@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.js CHANGED
@@ -2008,7 +2008,7 @@ var WorkflowEngine = class {
2008
2008
  workflow: name,
2009
2009
  workflowVersion: "1",
2010
2010
  status: "pending",
2011
- // Stamp the namespace the REAL run will carry (:893) so convention routing resolves the same
2011
+ // Stamp the namespace the REAL run will carry (below) so convention routing resolves the same
2012
2012
  // tenant-suffixed group the run will dispatch to — an operator starting a tenant's run via the
2013
2013
  // `onStartRun` wire (opts.namespace = tenant) must find the live `<workflow>@<tenant>` group,
2014
2014
  // not the bare group. Without this the start-run entry path can't reach a suffixed-only worker.
@@ -3347,7 +3347,9 @@ var WorkflowEngine = class {
3347
3347
  parallelGroup: cmd.parallelGroup
3348
3348
  });
3349
3349
  if (!await this.store.getRun(childId)) {
3350
- queueMicrotask(() => void this.start(cmd.workflow, cmd.input, childId).catch(() => void 0));
3350
+ queueMicrotask(() => void this.start(cmd.workflow, cmd.input, childId, {
3351
+ namespace: run.namespace
3352
+ }).catch(() => void 0));
3351
3353
  }
3352
3354
  } else {
3353
3355
  throw new Error(`remote workflow command '${cmd.kind}' is not supported yet`);
@@ -3427,7 +3429,7 @@ var WorkflowEngine = class {
3427
3429
  const snapshot = await this.store.listCheckpoints(run.id);
3428
3430
  const replay = /* @__PURE__ */ new Map();
3429
3431
  for (const cp of snapshot) replay.set(cp.seq, cp);
3430
- const ctx = createWorkflowCtx(this.ctxHostFor(replay), run.id, compensations, run.workflow);
3432
+ const ctx = createWorkflowCtx(this.ctxHostFor(replay, run.namespace), run.id, compensations, run.workflow);
3431
3433
  try {
3432
3434
  const output = await fn(ctx, run.input);
3433
3435
  if (this.cancelRequested.has(run.id)) return this.compensateAndCancel(run, compensations);
@@ -3526,7 +3528,7 @@ var WorkflowEngine = class {
3526
3528
  /** The seam handed to {@link createWorkflowCtx}: the authoring API reaches durability + lifecycle
3527
3529
  * (checkpointing, dispatch, child start) through this, so the ctx primitives live in their own
3528
3530
  * module and the engine stays the orchestrator. */
3529
- ctxHostFor(replay) {
3531
+ ctxHostFor(replay, parentNamespace) {
3530
3532
  return {
3531
3533
  store: this.store,
3532
3534
  replay,
@@ -3536,10 +3538,16 @@ var WorkflowEngine = class {
3536
3538
  completeStep: /* @__PURE__ */ __name((s) => this.completeStep(s), "completeStep"),
3537
3539
  failStep: /* @__PURE__ */ __name((s) => this.failStep(s), "failStep"),
3538
3540
  callRemote: /* @__PURE__ */ __name((runId, seq, step, input, queue, transport, admission) => this.callRemote(runId, seq, step, input, queue, transport, replay, admission), "callRemote"),
3539
- // Defer so a fast child can't reentrantly resume a still-running parent.
3541
+ // Defer so a fast child can't reentrantly resume a still-running parent. Stamp the child with
3542
+ // the PARENT run's namespace (not this engine's) so a child belongs to the tenant/partition of
3543
+ // the run it was spawned from — even when an operator (namespace: undefined, drives every
3544
+ // namespace) is the one executing the parent. Otherwise an operator recovery-resuming a
3545
+ // `davi-local` pipeline would stamp its `processing` child `default` and it would leak off the
3546
+ // tenant's worker pool onto the shared/dev workers.
3540
3547
  startChild: /* @__PURE__ */ __name((workflow, input, id, priority) => {
3541
3548
  queueMicrotask(() => void this.start(workflow, input, id, {
3542
- priority
3549
+ priority,
3550
+ namespace: parentNamespace
3543
3551
  }).catch(() => void 0));
3544
3552
  }, "startChild"),
3545
3553
  // Shallow-merge into the run's searchAttributes (the ctx primitive makes this exactly-once).