@dudousxd/nestjs-durable 0.30.0 → 0.30.2

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 CHANGED
@@ -516,6 +516,9 @@ function unavailableRunGateway() {
516
516
  retryWithInput(_runId, _input) {
517
517
  return tenantGatewayUnavailable("retryWithInput");
518
518
  },
519
+ redispatchPending(_runId) {
520
+ return tenantGatewayUnavailable("redispatchPending");
521
+ },
519
522
  subscribe(_runId, _onEvent) {
520
523
  throw new Error("RunGateway.subscribe() is not available \u2014 pass `transport` to use RunGateway.");
521
524
  }
@@ -901,6 +904,8 @@ var ProxyRunGateway = class {
901
904
  runId
902
905
  });
903
906
  }
907
+ /** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
908
+ * it through as plain JSON, so a tenant's list rows name the wait too. */
904
909
  listRuns(query) {
905
910
  return this.request({
906
911
  kind: "listRuns",
@@ -942,6 +947,12 @@ var ProxyRunGateway = class {
942
947
  input
943
948
  });
944
949
  }
950
+ redispatchPending(runId) {
951
+ return this.request({
952
+ kind: "redispatch",
953
+ runId
954
+ });
955
+ }
945
956
  subscribe(runId, onEvent) {
946
957
  const unsubscribe = this.transport.onTenantEvent?.(this.tenant, (evt) => {
947
958
  if (evt.event.runId === runId) onEvent(evt.event);
@@ -1173,6 +1184,8 @@ var RunRequestResponder = class {
1173
1184
  return this.gateway.continue(body.runId);
1174
1185
  case "retryWithInput":
1175
1186
  return this.gateway.retryWithInput(body.runId, body.input);
1187
+ case "redispatch":
1188
+ return this.gateway.redispatchPending(body.runId);
1176
1189
  }
1177
1190
  }
1178
1191
  };
@@ -1225,8 +1238,16 @@ var StoreRunGateway = class {
1225
1238
  children
1226
1239
  };
1227
1240
  }
1228
- listRuns(query) {
1229
- return this.store.listRuns(query);
1241
+ async listRuns(query) {
1242
+ const runs = await this.store.listRuns(query);
1243
+ const waiterByRun = (0, import_nestjs_durable_core8.indexWaitersByRun)(await this.store.listSignalWaiters(""));
1244
+ return runs.map((run) => {
1245
+ const waiting = (0, import_nestjs_durable_core8.resolveRunWaiting)(run, waiterByRun);
1246
+ return waiting ? {
1247
+ ...run,
1248
+ waiting
1249
+ } : run;
1250
+ });
1230
1251
  }
1231
1252
  /** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
1232
1253
  * `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */
@@ -1246,6 +1267,9 @@ var StoreRunGateway = class {
1246
1267
  retryWithInput(runId, input) {
1247
1268
  return this.engine.retryWithInput(runId, input);
1248
1269
  }
1270
+ redispatchPending(runId) {
1271
+ return this.engine.redispatchPending(runId);
1272
+ }
1249
1273
  subscribe(runId, onEvent) {
1250
1274
  return this.engine.subscribe((event) => {
1251
1275
  if (event.runId === runId) onEvent(event);