@dudousxd/nestjs-durable 0.45.0 → 0.46.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.d.cts CHANGED
@@ -1065,12 +1065,12 @@ declare class StoreRunGateway implements RunGateway {
1065
1065
  /**
1066
1066
  * Bulk-resolve what each of `runIds` is currently parked on — for a consumer with its own filtered/
1067
1067
  * paginated run listing (e.g. "which of MY suspended runs are stuck at a breakpoint") without
1068
- * re-deriving `listRuns`' waiter scan or querying `durable_step_checkpoints` directly. Mirrors
1069
- * `listRuns`' waiting computation (the SAME bulk signal-waiter scan + `resolveRunWaiting`), but ALSO
1068
+ * re-deriving `listRuns`' waiter read or querying `durable_step_checkpoints` directly. Mirrors
1069
+ * `listRuns`' waiting computation (the requested runs' signal waiters + `resolveRunWaiting`), but ALSO
1070
1070
  * bulk-fetches the currently-suspended runs to check real status: `engine.cancel` (the non-compensate
1071
1071
  * path) doesn't clear a run's signal waiter row, so a cancelled run can leave an ORPHANED waiter
1072
1072
  * behind — trusting waiter presence alone would wrongly report a terminal run as still waiting.
1073
- * Two bulk scans total (never one query per requested id), same as `listRuns`.
1073
+ * Two bulk reads total (never one query per requested id), same as `listRuns`.
1074
1074
  */
1075
1075
  waitingFor(runIds: string[]): Promise<Record<string, RunWaiting>>;
1076
1076
  /** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
package/dist/index.d.ts CHANGED
@@ -1065,12 +1065,12 @@ declare class StoreRunGateway implements RunGateway {
1065
1065
  /**
1066
1066
  * Bulk-resolve what each of `runIds` is currently parked on — for a consumer with its own filtered/
1067
1067
  * paginated run listing (e.g. "which of MY suspended runs are stuck at a breakpoint") without
1068
- * re-deriving `listRuns`' waiter scan or querying `durable_step_checkpoints` directly. Mirrors
1069
- * `listRuns`' waiting computation (the SAME bulk signal-waiter scan + `resolveRunWaiting`), but ALSO
1068
+ * re-deriving `listRuns`' waiter read or querying `durable_step_checkpoints` directly. Mirrors
1069
+ * `listRuns`' waiting computation (the requested runs' signal waiters + `resolveRunWaiting`), but ALSO
1070
1070
  * bulk-fetches the currently-suspended runs to check real status: `engine.cancel` (the non-compensate
1071
1071
  * path) doesn't clear a run's signal waiter row, so a cancelled run can leave an ORPHANED waiter
1072
1072
  * behind — trusting waiter presence alone would wrongly report a terminal run as still waiting.
1073
- * Two bulk scans total (never one query per requested id), same as `listRuns`.
1073
+ * Two bulk reads total (never one query per requested id), same as `listRuns`.
1074
1074
  */
1075
1075
  waitingFor(runIds: string[]): Promise<Record<string, RunWaiting>>;
1076
1076
  /** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
package/dist/index.js CHANGED
@@ -1468,7 +1468,7 @@ var RunRequestResponder = class {
1468
1468
  };
1469
1469
 
1470
1470
  // src/store-run-gateway.ts
1471
- import { STATE_STORE_CANONICAL as STATE_STORE_CANONICAL2, WorkflowEngine as WorkflowEngine2, indexWaitersByRun, mergeRunFacetRows, resolveRunWaiting } from "@dudousxd/nestjs-durable-core";
1471
+ import { STATE_STORE_CANONICAL as STATE_STORE_CANONICAL2, WorkflowEngine as WorkflowEngine2, indexWaitersByRun, listSignalWaitersOfRuns, mergeRunFacetRows, resolveRunWaiting } from "@dudousxd/nestjs-durable-core";
1472
1472
  import { Inject as Inject5, Injectable as Injectable8 } from "@nestjs/common";
1473
1473
  function _ts_decorate8(decorators, target, key, desc) {
1474
1474
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1526,7 +1526,7 @@ var StoreRunGateway = class {
1526
1526
  }
1527
1527
  async listRuns(query) {
1528
1528
  const runs = await this.store.listRuns(query);
1529
- const waiterByRun = indexWaitersByRun(await this.store.listSignalWaiters(""));
1529
+ const waiterByRun = indexWaitersByRun(await listSignalWaitersOfRuns(this.store, runs.filter((run) => run.status === "suspended").map((run) => run.id)));
1530
1530
  return runs.map((run) => {
1531
1531
  const waiting = resolveRunWaiting(run, waiterByRun);
1532
1532
  return waiting ? {
@@ -1563,12 +1563,12 @@ var StoreRunGateway = class {
1563
1563
  /**
1564
1564
  * Bulk-resolve what each of `runIds` is currently parked on — for a consumer with its own filtered/
1565
1565
  * paginated run listing (e.g. "which of MY suspended runs are stuck at a breakpoint") without
1566
- * re-deriving `listRuns`' waiter scan or querying `durable_step_checkpoints` directly. Mirrors
1567
- * `listRuns`' waiting computation (the SAME bulk signal-waiter scan + `resolveRunWaiting`), but ALSO
1566
+ * re-deriving `listRuns`' waiter read or querying `durable_step_checkpoints` directly. Mirrors
1567
+ * `listRuns`' waiting computation (the requested runs' signal waiters + `resolveRunWaiting`), but ALSO
1568
1568
  * bulk-fetches the currently-suspended runs to check real status: `engine.cancel` (the non-compensate
1569
1569
  * path) doesn't clear a run's signal waiter row, so a cancelled run can leave an ORPHANED waiter
1570
1570
  * behind — trusting waiter presence alone would wrongly report a terminal run as still waiting.
1571
- * Two bulk scans total (never one query per requested id), same as `listRuns`.
1571
+ * Two bulk reads total (never one query per requested id), same as `listRuns`.
1572
1572
  */
1573
1573
  async waitingFor(runIds) {
1574
1574
  if (runIds.length === 0) return {};
@@ -1579,7 +1579,7 @@ var StoreRunGateway = class {
1579
1579
  "suspended"
1580
1580
  ]
1581
1581
  }),
1582
- this.store.listSignalWaiters("")
1582
+ listSignalWaitersOfRuns(this.store, runIds)
1583
1583
  ]);
1584
1584
  const waiterByRun = indexWaitersByRun(waiters);
1585
1585
  const result = {};
@@ -2306,7 +2306,7 @@ var RunGatewayBootstrap = class RunGatewayBootstrap2 {
2306
2306
  if (typeof publishTenantEvent === "function") {
2307
2307
  const republisher = new TenantEventRepublisher(store, publishTenantEvent.bind(this.transport));
2308
2308
  this.unsubscribe = this.engine.subscribe((event) => {
2309
- void republisher.handle(event);
2309
+ void republisher.handle(event).catch(() => void 0);
2310
2310
  });
2311
2311
  }
2312
2312
  }