@n8n/engine 0.16.1 → 0.17.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/auth/authenticate.d.ts +3 -0
- package/dist/auth/authenticate.js +29 -0
- package/dist/auth/authenticate.js.map +1 -0
- package/dist/auth/identity-token.d.ts +14 -0
- package/dist/auth/identity-token.js +66 -0
- package/dist/auth/identity-token.js.map +1 -0
- package/dist/auth/identity.types.d.ts +7 -0
- package/dist/auth/identity.types.js +3 -0
- package/dist/auth/identity.types.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +15 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -1
- package/dist/database/create-stores.d.ts +3 -2
- package/dist/database/create-stores.js.map +1 -1
- package/dist/database/entities/workflow-execution.entity.d.ts +2 -3
- package/dist/database/entities/workflow-execution.entity.js +3 -3
- package/dist/database/entities/workflow-execution.entity.js.map +1 -1
- package/dist/database/entities/workflow-step-execution.entity.d.ts +1 -0
- package/dist/database/entities/workflow-step-execution.entity.js +7 -3
- package/dist/database/entities/workflow-step-execution.entity.js.map +1 -1
- package/dist/database/index.d.ts +1 -0
- package/dist/database/index.js.map +1 -1
- package/dist/database/migrations/1778529600000-CreateWorkflowExecution.js +1 -1
- package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js +13 -2
- package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js.map +1 -1
- package/dist/database/typeorm-execution-store.js +1 -1
- package/dist/database/typeorm-execution-store.js.map +1 -1
- package/dist/database/typeorm-step-store.d.ts +5 -5
- package/dist/database/typeorm-step-store.js +57 -13
- package/dist/database/typeorm-step-store.js.map +1 -1
- package/dist/execution/completion.d.ts +2 -0
- package/dist/execution/completion.js +21 -0
- package/dist/execution/completion.js.map +1 -0
- package/dist/execution/execution-start-handler.js +3 -1
- package/dist/execution/execution-start-handler.js.map +1 -1
- package/dist/execution/execution-store.d.ts +3 -4
- package/dist/execution/execution-store.js.map +1 -1
- package/dist/execution/execution.types.d.ts +8 -0
- package/dist/execution/execution.types.js +6 -1
- package/dist/execution/execution.types.js.map +1 -1
- package/dist/execution/index.d.ts +3 -2
- package/dist/execution/index.js +3 -1
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/iteration-mapping.d.ts +14 -0
- package/dist/execution/iteration-mapping.js +48 -0
- package/dist/execution/iteration-mapping.js.map +1 -0
- package/dist/execution/loop-ledger.d.ts +7 -0
- package/dist/execution/loop-ledger.js +38 -0
- package/dist/execution/loop-ledger.js.map +1 -0
- package/dist/execution/settlement.d.ts +6 -4
- package/dist/execution/settlement.js +73 -17
- package/dist/execution/settlement.js.map +1 -1
- package/dist/execution/start-execution.service.d.ts +2 -3
- package/dist/execution/start-execution.service.js +1 -1
- package/dist/execution/start-execution.service.js.map +1 -1
- package/dist/execution/step-ready-handler.d.ts +7 -1
- package/dist/execution/step-ready-handler.js +29 -10
- package/dist/execution/step-ready-handler.js.map +1 -1
- package/dist/execution/step-settled-handler.d.ts +1 -2
- package/dist/execution/step-settled-handler.js +27 -23
- package/dist/execution/step-settled-handler.js.map +1 -1
- package/dist/execution/step-store.d.ts +8 -5
- package/dist/execution/step-store.js.map +1 -1
- package/dist/graph/graph-validation.error.d.ts +3 -0
- package/dist/graph/graph-validation.error.js +11 -0
- package/dist/graph/graph-validation.error.js.map +1 -0
- package/dist/graph/index.d.ts +4 -1
- package/dist/graph/index.js +7 -2
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/loops.d.ts +10 -0
- package/dist/graph/loops.js +161 -0
- package/dist/graph/loops.js.map +1 -0
- package/dist/graph/validate-executable-graph.d.ts +1 -3
- package/dist/graph/validate-executable-graph.js +9 -15
- package/dist/graph/validate-executable-graph.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/dist/runtime/create-engine-runtime.d.ts +18 -0
- package/dist/runtime/create-engine-runtime.js +26 -0
- package/dist/runtime/create-engine-runtime.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/serve.js +18 -30
- package/dist/serve.js.map +1 -1
- package/dist/server/create-engine-server.d.ts +3 -9
- package/dist/server/create-engine-server.js +5 -9
- package/dist/server/create-engine-server.js.map +1 -1
- package/dist/server/error-response.d.ts +7 -0
- package/dist/server/error-response.js +12 -0
- package/dist/server/error-response.js.map +1 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +3 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/routes/workflow-executions.js +7 -9
- package/dist/server/routes/workflow-executions.js.map +1 -1
- package/dist/testing/start-engine-server.d.ts +3 -2
- package/dist/testing/start-engine-server.js +2 -2
- package/dist/testing/start-engine-server.js.map +1 -1
- package/package.json +5 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DataSource } from '@n8n/typeorm';
|
|
2
2
|
import type { ExecutionStore } from '../execution/execution-store';
|
|
3
3
|
import type { StepStore } from '../execution/step-store';
|
|
4
|
-
export
|
|
4
|
+
export interface EngineStores {
|
|
5
5
|
executionStore: ExecutionStore;
|
|
6
6
|
stepStore: StepStore;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
|
+
export declare function createStores(dataSource: DataSource): EngineStores;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-stores.js","sourceRoot":"","sources":["../../src/database/create-stores.ts"],"names":[],"mappings":";;;AAEA,yCAAsE;AACtE,uEAAkE;AAClE,6DAAwD;
|
|
1
|
+
{"version":3,"file":"create-stores.js","sourceRoot":"","sources":["../../src/database/create-stores.ts"],"names":[],"mappings":";;;AAEA,yCAAsE;AACtE,uEAAkE;AAClE,6DAAwD;AAUxD,sBAA6B,UAAsB;IAClD,OAAO;QACN,cAAc,EAAE,IAAI,+CAAqB,CAAC,UAAU,CAAC,aAAa,CAAC,4BAAiB,CAAC,CAAC;QACtF,SAAS,EAAE,IAAI,qCAAgB,CAAC,UAAU,CAAC,aAAa,CAAC,gCAAqB,CAAC,CAAC;KAChF,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ExecutionMode, ExecutionStatus } from '../../execution/execution.types';
|
|
1
|
+
import type { ExecutionMode, ExecutionStatus, TriggerOutputs } from '../../execution/execution.types';
|
|
3
2
|
import type { WorkflowGraph } from '../../graph';
|
|
4
3
|
export declare class WorkflowExecution {
|
|
5
4
|
id: string;
|
|
@@ -7,7 +6,7 @@ export declare class WorkflowExecution {
|
|
|
7
6
|
status: ExecutionStatus;
|
|
8
7
|
mode: ExecutionMode;
|
|
9
8
|
graph: WorkflowGraph;
|
|
10
|
-
|
|
9
|
+
triggerOutputs: TriggerOutputs | null;
|
|
11
10
|
createdAt: Date;
|
|
12
11
|
updatedAt: Date;
|
|
13
12
|
finishedAt: Date | null;
|
|
@@ -18,7 +18,7 @@ let WorkflowExecution = class WorkflowExecution {
|
|
|
18
18
|
status;
|
|
19
19
|
mode;
|
|
20
20
|
graph;
|
|
21
|
-
|
|
21
|
+
triggerOutputs;
|
|
22
22
|
createdAt;
|
|
23
23
|
updatedAt;
|
|
24
24
|
finishedAt;
|
|
@@ -49,9 +49,9 @@ __decorate([
|
|
|
49
49
|
__metadata("design:type", Object)
|
|
50
50
|
], WorkflowExecution.prototype, "graph", void 0);
|
|
51
51
|
__decorate([
|
|
52
|
-
(0, typeorm_1.Column)('jsonb', { name: '
|
|
52
|
+
(0, typeorm_1.Column)('jsonb', { name: 'trigger_outputs', nullable: true }),
|
|
53
53
|
__metadata("design:type", Object)
|
|
54
|
-
], WorkflowExecution.prototype, "
|
|
54
|
+
], WorkflowExecution.prototype, "triggerOutputs", void 0);
|
|
55
55
|
__decorate([
|
|
56
56
|
(0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz', precision: 3 }),
|
|
57
57
|
__metadata("design:type", Date)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-execution.entity.js","sourceRoot":"","sources":["../../../src/database/entities/workflow-execution.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAQsB;
|
|
1
|
+
{"version":3,"file":"workflow-execution.entity.js","sourceRoot":"","sources":["../../../src/database/entities/workflow-execution.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAQsB;AAQtB,gDAA4C;AAKrC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE7B,EAAE,CAAU;IAGZ,UAAU,CAAU;IAGpB,MAAM,CAAmB;IAGzB,IAAI,CAAiB;IAGrB,KAAK,CAAiB;IAGtB,cAAc,CAAyB;IAGvC,SAAS,CAAQ;IAGjB,SAAS,CAAQ;IAGjB,UAAU,CAAe;IAGzB,KAAK;QACJ,IAAI,CAAC,IAAI,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,GAAG,IAAA,wBAAU,GAAE,CAAC;IACtC,CAAC;CACD,CAAA;;AA9BA;IADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;6CACV;AAGZ;IADC,IAAA,gBAAM,EAAC,SAAS,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;;qDACvB;AAGpB;IADC,IAAA,gBAAM,EAAC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;iDACT;AAGzB;IADC,IAAA,gBAAM,EAAC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;+CACb;AAGrB;IADC,IAAA,gBAAM,EAAC,OAAO,CAAC;;gDACM;AAGtB;IADC,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACtB;AAGvC;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;8BAChE,IAAI;oDAAC;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;8BAChE,IAAI;oDAAC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;;qDAC1D;AAGzB;IADC,IAAA,sBAAY,GAAE;;;;8CAGd;4BA/BW,iBAAiB;IAH7B,IAAA,gBAAM,EAAC,oBAAoB,CAAC;IAC5B,IAAA,eAAK,EAAC,oCAAoC,EAAE,CAAC,YAAY,CAAC,CAAC;IAC3D,IAAA,eAAK,EAAC,+BAA+B,EAAE,CAAC,QAAQ,CAAC,CAAC;GACtC,iBAAiB,CAgC7B"}
|
|
@@ -16,6 +16,7 @@ let WorkflowStepExecution = class WorkflowStepExecution {
|
|
|
16
16
|
id;
|
|
17
17
|
executionId;
|
|
18
18
|
nodeId;
|
|
19
|
+
iteration;
|
|
19
20
|
status;
|
|
20
21
|
outputs;
|
|
21
22
|
error;
|
|
@@ -39,6 +40,10 @@ __decorate([
|
|
|
39
40
|
(0, typeorm_1.Column)('varchar', { name: 'node_id' }),
|
|
40
41
|
__metadata("design:type", String)
|
|
41
42
|
], WorkflowStepExecution.prototype, "nodeId", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)('int', { default: 0 }),
|
|
45
|
+
__metadata("design:type", Number)
|
|
46
|
+
], WorkflowStepExecution.prototype, "iteration", void 0);
|
|
42
47
|
__decorate([
|
|
43
48
|
(0, typeorm_1.Column)('varchar', { length: 32 }),
|
|
44
49
|
__metadata("design:type", String)
|
|
@@ -67,8 +72,7 @@ __decorate([
|
|
|
67
72
|
], WorkflowStepExecution.prototype, "setId", null);
|
|
68
73
|
exports.WorkflowStepExecution = WorkflowStepExecution = __decorate([
|
|
69
74
|
(0, typeorm_1.Entity)('workflow_step_execution'),
|
|
70
|
-
(0, typeorm_1.Index)('
|
|
71
|
-
|
|
72
|
-
})
|
|
75
|
+
(0, typeorm_1.Index)('uniq_workflow_step_execution_execution_id_node_id_iteration', ['executionId', 'nodeId', 'iteration'], { unique: true }),
|
|
76
|
+
(0, typeorm_1.Index)('idx_workflow_step_execution_failed', ['executionId'], { where: "status = 'failed'" })
|
|
73
77
|
], WorkflowStepExecution);
|
|
74
78
|
//# sourceMappingURL=workflow-step-execution.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-step-execution.entity.js","sourceRoot":"","sources":["../../../src/database/entities/workflow-step-execution.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAQsB;AAItB,gDAA4C;
|
|
1
|
+
{"version":3,"file":"workflow-step-execution.entity.js","sourceRoot":"","sources":["../../../src/database/entities/workflow-step-execution.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAQsB;AAItB,gDAA4C;AASrC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAEjC,EAAE,CAAU;IAGZ,WAAW,CAAU;IAGrB,MAAM,CAAU;IAGhB,SAAS,CAAU;IAGnB,MAAM,CAAc;IAGpB,OAAO,CAAoB;IAG3B,KAAK,CAAoB;IAGzB,SAAS,CAAQ;IAGjB,SAAS,CAAQ;IAGjB,KAAK;QACJ,IAAI,CAAC,IAAI,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,GAAG,IAAA,wBAAU,GAAE,CAAC;IACtC,CAAC;CACD,CAAA;;AA9BA;IADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;iDACV;AAGZ;IADC,IAAA,gBAAM,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;;0DACpB;AAGrB;IADC,IAAA,gBAAM,EAAC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;qDACvB;AAGhB;IADC,IAAA,gBAAM,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;wDACX;AAGnB;IADC,IAAA,gBAAM,EAAC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;qDACd;AAGpB;IADC,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACT;AAG3B;IADC,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACX;AAGzB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;8BAChE,IAAI;wDAAC;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;8BAChE,IAAI;wDAAC;AAGjB;IADC,IAAA,sBAAY,GAAE;;;;kDAGd;gCA/BW,qBAAqB;IAPjC,IAAA,gBAAM,EAAC,yBAAyB,CAAC;IACjC,IAAA,eAAK,EACL,6DAA6D,EAC7D,CAAC,aAAa,EAAE,QAAQ,EAAE,WAAW,CAAC,EACtC,EAAE,MAAM,EAAE,IAAI,EAAE,CAChB;IACA,IAAA,eAAK,EAAC,oCAAoC,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;GAChF,qBAAqB,CAgCjC"}
|
package/dist/database/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createDataSource } from './data-source';
|
|
2
2
|
export { createStores } from './create-stores';
|
|
3
|
+
export type { EngineStores } from './create-stores';
|
|
3
4
|
export { WorkflowExecution, WorkflowStepExecution } from './entities';
|
|
4
5
|
export { TypeOrmExecutionStore } from './typeorm-execution-store';
|
|
5
6
|
export { TypeOrmStepStore } from './typeorm-step-store';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AACzB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AACzB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAErB,uCAAsE;AAA7D,6GAAA,iBAAiB,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AACjD,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA"}
|
|
@@ -13,7 +13,7 @@ class CreateWorkflowExecution1778529600000 {
|
|
|
13
13
|
{ name: 'status', type: 'varchar', length: '32' },
|
|
14
14
|
{ name: 'mode', type: 'varchar', length: '32' },
|
|
15
15
|
{ name: 'graph', type: 'jsonb' },
|
|
16
|
-
{ name: '
|
|
16
|
+
{ name: 'trigger_outputs', type: 'jsonb', isNullable: true },
|
|
17
17
|
{
|
|
18
18
|
name: 'created_at',
|
|
19
19
|
type: 'timestamptz',
|
|
@@ -11,6 +11,12 @@ class CreateWorkflowStepExecution1784890100000 {
|
|
|
11
11
|
{ name: 'id', type: 'uuid', isPrimary: true },
|
|
12
12
|
{ name: 'execution_id', type: 'uuid' },
|
|
13
13
|
{ name: 'node_id', type: 'varchar' },
|
|
14
|
+
{
|
|
15
|
+
name: 'iteration',
|
|
16
|
+
type: 'int',
|
|
17
|
+
default: 0,
|
|
18
|
+
comment: 'Which pass over a loop body this row belongs to. 0 for non-loops.',
|
|
19
|
+
},
|
|
14
20
|
{ name: 'status', type: 'varchar', length: '32' },
|
|
15
21
|
{
|
|
16
22
|
name: 'outputs',
|
|
@@ -39,10 +45,15 @@ class CreateWorkflowStepExecution1784890100000 {
|
|
|
39
45
|
],
|
|
40
46
|
indices: [
|
|
41
47
|
{
|
|
42
|
-
name: '
|
|
43
|
-
columnNames: ['execution_id', 'node_id'],
|
|
48
|
+
name: 'uniq_workflow_step_execution_execution_id_node_id_iteration',
|
|
49
|
+
columnNames: ['execution_id', 'node_id', 'iteration'],
|
|
44
50
|
isUnique: true,
|
|
45
51
|
},
|
|
52
|
+
{
|
|
53
|
+
name: 'idx_workflow_step_execution_failed',
|
|
54
|
+
columnNames: ['execution_id'],
|
|
55
|
+
where: "status = 'failed'",
|
|
56
|
+
},
|
|
46
57
|
],
|
|
47
58
|
foreignKeys: [
|
|
48
59
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1784890100000-CreateWorkflowStepExecution.js","sourceRoot":"","sources":["../../../src/database/migrations/1784890100000-CreateWorkflowStepExecution.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AAGrC,MAAM,KAAK,GAAG,yBAAyB,CAAC;AAExC;IACC,KAAK,CAAC,EAAE,CAAC,WAAwB;QAChC,MAAM,WAAW,CAAC,WAAW,CAC5B,IAAI,eAAK,CAAC;YACT,IAAI,EAAE,KAAK;YACX,OAAO,EAAE;gBACR,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE;gBAC7C,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE;gBACtC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;gBACpC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;gBACjD;oBACC,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,OAAO;oBACb,UAAU,EAAE,IAAI;oBAChB,OAAO,EACN,4GAA4G;iBAC7G;gBACD;oBACC,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,OAAO;oBACb,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,sDAAsD;iBAC/D;gBACD;oBACC,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,aAAa;oBACnB,SAAS,EAAE,CAAC;oBACZ,OAAO,EAAE,sBAAsB;iBAC/B;gBACD;oBACC,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,aAAa;oBACnB,SAAS,EAAE,CAAC;oBACZ,OAAO,EAAE,sBAAsB;iBAC/B;aACD;YACD,OAAO,EAAE;gBAIR;oBACC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"1784890100000-CreateWorkflowStepExecution.js","sourceRoot":"","sources":["../../../src/database/migrations/1784890100000-CreateWorkflowStepExecution.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AAGrC,MAAM,KAAK,GAAG,yBAAyB,CAAC;AAExC;IACC,KAAK,CAAC,EAAE,CAAC,WAAwB;QAChC,MAAM,WAAW,CAAC,WAAW,CAC5B,IAAI,eAAK,CAAC;YACT,IAAI,EAAE,KAAK;YACX,OAAO,EAAE;gBACR,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE;gBAC7C,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE;gBACtC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;gBACpC;oBACC,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,KAAK;oBACX,OAAO,EAAE,CAAC;oBACV,OAAO,EAAE,mEAAmE;iBAC5E;gBACD,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;gBACjD;oBACC,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,OAAO;oBACb,UAAU,EAAE,IAAI;oBAChB,OAAO,EACN,4GAA4G;iBAC7G;gBACD;oBACC,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,OAAO;oBACb,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,sDAAsD;iBAC/D;gBACD;oBACC,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,aAAa;oBACnB,SAAS,EAAE,CAAC;oBACZ,OAAO,EAAE,sBAAsB;iBAC/B;gBACD;oBACC,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,aAAa;oBACnB,SAAS,EAAE,CAAC;oBACZ,OAAO,EAAE,sBAAsB;iBAC/B;aACD;YACD,OAAO,EAAE;gBAIR;oBACC,IAAI,EAAE,6DAA6D;oBACnE,WAAW,EAAE,CAAC,cAAc,EAAE,SAAS,EAAE,WAAW,CAAC;oBACrD,QAAQ,EAAE,IAAI;iBACd;gBAGD;oBACC,IAAI,EAAE,oCAAoC;oBAC1C,WAAW,EAAE,CAAC,cAAc,CAAC;oBAC7B,KAAK,EAAE,mBAAmB;iBAC1B;aACD;YACD,WAAW,EAAE;gBACZ;oBACC,WAAW,EAAE,CAAC,cAAc,CAAC;oBAC7B,mBAAmB,EAAE,oBAAoB;oBACzC,qBAAqB,EAAE,CAAC,IAAI,CAAC;oBAC7B,QAAQ,EAAE,SAAS;iBACnB;aACD;YACD,MAAM,EAAE;gBACP;oBACC,IAAI,EAAE,oCAAoC;oBAC1C,UAAU,EACT,gFAAgF;iBACjF;aACD;SACD,CAAC,CACF,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAAwB;QAClC,MAAM,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACD"}
|
|
@@ -13,7 +13,7 @@ class TypeOrmExecutionStore {
|
|
|
13
13
|
return { id: execution.id };
|
|
14
14
|
}
|
|
15
15
|
async loadExecution(id) {
|
|
16
|
-
const row = await this.repo.
|
|
16
|
+
const row = await this.repo.findOne({ where: { id } });
|
|
17
17
|
if (!row)
|
|
18
18
|
throw new execution_store_1.ExecutionNotFoundError(id);
|
|
19
19
|
return row;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeorm-execution-store.js","sourceRoot":"","sources":["../../src/database/typeorm-execution-store.ts"],"names":[],"mappings":";;;AAGA,kEAKsC;AAUtC;IAC8B,IAAI;IAAjC,YAA6B,IAAmC;oBAAnC,IAAI;IAAkC,CAAC;IAEpE,KAAK,CAAC,eAAe,CAAC,MAA0B;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAIpE,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAyB,CAAC,CAAC;QAClD,OAAO,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;
|
|
1
|
+
{"version":3,"file":"typeorm-execution-store.js","sourceRoot":"","sources":["../../src/database/typeorm-execution-store.ts"],"names":[],"mappings":";;;AAGA,kEAKsC;AAUtC;IAC8B,IAAI;IAAjC,YAA6B,IAAmC;oBAAnC,IAAI;IAAkC,CAAC;IAEpE,KAAK,CAAC,eAAe,CAAC,MAA0B;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAIpE,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAyB,CAAC,CAAC;QAClD,OAAO,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,EAAU;QAG7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,wCAAsB,CAAC,EAAE,CAAC,CAAC;QAC/C,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,EAAU,EAAE,IAAqB,EAAE,EAAmB;QAC5E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5E,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,EAAU,EAAE,MAA8B;QAC/D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CACpC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EACzB,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE,EAAE,CAClC,CAAC;QACF,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC9B,CAAC;CACD"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { type Repository } from '@n8n/typeorm';
|
|
2
2
|
import { WorkflowStepExecution } from './entities';
|
|
3
|
-
import { type StepSlots } from '../execution/execution.types';
|
|
3
|
+
import { type StepKey, type StepKeyId, type StepSlots } from '../execution/execution.types';
|
|
4
4
|
import { type NewStepRecord, type StepError, type StepRecord, type StepStore, type StepSummary } from '../execution/step-store';
|
|
5
5
|
export declare class TypeOrmStepStore implements StepStore {
|
|
6
6
|
private readonly repo;
|
|
7
7
|
constructor(repo: Repository<WorkflowStepExecution>);
|
|
8
8
|
createSteps(executionId: string, records: NewStepRecord[]): Promise<Array<{
|
|
9
9
|
id: string;
|
|
10
|
-
|
|
11
|
-
}>>;
|
|
10
|
+
} & StepKey>>;
|
|
12
11
|
loadStep(id: string): Promise<StepRecord>;
|
|
13
12
|
claimStep(id: string): Promise<StepRecord | null>;
|
|
14
13
|
completeStep(id: string, outputs: StepSlots): Promise<boolean>;
|
|
15
14
|
cancelQueuedSteps(executionId: string): Promise<void>;
|
|
16
15
|
failStep(id: string, error: StepError): Promise<boolean>;
|
|
17
16
|
private transition;
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
loadStepsByKeys(executionId: string, keys: StepKey[]): Promise<Record<StepKeyId, StepRecord>>;
|
|
18
|
+
loadStepSummariesByKeys(executionId: string, keys: StepKey[]): Promise<Record<StepKeyId, StepSummary>>;
|
|
19
|
+
loadLatestStepSummaries(executionId: string, nodeIds: string[]): Promise<Record<string, StepSummary>>;
|
|
20
20
|
countSettledSteps(executionId: string): Promise<number>;
|
|
21
21
|
hasFailedSteps(executionId: string): Promise<boolean>;
|
|
22
22
|
}
|
|
@@ -7,6 +7,21 @@ const generate_id_1 = require("./generate-id");
|
|
|
7
7
|
const common_1 = require("../common");
|
|
8
8
|
const execution_types_1 = require("../execution/execution.types");
|
|
9
9
|
const step_store_1 = require("../execution/step-store");
|
|
10
|
+
const FILLED_OUTPUT_SLOTS = `COALESCE(
|
|
11
|
+
(SELECT array_agg(jsonb_typeof(slot.value) <> 'null' ORDER BY slot.ordinality)
|
|
12
|
+
FROM jsonb_array_elements(step.outputs) WITH ORDINALITY AS slot),
|
|
13
|
+
'{}'
|
|
14
|
+
)`;
|
|
15
|
+
function stepKeyFilter(keys) {
|
|
16
|
+
const tuples = [];
|
|
17
|
+
const parameters = {};
|
|
18
|
+
keys.forEach(({ nodeId, iteration }, index) => {
|
|
19
|
+
tuples.push(`(:n${index}, :i${index})`);
|
|
20
|
+
parameters[`n${index}`] = nodeId;
|
|
21
|
+
parameters[`i${index}`] = iteration;
|
|
22
|
+
});
|
|
23
|
+
return { fragment: `(step.node_id, step.iteration) IN (${tuples.join(', ')})`, parameters };
|
|
24
|
+
}
|
|
10
25
|
class TypeOrmStepStore {
|
|
11
26
|
repo;
|
|
12
27
|
constructor(repo) {
|
|
@@ -33,9 +48,13 @@ class TypeOrmStepStore {
|
|
|
33
48
|
.into(entities_1.WorkflowStepExecution)
|
|
34
49
|
.values(rows)
|
|
35
50
|
.orIgnore()
|
|
36
|
-
.returning(['id', 'nodeId'])
|
|
51
|
+
.returning(['id', 'nodeId', 'iteration'])
|
|
37
52
|
.execute();
|
|
38
|
-
return result.raw.map(({ id, node_id: nodeId }) => ({
|
|
53
|
+
return result.raw.map(({ id, node_id: nodeId, iteration }) => ({
|
|
54
|
+
id,
|
|
55
|
+
nodeId,
|
|
56
|
+
iteration,
|
|
57
|
+
}));
|
|
39
58
|
});
|
|
40
59
|
}
|
|
41
60
|
async loadStep(id) {
|
|
@@ -60,7 +79,7 @@ class TypeOrmStepStore {
|
|
|
60
79
|
SELECT 1 FROM workflow_step_execution sibling
|
|
61
80
|
WHERE sibling.execution_id = :executionId AND sibling.status = 'failed'
|
|
62
81
|
)`, { executionId: execution.id })
|
|
63
|
-
.returning(['id', 'executionId', 'nodeId'])
|
|
82
|
+
.returning(['id', 'executionId', 'nodeId', 'iteration'])
|
|
64
83
|
.execute();
|
|
65
84
|
const [row] = result.raw;
|
|
66
85
|
if (!row)
|
|
@@ -69,6 +88,7 @@ class TypeOrmStepStore {
|
|
|
69
88
|
id: row.id,
|
|
70
89
|
executionId: row.execution_id,
|
|
71
90
|
nodeId: row.node_id,
|
|
91
|
+
iteration: row.iteration,
|
|
72
92
|
status: 'running',
|
|
73
93
|
outputs: null,
|
|
74
94
|
error: null,
|
|
@@ -94,27 +114,48 @@ class TypeOrmStepStore {
|
|
|
94
114
|
const result = await this.repo.update({ id, status: from }, { ...fields, status: to });
|
|
95
115
|
return result.affected === 1;
|
|
96
116
|
}
|
|
97
|
-
async
|
|
98
|
-
if (
|
|
117
|
+
async loadStepsByKeys(executionId, keys) {
|
|
118
|
+
if (keys.length === 0)
|
|
99
119
|
return {};
|
|
100
|
-
const
|
|
101
|
-
|
|
120
|
+
const { fragment, parameters } = stepKeyFilter(keys);
|
|
121
|
+
const rows = await this.repo
|
|
122
|
+
.createQueryBuilder('step')
|
|
123
|
+
.where('step.execution_id = :executionId', { executionId })
|
|
124
|
+
.andWhere(fragment, parameters)
|
|
125
|
+
.getMany();
|
|
126
|
+
return Object.fromEntries(rows.map((row) => [(0, execution_types_1.stepKeyId)(row), row]));
|
|
127
|
+
}
|
|
128
|
+
async loadStepSummariesByKeys(executionId, keys) {
|
|
129
|
+
if (keys.length === 0)
|
|
130
|
+
return {};
|
|
131
|
+
const { fragment, parameters } = stepKeyFilter(keys);
|
|
132
|
+
const rows = await this.repo
|
|
133
|
+
.createQueryBuilder('step')
|
|
134
|
+
.select('step.id', 'id')
|
|
135
|
+
.addSelect('step.node_id', 'nodeId')
|
|
136
|
+
.addSelect('step.iteration', 'iteration')
|
|
137
|
+
.addSelect('step.status', 'status')
|
|
138
|
+
.addSelect(FILLED_OUTPUT_SLOTS, 'filledOutputSlots')
|
|
139
|
+
.where('step.execution_id = :executionId', { executionId })
|
|
140
|
+
.andWhere(fragment, parameters)
|
|
141
|
+
.getRawMany();
|
|
142
|
+
return Object.fromEntries(rows.map((row) => [(0, execution_types_1.stepKeyId)(row), row]));
|
|
102
143
|
}
|
|
103
|
-
async
|
|
144
|
+
async loadLatestStepSummaries(executionId, nodeIds) {
|
|
104
145
|
if (nodeIds.length === 0)
|
|
105
146
|
return {};
|
|
106
147
|
const rows = await this.repo
|
|
107
148
|
.createQueryBuilder('step')
|
|
149
|
+
.distinctOn(['step.node_id'])
|
|
108
150
|
.select('step.id', 'id')
|
|
109
151
|
.addSelect('step.node_id', 'nodeId')
|
|
152
|
+
.addSelect('step.iteration', 'iteration')
|
|
110
153
|
.addSelect('step.status', 'status')
|
|
111
|
-
.addSelect(
|
|
112
|
-
(SELECT array_agg(jsonb_typeof(slot.value) <> 'null' ORDER BY slot.ordinality)
|
|
113
|
-
FROM jsonb_array_elements(step.outputs) WITH ORDINALITY AS slot),
|
|
114
|
-
'{}'
|
|
115
|
-
)`, 'filledOutputSlots')
|
|
154
|
+
.addSelect(FILLED_OUTPUT_SLOTS, 'filledOutputSlots')
|
|
116
155
|
.where('step.execution_id = :executionId', { executionId })
|
|
117
156
|
.andWhere('step.node_id IN (:...nodeIds)', { nodeIds })
|
|
157
|
+
.orderBy('step.node_id')
|
|
158
|
+
.addOrderBy('step.iteration', 'DESC')
|
|
118
159
|
.getRawMany();
|
|
119
160
|
return Object.fromEntries(rows.map((row) => [row.nodeId, row]));
|
|
120
161
|
}
|
|
@@ -130,6 +171,9 @@ class TypeOrmStepStore {
|
|
|
130
171
|
exports.TypeOrmStepStore = TypeOrmStepStore;
|
|
131
172
|
const CREATION_STATUSES = ['queued', 'completed', 'skipped'];
|
|
132
173
|
function assertCreatableRecord(record) {
|
|
174
|
+
if (!Number.isInteger(record.iteration) || record.iteration < 0) {
|
|
175
|
+
throw new common_1.UnexpectedError(`step for node ${record.nodeId} is created with iteration ${record.iteration}; iterations are non-negative integers`);
|
|
176
|
+
}
|
|
133
177
|
if (!CREATION_STATUSES.includes(record.status)) {
|
|
134
178
|
throw new common_1.UnexpectedError(`step for node ${record.nodeId} is created ${record.status}, a status only reachable through its transition method`);
|
|
135
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeorm-step-store.js","sourceRoot":"","sources":["../../src/database/typeorm-step-store.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AAEnD,yCAAmD;AACnD,+CAA2C;AAC3C,sCAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"typeorm-step-store.js","sourceRoot":"","sources":["../../src/database/typeorm-step-store.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AAEnD,yCAAmD;AACnD,+CAA2C;AAC3C,sCAA4C;AAC5C,kEAOsC;AACtC,wDAOiC;AAOjC,MAAM,mBAAmB,GAAG;;;;EAI1B,CAAC;AAmBH,SAAS,aAAa,CAAC,IAAe;IAIrC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,UAAU,GAAoC,EAAE,CAAC;IACvD,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,EA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AAE,CAAC;QACnE,MAAM,IAAI,wBAAe,CACxB,iBAAiB,MAAM,CAAC,MAAM,eAAe,MAAM,CAAC,MAAM,8DAA8D,CACxH,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,wBAAe,CACxB,iBAAiB,MAAM,CAAC,MAAM,wIAAwI,CACtK,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.countExpectedSettledSteps = countExpectedSettledSteps;
|
|
4
|
+
function countExpectedSettledSteps(loops, reachable, terminalIterations) {
|
|
5
|
+
let expected = 0;
|
|
6
|
+
const members = new Set();
|
|
7
|
+
for (const loop of loops.filter((l) => reachable.has(l.batchNodeId))) {
|
|
8
|
+
const terminal = terminalIterations.get(loop.batchNodeId);
|
|
9
|
+
if (terminal === undefined)
|
|
10
|
+
return undefined;
|
|
11
|
+
expected += terminal + 1 + terminal * (loop.memberIds.size - 1);
|
|
12
|
+
for (const memberId of loop.memberIds)
|
|
13
|
+
members.add(memberId);
|
|
14
|
+
}
|
|
15
|
+
for (const nodeId of reachable) {
|
|
16
|
+
if (!members.has(nodeId))
|
|
17
|
+
expected += 1;
|
|
18
|
+
}
|
|
19
|
+
return expected;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=completion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/execution/completion.ts"],"names":[],"mappings":";;;AAkBA,mCACC,KAAqB,EACrB,SAAsB,EACtB,kBAAuC;IAEvC,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QACtE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1D,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAI7C,QAAQ,IAAI,QAAQ,GAAG,CAAC,GAAG,QAAQ,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAChE,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,QAAQ,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExecutionStartHandler = void 0;
|
|
4
4
|
const common_1 = require("../common");
|
|
5
5
|
const graph_1 = require("../graph");
|
|
6
|
+
const execution_types_1 = require("./execution.types");
|
|
6
7
|
class ExecutionStartHandler {
|
|
7
8
|
executionStore;
|
|
8
9
|
stepStore;
|
|
@@ -24,8 +25,9 @@ class ExecutionStartHandler {
|
|
|
24
25
|
const [triggerStep] = await this.stepStore.createSteps(event.executionId, [
|
|
25
26
|
{
|
|
26
27
|
nodeId: trigger.id,
|
|
28
|
+
iteration: 0,
|
|
27
29
|
status: 'completed',
|
|
28
|
-
outputs:
|
|
30
|
+
outputs: execution.triggerOutputs ?? execution_types_1.DEFAULT_TRIGGER_OUTPUTS,
|
|
29
31
|
},
|
|
30
32
|
]);
|
|
31
33
|
if (!triggerStep) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-start-handler.js","sourceRoot":"","sources":["../../src/execution/execution-start-handler.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,oCAA2C;
|
|
1
|
+
{"version":3,"file":"execution-start-handler.js","sourceRoot":"","sources":["../../src/execution/execution-start-handler.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,oCAA2C;AAG3C,uDAA4D;AAW5D;IAEmB,cAAc;IACd,SAAS;IACT,kBAAkB;IAHpC,YACkB,cAA8B,EAC9B,SAAoB,EACpB,kBAAmD;8BAFnD,cAAc;yBACd,SAAS;kCACT,kBAAkB;IACjC,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,KAA6B;QAEzC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CACzD,KAAK,CAAC,WAAW,EACjB,QAAQ,EACR,SAAS,CACT,CAAC;QACF,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,IAAA,uBAAe,EAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,EAAE,CAAC;YAGd,MAAM,IAAI,wBAAe,CAAC,aAAa,KAAK,CAAC,WAAW,mCAAmC,CAAC,CAAC;QAC9F,CAAC;QAOD,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE;YACzE;gBACC,MAAM,EAAE,OAAO,CAAC,EAAE;gBAClB,SAAS,EAAE,CAAC;gBACZ,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,SAAS,CAAC,cAAc,IAAI,yCAAuB;aAC5D;SACD,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,MAAM,IAAI,wBAAe,CACxB,8BAA8B,KAAK,CAAC,WAAW,oCAAoC,CACnF,CAAC;QACH,CAAC;QAGD,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YACrC,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,WAAW,CAAC,EAAE;SACtB,CAAC,CAAC;IACJ,CAAC;CACD"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { JsonObject } from '../common';
|
|
2
1
|
import type { WorkflowGraph } from '../graph';
|
|
3
|
-
import type { ExecutionMode, ExecutionStatus } from './execution.types';
|
|
2
|
+
import type { ExecutionMode, ExecutionStatus, TriggerOutputs } from './execution.types';
|
|
4
3
|
export interface NewExecutionRecord {
|
|
5
4
|
workflowId: string;
|
|
6
5
|
status: ExecutionStatus;
|
|
7
6
|
mode: ExecutionMode;
|
|
8
7
|
graph: WorkflowGraph;
|
|
9
|
-
|
|
8
|
+
triggerOutputs: TriggerOutputs | null;
|
|
10
9
|
}
|
|
11
10
|
export interface ExecutionRecord {
|
|
12
11
|
id: string;
|
|
@@ -14,7 +13,7 @@ export interface ExecutionRecord {
|
|
|
14
13
|
status: ExecutionStatus;
|
|
15
14
|
mode: ExecutionMode;
|
|
16
15
|
graph: WorkflowGraph;
|
|
17
|
-
|
|
16
|
+
triggerOutputs: TriggerOutputs | null;
|
|
18
17
|
}
|
|
19
18
|
export declare class ExecutionNotFoundError extends Error {
|
|
20
19
|
readonly executionId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-store.js","sourceRoot":"","sources":["../../src/execution/execution-store.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"execution-store.js","sourceRoot":"","sources":["../../src/execution/execution-store.ts"],"names":[],"mappings":";;;AAuBA,4BAAoC,SAAQ,KAAK;IAC3B,WAAW;IAAhC,YAAqB,WAAmB;QACvC,KAAK,CAAC,wBAAwB,WAAW,EAAE,CAAC,CAAC;2BADzB,WAAW;QAE/B,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACtC,CAAC;CACD"}
|
|
@@ -5,3 +5,11 @@ export type StepStatus = 'queued' | 'running' | 'completed' | 'failed' | 'skippe
|
|
|
5
5
|
export declare const SETTLED_STEP_STATUSES: readonly StepStatus[];
|
|
6
6
|
export declare function isSettledStatus(status: StepStatus): boolean;
|
|
7
7
|
export type StepSlots = JsonValue[];
|
|
8
|
+
export type TriggerOutputs = StepSlots;
|
|
9
|
+
export declare const DEFAULT_TRIGGER_OUTPUTS: TriggerOutputs;
|
|
10
|
+
export interface StepKey {
|
|
11
|
+
nodeId: string;
|
|
12
|
+
iteration: number;
|
|
13
|
+
}
|
|
14
|
+
export type StepKeyId = string;
|
|
15
|
+
export declare function stepKeyId({ nodeId, iteration }: StepKey): StepKeyId;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SETTLED_STEP_STATUSES = void 0;
|
|
3
|
+
exports.DEFAULT_TRIGGER_OUTPUTS = exports.SETTLED_STEP_STATUSES = void 0;
|
|
4
4
|
exports.isSettledStatus = isSettledStatus;
|
|
5
|
+
exports.stepKeyId = stepKeyId;
|
|
5
6
|
exports.SETTLED_STEP_STATUSES = [
|
|
6
7
|
'completed',
|
|
7
8
|
'failed',
|
|
@@ -11,4 +12,8 @@ exports.SETTLED_STEP_STATUSES = [
|
|
|
11
12
|
function isSettledStatus(status) {
|
|
12
13
|
return exports.SETTLED_STEP_STATUSES.includes(status);
|
|
13
14
|
}
|
|
15
|
+
exports.DEFAULT_TRIGGER_OUTPUTS = [];
|
|
16
|
+
function stepKeyId({ nodeId, iteration }) {
|
|
17
|
+
return `${nodeId}@${iteration}`;
|
|
18
|
+
}
|
|
14
19
|
//# sourceMappingURL=execution.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.types.js","sourceRoot":"","sources":["../../src/execution/execution.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execution.types.js","sourceRoot":"","sources":["../../src/execution/execution.types.ts"],"names":[],"mappings":";;;;;AAoBa,QAAA,qBAAqB,GAA0B;IAC3D,WAAW;IACX,QAAQ;IACR,SAAS;IACT,WAAW;CACX,CAAC;AAEF,yBAAgC,MAAkB;IACjD,OAAO,QAAA,qBAAqB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AAuBY,QAAA,uBAAuB,GAAmB,EAAE,CAAC;AAU1D,mBAA0B,EAAE,MAAM,EAAE,SAAS,EAAW;IACvD,OAAO,GAAG,MAAM,IAAI,SAAS,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { StartExecutionService } from './start-execution.service';
|
|
2
2
|
export type { StartExecutionRequest, StartExecutionResult, } from './start-execution.service';
|
|
3
|
-
export
|
|
3
|
+
export { stepKeyId } from './execution.types';
|
|
4
|
+
export type { ExecutionMode, ExecutionStatus, StepKey, StepKeyId, StepSlots, StepStatus, TriggerOutputs, } from './execution.types';
|
|
4
5
|
export { ExecutionNotFoundError } from './execution-store';
|
|
5
6
|
export type { ExecutionRecord, ExecutionStore, NewExecutionRecord } from './execution-store';
|
|
6
7
|
export { StepNotFoundError } from './step-store';
|
|
7
|
-
export type { NewStepRecord, StepError, StepRecord, StepStore } from './step-store';
|
|
8
|
+
export type { NewStepRecord, StepError, StepRecord, StepStore, StepSummary } from './step-store';
|
|
8
9
|
export { ExecutionStartHandler } from './execution-start-handler';
|
|
9
10
|
export { OrchestrationWorker } from './orchestration-worker';
|
|
10
11
|
export { StepSettledHandler } from './step-settled-handler';
|
package/dist/execution/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StepWorker = exports.StepReadyHandler = exports.StepSettledHandler = exports.OrchestrationWorker = exports.ExecutionStartHandler = exports.StepNotFoundError = exports.ExecutionNotFoundError = exports.StartExecutionService = void 0;
|
|
3
|
+
exports.StepWorker = exports.StepReadyHandler = exports.StepSettledHandler = exports.OrchestrationWorker = exports.ExecutionStartHandler = exports.StepNotFoundError = exports.ExecutionNotFoundError = exports.stepKeyId = exports.StartExecutionService = void 0;
|
|
4
4
|
var start_execution_service_1 = require("./start-execution.service");
|
|
5
5
|
Object.defineProperty(exports, "StartExecutionService", { enumerable: true, get: function () { return start_execution_service_1.StartExecutionService; } });
|
|
6
|
+
var execution_types_1 = require("./execution.types");
|
|
7
|
+
Object.defineProperty(exports, "stepKeyId", { enumerable: true, get: function () { return execution_types_1.stepKeyId; } });
|
|
6
8
|
var execution_store_1 = require("./execution-store");
|
|
7
9
|
Object.defineProperty(exports, "ExecutionNotFoundError", { enumerable: true, get: function () { return execution_store_1.ExecutionNotFoundError; } });
|
|
8
10
|
var step_store_1 = require("./step-store");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/execution/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/execution/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAK9B,qDAA8C;AAArC,4GAAA,SAAS,OAAA;AAUlB,qDAA2D;AAAlD,yHAAA,sBAAsB,OAAA;AAE/B,2CAAiD;AAAxC,+GAAA,iBAAiB,OAAA;AAE1B,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAC5B,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GraphEdge, WorkflowLoop } from '../graph';
|
|
2
|
+
import type { StepKey } from './execution.types';
|
|
3
|
+
export type EdgeClass = 'plain' | 'entry' | 'intra' | 'back' | 'exit';
|
|
4
|
+
export type SourceRow = {
|
|
5
|
+
kind: 'row';
|
|
6
|
+
key: StepKey;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'none';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'pending';
|
|
11
|
+
};
|
|
12
|
+
export declare function classifyEdge(edge: GraphEdge, loops: WorkflowLoop[]): EdgeClass;
|
|
13
|
+
export declare function targetKey(edge: GraphEdge, edgeClass: EdgeClass, source: StepKey): StepKey;
|
|
14
|
+
export declare function sourceRow(edge: GraphEdge, edgeClass: EdgeClass, target: StepKey, terminalIteration?: number): SourceRow;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyEdge = classifyEdge;
|
|
4
|
+
exports.targetKey = targetKey;
|
|
5
|
+
exports.sourceRow = sourceRow;
|
|
6
|
+
function classifyEdge(edge, loops) {
|
|
7
|
+
if (edge.isBackEdge)
|
|
8
|
+
return 'back';
|
|
9
|
+
const sourceLoop = loops.find((loop) => loop.memberIds.has(edge.from));
|
|
10
|
+
const targetLoop = loops.find((loop) => loop.memberIds.has(edge.to));
|
|
11
|
+
if (sourceLoop && sourceLoop === targetLoop)
|
|
12
|
+
return 'intra';
|
|
13
|
+
if (sourceLoop)
|
|
14
|
+
return 'exit';
|
|
15
|
+
if (targetLoop)
|
|
16
|
+
return 'entry';
|
|
17
|
+
return 'plain';
|
|
18
|
+
}
|
|
19
|
+
function targetKey(edge, edgeClass, source) {
|
|
20
|
+
switch (edgeClass) {
|
|
21
|
+
case 'back':
|
|
22
|
+
return { nodeId: edge.to, iteration: source.iteration + 1 };
|
|
23
|
+
case 'exit':
|
|
24
|
+
case 'entry':
|
|
25
|
+
return { nodeId: edge.to, iteration: 0 };
|
|
26
|
+
default:
|
|
27
|
+
return { nodeId: edge.to, iteration: source.iteration };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function sourceRow(edge, edgeClass, target, terminalIteration) {
|
|
31
|
+
const row = (iteration) => ({
|
|
32
|
+
kind: 'row',
|
|
33
|
+
key: { nodeId: edge.from, iteration },
|
|
34
|
+
});
|
|
35
|
+
switch (edgeClass) {
|
|
36
|
+
case 'back':
|
|
37
|
+
return target.iteration === 0 ? { kind: 'none' } : row(target.iteration - 1);
|
|
38
|
+
case 'entry':
|
|
39
|
+
return target.iteration > 0 ? { kind: 'none' } : row(0);
|
|
40
|
+
case 'exit':
|
|
41
|
+
if (target.iteration > 0)
|
|
42
|
+
return { kind: 'none' };
|
|
43
|
+
return terminalIteration === undefined ? { kind: 'pending' } : row(terminalIteration);
|
|
44
|
+
default:
|
|
45
|
+
return row(target.iteration);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=iteration-mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iteration-mapping.js","sourceRoot":"","sources":["../../src/execution/iteration-mapping.ts"],"names":[],"mappings":";;;;;AAkCA,sBAA6B,IAAe,EAAE,KAAqB;IAClE,IAAI,IAAI,CAAC,UAAU;QAAE,OAAO,MAAM,CAAC;IAEnC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAErE,IAAI,UAAU,IAAI,UAAU,KAAK,UAAU;QAAE,OAAO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