@atom8n/n8n 2.4.7 → 2.5.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/chat/chat-service.types.d.ts +6 -6
- package/dist/commands/execute-batch.d.ts +2 -2
- package/dist/commands/execute.js +0 -0
- package/dist/commands/import/credentials.d.ts +2 -2
- package/dist/commands/import/credentials.js +0 -0
- package/dist/commands/import/workflow.d.ts +2 -2
- package/dist/commands/ldap/reset.d.ts +2 -2
- package/dist/commands/mcp.d.ts +23 -0
- package/dist/commands/mcp.js +315 -0
- package/dist/commands/run.d.ts +23 -0
- package/dist/commands/run.js +162 -0
- package/dist/controllers/annotation-tags.controller.ee.d.ts +1 -1
- package/dist/controllers/cli.controller.d.ts +26 -0
- package/dist/controllers/cli.controller.js +334 -0
- package/dist/controllers/orchestration.controller.js +0 -0
- package/dist/controllers/users.controller.d.ts +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/environments.ee/source-control/types/source-control-set-branch.js +0 -0
- package/dist/eventbus/event-message-classes/index.js +0 -0
- package/dist/events/relays/workflow-failure-notification.event-relay.d.ts +13 -0
- package/dist/events/relays/workflow-failure-notification.event-relay.js +77 -0
- package/dist/executions/execution-data/types.d.ts +17 -0
- package/dist/executions/execution-data/types.js +2 -0
- package/dist/executions/failed-run-factory.d.ts +4 -0
- package/dist/executions/failed-run-factory.js +71 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -0
- package/dist/interfaces.d.ts +1 -1
- package/dist/license.js +1 -1
- package/dist/middlewares/webview-frame-options.d.ts +2 -0
- package/dist/middlewares/webview-frame-options.js +22 -0
- package/dist/modules/chat-hub/chat-hub-extractor.d.ts +22 -0
- package/dist/modules/chat-hub/chat-hub-extractor.js +63 -0
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-user-entry-storage.d.ts +11 -0
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-user-entry-storage.js +58 -0
- package/dist/modules/dynamic-credentials.ee/database/entities/dynamic-credential-user-entry.d.ts +12 -0
- package/dist/modules/dynamic-credentials.ee/database/entities/dynamic-credential-user-entry.js +64 -0
- package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.d.ts +5 -0
- package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.js +25 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.d.ts +5 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.js +36 -0
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.d.ts +12 -0
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js +69 -0
- package/dist/modules/dynamic-credentials.ee/services/resolver-config-expression.service.d.ts +7 -0
- package/dist/modules/dynamic-credentials.ee/services/resolver-config-expression.service.js +46 -0
- package/dist/modules/insights/database/entities/insights-metadata.js +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js +4 -1
- package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +1 -1
- package/dist/modules/insights/insights.module.d.ts +1 -1
- package/dist/modules/insights/insights.service.d.ts +1 -1
- package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.d.ts +6 -0
- package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.js +28 -0
- package/dist/modules/log-streaming.ee/database/entities/index.d.ts +1 -0
- package/dist/modules/log-streaming.ee/database/entities/index.js +5 -0
- package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.d.ts +5 -0
- package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.js +25 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.d.ts +4 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.js +24 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.d.ts +17 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.js +131 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.d.ts +22 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.js +116 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.d.ts +35 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.js +328 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.d.ts +28 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.js +74 -0
- package/dist/modules/log-streaming.ee/log-streaming-destination.service.d.ts +32 -0
- package/dist/modules/log-streaming.ee/log-streaming-destination.service.js +175 -0
- package/dist/modules/log-streaming.ee/log-streaming.controller.d.ts +15 -0
- package/dist/modules/log-streaming.ee/log-streaming.controller.js +149 -0
- package/dist/modules/log-streaming.ee/log-streaming.module.d.ts +5 -0
- package/dist/modules/log-streaming.ee/log-streaming.module.js +66 -0
- package/dist/modules/mcp/mcp-oauth.helpers.js +0 -0
- package/dist/modules/mcp/mcp.oauth-clients.controller.js +0 -0
- package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +10 -10
- package/dist/modules/mcp/tools/schemas.d.ts +10 -10
- package/dist/modules/source-control.ee/constants.d.ts +17 -0
- package/dist/modules/source-control.ee/constants.js +22 -0
- package/dist/modules/source-control.ee/middleware/source-control-enabled-middleware.ee.d.ts +2 -0
- package/dist/modules/source-control.ee/middleware/source-control-enabled-middleware.ee.js +18 -0
- package/dist/modules/source-control.ee/source-control-export.service.ee.d.ts +37 -0
- package/dist/modules/source-control.ee/source-control-export.service.ee.js +426 -0
- package/dist/modules/source-control.ee/source-control-git.service.ee.d.ts +59 -0
- package/dist/modules/source-control.ee/source-control-git.service.ee.js +427 -0
- package/dist/modules/source-control.ee/source-control-helper.ee.d.ts +49 -0
- package/dist/modules/source-control.ee/source-control-helper.ee.js +241 -0
- package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +110 -0
- package/dist/modules/source-control.ee/source-control-import.service.ee.js +957 -0
- package/dist/modules/source-control.ee/source-control-preferences.service.ee.d.ts +46 -0
- package/dist/modules/source-control.ee/source-control-preferences.service.ee.js +309 -0
- package/dist/modules/source-control.ee/source-control-resource-helper.d.ts +4 -0
- package/dist/modules/source-control.ee/source-control-resource-helper.js +20 -0
- package/dist/modules/source-control.ee/source-control-scoped.service.d.ts +17 -0
- package/dist/modules/source-control.ee/source-control-scoped.service.js +134 -0
- package/dist/modules/source-control.ee/source-control-status.service.ee.d.ts +90 -0
- package/dist/modules/source-control.ee/source-control-status.service.ee.js +596 -0
- package/dist/modules/source-control.ee/source-control.config.d.ts +3 -0
- package/dist/modules/source-control.ee/source-control.config.js +26 -0
- package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +157 -0
- package/dist/modules/source-control.ee/source-control.controller.ee.js +347 -0
- package/dist/modules/source-control.ee/source-control.module.d.ts +4 -0
- package/dist/modules/source-control.ee/source-control.module.js +59 -0
- package/dist/modules/source-control.ee/source-control.service.ee.d.ts +125 -0
- package/dist/modules/source-control.ee/source-control.service.ee.js +466 -0
- package/dist/modules/source-control.ee/types/export-result.d.ts +10 -0
- package/dist/modules/source-control.ee/types/export-result.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-credential.d.ts +14 -0
- package/dist/modules/source-control.ee/types/exportable-credential.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-folders.d.ts +11 -0
- package/dist/modules/source-control.ee/types/exportable-folders.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-project.d.ts +17 -0
- package/dist/modules/source-control.ee/types/exportable-project.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-tags.d.ts +5 -0
- package/dist/modules/source-control.ee/types/exportable-tags.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-variable.d.ts +7 -0
- package/dist/modules/source-control.ee/types/exportable-variable.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-workflow.d.ts +14 -0
- package/dist/modules/source-control.ee/types/exportable-workflow.js +2 -0
- package/dist/modules/source-control.ee/types/import-result.d.ts +20 -0
- package/dist/modules/source-control.ee/types/import-result.js +2 -0
- package/dist/modules/source-control.ee/types/key-pair-type.d.ts +1 -0
- package/dist/modules/source-control.ee/types/key-pair-type.js +2 -0
- package/dist/modules/source-control.ee/types/key-pair.d.ts +4 -0
- package/dist/modules/source-control.ee/types/key-pair.js +2 -0
- package/dist/modules/source-control.ee/types/requests.d.ts +21 -0
- package/dist/modules/source-control.ee/types/requests.js +2 -0
- package/dist/modules/source-control.ee/types/resource-owner.d.ts +17 -0
- package/dist/modules/source-control.ee/types/resource-owner.js +2 -0
- package/dist/modules/source-control.ee/types/source-control-commit.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-commit.js +20 -0
- package/dist/modules/source-control.ee/types/source-control-context.d.ts +7 -0
- package/dist/modules/source-control.ee/types/source-control-context.js +16 -0
- package/dist/modules/source-control.ee/types/source-control-disconnect.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-disconnect.js +21 -0
- package/dist/modules/source-control.ee/types/source-control-generate-key-pair.d.ts +4 -0
- package/dist/modules/source-control.ee/types/source-control-generate-key-pair.js +21 -0
- package/dist/modules/source-control.ee/types/source-control-get-status.d.ts +10 -0
- package/dist/modules/source-control.ee/types/source-control-get-status.js +42 -0
- package/dist/modules/source-control.ee/types/source-control-preferences.d.ts +17 -0
- package/dist/modules/source-control.ee/types/source-control-preferences.js +88 -0
- package/dist/modules/source-control.ee/types/source-control-push.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-push.js +21 -0
- package/dist/modules/source-control.ee/types/source-control-set-branch.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-set-branch.js +20 -0
- package/dist/modules/source-control.ee/types/source-control-set-read-only.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-set-read-only.js +20 -0
- package/dist/modules/source-control.ee/types/source-control-stage.d.ts +5 -0
- package/dist/modules/source-control.ee/types/source-control-stage.js +31 -0
- package/dist/modules/source-control.ee/types/source-control-workflow-version-id.d.ts +12 -0
- package/dist/modules/source-control.ee/types/source-control-workflow-version-id.js +2 -0
- package/dist/modules/sso-oidc/constants.d.ts +3 -0
- package/dist/modules/sso-oidc/constants.js +6 -0
- package/dist/modules/sso-oidc/oidc.controller.ee.d.ts +23 -0
- package/dist/modules/sso-oidc/oidc.controller.ee.js +123 -0
- package/dist/modules/sso-oidc/oidc.service.ee.d.ts +56 -0
- package/dist/modules/sso-oidc/oidc.service.ee.js +468 -0
- package/dist/modules/sso-oidc/sso-oidc.module.d.ts +4 -0
- package/dist/modules/sso-oidc/sso-oidc.module.js +55 -0
- package/dist/modules/sso-saml/constants.d.ts +3 -0
- package/dist/modules/sso-saml/constants.js +6 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.d.ts +4 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.js +10 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.d.ts +4 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.js +10 -0
- package/dist/modules/sso-saml/middleware/saml-enabled-middleware.d.ts +3 -0
- package/dist/modules/sso-saml/middleware/saml-enabled-middleware.js +22 -0
- package/dist/modules/sso-saml/saml-helpers.d.ts +19 -0
- package/dist/modules/sso-saml/saml-helpers.js +129 -0
- package/dist/modules/sso-saml/saml-validator.d.ts +16 -0
- package/dist/modules/sso-saml/saml-validator.js +129 -0
- package/dist/modules/sso-saml/saml.controller.ee.d.ts +50 -0
- package/dist/modules/sso-saml/saml.controller.ee.js +227 -0
- package/dist/modules/sso-saml/saml.service.ee.d.ts +52 -0
- package/dist/modules/sso-saml/saml.service.ee.js +462 -0
- package/dist/modules/sso-saml/schema/metadata-exchange.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/metadata-exchange.xsd.js +118 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.js +201 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.js +114 -0
- package/dist/modules/sso-saml/schema/saml-schema-assertion-2.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/saml-schema-assertion-2.0.xsd.js +289 -0
- package/dist/modules/sso-saml/schema/saml-schema-metadata-2.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/saml-schema-metadata-2.0.xsd.js +344 -0
- package/dist/modules/sso-saml/schema/saml-schema-protocol-2.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/saml-schema-protocol-2.0.xsd.js +308 -0
- package/dist/modules/sso-saml/schema/ws-addr.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/ws-addr.xsd.js +143 -0
- package/dist/modules/sso-saml/schema/ws-authorization.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/ws-authorization.xsd.js +151 -0
- package/dist/modules/sso-saml/schema/ws-federation.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/ws-federation.xsd.js +476 -0
- package/dist/modules/sso-saml/schema/ws-securitypolicy-1.2.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/ws-securitypolicy-1.2.xsd.js +1211 -0
- package/dist/modules/sso-saml/schema/xenc-schema.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/xenc-schema.xsd.js +151 -0
- package/dist/modules/sso-saml/schema/xml.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/xml.xsd.js +123 -0
- package/dist/modules/sso-saml/schema/xmldsig-core-schema.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/xmldsig-core-schema.xsd.js +324 -0
- package/dist/modules/sso-saml/service-provider.ee.d.ts +6 -0
- package/dist/modules/sso-saml/service-provider.ee.js +44 -0
- package/dist/modules/sso-saml/sso-saml.module.d.ts +4 -0
- package/dist/modules/sso-saml/sso-saml.module.js +55 -0
- package/dist/modules/sso-saml/types.d.ts +4 -0
- package/dist/modules/sso-saml/types.js +2 -0
- package/dist/modules/sso-saml/views/init-sso-post.d.ts +2 -0
- package/dist/modules/sso-saml/views/init-sso-post.js +16 -0
- package/dist/node-lib.d.ts +10 -0
- package/dist/node-lib.js +137 -0
- package/dist/push/index.d.ts +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/dist/services/cors-service.d.ts +7 -0
- package/dist/services/cors-service.js +50 -0
- package/dist/services/static-auth-service.d.ts +4 -0
- package/dist/services/static-auth-service.js +29 -0
- package/dist/sso.ee/saml/schema/metadata-exchange.xsd.js +0 -0
- package/dist/task-runners/task-broker/errors/task-runner-accept-timeout.error.js +0 -0
- package/dist/typecheck.tsbuildinfo +1 -0
- package/dist/user-management/email/templates/workflow-failure.handlebars +211 -0
- package/dist/utils/cors.util.d.ts +2 -0
- package/dist/utils/cors.util.js +17 -0
- package/dist/webhooks/waiting-forms.js +3 -3
- package/dist/webhooks/waiting-webhooks.js +2 -0
- package/dist/workflows/workflow.service.d.ts +2 -2
- package/dist/workflows/workflows.controller.d.ts +6 -6
- package/package.json +22 -21
|
@@ -0,0 +1,241 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.stringContainsExpression = stringContainsExpression;
|
|
40
|
+
exports.getWorkflowExportPath = getWorkflowExportPath;
|
|
41
|
+
exports.getProjectExportPath = getProjectExportPath;
|
|
42
|
+
exports.getCredentialExportPath = getCredentialExportPath;
|
|
43
|
+
exports.getVariablesPath = getVariablesPath;
|
|
44
|
+
exports.getTagsPath = getTagsPath;
|
|
45
|
+
exports.getFoldersPath = getFoldersPath;
|
|
46
|
+
exports.readTagAndMappingsFromSourceControlFile = readTagAndMappingsFromSourceControlFile;
|
|
47
|
+
exports.readFoldersFromSourceControlFile = readFoldersFromSourceControlFile;
|
|
48
|
+
exports.sourceControlFoldersExistCheck = sourceControlFoldersExistCheck;
|
|
49
|
+
exports.isSourceControlLicensed = isSourceControlLicensed;
|
|
50
|
+
exports.generateSshKeyPair = generateSshKeyPair;
|
|
51
|
+
exports.getRepoType = getRepoType;
|
|
52
|
+
exports.getTrackingInformationFromPullResult = getTrackingInformationFromPullResult;
|
|
53
|
+
exports.getTrackingInformationFromPrePushResult = getTrackingInformationFromPrePushResult;
|
|
54
|
+
exports.getTrackingInformationFromPostPushResult = getTrackingInformationFromPostPushResult;
|
|
55
|
+
exports.normalizeAndValidateSourceControlledFilePath = normalizeAndValidateSourceControlledFilePath;
|
|
56
|
+
exports.hasOwnerChanged = hasOwnerChanged;
|
|
57
|
+
exports.isWorkflowModified = isWorkflowModified;
|
|
58
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
59
|
+
const di_1 = require("@n8n/di");
|
|
60
|
+
const crypto_1 = require("crypto");
|
|
61
|
+
const fs_1 = require("fs");
|
|
62
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
63
|
+
const strict_1 = require("node:assert/strict");
|
|
64
|
+
const promises_1 = require("node:fs/promises");
|
|
65
|
+
const path_1 = __importDefault(require("path"));
|
|
66
|
+
const license_1 = require("../../license");
|
|
67
|
+
const constants_1 = require("./constants");
|
|
68
|
+
function stringContainsExpression(testString) {
|
|
69
|
+
return /^=.*\{\{.*\}\}/.test(testString);
|
|
70
|
+
}
|
|
71
|
+
function getWorkflowExportPath(workflowId, workflowExportFolder) {
|
|
72
|
+
return (0, backend_common_1.safeJoinPath)(workflowExportFolder, `${workflowId}.json`);
|
|
73
|
+
}
|
|
74
|
+
function getProjectExportPath(projectId, projectExportFolder) {
|
|
75
|
+
return (0, backend_common_1.safeJoinPath)(projectExportFolder, `${projectId}.json`);
|
|
76
|
+
}
|
|
77
|
+
function getCredentialExportPath(credentialId, credentialExportFolder) {
|
|
78
|
+
return (0, backend_common_1.safeJoinPath)(credentialExportFolder, `${credentialId}.json`);
|
|
79
|
+
}
|
|
80
|
+
function getVariablesPath(gitFolder) {
|
|
81
|
+
return (0, backend_common_1.safeJoinPath)(gitFolder, constants_1.SOURCE_CONTROL_VARIABLES_EXPORT_FILE);
|
|
82
|
+
}
|
|
83
|
+
function getTagsPath(gitFolder) {
|
|
84
|
+
return (0, backend_common_1.safeJoinPath)(gitFolder, constants_1.SOURCE_CONTROL_TAGS_EXPORT_FILE);
|
|
85
|
+
}
|
|
86
|
+
function getFoldersPath(gitFolder) {
|
|
87
|
+
return (0, backend_common_1.safeJoinPath)(gitFolder, constants_1.SOURCE_CONTROL_FOLDERS_EXPORT_FILE);
|
|
88
|
+
}
|
|
89
|
+
async function readTagAndMappingsFromSourceControlFile(file) {
|
|
90
|
+
try {
|
|
91
|
+
return (0, n8n_workflow_1.jsonParse)(await (0, promises_1.readFile)(file, { encoding: 'utf8' }), { fallbackValue: { tags: [], mappings: [] } });
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (error.code === 'ENOENT') {
|
|
95
|
+
return { tags: [], mappings: [] };
|
|
96
|
+
}
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function readFoldersFromSourceControlFile(file) {
|
|
101
|
+
try {
|
|
102
|
+
return (0, n8n_workflow_1.jsonParse)(await (0, promises_1.readFile)(file, { encoding: 'utf8' }), {
|
|
103
|
+
fallbackValue: { folders: [] },
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
if (error.code === 'ENOENT') {
|
|
108
|
+
return { folders: [] };
|
|
109
|
+
}
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function sourceControlFoldersExistCheck(folders, createIfNotExists = true) {
|
|
114
|
+
let existed = true;
|
|
115
|
+
folders.forEach((folder) => {
|
|
116
|
+
try {
|
|
117
|
+
(0, fs_1.accessSync)(folder, fs_1.constants.F_OK);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
existed = false;
|
|
121
|
+
if (createIfNotExists) {
|
|
122
|
+
try {
|
|
123
|
+
(0, fs_1.mkdirSync)(folder, { recursive: true });
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
di_1.Container.get(backend_common_1.Logger).error(error.message);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return existed;
|
|
132
|
+
}
|
|
133
|
+
function isSourceControlLicensed() {
|
|
134
|
+
const license = di_1.Container.get(license_1.License);
|
|
135
|
+
return license.isSourceControlLicensed();
|
|
136
|
+
}
|
|
137
|
+
async function generateSshKeyPair(keyType) {
|
|
138
|
+
const sshpk = await Promise.resolve().then(() => __importStar(require('sshpk')));
|
|
139
|
+
const keyPair = {
|
|
140
|
+
publicKey: '',
|
|
141
|
+
privateKey: '',
|
|
142
|
+
};
|
|
143
|
+
let generatedKeyPair;
|
|
144
|
+
switch (keyType) {
|
|
145
|
+
case 'ed25519':
|
|
146
|
+
generatedKeyPair = (0, crypto_1.generateKeyPairSync)('ed25519', {
|
|
147
|
+
privateKeyEncoding: { format: 'pem', type: 'pkcs8' },
|
|
148
|
+
publicKeyEncoding: { format: 'pem', type: 'spki' },
|
|
149
|
+
});
|
|
150
|
+
break;
|
|
151
|
+
case 'rsa':
|
|
152
|
+
generatedKeyPair = (0, crypto_1.generateKeyPairSync)('rsa', {
|
|
153
|
+
modulusLength: 4096,
|
|
154
|
+
publicKeyEncoding: {
|
|
155
|
+
type: 'spki',
|
|
156
|
+
format: 'pem',
|
|
157
|
+
},
|
|
158
|
+
privateKeyEncoding: {
|
|
159
|
+
type: 'pkcs8',
|
|
160
|
+
format: 'pem',
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
const keyPublic = sshpk.parseKey(generatedKeyPair.publicKey, 'pem');
|
|
166
|
+
keyPublic.comment = constants_1.SOURCE_CONTROL_GIT_KEY_COMMENT;
|
|
167
|
+
keyPair.publicKey = keyPublic.toString('ssh');
|
|
168
|
+
const keyPrivate = sshpk.parsePrivateKey(generatedKeyPair.privateKey, 'pem');
|
|
169
|
+
keyPrivate.comment = constants_1.SOURCE_CONTROL_GIT_KEY_COMMENT;
|
|
170
|
+
keyPair.privateKey = keyPrivate.toString('ssh-private');
|
|
171
|
+
return {
|
|
172
|
+
privateKey: keyPair.privateKey,
|
|
173
|
+
publicKey: keyPair.publicKey,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function getRepoType(repoUrl) {
|
|
177
|
+
if (repoUrl.includes('github.com')) {
|
|
178
|
+
return 'github';
|
|
179
|
+
}
|
|
180
|
+
else if (repoUrl.includes('gitlab.com')) {
|
|
181
|
+
return 'gitlab';
|
|
182
|
+
}
|
|
183
|
+
return 'other';
|
|
184
|
+
}
|
|
185
|
+
function filterSourceControlledFilesUniqueIds(files) {
|
|
186
|
+
return (files.filter((file, index, self) => {
|
|
187
|
+
return self.findIndex((f) => f.id === file.id) === index;
|
|
188
|
+
}) || []);
|
|
189
|
+
}
|
|
190
|
+
function getTrackingInformationFromPullResult(userId, result) {
|
|
191
|
+
const uniques = filterSourceControlledFilesUniqueIds(result);
|
|
192
|
+
return {
|
|
193
|
+
userId,
|
|
194
|
+
credConflicts: uniques.filter((file) => file.type === 'credential' && file.status === 'modified' && file.location === 'local').length,
|
|
195
|
+
workflowConflicts: uniques.filter((file) => file.type === 'workflow' && file.status === 'modified' && file.location === 'local').length,
|
|
196
|
+
workflowUpdates: uniques.filter((file) => file.type === 'workflow').length,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function getTrackingInformationFromPrePushResult(userId, result) {
|
|
200
|
+
const uniques = filterSourceControlledFilesUniqueIds(result);
|
|
201
|
+
return {
|
|
202
|
+
userId,
|
|
203
|
+
workflowsEligible: uniques.filter((file) => file.type === 'workflow').length,
|
|
204
|
+
workflowsEligibleWithConflicts: uniques.filter((file) => file.type === 'workflow' && file.conflict).length,
|
|
205
|
+
credsEligible: uniques.filter((file) => file.type === 'credential').length,
|
|
206
|
+
credsEligibleWithConflicts: uniques.filter((file) => file.type === 'credential' && file.conflict).length,
|
|
207
|
+
variablesEligible: uniques.filter((file) => file.type === 'variables').length,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function getTrackingInformationFromPostPushResult(userId, result) {
|
|
211
|
+
const uniques = filterSourceControlledFilesUniqueIds(result);
|
|
212
|
+
return {
|
|
213
|
+
userId,
|
|
214
|
+
workflowsPushed: uniques.filter((file) => file.pushed && file.type === 'workflow').length ?? 0,
|
|
215
|
+
workflowsEligible: uniques.filter((file) => file.type === 'workflow').length ?? 0,
|
|
216
|
+
credsPushed: uniques.filter((file) => file.pushed && file.file.startsWith('credential_stubs')).length ?? 0,
|
|
217
|
+
variablesPushed: uniques.filter((file) => file.pushed && file.file.startsWith('variable_stubs')).length ?? 0,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function normalizeAndValidateSourceControlledFilePath(gitFolderPath, filePath) {
|
|
221
|
+
(0, strict_1.ok)(path_1.default.isAbsolute(gitFolderPath), 'gitFolder must be an absolute path');
|
|
222
|
+
const normalizedPath = path_1.default.isAbsolute(filePath)
|
|
223
|
+
? filePath
|
|
224
|
+
: (0, backend_common_1.safeJoinPath)(gitFolderPath, filePath);
|
|
225
|
+
if (!(0, backend_common_1.isContainedWithin)(gitFolderPath, filePath)) {
|
|
226
|
+
throw new n8n_workflow_1.UserError(`File path ${filePath} is invalid`);
|
|
227
|
+
}
|
|
228
|
+
return normalizedPath;
|
|
229
|
+
}
|
|
230
|
+
function hasOwnerChanged(owner1, owner2) {
|
|
231
|
+
if (owner1?.type !== 'team' && owner2?.type !== 'team') {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
return owner1?.projectId !== owner2?.projectId;
|
|
235
|
+
}
|
|
236
|
+
function isWorkflowModified(local, remote) {
|
|
237
|
+
const hasVersionIdChanged = remote.versionId !== local.versionId;
|
|
238
|
+
const hasParentFolderIdChanged = remote.parentFolderId !== undefined && remote.parentFolderId !== local.parentFolderId;
|
|
239
|
+
const ownerChanged = hasOwnerChanged(remote.owner, local.owner);
|
|
240
|
+
return hasVersionIdChanged || hasParentFolderIdChanged || ownerChanged;
|
|
241
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { SourceControlledFile } from '@n8n/api-types';
|
|
2
|
+
import { Logger } from '@n8n/backend-common';
|
|
3
|
+
import type { TagEntity, User, Variables, WorkflowTagMapping } from '@n8n/db';
|
|
4
|
+
import { CredentialsRepository, FolderRepository, ProjectRelationRepository, ProjectRepository, SharedCredentialsRepository, SharedWorkflowRepository, TagRepository, UserRepository, VariablesRepository, WorkflowRepository, WorkflowTagMappingRepository, WorkflowPublishHistoryRepository } from '@n8n/db';
|
|
5
|
+
import { ErrorReporter, InstanceSettings } from 'n8n-core';
|
|
6
|
+
import { ActiveWorkflowManager } from '../../active-workflow-manager';
|
|
7
|
+
import { CredentialsService } from '../../credentials/credentials.service';
|
|
8
|
+
import { TagService } from '../../services/tag.service';
|
|
9
|
+
import { WorkflowHistoryService } from '../../workflows/workflow-history/workflow-history.service';
|
|
10
|
+
import { WorkflowService } from '../../workflows/workflow.service';
|
|
11
|
+
import { SourceControlScopedService } from './source-control-scoped.service';
|
|
12
|
+
import type { StatusExportableCredential } from './types/exportable-credential';
|
|
13
|
+
import type { ExportableFolder } from './types/exportable-folders';
|
|
14
|
+
import type { ExportableProjectWithFileName } from './types/exportable-project';
|
|
15
|
+
import type { ExportableTags } from './types/exportable-tags';
|
|
16
|
+
import { ExportableVariable } from './types/exportable-variable';
|
|
17
|
+
import type { SourceControlContext } from './types/source-control-context';
|
|
18
|
+
import type { SourceControlWorkflowVersionId } from './types/source-control-workflow-version-id';
|
|
19
|
+
import { VariablesService } from '../../environments.ee/variables/variables.service.ee';
|
|
20
|
+
export declare class SourceControlImportService {
|
|
21
|
+
private readonly logger;
|
|
22
|
+
private readonly errorReporter;
|
|
23
|
+
private readonly variablesService;
|
|
24
|
+
private readonly activeWorkflowManager;
|
|
25
|
+
private readonly credentialsRepository;
|
|
26
|
+
private readonly projectRepository;
|
|
27
|
+
private readonly projectRelationRepository;
|
|
28
|
+
private readonly tagRepository;
|
|
29
|
+
private readonly sharedWorkflowRepository;
|
|
30
|
+
private readonly sharedCredentialsRepository;
|
|
31
|
+
private readonly userRepository;
|
|
32
|
+
private readonly variablesRepository;
|
|
33
|
+
private readonly workflowRepository;
|
|
34
|
+
private readonly workflowTagMappingRepository;
|
|
35
|
+
private readonly workflowService;
|
|
36
|
+
private readonly credentialsService;
|
|
37
|
+
private readonly tagService;
|
|
38
|
+
private readonly folderRepository;
|
|
39
|
+
private readonly sourceControlScopedService;
|
|
40
|
+
private readonly workflowPublishHistoryRepository;
|
|
41
|
+
private readonly workflowHistoryService;
|
|
42
|
+
private gitFolder;
|
|
43
|
+
private workflowExportFolder;
|
|
44
|
+
private credentialExportFolder;
|
|
45
|
+
private projectExportFolder;
|
|
46
|
+
constructor(logger: Logger, errorReporter: ErrorReporter, variablesService: VariablesService, activeWorkflowManager: ActiveWorkflowManager, credentialsRepository: CredentialsRepository, projectRepository: ProjectRepository, projectRelationRepository: ProjectRelationRepository, tagRepository: TagRepository, sharedWorkflowRepository: SharedWorkflowRepository, sharedCredentialsRepository: SharedCredentialsRepository, userRepository: UserRepository, variablesRepository: VariablesRepository, workflowRepository: WorkflowRepository, workflowTagMappingRepository: WorkflowTagMappingRepository, workflowService: WorkflowService, credentialsService: CredentialsService, tagService: TagService, folderRepository: FolderRepository, instanceSettings: InstanceSettings, sourceControlScopedService: SourceControlScopedService, workflowPublishHistoryRepository: WorkflowPublishHistoryRepository, workflowHistoryService: WorkflowHistoryService);
|
|
47
|
+
getRemoteVersionIdsFromFiles(context: SourceControlContext): Promise<SourceControlWorkflowVersionId[]>;
|
|
48
|
+
getAllLocalVersionIdsFromDb(): Promise<SourceControlWorkflowVersionId[]>;
|
|
49
|
+
getLocalVersionIdsFromDb(context: SourceControlContext): Promise<SourceControlWorkflowVersionId[]>;
|
|
50
|
+
getRemoteCredentialsFromFiles(context: SourceControlContext): Promise<StatusExportableCredential[]>;
|
|
51
|
+
getLocalCredentialsFromDb(context: SourceControlContext): Promise<StatusExportableCredential[]>;
|
|
52
|
+
getRemoteVariablesFromFile(): Promise<ExportableVariable[]>;
|
|
53
|
+
getLocalGlobalVariablesFromDb(): Promise<Variables[]>;
|
|
54
|
+
getRemoteFoldersAndMappingsFromFile(context: SourceControlContext): Promise<{
|
|
55
|
+
folders: ExportableFolder[];
|
|
56
|
+
}>;
|
|
57
|
+
getLocalFoldersAndMappingsFromDb(context: SourceControlContext): Promise<{
|
|
58
|
+
folders: ExportableFolder[];
|
|
59
|
+
}>;
|
|
60
|
+
getRemoteTagsAndMappingsFromFile(context: SourceControlContext): Promise<ExportableTags>;
|
|
61
|
+
getLocalTagsAndMappingsFromDb(context: SourceControlContext): Promise<{
|
|
62
|
+
tags: TagEntity[];
|
|
63
|
+
mappings: WorkflowTagMapping[];
|
|
64
|
+
}>;
|
|
65
|
+
getRemoteProjectsFromFiles(context: SourceControlContext): Promise<ExportableProjectWithFileName[]>;
|
|
66
|
+
getLocalTeamProjectsFromDb(context?: SourceControlContext): Promise<ExportableProjectWithFileName[]>;
|
|
67
|
+
private mapProjectEntityToExportableProjectWithFileName;
|
|
68
|
+
importWorkflowFromWorkFolder(candidates: SourceControlledFile[], userId: string): Promise<{
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
}[]>;
|
|
72
|
+
private parseWorkflowFromFile;
|
|
73
|
+
private activateImportedWorkflowIfAlreadyActive;
|
|
74
|
+
importCredentialsFromWorkFolder(candidates: SourceControlledFile[], userId: string): Promise<{
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
type: string;
|
|
78
|
+
}[]>;
|
|
79
|
+
importTagsFromWorkFolder(candidate: SourceControlledFile): Promise<{
|
|
80
|
+
tags: TagEntity[];
|
|
81
|
+
mappings: WorkflowTagMapping[];
|
|
82
|
+
} | undefined>;
|
|
83
|
+
importFoldersFromWorkFolder(user: User, candidate: SourceControlledFile): Promise<{
|
|
84
|
+
folders: ExportableFolder[];
|
|
85
|
+
} | undefined>;
|
|
86
|
+
importVariables(variables: ExportableVariable[], valueOverrides?: {
|
|
87
|
+
[key: string]: string;
|
|
88
|
+
}): Promise<{
|
|
89
|
+
imported: string[];
|
|
90
|
+
}>;
|
|
91
|
+
importVariablesFromWorkFolder(candidate: SourceControlledFile, valueOverrides?: {
|
|
92
|
+
[key: string]: string;
|
|
93
|
+
}): Promise<{
|
|
94
|
+
imported: string[];
|
|
95
|
+
} | undefined>;
|
|
96
|
+
importTeamProjectsFromWorkFolder(candidates: SourceControlledFile[], pullingUserId: string): Promise<{
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
}[]>;
|
|
100
|
+
deleteWorkflowsNotInWorkfolder(user: User, candidates: SourceControlledFile[]): Promise<void>;
|
|
101
|
+
deleteCredentialsNotInWorkfolder(user: User, candidates: SourceControlledFile[]): Promise<void>;
|
|
102
|
+
deleteVariablesNotInWorkfolder(candidates: SourceControlledFile[]): Promise<void>;
|
|
103
|
+
deleteTagsNotInWorkfolder(candidates: SourceControlledFile[]): Promise<void>;
|
|
104
|
+
deleteFoldersNotInWorkfolder(candidates: SourceControlledFile[]): Promise<void>;
|
|
105
|
+
deleteTeamProjectsNotInWorkfolder(candidates: SourceControlledFile[]): Promise<void>;
|
|
106
|
+
private syncResourceOwnership;
|
|
107
|
+
private findOwnerProjectInLocalDb;
|
|
108
|
+
private createTeamProject;
|
|
109
|
+
private saveOrUpdateWorkflowHistory;
|
|
110
|
+
}
|