@dudousxd/nestjs-durable 0.37.0 → 0.38.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,7 +56,7 @@ __export(index_exports, {
56
56
  ThinWorkflowRegistrar: () => ThinWorkflowRegistrar,
57
57
  WORKFLOW_METADATA: () => WORKFLOW_METADATA,
58
58
  Workflow: () => Workflow,
59
- WorkflowEngine: () => import_nestjs_durable_core14.WorkflowEngine,
59
+ WorkflowEngine: () => import_nestjs_durable_core15.WorkflowEngine,
60
60
  WorkflowService: () => WorkflowService,
61
61
  attributesOf: () => attributesOf,
62
62
  entityConfigFor: () => entityConfigFor,
@@ -69,7 +69,7 @@ __export(index_exports, {
69
69
  isDrivingOperator: () => isDrivingOperator,
70
70
  isOperatorRole: () => isOperatorRole,
71
71
  isStepInterceptor: () => isStepInterceptor,
72
- readSearchAttributes: () => import_nestjs_durable_core14.readSearchAttributes,
72
+ readSearchAttributes: () => import_nestjs_durable_core15.readSearchAttributes,
73
73
  thinWorkerProviders: () => thinWorkerProviders,
74
74
  unavailableRunGateway: () => unavailableRunGateway
75
75
  });
@@ -552,7 +552,7 @@ function unavailableRunGateway() {
552
552
  __name(unavailableRunGateway, "unavailableRunGateway");
553
553
 
554
554
  // src/durable.module.ts
555
- var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
555
+ var import_nestjs_durable_core14 = require("@dudousxd/nestjs-durable-core");
556
556
  var import_common12 = require("@nestjs/common");
557
557
  var import_core5 = require("@nestjs/core");
558
558
 
@@ -1486,11 +1486,12 @@ TimerPoller = _ts_decorate9([
1486
1486
  ], TimerPoller);
1487
1487
 
1488
1488
  // src/tokens.ts
1489
+ var import_nestjs_durable_core11 = require("@dudousxd/nestjs-durable-core");
1489
1490
  var CONTEXT_ACCESSOR = Symbol.for("@dudousxd/nestjs-context:accessor");
1490
- var RUN_GATEWAY = Symbol.for("nestjs-durable:run-gateway");
1491
+ var RUN_GATEWAY = import_nestjs_durable_core11.RunGateway;
1491
1492
 
1492
1493
  // src/workflow.registrar.ts
1493
- var import_nestjs_durable_core11 = require("@dudousxd/nestjs-durable-core");
1494
+ var import_nestjs_durable_core12 = require("@dudousxd/nestjs-durable-core");
1494
1495
  var import_common10 = require("@nestjs/common");
1495
1496
  var import_core4 = require("@nestjs/core");
1496
1497
 
@@ -1612,11 +1613,11 @@ var WorkflowRegistrar = class {
1612
1613
  const validateInput = meta.validateInput ?? (meta.inputSchema ? classValidatorInput(meta.inputSchema) : void 0);
1613
1614
  const eventBatch = meta.debounce ? {
1614
1615
  mode: "debounce",
1615
- windowMs: (0, import_nestjs_durable_core11.parseDuration)(meta.debounce)
1616
+ windowMs: (0, import_nestjs_durable_core12.parseDuration)(meta.debounce)
1616
1617
  } : meta.batch ? {
1617
1618
  mode: "batch",
1618
1619
  maxSize: meta.batch.maxSize,
1619
- windowMs: (0, import_nestjs_durable_core11.parseDuration)(meta.batch.within)
1620
+ windowMs: (0, import_nestjs_durable_core12.parseDuration)(meta.batch.within)
1620
1621
  } : void 0;
1621
1622
  const workflowCtor = workflow.constructor;
1622
1623
  this.engine.register(meta.name, meta.version, (ctx, input) => workflow.run(ctx, input), {
@@ -1638,11 +1639,11 @@ var WorkflowRegistrar = class {
1638
1639
  // so a turn dispatched under the wrong token would never be consumed. Absent → the inline fast
1639
1640
  // path (unchanged).
1640
1641
  ...this.inAppWorker ? {
1641
- group: (0, import_nestjs_durable_core11.tenantGroup)((0, import_nestjs_durable_core11.sanitizeQueueToken)(meta.name), this.inAppWorker.partition),
1642
- executor: new import_nestjs_durable_core11.RemoteWorkflowExecutor(this.inAppWorker.transport, meta.name, this.inAppWorker.partition)
1642
+ group: (0, import_nestjs_durable_core12.tenantGroup)((0, import_nestjs_durable_core12.sanitizeQueueToken)(meta.name), this.inAppWorker.partition),
1643
+ executor: new import_nestjs_durable_core12.RemoteWorkflowExecutor(this.inAppWorker.transport, meta.name, this.inAppWorker.partition)
1643
1644
  } : {}
1644
1645
  });
1645
- (0, import_nestjs_durable_core11.bindWorkflowClass)(workflowCtor, {
1646
+ (0, import_nestjs_durable_core12.bindWorkflowClass)(workflowCtor, {
1646
1647
  start: /* @__PURE__ */ __name((name, input, runId, opts) => this.engine.start(name, input, runId, opts), "start"),
1647
1648
  waitForRun: /* @__PURE__ */ __name((runId, opts) => this.engine.waitForRun(runId, opts), "waitForRun")
1648
1649
  });
@@ -1655,7 +1656,7 @@ var WorkflowRegistrar = class {
1655
1656
  this.engine.register(dlqName, meta.version, inline);
1656
1657
  deadLetterByWorkflow.set(meta.name, dlqName);
1657
1658
  } else if (meta.deadLetterWorkflow) {
1658
- deadLetterByWorkflow.set(meta.name, (0, import_nestjs_durable_core11.workflowName)(meta.deadLetterWorkflow));
1659
+ deadLetterByWorkflow.set(meta.name, (0, import_nestjs_durable_core12.workflowName)(meta.deadLetterWorkflow));
1659
1660
  }
1660
1661
  });
1661
1662
  this.installDeadLetterRouting(deadLetterByWorkflow);
@@ -1677,7 +1678,7 @@ var WorkflowRegistrar = class {
1677
1678
  * a `dlq:<runId>` id, so re-recovery never double-dispatches.
1678
1679
  */
1679
1680
  installDeadLetterRouting(byWorkflow) {
1680
- const fallback = this.options.deadLetterWorkflow ? (0, import_nestjs_durable_core11.workflowName)(this.options.deadLetterWorkflow) : void 0;
1681
+ const fallback = this.options.deadLetterWorkflow ? (0, import_nestjs_durable_core12.workflowName)(this.options.deadLetterWorkflow) : void 0;
1681
1682
  if (byWorkflow.size === 0 && !fallback) return;
1682
1683
  this.engine.onDead((run) => {
1683
1684
  const target = byWorkflow.get(run.workflow) ?? fallback;
@@ -1702,14 +1703,14 @@ var WorkflowRegistrar = class {
1702
1703
  };
1703
1704
  WorkflowRegistrar = _ts_decorate10([
1704
1705
  (0, import_common10.Injectable)(),
1705
- _ts_param7(3, (0, import_common10.Inject)(import_nestjs_durable_core11.STATE_STORE_CANONICAL)),
1706
- _ts_param7(4, (0, import_common10.Inject)(import_nestjs_durable_core11.DURABLE_OPTIONS_CANONICAL)),
1706
+ _ts_param7(3, (0, import_common10.Inject)(import_nestjs_durable_core12.STATE_STORE_CANONICAL)),
1707
+ _ts_param7(4, (0, import_common10.Inject)(import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL)),
1707
1708
  _ts_param7(5, (0, import_common10.Inject)(IN_APP_WORKER_BINDING)),
1708
1709
  _ts_metadata10("design:type", Function),
1709
1710
  _ts_metadata10("design:paramtypes", [
1710
1711
  typeof import_core4.DiscoveryService === "undefined" ? Object : import_core4.DiscoveryService,
1711
1712
  typeof import_core4.MetadataScanner === "undefined" ? Object : import_core4.MetadataScanner,
1712
- typeof import_nestjs_durable_core11.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core11.WorkflowEngine,
1713
+ typeof import_nestjs_durable_core12.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core12.WorkflowEngine,
1713
1714
  Object,
1714
1715
  typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
1715
1716
  Object
@@ -1718,7 +1719,7 @@ WorkflowRegistrar = _ts_decorate10([
1718
1719
 
1719
1720
  // src/workflow.service.ts
1720
1721
  var import_node_crypto = require("crypto");
1721
- var import_nestjs_durable_core12 = require("@dudousxd/nestjs-durable-core");
1722
+ var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
1722
1723
  var import_common11 = require("@nestjs/common");
1723
1724
  function _ts_decorate11(decorators, target, key, desc) {
1724
1725
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1778,7 +1779,7 @@ WorkflowService = _ts_decorate11([
1778
1779
  (0, import_common11.Injectable)(),
1779
1780
  _ts_metadata11("design:type", Function),
1780
1781
  _ts_metadata11("design:paramtypes", [
1781
- typeof import_nestjs_durable_core12.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core12.WorkflowEngine
1782
+ typeof import_nestjs_durable_core13.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core13.WorkflowEngine
1782
1783
  ])
1783
1784
  ], WorkflowService);
1784
1785
 
@@ -1953,15 +1954,14 @@ var RunGatewayBootstrap = class RunGatewayBootstrap2 {
1953
1954
  };
1954
1955
  RunGatewayBootstrap = _ts_decorate12([
1955
1956
  (0, import_common12.Injectable)(),
1956
- _ts_param8(1, (0, import_common12.Inject)(import_nestjs_durable_core13.TRANSPORT_CANONICAL)),
1957
- _ts_param8(2, (0, import_common12.Inject)(RUN_GATEWAY)),
1958
- _ts_param8(3, (0, import_common12.Inject)(import_nestjs_durable_core13.STATE_STORE_CANONICAL)),
1959
- _ts_param8(4, (0, import_common12.Inject)(import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL)),
1957
+ _ts_param8(1, (0, import_common12.Inject)(import_nestjs_durable_core14.TRANSPORT_CANONICAL)),
1958
+ _ts_param8(3, (0, import_common12.Inject)(import_nestjs_durable_core14.STATE_STORE_CANONICAL)),
1959
+ _ts_param8(4, (0, import_common12.Inject)(import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL)),
1960
1960
  _ts_metadata12("design:type", Function),
1961
1961
  _ts_metadata12("design:paramtypes", [
1962
- typeof import_nestjs_durable_core13.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core13.WorkflowEngine,
1962
+ typeof import_nestjs_durable_core14.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core14.WorkflowEngine,
1963
1963
  Object,
1964
- typeof RunGateway === "undefined" ? Object : RunGateway,
1964
+ typeof import_nestjs_durable_core14.RunGateway === "undefined" ? Object : import_nestjs_durable_core14.RunGateway,
1965
1965
  Object,
1966
1966
  typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
1967
1967
  ])
@@ -1973,13 +1973,13 @@ var DurableModule = class _DurableModule {
1973
1973
  static forRoot(options) {
1974
1974
  _DurableModule.assertValid(options);
1975
1975
  return _DurableModule.build({
1976
- provide: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
1976
+ provide: import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL,
1977
1977
  useValue: resolveTopology(options)
1978
1978
  });
1979
1979
  }
1980
1980
  static forRootAsync(options) {
1981
1981
  return _DurableModule.build({
1982
- provide: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
1982
+ provide: import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL,
1983
1983
  useFactory: /* @__PURE__ */ __name(async (...args) => {
1984
1984
  const resolved = await options.useFactory(...args);
1985
1985
  _DurableModule.assertValid(resolved);
@@ -2012,41 +2012,41 @@ var DurableModule = class _DurableModule {
2012
2012
  providers: [
2013
2013
  optionsProvider,
2014
2014
  {
2015
- provide: import_nestjs_durable_core13.STATE_STORE_CANONICAL,
2015
+ provide: import_nestjs_durable_core14.STATE_STORE_CANONICAL,
2016
2016
  useFactory: /* @__PURE__ */ __name((options) => options.store !== void 0 ? scopedStore(options.store, options) : null, "useFactory"),
2017
2017
  inject: [
2018
- import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
2018
+ import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL
2019
2019
  ]
2020
2020
  },
2021
2021
  {
2022
- provide: import_nestjs_durable_core13.TRANSPORT_CANONICAL,
2022
+ provide: import_nestjs_durable_core14.TRANSPORT_CANONICAL,
2023
2023
  // With a POOL (`transports`) and no singular `transport`, the canonical transport is the
2024
2024
  // pool's PRIMARY — the same one the engine dispatches on first. Leaving it null starved
2025
2025
  // the step registrar / in-app worker of a transport, so a pool-configured operator
2026
2026
  // registered NO step handlers and its own steps parked in `wait` with no consumer.
2027
2027
  useFactory: /* @__PURE__ */ __name((options) => options.transport ?? options.transports?.[0]?.transport ?? null, "useFactory"),
2028
2028
  inject: [
2029
- import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
2029
+ import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL
2030
2030
  ]
2031
2031
  },
2032
2032
  // Legacy back-compat aliases (deprecated tokens still resolve to the same instances):
2033
2033
  {
2034
- provide: import_nestjs_durable_core13.STATE_STORE,
2035
- useExisting: import_nestjs_durable_core13.STATE_STORE_CANONICAL
2034
+ provide: import_nestjs_durable_core14.STATE_STORE,
2035
+ useExisting: import_nestjs_durable_core14.STATE_STORE_CANONICAL
2036
2036
  },
2037
2037
  {
2038
- provide: import_nestjs_durable_core13.TRANSPORT,
2039
- useExisting: import_nestjs_durable_core13.TRANSPORT_CANONICAL
2038
+ provide: import_nestjs_durable_core14.TRANSPORT,
2039
+ useExisting: import_nestjs_durable_core14.TRANSPORT_CANONICAL
2040
2040
  },
2041
2041
  {
2042
- provide: import_nestjs_durable_core13.DURABLE_OPTIONS,
2043
- useExisting: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
2042
+ provide: import_nestjs_durable_core14.DURABLE_OPTIONS,
2043
+ useExisting: import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL
2044
2044
  },
2045
2045
  {
2046
2046
  // Shared token, bound EXACTLY once: a real engine for the operator role, or a store-less
2047
2047
  // `DurableStartClient` facade for a thin worker (no `store`) — either way, `WorkflowService`
2048
2048
  // and app code call `engine.start(...)` unchanged.
2049
- provide: import_nestjs_durable_core13.WorkflowEngine,
2049
+ provide: import_nestjs_durable_core14.WorkflowEngine,
2050
2050
  useFactory: /* @__PURE__ */ __name(async (options, store, transport, moduleRef) => {
2051
2051
  if (options.store === void 0) {
2052
2052
  return new DurableStartClient(options);
@@ -2059,7 +2059,7 @@ var DurableModule = class _DurableModule {
2059
2059
  const context = options.context ?? (accessor ? () => carrierFromAccessor(accessor) : void 0);
2060
2060
  const runtime = accessor ? await resolveContextRuntime() : void 0;
2061
2061
  const rehydrate = runtime && ((carrier, fn) => carrier && Object.keys(carrier).length > 0 ? runtime.deserialize(carrier, fn) : fn());
2062
- const engine = new import_nestjs_durable_core13.WorkflowEngine({
2062
+ const engine = new import_nestjs_durable_core14.WorkflowEngine({
2063
2063
  store,
2064
2064
  transport: transport ?? void 0,
2065
2065
  transports: options.transports,
@@ -2090,9 +2090,9 @@ var DurableModule = class _DurableModule {
2090
2090
  return engine;
2091
2091
  }, "useFactory"),
2092
2092
  inject: [
2093
- import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
2094
- import_nestjs_durable_core13.STATE_STORE_CANONICAL,
2095
- import_nestjs_durable_core13.TRANSPORT_CANONICAL,
2093
+ import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL,
2094
+ import_nestjs_durable_core14.STATE_STORE_CANONICAL,
2095
+ import_nestjs_durable_core14.TRANSPORT_CANONICAL,
2096
2096
  import_core5.ModuleRef
2097
2097
  ]
2098
2098
  },
@@ -2106,7 +2106,7 @@ var DurableModule = class _DurableModule {
2106
2106
  // or (for a thin worker, no `store`) a `ProxyRunGateway` over `transport` when given, else a
2107
2107
  // gateway whose every method rejects with a clear tenant error.
2108
2108
  {
2109
- provide: RUN_GATEWAY,
2109
+ provide: import_nestjs_durable_core14.RunGateway,
2110
2110
  useFactory: /* @__PURE__ */ __name((options, store, engine) => {
2111
2111
  if (options.store !== void 0) {
2112
2112
  if (!store) {
@@ -2117,9 +2117,9 @@ var DurableModule = class _DurableModule {
2117
2117
  return options.transport ? new ProxyRunGateway(options.transport, options.partition ?? "default", options.runGatewayTimeoutMs) : unavailableRunGateway();
2118
2118
  }, "useFactory"),
2119
2119
  inject: [
2120
- import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
2121
- import_nestjs_durable_core13.STATE_STORE_CANONICAL,
2122
- import_nestjs_durable_core13.WorkflowEngine
2120
+ import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL,
2121
+ import_nestjs_durable_core14.STATE_STORE_CANONICAL,
2122
+ import_nestjs_durable_core14.WorkflowEngine
2123
2123
  ]
2124
2124
  },
2125
2125
  RunGatewayBootstrap,
@@ -2133,13 +2133,13 @@ var DurableModule = class _DurableModule {
2133
2133
  exports: [
2134
2134
  WorkflowService,
2135
2135
  EntityService,
2136
- import_nestjs_durable_core13.WorkflowEngine,
2137
- import_nestjs_durable_core13.STATE_STORE,
2138
- import_nestjs_durable_core13.STATE_STORE_CANONICAL,
2139
- import_nestjs_durable_core13.TRANSPORT,
2140
- import_nestjs_durable_core13.TRANSPORT_CANONICAL,
2141
- import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
2142
- RUN_GATEWAY
2136
+ import_nestjs_durable_core14.WorkflowEngine,
2137
+ import_nestjs_durable_core14.STATE_STORE,
2138
+ import_nestjs_durable_core14.STATE_STORE_CANONICAL,
2139
+ import_nestjs_durable_core14.TRANSPORT,
2140
+ import_nestjs_durable_core14.TRANSPORT_CANONICAL,
2141
+ import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL,
2142
+ import_nestjs_durable_core14.RunGateway
2143
2143
  ]
2144
2144
  };
2145
2145
  }
@@ -2149,7 +2149,7 @@ DurableModule = _ts_decorate12([
2149
2149
  ], DurableModule);
2150
2150
 
2151
2151
  // src/index.ts
2152
- var import_nestjs_durable_core14 = require("@dudousxd/nestjs-durable-core");
2152
+ var import_nestjs_durable_core15 = require("@dudousxd/nestjs-durable-core");
2153
2153
  // Annotate the CommonJS export names for ESM import in node:
2154
2154
  0 && (module.exports = {
2155
2155
  CONTEXT_ACCESSOR,