n8n 1.78.0 → 1.79.0
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-executions.d.ts +1 -1
- package/dist/active-executions.js +36 -17
- package/dist/active-executions.js.map +1 -1
- package/dist/active-workflow-manager.d.ts +10 -9
- package/dist/active-workflow-manager.js +42 -30
- package/dist/active-workflow-manager.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/commands/base-command.d.ts +1 -0
- package/dist/commands/base-command.js +4 -0
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/execute-batch.d.ts +2 -2
- package/dist/commands/execute-batch.js.map +1 -1
- package/dist/commands/import/workflow.js +6 -6
- package/dist/commands/import/workflow.js.map +1 -1
- package/dist/commands/start.js +4 -0
- package/dist/commands/start.js.map +1 -1
- package/dist/concurrency/concurrency-control.service.d.ts +1 -4
- package/dist/concurrency/concurrency-control.service.js +6 -7
- package/dist/concurrency/concurrency-control.service.js.map +1 -1
- package/dist/controllers/oauth/abstract-oauth.controller.d.ts +4 -2
- package/dist/controllers/oauth/abstract-oauth.controller.js +12 -6
- package/dist/controllers/oauth/abstract-oauth.controller.js.map +1 -1
- package/dist/controllers/oauth/oauth1-credential.controller.js +5 -8
- package/dist/controllers/oauth/oauth1-credential.controller.js.map +1 -1
- package/dist/controllers/oauth/oauth2-credential.controller.js +10 -12
- package/dist/controllers/oauth/oauth2-credential.controller.js.map +1 -1
- package/dist/credentials/credentials.service.d.ts +3 -2
- package/dist/credentials/credentials.service.js +20 -5
- package/dist/credentials/credentials.service.js.map +1 -1
- package/dist/databases/entities/folder.d.ts +11 -0
- package/dist/databases/entities/folder.js +56 -0
- package/dist/databases/entities/folder.js.map +1 -0
- package/dist/databases/entities/index.d.ts +2 -0
- package/dist/databases/entities/index.js +2 -0
- package/dist/databases/entities/index.js.map +1 -1
- package/dist/databases/entities/test-case-execution.ee.d.ts +6 -3
- package/dist/databases/entities/test-case-execution.ee.js.map +1 -1
- package/dist/databases/entities/test-run.ee.d.ts +9 -2
- package/dist/databases/entities/test-run.ee.js +12 -0
- package/dist/databases/entities/test-run.ee.js.map +1 -1
- package/dist/databases/entities/workflow-entity.d.ts +2 -1
- package/dist/databases/entities/workflow-entity.js +8 -3
- package/dist/databases/entities/workflow-entity.js.map +1 -1
- package/dist/databases/migrations/common/1737715421462-AddErrorColumnsToTestRuns.d.ts +5 -0
- package/dist/databases/migrations/common/1737715421462-AddErrorColumnsToTestRuns.js +21 -0
- package/dist/databases/migrations/common/1737715421462-AddErrorColumnsToTestRuns.js.map +1 -0
- package/dist/databases/migrations/common/1738709609940-CreateFolderTable.d.ts +5 -0
- package/dist/databases/migrations/common/1738709609940-CreateFolderTable.js +46 -0
- package/dist/databases/migrations/common/1738709609940-CreateFolderTable.js.map +1 -0
- package/dist/databases/migrations/mysqldb/index.js +4 -0
- package/dist/databases/migrations/mysqldb/index.js.map +1 -1
- package/dist/databases/migrations/postgresdb/index.js +4 -0
- package/dist/databases/migrations/postgresdb/index.js.map +1 -1
- package/dist/databases/migrations/sqlite/1738709609940-CreateFolderTable.d.ts +4 -0
- package/dist/databases/migrations/sqlite/1738709609940-CreateFolderTable.js +12 -0
- package/dist/databases/migrations/sqlite/1738709609940-CreateFolderTable.js.map +1 -0
- package/dist/databases/migrations/sqlite/index.js +4 -0
- package/dist/databases/migrations/sqlite/index.js.map +1 -1
- package/dist/databases/repositories/folder.repository.d.ts +5 -0
- package/dist/databases/repositories/folder.repository.js +26 -0
- package/dist/databases/repositories/folder.repository.js.map +1 -0
- package/dist/databases/repositories/shared-workflow.repository.d.ts +1 -0
- package/dist/databases/repositories/tag.repository.d.ts +2 -2
- package/dist/databases/repositories/tag.repository.js.map +1 -1
- package/dist/databases/repositories/test-case-execution.repository.ee.d.ts +27 -4
- package/dist/databases/repositories/test-case-execution.repository.ee.js +18 -6
- package/dist/databases/repositories/test-case-execution.repository.ee.js.map +1 -1
- package/dist/databases/repositories/test-run.repository.ee.d.ts +26 -1
- package/dist/databases/repositories/test-run.repository.ee.js +30 -1
- package/dist/databases/repositories/test-run.repository.ee.js.map +1 -1
- package/dist/environments.ee/source-control/source-control-export.service.ee.js +3 -2
- package/dist/environments.ee/source-control/source-control-export.service.ee.js.map +1 -1
- package/dist/environments.ee/source-control/types/exportable-workflow.d.ts +1 -1
- package/dist/errors/workflow-missing-id.error.d.ts +2 -3
- package/dist/errors/workflow-missing-id.error.js.map +1 -1
- package/dist/evaluation.ee/test-definition.service.ee.js +1 -5
- package/dist/evaluation.ee/test-definition.service.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runner/errors.ee.d.ts +11 -0
- package/dist/evaluation.ee/test-runner/errors.ee.js +19 -0
- package/dist/evaluation.ee/test-runner/errors.ee.js.map +1 -0
- package/dist/evaluation.ee/test-runner/evaluation-metrics.ee.d.ts +7 -1
- package/dist/evaluation.ee/test-runner/evaluation-metrics.ee.js +32 -5
- package/dist/evaluation.ee/test-runner/evaluation-metrics.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.d.ts +1 -0
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js +86 -19
- package/dist/evaluation.ee/test-runner/test-runner.service.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runner/utils.ee.d.ts +4 -2
- package/dist/evaluation.ee/test-runner/utils.ee.js +22 -0
- package/dist/evaluation.ee/test-runner/utils.ee.js.map +1 -1
- package/dist/evaluation.ee/test-runs.controller.ee.d.ts +18 -2
- package/dist/evaluation.ee/test-runs.controller.ee.js +2 -1
- package/dist/evaluation.ee/test-runs.controller.ee.js.map +1 -1
- package/dist/events/maps/pub-sub.event-map.d.ts +2 -2
- package/dist/execution-lifecycle/execution-lifecycle-hooks.d.ts +5 -5
- package/dist/execution-lifecycle/execution-lifecycle-hooks.js +258 -313
- package/dist/execution-lifecycle/execution-lifecycle-hooks.js.map +1 -1
- package/dist/executions/execution-recovery.service.js +2 -2
- package/dist/executions/execution-recovery.service.js.map +1 -1
- package/dist/executions/execution.service.d.ts +3 -3
- package/dist/executions/execution.service.js.map +1 -1
- package/dist/interfaces.d.ts +1 -0
- package/dist/interfaces.js.map +1 -1
- package/dist/manual-execution.service.js +3 -0
- package/dist/manual-execution.service.js.map +1 -1
- package/dist/node-types.d.ts +4 -2
- package/dist/node-types.js +14 -4
- package/dist/node-types.js.map +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js +2 -2
- package/dist/public-api/v1/handlers/workflows/workflows.handler.js.map +1 -1
- package/dist/public-api/v1/handlers/workflows/workflows.service.d.ts +3 -2
- package/dist/public-api/v1/handlers/workflows/workflows.service.js +4 -4
- package/dist/public-api/v1/handlers/workflows/workflows.service.js.map +1 -1
- package/dist/push/websocket.push.d.ts +1 -0
- package/dist/push/websocket.push.js +11 -2
- package/dist/push/websocket.push.js.map +1 -1
- package/dist/scaling/job-processor.js +12 -13
- package/dist/scaling/job-processor.js.map +1 -1
- package/dist/security-audit/risk-reporters/credentials-risk-reporter.d.ts +2 -2
- package/dist/security-audit/risk-reporters/credentials-risk-reporter.js.map +1 -1
- package/dist/security-audit/risk-reporters/database-risk-reporter.d.ts +2 -2
- package/dist/security-audit/risk-reporters/database-risk-reporter.js.map +1 -1
- package/dist/security-audit/risk-reporters/filesystem-risk-reporter.d.ts +2 -2
- package/dist/security-audit/risk-reporters/filesystem-risk-reporter.js.map +1 -1
- package/dist/security-audit/risk-reporters/instance-risk-reporter.d.ts +2 -2
- package/dist/security-audit/risk-reporters/instance-risk-reporter.js.map +1 -1
- package/dist/security-audit/risk-reporters/nodes-risk-reporter.d.ts +2 -2
- package/dist/security-audit/risk-reporters/nodes-risk-reporter.js.map +1 -1
- package/dist/security-audit/types.d.ts +5 -5
- package/dist/security-audit/utils.d.ts +4 -4
- package/dist/security-audit/utils.js.map +1 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/services/import.service.d.ts +4 -3
- package/dist/services/import.service.js.map +1 -1
- package/dist/services/redis-client.service.js +3 -1
- package/dist/services/redis-client.service.js.map +1 -1
- package/dist/user-management/email/user-management-mailer.d.ts +2 -2
- package/dist/user-management/email/user-management-mailer.js.map +1 -1
- package/dist/webhooks/test-webhook-registrations.service.d.ts +2 -3
- package/dist/webhooks/test-webhook-registrations.service.js.map +1 -1
- package/dist/webhooks/test-webhooks.d.ts +3 -4
- package/dist/webhooks/test-webhooks.js.map +1 -1
- package/dist/webhooks/waiting-webhooks.js +2 -0
- package/dist/webhooks/waiting-webhooks.js.map +1 -1
- package/dist/webhooks/webhook-helpers.d.ts +2 -3
- package/dist/webhooks/webhook-helpers.js +1 -0
- package/dist/webhooks/webhook-helpers.js.map +1 -1
- package/dist/workflow-execute-additional-data.js +5 -1
- package/dist/workflow-execute-additional-data.js.map +1 -1
- package/dist/workflow-helpers.d.ts +3 -4
- package/dist/workflow-helpers.js.map +1 -1
- package/dist/workflow-runner.d.ts +3 -2
- package/dist/workflow-runner.js +19 -25
- package/dist/workflow-runner.js.map +1 -1
- package/dist/workflows/workflow-execution.service.d.ts +4 -4
- package/dist/workflows/workflow-execution.service.js +4 -1
- package/dist/workflows/workflow-execution.service.js.map +1 -1
- package/dist/workflows/workflow-history.ee/workflow-history.service.ee.d.ts +2 -2
- package/dist/workflows/workflow-history.ee/workflow-history.service.ee.js.map +1 -1
- package/dist/workflows/workflow.formatter.d.ts +2 -0
- package/dist/workflows/workflow.formatter.js +7 -0
- package/dist/workflows/workflow.formatter.js.map +1 -0
- package/dist/workflows/workflow.request.d.ts +2 -3
- package/dist/workflows/workflow.service.ee.d.ts +7 -7
- package/dist/workflows/workflow.service.ee.js +2 -2
- package/dist/workflows/workflow.service.ee.js.map +1 -1
- package/dist/workflows/workflows.controller.d.ts +4 -2
- package/dist/workflows/workflows.controller.js +1 -1
- package/dist/workflows/workflows.controller.js.map +1 -1
- package/package.json +11 -12
- package/dist/controllers/curl.controller.d.ts +0 -9
- package/dist/controllers/curl.controller.js +0 -41
- package/dist/controllers/curl.controller.js.map +0 -1
- package/dist/services/curl.service.d.ts +0 -51
- package/dist/services/curl.service.js +0 -334
- package/dist/services/curl.service.js.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
3
|
+
exports.getLifecycleHooksForSubExecutions = getLifecycleHooksForSubExecutions;
|
|
4
|
+
exports.getLifecycleHooksForScalingWorker = getLifecycleHooksForScalingWorker;
|
|
5
|
+
exports.getLifecycleHooksForScalingMain = getLifecycleHooksForScalingMain;
|
|
6
|
+
exports.getLifecycleHooksForRegularMain = getLifecycleHooksForRegularMain;
|
|
7
7
|
const di_1 = require("@n8n/di");
|
|
8
8
|
const flatted_1 = require("flatted");
|
|
9
9
|
const n8n_core_1 = require("n8n-core");
|
|
10
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
11
10
|
const execution_repository_1 = require("../databases/repositories/execution.repository");
|
|
12
11
|
const event_service_1 = require("../events/event.service");
|
|
13
12
|
const external_hooks_1 = require("../external-hooks");
|
|
@@ -20,359 +19,305 @@ const restore_binary_data_id_1 = require("./restore-binary-data-id");
|
|
|
20
19
|
const save_execution_progress_1 = require("./save-execution-progress");
|
|
21
20
|
const shared_hook_functions_1 = require("./shared/shared-hook-functions");
|
|
22
21
|
const to_save_settings_1 = require("./to-save-settings");
|
|
23
|
-
function
|
|
24
|
-
const result = {
|
|
25
|
-
nodeExecuteBefore: [],
|
|
26
|
-
nodeExecuteAfter: [],
|
|
27
|
-
workflowExecuteBefore: [],
|
|
28
|
-
workflowExecuteAfter: [],
|
|
29
|
-
sendResponse: [],
|
|
30
|
-
nodeFetchedData: [],
|
|
31
|
-
};
|
|
32
|
-
for (const hooks of hookFunctions) {
|
|
33
|
-
for (const key in hooks) {
|
|
34
|
-
if (!result[key] || !hooks[key])
|
|
35
|
-
continue;
|
|
36
|
-
result[key].push(...hooks[key]);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
function hookFunctionsWorkflowEvents(userId) {
|
|
22
|
+
function hookFunctionsWorkflowEvents(hooks, userId) {
|
|
42
23
|
const eventService = di_1.Container.get(event_service_1.EventService);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
const { executionId, workflowData: workflow } = this;
|
|
55
|
-
eventService.emit('workflow-post-execute', { executionId, runData, workflow, userId });
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
|
24
|
+
hooks.addHandler('workflowExecuteBefore', function () {
|
|
25
|
+
const { executionId, workflowData } = this;
|
|
26
|
+
eventService.emit('workflow-pre-execute', { executionId, data: workflowData });
|
|
27
|
+
});
|
|
28
|
+
hooks.addHandler('workflowExecuteAfter', function (runData) {
|
|
29
|
+
if (runData.status === 'waiting')
|
|
30
|
+
return;
|
|
31
|
+
const { executionId, workflowData: workflow } = this;
|
|
32
|
+
eventService.emit('workflow-post-execute', { executionId, runData, workflow, userId });
|
|
33
|
+
});
|
|
59
34
|
}
|
|
60
|
-
function hookFunctionsNodeEvents() {
|
|
35
|
+
function hookFunctionsNodeEvents(hooks) {
|
|
61
36
|
const eventService = di_1.Container.get(event_service_1.EventService);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
async function (nodeName) {
|
|
71
|
-
const { executionId, workflowData: workflow } = this;
|
|
72
|
-
eventService.emit('node-post-execute', { executionId, workflow, nodeName });
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
};
|
|
37
|
+
hooks.addHandler('nodeExecuteBefore', function (nodeName) {
|
|
38
|
+
const { executionId, workflowData: workflow } = this;
|
|
39
|
+
eventService.emit('node-pre-execute', { executionId, workflow, nodeName });
|
|
40
|
+
});
|
|
41
|
+
hooks.addHandler('nodeExecuteAfter', function (nodeName) {
|
|
42
|
+
const { executionId, workflowData: workflow } = this;
|
|
43
|
+
eventService.emit('node-post-execute', { executionId, workflow, nodeName });
|
|
44
|
+
});
|
|
76
45
|
}
|
|
77
|
-
function hookFunctionsPush({ pushRef, retryOf }) {
|
|
46
|
+
function hookFunctionsPush(hooks, { pushRef, retryOf }) {
|
|
78
47
|
if (!pushRef)
|
|
79
|
-
return
|
|
48
|
+
return;
|
|
80
49
|
const logger = di_1.Container.get(n8n_core_1.Logger);
|
|
81
50
|
const pushInstance = di_1.Container.get(push_1.Push);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
retryOf,
|
|
121
|
-
workflowId,
|
|
122
|
-
workflowName,
|
|
123
|
-
flattedRunData: data?.resultData.runData
|
|
124
|
-
? (0, flatted_1.stringify)(data.resultData.runData)
|
|
125
|
-
: (0, flatted_1.stringify)({}),
|
|
126
|
-
},
|
|
127
|
-
}, pushRef);
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
workflowExecuteAfter: [
|
|
131
|
-
async function (fullRunData) {
|
|
132
|
-
const { executionId } = this;
|
|
133
|
-
const { id: workflowId } = this.workflowData;
|
|
134
|
-
logger.debug('Executing hook (hookFunctionsPush)', {
|
|
135
|
-
executionId,
|
|
136
|
-
pushRef,
|
|
137
|
-
workflowId,
|
|
138
|
-
});
|
|
139
|
-
const { status } = fullRunData;
|
|
140
|
-
if (status === 'waiting') {
|
|
141
|
-
pushInstance.send({ type: 'executionWaiting', data: { executionId } }, pushRef);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
const rawData = (0, flatted_1.stringify)(fullRunData.data);
|
|
145
|
-
pushInstance.send({ type: 'executionFinished', data: { executionId, workflowId, status, rawData } }, pushRef);
|
|
146
|
-
}
|
|
51
|
+
hooks.addHandler('nodeExecuteBefore', function (nodeName) {
|
|
52
|
+
const { executionId } = this;
|
|
53
|
+
logger.debug(`Executing hook on node "${nodeName}" (hookFunctionsPush)`, {
|
|
54
|
+
executionId,
|
|
55
|
+
pushRef,
|
|
56
|
+
workflowId: this.workflowData.id,
|
|
57
|
+
});
|
|
58
|
+
pushInstance.send({ type: 'nodeExecuteBefore', data: { executionId, nodeName } }, pushRef);
|
|
59
|
+
});
|
|
60
|
+
hooks.addHandler('nodeExecuteAfter', function (nodeName, data) {
|
|
61
|
+
const { executionId } = this;
|
|
62
|
+
logger.debug(`Executing hook on node "${nodeName}" (hookFunctionsPush)`, {
|
|
63
|
+
executionId,
|
|
64
|
+
pushRef,
|
|
65
|
+
workflowId: this.workflowData.id,
|
|
66
|
+
});
|
|
67
|
+
pushInstance.send({ type: 'nodeExecuteAfter', data: { executionId, nodeName, data } }, pushRef);
|
|
68
|
+
});
|
|
69
|
+
hooks.addHandler('workflowExecuteBefore', function (_workflow, data) {
|
|
70
|
+
const { executionId } = this;
|
|
71
|
+
const { id: workflowId, name: workflowName } = this.workflowData;
|
|
72
|
+
logger.debug('Executing hook (hookFunctionsPush)', {
|
|
73
|
+
executionId,
|
|
74
|
+
pushRef,
|
|
75
|
+
workflowId,
|
|
76
|
+
});
|
|
77
|
+
pushInstance.send({
|
|
78
|
+
type: 'executionStarted',
|
|
79
|
+
data: {
|
|
80
|
+
executionId,
|
|
81
|
+
mode: this.mode,
|
|
82
|
+
startedAt: new Date(),
|
|
83
|
+
retryOf,
|
|
84
|
+
workflowId,
|
|
85
|
+
workflowName,
|
|
86
|
+
flattedRunData: data?.resultData.runData
|
|
87
|
+
? (0, flatted_1.stringify)(data.resultData.runData)
|
|
88
|
+
: (0, flatted_1.stringify)({}),
|
|
147
89
|
},
|
|
148
|
-
|
|
149
|
-
};
|
|
90
|
+
}, pushRef);
|
|
91
|
+
});
|
|
92
|
+
hooks.addHandler('workflowExecuteAfter', function (fullRunData) {
|
|
93
|
+
const { executionId } = this;
|
|
94
|
+
const { id: workflowId } = this.workflowData;
|
|
95
|
+
logger.debug('Executing hook (hookFunctionsPush)', {
|
|
96
|
+
executionId,
|
|
97
|
+
pushRef,
|
|
98
|
+
workflowId,
|
|
99
|
+
});
|
|
100
|
+
const { status } = fullRunData;
|
|
101
|
+
if (status === 'waiting') {
|
|
102
|
+
pushInstance.send({ type: 'executionWaiting', data: { executionId } }, pushRef);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
const rawData = (0, flatted_1.stringify)(fullRunData.data);
|
|
106
|
+
pushInstance.send({ type: 'executionFinished', data: { executionId, workflowId, status, rawData } }, pushRef);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
150
109
|
}
|
|
151
|
-
function hookFunctionsExternalHooks() {
|
|
110
|
+
function hookFunctionsExternalHooks(hooks) {
|
|
152
111
|
const externalHooks = di_1.Container.get(external_hooks_1.ExternalHooks);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.workflowData,
|
|
164
|
-
this.executionId,
|
|
165
|
-
]);
|
|
166
|
-
},
|
|
167
|
-
],
|
|
168
|
-
};
|
|
112
|
+
hooks.addHandler('workflowExecuteBefore', async function (workflow) {
|
|
113
|
+
await externalHooks.run('workflow.preExecute', [workflow, this.mode]);
|
|
114
|
+
});
|
|
115
|
+
hooks.addHandler('workflowExecuteAfter', async function (fullRunData) {
|
|
116
|
+
await externalHooks.run('workflow.postExecute', [
|
|
117
|
+
fullRunData,
|
|
118
|
+
this.workflowData,
|
|
119
|
+
this.executionId,
|
|
120
|
+
]);
|
|
121
|
+
});
|
|
169
122
|
}
|
|
170
|
-
function hookFunctionsSaveProgress({ saveSettings }) {
|
|
123
|
+
function hookFunctionsSaveProgress(hooks, { saveSettings }) {
|
|
171
124
|
if (!saveSettings.progress)
|
|
172
|
-
return
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
await (0, save_execution_progress_1.saveExecutionProgress)(this.workflowData.id, this.executionId, nodeName, data, executionData);
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
};
|
|
125
|
+
return;
|
|
126
|
+
hooks.addHandler('nodeExecuteAfter', async function (nodeName, data, executionData) {
|
|
127
|
+
await (0, save_execution_progress_1.saveExecutionProgress)(this.workflowData.id, this.executionId, nodeName, data, executionData);
|
|
128
|
+
});
|
|
180
129
|
}
|
|
181
|
-
function hookFunctionsFinalizeExecutionStatus() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
fullRunData.status = (0, shared_hook_functions_1.determineFinalExecutionStatus)(fullRunData);
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
};
|
|
130
|
+
function hookFunctionsFinalizeExecutionStatus(hooks) {
|
|
131
|
+
hooks.addHandler('workflowExecuteAfter', (fullRunData) => {
|
|
132
|
+
fullRunData.status = (0, shared_hook_functions_1.determineFinalExecutionStatus)(fullRunData);
|
|
133
|
+
});
|
|
189
134
|
}
|
|
190
|
-
function hookFunctionsStatistics() {
|
|
135
|
+
function hookFunctionsStatistics(hooks) {
|
|
191
136
|
const workflowStatisticsService = di_1.Container.get(workflow_statistics_service_1.WorkflowStatisticsService);
|
|
192
|
-
|
|
193
|
-
nodeFetchedData
|
|
194
|
-
|
|
195
|
-
workflowStatisticsService.emit('nodeFetchedData', { workflowId, node });
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
};
|
|
137
|
+
hooks.addHandler('nodeFetchedData', (workflowId, node) => {
|
|
138
|
+
workflowStatisticsService.emit('nodeFetchedData', { workflowId, node });
|
|
139
|
+
});
|
|
199
140
|
}
|
|
200
|
-
function hookFunctionsSave({ pushRef, retryOf, saveSettings
|
|
141
|
+
function hookFunctionsSave(hooks, { pushRef, retryOf, saveSettings }) {
|
|
201
142
|
const logger = di_1.Container.get(n8n_core_1.Logger);
|
|
202
143
|
const errorReporter = di_1.Container.get(n8n_core_1.ErrorReporter);
|
|
203
144
|
const executionRepository = di_1.Container.get(execution_repository_1.ExecutionRepository);
|
|
204
145
|
const workflowStaticDataService = di_1.Container.get(workflow_static_data_service_1.WorkflowStaticDataService);
|
|
205
146
|
const workflowStatisticsService = di_1.Container.get(workflow_statistics_service_1.WorkflowStatisticsService);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
147
|
+
hooks.addHandler('workflowExecuteAfter', async function (fullRunData, newStaticData) {
|
|
148
|
+
logger.debug('Executing hook (hookFunctionsSave)', {
|
|
149
|
+
executionId: this.executionId,
|
|
150
|
+
workflowId: this.workflowData.id,
|
|
151
|
+
});
|
|
152
|
+
await (0, restore_binary_data_id_1.restoreBinaryDataId)(fullRunData, this.executionId, this.mode);
|
|
153
|
+
const isManualMode = this.mode === 'manual';
|
|
154
|
+
try {
|
|
155
|
+
if (!isManualMode && (0, utils_1.isWorkflowIdValid)(this.workflowData.id) && newStaticData) {
|
|
215
156
|
try {
|
|
216
|
-
|
|
217
|
-
try {
|
|
218
|
-
await workflowStaticDataService.saveStaticDataById(this.workflowData.id, newStaticData);
|
|
219
|
-
}
|
|
220
|
-
catch (e) {
|
|
221
|
-
errorReporter.error(e);
|
|
222
|
-
logger.error(`There was a problem saving the workflow with id "${this.workflowData.id}" to save changed staticData: "${e.message}" (hookFunctionsSave)`, { executionId: this.executionId, workflowId: this.workflowData.id });
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (isManualMode && !saveSettings.manual && !fullRunData.waitTill) {
|
|
226
|
-
await executionRepository.softDelete(this.executionId);
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
const shouldNotSave = (fullRunData.status === 'success' && !saveSettings.success) ||
|
|
230
|
-
(fullRunData.status !== 'success' && !saveSettings.error);
|
|
231
|
-
if (shouldNotSave && !fullRunData.waitTill && !isManualMode) {
|
|
232
|
-
(0, execute_error_workflow_1.executeErrorWorkflow)(this.workflowData, fullRunData, this.mode, this.executionId, retryOf);
|
|
233
|
-
await executionRepository.hardDelete({
|
|
234
|
-
workflowId: this.workflowData.id,
|
|
235
|
-
executionId: this.executionId,
|
|
236
|
-
});
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
const fullExecutionData = (0, shared_hook_functions_1.prepareExecutionDataForDbUpdate)({
|
|
240
|
-
runData: fullRunData,
|
|
241
|
-
workflowData: this.workflowData,
|
|
242
|
-
workflowStatusFinal: fullRunData.status,
|
|
243
|
-
retryOf,
|
|
244
|
-
});
|
|
245
|
-
if (fullRunData.waitTill && isManualMode) {
|
|
246
|
-
fullExecutionData.data.pushRef = pushRef;
|
|
247
|
-
}
|
|
248
|
-
await (0, shared_hook_functions_1.updateExistingExecution)({
|
|
249
|
-
executionId: this.executionId,
|
|
250
|
-
workflowId: this.workflowData.id,
|
|
251
|
-
executionData: fullExecutionData,
|
|
252
|
-
});
|
|
253
|
-
if (!isManualMode) {
|
|
254
|
-
(0, execute_error_workflow_1.executeErrorWorkflow)(this.workflowData, fullRunData, this.mode, this.executionId, retryOf);
|
|
255
|
-
}
|
|
157
|
+
await workflowStaticDataService.saveStaticDataById(this.workflowData.id, newStaticData);
|
|
256
158
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
fullRunData,
|
|
261
|
-
});
|
|
159
|
+
catch (e) {
|
|
160
|
+
errorReporter.error(e);
|
|
161
|
+
logger.error(`There was a problem saving the workflow with id "${this.workflowData.id}" to save changed staticData: "${e.message}" (hookFunctionsSave)`, { executionId: this.executionId, workflowId: this.workflowData.id });
|
|
262
162
|
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
163
|
+
}
|
|
164
|
+
if (isManualMode && !saveSettings.manual && !fullRunData.waitTill) {
|
|
165
|
+
await executionRepository.softDelete(this.executionId);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const shouldNotSave = (fullRunData.status === 'success' && !saveSettings.success) ||
|
|
169
|
+
(fullRunData.status !== 'success' && !saveSettings.error);
|
|
170
|
+
if (shouldNotSave && !fullRunData.waitTill && !isManualMode) {
|
|
171
|
+
(0, execute_error_workflow_1.executeErrorWorkflow)(this.workflowData, fullRunData, this.mode, this.executionId, retryOf);
|
|
172
|
+
await executionRepository.hardDelete({
|
|
173
|
+
workflowId: this.workflowData.id,
|
|
174
|
+
executionId: this.executionId,
|
|
175
|
+
});
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const fullExecutionData = (0, shared_hook_functions_1.prepareExecutionDataForDbUpdate)({
|
|
179
|
+
runData: fullRunData,
|
|
180
|
+
workflowData: this.workflowData,
|
|
181
|
+
workflowStatusFinal: fullRunData.status,
|
|
182
|
+
retryOf,
|
|
183
|
+
});
|
|
184
|
+
if (fullRunData.waitTill && isManualMode) {
|
|
185
|
+
fullExecutionData.data.pushRef = pushRef;
|
|
186
|
+
}
|
|
187
|
+
await (0, shared_hook_functions_1.updateExistingExecution)({
|
|
188
|
+
executionId: this.executionId,
|
|
189
|
+
workflowId: this.workflowData.id,
|
|
190
|
+
executionData: fullExecutionData,
|
|
191
|
+
});
|
|
192
|
+
if (!isManualMode) {
|
|
193
|
+
(0, execute_error_workflow_1.executeErrorWorkflow)(this.workflowData, fullRunData, this.mode, this.executionId, retryOf);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
workflowStatisticsService.emit('workflowExecutionCompleted', {
|
|
198
|
+
workflowData: this.workflowData,
|
|
199
|
+
fullRunData,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
266
203
|
}
|
|
267
|
-
function hookFunctionsSaveWorker({ pushRef, retryOf
|
|
204
|
+
function hookFunctionsSaveWorker(hooks, { pushRef, retryOf }) {
|
|
268
205
|
const logger = di_1.Container.get(n8n_core_1.Logger);
|
|
269
206
|
const errorReporter = di_1.Container.get(n8n_core_1.ErrorReporter);
|
|
270
207
|
const workflowStaticDataService = di_1.Container.get(workflow_static_data_service_1.WorkflowStaticDataService);
|
|
271
208
|
const workflowStatisticsService = di_1.Container.get(workflow_statistics_service_1.WorkflowStatisticsService);
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
209
|
+
hooks.addHandler('workflowExecuteAfter', async function (fullRunData, newStaticData) {
|
|
210
|
+
logger.debug('Executing hook (hookFunctionsSaveWorker)', {
|
|
211
|
+
executionId: this.executionId,
|
|
212
|
+
workflowId: this.workflowData.id,
|
|
213
|
+
});
|
|
214
|
+
const isManualMode = this.mode === 'manual';
|
|
215
|
+
try {
|
|
216
|
+
if (!isManualMode && (0, utils_1.isWorkflowIdValid)(this.workflowData.id) && newStaticData) {
|
|
280
217
|
try {
|
|
281
|
-
|
|
282
|
-
try {
|
|
283
|
-
await workflowStaticDataService.saveStaticDataById(this.workflowData.id, newStaticData);
|
|
284
|
-
}
|
|
285
|
-
catch (e) {
|
|
286
|
-
errorReporter.error(e);
|
|
287
|
-
logger.error(`There was a problem saving the workflow with id "${this.workflowData.id}" to save changed staticData: "${e.message}" (workflowExecuteAfter)`, { workflowId: this.workflowData.id });
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (!isManualMode &&
|
|
291
|
-
fullRunData.status !== 'success' &&
|
|
292
|
-
fullRunData.status !== 'waiting') {
|
|
293
|
-
(0, execute_error_workflow_1.executeErrorWorkflow)(this.workflowData, fullRunData, this.mode, this.executionId, retryOf);
|
|
294
|
-
}
|
|
295
|
-
const fullExecutionData = (0, shared_hook_functions_1.prepareExecutionDataForDbUpdate)({
|
|
296
|
-
runData: fullRunData,
|
|
297
|
-
workflowData: this.workflowData,
|
|
298
|
-
workflowStatusFinal: fullRunData.status,
|
|
299
|
-
retryOf,
|
|
300
|
-
});
|
|
301
|
-
if (fullRunData.waitTill && isManualMode) {
|
|
302
|
-
fullExecutionData.data.pushRef = pushRef;
|
|
303
|
-
}
|
|
304
|
-
await (0, shared_hook_functions_1.updateExistingExecution)({
|
|
305
|
-
executionId: this.executionId,
|
|
306
|
-
workflowId: this.workflowData.id,
|
|
307
|
-
executionData: fullExecutionData,
|
|
308
|
-
});
|
|
218
|
+
await workflowStaticDataService.saveStaticDataById(this.workflowData.id, newStaticData);
|
|
309
219
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
fullRunData,
|
|
314
|
-
});
|
|
220
|
+
catch (e) {
|
|
221
|
+
errorReporter.error(e);
|
|
222
|
+
logger.error(`There was a problem saving the workflow with id "${this.workflowData.id}" to save changed staticData: "${e.message}" (workflowExecuteAfter)`, { workflowId: this.workflowData.id });
|
|
315
223
|
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
224
|
+
}
|
|
225
|
+
if (!isManualMode && fullRunData.status !== 'success' && fullRunData.status !== 'waiting') {
|
|
226
|
+
(0, execute_error_workflow_1.executeErrorWorkflow)(this.workflowData, fullRunData, this.mode, this.executionId, retryOf);
|
|
227
|
+
}
|
|
228
|
+
const fullExecutionData = (0, shared_hook_functions_1.prepareExecutionDataForDbUpdate)({
|
|
229
|
+
runData: fullRunData,
|
|
230
|
+
workflowData: this.workflowData,
|
|
231
|
+
workflowStatusFinal: fullRunData.status,
|
|
232
|
+
retryOf,
|
|
233
|
+
});
|
|
234
|
+
if (fullRunData.waitTill && isManualMode) {
|
|
235
|
+
fullExecutionData.data.pushRef = pushRef;
|
|
236
|
+
}
|
|
237
|
+
await (0, shared_hook_functions_1.updateExistingExecution)({
|
|
238
|
+
executionId: this.executionId,
|
|
239
|
+
workflowId: this.workflowData.id,
|
|
240
|
+
executionData: fullExecutionData,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
workflowStatisticsService.emit('workflowExecutionCompleted', {
|
|
245
|
+
workflowData: this.workflowData,
|
|
246
|
+
fullRunData,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
});
|
|
319
250
|
}
|
|
320
|
-
function
|
|
251
|
+
function getLifecycleHooksForSubExecutions(mode, executionId, workflowData, userId) {
|
|
252
|
+
const hooks = new n8n_core_1.ExecutionLifecycleHooks(mode, executionId, workflowData);
|
|
321
253
|
const saveSettings = (0, to_save_settings_1.toSaveSettings)(workflowData.settings);
|
|
322
|
-
|
|
323
|
-
|
|
254
|
+
hookFunctionsWorkflowEvents(hooks, userId);
|
|
255
|
+
hookFunctionsNodeEvents(hooks);
|
|
256
|
+
hookFunctionsFinalizeExecutionStatus(hooks);
|
|
257
|
+
hookFunctionsSave(hooks, { saveSettings });
|
|
258
|
+
hookFunctionsSaveProgress(hooks, { saveSettings });
|
|
259
|
+
hookFunctionsStatistics(hooks);
|
|
260
|
+
hookFunctionsExternalHooks(hooks);
|
|
261
|
+
return hooks;
|
|
324
262
|
}
|
|
325
|
-
function
|
|
263
|
+
function getLifecycleHooksForScalingWorker(mode, executionId, workflowData, { pushRef, retryOf } = {}) {
|
|
264
|
+
const hooks = new n8n_core_1.ExecutionLifecycleHooks(mode, executionId, workflowData);
|
|
326
265
|
const saveSettings = (0, to_save_settings_1.toSaveSettings)(workflowData.settings);
|
|
327
266
|
const optionalParameters = { pushRef, retryOf, saveSettings };
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
hookFunctionsExternalHooks(),
|
|
335
|
-
];
|
|
267
|
+
hookFunctionsNodeEvents(hooks);
|
|
268
|
+
hookFunctionsFinalizeExecutionStatus(hooks);
|
|
269
|
+
hookFunctionsSaveWorker(hooks, optionalParameters);
|
|
270
|
+
hookFunctionsSaveProgress(hooks, optionalParameters);
|
|
271
|
+
hookFunctionsStatistics(hooks);
|
|
272
|
+
hookFunctionsExternalHooks(hooks);
|
|
336
273
|
if (mode === 'manual' && di_1.Container.get(n8n_core_1.InstanceSettings).isWorker) {
|
|
337
|
-
|
|
274
|
+
hookFunctionsPush(hooks, optionalParameters);
|
|
338
275
|
}
|
|
339
|
-
|
|
340
|
-
return new n8n_workflow_1.WorkflowHooks(hookFunctions, mode, executionId, workflowData);
|
|
276
|
+
return hooks;
|
|
341
277
|
}
|
|
342
|
-
function
|
|
278
|
+
function getLifecycleHooksForScalingMain(mode, executionId, workflowData, { pushRef, retryOf } = {}) {
|
|
279
|
+
const hooks = new n8n_core_1.ExecutionLifecycleHooks(mode, executionId, workflowData);
|
|
343
280
|
const saveSettings = (0, to_save_settings_1.toSaveSettings)(workflowData.settings);
|
|
344
281
|
const optionalParameters = { pushRef, retryOf, saveSettings };
|
|
345
282
|
const executionRepository = di_1.Container.get(execution_repository_1.ExecutionRepository);
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
|
|
283
|
+
hookFunctionsWorkflowEvents(hooks);
|
|
284
|
+
hookFunctionsSaveProgress(hooks, optionalParameters);
|
|
285
|
+
hookFunctionsExternalHooks(hooks);
|
|
286
|
+
hookFunctionsFinalizeExecutionStatus(hooks);
|
|
287
|
+
hooks.addHandler('workflowExecuteAfter', async function (fullRunData) {
|
|
288
|
+
if (!fullRunData.finished)
|
|
289
|
+
return;
|
|
290
|
+
const isManualMode = this.mode === 'manual';
|
|
291
|
+
if (isManualMode && !saveSettings.manual && !fullRunData.waitTill) {
|
|
292
|
+
await executionRepository.softDelete(this.executionId);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const shouldNotSave = (fullRunData.status === 'success' && !saveSettings.success) ||
|
|
296
|
+
(fullRunData.status !== 'success' && !saveSettings.error);
|
|
297
|
+
if (!isManualMode && shouldNotSave && !fullRunData.waitTill) {
|
|
298
|
+
await executionRepository.hardDelete({
|
|
299
|
+
workflowId: this.workflowData.id,
|
|
300
|
+
executionId: this.executionId,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
366
303
|
});
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return
|
|
304
|
+
hooks.handlers.nodeExecuteBefore = [];
|
|
305
|
+
hooks.handlers.nodeExecuteAfter = [];
|
|
306
|
+
return hooks;
|
|
370
307
|
}
|
|
371
|
-
function
|
|
372
|
-
const { pushRef, retryOf } = data;
|
|
373
|
-
const
|
|
308
|
+
function getLifecycleHooksForRegularMain(data, executionId) {
|
|
309
|
+
const { pushRef, retryOf, executionMode, workflowData } = data;
|
|
310
|
+
const hooks = new n8n_core_1.ExecutionLifecycleHooks(executionMode, executionId, workflowData);
|
|
311
|
+
const saveSettings = (0, to_save_settings_1.toSaveSettings)(workflowData.settings);
|
|
374
312
|
const optionalParameters = { pushRef, retryOf: retryOf ?? undefined, saveSettings };
|
|
375
|
-
|
|
376
|
-
|
|
313
|
+
hookFunctionsWorkflowEvents(hooks);
|
|
314
|
+
hookFunctionsNodeEvents(hooks);
|
|
315
|
+
hookFunctionsFinalizeExecutionStatus(hooks);
|
|
316
|
+
hookFunctionsSave(hooks, optionalParameters);
|
|
317
|
+
hookFunctionsPush(hooks, optionalParameters);
|
|
318
|
+
hookFunctionsSaveProgress(hooks, optionalParameters);
|
|
319
|
+
hookFunctionsStatistics(hooks);
|
|
320
|
+
hookFunctionsExternalHooks(hooks);
|
|
321
|
+
return hooks;
|
|
377
322
|
}
|
|
378
323
|
//# sourceMappingURL=execution-lifecycle-hooks.js.map
|