n8n 2.45.0 → 2.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth.service.d.ts +4 -2
- package/dist/auth/auth.service.js +8 -3
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/modules/agents/agent-modification-telemetry.service.d.ts +3 -1
- package/dist/modules/agents/agent-modification-telemetry.service.js +10 -2
- package/dist/modules/agents/agent-modification-telemetry.service.js.map +1 -1
- package/dist/modules/breaking-changes/breaking-changes.controller.d.ts +11 -7
- package/dist/modules/breaking-changes/breaking-changes.controller.js +44 -14
- package/dist/modules/breaking-changes/breaking-changes.controller.js.map +1 -1
- package/dist/modules/breaking-changes/breaking-changes.migration.service.d.ts +1 -0
- package/dist/modules/breaking-changes/breaking-changes.migration.service.js +3 -2
- package/dist/modules/breaking-changes/breaking-changes.migration.service.js.map +1 -1
- package/dist/modules/breaking-changes/owners/migration-owner-assignment.service.d.ts +2 -1
- package/dist/modules/breaking-changes/owners/migration-owner-assignment.service.js +18 -1
- package/dist/modules/breaking-changes/owners/migration-owner-assignment.service.js.map +1 -1
- package/dist/modules/breaking-changes/owners/migration-owner-suggestion.service.js +2 -1
- package/dist/modules/breaking-changes/owners/migration-owner-suggestion.service.js.map +1 -1
- package/dist/modules/breaking-changes/owners/workflow-owner.d.ts +1 -0
- package/dist/modules/breaking-changes/owners/workflow-owner.js +4 -0
- package/dist/modules/breaking-changes/owners/workflow-owner.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.js +9 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
- package/dist/modules/mcp/mcp-api-key.service.js +4 -1
- package/dist/modules/mcp/mcp-api-key.service.js.map +1 -1
- package/dist/modules/mcp/mcp.controller.js +2 -0
- package/dist/modules/mcp/mcp.controller.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +1 -0
- package/dist/modules/mcp/mcp.service.js +18 -2
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp-discovery/activity-events.service.d.ts +14 -0
- package/dist/modules/mcp-discovery/activity-events.service.js +67 -0
- package/dist/modules/mcp-discovery/activity-events.service.js.map +1 -0
- package/dist/modules/mcp-discovery/activity.service.d.ts +16 -0
- package/dist/modules/mcp-discovery/activity.service.js +71 -0
- package/dist/modules/mcp-discovery/activity.service.js.map +1 -0
- package/dist/modules/mcp-discovery/eligibility.d.ts +21 -0
- package/dist/modules/mcp-discovery/eligibility.js +31 -0
- package/dist/modules/mcp-discovery/eligibility.js.map +1 -0
- package/dist/modules/mcp-discovery/enrollment.service.d.ts +19 -0
- package/dist/modules/mcp-discovery/enrollment.service.js +100 -0
- package/dist/modules/mcp-discovery/enrollment.service.js.map +1 -0
- package/dist/modules/mcp-discovery/events.d.ts +29 -0
- package/dist/modules/mcp-discovery/events.js +3 -0
- package/dist/modules/mcp-discovery/events.js.map +1 -0
- package/dist/modules/mcp-discovery/mcp-discovery.controller.d.ts +9 -0
- package/dist/modules/mcp-discovery/mcp-discovery.controller.js +39 -0
- package/dist/modules/mcp-discovery/mcp-discovery.controller.js.map +1 -0
- package/dist/modules/mcp-discovery/mcp-discovery.dto.d.ts +11 -0
- package/dist/modules/mcp-discovery/mcp-discovery.dto.js +12 -0
- package/dist/modules/mcp-discovery/mcp-discovery.dto.js.map +1 -0
- package/dist/modules/mcp-discovery/mcp-discovery.module.d.ts +4 -0
- package/dist/modules/mcp-discovery/mcp-discovery.module.js +26 -0
- package/dist/modules/mcp-discovery/mcp-discovery.module.js.map +1 -0
- package/dist/modules/mcp-discovery/types.d.ts +6 -0
- package/dist/modules/mcp-discovery/types.js +3 -0
- package/dist/modules/mcp-discovery/types.js.map +1 -0
- package/package.json +27 -27
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventService } from '@n8n/backend-services';
|
|
1
2
|
import type { AgentActor, AgentIntegrationConfig, AgentJsonConfig } from '@n8n/api-types';
|
|
2
3
|
import type { User } from '@n8n/db';
|
|
3
4
|
import { Telemetry } from '../../telemetry';
|
|
@@ -420,7 +421,8 @@ export type AgentSidecarChanges = Partial<Record<'tools' | 'skills' | 'tasks', b
|
|
|
420
421
|
export declare function buildAgentMutationEvent(agent: Agent, skillRefs: AgentSkillRefs, projectId: string, context: AgentMutationTelemetryContext, previous: AgentMutationSnapshot, sidecarChanges: AgentSidecarChanges): AgentModificationEvent;
|
|
421
422
|
export declare class AgentModificationTelemetryService {
|
|
422
423
|
private readonly telemetry;
|
|
423
|
-
|
|
424
|
+
private readonly eventService;
|
|
425
|
+
constructor(telemetry: Telemetry, eventService: EventService);
|
|
424
426
|
record(event: AgentModificationEvent): void;
|
|
425
427
|
private recordCreation;
|
|
426
428
|
}
|
|
@@ -16,6 +16,7 @@ exports.AgentModificationTelemetryService = exports.isUnconfiguredAgent = void 0
|
|
|
16
16
|
exports.diffAgentConfigParts = diffAgentConfigParts;
|
|
17
17
|
exports.captureAgentMutation = captureAgentMutation;
|
|
18
18
|
exports.buildAgentMutationEvent = buildAgentMutationEvent;
|
|
19
|
+
const backend_services_1 = require("@n8n/backend-services");
|
|
19
20
|
const di_1 = require("@n8n/di");
|
|
20
21
|
const telemetry_1 = require("@n8n/telemetry");
|
|
21
22
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
@@ -78,8 +79,9 @@ function modificationProperties({ agent, config, projectId, user, changedParts,
|
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
81
|
let AgentModificationTelemetryService = class AgentModificationTelemetryService {
|
|
81
|
-
constructor(telemetry) {
|
|
82
|
+
constructor(telemetry, eventService) {
|
|
82
83
|
this.telemetry = telemetry;
|
|
84
|
+
this.eventService = eventService;
|
|
83
85
|
}
|
|
84
86
|
record(event) {
|
|
85
87
|
if (event.changedParts.length === 0)
|
|
@@ -88,6 +90,12 @@ let AgentModificationTelemetryService = class AgentModificationTelemetryService
|
|
|
88
90
|
const { agent, config, by, wasUnconfigured } = event;
|
|
89
91
|
if (wasUnconfigured && (0, agent_capabilities_1.isUnconfiguredAgent)(config, agent.integrations))
|
|
90
92
|
return;
|
|
93
|
+
if (by === 'builder') {
|
|
94
|
+
this.eventService.emit('experiment-assistant-change-saved', {
|
|
95
|
+
userId: event.user.id,
|
|
96
|
+
at: Date.now(),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
91
99
|
const properties = modificationProperties(event);
|
|
92
100
|
if (wasUnconfigured) {
|
|
93
101
|
this.recordCreation(by, properties);
|
|
@@ -129,6 +137,6 @@ let AgentModificationTelemetryService = class AgentModificationTelemetryService
|
|
|
129
137
|
exports.AgentModificationTelemetryService = AgentModificationTelemetryService;
|
|
130
138
|
exports.AgentModificationTelemetryService = AgentModificationTelemetryService = __decorate([
|
|
131
139
|
(0, di_1.Service)(),
|
|
132
|
-
__metadata("design:paramtypes", [telemetry_2.Telemetry])
|
|
140
|
+
__metadata("design:paramtypes", [telemetry_2.Telemetry, backend_services_1.EventService])
|
|
133
141
|
], AgentModificationTelemetryService);
|
|
134
142
|
//# sourceMappingURL=agent-modification-telemetry.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-modification-telemetry.service.js","sourceRoot":"","sources":["../../../src/modules/agents/agent-modification-telemetry.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"agent-modification-telemetry.service.js","sourceRoot":"","sources":["../../../src/modules/agents/agent-modification-telemetry.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,4DAAqD;AAIrD,gCAAkC;AAClC,8CAAiD;AACjD,6DAAqC;AAErC,2CAAwC;AAExC,uDAA4E;AAE5E,iEAAoF;AACpF,mEAAiE;oGAAxD,wCAAmB;AA+B5B,MAAM,YAAY,GAAG;IACpB,cAAc;IACd,OAAO;IACP,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,OAAO;IACP,eAAe;IACf,QAAQ;IACR,O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AAC;IACF,CAAC;CACD,CAAA;;4CAnEY,iCAAiC;IAD7C,IAAA,YAAO,GAAE;qCAGoB,qBAAS,EAEN,+BAAY;GAJhC,iCAAiC,CAmE7C"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AssignMigrationOwnerDto, BreakingChangeLightReportResult, BreakingChangeReportQueryDto, BreakingChangeRuleDetailResult, MigrationNotifyResult, MigrationWorkflowOwnerResponse, NotifyMigrationOwnersRequestDto, UpdateMigrationFindingStatusRequestDto, UpdateMigrationFindingStatusesRequestDto, WorkflowMigrationResult } from '@n8n/api-types';
|
|
2
|
-
import { EventService
|
|
1
|
+
import { AssignMigrationOwnerDto, BreakingChangeLightReportResult, BreakingChangeReportQueryDto, BreakingChangeRuleDetailResult, MigrationNotifyResult, MigrationOwnerCandidate, MigrationWorkflowOwnerResponse, NotifyMigrationOwnersRequestDto, UpdateMigrationFindingStatusRequestDto, UpdateMigrationFindingStatusesRequestDto, WorkflowMigrationResult } from '@n8n/api-types';
|
|
2
|
+
import { EventService } from '@n8n/backend-services';
|
|
3
3
|
import { AuthenticatedRequest } from '@n8n/db';
|
|
4
4
|
import { Response } from 'express';
|
|
5
|
+
import { WorkflowFinderService } from '../../workflows/workflow-finder.service';
|
|
5
6
|
import { BreakingChangeMigrationService } from './breaking-changes.migration.service';
|
|
6
7
|
import { RuleRegistry } from './breaking-changes.rule-registry.service';
|
|
7
8
|
import { MigrationFindingNotificationService } from './notifications/migration-finding-notification.service';
|
|
@@ -15,19 +16,22 @@ export declare class BreakingChangesController {
|
|
|
15
16
|
private readonly queryService;
|
|
16
17
|
private readonly ruleRegistry;
|
|
17
18
|
private readonly triageService;
|
|
18
|
-
private readonly workflowSharingService;
|
|
19
19
|
private readonly eventService;
|
|
20
20
|
private readonly ownerAssignmentService;
|
|
21
21
|
private readonly notificationService;
|
|
22
|
-
|
|
22
|
+
private readonly workflowFinderService;
|
|
23
|
+
constructor(migrationService: BreakingChangeMigrationService, syncService: MigrationFindingSyncService, queryService: MigrationFindingQueryService, ruleRegistry: RuleRegistry, triageService: MigrationFindingTriageService, eventService: EventService, ownerAssignmentService: MigrationOwnerAssignmentService, notificationService: MigrationFindingNotificationService, workflowFinderService: WorkflowFinderService);
|
|
23
24
|
private scopeFor;
|
|
25
|
+
private editableWorkflowIds;
|
|
26
|
+
private assertCanEdit;
|
|
24
27
|
getDetectionReport(req: AuthenticatedRequest, _res: Response, query: BreakingChangeReportQueryDto): Promise<BreakingChangeLightReportResult>;
|
|
25
28
|
regenerate(req: AuthenticatedRequest, _res: Response, query: BreakingChangeReportQueryDto): Promise<BreakingChangeLightReportResult>;
|
|
26
29
|
getDetectionReportForRule(req: AuthenticatedRequest, _res: Response, ruleId: string): Promise<BreakingChangeRuleDetailResult>;
|
|
27
|
-
updateFindingStatuses(
|
|
30
|
+
updateFindingStatuses(req: AuthenticatedRequest, _res: Response, ruleId: string, body: UpdateMigrationFindingStatusesRequestDto): Promise<void>;
|
|
28
31
|
notifyOwners(req: AuthenticatedRequest, _res: Response, ruleId: string, body: NotifyMigrationOwnersRequestDto): Promise<MigrationNotifyResult>;
|
|
29
|
-
updateFindingStatus(
|
|
32
|
+
updateFindingStatus(req: AuthenticatedRequest, _res: Response, ruleId: string, workflowId: string, body: UpdateMigrationFindingStatusRequestDto): Promise<void>;
|
|
33
|
+
listOwnerCandidates(req: AuthenticatedRequest, _res: Response, workflowId: string): Promise<MigrationOwnerCandidate[]>;
|
|
30
34
|
assignOwner(req: AuthenticatedRequest, _res: Response, workflowId: string, body: AssignMigrationOwnerDto): Promise<MigrationWorkflowOwnerResponse>;
|
|
31
|
-
unassignOwner(
|
|
35
|
+
unassignOwner(req: AuthenticatedRequest, _res: Response, workflowId: string): Promise<MigrationWorkflowOwnerResponse>;
|
|
32
36
|
migrateWorkflow(req: AuthenticatedRequest, _res: Response, ruleId: string, workflowId: string): Promise<WorkflowMigrationResult>;
|
|
33
37
|
}
|
|
@@ -18,6 +18,7 @@ const backend_services_1 = require("@n8n/backend-services");
|
|
|
18
18
|
const decorators_1 = require("@n8n/decorators");
|
|
19
19
|
const errors_1 = require("@n8n/errors");
|
|
20
20
|
const permissions_1 = require("@n8n/permissions");
|
|
21
|
+
const workflow_finder_service_1 = require("../../workflows/workflow-finder.service");
|
|
21
22
|
const breaking_changes_migration_service_1 = require("./breaking-changes.migration.service");
|
|
22
23
|
const breaking_changes_rule_registry_service_1 = require("./breaking-changes.rule-registry.service");
|
|
23
24
|
const migration_finding_notification_service_1 = require("./notifications/migration-finding-notification.service");
|
|
@@ -28,24 +29,35 @@ const migration_finding_triage_service_1 = require("./triage/migration-finding-t
|
|
|
28
29
|
const types_1 = require("./types");
|
|
29
30
|
const DEFAULT_TARGET_VERSION = 'v2';
|
|
30
31
|
let BreakingChangesController = class BreakingChangesController {
|
|
31
|
-
constructor(migrationService, syncService, queryService, ruleRegistry, triageService,
|
|
32
|
+
constructor(migrationService, syncService, queryService, ruleRegistry, triageService, eventService, ownerAssignmentService, notificationService, workflowFinderService) {
|
|
32
33
|
this.migrationService = migrationService;
|
|
33
34
|
this.syncService = syncService;
|
|
34
35
|
this.queryService = queryService;
|
|
35
36
|
this.ruleRegistry = ruleRegistry;
|
|
36
37
|
this.triageService = triageService;
|
|
37
|
-
this.workflowSharingService = workflowSharingService;
|
|
38
38
|
this.eventService = eventService;
|
|
39
39
|
this.ownerAssignmentService = ownerAssignmentService;
|
|
40
40
|
this.notificationService = notificationService;
|
|
41
|
+
this.workflowFinderService = workflowFinderService;
|
|
41
42
|
}
|
|
42
43
|
async scopeFor(user) {
|
|
43
44
|
if ((0, permissions_1.hasGlobalScope)(user, 'workflow:update'))
|
|
44
45
|
return { kind: 'instance' };
|
|
45
|
-
const workflowIds = await this.
|
|
46
|
+
const workflowIds = await this.workflowFinderService.findAllWorkflowIdsForUser(user, [
|
|
46
47
|
'workflow:update',
|
|
47
48
|
]);
|
|
48
|
-
return { kind: 'workflows', workflowIds
|
|
49
|
+
return { kind: 'workflows', workflowIds };
|
|
50
|
+
}
|
|
51
|
+
async editableWorkflowIds(user, workflowIds) {
|
|
52
|
+
if ((0, permissions_1.hasGlobalScope)(user, 'workflow:update'))
|
|
53
|
+
return workflowIds;
|
|
54
|
+
const editable = await this.workflowFinderService.findWorkflowIdsWithScopeForUser(workflowIds, user, ['workflow:update']);
|
|
55
|
+
return workflowIds.filter((workflowId) => editable.has(workflowId));
|
|
56
|
+
}
|
|
57
|
+
async assertCanEdit(user, workflowId) {
|
|
58
|
+
const [editable] = await this.editableWorkflowIds(user, [workflowId]);
|
|
59
|
+
if (!editable)
|
|
60
|
+
throw new errors_1.NotFoundError(breaking_changes_migration_service_1.WORKFLOW_NOT_EDITABLE_MESSAGE);
|
|
49
61
|
}
|
|
50
62
|
async getDetectionReport(req, _res, query) {
|
|
51
63
|
const version = query.version ?? DEFAULT_TARGET_VERSION;
|
|
@@ -86,20 +98,30 @@ let BreakingChangesController = class BreakingChangesController {
|
|
|
86
98
|
await this.syncService.syncIfStale(version);
|
|
87
99
|
return await this.queryService.getRuleFindings(version, ruleId, scope);
|
|
88
100
|
}
|
|
89
|
-
async updateFindingStatuses(
|
|
90
|
-
await this.
|
|
101
|
+
async updateFindingStatuses(req, _res, ruleId, body) {
|
|
102
|
+
const workflowIds = await this.editableWorkflowIds(req.user, body.workflowIds);
|
|
103
|
+
if (workflowIds.length === 0)
|
|
104
|
+
return;
|
|
105
|
+
await this.triageService.setStatuses(ruleId, workflowIds, body.status);
|
|
91
106
|
}
|
|
92
107
|
async notifyOwners(req, _res, ruleId, body) {
|
|
93
108
|
return await this.notificationService.notifyOwners(ruleId, body.workflowIds, req.user);
|
|
94
109
|
}
|
|
95
|
-
async updateFindingStatus(
|
|
110
|
+
async updateFindingStatus(req, _res, ruleId, workflowId, body) {
|
|
111
|
+
await this.assertCanEdit(req.user, workflowId);
|
|
96
112
|
await this.triageService.setStatus(ruleId, workflowId, body.status);
|
|
97
113
|
}
|
|
114
|
+
async listOwnerCandidates(req, _res, workflowId) {
|
|
115
|
+
await this.assertCanEdit(req.user, workflowId);
|
|
116
|
+
return await this.ownerAssignmentService.candidates(workflowId);
|
|
117
|
+
}
|
|
98
118
|
async assignOwner(req, _res, workflowId, body) {
|
|
119
|
+
await this.assertCanEdit(req.user, workflowId);
|
|
99
120
|
const owner = await this.ownerAssignmentService.assign(workflowId, body.userId, req.user);
|
|
100
121
|
return { owner };
|
|
101
122
|
}
|
|
102
|
-
async unassignOwner(
|
|
123
|
+
async unassignOwner(req, _res, workflowId) {
|
|
124
|
+
await this.assertCanEdit(req.user, workflowId);
|
|
103
125
|
const owner = await this.ownerAssignmentService.unassign(workflowId);
|
|
104
126
|
return { owner };
|
|
105
127
|
}
|
|
@@ -134,7 +156,7 @@ __decorate([
|
|
|
134
156
|
], BreakingChangesController.prototype, "getDetectionReportForRule", null);
|
|
135
157
|
__decorate([
|
|
136
158
|
(0, decorators_1.Patch)('/report/:ruleId/workflows'),
|
|
137
|
-
(0, decorators_1.GlobalScope)('breakingChanges:
|
|
159
|
+
(0, decorators_1.GlobalScope)('breakingChanges:list'),
|
|
138
160
|
__param(2, (0, decorators_1.Param)('ruleId')),
|
|
139
161
|
__param(3, decorators_1.Body),
|
|
140
162
|
__metadata("design:type", Function),
|
|
@@ -152,7 +174,7 @@ __decorate([
|
|
|
152
174
|
], BreakingChangesController.prototype, "notifyOwners", null);
|
|
153
175
|
__decorate([
|
|
154
176
|
(0, decorators_1.Patch)('/report/:ruleId/workflows/:workflowId'),
|
|
155
|
-
(0, decorators_1.GlobalScope)('breakingChanges:
|
|
177
|
+
(0, decorators_1.GlobalScope)('breakingChanges:list'),
|
|
156
178
|
__param(2, (0, decorators_1.Param)('ruleId')),
|
|
157
179
|
__param(3, (0, decorators_1.Param)('workflowId')),
|
|
158
180
|
__param(4, decorators_1.Body),
|
|
@@ -160,9 +182,17 @@ __decorate([
|
|
|
160
182
|
__metadata("design:paramtypes", [Object, Object, String, String, api_types_1.UpdateMigrationFindingStatusRequestDto]),
|
|
161
183
|
__metadata("design:returntype", Promise)
|
|
162
184
|
], BreakingChangesController.prototype, "updateFindingStatus", null);
|
|
185
|
+
__decorate([
|
|
186
|
+
(0, decorators_1.Get)('/workflows/:workflowId/owner/candidates'),
|
|
187
|
+
(0, decorators_1.GlobalScope)('breakingChanges:list'),
|
|
188
|
+
__param(2, (0, decorators_1.Param)('workflowId')),
|
|
189
|
+
__metadata("design:type", Function),
|
|
190
|
+
__metadata("design:paramtypes", [Object, Object, String]),
|
|
191
|
+
__metadata("design:returntype", Promise)
|
|
192
|
+
], BreakingChangesController.prototype, "listOwnerCandidates", null);
|
|
163
193
|
__decorate([
|
|
164
194
|
(0, decorators_1.Put)('/workflows/:workflowId/owner'),
|
|
165
|
-
(0, decorators_1.GlobalScope)('breakingChanges:
|
|
195
|
+
(0, decorators_1.GlobalScope)('breakingChanges:list'),
|
|
166
196
|
__param(2, (0, decorators_1.Param)('workflowId')),
|
|
167
197
|
__param(3, decorators_1.Body),
|
|
168
198
|
__metadata("design:type", Function),
|
|
@@ -171,7 +201,7 @@ __decorate([
|
|
|
171
201
|
], BreakingChangesController.prototype, "assignOwner", null);
|
|
172
202
|
__decorate([
|
|
173
203
|
(0, decorators_1.Delete)('/workflows/:workflowId/owner'),
|
|
174
|
-
(0, decorators_1.GlobalScope)('breakingChanges:
|
|
204
|
+
(0, decorators_1.GlobalScope)('breakingChanges:list'),
|
|
175
205
|
__param(2, (0, decorators_1.Param)('workflowId')),
|
|
176
206
|
__metadata("design:type", Function),
|
|
177
207
|
__metadata("design:paramtypes", [Object, Object, String]),
|
|
@@ -179,7 +209,7 @@ __decorate([
|
|
|
179
209
|
], BreakingChangesController.prototype, "unassignOwner", null);
|
|
180
210
|
__decorate([
|
|
181
211
|
(0, decorators_1.Post)('/report/:ruleId/workflows/:workflowId/migrate'),
|
|
182
|
-
(0, decorators_1.GlobalScope)('breakingChanges:
|
|
212
|
+
(0, decorators_1.GlobalScope)('breakingChanges:list'),
|
|
183
213
|
__param(2, (0, decorators_1.Param)('ruleId')),
|
|
184
214
|
__param(3, (0, decorators_1.Param)('workflowId')),
|
|
185
215
|
__metadata("design:type", Function),
|
|
@@ -188,6 +218,6 @@ __decorate([
|
|
|
188
218
|
], BreakingChangesController.prototype, "migrateWorkflow", null);
|
|
189
219
|
exports.BreakingChangesController = BreakingChangesController = __decorate([
|
|
190
220
|
(0, decorators_1.RestController)('/breaking-changes'),
|
|
191
|
-
__metadata("design:paramtypes", [breaking_changes_migration_service_1.BreakingChangeMigrationService, migration_finding_sync_service_1.MigrationFindingSyncService, migration_finding_query_service_1.MigrationFindingQueryService, breaking_changes_rule_registry_service_1.RuleRegistry, migration_finding_triage_service_1.MigrationFindingTriageService, backend_services_1.
|
|
221
|
+
__metadata("design:paramtypes", [breaking_changes_migration_service_1.BreakingChangeMigrationService, migration_finding_sync_service_1.MigrationFindingSyncService, migration_finding_query_service_1.MigrationFindingQueryService, breaking_changes_rule_registry_service_1.RuleRegistry, migration_finding_triage_service_1.MigrationFindingTriageService, backend_services_1.EventService, migration_owner_assignment_service_1.MigrationOwnerAssignmentService, migration_finding_notification_service_1.MigrationFindingNotificationService, workflow_finder_service_1.WorkflowFinderService])
|
|
192
222
|
], BreakingChangesController);
|
|
193
223
|
//# sourceMappingURL=breaking-changes.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breaking-changes.controller.js","sourceRoot":"","sources":["../../../src/modules/breaking-changes/breaking-changes.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"breaking-changes.controller.js","sourceRoot":"","sources":["../../../src/modules/breaking-changes/breaking-changes.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8CAawB;AACxB,4DAAqD;AAErD,gDAWyB;AACzB,wCAA4D;AAC5D,kDAAkD;AAGlD,iFAA4E;AAE5E,6FAG8C;AAC9C,qGAAwE;AACxE,mHAA6G;AAC7G,oGAA8F;AAC9F,6FAGiD;AACjD,0FAA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A;IACf,WAAA,IAAA,kBAAK,EAAC,YAAY,CAAC,CAAA;IACnB,WAAA,iBAAI,CAAA;;qEAAO,kDAAsC;;oEAIlD;AAKK;IAFL,IAAA,gBAAG,EAAC,yCAAyC,CAAC;IAC9C,IAAA,wBAAW,EAAC,sBAAsB,CAAC;IAIlC,WAAA,IAAA,kBAAK,EAAC,YAAY,CAAC,CAAA;;;;oEAIpB;AAKK;IAFL,IAAA,gBAAG,EAAC,8BAA8B,CAAC;IACnC,IAAA,wBAAW,EAAC,sBAAsB,CAAC;IAIlC,WAAA,IAAA,kBAAK,EAAC,YAAY,CAAC,CAAA;IACnB,WAAA,iBAAI,CAAA;;6DAAO,mCAAuB;;4DAKnC;AAKK;IAFL,IAAA,mBAAM,EAAC,8BAA8B,CAAC;IACtC,IAAA,wBAAW,EAAC,sBAAsB,CAAC;IAIlC,WAAA,IAAA,kBAAK,EAAC,YAAY,CAAC,CAAA;;;;8DAKpB;AASK;IAFL,IAAA,iBAAI,EAAC,+CAA+C,CAAC;IACrD,IAAA,wBAAW,EAAC,sBAAsB,CAAC;IAIlC,WAAA,IAAA,kBAAK,EAAC,QAAQ,CAAC,CAAA;IACf,WAAA,IAAA,kBAAK,EAAC,YAAY,CAAC,CAAA;;;;gEAGpB;oCAvNW,yBAAyB;IADrC,IAAA,2BAAc,EAAC,mBAAmB,CAAC;qCAGC,mEAA8B,EACnC,4DAA2B,EAC1B,8DAA4B,EAC5B,qDAAY,EACX,gEAA6B,EAC9B,+BAAY,EACF,oEAA+B,EAClC,4EAAmC,EACjC,+CAAqB;GAVlD,yBAAyB,CAwNrC"}
|
|
@@ -9,6 +9,7 @@ import { MigrationRegistry } from './breaking-changes.migration-registry.service
|
|
|
9
9
|
import { RuleRegistry } from './breaking-changes.rule-registry.service';
|
|
10
10
|
import { WorkflowMigrationNodeError } from './migrations/node-migration';
|
|
11
11
|
export { WorkflowMigrationNodeError };
|
|
12
|
+
export declare const WORKFLOW_NOT_EDITABLE_MESSAGE = "Workflow not found, or you do not have permission to update it.";
|
|
12
13
|
export declare class BreakingChangeMigrationService {
|
|
13
14
|
private readonly ruleRegistry;
|
|
14
15
|
private readonly migrationRegistry;
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BreakingChangeMigrationService = exports.WorkflowMigrationNodeError = void 0;
|
|
12
|
+
exports.BreakingChangeMigrationService = exports.WORKFLOW_NOT_EDITABLE_MESSAGE = exports.WorkflowMigrationNodeError = void 0;
|
|
13
13
|
const backend_common_1 = require("@n8n/backend-common");
|
|
14
14
|
const di_1 = require("@n8n/di");
|
|
15
15
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
@@ -23,6 +23,7 @@ const breaking_changes_rule_registry_service_1 = require("./breaking-changes.rul
|
|
|
23
23
|
const group_nodes_by_type_1 = require("./group-nodes-by-type");
|
|
24
24
|
const node_migration_1 = require("./migrations/node-migration");
|
|
25
25
|
Object.defineProperty(exports, "WorkflowMigrationNodeError", { enumerable: true, get: function () { return node_migration_1.WorkflowMigrationNodeError; } });
|
|
26
|
+
exports.WORKFLOW_NOT_EDITABLE_MESSAGE = 'Workflow not found, or you do not have permission to update it.';
|
|
26
27
|
let BreakingChangeMigrationService = class BreakingChangeMigrationService {
|
|
27
28
|
constructor(ruleRegistry, migrationRegistry, workflowFinderService, workflowService, workflowValidationService, nodeTypes, logger) {
|
|
28
29
|
this.ruleRegistry = ruleRegistry;
|
|
@@ -47,7 +48,7 @@ let BreakingChangeMigrationService = class BreakingChangeMigrationService {
|
|
|
47
48
|
'workflow:update',
|
|
48
49
|
]);
|
|
49
50
|
if (!workflow) {
|
|
50
|
-
throw new errors_1.NotFoundError(
|
|
51
|
+
throw new errors_1.NotFoundError(exports.WORKFLOW_NOT_EDITABLE_MESSAGE);
|
|
51
52
|
}
|
|
52
53
|
const wasPublishedVersion = !!workflow.activeVersionId && workflow.activeVersionId === workflow.versionId;
|
|
53
54
|
const detection = await rule.detectWorkflow(workflow, (0, group_nodes_by_type_1.groupNodesByType)(workflow.nodes));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breaking-changes.migration.service.js","sourceRoot":"","sources":["../../../src/modules/breaking-changes/breaking-changes.migration.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wDAA6C;AAE7C,gCAAkC;AAClC,+CAAyD;AAGzD,wCAA6D;AAC7D,6CAAyC;AACzC,iFAA4E;AAC5E,yFAAoF;AACpF,mEAA+D;AAE/D,+GAAkF;AAClF,qGAAwE;AACxE,+DAAyD;AAMzD,gEAA8F;2GAAhE,2CAA0B;
|
|
1
|
+
{"version":3,"file":"breaking-changes.migration.service.js","sourceRoot":"","sources":["../../../src/modules/breaking-changes/breaking-changes.migration.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wDAA6C;AAE7C,gCAAkC;AAClC,+CAAyD;AAGzD,wCAA6D;AAC7D,6CAAyC;AACzC,iFAA4E;AAC5E,yFAAoF;AACpF,mEAA+D;AAE/D,+GAAkF;AAClF,qGAAwE;AACxE,+DAAyD;AAMzD,gEAA8F;2GAAhE,2CAA0B;AAK3C,QAAA,6BAA6B,GACzC,iEAAiE,CAAC;AAG5D,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAC1C,YACkB,YAA0B,EAC1B,iBAAoC,EACpC,qBAA4C,EAC5C,eAAgC,EAChC,yBAAoD,EACpD,SAAoB,EACpB,MAAc;4BANd,YAAY;iCACZ,iBAAiB;qCACjB,qBAAqB;+BACrB,eAAe;yCACf,yBAAyB;yBACzB,SAAS;sBACT,MAAM;QAEvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACjD,CAAC;IAMD,KAAK,CAAC,eAAe,CACpB,MAAc,EACd,UA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AAM,CAAC,IAAI,CAAC,WAAW;gBACpC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU;aAClB,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,OAAO;YACN,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,eAAe;YACf,QAAQ;YACR,KAAK;SACL,CAAC;IACH,CAAC;IAGO,sBAAsB,CAC7B,SAA4B,EAC5B,QAAwB,EACxB,eAA4B;QAE5B,IAAI,CAAC;YACJ,OAAO,SAAS,CAAC,eAAe,CAAC;gBAChC,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,WAAW,EAAE,QAAQ,CAAC,WAAW;gBACjC,eAAe;aACf,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,KAAK,YAAY,2CAA0B;gBAAE,MAAM,KAAK,CAAC;YAC7D,MAAM,IAAI,wBAAe,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;QACzF,CAAC;IACF,CAAC;CACD,CAAA;;yCArKY,8BAA8B;IAD1C,IAAA,YAAO,GAAE;qCAGuB,qDAAY,EACP,+DAAiB,EACb,+CAAqB,EAC3B,kCAAe,EACL,uDAAyB,EACzC,sBAAS,EACZ,uBAAM;GARpB,8BAA8B,CAqK1C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BreakingChangeWorkflowOwner } from '@n8n/api-types';
|
|
1
|
+
import type { BreakingChangeWorkflowOwner, MigrationOwnerCandidate } from '@n8n/api-types';
|
|
2
2
|
import { WorkflowSharingService } from '@n8n/backend-services';
|
|
3
3
|
import { UserRepository, WorkflowRepository, type User } from '@n8n/db';
|
|
4
4
|
import { MigrationWorkflowOwnerRepository } from '../database/repositories/migration-workflow-owner.repository';
|
|
@@ -11,6 +11,7 @@ export declare class MigrationOwnerAssignmentService {
|
|
|
11
11
|
private readonly workflowSharingService;
|
|
12
12
|
constructor(workflowRepository: WorkflowRepository, userRepository: UserRepository, ownerRepository: MigrationWorkflowOwnerRepository, suggestionService: MigrationOwnerSuggestionService, workflowSharingService: WorkflowSharingService);
|
|
13
13
|
assign(workflowId: string, userId: string, assignedBy: User): Promise<BreakingChangeWorkflowOwner>;
|
|
14
|
+
candidates(workflowId: string): Promise<MigrationOwnerCandidate[]>;
|
|
14
15
|
unassign(workflowId: string): Promise<BreakingChangeWorkflowOwner | null>;
|
|
15
16
|
private ensureWorkflowExists;
|
|
16
17
|
private findUser;
|
|
@@ -30,6 +30,9 @@ let MigrationOwnerAssignmentService = class MigrationOwnerAssignmentService {
|
|
|
30
30
|
const user = await this.findUser(userId);
|
|
31
31
|
if (!user)
|
|
32
32
|
throw new errors_1.NotFoundError(`User with ID '${userId}' not found.`);
|
|
33
|
+
if (!(0, workflow_owner_1.canOwnFindings)(user)) {
|
|
34
|
+
throw new errors_1.BadRequestError('The user cannot sign in, so they cannot own the workflow');
|
|
35
|
+
}
|
|
33
36
|
const allowedUserIds = await this.workflowSharingService.getUserIdsWithAccessToWorkflow(workflowId);
|
|
34
37
|
if (!allowedUserIds.includes(userId)) {
|
|
35
38
|
throw new errors_1.BadRequestError('The user has no access to the workflow');
|
|
@@ -37,6 +40,17 @@ let MigrationOwnerAssignmentService = class MigrationOwnerAssignmentService {
|
|
|
37
40
|
await this.ownerRepository.assign(workflowId, userId, assignedBy.id, {});
|
|
38
41
|
return (0, workflow_owner_1.toWorkflowOwner)(user, 'assigned');
|
|
39
42
|
}
|
|
43
|
+
async candidates(workflowId) {
|
|
44
|
+
await this.ensureWorkflowExists(workflowId);
|
|
45
|
+
const userIds = await this.workflowSharingService.getUserIdsWithAccessToWorkflow(workflowId);
|
|
46
|
+
const users = await this.userRepository.findManyByIds(userIds, {
|
|
47
|
+
includeRole: true,
|
|
48
|
+
includeAuthIdentities: true,
|
|
49
|
+
});
|
|
50
|
+
return users
|
|
51
|
+
.filter(workflow_owner_1.canOwnFindings)
|
|
52
|
+
.map(({ id, firstName, lastName, email }) => ({ id, firstName, lastName, email }));
|
|
53
|
+
}
|
|
40
54
|
async unassign(workflowId) {
|
|
41
55
|
await this.ensureWorkflowExists(workflowId);
|
|
42
56
|
const suggestions = await this.suggestionService.suggestOwners([workflowId]);
|
|
@@ -52,7 +66,10 @@ let MigrationOwnerAssignmentService = class MigrationOwnerAssignmentService {
|
|
|
52
66
|
}
|
|
53
67
|
}
|
|
54
68
|
async findUser(userId) {
|
|
55
|
-
const [user] = await this.userRepository.findManyByIds([userId]
|
|
69
|
+
const [user] = await this.userRepository.findManyByIds([userId], {
|
|
70
|
+
includeRole: true,
|
|
71
|
+
includeAuthIdentities: true,
|
|
72
|
+
});
|
|
56
73
|
return user;
|
|
57
74
|
}
|
|
58
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-owner-assignment.service.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/owners/migration-owner-assignment.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4DAA+D;AAC/D,gCAAwE;AACxE,gCAAkC;AAClC,wCAA6D;AAE7D,sHAAgH;AAChH,6FAAuF;AACvF,
|
|
1
|
+
{"version":3,"file":"migration-owner-assignment.service.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/owners/migration-owner-assignment.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,4DAA+D;AAC/D,gCAAwE;AACxE,gCAAkC;AAClC,wCAA6D;AAE7D,sHAAgH;AAChH,6FAAuF;AACvF,qDAAmE;AAI5D,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAC3C,YACkB,kBAAsC,EACtC,cAA8B,EAC9B,eAAiD,EACjD,iBAAkD,EAClD,sBAA8C;kCAJ9C,kBAAkB;8BAClB,cAAc;+BACd,eAAe;iCACf,iBAAiB;sCACjB,sBAAsB;IACrC,CAAC;IAEJ,KAAK,CAAC,MAAM,CACX,UAAkB,E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AChE,WAAW,EAAE,IAAI;YACjB,qBAAqB,EAAE,IAAI;SAC3B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAA;;0CA3EY,+BAA+B;IAD3C,IAAA,YAAO,GAAE;qCAG6B,uBAAkB,EACtB,mBAAc,EACb,sEAAgC,EAC9B,oEAA+B,EAC1B,yCAAsB;GANpD,+BAA+B,CA2E3C"}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MigrationOwnerSuggestionService = exports.RECENT_ACTIONS_PER_WORKFLOW = void 0;
|
|
13
13
|
const db_1 = require("@n8n/db");
|
|
14
14
|
const di_1 = require("@n8n/di");
|
|
15
|
+
const workflow_owner_1 = require("./workflow-owner");
|
|
15
16
|
const MCP_AUTHOR_SUFFIX = ' (via MCP)';
|
|
16
17
|
exports.RECENT_ACTIONS_PER_WORKFLOW = 10;
|
|
17
18
|
let MigrationOwnerSuggestionService = class MigrationOwnerSuggestionService {
|
|
@@ -43,7 +44,7 @@ let MigrationOwnerSuggestionService = class MigrationOwnerSuggestionService {
|
|
|
43
44
|
const byId = new Map();
|
|
44
45
|
const idsByName = new Map();
|
|
45
46
|
for (const user of all) {
|
|
46
|
-
if (
|
|
47
|
+
if (!(0, workflow_owner_1.canOwnFindings)(user))
|
|
47
48
|
continue;
|
|
48
49
|
byId.set(user.id, user);
|
|
49
50
|
const name = `${user.firstName} ${user.lastName}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-owner-suggestion.service.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/owners/migration-owner-suggestion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAQiB;AACjB,gCAAkC;
|
|
1
|
+
{"version":3,"file":"migration-owner-suggestion.service.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/owners/migration-owner-suggestion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAQiB;A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EAC1B,6BAAwB,EACvB,8BAAyB,EACpC,mBAAc;GAPpC,+BAA+B,CA2G3C;AAWD,SAAS,aAAa,CAAC,OAAe,EAAE,KAAoB;IAC3D,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAC/C,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC;QAC7C,CAAC,CAAC,OAAO,CAAC;IACX,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/C,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { BreakingChangeWorkflowOwner, MigrationOwnerSource } from '@n8n/api-types';
|
|
2
2
|
import type { User } from '@n8n/db';
|
|
3
3
|
export declare function toWorkflowOwner(user: Pick<User, 'id' | 'firstName' | 'lastName' | 'email'>, source: MigrationOwnerSource): BreakingChangeWorkflowOwner;
|
|
4
|
+
export declare function canOwnFindings(user: Pick<User, 'disabled' | 'isPending'>): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toWorkflowOwner = toWorkflowOwner;
|
|
4
|
+
exports.canOwnFindings = canOwnFindings;
|
|
4
5
|
function toWorkflowOwner(user, source) {
|
|
5
6
|
return {
|
|
6
7
|
id: user.id,
|
|
@@ -10,4 +11,7 @@ function toWorkflowOwner(user, source) {
|
|
|
10
11
|
source,
|
|
11
12
|
};
|
|
12
13
|
}
|
|
14
|
+
function canOwnFindings(user) {
|
|
15
|
+
return !user.disabled && !user.isPending;
|
|
16
|
+
}
|
|
13
17
|
//# sourceMappingURL=workflow-owner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-owner.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/owners/workflow-owner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-owner.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/owners/workflow-owner.ts"],"names":[],"mappings":";;;;AAIA,yBACC,IAA2D,EAC3D,MAA4B;IAE5B,OAAO;QACN,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM;KACN,CAAC;AACH,CAAC;AAGD,wBAA+B,IAA0C;IACxE,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;AAC1C,CAAC"}
|
|
@@ -586,7 +586,7 @@ let InstanceAiAdapterService = class InstanceAiAdapterService {
|
|
|
586
586
|
const foldersOn = options.folderExploration === true;
|
|
587
587
|
const foldersAttributed = foldersOn && this.license.isLicensed('feat:folders');
|
|
588
588
|
const { folderRepository, folderFinderService, projectService } = this;
|
|
589
|
-
const { workflowService, workflowFinderService, workflowRepository, sharedWorkflowRepository, aiBuilderTemporaryWorkflowRepository, workflowHistoryService, enterpriseWorkflowService, executionRepository, executionPersistence, license, telemetry, collaborationService, policyEnforcementService, workflowDependencyQueryService, } = this;
|
|
589
|
+
const { workflowService, workflowFinderService, workflowRepository, sharedWorkflowRepository, aiBuilderTemporaryWorkflowRepository, workflowHistoryService, enterpriseWorkflowService, executionRepository, executionPersistence, license, telemetry, eventService, collaborationService, policyEnforcementService, workflowDependencyQueryService, } = this;
|
|
590
590
|
const logger = this.logger;
|
|
591
591
|
const maxExecutionTimeout = this.globalConfig.executions.maxTimeout;
|
|
592
592
|
const assertNotReadOnly = () => this.assertInstanceNotReadOnly('workflows');
|
|
@@ -1087,6 +1087,10 @@ let InstanceAiAdapterService = class InstanceAiAdapterService {
|
|
|
1087
1087
|
throw error;
|
|
1088
1088
|
}
|
|
1089
1089
|
if (threadId) {
|
|
1090
|
+
eventService.emit('experiment-assistant-change-saved', {
|
|
1091
|
+
userId: user.id,
|
|
1092
|
+
at: Date.now(),
|
|
1093
|
+
});
|
|
1090
1094
|
telemetry.track('Builder created workflow', {
|
|
1091
1095
|
...setupExperimentProperties,
|
|
1092
1096
|
user_id: user.id,
|
|
@@ -1163,6 +1167,10 @@ let InstanceAiAdapterService = class InstanceAiAdapterService {
|
|
|
1163
1167
|
throw error;
|
|
1164
1168
|
}
|
|
1165
1169
|
if (threadId) {
|
|
1170
|
+
eventService.emit('experiment-assistant-change-saved', {
|
|
1171
|
+
userId: user.id,
|
|
1172
|
+
at: Date.now(),
|
|
1173
|
+
});
|
|
1166
1174
|
telemetry.track('Builder modified workflow', {
|
|
1167
1175
|
...setupExperimentProperties,
|
|
1168
1176
|
user_id: user.id,
|