@acmekit/workflow-engine-inmemory 2.13.1
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/README.md +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders/index.d.ts +2 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +9 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/loaders/utils.d.ts +5 -0
- package/dist/loaders/utils.d.ts.map +1 -0
- package/dist/loaders/utils.js +10 -0
- package/dist/loaders/utils.js.map +1 -0
- package/dist/migrations/Migration20231228143900.d.ts +6 -0
- package/dist/migrations/Migration20231228143900.d.ts.map +1 -0
- package/dist/migrations/Migration20231228143900.js +40 -0
- package/dist/migrations/Migration20231228143900.js.map +1 -0
- package/dist/migrations/Migration20241206101446.d.ts +5 -0
- package/dist/migrations/Migration20241206101446.d.ts.map +1 -0
- package/dist/migrations/Migration20241206101446.js +19 -0
- package/dist/migrations/Migration20241206101446.js.map +1 -0
- package/dist/migrations/Migration20250128174331.d.ts +6 -0
- package/dist/migrations/Migration20250128174331.d.ts.map +1 -0
- package/dist/migrations/Migration20250128174331.js +24 -0
- package/dist/migrations/Migration20250128174331.js.map +1 -0
- package/dist/migrations/Migration20250505092459.d.ts +6 -0
- package/dist/migrations/Migration20250505092459.d.ts.map +1 -0
- package/dist/migrations/Migration20250505092459.js +40 -0
- package/dist/migrations/Migration20250505092459.js.map +1 -0
- package/dist/migrations/Migration20250819104213.d.ts +6 -0
- package/dist/migrations/Migration20250819104213.d.ts.map +1 -0
- package/dist/migrations/Migration20250819104213.js +14 -0
- package/dist/migrations/Migration20250819104213.js.map +1 -0
- package/dist/migrations/Migration20250819110924.d.ts +6 -0
- package/dist/migrations/Migration20250819110924.d.ts.map +1 -0
- package/dist/migrations/Migration20250819110924.js +16 -0
- package/dist/migrations/Migration20250819110924.js.map +1 -0
- package/dist/migrations/Migration20250908080305.d.ts +6 -0
- package/dist/migrations/Migration20250908080305.d.ts.map +1 -0
- package/dist/migrations/Migration20250908080305.js +20 -0
- package/dist/migrations/Migration20250908080305.js.map +1 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +6 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/workflow-execution.d.ts +12 -0
- package/dist/models/workflow-execution.d.ts.map +1 -0
- package/dist/models/workflow-execution.js +60 -0
- package/dist/models/workflow-execution.js.map +1 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +27 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +19 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/workflow-orchestrator.d.ts +86 -0
- package/dist/services/workflow-orchestrator.d.ts.map +1 -0
- package/dist/services/workflow-orchestrator.js +563 -0
- package/dist/services/workflow-orchestrator.js.map +1 -0
- package/dist/services/workflows-module.d.ts +163 -0
- package/dist/services/workflows-module.d.ts.map +1 -0
- package/dist/services/workflows-module.js +208 -0
- package/dist/services/workflows-module.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/workflow-orchestrator-storage.d.ts +43 -0
- package/dist/utils/workflow-orchestrator-storage.d.ts.map +1 -0
- package/dist/utils/workflow-orchestrator-storage.js +541 -0
- package/dist/utils/workflow-orchestrator-storage.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var _InMemoryDistributedTransactionStorage_instances, _InMemoryDistributedTransactionStorage_preventRaceConditionExecutionIfNecessary;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.InMemoryDistributedTransactionStorage = void 0;
|
|
10
|
+
const core_1 = require("@acmekit/framework/mikro-orm/core");
|
|
11
|
+
const orchestration_1 = require("@acmekit/framework/orchestration");
|
|
12
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
13
|
+
const cron_parser_1 = require("cron-parser");
|
|
14
|
+
const THIRTY_MINUTES_IN_MS = 1000 * 60 * 30;
|
|
15
|
+
const doneStates = new Set([
|
|
16
|
+
utils_1.TransactionStepState.DONE,
|
|
17
|
+
utils_1.TransactionStepState.REVERTED,
|
|
18
|
+
utils_1.TransactionStepState.FAILED,
|
|
19
|
+
utils_1.TransactionStepState.SKIPPED,
|
|
20
|
+
utils_1.TransactionStepState.SKIPPED_FAILURE,
|
|
21
|
+
utils_1.TransactionStepState.TIMEOUT,
|
|
22
|
+
]);
|
|
23
|
+
const finishedStates = new Set([
|
|
24
|
+
utils_1.TransactionState.DONE,
|
|
25
|
+
utils_1.TransactionState.FAILED,
|
|
26
|
+
utils_1.TransactionState.REVERTED,
|
|
27
|
+
]);
|
|
28
|
+
const failedStates = new Set([
|
|
29
|
+
utils_1.TransactionState.FAILED,
|
|
30
|
+
utils_1.TransactionState.REVERTED,
|
|
31
|
+
]);
|
|
32
|
+
function calculateDelayFromExpression(expression) {
|
|
33
|
+
const nextTime = expression.next().getTime();
|
|
34
|
+
const now = Date.now();
|
|
35
|
+
const delay = nextTime - now;
|
|
36
|
+
// If the calculated delay is negative or zero, get the next occurrence
|
|
37
|
+
if (delay <= 0) {
|
|
38
|
+
const nextNextTime = expression.next().getTime();
|
|
39
|
+
return Math.max(1, nextNextTime - now);
|
|
40
|
+
}
|
|
41
|
+
return delay;
|
|
42
|
+
}
|
|
43
|
+
function parseNextExecution(optionsOrExpression) {
|
|
44
|
+
if (typeof optionsOrExpression === "object") {
|
|
45
|
+
if ("cron" in optionsOrExpression) {
|
|
46
|
+
const expression = (0, cron_parser_1.parseExpression)(optionsOrExpression.cron);
|
|
47
|
+
return calculateDelayFromExpression(expression);
|
|
48
|
+
}
|
|
49
|
+
if ("interval" in optionsOrExpression) {
|
|
50
|
+
return optionsOrExpression.interval;
|
|
51
|
+
}
|
|
52
|
+
return calculateDelayFromExpression(optionsOrExpression);
|
|
53
|
+
}
|
|
54
|
+
const result = parseInt(`${optionsOrExpression}`);
|
|
55
|
+
if (isNaN(result)) {
|
|
56
|
+
const expression = (0, cron_parser_1.parseExpression)(`${optionsOrExpression}`);
|
|
57
|
+
return calculateDelayFromExpression(expression);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
class InMemoryDistributedTransactionStorage {
|
|
62
|
+
constructor({ workflowExecutionService, logger, }) {
|
|
63
|
+
_InMemoryDistributedTransactionStorage_instances.add(this);
|
|
64
|
+
this.storage = {};
|
|
65
|
+
this.scheduled = new Map();
|
|
66
|
+
this.retries = new Map();
|
|
67
|
+
this.timeouts = new Map();
|
|
68
|
+
this.pendingTimers = new Set();
|
|
69
|
+
this.isLocked = new Map();
|
|
70
|
+
this.workflowExecutionService_ = workflowExecutionService;
|
|
71
|
+
this.logger_ = logger;
|
|
72
|
+
}
|
|
73
|
+
async onApplicationStart() {
|
|
74
|
+
this.clearTimeout_ = setInterval(async () => {
|
|
75
|
+
try {
|
|
76
|
+
await this.clearExpiredExecutions();
|
|
77
|
+
}
|
|
78
|
+
catch { }
|
|
79
|
+
}, THIRTY_MINUTES_IN_MS);
|
|
80
|
+
}
|
|
81
|
+
async onApplicationShutdown() {
|
|
82
|
+
clearInterval(this.clearTimeout_);
|
|
83
|
+
for (const timer of this.pendingTimers) {
|
|
84
|
+
clearTimeout(timer);
|
|
85
|
+
}
|
|
86
|
+
this.pendingTimers.clear();
|
|
87
|
+
for (const timer of this.retries.values()) {
|
|
88
|
+
clearTimeout(timer);
|
|
89
|
+
}
|
|
90
|
+
this.retries.clear();
|
|
91
|
+
for (const timer of this.timeouts.values()) {
|
|
92
|
+
clearTimeout(timer);
|
|
93
|
+
}
|
|
94
|
+
this.timeouts.clear();
|
|
95
|
+
// Clean up scheduled job timers
|
|
96
|
+
for (const job of this.scheduled.values()) {
|
|
97
|
+
clearTimeout(job.timer);
|
|
98
|
+
}
|
|
99
|
+
this.scheduled.clear();
|
|
100
|
+
}
|
|
101
|
+
setWorkflowOrchestratorService(workflowOrchestratorService) {
|
|
102
|
+
this.workflowOrchestratorService_ = workflowOrchestratorService;
|
|
103
|
+
}
|
|
104
|
+
createManagedTimer(callback, delay) {
|
|
105
|
+
const timer = setTimeout(async () => {
|
|
106
|
+
this.pendingTimers.delete(timer);
|
|
107
|
+
const res = callback();
|
|
108
|
+
if (res instanceof Promise) {
|
|
109
|
+
await res;
|
|
110
|
+
}
|
|
111
|
+
}, delay);
|
|
112
|
+
this.pendingTimers.add(timer);
|
|
113
|
+
return timer;
|
|
114
|
+
}
|
|
115
|
+
async saveToDb(data, retentionTime) {
|
|
116
|
+
const isNotStarted = data.flow.state === utils_1.TransactionState.NOT_STARTED;
|
|
117
|
+
const asyncVersion = data.flow._v;
|
|
118
|
+
const isFinished = finishedStates.has(data.flow.state);
|
|
119
|
+
const isWaitingToCompensate = data.flow.state === utils_1.TransactionState.WAITING_TO_COMPENSATE;
|
|
120
|
+
const isFlowInvoking = data.flow.state === utils_1.TransactionState.INVOKING;
|
|
121
|
+
const stepsArray = Object.values(data.flow.steps);
|
|
122
|
+
let currentStep;
|
|
123
|
+
const targetStates = isFlowInvoking
|
|
124
|
+
? new Set([
|
|
125
|
+
utils_1.TransactionStepState.INVOKING,
|
|
126
|
+
utils_1.TransactionStepState.DONE,
|
|
127
|
+
utils_1.TransactionStepState.FAILED,
|
|
128
|
+
])
|
|
129
|
+
: new Set([utils_1.TransactionStepState.COMPENSATING]);
|
|
130
|
+
for (let i = stepsArray.length - 1; i >= 0; i--) {
|
|
131
|
+
const step = stepsArray[i];
|
|
132
|
+
if (step.id === "_root") {
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
const isTargetState = targetStates.has(step.invoke?.state);
|
|
136
|
+
if (isTargetState && !currentStep) {
|
|
137
|
+
currentStep = step;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
let shouldStoreCurrentSteps = false;
|
|
142
|
+
if (currentStep) {
|
|
143
|
+
for (const step of stepsArray) {
|
|
144
|
+
if (step.id === "_root") {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (step.depth === currentStep.depth &&
|
|
148
|
+
step?.definition?.store === true) {
|
|
149
|
+
shouldStoreCurrentSteps = true;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (!(isNotStarted || isFinished || isWaitingToCompensate) &&
|
|
155
|
+
!shouldStoreCurrentSteps &&
|
|
156
|
+
!asyncVersion) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
await this.workflowExecutionService_.upsert([
|
|
160
|
+
{
|
|
161
|
+
workflow_id: data.flow.modelId,
|
|
162
|
+
transaction_id: data.flow.transactionId,
|
|
163
|
+
run_id: data.flow.runId,
|
|
164
|
+
execution: data.flow,
|
|
165
|
+
context: {
|
|
166
|
+
data: data.context,
|
|
167
|
+
errors: data.errors,
|
|
168
|
+
},
|
|
169
|
+
state: data.flow.state,
|
|
170
|
+
retention_time: retentionTime,
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
173
|
+
}
|
|
174
|
+
async deleteFromDb(data) {
|
|
175
|
+
await this.workflowExecutionService_.delete([
|
|
176
|
+
{
|
|
177
|
+
run_id: data.flow.runId,
|
|
178
|
+
},
|
|
179
|
+
]);
|
|
180
|
+
}
|
|
181
|
+
async get(key, options) {
|
|
182
|
+
const [_, workflowId, transactionId] = key.split(":");
|
|
183
|
+
const trx = await this.workflowExecutionService_
|
|
184
|
+
.list({
|
|
185
|
+
workflow_id: workflowId,
|
|
186
|
+
transaction_id: transactionId,
|
|
187
|
+
}, {
|
|
188
|
+
select: ["execution", "context"],
|
|
189
|
+
order: {
|
|
190
|
+
id: "desc",
|
|
191
|
+
},
|
|
192
|
+
take: 1,
|
|
193
|
+
})
|
|
194
|
+
.then((trx) => trx[0])
|
|
195
|
+
.catch(() => undefined);
|
|
196
|
+
if (trx) {
|
|
197
|
+
const { flow, errors } = this.storage[key]
|
|
198
|
+
? JSON.parse(JSON.stringify(this.storage[key]))
|
|
199
|
+
: {};
|
|
200
|
+
const { idempotent } = options ?? {};
|
|
201
|
+
const execution = trx.execution;
|
|
202
|
+
if (!idempotent) {
|
|
203
|
+
const isFailedOrReverted = failedStates.has(execution.state);
|
|
204
|
+
const isDone = execution.state === utils_1.TransactionState.DONE;
|
|
205
|
+
const isCancellingAndFailedOrReverted = options?.isCancelling && isFailedOrReverted;
|
|
206
|
+
const isNotCancellingAndDoneOrFailedOrReverted = !options?.isCancelling && (isDone || isFailedOrReverted);
|
|
207
|
+
if (isCancellingAndFailedOrReverted ||
|
|
208
|
+
isNotCancellingAndDoneOrFailedOrReverted) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return new orchestration_1.TransactionCheckpoint(flow ?? trx?.execution, trx?.context?.data, errors ?? trx?.context?.errors);
|
|
213
|
+
}
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
async save(key, data, ttl, options) {
|
|
217
|
+
if (this.isLocked.has(key)) {
|
|
218
|
+
throw new Error("Transaction storage is locked");
|
|
219
|
+
}
|
|
220
|
+
this.isLocked.set(key, true);
|
|
221
|
+
try {
|
|
222
|
+
/**
|
|
223
|
+
* Store the retention time only if the transaction is done, failed or reverted.
|
|
224
|
+
* From that moment, this tuple can be later on archived or deleted after the retention time.
|
|
225
|
+
*/
|
|
226
|
+
const { retentionTime } = options ?? {};
|
|
227
|
+
const hasFinished = finishedStates.has(data.flow.state);
|
|
228
|
+
await __classPrivateFieldGet(this, _InMemoryDistributedTransactionStorage_instances, "m", _InMemoryDistributedTransactionStorage_preventRaceConditionExecutionIfNecessary).call(this, {
|
|
229
|
+
data,
|
|
230
|
+
key,
|
|
231
|
+
options,
|
|
232
|
+
});
|
|
233
|
+
// Only store retention time if it's provided
|
|
234
|
+
if (retentionTime) {
|
|
235
|
+
Object.assign(data, {
|
|
236
|
+
retention_time: retentionTime,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
// Store in memory
|
|
240
|
+
const isNotStarted = data.flow.state === utils_1.TransactionState.NOT_STARTED;
|
|
241
|
+
const isManualTransactionId = !data.flow.transactionId.startsWith("auto-");
|
|
242
|
+
if (isNotStarted && isManualTransactionId) {
|
|
243
|
+
const storedData = this.storage[key];
|
|
244
|
+
if (storedData) {
|
|
245
|
+
throw new orchestration_1.SkipExecutionError("Transaction already started for transactionId: " +
|
|
246
|
+
data.flow.transactionId);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (data.flow._v) {
|
|
250
|
+
const storedData = await this.get(key, {
|
|
251
|
+
isCancelling: !!data.flow.cancelledAt,
|
|
252
|
+
});
|
|
253
|
+
orchestration_1.TransactionCheckpoint.mergeCheckpoints(data, storedData);
|
|
254
|
+
}
|
|
255
|
+
const { flow, context, errors } = data;
|
|
256
|
+
this.storage[key] = {
|
|
257
|
+
flow: JSON.parse(JSON.stringify(flow)),
|
|
258
|
+
context: JSON.parse(JSON.stringify(context)),
|
|
259
|
+
errors: [...errors],
|
|
260
|
+
};
|
|
261
|
+
// Optimize DB operations - only perform when necessary
|
|
262
|
+
if (hasFinished) {
|
|
263
|
+
if (!retentionTime) {
|
|
264
|
+
if (!flow.metadata?.parentStepIdempotencyKey) {
|
|
265
|
+
await this.deleteFromDb(data);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
await this.saveToDb(data, retentionTime);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
await this.saveToDb(data, retentionTime);
|
|
273
|
+
}
|
|
274
|
+
delete this.storage[key];
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
await this.saveToDb(data, retentionTime);
|
|
278
|
+
}
|
|
279
|
+
return data;
|
|
280
|
+
}
|
|
281
|
+
finally {
|
|
282
|
+
this.isLocked.delete(key);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
async scheduleRetry(transaction, step, timestamp, interval) {
|
|
286
|
+
const { modelId: workflowId, transactionId } = transaction;
|
|
287
|
+
const key = `${workflowId}:${transactionId}:${step.id}`;
|
|
288
|
+
const existingTimer = this.retries.get(key);
|
|
289
|
+
if (existingTimer) {
|
|
290
|
+
clearTimeout(existingTimer);
|
|
291
|
+
this.pendingTimers.delete(existingTimer);
|
|
292
|
+
}
|
|
293
|
+
const timer = this.createManagedTimer(async () => {
|
|
294
|
+
this.retries.delete(key);
|
|
295
|
+
const context = transaction.getFlow().metadata ?? {};
|
|
296
|
+
await this.workflowOrchestratorService_.run(workflowId, {
|
|
297
|
+
transactionId,
|
|
298
|
+
logOnError: true,
|
|
299
|
+
throwOnError: false,
|
|
300
|
+
context: {
|
|
301
|
+
eventGroupId: context.eventGroupId,
|
|
302
|
+
parentStepIdempotencyKey: context.parentStepIdempotencyKey,
|
|
303
|
+
preventReleaseEvents: context.preventReleaseEvents,
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
}, interval * 1e3);
|
|
307
|
+
this.retries.set(key, timer);
|
|
308
|
+
}
|
|
309
|
+
async clearRetry(transaction, step) {
|
|
310
|
+
const { modelId: workflowId, transactionId } = transaction;
|
|
311
|
+
const key = `${workflowId}:${transactionId}:${step.id}`;
|
|
312
|
+
const timer = this.retries.get(key);
|
|
313
|
+
if (timer) {
|
|
314
|
+
clearTimeout(timer);
|
|
315
|
+
this.pendingTimers.delete(timer);
|
|
316
|
+
this.retries.delete(key);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
async scheduleTransactionTimeout(transaction, timestamp, interval) {
|
|
320
|
+
const { modelId: workflowId, transactionId } = transaction;
|
|
321
|
+
const key = `${workflowId}:${transactionId}`;
|
|
322
|
+
const existingTimer = this.timeouts.get(key);
|
|
323
|
+
if (existingTimer) {
|
|
324
|
+
clearTimeout(existingTimer);
|
|
325
|
+
this.pendingTimers.delete(existingTimer);
|
|
326
|
+
}
|
|
327
|
+
const timer = this.createManagedTimer(async () => {
|
|
328
|
+
this.timeouts.delete(key);
|
|
329
|
+
const context = transaction.getFlow().metadata ?? {};
|
|
330
|
+
await this.workflowOrchestratorService_.run(workflowId, {
|
|
331
|
+
transactionId,
|
|
332
|
+
logOnError: true,
|
|
333
|
+
throwOnError: false,
|
|
334
|
+
context: {
|
|
335
|
+
eventGroupId: context.eventGroupId,
|
|
336
|
+
parentStepIdempotencyKey: context.parentStepIdempotencyKey,
|
|
337
|
+
preventReleaseEvents: context.preventReleaseEvents,
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
}, interval * 1e3);
|
|
341
|
+
this.timeouts.set(key, timer);
|
|
342
|
+
}
|
|
343
|
+
async clearTransactionTimeout(transaction) {
|
|
344
|
+
const { modelId: workflowId, transactionId } = transaction;
|
|
345
|
+
const key = `${workflowId}:${transactionId}`;
|
|
346
|
+
const timer = this.timeouts.get(key);
|
|
347
|
+
if (timer) {
|
|
348
|
+
clearTimeout(timer);
|
|
349
|
+
this.pendingTimers.delete(timer);
|
|
350
|
+
this.timeouts.delete(key);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
async scheduleStepTimeout(transaction, step, timestamp, interval) {
|
|
354
|
+
const { modelId: workflowId, transactionId } = transaction;
|
|
355
|
+
const key = `${workflowId}:${transactionId}:${step.id}`;
|
|
356
|
+
const existingTimer = this.timeouts.get(key);
|
|
357
|
+
if (existingTimer) {
|
|
358
|
+
clearTimeout(existingTimer);
|
|
359
|
+
this.pendingTimers.delete(existingTimer);
|
|
360
|
+
}
|
|
361
|
+
const timer = this.createManagedTimer(async () => {
|
|
362
|
+
this.timeouts.delete(key);
|
|
363
|
+
const context = transaction.getFlow().metadata ?? {};
|
|
364
|
+
await this.workflowOrchestratorService_.run(workflowId, {
|
|
365
|
+
transactionId,
|
|
366
|
+
logOnError: true,
|
|
367
|
+
throwOnError: false,
|
|
368
|
+
context: {
|
|
369
|
+
eventGroupId: context.eventGroupId,
|
|
370
|
+
parentStepIdempotencyKey: context.parentStepIdempotencyKey,
|
|
371
|
+
preventReleaseEvents: context.preventReleaseEvents,
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
}, interval * 1e3);
|
|
375
|
+
this.timeouts.set(key, timer);
|
|
376
|
+
}
|
|
377
|
+
async clearStepTimeout(transaction, step) {
|
|
378
|
+
const { modelId: workflowId, transactionId } = transaction;
|
|
379
|
+
const key = `${workflowId}:${transactionId}:${step.id}`;
|
|
380
|
+
const timer = this.timeouts.get(key);
|
|
381
|
+
if (timer) {
|
|
382
|
+
clearTimeout(timer);
|
|
383
|
+
this.pendingTimers.delete(timer);
|
|
384
|
+
this.timeouts.delete(key);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/* Scheduler storage methods */
|
|
388
|
+
async schedule(jobDefinition, schedulerOptions) {
|
|
389
|
+
const jobId = typeof jobDefinition === "string" ? jobDefinition : jobDefinition.jobId;
|
|
390
|
+
// In order to ensure that the schedule configuration is always up to date, we first cancel an existing job, if there was one
|
|
391
|
+
await this.remove(jobId);
|
|
392
|
+
let expression;
|
|
393
|
+
let nextExecution = parseNextExecution(schedulerOptions);
|
|
394
|
+
if ("cron" in schedulerOptions) {
|
|
395
|
+
// Cache the parsed expression to avoid repeated parsing
|
|
396
|
+
expression = (0, cron_parser_1.parseExpression)(schedulerOptions.cron);
|
|
397
|
+
}
|
|
398
|
+
else if ("interval" in schedulerOptions) {
|
|
399
|
+
expression = schedulerOptions.interval;
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.INVALID_ARGUMENT, "Schedule cron or interval definition is required for scheduled jobs.");
|
|
403
|
+
}
|
|
404
|
+
const timer = setTimeout(async () => {
|
|
405
|
+
this.jobHandler(jobId);
|
|
406
|
+
}, nextExecution);
|
|
407
|
+
// Set the timer's unref to prevent it from keeping the process alive
|
|
408
|
+
timer.unref();
|
|
409
|
+
this.scheduled.set(jobId, {
|
|
410
|
+
timer,
|
|
411
|
+
expression,
|
|
412
|
+
numberOfExecutions: 0,
|
|
413
|
+
config: schedulerOptions,
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
async remove(jobId) {
|
|
417
|
+
const job = this.scheduled.get(jobId);
|
|
418
|
+
if (!job) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
clearTimeout(job.timer);
|
|
422
|
+
this.scheduled.delete(jobId);
|
|
423
|
+
}
|
|
424
|
+
async removeAll() {
|
|
425
|
+
for (const [key] of this.scheduled) {
|
|
426
|
+
await this.remove(key);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
async jobHandler(jobId) {
|
|
430
|
+
const job = this.scheduled.get(jobId);
|
|
431
|
+
if (!job) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
if (job.config?.numberOfExecutions !== undefined &&
|
|
435
|
+
job.config.numberOfExecutions <= job.numberOfExecutions) {
|
|
436
|
+
this.scheduled.delete(jobId);
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
const nextExecution = parseNextExecution(job.expression);
|
|
440
|
+
try {
|
|
441
|
+
await this.workflowOrchestratorService_.run(jobId, {
|
|
442
|
+
logOnError: true,
|
|
443
|
+
throwOnError: false,
|
|
444
|
+
});
|
|
445
|
+
const timer = this.createManagedTimer(() => {
|
|
446
|
+
this.jobHandler(jobId);
|
|
447
|
+
}, nextExecution);
|
|
448
|
+
// Prevent timer from keeping the process alive
|
|
449
|
+
timer.unref();
|
|
450
|
+
this.scheduled.set(jobId, {
|
|
451
|
+
timer,
|
|
452
|
+
expression: job.expression,
|
|
453
|
+
numberOfExecutions: (job.numberOfExecutions ?? 0) + 1,
|
|
454
|
+
config: job.config,
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
catch (e) {
|
|
458
|
+
if (e instanceof utils_1.AcmeKitError && e.type === utils_1.AcmeKitError.Types.NOT_FOUND) {
|
|
459
|
+
this.logger_?.warn(`Tried to execute a scheduled workflow with ID ${jobId} that does not exist, removing it from the scheduler.`);
|
|
460
|
+
await this.remove(jobId);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
throw e;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
async clearExpiredExecutions() {
|
|
467
|
+
await this.workflowExecutionService_.delete({
|
|
468
|
+
retention_time: {
|
|
469
|
+
$ne: null,
|
|
470
|
+
},
|
|
471
|
+
updated_at: {
|
|
472
|
+
$lte: (0, core_1.raw)((_alias) => `CURRENT_TIMESTAMP - (INTERVAL '1 second' * "retention_time")`),
|
|
473
|
+
},
|
|
474
|
+
state: {
|
|
475
|
+
$in: [
|
|
476
|
+
utils_1.TransactionState.DONE,
|
|
477
|
+
utils_1.TransactionState.FAILED,
|
|
478
|
+
utils_1.TransactionState.REVERTED,
|
|
479
|
+
],
|
|
480
|
+
},
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
exports.InMemoryDistributedTransactionStorage = InMemoryDistributedTransactionStorage;
|
|
485
|
+
_InMemoryDistributedTransactionStorage_instances = new WeakSet(), _InMemoryDistributedTransactionStorage_preventRaceConditionExecutionIfNecessary = async function _InMemoryDistributedTransactionStorage_preventRaceConditionExecutionIfNecessary({ data, key, options, }) {
|
|
486
|
+
const isInitialCheckpoint = [utils_1.TransactionState.NOT_STARTED].includes(data.flow.state);
|
|
487
|
+
/**
|
|
488
|
+
* In case many execution can succeed simultaneously, we need to ensure that the latest
|
|
489
|
+
* execution does continue if a previous execution is considered finished
|
|
490
|
+
*/
|
|
491
|
+
const currentFlow = data.flow;
|
|
492
|
+
const rawData = this.storage[key];
|
|
493
|
+
let data_ = {};
|
|
494
|
+
if (rawData) {
|
|
495
|
+
data_ = rawData;
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
const getOptions = {
|
|
499
|
+
...options,
|
|
500
|
+
isCancelling: !!data.flow.cancelledAt,
|
|
501
|
+
};
|
|
502
|
+
data_ =
|
|
503
|
+
(await this.get(key, getOptions)) ??
|
|
504
|
+
{ flow: {} };
|
|
505
|
+
}
|
|
506
|
+
const { flow: latestUpdatedFlow } = data_;
|
|
507
|
+
if (options?.stepId) {
|
|
508
|
+
const stepId = options.stepId;
|
|
509
|
+
const currentStep = data.flow.steps[stepId];
|
|
510
|
+
const latestStep = latestUpdatedFlow.steps?.[stepId];
|
|
511
|
+
if (latestStep && currentStep) {
|
|
512
|
+
const isCompensating = data.flow.state === utils_1.TransactionState.COMPENSATING;
|
|
513
|
+
const latestState = isCompensating
|
|
514
|
+
? latestStep.compensate?.state
|
|
515
|
+
: latestStep.invoke?.state;
|
|
516
|
+
const shouldSkip = doneStates.has(latestState);
|
|
517
|
+
if (shouldSkip) {
|
|
518
|
+
throw new orchestration_1.SkipStepAlreadyFinishedError(`Step ${stepId} already finished by another execution`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (!isInitialCheckpoint &&
|
|
523
|
+
!(0, utils_1.isPresent)(latestUpdatedFlow) &&
|
|
524
|
+
!data.flow.metadata?.parentStepIdempotencyKey) {
|
|
525
|
+
/**
|
|
526
|
+
* the initial checkpoint expect no other checkpoint to have been stored.
|
|
527
|
+
* In case it is not the initial one and another checkpoint is trying to
|
|
528
|
+
* find if a concurrent execution has finished, we skip the execution.
|
|
529
|
+
* The already finished execution would have deleted the checkpoint already.
|
|
530
|
+
*/
|
|
531
|
+
throw new orchestration_1.SkipExecutionError("Already finished by another execution");
|
|
532
|
+
}
|
|
533
|
+
// Ensure that the latest execution was not cancelled, otherwise we skip the execution
|
|
534
|
+
const latestTransactionCancelledAt = latestUpdatedFlow.cancelledAt;
|
|
535
|
+
const currentTransactionCancelledAt = currentFlow.cancelledAt;
|
|
536
|
+
if (!!latestTransactionCancelledAt &&
|
|
537
|
+
currentTransactionCancelledAt == null) {
|
|
538
|
+
throw new orchestration_1.SkipCancelledExecutionError("Workflow execution has been cancelled during the execution");
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
//# sourceMappingURL=workflow-orchestrator-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-orchestrator-storage.js","sourceRoot":"","sources":["../../src/utils/workflow-orchestrator-storage.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4DAAuD;AACvD,oEAcyC;AAMzC,oDAKiC;AAEjC,6CAAkE;AAGlE,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAA;AAE3C,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,4BAAoB,CAAC,IAAI;IACzB,4BAAoB,CAAC,QAAQ;IAC7B,4BAAoB,CAAC,MAAM;IAC3B,4BAAoB,CAAC,OAAO;IAC5B,4BAAoB,CAAC,eAAe;IACpC,4BAAoB,CAAC,OAAO;CAC7B,CAAC,CAAA;AAEF,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,wBAAgB,CAAC,IAAI;IACrB,wBAAgB,CAAC,MAAM;IACvB,wBAAgB,CAAC,QAAQ;CAC1B,CAAC,CA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DED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@acmekit/workflow-engine-inmemory",
|
|
3
|
+
"version": "2.13.1",
|
|
4
|
+
"description": "AcmeKit Workflow Orchestrator module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"!dist/**/__tests__",
|
|
10
|
+
"!dist/**/__mocks__",
|
|
11
|
+
"!dist/**/__fixtures__"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/acmekit/acmekit",
|
|
19
|
+
"directory": "packages/modules/workflow-engine-inmemory"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"author": "AcmeKit",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"watch": "yarn run -T tsc --build --watch",
|
|
28
|
+
"watch:test": "yarn run -T tsc --build tsconfig.spec.json --watch",
|
|
29
|
+
"resolve:aliases": "yarn run -T tsc --showConfig -p tsconfig.json > tsconfig.resolved.json && yarn run -T tsc-alias -p tsconfig.resolved.json && yarn run -T rimraf tsconfig.resolved.json",
|
|
30
|
+
"build": "yarn run -T rimraf dist && yarn run -T tsc --build && npm run resolve:aliases",
|
|
31
|
+
"test": "../../../node_modules/.bin/jest --passWithNoTests --bail --forceExit --testPathPattern=src",
|
|
32
|
+
"test:integration": "../../../node_modules/.bin/jest --passWithNoTests --forceExit --testPathPattern=\"integration-tests/__tests__/index\\.spec\\.ts\" && ../../../node_modules/.bin/jest --passWithNoTests --forceExit --testPathPattern=\"integration-tests/__tests__/race\\.spec\\.ts\" && ../../../node_modules/.bin/jest --passWithNoTests --forceExit --testPathPattern=\"integration-tests/__tests__/subscribe\\.spec\\.ts\" && ../../../node_modules/.bin/jest --passWithNoTests --forceExit --testPathPattern=\"integration-tests/__tests__/retry-interval\\.spec\\.ts\"",
|
|
33
|
+
"migration:initial": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:create --initial",
|
|
34
|
+
"migration:create": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:create",
|
|
35
|
+
"migration:up": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:up",
|
|
36
|
+
"orm:cache:clear": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm cache:clear"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@acmekit/framework": "2.13.1",
|
|
40
|
+
"@acmekit/test-utils": "2.13.1"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"cron-parser": "^4.9.0",
|
|
44
|
+
"ulid": "^2.3.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@acmekit/framework": "2.13.1"
|
|
48
|
+
}
|
|
49
|
+
}
|