@dudousxd/nestjs-durable 0.31.0 → 0.32.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
@@ -1847,8 +1847,9 @@ function assertValidTopology(options) {
1847
1847
  if (options.partition !== void 0) {
1848
1848
  throw new Error("topology: { role: 'control-plane' } forbids `partition`.\npartition is the WORKER queue-routing suffix \u2014 on a control-plane node, runs are dispatched to tenant partitions via each run's namespace, not via this option. Set `partition` (or `topology: { role: 'tenant', tenant }`) on the WORKER node instead.");
1849
1849
  }
1850
- if ("tenant" in topology) {
1851
- throw new Error("topology: { role: 'control-plane' } forbids a `tenant` field.\ntenant names a WORKER's isolation partition \u2014 a control-plane node serves every tenant's runs (via their namespace), it isn't scoped to one itself.");
1850
+ if (topology.tenant !== void 0 && options.namespace !== void 0 && options.namespace !== topology.tenant) {
1851
+ throw new Error(`topology: { role: 'control-plane', tenant: '${topology.tenant}' } conflicts with \`namespace: '${options.namespace}'\`.
1852
+ tenant maps 1:1 onto namespace (the operator's poll-scoping axis) \u2014 set only \`tenant\`, or set \`namespace\` to the same value.`);
1852
1853
  }
1853
1854
  return;
1854
1855
  }
@@ -1870,7 +1871,14 @@ tenant maps 1:1 onto partition (the worker queue-routing suffix) \u2014 set only
1870
1871
  __name(assertValidTopology, "assertValidTopology");
1871
1872
  function resolveTopology(options) {
1872
1873
  const topology = options.topology;
1873
- if (topology === void 0 || topology.role !== "tenant") return options;
1874
+ if (topology === void 0) return options;
1875
+ if (topology.role === "control-plane") {
1876
+ if (topology.tenant === void 0 || options.namespace !== void 0) return options;
1877
+ return {
1878
+ ...options,
1879
+ namespace: topology.tenant
1880
+ };
1881
+ }
1874
1882
  if (options.partition !== void 0) return options;
1875
1883
  return {
1876
1884
  ...options,