@dudousxd/nestjs-durable-core 0.46.0 → 0.46.1
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 +14 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2085,7 +2085,7 @@ var WorkflowEngine = class {
|
|
|
2085
2085
|
workflow: name,
|
|
2086
2086
|
workflowVersion: "1",
|
|
2087
2087
|
status: "pending",
|
|
2088
|
-
// Stamp the namespace the REAL run will carry (
|
|
2088
|
+
// Stamp the namespace the REAL run will carry (below) so convention routing resolves the same
|
|
2089
2089
|
// tenant-suffixed group the run will dispatch to — an operator starting a tenant's run via the
|
|
2090
2090
|
// `onStartRun` wire (opts.namespace = tenant) must find the live `<workflow>@<tenant>` group,
|
|
2091
2091
|
// not the bare group. Without this the start-run entry path can't reach a suffixed-only worker.
|
|
@@ -3424,7 +3424,9 @@ var WorkflowEngine = class {
|
|
|
3424
3424
|
parallelGroup: cmd.parallelGroup
|
|
3425
3425
|
});
|
|
3426
3426
|
if (!await this.store.getRun(childId)) {
|
|
3427
|
-
queueMicrotask(() => void this.start(cmd.workflow, cmd.input, childId
|
|
3427
|
+
queueMicrotask(() => void this.start(cmd.workflow, cmd.input, childId, {
|
|
3428
|
+
namespace: run.namespace
|
|
3429
|
+
}).catch(() => void 0));
|
|
3428
3430
|
}
|
|
3429
3431
|
} else {
|
|
3430
3432
|
throw new Error(`remote workflow command '${cmd.kind}' is not supported yet`);
|
|
@@ -3504,7 +3506,7 @@ var WorkflowEngine = class {
|
|
|
3504
3506
|
const snapshot = await this.store.listCheckpoints(run.id);
|
|
3505
3507
|
const replay = /* @__PURE__ */ new Map();
|
|
3506
3508
|
for (const cp of snapshot) replay.set(cp.seq, cp);
|
|
3507
|
-
const ctx = createWorkflowCtx(this.ctxHostFor(replay), run.id, compensations, run.workflow);
|
|
3509
|
+
const ctx = createWorkflowCtx(this.ctxHostFor(replay, run.namespace), run.id, compensations, run.workflow);
|
|
3508
3510
|
try {
|
|
3509
3511
|
const output = await fn(ctx, run.input);
|
|
3510
3512
|
if (this.cancelRequested.has(run.id)) return this.compensateAndCancel(run, compensations);
|
|
@@ -3603,7 +3605,7 @@ var WorkflowEngine = class {
|
|
|
3603
3605
|
/** The seam handed to {@link createWorkflowCtx}: the authoring API reaches durability + lifecycle
|
|
3604
3606
|
* (checkpointing, dispatch, child start) through this, so the ctx primitives live in their own
|
|
3605
3607
|
* module and the engine stays the orchestrator. */
|
|
3606
|
-
ctxHostFor(replay) {
|
|
3608
|
+
ctxHostFor(replay, parentNamespace) {
|
|
3607
3609
|
return {
|
|
3608
3610
|
store: this.store,
|
|
3609
3611
|
replay,
|
|
@@ -3613,10 +3615,16 @@ var WorkflowEngine = class {
|
|
|
3613
3615
|
completeStep: /* @__PURE__ */ __name((s) => this.completeStep(s), "completeStep"),
|
|
3614
3616
|
failStep: /* @__PURE__ */ __name((s) => this.failStep(s), "failStep"),
|
|
3615
3617
|
callRemote: /* @__PURE__ */ __name((runId, seq, step, input, queue, transport, admission) => this.callRemote(runId, seq, step, input, queue, transport, replay, admission), "callRemote"),
|
|
3616
|
-
// Defer so a fast child can't reentrantly resume a still-running parent.
|
|
3618
|
+
// Defer so a fast child can't reentrantly resume a still-running parent. Stamp the child with
|
|
3619
|
+
// the PARENT run's namespace (not this engine's) so a child belongs to the tenant/partition of
|
|
3620
|
+
// the run it was spawned from — even when an operator (namespace: undefined, drives every
|
|
3621
|
+
// namespace) is the one executing the parent. Otherwise an operator recovery-resuming a
|
|
3622
|
+
// `davi-local` pipeline would stamp its `processing` child `default` and it would leak off the
|
|
3623
|
+
// tenant's worker pool onto the shared/dev workers.
|
|
3617
3624
|
startChild: /* @__PURE__ */ __name((workflow, input, id, priority) => {
|
|
3618
3625
|
queueMicrotask(() => void this.start(workflow, input, id, {
|
|
3619
|
-
priority
|
|
3626
|
+
priority,
|
|
3627
|
+
namespace: parentNamespace
|
|
3620
3628
|
}).catch(() => void 0));
|
|
3621
3629
|
}, "startChild"),
|
|
3622
3630
|
// Shallow-merge into the run's searchAttributes (the ctx primitive makes this exactly-once).
|