@etohq/workflow-engine-inmemory 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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 +10 -0
- package/dist/models/workflow-execution.d.ts.map +1 -0
- package/dist/models/workflow-execution.js +33 -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 +26 -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 +69 -0
- package/dist/services/workflow-orchestrator.d.ts.map +1 -0
- package/dist/services/workflow-orchestrator.js +423 -0
- package/dist/services/workflow-orchestrator.js.map +1 -0
- package/dist/services/workflows-module.d.ts +48 -0
- package/dist/services/workflows-module.d.ts.map +1 -0
- package/dist/services/workflows-module.js +100 -0
- package/dist/services/workflows-module.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +5 -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 +34 -0
- package/dist/utils/workflow-orchestrator-storage.d.ts.map +1 -0
- package/dist/utils/workflow-orchestrator-storage.js +227 -0
- package/dist/utils/workflow-orchestrator-storage.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,423 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.WorkflowOrchestratorService = void 0;
|
|
16
|
+
const orchestration_1 = require("@etohq/framework/orchestration");
|
|
17
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
18
|
+
const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
|
|
19
|
+
const ulid_1 = require("ulid");
|
|
20
|
+
const AnySubscriber = "any";
|
|
21
|
+
class WorkflowOrchestratorService {
|
|
22
|
+
constructor({ inMemoryDistributedTransactionStorage, sharedContainer, }) {
|
|
23
|
+
this.subscribers = new Map();
|
|
24
|
+
this.container_ = sharedContainer;
|
|
25
|
+
inMemoryDistributedTransactionStorage.setWorkflowOrchestratorService(this);
|
|
26
|
+
orchestration_1.DistributedTransaction.setStorage(inMemoryDistributedTransactionStorage);
|
|
27
|
+
orchestration_1.WorkflowScheduler.setStorage(inMemoryDistributedTransactionStorage);
|
|
28
|
+
}
|
|
29
|
+
async triggerParentStep(transaction, result) {
|
|
30
|
+
const metadata = transaction.flow.metadata;
|
|
31
|
+
const { parentStepIdempotencyKey } = metadata ?? {};
|
|
32
|
+
if (parentStepIdempotencyKey) {
|
|
33
|
+
const hasFailed = [
|
|
34
|
+
utils_1.TransactionState.REVERTED,
|
|
35
|
+
utils_1.TransactionState.FAILED,
|
|
36
|
+
].includes(transaction.flow.state);
|
|
37
|
+
if (hasFailed) {
|
|
38
|
+
await this.setStepFailure({
|
|
39
|
+
idempotencyKey: parentStepIdempotencyKey,
|
|
40
|
+
stepResponse: result,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
await this.setStepSuccess({
|
|
45
|
+
idempotencyKey: parentStepIdempotencyKey,
|
|
46
|
+
stepResponse: result,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async run(workflowIdOrWorkflow, options, sharedContext = {}) {
|
|
52
|
+
const { input, transactionId, resultFrom, logOnError, events: eventHandlers, container, } = options ?? {};
|
|
53
|
+
let { throwOnError, context } = options ?? {};
|
|
54
|
+
throwOnError ??= true;
|
|
55
|
+
context ??= {};
|
|
56
|
+
context.transactionId ??= transactionId ?? (0, ulid_1.ulid)();
|
|
57
|
+
const workflowId = (0, utils_1.isString)(workflowIdOrWorkflow)
|
|
58
|
+
? workflowIdOrWorkflow
|
|
59
|
+
: workflowIdOrWorkflow.getName();
|
|
60
|
+
if (!workflowId) {
|
|
61
|
+
throw new utils_1.EtoError(utils_1.EtoError.Types.NOT_FOUND, `Workflow ID is required`);
|
|
62
|
+
}
|
|
63
|
+
const events = this.buildWorkflowEvents({
|
|
64
|
+
customEventHandlers: eventHandlers,
|
|
65
|
+
workflowId,
|
|
66
|
+
transactionId: context.transactionId,
|
|
67
|
+
});
|
|
68
|
+
const exportedWorkflow = workflows_sdk_1.EtoWorkflow.getWorkflow(workflowId);
|
|
69
|
+
if (!exportedWorkflow) {
|
|
70
|
+
throw new utils_1.EtoError(utils_1.EtoError.Types.NOT_FOUND, `Workflow with id "${workflowId}" not found.`);
|
|
71
|
+
}
|
|
72
|
+
const ret = await exportedWorkflow.run({
|
|
73
|
+
input,
|
|
74
|
+
throwOnError: false,
|
|
75
|
+
logOnError,
|
|
76
|
+
resultFrom,
|
|
77
|
+
context,
|
|
78
|
+
events,
|
|
79
|
+
container: container ?? this.container_,
|
|
80
|
+
});
|
|
81
|
+
const hasFinished = ret.transaction.hasFinished();
|
|
82
|
+
const metadata = ret.transaction.getFlow().metadata;
|
|
83
|
+
const { parentStepIdempotencyKey } = metadata ?? {};
|
|
84
|
+
const hasFailed = [
|
|
85
|
+
utils_1.TransactionState.REVERTED,
|
|
86
|
+
utils_1.TransactionState.FAILED,
|
|
87
|
+
].includes(ret.transaction.getFlow().state);
|
|
88
|
+
const acknowledgement = {
|
|
89
|
+
transactionId: context.transactionId,
|
|
90
|
+
workflowId: workflowId,
|
|
91
|
+
parentStepIdempotencyKey,
|
|
92
|
+
hasFinished,
|
|
93
|
+
hasFailed,
|
|
94
|
+
};
|
|
95
|
+
if (ret.transaction.hasFinished()) {
|
|
96
|
+
const { result, errors } = ret;
|
|
97
|
+
this.notify({
|
|
98
|
+
eventType: "onFinish",
|
|
99
|
+
workflowId,
|
|
100
|
+
transactionId: context.transactionId,
|
|
101
|
+
result,
|
|
102
|
+
errors,
|
|
103
|
+
});
|
|
104
|
+
await this.triggerParentStep(ret.transaction, result);
|
|
105
|
+
}
|
|
106
|
+
if (throwOnError && ret.thrownError) {
|
|
107
|
+
throw ret.thrownError;
|
|
108
|
+
}
|
|
109
|
+
return { acknowledgement, ...ret };
|
|
110
|
+
}
|
|
111
|
+
async getRunningTransaction(workflowId, transactionId, options, sharedContext = {}) {
|
|
112
|
+
let { context, container } = options ?? {};
|
|
113
|
+
if (!workflowId) {
|
|
114
|
+
throw new Error("Workflow ID is required");
|
|
115
|
+
}
|
|
116
|
+
if (!transactionId) {
|
|
117
|
+
throw new Error("TransactionId ID is required");
|
|
118
|
+
}
|
|
119
|
+
context ??= {};
|
|
120
|
+
context.transactionId ??= transactionId;
|
|
121
|
+
const exportedWorkflow = workflows_sdk_1.EtoWorkflow.getWorkflow(workflowId);
|
|
122
|
+
if (!exportedWorkflow) {
|
|
123
|
+
throw new Error(`Workflow with id "${workflowId}" not found.`);
|
|
124
|
+
}
|
|
125
|
+
const flow = exportedWorkflow(container ?? this.container_);
|
|
126
|
+
const transaction = await flow.getRunningTransaction(transactionId, context);
|
|
127
|
+
return transaction;
|
|
128
|
+
}
|
|
129
|
+
async setStepSuccess({ idempotencyKey, stepResponse, options, }, sharedContext = {}) {
|
|
130
|
+
const { context, logOnError, resultFrom, container, events: eventHandlers, } = options ?? {};
|
|
131
|
+
let { throwOnError } = options ?? {};
|
|
132
|
+
throwOnError ??= true;
|
|
133
|
+
const [idempotencyKey_, { workflowId, transactionId }] = this.buildIdempotencyKeyAndParts(idempotencyKey);
|
|
134
|
+
const exportedWorkflow = workflows_sdk_1.EtoWorkflow.getWorkflow(workflowId);
|
|
135
|
+
if (!exportedWorkflow) {
|
|
136
|
+
throw new Error(`Workflow with id "${workflowId}" not found.`);
|
|
137
|
+
}
|
|
138
|
+
const events = this.buildWorkflowEvents({
|
|
139
|
+
customEventHandlers: eventHandlers,
|
|
140
|
+
transactionId,
|
|
141
|
+
workflowId,
|
|
142
|
+
});
|
|
143
|
+
const ret = await exportedWorkflow.registerStepSuccess({
|
|
144
|
+
idempotencyKey: idempotencyKey_,
|
|
145
|
+
context,
|
|
146
|
+
resultFrom,
|
|
147
|
+
throwOnError: false,
|
|
148
|
+
logOnError,
|
|
149
|
+
events,
|
|
150
|
+
response: stepResponse,
|
|
151
|
+
container: container ?? this.container_,
|
|
152
|
+
});
|
|
153
|
+
if (ret.transaction.hasFinished()) {
|
|
154
|
+
const { result, errors } = ret;
|
|
155
|
+
this.notify({
|
|
156
|
+
eventType: "onFinish",
|
|
157
|
+
workflowId,
|
|
158
|
+
transactionId,
|
|
159
|
+
result,
|
|
160
|
+
errors,
|
|
161
|
+
});
|
|
162
|
+
await this.triggerParentStep(ret.transaction, result);
|
|
163
|
+
}
|
|
164
|
+
if (throwOnError && ret.thrownError) {
|
|
165
|
+
throw ret.thrownError;
|
|
166
|
+
}
|
|
167
|
+
return ret;
|
|
168
|
+
}
|
|
169
|
+
async setStepFailure({ idempotencyKey, stepResponse, options, }, sharedContext = {}) {
|
|
170
|
+
const { context, logOnError, resultFrom, container, events: eventHandlers, } = options ?? {};
|
|
171
|
+
let { throwOnError } = options ?? {};
|
|
172
|
+
throwOnError ??= true;
|
|
173
|
+
const [idempotencyKey_, { workflowId, transactionId }] = this.buildIdempotencyKeyAndParts(idempotencyKey);
|
|
174
|
+
const exportedWorkflow = workflows_sdk_1.EtoWorkflow.getWorkflow(workflowId);
|
|
175
|
+
if (!exportedWorkflow) {
|
|
176
|
+
throw new Error(`Workflow with id "${workflowId}" not found.`);
|
|
177
|
+
}
|
|
178
|
+
const events = this.buildWorkflowEvents({
|
|
179
|
+
customEventHandlers: eventHandlers,
|
|
180
|
+
transactionId,
|
|
181
|
+
workflowId,
|
|
182
|
+
});
|
|
183
|
+
const ret = await exportedWorkflow.registerStepFailure({
|
|
184
|
+
idempotencyKey: idempotencyKey_,
|
|
185
|
+
context,
|
|
186
|
+
resultFrom,
|
|
187
|
+
throwOnError: false,
|
|
188
|
+
logOnError,
|
|
189
|
+
events,
|
|
190
|
+
response: stepResponse,
|
|
191
|
+
container: container ?? this.container_,
|
|
192
|
+
});
|
|
193
|
+
if (ret.transaction.hasFinished()) {
|
|
194
|
+
const { result, errors } = ret;
|
|
195
|
+
this.notify({
|
|
196
|
+
eventType: "onFinish",
|
|
197
|
+
workflowId,
|
|
198
|
+
transactionId,
|
|
199
|
+
result,
|
|
200
|
+
errors,
|
|
201
|
+
});
|
|
202
|
+
await this.triggerParentStep(ret.transaction, result);
|
|
203
|
+
}
|
|
204
|
+
if (throwOnError && ret.thrownError) {
|
|
205
|
+
throw ret.thrownError;
|
|
206
|
+
}
|
|
207
|
+
return ret;
|
|
208
|
+
}
|
|
209
|
+
subscribe({ workflowId, transactionId, subscriber, subscriberId }, sharedContext = {}) {
|
|
210
|
+
subscriber._id = subscriberId;
|
|
211
|
+
const subscribers = this.subscribers.get(workflowId) ?? new Map();
|
|
212
|
+
const handlerIndex = (handlers) => {
|
|
213
|
+
return handlers.indexOf((s) => s === subscriber || s._id === subscriberId);
|
|
214
|
+
};
|
|
215
|
+
if (transactionId) {
|
|
216
|
+
const transactionSubscribers = subscribers.get(transactionId) ?? [];
|
|
217
|
+
const subscriberIndex = handlerIndex(transactionSubscribers);
|
|
218
|
+
if (subscriberIndex !== -1) {
|
|
219
|
+
transactionSubscribers.slice(subscriberIndex, 1);
|
|
220
|
+
}
|
|
221
|
+
transactionSubscribers.push(subscriber);
|
|
222
|
+
subscribers.set(transactionId, transactionSubscribers);
|
|
223
|
+
this.subscribers.set(workflowId, subscribers);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const workflowSubscribers = subscribers.get(AnySubscriber) ?? [];
|
|
227
|
+
const subscriberIndex = handlerIndex(workflowSubscribers);
|
|
228
|
+
if (subscriberIndex !== -1) {
|
|
229
|
+
workflowSubscribers.slice(subscriberIndex, 1);
|
|
230
|
+
}
|
|
231
|
+
workflowSubscribers.push(subscriber);
|
|
232
|
+
subscribers.set(AnySubscriber, workflowSubscribers);
|
|
233
|
+
this.subscribers.set(workflowId, subscribers);
|
|
234
|
+
}
|
|
235
|
+
unsubscribe({ workflowId, transactionId, subscriberOrId }, sharedContext = {}) {
|
|
236
|
+
const subscribers = this.subscribers.get(workflowId) ?? new Map();
|
|
237
|
+
const filterSubscribers = (handlers) => {
|
|
238
|
+
return handlers.filter((handler) => {
|
|
239
|
+
return handler._id
|
|
240
|
+
? handler._id !== subscriberOrId
|
|
241
|
+
: handler !== subscriberOrId;
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
if (transactionId) {
|
|
245
|
+
const transactionSubscribers = subscribers.get(transactionId) ?? [];
|
|
246
|
+
const newTransactionSubscribers = filterSubscribers(transactionSubscribers);
|
|
247
|
+
subscribers.set(transactionId, newTransactionSubscribers);
|
|
248
|
+
this.subscribers.set(workflowId, subscribers);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const workflowSubscribers = subscribers.get(AnySubscriber) ?? [];
|
|
252
|
+
const newWorkflowSubscribers = filterSubscribers(workflowSubscribers);
|
|
253
|
+
subscribers.set(AnySubscriber, newWorkflowSubscribers);
|
|
254
|
+
this.subscribers.set(workflowId, subscribers);
|
|
255
|
+
}
|
|
256
|
+
notify(options) {
|
|
257
|
+
const { eventType, workflowId, transactionId, errors, result, step, response, } = options;
|
|
258
|
+
const subscribers = this.subscribers.get(workflowId) ?? new Map();
|
|
259
|
+
const notifySubscribers = (handlers) => {
|
|
260
|
+
handlers.forEach((handler) => {
|
|
261
|
+
handler({
|
|
262
|
+
eventType,
|
|
263
|
+
workflowId,
|
|
264
|
+
transactionId,
|
|
265
|
+
step,
|
|
266
|
+
response,
|
|
267
|
+
result,
|
|
268
|
+
errors,
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
if (transactionId) {
|
|
273
|
+
const transactionSubscribers = subscribers.get(transactionId) ?? [];
|
|
274
|
+
notifySubscribers(transactionSubscribers);
|
|
275
|
+
}
|
|
276
|
+
const workflowSubscribers = subscribers.get(AnySubscriber) ?? [];
|
|
277
|
+
notifySubscribers(workflowSubscribers);
|
|
278
|
+
}
|
|
279
|
+
buildWorkflowEvents({ customEventHandlers, workflowId, transactionId, }) {
|
|
280
|
+
const notify = ({ eventType, step, result, response, errors, }) => {
|
|
281
|
+
this.notify({
|
|
282
|
+
workflowId,
|
|
283
|
+
transactionId,
|
|
284
|
+
eventType,
|
|
285
|
+
response,
|
|
286
|
+
step,
|
|
287
|
+
result,
|
|
288
|
+
errors,
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
return {
|
|
292
|
+
onTimeout: ({ transaction }) => {
|
|
293
|
+
customEventHandlers?.onTimeout?.({ transaction });
|
|
294
|
+
notify({ eventType: "onTimeout" });
|
|
295
|
+
},
|
|
296
|
+
onBegin: ({ transaction }) => {
|
|
297
|
+
customEventHandlers?.onBegin?.({ transaction });
|
|
298
|
+
notify({ eventType: "onBegin" });
|
|
299
|
+
},
|
|
300
|
+
onResume: ({ transaction }) => {
|
|
301
|
+
customEventHandlers?.onResume?.({ transaction });
|
|
302
|
+
notify({ eventType: "onResume" });
|
|
303
|
+
},
|
|
304
|
+
onCompensateBegin: ({ transaction }) => {
|
|
305
|
+
customEventHandlers?.onCompensateBegin?.({ transaction });
|
|
306
|
+
notify({ eventType: "onCompensateBegin" });
|
|
307
|
+
},
|
|
308
|
+
onFinish: ({ transaction, result, errors }) => {
|
|
309
|
+
// TODO: unsubscribe transaction handlers on finish
|
|
310
|
+
customEventHandlers?.onFinish?.({ transaction, result, errors });
|
|
311
|
+
},
|
|
312
|
+
onStepBegin: ({ step, transaction }) => {
|
|
313
|
+
customEventHandlers?.onStepBegin?.({ step, transaction });
|
|
314
|
+
notify({ eventType: "onStepBegin", step });
|
|
315
|
+
},
|
|
316
|
+
onStepSuccess: async ({ step, transaction }) => {
|
|
317
|
+
const stepName = step.definition.action;
|
|
318
|
+
const response = await (0, workflows_sdk_1.resolveValue)(transaction.getContext().invoke[stepName], transaction);
|
|
319
|
+
customEventHandlers?.onStepSuccess?.({ step, transaction, response });
|
|
320
|
+
notify({ eventType: "onStepSuccess", step, response });
|
|
321
|
+
},
|
|
322
|
+
onStepFailure: ({ step, transaction }) => {
|
|
323
|
+
const stepName = step.definition.action;
|
|
324
|
+
const errors = transaction
|
|
325
|
+
.getErrors(orchestration_1.TransactionHandlerType.INVOKE)
|
|
326
|
+
.filter((err) => err.action === stepName);
|
|
327
|
+
customEventHandlers?.onStepFailure?.({ step, transaction, errors });
|
|
328
|
+
notify({ eventType: "onStepFailure", step, errors });
|
|
329
|
+
},
|
|
330
|
+
onStepAwaiting: ({ step, transaction }) => {
|
|
331
|
+
customEventHandlers?.onStepAwaiting?.({ step, transaction });
|
|
332
|
+
notify({ eventType: "onStepAwaiting", step });
|
|
333
|
+
},
|
|
334
|
+
onCompensateStepSuccess: ({ step, transaction }) => {
|
|
335
|
+
const stepName = step.definition.action;
|
|
336
|
+
const response = transaction.getContext().compensate[stepName];
|
|
337
|
+
customEventHandlers?.onCompensateStepSuccess?.({
|
|
338
|
+
step,
|
|
339
|
+
transaction,
|
|
340
|
+
response,
|
|
341
|
+
});
|
|
342
|
+
notify({ eventType: "onCompensateStepSuccess", step, response });
|
|
343
|
+
},
|
|
344
|
+
onCompensateStepFailure: ({ step, transaction }) => {
|
|
345
|
+
const stepName = step.definition.action;
|
|
346
|
+
const errors = transaction
|
|
347
|
+
.getErrors(orchestration_1.TransactionHandlerType.COMPENSATE)
|
|
348
|
+
.filter((err) => err.action === stepName);
|
|
349
|
+
customEventHandlers?.onStepFailure?.({ step, transaction, errors });
|
|
350
|
+
notify({ eventType: "onCompensateStepFailure", step, errors });
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
buildIdempotencyKeyAndParts(idempotencyKey) {
|
|
355
|
+
const parts = {
|
|
356
|
+
workflowId: "",
|
|
357
|
+
transactionId: "",
|
|
358
|
+
stepId: "",
|
|
359
|
+
action: "invoke",
|
|
360
|
+
};
|
|
361
|
+
let idempotencyKey_ = idempotencyKey;
|
|
362
|
+
const setParts = (workflowId, transactionId, stepId, action) => {
|
|
363
|
+
parts.workflowId = workflowId;
|
|
364
|
+
parts.transactionId = transactionId;
|
|
365
|
+
parts.stepId = stepId;
|
|
366
|
+
parts.action = action;
|
|
367
|
+
};
|
|
368
|
+
if (!(0, utils_1.isString)(idempotencyKey)) {
|
|
369
|
+
const { workflowId, transactionId, stepId, action } = idempotencyKey;
|
|
370
|
+
idempotencyKey_ = [workflowId, transactionId, stepId, action].join(":");
|
|
371
|
+
setParts(workflowId, transactionId, stepId, action);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
const [workflowId, transactionId, stepId, action] = idempotencyKey_.split(":");
|
|
375
|
+
setParts(workflowId, transactionId, stepId, action);
|
|
376
|
+
}
|
|
377
|
+
return [idempotencyKey_, parts];
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
exports.WorkflowOrchestratorService = WorkflowOrchestratorService;
|
|
381
|
+
__decorate([
|
|
382
|
+
(0, utils_1.InjectSharedContext)(),
|
|
383
|
+
__param(2, (0, utils_1.EtoContext)()),
|
|
384
|
+
__metadata("design:type", Function),
|
|
385
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
386
|
+
__metadata("design:returntype", Promise)
|
|
387
|
+
], WorkflowOrchestratorService.prototype, "run", null);
|
|
388
|
+
__decorate([
|
|
389
|
+
(0, utils_1.InjectSharedContext)(),
|
|
390
|
+
__param(3, (0, utils_1.EtoContext)()),
|
|
391
|
+
__metadata("design:type", Function),
|
|
392
|
+
__metadata("design:paramtypes", [String, String, Object, Object]),
|
|
393
|
+
__metadata("design:returntype", Promise)
|
|
394
|
+
], WorkflowOrchestratorService.prototype, "getRunningTransaction", null);
|
|
395
|
+
__decorate([
|
|
396
|
+
(0, utils_1.InjectSharedContext)(),
|
|
397
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
398
|
+
__metadata("design:type", Function),
|
|
399
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
400
|
+
__metadata("design:returntype", Promise)
|
|
401
|
+
], WorkflowOrchestratorService.prototype, "setStepSuccess", null);
|
|
402
|
+
__decorate([
|
|
403
|
+
(0, utils_1.InjectSharedContext)(),
|
|
404
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
405
|
+
__metadata("design:type", Function),
|
|
406
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
407
|
+
__metadata("design:returntype", Promise)
|
|
408
|
+
], WorkflowOrchestratorService.prototype, "setStepFailure", null);
|
|
409
|
+
__decorate([
|
|
410
|
+
(0, utils_1.InjectSharedContext)(),
|
|
411
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
412
|
+
__metadata("design:type", Function),
|
|
413
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
414
|
+
__metadata("design:returntype", void 0)
|
|
415
|
+
], WorkflowOrchestratorService.prototype, "subscribe", null);
|
|
416
|
+
__decorate([
|
|
417
|
+
(0, utils_1.InjectSharedContext)(),
|
|
418
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
419
|
+
__metadata("design:type", Function),
|
|
420
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
421
|
+
__metadata("design:returntype", void 0)
|
|
422
|
+
], WorkflowOrchestratorService.prototype, "unsubscribe", null);
|
|
423
|
+
//# sourceMappingURL=workflow-orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-orchestrator.js","sourceRoot":"","sources":["../../src/services/workflow-orchestrator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAOuC;AAMvC,kDAM+B;AAC/B,kEAKuC;AACvC,+BAA2B;AA0D3B,MAAM,aAAa,GAAG,KAAK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AM,CAAC;YACN,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,GAC/C,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC5B,QAAQ,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QACrD,CAAC;QAED,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;IACjC,CAAC;CACF;AAriBD,kEAqiBC;AA3fO;IADL,IAAA,2BAAmB,GAAE;IAInB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;sDAsFd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAKnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;wEA2Bd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;iEAyDd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;iEAyDd;AAGD;IADC,IAAA,2BAAmB,GAAE;IAGnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;4DA+Bd;AAGD;IADC,IAAA,2BAAmB,GAAE;IAGnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;8DA0Bd"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Context, DAL, InferEntityType, InternalModuleDeclaration, EtoContainer, ModulesSdkTypes, WorkflowsSdkTypes } from "@etohq/framework/types";
|
|
2
|
+
import { ModulesSdkUtils } from "@etohq/framework/utils";
|
|
3
|
+
import type { ReturnWorkflow, UnwrapWorkflowInputDataType } from "@etohq/framework/workflows-sdk";
|
|
4
|
+
import { WorkflowExecution } from "../models";
|
|
5
|
+
import { WorkflowOrchestratorService } from ".";
|
|
6
|
+
type InjectedDependencies = {
|
|
7
|
+
baseRepository: DAL.RepositoryService;
|
|
8
|
+
workflowExecutionService: ModulesSdkTypes.IEtoInternalService<any>;
|
|
9
|
+
workflowOrchestratorService: WorkflowOrchestratorService;
|
|
10
|
+
};
|
|
11
|
+
declare const WorkflowsModuleService_base: ModulesSdkUtils.EtoServiceReturnType<{
|
|
12
|
+
WorkflowExecution: {
|
|
13
|
+
dto: InferEntityType<typeof WorkflowExecution>;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
export declare class WorkflowsModuleService<TWorkflowExecution extends InferEntityType<typeof WorkflowExecution> = InferEntityType<typeof WorkflowExecution>> extends WorkflowsModuleService_base {
|
|
17
|
+
protected readonly moduleDeclaration: InternalModuleDeclaration;
|
|
18
|
+
protected baseRepository_: DAL.RepositoryService;
|
|
19
|
+
protected workflowExecutionService_: ModulesSdkTypes.IEtoInternalService<TWorkflowExecution>;
|
|
20
|
+
protected workflowOrchestratorService_: WorkflowOrchestratorService;
|
|
21
|
+
protected container_: EtoContainer;
|
|
22
|
+
constructor({ baseRepository, workflowExecutionService, workflowOrchestratorService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
|
|
23
|
+
run<TWorkflow extends string | ReturnWorkflow<any, any, any>>(workflowIdOrWorkflow: TWorkflow, options?: WorkflowsSdkTypes.WorkflowOrchestratorRunDTO<TWorkflow extends ReturnWorkflow<any, any, any> ? UnwrapWorkflowInputDataType<TWorkflow> : unknown>, context?: Context): Promise<any>;
|
|
24
|
+
getRunningTransaction(workflowId: string, transactionId: string, context?: Context): Promise<import("@etohq/framework/orchestration").DistributedTransactionType>;
|
|
25
|
+
setStepSuccess({ idempotencyKey, stepResponse, options, }: {
|
|
26
|
+
idempotencyKey: string | object;
|
|
27
|
+
stepResponse: unknown;
|
|
28
|
+
options?: Record<string, any>;
|
|
29
|
+
}, context?: Context): Promise<any>;
|
|
30
|
+
setStepFailure({ idempotencyKey, stepResponse, options, }: {
|
|
31
|
+
idempotencyKey: string | object;
|
|
32
|
+
stepResponse: unknown;
|
|
33
|
+
options?: Record<string, any>;
|
|
34
|
+
}, context?: Context): Promise<any>;
|
|
35
|
+
subscribe(args: {
|
|
36
|
+
workflowId: string;
|
|
37
|
+
transactionId?: string;
|
|
38
|
+
subscriber: Function;
|
|
39
|
+
subscriberId?: string;
|
|
40
|
+
}, context?: Context): Promise<void>;
|
|
41
|
+
unsubscribe(args: {
|
|
42
|
+
workflowId: string;
|
|
43
|
+
transactionId?: string;
|
|
44
|
+
subscriberOrId: string | Function;
|
|
45
|
+
}, context?: Context): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=workflows-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows-module.d.ts","sourceRoot":"","sources":["../../src/services/workflows-module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,GAAG,EACH,eAAe,EACf,yBAAyB,EACzB,YAAY,EACZ,eAAe,EACf,iBAAiB,EAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAGL,eAAe,EAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EACV,cAAc,EACd,2BAA2B,EAC5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAA;AAEvD,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,GAAG,CAAC,iBAAiB,CAAA;IACrC,wBAAwB,EAAE,eAAe,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAA;IAClE,2BAA2B,EAAE,2BAA2B,CAAA;CACzD,CAAA;;uBAOoB;QAAE,GAAG,EAAE,eAAe,CAAC,OAAO,iBAAiB,CAAC,CAAA;KAAE;;AALvE,qBAAa,sBAAsB,CACjC,kBAAkB,SAAS,eAAe,CACxC,OAAO,iBAAiB,CACzB,GAAG,eAAe,CAAC,OAAO,iBAAiB,CAAC,CAC7C,SAAQ,2BAEe;IAYrB,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB;IAXjE,S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B,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,UAAU,EAAE,QAAQ,CAAA;QACpB,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,EACa,OAAO,GAAE,OAAY;IAM/B,WAAW,CACf,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,cAAc,EAAE,MAAM,GAAG,QAAQ,CAAA;KAClC,EACa,OAAO,GAAE,OAAY;CAItC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var _a;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.WorkflowsModuleService = void 0;
|
|
17
|
+
const types_1 = require("@etohq/framework/types");
|
|
18
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
19
|
+
const _models_1 = require("../models");
|
|
20
|
+
class WorkflowsModuleService extends utils_1.ModulesSdkUtils.EtoService({ WorkflowExecution: _models_1.WorkflowExecution }) {
|
|
21
|
+
constructor({ baseRepository, workflowExecutionService, workflowOrchestratorService, }, moduleDeclaration) {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.moduleDeclaration = moduleDeclaration;
|
|
25
|
+
this.baseRepository_ = baseRepository;
|
|
26
|
+
this.workflowExecutionService_ = workflowExecutionService;
|
|
27
|
+
this.workflowOrchestratorService_ = workflowOrchestratorService;
|
|
28
|
+
}
|
|
29
|
+
async run(workflowIdOrWorkflow, options = {}, context = {}) {
|
|
30
|
+
const ret = await this.workflowOrchestratorService_.run(workflowIdOrWorkflow, options, context);
|
|
31
|
+
return ret;
|
|
32
|
+
}
|
|
33
|
+
async getRunningTransaction(workflowId, transactionId, context = {}) {
|
|
34
|
+
return await this.workflowOrchestratorService_.getRunningTransaction(workflowId, transactionId, context);
|
|
35
|
+
}
|
|
36
|
+
async setStepSuccess({ idempotencyKey, stepResponse, options, }, context = {}) {
|
|
37
|
+
return await this.workflowOrchestratorService_.setStepSuccess({
|
|
38
|
+
idempotencyKey,
|
|
39
|
+
stepResponse,
|
|
40
|
+
options,
|
|
41
|
+
}, context);
|
|
42
|
+
}
|
|
43
|
+
async setStepFailure({ idempotencyKey, stepResponse, options, }, context = {}) {
|
|
44
|
+
return await this.workflowOrchestratorService_.setStepFailure({
|
|
45
|
+
idempotencyKey,
|
|
46
|
+
stepResponse,
|
|
47
|
+
options,
|
|
48
|
+
}, context);
|
|
49
|
+
}
|
|
50
|
+
async subscribe(args, context = {}) {
|
|
51
|
+
return this.workflowOrchestratorService_.subscribe(args, context);
|
|
52
|
+
}
|
|
53
|
+
async unsubscribe(args, context = {}) {
|
|
54
|
+
return this.workflowOrchestratorService_.unsubscribe(args, context);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.WorkflowsModuleService = WorkflowsModuleService;
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, utils_1.InjectSharedContext)(),
|
|
60
|
+
__param(2, (0, utils_1.EtoContext)()),
|
|
61
|
+
__metadata("design:type", Function),
|
|
62
|
+
__metadata("design:paramtypes", [typeof (_a = typeof TWorkflow !== "undefined" && TWorkflow) === "function" ? _a : Object, Object, Object]),
|
|
63
|
+
__metadata("design:returntype", Promise)
|
|
64
|
+
], WorkflowsModuleService.prototype, "run", null);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, utils_1.InjectSharedContext)(),
|
|
67
|
+
__param(2, (0, utils_1.EtoContext)()),
|
|
68
|
+
__metadata("design:type", Function),
|
|
69
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
70
|
+
__metadata("design:returntype", Promise)
|
|
71
|
+
], WorkflowsModuleService.prototype, "getRunningTransaction", null);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, utils_1.InjectSharedContext)(),
|
|
74
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
77
|
+
__metadata("design:returntype", Promise)
|
|
78
|
+
], WorkflowsModuleService.prototype, "setStepSuccess", null);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, utils_1.InjectSharedContext)(),
|
|
81
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
82
|
+
__metadata("design:type", Function),
|
|
83
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
84
|
+
__metadata("design:returntype", Promise)
|
|
85
|
+
], WorkflowsModuleService.prototype, "setStepFailure", null);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, utils_1.InjectSharedContext)(),
|
|
88
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
89
|
+
__metadata("design:type", Function),
|
|
90
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
91
|
+
__metadata("design:returntype", Promise)
|
|
92
|
+
], WorkflowsModuleService.prototype, "subscribe", null);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, utils_1.InjectSharedContext)(),
|
|
95
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
96
|
+
__metadata("design:type", Function),
|
|
97
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
98
|
+
__metadata("design:returntype", Promise)
|
|
99
|
+
], WorkflowsModuleService.prototype, "unsubscribe", null);
|
|
100
|
+
//# sourceMappingURL=workflows-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows-module.js","sourceRoot":"","sources":["../../src/services/workflows-module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAQ+B;AAC/B,kDAI+B;AAK/B,qCAA2C;AAS3C,MAAa,sBAIX,SAAQ,uBAAe,CAAC,UAAU,CAEjC,EAAE,iBAAiB,EAAjB,2BAAiB,EAAE,CAAC;IAMvB,YACE,EACE,cAAc,EACd,wBAAwB,EACxB,2BAA2B,GACN,EACJ,iBAA4C;QAE/D,aAAa;QACb,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QAHA,sBAAiB,GAAjB,iBAAiB,CAA2B;QAK/D,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QACrC,IAAI,CAAC,yBAAyB,GAAG,wBAAwB,CAAA;QACzD,IAAI,CAAC,4BAA4B,GAAG,2BAA2B,CAAA;IACjE,CAAC;IAGK,AAAN,KAAK,CAAC,GAAG,CACP,oBAA+B,EAC/B,UAII,EAAE,EACQ,UAAmB,EAAE;QAEnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAIrD,oBAAoB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QAEzC,OAAO,GAAU,CAAA;IACnB,CAAC;IAGK,AAAN,KAAK,CAAC,qBAAqB,CACzB,UAAkB,EAClB,aAAqB,EACP,UAAmB,EAAE;QAEnC,OAAO,MAAM,IAAI,CAAC,4BAA4B,CAAC,qBAAqB,CAClE,UAAU,EACV,aAAa,EACb,OAAO,CACR,CAAA;IACH,CAAC;IAGK,AAAN,KAAK,CAAC,cAAc,CAClB,EACE,cAAc,EACd,YAAY,EACZ,OAAO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 @@
|
|
|
1
|
+
{"root":["../src/index.ts","../src/loaders/index.ts","../src/loaders/utils.ts","../src/migrations/Migration20231228143900.ts","../src/migrations/Migration20241206101446.ts","../src/models/index.ts","../src/models/workflow-execution.ts","../src/schema/index.ts","../src/services/index.ts","../src/services/workflow-orchestrator.ts","../src/services/workflows-module.ts","../src/types/index.ts","../src/utils/index.ts","../src/utils/workflow-orchestrator-storage.ts"],"version":"5.6.2"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAE/C,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
|