@n8n/engine 0.17.0 → 0.18.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 (145) hide show
  1. package/dist/auth/action-token.d.ts +7 -0
  2. package/dist/auth/action-token.js +30 -0
  3. package/dist/auth/action-token.js.map +1 -0
  4. package/dist/auth/authenticate.d.ts +2 -1
  5. package/dist/auth/authenticate.js +3 -2
  6. package/dist/auth/authenticate.js.map +1 -1
  7. package/dist/auth/identity-token.d.ts +3 -5
  8. package/dist/auth/identity-token.js +17 -38
  9. package/dist/auth/identity-token.js.map +1 -1
  10. package/dist/auth/index.d.ts +3 -1
  11. package/dist/auth/index.js +7 -5
  12. package/dist/auth/index.js.map +1 -1
  13. package/dist/auth/shared-secret-token.d.ts +12 -0
  14. package/dist/auth/shared-secret-token.js +44 -0
  15. package/dist/auth/shared-secret-token.js.map +1 -0
  16. package/dist/build.tsbuildinfo +1 -1
  17. package/dist/common/index.d.ts +1 -0
  18. package/dist/common/index.js +3 -1
  19. package/dist/common/index.js.map +1 -1
  20. package/dist/common/json.schema.d.ts +3 -0
  21. package/dist/common/json.schema.js +13 -0
  22. package/dist/common/json.schema.js.map +1 -0
  23. package/dist/database/create-stores.d.ts +2 -0
  24. package/dist/database/create-stores.js +6 -2
  25. package/dist/database/create-stores.js.map +1 -1
  26. package/dist/database/entities/workflow-execution.entity.d.ts +0 -1
  27. package/dist/database/entities/workflow-execution.entity.js +0 -11
  28. package/dist/database/entities/workflow-execution.entity.js.map +1 -1
  29. package/dist/database/entities/workflow-step-execution.entity.d.ts +1 -2
  30. package/dist/database/entities/workflow-step-execution.entity.js.map +1 -1
  31. package/dist/database/index.d.ts +1 -0
  32. package/dist/database/index.js +3 -1
  33. package/dist/database/index.js.map +1 -1
  34. package/dist/database/typeorm-execution-store.d.ts +1 -3
  35. package/dist/database/typeorm-execution-store.js +0 -1
  36. package/dist/database/typeorm-execution-store.js.map +1 -1
  37. package/dist/database/typeorm-execution-view-store.d.ts +10 -0
  38. package/dist/database/typeorm-execution-view-store.js +49 -0
  39. package/dist/database/typeorm-execution-view-store.js.map +1 -0
  40. package/dist/database/typeorm-step-store.d.ts +3 -2
  41. package/dist/database/typeorm-step-store.js +6 -1
  42. package/dist/database/typeorm-step-store.js.map +1 -1
  43. package/dist/dependencies/external-dependencies.d.ts +3 -0
  44. package/dist/execution/batch-step.d.ts +8 -0
  45. package/dist/execution/batch-step.js +28 -0
  46. package/dist/execution/batch-step.js.map +1 -0
  47. package/dist/execution/completion.js.map +1 -1
  48. package/dist/execution/execution-query.service.d.ts +7 -0
  49. package/dist/execution/execution-query.service.js +17 -0
  50. package/dist/execution/execution-query.service.js.map +1 -0
  51. package/dist/execution/execution-start-handler.d.ts +3 -1
  52. package/dist/execution/execution-start-handler.js +10 -1
  53. package/dist/execution/execution-start-handler.js.map +1 -1
  54. package/dist/execution/execution-store.d.ts +2 -3
  55. package/dist/execution/execution-store.js.map +1 -1
  56. package/dist/execution/execution-view-store.d.ts +26 -0
  57. package/dist/execution/execution-view-store.js +3 -0
  58. package/dist/execution/execution-view-store.js.map +1 -0
  59. package/dist/execution/execution.types.d.ts +6 -0
  60. package/dist/execution/execution.types.js.map +1 -1
  61. package/dist/execution/index.d.ts +4 -2
  62. package/dist/execution/index.js +3 -1
  63. package/dist/execution/index.js.map +1 -1
  64. package/dist/execution/loop-ledger.d.ts +2 -2
  65. package/dist/execution/loop-ledger.js +4 -3
  66. package/dist/execution/loop-ledger.js.map +1 -1
  67. package/dist/execution/settlement.js.map +1 -1
  68. package/dist/execution/start-execution.service.d.ts +1 -0
  69. package/dist/execution/start-execution.service.js +5 -3
  70. package/dist/execution/start-execution.service.js.map +1 -1
  71. package/dist/execution/step-ready-handler.d.ts +4 -1
  72. package/dist/execution/step-ready-handler.js +37 -3
  73. package/dist/execution/step-ready-handler.js.map +1 -1
  74. package/dist/execution/step-settled-handler.d.ts +3 -1
  75. package/dist/execution/step-settled-handler.js +25 -7
  76. package/dist/execution/step-settled-handler.js.map +1 -1
  77. package/dist/execution/step-store.d.ts +2 -9
  78. package/dist/execution/step-store.js.map +1 -1
  79. package/dist/execution/store-loop-reader.d.ts +4 -0
  80. package/dist/execution/store-loop-reader.js +48 -0
  81. package/dist/execution/store-loop-reader.js.map +1 -0
  82. package/dist/graph/index.d.ts +2 -1
  83. package/dist/graph/index.js +3 -1
  84. package/dist/graph/index.js.map +1 -1
  85. package/dist/graph/loops.d.ts +1 -1
  86. package/dist/graph/loops.js +11 -0
  87. package/dist/graph/loops.js.map +1 -1
  88. package/dist/graph/validate-executable-graph.js +4 -3
  89. package/dist/graph/validate-executable-graph.js.map +1 -1
  90. package/dist/graph/workflow-graph.d.ts +4 -0
  91. package/dist/graph/workflow-graph.js +7 -0
  92. package/dist/graph/workflow-graph.js.map +1 -1
  93. package/dist/index.d.ts +9 -5
  94. package/dist/index.js +13 -1
  95. package/dist/index.js.map +1 -1
  96. package/dist/lifecycle-events/batching-lifecycle-event-publisher.d.ts +26 -0
  97. package/dist/lifecycle-events/batching-lifecycle-event-publisher.js +121 -0
  98. package/dist/lifecycle-events/batching-lifecycle-event-publisher.js.map +1 -0
  99. package/dist/lifecycle-events/index.d.ts +6 -0
  100. package/dist/lifecycle-events/index.js +15 -0
  101. package/dist/lifecycle-events/index.js.map +1 -0
  102. package/dist/lifecycle-events/lifecycle-event-publisher.d.ts +6 -0
  103. package/dist/lifecycle-events/lifecycle-event-publisher.js +8 -0
  104. package/dist/lifecycle-events/lifecycle-event-publisher.js.map +1 -0
  105. package/dist/lifecycle-events/lifecycle-event.schema.d.ts +339 -0
  106. package/dist/lifecycle-events/lifecycle-event.schema.js +39 -0
  107. package/dist/lifecycle-events/lifecycle-event.schema.js.map +1 -0
  108. package/dist/lifecycle-events/lifecycle-event.types.d.ts +4 -0
  109. package/dist/lifecycle-events/lifecycle-event.types.js +3 -0
  110. package/dist/lifecycle-events/lifecycle-event.types.js.map +1 -0
  111. package/dist/logging/console-logger.d.ts +2 -0
  112. package/dist/logging/console-logger.js +18 -0
  113. package/dist/logging/console-logger.js.map +1 -0
  114. package/dist/logging/index.d.ts +2 -0
  115. package/dist/logging/index.js +6 -0
  116. package/dist/logging/index.js.map +1 -0
  117. package/dist/logging/logger.types.d.ts +6 -0
  118. package/dist/logging/logger.types.js +3 -0
  119. package/dist/logging/logger.types.js.map +1 -0
  120. package/dist/queue/in-memory-work-queue.d.ts +3 -0
  121. package/dist/queue/in-memory-work-queue.js +7 -2
  122. package/dist/queue/in-memory-work-queue.js.map +1 -1
  123. package/dist/runtime/create-engine-runtime.d.ts +3 -1
  124. package/dist/runtime/create-engine-runtime.js +19 -7
  125. package/dist/runtime/create-engine-runtime.js.map +1 -1
  126. package/dist/serve.js +7 -4
  127. package/dist/serve.js.map +1 -1
  128. package/dist/server/api.types.d.ts +25 -0
  129. package/dist/server/api.types.js +3 -0
  130. package/dist/server/api.types.js.map +1 -0
  131. package/dist/server/create-engine-server.d.ts +9 -1
  132. package/dist/server/create-engine-server.js +3 -3
  133. package/dist/server/create-engine-server.js.map +1 -1
  134. package/dist/server/index.d.ts +2 -0
  135. package/dist/server/index.js.map +1 -1
  136. package/dist/server/routes/workflow-executions.d.ts +2 -2
  137. package/dist/server/routes/workflow-executions.handlers.d.ts +4 -0
  138. package/dist/server/routes/workflow-executions.handlers.js +68 -0
  139. package/dist/server/routes/workflow-executions.handlers.js.map +1 -0
  140. package/dist/server/routes/workflow-executions.js +10 -13
  141. package/dist/server/routes/workflow-executions.js.map +1 -1
  142. package/dist/testing/start-engine-server.d.ts +2 -3
  143. package/dist/testing/start-engine-server.js +2 -2
  144. package/dist/testing/start-engine-server.js.map +1 -1
  145. package/package.json +10 -9
