@n8n/engine 0.12.0 → 0.14.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.
Files changed (116) hide show
  1. package/dist/admittance/admittance-rejected.error.d.ts +4 -0
  2. package/dist/admittance/admittance-rejected.error.js +13 -0
  3. package/dist/admittance/admittance-rejected.error.js.map +1 -0
  4. package/dist/admittance/admittance.types.d.ts +12 -0
  5. package/dist/admittance/admittance.types.js +3 -0
  6. package/dist/admittance/admittance.types.js.map +1 -0
  7. package/dist/admittance/allow-all-admittance.d.ts +4 -0
  8. package/dist/admittance/allow-all-admittance.js +10 -0
  9. package/dist/admittance/allow-all-admittance.js.map +1 -0
  10. package/dist/admittance/index.d.ts +3 -0
  11. package/dist/admittance/index.js +8 -0
  12. package/dist/admittance/index.js.map +1 -0
  13. package/dist/build.tsbuildinfo +1 -1
  14. package/dist/common/errors.d.ts +3 -0
  15. package/dist/common/errors.js +11 -0
  16. package/dist/common/errors.js.map +1 -0
  17. package/dist/common/index.d.ts +2 -0
  18. package/dist/common/index.js +6 -0
  19. package/dist/common/index.js.map +1 -0
  20. package/dist/common/json.d.ts +4 -0
  21. package/dist/common/json.js +3 -0
  22. package/dist/common/json.js.map +1 -0
  23. package/dist/database/data-source.d.ts +3 -0
  24. package/dist/database/data-source.js +19 -0
  25. package/dist/database/data-source.js.map +1 -0
  26. package/dist/database/entities/index.d.ts +5 -0
  27. package/dist/database/entities/index.js +9 -0
  28. package/dist/database/entities/index.js.map +1 -0
  29. package/dist/database/entities/workflow-execution.entity.d.ts +15 -0
  30. package/dist/database/entities/workflow-execution.entity.js +78 -0
  31. package/dist/database/entities/workflow-execution.entity.js.map +1 -0
  32. package/dist/database/entities/workflow-step-execution.entity.d.ts +14 -0
  33. package/dist/database/entities/workflow-step-execution.entity.js +72 -0
  34. package/dist/database/entities/workflow-step-execution.entity.js.map +1 -0
  35. package/dist/database/generate-id.d.ts +1 -0
  36. package/dist/database/generate-id.js +8 -0
  37. package/dist/database/generate-id.js.map +1 -0
  38. package/dist/database/index.d.ts +4 -0
  39. package/dist/database/index.js +13 -0
  40. package/dist/database/index.js.map +1 -0
  41. package/dist/database/migrations/1778529600000-CreateWorkflowExecution.d.ts +5 -0
  42. package/dist/database/migrations/1778529600000-CreateWorkflowExecution.js +48 -0
  43. package/dist/database/migrations/1778529600000-CreateWorkflowExecution.js.map +1 -0
  44. package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.d.ts +5 -0
  45. package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js +67 -0
  46. package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js.map +1 -0
  47. package/dist/database/migrations/index.d.ts +2 -0
  48. package/dist/database/migrations/index.js +10 -0
  49. package/dist/database/migrations/index.js.map +1 -0
  50. package/dist/database/typeorm-execution-store.d.ts +13 -0
  51. package/dist/database/typeorm-execution-store.js +27 -0
  52. package/dist/database/typeorm-execution-store.js.map +1 -0
  53. package/dist/database/typeorm-step-store.d.ts +17 -0
  54. package/dist/database/typeorm-step-store.js +51 -0
  55. package/dist/database/typeorm-step-store.js.map +1 -0
  56. package/dist/dependencies/external-dependencies.d.ts +23 -0
  57. package/dist/dependencies/external-dependencies.js +3 -0
  58. package/dist/dependencies/external-dependencies.js.map +1 -0
  59. package/dist/dependencies/index.d.ts +1 -0
  60. package/dist/dependencies/index.js +3 -0
  61. package/dist/dependencies/index.js.map +1 -0
  62. package/dist/execution/execution-start-handler.d.ts +10 -0
  63. package/dist/execution/execution-start-handler.js +43 -0
  64. package/dist/execution/execution-start-handler.js.map +1 -0
  65. package/dist/execution/execution-store.d.ts +29 -0
  66. package/dist/execution/execution-store.js +13 -0
  67. package/dist/execution/execution-store.js.map +1 -0
  68. package/dist/execution/execution.types.d.ts +3 -0
  69. package/dist/execution/execution.types.js +3 -0
  70. package/dist/execution/execution.types.js.map +1 -0
  71. package/dist/execution/index.d.ts +9 -0
  72. package/dist/execution/index.js +14 -0
  73. package/dist/execution/index.js.map +1 -0
  74. package/dist/execution/orchestration-worker.d.ts +9 -0
  75. package/dist/execution/orchestration-worker.js +28 -0
  76. package/dist/execution/orchestration-worker.js.map +1 -0
  77. package/dist/execution/start-execution.service.d.ts +22 -0
  78. package/dist/execution/start-execution.service.js +34 -0
  79. package/dist/execution/start-execution.service.js.map +1 -0
  80. package/dist/execution/step-store.d.ts +35 -0
  81. package/dist/execution/step-store.js +13 -0
  82. package/dist/execution/step-store.js.map +1 -0
  83. package/dist/graph/index.d.ts +2 -0
  84. package/dist/graph/index.js +7 -0
  85. package/dist/graph/index.js.map +1 -0
  86. package/dist/graph/workflow-graph-queries.d.ts +3 -0
  87. package/dist/graph/workflow-graph-queries.js +17 -0
  88. package/dist/graph/workflow-graph-queries.js.map +1 -0
  89. package/dist/graph/workflow-graph.d.ts +19 -0
  90. package/dist/graph/workflow-graph.js +3 -0
  91. package/dist/graph/workflow-graph.js.map +1 -0
  92. package/dist/index.d.ts +11 -0
  93. package/dist/index.js +15 -1
  94. package/dist/index.js.map +1 -1
  95. package/dist/queue/in-memory-work-queue.d.ts +12 -0
  96. package/dist/queue/in-memory-work-queue.js +53 -0
  97. package/dist/queue/in-memory-work-queue.js.map +1 -0
  98. package/dist/queue/index.d.ts +2 -0
  99. package/dist/queue/index.js +6 -0
  100. package/dist/queue/index.js.map +1 -0
  101. package/dist/queue/work-queue.types.d.ts +16 -0
  102. package/dist/queue/work-queue.types.js +3 -0
  103. package/dist/queue/work-queue.types.js.map +1 -0
  104. package/dist/serve.js +56 -19
  105. package/dist/serve.js.map +1 -1
  106. package/dist/server/create-engine-server.d.ts +9 -1
  107. package/dist/server/create-engine-server.js +10 -1
  108. package/dist/server/create-engine-server.js.map +1 -1
  109. package/dist/server/index.d.ts +1 -0
  110. package/dist/server/routes/workflow-executions.d.ts +3 -0
  111. package/dist/server/routes/workflow-executions.js +65 -0
  112. package/dist/server/routes/workflow-executions.js.map +1 -0
  113. package/dist/testing/start-engine-server.d.ts +2 -1
  114. package/dist/testing/start-engine-server.js +2 -2
  115. package/dist/testing/start-engine-server.js.map +1 -1
  116. package/package.json +9 -2
