@etohq/workflow-engine-redis 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 +3 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +11 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/loaders/redis.d.ts +4 -0
- package/dist/loaders/redis.d.ts.map +1 -0
- package/dist/loaders/redis.js +64 -0
- package/dist/loaders/redis.js.map +1 -0
- package/dist/loaders/utils.d.ts +6 -0
- package/dist/loaders/utils.d.ts.map +1 -0
- package/dist/loaders/utils.js +11 -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/Migration20241206123341.d.ts +5 -0
- package/dist/migrations/Migration20241206123341.d.ts.map +1 -0
- package/dist/migrations/Migration20241206123341.js +19 -0
- package/dist/migrations/Migration20241206123341.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 +83 -0
- package/dist/services/workflow-orchestrator.d.ts.map +1 -0
- package/dist/services/workflow-orchestrator.js +514 -0
- package/dist/services/workflow-orchestrator.js.map +1 -0
- package/dist/services/workflows-module.d.ts +54 -0
- package/dist/services/workflows-module.d.ts.map +1 -0
- package/dist/services/workflows-module.js +113 -0
- package/dist/services/workflows-module.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +30 -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 +46 -0
- package/dist/utils/workflow-orchestrator-storage.d.ts.map +1 -0
- package/dist/utils/workflow-orchestrator-storage.js +262 -0
- package/dist/utils/workflow-orchestrator-storage.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,514 @@
|
|
|
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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
15
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
16
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
17
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
18
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
19
|
+
};
|
|
20
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
21
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
22
|
+
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");
|
|
23
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
24
|
+
};
|
|
25
|
+
var _WorkflowOrchestratorService_logger;
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.WorkflowOrchestratorService = void 0;
|
|
28
|
+
const orchestration_1 = require("@etohq/framework/orchestration");
|
|
29
|
+
const utils_1 = require("@etohq/framework/utils");
|
|
30
|
+
const workflows_sdk_1 = require("@etohq/framework/workflows-sdk");
|
|
31
|
+
const timers_1 = require("timers");
|
|
32
|
+
const ulid_1 = require("ulid");
|
|
33
|
+
const AnySubscriber = "any";
|
|
34
|
+
class WorkflowOrchestratorService {
|
|
35
|
+
constructor({ dataLoaderOnly, redisDistributedTransactionStorage, redisPublisher, redisSubscriber, sharedContainer, }) {
|
|
36
|
+
this.instanceId = (0, ulid_1.ulid)();
|
|
37
|
+
this.subscribers = new Map();
|
|
38
|
+
this.activeStepsCount = 0;
|
|
39
|
+
_WorkflowOrchestratorService_logger.set(this, void 0);
|
|
40
|
+
this.container_ = sharedContainer;
|
|
41
|
+
this.redisPublisher = redisPublisher;
|
|
42
|
+
this.redisSubscriber = redisSubscriber;
|
|
43
|
+
__classPrivateFieldSet(this, _WorkflowOrchestratorService_logger, this.container_.resolve("logger", { allowUnregistered: true }) ?? console, "f");
|
|
44
|
+
redisDistributedTransactionStorage.setWorkflowOrchestratorService(this);
|
|
45
|
+
if (!dataLoaderOnly) {
|
|
46
|
+
orchestration_1.DistributedTransaction.setStorage(redisDistributedTransactionStorage);
|
|
47
|
+
orchestration_1.WorkflowScheduler.setStorage(redisDistributedTransactionStorage);
|
|
48
|
+
}
|
|
49
|
+
this.redisDistributedTransactionStorage_ =
|
|
50
|
+
redisDistributedTransactionStorage;
|
|
51
|
+
this.redisSubscriber.on("message", async (_, message) => {
|
|
52
|
+
const { instanceId, data } = JSON.parse(message);
|
|
53
|
+
await this.notify(data, false, instanceId);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async onApplicationShutdown() {
|
|
57
|
+
await this.redisDistributedTransactionStorage_.onApplicationShutdown();
|
|
58
|
+
}
|
|
59
|
+
async onApplicationPrepareShutdown() {
|
|
60
|
+
// eslint-disable-next-line max-len
|
|
61
|
+
await this.redisDistributedTransactionStorage_.onApplicationPrepareShutdown();
|
|
62
|
+
while (this.activeStepsCount > 0) {
|
|
63
|
+
await new Promise((resolve) => (0, timers_1.setTimeout)(resolve, 1000));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async onApplicationStart() {
|
|
67
|
+
await this.redisDistributedTransactionStorage_.onApplicationStart();
|
|
68
|
+
}
|
|
69
|
+
async triggerParentStep(transaction, result) {
|
|
70
|
+
const metadata = transaction.flow.metadata;
|
|
71
|
+
const { parentStepIdempotencyKey } = metadata ?? {};
|
|
72
|
+
if (parentStepIdempotencyKey) {
|
|
73
|
+
const hasFailed = [
|
|
74
|
+
utils_1.TransactionState.REVERTED,
|
|
75
|
+
utils_1.TransactionState.FAILED,
|
|
76
|
+
].includes(transaction.flow.state);
|
|
77
|
+
if (hasFailed) {
|
|
78
|
+
await this.setStepFailure({
|
|
79
|
+
idempotencyKey: parentStepIdempotencyKey,
|
|
80
|
+
stepResponse: result,
|
|
81
|
+
options: {
|
|
82
|
+
logOnError: true,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
await this.setStepSuccess({
|
|
88
|
+
idempotencyKey: parentStepIdempotencyKey,
|
|
89
|
+
stepResponse: result,
|
|
90
|
+
options: {
|
|
91
|
+
logOnError: true,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async run(workflowIdOrWorkflow, options, sharedContext = {}) {
|
|
98
|
+
const { input, transactionId, resultFrom, logOnError, events: eventHandlers, container, } = options ?? {};
|
|
99
|
+
let { throwOnError, context } = options ?? {};
|
|
100
|
+
throwOnError ??= true;
|
|
101
|
+
context ??= {};
|
|
102
|
+
context.transactionId ??= transactionId ?? (0, ulid_1.ulid)();
|
|
103
|
+
const workflowId = (0, utils_1.isString)(workflowIdOrWorkflow)
|
|
104
|
+
? workflowIdOrWorkflow
|
|
105
|
+
: workflowIdOrWorkflow.getName();
|
|
106
|
+
if (!workflowId) {
|
|
107
|
+
throw new Error("Workflow ID is required");
|
|
108
|
+
}
|
|
109
|
+
const events = this.buildWorkflowEvents({
|
|
110
|
+
customEventHandlers: eventHandlers,
|
|
111
|
+
workflowId,
|
|
112
|
+
transactionId: context.transactionId,
|
|
113
|
+
});
|
|
114
|
+
const exportedWorkflow = workflows_sdk_1.EtoWorkflow.getWorkflow(workflowId);
|
|
115
|
+
if (!exportedWorkflow) {
|
|
116
|
+
throw new Error(`Workflow with id "${workflowId}" not found.`);
|
|
117
|
+
}
|
|
118
|
+
const originalOnFinishHandler = events.onFinish;
|
|
119
|
+
delete events.onFinish;
|
|
120
|
+
const ret = await exportedWorkflow.run({
|
|
121
|
+
input,
|
|
122
|
+
throwOnError: false,
|
|
123
|
+
logOnError,
|
|
124
|
+
resultFrom,
|
|
125
|
+
context,
|
|
126
|
+
events,
|
|
127
|
+
container: container ?? this.container_,
|
|
128
|
+
});
|
|
129
|
+
const hasFinished = ret.transaction.hasFinished();
|
|
130
|
+
const metadata = ret.transaction.getFlow().metadata;
|
|
131
|
+
const { parentStepIdempotencyKey } = metadata ?? {};
|
|
132
|
+
const hasFailed = [
|
|
133
|
+
utils_1.TransactionState.REVERTED,
|
|
134
|
+
utils_1.TransactionState.FAILED,
|
|
135
|
+
].includes(ret.transaction.getFlow().state);
|
|
136
|
+
const acknowledgement = {
|
|
137
|
+
transactionId: context.transactionId,
|
|
138
|
+
workflowId: workflowId,
|
|
139
|
+
parentStepIdempotencyKey,
|
|
140
|
+
hasFinished,
|
|
141
|
+
hasFailed,
|
|
142
|
+
};
|
|
143
|
+
if (hasFinished) {
|
|
144
|
+
const { result, errors } = ret;
|
|
145
|
+
await originalOnFinishHandler({
|
|
146
|
+
transaction: ret.transaction,
|
|
147
|
+
result,
|
|
148
|
+
errors,
|
|
149
|
+
});
|
|
150
|
+
await this.triggerParentStep(ret.transaction, result);
|
|
151
|
+
}
|
|
152
|
+
if (throwOnError && ret.thrownError) {
|
|
153
|
+
throw ret.thrownError;
|
|
154
|
+
}
|
|
155
|
+
return { acknowledgement, ...ret };
|
|
156
|
+
}
|
|
157
|
+
async getRunningTransaction(workflowId, transactionId, options, sharedContext = {}) {
|
|
158
|
+
let { context } = options ?? {};
|
|
159
|
+
if (!workflowId) {
|
|
160
|
+
throw new Error("Workflow ID is required");
|
|
161
|
+
}
|
|
162
|
+
if (!transactionId) {
|
|
163
|
+
throw new Error("TransactionId ID is required");
|
|
164
|
+
}
|
|
165
|
+
context ??= {};
|
|
166
|
+
context.transactionId ??= transactionId;
|
|
167
|
+
const exportedWorkflow = workflows_sdk_1.EtoWorkflow.getWorkflow(workflowId);
|
|
168
|
+
if (!exportedWorkflow) {
|
|
169
|
+
throw new Error(`Workflow with id "${workflowId}" not found.`);
|
|
170
|
+
}
|
|
171
|
+
const transaction = await exportedWorkflow.getRunningTransaction(transactionId, context);
|
|
172
|
+
return transaction;
|
|
173
|
+
}
|
|
174
|
+
async setStepSuccess({ idempotencyKey, stepResponse, options, }, sharedContext = {}) {
|
|
175
|
+
const { context, logOnError, resultFrom, container, events: eventHandlers, } = options ?? {};
|
|
176
|
+
let { throwOnError } = options ?? {};
|
|
177
|
+
throwOnError ??= true;
|
|
178
|
+
const [idempotencyKey_, { workflowId, transactionId }] = this.buildIdempotencyKeyAndParts(idempotencyKey);
|
|
179
|
+
const exportedWorkflow = workflows_sdk_1.EtoWorkflow.getWorkflow(workflowId);
|
|
180
|
+
if (!exportedWorkflow) {
|
|
181
|
+
throw new Error(`Workflow with id "${workflowId}" not found.`);
|
|
182
|
+
}
|
|
183
|
+
const events = this.buildWorkflowEvents({
|
|
184
|
+
customEventHandlers: eventHandlers,
|
|
185
|
+
transactionId,
|
|
186
|
+
workflowId,
|
|
187
|
+
});
|
|
188
|
+
const originalOnFinishHandler = events.onFinish;
|
|
189
|
+
delete events.onFinish;
|
|
190
|
+
const ret = await exportedWorkflow.registerStepSuccess({
|
|
191
|
+
idempotencyKey: idempotencyKey_,
|
|
192
|
+
context,
|
|
193
|
+
resultFrom,
|
|
194
|
+
throwOnError: false,
|
|
195
|
+
logOnError,
|
|
196
|
+
events,
|
|
197
|
+
response: stepResponse,
|
|
198
|
+
container: container ?? this.container_,
|
|
199
|
+
});
|
|
200
|
+
if (ret.transaction.hasFinished()) {
|
|
201
|
+
const { result, errors } = ret;
|
|
202
|
+
await originalOnFinishHandler({
|
|
203
|
+
transaction: ret.transaction,
|
|
204
|
+
result,
|
|
205
|
+
errors,
|
|
206
|
+
});
|
|
207
|
+
await this.triggerParentStep(ret.transaction, result);
|
|
208
|
+
}
|
|
209
|
+
if (throwOnError && ret.thrownError) {
|
|
210
|
+
throw ret.thrownError;
|
|
211
|
+
}
|
|
212
|
+
return ret;
|
|
213
|
+
}
|
|
214
|
+
async setStepFailure({ idempotencyKey, stepResponse, options, }, sharedContext = {}) {
|
|
215
|
+
const { context, logOnError, resultFrom, container, events: eventHandlers, } = options ?? {};
|
|
216
|
+
let { throwOnError } = options ?? {};
|
|
217
|
+
throwOnError ??= true;
|
|
218
|
+
const [idempotencyKey_, { workflowId, transactionId }] = this.buildIdempotencyKeyAndParts(idempotencyKey);
|
|
219
|
+
const exportedWorkflow = workflows_sdk_1.EtoWorkflow.getWorkflow(workflowId);
|
|
220
|
+
if (!exportedWorkflow) {
|
|
221
|
+
throw new Error(`Workflow with id "${workflowId}" not found.`);
|
|
222
|
+
}
|
|
223
|
+
const events = this.buildWorkflowEvents({
|
|
224
|
+
customEventHandlers: eventHandlers,
|
|
225
|
+
transactionId,
|
|
226
|
+
workflowId,
|
|
227
|
+
});
|
|
228
|
+
const originalOnFinishHandler = events.onFinish;
|
|
229
|
+
delete events.onFinish;
|
|
230
|
+
const ret = await exportedWorkflow.registerStepFailure({
|
|
231
|
+
idempotencyKey: idempotencyKey_,
|
|
232
|
+
context,
|
|
233
|
+
resultFrom,
|
|
234
|
+
throwOnError: false,
|
|
235
|
+
logOnError,
|
|
236
|
+
events,
|
|
237
|
+
response: stepResponse,
|
|
238
|
+
container: container ?? this.container_,
|
|
239
|
+
});
|
|
240
|
+
if (ret.transaction.hasFinished()) {
|
|
241
|
+
const { result, errors } = ret;
|
|
242
|
+
await originalOnFinishHandler({
|
|
243
|
+
transaction: ret.transaction,
|
|
244
|
+
result,
|
|
245
|
+
errors,
|
|
246
|
+
});
|
|
247
|
+
await this.triggerParentStep(ret.transaction, result);
|
|
248
|
+
}
|
|
249
|
+
if (throwOnError && ret.thrownError) {
|
|
250
|
+
throw ret.thrownError;
|
|
251
|
+
}
|
|
252
|
+
return ret;
|
|
253
|
+
}
|
|
254
|
+
subscribe({ workflowId, transactionId, subscriber, subscriberId }, sharedContext = {}) {
|
|
255
|
+
subscriber._id = subscriberId;
|
|
256
|
+
const subscribers = this.subscribers.get(workflowId) ?? new Map();
|
|
257
|
+
// Subscribe instance to redis
|
|
258
|
+
if (!this.subscribers.has(workflowId)) {
|
|
259
|
+
void this.redisSubscriber.subscribe(this.getChannelName(workflowId));
|
|
260
|
+
}
|
|
261
|
+
const handlerIndex = (handlers) => {
|
|
262
|
+
return handlers.indexOf((s) => s === subscriber || s._id === subscriberId);
|
|
263
|
+
};
|
|
264
|
+
if (transactionId) {
|
|
265
|
+
const transactionSubscribers = subscribers.get(transactionId) ?? [];
|
|
266
|
+
const subscriberIndex = handlerIndex(transactionSubscribers);
|
|
267
|
+
if (subscriberIndex !== -1) {
|
|
268
|
+
transactionSubscribers.slice(subscriberIndex, 1);
|
|
269
|
+
}
|
|
270
|
+
transactionSubscribers.push(subscriber);
|
|
271
|
+
subscribers.set(transactionId, transactionSubscribers);
|
|
272
|
+
this.subscribers.set(workflowId, subscribers);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const workflowSubscribers = subscribers.get(AnySubscriber) ?? [];
|
|
276
|
+
const subscriberIndex = handlerIndex(workflowSubscribers);
|
|
277
|
+
if (subscriberIndex !== -1) {
|
|
278
|
+
workflowSubscribers.slice(subscriberIndex, 1);
|
|
279
|
+
}
|
|
280
|
+
workflowSubscribers.push(subscriber);
|
|
281
|
+
subscribers.set(AnySubscriber, workflowSubscribers);
|
|
282
|
+
this.subscribers.set(workflowId, subscribers);
|
|
283
|
+
}
|
|
284
|
+
unsubscribe({ workflowId, transactionId, subscriberOrId }, sharedContext = {}) {
|
|
285
|
+
const subscribers = this.subscribers.get(workflowId) ?? new Map();
|
|
286
|
+
const filterSubscribers = (handlers) => {
|
|
287
|
+
return handlers.filter((handler) => {
|
|
288
|
+
return handler._id
|
|
289
|
+
? handler._id !== subscriberOrId
|
|
290
|
+
: handler !== subscriberOrId;
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
// Unsubscribe instance
|
|
294
|
+
if (!this.subscribers.has(workflowId)) {
|
|
295
|
+
void this.redisSubscriber.unsubscribe(this.getChannelName(workflowId));
|
|
296
|
+
}
|
|
297
|
+
if (transactionId) {
|
|
298
|
+
const transactionSubscribers = subscribers.get(transactionId) ?? [];
|
|
299
|
+
const newTransactionSubscribers = filterSubscribers(transactionSubscribers);
|
|
300
|
+
subscribers.set(transactionId, newTransactionSubscribers);
|
|
301
|
+
this.subscribers.set(workflowId, subscribers);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const workflowSubscribers = subscribers.get(AnySubscriber) ?? [];
|
|
305
|
+
const newWorkflowSubscribers = filterSubscribers(workflowSubscribers);
|
|
306
|
+
subscribers.set(AnySubscriber, newWorkflowSubscribers);
|
|
307
|
+
this.subscribers.set(workflowId, subscribers);
|
|
308
|
+
}
|
|
309
|
+
async notify(options, publish = true, instanceId = this.instanceId) {
|
|
310
|
+
if (!publish && instanceId === this.instanceId) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (publish) {
|
|
314
|
+
const channel = this.getChannelName(options.workflowId);
|
|
315
|
+
const message = JSON.stringify({
|
|
316
|
+
instanceId: this.instanceId,
|
|
317
|
+
data: options,
|
|
318
|
+
});
|
|
319
|
+
await this.redisPublisher.publish(channel, message);
|
|
320
|
+
}
|
|
321
|
+
const { eventType, workflowId, transactionId, errors, result, step, response, } = options;
|
|
322
|
+
const subscribers = this.subscribers.get(workflowId) ?? new Map();
|
|
323
|
+
const notifySubscribers = (handlers) => {
|
|
324
|
+
handlers.forEach((handler) => {
|
|
325
|
+
const args = {
|
|
326
|
+
eventType,
|
|
327
|
+
workflowId,
|
|
328
|
+
transactionId,
|
|
329
|
+
step,
|
|
330
|
+
response,
|
|
331
|
+
result,
|
|
332
|
+
errors,
|
|
333
|
+
};
|
|
334
|
+
const isPromise = "then" in handler;
|
|
335
|
+
if (isPromise) {
|
|
336
|
+
;
|
|
337
|
+
handler(args).catch((e) => {
|
|
338
|
+
__classPrivateFieldGet(this, _WorkflowOrchestratorService_logger, "f").error(e);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
try {
|
|
343
|
+
handler(args);
|
|
344
|
+
}
|
|
345
|
+
catch (e) {
|
|
346
|
+
__classPrivateFieldGet(this, _WorkflowOrchestratorService_logger, "f").error(e);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
};
|
|
351
|
+
if (transactionId) {
|
|
352
|
+
const transactionSubscribers = subscribers.get(transactionId) ?? [];
|
|
353
|
+
notifySubscribers(transactionSubscribers);
|
|
354
|
+
// removes transaction id subscribers on finish
|
|
355
|
+
if (eventType === "onFinish") {
|
|
356
|
+
subscribers.delete(transactionId);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const workflowSubscribers = subscribers.get(AnySubscriber) ?? [];
|
|
360
|
+
notifySubscribers(workflowSubscribers);
|
|
361
|
+
}
|
|
362
|
+
getChannelName(workflowId) {
|
|
363
|
+
return `orchestrator:${workflowId}`;
|
|
364
|
+
}
|
|
365
|
+
buildWorkflowEvents({ customEventHandlers, workflowId, transactionId, }) {
|
|
366
|
+
const notify = async ({ eventType, step, result, response, errors, }) => {
|
|
367
|
+
await this.notify({
|
|
368
|
+
workflowId,
|
|
369
|
+
transactionId,
|
|
370
|
+
eventType,
|
|
371
|
+
response,
|
|
372
|
+
step,
|
|
373
|
+
result,
|
|
374
|
+
errors,
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
return {
|
|
378
|
+
onTimeout: async ({ transaction }) => {
|
|
379
|
+
customEventHandlers?.onTimeout?.({ transaction });
|
|
380
|
+
await notify({ eventType: "onTimeout" });
|
|
381
|
+
},
|
|
382
|
+
onBegin: async ({ transaction }) => {
|
|
383
|
+
customEventHandlers?.onBegin?.({ transaction });
|
|
384
|
+
await notify({ eventType: "onBegin" });
|
|
385
|
+
},
|
|
386
|
+
onResume: async ({ transaction }) => {
|
|
387
|
+
customEventHandlers?.onResume?.({ transaction });
|
|
388
|
+
await notify({ eventType: "onResume" });
|
|
389
|
+
},
|
|
390
|
+
onCompensateBegin: async ({ transaction }) => {
|
|
391
|
+
customEventHandlers?.onCompensateBegin?.({ transaction });
|
|
392
|
+
await notify({ eventType: "onCompensateBegin" });
|
|
393
|
+
},
|
|
394
|
+
onFinish: async ({ transaction, result, errors }) => {
|
|
395
|
+
customEventHandlers?.onFinish?.({ transaction, result, errors });
|
|
396
|
+
await notify({ eventType: "onFinish" });
|
|
397
|
+
},
|
|
398
|
+
onStepBegin: async ({ step, transaction }) => {
|
|
399
|
+
customEventHandlers?.onStepBegin?.({ step, transaction });
|
|
400
|
+
this.activeStepsCount++;
|
|
401
|
+
await notify({ eventType: "onStepBegin", step });
|
|
402
|
+
},
|
|
403
|
+
onStepSuccess: async ({ step, transaction }) => {
|
|
404
|
+
const stepName = step.definition.action;
|
|
405
|
+
const response = await (0, workflows_sdk_1.resolveValue)(transaction.getContext().invoke[stepName], transaction);
|
|
406
|
+
customEventHandlers?.onStepSuccess?.({ step, transaction, response });
|
|
407
|
+
await notify({ eventType: "onStepSuccess", step, response });
|
|
408
|
+
this.activeStepsCount--;
|
|
409
|
+
},
|
|
410
|
+
onStepFailure: async ({ step, transaction }) => {
|
|
411
|
+
const stepName = step.definition.action;
|
|
412
|
+
const errors = transaction
|
|
413
|
+
.getErrors(orchestration_1.TransactionHandlerType.INVOKE)
|
|
414
|
+
.filter((err) => err.action === stepName);
|
|
415
|
+
customEventHandlers?.onStepFailure?.({ step, transaction, errors });
|
|
416
|
+
await notify({ eventType: "onStepFailure", step, errors });
|
|
417
|
+
this.activeStepsCount--;
|
|
418
|
+
},
|
|
419
|
+
onStepAwaiting: async ({ step, transaction }) => {
|
|
420
|
+
customEventHandlers?.onStepAwaiting?.({ step, transaction });
|
|
421
|
+
await notify({ eventType: "onStepAwaiting", step });
|
|
422
|
+
this.activeStepsCount--;
|
|
423
|
+
},
|
|
424
|
+
onCompensateStepSuccess: async ({ step, transaction }) => {
|
|
425
|
+
const stepName = step.definition.action;
|
|
426
|
+
const response = transaction.getContext().compensate[stepName];
|
|
427
|
+
customEventHandlers?.onCompensateStepSuccess?.({
|
|
428
|
+
step,
|
|
429
|
+
transaction,
|
|
430
|
+
response,
|
|
431
|
+
});
|
|
432
|
+
await notify({ eventType: "onCompensateStepSuccess", step, response });
|
|
433
|
+
},
|
|
434
|
+
onCompensateStepFailure: async ({ step, transaction }) => {
|
|
435
|
+
const stepName = step.definition.action;
|
|
436
|
+
const errors = transaction
|
|
437
|
+
.getErrors(orchestration_1.TransactionHandlerType.COMPENSATE)
|
|
438
|
+
.filter((err) => err.action === stepName);
|
|
439
|
+
customEventHandlers?.onStepFailure?.({ step, transaction, errors });
|
|
440
|
+
await notify({ eventType: "onCompensateStepFailure", step, errors });
|
|
441
|
+
},
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
buildIdempotencyKeyAndParts(idempotencyKey) {
|
|
445
|
+
const parts = {
|
|
446
|
+
workflowId: "",
|
|
447
|
+
transactionId: "",
|
|
448
|
+
stepId: "",
|
|
449
|
+
action: "invoke",
|
|
450
|
+
};
|
|
451
|
+
let idempotencyKey_ = idempotencyKey;
|
|
452
|
+
const setParts = (workflowId, transactionId, stepId, action) => {
|
|
453
|
+
parts.workflowId = workflowId;
|
|
454
|
+
parts.transactionId = transactionId;
|
|
455
|
+
parts.stepId = stepId;
|
|
456
|
+
parts.action = action;
|
|
457
|
+
};
|
|
458
|
+
if (!(0, utils_1.isString)(idempotencyKey)) {
|
|
459
|
+
const { workflowId, transactionId, stepId, action } = idempotencyKey;
|
|
460
|
+
idempotencyKey_ = [workflowId, transactionId, stepId, action].join(":");
|
|
461
|
+
setParts(workflowId, transactionId, stepId, action);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
const [workflowId, transactionId, stepId, action] = idempotencyKey_.split(":");
|
|
465
|
+
setParts(workflowId, transactionId, stepId, action);
|
|
466
|
+
}
|
|
467
|
+
return [idempotencyKey_, parts];
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
exports.WorkflowOrchestratorService = WorkflowOrchestratorService;
|
|
471
|
+
_WorkflowOrchestratorService_logger = new WeakMap();
|
|
472
|
+
__decorate([
|
|
473
|
+
(0, utils_1.InjectSharedContext)(),
|
|
474
|
+
__param(2, (0, utils_1.EtoContext)()),
|
|
475
|
+
__metadata("design:type", Function),
|
|
476
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
477
|
+
__metadata("design:returntype", Promise)
|
|
478
|
+
], WorkflowOrchestratorService.prototype, "run", null);
|
|
479
|
+
__decorate([
|
|
480
|
+
(0, utils_1.InjectSharedContext)(),
|
|
481
|
+
__param(3, (0, utils_1.EtoContext)()),
|
|
482
|
+
__metadata("design:type", Function),
|
|
483
|
+
__metadata("design:paramtypes", [String, String, Object, Object]),
|
|
484
|
+
__metadata("design:returntype", Promise)
|
|
485
|
+
], WorkflowOrchestratorService.prototype, "getRunningTransaction", null);
|
|
486
|
+
__decorate([
|
|
487
|
+
(0, utils_1.InjectSharedContext)(),
|
|
488
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
489
|
+
__metadata("design:type", Function),
|
|
490
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
491
|
+
__metadata("design:returntype", Promise)
|
|
492
|
+
], WorkflowOrchestratorService.prototype, "setStepSuccess", null);
|
|
493
|
+
__decorate([
|
|
494
|
+
(0, utils_1.InjectSharedContext)(),
|
|
495
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
496
|
+
__metadata("design:type", Function),
|
|
497
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
498
|
+
__metadata("design:returntype", Promise)
|
|
499
|
+
], WorkflowOrchestratorService.prototype, "setStepFailure", null);
|
|
500
|
+
__decorate([
|
|
501
|
+
(0, utils_1.InjectSharedContext)(),
|
|
502
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
503
|
+
__metadata("design:type", Function),
|
|
504
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
505
|
+
__metadata("design:returntype", void 0)
|
|
506
|
+
], WorkflowOrchestratorService.prototype, "subscribe", null);
|
|
507
|
+
__decorate([
|
|
508
|
+
(0, utils_1.InjectSharedContext)(),
|
|
509
|
+
__param(1, (0, utils_1.EtoContext)()),
|
|
510
|
+
__metadata("design:type", Function),
|
|
511
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
512
|
+
__metadata("design:returntype", void 0)
|
|
513
|
+
], WorkflowOrchestratorService.prototype, "unsubscribe", null);
|
|
514
|
+
//# 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;AAOvC,kDAK+B;AAC/B,kEAKuC;AAEvC,mCAAmC;AACnC,+BAA2B;AA0D3B,MAAM,aAAa,GAAG,KAAK,CAAA;AAE3B,MAAa,2BAA2B;IAYtC,YAAY,EACV,cAAc,EACd,kCAAkC,EAClC,cAAc,EACd,eAAe,EACf,eAAe,GAQhB;QAxBO,eAAU,GAAG,IAAA,WAAI,GAAE,CAAA;QAInB,gBAAW,GAAgB,IAAI,GAAG,EAAE,CAAA;QACpC,qBAAgB,GAAW,CAAC,CAAA;QAE3B,sDAAe;QAkBtB,IAAI,CAAC,UAAU,GAAG,eAAe,CAAA;QACjC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;QACpC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;QAEtC,uBAAA,IAAI,uCACF,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,IAAI,OAAO,MAAA,CAAA;QAE3E,kCAAkC,CAAC,8BAA8B,CAAC,IAAI,CAAC,CAAA;QAEvE,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,sCAAsB,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAA;YACrE,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,CAAC,CAAA;YACvE,QAAQ,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QACrD,CAAC;aAAM,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;AA/oBD,kEA+oBC;;AA7iBO;IADL,IAAA,2BAAmB,GAAE;IAInB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;sDAkFd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAKnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;wEA0Bd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;iEA0Dd;AAGK;IADL,IAAA,2BAAmB,GAAE;IAWnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;iEA0Dd;AAGD;IADC,IAAA,2BAAmB,GAAE;IAGnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;4DAoCd;AAGD;IADC,IAAA,2BAAmB,GAAE;IAGnB,WAAA,IAAA,kBAAU,GAAE,CAAA;;;;8DA+Bd"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Context, DAL, InferEntityType, InternalModuleDeclaration, 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
|
+
redisDisconnectHandler: () => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
declare const WorkflowsModuleService_base: ModulesSdkUtils.EtoServiceReturnType<{
|
|
13
|
+
WorkflowExecution: {
|
|
14
|
+
dto: InferEntityType<typeof WorkflowExecution>;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
export declare class WorkflowsModuleService<TWorkflowExecution extends InferEntityType<typeof WorkflowExecution> = InferEntityType<typeof WorkflowExecution>> extends WorkflowsModuleService_base {
|
|
18
|
+
protected readonly moduleDeclaration: InternalModuleDeclaration;
|
|
19
|
+
protected baseRepository_: DAL.RepositoryService;
|
|
20
|
+
protected workflowExecutionService_: ModulesSdkTypes.IEtoInternalService<TWorkflowExecution>;
|
|
21
|
+
protected workflowOrchestratorService_: WorkflowOrchestratorService;
|
|
22
|
+
protected redisDisconnectHandler_: () => Promise<void>;
|
|
23
|
+
constructor({ baseRepository, workflowExecutionService, workflowOrchestratorService, redisDisconnectHandler, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
|
|
24
|
+
__hooks: {
|
|
25
|
+
onApplicationShutdown: () => Promise<void>;
|
|
26
|
+
onApplicationPrepareShutdown: () => Promise<void>;
|
|
27
|
+
onApplicationStart: () => Promise<void>;
|
|
28
|
+
};
|
|
29
|
+
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>;
|
|
30
|
+
getRunningTransaction(workflowId: string, transactionId: string, context?: Context): Promise<import("@etohq/framework/orchestration").DistributedTransactionType>;
|
|
31
|
+
setStepSuccess({ idempotencyKey, stepResponse, options, }: {
|
|
32
|
+
idempotencyKey: string | object;
|
|
33
|
+
stepResponse: unknown;
|
|
34
|
+
options?: Record<string, any>;
|
|
35
|
+
}, context?: Context): Promise<any>;
|
|
36
|
+
setStepFailure({ idempotencyKey, stepResponse, options, }: {
|
|
37
|
+
idempotencyKey: string | object;
|
|
38
|
+
stepResponse: unknown;
|
|
39
|
+
options?: Record<string, any>;
|
|
40
|
+
}, context?: Context): Promise<any>;
|
|
41
|
+
subscribe(args: {
|
|
42
|
+
workflowId: string;
|
|
43
|
+
transactionId?: string;
|
|
44
|
+
subscriber: Function;
|
|
45
|
+
subscriberId?: string;
|
|
46
|
+
}, context?: Context): Promise<void>;
|
|
47
|
+
unsubscribe(args: {
|
|
48
|
+
workflowId: string;
|
|
49
|
+
transactionId?: string;
|
|
50
|
+
subscriberOrId: string | Function;
|
|
51
|
+
}, context?: Context): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
//# 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,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,2BA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