@dudousxd/nestjs-durable 0.34.2 → 0.35.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
@@ -1896,10 +1896,10 @@ function resolveTopology(options) {
1896
1896
  if (topology === void 0) return options;
1897
1897
  if (topology.role === "control-plane") {
1898
1898
  if (topology.tenant === void 0 || options.namespace !== void 0) return options;
1899
- return {
1899
+ return resolveTenantWorkersBridge({
1900
1900
  ...options,
1901
1901
  namespace: topology.tenant
1902
- };
1902
+ });
1903
1903
  }
1904
1904
  if (options.partition !== void 0) return options;
1905
1905
  return {
@@ -1908,6 +1908,30 @@ function resolveTopology(options) {
1908
1908
  };
1909
1909
  }
1910
1910
  __name(resolveTopology, "resolveTopology");
1911
+ function resolveTenantWorkersBridge(options) {
1912
+ const topology = options.topology;
1913
+ if (topology?.role !== "control-plane" || topology.tenantWorkers !== "bridge") return options;
1914
+ if (options.transports !== void 0) return options;
1915
+ const primary = options.transport;
1916
+ if (primary === void 0) return options;
1917
+ if (primary.withNamespace === void 0) {
1918
+ throw new Error("topology: { tenantWorkers: 'bridge' } needs a transport implementing `withNamespace` (e.g. BullMQTransport) \u2014 the bridge derives a bare-prefix sibling from the configured transport to reach operator-convention tenant workers.");
1919
+ }
1920
+ return {
1921
+ ...options,
1922
+ transports: [
1923
+ {
1924
+ id: "default",
1925
+ transport: primary
1926
+ },
1927
+ {
1928
+ id: "tenant-workers",
1929
+ transport: primary.withNamespace("default")
1930
+ }
1931
+ ]
1932
+ };
1933
+ }
1934
+ __name(resolveTenantWorkersBridge, "resolveTenantWorkersBridge");
1911
1935
  var RunGatewayBootstrap = class RunGatewayBootstrap2 {
1912
1936
  static {
1913
1937
  __name(this, "RunGatewayBootstrap");
@@ -2017,7 +2041,11 @@ var DurableModule = class _DurableModule {
2017
2041
  },
2018
2042
  {
2019
2043
  provide: import_nestjs_durable_core13.TRANSPORT_CANONICAL,
2020
- useFactory: /* @__PURE__ */ __name((options) => options.transport ?? null, "useFactory"),
2044
+ // With a POOL (`transports`) and no singular `transport`, the canonical transport is the
2045
+ // pool's PRIMARY — the same one the engine dispatches on first. Leaving it null starved
2046
+ // the step registrar / in-app worker of a transport, so a pool-configured operator
2047
+ // registered NO step handlers and its own steps parked in `wait` with no consumer.
2048
+ useFactory: /* @__PURE__ */ __name((options) => options.transport ?? options.transports?.[0]?.transport ?? null, "useFactory"),
2021
2049
  inject: [
2022
2050
  import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
2023
2051
  ]