n8n 1.118.2 → 1.119.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/build.tsbuildinfo +1 -1
- package/dist/controllers/oauth/oauth2-credential.controller.d.ts +2 -0
- package/dist/controllers/oauth/oauth2-credential.controller.js +85 -1
- package/dist/controllers/oauth/oauth2-credential.controller.js.map +1 -1
- package/dist/controllers/users.controller.d.ts +1 -1
- package/dist/credentials-helper.js +8 -0
- package/dist/credentials-helper.js.map +1 -1
- package/dist/environments.ee/source-control/source-control-status.service.ee.d.ts +2 -2
- package/dist/environments.ee/source-control/source-control.controller.ee.d.ts +4 -4
- package/dist/environments.ee/source-control/source-control.service.ee.d.ts +2 -2
- package/dist/errors/response-errors/abstract/response.error.d.ts +1 -0
- package/dist/errors/response-errors/abstract/response.error.js.map +1 -1
- package/dist/errors/response-errors/license-eula-required.error.d.ts +9 -0
- package/dist/errors/response-errors/license-eula-required.error.js +13 -0
- package/dist/errors/response-errors/license-eula-required.error.js.map +1 -0
- package/dist/events/relays/telemetry.event-relay.js +3 -0
- package/dist/events/relays/telemetry.event-relay.js.map +1 -1
- package/dist/license/license.controller.js +2 -2
- package/dist/license/license.controller.js.map +1 -1
- package/dist/license/license.service.d.ts +3 -1
- package/dist/license/license.service.js +30 -5
- package/dist/license/license.service.js.map +1 -1
- package/dist/license.d.ts +1 -1
- package/dist/license.js +2 -2
- package/dist/license.js.map +1 -1
- package/dist/modules/breaking-changes/breaking-changes.controller.d.ts +12 -0
- package/dist/modules/breaking-changes/breaking-changes.controller.js +50 -0
- package/dist/modules/breaking-changes/breaking-changes.controller.js.map +1 -0
- package/dist/modules/breaking-changes/breaking-changes.module.d.ts +4 -0
- package/dist/modules/breaking-changes/breaking-changes.module.js +53 -0
- package/dist/modules/breaking-changes/breaking-changes.module.js.map +1 -0
- package/dist/modules/breaking-changes/breaking-changes.rule-registry.service.d.ts +11 -0
- package/dist/modules/breaking-changes/breaking-changes.rule-registry.service.js +47 -0
- package/dist/modules/breaking-changes/breaking-changes.rule-registry.service.js.map +1 -0
- package/dist/modules/breaking-changes/breaking-changes.service.d.ts +24 -0
- package/dist/modules/breaking-changes/breaking-changes.service.js +189 -0
- package/dist/modules/breaking-changes/breaking-changes.service.js.map +1 -0
- package/dist/modules/breaking-changes/rules/index.d.ts +4 -0
- package/dist/modules/breaking-changes/rules/index.js +7 -0
- package/dist/modules/breaking-changes/rules/index.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/file-access.rule.d.ts +10 -0
- package/dist/modules/breaking-changes/rules/v2/file-access.rule.js +52 -0
- package/dist/modules/breaking-changes/rules/v2/file-access.rule.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/index.d.ts +3 -0
- package/dist/modules/breaking-changes/rules/v2/index.js +9 -0
- package/dist/modules/breaking-changes/rules/v2/index.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/process-env-access.rule.d.ts +9 -0
- package/dist/modules/breaking-changes/rules/v2/process-env-access.rule.js +71 -0
- package/dist/modules/breaking-changes/rules/v2/process-env-access.rule.js.map +1 -0
- package/dist/modules/breaking-changes/rules/v2/removed-nodes.rule.d.ts +10 -0
- package/dist/modules/breaking-changes/rules/v2/removed-nodes.rule.js +56 -0
- package/dist/modules/breaking-changes/rules/v2/removed-nodes.rule.js.map +1 -0
- package/dist/modules/breaking-changes/types/detection.types.d.ts +11 -0
- package/dist/modules/breaking-changes/types/detection.types.js +3 -0
- package/dist/modules/breaking-changes/types/detection.types.js.map +1 -0
- package/dist/modules/breaking-changes/types/index.d.ts +2 -0
- package/dist/modules/breaking-changes/types/index.js +18 -0
- package/dist/modules/breaking-changes/types/index.js.map +1 -0
- package/dist/modules/breaking-changes/types/rule.types.d.ts +71 -0
- package/dist/modules/breaking-changes/types/rule.types.js +25 -0
- package/dist/modules/breaking-changes/types/rule.types.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-agent.entity.d.ts +14 -0
- package/dist/modules/chat-hub/chat-hub-agent.entity.js +63 -0
- package/dist/modules/chat-hub/chat-hub-agent.entity.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-agent.repository.d.ts +10 -0
- package/dist/modules/chat-hub/chat-hub-agent.repository.js +61 -0
- package/dist/modules/chat-hub/chat-hub-agent.repository.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-agent.service.d.ts +32 -0
- package/dist/modules/chat-hub/chat-hub-agent.service.js +107 -0
- package/dist/modules/chat-hub/chat-hub-agent.service.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-credentials.service.d.ts +15 -0
- package/dist/modules/chat-hub/chat-hub-credentials.service.js +54 -0
- package/dist/modules/chat-hub/chat-hub-credentials.service.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub-message.entity.d.ts +1 -0
- package/dist/modules/chat-hub/chat-hub-message.entity.js +4 -0
- package/dist/modules/chat-hub/chat-hub-message.entity.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-session.entity.d.ts +7 -4
- package/dist/modules/chat-hub/chat-hub-session.entity.js +9 -1
- package/dist/modules/chat-hub/chat-hub-session.entity.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub-workflow.service.d.ts +29 -0
- package/dist/modules/chat-hub/chat-hub-workflow.service.js +382 -0
- package/dist/modules/chat-hub/chat-hub-workflow.service.js.map +1 -0
- package/dist/modules/chat-hub/chat-hub.constants.d.ts +18 -0
- package/dist/modules/chat-hub/chat-hub.constants.js +30 -1
- package/dist/modules/chat-hub/chat-hub.constants.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.controller.d.ts +10 -3
- package/dist/modules/chat-hub/chat-hub.controller.js +68 -7
- package/dist/modules/chat-hub/chat-hub.controller.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.module.d.ts +1 -1
- package/dist/modules/chat-hub/chat-hub.module.js +2 -1
- package/dist/modules/chat-hub/chat-hub.module.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.service.d.ts +31 -11
- package/dist/modules/chat-hub/chat-hub.service.js +519 -498
- package/dist/modules/chat-hub/chat-hub.service.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.types.d.ts +2 -1
- package/dist/modules/chat-hub/chat-message.repository.js +3 -3
- package/dist/modules/chat-hub/chat-message.repository.js.map +1 -1
- package/dist/modules/chat-hub/chat-session.repository.d.ts +1 -0
- package/dist/modules/chat-hub/chat-session.repository.js +9 -0
- package/dist/modules/chat-hub/chat-session.repository.js.map +1 -1
- package/dist/modules/chat-hub/dto/chat-models-request.dto.d.ts +1 -1
- package/dist/modules/chat-hub/stream-capturer.d.ts +17 -2
- package/dist/modules/chat-hub/stream-capturer.js +90 -19
- package/dist/modules/chat-hub/stream-capturer.js.map +1 -1
- package/dist/modules/data-table/data-table-aggregate.service.js +4 -0
- package/dist/modules/data-table/data-table-aggregate.service.js.map +1 -1
- package/dist/modules/data-table/data-table.controller.d.ts +7 -1
- package/dist/modules/data-table/data-table.controller.js +35 -17
- package/dist/modules/data-table/data-table.controller.js.map +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js.map +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period.repository.js +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period.repository.js.map +1 -1
- package/dist/modules/insights/insights-collection.service.js +1 -0
- package/dist/modules/insights/insights-collection.service.js.map +1 -1
- package/dist/modules/insights/insights.controller.js +2 -15
- package/dist/modules/insights/insights.controller.js.map +1 -1
- package/dist/modules/insights/insights.service.d.ts +1 -1
- package/dist/modules/insights/insights.service.js.map +1 -1
- package/dist/modules/workflow-index/workflow-index.service.d.ts +22 -0
- package/dist/modules/workflow-index/workflow-index.service.js +166 -0
- package/dist/modules/workflow-index/workflow-index.service.js.map +1 -0
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.service.d.ts +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.service.js +8 -2
- package/dist/public-api/v1/handlers/workflows/workflows.service.js.map +1 -1
- package/dist/public-api/v1/openapi.yml +47 -0
- package/dist/requests.d.ts +1 -0
- package/dist/response-helper.js +3 -0
- package/dist/response-helper.js.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +11 -0
- package/dist/server.js.map +1 -1
- package/dist/services/frontend.service.d.ts +1 -1
- package/dist/services/frontend.service.js +7 -2
- package/dist/services/frontend.service.js.map +1 -1
- package/dist/services/import.service.d.ts +5 -1
- package/dist/services/import.service.js +15 -2
- package/dist/services/import.service.js.map +1 -1
- package/dist/services/workflow-statistics.service.js +1 -0
- package/dist/services/workflow-statistics.service.js.map +1 -1
- package/dist/sso.ee/oidc/oidc.service.ee.d.ts +2 -1
- package/dist/sso.ee/oidc/oidc.service.ee.js +28 -6
- package/dist/sso.ee/oidc/oidc.service.ee.js.map +1 -1
- package/dist/sso.ee/saml/routes/saml.controller.ee.d.ts +1 -0
- package/dist/sso.ee/saml/routes/saml.controller.ee.js +19 -4
- package/dist/sso.ee/saml/routes/saml.controller.ee.js.map +1 -1
- package/dist/sso.ee/saml/saml.service.ee.d.ts +1 -1
- package/dist/sso.ee/saml/saml.service.ee.js +9 -6
- package/dist/sso.ee/saml/saml.service.ee.js.map +1 -1
- package/dist/workflow-runner.js +2 -1
- package/dist/workflow-runner.js.map +1 -1
- package/dist/workflows/workflow-execution.service.d.ts +4 -1
- package/dist/workflows/workflow-execution.service.js +14 -0
- package/dist/workflows/workflow-execution.service.js.map +1 -1
- package/dist/workflows/workflow.service.d.ts +4 -11
- package/dist/workflows/workflow.service.js +10 -8
- package/dist/workflows/workflow.service.js.map +1 -1
- package/package.json +24 -21
|
@@ -0,0 +1,52 @@
|
|
|
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.FileAccessRule = void 0;
|
|
10
|
+
const di_1 = require("@n8n/di");
|
|
11
|
+
let FileAccessRule = class FileAccessRule {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.FILE_NODES = ['n8n-nodes-base.readWriteFile', 'n8n-nodes-base.readBinaryFiles'];
|
|
14
|
+
this.id = 'file-access-restriction-v2';
|
|
15
|
+
}
|
|
16
|
+
getMetadata() {
|
|
17
|
+
return {
|
|
18
|
+
version: 'v2',
|
|
19
|
+
title: 'File Access Restrictions',
|
|
20
|
+
description: 'File access is now restricted to a default directory for security purposes',
|
|
21
|
+
category: "workflow",
|
|
22
|
+
severity: "high",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async getRecommendations() {
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
action: 'Configure file access paths',
|
|
29
|
+
description: 'Set N8N_RESTRICT_FILE_ACCESS_TO to a semicolon-separated list of allowed paths if workflows need to access files outside the default directory',
|
|
30
|
+
documentationUrl: this.getMetadata().documentationUrl,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
async detectWorkflow(_workflow, nodesGroupedByType) {
|
|
35
|
+
const fileNodes = this.FILE_NODES.flatMap((nodeType) => nodesGroupedByType.get(nodeType) ?? []);
|
|
36
|
+
if (fileNodes.length === 0)
|
|
37
|
+
return { isAffected: false, issues: [] };
|
|
38
|
+
return {
|
|
39
|
+
isAffected: true,
|
|
40
|
+
issues: fileNodes.map((node) => ({
|
|
41
|
+
title: `File access node '${node.type}' with name '${node.name}' affected`,
|
|
42
|
+
description: 'File access for this node is now restricted to configured directories.',
|
|
43
|
+
level: "warning",
|
|
44
|
+
})),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.FileAccessRule = FileAccessRule;
|
|
49
|
+
exports.FileAccessRule = FileAccessRule = __decorate([
|
|
50
|
+
(0, di_1.Service)()
|
|
51
|
+
], FileAccessRule);
|
|
52
|
+
//# sourceMappingURL=file-access.rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-access.rule.js","sourceRoot":"","sources":["../../../../../src/modules/breaking-changes/rules/v2/file-access.rule.ts"],"names":[],"mappings":";;;;;;;;;AACA,gCAAkC;AAY3B,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;QACW,eAAU,GAAG,CAAC,8BAA8B,EAAE,gCAAgC,CAAC,CAAC;QAEjG,OAAE,GAAW,4BAA4B,CAAC;IAuC3C,CAAC;IArCA,WAAW;QACV,OAAO;YACN,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,4EAA4E;YACzF,QAAQ,YAAiC;YACzC,QAAQ,QAA6B;SACrC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB;QACvB,OAAO;YACN;gBACC,MAAM,EAAE,6BAA6B;gBACrC,WAAW,EACV,gJAAgJ;gBACjJ,gBAAgB,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,gBAAgB;aACrD;SACD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CACnB,SAAyB,EACzB,kBAAwC;QAExC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAChG,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAErE,OAAO;YACN,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAChC,KAAK,EAAE,qBAAqB,IAAI,CAAC,IAAI,gBAAgB,IAAI,CAAC,IAAI,YAAY;gBAC1E,WAAW,EAAE,wEAAwE;gBACrF,KAAK,WAAoB;aACzB,CAAC,CAAC;SACH,CAAC;IACH,CAAC;CACD,CAAA;AA1CY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,YAAO,GAAE;GACG,cAAc,CA0C1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.v2Rules = void 0;
|
|
4
|
+
const file_access_rule_1 = require("./file-access.rule");
|
|
5
|
+
const process_env_access_rule_1 = require("./process-env-access.rule");
|
|
6
|
+
const removed_nodes_rule_1 = require("./removed-nodes.rule");
|
|
7
|
+
const v2Rules = [removed_nodes_rule_1.RemovedNodesRule, process_env_access_rule_1.ProcessEnvAccessRule, file_access_rule_1.FileAccessRule];
|
|
8
|
+
exports.v2Rules = v2Rules;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/breaking-changes/rules/v2/index.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AACpD,uEAAiE;AACjE,6DAAwD;AAExD,MAAM,OAAO,GAAG,CAAC,qCAAgB,EAAE,8CAAoB,EAAE,iCAAc,CAAC,CAAC;AAChE,0BAAO"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WorkflowEntity } from '@n8n/db';
|
|
2
|
+
import { INode } from 'n8n-workflow';
|
|
3
|
+
import type { BreakingChangeMetadata, IBreakingChangeWorkflowRule, Recommendation, WorkflowDetectionResult } from '../../types';
|
|
4
|
+
export declare class ProcessEnvAccessRule implements IBreakingChangeWorkflowRule {
|
|
5
|
+
id: string;
|
|
6
|
+
getMetadata(): BreakingChangeMetadata;
|
|
7
|
+
detectWorkflow(workflow: WorkflowEntity, _nodesGroupedByType: Map<string, INode[]>): Promise<WorkflowDetectionResult>;
|
|
8
|
+
getRecommendations(): Promise<Recommendation[]>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.ProcessEnvAccessRule = void 0;
|
|
10
|
+
const di_1 = require("@n8n/di");
|
|
11
|
+
let ProcessEnvAccessRule = class ProcessEnvAccessRule {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.id = 'process-env-access-v2';
|
|
14
|
+
}
|
|
15
|
+
getMetadata() {
|
|
16
|
+
return {
|
|
17
|
+
version: 'v2',
|
|
18
|
+
title: 'Block process.env Access in Expressions and Code nodes',
|
|
19
|
+
description: 'Direct access to process.env is blocked by default for security',
|
|
20
|
+
category: "workflow",
|
|
21
|
+
severity: "high",
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async detectWorkflow(workflow, _nodesGroupedByType) {
|
|
25
|
+
const processEnvPattern = /process\s*(?:\/\*[\s\S]*?\*\/)?\s*\??\.?\s*env\b/;
|
|
26
|
+
const affectedNodes = [];
|
|
27
|
+
workflow.nodes.forEach((node) => {
|
|
28
|
+
if (node.type === 'n8n-nodes-base.code') {
|
|
29
|
+
const code = typeof node.parameters?.code === 'string' ? node.parameters.code : undefined;
|
|
30
|
+
if (code && processEnvPattern.test(code)) {
|
|
31
|
+
affectedNodes.push(node.name);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const nodeJson = JSON.stringify(node.parameters);
|
|
36
|
+
if (processEnvPattern.test(nodeJson) && !affectedNodes.includes(node.name)) {
|
|
37
|
+
affectedNodes.push(node.name);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
isAffected: affectedNodes.length > 0,
|
|
43
|
+
issues: affectedNodes.length > 0
|
|
44
|
+
? [
|
|
45
|
+
{
|
|
46
|
+
title: 'process.env access detected',
|
|
47
|
+
description: `The following nodes contain process.env access: '${affectedNodes.join(', ')}'. This will be blocked by default in v2.0.0.`,
|
|
48
|
+
level: "error",
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
: [],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async getRecommendations() {
|
|
55
|
+
return [
|
|
56
|
+
{
|
|
57
|
+
action: 'Remove process.env usage',
|
|
58
|
+
description: 'Replace process.env with environment variables configured in n8n',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
action: 'Enable access if required',
|
|
62
|
+
description: 'Set N8N_BLOCK_ENV_ACCESS_IN_NODE=false to allow access',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.ProcessEnvAccessRule = ProcessEnvAccessRule;
|
|
68
|
+
exports.ProcessEnvAccessRule = ProcessEnvAccessRule = __decorate([
|
|
69
|
+
(0, di_1.Service)()
|
|
70
|
+
], ProcessEnvAccessRule);
|
|
71
|
+
//# sourceMappingURL=process-env-access.rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-env-access.rule.js","sourceRoot":"","sources":["../../../../../src/modules/breaking-changes/rules/v2/process-env-access.rule.ts"],"names":[],"mappings":";;;;;;;;;AACA,gCAAkC;AAY3B,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;QACN,OAAE,GAAW,uBAAuB,CAAC;IAiEtC,CAAC;IAhEA,WAAW;QACV,OAAO;YACN,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,wDAAwD;YAC/D,WAAW,EAAE,iEAAiE;YAC9E,QAAQ,YAAiC;YACzC,QAAQ,QAA6B;SACrC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CACnB,QAAwB,EACxB,mBAAyC;QAKzC,MAAM,iBAAiB,GAAG,kDAAkD,CAAC;QAE7E,MAAM,aAAa,GAAa,EAAE,CAAC;QAEnC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAE/B,IAAI,IAAI,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;gBACzC,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,UAAU,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBAC1F,IAAI,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC1C,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;iBAAM,CAAC;gBAEP,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACjD,IAAI,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5E,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;QACF,CAAC,CAAC,CAAC;QAEH,OAAO;YACN,UAAU,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC;YACpC,MAAM,EACL,aAAa,CAAC,MAAM,GAAG,CAAC;gBACvB,CAAC,CAAC;oBACA;wBACC,KAAK,EAAE,6BAA6B;wBACpC,WAAW,EAAE,oDAAoD,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,+CAA+C;wBACxI,KAAK,SAAkB;qBACvB;iBACD;gBACF,CAAC,CAAC,EAAE;SACN,CAAC;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB;QACvB,OAAO;YACN;gBACC,MAAM,EAAE,0BAA0B;gBAClC,WAAW,EAAE,kEAAkE;aAC/E;YACD;gBACC,MAAM,EAAE,2BAA2B;gBACnC,WAAW,EAAE,wDAAwD;aACrE;SACD,CAAC;IACH,CAAC;CACD,CAAA;AAlEY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,YAAO,GAAE;GACG,oBAAoB,CAkEhC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorkflowEntity } from '@n8n/db';
|
|
2
|
+
import { INode } from 'n8n-workflow';
|
|
3
|
+
import type { BreakingChangeMetadata, WorkflowDetectionResult, Recommendation, IBreakingChangeWorkflowRule } from '../../types';
|
|
4
|
+
export declare class RemovedNodesRule implements IBreakingChangeWorkflowRule {
|
|
5
|
+
private readonly REMOVED_NODES;
|
|
6
|
+
id: string;
|
|
7
|
+
getMetadata(): BreakingChangeMetadata;
|
|
8
|
+
getRecommendations(): Promise<Recommendation[]>;
|
|
9
|
+
detectWorkflow(_workflow: WorkflowEntity, nodesGroupedByType: Map<string, INode[]>): Promise<WorkflowDetectionResult>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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.RemovedNodesRule = void 0;
|
|
10
|
+
const di_1 = require("@n8n/di");
|
|
11
|
+
let RemovedNodesRule = class RemovedNodesRule {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.REMOVED_NODES = [
|
|
14
|
+
'n8n-nodes-base.spontit',
|
|
15
|
+
'n8n-nodes-base.crowdDev',
|
|
16
|
+
'n8n-nodes-base.kitemaker',
|
|
17
|
+
];
|
|
18
|
+
this.id = 'removed-nodes-v2';
|
|
19
|
+
}
|
|
20
|
+
getMetadata() {
|
|
21
|
+
return {
|
|
22
|
+
version: 'v2',
|
|
23
|
+
title: 'Removed Deprecated Nodes',
|
|
24
|
+
description: 'Several deprecated nodes have been removed and will no longer work',
|
|
25
|
+
category: "workflow",
|
|
26
|
+
severity: "critical",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async getRecommendations() {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
action: 'Update affected workflows',
|
|
33
|
+
description: 'Replace removed nodes with their updated versions or alternatives',
|
|
34
|
+
documentationUrl: this.getMetadata().documentationUrl,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
async detectWorkflow(_workflow, nodesGroupedByType) {
|
|
39
|
+
const removedNodes = this.REMOVED_NODES.flatMap((type) => nodesGroupedByType.get(type) ?? []);
|
|
40
|
+
if (removedNodes.length === 0)
|
|
41
|
+
return { isAffected: false, issues: [] };
|
|
42
|
+
return {
|
|
43
|
+
isAffected: true,
|
|
44
|
+
issues: removedNodes.map((node) => ({
|
|
45
|
+
title: `Node '${node.type}' with name '${node.name}' has been removed`,
|
|
46
|
+
description: `The node type '${node.type}' is no longer available. Please replace it with an alternative.`,
|
|
47
|
+
level: "error",
|
|
48
|
+
})),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.RemovedNodesRule = RemovedNodesRule;
|
|
53
|
+
exports.RemovedNodesRule = RemovedNodesRule = __decorate([
|
|
54
|
+
(0, di_1.Service)()
|
|
55
|
+
], RemovedNodesRule);
|
|
56
|
+
//# sourceMappingURL=removed-nodes.rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removed-nodes.rule.js","sourceRoot":"","sources":["../../../../../src/modules/breaking-changes/rules/v2/removed-nodes.rule.ts"],"names":[],"mappings":";;;;;;;;;AACA,gCAAkC;AAY3B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAAtB;QACW,kBAAa,GAAG;YAChC,wBAAwB;YACxB,yBAAyB;YACzB,0BAA0B;SAC1B,CAAC;QAEF,OAAE,GAAW,kBAAkB,CAAC;IAsCjC,CAAC;IApCA,WAAW;QACV,OAAO;YACN,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,oEAAoE;YACjF,QAAQ,YAAiC;YACzC,QAAQ,YAAiC;SACzC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB;QACvB,OAAO;YACN;gBACC,MAAM,EAAE,2BAA2B;gBACnC,WAAW,EAAE,mEAAmE;gBAChF,gBAAgB,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,gBAAgB;aACrD;SACD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CACnB,SAAyB,EACzB,kBAAwC;QAExC,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9F,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAExE,OAAO;YACN,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACnC,KAAK,EAAE,SAAS,IAAI,CAAC,IAAI,gBAAgB,IAAI,CAAC,IAAI,oBAAoB;gBACtE,WAAW,EAAE,kBAAkB,IAAI,CAAC,IAAI,kEAAkE;gBAC1G,KAAK,SAAkB;aACvB,CAAC,CAAC;SACH,CAAC;IACH,CAAC;CACD,CAAA;AA7CY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,YAAO,GAAE;GACG,gBAAgB,CA6C5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DetectionResult } from './rule.types';
|
|
2
|
+
export interface DetectionReport {
|
|
3
|
+
generatedAt: Date;
|
|
4
|
+
targetVersion: string;
|
|
5
|
+
currentVersion: string;
|
|
6
|
+
summary: {
|
|
7
|
+
totalIssues: number;
|
|
8
|
+
criticalIssues: number;
|
|
9
|
+
};
|
|
10
|
+
results: DetectionResult[];
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.types.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/types/detection.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./rule.types"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { WorkflowEntity } from '@n8n/db';
|
|
2
|
+
import type { INode } from 'n8n-workflow';
|
|
3
|
+
export declare const enum BreakingChangeSeverity {
|
|
4
|
+
critical = "critical",
|
|
5
|
+
high = "high",
|
|
6
|
+
medium = "medium",
|
|
7
|
+
low = "low"
|
|
8
|
+
}
|
|
9
|
+
export declare const enum BreakingChangeCategory {
|
|
10
|
+
workflow = "workflow",
|
|
11
|
+
instance = "instance",
|
|
12
|
+
environment = "environment",
|
|
13
|
+
database = "database",
|
|
14
|
+
infrastructure = "infrastructure"
|
|
15
|
+
}
|
|
16
|
+
export declare const enum IssueLevel {
|
|
17
|
+
error = "error",
|
|
18
|
+
warning = "warning",
|
|
19
|
+
info = "info"
|
|
20
|
+
}
|
|
21
|
+
export type BreakingChangeVersion = 'v2';
|
|
22
|
+
export interface BreakingChangeMetadata {
|
|
23
|
+
version: BreakingChangeVersion;
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
category: BreakingChangeCategory;
|
|
27
|
+
severity: BreakingChangeSeverity;
|
|
28
|
+
documentationUrl?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface WorkflowDetectionResult {
|
|
31
|
+
isAffected: boolean;
|
|
32
|
+
issues: DetectionIssue[];
|
|
33
|
+
}
|
|
34
|
+
export interface InstanceDetectionResult {
|
|
35
|
+
isAffected: boolean;
|
|
36
|
+
instanceIssues: DetectionIssue[];
|
|
37
|
+
recommendations: Recommendation[];
|
|
38
|
+
}
|
|
39
|
+
export type AffectedWorkflow = Omit<WorkflowDetectionResult, 'isAffected'> & {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
active: boolean;
|
|
43
|
+
};
|
|
44
|
+
export interface DetectionResult {
|
|
45
|
+
ruleId: string;
|
|
46
|
+
affectedWorkflows: AffectedWorkflow[];
|
|
47
|
+
instanceIssues: DetectionIssue[];
|
|
48
|
+
recommendations: Recommendation[];
|
|
49
|
+
}
|
|
50
|
+
export interface DetectionIssue {
|
|
51
|
+
title: string;
|
|
52
|
+
description: string;
|
|
53
|
+
level: IssueLevel;
|
|
54
|
+
}
|
|
55
|
+
export interface Recommendation {
|
|
56
|
+
action: string;
|
|
57
|
+
description: string;
|
|
58
|
+
documentationUrl?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface IBreakingChangeInstanceRule {
|
|
61
|
+
id: string;
|
|
62
|
+
getMetadata(): BreakingChangeMetadata;
|
|
63
|
+
detect(): Promise<InstanceDetectionResult>;
|
|
64
|
+
}
|
|
65
|
+
export interface IBreakingChangeWorkflowRule {
|
|
66
|
+
id: string;
|
|
67
|
+
getMetadata(): BreakingChangeMetadata;
|
|
68
|
+
getRecommendations(workflowResults: AffectedWorkflow[]): Promise<Recommendation[]>;
|
|
69
|
+
detectWorkflow(workflow: WorkflowEntity, nodesGroupedByType: Map<string, INode[]>): Promise<WorkflowDetectionResult>;
|
|
70
|
+
}
|
|
71
|
+
export type IBreakingChangeRule = IBreakingChangeInstanceRule | IBreakingChangeWorkflowRule;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IssueLevel = exports.BreakingChangeCategory = exports.BreakingChangeSeverity = void 0;
|
|
4
|
+
var BreakingChangeSeverity;
|
|
5
|
+
(function (BreakingChangeSeverity) {
|
|
6
|
+
BreakingChangeSeverity["critical"] = "critical";
|
|
7
|
+
BreakingChangeSeverity["high"] = "high";
|
|
8
|
+
BreakingChangeSeverity["medium"] = "medium";
|
|
9
|
+
BreakingChangeSeverity["low"] = "low";
|
|
10
|
+
})(BreakingChangeSeverity || (exports.BreakingChangeSeverity = BreakingChangeSeverity = {}));
|
|
11
|
+
var BreakingChangeCategory;
|
|
12
|
+
(function (BreakingChangeCategory) {
|
|
13
|
+
BreakingChangeCategory["workflow"] = "workflow";
|
|
14
|
+
BreakingChangeCategory["instance"] = "instance";
|
|
15
|
+
BreakingChangeCategory["environment"] = "environment";
|
|
16
|
+
BreakingChangeCategory["database"] = "database";
|
|
17
|
+
BreakingChangeCategory["infrastructure"] = "infrastructure";
|
|
18
|
+
})(BreakingChangeCategory || (exports.BreakingChangeCategory = BreakingChangeCategory = {}));
|
|
19
|
+
var IssueLevel;
|
|
20
|
+
(function (IssueLevel) {
|
|
21
|
+
IssueLevel["error"] = "error";
|
|
22
|
+
IssueLevel["warning"] = "warning";
|
|
23
|
+
IssueLevel["info"] = "info";
|
|
24
|
+
})(IssueLevel || (exports.IssueLevel = IssueLevel = {}));
|
|
25
|
+
//# sourceMappingURL=rule.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule.types.js","sourceRoot":"","sources":["../../../../src/modules/breaking-changes/types/rule.types.ts"],"names":[],"mappings":";;;AAGA,IAAkB,sBAKjB;AALD,WAAkB,sBAAsB;IACvC,+CAAqB,CAAA;IACrB,uCAAa,CAAA;IACb,2CAAiB,CAAA;IACjB,qCAAW,CAAA;AACZ,CAAC,EALiB,sBAAsB,sCAAtB,sBAAsB,QAKvC;AAED,IAAkB,sBAMjB;AAND,WAAkB,sBAAsB;IACvC,+CAAqB,CAAA;IACrB,+CAAqB,CAAA;IACrB,qDAA2B,CAAA;IAC3B,+CAAqB,CAAA;IACrB,2DAAiC,CAAA;AAClC,CAAC,EANiB,sBAAsB,sCAAtB,sBAAsB,QAMvC;AAED,IAAkB,UAIjB;AAJD,WAAkB,UAAU;IAC3B,6BAAe,CAAA;IACf,iCAAmB,CAAA;IACnB,2BAAa,CAAA;AACd,CAAC,EAJiB,UAAU,0BAAV,UAAU,QAI3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChatHubProvider } from '@n8n/api-types';
|
|
2
|
+
import { WithTimestamps, User, CredentialsEntity } from '@n8n/db';
|
|
3
|
+
export declare class ChatHubAgent extends WithTimestamps {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string | null;
|
|
7
|
+
systemPrompt: string;
|
|
8
|
+
ownerId: string;
|
|
9
|
+
owner?: User;
|
|
10
|
+
credentialId: string | null;
|
|
11
|
+
credential?: CredentialsEntity | null;
|
|
12
|
+
provider: ChatHubProvider;
|
|
13
|
+
model: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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.ChatHubAgent = void 0;
|
|
13
|
+
const db_1 = require("@n8n/db");
|
|
14
|
+
const typeorm_1 = require("@n8n/typeorm");
|
|
15
|
+
let ChatHubAgent = class ChatHubAgent extends db_1.WithTimestamps {
|
|
16
|
+
};
|
|
17
|
+
exports.ChatHubAgent = ChatHubAgent;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], ChatHubAgent.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 128 }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], ChatHubAgent.prototype, "name", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 512, nullable: true }),
|
|
28
|
+
__metadata("design:type", Object)
|
|
29
|
+
], ChatHubAgent.prototype, "description", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], ChatHubAgent.prototype, "systemPrompt", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ type: String }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], ChatHubAgent.prototype, "ownerId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.ManyToOne)('User', { onDelete: 'CASCADE' }),
|
|
40
|
+
(0, typeorm_1.JoinColumn)({ name: 'ownerId' }),
|
|
41
|
+
__metadata("design:type", db_1.User)
|
|
42
|
+
], ChatHubAgent.prototype, "owner", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 36, nullable: true }),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], ChatHubAgent.prototype, "credentialId", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.ManyToOne)('CredentialsEntity', { onDelete: 'SET NULL', nullable: true }),
|
|
49
|
+
(0, typeorm_1.JoinColumn)({ name: 'credentialId' }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], ChatHubAgent.prototype, "credential", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 16, nullable: true }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], ChatHubAgent.prototype, "provider", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 64, nullable: true }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], ChatHubAgent.prototype, "model", void 0);
|
|
60
|
+
exports.ChatHubAgent = ChatHubAgent = __decorate([
|
|
61
|
+
(0, typeorm_1.Entity)({ name: 'chat_hub_agents' })
|
|
62
|
+
], ChatHubAgent);
|
|
63
|
+
//# sourceMappingURL=chat-hub-agent.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-hub-agent.entity.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-agent.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gCAAkE;AAClE,0CAA6F;AAGtF,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,mBAAc;CA2D/C,CAAA;AA3DY,oCAAY;AAExB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;wCACpB;AAMX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;0CAC5B;AAMb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDAC9B;AAM3B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDACJ;AAMrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CACT;AAOhB;IAFC,IAAA,mBAAS,EAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC1C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8BACxB,SAAI;2CAAC;AAMb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDAC5B;AAO5B;IAFC,IAAA,mBAAS,EAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACxE,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;;gDACC;AAMtC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC9B;AAM1B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC1C;uBA1DF,YAAY;IADxB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;GACvB,YAAY,CA2DxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataSource, EntityManager, Repository } from '@n8n/typeorm';
|
|
2
|
+
import { ChatHubAgent } from './chat-hub-agent.entity';
|
|
3
|
+
export declare class ChatHubAgentRepository extends Repository<ChatHubAgent> {
|
|
4
|
+
constructor(dataSource: DataSource);
|
|
5
|
+
createAgent(agent: Partial<ChatHubAgent>, trx?: EntityManager): Promise<ChatHubAgent>;
|
|
6
|
+
updateAgent(id: string, updates: Partial<Pick<ChatHubAgent, 'name' | 'description' | 'systemPrompt' | 'provider' | 'model' | 'credentialId'>>, trx?: EntityManager): Promise<ChatHubAgent>;
|
|
7
|
+
deleteAgent(id: string, trx?: EntityManager): Promise<import("@n8n/typeorm").DeleteResult>;
|
|
8
|
+
getManyByUserId(userId: string): Promise<ChatHubAgent[]>;
|
|
9
|
+
getOneById(id: string, userId: string, trx?: EntityManager): Promise<ChatHubAgent | null>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.ChatHubAgentRepository = void 0;
|
|
13
|
+
const db_1 = require("@n8n/db");
|
|
14
|
+
const di_1 = require("@n8n/di");
|
|
15
|
+
const typeorm_1 = require("@n8n/typeorm");
|
|
16
|
+
const chat_hub_agent_entity_1 = require("./chat-hub-agent.entity");
|
|
17
|
+
let ChatHubAgentRepository = class ChatHubAgentRepository extends typeorm_1.Repository {
|
|
18
|
+
constructor(dataSource) {
|
|
19
|
+
super(chat_hub_agent_entity_1.ChatHubAgent, dataSource.manager);
|
|
20
|
+
}
|
|
21
|
+
async createAgent(agent, trx) {
|
|
22
|
+
return await (0, db_1.withTransaction)(this.manager, trx, async (em) => {
|
|
23
|
+
await em.insert(chat_hub_agent_entity_1.ChatHubAgent, agent);
|
|
24
|
+
return await em.findOneOrFail(chat_hub_agent_entity_1.ChatHubAgent, {
|
|
25
|
+
where: { id: agent.id },
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async updateAgent(id, updates, trx) {
|
|
30
|
+
return await (0, db_1.withTransaction)(this.manager, trx, async (em) => {
|
|
31
|
+
await em.update(chat_hub_agent_entity_1.ChatHubAgent, { id }, updates);
|
|
32
|
+
return await em.findOneOrFail(chat_hub_agent_entity_1.ChatHubAgent, {
|
|
33
|
+
where: { id },
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async deleteAgent(id, trx) {
|
|
38
|
+
return await (0, db_1.withTransaction)(this.manager, trx, async (em) => {
|
|
39
|
+
return await em.delete(chat_hub_agent_entity_1.ChatHubAgent, { id });
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async getManyByUserId(userId) {
|
|
43
|
+
return await this.find({
|
|
44
|
+
where: { ownerId: userId },
|
|
45
|
+
order: { createdAt: 'DESC' },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async getOneById(id, userId, trx) {
|
|
49
|
+
return await (0, db_1.withTransaction)(this.manager, trx, async (em) => {
|
|
50
|
+
return await em.findOne(chat_hub_agent_entity_1.ChatHubAgent, {
|
|
51
|
+
where: { id, ownerId: userId },
|
|
52
|
+
});
|
|
53
|
+
}, false);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.ChatHubAgentRepository = ChatHubAgentRepository;
|
|
57
|
+
exports.ChatHubAgentRepository = ChatHubAgentRepository = __decorate([
|
|
58
|
+
(0, di_1.Service)(),
|
|
59
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
60
|
+
], ChatHubAgentRepository);
|
|
61
|
+
//# sourceMappingURL=chat-hub-agent.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-hub-agent.repository.js","sourceRoot":"","sources":["../../../src/modules/chat-hub/chat-hub-agent.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAA0C;AAC1C,gCAAkC;AAClC,0CAAqE;AAErE,mEAAuD;AAGhD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,oBAAwB;IACnE,YAAY,UAAsB;QACjC,KAAK,CAAC,oCAAY,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAA4B,EAAE,GAAmB;QAClE,OAAO,MAAM,IAAA,oBAAe,EAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAC5D,MAAM,EAAE,CAAC,MAAM,CAAC,oCAAY,EAAE,KAAK,CAAC,CAAC;YACrC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,oCAAY,EAAE;gBAC3C,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE;aACvB,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAChB,EAAU,EACV,OAKC,EACD,GAAmB;QAEnB,OAAO,MAAM,IAAA,oBAAe,EAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAC5D,MAAM,EAAE,CAAC,MAAM,CAAC,oCAAY,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;YAC/C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,oCAAY,EAAE;gBAC3C,KAAK,EAAE,EAAE,EAAE,EAAE;aACb,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAAU,EAAE,GAAmB;QAChD,OAAO,MAAM,IAAA,oBAAe,EAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAC5D,OAAO,MAAM,EAAE,CAAC,MAAM,CAAC,oCAAY,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,MAAc;QACnC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC;YACtB,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;YAC1B,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;SAC5B,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,EAAE,MAAc,EAAE,GAAmB;QAC/D,OAAO,MAAM,IAAA,oBAAe,EAC3B,IAAI,CAAC,OAAO,EACZ,GAAG,EACH,KAAK,EAAE,EAAE,EAAE,EAAE;YACZ,OAAO,MAAM,EAAE,CAAC,OAAO,CAAC,oCAAY,EAAE;gBACrC,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;aAC9B,CAAC,CAAC;QACJ,CAAC,EACD,KAAK,CACL,CAAC;IACH,CAAC;CACD,CAAA;AAzDY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,YAAO,GAAE;qCAEe,oBAAU;GADtB,sBAAsB,CAyDlC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChatModelsResponse } from '@n8n/api-types';
|
|
2
|
+
import { Logger } from '@n8n/backend-common';
|
|
3
|
+
import type { User } from '@n8n/db';
|
|
4
|
+
import type { ChatHubAgent } from './chat-hub-agent.entity';
|
|
5
|
+
import { ChatHubAgentRepository } from './chat-hub-agent.repository';
|
|
6
|
+
import { ChatHubCredentialsService } from './chat-hub-credentials.service';
|
|
7
|
+
export declare class ChatHubAgentService {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private readonly chatAgentRepository;
|
|
10
|
+
private readonly chatHubCredentialsService;
|
|
11
|
+
constructor(logger: Logger, chatAgentRepository: ChatHubAgentRepository, chatHubCredentialsService: ChatHubCredentialsService);
|
|
12
|
+
getAgentsByUserIdAsModels(userId: string): Promise<ChatModelsResponse['custom-agent']>;
|
|
13
|
+
getAgentsByUserId(userId: string): Promise<ChatHubAgent[]>;
|
|
14
|
+
getAgentById(id: string, userId: string): Promise<ChatHubAgent>;
|
|
15
|
+
createAgent(user: User, data: {
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
systemPrompt: string;
|
|
19
|
+
credentialId: string;
|
|
20
|
+
provider: ChatHubAgent['provider'];
|
|
21
|
+
model: string;
|
|
22
|
+
}): Promise<ChatHubAgent>;
|
|
23
|
+
updateAgent(id: string, user: User, updates: {
|
|
24
|
+
name?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
systemPrompt?: string;
|
|
27
|
+
credentialId?: string;
|
|
28
|
+
provider?: string;
|
|
29
|
+
model?: string;
|
|
30
|
+
}): Promise<ChatHubAgent>;
|
|
31
|
+
deleteAgent(id: string, userId: string): Promise<void>;
|
|
32
|
+
}
|