mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(core): Add telemetry events for archive and unarchive (no-changelog) (#15224)
This commit is contained in:
@@ -700,6 +700,50 @@ describe('TelemetryEventRelay', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should track on `workflow-archived` event', () => {
|
||||||
|
const event: RelayEventMap['workflow-archived'] = {
|
||||||
|
user: {
|
||||||
|
id: 'user123',
|
||||||
|
email: 'user@example.com',
|
||||||
|
firstName: 'John',
|
||||||
|
lastName: 'Doe',
|
||||||
|
role: 'global:owner',
|
||||||
|
},
|
||||||
|
workflowId: 'workflow123',
|
||||||
|
publicApi: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
eventService.emit('workflow-archived', event);
|
||||||
|
|
||||||
|
expect(telemetry.track).toHaveBeenCalledWith('User archived workflow', {
|
||||||
|
user_id: 'user123',
|
||||||
|
workflow_id: 'workflow123',
|
||||||
|
public_api: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should track on `workflow-unarchived` event', () => {
|
||||||
|
const event: RelayEventMap['workflow-unarchived'] = {
|
||||||
|
user: {
|
||||||
|
id: 'user123',
|
||||||
|
email: 'user@example.com',
|
||||||
|
firstName: 'John',
|
||||||
|
lastName: 'Doe',
|
||||||
|
role: 'global:owner',
|
||||||
|
},
|
||||||
|
workflowId: 'workflow123',
|
||||||
|
publicApi: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
eventService.emit('workflow-unarchived', event);
|
||||||
|
|
||||||
|
expect(telemetry.track).toHaveBeenCalledWith('User unarchived workflow', {
|
||||||
|
user_id: 'user123',
|
||||||
|
workflow_id: 'workflow123',
|
||||||
|
public_api: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should track on `workflow-deleted` event', () => {
|
it('should track on `workflow-deleted` event', () => {
|
||||||
const event: RelayEventMap['workflow-deleted'] = {
|
const event: RelayEventMap['workflow-deleted'] = {
|
||||||
user: {
|
user: {
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ export class TelemetryEventRelay extends EventRelay {
|
|||||||
'ldap-login-sync-failed': (event) => this.ldapLoginSyncFailed(event),
|
'ldap-login-sync-failed': (event) => this.ldapLoginSyncFailed(event),
|
||||||
'login-failed-due-to-ldap-disabled': (event) => this.loginFailedDueToLdapDisabled(event),
|
'login-failed-due-to-ldap-disabled': (event) => this.loginFailedDueToLdapDisabled(event),
|
||||||
'workflow-created': (event) => this.workflowCreated(event),
|
'workflow-created': (event) => this.workflowCreated(event),
|
||||||
|
'workflow-archived': (event) => this.workflowArchived(event),
|
||||||
|
'workflow-unarchived': (event) => this.workflowUnarchived(event),
|
||||||
'workflow-deleted': (event) => this.workflowDeleted(event),
|
'workflow-deleted': (event) => this.workflowDeleted(event),
|
||||||
'workflow-sharing-updated': (event) => this.workflowSharingUpdated(event),
|
'workflow-sharing-updated': (event) => this.workflowSharingUpdated(event),
|
||||||
'workflow-saved': async (event) => await this.workflowSaved(event),
|
'workflow-saved': async (event) => await this.workflowSaved(event),
|
||||||
@@ -532,6 +534,26 @@ export class TelemetryEventRelay extends EventRelay {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private workflowArchived({ user, workflowId, publicApi }: RelayEventMap['workflow-archived']) {
|
||||||
|
this.telemetry.track('User archived workflow', {
|
||||||
|
user_id: user.id,
|
||||||
|
workflow_id: workflowId,
|
||||||
|
public_api: publicApi,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private workflowUnarchived({
|
||||||
|
user,
|
||||||
|
workflowId,
|
||||||
|
publicApi,
|
||||||
|
}: RelayEventMap['workflow-unarchived']) {
|
||||||
|
this.telemetry.track('User unarchived workflow', {
|
||||||
|
user_id: user.id,
|
||||||
|
workflow_id: workflowId,
|
||||||
|
public_api: publicApi,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private workflowDeleted({ user, workflowId, publicApi }: RelayEventMap['workflow-deleted']) {
|
private workflowDeleted({ user, workflowId, publicApi }: RelayEventMap['workflow-deleted']) {
|
||||||
this.telemetry.track('User deleted workflow', {
|
this.telemetry.track('User deleted workflow', {
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user