awaitly 2.0.0 → 3.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/dist/di-Biw_plBn.d.cts +15 -0
- package/dist/di-DxyH2N3i.d.ts +15 -0
- package/dist/durable.cjs +4670 -0
- package/dist/durable.cjs.map +1 -0
- package/dist/durable.d.cts +9 -0
- package/dist/durable.d.ts +9 -0
- package/dist/durable.js +4610 -0
- package/dist/durable.js.map +1 -0
- package/dist/{di-BbFFfO8y.d.ts → duration-BjVn3QpB.d.cts} +1 -15
- package/dist/{di-BDlT7InM.d.cts → duration-BjVn3QpB.d.ts} +1 -15
- package/dist/engine.cjs +4501 -0
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +113 -0
- package/dist/engine.d.ts +113 -0
- package/dist/engine.js +4474 -0
- package/dist/engine.js.map +1 -0
- package/dist/{errors-DtXvrCiO.d.cts → errors-sDSeaZBO.d.cts} +1 -1
- package/dist/{errors-DtXvrCiO.d.ts → errors-sDSeaZBO.d.ts} +1 -1
- package/dist/guards-CwQZro1F.d.ts +72 -0
- package/dist/guards-DhhOJZda.d.cts +72 -0
- package/dist/hitl-BnnnLzh2.d.cts +468 -0
- package/dist/hitl-pYfkQMv_.d.ts +468 -0
- package/dist/hitl.cjs +646 -0
- package/dist/hitl.cjs.map +1 -0
- package/dist/hitl.d.cts +440 -0
- package/dist/hitl.d.ts +440 -0
- package/dist/hitl.js +605 -0
- package/dist/hitl.js.map +1 -0
- package/dist/index-Bew12SZ8.d.ts +417 -0
- package/dist/index-Bwt-iz50.d.cts +417 -0
- package/dist/{types-B8NfNRGX.d.ts → index-Cv4K_3sZ.d.ts} +2 -1162
- package/dist/{types-BZ2f4MRR.d.cts → index-ICmfQi08.d.cts} +2 -1162
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1527
- package/dist/index.d.ts +11 -1527
- package/dist/persistence.cjs +552 -0
- package/dist/persistence.cjs.map +1 -0
- package/dist/persistence.d.cts +254 -0
- package/dist/persistence.d.ts +254 -0
- package/dist/persistence.js +499 -0
- package/dist/persistence.js.map +1 -0
- package/dist/reliability.cjs +1651 -0
- package/dist/reliability.cjs.map +1 -0
- package/dist/reliability.d.cts +1442 -0
- package/dist/reliability.d.ts +1442 -0
- package/dist/reliability.js +1589 -0
- package/dist/reliability.js.map +1 -0
- package/dist/result.d.cts +1 -1
- package/dist/result.d.ts +1 -1
- package/dist/run.cjs +2283 -0
- package/dist/run.cjs.map +1 -0
- package/dist/run.d.cts +90 -0
- package/dist/run.d.ts +90 -0
- package/dist/run.js +2247 -0
- package/dist/run.js.map +1 -0
- package/dist/saga.cjs +3699 -0
- package/dist/saga.cjs.map +1 -0
- package/dist/saga.d.cts +162 -0
- package/dist/saga.d.ts +162 -0
- package/dist/saga.js +3670 -0
- package/dist/saga.js.map +1 -0
- package/dist/store-contract-BI98VYmX.d.ts +66 -0
- package/dist/store-contract-C2HyR_o6.d.cts +66 -0
- package/dist/streaming.cjs +895 -0
- package/dist/streaming.cjs.map +1 -0
- package/dist/streaming.d.cts +594 -0
- package/dist/streaming.d.ts +594 -0
- package/dist/streaming.js +832 -0
- package/dist/streaming.js.map +1 -0
- package/dist/testing.d.cts +4 -2
- package/dist/testing.d.ts +4 -2
- package/dist/types-BDTxgKKc.d.ts +845 -0
- package/dist/types-C9Y71dua.d.cts +845 -0
- package/dist/types-d8q8iQlk.d.cts +323 -0
- package/dist/types-sObbY4mX.d.ts +323 -0
- package/dist/webhook.cjs +461 -0
- package/dist/webhook.cjs.map +1 -0
- package/dist/webhook.d.cts +497 -0
- package/dist/webhook.d.ts +497 -0
- package/dist/webhook.js +422 -0
- package/dist/webhook.js.map +1 -0
- package/dist/workflow.cjs +2 -2614
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +12 -3023
- package/dist/workflow.d.ts +12 -3023
- package/dist/workflow.js +2 -2535
- package/dist/workflow.js.map +1 -1
- package/package.json +46 -1
package/dist/webhook.js
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
// src/slugs.ts
|
|
2
|
+
var AWAITLY_SLUGS = {
|
|
3
|
+
// --- step-* ---
|
|
4
|
+
"step-require-id": "step-require-id",
|
|
5
|
+
"step-no-immediate-execution": "step-no-immediate-execution",
|
|
6
|
+
"step-require-thunk-for-key": "step-require-thunk-for-key",
|
|
7
|
+
"step-no-bare-await": "step-no-bare-await",
|
|
8
|
+
"step-no-try-catch-wrap": "step-no-try-catch-wrap",
|
|
9
|
+
"step-stable-cache-keys": "step-stable-cache-keys",
|
|
10
|
+
// --- workflow-* ---
|
|
11
|
+
"workflow-no-floating": "workflow-no-floating",
|
|
12
|
+
"workflow-options-position": "workflow-options-position",
|
|
13
|
+
"workflow-callback-shape": "workflow-callback-shape",
|
|
14
|
+
"workflow-no-callable-form": "workflow-no-callable-form",
|
|
15
|
+
"workflow-no-dynamic-import": "workflow-no-dynamic-import",
|
|
16
|
+
"workflow-prefer-step-if": "workflow-prefer-step-if",
|
|
17
|
+
"workflow-prefer-step-foreach": "workflow-prefer-step-foreach",
|
|
18
|
+
// --- result-* ---
|
|
19
|
+
"result-no-floating": "result-no-floating",
|
|
20
|
+
"result-require-handling": "result-require-handling",
|
|
21
|
+
"result-no-double-wrap": "result-no-double-wrap",
|
|
22
|
+
"result-no-manual-propagation": "result-no-manual-propagation",
|
|
23
|
+
"result-no-direct-ok-err": "result-no-direct-ok-err",
|
|
24
|
+
// --- error-* ---
|
|
25
|
+
"error-check-unexpected-first": "error-check-unexpected-first",
|
|
26
|
+
"error-access-cause": "error-access-cause",
|
|
27
|
+
"error-normalize": "error-normalize",
|
|
28
|
+
"error-no-throw-in-deps": "error-no-throw-in-deps",
|
|
29
|
+
// --- concurrency-* ---
|
|
30
|
+
"concurrency-no-promise-all": "concurrency-no-promise-all",
|
|
31
|
+
"concurrency-no-promise-race": "concurrency-no-promise-race",
|
|
32
|
+
"concurrency-no-promise-allsettled": "concurrency-no-promise-allsettled",
|
|
33
|
+
// --- runtime-* ---
|
|
34
|
+
"runtime-step-timeout": "runtime-step-timeout",
|
|
35
|
+
"runtime-step-aborted": "runtime-step-aborted",
|
|
36
|
+
"runtime-retry-exhausted": "runtime-retry-exhausted",
|
|
37
|
+
"runtime-rate-limit": "runtime-rate-limit",
|
|
38
|
+
"runtime-circuit-open": "runtime-circuit-open",
|
|
39
|
+
"runtime-unexpected": "runtime-unexpected",
|
|
40
|
+
"runtime-resolver-not-found": "runtime-resolver-not-found",
|
|
41
|
+
"runtime-saga-compensation": "runtime-saga-compensation"
|
|
42
|
+
};
|
|
43
|
+
function slugDocsUrl(slug) {
|
|
44
|
+
return `https://jagreehal.github.io/awaitly/rules/#${slug}`;
|
|
45
|
+
}
|
|
46
|
+
var ALL_SLUGS = Object.keys(
|
|
47
|
+
AWAITLY_SLUGS
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// src/tagged-error.ts
|
|
51
|
+
var InternalTaggedErrorBase = class extends Error {
|
|
52
|
+
type;
|
|
53
|
+
/** @deprecated Use `type`. */
|
|
54
|
+
_tag;
|
|
55
|
+
};
|
|
56
|
+
function TaggedError(tag, options) {
|
|
57
|
+
return class extends InternalTaggedErrorBase {
|
|
58
|
+
type = tag;
|
|
59
|
+
/** @deprecated Use `type`. */
|
|
60
|
+
_tag = tag;
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
constructor(props, errorOptions) {
|
|
63
|
+
const message = options?.message ? options.message(props ?? {}) : tag;
|
|
64
|
+
super(message);
|
|
65
|
+
this.name = tag;
|
|
66
|
+
if (options?.slug !== void 0) {
|
|
67
|
+
if (!options.hint) {
|
|
68
|
+
throw new TypeError(
|
|
69
|
+
`TaggedError: 'hint' is required when 'slug' is set (slug: "${options.slug}")`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
Object.defineProperty(this, "code", {
|
|
73
|
+
value: options.slug,
|
|
74
|
+
enumerable: true,
|
|
75
|
+
writable: false,
|
|
76
|
+
configurable: false
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(this, "hint", {
|
|
79
|
+
value: options.hint,
|
|
80
|
+
enumerable: true,
|
|
81
|
+
writable: false,
|
|
82
|
+
configurable: false
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(this, "docsUrl", {
|
|
85
|
+
value: slugDocsUrl(options.slug),
|
|
86
|
+
enumerable: true,
|
|
87
|
+
writable: false,
|
|
88
|
+
configurable: false
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
92
|
+
if (props && typeof props === "object") {
|
|
93
|
+
let safeProps;
|
|
94
|
+
if (options?.slug !== void 0) {
|
|
95
|
+
const {
|
|
96
|
+
_tag: _,
|
|
97
|
+
type: _t,
|
|
98
|
+
name: _n,
|
|
99
|
+
message: _m,
|
|
100
|
+
stack: _s,
|
|
101
|
+
code: _c,
|
|
102
|
+
hint: _h,
|
|
103
|
+
docsUrl: _d,
|
|
104
|
+
...rest
|
|
105
|
+
} = props;
|
|
106
|
+
safeProps = rest;
|
|
107
|
+
} else {
|
|
108
|
+
const {
|
|
109
|
+
_tag: _,
|
|
110
|
+
type: _t,
|
|
111
|
+
name: _n,
|
|
112
|
+
message: _m,
|
|
113
|
+
stack: _s,
|
|
114
|
+
...rest
|
|
115
|
+
} = props;
|
|
116
|
+
safeProps = rest;
|
|
117
|
+
}
|
|
118
|
+
const hasUserCause = Object.prototype.hasOwnProperty.call(
|
|
119
|
+
safeProps,
|
|
120
|
+
"cause"
|
|
121
|
+
);
|
|
122
|
+
const userCause = hasUserCause ? safeProps.cause : void 0;
|
|
123
|
+
if (hasUserCause) {
|
|
124
|
+
delete safeProps.cause;
|
|
125
|
+
}
|
|
126
|
+
const hasOptionsCause = errorOptions?.cause !== void 0;
|
|
127
|
+
if (hasUserCause && hasOptionsCause) {
|
|
128
|
+
throw new TypeError(
|
|
129
|
+
"TaggedError: cannot provide 'cause' in props when also setting ErrorOptions.cause"
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
Object.assign(this, safeProps);
|
|
133
|
+
if (hasUserCause) {
|
|
134
|
+
this.cause = userCause;
|
|
135
|
+
}
|
|
136
|
+
if (hasOptionsCause) {
|
|
137
|
+
this.cause = errorOptions?.cause;
|
|
138
|
+
}
|
|
139
|
+
} else if (errorOptions?.cause !== void 0) {
|
|
140
|
+
this.cause = errorOptions.cause;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
Object.defineProperty(TaggedError, Symbol.hasInstance, {
|
|
146
|
+
value: (instance) => instance instanceof InternalTaggedErrorBase
|
|
147
|
+
});
|
|
148
|
+
((TaggedError2) => {
|
|
149
|
+
function isError(value) {
|
|
150
|
+
return value instanceof Error;
|
|
151
|
+
}
|
|
152
|
+
TaggedError2.isError = isError;
|
|
153
|
+
function isTaggedError(value) {
|
|
154
|
+
return value instanceof InternalTaggedErrorBase;
|
|
155
|
+
}
|
|
156
|
+
TaggedError2.isTaggedError = isTaggedError;
|
|
157
|
+
function match(error, handlers) {
|
|
158
|
+
const tag = error._tag;
|
|
159
|
+
const handler = handlers[tag];
|
|
160
|
+
return handler(
|
|
161
|
+
error
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
TaggedError2.match = match;
|
|
165
|
+
function matchPartial(error, handlers, otherwise) {
|
|
166
|
+
const tag = error._tag;
|
|
167
|
+
const handler = handlers[tag];
|
|
168
|
+
if (handler) {
|
|
169
|
+
return handler(
|
|
170
|
+
error
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
return otherwise(error);
|
|
174
|
+
}
|
|
175
|
+
TaggedError2.matchPartial = matchPartial;
|
|
176
|
+
})(TaggedError || (TaggedError = {}));
|
|
177
|
+
|
|
178
|
+
// src/errors.ts
|
|
179
|
+
var UnexpectedError = class extends (/* @__PURE__ */ TaggedError("UnexpectedError", {
|
|
180
|
+
slug: "runtime-unexpected",
|
|
181
|
+
hint: "An unexpected exception escaped a step. Inspect cause; consider returning a typed Result instead of throwing.",
|
|
182
|
+
message: (p) => `UnexpectedError: ${p.cause instanceof Error ? p.cause.message : String(p.cause ?? "unknown")}`
|
|
183
|
+
})) {
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// src/core/index.ts
|
|
187
|
+
function ok(value) {
|
|
188
|
+
return { ok: true, value };
|
|
189
|
+
}
|
|
190
|
+
function err(error, options) {
|
|
191
|
+
const cause = options?.cause;
|
|
192
|
+
return { ok: false, error, ...cause !== void 0 ? { cause } : {} };
|
|
193
|
+
}
|
|
194
|
+
var isOk = (r) => r.ok;
|
|
195
|
+
var isUnexpectedError = (e) => e instanceof UnexpectedError || typeof e === "object" && e !== null && "_tag" in e && e._tag === "UnexpectedError";
|
|
196
|
+
|
|
197
|
+
// src/webhook/index.ts
|
|
198
|
+
function isValidationError(e) {
|
|
199
|
+
return typeof e === "object" && e !== null && e.type === "VALIDATION_ERROR";
|
|
200
|
+
}
|
|
201
|
+
function defaultValidationErrorMapper(error) {
|
|
202
|
+
return {
|
|
203
|
+
status: 400,
|
|
204
|
+
body: {
|
|
205
|
+
error: {
|
|
206
|
+
type: error.type,
|
|
207
|
+
message: error.message,
|
|
208
|
+
details: error.field ? { field: error.field } : error.details
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function defaultUnexpectedErrorMapper(error) {
|
|
214
|
+
return {
|
|
215
|
+
status: 500,
|
|
216
|
+
body: {
|
|
217
|
+
error: {
|
|
218
|
+
type: "INTERNAL_ERROR",
|
|
219
|
+
message: error instanceof Error ? error.message : "An unexpected error occurred"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function createWebhookHandler(workflow, workflowFn, config) {
|
|
225
|
+
const {
|
|
226
|
+
validateInput,
|
|
227
|
+
mapResult,
|
|
228
|
+
mapValidationError = defaultValidationErrorMapper,
|
|
229
|
+
mapUnexpectedError = defaultUnexpectedErrorMapper,
|
|
230
|
+
beforeValidation,
|
|
231
|
+
afterResponse
|
|
232
|
+
} = config;
|
|
233
|
+
return async (req) => {
|
|
234
|
+
try {
|
|
235
|
+
const processedReq = beforeValidation ? await beforeValidation(req) : req;
|
|
236
|
+
const validationResult = await validateInput(processedReq);
|
|
237
|
+
if (!isOk(validationResult)) {
|
|
238
|
+
const response2 = mapValidationError(validationResult.error, processedReq);
|
|
239
|
+
return afterResponse ? await afterResponse(response2, processedReq) : response2;
|
|
240
|
+
}
|
|
241
|
+
const args = validationResult.value;
|
|
242
|
+
const workflowResult = await workflow.run(
|
|
243
|
+
async ({ step, deps }) => workflowFn({ step, deps, args })
|
|
244
|
+
);
|
|
245
|
+
const response = mapResult(workflowResult, processedReq);
|
|
246
|
+
return afterResponse ? await afterResponse(response, processedReq) : response;
|
|
247
|
+
} catch (error) {
|
|
248
|
+
const response = mapUnexpectedError(error, req);
|
|
249
|
+
return afterResponse ? await afterResponse(response, req) : response;
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function createSimpleHandler(config) {
|
|
254
|
+
const {
|
|
255
|
+
validateInput,
|
|
256
|
+
handler,
|
|
257
|
+
mapResult,
|
|
258
|
+
mapValidationError = defaultValidationErrorMapper,
|
|
259
|
+
mapUnexpectedError = defaultUnexpectedErrorMapper
|
|
260
|
+
} = config;
|
|
261
|
+
return async (req) => {
|
|
262
|
+
try {
|
|
263
|
+
const validationResult = await validateInput(req);
|
|
264
|
+
if (!isOk(validationResult)) {
|
|
265
|
+
return mapValidationError(validationResult.error, req);
|
|
266
|
+
}
|
|
267
|
+
const result = await handler(validationResult.value, req);
|
|
268
|
+
return mapResult(result, req);
|
|
269
|
+
} catch (error) {
|
|
270
|
+
return mapUnexpectedError(error, req);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function createResultMapper(mappings, options = {}) {
|
|
275
|
+
const { defaultStatus = 500, successStatus = 200 } = options;
|
|
276
|
+
const errorMap = /* @__PURE__ */ new Map();
|
|
277
|
+
for (const mapping of mappings) {
|
|
278
|
+
errorMap.set(mapping.error, mapping);
|
|
279
|
+
}
|
|
280
|
+
return (result) => {
|
|
281
|
+
if (result.ok) {
|
|
282
|
+
return {
|
|
283
|
+
status: successStatus,
|
|
284
|
+
body: result.value
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
if (isUnexpectedError(result.error)) {
|
|
288
|
+
return {
|
|
289
|
+
status: 500,
|
|
290
|
+
body: {
|
|
291
|
+
error: {
|
|
292
|
+
type: "INTERNAL_ERROR",
|
|
293
|
+
message: result.error instanceof Error ? result.error.message : "An unexpected error occurred"
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
const mapping = errorMap.get(result.error);
|
|
299
|
+
if (mapping) {
|
|
300
|
+
return {
|
|
301
|
+
status: mapping.status,
|
|
302
|
+
body: {
|
|
303
|
+
error: {
|
|
304
|
+
type: String(mapping.error),
|
|
305
|
+
message: mapping.message
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
status: defaultStatus,
|
|
312
|
+
body: {
|
|
313
|
+
error: {
|
|
314
|
+
type: String(result.error)
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function toWebhookRequest(req) {
|
|
321
|
+
return {
|
|
322
|
+
method: req.method,
|
|
323
|
+
path: req.path,
|
|
324
|
+
headers: req.headers,
|
|
325
|
+
body: req.body,
|
|
326
|
+
query: req.query,
|
|
327
|
+
params: req.params,
|
|
328
|
+
raw: req
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function sendWebhookResponse(res, response) {
|
|
332
|
+
if (response.headers) {
|
|
333
|
+
res.set(response.headers);
|
|
334
|
+
}
|
|
335
|
+
res.status(response.status).json(response.body);
|
|
336
|
+
}
|
|
337
|
+
function createExpressHandler(handler) {
|
|
338
|
+
return async (req, res) => {
|
|
339
|
+
const webhookReq = toWebhookRequest(req);
|
|
340
|
+
const response = await handler(webhookReq);
|
|
341
|
+
sendWebhookResponse(res, response);
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function validationError(message, field, details) {
|
|
345
|
+
return {
|
|
346
|
+
type: "VALIDATION_ERROR",
|
|
347
|
+
message,
|
|
348
|
+
field,
|
|
349
|
+
details
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function requireFields(fields) {
|
|
353
|
+
return (body) => {
|
|
354
|
+
for (const field of fields) {
|
|
355
|
+
if (body[field] === void 0 || body[field] === null || body[field] === "") {
|
|
356
|
+
return err(validationError(`Missing required field: ${field}`, field));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return ok(void 0);
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function composeValidators(...validators) {
|
|
363
|
+
return (input) => {
|
|
364
|
+
for (const validator of validators) {
|
|
365
|
+
const result = validator(input);
|
|
366
|
+
if (!result.ok) return result;
|
|
367
|
+
}
|
|
368
|
+
return ok(void 0);
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
function createEventHandler(workflow, workflowFn, config) {
|
|
372
|
+
const { validatePayload, mapResult } = config;
|
|
373
|
+
return async (event) => {
|
|
374
|
+
try {
|
|
375
|
+
const validationResult = validatePayload(event);
|
|
376
|
+
if (!isOk(validationResult)) {
|
|
377
|
+
return {
|
|
378
|
+
success: false,
|
|
379
|
+
ack: true,
|
|
380
|
+
// Don't retry validation errors
|
|
381
|
+
error: {
|
|
382
|
+
type: validationResult.error.type,
|
|
383
|
+
message: validationResult.error.message,
|
|
384
|
+
retryable: false
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
const args = validationResult.value;
|
|
389
|
+
const workflowResult = await workflow.run(
|
|
390
|
+
async ({ step, deps }) => workflowFn({ step, deps, args })
|
|
391
|
+
);
|
|
392
|
+
return mapResult(workflowResult, event);
|
|
393
|
+
} catch (error) {
|
|
394
|
+
return {
|
|
395
|
+
success: false,
|
|
396
|
+
ack: false,
|
|
397
|
+
// Retry unexpected errors
|
|
398
|
+
error: {
|
|
399
|
+
type: "UnexpectedError",
|
|
400
|
+
message: error instanceof Error ? error.message : String(error),
|
|
401
|
+
retryable: true
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
export {
|
|
408
|
+
composeValidators,
|
|
409
|
+
createEventHandler,
|
|
410
|
+
createExpressHandler,
|
|
411
|
+
createResultMapper,
|
|
412
|
+
createSimpleHandler,
|
|
413
|
+
createWebhookHandler,
|
|
414
|
+
defaultUnexpectedErrorMapper,
|
|
415
|
+
defaultValidationErrorMapper,
|
|
416
|
+
isValidationError,
|
|
417
|
+
requireFields,
|
|
418
|
+
sendWebhookResponse,
|
|
419
|
+
toWebhookRequest,
|
|
420
|
+
validationError
|
|
421
|
+
};
|
|
422
|
+
//# sourceMappingURL=webhook.js.map
|