@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,596 @@
|
|
|
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.SourceControlStatusService = void 0;
|
|
13
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
14
|
+
const db_1 = require("@n8n/db");
|
|
15
|
+
const di_1 = require("@n8n/di");
|
|
16
|
+
const permissions_1 = require("@n8n/permissions");
|
|
17
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
18
|
+
const forbidden_error_1 = require("../../errors/response-errors/forbidden.error");
|
|
19
|
+
const event_service_1 = require("../../events/event.service");
|
|
20
|
+
const source_control_git_service_ee_1 = require("./source-control-git.service.ee");
|
|
21
|
+
const source_control_helper_ee_1 = require("./source-control-helper.ee");
|
|
22
|
+
const source_control_import_service_ee_1 = require("./source-control-import.service.ee");
|
|
23
|
+
const source_control_preferences_service_ee_1 = require("./source-control-preferences.service.ee");
|
|
24
|
+
const source_control_context_1 = require("./types/source-control-context");
|
|
25
|
+
let SourceControlStatusService = class SourceControlStatusService {
|
|
26
|
+
constructor(logger, gitService, sourceControlImportService, sourceControlPreferencesService, tagRepository, folderRepository, eventService) {
|
|
27
|
+
this.logger = logger;
|
|
28
|
+
this.gitService = gitService;
|
|
29
|
+
this.sourceControlImportService = sourceControlImportService;
|
|
30
|
+
this.sourceControlPreferencesService = sourceControlPreferencesService;
|
|
31
|
+
this.tagRepository = tagRepository;
|
|
32
|
+
this.folderRepository = folderRepository;
|
|
33
|
+
this.eventService = eventService;
|
|
34
|
+
}
|
|
35
|
+
get gitFolder() {
|
|
36
|
+
return this.sourceControlPreferencesService.gitFolder;
|
|
37
|
+
}
|
|
38
|
+
async getStatus(user, options) {
|
|
39
|
+
const context = new source_control_context_1.SourceControlContext(user);
|
|
40
|
+
if (options.direction === 'pull' && !(0, permissions_1.hasGlobalScope)(user, 'sourceControl:pull')) {
|
|
41
|
+
throw new forbidden_error_1.ForbiddenError('You do not have permission to pull from source control');
|
|
42
|
+
}
|
|
43
|
+
const sourceControlledFiles = [];
|
|
44
|
+
await this.resetWorkfolder();
|
|
45
|
+
const { wfRemoteVersionIds, wfLocalVersionIds, wfMissingInLocal, wfMissingInRemote, wfModifiedInEither, } = await this.getStatusWorkflows(options, context, sourceControlledFiles);
|
|
46
|
+
const { credMissingInLocal, credMissingInRemote, credModifiedInEither } = await this.getStatusCredentials(options, context, sourceControlledFiles);
|
|
47
|
+
const { varMissingInLocal, varMissingInRemote, varModifiedInEither } = await this.getStatusVariables(options, sourceControlledFiles);
|
|
48
|
+
const { tagsMissingInLocal, tagsMissingInRemote, tagsModifiedInEither, mappingsMissingInLocal, mappingsMissingInRemote, } = await this.getStatusTagsMappings(options, context, sourceControlledFiles);
|
|
49
|
+
const { foldersMissingInLocal, foldersMissingInRemote, foldersModifiedInEither } = await this.getStatusFoldersMapping(options, context, sourceControlledFiles);
|
|
50
|
+
const { projectsRemote, projectsLocal, projectsMissingInLocal, projectsMissingInRemote, projectsModifiedInEither, } = await this.getStatusProjects(options, context, sourceControlledFiles);
|
|
51
|
+
if (options.direction === 'push') {
|
|
52
|
+
this.eventService.emit('source-control-user-started-push-ui', (0, source_control_helper_ee_1.getTrackingInformationFromPrePushResult)(user.id, sourceControlledFiles));
|
|
53
|
+
}
|
|
54
|
+
else if (options.direction === 'pull') {
|
|
55
|
+
this.eventService.emit('source-control-user-started-pull-ui', (0, source_control_helper_ee_1.getTrackingInformationFromPullResult)(user.id, sourceControlledFiles));
|
|
56
|
+
}
|
|
57
|
+
if (options?.verbose) {
|
|
58
|
+
return {
|
|
59
|
+
wfRemoteVersionIds,
|
|
60
|
+
wfLocalVersionIds,
|
|
61
|
+
wfMissingInLocal,
|
|
62
|
+
wfMissingInRemote,
|
|
63
|
+
wfModifiedInEither,
|
|
64
|
+
credMissingInLocal,
|
|
65
|
+
credMissingInRemote,
|
|
66
|
+
credModifiedInEither,
|
|
67
|
+
varMissingInLocal,
|
|
68
|
+
varMissingInRemote,
|
|
69
|
+
varModifiedInEither,
|
|
70
|
+
tagsMissingInLocal,
|
|
71
|
+
tagsMissingInRemote,
|
|
72
|
+
tagsModifiedInEither,
|
|
73
|
+
mappingsMissingInLocal,
|
|
74
|
+
mappingsMissingInRemote,
|
|
75
|
+
foldersMissingInLocal,
|
|
76
|
+
foldersMissingInRemote,
|
|
77
|
+
foldersModifiedInEither,
|
|
78
|
+
projectsRemote,
|
|
79
|
+
projectsLocal,
|
|
80
|
+
projectsMissingInLocal,
|
|
81
|
+
projectsMissingInRemote,
|
|
82
|
+
projectsModifiedInEither,
|
|
83
|
+
sourceControlledFiles,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
return sourceControlledFiles;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async resetWorkfolder() {
|
|
91
|
+
if (!this.gitService.git) {
|
|
92
|
+
throw new Error('Git service not initialized');
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
await this.gitService.resetBranch();
|
|
96
|
+
await this.gitService.pull();
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
this.logger.error(`Failed to reset workfolder: ${error instanceof Error ? error.message : String(error)}`);
|
|
100
|
+
throw new n8n_workflow_1.UserError(`Unable to fetch updates from git - your folder might be out of sync. Try reconnecting from the Source Control settings page. Git error message: ${error instanceof Error ? error.message : String(error)}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async getStatusWorkflows(options, context, sourceControlledFiles) {
|
|
104
|
+
const wfRemoteVersionIds = await this.sourceControlImportService.getRemoteVersionIdsFromFiles(context);
|
|
105
|
+
const wfLocalVersionIds = await this.sourceControlImportService.getLocalVersionIdsFromDb(context);
|
|
106
|
+
let outOfScopeWF = [];
|
|
107
|
+
if (!context.hasAccessToAllProjects()) {
|
|
108
|
+
outOfScopeWF = await this.sourceControlImportService.getAllLocalVersionIdsFromDb();
|
|
109
|
+
outOfScopeWF = outOfScopeWF.filter((wf) => !wfLocalVersionIds.some((local) => local.id === wf.id));
|
|
110
|
+
}
|
|
111
|
+
const wfMissingInLocal = wfRemoteVersionIds
|
|
112
|
+
.filter((remote) => wfLocalVersionIds.findIndex((local) => local.id === remote.id) === -1)
|
|
113
|
+
.filter((remote) => !outOfScopeWF.some((outOfScope) => outOfScope.id === remote.id));
|
|
114
|
+
const wfMissingInRemote = wfLocalVersionIds.filter((local) => wfRemoteVersionIds.findIndex((remote) => remote.id === local.id) === -1);
|
|
115
|
+
const wfModifiedInEither = [];
|
|
116
|
+
wfLocalVersionIds.forEach((localWorkflow) => {
|
|
117
|
+
const remoteWorkflowWithSameId = wfRemoteVersionIds.find((removeWorkflow) => removeWorkflow.id === localWorkflow.id);
|
|
118
|
+
if (!remoteWorkflowWithSameId) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if ((0, source_control_helper_ee_1.isWorkflowModified)(localWorkflow, remoteWorkflowWithSameId)) {
|
|
122
|
+
let name = (options?.preferLocalVersion ? localWorkflow?.name : remoteWorkflowWithSameId?.name) ??
|
|
123
|
+
'Workflow';
|
|
124
|
+
if (localWorkflow.name &&
|
|
125
|
+
remoteWorkflowWithSameId?.name &&
|
|
126
|
+
localWorkflow.name !== remoteWorkflowWithSameId.name) {
|
|
127
|
+
name = options?.preferLocalVersion
|
|
128
|
+
? `${localWorkflow.name} (Remote: ${remoteWorkflowWithSameId.name})`
|
|
129
|
+
: (name = `${remoteWorkflowWithSameId.name} (Local: ${localWorkflow.name})`);
|
|
130
|
+
}
|
|
131
|
+
wfModifiedInEither.push({
|
|
132
|
+
...localWorkflow,
|
|
133
|
+
name,
|
|
134
|
+
versionId: options.preferLocalVersion
|
|
135
|
+
? localWorkflow.versionId
|
|
136
|
+
: remoteWorkflowWithSameId.versionId,
|
|
137
|
+
localId: localWorkflow.versionId,
|
|
138
|
+
remoteId: remoteWorkflowWithSameId.versionId,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
wfMissingInLocal.forEach((item) => {
|
|
143
|
+
sourceControlledFiles.push({
|
|
144
|
+
id: item.id,
|
|
145
|
+
name: item.name ?? 'Workflow',
|
|
146
|
+
type: 'workflow',
|
|
147
|
+
status: options.direction === 'push' ? 'deleted' : 'created',
|
|
148
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
149
|
+
conflict: false,
|
|
150
|
+
file: item.filename,
|
|
151
|
+
updatedAt: item.updatedAt ?? new Date().toISOString(),
|
|
152
|
+
owner: item.owner,
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
wfMissingInRemote.forEach((item) => {
|
|
156
|
+
sourceControlledFiles.push({
|
|
157
|
+
id: item.id,
|
|
158
|
+
name: item.name ?? 'Workflow',
|
|
159
|
+
type: 'workflow',
|
|
160
|
+
status: options.direction === 'push' ? 'created' : 'deleted',
|
|
161
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
162
|
+
conflict: options.direction === 'push' ? false : true,
|
|
163
|
+
file: item.filename,
|
|
164
|
+
updatedAt: item.updatedAt ?? new Date().toISOString(),
|
|
165
|
+
owner: item.owner,
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
wfModifiedInEither.forEach((item) => {
|
|
169
|
+
sourceControlledFiles.push({
|
|
170
|
+
id: item.id,
|
|
171
|
+
name: item.name ?? 'Workflow',
|
|
172
|
+
type: 'workflow',
|
|
173
|
+
status: 'modified',
|
|
174
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
175
|
+
conflict: true,
|
|
176
|
+
file: item.filename,
|
|
177
|
+
updatedAt: item.updatedAt ?? new Date().toISOString(),
|
|
178
|
+
owner: item.owner,
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
wfRemoteVersionIds,
|
|
183
|
+
wfLocalVersionIds,
|
|
184
|
+
wfMissingInLocal,
|
|
185
|
+
wfMissingInRemote,
|
|
186
|
+
wfModifiedInEither,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
async getStatusCredentials(options, context, sourceControlledFiles) {
|
|
190
|
+
const credRemoteIds = await this.sourceControlImportService.getRemoteCredentialsFromFiles(context);
|
|
191
|
+
const credLocalIds = await this.sourceControlImportService.getLocalCredentialsFromDb(context);
|
|
192
|
+
const credMissingInLocal = credRemoteIds.filter((remote) => credLocalIds.findIndex((local) => local.id === remote.id) === -1);
|
|
193
|
+
const credMissingInRemote = credLocalIds.filter((local) => credRemoteIds.findIndex((remote) => remote.id === local.id) === -1);
|
|
194
|
+
const credModifiedInEither = [];
|
|
195
|
+
credLocalIds.forEach((local) => {
|
|
196
|
+
const mismatchingCreds = credRemoteIds.find((remote) => {
|
|
197
|
+
return (remote.id === local.id &&
|
|
198
|
+
(remote.name !== local.name ||
|
|
199
|
+
remote.type !== local.type ||
|
|
200
|
+
(0, source_control_helper_ee_1.hasOwnerChanged)(remote.ownedBy, local.ownedBy) ||
|
|
201
|
+
(remote.isGlobal ?? false) !== (local.isGlobal ?? false)));
|
|
202
|
+
});
|
|
203
|
+
if (mismatchingCreds) {
|
|
204
|
+
credModifiedInEither.push({
|
|
205
|
+
...local,
|
|
206
|
+
name: options?.preferLocalVersion ? local.name : mismatchingCreds.name,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
credMissingInLocal.forEach((item) => {
|
|
211
|
+
sourceControlledFiles.push({
|
|
212
|
+
id: item.id,
|
|
213
|
+
name: item.name ?? 'Credential',
|
|
214
|
+
type: 'credential',
|
|
215
|
+
status: options.direction === 'push' ? 'deleted' : 'created',
|
|
216
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
217
|
+
conflict: false,
|
|
218
|
+
file: item.filename,
|
|
219
|
+
updatedAt: new Date().toISOString(),
|
|
220
|
+
owner: item.ownedBy,
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
credMissingInRemote.forEach((item) => {
|
|
224
|
+
sourceControlledFiles.push({
|
|
225
|
+
id: item.id,
|
|
226
|
+
name: item.name ?? 'Credential',
|
|
227
|
+
type: 'credential',
|
|
228
|
+
status: options.direction === 'push' ? 'created' : 'deleted',
|
|
229
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
230
|
+
conflict: options.direction === 'push' ? false : true,
|
|
231
|
+
file: item.filename,
|
|
232
|
+
updatedAt: new Date().toISOString(),
|
|
233
|
+
owner: item.ownedBy,
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
credModifiedInEither.forEach((item) => {
|
|
237
|
+
sourceControlledFiles.push({
|
|
238
|
+
id: item.id,
|
|
239
|
+
name: item.name ?? 'Credential',
|
|
240
|
+
type: 'credential',
|
|
241
|
+
status: 'modified',
|
|
242
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
243
|
+
conflict: true,
|
|
244
|
+
file: item.filename,
|
|
245
|
+
updatedAt: new Date().toISOString(),
|
|
246
|
+
owner: item.ownedBy,
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
return {
|
|
250
|
+
credMissingInLocal,
|
|
251
|
+
credMissingInRemote,
|
|
252
|
+
credModifiedInEither,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
async getStatusVariables(options, sourceControlledFiles) {
|
|
256
|
+
const varRemoteIds = await this.sourceControlImportService.getRemoteVariablesFromFile();
|
|
257
|
+
const varLocalIds = await this.sourceControlImportService.getLocalGlobalVariablesFromDb();
|
|
258
|
+
const varMissingInLocal = varRemoteIds.filter((remote) => varLocalIds.findIndex((local) => local.id === remote.id) === -1);
|
|
259
|
+
const varMissingInRemote = varLocalIds.filter((local) => varRemoteIds.findIndex((remote) => remote.id === local.id) === -1);
|
|
260
|
+
const varModifiedInEither = [];
|
|
261
|
+
varLocalIds.forEach((local) => {
|
|
262
|
+
const mismatchingIds = varRemoteIds.find((remote) => (remote.id === local.id && remote.key !== local.key) ||
|
|
263
|
+
(remote.id !== local.id && remote.key === local.key));
|
|
264
|
+
if (mismatchingIds) {
|
|
265
|
+
varModifiedInEither.push(options.preferLocalVersion ? local : mismatchingIds);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
varMissingInLocal.forEach((item) => {
|
|
269
|
+
sourceControlledFiles.push({
|
|
270
|
+
id: item.id,
|
|
271
|
+
name: item.key,
|
|
272
|
+
type: 'variables',
|
|
273
|
+
status: options.direction === 'push' ? 'deleted' : 'created',
|
|
274
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
275
|
+
conflict: false,
|
|
276
|
+
file: (0, source_control_helper_ee_1.getVariablesPath)(this.gitFolder),
|
|
277
|
+
updatedAt: new Date().toISOString(),
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
varMissingInRemote.forEach((item) => {
|
|
281
|
+
sourceControlledFiles.push({
|
|
282
|
+
id: item.id,
|
|
283
|
+
name: item.key,
|
|
284
|
+
type: 'variables',
|
|
285
|
+
status: options.direction === 'push' ? 'created' : 'deleted',
|
|
286
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
287
|
+
conflict: options.direction === 'push' ? false : true,
|
|
288
|
+
file: (0, source_control_helper_ee_1.getVariablesPath)(this.gitFolder),
|
|
289
|
+
updatedAt: new Date().toISOString(),
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
varModifiedInEither.forEach((item) => {
|
|
293
|
+
sourceControlledFiles.push({
|
|
294
|
+
id: item.id,
|
|
295
|
+
name: item.key,
|
|
296
|
+
type: 'variables',
|
|
297
|
+
status: 'modified',
|
|
298
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
299
|
+
conflict: true,
|
|
300
|
+
file: (0, source_control_helper_ee_1.getVariablesPath)(this.gitFolder),
|
|
301
|
+
updatedAt: new Date().toISOString(),
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
return {
|
|
305
|
+
varMissingInLocal,
|
|
306
|
+
varMissingInRemote,
|
|
307
|
+
varModifiedInEither,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
async getStatusTagsMappings(options, context, sourceControlledFiles) {
|
|
311
|
+
const lastUpdatedTag = await this.tagRepository.find({
|
|
312
|
+
order: { updatedAt: 'DESC' },
|
|
313
|
+
take: 1,
|
|
314
|
+
select: ['updatedAt'],
|
|
315
|
+
});
|
|
316
|
+
const lastUpdatedDate = lastUpdatedTag[0]?.updatedAt ?? new Date();
|
|
317
|
+
const tagMappingsRemote = await this.sourceControlImportService.getRemoteTagsAndMappingsFromFile(context);
|
|
318
|
+
const tagMappingsLocal = await this.sourceControlImportService.getLocalTagsAndMappingsFromDb(context);
|
|
319
|
+
const tagsMissingInLocal = tagMappingsRemote.tags.filter((remote) => tagMappingsLocal.tags.findIndex((local) => local.id === remote.id) === -1);
|
|
320
|
+
const tagsMissingInRemote = tagMappingsLocal.tags.filter((local) => tagMappingsRemote.tags.findIndex((remote) => remote.id === local.id) === -1);
|
|
321
|
+
const tagsModifiedInEither = [];
|
|
322
|
+
tagMappingsLocal.tags.forEach((local) => {
|
|
323
|
+
const mismatchingIds = tagMappingsRemote.tags.find((remote) => remote.id === local.id && remote.name !== local.name);
|
|
324
|
+
if (!mismatchingIds) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
tagsModifiedInEither.push(options.preferLocalVersion ? local : mismatchingIds);
|
|
328
|
+
});
|
|
329
|
+
const mappingsMissingInLocal = tagMappingsRemote.mappings.filter((remote) => tagMappingsLocal.mappings.findIndex((local) => local.tagId === remote.tagId && local.workflowId === remote.workflowId) === -1);
|
|
330
|
+
const mappingsMissingInRemote = tagMappingsLocal.mappings.filter((local) => tagMappingsRemote.mappings.findIndex((remote) => remote.tagId === local.tagId && remote.workflowId === remote.workflowId) === -1);
|
|
331
|
+
tagsMissingInLocal.forEach((item) => {
|
|
332
|
+
sourceControlledFiles.push({
|
|
333
|
+
id: item.id,
|
|
334
|
+
name: item.name,
|
|
335
|
+
type: 'tags',
|
|
336
|
+
status: options.direction === 'push' ? 'deleted' : 'created',
|
|
337
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
338
|
+
conflict: false,
|
|
339
|
+
file: (0, source_control_helper_ee_1.getTagsPath)(this.gitFolder),
|
|
340
|
+
updatedAt: lastUpdatedDate.toISOString(),
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
tagsMissingInRemote.forEach((item) => {
|
|
344
|
+
sourceControlledFiles.push({
|
|
345
|
+
id: item.id,
|
|
346
|
+
name: item.name,
|
|
347
|
+
type: 'tags',
|
|
348
|
+
status: options.direction === 'push' ? 'created' : 'deleted',
|
|
349
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
350
|
+
conflict: options.direction === 'push' ? false : true,
|
|
351
|
+
file: (0, source_control_helper_ee_1.getTagsPath)(this.gitFolder),
|
|
352
|
+
updatedAt: lastUpdatedDate.toISOString(),
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
tagsModifiedInEither.forEach((item) => {
|
|
356
|
+
sourceControlledFiles.push({
|
|
357
|
+
id: item.id,
|
|
358
|
+
name: item.name,
|
|
359
|
+
type: 'tags',
|
|
360
|
+
status: 'modified',
|
|
361
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
362
|
+
conflict: true,
|
|
363
|
+
file: (0, source_control_helper_ee_1.getTagsPath)(this.gitFolder),
|
|
364
|
+
updatedAt: lastUpdatedDate.toISOString(),
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
return {
|
|
368
|
+
tagsMissingInLocal,
|
|
369
|
+
tagsMissingInRemote,
|
|
370
|
+
tagsModifiedInEither,
|
|
371
|
+
mappingsMissingInLocal,
|
|
372
|
+
mappingsMissingInRemote,
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
async getStatusFoldersMapping(options, context, sourceControlledFiles) {
|
|
376
|
+
const lastUpdatedFolder = await this.folderRepository.find({
|
|
377
|
+
order: { updatedAt: 'DESC' },
|
|
378
|
+
take: 1,
|
|
379
|
+
select: ['updatedAt'],
|
|
380
|
+
});
|
|
381
|
+
const lastUpdatedDate = lastUpdatedFolder[0]?.updatedAt ?? new Date();
|
|
382
|
+
const foldersMappingsRemote = await this.sourceControlImportService.getRemoteFoldersAndMappingsFromFile(context);
|
|
383
|
+
const foldersMappingsLocal = await this.sourceControlImportService.getLocalFoldersAndMappingsFromDb(context);
|
|
384
|
+
const foldersMissingInLocal = foldersMappingsRemote.folders.filter((remote) => foldersMappingsLocal.folders.findIndex((local) => local.id === remote.id) === -1);
|
|
385
|
+
const foldersMissingInRemote = foldersMappingsLocal.folders.filter((local) => foldersMappingsRemote.folders.findIndex((remote) => remote.id === local.id) === -1);
|
|
386
|
+
const allTeamProjects = await this.sourceControlImportService.getLocalTeamProjectsFromDb();
|
|
387
|
+
const foldersModifiedInEither = [];
|
|
388
|
+
foldersMappingsLocal.folders.forEach((local) => {
|
|
389
|
+
const localHomeProject = allTeamProjects.find((project) => project.id === local.homeProjectId);
|
|
390
|
+
const mismatchingIds = foldersMappingsRemote.folders.find((remote) => {
|
|
391
|
+
const remoteHomeProject = allTeamProjects.find((project) => project.id === remote.homeProjectId);
|
|
392
|
+
const localOwner = localHomeProject
|
|
393
|
+
? {
|
|
394
|
+
type: 'team',
|
|
395
|
+
projectId: localHomeProject.id,
|
|
396
|
+
projectName: localHomeProject.name,
|
|
397
|
+
}
|
|
398
|
+
: undefined;
|
|
399
|
+
const remoteOwner = remoteHomeProject
|
|
400
|
+
? {
|
|
401
|
+
type: 'team',
|
|
402
|
+
projectId: remoteHomeProject?.id,
|
|
403
|
+
projectName: remoteHomeProject?.name,
|
|
404
|
+
}
|
|
405
|
+
: undefined;
|
|
406
|
+
const ownerChanged = (0, source_control_helper_ee_1.hasOwnerChanged)(localOwner, remoteOwner);
|
|
407
|
+
return (remote.id === local.id &&
|
|
408
|
+
(remote.name !== local.name ||
|
|
409
|
+
remote.parentFolderId !== local.parentFolderId ||
|
|
410
|
+
ownerChanged));
|
|
411
|
+
});
|
|
412
|
+
if (!mismatchingIds) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
foldersModifiedInEither.push(options.preferLocalVersion ? local : mismatchingIds);
|
|
416
|
+
});
|
|
417
|
+
foldersMissingInLocal.forEach((item) => {
|
|
418
|
+
sourceControlledFiles.push({
|
|
419
|
+
id: item.id,
|
|
420
|
+
name: item.name,
|
|
421
|
+
type: 'folders',
|
|
422
|
+
status: options.direction === 'push' ? 'deleted' : 'created',
|
|
423
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
424
|
+
conflict: false,
|
|
425
|
+
file: (0, source_control_helper_ee_1.getFoldersPath)(this.gitFolder),
|
|
426
|
+
updatedAt: lastUpdatedDate.toISOString(),
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
foldersMissingInRemote.forEach((item) => {
|
|
430
|
+
sourceControlledFiles.push({
|
|
431
|
+
id: item.id,
|
|
432
|
+
name: item.name,
|
|
433
|
+
type: 'folders',
|
|
434
|
+
status: options.direction === 'push' ? 'created' : 'deleted',
|
|
435
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
436
|
+
conflict: options.direction === 'push' ? false : true,
|
|
437
|
+
file: (0, source_control_helper_ee_1.getFoldersPath)(this.gitFolder),
|
|
438
|
+
updatedAt: lastUpdatedDate.toISOString(),
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
foldersModifiedInEither.forEach((item) => {
|
|
442
|
+
sourceControlledFiles.push({
|
|
443
|
+
id: item.id,
|
|
444
|
+
name: item.name,
|
|
445
|
+
type: 'folders',
|
|
446
|
+
status: 'modified',
|
|
447
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
448
|
+
conflict: true,
|
|
449
|
+
file: (0, source_control_helper_ee_1.getFoldersPath)(this.gitFolder),
|
|
450
|
+
updatedAt: lastUpdatedDate.toISOString(),
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
return {
|
|
454
|
+
foldersMissingInLocal,
|
|
455
|
+
foldersMissingInRemote,
|
|
456
|
+
foldersModifiedInEither,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
async getStatusProjects(options, context, sourceControlledFiles) {
|
|
460
|
+
const projectsRemote = await this.sourceControlImportService.getRemoteProjectsFromFiles(context);
|
|
461
|
+
const projectsLocal = await this.sourceControlImportService.getLocalTeamProjectsFromDb(context);
|
|
462
|
+
let outOfScopeProjects = [];
|
|
463
|
+
if (!context.hasAccessToAllProjects()) {
|
|
464
|
+
outOfScopeProjects = await this.sourceControlImportService.getLocalTeamProjectsFromDb();
|
|
465
|
+
outOfScopeProjects = outOfScopeProjects.filter((project) => !projectsLocal.some((local) => local.id === project.id));
|
|
466
|
+
}
|
|
467
|
+
const projectsMissingInLocal = projectsRemote
|
|
468
|
+
.filter((remote) => !projectsLocal.some((local) => local.id === remote.id))
|
|
469
|
+
.filter((remote) => !outOfScopeProjects.some((outOfScope) => outOfScope.id === remote.id));
|
|
470
|
+
const areRemoteProjectsEmpty = projectsRemote.length === 0;
|
|
471
|
+
let projectsMissingInRemote = projectsLocal.filter((local) => !projectsRemote.some((remote) => remote.id === local.id));
|
|
472
|
+
if (options.direction === 'pull' && areRemoteProjectsEmpty) {
|
|
473
|
+
projectsMissingInRemote = [];
|
|
474
|
+
}
|
|
475
|
+
const projectsModifiedInEither = [];
|
|
476
|
+
projectsLocal.forEach((localProject) => {
|
|
477
|
+
const remoteProjectWithSameId = projectsRemote.find((remoteProject) => remoteProject.id === localProject.id);
|
|
478
|
+
if (!remoteProjectWithSameId) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
if (this.isProjectModified(localProject, remoteProjectWithSameId)) {
|
|
482
|
+
let name = (options?.preferLocalVersion ? localProject?.name : remoteProjectWithSameId?.name) ??
|
|
483
|
+
'Project';
|
|
484
|
+
if (localProject.name &&
|
|
485
|
+
remoteProjectWithSameId?.name &&
|
|
486
|
+
localProject.name !== remoteProjectWithSameId.name) {
|
|
487
|
+
name = options?.preferLocalVersion
|
|
488
|
+
? `${localProject.name} (Remote: ${remoteProjectWithSameId.name})`
|
|
489
|
+
: `${remoteProjectWithSameId.name} (Local: ${localProject.name})`;
|
|
490
|
+
}
|
|
491
|
+
projectsModifiedInEither.push({
|
|
492
|
+
...localProject,
|
|
493
|
+
name,
|
|
494
|
+
description: options.preferLocalVersion
|
|
495
|
+
? localProject.description
|
|
496
|
+
: remoteProjectWithSameId.description,
|
|
497
|
+
icon: options.preferLocalVersion ? localProject.icon : remoteProjectWithSameId.icon,
|
|
498
|
+
variableStubs: options.preferLocalVersion
|
|
499
|
+
? localProject.variableStubs
|
|
500
|
+
: remoteProjectWithSameId.variableStubs,
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
const mapExportableProjectWithFileNameToSourceControlledFile = ({ project, status, conflict, }) => {
|
|
505
|
+
return {
|
|
506
|
+
id: project.id,
|
|
507
|
+
name: project.name ?? 'Project',
|
|
508
|
+
type: 'project',
|
|
509
|
+
status,
|
|
510
|
+
location: options.direction === 'push' ? 'local' : 'remote',
|
|
511
|
+
conflict,
|
|
512
|
+
file: project.filename,
|
|
513
|
+
updatedAt: new Date().toISOString(),
|
|
514
|
+
owner: {
|
|
515
|
+
type: project.owner.type,
|
|
516
|
+
projectId: project.owner.teamId,
|
|
517
|
+
projectName: project.owner.teamName,
|
|
518
|
+
},
|
|
519
|
+
};
|
|
520
|
+
};
|
|
521
|
+
projectsMissingInLocal.forEach((item) => {
|
|
522
|
+
sourceControlledFiles.push(mapExportableProjectWithFileNameToSourceControlledFile({
|
|
523
|
+
project: item,
|
|
524
|
+
status: options.direction === 'push' ? 'deleted' : 'created',
|
|
525
|
+
conflict: false,
|
|
526
|
+
}));
|
|
527
|
+
});
|
|
528
|
+
projectsMissingInRemote.forEach((item) => {
|
|
529
|
+
sourceControlledFiles.push(mapExportableProjectWithFileNameToSourceControlledFile({
|
|
530
|
+
project: item,
|
|
531
|
+
status: options.direction === 'push' ? 'created' : 'deleted',
|
|
532
|
+
conflict: options.direction === 'push' ? false : true,
|
|
533
|
+
}));
|
|
534
|
+
});
|
|
535
|
+
projectsModifiedInEither.forEach((item) => {
|
|
536
|
+
sourceControlledFiles.push(mapExportableProjectWithFileNameToSourceControlledFile({
|
|
537
|
+
project: item,
|
|
538
|
+
status: 'modified',
|
|
539
|
+
conflict: true,
|
|
540
|
+
}));
|
|
541
|
+
});
|
|
542
|
+
return {
|
|
543
|
+
projectsRemote,
|
|
544
|
+
projectsLocal,
|
|
545
|
+
projectsMissingInLocal,
|
|
546
|
+
projectsMissingInRemote,
|
|
547
|
+
projectsModifiedInEither,
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
areVariablesEqual(localVariables, remoteVariables) {
|
|
551
|
+
if (Array.isArray(localVariables) !== Array.isArray(remoteVariables)) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
if (localVariables?.length !== remoteVariables?.length) {
|
|
555
|
+
return false;
|
|
556
|
+
}
|
|
557
|
+
const sortedLocalVars = [...(localVariables ?? [])].sort((a, b) => a.key.localeCompare(b.key));
|
|
558
|
+
const sortedRemoteVars = [...(remoteVariables ?? [])].sort((a, b) => a.key.localeCompare(b.key));
|
|
559
|
+
return sortedLocalVars.every((localVar, index) => {
|
|
560
|
+
const remoteVar = sortedRemoteVars[index];
|
|
561
|
+
return localVar.key === remoteVar.key && localVar.type === remoteVar.type;
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
isProjectModified(local, remote) {
|
|
565
|
+
const isIconModified = this.isProjectIconModified({
|
|
566
|
+
localIcon: local.icon,
|
|
567
|
+
remoteIcon: remote.icon,
|
|
568
|
+
});
|
|
569
|
+
return (isIconModified ||
|
|
570
|
+
remote.type !== local.type ||
|
|
571
|
+
remote.name !== local.name ||
|
|
572
|
+
remote.description !== local.description ||
|
|
573
|
+
!this.areVariablesEqual(local.variableStubs, remote.variableStubs));
|
|
574
|
+
}
|
|
575
|
+
isProjectIconModified({ localIcon, remoteIcon, }) {
|
|
576
|
+
if (!remoteIcon && !!localIcon)
|
|
577
|
+
return true;
|
|
578
|
+
if (!!remoteIcon && !localIcon)
|
|
579
|
+
return true;
|
|
580
|
+
if (!!remoteIcon && !!localIcon) {
|
|
581
|
+
return remoteIcon.type !== localIcon.type || remoteIcon.value !== localIcon.value;
|
|
582
|
+
}
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
exports.SourceControlStatusService = SourceControlStatusService;
|
|
587
|
+
exports.SourceControlStatusService = SourceControlStatusService = __decorate([
|
|
588
|
+
(0, di_1.Service)(),
|
|
589
|
+
__metadata("design:paramtypes", [backend_common_1.Logger,
|
|
590
|
+
source_control_git_service_ee_1.SourceControlGitService,
|
|
591
|
+
source_control_import_service_ee_1.SourceControlImportService,
|
|
592
|
+
source_control_preferences_service_ee_1.SourceControlPreferencesService,
|
|
593
|
+
db_1.TagRepository,
|
|
594
|
+
db_1.FolderRepository,
|
|
595
|
+
event_service_1.EventService])
|
|
596
|
+
], SourceControlStatusService);
|
|
@@ -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
|
+
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.SourceControlConfig = void 0;
|
|
13
|
+
const config_1 = require("@n8n/config");
|
|
14
|
+
let SourceControlConfig = class SourceControlConfig {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.defaultKeyPairType = 'ed25519';
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.SourceControlConfig = SourceControlConfig;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, config_1.Env)('N8N_SOURCECONTROL_DEFAULT_SSH_KEY_TYPE'),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], SourceControlConfig.prototype, "defaultKeyPairType", void 0);
|
|
24
|
+
exports.SourceControlConfig = SourceControlConfig = __decorate([
|
|
25
|
+
config_1.Config
|
|
26
|
+
], SourceControlConfig);
|