@@ -0,0 +1,339 @@
1
+ import { z } from 'zod';
2
+ export declare const MAX_LIFECYCLE_EVENTS_PER_BATCH = 500;
3
+ export declare const lifecycleEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
4
+ executionId: z.ZodString;
5
+ workflowId: z.ZodString;
6
+ at: z.ZodString;
7
+ type: z.ZodLiteral<"execution:started">;
8
+ mode: z.ZodEnum<["production", "manual"]>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ executionId: string;
11
+ workflowId: string;
12
+ at: string;
13
+ type: "execution:started";
14
+ mode: "manual" | "production";
15
+ }, {
16
+ executionId: string;
17
+ workflowId: string;
18
+ at: string;
19
+ type: "execution:started";
20
+ mode: "manual" | "production";
21
+ }>, z.ZodObject<{
22
+ executionId: z.ZodString;
23
+ workflowId: z.ZodString;
24
+ at: z.ZodString;
25
+ type: z.ZodLiteral<"execution:completed">;
26
+ }, "strip", z.ZodTypeAny, {
27
+ executionId: string;
28
+ workflowId: string;
29
+ at: string;
30
+ type: "execution:completed";
31
+ }, {
32
+ executionId: string;
33
+ workflowId: string;
34
+ at: string;
35
+ type: "execution:completed";
36
+ }>, z.ZodObject<{
37
+ executionId: z.ZodString;
38
+ workflowId: z.ZodString;
39
+ at: z.ZodString;
40
+ type: z.ZodLiteral<"execution:failed">;
41
+ }, "strip", z.ZodTypeAny, {
42
+ executionId: string;
43
+ workflowId: string;
44
+ at: string;
45
+ type: "execution:failed";
46
+ }, {
47
+ executionId: string;
48
+ workflowId: string;
49
+ at: string;
50
+ type: "execution:failed";
51
+ }>, z.ZodObject<{
52
+ executionId: z.ZodString;
53
+ stepId: z.ZodString;
54
+ nodeId: z.ZodString;
55
+ nodeName: z.ZodString;
56
+ iteration: z.ZodNumber;
57
+ at: z.ZodString;
58
+ type: z.ZodLiteral<"step:started">;
59
+ }, "strip", z.ZodTypeAny, {
60
+ executionId: string;
61
+ stepId: string;
62
+ nodeId: string;
63
+ nodeName: string;
64
+ iteration: number;
65
+ at: string;
66
+ type: "step:started";
67
+ }, {
68
+ executionId: string;
69
+ stepId: string;
70
+ nodeId: string;
71
+ nodeName: string;
72
+ iteration: number;
73
+ at: string;
74
+ type: "step:started";
75
+ }>, z.ZodObject<{
76
+ executionId: z.ZodString;
77
+ stepId: z.ZodString;
78
+ nodeId: z.ZodString;
79
+ nodeName: z.ZodString;
80
+ iteration: z.ZodNumber;
81
+ at: z.ZodString;
82
+ type: z.ZodLiteral<"step:completed">;
83
+ outputs: z.ZodArray<z.ZodType<import("../common").JsonValue, z.ZodTypeDef, import("../common").JsonValue>, "many">;
84
+ }, "strip", z.ZodTypeAny, {
85
+ executionId: string;
86
+ stepId: string;
87
+ nodeId: string;
88
+ nodeName: string;
89
+ iteration: number;
90
+ at: string;
91
+ type: "step:completed";
92
+ outputs: import("../common").JsonValue[];
93
+ }, {
94
+ executionId: string;
95
+ stepId: string;
96
+ nodeId: string;
97
+ nodeName: string;
98
+ iteration: number;
99
+ at: string;
100
+ type: "step:completed";
101
+ outputs: import("../common").JsonValue[];
102
+ }>, z.ZodObject<{
103
+ executionId: z.ZodString;
104
+ stepId: z.ZodString;
105
+ nodeId: z.ZodString;
106
+ nodeName: z.ZodString;
107
+ iteration: z.ZodNumber;
108
+ at: z.ZodString;
109
+ type: z.ZodLiteral<"step:failed">;
110
+ }, "strip", z.ZodTypeAny, {
111
+ executionId: string;
112
+ stepId: string;
113
+ nodeId: string;
114
+ nodeName: string;
115
+ iteration: number;
116
+ at: string;
117
+ type: "step:failed";
118
+ }, {
119
+ executionId: string;
120
+ stepId: string;
121
+ nodeId: string;
122
+ nodeName: string;
123
+ iteration: number;
124
+ at: string;
125
+ type: "step:failed";
126
+ }>]>;
127
+ export declare const lifecycleEventBatchSchema: z.ZodObject<{
128
+ events: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
129
+ executionId: z.ZodString;
130
+ workflowId: z.ZodString;
131
+ at: z.ZodString;
132
+ type: z.ZodLiteral<"execution:started">;
133
+ mode: z.ZodEnum<["production", "manual"]>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ executionId: string;
136
+ workflowId: string;
137
+ at: string;
138
+ type: "execution:started";
139
+ mode: "manual" | "production";
140
+ }, {
141
+ executionId: string;
142
+ workflowId: string;
143
+ at: string;
144
+ type: "execution:started";
145
+ mode: "manual" | "production";
146
+ }>, z.ZodObject<{
147
+ executionId: z.ZodString;
148
+ workflowId: z.ZodString;
149
+ at: z.ZodString;
150
+ type: z.ZodLiteral<"execution:completed">;
151
+ }, "strip", z.ZodTypeAny, {
152
+ executionId: string;
153
+ workflowId: string;
154
+ at: string;
155
+ type: "execution:completed";
156
+ }, {
157
+ executionId: string;
158
+ workflowId: string;
159
+ at: string;
160
+ type: "execution:completed";
161
+ }>, z.ZodObject<{
162
+ executionId: z.ZodString;
163
+ workflowId: z.ZodString;
164
+ at: z.ZodString;
165
+ type: z.ZodLiteral<"execution:failed">;
166
+ }, "strip", z.ZodTypeAny, {
167
+ executionId: string;
168
+ workflowId: string;
169
+ at: string;
170
+ type: "execution:failed";
171
+ }, {
172
+ executionId: string;
173
+ workflowId: string;
174
+ at: string;
175
+ type: "execution:failed";
176
+ }>, z.ZodObject<{
177
+ executionId: z.ZodString;
178
+ stepId: z.ZodString;
179
+ nodeId: z.ZodString;
180
+ nodeName: z.ZodString;
181
+ iteration: z.ZodNumber;
182
+ at: z.ZodString;
183
+ type: z.ZodLiteral<"step:started">;
184
+ }, "strip", z.ZodTypeAny, {
185
+ executionId: string;
186
+ stepId: string;
187
+ nodeId: string;
188
+ nodeName: string;
189
+ iteration: number;
190
+ at: string;
191
+ type: "step:started";
192
+ }, {
193
+ executionId: string;
194
+ stepId: string;
195
+ nodeId: string;
196
+ nodeName: string;
197
+ iteration: number;
198
+ at: string;
199
+ type: "step:started";
200
+ }>, z.ZodObject<{
201
+ executionId: z.ZodString;
202
+ stepId: z.ZodString;
203
+ nodeId: z.ZodString;
204
+ nodeName: z.ZodString;
205
+ iteration: z.ZodNumber;
206
+ at: z.ZodString;
207
+ type: z.ZodLiteral<"step:completed">;
208
+ outputs: z.ZodArray<z.ZodType<import("../common").JsonValue, z.ZodTypeDef, import("../common").JsonValue>, "many">;
209
+ }, "strip", z.ZodTypeAny, {
210
+ executionId: string;
211
+ stepId: string;
212
+ nodeId: string;
213
+ nodeName: string;
214
+ iteration: number;
215
+ at: string;
216
+ type: "step:completed";
217
+ outputs: import("../common").JsonValue[];
218
+ }, {
219
+ executionId: string;
220
+ stepId: string;
221
+ nodeId: string;
222
+ nodeName: string;
223
+ iteration: number;
224
+ at: string;
225
+ type: "step:completed";
226
+ outputs: import("../common").JsonValue[];
227
+ }>, z.ZodObject<{
228
+ executionId: z.ZodString;
229
+ stepId: z.ZodString;
230
+ nodeId: z.ZodString;
231
+ nodeName: z.ZodString;
232
+ iteration: z.ZodNumber;
233
+ at: z.ZodString;
234
+ type: z.ZodLiteral<"step:failed">;
235
+ }, "strip", z.ZodTypeAny, {
236
+ executionId: string;
237
+ stepId: string;
238
+ nodeId: string;
239
+ nodeName: string;
240
+ iteration: number;
241
+ at: string;
242
+ type: "step:failed";
243
+ }, {
244
+ executionId: string;
245
+ stepId: string;
246
+ nodeId: string;
247
+ nodeName: string;
248
+ iteration: number;
249
+ at: string;
250
+ type: "step:failed";
251
+ }>]>, "many">;
252
+ }, "strip", z.ZodTypeAny, {
253
+ events: ({
254
+ executionId: string;
255
+ workflowId: string;
256
+ at: string;
257
+ type: "execution:started";
258
+ mode: "manual" | "production";
259
+ } | {
260
+ executionId: string;
261
+ workflowId: string;
262
+ at: string;
263
+ type: "execution:completed";
264
+ } | {
265
+ executionId: string;
266
+ workflowId: string;
267
+ at: string;
268
+ type: "execution:failed";
269
+ } | {
270
+ executionId: string;
271
+ stepId: string;
272
+ nodeId: string;
273
+ nodeName: string;
274
+ iteration: number;
275
+ at: string;
276
+ type: "step:started";
277
+ } | {
278
+ executionId: string;
279
+ stepId: string;
280
+ nodeId: string;
281
+ nodeName: string;
282
+ iteration: number;
283
+ at: string;
284
+ type: "step:completed";
285
+ outputs: import("../common").JsonValue[];
286
+ } | {
287
+ executionId: string;
288
+ stepId: string;
289
+ nodeId: string;
290
+ nodeName: string;
291
+ iteration: number;
292
+ at: string;
293
+ type: "step:failed";
294
+ })[];
295
+ }, {
296
+ events: ({
297
+ executionId: string;
298
+ workflowId: string;
299
+ at: string;
300
+ type: "execution:started";
301
+ mode: "manual" | "production";
302
+ } | {
303
+ executionId: string;
304
+ workflowId: string;
305
+ at: string;
306
+ type: "execution:completed";
307
+ } | {
308
+ executionId: string;
309
+ workflowId: string;
310
+ at: string;
311
+ type: "execution:failed";
312
+ } | {
313
+ executionId: string;
314
+ stepId: string;
315
+ nodeId: string;
316
+ nodeName: string;
317
+ iteration: number;
318
+ at: string;
319
+ type: "step:started";
320
+ } | {
321
+ executionId: string;
322
+ stepId: string;
323
+ nodeId: string;
324
+ nodeName: string;
325
+ iteration: number;
326
+ at: string;
327
+ type: "step:completed";
328
+ outputs: import("../common").JsonValue[];
329
+ } | {
330
+ executionId: string;
331
+ stepId: string;
332
+ nodeId: string;
333
+ nodeName: string;
334
+ iteration: number;
335
+ at: string;
336
+ type: "step:failed";
337
+ })[];
338
+ }>;
339
+ export type LifecycleEventBatch = z.infer<typeof lifecycleEventBatchSchema>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lifecycleEventBatchSchema = exports.lifecycleEventSchema = exports.MAX_LIFECYCLE_EVENTS_PER_BATCH = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../common");
6
+ exports.MAX_LIFECYCLE_EVENTS_PER_BATCH = 500;
7
+ const executionFields = {
8
+ executionId: zod_1.z.string().min(1),
9
+ workflowId: zod_1.z.string().min(1),
10
+ at: zod_1.z.string().datetime(),
11
+ };
12
+ const stepFields = {
13
+ executionId: zod_1.z.string().min(1),
14
+ stepId: zod_1.z.string().min(1),
15
+ nodeId: zod_1.z.string().min(1),
16
+ nodeName: zod_1.z.string().min(1),
17
+ iteration: zod_1.z.number().int().nonnegative(),
18
+ at: zod_1.z.string().datetime(),
19
+ };
20
+ exports.lifecycleEventSchema = zod_1.z.discriminatedUnion('type', [
21
+ zod_1.z.object({
22
+ type: zod_1.z.literal('execution:started'),
23
+ ...executionFields,
24
+ mode: zod_1.z.enum(['production', 'manual']),
25
+ }),
26
+ zod_1.z.object({ type: zod_1.z.literal('execution:completed'), ...executionFields }),
27
+ zod_1.z.object({ type: zod_1.z.literal('execution:failed'), ...executionFields }),
28
+ zod_1.z.object({ type: zod_1.z.literal('step:started'), ...stepFields }),
29
+ zod_1.z.object({
30
+ type: zod_1.z.literal('step:completed'),
31
+ ...stepFields,
32
+ outputs: zod_1.z.array(common_1.jsonValueSchema),
33
+ }),
34
+ zod_1.z.object({ type: zod_1.z.literal('step:failed'), ...stepFields }),
35
+ ]);
36
+ exports.lifecycleEventBatchSchema = zod_1.z.object({
37
+ events: zod_1.z.array(exports.lifecycleEventSchema).min(1).max(exports.MAX_LIFECYCLE_EVENTS_PER_BATCH),
38
+ });
39
+ //# sourceMappingURL=lifecycle-event.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-event.schema.js","sourceRoot":"","sources":["../../src/lifecycle-events/lifecycle-event.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,sCAA4C;AAG/B,QAAA,8BAA8B,GAAG,GAAG,CAAC;AAElD,MAAM,eAAe,GAAG;IACvB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAE9B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAE7B,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACzB,CAAC;AAEF,MAAM,UAAU,GAAG;IAClB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEzB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAA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,CAAC,GAAG,CAAC,QAAA,8BAA8B,CAAC;CAChF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { z } from 'zod';
2
+ import type { lifecycleEventSchema } from './lifecycle-event.schema';
3
+ export type LifecycleEvent = z.infer<typeof lifecycleEventSchema>;
4
+ export type LifecycleEventCallback = (events: LifecycleEvent[], signal: AbortSignal) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=lifecycle-event.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-event.types.js","sourceRoot":"","sources":["../../src/lifecycle-events/lifecycle-event.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import type { EngineLogger } from './logger.types';
2
+ export declare function createConsoleLogger(scope?: string): EngineLogger;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createConsoleLogger = createConsoleLogger;
4
+ function createConsoleLogger(scope = 'engine') {
5
+ const write = (to, message, metadata) => {
6
+ if (metadata === undefined)
7
+ to(`${scope}: ${message}`);
8
+ else
9
+ to(`${scope}: ${message}`, metadata);
10
+ };
11
+ return {
12
+ error: (message, metadata) => write(console.error, message, metadata),
13
+ warn: (message, metadata) => write(console.warn, message, metadata),
14
+ info: (message, metadata) => write(console.info, message, metadata),
15
+ debug: (message, metadata) => write(console.debug, message, metadata),
16
+ };
17
+ }
18
+ //# sourceMappingURL=console-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-logger.js","sourceRoot":"","sources":["../../src/logging/console-logger.ts"],"names":[],"mappings":";;;AASA,6BAAoC,KAAK,GAAG,QAAQ;IACnD,MAAM,KAAK,GAAG,CACb,EAAiD,EACjD,OAAe,EACf,QAAkC,EAC3B,EAAE;QACT,IAAI,QAAQ,KAAK,SAAS;YAAE,EAAE,CAAC,GAAG,KAAK,KAAK,OAAO,EAAE,CAAC,CAAC;;YAClD,EAAE,CAAC,GAAG,KAAK,KAAK,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,OAAO;QACN,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;QACrE,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC;QACnE,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC;QACnE,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;KACrE,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type { EngineLogger } from './logger.types';
2
+ export { createConsoleLogger } from './console-logger';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createConsoleLogger = void 0;
4
+ var console_logger_1 = require("./console-logger");
5
+ Object.defineProperty(exports, "createConsoleLogger", { enumerable: true, get: function () { return console_logger_1.createConsoleLogger; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":";;;AACA,mDAAuD;AAA9C,qHAAA,mBAAmB,OAAA"}
@@ -0,0 +1,6 @@
1
+ export interface EngineLogger {
2
+ error(message: string, metadata?: Record<string, unknown>): void;
3
+ warn(message: string, metadata?: Record<string, unknown>): void;
4
+ info(message: string, metadata?: Record<string, unknown>): void;
5
+ debug(message: string, metadata?: Record<string, unknown>): void;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=logger.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.types.js","sourceRoot":"","sources":["../../src/logging/logger.types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,8 @@
1
+ import { type EngineLogger } from '../logging';
1
2
  import type { WorkQueue } from './work-queue.types';
2
3
  export declare class InMemoryWorkQueue<TMessage> implements WorkQueue<TMessage> {
4
+ private readonly logger;
5
+ constructor(logger?: EngineLogger);
3
6
  private pending;
4
7
  private handler;
5
8
  private dispatching;
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InMemoryWorkQueue = void 0;
4
+ const logging_1 = require("../logging");
4
5
  class InMemoryWorkQueue {
6
+ logger;
7
+ constructor(logger = (0, logging_1.createConsoleLogger)()) {
8
+ this.logger = logger;
9
+ }
5
10
  pending = [];
6
11
  handler;
7
12
  dispatching = false;
@@ -25,7 +30,7 @@ class InMemoryWorkQueue {
25
30
  return;
26
31
  this.dispatching = true;
27
32
  this.dispatchPending().catch((error) => {
28
- console.error('engine: work queue dispatch failed', error);
33
+ this.logger.error('work queue dispatch failed', { error });
29
34
  });
30
35
  }
31
36
  async dispatchPending() {
@@ -36,7 +41,7 @@ class InMemoryWorkQueue {
36
41
  await this.handler(message);
37
42
  }
38
43
  catch (error) {
39
- console.error('engine: work queue handler failed', error);
44
+ this.logger.error('work queue handler failed', { error });
40
45
  }
41
46
  }
42
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"in-memory-work-queue.js","sourceRoot":"","sources":["../../src/queue/in-memory-work-queue.ts"],"names":[],"mappings":";;;AAMA;IACS,OAAO,GAAe,EAAE,CAAC;IAEzB,OAAO,CAAqD;IAE5D,WAAW,GAAG,KAAK,CAAC;IAEpB,WAAW,GAAsB,EAAE,CAAC;IAG5C,KAAK,CAAC,OAAO,CAAC,OAAiB;Q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M,KAAK,CAAC;YAAE,OAAO;QAC3E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,eAAe;QAC5B,IAAI,CAAC;YACJ,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChD,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC;oBACJ,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC7B,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAEhB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC3D,CAAC;YACF,CAAC;QACF,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;YACjC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;YACtB,KAAK,MAAM,OAAO,IAAI,OAAO;gBAAE,OAAO,EAAE,CAAC;QAC1C,CAAC;IACF,CAAC;CACD"}
@@ -4,10 +4,12 @@ import type { AdmittanceService } from '../admittance';
4
4
  import type { IdentityVerifier } from '../auth/identity.types';
5
5
  import type { EngineStores } from '../database';
6
6
  import type { ExternalDependencies } from '../dependencies';
7
+ import { type EngineLogger } from '../logging';
7
8
  export interface EngineRuntimeOptions {
8
9
  dataSource: DataSource;
9
10
  admittance: AdmittanceService;
10
11
  identityVerifier: IdentityVerifier;
12
+ logger?: EngineLogger;
11
13
  externalDependencies?: (stores: EngineStores) => ExternalDependencies;
12
14
  }
13
15
  export interface EngineRuntime {
@@ -15,4 +17,4 @@ export interface EngineRuntime {
15
17
  start(): void;
16
18
  stop(): Promise<void>;
17
19
  }
18
- export declare function createEngineRuntime({ dataSource, admittance, identityVerifier, externalDependencies, }: EngineRuntimeOptions): EngineRuntime;
20
+ export declare function createEngineRuntime({ dataSource, admittance, identityVerifier, logger, externalDependencies, }: EngineRuntimeOptions): EngineRuntime;
@@ -3,15 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createEngineRuntime = createEngineRuntime;
4
4
  const database_1 = require("../database");
5
5
  const execution_1 = require("../execution");
6
+ const lifecycle_events_1 = require("../lifecycle-events");
7
+ const logging_1 = require("../logging");
6
8
  const queue_1 = require("../queue");
7
9
  const server_1 = require("../server");
8
- function createEngineRuntime({ dataSource, admittance, identityVerifier, externalDependencies, }) {
9
- const orchestrationQueue = new queue_1.InMemoryWorkQueue();
10
- const stepQueue = new queue_1.InMemoryWorkQueue();
11
- const { executionStore, stepStore } = (0, database_1.createStores)(dataSource);
12
- const orchestrationWorker = new execution_1.OrchestrationWorker(orchestrationQueue, new execution_1.ExecutionStartHandler(executionStore, stepStore, orchestrationQueue), new execution_1.StepSettledHandler(executionStore, stepStore, stepQueue, orchestrationQueue));
13
- const stepWorker = new execution_1.StepWorker(stepQueue, new execution_1.StepReadyHandler(executionStore, stepStore, orchestrationQueue, externalDependencies?.({ executionStore, stepStore }) ?? {}));
14
- const { app } = (0, server_1.createEngineServer)(new execution_1.StartExecutionService(admittance, executionStore, orchestrationQueue), identityVerifier);
10
+ function createEngineRuntime({ dataSource, admittance, identityVerifier, logger = (0, logging_1.createConsoleLogger)(), externalDependencies, }) {
11
+ const orchestrationQueue = new queue_1.InMemoryWorkQueue(logger);
12
+ const stepQueue = new queue_1.InMemoryWorkQueue(logger);
13
+ const { executionStore, stepStore, executionViewStore } = (0, database_1.createStores)(dataSource);
14
+ const dependencies = externalDependencies?.({ executionStore, stepStore, executionViewStore }) ?? {};
15
+ const lifecycleEventPublisher = dependencies.lifecycleEventCallback
16
+ ? new lifecycle_events_1.BatchingLifecycleEventPublisher(dependencies.lifecycleEventCallback)
17
+ : lifecycle_events_1.noopLifecycleEventPublisher;
18
+ const orchestrationWorker = new execution_1.OrchestrationWorker(orchestrationQueue, new execution_1.ExecutionStartHandler(executionStore, stepStore, orchestrationQueue, lifecycleEventPublisher), new execution_1.StepSettledHandler(executionStore, stepStore, stepQueue, orchestrationQueue, lifecycleEventPublisher));
19
+ const stepWorker = new execution_1.StepWorker(stepQueue, new execution_1.StepReadyHandler(executionStore, stepStore, orchestrationQueue, dependencies, lifecycleEventPublisher));
20
+ const { app } = (0, server_1.createEngineServer)({
21
+ startExecution: new execution_1.StartExecutionService(admittance, executionStore, orchestrationQueue),
22
+ executionQuery: new execution_1.ExecutionQueryService(executionViewStore),
23
+ identityVerifier,
24
+ logger,
25
+ });
15
26
  return {
16
27
  app,
17
28
  start: () => {
@@ -20,6 +31,7 @@ function createEngineRuntime({ dataSource, admittance, identityVerifier, externa
20
31
  },
21
32
  stop: async () => {
22
33
  await Promise.all([orchestrationWorker.stop(), stepWorker.stop()]);
34
+ await lifecycleEventPublisher.stop();
23
35
  },
24
36
  };
25
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-engine-runtime.js","sourceRoot":"","sources":["../../src/runtime/create-engine-runtime.ts"],"names":[],"mappings":";;;AAKA,0CAA2C;AAG3C,4CAOsB;AACtB,oCAA6C;AAE7C,sCAA+C;AAsC/C,6BAAoC,EACnC,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,oBAAoB,GACE;IACtB,MAAM,kBAAkB,GAAG,IAAI,yBAAiB,EAAwB,CAAC;IACzE,MAAM,SAAS,GAAG,IAAI,yBAAiB,EAAe,CAAC;IACvD,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,IAAA,uBAAY,EAAC,UAAU,CAAC,CAAC;IAE/D,MAAM,mBAAmB,GAAG,IAAI,+BAAmB,CAClD,kBAAkB,EAClB,IAAI,iCAAqB,CAAC,cAAc,EAAE,SAAS,EAAE,kBAAkB,CAAC,EACxE,IAAI,8BAAkB,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAChF,CAAC;IACF,MAAM,UAAU,GAAG,IAAI,sBAAU,CAChC,SAAS,EACT,IAAI,4BAAgB,CACnB,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EAAE,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAC3D,CACD,CAAC;IAEF,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,2BAAkB,EACjC,IAAI,iCAAqB,CAAC,UAAU,EAAE,cAAc,EAAE,kBAAkB,CAAC,EACzE,gBAAgB,CAChB,CAAC;IAEF,OAAO;QACN,GAAG;QAEH,KAAK,EAAE,GAAG,EAAE;YACX,mBAAmB,CAAC,KAAK,EAAE,CAAC;YAC5B,UAAU,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;QAED,IAAI,EAAE,KAAK,IAAI,EAAE;YAIhB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC;KACD,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"create-engine-runtime.js","sourceRoot":"","sources":["../../src/runtime/create-engine-runtime.ts"],"names":[],"mappings":";;;AAKA,0CAA2C;AAG3C,4CAQsB;AACtB,0DAAmG;AAEnG,wCAAoE;AACpE,oCAA6C;AAE7C,sCAA+C;AAwC/C,6BAAoC,EACnC,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,MAAM,GAAG,IAAA,6BAAmB,GAAE,EAC9B,oBAAoB,GACE;IACtB,MAAM,kBAAkB,GAAG,IAAI,yBAAiB,CAAuB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IhB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAEnE,MAAM,uBAAuB,CAAC,IAAI,EAAE,CAAC;QACtC,CAAC;KACD,CAAC;AACH,CAAC"}
package/dist/serve.js CHANGED
@@ -5,7 +5,9 @@ const di_1 = require("@n8n/di");
5
5
  const admittance_1 = require("./admittance");
6
6
  const auth_1 = require("./auth");
7
7
  const database_1 = require("./database");
8
+ const logging_1 = require("./logging");
8
9
  const runtime_1 = require("./runtime");
10
+ const logger = (0, logging_1.createConsoleLogger)();
9
11
  async function main() {
10
12
  const config = di_1.Container.get(config_1.EngineConfig);
11
13
  if (!config.databaseUrl) {
@@ -21,17 +23,18 @@ async function main() {
21
23
  dataSource,
22
24
  admittance: new admittance_1.AllowAllAdmittance(),
23
25
  identityVerifier: new auth_1.SharedSecretIdentityVerifier(config.authSecret),
26
+ logger,
24
27
  });
25
28
  runtime.start();
26
29
  const server = runtime.app.listen(config.port, config.host, () => {
27
- console.log(`engine: listening on http://${config.host}:${config.port}`);
30
+ logger.info(`listening on http://${config.host}:${config.port}`);
28
31
  });
29
32
  let shuttingDown = false;
30
33
  const shutdown = async (signal) => {
31
34
  if (shuttingDown)
32
35
  return;
33
36
  shuttingDown = true;
34
- console.log(`engine: received ${signal}, shutting down`);
37
+ logger.info(`received ${signal}, shutting down`);
35
38
  await new Promise((resolve, reject) => {
36
39
  server.close((error) => (error ? reject(error) : resolve()));
37
40
  });
@@ -42,7 +45,7 @@ async function main() {
42
45
  };
43
46
  const onSignal = (signal) => {
44
47
  shutdown(signal).catch((error) => {
45
- console.error('engine: error during shutdown', error);
48
+ logger.error('error during shutdown', { error });
46
49
  process.exit(1);
47
50
  });
48
51
  };
@@ -50,7 +53,7 @@ async function main() {
50
53
  process.on('SIGINT', () => onSignal('SIGINT'));
51
54
  }
52
55
  main().catch((error) => {
53
- console.error('engine: failed to start', error);
56
+ logger.error('failed to start', { error });
54
57
  process.exit(1);
55
58
  });
56
59
  //# sourceMappingURL=serve.js.map
package/dist/serve.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":";;AAAA,wCAA2C;AAC3C,gCAAoC;AAEpC,6CAAkD;AAClD,iCAAsD;AACtD,yCAA8C;AAC9C,uCAAgD;AAEhD,KAAK,UAAU,IAAI;IAClB,MAAM,MAAM,GAAG,cAAS,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC;IAI3C,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,2BAAgB,EAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACxD,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAC9B,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;IAEjC,MAAM,OAAO,GAAG,IAAA,6BAAmB,EAAC;QACnC,UAAU;QACV,UAAU,EAAE,IAAI,+BAAkB,EAAE;QACpC,gBAAgB,EAAE,IAAI,mCAA4B,CAAC,MAAM,CAAC,UAAU,CAAC;KACrE,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;QAChE,OAAO,CAAC,GAAG,CAAC,+BAA+B,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,IAAI,YAAY,GAAG,KAAK,CAAC;I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