@dudousxd/nestjs-durable 0.29.0 → 0.30.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 CHANGED
@@ -489,6 +489,12 @@ function tenantGatewayUnavailable(method) {
489
489
  __name(tenantGatewayUnavailable, "tenantGatewayUnavailable");
490
490
  function unavailableRunGateway() {
491
491
  return {
492
+ // Topology is local metadata, always answerable — a thin worker with no transport is still a tenant.
493
+ topology() {
494
+ return {
495
+ role: "tenant"
496
+ };
497
+ },
492
498
  getRunDetail(_runId) {
493
499
  return tenantGatewayUnavailable("getRunDetail");
494
500
  },
@@ -883,12 +889,20 @@ var ProxyRunGateway = class {
883
889
  });
884
890
  });
885
891
  }
892
+ topology() {
893
+ return {
894
+ role: "tenant",
895
+ tenant: this.tenant
896
+ };
897
+ }
886
898
  getRunDetail(runId) {
887
899
  return this.request({
888
900
  kind: "getRunDetail",
889
901
  runId
890
902
  });
891
903
  }
904
+ /** The control plane's `StoreRunGateway` resolves each run's `waiting` descriptor; the reply carries
905
+ * it through as plain JSON, so a tenant's list rows name the wait too. */
892
906
  listRuns(query) {
893
907
  return this.request({
894
908
  kind: "listRuns",
@@ -1195,6 +1209,11 @@ var StoreRunGateway = class {
1195
1209
  this.store = store;
1196
1210
  this.engine = engine;
1197
1211
  }
1212
+ topology() {
1213
+ return {
1214
+ role: "control-plane"
1215
+ };
1216
+ }
1198
1217
  async getRunDetail(runId) {
1199
1218
  const run = await this.store.getRun(runId);
1200
1219
  if (!run) return null;
@@ -1208,8 +1227,16 @@ var StoreRunGateway = class {
1208
1227
  children
1209
1228
  };
1210
1229
  }
1211
- listRuns(query) {
1212
- return this.store.listRuns(query);
1230
+ async listRuns(query) {
1231
+ const runs = await this.store.listRuns(query);
1232
+ const waiterByRun = (0, import_nestjs_durable_core8.indexWaitersByRun)(await this.store.listSignalWaiters(""));
1233
+ return runs.map((run) => {
1234
+ const waiting = (0, import_nestjs_durable_core8.resolveRunWaiting)(run, waiterByRun);
1235
+ return waiting ? {
1236
+ ...run,
1237
+ waiting
1238
+ } : run;
1239
+ });
1213
1240
  }
1214
1241
  /** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
1215
1242
  * `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */