n8n 2.45.0 → 2.45.2
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/commands/base-command.d.ts +2 -0
- package/dist/commands/base-command.js +35 -1
- package/dist/commands/base-command.js.map +1 -1
- package/dist/load-nodes-and-credentials.d.ts +1 -0
- package/dist/load-nodes-and-credentials.js +8 -2
- package/dist/load-nodes-and-credentials.js.map +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/agents/agents.service.js +10 -5
- package/dist/modules/agents/agents.service.js.map +1 -1
- package/dist/modules/agents/builder/get-resource-locator-options.tool.d.ts +2 -2
- package/dist/modules/agents/repositories/agent.repository.d.ts +5 -0
- package/dist/modules/agents/repositories/agent.repository.js +48 -10
- package/dist/modules/agents/repositories/agent.repository.js.map +1 -1
- package/dist/modules/agents/utils/agent-ref.d.ts +3 -1
- package/dist/modules/agents/utils/agent-ref.js +3 -2
- package/dist/modules/agents/utils/agent-ref.js.map +1 -1
- package/dist/modules/breaking-changes/breaking-changes.controller.d.ts +12 -7
- package/dist/modules/breaking-changes/breaking-changes.controller.js +63 -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/migration-report-csv.d.ts +3 -0
- package/dist/modules/breaking-changes/migration-report-csv.js +66 -0
- package/dist/modules/breaking-changes/migration-report-csv.js.map +1 -0
- 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/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.d.ts +8 -2
- package/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.js +15 -11
- package/dist/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.js.map +1 -1
- package/dist/modules/type-availability-policies/effective-policy.d.ts +17 -0
- package/dist/modules/type-availability-policies/effective-policy.js +33 -0
- package/dist/modules/type-availability-policies/effective-policy.js.map +1 -0
- package/dist/modules/type-availability-policies/policy-rule.types.d.ts +0 -4
- package/dist/modules/type-availability-policies/type-availability-policies.module.js +2 -0
- package/dist/modules/type-availability-policies/type-availability-policies.module.js.map +1 -1
- package/dist/modules/type-availability-policies/type-availability-policy-snapshot.d.ts +28 -0
- package/dist/modules/type-availability-policies/type-availability-policy-snapshot.js +138 -0
- package/dist/modules/type-availability-policies/type-availability-policy-snapshot.js.map +1 -0
- package/dist/modules/type-availability-policies/type-availability-policy.service.d.ts +8 -25
- package/dist/modules/type-availability-policies/type-availability-policy.service.js +42 -171
- package/dist/modules/type-availability-policies/type-availability-policy.service.js.map +1 -1
- package/dist/scaling/constants.d.ts +2 -2
- package/dist/scaling/pubsub/pubsub.event-map.d.ts +5 -1
- package/dist/scaling/pubsub/pubsub.types.d.ts +2 -1
- package/dist/scaling/pubsub/subscriber.service.js +2 -0
- package/dist/scaling/pubsub/subscriber.service.js.map +1 -1
- package/dist/user-management/email/templates/n8n-logo.png +0 -0
- package/package.json +36 -36
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrollment.service.js","sourceRoot":"","sources":["../../../src/modules/mcp-discovery/enrollment.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wCAA2C;AAC3C,gCAA+D;AAE/D,gCAAkC;AAElC,8HAAmH;AAEnH,yDAAyE;AACzE,uEAAuE;AACvE,+CAAgE;AAKzD,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACzC,YACkB,QAA4B,EAC5B,MAAoB,EACpB,QAA+B,EAC/B,OAAyB,EACzB,cAA0C;wBAJ1C,QAAQ;sBACR,MAAM;wBACN,QAAQ;uBACR,OAAO;8BACP,cAAc;IAC7B,CAAC;IAEJ,KAAK,CAAC,KAAK,CACV,IAA+B,EAC/B,EAAE,YAAY,EAAE,OAAO,EAAE,GAAgC,EAAE;QAE3D,MAAM,QAAQ,GAAsB,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QAC3D,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,QAAQ,CAAC;QAC7D,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc;YAAE,OAAO,QAAQ,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAExC,MAAM,OAAO,GAAsB,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QACzD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAChE,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO;gBACN,MAAM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,oCAAiB,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACrE,OAAO;YACN,kBAAkB;YAClB,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,SAAS;SAC1D,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAAC,MAAc;QAC/C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAA,mCAAgB,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAEO,cAAc,CAAC,KAAc;QACpC,OAAO,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,CAAC;CACD,CAAA;;wCA3FY,6BAA6B;IADzC,IAAA,YAAO,GAAE;qCAGmB,uBAAkB,EACpB,qBAAY,EACV,qDAAqB,EACtB,qBAAgB,EACT,oDAA0B;GANhD,6BAA6B,CA2FzC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { McpCallerAuth } from '@n8n/backend-services/auth';
|
|
2
|
+
interface McpConnection {
|
|
3
|
+
userId: string;
|
|
4
|
+
clientName?: string;
|
|
5
|
+
caller?: McpCallerAuth;
|
|
6
|
+
}
|
|
7
|
+
export interface McpDiscoveryEventMap {
|
|
8
|
+
'experiment-user-first-login': {
|
|
9
|
+
userId: string;
|
|
10
|
+
at: number;
|
|
11
|
+
};
|
|
12
|
+
'experiment-assistant-change-saved': {
|
|
13
|
+
userId: string;
|
|
14
|
+
at: number;
|
|
15
|
+
};
|
|
16
|
+
'experiment-mcp-client-connected': McpConnection;
|
|
17
|
+
'experiment-mcp-workflow-write-completed': {
|
|
18
|
+
userId: string;
|
|
19
|
+
toolName: string;
|
|
20
|
+
status: 'success' | 'error';
|
|
21
|
+
workflowId?: string;
|
|
22
|
+
structuredContent?: unknown;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
declare module '@n8n/backend-services' {
|
|
26
|
+
interface EventMap extends McpDiscoveryEventMap {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/modules/mcp-discovery/events.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { McpDiscoveryVisitRequestDto } from './mcp-discovery.dto';
|
|
2
|
+
import { AuthenticatedRequest } from '@n8n/db';
|
|
3
|
+
import { Response } from 'express';
|
|
4
|
+
import { McpDiscoveryEnrollmentService } from './enrollment.service';
|
|
5
|
+
export declare class McpDiscoveryController {
|
|
6
|
+
private readonly enrollment;
|
|
7
|
+
constructor(enrollment: McpDiscoveryEnrollmentService);
|
|
8
|
+
visit(req: AuthenticatedRequest, _: Response, payload: McpDiscoveryVisitRequestDto): Promise<import("./types").McpDiscoveryState>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.McpDiscoveryController = void 0;
|
|
16
|
+
const mcp_discovery_dto_1 = require("./mcp-discovery.dto");
|
|
17
|
+
const decorators_1 = require("@n8n/decorators");
|
|
18
|
+
const enrollment_service_1 = require("./enrollment.service");
|
|
19
|
+
let McpDiscoveryController = class McpDiscoveryController {
|
|
20
|
+
constructor(enrollment) {
|
|
21
|
+
this.enrollment = enrollment;
|
|
22
|
+
}
|
|
23
|
+
async visit(req, _, payload) {
|
|
24
|
+
return await this.enrollment.visit(req.user, payload);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.McpDiscoveryController = McpDiscoveryController;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, decorators_1.Post)('/visit'),
|
|
30
|
+
__param(2, decorators_1.Body),
|
|
31
|
+
__metadata("design:type", Function),
|
|
32
|
+
__metadata("design:paramtypes", [Object, Object, mcp_discovery_dto_1.McpDiscoveryVisitRequestDto]),
|
|
33
|
+
__metadata("design:returntype", Promise)
|
|
34
|
+
], McpDiscoveryController.prototype, "visit", null);
|
|
35
|
+
exports.McpDiscoveryController = McpDiscoveryController = __decorate([
|
|
36
|
+
(0, decorators_1.RestController)('/me/mcp-discovery'),
|
|
37
|
+
__metadata("design:paramtypes", [enrollment_service_1.McpDiscoveryEnrollmentService])
|
|
38
|
+
], McpDiscoveryController);
|
|
39
|
+
//# sourceMappingURL=mcp-discovery.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-discovery.controller.js","sourceRoot":"","sources":["../../../src/modules/mcp-discovery/mcp-discovery.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2DAAkE;AAElE,gDAA6D;AAG7D,6DAAqE;AAG9D,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAClC,YAA6B,UAAyC;0BAAzC,UAAU;IAAkC,CAAC;IAIpE,AAAN,KAAK,CAAC,KAAK,CAAC,GAAyB,EAAE,CAAW,EAAQ,OAAoC;QAC7F,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACD,CAAA;;AAHM;IADL,IAAA,iBAAI,EAAC,QAAQ,CAAC;IACsC,WAAA,iBAAI,CAAA;;qDAAU,+CAA2B;;mDAE7F;iCAPW,sBAAsB;IADlC,IAAA,2BAAc,EAAC,mBAAmB,CAAC;qCAEM,kDAA6B;GAD1D,sBAAsB,CAQlC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const McpDiscoveryVisitRequestDto_base: import("@n8n/api-types").ZodClass<{
|
|
3
|
+
pickedClaude?: boolean | undefined;
|
|
4
|
+
isTrial?: boolean | undefined;
|
|
5
|
+
}, {
|
|
6
|
+
pickedClaude: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
isTrial: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare class McpDiscoveryVisitRequestDto extends McpDiscoveryVisitRequestDto_base {
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.McpDiscoveryVisitRequestDto = void 0;
|
|
4
|
+
const api_types_1 = require("@n8n/api-types");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
class McpDiscoveryVisitRequestDto extends api_types_1.Z.class({
|
|
7
|
+
pickedClaude: zod_1.z.boolean().optional(),
|
|
8
|
+
isTrial: zod_1.z.boolean().optional(),
|
|
9
|
+
}) {
|
|
10
|
+
}
|
|
11
|
+
exports.McpDiscoveryVisitRequestDto = McpDiscoveryVisitRequestDto;
|
|
12
|
+
//# sourceMappingURL=mcp-discovery.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-discovery.dto.js","sourceRoot":"","sources":["../../../src/modules/mcp-discovery/mcp-discovery.dto.ts"],"names":[],"mappings":";;;AACA,8CAAmC;AACnC,6BAAwB;AAExB,iCAAyC,SAAQ,aAAC,CAAC,KAAK,CAAC;IACxD,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpC,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC;CAAG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.McpDiscoveryModule = void 0;
|
|
10
|
+
const config_1 = require("@n8n/config");
|
|
11
|
+
const decorators_1 = require("@n8n/decorators");
|
|
12
|
+
const di_1 = require("@n8n/di");
|
|
13
|
+
let McpDiscoveryModule = class McpDiscoveryModule {
|
|
14
|
+
async init() {
|
|
15
|
+
if (di_1.Container.get(config_1.GlobalConfig).deployment.type !== 'cloud')
|
|
16
|
+
return;
|
|
17
|
+
const { McpDiscoveryActivityEvents } = await import('./activity-events.service.js');
|
|
18
|
+
di_1.Container.get(McpDiscoveryActivityEvents).init();
|
|
19
|
+
await import('./mcp-discovery.controller.js');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.McpDiscoveryModule = McpDiscoveryModule;
|
|
23
|
+
exports.McpDiscoveryModule = McpDiscoveryModule = __decorate([
|
|
24
|
+
(0, decorators_1.BackendModule)({ name: 'mcp-discovery' })
|
|
25
|
+
], McpDiscoveryModule);
|
|
26
|
+
//# sourceMappingURL=mcp-discovery.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-discovery.module.js","sourceRoot":"","sources":["../../../src/modules/mcp-discovery/mcp-discovery.module.ts"],"names":[],"mappings":";;;;;;;;;AACA,wCAA2C;AAC3C,gDAAgD;AAEhD,gCAAoC;AAG7B,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC9B,KAAK,CAAC,IAAI;QACT,IAAI,cAAS,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO;QACpE,MAAM,EAAE,0BAA0B,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;QACpF,cAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,IAAI,EAAE,CAAC;QACjD,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;IAC/C,CAAC;CACD,CAAA;;6BAPY,kBAAkB;IAD9B,IAAA,0BAAa,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;GAC5B,kBAAkB,CAO9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/mcp-discovery/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRepository, TransactionRunner, type OperationContext } from '@n8n/db';
|
|
2
2
|
import { DataSource } from '@n8n/typeorm';
|
|
3
|
-
import type { PolicyAction
|
|
3
|
+
import type { PolicyAction } from '../../policy-rule.types';
|
|
4
4
|
import { TypeAvailabilityPolicyScope } from '../entities/type-availability-policy-scope.entity';
|
|
5
5
|
type NewPolicyScope = {
|
|
6
6
|
kind: string;
|
|
@@ -11,6 +11,11 @@ type NewPolicyScope = {
|
|
|
11
11
|
export type ProjectPolicyScope = TypeAvailabilityPolicyScope & {
|
|
12
12
|
projectId: string;
|
|
13
13
|
};
|
|
14
|
+
export type ScopeFingerprint = {
|
|
15
|
+
count: number;
|
|
16
|
+
versionSum: number;
|
|
17
|
+
newestCreatedAt: number;
|
|
18
|
+
};
|
|
14
19
|
export declare class TypeAvailabilityPolicyScopeRepository extends BaseRepository<TypeAvailabilityPolicyScope> {
|
|
15
20
|
constructor(dataSource: DataSource, transactionRunner: TransactionRunner);
|
|
16
21
|
private forUpdateLock;
|
|
@@ -18,7 +23,8 @@ export declare class TypeAvailabilityPolicyScopeRepository extends BaseRepositor
|
|
|
18
23
|
findScopeById(id: string, ctx: OperationContext, forUpdate?: boolean): Promise<TypeAvailabilityPolicyScope | null>;
|
|
19
24
|
findScopeByIdAndKind(id: string, kind: string, ctx: OperationContext, forUpdate?: boolean): Promise<TypeAvailabilityPolicyScope | null>;
|
|
20
25
|
lockScopesByIds(ids: string[], ctx: OperationContext): Promise<string[]>;
|
|
21
|
-
|
|
26
|
+
findAllScopes(ctx: OperationContext): Promise<TypeAvailabilityPolicyScope[]>;
|
|
27
|
+
readFingerprint(ctx: OperationContext): Promise<ScopeFingerprint>;
|
|
22
28
|
findProjectScopes(kind: string, ctx: OperationContext): Promise<ProjectPolicyScope[]>;
|
|
23
29
|
containsProjectScope(ids: string[], ctx: OperationContext): Promise<boolean>;
|
|
24
30
|
createScopeIfAbsent(input: NewPolicyScope, ctx: OperationContext): Promise<{
|
|
@@ -62,17 +62,21 @@ let TypeAvailabilityPolicyScopeRepository = class TypeAvailabilityPolicyScopeRep
|
|
|
62
62
|
}
|
|
63
63
|
return found;
|
|
64
64
|
}
|
|
65
|
-
async
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return
|
|
65
|
+
async findAllScopes(ctx) {
|
|
66
|
+
return await this.managerFor(ctx).find(type_availability_policy_scope_entity_1.TypeAvailabilityPolicyScope);
|
|
67
|
+
}
|
|
68
|
+
async readFingerprint(ctx) {
|
|
69
|
+
const row = await this.managerFor(ctx)
|
|
70
|
+
.createQueryBuilder(type_availability_policy_scope_entity_1.TypeAvailabilityPolicyScope, 'scope')
|
|
71
|
+
.select('COUNT(*)', 'count')
|
|
72
|
+
.addSelect('COALESCE(SUM(scope.version), 0)', 'versionSum')
|
|
73
|
+
.addSelect('MAX(scope.createdAt)', 'newestCreatedAt')
|
|
74
|
+
.getRawOne();
|
|
75
|
+
return {
|
|
76
|
+
count: Number(row?.count ?? 0),
|
|
77
|
+
versionSum: Number(row?.versionSum ?? 0),
|
|
78
|
+
newestCreatedAt: row?.newestCreatedAt ? new Date(row.newestCreatedAt).getTime() : 0,
|
|
79
|
+
};
|
|
76
80
|
}
|
|
77
81
|
async findProjectScopes(kind, ctx) {
|
|
78
82
|
const scopes = await this.managerFor(ctx).findBy(type_availability_policy_scope_entity_1.TypeAvailabilityPolicyScope, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-availability-policy-scope.repository.js","sourceRoot":"","sources":["../../../../../src/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAMiB;AACjB,gCAAkC;AAClC,0CAA+E;AAC/E,+CAA+C;AAG/C,6GAAgG;
|
|
1
|
+
{"version":3,"file":"type-availability-policy-scope.repository.js","sourceRoot":"","sources":["../../../../../src/modules/type-availability-policies/database/repositories/type-availability-policy-scope.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAMiB;AACjB,gCAAkC;AAClC,0CAA+E;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AE,EAAE,EAAE,IAAA,YAAE,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EACtB,SAAS,EACT,CAAC,CACD,CAAC;YACF,OAAO;QACR,CAAC;QAED,MAAM,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAC7C,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC7B,MAAM,EAAE,CAAC,SAAS,CAAC,mEAA2B,EAAE,EAAE,EAAE,EAAE,IAAA,YAAE,EAAC,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YAClF,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;;gDAxQY,qCAAqC;IADjD,IAAA,YAAO,GAAE;qCAEe,oBAAU,EAAqB,sBAAiB;GAD5D,qCAAqC,CAwQjD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TypeAvailabilityPolicyScope } from './database/entities/type-availability-policy-scope.entity';
|
|
2
|
+
import type { PolicyAction, PolicyAttachment, PolicyRule } from './policy-rule.types';
|
|
3
|
+
export declare const UNCONFIGURED_VERSION = 0;
|
|
4
|
+
export type EffectivePolicy = {
|
|
5
|
+
readonly scopeId: string | null;
|
|
6
|
+
readonly kind: string;
|
|
7
|
+
readonly projectId: string | null;
|
|
8
|
+
readonly defaultAction: PolicyAction;
|
|
9
|
+
readonly version: number;
|
|
10
|
+
readonly rules: readonly PolicyRule[];
|
|
11
|
+
readonly attachments: readonly PolicyAttachment[];
|
|
12
|
+
};
|
|
13
|
+
export type ProjectEffectivePolicy = EffectivePolicy & {
|
|
14
|
+
readonly projectId: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function unconfiguredScope(kind: string, projectId: string | null): EffectivePolicy;
|
|
17
|
+
export declare function toEffectivePolicy(scope: TypeAvailabilityPolicyScope, attachments: readonly PolicyAttachment[]): EffectivePolicy;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNCONFIGURED_VERSION = void 0;
|
|
4
|
+
exports.unconfiguredScope = unconfiguredScope;
|
|
5
|
+
exports.toEffectivePolicy = toEffectivePolicy;
|
|
6
|
+
const policy_evaluator_1 = require("./policy-evaluator");
|
|
7
|
+
exports.UNCONFIGURED_VERSION = 0;
|
|
8
|
+
function unconfiguredScope(kind, projectId) {
|
|
9
|
+
return {
|
|
10
|
+
scopeId: null,
|
|
11
|
+
kind,
|
|
12
|
+
projectId,
|
|
13
|
+
defaultAction: 'allow',
|
|
14
|
+
version: exports.UNCONFIGURED_VERSION,
|
|
15
|
+
rules: [],
|
|
16
|
+
attachments: [],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function flattenRules(attachments) {
|
|
20
|
+
return (0, policy_evaluator_1.orderedAttachments)(attachments).flatMap((attachment) => [...attachment.rules]);
|
|
21
|
+
}
|
|
22
|
+
function toEffectivePolicy(scope, attachments) {
|
|
23
|
+
return {
|
|
24
|
+
scopeId: scope.id,
|
|
25
|
+
kind: scope.kind,
|
|
26
|
+
projectId: scope.projectId,
|
|
27
|
+
defaultAction: scope.defaultAction,
|
|
28
|
+
version: scope.version,
|
|
29
|
+
rules: flattenRules(attachments),
|
|
30
|
+
attachments,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=effective-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effective-policy.js","sourceRoot":"","sources":["../../../src/modules/type-availability-policies/effective-policy.ts"],"names":[],"mappings":";;;;;AACA,yDAAwD;AAS3C,QAAA,oBAAoB,GAAG,CAAC,CAAC;AAqBtC,2BAAkC,IAAY,EAAE,SAAwB;IACvE,OAAO;QACN,OAAO,EAAE,IAAI;QACb,IAAI;QACJ,SAAS;QACT,aAAa,EAAE,OAAO;QACtB,OAAO,EAAE,QAAA,oBAAoB;QAC7B,KAAK,EAAE,EAAE;QACT,WAAW,EAAE,EAAE;KACf,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,WAAwC;IAC7D,OAAO,IAAA,qCAAkB,EAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,2BACC,KAAkC,EAClC,WAAwC;IAExC,OAAO;QACN,OAAO,EAAE,KAAK,CAAC,EAAE;QACjB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,YAAY,CAAC,WAAW,CAAC;QAChC,WAAW;KACX,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { PolicyAction, PolicyRule } from '@n8n/api-types';
|
|
2
2
|
export type { NonDelegatingPolicyAction, NonDelegatingPolicyRule, PolicyAction, PolicyRule, PolicySelector, } from '@n8n/api-types';
|
|
3
|
-
export type PolicyScopeKey = {
|
|
4
|
-
readonly kind: string;
|
|
5
|
-
readonly projectId: string | null;
|
|
6
|
-
};
|
|
7
3
|
export type PolicyAttachment = {
|
|
8
4
|
readonly policyId: string;
|
|
9
5
|
readonly rules: readonly PolicyRule[];
|
|
@@ -23,6 +23,8 @@ let TypeAvailabilityPoliciesModule = class TypeAvailabilityPoliciesModule {
|
|
|
23
23
|
await import('./credential-type-policy.check.js');
|
|
24
24
|
const { NodeTypePolicyRestrictedTypesProvider } = await import('./restricted-node-types.provider.js');
|
|
25
25
|
di_1.Container.get(backend_services_1.RestrictedNodeTypesProviderProxy).registerProvider(di_1.Container.get(NodeTypePolicyRestrictedTypesProvider));
|
|
26
|
+
const { TypeAvailabilityPolicySnapshot } = await import('./type-availability-policy-snapshot.js');
|
|
27
|
+
await di_1.Container.get(TypeAvailabilityPolicySnapshot).start();
|
|
26
28
|
}
|
|
27
29
|
async entities() {
|
|
28
30
|
const { TypeAvailabilityPolicy } = await import('./database/entities/type-availability-policy.entity.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-availability-policies.module.js","sourceRoot":"","sources":["../../../src/modules/type-availability-policies/type-availability-policies.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAkD;AAElD,gDAAgD;AAChD,gCAAoC;AAEpC,4DAAyE;AAYlE,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAC1C,KAAK,CAAC,IAAI;QAET,MAAM,MAAM,CAAC,mDAAmD,CAAC,CAAC;QAClE,MAAM,MAAM,CAAC,kDAAkD,CAAC,CAAC;QACjE,MAAM,MAAM,CAAC,iDAAiD,CAAC,CAAC;QAChE,MAAM,MAAM,CAAC,gDAAgD,CAAC,CAAC;QAC/D,MAAM,MAAM,CAAC,iCAAiC,CAAC,CAAC;QAChD,MAAM,MAAM,CAAC,4CAA4C,CAAC,CAAC;QAG3D,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;QAC5C,MAAM,MAAM,CAAC,mCAAmC,CAAC,CAAC;QAElD,MAAM,EAAE,qCAAqC,EAAE,GAAG,MAAM,MAAM,CAC7D,qCAAqC,CACrC,CAAC;QACF,cAAS,CAAC,GAAG,CAAC,mDAAgC,CAAC,CAAC,gBAAgB,CAC/D,cAAS,CAAC,GAAG,CAAC,qCAAqC,CAAC,CACpD,CAAC;
|
|
1
|
+
{"version":3,"file":"type-availability-policies.module.js","sourceRoot":"","sources":["../../../src/modules/type-availability-policies/type-availability-policies.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAkD;AAElD,gDAAgD;AAChD,gCAAoC;AAEpC,4DAAyE;AAYlE,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAC1C,KAAK,CAAC,IAAI;QAET,MAAM,MAAM,CAAC,mDAAmD,CAAC,CAAC;QAClE,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import { Publisher } from '../../scaling/pubsub/publisher.service';
|
|
3
|
+
import { TypeAvailabilityPolicyAttachmentRepository } from './database/repositories/type-availability-policy-attachment.repository';
|
|
4
|
+
import { TypeAvailabilityPolicyScopeRepository } from './database/repositories/type-availability-policy-scope.repository';
|
|
5
|
+
import { type EffectivePolicy, type ProjectEffectivePolicy } from './effective-policy';
|
|
6
|
+
export declare const FINGERPRINT_POLL_INTERVAL_MS: number;
|
|
7
|
+
export declare class TypeAvailabilityPolicySnapshot {
|
|
8
|
+
private readonly scopeRepository;
|
|
9
|
+
private readonly attachmentRepository;
|
|
10
|
+
private readonly publisher;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
private loaded;
|
|
13
|
+
private queue;
|
|
14
|
+
private pending;
|
|
15
|
+
private pollTimer;
|
|
16
|
+
private polling;
|
|
17
|
+
constructor(scopeRepository: TypeAvailabilityPolicyScopeRepository, attachmentRepository: TypeAvailabilityPolicyAttachmentRepository, publisher: Publisher, logger: Logger);
|
|
18
|
+
read(kind: string, projectId: string | null): EffectivePolicy | null;
|
|
19
|
+
projectScopes(kind: string): ProjectEffectivePolicy[] | null;
|
|
20
|
+
start(): Promise<void>;
|
|
21
|
+
stop(): void;
|
|
22
|
+
refreshAfterWrite(): Promise<void>;
|
|
23
|
+
handleReloadRequest(): Promise<void>;
|
|
24
|
+
reload(): Promise<void>;
|
|
25
|
+
private reloadAndLog;
|
|
26
|
+
private load;
|
|
27
|
+
private poll;
|
|
28
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TypeAvailabilityPolicySnapshot = exports.FINGERPRINT_POLL_INTERVAL_MS = void 0;
|
|
13
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
14
|
+
const constants_1 = require("@n8n/constants");
|
|
15
|
+
const decorators_1 = require("@n8n/decorators");
|
|
16
|
+
const di_1 = require("@n8n/di");
|
|
17
|
+
const publisher_service_1 = require("../../scaling/pubsub/publisher.service");
|
|
18
|
+
const type_availability_policy_attachment_repository_1 = require("./database/repositories/type-availability-policy-attachment.repository");
|
|
19
|
+
const type_availability_policy_scope_repository_1 = require("./database/repositories/type-availability-policy-scope.repository");
|
|
20
|
+
const effective_policy_1 = require("./effective-policy");
|
|
21
|
+
exports.FINGERPRINT_POLL_INTERVAL_MS = 30 * constants_1.Time.seconds.toMilliseconds;
|
|
22
|
+
function scopeKey(kind, projectId) {
|
|
23
|
+
return `${kind}:${projectId ?? 'instance'}`;
|
|
24
|
+
}
|
|
25
|
+
function sameFingerprint(a, b) {
|
|
26
|
+
return (a.count === b.count && a.versionSum === b.versionSum && a.newestCreatedAt === b.newestCreatedAt);
|
|
27
|
+
}
|
|
28
|
+
let TypeAvailabilityPolicySnapshot = class TypeAvailabilityPolicySnapshot {
|
|
29
|
+
constructor(scopeRepository, attachmentRepository, publisher, logger) {
|
|
30
|
+
this.scopeRepository = scopeRepository;
|
|
31
|
+
this.attachmentRepository = attachmentRepository;
|
|
32
|
+
this.publisher = publisher;
|
|
33
|
+
this.logger = logger;
|
|
34
|
+
this.loaded = null;
|
|
35
|
+
this.queue = Promise.resolve();
|
|
36
|
+
this.pending = null;
|
|
37
|
+
this.polling = false;
|
|
38
|
+
this.logger = this.logger.scoped('policy');
|
|
39
|
+
}
|
|
40
|
+
read(kind, projectId) {
|
|
41
|
+
if (!this.loaded)
|
|
42
|
+
return null;
|
|
43
|
+
return this.loaded.scopes.get(scopeKey(kind, projectId)) ?? (0, effective_policy_1.unconfiguredScope)(kind, projectId);
|
|
44
|
+
}
|
|
45
|
+
projectScopes(kind) {
|
|
46
|
+
if (!this.loaded)
|
|
47
|
+
return null;
|
|
48
|
+
return [...this.loaded.scopes.values()].filter((scope) => scope.kind === kind && scope.projectId !== null);
|
|
49
|
+
}
|
|
50
|
+
async start() {
|
|
51
|
+
await this.reloadAndLog();
|
|
52
|
+
this.pollTimer ??= setInterval(async () => await this.poll(), exports.FINGERPRINT_POLL_INTERVAL_MS);
|
|
53
|
+
this.pollTimer.unref();
|
|
54
|
+
}
|
|
55
|
+
stop() {
|
|
56
|
+
clearInterval(this.pollTimer);
|
|
57
|
+
this.pollTimer = undefined;
|
|
58
|
+
}
|
|
59
|
+
async refreshAfterWrite() {
|
|
60
|
+
await this.reloadAndLog();
|
|
61
|
+
void this.publisher
|
|
62
|
+
.publishCommand({ command: 'reload-type-availability-policies' })
|
|
63
|
+
.catch((error) => {
|
|
64
|
+
this.logger.warn('Failed to tell other processes to reload type availability policies', {
|
|
65
|
+
error,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async handleReloadRequest() {
|
|
70
|
+
await this.reloadAndLog();
|
|
71
|
+
}
|
|
72
|
+
async reload() {
|
|
73
|
+
this.pending ??= this.queue.then(async () => {
|
|
74
|
+
this.pending = null;
|
|
75
|
+
await this.load();
|
|
76
|
+
});
|
|
77
|
+
const pending = this.pending;
|
|
78
|
+
this.queue = pending.catch(() => { });
|
|
79
|
+
await pending;
|
|
80
|
+
}
|
|
81
|
+
async reloadAndLog() {
|
|
82
|
+
try {
|
|
83
|
+
await this.reload();
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
this.logger.error('Failed to load type availability policies', { error });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async load() {
|
|
90
|
+
const fingerprint = await this.scopeRepository.readFingerprint({});
|
|
91
|
+
const scopes = await this.scopeRepository.findAllScopes({});
|
|
92
|
+
const attachmentsByScope = await this.attachmentRepository.listAttachmentsForScopes(scopes.map((scope) => scope.id), {});
|
|
93
|
+
const byKey = new Map();
|
|
94
|
+
for (const scope of scopes) {
|
|
95
|
+
byKey.set(scopeKey(scope.kind, scope.projectId), (0, effective_policy_1.toEffectivePolicy)(scope, attachmentsByScope.get(scope.id) ?? []));
|
|
96
|
+
}
|
|
97
|
+
this.loaded = { scopes: byKey, fingerprint };
|
|
98
|
+
}
|
|
99
|
+
async poll() {
|
|
100
|
+
if (this.polling)
|
|
101
|
+
return;
|
|
102
|
+
this.polling = true;
|
|
103
|
+
try {
|
|
104
|
+
if (this.loaded) {
|
|
105
|
+
const fingerprint = await this.scopeRepository.readFingerprint({});
|
|
106
|
+
if (sameFingerprint(fingerprint, this.loaded.fingerprint))
|
|
107
|
+
return;
|
|
108
|
+
this.logger.info('Type availability policies changed without a reload message');
|
|
109
|
+
}
|
|
110
|
+
await this.reload();
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.logger.error('Failed to check type availability policies for changes', { error });
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
this.polling = false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
exports.TypeAvailabilityPolicySnapshot = TypeAvailabilityPolicySnapshot;
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, decorators_1.OnShutdown)(),
|
|
123
|
+
__metadata("design:type", Function),
|
|
124
|
+
__metadata("design:paramtypes", []),
|
|
125
|
+
__metadata("design:returntype", void 0)
|
|
126
|
+
], TypeAvailabilityPolicySnapshot.prototype, "stop", null);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, decorators_1.OnPubSubEvent)('reload-type-availability-policies'),
|
|
129
|
+
(0, decorators_1.OnPubSubEvent)('pubsub-reconnected'),
|
|
130
|
+
__metadata("design:type", Function),
|
|
131
|
+
__metadata("design:paramtypes", []),
|
|
132
|
+
__metadata("design:returntype", Promise)
|
|
133
|
+
], TypeAvailabilityPolicySnapshot.prototype, "handleReloadRequest", null);
|
|
134
|
+
exports.TypeAvailabilityPolicySnapshot = TypeAvailabilityPolicySnapshot = __decorate([
|
|
135
|
+
(0, di_1.Service)(),
|
|
136
|
+
__metadata("design:paramtypes", [type_availability_policy_scope_repository_1.TypeAvailabilityPolicyScopeRepository, type_availability_policy_attachment_repository_1.TypeAvailabilityPolicyAttachmentRepository, publisher_service_1.Publisher, backend_common_1.Logger])
|
|
137
|
+
], TypeAvailabilityPolicySnapshot);
|
|
138
|
+
//# sourceMappingURL=type-availability-policy-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-availability-policy-snapshot.js","sourceRoot":"","sources":["../../../src/modules/type-availability-policies/type-availability-policy-snapshot.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAA6C;AAC7C,8CAAsC;AACtC,gDAA4D;AAC5D,gCAAkC;AAElC,0EAA+D;AAE/D,2IAAoI;AACpI,iIAG2E;AAC3E,yDAK4B;AAGf,QAAA,4BAA4B,GAAG,EAAE,GAAG,gBAAI,CAAC,OAAO,CAAC,cAAc,CAAC;AAO7E,SAAS,QAAQ,CAAC,IAAY,EAAE,SAAwB;IACvD,OAAO,GAAG,IAAI,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;AAC7C,CAAC;AAED,SAAS,eAAe,CAAC,CAAmB,EAAE,CAAmB;IAChE,OAAO,CACN,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,eAAe,KAAK,CAAC,CAAC,eAAe,CAC/F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AAC,MAAM,EAAE,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wDAAwD,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACxF,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACtB,CAAC;IACF,CAAC;CACD,CAAA;;AArFA;IADC,IAAA,uBAAU,GAAE;;;;0DAIZ;AAkBK;IAFL,IAAA,0BAAa,EAAC,mCAAmC,CAAC;IAClD,IAAA,0BAAa,EAAC,oBAAoB,CAAC;;;;yEAGnC;yCAtEW,8BAA8B;IAD1C,IAAA,YAAO,GAAE;qCAe0B,iFAAqC,EAChC,2FAA0C,EACrD,6BAAS,EACZ,uBAAM;GAjBpB,8BAA8B,CAoI1C"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { NodeTypeAvailabilityScope } from '@n8n/api-types';
|
|
2
|
-
import {
|
|
3
|
-
import { CacheService, EventService } from '@n8n/backend-services';
|
|
2
|
+
import { EventService } from '@n8n/backend-services';
|
|
4
3
|
import { TransactionRunner, type OperationContext } from '@n8n/db';
|
|
5
4
|
import { LoadNodesAndCredentials } from '../../load-nodes-and-credentials';
|
|
6
5
|
import { NodeTypes } from '../../node-types';
|
|
@@ -9,24 +8,17 @@ import { TypeAvailabilityPolicyScopeRepository } from './database/repositories/t
|
|
|
9
8
|
import { TypeAvailabilityPolicyRepository } from './database/repositories/type-availability-policy.repository';
|
|
10
9
|
import type { TypeAvailabilityPolicy } from './database/entities/type-availability-policy.entity';
|
|
11
10
|
import type { TypeAvailabilityPolicyScope } from './database/entities/type-availability-policy-scope.entity';
|
|
11
|
+
import { type EffectivePolicy } from './effective-policy';
|
|
12
12
|
import { type ComposedVerdict } from './policy-evaluator';
|
|
13
13
|
import type { PolicyAction, PolicyAttachment, PolicyRule } from './policy-rule.types';
|
|
14
14
|
import { type PolicyRuleWarning } from './policy-rule-lint';
|
|
15
|
-
|
|
15
|
+
import { TypeAvailabilityPolicySnapshot } from './type-availability-policy-snapshot';
|
|
16
|
+
export type { EffectivePolicy } from './effective-policy';
|
|
16
17
|
export type AttachmentInput = {
|
|
17
18
|
readonly policyId: string;
|
|
18
19
|
readonly priority: number;
|
|
19
20
|
readonly isFloor: boolean;
|
|
20
21
|
};
|
|
21
|
-
export type EffectivePolicy = {
|
|
22
|
-
readonly scopeId: string | null;
|
|
23
|
-
readonly kind: string;
|
|
24
|
-
readonly projectId: string | null;
|
|
25
|
-
readonly defaultAction: PolicyAction;
|
|
26
|
-
readonly version: number;
|
|
27
|
-
readonly rules: readonly PolicyRule[];
|
|
28
|
-
readonly attachments: readonly PolicyAttachment[];
|
|
29
|
-
};
|
|
30
22
|
export type ScopeAttachments = {
|
|
31
23
|
readonly attachments: readonly PolicyAttachment[];
|
|
32
24
|
readonly version: number;
|
|
@@ -51,14 +43,10 @@ export declare class TypeAvailabilityPolicyService {
|
|
|
51
43
|
private readonly attachmentRepository;
|
|
52
44
|
private readonly transactionRunner;
|
|
53
45
|
private readonly eventService;
|
|
54
|
-
private readonly
|
|
46
|
+
private readonly snapshot;
|
|
55
47
|
private readonly loadNodesAndCredentials;
|
|
56
48
|
private readonly nodeTypes;
|
|
57
|
-
|
|
58
|
-
constructor(policyRepository: TypeAvailabilityPolicyRepository, scopeRepository: TypeAvailabilityPolicyScopeRepository, attachmentRepository: TypeAvailabilityPolicyAttachmentRepository, transactionRunner: TransactionRunner, eventService: EventService, cacheService: CacheService, loadNodesAndCredentials: LoadNodesAndCredentials, nodeTypes: NodeTypes, logger: Logger);
|
|
59
|
-
private readonly localReads;
|
|
60
|
-
private invalidations;
|
|
61
|
-
private readonly repeatDeletes;
|
|
49
|
+
constructor(policyRepository: TypeAvailabilityPolicyRepository, scopeRepository: TypeAvailabilityPolicyScopeRepository, attachmentRepository: TypeAvailabilityPolicyAttachmentRepository, transactionRunner: TransactionRunner, eventService: EventService, snapshot: TypeAvailabilityPolicySnapshot, loadNodesAndCredentials: LoadNodesAndCredentials, nodeTypes: NodeTypes);
|
|
62
50
|
getEffectivePolicy(kind: string, projectId: string | null, ctx?: OperationContext): Promise<EffectivePolicy>;
|
|
63
51
|
setDefaultAction(kind: string, projectId: string | null, defaultAction: PolicyAction, expectedVersion: number, updatedBy: string): Promise<TypeAvailabilityPolicyScope>;
|
|
64
52
|
private createScopeOrConflict;
|
|
@@ -96,11 +84,6 @@ export declare class TypeAvailabilityPolicyService {
|
|
|
96
84
|
}>;
|
|
97
85
|
private verdictComposer;
|
|
98
86
|
private readComposedScopes;
|
|
99
|
-
private
|
|
100
|
-
private
|
|
101
|
-
private canPublish;
|
|
102
|
-
resetLocalCaches(): void;
|
|
103
|
-
private invalidateScopes;
|
|
104
|
-
private dropCacheKeys;
|
|
87
|
+
private readEnforcedScope;
|
|
88
|
+
private readProjectScopes;
|
|
105
89
|
}
|
|
106
|
-
export {};
|