n8n 2.37.6 → 2.37.7
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/active-workflow-manager.d.ts +8 -8
- package/dist/active-workflow-manager.js +38 -23
- package/dist/active-workflow-manager.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chat/chat-execution-manager.d.ts +5 -0
- package/dist/chat/chat-execution-manager.js +50 -10
- package/dist/chat/chat-execution-manager.js.map +1 -1
- package/dist/chat/chat-service.d.ts +0 -1
- package/dist/chat/chat-service.js +12 -18
- package/dist/chat/chat-service.js.map +1 -1
- package/dist/chat/utils.d.ts +1 -0
- package/dist/chat/utils.js +14 -4
- package/dist/chat/utils.js.map +1 -1
- package/dist/controllers/role.controller.d.ts +3 -1
- package/dist/controllers/role.controller.js +19 -3
- package/dist/controllers/role.controller.js.map +1 -1
- package/dist/credentials/credentials.service.js +24 -3
- package/dist/credentials/credentials.service.js.map +1 -1
- package/dist/errors/subworkflow-policy-denial.error.d.ts +4 -1
- package/dist/errors/subworkflow-policy-denial.error.js +26 -10
- package/dist/errors/subworkflow-policy-denial.error.js.map +1 -1
- package/dist/executions/execution-recovery.service.d.ts +3 -1
- package/dist/executions/execution-recovery.service.js +13 -4
- package/dist/executions/execution-recovery.service.js.map +1 -1
- package/dist/executions/pre-execution-checks/subworkflow-policy-checker.d.ts +5 -2
- package/dist/executions/pre-execution-checks/subworkflow-policy-checker.js +28 -8
- package/dist/executions/pre-execution-checks/subworkflow-policy-checker.js.map +1 -1
- package/dist/modules/agents/agent-runtime-reconstruction.service.js +4 -2
- package/dist/modules/agents/agent-runtime-reconstruction.service.js.map +1 -1
- package/dist/modules/agents/builder/get-resource-locator-options.tool.d.ts +2 -2
- package/dist/modules/agents/tools/workflow-tool-factory.d.ts +2 -0
- package/dist/modules/agents/tools/workflow-tool-factory.js +2 -1
- package/dist/modules/agents/tools/workflow-tool-factory.js.map +1 -1
- package/dist/modules/chat-hub/chat-hub.service.d.ts +3 -1
- package/dist/modules/chat-hub/chat-hub.service.js +8 -2
- package/dist/modules/chat-hub/chat-hub.service.js.map +1 -1
- package/dist/modules/community-packages/community-packages.service.js +4 -0
- package/dist/modules/community-packages/community-packages.service.js.map +1 -1
- package/dist/modules/instance-ai/eval/execution.service.js +1 -1
- package/dist/modules/instance-ai/eval/execution.service.js.map +1 -1
- package/dist/modules/instance-ai/instance-ai.adapter.service.js +2 -2
- package/dist/modules/instance-ai/instance-ai.adapter.service.js.map +1 -1
- package/dist/modules/log-streaming.ee/destinations/destination-credentials-access.d.ts +4 -0
- package/dist/modules/log-streaming.ee/destinations/destination-credentials-access.js +21 -0
- package/dist/modules/log-streaming.ee/destinations/destination-credentials-access.js.map +1 -0
- package/dist/modules/log-streaming.ee/log-streaming.controller.d.ts +4 -2
- package/dist/modules/log-streaming.ee/log-streaming.controller.js +13 -4
- package/dist/modules/log-streaming.ee/log-streaming.controller.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/constants.d.ts +1 -0
- package/dist/modules/mcp/tools/workflow-builder/constants.js +2 -1
- package/dist/modules/mcp/tools/workflow-builder/constants.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js +2 -1
- package/dist/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.js.map +1 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.js +2 -1
- package/dist/modules/mcp/tools/workflow-builder/validate-workflow-code.tool.js.map +1 -1
- package/dist/modules/oauth-server/oauth-server.service.js +29 -0
- package/dist/modules/oauth-server/oauth-server.service.js.map +1 -1
- package/dist/modules/oauth-server/oauth-session.service.d.ts +1 -0
- package/dist/modules/oauth-server/oauth-session.service.js +5 -5
- package/dist/modules/oauth-server/oauth-session.service.js.map +1 -1
- package/dist/modules/source-control.ee/source-control.service.ee.d.ts +1 -0
- package/dist/modules/source-control.ee/source-control.service.ee.js +24 -20
- package/dist/modules/source-control.ee/source-control.service.ee.js.map +1 -1
- package/dist/modules/sso-oidc/oidc.controller.ee.js +1 -0
- package/dist/modules/sso-oidc/oidc.controller.ee.js.map +1 -1
- package/dist/modules/sso-oidc/oidc.service.ee.d.ts +1 -0
- package/dist/modules/sso-oidc/oidc.service.ee.js +7 -0
- package/dist/modules/sso-oidc/oidc.service.ee.js.map +1 -1
- package/dist/public-api/v1/handlers/log-streaming/log-streaming.handler.js +10 -3
- package/dist/public-api/v1/handlers/log-streaming/log-streaming.handler.js.map +1 -1
- package/dist/push/abstract.push.js +2 -1
- package/dist/push/abstract.push.js.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +25 -25
- package/dist/server.js.map +1 -1
- package/dist/services/active-workflows.service.d.ts +4 -3
- package/dist/services/active-workflows.service.js +7 -6
- package/dist/services/active-workflows.service.js.map +1 -1
- package/dist/services/credentials-tester.service.d.ts +1 -0
- package/dist/services/credentials-tester.service.js +9 -1
- package/dist/services/credentials-tester.service.js.map +1 -1
- package/dist/task-runners/task-broker/auth/task-broker-auth.service.js +1 -2
- package/dist/task-runners/task-broker/auth/task-broker-auth.service.js.map +1 -1
- package/dist/utils/request-path.d.ts +2 -0
- package/dist/utils/request-path.js +58 -0
- package/dist/utils/request-path.js.map +1 -0
- package/dist/webhooks/hitl-interaction-webhooks.d.ts +1 -0
- package/dist/webhooks/hitl-interaction-webhooks.js +5 -3
- package/dist/webhooks/hitl-interaction-webhooks.js.map +1 -1
- package/dist/webhooks/slack-interaction-webhooks.d.ts +1 -0
- package/dist/webhooks/slack-interaction-webhooks.js +4 -0
- package/dist/webhooks/slack-interaction-webhooks.js.map +1 -1
- package/dist/webhooks/telegram-interaction-webhooks.d.ts +1 -0
- package/dist/webhooks/telegram-interaction-webhooks.js +4 -0
- package/dist/webhooks/telegram-interaction-webhooks.js.map +1 -1
- package/dist/webhooks/webhook-request-sanitizer.js +8 -0
- package/dist/webhooks/webhook-request-sanitizer.js.map +1 -1
- package/dist/webhooks/webhook-response-headers.js +11 -2
- package/dist/webhooks/webhook-response-headers.js.map +1 -1
- package/dist/workflows/publication/publication-status-reporter.d.ts +4 -4
- package/dist/workflows/publication/publication-status-reporter.js +16 -16
- package/dist/workflows/publication/publication-status-reporter.js.map +1 -1
- package/dist/workflows/workflow-push-notifier.service.d.ts +9 -0
- package/dist/workflows/workflow-push-notifier.service.js +31 -0
- package/dist/workflows/workflow-push-notifier.service.js.map +1 -0
- package/dist/workflows/workflow-sharing.service.d.ts +7 -3
- package/dist/workflows/workflow-sharing.service.js +29 -2
- package/dist/workflows/workflow-sharing.service.js.map +1 -1
- package/package.json +35 -35
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.normalize = normalize;
|
|
7
|
+
exports.mayReachDirectory = mayReachDirectory;
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const DOT_SEGMENT = /^\.{1,2}$/;
|
|
10
|
+
const DOTS_AND_SPACES = /^[. ]+$/;
|
|
11
|
+
const TRAILING_DOTS_AND_SPACES = /[. ]+$/;
|
|
12
|
+
const TRAILING_SPACES = / +$/;
|
|
13
|
+
function tryDecode(requestPath) {
|
|
14
|
+
try {
|
|
15
|
+
return decodeURIComponent(requestPath);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function toSegments(decoded) {
|
|
22
|
+
return decoded.replace(/\\/g, '/').split('/');
|
|
23
|
+
}
|
|
24
|
+
function trimSegment(segment) {
|
|
25
|
+
const withoutTrailingSpaces = segment.replace(TRAILING_SPACES, '');
|
|
26
|
+
if (DOT_SEGMENT.test(withoutTrailingSpaces))
|
|
27
|
+
return withoutTrailingSpaces;
|
|
28
|
+
return withoutTrailingSpaces.replace(TRAILING_DOTS_AND_SPACES, '');
|
|
29
|
+
}
|
|
30
|
+
function normalizeSegments(segments) {
|
|
31
|
+
const trimmed = segments.map(trimSegment).filter((segment) => segment !== '');
|
|
32
|
+
return node_path_1.default.posix.normalize(`/${trimmed.join('/')}`).toLowerCase();
|
|
33
|
+
}
|
|
34
|
+
function normalize(requestPath) {
|
|
35
|
+
const decoded = tryDecode(requestPath) ?? requestPath;
|
|
36
|
+
return normalizeSegments(toSegments(decoded));
|
|
37
|
+
}
|
|
38
|
+
function mayReachDirectory(requestPath, directory) {
|
|
39
|
+
const decoded = tryDecode(requestPath);
|
|
40
|
+
if (decoded === null)
|
|
41
|
+
return true;
|
|
42
|
+
const lowerDirectory = directory.toLowerCase();
|
|
43
|
+
const segments = toSegments(decoded);
|
|
44
|
+
const normalized = normalizeSegments(segments);
|
|
45
|
+
if (normalized === `/${lowerDirectory}` || normalized.startsWith(`/${lowerDirectory}/`)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
let hasUnreadableSegment = false;
|
|
49
|
+
let matchesDirectory = false;
|
|
50
|
+
for (const segment of segments) {
|
|
51
|
+
if (DOTS_AND_SPACES.test(segment) && !DOT_SEGMENT.test(segment))
|
|
52
|
+
hasUnreadableSegment = true;
|
|
53
|
+
if (trimSegment(segment).toLowerCase() === lowerDirectory)
|
|
54
|
+
matchesDirectory = true;
|
|
55
|
+
}
|
|
56
|
+
return hasUnreadableSegment && matchesDirectory;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=request-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-path.js","sourceRoot":"","sources":["../../src/utils/request-path.ts"],"names":[],"mappings":";;;;;;;AAAA,0DAA6B;AAE7B,MAAM,WAAW,GAAG,WAAW,CAAC;AAChC,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,MAAM,wBAAwB,GAAG,QAAQ,CAAC;AAC1C,MAAM,eAAe,GAAG,KAAK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G,SAAS,CAAC,WAAW,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC/C,IAAI,UAAU,KAAK,IAAI,cAAc,EAAE,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;QACzF,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,oBAAoB,GAAG,KAAK,CAAC;IACjC,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC;YAAE,oBAAoB,GAAG,IAAI,CAAC;QAC7F,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK,cAAc;YAAE,gBAAgB,GAAG,IAAI,CAAC;IACpF,CAAC;IAED,OAAO,oBAAoB,IAAI,gBAAgB,CAAC;AACjD,CAAC"}
|
|
@@ -5,6 +5,7 @@ import type { IWebhookResponseCallbackData, WaitingWebhookRequest } from './webh
|
|
|
5
5
|
export declare abstract class HitlInteractionWebhooks extends WaitingWebhooks {
|
|
6
6
|
protected reject(res: express.Response, status: number): IWebhookResponseCallbackData;
|
|
7
7
|
protected abstract parseCallback(req: WaitingWebhookRequest): Promise<ParsedHitlCallbackReference | null>;
|
|
8
|
+
protected abstract readonly platformNodeType: string;
|
|
8
9
|
protected handleUnrecognizedCallback(res: express.Response): IWebhookResponseCallbackData;
|
|
9
10
|
protected beforeResume(_req: WaitingWebhookRequest): void;
|
|
10
11
|
private validate;
|
|
@@ -25,12 +25,14 @@ class HitlInteractionWebhooks extends waiting_webhooks_1.WaitingWebhooks {
|
|
|
25
25
|
}
|
|
26
26
|
const lastNodeExecuted = execution.data.resultData.lastNodeExecuted;
|
|
27
27
|
const workflow = this.createWorkflow(execution.workflowData);
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
28
|
+
const node = workflow.getNode(lastNodeExecuted);
|
|
29
|
+
if (!node)
|
|
30
|
+
return { ok: false, status: 404 };
|
|
31
|
+
if (node.type !== this.platformNodeType)
|
|
30
32
|
return { ok: false, status: 404 };
|
|
31
33
|
return {
|
|
32
34
|
ok: true,
|
|
33
|
-
value: { execution, executionId: parsed.executionId, lastNodeExecuted, nodeId },
|
|
35
|
+
value: { execution, executionId: parsed.executionId, lastNodeExecuted, nodeId: node.id },
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
38
|
async executeWebhook(req, res) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hitl-interaction-webhooks.js","sourceRoot":"","sources":["../../src/webhooks/hitl-interaction-webhooks.ts"],"names":[],"mappings":";;;AAGA,uCAAuD;AAEvD,yDAAqD;AACrD,2EAAqE;AAmBrE,6BAA8C,SAAQ,kCAAe;IAC1D,MAAM,CAAC,GAAqB,EAAE,MAAc;QACrD,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;
|
|
1
|
+
{"version":3,"file":"hitl-interaction-webhooks.js","sourceRoot":"","sources":["../../src/webhooks/hitl-interaction-webhooks.ts"],"names":[],"mappings":";;;AAGA,uCAAuD;AAEvD,yDAAqD;AACrD,2EAAqE;AAmBrE,6BAA8C,SAAQ,kCAAe;IAC1D,MAAM,CAAC,GAAqB,EAAE,MAAc;QACrD,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;IAcS,0BAA0B,CAAC,GAAqB;QACzD,OAAO,IAAI,CAAC,MAAM,CAAC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,EAAE,MAAM,CAAC,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;SACxF,CAAC;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CACnB,GAA0B,EAC1B,GAAqB;QAGrB,IAAA,kDAAsB,EAAC,GAAG,CAAC,CAAC;QAE5B,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAExD,MAAM,MAAM,GAAuC,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QACjF,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC;QAEzD,MAAM,SAAS,GAAqB,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAE7D,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAGvB,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC;QAC7E,OAAO,MAAM,IAAI,CAAC,uBAAuB,CAAC;YACzC,SAAS;YACT,GAAG;YACH,GAAG;YACH,gBAAgB;YAChB,WAAW;YACX,MAAM,EAAE,MAAM;SACd,CAAC,CAAC;IACJ,CAAC;CACD"}
|
|
@@ -3,6 +3,7 @@ import type { ParsedHitlCallbackReference } from 'n8n-core';
|
|
|
3
3
|
import { HitlInteractionWebhooks } from './hitl-interaction-webhooks';
|
|
4
4
|
import type { IWebhookResponseCallbackData, WaitingWebhookRequest } from './webhook.types';
|
|
5
5
|
export declare class SlackInteractionWebhooks extends HitlInteractionWebhooks {
|
|
6
|
+
protected readonly platformNodeType = "n8n-nodes-base.slack";
|
|
6
7
|
protected parseCallback(req: WaitingWebhookRequest): Promise<ParsedHitlCallbackReference | null>;
|
|
7
8
|
protected beforeResume(req: WaitingWebhookRequest): void;
|
|
8
9
|
protected handleUnrecognizedCallback(res: express.Response): IWebhookResponseCallbackData;
|
|
@@ -12,6 +12,10 @@ const n8n_core_1 = require("n8n-core");
|
|
|
12
12
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
13
13
|
const hitl_interaction_webhooks_1 = require("./hitl-interaction-webhooks");
|
|
14
14
|
let SlackInteractionWebhooks = class SlackInteractionWebhooks extends hitl_interaction_webhooks_1.HitlInteractionWebhooks {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.platformNodeType = 'n8n-nodes-base.slack';
|
|
18
|
+
}
|
|
15
19
|
async parseCallback(req) {
|
|
16
20
|
await req.readRawBody();
|
|
17
21
|
const payloadRaw = new URLSearchParams(req.rawBody?.toString() ?? '').get('payload');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-interaction-webhooks.js","sourceRoot":"","sources":["../../src/webhooks/slack-interaction-webhooks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gCAAkC;AAGlC,uCAAmF;AACnF,+CAAyC;AAEzC,2EAAsE;AAa/D,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,mDAAuB;
|
|
1
|
+
{"version":3,"file":"slack-interaction-webhooks.js","sourceRoot":"","sources":["../../src/webhooks/slack-interaction-webhooks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gCAAkC;AAGlC,uCAAmF;AACnF,+CAAyC;AAEzC,2EAAsE;AAa/D,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,mDAAuB;IAA9D;;QACa,qBAAgB,GAAG,sBAAsB,CAAC;IA8B9D,CAAC;IA5BU,KAAK,CAAC,aAAa,CAC5B,GAA0B;QAE1B,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACrF,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC;QAC7B,MAAM,OAAO,GAAG,IAAA,wBAAS,EAA0B,UAAU,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;QACtF,OAAO,IAAA,qCAA0B,EAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;IAMS,YAAY,CAAC,GAA0B;QAChD,IAAA,sCAA2B,EAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAOS,0BAA0B,CAAC,GAAqB;QACzD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzB,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;CACD,CAAA;;mCA/BY,wBAAwB;IADpC,IAAA,YAAO,GAAE;GACG,wBAAwB,CA+BpC"}
|
|
@@ -2,5 +2,6 @@ import type { ParsedHitlCallbackReference } from 'n8n-core';
|
|
|
2
2
|
import { HitlInteractionWebhooks } from './hitl-interaction-webhooks';
|
|
3
3
|
import type { WaitingWebhookRequest } from './webhook.types';
|
|
4
4
|
export declare class TelegramInteractionWebhooks extends HitlInteractionWebhooks {
|
|
5
|
+
protected readonly platformNodeType = "n8n-nodes-base.telegram";
|
|
5
6
|
protected parseCallback(req: WaitingWebhookRequest): Promise<ParsedHitlCallbackReference | null>;
|
|
6
7
|
}
|
|
@@ -12,6 +12,10 @@ const n8n_core_1 = require("n8n-core");
|
|
|
12
12
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
13
13
|
const hitl_interaction_webhooks_1 = require("./hitl-interaction-webhooks");
|
|
14
14
|
let TelegramInteractionWebhooks = class TelegramInteractionWebhooks extends hitl_interaction_webhooks_1.HitlInteractionWebhooks {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.platformNodeType = 'n8n-nodes-base.telegram';
|
|
18
|
+
}
|
|
15
19
|
async parseCallback(req) {
|
|
16
20
|
await req.readRawBody();
|
|
17
21
|
const update = (0, n8n_workflow_1.jsonParse)(req.rawBody?.toString() ?? '', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegram-interaction-webhooks.js","sourceRoot":"","sources":["../../src/webhooks/telegram-interaction-webhooks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gCAAkC;AAElC,uCAAsD;AACtD,+CAAyC;AAEzC,2EAAsE;AAe/D,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,mDAAuB;
|
|
1
|
+
{"version":3,"file":"telegram-interaction-webhooks.js","sourceRoot":"","sources":["../../src/webhooks/telegram-interaction-webhooks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gCAAkC;AAElC,uCAAsD;AACtD,+CAAyC;AAEzC,2EAAsE;AAe/D,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,mDAAuB;IAAjE;;QACa,qBAAgB,GAAG,yBAAyB,CAAC;IAWjE,CAAC;IATU,KAAK,CAAC,aAAa,CAC5B,GAA0B;QAE1B,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,IAAA,wBAAS,EAAyB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;YAC/E,aAAa,EAAE,EAAE;SACjB,CAAC,CAAC;QACH,OAAO,IAAA,qCAA0B,EAAC,MAAM,CAAC,cAAc,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;CACD,CAAA;;sCAZY,2BAA2B;IADvC,IAAA,YAAO,GAAE;GACG,2BAA2B,CAYvC"}
|
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sanitizeWebhookRequest = void 0;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
|
+
const oauth_session_service_1 = require("../modules/oauth-server/oauth-session.service");
|
|
6
|
+
const constants_2 = require("../modules/sso-oidc/constants");
|
|
7
|
+
const oauth_browser_binding_service_1 = require("../oauth/oauth-browser-binding.service");
|
|
5
8
|
const BROWSER_ID_COOKIE_NAME = 'n8n-browserId';
|
|
6
9
|
const DISALLOWED_COOKIES = new Set([
|
|
7
10
|
constants_1.AUTH_COOKIE_NAME,
|
|
8
11
|
BROWSER_ID_COOKIE_NAME,
|
|
12
|
+
oauth_session_service_1.OAUTH_SESSION_COOKIE_NAME,
|
|
13
|
+
oauth_browser_binding_service_1.OAUTH_BINDING_COOKIE_NAME,
|
|
14
|
+
constants_2.OIDC_ID_TOKEN_COOKIE_NAME,
|
|
15
|
+
constants_1.OIDC_STATE_COOKIE_NAME,
|
|
16
|
+
constants_1.OIDC_NONCE_COOKIE_NAME,
|
|
9
17
|
constants_1.FORM_OAUTH_COOKIE_NAME,
|
|
10
18
|
]);
|
|
11
19
|
const isDisallowedCookie = (name) => DISALLOWED_COOKIES.has(name) || name.startsWith(`${constants_1.FORM_AUTH_COOKIE_PREFIX}-`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-request-sanitizer.js","sourceRoot":"","sources":["../../src/webhooks/webhook-request-sanitizer.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"webhook-request-sanitizer.js","sourceRoot":"","sources":["../../src/webhooks/webhook-request-sanitizer.ts"],"names":[],"mappings":";;;AAEA,2CAMqB;AACrB,wFAAyF;AACzF,4DAAyE;AACzE,yFAAkF;AAElF,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAU/C,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IAClC,4BAAgB;IAChB,sBAAsB;IACtB,iDAAyB;IACzB,yDAAyB;IACzB,qCAAyB;IACzB,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BAAE,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;AACF,CAAC,CAAC;AAEK,MAAM,sBAAsB,GAAG,CAAC,GAAY,EAAE,EAAE;IACtD,uBAAuB,CAAC,GAAG,CAAC,CAAC;IAC7B,8BAA8B,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC;AAHW,QAAA,sBAAsB,GAAtB,sBAAsB,CAGjC"}
|
|
@@ -7,7 +7,12 @@ const di_1 = require("@n8n/di");
|
|
|
7
7
|
const n8n_core_1 = require("n8n-core");
|
|
8
8
|
const node_http_1 = require("node:http");
|
|
9
9
|
const ensure_error_1 = require("@n8n/utils/errors/ensure-error");
|
|
10
|
-
const PROTECTED_HEADERS = new Set([
|
|
10
|
+
const PROTECTED_HEADERS = new Set([
|
|
11
|
+
'content-security-policy',
|
|
12
|
+
'set-cookie',
|
|
13
|
+
'strict-transport-security',
|
|
14
|
+
'clear-site-data',
|
|
15
|
+
]);
|
|
11
16
|
class WebhookResponseHeaders {
|
|
12
17
|
constructor() {
|
|
13
18
|
this.headers = new Map();
|
|
@@ -19,8 +24,12 @@ class WebhookResponseHeaders {
|
|
|
19
24
|
}
|
|
20
25
|
set(name, value) {
|
|
21
26
|
const lowerName = name.toLowerCase();
|
|
22
|
-
if (PROTECTED_HEADERS.has(lowerName))
|
|
27
|
+
if (PROTECTED_HEADERS.has(lowerName)) {
|
|
28
|
+
di_1.Container.get(backend_common_1.Logger).warn('Dropping protected webhook response header', {
|
|
29
|
+
headerName: name,
|
|
30
|
+
});
|
|
23
31
|
return;
|
|
32
|
+
}
|
|
24
33
|
try {
|
|
25
34
|
(0, node_http_1.validateHeaderName)(lowerName);
|
|
26
35
|
(0, node_http_1.validateHeaderValue)(lowerName, value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-response-headers.js","sourceRoot":"","sources":["../../src/webhooks/webhook-response-headers.ts"],"names":[],"mappings":";;;;AAAA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;aAC7B,CAAC,CAAC;YACH,OAAO;QACR,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAGD,aAAa,CAAC,GAAW;QACxB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/B,CAAC;IACF,CAAC;IAGD,kBAAkB,CAAC,WAAuC;QACzD,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS;YAAE,OAAO;QAE9C,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;IACF,CAAC;IAGD,eAAe,CAAC,GAAa;QAC5B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO;QAEpC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACD;;AAGD,yBAAgC,GAAa;IAC5C,IAAI,IAAA,0CAA+B,GAAE;QAAE,OAAO;IAC9C,GAAG,CAAC,SAAS,CAAC,yBAAyB,EAAE,IAAA,4BAAiB,GAAE,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -3,25 +3,25 @@ import { Logger } from '@n8n/backend-common';
|
|
|
3
3
|
import { WorkflowPublicationOutbox, WorkflowPublicationOutboxRepository, WorkflowPublicationTriggerStatusRepository } from '@n8n/db';
|
|
4
4
|
import { ErrorReporter } from 'n8n-core';
|
|
5
5
|
import { ActivationErrorsService } from '../../activation-errors.service';
|
|
6
|
-
import { Push } from '../../push';
|
|
7
6
|
import { Publisher } from '../../scaling/pubsub/publisher.service';
|
|
8
7
|
import type { PublicationResult } from '../../workflows/publication/publication-result';
|
|
8
|
+
import { WorkflowPushNotifier } from '../../workflows/workflow-push-notifier.service';
|
|
9
9
|
export declare class PublicationStatusReporter {
|
|
10
10
|
private readonly logger;
|
|
11
11
|
private readonly errorReporter;
|
|
12
12
|
private readonly outboxRepository;
|
|
13
13
|
private readonly activationErrorsService;
|
|
14
|
-
private readonly push;
|
|
15
14
|
private readonly publisher;
|
|
16
15
|
private readonly triggerStatusRepository;
|
|
17
|
-
|
|
16
|
+
private readonly workflowPushNotifier;
|
|
17
|
+
constructor(logger: Logger, errorReporter: ErrorReporter, outboxRepository: WorkflowPublicationOutboxRepository, activationErrorsService: ActivationErrorsService, publisher: Publisher, triggerStatusRepository: WorkflowPublicationTriggerStatusRepository, workflowPushNotifier: WorkflowPushNotifier);
|
|
18
18
|
report(record: WorkflowPublicationOutbox, result: PublicationResult): Promise<void>;
|
|
19
19
|
private reportPartial;
|
|
20
20
|
private toRows;
|
|
21
21
|
private formatActivationError;
|
|
22
22
|
private pushFailedToActivate;
|
|
23
23
|
private pushStatus;
|
|
24
|
-
handleDisplayWorkflowPublicationStatus(pushMsg: WorkflowPublicationStatusMessage): void
|
|
24
|
+
handleDisplayWorkflowPublicationStatus(pushMsg: WorkflowPublicationStatusMessage): Promise<void>;
|
|
25
25
|
private complete;
|
|
26
26
|
private logSkip;
|
|
27
27
|
}
|
|
@@ -16,29 +16,29 @@ const decorators_1 = require("@n8n/decorators");
|
|
|
16
16
|
const di_1 = require("@n8n/di");
|
|
17
17
|
const n8n_core_1 = require("n8n-core");
|
|
18
18
|
const activation_errors_service_1 = require("../../activation-errors.service");
|
|
19
|
-
const push_1 = require("../../push");
|
|
20
19
|
const publisher_service_1 = require("../../scaling/pubsub/publisher.service");
|
|
20
|
+
const workflow_push_notifier_service_1 = require("../../workflows/workflow-push-notifier.service");
|
|
21
21
|
const SKIP_LOG_MESSAGE = {
|
|
22
22
|
'workflow-not-found': 'Workflow not found',
|
|
23
23
|
'node-ids-healed': 'Version was healed and republished; its own record applies it',
|
|
24
24
|
superseded: 'Version was superseded by a concurrent publication',
|
|
25
25
|
};
|
|
26
26
|
let PublicationStatusReporter = class PublicationStatusReporter {
|
|
27
|
-
constructor(logger, errorReporter, outboxRepository, activationErrorsService,
|
|
27
|
+
constructor(logger, errorReporter, outboxRepository, activationErrorsService, publisher, triggerStatusRepository, workflowPushNotifier) {
|
|
28
28
|
this.logger = logger;
|
|
29
29
|
this.errorReporter = errorReporter;
|
|
30
30
|
this.outboxRepository = outboxRepository;
|
|
31
31
|
this.activationErrorsService = activationErrorsService;
|
|
32
|
-
this.push = push;
|
|
33
32
|
this.publisher = publisher;
|
|
34
33
|
this.triggerStatusRepository = triggerStatusRepository;
|
|
34
|
+
this.workflowPushNotifier = workflowPushNotifier;
|
|
35
35
|
this.logger = this.logger.scoped('workflow-publication');
|
|
36
36
|
}
|
|
37
37
|
async report(record, result) {
|
|
38
38
|
switch (result.type) {
|
|
39
39
|
case 'completed': {
|
|
40
40
|
await this.complete(record, this.toRows(record, result.triggerStatuses));
|
|
41
|
-
this.pushStatus({
|
|
41
|
+
await this.pushStatus({
|
|
42
42
|
type: 'workflowActivated',
|
|
43
43
|
data: { workflowId: record.workflowId, activeVersionId: record.publishedVersionId },
|
|
44
44
|
});
|
|
@@ -46,7 +46,7 @@ let PublicationStatusReporter = class PublicationStatusReporter {
|
|
|
46
46
|
}
|
|
47
47
|
case 'unpublished': {
|
|
48
48
|
await this.complete(record, []);
|
|
49
|
-
this.pushStatus({
|
|
49
|
+
await this.pushStatus({
|
|
50
50
|
type: 'workflowDeactivated',
|
|
51
51
|
data: { workflowId: record.workflowId },
|
|
52
52
|
});
|
|
@@ -65,7 +65,7 @@ let PublicationStatusReporter = class PublicationStatusReporter {
|
|
|
65
65
|
outboxId: record.id,
|
|
66
66
|
});
|
|
67
67
|
await this.outboxRepository.markFailed(record.id, errorMessage);
|
|
68
|
-
this.pushFailedToActivate(record.workflowId, errorMessage);
|
|
68
|
+
await this.pushFailedToActivate(record.workflowId, errorMessage);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
case 'failed': {
|
|
@@ -77,7 +77,7 @@ let PublicationStatusReporter = class PublicationStatusReporter {
|
|
|
77
77
|
await this.outboxRepository.markFailed(record.id, result.error.message, trx);
|
|
78
78
|
});
|
|
79
79
|
this.errorReporter.error(result.error, { shouldBeLogged: true });
|
|
80
|
-
this.pushFailedToActivate(record.workflowId, result.error.message);
|
|
80
|
+
await this.pushFailedToActivate(record.workflowId, result.error.message);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
case 'partial': {
|
|
@@ -98,7 +98,7 @@ let PublicationStatusReporter = class PublicationStatusReporter {
|
|
|
98
98
|
await this.triggerStatusRepository.replaceForWorkflow(record.workflowId, this.toRows(record, triggerStatuses), trx);
|
|
99
99
|
await this.outboxRepository.markPartialSuccess(record.id, errorMessage, trx);
|
|
100
100
|
});
|
|
101
|
-
this.pushStatus({
|
|
101
|
+
await this.pushStatus({
|
|
102
102
|
type: 'workflowPartiallyActivated',
|
|
103
103
|
data: {
|
|
104
104
|
workflowId: record.workflowId,
|
|
@@ -127,20 +127,20 @@ let PublicationStatusReporter = class PublicationStatusReporter {
|
|
|
127
127
|
.join('; ');
|
|
128
128
|
return `Some triggers failed to activate: ${detail}`;
|
|
129
129
|
}
|
|
130
|
-
pushFailedToActivate(workflowId, errorMessage) {
|
|
131
|
-
this.pushStatus({
|
|
130
|
+
async pushFailedToActivate(workflowId, errorMessage) {
|
|
131
|
+
await this.pushStatus({
|
|
132
132
|
type: 'workflowFailedToActivate',
|
|
133
133
|
data: { workflowId, errorMessage },
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
pushStatus(pushMsg) {
|
|
137
|
-
this.push.broadcast(pushMsg);
|
|
136
|
+
async pushStatus(pushMsg) {
|
|
138
137
|
void this.publisher
|
|
139
138
|
.publishCommand({ command: 'display-workflow-publication-status', payload: pushMsg })
|
|
140
139
|
.catch((error) => this.errorReporter.error(error, { shouldBeLogged: true }));
|
|
140
|
+
await this.workflowPushNotifier.notify(pushMsg.data.workflowId, pushMsg);
|
|
141
141
|
}
|
|
142
|
-
handleDisplayWorkflowPublicationStatus(pushMsg) {
|
|
143
|
-
this.
|
|
142
|
+
async handleDisplayWorkflowPublicationStatus(pushMsg) {
|
|
143
|
+
await this.workflowPushNotifier.notify(pushMsg.data.workflowId, pushMsg);
|
|
144
144
|
}
|
|
145
145
|
async complete(record, triggerStatuses) {
|
|
146
146
|
await this.outboxRepository.manager.transaction(async (trx) => {
|
|
@@ -161,10 +161,10 @@ __decorate([
|
|
|
161
161
|
(0, decorators_1.OnPubSubEvent)('display-workflow-publication-status', { instanceType: 'main' }),
|
|
162
162
|
__metadata("design:type", Function),
|
|
163
163
|
__metadata("design:paramtypes", [Object]),
|
|
164
|
-
__metadata("design:returntype",
|
|
164
|
+
__metadata("design:returntype", Promise)
|
|
165
165
|
], PublicationStatusReporter.prototype, "handleDisplayWorkflowPublicationStatus", null);
|
|
166
166
|
exports.PublicationStatusReporter = PublicationStatusReporter = __decorate([
|
|
167
167
|
(0, di_1.Service)(),
|
|
168
|
-
__metadata("design:paramtypes", [backend_common_1.Logger, n8n_core_1.ErrorReporter, db_1.WorkflowPublicationOutboxRepository, activation_errors_service_1.ActivationErrorsService,
|
|
168
|
+
__metadata("design:paramtypes", [backend_common_1.Logger, n8n_core_1.ErrorReporter, db_1.WorkflowPublicationOutboxRepository, activation_errors_service_1.ActivationErrorsService, publisher_service_1.Publisher, db_1.WorkflowPublicationTriggerStatusRepository, workflow_push_notifier_service_1.WorkflowPushNotifier])
|
|
169
169
|
], PublicationStatusReporter);
|
|
170
170
|
//# sourceMappingURL=publication-status-reporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publication-status-reporter.js","sourceRoot":"","sources":["../../../src/workflows/publication/publication-status-reporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wDAA6C;AAC7C,gCAKiB;AACjB,gDAAgD;AAChD,gCAAkC;AAClC,uCAAyC;AAEzC,2EAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"publication-status-reporter.js","sourceRoot":"","sources":["../../../src/workflows/publication/publication-status-reporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wDAA6C;AAC7C,gCAKiB;AACjB,gDAAgD;AAChD,gCAAkC;AAClC,uCAAyC;AAEzC,2EAAsE;AACtE,0EAA+D;AAO/D,+FAAkF;AAQlF,MAAM,gBAAgB,GAA0C;IAC/D,oBAAoB,EAAE,oBAAoB;IAC1C,iBAAiB,EAAE,+DAA+D;IAClF,UAAU,EAAE,oDAAoD;CAChE,CAAC;AAGK,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACrC,YACkB,MAAc,EACd,aAA4B,EAC5B,gBAAqD,EACrD,uBAAgD,EAChD,SAAoB,EACpB,uBAAmE,EACnE,oBAA0C;sBAN1C,MAAM;6BACN,aAAa;gCACb,gBAAgB;uCAChB,uBAAuB;yBACvB,SAAS;uCACT,uBAAuB;oCACvB,oBAAoB;QAErC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAiC,EAAE,MAAyB;QACxE,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,WAAW,EAAE,CAAC;gBAClB,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;gBACzE,MAAM,IAAI,CAAC,UAAU,CAAC;oBACrB,IAAI,EAAE,mBAAmB;oBACzB,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,CAAC,kBAAkB,EAAE;iBACnF,CAAC,CAAC;gBACH,OAAO;YACR,CAAC;YAED,K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,GAAG,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClE,CAAC;IAEO,OAAO,CAAC,MAAiC,EAAE,MAA6B;QAC/E,MAAM,OAAO,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;QAEvE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;IAC9F,CAAC;CACD,CAAA;;AAhCM;IADL,IAAA,0BAAa,EAAC,qCAAqC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;;;;uFAK9E;oCA9KW,yBAAyB;IADrC,IAAA,YAAO,GAAE;qCAGiB,uBAAM,EACC,wBAAa,EACV,wCAAmC,EAC5B,mDAAuB,EACrC,6BAAS,EACK,+CAA0C,EAC7C,qDAAoB;GARhD,yBAAyB,CA0MrC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PushMessage } from '@n8n/api-types';
|
|
2
|
+
import { Push } from '../push';
|
|
3
|
+
import { WorkflowSharingService } from '../workflows/workflow-sharing.service';
|
|
4
|
+
export declare class WorkflowPushNotifier {
|
|
5
|
+
private readonly push;
|
|
6
|
+
private readonly workflowSharingService;
|
|
7
|
+
constructor(push: Push, workflowSharingService: WorkflowSharingService);
|
|
8
|
+
notify(workflowId: string, pushMsg: PushMessage): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.WorkflowPushNotifier = void 0;
|
|
13
|
+
const di_1 = require("@n8n/di");
|
|
14
|
+
const push_1 = require("../push");
|
|
15
|
+
const workflow_sharing_service_1 = require("../workflows/workflow-sharing.service");
|
|
16
|
+
let WorkflowPushNotifier = class WorkflowPushNotifier {
|
|
17
|
+
constructor(push, workflowSharingService) {
|
|
18
|
+
this.push = push;
|
|
19
|
+
this.workflowSharingService = workflowSharingService;
|
|
20
|
+
}
|
|
21
|
+
async notify(workflowId, pushMsg) {
|
|
22
|
+
const userIds = await this.workflowSharingService.getUserIdsWithAccessToWorkflowSafe(workflowId);
|
|
23
|
+
this.push.sendToUsers(pushMsg, userIds);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.WorkflowPushNotifier = WorkflowPushNotifier;
|
|
27
|
+
exports.WorkflowPushNotifier = WorkflowPushNotifier = __decorate([
|
|
28
|
+
(0, di_1.Service)(),
|
|
29
|
+
__metadata("design:paramtypes", [push_1.Push, workflow_sharing_service_1.WorkflowSharingService])
|
|
30
|
+
], WorkflowPushNotifier);
|
|
31
|
+
//# sourceMappingURL=workflow-push-notifier.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-push-notifier.service.js","sourceRoot":"","sources":["../../src/workflows/workflow-push-notifier.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gCAAkC;AAElC,iCAA8B;AAC9B,mFAA8E;AAIvE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAChC,YACkB,IAAU,EACV,sBAA8C;oBAD9C,IAAI;sCACJ,sBAAsB;IACrC,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,UAAkB,EAAE,OAAoB;QACpD,MAAM,OAAO,GACZ,MAAM,IAAI,CAAC,sBAAsB,CAAC,kCAAkC,CAAC,UAAU,CAAC,CAAC;QAClF,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;CACD,CAAA;;+BAXY,oBAAoB;IADhC,IAAA,YAAO,GAAE;qCAGe,WAAI,EACc,iDAAsB;GAHpD,oBAAoB,CAWhC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LicenseState } from '@n8n/backend-common';
|
|
1
|
+
import { Logger, LicenseState } from '@n8n/backend-common';
|
|
2
2
|
import type { User } from '@n8n/db';
|
|
3
|
-
import { ProjectRelationRepository, SharedWorkflowRepository } from '@n8n/db';
|
|
3
|
+
import { ProjectRelationRepository, SharedWorkflowRepository, UserRepository } from '@n8n/db';
|
|
4
4
|
import { type ProjectRole, type WorkflowSharingRole, type Scope } from '@n8n/permissions';
|
|
5
5
|
import { RoleService } from '../services/role.service';
|
|
6
6
|
export type ShareWorkflowOptions = {
|
|
@@ -16,8 +16,12 @@ export declare class WorkflowSharingService {
|
|
|
16
16
|
private readonly roleService;
|
|
17
17
|
private readonly projectRelationRepository;
|
|
18
18
|
private readonly licenseState;
|
|
19
|
-
|
|
19
|
+
private readonly userRepository;
|
|
20
|
+
private readonly logger;
|
|
21
|
+
constructor(sharedWorkflowRepository: SharedWorkflowRepository, roleService: RoleService, projectRelationRepository: ProjectRelationRepository, licenseState: LicenseState, userRepository: UserRepository, logger: Logger);
|
|
20
22
|
getSharedWorkflowIds(user: User, options: ShareWorkflowOptions): Promise<string[]>;
|
|
23
|
+
getUserIdsWithAccessToWorkflow(workflowId: string): Promise<string[]>;
|
|
24
|
+
getUserIdsWithAccessToWorkflowSafe(workflowId: string): Promise<string[]>;
|
|
21
25
|
getSharedWorkflowIdsForScopes(user: User, scopes: Scope[], projectId?: string): Promise<string[]>;
|
|
22
26
|
getSharedWithMeIds(user: User): Promise<string[]>;
|
|
23
27
|
getSharedWorkflowScopes(workflowIds: string[], user: User): Promise<Array<[string, Scope[]]>>;
|
|
@@ -17,11 +17,13 @@ const permissions_1 = require("@n8n/permissions");
|
|
|
17
17
|
const typeorm_1 = require("@n8n/typeorm");
|
|
18
18
|
const role_service_1 = require("../services/role.service");
|
|
19
19
|
let WorkflowSharingService = class WorkflowSharingService {
|
|
20
|
-
constructor(sharedWorkflowRepository, roleService, projectRelationRepository, licenseState) {
|
|
20
|
+
constructor(sharedWorkflowRepository, roleService, projectRelationRepository, licenseState, userRepository, logger) {
|
|
21
21
|
this.sharedWorkflowRepository = sharedWorkflowRepository;
|
|
22
22
|
this.roleService = roleService;
|
|
23
23
|
this.projectRelationRepository = projectRelationRepository;
|
|
24
24
|
this.licenseState = licenseState;
|
|
25
|
+
this.userRepository = userRepository;
|
|
26
|
+
this.logger = logger;
|
|
25
27
|
}
|
|
26
28
|
async getSharedWorkflowIds(user, options) {
|
|
27
29
|
const { projectId } = options;
|
|
@@ -52,6 +54,31 @@ let WorkflowSharingService = class WorkflowSharingService {
|
|
|
52
54
|
});
|
|
53
55
|
return sharedWorkflows.map(({ workflowId }) => workflowId);
|
|
54
56
|
}
|
|
57
|
+
async getUserIdsWithAccessToWorkflow(workflowId) {
|
|
58
|
+
const [workflowRoles, globalRoles, projectRoles] = await Promise.all([
|
|
59
|
+
this.roleService.rolesWithScope('workflow', ['workflow:read']),
|
|
60
|
+
this.roleService.rolesWithScope('global', ['workflow:read']),
|
|
61
|
+
this.roleService.rolesWithScope('project', ['workflow:read']),
|
|
62
|
+
]);
|
|
63
|
+
const projectIds = await this.sharedWorkflowRepository.findProjectIdsByRole(workflowId, workflowRoles);
|
|
64
|
+
return await this.userRepository.findIdsWithGlobalOrProjectRoles({
|
|
65
|
+
projectIds,
|
|
66
|
+
projectRoleSlugs: projectRoles,
|
|
67
|
+
globalRoleSlugs: globalRoles,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async getUserIdsWithAccessToWorkflowSafe(workflowId) {
|
|
71
|
+
try {
|
|
72
|
+
return await this.getUserIdsWithAccessToWorkflow(workflowId);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
this.logger.error(`Failed to resolve who can access workflow "${workflowId}"`, {
|
|
76
|
+
workflowId,
|
|
77
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
78
|
+
});
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
55
82
|
async getSharedWorkflowIdsForScopes(user, scopes, projectId) {
|
|
56
83
|
if (this.licenseState.isSharingLicensed()) {
|
|
57
84
|
return await this.getSharedWorkflowIds(user, { scopes, projectId });
|
|
@@ -119,6 +146,6 @@ let WorkflowSharingService = class WorkflowSharingService {
|
|
|
119
146
|
exports.WorkflowSharingService = WorkflowSharingService;
|
|
120
147
|
exports.WorkflowSharingService = WorkflowSharingService = __decorate([
|
|
121
148
|
(0, di_1.Service)(),
|
|
122
|
-
__metadata("design:paramtypes", [db_1.SharedWorkflowRepository, role_service_1.RoleService, db_1.ProjectRelationRepository, backend_common_1.LicenseState])
|
|
149
|
+
__metadata("design:paramtypes", [db_1.SharedWorkflowRepository, role_service_1.RoleService, db_1.ProjectRelationRepository, backend_common_1.LicenseState, db_1.UserRepository, backend_common_1.Logger])
|
|
123
150
|
], WorkflowSharingService);
|
|
124
151
|
//# sourceMappingURL=workflow-sharing.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-sharing.service.js","sourceRoot":"","sources":["../../src/workflows/workflow-sharing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"workflow-sharing.service.js","sourceRoot":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