@dudousxd/nestjs-durable 0.38.0 → 0.39.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
@@ -611,7 +611,7 @@ var DurableStepRegistrar = class {
611
611
  if (!isDrivingOperator(this.options)) return;
612
612
  if (!supportsHandle(this.transport)) return;
613
613
  const transport = this.transport;
614
- scanSteps(this.discovery, this.metadataScanner, (meta, handler) => transport.handle(meta.name, handler));
614
+ scanSteps(this.discovery, this.metadataScanner, (meta, handler) => transport.handle(meta.name, handler, this.options.partition));
615
615
  }
616
616
  };
617
617
  DurableStepRegistrar = _ts_decorate3([
@@ -1896,13 +1896,32 @@ tenant maps 1:1 onto partition (the worker queue-routing suffix) \u2014 set only
1896
1896
  }
1897
1897
  __name(assertValidTopology, "assertValidTopology");
1898
1898
  function resolveTopology(options) {
1899
+ return servingPartition(resolveTopologyPreset(options));
1900
+ }
1901
+ __name(resolveTopology, "resolveTopology");
1902
+ function servingPartition(options) {
1903
+ if (options.partition !== void 0 || options.namespace === void 0) return options;
1904
+ return {
1905
+ ...options,
1906
+ partition: options.namespace
1907
+ };
1908
+ }
1909
+ __name(servingPartition, "servingPartition");
1910
+ function resolveTopologyPreset(options) {
1899
1911
  const topology = options.topology;
1900
1912
  if (topology === void 0) return options;
1901
1913
  if (topology.role === "control-plane") {
1902
- if (topology.tenant === void 0 || options.namespace !== void 0) return options;
1914
+ if (topology.tenant === void 0) return options;
1903
1915
  return {
1904
1916
  ...options,
1905
- namespace: topology.tenant
1917
+ // An explicit `namespace` is already validated equal to `tenant` (assertValidTopology), so
1918
+ // keeping it is a no-op rather than a conflict.
1919
+ namespace: options.namespace ?? topology.tenant,
1920
+ // The tenant is ALSO this node's worker-routing suffix: its engine now dispatches a run's steps
1921
+ // to `<name>@<tenant>` (core's `stepGroup`), so its own co-located worker must SUBSCRIBE those
1922
+ // same tokens. Without this the node would dispatch into queues it is not itself listening on.
1923
+ // `partition` is user-forbidden on this role (assertValidTopology), so we own it here.
1924
+ partition: topology.tenant
1906
1925
  };
1907
1926
  }
1908
1927
  if (options.partition !== void 0) return options;
@@ -1911,7 +1930,7 @@ function resolveTopology(options) {
1911
1930
  partition: topology.tenant
1912
1931
  };
1913
1932
  }
1914
- __name(resolveTopology, "resolveTopology");
1933
+ __name(resolveTopologyPreset, "resolveTopologyPreset");
1915
1934
  var RunGatewayBootstrap = class RunGatewayBootstrap2 {
1916
1935
  static {
1917
1936
  __name(this, "RunGatewayBootstrap");