@@ -0,0 +1,3 @@
1
+ export declare class UnimplementedError extends Error {
2
+ constructor(message: string);
3
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnimplementedError = void 0;
4
+ class UnimplementedError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.name = 'UnimplementedError';
8
+ }
9
+ }
10
+ exports.UnimplementedError = UnimplementedError;
11
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/common/errors.ts"],"names":[],"mappings":";;;AAMA,wBAAgC,SAAQ,KAAK;IAC5C,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IAClC,CAAC;CACD"}
@@ -0,0 +1,2 @@
1
+ export type { JsonObject, JsonValue } from './json';
2
+ export { UnimplementedError } from './errors';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnimplementedError = void 0;
4
+ var errors_1 = require("./errors");
5
+ Object.defineProperty(exports, "UnimplementedError", { enumerable: true, get: function () { return errors_1.UnimplementedError; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AACA,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA"}
@@ -0,0 +1,4 @@
1
+ export type JsonValue = string | number | boolean | null | JsonObject | JsonValue[];
2
+ export type JsonObject = {
3
+ [key: string]: JsonValue;
4
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/common/json.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import 'reflect-metadata';
2
+ import { DataSource } from '@n8n/typeorm';
3
+ export declare function createDataSource(url: string): DataSource;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDataSource = createDataSource;
4
+ require("reflect-metadata");
5
+ const typeorm_1 = require("@n8n/typeorm");
6
+ const entities_1 = require("./entities");
7
+ const migrations_1 = require("./migrations");
8
+ function createDataSource(url) {
9
+ const options = {
10
+ type: 'postgres',
11
+ url,
12
+ entities: entities_1.entities,
13
+ migrations: migrations_1.migrations,
14
+ synchronize: false,
15
+ logging: false,
16
+ };
17
+ return new typeorm_1.DataSource(options);
18
+ }
19
+ //# sourceMappingURL=data-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-source.js","sourceRoot":"","sources":["../../src/database/data-source.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAE1B,0CAAkE;AAElE,yCAAsC;AACtC,6CAA0C;AAW1C,0BAAiC,GAAW;IAC3C,MAAM,OAAO,GAAsB;QAClC,IAAI,EAAE,UAAU;QAChB,GAAG;QACH,QAAQ,EAAR,mBAAQ;QACR,UAAU,EAAV,uBAAU;QACV,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,KAAK;KACd,CAAC;IAEF,OAAO,IAAI,oBAAU,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { WorkflowExecution } from './workflow-execution.entity';
2
+ import { WorkflowStepExecution } from './workflow-step-execution.entity';
3
+ export declare const entities: (typeof WorkflowExecution | typeof WorkflowStepExecution)[];
4
+ export { WorkflowExecution };
5
+ export { WorkflowStepExecution };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkflowStepExecution = exports.WorkflowExecution = exports.entities = void 0;
4
+ const workflow_execution_entity_1 = require("./workflow-execution.entity");
5
+ Object.defineProperty(exports, "WorkflowExecution", { enumerable: true, get: function () { return workflow_execution_entity_1.WorkflowExecution; } });
6
+ const workflow_step_execution_entity_1 = require("./workflow-step-execution.entity");
7
+ Object.defineProperty(exports, "WorkflowStepExecution", { enumerable: true, get: function () { return workflow_step_execution_entity_1.WorkflowStepExecution; } });
8
+ exports.entities = [workflow_execution_entity_1.WorkflowExecution, workflow_step_execution_entity_1.WorkflowStepExecution];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/entities/index.ts"],"names":[],"mappings":";;;AAAA,2EAAgE;kGAAvD,6CAAiB;AAC1B,qFAAyE;sGAAhE,sDAAqB;AAEjB,QAAA,QAAQ,GAAG,CAAC,6CAAiB,EAAE,sDAAqB,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { JsonObject } from '../../common';
2
+ import type { ExecutionMode, ExecutionStatus } from '../../execution/execution.types';
3
+ import type { WorkflowGraph } from '../../graph';
4
+ export declare class WorkflowExecution {
5
+ id: string;
6
+ workflowId: string;
7
+ status: ExecutionStatus;
8
+ mode: ExecutionMode;
9
+ graph: WorkflowGraph;
10
+ triggerPayload: JsonObject | null;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ finishedAt: Date | null;
14
+ setId(): void;
15
+ }
@@ -0,0 +1,78 @@
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.WorkflowExecution = void 0;
13
+ const typeorm_1 = require("@n8n/typeorm");
14
+ const generate_id_1 = require("../generate-id");
15
+ let WorkflowExecution = class WorkflowExecution {
16
+ id;
17
+ workflowId;
18
+ status;
19
+ mode;
20
+ graph;
21
+ triggerPayload;
22
+ createdAt;
23
+ updatedAt;
24
+ finishedAt;
25
+ setId() {
26
+ if (!this.id)
27
+ this.id = (0, generate_id_1.generateId)();
28
+ }
29
+ };
30
+ exports.WorkflowExecution = WorkflowExecution;
31
+ __decorate([
32
+ (0, typeorm_1.PrimaryColumn)('uuid'),
33
+ __metadata("design:type", String)
34
+ ], WorkflowExecution.prototype, "id", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)('varchar', { name: 'workflow_id' }),
37
+ __metadata("design:type", String)
38
+ ], WorkflowExecution.prototype, "workflowId", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.Column)('varchar', { length: 32 }),
41
+ __metadata("design:type", String)
42
+ ], WorkflowExecution.prototype, "status", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)('varchar', { length: 32 }),
45
+ __metadata("design:type", String)
46
+ ], WorkflowExecution.prototype, "mode", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)('jsonb'),
49
+ __metadata("design:type", Object)
50
+ ], WorkflowExecution.prototype, "graph", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)('jsonb', { name: 'trigger_payload', nullable: true }),
53
+ __metadata("design:type", Object)
54
+ ], WorkflowExecution.prototype, "triggerPayload", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz', precision: 3 }),
57
+ __metadata("design:type", Date)
58
+ ], WorkflowExecution.prototype, "createdAt", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', precision: 3 }),
61
+ __metadata("design:type", Date)
62
+ ], WorkflowExecution.prototype, "updatedAt", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ name: 'finished_at', type: 'timestamptz', nullable: true, precision: 3 }),
65
+ __metadata("design:type", Object)
66
+ ], WorkflowExecution.prototype, "finishedAt", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.BeforeInsert)(),
69
+ __metadata("design:type", Function),
70
+ __metadata("design:paramtypes", []),
71
+ __metadata("design:returntype", void 0)
72
+ ], WorkflowExecution.prototype, "setId", null);
73
+ exports.WorkflowExecution = WorkflowExecution = __decorate([
74
+ (0, typeorm_1.Entity)('workflow_execution'),
75
+ (0, typeorm_1.Index)('idx_workflow_execution_workflow_id', ['workflowId']),
76
+ (0, typeorm_1.Index)('idx_workflow_execution_status', ['status'])
77
+ ], WorkflowExecution);
78
+ //# sourceMappingURL=workflow-execution.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-execution.entity.js","sourceRoot":"","sources":["../../../src/database/entities/workflow-execution.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAQsB;AAKtB,gDAA4C;AAKrC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE7B,EAAE,CAAU;IAGZ,UAAU,CAAU;IAGpB,MAAM,CAAmB;IAGzB,IAAI,CAAiB;IAGrB,KAAK,CAAiB;IAGtB,cAAc,CAAqB;IAGnC,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;;yDAC1B;AAGnC;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"}
@@ -0,0 +1,14 @@
1
+ import type { JsonValue } from '../../common';
2
+ import type { StepStatus } from '../../execution/execution.types';
3
+ import type { StepError } from '../../execution/step-store';
4
+ export declare class WorkflowStepExecution {
5
+ id: string;
6
+ executionId: string;
7
+ nodeId: string;
8
+ status: StepStatus;
9
+ outputs: JsonValue | null;
10
+ error: StepError | null;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ setId(): void;
14
+ }
@@ -0,0 +1,72 @@
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.WorkflowStepExecution = void 0;
13
+ const typeorm_1 = require("@n8n/typeorm");
14
+ const generate_id_1 = require("../generate-id");
15
+ let WorkflowStepExecution = class WorkflowStepExecution {
16
+ id;
17
+ executionId;
18
+ nodeId;
19
+ status;
20
+ outputs;
21
+ error;
22
+ createdAt;
23
+ updatedAt;
24
+ setId() {
25
+ if (!this.id)
26
+ this.id = (0, generate_id_1.generateId)();
27
+ }
28
+ };
29
+ exports.WorkflowStepExecution = WorkflowStepExecution;
30
+ __decorate([
31
+ (0, typeorm_1.PrimaryColumn)('uuid'),
32
+ __metadata("design:type", String)
33
+ ], WorkflowStepExecution.prototype, "id", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)('uuid', { name: 'execution_id' }),
36
+ __metadata("design:type", String)
37
+ ], WorkflowStepExecution.prototype, "executionId", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)('varchar', { name: 'node_id' }),
40
+ __metadata("design:type", String)
41
+ ], WorkflowStepExecution.prototype, "nodeId", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)('varchar', { length: 32 }),
44
+ __metadata("design:type", String)
45
+ ], WorkflowStepExecution.prototype, "status", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)('jsonb', { nullable: true }),
48
+ __metadata("design:type", Object)
49
+ ], WorkflowStepExecution.prototype, "outputs", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)('jsonb', { nullable: true }),
52
+ __metadata("design:type", Object)
53
+ ], WorkflowStepExecution.prototype, "error", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'timestamptz', precision: 3 }),
56
+ __metadata("design:type", Date)
57
+ ], WorkflowStepExecution.prototype, "createdAt", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'timestamptz', precision: 3 }),
60
+ __metadata("design:type", Date)
61
+ ], WorkflowStepExecution.prototype, "updatedAt", void 0);
62
+ __decorate([
63
+ (0, typeorm_1.BeforeInsert)(),
64
+ __metadata("design:type", Function),
65
+ __metadata("design:paramtypes", []),
66
+ __metadata("design:returntype", void 0)
67
+ ], WorkflowStepExecution.prototype, "setId", null);
68
+ exports.WorkflowStepExecution = WorkflowStepExecution = __decorate([
69
+ (0, typeorm_1.Entity)('workflow_step_execution'),
70
+ (0, typeorm_1.Index)('idx_workflow_step_execution_execution_id_node_id', ['executionId', 'nodeId'])
71
+ ], WorkflowStepExecution);
72
+ //# sourceMappingURL=workflow-step-execution.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-step-execution.entity.js","sourceRoot":"","sources":["../../../src/database/entities/workflow-step-execution.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAQsB;AAKtB,gDAA4C;AAIrC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAEjC,EAAE,CAAU;IAGZ,WAAW,CAAU;IAGrB,MAAM,CAAU;IAGhB,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;;AA3BA;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,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;gCA5BW,qBAAqB;IAFjC,IAAA,gBAAM,EAAC,yBAAyB,CAAC;IACjC,IAAA,eAAK,EAAC,kDAAkD,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;GACxE,qBAAqB,CA6BjC"}
@@ -0,0 +1 @@
1
+ export declare function generateId(): string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateId = generateId;
4
+ const uuid_1 = require("uuid");
5
+ function generateId() {
6
+ return (0, uuid_1.v7)();
7
+ }
8
+ //# sourceMappingURL=generate-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-id.js","sourceRoot":"","sources":["../../src/database/generate-id.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAOpC;IACC,OAAO,IAAA,SAAM,GAAE,CAAC;AACjB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { createDataSource } from './data-source';
2
+ export { WorkflowExecution, WorkflowStepExecution } from './entities';
3
+ export { TypeOrmExecutionStore } from './typeorm-execution-store';
4
+ export { TypeOrmStepStore } from './typeorm-step-store';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeOrmStepStore = exports.TypeOrmExecutionStore = exports.WorkflowStepExecution = exports.WorkflowExecution = exports.createDataSource = void 0;
4
+ var data_source_1 = require("./data-source");
5
+ Object.defineProperty(exports, "createDataSource", { enumerable: true, get: function () { return data_source_1.createDataSource; } });
6
+ var entities_1 = require("./entities");
7
+ Object.defineProperty(exports, "WorkflowExecution", { enumerable: true, get: function () { return entities_1.WorkflowExecution; } });
8
+ Object.defineProperty(exports, "WorkflowStepExecution", { enumerable: true, get: function () { return entities_1.WorkflowStepExecution; } });
9
+ var typeorm_execution_store_1 = require("./typeorm-execution-store");
10
+ Object.defineProperty(exports, "TypeOrmExecutionStore", { enumerable: true, get: function () { return typeorm_execution_store_1.TypeOrmExecutionStore; } });
11
+ var typeorm_step_store_1 = require("./typeorm-step-store");
12
+ Object.defineProperty(exports, "TypeOrmStepStore", { enumerable: true, get: function () { return typeorm_step_store_1.TypeOrmStepStore; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AACzB,uCAAsE;AAA7D,6GAAA,iBAAiB,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AACjD,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,5 @@
1
+ import type { MigrationInterface, QueryRunner } from '@n8n/typeorm';
2
+ export declare class CreateWorkflowExecution1778529600000 implements MigrationInterface {
3
+ up(queryRunner: QueryRunner): Promise<void>;
4
+ down(queryRunner: QueryRunner): Promise<void>;
5
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateWorkflowExecution1778529600000 = void 0;
4
+ const typeorm_1 = require("@n8n/typeorm");
5
+ const TABLE = 'workflow_execution';
6
+ class CreateWorkflowExecution1778529600000 {
7
+ async up(queryRunner) {
8
+ await queryRunner.createTable(new typeorm_1.Table({
9
+ name: TABLE,
10
+ columns: [
11
+ { name: 'id', type: 'uuid', isPrimary: true },
12
+ { name: 'workflow_id', type: 'varchar' },
13
+ { name: 'status', type: 'varchar', length: '32' },
14
+ { name: 'mode', type: 'varchar', length: '32' },
15
+ { name: 'graph', type: 'jsonb' },
16
+ { name: 'trigger_payload', type: 'jsonb', isNullable: true },
17
+ {
18
+ name: 'created_at',
19
+ type: 'timestamptz',
20
+ precision: 3,
21
+ default: 'CURRENT_TIMESTAMP(3)',
22
+ },
23
+ {
24
+ name: 'updated_at',
25
+ type: 'timestamptz',
26
+ precision: 3,
27
+ default: 'CURRENT_TIMESTAMP(3)',
28
+ },
29
+ { name: 'finished_at', type: 'timestamptz', precision: 3, isNullable: true },
30
+ ],
31
+ checks: [
32
+ {
33
+ name: 'chk_workflow_execution_status',
34
+ expression: "status IN ('queued', 'running', 'completed', 'failed', 'cancelled')",
35
+ },
36
+ ],
37
+ }));
38
+ await queryRunner.createIndices(TABLE, [
39
+ new typeorm_1.TableIndex({ name: 'idx_workflow_execution_workflow_id', columnNames: ['workflow_id'] }),
40
+ new typeorm_1.TableIndex({ name: 'idx_workflow_execution_status', columnNames: ['status'] }),
41
+ ]);
42
+ }
43
+ async down(queryRunner) {
44
+ await queryRunner.dropTable(TABLE);
45
+ }
46
+ }
47
+ exports.CreateWorkflowExecution1778529600000 = CreateWorkflowExecution1778529600000;
48
+ //# sourceMappingURL=1778529600000-CreateWorkflowExecution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1778529600000-CreateWorkflowExecution.js","sourceRoot":"","sources":["../../../src/database/migrations/1778529600000-CreateWorkflowExecution.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAGjD,MAAM,KAAK,GAAG,oBAAoB,CAAC;AAEnC;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,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;gBACxC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;gBACjD,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;gBAC/C,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;gBAChC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE;gBAC5D;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;gBACD,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE;aAC5E;YACD,MAAM,EAAE;gBACP;oBACC,IAAI,EAAE,+BAA+B;oBACrC,UAAU,EAAE,qEAAqE;iBACjF;aACD;SACD,CAAC,CACF,CAAC;QAEF,MAAM,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE;YACtC,IAAI,oBAAU,CAAC,EAAE,IAAI,EAAE,oCAAoC,EAAE,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;YAC5F,IAAI,oBAAU,CAAC,EAAE,IAAI,EAAE,+BAA+B,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;SAClF,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAAwB;QAClC,MAAM,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACD"}
@@ -0,0 +1,5 @@
1
+ import type { MigrationInterface, QueryRunner } from '@n8n/typeorm';
2
+ export declare class CreateWorkflowStepExecution1784890100000 implements MigrationInterface {
3
+ up(queryRunner: QueryRunner): Promise<void>;
4
+ down(queryRunner: QueryRunner): Promise<void>;
5
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateWorkflowStepExecution1784890100000 = void 0;
4
+ const typeorm_1 = require("@n8n/typeorm");
5
+ const TABLE = 'workflow_step_execution';
6
+ class CreateWorkflowStepExecution1784890100000 {
7
+ async up(queryRunner) {
8
+ await queryRunner.createTable(new typeorm_1.Table({
9
+ name: TABLE,
10
+ columns: [
11
+ { name: 'id', type: 'uuid', isPrimary: true },
12
+ { name: 'execution_id', type: 'uuid' },
13
+ { name: 'node_id', type: 'varchar' },
14
+ { name: 'status', type: 'varchar', length: '32' },
15
+ {
16
+ name: 'outputs',
17
+ type: 'jsonb',
18
+ isNullable: true,
19
+ comment: 'Step outputs, persisted without inspection and reloaded as downstream inputs. Shape is step-type-specific.',
20
+ },
21
+ {
22
+ name: 'error',
23
+ type: 'jsonb',
24
+ isNullable: true,
25
+ comment: 'Name and message of the error that failed this step.',
26
+ },
27
+ {
28
+ name: 'created_at',
29
+ type: 'timestamptz',
30
+ precision: 3,
31
+ default: 'CURRENT_TIMESTAMP(3)',
32
+ },
33
+ {
34
+ name: 'updated_at',
35
+ type: 'timestamptz',
36
+ precision: 3,
37
+ default: 'CURRENT_TIMESTAMP(3)',
38
+ },
39
+ ],
40
+ indices: [
41
+ {
42
+ name: 'idx_workflow_step_execution_execution_id_node_id',
43
+ columnNames: ['execution_id', 'node_id'],
44
+ },
45
+ ],
46
+ foreignKeys: [
47
+ {
48
+ columnNames: ['execution_id'],
49
+ referencedTableName: 'workflow_execution',
50
+ referencedColumnNames: ['id'],
51
+ onDelete: 'CASCADE',
52
+ },
53
+ ],
54
+ checks: [
55
+ {
56
+ name: 'chk_workflow_step_execution_status',
57
+ expression: "status IN ('queued', 'running', 'completed', 'failed', 'cancelled')",
58
+ },
59
+ ],
60
+ }));
61
+ }
62
+ async down(queryRunner) {
63
+ await queryRunner.dropTable(TABLE);
64
+ }
65
+ }
66
+ exports.CreateWorkflowStepExecution1784890100000 = CreateWorkflowStepExecution1784890100000;
67
+ //# sourceMappingURL=1784890100000-CreateWorkflowStepExecution.js.map
@@ -0,0 +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,kDAAkD;oBACxD,WAAW,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC;iBACxC;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,EAAE,qEAAqE;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"}
@@ -0,0 +1,2 @@
1
+ import { CreateWorkflowExecution1778529600000 } from './1778529600000-CreateWorkflowExecution';
2
+ export declare const migrations: (typeof CreateWorkflowExecution1778529600000)[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrations = void 0;
4
+ const _1778529600000_CreateWorkflowExecution_1 = require("./1778529600000-CreateWorkflowExecution");
5
+ const _1784890100000_CreateWorkflowStepExecution_1 = require("./1784890100000-CreateWorkflowStepExecution");
6
+ exports.migrations = [
7
+ _1778529600000_CreateWorkflowExecution_1.CreateWorkflowExecution1778529600000,
8
+ _1784890100000_CreateWorkflowStepExecution_1.CreateWorkflowStepExecution1784890100000,
9
+ ];
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/migrations/index.ts"],"names":[],"mappings":";;;AAAA,oGAA+F;AAC/F,4GAAuG;AAE1F,QAAA,UAAU,GAAG;IACzB,6EAAoC;IACpC,qFAAwC;CACxC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Repository } from '@n8n/typeorm';
2
+ import type { WorkflowExecution } from './entities';
3
+ import { type ExecutionRecord, type ExecutionStore, type NewExecutionRecord } from '../execution/execution-store';
4
+ import type { ExecutionStatus } from '../execution/execution.types';
5
+ export declare class TypeOrmExecutionStore implements ExecutionStore {
6
+ private readonly repo;
7
+ constructor(repo: Repository<WorkflowExecution>);
8
+ createExecution(record: NewExecutionRecord): Promise<{
9
+ id: string;
10
+ }>;
11
+ loadExecution(id: string): Promise<ExecutionRecord>;
12
+ transitionStatus(id: string, from: ExecutionStatus, to: ExecutionStatus): Promise<boolean>;
13
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeOrmExecutionStore = void 0;
4
+ const execution_store_1 = require("../execution/execution-store");
5
+ class TypeOrmExecutionStore {
6
+ repo;
7
+ constructor(repo) {
8
+ this.repo = repo;
9
+ }
10
+ async createExecution(record) {
11
+ const execution = this.repo.create({ ...record, finishedAt: null });
12
+ await this.repo.insert(execution);
13
+ return { id: execution.id };
14
+ }
15
+ async loadExecution(id) {
16
+ const row = await this.repo.findOneBy({ id });
17
+ if (!row)
18
+ throw new execution_store_1.ExecutionNotFoundError(id);
19
+ return row;
20
+ }
21
+ async transitionStatus(id, from, to) {
22
+ const result = await this.repo.update({ id, status: from }, { status: to });
23
+ return result.affected === 1;
24
+ }
25
+ }
26
+ exports.TypeOrmExecutionStore = TypeOrmExecutionStore;
27
+ //# sourceMappingURL=typeorm-execution-store.js.map
@@ -0,0 +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;QAC7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9C,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;CACD"}
@@ -0,0 +1,17 @@
1
+ import { type Repository } from '@n8n/typeorm';
2
+ import type { WorkflowStepExecution } from './entities';
3
+ import type { JsonValue } from '../common';
4
+ import { type NewStepRecord, type StepError, type StepRecord, type StepStore } from '../execution/step-store';
5
+ export declare class TypeOrmStepStore implements StepStore {
6
+ private readonly repo;
7
+ constructor(repo: Repository<WorkflowStepExecution>);
8
+ createSteps(records: NewStepRecord[]): Promise<Array<{
9
+ id: string;
10
+ }>>;
11
+ loadStep(id: string): Promise<StepRecord>;
12
+ claimStep(id: string): Promise<boolean>;
13
+ completeStep(id: string, outputs: JsonValue): Promise<boolean>;
14
+ failStep(id: string, error: StepError): Promise<boolean>;
15
+ private transition;
16
+ loadStepOutputs(executionId: string, nodeIds: string[]): Promise<Record<string, JsonValue | null>>;
17
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeOrmStepStore = void 0;
4
+ const typeorm_1 = require("@n8n/typeorm");
5
+ const step_store_1 = require("../execution/step-store");
6
+ class TypeOrmStepStore {
7
+ repo;
8
+ constructor(repo) {
9
+ this.repo = repo;
10
+ }
11
+ async createSteps(records) {
12
+ const steps = records.map((record) => this.repo.create(record));
13
+ await this.repo.insert(steps);
14
+ return steps.map(({ id }) => ({ id }));
15
+ }
16
+ async loadStep(id) {
17
+ const row = await this.repo.findOne({ where: { id } });
18
+ if (!row)
19
+ throw new step_store_1.StepNotFoundError(id);
20
+ return row;
21
+ }
22
+ async claimStep(id) {
23
+ return await this.transition(id, 'queued', 'running');
24
+ }
25
+ async completeStep(id, outputs) {
26
+ return await this.transition(id, 'running', 'completed', { outputs });
27
+ }
28
+ async failStep(id, error) {
29
+ return await this.transition(id, 'running', 'failed', { error });
30
+ }
31
+ async transition(id, from, to, fields = {}) {
32
+ const result = await this.repo.update({ id, status: from }, { ...fields, status: to });
33
+ return result.affected === 1;
34
+ }
35
+ async loadStepOutputs(executionId, nodeIds) {
36
+ const outputsByNodeId = {};
37
+ for (const nodeId of nodeIds)
38
+ outputsByNodeId[nodeId] = null;
39
+ if (nodeIds.length === 0)
40
+ return outputsByNodeId;
41
+ const rows = await this.repo.find({
42
+ where: { executionId, nodeId: (0, typeorm_1.In)(nodeIds), status: 'completed' },
43
+ select: ['nodeId', 'outputs'],
44
+ });
45
+ for (const row of rows)
46
+ outputsByNodeId[row.nodeId] = row.outputs;
47
+ return outputsByNodeId;
48
+ }
49
+ }
50
+ exports.TypeOrmStepStore = TypeOrmStepStore;
51
+ //# sourceMappingURL=typeorm-step-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeorm-step-store.js","sourceRoot":"","sources":["../../src/database/typeorm-step-store.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AAKnD,wDAMiC;AAGjC;IAC8B,IAAI;IAAjC,YAA6B,IAAuC;oBAAvC,IAAI;IAAsC,CAAC;IAExE,KAAK,CAAC,WAAW,CAAC,OAAwB;QACzC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAEhE,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU;QAGxB,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,8BAAiB,CAAC,EAAE,CAAC,CAAC;QAC1C,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,EAAU;QACzB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAU,EAAE,OAAkB;QAChD,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,KAAgB;QAC1C,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,CAAC;IAMO,KAAK,CAAC,UAAU,CACvB,EAAU,EACV,IAAgB,EAChB,EAAc,EACd,MAAM,GAA+C,EAAE;QAEvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACvF,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,eAAe,CACpB,WAAmB,EACnB,OAAiB;QAEjB,MAAM,eAAe,GAAqC,EAAE,CAAC;QAC7D,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAC7D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,eAAe,CAAC;QAIjD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YACjC,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,IAAA,YAAE,EAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE;YAChE,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC7B,CAAC,CAAC;QACH,KAAK,MAAM,GAAG,IAAI,IAAI;YAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;QAElE,OAAO,eAAe,CAAC;IACxB,CAAC;CACD"}