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