@dudousxd/nestjs-durable-core 0.60.0 → 0.61.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/index.cjs +167 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -4
- package/dist/index.d.ts +73 -4
- package/dist/index.js +157 -53
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -71,8 +71,11 @@ __export(index_exports, {
|
|
|
71
71
|
collectMetrics: () => collectMetrics,
|
|
72
72
|
controlPlaneDescriptor: () => controlPlaneDescriptor,
|
|
73
73
|
createStepLogger: () => createStepLogger,
|
|
74
|
+
currentStep: () => currentStep,
|
|
74
75
|
currentWorkflowCtx: () => currentWorkflowCtx,
|
|
76
|
+
debug: () => debug,
|
|
75
77
|
descriptorHash: () => descriptorHash,
|
|
78
|
+
error: () => error,
|
|
76
79
|
eventMatchOf: () => eventMatchOf,
|
|
77
80
|
eventMatches: () => eventMatches,
|
|
78
81
|
eventNameOf: () => eventNameOf,
|
|
@@ -80,9 +83,11 @@ __export(index_exports, {
|
|
|
80
83
|
eventToken: () => eventToken,
|
|
81
84
|
heartbeatStatus: () => heartbeatStatus,
|
|
82
85
|
indexWaitersByRun: () => indexWaitersByRun,
|
|
86
|
+
info: () => info,
|
|
83
87
|
isEventToken: () => isEventToken,
|
|
84
88
|
isLegacyDescriptor: () => isLegacyDescriptor,
|
|
85
89
|
isWorkflowControlFlowSignal: () => isWorkflowControlFlowSignal,
|
|
90
|
+
log: () => log,
|
|
86
91
|
matchesAttributes: () => matchesAttributes,
|
|
87
92
|
missingCapabilities: () => missingCapabilities,
|
|
88
93
|
negotiate: () => negotiate,
|
|
@@ -95,6 +100,7 @@ __export(index_exports, {
|
|
|
95
100
|
requiredCapabilities: () => requiredCapabilities,
|
|
96
101
|
resolveRouting: () => resolveRouting,
|
|
97
102
|
resolveRunWaiting: () => resolveRunWaiting,
|
|
103
|
+
runInStepLogger: () => runInStepLogger,
|
|
98
104
|
runInWorkflowCtx: () => runInWorkflowCtx,
|
|
99
105
|
runSchedules: () => runSchedules,
|
|
100
106
|
runStepHandler: () => runStepHandler,
|
|
@@ -104,7 +110,11 @@ __export(index_exports, {
|
|
|
104
110
|
stepConfigOf: () => stepConfigOf,
|
|
105
111
|
stepId: () => stepId,
|
|
106
112
|
stepNameOf: () => stepNameOf,
|
|
113
|
+
sub: () => sub,
|
|
114
|
+
subEvent: () => subEvent,
|
|
115
|
+
subProcess: () => subProcess,
|
|
107
116
|
tenantGroup: () => tenantGroup,
|
|
117
|
+
warn: () => warn,
|
|
108
118
|
workflowName: () => workflowName
|
|
109
119
|
});
|
|
110
120
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -281,10 +291,68 @@ function currentWorkflowCtx() {
|
|
|
281
291
|
}
|
|
282
292
|
__name(currentWorkflowCtx, "currentWorkflowCtx");
|
|
283
293
|
|
|
294
|
+
// src/ambient-step.ts
|
|
295
|
+
var import_node_async_hooks2 = require("async_hooks");
|
|
296
|
+
var STORAGE_KEY2 = Symbol.for("nestjs-durable:ambient-step-logger");
|
|
297
|
+
var globalRef2 = globalThis;
|
|
298
|
+
if (!globalRef2[STORAGE_KEY2]) {
|
|
299
|
+
globalRef2[STORAGE_KEY2] = new import_node_async_hooks2.AsyncLocalStorage();
|
|
300
|
+
}
|
|
301
|
+
var storage2 = globalRef2[STORAGE_KEY2];
|
|
302
|
+
function runInStepLogger(logger, fn) {
|
|
303
|
+
return storage2.run(logger, fn);
|
|
304
|
+
}
|
|
305
|
+
__name(runInStepLogger, "runInStepLogger");
|
|
306
|
+
function currentStep() {
|
|
307
|
+
return storage2.getStore();
|
|
308
|
+
}
|
|
309
|
+
__name(currentStep, "currentStep");
|
|
310
|
+
function log(level, message, data) {
|
|
311
|
+
currentStep()?.[level](message, data);
|
|
312
|
+
}
|
|
313
|
+
__name(log, "log");
|
|
314
|
+
function debug(message, data) {
|
|
315
|
+
currentStep()?.debug(message, data);
|
|
316
|
+
}
|
|
317
|
+
__name(debug, "debug");
|
|
318
|
+
function info(message, data) {
|
|
319
|
+
currentStep()?.info(message, data);
|
|
320
|
+
}
|
|
321
|
+
__name(info, "info");
|
|
322
|
+
function warn(message, data) {
|
|
323
|
+
currentStep()?.warn(message, data);
|
|
324
|
+
}
|
|
325
|
+
__name(warn, "warn");
|
|
326
|
+
function error(message, data) {
|
|
327
|
+
currentStep()?.error(message, data);
|
|
328
|
+
}
|
|
329
|
+
__name(error, "error");
|
|
330
|
+
function sub(name, status, message, data) {
|
|
331
|
+
currentStep()?.sub(name, status, message, data);
|
|
332
|
+
}
|
|
333
|
+
__name(sub, "sub");
|
|
334
|
+
function subEvent(e) {
|
|
335
|
+
currentStep()?.subEvent(e);
|
|
336
|
+
}
|
|
337
|
+
__name(subEvent, "subEvent");
|
|
338
|
+
var noopSubProcessHandle = {
|
|
339
|
+
phase: /* @__PURE__ */ __name(() => noopSubProcessHandle, "phase"),
|
|
340
|
+
skip: /* @__PURE__ */ __name(() => {
|
|
341
|
+
}, "skip"),
|
|
342
|
+
fail: /* @__PURE__ */ __name(() => {
|
|
343
|
+
}, "fail")
|
|
344
|
+
};
|
|
345
|
+
function subProcess(name, body, opts) {
|
|
346
|
+
const logger = currentStep();
|
|
347
|
+
if (!logger) return Promise.resolve(body(noopSubProcessHandle));
|
|
348
|
+
return logger.subProcess(name, body, opts);
|
|
349
|
+
}
|
|
350
|
+
__name(subProcess, "subProcess");
|
|
351
|
+
|
|
284
352
|
// src/control-flow-signal.ts
|
|
285
353
|
var CONTROL_FLOW_SIGNAL = Symbol.for("aviary:durable:control-flow");
|
|
286
|
-
function isWorkflowControlFlowSignal(
|
|
287
|
-
return typeof
|
|
354
|
+
function isWorkflowControlFlowSignal(error2) {
|
|
355
|
+
return typeof error2 === "object" && error2 !== null && error2[CONTROL_FLOW_SIGNAL] === true;
|
|
288
356
|
}
|
|
289
357
|
__name(isWorkflowControlFlowSignal, "isWorkflowControlFlowSignal");
|
|
290
358
|
|
|
@@ -421,11 +489,11 @@ __name(workflowName, "workflowName");
|
|
|
421
489
|
|
|
422
490
|
// src/durable-workflow.ts
|
|
423
491
|
var BINDINGS_KEY = Symbol.for("nestjs-durable:workflow-class-bindings");
|
|
424
|
-
var
|
|
425
|
-
if (!
|
|
426
|
-
|
|
492
|
+
var globalRef3 = globalThis;
|
|
493
|
+
if (!globalRef3[BINDINGS_KEY]) {
|
|
494
|
+
globalRef3[BINDINGS_KEY] = /* @__PURE__ */ new WeakMap();
|
|
427
495
|
}
|
|
428
|
-
var bindings =
|
|
496
|
+
var bindings = globalRef3[BINDINGS_KEY];
|
|
429
497
|
function bindWorkflowClass(ctor, client) {
|
|
430
498
|
bindings.set(ctor, client);
|
|
431
499
|
}
|
|
@@ -556,7 +624,7 @@ function createStepLogger(events, now) {
|
|
|
556
624
|
data
|
|
557
625
|
}
|
|
558
626
|
}), "push");
|
|
559
|
-
const
|
|
627
|
+
const subEvent2 = /* @__PURE__ */ __name((e) => events.push({
|
|
560
628
|
at: now(),
|
|
561
629
|
level: e.status === "failed" ? "error" : e.status === "skipped" ? "warn" : "info",
|
|
562
630
|
message: e.message ?? e.phase ?? e.name,
|
|
@@ -575,7 +643,7 @@ function createStepLogger(events, now) {
|
|
|
575
643
|
data: e.data
|
|
576
644
|
}
|
|
577
645
|
}), "subEvent");
|
|
578
|
-
const
|
|
646
|
+
const subProcess2 = /* @__PURE__ */ __name(async (name, body, opts) => {
|
|
579
647
|
const id = opts?.id ?? globalThis.crypto.randomUUID();
|
|
580
648
|
const group = opts?.group;
|
|
581
649
|
const start = now();
|
|
@@ -587,7 +655,7 @@ function createStepLogger(events, now) {
|
|
|
587
655
|
const emit = /* @__PURE__ */ __name((status, message, data) => {
|
|
588
656
|
if (terminal) return;
|
|
589
657
|
terminal = true;
|
|
590
|
-
|
|
658
|
+
subEvent2({
|
|
591
659
|
id,
|
|
592
660
|
name,
|
|
593
661
|
group,
|
|
@@ -598,7 +666,7 @@ function createStepLogger(events, now) {
|
|
|
598
666
|
}, "emit");
|
|
599
667
|
const handle = {
|
|
600
668
|
phase: /* @__PURE__ */ __name((phase, data) => {
|
|
601
|
-
if (!terminal)
|
|
669
|
+
if (!terminal) subEvent2({
|
|
602
670
|
id,
|
|
603
671
|
name,
|
|
604
672
|
group,
|
|
@@ -636,8 +704,8 @@ function createStepLogger(events, now) {
|
|
|
636
704
|
data
|
|
637
705
|
}
|
|
638
706
|
}), "sub"),
|
|
639
|
-
subEvent,
|
|
640
|
-
subProcess
|
|
707
|
+
subEvent: subEvent2,
|
|
708
|
+
subProcess: subProcess2
|
|
641
709
|
};
|
|
642
710
|
}
|
|
643
711
|
__name(createStepLogger, "createStepLogger");
|
|
@@ -671,7 +739,8 @@ async function runStepHandler(task, handler) {
|
|
|
671
739
|
events
|
|
672
740
|
} : result, "withEvents");
|
|
673
741
|
try {
|
|
674
|
-
const
|
|
742
|
+
const logger = createStepLogger(events, Date.now);
|
|
743
|
+
const output = await runInStepLogger(logger, () => handler(task.input, logger));
|
|
675
744
|
return withEvents({
|
|
676
745
|
...base,
|
|
677
746
|
status: "completed",
|
|
@@ -1721,7 +1790,10 @@ function createWorkflowCtx(host, runId, compensations, workflow = "", searchAttr
|
|
|
1721
1790
|
seq: current,
|
|
1722
1791
|
attempt
|
|
1723
1792
|
};
|
|
1724
|
-
const body = /* @__PURE__ */ __name(() =>
|
|
1793
|
+
const body = /* @__PURE__ */ __name(() => {
|
|
1794
|
+
const logger = createStepLogger(events, host.clock);
|
|
1795
|
+
return runInStepLogger(logger, () => fn(logger));
|
|
1796
|
+
}, "body");
|
|
1725
1797
|
const output = host.interceptStep ? await host.interceptStep(invocation, body) : await body();
|
|
1726
1798
|
await host.completeStep({
|
|
1727
1799
|
runId,
|
|
@@ -3023,13 +3095,13 @@ var WorkflowEngine = class {
|
|
|
3023
3095
|
];
|
|
3024
3096
|
for (const run of inflight) {
|
|
3025
3097
|
if (run.createdAt.getTime() > deadline) continue;
|
|
3026
|
-
const
|
|
3098
|
+
const error2 = {
|
|
3027
3099
|
message: "execution timeout",
|
|
3028
3100
|
code: "execution_timeout"
|
|
3029
3101
|
};
|
|
3030
3102
|
await this.store.updateRun(run.id, {
|
|
3031
3103
|
status: "cancelled",
|
|
3032
|
-
error,
|
|
3104
|
+
error: error2,
|
|
3033
3105
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3034
3106
|
});
|
|
3035
3107
|
this.emit({
|
|
@@ -3037,7 +3109,7 @@ var WorkflowEngine = class {
|
|
|
3037
3109
|
runId: run.id,
|
|
3038
3110
|
workflow: run.workflow,
|
|
3039
3111
|
namespace: run.namespace,
|
|
3040
|
-
error
|
|
3112
|
+
error: error2
|
|
3041
3113
|
});
|
|
3042
3114
|
}
|
|
3043
3115
|
}
|
|
@@ -3052,6 +3124,22 @@ var WorkflowEngine = class {
|
|
|
3052
3124
|
for (const run of await this.store.listIncompleteRuns(this.namespace)) {
|
|
3053
3125
|
const acquired = await this.store.tryLockRun(run.id, this.instanceId, nowMs + this.leaseMs, nowMs);
|
|
3054
3126
|
if (!acquired) continue;
|
|
3127
|
+
if (run.status === "running") {
|
|
3128
|
+
const dispatched = await this.inFlightRemoteStep(run.id);
|
|
3129
|
+
if (dispatched) {
|
|
3130
|
+
await this.store.updateRun(run.id, {
|
|
3131
|
+
status: "suspended",
|
|
3132
|
+
wakeAt: this.reconcileWakeAt(dispatched.wakeAt ?? void 0),
|
|
3133
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
3134
|
+
});
|
|
3135
|
+
await this.store.releaseRunLock(run.id);
|
|
3136
|
+
results.push({
|
|
3137
|
+
runId: run.id,
|
|
3138
|
+
status: "suspended"
|
|
3139
|
+
});
|
|
3140
|
+
continue;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3055
3143
|
const settled = await this.countRecovery(run);
|
|
3056
3144
|
if (settled) {
|
|
3057
3145
|
results.push(settled);
|
|
@@ -3073,6 +3161,16 @@ var WorkflowEngine = class {
|
|
|
3073
3161
|
return results;
|
|
3074
3162
|
}
|
|
3075
3163
|
/**
|
|
3164
|
+
* The remote step this run dispatched and is still awaiting a result for, if any — the signature
|
|
3165
|
+
* that tells {@link recoverIncomplete} "this run's work is ON THE TRANSPORT, not in a crashed
|
|
3166
|
+
* process". A `pending` remote checkpoint is written BEFORE the dispatch and settled by the
|
|
3167
|
+
* worker's result, so its presence is the durable marker of an in-flight dispatched step.
|
|
3168
|
+
*/
|
|
3169
|
+
async inFlightRemoteStep(runId) {
|
|
3170
|
+
const checkpoints = await this.store.listCheckpoints(runId);
|
|
3171
|
+
return checkpoints.find((cp) => cp.kind === "remote" && cp.status === "pending");
|
|
3172
|
+
}
|
|
3173
|
+
/**
|
|
3076
3174
|
* Per-recovery bookkeeping (called once the lease is held): count the attempt, or — past
|
|
3077
3175
|
* `maxRecoveryAttempts` — move a poison pill to the `dead` dead-letter state. Returns a terminal
|
|
3078
3176
|
* result to skip the resume, or `undefined` to proceed.
|
|
@@ -3080,13 +3178,13 @@ var WorkflowEngine = class {
|
|
|
3080
3178
|
async countRecovery(run) {
|
|
3081
3179
|
const attempts = (run.recoveryAttempts ?? 0) + 1;
|
|
3082
3180
|
if (this.maxRecoveryAttempts != null && attempts > this.maxRecoveryAttempts) {
|
|
3083
|
-
const
|
|
3181
|
+
const error2 = {
|
|
3084
3182
|
message: `run exceeded maxRecoveryAttempts (${this.maxRecoveryAttempts}) \u2014 moved to dead-letter`,
|
|
3085
3183
|
code: "max_recovery_attempts"
|
|
3086
3184
|
};
|
|
3087
3185
|
await this.store.updateRun(run.id, {
|
|
3088
3186
|
status: "dead",
|
|
3089
|
-
error,
|
|
3187
|
+
error: error2,
|
|
3090
3188
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3091
3189
|
});
|
|
3092
3190
|
await this.store.releaseRunLock(run.id);
|
|
@@ -3095,18 +3193,18 @@ var WorkflowEngine = class {
|
|
|
3095
3193
|
runId: run.id,
|
|
3096
3194
|
workflow: run.workflow,
|
|
3097
3195
|
namespace: run.namespace,
|
|
3098
|
-
error
|
|
3196
|
+
error: error2
|
|
3099
3197
|
});
|
|
3100
3198
|
this.notifyDead({
|
|
3101
3199
|
...run,
|
|
3102
3200
|
status: "dead",
|
|
3103
|
-
error,
|
|
3201
|
+
error: error2,
|
|
3104
3202
|
recoveryAttempts: attempts
|
|
3105
3203
|
});
|
|
3106
3204
|
return {
|
|
3107
3205
|
runId: run.id,
|
|
3108
3206
|
status: "dead",
|
|
3109
|
-
error
|
|
3207
|
+
error: error2
|
|
3110
3208
|
};
|
|
3111
3209
|
}
|
|
3112
3210
|
await this.store.updateRun(run.id, {
|
|
@@ -3227,7 +3325,8 @@ var WorkflowEngine = class {
|
|
|
3227
3325
|
seen.add(runId);
|
|
3228
3326
|
const run = await this.store.getRun(runId);
|
|
3229
3327
|
if (!run) return null;
|
|
3230
|
-
|
|
3328
|
+
const resurrecting = run.status === "failed" || run.status === "dead";
|
|
3329
|
+
if (resurrecting) {
|
|
3231
3330
|
const isFailureCompletion = /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && v.ok === false, "isFailureCompletion");
|
|
3232
3331
|
for (const cp of await this.store.listCheckpoints(runId)) {
|
|
3233
3332
|
if (cp.status === "failed") {
|
|
@@ -3270,6 +3369,9 @@ var WorkflowEngine = class {
|
|
|
3270
3369
|
await this.store.updateRun(runId, {
|
|
3271
3370
|
status: "pending",
|
|
3272
3371
|
error: void 0,
|
|
3372
|
+
...resurrecting ? {
|
|
3373
|
+
recoveryAttempts: 0
|
|
3374
|
+
} : {},
|
|
3273
3375
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3274
3376
|
});
|
|
3275
3377
|
await this.runDispatcher.dispatch(runId);
|
|
@@ -3282,9 +3384,11 @@ var WorkflowEngine = class {
|
|
|
3282
3384
|
* Explicitly re-dispatch every remote step of `runId` stuck `pending` — the OPERATOR escape hatch for
|
|
3283
3385
|
* a run whose dispatched step job was LOST (worker crashed with no result, or a transport that dropped
|
|
3284
3386
|
* the job). No automatic recovery re-drives these: a reconcile re-drive re-suspends a still-pending
|
|
3285
|
-
* step by design (unless `remoteRedispatchMs` is set), `recoverIncomplete`
|
|
3286
|
-
*
|
|
3287
|
-
*
|
|
3387
|
+
* step by design (unless `remoteRedispatchMs` is set), `recoverIncomplete` explicitly SKIPS a run with
|
|
3388
|
+
* an in-flight `pending` remote step (it re-asserts the durably-suspended invariant instead of counting
|
|
3389
|
+
* a recovery attempt — see there), and `requeue` just replays back to the pending guard. This
|
|
3390
|
+
* re-enqueues the same `stepId` so the (idempotent) step re-runs and its result resumes the run.
|
|
3391
|
+
* Safe to call on a healthy run — it re-runs
|
|
3288
3392
|
* only in-flight `pending` remote steps, which are idempotent by the durable contract. Returns the
|
|
3289
3393
|
* run's current status (with the count re-dispatched), or null if the run is unknown.
|
|
3290
3394
|
*/
|
|
@@ -3576,10 +3680,10 @@ var WorkflowEngine = class {
|
|
|
3576
3680
|
});
|
|
3577
3681
|
}
|
|
3578
3682
|
/** Report that a `ctx.task` failed — the run resumes and throws a FatalError at the task. */
|
|
3579
|
-
async failTask(runId, name,
|
|
3683
|
+
async failTask(runId, name, error2) {
|
|
3580
3684
|
return this.signal(`task:${runId}:${name}`, {
|
|
3581
3685
|
ok: false,
|
|
3582
|
-
error
|
|
3686
|
+
error: error2
|
|
3583
3687
|
});
|
|
3584
3688
|
}
|
|
3585
3689
|
/**
|
|
@@ -3661,12 +3765,12 @@ var WorkflowEngine = class {
|
|
|
3661
3765
|
status: "cancelling"
|
|
3662
3766
|
};
|
|
3663
3767
|
}
|
|
3664
|
-
const
|
|
3768
|
+
const error2 = {
|
|
3665
3769
|
message: "cancelled"
|
|
3666
3770
|
};
|
|
3667
3771
|
await this.store.updateRun(runId, {
|
|
3668
3772
|
status: "cancelled",
|
|
3669
|
-
error,
|
|
3773
|
+
error: error2,
|
|
3670
3774
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3671
3775
|
});
|
|
3672
3776
|
this.emit({
|
|
@@ -3674,7 +3778,7 @@ var WorkflowEngine = class {
|
|
|
3674
3778
|
runId,
|
|
3675
3779
|
workflow: run.workflow,
|
|
3676
3780
|
namespace: run.namespace,
|
|
3677
|
-
error
|
|
3781
|
+
error: error2
|
|
3678
3782
|
});
|
|
3679
3783
|
await this.cancelChildren(runId, opts);
|
|
3680
3784
|
this.notifyCancelled(runId);
|
|
@@ -3689,7 +3793,7 @@ var WorkflowEngine = class {
|
|
|
3689
3793
|
return {
|
|
3690
3794
|
runId,
|
|
3691
3795
|
status: "cancelled",
|
|
3692
|
-
error
|
|
3796
|
+
error: error2
|
|
3693
3797
|
};
|
|
3694
3798
|
}
|
|
3695
3799
|
/**
|
|
@@ -4084,12 +4188,12 @@ var WorkflowEngine = class {
|
|
|
4084
4188
|
}
|
|
4085
4189
|
async runRemoteExecution(run, registered) {
|
|
4086
4190
|
if (run.status === "cancelling") {
|
|
4087
|
-
const
|
|
4191
|
+
const error2 = {
|
|
4088
4192
|
message: "cancelled"
|
|
4089
4193
|
};
|
|
4090
4194
|
await this.store.updateRun(run.id, {
|
|
4091
4195
|
status: "cancelled",
|
|
4092
|
-
error,
|
|
4196
|
+
error: error2,
|
|
4093
4197
|
updatedAt: /* @__PURE__ */ new Date()
|
|
4094
4198
|
});
|
|
4095
4199
|
this.emit({
|
|
@@ -4097,7 +4201,7 @@ var WorkflowEngine = class {
|
|
|
4097
4201
|
runId: run.id,
|
|
4098
4202
|
workflow: run.workflow,
|
|
4099
4203
|
namespace: run.namespace,
|
|
4100
|
-
error
|
|
4204
|
+
error: error2
|
|
4101
4205
|
});
|
|
4102
4206
|
this.notifyCancelled(run.id);
|
|
4103
4207
|
if (this.controlPlane) {
|
|
@@ -4111,7 +4215,7 @@ var WorkflowEngine = class {
|
|
|
4111
4215
|
return {
|
|
4112
4216
|
runId: run.id,
|
|
4113
4217
|
status: "cancelled",
|
|
4114
|
-
error
|
|
4218
|
+
error: error2
|
|
4115
4219
|
};
|
|
4116
4220
|
}
|
|
4117
4221
|
const remote = registered.remote;
|
|
@@ -4190,13 +4294,13 @@ var WorkflowEngine = class {
|
|
|
4190
4294
|
status: "running"
|
|
4191
4295
|
};
|
|
4192
4296
|
}
|
|
4193
|
-
const
|
|
4297
|
+
const error2 = {
|
|
4194
4298
|
message: err instanceof Error ? err.message : String(err),
|
|
4195
4299
|
stack: err instanceof Error ? err.stack : void 0
|
|
4196
4300
|
};
|
|
4197
4301
|
await this.store.updateRun(run.id, {
|
|
4198
4302
|
status: "failed",
|
|
4199
|
-
error,
|
|
4303
|
+
error: error2,
|
|
4200
4304
|
updatedAt: /* @__PURE__ */ new Date()
|
|
4201
4305
|
});
|
|
4202
4306
|
this.emit({
|
|
@@ -4204,12 +4308,12 @@ var WorkflowEngine = class {
|
|
|
4204
4308
|
runId: run.id,
|
|
4205
4309
|
workflow: run.workflow,
|
|
4206
4310
|
namespace: run.namespace,
|
|
4207
|
-
error
|
|
4311
|
+
error: error2
|
|
4208
4312
|
});
|
|
4209
4313
|
return {
|
|
4210
4314
|
runId: run.id,
|
|
4211
4315
|
status: "failed",
|
|
4212
|
-
error
|
|
4316
|
+
error: error2
|
|
4213
4317
|
};
|
|
4214
4318
|
}
|
|
4215
4319
|
return this.applyDecision(run, decision);
|
|
@@ -4474,12 +4578,12 @@ var WorkflowEngine = class {
|
|
|
4474
4578
|
status: "cancelling"
|
|
4475
4579
|
};
|
|
4476
4580
|
this.cancelRequested.delete(run.id);
|
|
4477
|
-
const
|
|
4581
|
+
const error2 = {
|
|
4478
4582
|
message: "cancelled"
|
|
4479
4583
|
};
|
|
4480
4584
|
await this.store.updateRun(run.id, {
|
|
4481
4585
|
status: "cancelled",
|
|
4482
|
-
error,
|
|
4586
|
+
error: error2,
|
|
4483
4587
|
updatedAt: /* @__PURE__ */ new Date()
|
|
4484
4588
|
});
|
|
4485
4589
|
this.emit({
|
|
@@ -4487,12 +4591,12 @@ var WorkflowEngine = class {
|
|
|
4487
4591
|
runId: run.id,
|
|
4488
4592
|
workflow: run.workflow,
|
|
4489
4593
|
namespace: run.namespace,
|
|
4490
|
-
error
|
|
4594
|
+
error: error2
|
|
4491
4595
|
});
|
|
4492
4596
|
return {
|
|
4493
4597
|
runId: run.id,
|
|
4494
4598
|
status: "cancelled",
|
|
4495
|
-
error
|
|
4599
|
+
error: error2
|
|
4496
4600
|
};
|
|
4497
4601
|
}
|
|
4498
4602
|
/** The run body, lease held + renewed by {@link execute}. */
|
|
@@ -4593,7 +4697,7 @@ var WorkflowEngine = class {
|
|
|
4593
4697
|
if (this.cancelRequested.has(run.id)) {
|
|
4594
4698
|
return this.compensateAndCancel(run, compensations, replay);
|
|
4595
4699
|
}
|
|
4596
|
-
const
|
|
4700
|
+
const error2 = {
|
|
4597
4701
|
message: err instanceof Error ? err.message : String(err),
|
|
4598
4702
|
stack: err instanceof Error ? err.stack : void 0
|
|
4599
4703
|
};
|
|
@@ -4604,7 +4708,7 @@ var WorkflowEngine = class {
|
|
|
4604
4708
|
});
|
|
4605
4709
|
return this.settleRun(run, {
|
|
4606
4710
|
kind: "failed",
|
|
4607
|
-
error
|
|
4711
|
+
error: error2
|
|
4608
4712
|
});
|
|
4609
4713
|
} finally {
|
|
4610
4714
|
await this.store.releaseRunLock(run.id);
|
|
@@ -4693,7 +4797,7 @@ var WorkflowEngine = class {
|
|
|
4693
4797
|
return;
|
|
4694
4798
|
} catch (err) {
|
|
4695
4799
|
if (attempt >= this.compensationRetries) {
|
|
4696
|
-
const
|
|
4800
|
+
const error2 = {
|
|
4697
4801
|
message: err instanceof Error ? err.message : String(err)
|
|
4698
4802
|
};
|
|
4699
4803
|
this.emit({
|
|
@@ -4702,7 +4806,7 @@ var WorkflowEngine = class {
|
|
|
4702
4806
|
workflow: run.workflow,
|
|
4703
4807
|
name,
|
|
4704
4808
|
kind: "local",
|
|
4705
|
-
error,
|
|
4809
|
+
error: error2,
|
|
4706
4810
|
durationMs: Date.now() - startedAt.getTime()
|
|
4707
4811
|
});
|
|
4708
4812
|
const cp = stepCheckpoint({
|
|
@@ -4712,7 +4816,7 @@ var WorkflowEngine = class {
|
|
|
4712
4816
|
kind: "local",
|
|
4713
4817
|
status: "failed",
|
|
4714
4818
|
attempts: attempt,
|
|
4715
|
-
error,
|
|
4819
|
+
error: error2,
|
|
4716
4820
|
enqueuedAt,
|
|
4717
4821
|
startedAt,
|
|
4718
4822
|
finishedAt: /* @__PURE__ */ new Date()
|
|
@@ -4968,14 +5072,14 @@ var WorkflowEngine = class {
|
|
|
4968
5072
|
error: current.error
|
|
4969
5073
|
};
|
|
4970
5074
|
}
|
|
4971
|
-
const
|
|
5075
|
+
const error2 = {
|
|
4972
5076
|
message: blocked.reason,
|
|
4973
5077
|
code: blocked.code,
|
|
4974
5078
|
retryable: true
|
|
4975
5079
|
};
|
|
4976
5080
|
await this.store.updateRun(run.id, {
|
|
4977
5081
|
status: "blocked",
|
|
4978
|
-
error,
|
|
5082
|
+
error: error2,
|
|
4979
5083
|
wakeAt: this.clock() + this.blockedPollMs,
|
|
4980
5084
|
updatedAt: /* @__PURE__ */ new Date()
|
|
4981
5085
|
});
|
|
@@ -4984,7 +5088,7 @@ var WorkflowEngine = class {
|
|
|
4984
5088
|
runId: run.id,
|
|
4985
5089
|
workflow: run.workflow,
|
|
4986
5090
|
namespace: run.namespace,
|
|
4987
|
-
error,
|
|
5091
|
+
error: error2,
|
|
4988
5092
|
requires: blocked.requires,
|
|
4989
5093
|
diagnostics: blocked.diagnostics
|
|
4990
5094
|
});
|
|
@@ -4992,7 +5096,7 @@ var WorkflowEngine = class {
|
|
|
4992
5096
|
return {
|
|
4993
5097
|
runId: run.id,
|
|
4994
5098
|
status: "blocked",
|
|
4995
|
-
error
|
|
5099
|
+
error: error2
|
|
4996
5100
|
};
|
|
4997
5101
|
}
|
|
4998
5102
|
/** Runs parked `blocked` whose recovery poll is due (`wakeAt <= nowMs`), namespace-scoped like
|
|
@@ -6213,8 +6317,11 @@ var InMemoryTransport = class {
|
|
|
6213
6317
|
collectMetrics,
|
|
6214
6318
|
controlPlaneDescriptor,
|
|
6215
6319
|
createStepLogger,
|
|
6320
|
+
currentStep,
|
|
6216
6321
|
currentWorkflowCtx,
|
|
6322
|
+
debug,
|
|
6217
6323
|
descriptorHash,
|
|
6324
|
+
error,
|
|
6218
6325
|
eventMatchOf,
|
|
6219
6326
|
eventMatches,
|
|
6220
6327
|
eventNameOf,
|
|
@@ -6222,9 +6329,11 @@ var InMemoryTransport = class {
|
|
|
6222
6329
|
eventToken,
|
|
6223
6330
|
heartbeatStatus,
|
|
6224
6331
|
indexWaitersByRun,
|
|
6332
|
+
info,
|
|
6225
6333
|
isEventToken,
|
|
6226
6334
|
isLegacyDescriptor,
|
|
6227
6335
|
isWorkflowControlFlowSignal,
|
|
6336
|
+
log,
|
|
6228
6337
|
matchesAttributes,
|
|
6229
6338
|
missingCapabilities,
|
|
6230
6339
|
negotiate,
|
|
@@ -6237,6 +6346,7 @@ var InMemoryTransport = class {
|
|
|
6237
6346
|
requiredCapabilities,
|
|
6238
6347
|
resolveRouting,
|
|
6239
6348
|
resolveRunWaiting,
|
|
6349
|
+
runInStepLogger,
|
|
6240
6350
|
runInWorkflowCtx,
|
|
6241
6351
|
runSchedules,
|
|
6242
6352
|
runStepHandler,
|
|
@@ -6246,7 +6356,11 @@ var InMemoryTransport = class {
|
|
|
6246
6356
|
stepConfigOf,
|
|
6247
6357
|
stepId,
|
|
6248
6358
|
stepNameOf,
|
|
6359
|
+
sub,
|
|
6360
|
+
subEvent,
|
|
6361
|
+
subProcess,
|
|
6249
6362
|
tenantGroup,
|
|
6363
|
+
warn,
|
|
6250
6364
|
workflowName
|
|
6251
6365
|
});
|
|
6252
6366
|
//# sourceMappingURL=index.cjs.map
|