@dudousxd/nestjs-durable 0.33.0 → 0.34.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.cjs CHANGED
@@ -56,8 +56,9 @@ __export(index_exports, {
56
56
  ThinWorkflowRegistrar: () => ThinWorkflowRegistrar,
57
57
  WORKFLOW_METADATA: () => WORKFLOW_METADATA,
58
58
  Workflow: () => Workflow,
59
- WorkflowEngine: () => import_nestjs_durable_core13.WorkflowEngine,
59
+ WorkflowEngine: () => import_nestjs_durable_core14.WorkflowEngine,
60
60
  WorkflowService: () => WorkflowService,
61
+ attributesOf: () => attributesOf,
61
62
  entityConfigFor: () => entityConfigFor,
62
63
  getDurableStepMeta: () => getDurableStepMeta,
63
64
  getEntityMeta: () => getEntityMeta,
@@ -68,12 +69,15 @@ __export(index_exports, {
68
69
  isDrivingOperator: () => isDrivingOperator,
69
70
  isOperatorRole: () => isOperatorRole,
70
71
  isStepInterceptor: () => isStepInterceptor,
71
- readSearchAttributes: () => import_nestjs_durable_core13.readSearchAttributes,
72
+ readSearchAttributes: () => import_nestjs_durable_core14.readSearchAttributes,
72
73
  thinWorkerProviders: () => thinWorkerProviders,
73
74
  unavailableRunGateway: () => unavailableRunGateway
74
75
  });
75
76
  module.exports = __toCommonJS(index_exports);
76
77
 
78
+ // src/attributes-of.ts
79
+ var import_nestjs_durable_core2 = require("@dudousxd/nestjs-durable-core");
80
+
77
81
  // src/decorators.ts
78
82
  var import_nestjs_durable_core = require("@dudousxd/nestjs-durable-core");
79
83
  var import_reflect_metadata = require("reflect-metadata");
@@ -181,9 +185,22 @@ function getOnEvents(meta, target) {
181
185
  }
182
186
  __name(getOnEvents, "getOnEvents");
183
187
 
188
+ // src/attributes-of.ts
189
+ function attributesOf(workflow, run) {
190
+ const meta = getWorkflowMeta(workflow);
191
+ if (!meta) {
192
+ throw new Error(`attributesOf: ${workflow.name} is not a @Workflow class \u2014 is it decorated with @Workflow({ name, searchAttributes })?`);
193
+ }
194
+ if (!meta.searchAttributes) {
195
+ throw new Error(`attributesOf: workflow '${meta.name}' declares no searchAttributes schema \u2014 reading attributes by class requires the workflow to declare its schema: @Workflow({ name: '${meta.name}', searchAttributes: mySchema }).`);
196
+ }
197
+ return (0, import_nestjs_durable_core2.readSearchAttributes)(meta.searchAttributes, run);
198
+ }
199
+ __name(attributesOf, "attributesOf");
200
+
184
201
  // src/durable-start-client.ts
185
202
  var import_durable_worker = require("@dudousxd/durable-worker");
186
- var import_nestjs_durable_core2 = require("@dudousxd/nestjs-durable-core");
203
+ var import_nestjs_durable_core3 = require("@dudousxd/nestjs-durable-core");
187
204
  var import_common = require("@nestjs/common");
188
205
  function _ts_decorate(decorators, target, key, desc) {
189
206
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -209,7 +226,7 @@ var DurableStartClient = class {
209
226
  this.tenant = options.partition ?? "default";
210
227
  }
211
228
  async start(workflow, input, runId = globalThis.crypto.randomUUID(), opts) {
212
- const name = (0, import_nestjs_durable_core2.workflowName)(workflow);
229
+ const name = (0, import_nestjs_durable_core3.workflowName)(workflow);
213
230
  await (0, import_durable_worker.startRun)(this.options.connection, {
214
231
  tenant: this.tenant,
215
232
  workflow: name,
@@ -278,7 +295,7 @@ __name(tenantUnsupported, "tenantUnsupported");
278
295
 
279
296
  // src/durable-worker.module.ts
280
297
  var import_durable_worker2 = require("@dudousxd/durable-worker");
281
- var import_nestjs_durable_core3 = require("@dudousxd/nestjs-durable-core");
298
+ var import_nestjs_durable_core4 = require("@dudousxd/nestjs-durable-core");
282
299
  var import_common2 = require("@nestjs/common");
283
300
  var import_core = require("@nestjs/core");
284
301
 
@@ -362,7 +379,7 @@ var ThinWorkflowRegistrar = class {
362
379
  };
363
380
  ThinWorkflowRegistrar = _ts_decorate2([
364
381
  (0, import_common2.Injectable)(),
365
- _ts_param(2, (0, import_common2.Inject)(import_nestjs_durable_core3.DURABLE_OPTIONS_CANONICAL)),
382
+ _ts_param(2, (0, import_common2.Inject)(import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL)),
366
383
  _ts_metadata2("design:type", Function),
367
384
  _ts_metadata2("design:paramtypes", [
368
385
  typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
@@ -391,7 +408,7 @@ var ThinStepRegistrar = class {
391
408
  };
392
409
  ThinStepRegistrar = _ts_decorate2([
393
410
  (0, import_common2.Injectable)(),
394
- _ts_param(3, (0, import_common2.Inject)(import_nestjs_durable_core3.DURABLE_OPTIONS_CANONICAL)),
411
+ _ts_param(3, (0, import_common2.Inject)(import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL)),
395
412
  _ts_metadata2("design:type", Function),
396
413
  _ts_metadata2("design:paramtypes", [
397
414
  typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
@@ -443,7 +460,7 @@ var ThinWorkerBootstrap = class {
443
460
  };
444
461
  ThinWorkerBootstrap = _ts_decorate2([
445
462
  (0, import_common2.Injectable)(),
446
- _ts_param(1, (0, import_common2.Inject)(import_nestjs_durable_core3.DURABLE_OPTIONS_CANONICAL)),
463
+ _ts_param(1, (0, import_common2.Inject)(import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL)),
447
464
  _ts_param(2, (0, import_common2.Inject)(RUN_REDIS_WORKER)),
448
465
  _ts_param(3, (0, import_common2.Inject)(DURABLE_WORKER_RUNNERS)),
449
466
  _ts_metadata2("design:type", Function),
@@ -469,7 +486,7 @@ function thinWorkerProviders() {
469
486
  workflowGroup: options.partition ?? ""
470
487
  }), "useFactory"),
471
488
  inject: [
472
- import_nestjs_durable_core3.DURABLE_OPTIONS_CANONICAL
489
+ import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL
473
490
  ]
474
491
  },
475
492
  {
@@ -533,12 +550,12 @@ function unavailableRunGateway() {
533
550
  __name(unavailableRunGateway, "unavailableRunGateway");
534
551
 
535
552
  // src/durable.module.ts
536
- var import_nestjs_durable_core12 = require("@dudousxd/nestjs-durable-core");
553
+ var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
537
554
  var import_common12 = require("@nestjs/common");
538
555
  var import_core5 = require("@nestjs/core");
539
556
 
540
557
  // src/durable-step.registrar.ts
541
- var import_nestjs_durable_core4 = require("@dudousxd/nestjs-durable-core");
558
+ var import_nestjs_durable_core5 = require("@dudousxd/nestjs-durable-core");
542
559
  var import_common3 = require("@nestjs/common");
543
560
  var import_core2 = require("@nestjs/core");
544
561
 
@@ -597,8 +614,8 @@ var DurableStepRegistrar = class {
597
614
  };
598
615
  DurableStepRegistrar = _ts_decorate3([
599
616
  (0, import_common3.Injectable)(),
600
- _ts_param2(2, (0, import_common3.Inject)(import_nestjs_durable_core4.TRANSPORT_CANONICAL)),
601
- _ts_param2(3, (0, import_common3.Inject)(import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL)),
617
+ _ts_param2(2, (0, import_common3.Inject)(import_nestjs_durable_core5.TRANSPORT_CANONICAL)),
618
+ _ts_param2(3, (0, import_common3.Inject)(import_nestjs_durable_core5.DURABLE_OPTIONS_CANONICAL)),
602
619
  _ts_metadata3("design:type", Function),
603
620
  _ts_metadata3("design:paramtypes", [
604
621
  typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
@@ -609,7 +626,7 @@ DurableStepRegistrar = _ts_decorate3([
609
626
  ], DurableStepRegistrar);
610
627
 
611
628
  // src/entity.ts
612
- var import_nestjs_durable_core5 = require("@dudousxd/nestjs-durable-core");
629
+ var import_nestjs_durable_core6 = require("@dudousxd/nestjs-durable-core");
613
630
  var import_common4 = require("@nestjs/common");
614
631
  var import_reflect_metadata2 = require("reflect-metadata");
615
632
  function _ts_decorate4(decorators, target, key, desc) {
@@ -683,13 +700,13 @@ EntityService = _ts_decorate4([
683
700
  (0, import_common4.Injectable)(),
684
701
  _ts_metadata4("design:type", Function),
685
702
  _ts_metadata4("design:paramtypes", [
686
- typeof import_nestjs_durable_core5.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core5.WorkflowEngine
703
+ typeof import_nestjs_durable_core6.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core6.WorkflowEngine
687
704
  ])
688
705
  ], EntityService);
689
706
 
690
707
  // src/in-app-worker.ts
691
708
  var import_durable_worker3 = require("@dudousxd/durable-worker");
692
- var import_nestjs_durable_core6 = require("@dudousxd/nestjs-durable-core");
709
+ var import_nestjs_durable_core7 = require("@dudousxd/nestjs-durable-core");
693
710
  var import_common5 = require("@nestjs/common");
694
711
  var import_core3 = require("@nestjs/core");
695
712
  function _ts_decorate5(decorators, target, key, desc) {
@@ -782,7 +799,7 @@ var InAppWorkerBootstrap = class {
782
799
  };
783
800
  InAppWorkerBootstrap = _ts_decorate5([
784
801
  (0, import_common5.Injectable)(),
785
- _ts_param3(2, (0, import_common5.Inject)(import_nestjs_durable_core6.DURABLE_OPTIONS_CANONICAL)),
802
+ _ts_param3(2, (0, import_common5.Inject)(import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL)),
786
803
  _ts_param3(3, (0, import_common5.Inject)(IN_APP_WORKER_RUNTIME)),
787
804
  _ts_param3(4, (0, import_common5.Inject)(IN_APP_RUN_REDIS_WORKER)),
788
805
  _ts_param3(5, (0, import_common5.Inject)(IN_APP_WORKER_RUNNERS)),
@@ -802,8 +819,8 @@ function inAppWorkerProviders() {
802
819
  provide: IN_APP_WORKER_BINDING,
803
820
  useFactory: /* @__PURE__ */ __name((transport, options) => inAppWorkerBinding(transport, options), "useFactory"),
804
821
  inject: [
805
- import_nestjs_durable_core6.TRANSPORT_CANONICAL,
806
- import_nestjs_durable_core6.DURABLE_OPTIONS_CANONICAL
822
+ import_nestjs_durable_core7.TRANSPORT_CANONICAL,
823
+ import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL
807
824
  ]
808
825
  },
809
826
  {
@@ -819,7 +836,7 @@ function inAppWorkerProviders() {
819
836
  workflowGroup: options.partition ?? ""
820
837
  }), "useFactory"),
821
838
  inject: [
822
- import_nestjs_durable_core6.DURABLE_OPTIONS_CANONICAL
839
+ import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL
823
840
  ]
824
841
  },
825
842
  {
@@ -986,7 +1003,7 @@ ProxyRunGateway = _ts_decorate6([
986
1003
  ], ProxyRunGateway);
987
1004
 
988
1005
  // src/retention-poller.ts
989
- var import_nestjs_durable_core7 = require("@dudousxd/nestjs-durable-core");
1006
+ var import_nestjs_durable_core8 = require("@dudousxd/nestjs-durable-core");
990
1007
  var import_common7 = require("@nestjs/common");
991
1008
  function _ts_decorate7(decorators, target, key, desc) {
992
1009
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1017,10 +1034,10 @@ function validateRetention(retention) {
1017
1034
  if (policy.maxAge == null && policy.maxCount == null) {
1018
1035
  throw new Error("durable retention: each policy must set maxAge and/or maxCount");
1019
1036
  }
1020
- if (policy.maxAge != null) (0, import_nestjs_durable_core7.parseDuration)(policy.maxAge);
1037
+ if (policy.maxAge != null) (0, import_nestjs_durable_core8.parseDuration)(policy.maxAge);
1021
1038
  for (const status of policy.statuses) {
1022
- if (!import_nestjs_durable_core7.TERMINAL_RUN_STATUSES.includes(status)) {
1023
- throw new Error(`durable retention: status "${status}" is not terminal; only ${import_nestjs_durable_core7.TERMINAL_RUN_STATUSES.join(", ")} can be pruned`);
1039
+ if (!import_nestjs_durable_core8.TERMINAL_RUN_STATUSES.includes(status)) {
1040
+ throw new Error(`durable retention: status "${status}" is not terminal; only ${import_nestjs_durable_core8.TERMINAL_RUN_STATUSES.join(", ")} can be pruned`);
1024
1041
  }
1025
1042
  if (seen.has(status)) {
1026
1043
  throw new Error(`durable retention: status "${status}" appears in more than one policy; status sets must be disjoint`);
@@ -1059,7 +1076,7 @@ var RetentionPoller = class {
1059
1076
  return;
1060
1077
  }
1061
1078
  await this.sweep();
1062
- const intervalMs = retention.sweepInterval != null ? (0, import_nestjs_durable_core7.parseDuration)(retention.sweepInterval) : DEFAULT_SWEEP_INTERVAL_MS;
1079
+ const intervalMs = retention.sweepInterval != null ? (0, import_nestjs_durable_core8.parseDuration)(retention.sweepInterval) : DEFAULT_SWEEP_INTERVAL_MS;
1063
1080
  if (intervalMs > 0) {
1064
1081
  this.timer = setInterval(() => void this.sweep(), intervalMs);
1065
1082
  this.timer.unref?.();
@@ -1091,8 +1108,8 @@ var RetentionPoller = class {
1091
1108
  };
1092
1109
  RetentionPoller = _ts_decorate7([
1093
1110
  (0, import_common7.Injectable)(),
1094
- _ts_param4(0, (0, import_common7.Inject)(import_nestjs_durable_core7.STATE_STORE_CANONICAL)),
1095
- _ts_param4(1, (0, import_common7.Inject)(import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL)),
1111
+ _ts_param4(0, (0, import_common7.Inject)(import_nestjs_durable_core8.STATE_STORE_CANONICAL)),
1112
+ _ts_param4(1, (0, import_common7.Inject)(import_nestjs_durable_core8.DURABLE_OPTIONS_CANONICAL)),
1096
1113
  _ts_metadata7("design:type", Function),
1097
1114
  _ts_metadata7("design:paramtypes", [
1098
1115
  Object,
@@ -1226,7 +1243,7 @@ var RunRequestResponder = class {
1226
1243
  };
1227
1244
 
1228
1245
  // src/store-run-gateway.ts
1229
- var import_nestjs_durable_core8 = require("@dudousxd/nestjs-durable-core");
1246
+ var import_nestjs_durable_core9 = require("@dudousxd/nestjs-durable-core");
1230
1247
  var import_common8 = require("@nestjs/common");
1231
1248
  function _ts_decorate8(decorators, target, key, desc) {
1232
1249
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1275,9 +1292,9 @@ var StoreRunGateway = class {
1275
1292
  }
1276
1293
  async listRuns(query) {
1277
1294
  const runs = await this.store.listRuns(query);
1278
- const waiterByRun = (0, import_nestjs_durable_core8.indexWaitersByRun)(await this.store.listSignalWaiters(""));
1295
+ const waiterByRun = (0, import_nestjs_durable_core9.indexWaitersByRun)(await this.store.listSignalWaiters(""));
1279
1296
  return runs.map((run) => {
1280
- const waiting = (0, import_nestjs_durable_core8.resolveRunWaiting)(run, waiterByRun);
1297
+ const waiting = (0, import_nestjs_durable_core9.resolveRunWaiting)(run, waiterByRun);
1281
1298
  return waiting ? {
1282
1299
  ...run,
1283
1300
  waiting
@@ -1305,11 +1322,11 @@ var StoreRunGateway = class {
1305
1322
  }),
1306
1323
  this.store.listSignalWaiters("")
1307
1324
  ]);
1308
- const waiterByRun = (0, import_nestjs_durable_core8.indexWaitersByRun)(waiters);
1325
+ const waiterByRun = (0, import_nestjs_durable_core9.indexWaitersByRun)(waiters);
1309
1326
  const result = {};
1310
1327
  for (const run of suspended) {
1311
1328
  if (!idSet.has(run.id)) continue;
1312
- const waiting = (0, import_nestjs_durable_core8.resolveRunWaiting)(run, waiterByRun);
1329
+ const waiting = (0, import_nestjs_durable_core9.resolveRunWaiting)(run, waiterByRun);
1313
1330
  if (waiting) result[run.id] = waiting;
1314
1331
  }
1315
1332
  return result;
@@ -1343,11 +1360,11 @@ var StoreRunGateway = class {
1343
1360
  };
1344
1361
  StoreRunGateway = _ts_decorate8([
1345
1362
  (0, import_common8.Injectable)(),
1346
- _ts_param5(0, (0, import_common8.Inject)(import_nestjs_durable_core8.STATE_STORE_CANONICAL)),
1363
+ _ts_param5(0, (0, import_common8.Inject)(import_nestjs_durable_core9.STATE_STORE_CANONICAL)),
1347
1364
  _ts_metadata8("design:type", Function),
1348
1365
  _ts_metadata8("design:paramtypes", [
1349
1366
  typeof StateStore === "undefined" ? Object : StateStore,
1350
- typeof import_nestjs_durable_core8.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core8.WorkflowEngine
1367
+ typeof import_nestjs_durable_core9.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core9.WorkflowEngine
1351
1368
  ])
1352
1369
  ], StoreRunGateway);
1353
1370
 
@@ -1393,7 +1410,7 @@ var TenantEventRepublisher = class {
1393
1410
  };
1394
1411
 
1395
1412
  // src/timer-poller.ts
1396
- var import_nestjs_durable_core9 = require("@dudousxd/nestjs-durable-core");
1413
+ var import_nestjs_durable_core10 = require("@dudousxd/nestjs-durable-core");
1397
1414
  var import_common9 = require("@nestjs/common");
1398
1415
  function _ts_decorate9(decorators, target, key, desc) {
1399
1416
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1449,7 +1466,7 @@ var TimerPoller = class {
1449
1466
  await this.engine.sweepTimeouts();
1450
1467
  const schedules = this.options.schedules;
1451
1468
  if (schedules && schedules.length > 0) {
1452
- await (0, import_nestjs_durable_core9.runSchedules)(this.engine, schedules, Date.now());
1469
+ await (0, import_nestjs_durable_core10.runSchedules)(this.engine, schedules, Date.now());
1453
1470
  }
1454
1471
  } finally {
1455
1472
  this.polling = false;
@@ -1458,10 +1475,10 @@ var TimerPoller = class {
1458
1475
  };
1459
1476
  TimerPoller = _ts_decorate9([
1460
1477
  (0, import_common9.Injectable)(),
1461
- _ts_param6(1, (0, import_common9.Inject)(import_nestjs_durable_core9.DURABLE_OPTIONS_CANONICAL)),
1478
+ _ts_param6(1, (0, import_common9.Inject)(import_nestjs_durable_core10.DURABLE_OPTIONS_CANONICAL)),
1462
1479
  _ts_metadata9("design:type", Function),
1463
1480
  _ts_metadata9("design:paramtypes", [
1464
- typeof import_nestjs_durable_core9.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core9.WorkflowEngine,
1481
+ typeof import_nestjs_durable_core10.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core10.WorkflowEngine,
1465
1482
  typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
1466
1483
  ])
1467
1484
  ], TimerPoller);
@@ -1471,7 +1488,7 @@ var CONTEXT_ACCESSOR = Symbol.for("@dudousxd/nestjs-context:accessor");
1471
1488
  var RUN_GATEWAY = Symbol.for("nestjs-durable:run-gateway");
1472
1489
 
1473
1490
  // src/workflow.registrar.ts
1474
- var import_nestjs_durable_core10 = require("@dudousxd/nestjs-durable-core");
1491
+ var import_nestjs_durable_core11 = require("@dudousxd/nestjs-durable-core");
1475
1492
  var import_common10 = require("@nestjs/common");
1476
1493
  var import_core4 = require("@nestjs/core");
1477
1494
 
@@ -1593,11 +1610,11 @@ var WorkflowRegistrar = class {
1593
1610
  const validateInput = meta.validateInput ?? (meta.inputSchema ? classValidatorInput(meta.inputSchema) : void 0);
1594
1611
  const eventBatch = meta.debounce ? {
1595
1612
  mode: "debounce",
1596
- windowMs: (0, import_nestjs_durable_core10.parseDuration)(meta.debounce)
1613
+ windowMs: (0, import_nestjs_durable_core11.parseDuration)(meta.debounce)
1597
1614
  } : meta.batch ? {
1598
1615
  mode: "batch",
1599
1616
  maxSize: meta.batch.maxSize,
1600
- windowMs: (0, import_nestjs_durable_core10.parseDuration)(meta.batch.within)
1617
+ windowMs: (0, import_nestjs_durable_core11.parseDuration)(meta.batch.within)
1601
1618
  } : void 0;
1602
1619
  const workflowCtor = workflow.constructor;
1603
1620
  this.engine.register(meta.name, meta.version, (ctx, input) => workflow.run(ctx, input), {
@@ -1618,11 +1635,11 @@ var WorkflowRegistrar = class {
1618
1635
  // so a turn dispatched under the wrong token would never be consumed. Absent → the inline fast
1619
1636
  // path (unchanged).
1620
1637
  ...this.inAppWorker ? {
1621
- group: (0, import_nestjs_durable_core10.tenantGroup)((0, import_nestjs_durable_core10.sanitizeQueueToken)(meta.name), this.inAppWorker.partition),
1622
- executor: new import_nestjs_durable_core10.RemoteWorkflowExecutor(this.inAppWorker.transport, meta.name, this.inAppWorker.partition)
1638
+ group: (0, import_nestjs_durable_core11.tenantGroup)((0, import_nestjs_durable_core11.sanitizeQueueToken)(meta.name), this.inAppWorker.partition),
1639
+ executor: new import_nestjs_durable_core11.RemoteWorkflowExecutor(this.inAppWorker.transport, meta.name, this.inAppWorker.partition)
1623
1640
  } : {}
1624
1641
  });
1625
- (0, import_nestjs_durable_core10.bindWorkflowClass)(workflowCtor, {
1642
+ (0, import_nestjs_durable_core11.bindWorkflowClass)(workflowCtor, {
1626
1643
  start: /* @__PURE__ */ __name((name, input, runId, opts) => this.engine.start(name, input, runId, opts), "start"),
1627
1644
  waitForRun: /* @__PURE__ */ __name((runId, opts) => this.engine.waitForRun(runId, opts), "waitForRun")
1628
1645
  });
@@ -1635,7 +1652,7 @@ var WorkflowRegistrar = class {
1635
1652
  this.engine.register(dlqName, meta.version, inline);
1636
1653
  deadLetterByWorkflow.set(meta.name, dlqName);
1637
1654
  } else if (meta.deadLetterWorkflow) {
1638
- deadLetterByWorkflow.set(meta.name, (0, import_nestjs_durable_core10.workflowName)(meta.deadLetterWorkflow));
1655
+ deadLetterByWorkflow.set(meta.name, (0, import_nestjs_durable_core11.workflowName)(meta.deadLetterWorkflow));
1639
1656
  }
1640
1657
  });
1641
1658
  this.installDeadLetterRouting(deadLetterByWorkflow);
@@ -1657,7 +1674,7 @@ var WorkflowRegistrar = class {
1657
1674
  * a `dlq:<runId>` id, so re-recovery never double-dispatches.
1658
1675
  */
1659
1676
  installDeadLetterRouting(byWorkflow) {
1660
- const fallback = this.options.deadLetterWorkflow ? (0, import_nestjs_durable_core10.workflowName)(this.options.deadLetterWorkflow) : void 0;
1677
+ const fallback = this.options.deadLetterWorkflow ? (0, import_nestjs_durable_core11.workflowName)(this.options.deadLetterWorkflow) : void 0;
1661
1678
  if (byWorkflow.size === 0 && !fallback) return;
1662
1679
  this.engine.onDead((run) => {
1663
1680
  const target = byWorkflow.get(run.workflow) ?? fallback;
@@ -1682,14 +1699,14 @@ var WorkflowRegistrar = class {
1682
1699
  };
1683
1700
  WorkflowRegistrar = _ts_decorate10([
1684
1701
  (0, import_common10.Injectable)(),
1685
- _ts_param7(3, (0, import_common10.Inject)(import_nestjs_durable_core10.STATE_STORE_CANONICAL)),
1686
- _ts_param7(4, (0, import_common10.Inject)(import_nestjs_durable_core10.DURABLE_OPTIONS_CANONICAL)),
1702
+ _ts_param7(3, (0, import_common10.Inject)(import_nestjs_durable_core11.STATE_STORE_CANONICAL)),
1703
+ _ts_param7(4, (0, import_common10.Inject)(import_nestjs_durable_core11.DURABLE_OPTIONS_CANONICAL)),
1687
1704
  _ts_param7(5, (0, import_common10.Inject)(IN_APP_WORKER_BINDING)),
1688
1705
  _ts_metadata10("design:type", Function),
1689
1706
  _ts_metadata10("design:paramtypes", [
1690
1707
  typeof import_core4.DiscoveryService === "undefined" ? Object : import_core4.DiscoveryService,
1691
1708
  typeof import_core4.MetadataScanner === "undefined" ? Object : import_core4.MetadataScanner,
1692
- typeof import_nestjs_durable_core10.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core10.WorkflowEngine,
1709
+ typeof import_nestjs_durable_core11.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core11.WorkflowEngine,
1693
1710
  Object,
1694
1711
  typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
1695
1712
  Object
@@ -1698,7 +1715,7 @@ WorkflowRegistrar = _ts_decorate10([
1698
1715
 
1699
1716
  // src/workflow.service.ts
1700
1717
  var import_node_crypto = require("crypto");
1701
- var import_nestjs_durable_core11 = require("@dudousxd/nestjs-durable-core");
1718
+ var import_nestjs_durable_core12 = require("@dudousxd/nestjs-durable-core");
1702
1719
  var import_common11 = require("@nestjs/common");
1703
1720
  function _ts_decorate11(decorators, target, key, desc) {
1704
1721
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1754,7 +1771,7 @@ WorkflowService = _ts_decorate11([
1754
1771
  (0, import_common11.Injectable)(),
1755
1772
  _ts_metadata11("design:type", Function),
1756
1773
  _ts_metadata11("design:paramtypes", [
1757
- typeof import_nestjs_durable_core11.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core11.WorkflowEngine
1774
+ typeof import_nestjs_durable_core12.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core12.WorkflowEngine
1758
1775
  ])
1759
1776
  ], WorkflowService);
1760
1777
 
@@ -1929,13 +1946,13 @@ var RunGatewayBootstrap = class RunGatewayBootstrap2 {
1929
1946
  };
1930
1947
  RunGatewayBootstrap = _ts_decorate12([
1931
1948
  (0, import_common12.Injectable)(),
1932
- _ts_param8(1, (0, import_common12.Inject)(import_nestjs_durable_core12.TRANSPORT_CANONICAL)),
1949
+ _ts_param8(1, (0, import_common12.Inject)(import_nestjs_durable_core13.TRANSPORT_CANONICAL)),
1933
1950
  _ts_param8(2, (0, import_common12.Inject)(RUN_GATEWAY)),
1934
- _ts_param8(3, (0, import_common12.Inject)(import_nestjs_durable_core12.STATE_STORE_CANONICAL)),
1935
- _ts_param8(4, (0, import_common12.Inject)(import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL)),
1951
+ _ts_param8(3, (0, import_common12.Inject)(import_nestjs_durable_core13.STATE_STORE_CANONICAL)),
1952
+ _ts_param8(4, (0, import_common12.Inject)(import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL)),
1936
1953
  _ts_metadata12("design:type", Function),
1937
1954
  _ts_metadata12("design:paramtypes", [
1938
- typeof import_nestjs_durable_core12.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core12.WorkflowEngine,
1955
+ typeof import_nestjs_durable_core13.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core13.WorkflowEngine,
1939
1956
  Object,
1940
1957
  typeof RunGateway === "undefined" ? Object : RunGateway,
1941
1958
  Object,
@@ -1949,13 +1966,13 @@ var DurableModule = class _DurableModule {
1949
1966
  static forRoot(options) {
1950
1967
  _DurableModule.assertValid(options);
1951
1968
  return _DurableModule.build({
1952
- provide: import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL,
1969
+ provide: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
1953
1970
  useValue: resolveTopology(options)
1954
1971
  });
1955
1972
  }
1956
1973
  static forRootAsync(options) {
1957
1974
  return _DurableModule.build({
1958
- provide: import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL,
1975
+ provide: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
1959
1976
  useFactory: /* @__PURE__ */ __name(async (...args) => {
1960
1977
  const resolved = await options.useFactory(...args);
1961
1978
  _DurableModule.assertValid(resolved);
@@ -1988,37 +2005,37 @@ var DurableModule = class _DurableModule {
1988
2005
  providers: [
1989
2006
  optionsProvider,
1990
2007
  {
1991
- provide: import_nestjs_durable_core12.STATE_STORE_CANONICAL,
2008
+ provide: import_nestjs_durable_core13.STATE_STORE_CANONICAL,
1992
2009
  useFactory: /* @__PURE__ */ __name((options) => options.store !== void 0 ? scopedStore(options.store, options) : null, "useFactory"),
1993
2010
  inject: [
1994
- import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL
2011
+ import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
1995
2012
  ]
1996
2013
  },
1997
2014
  {
1998
- provide: import_nestjs_durable_core12.TRANSPORT_CANONICAL,
2015
+ provide: import_nestjs_durable_core13.TRANSPORT_CANONICAL,
1999
2016
  useFactory: /* @__PURE__ */ __name((options) => options.transport ?? null, "useFactory"),
2000
2017
  inject: [
2001
- import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL
2018
+ import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
2002
2019
  ]
2003
2020
  },
2004
2021
  // Legacy back-compat aliases (deprecated tokens still resolve to the same instances):
2005
2022
  {
2006
- provide: import_nestjs_durable_core12.STATE_STORE,
2007
- useExisting: import_nestjs_durable_core12.STATE_STORE_CANONICAL
2023
+ provide: import_nestjs_durable_core13.STATE_STORE,
2024
+ useExisting: import_nestjs_durable_core13.STATE_STORE_CANONICAL
2008
2025
  },
2009
2026
  {
2010
- provide: import_nestjs_durable_core12.TRANSPORT,
2011
- useExisting: import_nestjs_durable_core12.TRANSPORT_CANONICAL
2027
+ provide: import_nestjs_durable_core13.TRANSPORT,
2028
+ useExisting: import_nestjs_durable_core13.TRANSPORT_CANONICAL
2012
2029
  },
2013
2030
  {
2014
- provide: import_nestjs_durable_core12.DURABLE_OPTIONS,
2015
- useExisting: import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL
2031
+ provide: import_nestjs_durable_core13.DURABLE_OPTIONS,
2032
+ useExisting: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
2016
2033
  },
2017
2034
  {
2018
2035
  // Shared token, bound EXACTLY once: a real engine for the operator role, or a store-less
2019
2036
  // `DurableStartClient` facade for a thin worker (no `store`) — either way, `WorkflowService`
2020
2037
  // and app code call `engine.start(...)` unchanged.
2021
- provide: import_nestjs_durable_core12.WorkflowEngine,
2038
+ provide: import_nestjs_durable_core13.WorkflowEngine,
2022
2039
  useFactory: /* @__PURE__ */ __name(async (options, store, transport, moduleRef) => {
2023
2040
  if (options.store === void 0) {
2024
2041
  return new DurableStartClient(options);
@@ -2031,7 +2048,7 @@ var DurableModule = class _DurableModule {
2031
2048
  const context = options.context ?? (accessor ? () => carrierFromAccessor(accessor) : void 0);
2032
2049
  const runtime = accessor ? await resolveContextRuntime() : void 0;
2033
2050
  const rehydrate = runtime && ((carrier, fn) => carrier && Object.keys(carrier).length > 0 ? runtime.deserialize(carrier, fn) : fn());
2034
- const engine = new import_nestjs_durable_core12.WorkflowEngine({
2051
+ const engine = new import_nestjs_durable_core13.WorkflowEngine({
2035
2052
  store,
2036
2053
  transport: transport ?? void 0,
2037
2054
  transports: options.transports,
@@ -2062,9 +2079,9 @@ var DurableModule = class _DurableModule {
2062
2079
  return engine;
2063
2080
  }, "useFactory"),
2064
2081
  inject: [
2065
- import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL,
2066
- import_nestjs_durable_core12.STATE_STORE_CANONICAL,
2067
- import_nestjs_durable_core12.TRANSPORT_CANONICAL,
2082
+ import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
2083
+ import_nestjs_durable_core13.STATE_STORE_CANONICAL,
2084
+ import_nestjs_durable_core13.TRANSPORT_CANONICAL,
2068
2085
  import_core5.ModuleRef
2069
2086
  ]
2070
2087
  },
@@ -2089,9 +2106,9 @@ var DurableModule = class _DurableModule {
2089
2106
  return options.transport ? new ProxyRunGateway(options.transport, options.partition ?? "default", options.runGatewayTimeoutMs) : unavailableRunGateway();
2090
2107
  }, "useFactory"),
2091
2108
  inject: [
2092
- import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL,
2093
- import_nestjs_durable_core12.STATE_STORE_CANONICAL,
2094
- import_nestjs_durable_core12.WorkflowEngine
2109
+ import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
2110
+ import_nestjs_durable_core13.STATE_STORE_CANONICAL,
2111
+ import_nestjs_durable_core13.WorkflowEngine
2095
2112
  ]
2096
2113
  },
2097
2114
  RunGatewayBootstrap,
@@ -2105,12 +2122,12 @@ var DurableModule = class _DurableModule {
2105
2122
  exports: [
2106
2123
  WorkflowService,
2107
2124
  EntityService,
2108
- import_nestjs_durable_core12.WorkflowEngine,
2109
- import_nestjs_durable_core12.STATE_STORE,
2110
- import_nestjs_durable_core12.STATE_STORE_CANONICAL,
2111
- import_nestjs_durable_core12.TRANSPORT,
2112
- import_nestjs_durable_core12.TRANSPORT_CANONICAL,
2113
- import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL,
2125
+ import_nestjs_durable_core13.WorkflowEngine,
2126
+ import_nestjs_durable_core13.STATE_STORE,
2127
+ import_nestjs_durable_core13.STATE_STORE_CANONICAL,
2128
+ import_nestjs_durable_core13.TRANSPORT,
2129
+ import_nestjs_durable_core13.TRANSPORT_CANONICAL,
2130
+ import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
2114
2131
  RUN_GATEWAY
2115
2132
  ]
2116
2133
  };
@@ -2121,7 +2138,7 @@ DurableModule = _ts_decorate12([
2121
2138
  ], DurableModule);
2122
2139
 
2123
2140
  // src/index.ts
2124
- var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
2141
+ var import_nestjs_durable_core14 = require("@dudousxd/nestjs-durable-core");
2125
2142
  // Annotate the CommonJS export names for ESM import in node:
2126
2143
  0 && (module.exports = {
2127
2144
  CONTEXT_ACCESSOR,
@@ -2161,6 +2178,7 @@ var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
2161
2178
  Workflow,
2162
2179
  WorkflowEngine,
2163
2180
  WorkflowService,
2181
+ attributesOf,
2164
2182
  entityConfigFor,
2165
2183
  getDurableStepMeta,
2166
2184
  getEntityMeta,