@etohq/workflows-sdk 1.5.1-alpha.4 → 1.5.1-alpha.5
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/dist/eto-workflow.d.ts.map +1 -1
- package/dist/eto-workflow.js +3 -0
- package/dist/eto-workflow.js.map +1 -1
- package/dist/framework/src/deps/awilix.d.ts +2 -0
- package/dist/framework/src/deps/awilix.d.ts.map +1 -0
- package/dist/framework/src/deps/awilix.js +18 -0
- package/dist/framework/src/deps/awilix.js.map +1 -0
- package/dist/framework/src/types/container.d.ts +46 -0
- package/dist/framework/src/types/container.d.ts.map +1 -0
- package/dist/framework/src/types/container.js +3 -0
- package/dist/framework/src/types/container.js.map +1 -0
- package/dist/framework/src/utils/index.d.ts +3 -0
- package/dist/framework/src/utils/index.d.ts.map +1 -0
- package/dist/framework/src/utils/index.js +19 -0
- package/dist/framework/src/utils/index.js.map +1 -0
- package/dist/framework/src/zod/index.d.ts +3 -0
- package/dist/framework/src/zod/index.d.ts.map +1 -0
- package/dist/framework/src/zod/index.js +19 -0
- package/dist/framework/src/zod/index.js.map +1 -0
- package/dist/framework/src/zod/zod-helpers.d.ts +3 -0
- package/dist/framework/src/zod/zod-helpers.d.ts.map +1 -0
- package/dist/framework/src/zod/zod-helpers.js +95 -0
- package/dist/framework/src/zod/zod-helpers.js.map +1 -0
- package/dist/helper/type.d.ts +6 -1
- package/dist/helper/type.d.ts.map +1 -1
- package/dist/helper/workflow-export.d.ts.map +1 -1
- package/dist/helper/workflow-export.js +61 -24
- package/dist/helper/workflow-export.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/composer/create-hook.d.ts +2 -2
- package/dist/utils/composer/create-hook.d.ts.map +1 -1
- package/dist/utils/composer/create-hook.js +2 -2
- package/dist/utils/composer/create-hook.js.map +1 -1
- package/dist/utils/composer/create-step.d.ts +0 -12
- package/dist/utils/composer/create-step.d.ts.map +1 -1
- package/dist/utils/composer/create-step.js +27 -14
- package/dist/utils/composer/create-step.js.map +1 -1
- package/dist/utils/composer/create-workflow.d.ts +1 -2
- package/dist/utils/composer/create-workflow.d.ts.map +1 -1
- package/dist/utils/composer/create-workflow.js +23 -11
- package/dist/utils/composer/create-workflow.js.map +1 -1
- package/dist/utils/composer/helpers/create-step-handler.d.ts.map +1 -1
- package/dist/utils/composer/helpers/create-step-handler.js +27 -5
- package/dist/utils/composer/helpers/create-step-handler.js.map +1 -1
- package/dist/utils/composer/helpers/proxy.d.ts.map +1 -1
- package/dist/utils/composer/helpers/proxy.js +3 -10
- package/dist/utils/composer/helpers/proxy.js.map +1 -1
- package/dist/utils/composer/helpers/resolve-value.d.ts +7 -4
- package/dist/utils/composer/helpers/resolve-value.d.ts.map +1 -1
- package/dist/utils/composer/helpers/resolve-value.js +176 -32
- package/dist/utils/composer/helpers/resolve-value.js.map +1 -1
- package/dist/utils/composer/transform.d.ts.map +1 -1
- package/dist/utils/composer/transform.js +15 -8
- package/dist/utils/composer/transform.js.map +1 -1
- package/dist/utils/composer/type.d.ts +7 -3
- package/dist/utils/composer/type.d.ts.map +1 -1
- package/dist/utils/composer/when.d.ts +1 -1
- package/dist/workflows-sdk/src/eto-workflow.d.ts +3 -0
- package/dist/workflows-sdk/src/eto-workflow.d.ts.map +1 -0
- package/dist/workflows-sdk/src/eto-workflow.js +22 -0
- package/dist/workflows-sdk/src/eto-workflow.js.map +1 -0
- package/dist/workflows-sdk/src/helper/index.d.ts +3 -0
- package/dist/workflows-sdk/src/helper/index.d.ts.map +1 -0
- package/dist/workflows-sdk/src/helper/index.js +19 -0
- package/dist/workflows-sdk/src/helper/index.js.map +1 -0
- package/dist/workflows-sdk/src/helper/type.d.ts +71 -0
- package/dist/workflows-sdk/src/helper/type.d.ts.map +1 -0
- package/dist/workflows-sdk/src/helper/type.js +3 -0
- package/dist/workflows-sdk/src/helper/type.js.map +1 -0
- package/dist/workflows-sdk/src/helper/workflow-export.d.ts +6 -0
- package/dist/workflows-sdk/src/helper/workflow-export.d.ts.map +1 -0
- package/dist/workflows-sdk/src/helper/workflow-export.js +291 -0
- package/dist/workflows-sdk/src/helper/workflow-export.js.map +1 -0
- package/dist/workflows-sdk/src/index.d.ts +5 -0
- package/dist/workflows-sdk/src/index.d.ts.map +1 -0
- package/dist/workflows-sdk/src/index.js +44 -0
- package/dist/workflows-sdk/src/index.js.map +1 -0
- package/dist/workflows-sdk/src/utils/_playground.d.ts +2 -0
- package/dist/workflows-sdk/src/utils/_playground.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/_playground.js +40 -0
- package/dist/workflows-sdk/src/utils/_playground.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/create-hook.d.ts +60 -0
- package/dist/workflows-sdk/src/utils/composer/create-hook.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/create-hook.js +97 -0
- package/dist/workflows-sdk/src/utils/composer/create-hook.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/create-step.d.ts +134 -0
- package/dist/workflows-sdk/src/utils/composer/create-step.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/create-step.js +262 -0
- package/dist/workflows-sdk/src/utils/composer/create-step.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/create-workflow.d.ts +71 -0
- package/dist/workflows-sdk/src/utils/composer/create-workflow.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/create-workflow.js +230 -0
- package/dist/workflows-sdk/src/utils/composer/create-workflow.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/create-step-handler.d.ts +20 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/create-step-handler.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/create-step-handler.js +95 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/create-step-handler.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/index.d.ts +3 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/index.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/index.js +19 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/index.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/proxy.d.ts +3 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/proxy.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/proxy.js +18 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/proxy.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/resolve-value.d.ts +8 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/resolve-value.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/resolve-value.js +211 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/resolve-value.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/step-response.d.ts +126 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/step-response.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/step-response.js +166 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/step-response.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/workflow-response.d.ts +20 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/workflow-response.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/workflow-response.js +16 -0
- package/dist/workflows-sdk/src/utils/composer/helpers/workflow-response.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/index.d.ts +11 -0
- package/dist/workflows-sdk/src/utils/composer/index.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/index.js +27 -0
- package/dist/workflows-sdk/src/utils/composer/index.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/parallelize.d.ts +43 -0
- package/dist/workflows-sdk/src/utils/composer/parallelize.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/parallelize.js +57 -0
- package/dist/workflows-sdk/src/utils/composer/parallelize.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/transform.d.ts +79 -0
- package/dist/workflows-sdk/src/utils/composer/transform.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/transform.js +47 -0
- package/dist/workflows-sdk/src/utils/composer/transform.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/type.d.ts +243 -0
- package/dist/workflows-sdk/src/utils/composer/type.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/type.js +3 -0
- package/dist/workflows-sdk/src/utils/composer/type.js.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/when.d.ts +58 -0
- package/dist/workflows-sdk/src/utils/composer/when.d.ts.map +1 -0
- package/dist/workflows-sdk/src/utils/composer/when.js +67 -0
- package/dist/workflows-sdk/src/utils/composer/when.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exportWorkflow = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@etohq/modules-sdk");
|
|
5
|
+
const orchestration_1 = require("@etohq/orchestration");
|
|
6
|
+
const utils_1 = require("@etohq/utils");
|
|
7
|
+
const os_1 = require("os");
|
|
8
|
+
const ulid_1 = require("ulid");
|
|
9
|
+
const eto_workflow_1 = require("../eto-workflow");
|
|
10
|
+
const resolve_value_1 = require("../utils/composer/helpers/resolve-value");
|
|
11
|
+
// Cache for loaded modules to avoid repeated traversal
|
|
12
|
+
let cachedLoadedModules = null;
|
|
13
|
+
function getCachedLoadedModules() {
|
|
14
|
+
if (!cachedLoadedModules) {
|
|
15
|
+
cachedLoadedModules = modules_sdk_1.EtoModule.getLoadedModules().map((mod) => Object.values(mod)[0]);
|
|
16
|
+
}
|
|
17
|
+
return cachedLoadedModules;
|
|
18
|
+
}
|
|
19
|
+
function createContextualWorkflowRunner({ workflowId, defaultResult, options, container, }) {
|
|
20
|
+
const flow = new orchestration_1.LocalWorkflow(workflowId, container);
|
|
21
|
+
const originalRun = flow.run.bind(flow);
|
|
22
|
+
const originalRegisterStepSuccess = flow.registerStepSuccess.bind(flow);
|
|
23
|
+
const originalRegisterStepFailure = flow.registerStepFailure.bind(flow);
|
|
24
|
+
const originalCancel = flow.cancel.bind(flow);
|
|
25
|
+
const originalRetryStep = flow.retryStep.bind(flow);
|
|
26
|
+
const originalExecution = async (method, { throwOnError, logOnError = false, resultFrom, isCancel = false, container: executionContainer, forcePermanentFailure, }, transactionOrIdOrIdempotencyKey, input, context, events = {}) => {
|
|
27
|
+
if (!executionContainer) {
|
|
28
|
+
const container_ = flow.container;
|
|
29
|
+
if (!container_ || !(0, utils_1.isPresent)(container_?.registrations)) {
|
|
30
|
+
executionContainer = getCachedLoadedModules();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (executionContainer) {
|
|
34
|
+
flow.container = executionContainer;
|
|
35
|
+
}
|
|
36
|
+
const { eventGroupId, parentStepIdempotencyKey, preventReleaseEvents, cancelingFromParentStep, } = context;
|
|
37
|
+
if (!preventReleaseEvents) {
|
|
38
|
+
attachOnFinishReleaseEvents(events, flow, { logOnError });
|
|
39
|
+
}
|
|
40
|
+
const flowMetadata = {
|
|
41
|
+
eventGroupId,
|
|
42
|
+
parentStepIdempotencyKey,
|
|
43
|
+
sourcePath: options?.sourcePath,
|
|
44
|
+
preventReleaseEvents,
|
|
45
|
+
cancelingFromParentStep,
|
|
46
|
+
};
|
|
47
|
+
context.isCancelling = isCancel;
|
|
48
|
+
const args = [transactionOrIdOrIdempotencyKey, input, context, events];
|
|
49
|
+
if (method === originalRegisterStepFailure) {
|
|
50
|
+
// Only available on registerStepFailure
|
|
51
|
+
args.push(forcePermanentFailure);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
args.push(flowMetadata);
|
|
55
|
+
}
|
|
56
|
+
const transaction = (await method.apply(method, args));
|
|
57
|
+
let errors = transaction.getErrors(utils_1.TransactionHandlerType.INVOKE);
|
|
58
|
+
const failedStatus = [orchestration_1.TransactionState.FAILED, orchestration_1.TransactionState.REVERTED];
|
|
59
|
+
const isCancelled = isCancel && transaction.getState() === orchestration_1.TransactionState.REVERTED;
|
|
60
|
+
const isRegisterStepFailure = method === originalRegisterStepFailure &&
|
|
61
|
+
transaction.getState() === orchestration_1.TransactionState.REVERTED;
|
|
62
|
+
let thrownError = null;
|
|
63
|
+
if (failedStatus.includes(transaction.getState()) &&
|
|
64
|
+
!isCancelled &&
|
|
65
|
+
!isRegisterStepFailure) {
|
|
66
|
+
const firstError = errors?.[0]?.error ?? new Error("Unknown error");
|
|
67
|
+
thrownError = firstError;
|
|
68
|
+
if (throwOnError) {
|
|
69
|
+
throw firstError;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let result;
|
|
73
|
+
if (options?.wrappedInput) {
|
|
74
|
+
result = (0, resolve_value_1.resolveValue)(resultFrom, transaction.getContext());
|
|
75
|
+
if (result instanceof Promise) {
|
|
76
|
+
result = await result.catch((e) => {
|
|
77
|
+
thrownError = e;
|
|
78
|
+
if (throwOnError) {
|
|
79
|
+
throw e;
|
|
80
|
+
}
|
|
81
|
+
errors ??= [];
|
|
82
|
+
errors.push(e);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
result =
|
|
88
|
+
resultFrom && transaction.getContext().invoke?.[resultFrom.toString()];
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
errors,
|
|
92
|
+
transaction,
|
|
93
|
+
result,
|
|
94
|
+
thrownError,
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
const newRun = async ({ input, context: outerContext, throwOnError, logOnError, resultFrom, events, container, } = {}) => {
|
|
98
|
+
resultFrom ??= defaultResult;
|
|
99
|
+
throwOnError ??= true;
|
|
100
|
+
logOnError ??= false;
|
|
101
|
+
const context = {
|
|
102
|
+
...outerContext,
|
|
103
|
+
__type: utils_1.EtoContextType,
|
|
104
|
+
};
|
|
105
|
+
const uniqId = (0, ulid_1.ulid)();
|
|
106
|
+
context.transactionId ??= "auto-" + uniqId;
|
|
107
|
+
context.eventGroupId ??= uniqId;
|
|
108
|
+
return await originalExecution(originalRun, {
|
|
109
|
+
throwOnError,
|
|
110
|
+
resultFrom,
|
|
111
|
+
container,
|
|
112
|
+
logOnError,
|
|
113
|
+
}, context.transactionId, input, context, events);
|
|
114
|
+
};
|
|
115
|
+
flow.run = newRun;
|
|
116
|
+
const newRegisterStepSuccess = async ({ response, idempotencyKey, context: outerContext, throwOnError, logOnError, resultFrom, events, container, } = {
|
|
117
|
+
idempotencyKey: "",
|
|
118
|
+
}) => {
|
|
119
|
+
idempotencyKey ??= "";
|
|
120
|
+
resultFrom ??= defaultResult;
|
|
121
|
+
throwOnError ??= true;
|
|
122
|
+
logOnError ??= false;
|
|
123
|
+
const [, transactionId] = idempotencyKey.split(":");
|
|
124
|
+
const context = {
|
|
125
|
+
...outerContext,
|
|
126
|
+
transactionId,
|
|
127
|
+
__type: utils_1.EtoContextType,
|
|
128
|
+
};
|
|
129
|
+
context.eventGroupId ??= (0, ulid_1.ulid)();
|
|
130
|
+
return await originalExecution(originalRegisterStepSuccess, {
|
|
131
|
+
throwOnError,
|
|
132
|
+
resultFrom,
|
|
133
|
+
container,
|
|
134
|
+
logOnError,
|
|
135
|
+
}, idempotencyKey, response, context, events);
|
|
136
|
+
};
|
|
137
|
+
flow.registerStepSuccess = newRegisterStepSuccess;
|
|
138
|
+
const newRegisterStepFailure = async ({ response, idempotencyKey, context: outerContext, throwOnError, logOnError, resultFrom, events, container, forcePermanentFailure, } = {
|
|
139
|
+
idempotencyKey: "",
|
|
140
|
+
}) => {
|
|
141
|
+
idempotencyKey ??= "";
|
|
142
|
+
resultFrom ??= defaultResult;
|
|
143
|
+
throwOnError ??= true;
|
|
144
|
+
logOnError ??= false;
|
|
145
|
+
const [, transactionId] = idempotencyKey.split(":");
|
|
146
|
+
const context = {
|
|
147
|
+
...outerContext,
|
|
148
|
+
transactionId,
|
|
149
|
+
__type: utils_1.EtoContextType,
|
|
150
|
+
};
|
|
151
|
+
context.eventGroupId ??= (0, ulid_1.ulid)();
|
|
152
|
+
return await originalExecution(originalRegisterStepFailure, {
|
|
153
|
+
throwOnError,
|
|
154
|
+
resultFrom,
|
|
155
|
+
container,
|
|
156
|
+
logOnError,
|
|
157
|
+
forcePermanentFailure,
|
|
158
|
+
}, idempotencyKey, response, context, events);
|
|
159
|
+
};
|
|
160
|
+
flow.registerStepFailure = newRegisterStepFailure;
|
|
161
|
+
const newRetryStep = async ({ idempotencyKey, context: outerContext, throwOnError, logOnError, events, container, } = {
|
|
162
|
+
idempotencyKey: "",
|
|
163
|
+
}) => {
|
|
164
|
+
idempotencyKey ??= "";
|
|
165
|
+
throwOnError ??= true;
|
|
166
|
+
logOnError ??= false;
|
|
167
|
+
const [, transactionId] = idempotencyKey.split(":");
|
|
168
|
+
const context = {
|
|
169
|
+
...outerContext,
|
|
170
|
+
transactionId,
|
|
171
|
+
__type: utils_1.EtoContextType,
|
|
172
|
+
};
|
|
173
|
+
context.eventGroupId ??= (0, ulid_1.ulid)();
|
|
174
|
+
return await originalExecution(originalRetryStep, {
|
|
175
|
+
throwOnError,
|
|
176
|
+
container,
|
|
177
|
+
logOnError,
|
|
178
|
+
}, idempotencyKey, undefined, context, events);
|
|
179
|
+
};
|
|
180
|
+
flow.retryStep = newRetryStep;
|
|
181
|
+
const newCancel = async ({ transaction, transactionId, context: outerContext, throwOnError, logOnError, events, container, } = {}) => {
|
|
182
|
+
throwOnError ??= true;
|
|
183
|
+
logOnError ??= false;
|
|
184
|
+
const context = {
|
|
185
|
+
...outerContext,
|
|
186
|
+
transactionId,
|
|
187
|
+
__type: utils_1.EtoContextType,
|
|
188
|
+
};
|
|
189
|
+
context.eventGroupId ??= (0, ulid_1.ulid)();
|
|
190
|
+
return await originalExecution(originalCancel, {
|
|
191
|
+
throwOnError,
|
|
192
|
+
resultFrom: undefined,
|
|
193
|
+
isCancel: true,
|
|
194
|
+
container,
|
|
195
|
+
logOnError,
|
|
196
|
+
}, transaction ?? transactionId, undefined, context, events);
|
|
197
|
+
};
|
|
198
|
+
flow.cancel = newCancel;
|
|
199
|
+
return flow;
|
|
200
|
+
}
|
|
201
|
+
const exportWorkflow = (workflowId, defaultResult, options) => {
|
|
202
|
+
function exportedWorkflow(
|
|
203
|
+
// TODO: rm when all usage have been migrated
|
|
204
|
+
container) {
|
|
205
|
+
return createContextualWorkflowRunner({
|
|
206
|
+
workflowId,
|
|
207
|
+
defaultResult,
|
|
208
|
+
options,
|
|
209
|
+
container,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const buildRunnerFn = (action, container) => {
|
|
213
|
+
const contextualRunner = createContextualWorkflowRunner({
|
|
214
|
+
workflowId,
|
|
215
|
+
defaultResult,
|
|
216
|
+
options,
|
|
217
|
+
container,
|
|
218
|
+
});
|
|
219
|
+
return contextualRunner[action];
|
|
220
|
+
};
|
|
221
|
+
exportedWorkflow.run = async (args) => {
|
|
222
|
+
const container = args?.container;
|
|
223
|
+
delete args?.container;
|
|
224
|
+
return await buildRunnerFn("run", container)(args);
|
|
225
|
+
};
|
|
226
|
+
exportedWorkflow.registerStepSuccess = async (args) => {
|
|
227
|
+
const container = args?.container;
|
|
228
|
+
delete args?.container;
|
|
229
|
+
return await buildRunnerFn("registerStepSuccess", container)(args);
|
|
230
|
+
};
|
|
231
|
+
exportedWorkflow.registerStepFailure = async (args) => {
|
|
232
|
+
const container = args?.container;
|
|
233
|
+
delete args?.container;
|
|
234
|
+
return await buildRunnerFn("registerStepFailure", container)(args);
|
|
235
|
+
};
|
|
236
|
+
exportedWorkflow.retryStep = async (args) => {
|
|
237
|
+
const container = args?.container;
|
|
238
|
+
delete args?.container;
|
|
239
|
+
const inputArgs = { ...args };
|
|
240
|
+
return await buildRunnerFn("retryStep", container)(inputArgs);
|
|
241
|
+
};
|
|
242
|
+
exportedWorkflow.cancel = async (args) => {
|
|
243
|
+
const container = args?.container;
|
|
244
|
+
delete args?.container;
|
|
245
|
+
return await buildRunnerFn("cancel", container)(args);
|
|
246
|
+
};
|
|
247
|
+
eto_workflow_1.EtoWorkflow.registerWorkflow(workflowId, exportedWorkflow);
|
|
248
|
+
return exportedWorkflow;
|
|
249
|
+
};
|
|
250
|
+
exports.exportWorkflow = exportWorkflow;
|
|
251
|
+
function attachOnFinishReleaseEvents(events = {}, flow, { logOnError, } = {}) {
|
|
252
|
+
const onFinish = events.onFinish;
|
|
253
|
+
const wrappedOnFinish = async (args) => {
|
|
254
|
+
const { transaction } = args;
|
|
255
|
+
const flowEventGroupId = transaction.getFlow().metadata?.eventGroupId;
|
|
256
|
+
const logger = flow.container.resolve(utils_1.ContainerRegistrationKeys.LOGGER, { allowUnregistered: true }) || console;
|
|
257
|
+
if (logOnError) {
|
|
258
|
+
const workflowName = transaction.getFlow().modelId;
|
|
259
|
+
transaction.getErrors().forEach((err) => {
|
|
260
|
+
const errMsg = err?.error?.message ? " - " + err?.error?.message : "";
|
|
261
|
+
logger.error(`${workflowName}:${err?.action}:${err?.handlerType}${errMsg}${os_1.EOL}${err?.error?.stack}`);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
const eventBusService = flow.container.resolve(utils_1.Modules.EVENT_BUS, {
|
|
265
|
+
allowUnregistered: true,
|
|
266
|
+
});
|
|
267
|
+
if (!eventBusService || !flowEventGroupId) {
|
|
268
|
+
await onFinish?.(args);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const failedStatus = [orchestration_1.TransactionState.FAILED, orchestration_1.TransactionState.REVERTED];
|
|
272
|
+
if (failedStatus.includes(transaction.getState())) {
|
|
273
|
+
return await eventBusService
|
|
274
|
+
.clearGroupedEvents(flowEventGroupId)
|
|
275
|
+
.catch(() => {
|
|
276
|
+
logger.warn(`Failed to clear events for eventGroupId - ${flowEventGroupId}`);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
await eventBusService
|
|
280
|
+
.releaseGroupedEvents(flowEventGroupId)
|
|
281
|
+
.then(async () => {
|
|
282
|
+
await onFinish?.(args);
|
|
283
|
+
})
|
|
284
|
+
.catch((e) => {
|
|
285
|
+
logger.error(`Failed to release grouped events for eventGroupId: ${flowEventGroupId}`, e);
|
|
286
|
+
return flow.cancel(transaction);
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
events.onFinish = wrappedOnFinish;
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=workflow-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-export.js","sourceRoot":"","sources":["../../../../src/helper/workflow-export.ts"],"names":[],"mappings":";;;AAAA,oDAA8C;AAC9C,wDAK6B;AAQ7B,wCAMqB;AACrB,2BAAwB;AACxB,+BAA2B;AAC3B,kDAA6C;AAC7C,2EAAsE;AAYtE,uDAAuD;AACvD,IAAI,mBAAmB,GAA0B,IAAI,CAAA;AAErD,SAAS,sBAAsB;IAC7B,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,mBAAmB,GAAG,uBAAS,CAAC,gBAAgB,EAAE,CAAC,GAAG,CACpD,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAA;IACH,CAAC;IACD,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAED,SAAS,8BAA8B,CAKrC,EACA,UAAU,EACV,aAAa,EACb,OAAO,EACP,SAAS,GASV;IAKC,MAAM,IAAI,GAAG,IAAI,6BAAa,CAAC,UAAU,EAAE,SAAU,CAAC,CAAA;IAEtD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,2BAA2B,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACvE,MAAM,2BAA2B,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACvE,MAAM,cAAc,GAAG,IAAI,C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E;gBACV,MAAM,CAAC,IAAI,CACT,6CAA6C,gBAAgB,EAAE,CAChE,CAAA;YACH,CAAC,CAAC,CAAA;QACN,CAAC;QAED,MAAM,eAAe;aAClB,oBAAoB,CAAC,gBAAgB,CAAC;aACtC,IAAI,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAA;QACxB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACX,MAAM,CAAC,KAAK,CACV,sDAAsD,gBAAgB,EAAE,EACxE,CAAC,CACF,CAAA;YAED,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;IACN,CAAC,CAAA;IAED,MAAM,CAAC,QAAQ,GAAG,eAAe,CAAA;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Composer = void 0;
|
|
40
|
+
__exportStar(require("./helper"), exports);
|
|
41
|
+
__exportStar(require("./eto-workflow"), exports);
|
|
42
|
+
__exportStar(require("./utils/composer"), exports);
|
|
43
|
+
exports.Composer = __importStar(require("./utils/composer"));
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,iDAA8B;AAC9B,mDAAgC;AAChC,6DAA4C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_playground.d.ts","sourceRoot":"","sources":["../../../../src/utils/_playground.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const composer_1 = require("./composer");
|
|
4
|
+
const create_hook_1 = require("./composer/create-hook");
|
|
5
|
+
const workflow_response_1 = require("./composer/helpers/workflow-response");
|
|
6
|
+
const step1 = (0, composer_1.createStep)("step1", () => {
|
|
7
|
+
return new composer_1.StepResponse("step1");
|
|
8
|
+
}, () => {
|
|
9
|
+
console.log("compensate step1");
|
|
10
|
+
});
|
|
11
|
+
const step2 = (0, composer_1.createStep)("step2", (input) => {
|
|
12
|
+
return new composer_1.StepResponse(input);
|
|
13
|
+
}, (input) => {
|
|
14
|
+
console.log("compensate step2", input);
|
|
15
|
+
});
|
|
16
|
+
const workflow = (0, composer_1.createWorkflow)("workflow", () => {
|
|
17
|
+
const step1Result = step1();
|
|
18
|
+
const step2Input = (0, composer_1.transform)({ step1Result }, (input) => {
|
|
19
|
+
return input;
|
|
20
|
+
});
|
|
21
|
+
const step2Result = step2(step2Input);
|
|
22
|
+
const hook = (0, create_hook_1.createHook)("hook", {
|
|
23
|
+
step2Result,
|
|
24
|
+
});
|
|
25
|
+
return new workflow_response_1.WorkflowResponse(void 0, {
|
|
26
|
+
hooks: [hook],
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
workflow.hooks.hook(() => {
|
|
30
|
+
throw new Error("hook failed");
|
|
31
|
+
});
|
|
32
|
+
workflow()
|
|
33
|
+
.run()
|
|
34
|
+
.then((res) => {
|
|
35
|
+
console.log(res);
|
|
36
|
+
})
|
|
37
|
+
.catch((e) => {
|
|
38
|
+
console.log(e);
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=_playground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_playground.js","sourceRoot":"","sources":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,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;IACZ,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAClB,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACX,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAChB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { OrchestrationUtils } from "@etohq/utils";
|
|
2
|
+
import { type ZodSchema } from "../../../../framework/src/zod/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Representation of a hook definition.
|
|
5
|
+
*/
|
|
6
|
+
export type Hook<Name extends string, Input, Output> = {
|
|
7
|
+
__type: typeof OrchestrationUtils.SymbolWorkflowHook;
|
|
8
|
+
name: Name;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the result of the hook
|
|
11
|
+
*/
|
|
12
|
+
getResult(): Output | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* By prefixing a key with a space, we remove it from the
|
|
15
|
+
* intellisense of TypeScript. This is needed because
|
|
16
|
+
* input is not set at runtime. It is a type-only
|
|
17
|
+
* property to infer input data type of a hook
|
|
18
|
+
*/
|
|
19
|
+
" output": Output;
|
|
20
|
+
" input": Input;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Expose a hook in your workflow where you can inject custom functionality as a step function.
|
|
24
|
+
*
|
|
25
|
+
* A handler hook can later be registered to consume the hook and perform custom functionality.
|
|
26
|
+
*
|
|
27
|
+
* Learn more in [this documentation](https://docs.etojs.com/learn/fundamentals/workflows/workflow-hooks).
|
|
28
|
+
*
|
|
29
|
+
* @param name - The hook's name. This is used when the hook handler is registered to consume the workflow.
|
|
30
|
+
* @param hookInput - The input to pass to the hook handler.
|
|
31
|
+
* @returns A workflow hook.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* import {
|
|
35
|
+
* createStep,
|
|
36
|
+
* createHook,
|
|
37
|
+
* createWorkflow,
|
|
38
|
+
* WorkflowResponse,
|
|
39
|
+
* } from "@etohq/framework/workflows-sdk"
|
|
40
|
+
* import { createProductStep } from "./steps/create-product"
|
|
41
|
+
*
|
|
42
|
+
* export const myWorkflow = createWorkflow(
|
|
43
|
+
* "my-workflow",
|
|
44
|
+
* function (input) {
|
|
45
|
+
* const product = createProductStep(input)
|
|
46
|
+
* const productCreatedHook = createHook(
|
|
47
|
+
* "productCreated",
|
|
48
|
+
* { productId: product.id }
|
|
49
|
+
* )
|
|
50
|
+
*
|
|
51
|
+
* return new WorkflowResponse(product, {
|
|
52
|
+
* hooks: [productCreatedHook],
|
|
53
|
+
* })
|
|
54
|
+
* }
|
|
55
|
+
* )
|
|
56
|
+
*/
|
|
57
|
+
export declare function createHook<Name extends string, TInvokeInput, TInvokeOutput>(name: Name, hookInput: TInvokeInput, options?: {
|
|
58
|
+
resultValidator?: ZodSchema<TInvokeOutput>;
|
|
59
|
+
}): Hook<Name, TInvokeInput, TInvokeOutput>;
|
|
60
|
+
//# sourceMappingURL=create-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-hook.d.ts","sourceRoot":"","sources":["../../../../../src/utils/composer/create-hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAarD;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI;IACrD,MAAM,EAAE,OAAO,kBAAkB,CAAC,kBAAkB,CAAA;IACpD,IAAI,EAAE,IAAI,CAAA;IAEV;;OAEG;IACH,SAAS,IAAI,MAAM,GAAG,SAAS,CAAA;IAE/B;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,YAAY,EAAE,aAAa,EACzE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,YAAY,EACvB,OAAO,GAAE;IACP,eAAe,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAA;CACtC,GACL,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,aAAa,CAAC,CA0EzC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHook = createHook;
|
|
4
|
+
const utils_1 = require("@etohq/utils");
|
|
5
|
+
const create_step_1 = require("./create-step");
|
|
6
|
+
const helpers_1 = require("./helpers");
|
|
7
|
+
const create_step_handler_1 = require("./helpers/create-step-handler");
|
|
8
|
+
const NOOP_RESULT = Symbol.for("NOOP");
|
|
9
|
+
/**
|
|
10
|
+
* Expose a hook in your workflow where you can inject custom functionality as a step function.
|
|
11
|
+
*
|
|
12
|
+
* A handler hook can later be registered to consume the hook and perform custom functionality.
|
|
13
|
+
*
|
|
14
|
+
* Learn more in [this documentation](https://docs.etojs.com/learn/fundamentals/workflows/workflow-hooks).
|
|
15
|
+
*
|
|
16
|
+
* @param name - The hook's name. This is used when the hook handler is registered to consume the workflow.
|
|
17
|
+
* @param hookInput - The input to pass to the hook handler.
|
|
18
|
+
* @returns A workflow hook.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* import {
|
|
22
|
+
* createStep,
|
|
23
|
+
* createHook,
|
|
24
|
+
* createWorkflow,
|
|
25
|
+
* WorkflowResponse,
|
|
26
|
+
* } from "@etohq/framework/workflows-sdk"
|
|
27
|
+
* import { createProductStep } from "./steps/create-product"
|
|
28
|
+
*
|
|
29
|
+
* export const myWorkflow = createWorkflow(
|
|
30
|
+
* "my-workflow",
|
|
31
|
+
* function (input) {
|
|
32
|
+
* const product = createProductStep(input)
|
|
33
|
+
* const productCreatedHook = createHook(
|
|
34
|
+
* "productCreated",
|
|
35
|
+
* { productId: product.id }
|
|
36
|
+
* )
|
|
37
|
+
*
|
|
38
|
+
* return new WorkflowResponse(product, {
|
|
39
|
+
* hooks: [productCreatedHook],
|
|
40
|
+
* })
|
|
41
|
+
* }
|
|
42
|
+
* )
|
|
43
|
+
*/
|
|
44
|
+
function createHook(name, hookInput, options = {}) {
|
|
45
|
+
const context = global[utils_1.OrchestrationUtils.SymbolEtoWorkflowComposerContext];
|
|
46
|
+
const getHookResultStep = (0, create_step_1.createStep)(`get-${name}-result`, (_, context) => {
|
|
47
|
+
const result = context[" getStepResult"](name);
|
|
48
|
+
if (result === NOOP_RESULT) {
|
|
49
|
+
return new helpers_1.StepResponse(undefined);
|
|
50
|
+
}
|
|
51
|
+
if (options.resultValidator) {
|
|
52
|
+
return options.resultValidator.parse(result);
|
|
53
|
+
}
|
|
54
|
+
if (result === undefined) {
|
|
55
|
+
return new helpers_1.StepResponse(undefined);
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}, () => void 0);
|
|
59
|
+
context.hookBinder(name, function () {
|
|
60
|
+
/**
|
|
61
|
+
* We start by registering a new step within the workflow. This will be a noop
|
|
62
|
+
* step that can be replaced (optionally) by the workflow consumer.
|
|
63
|
+
*/
|
|
64
|
+
(0, create_step_1.createStep)(name, (_) => new helpers_1.StepResponse(NOOP_RESULT), () => void 0)(hookInput);
|
|
65
|
+
function hook(invokeFn, compensateFn) {
|
|
66
|
+
const handlers = create_step_handler_1.createStepHandler.bind(this)({
|
|
67
|
+
stepName: name,
|
|
68
|
+
input: hookInput,
|
|
69
|
+
invokeFn,
|
|
70
|
+
compensateFn: compensateFn ?? (() => void 0),
|
|
71
|
+
});
|
|
72
|
+
if (this.hooks_.registered.includes(name)) {
|
|
73
|
+
throw new Error(`Cannot define multiple hook handlers for the ${name} hook`);
|
|
74
|
+
}
|
|
75
|
+
const conditional = this.stepConditions_[name];
|
|
76
|
+
if (conditional) {
|
|
77
|
+
(0, create_step_1.wrapConditionalStep)(conditional.input, conditional.condition, handlers);
|
|
78
|
+
}
|
|
79
|
+
this.hooks_.registered.push(name);
|
|
80
|
+
this.handlers.set(name, handlers);
|
|
81
|
+
}
|
|
82
|
+
return hook;
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
__type: utils_1.OrchestrationUtils.SymbolWorkflowHook,
|
|
86
|
+
name,
|
|
87
|
+
getResult() {
|
|
88
|
+
if ("cachedResult" in this) {
|
|
89
|
+
return this.cachedResult;
|
|
90
|
+
}
|
|
91
|
+
const result = getHookResultStep();
|
|
92
|
+
this["cachedResult"] = result;
|
|
93
|
+
return result;
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=create-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-hook.js","sourceRoot":"","sources":["../../../../../src/utils/composer/create-hook.ts"],"names":[],"mappings":";;AAuEA,gCAgFC;AAvJD,wCAAiD;AAEjD,+CAKsB;AACtB,uCAAwC;AACxC,uEAAiE;AAGjE,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAwBtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAgB,UAAU,CACxB,IAAU,EACV,SAAuB,EACvB,UAEI,EAAE;IAEN,MAAM,OAAO,GAAG,MAAM,CACpB,0BAAkB,CAAC,gCAAgC,CACnB,CAAA;IAElC,MAAM,iBAAiB,GAAG,IAAA,wBAAU,EAClC,OAAO,IAAI,SAAS,EACpB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAA;QAC9C,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;YAC3B,OAAO,IAAI,sBAAY,CAAC,SAAS,CAAC,CAAA;QACpC,CAAC;QACD,I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