@dudousxd/nestjs-durable 0.37.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 +75 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +29 -10
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1060,13 +1060,16 @@ declare class TenantEventRepublisher {
|
|
|
1060
1060
|
*/
|
|
1061
1061
|
declare const CONTEXT_ACCESSOR: unique symbol;
|
|
1062
1062
|
/**
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
* `
|
|
1067
|
-
*
|
|
1063
|
+
* @deprecated Inject the `RunGateway` abstract class directly (it is its own DI token now):
|
|
1064
|
+
* `constructor(private readonly gateway: RunGateway)`, provider `{ provide: RunGateway, useClass }`.
|
|
1065
|
+
* This symbol is kept as a back-compat alias — it points at the `RunGateway` class, so existing
|
|
1066
|
+
* `@Inject(RUN_GATEWAY)` sites resolve the very same token — and will be removed in a future major.
|
|
1067
|
+
*
|
|
1068
|
+
* `RunGateway` is owned by `@dudousxd/nestjs-durable-core` (a required peer dep of both this package
|
|
1069
|
+
* and the dashboard), so the abstract class is a single shared token across packages without the
|
|
1070
|
+
* previous `Symbol.for` value-sharing hack.
|
|
1068
1071
|
*/
|
|
1069
|
-
declare const RUN_GATEWAY:
|
|
1072
|
+
declare const RUN_GATEWAY: typeof RunGateway;
|
|
1070
1073
|
|
|
1071
1074
|
/** Public entry point for starting and resuming workflow runs. */
|
|
1072
1075
|
declare class WorkflowService {
|
package/dist/index.d.ts
CHANGED
|
@@ -1060,13 +1060,16 @@ declare class TenantEventRepublisher {
|
|
|
1060
1060
|
*/
|
|
1061
1061
|
declare const CONTEXT_ACCESSOR: unique symbol;
|
|
1062
1062
|
/**
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
* `
|
|
1067
|
-
*
|
|
1063
|
+
* @deprecated Inject the `RunGateway` abstract class directly (it is its own DI token now):
|
|
1064
|
+
* `constructor(private readonly gateway: RunGateway)`, provider `{ provide: RunGateway, useClass }`.
|
|
1065
|
+
* This symbol is kept as a back-compat alias — it points at the `RunGateway` class, so existing
|
|
1066
|
+
* `@Inject(RUN_GATEWAY)` sites resolve the very same token — and will be removed in a future major.
|
|
1067
|
+
*
|
|
1068
|
+
* `RunGateway` is owned by `@dudousxd/nestjs-durable-core` (a required peer dep of both this package
|
|
1069
|
+
* and the dashboard), so the abstract class is a single shared token across packages without the
|
|
1070
|
+
* previous `Symbol.for` value-sharing hack.
|
|
1068
1071
|
*/
|
|
1069
|
-
declare const RUN_GATEWAY:
|
|
1072
|
+
declare const RUN_GATEWAY: typeof RunGateway;
|
|
1070
1073
|
|
|
1071
1074
|
/** Public entry point for starting and resuming workflow runs. */
|
|
1072
1075
|
declare class WorkflowService {
|
package/dist/index.js
CHANGED
|
@@ -484,7 +484,7 @@ function unavailableRunGateway() {
|
|
|
484
484
|
__name(unavailableRunGateway, "unavailableRunGateway");
|
|
485
485
|
|
|
486
486
|
// src/durable.module.ts
|
|
487
|
-
import { DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL as DURABLE_OPTIONS_CANONICAL7, STATE_STORE, STATE_STORE_CANONICAL as STATE_STORE_CANONICAL4, TRANSPORT, TRANSPORT_CANONICAL as TRANSPORT_CANONICAL3, WorkflowEngine as WorkflowEngine6 } from "@dudousxd/nestjs-durable-core";
|
|
487
|
+
import { DURABLE_OPTIONS, DURABLE_OPTIONS_CANONICAL as DURABLE_OPTIONS_CANONICAL7, RunGateway as RunGateway2, STATE_STORE, STATE_STORE_CANONICAL as STATE_STORE_CANONICAL4, TRANSPORT, TRANSPORT_CANONICAL as TRANSPORT_CANONICAL3, WorkflowEngine as WorkflowEngine6 } from "@dudousxd/nestjs-durable-core";
|
|
488
488
|
import { Inject as Inject8, Injectable as Injectable12, Module } from "@nestjs/common";
|
|
489
489
|
import { DiscoveryModule, ModuleRef } from "@nestjs/core";
|
|
490
490
|
|
|
@@ -543,7 +543,7 @@ var DurableStepRegistrar = class {
|
|
|
543
543
|
if (!isDrivingOperator(this.options)) return;
|
|
544
544
|
if (!supportsHandle(this.transport)) return;
|
|
545
545
|
const transport = this.transport;
|
|
546
|
-
scanSteps(this.discovery, this.metadataScanner, (meta, handler) => transport.handle(meta.name, handler));
|
|
546
|
+
scanSteps(this.discovery, this.metadataScanner, (meta, handler) => transport.handle(meta.name, handler, this.options.partition));
|
|
547
547
|
}
|
|
548
548
|
};
|
|
549
549
|
DurableStepRegistrar = _ts_decorate3([
|
|
@@ -1418,8 +1418,9 @@ TimerPoller = _ts_decorate9([
|
|
|
1418
1418
|
], TimerPoller);
|
|
1419
1419
|
|
|
1420
1420
|
// src/tokens.ts
|
|
1421
|
+
import { RunGateway } from "@dudousxd/nestjs-durable-core";
|
|
1421
1422
|
var CONTEXT_ACCESSOR = Symbol.for("@dudousxd/nestjs-context:accessor");
|
|
1422
|
-
var RUN_GATEWAY =
|
|
1423
|
+
var RUN_GATEWAY = RunGateway;
|
|
1423
1424
|
|
|
1424
1425
|
// src/workflow.registrar.ts
|
|
1425
1426
|
import { DURABLE_OPTIONS_CANONICAL as DURABLE_OPTIONS_CANONICAL6, RemoteWorkflowExecutor, STATE_STORE_CANONICAL as STATE_STORE_CANONICAL3, WorkflowEngine as WorkflowEngine4, bindWorkflowClass, parseDuration as parseDuration2, sanitizeQueueToken, tenantGroup, workflowName as workflowName2 } from "@dudousxd/nestjs-durable-core";
|
|
@@ -1827,13 +1828,32 @@ tenant maps 1:1 onto partition (the worker queue-routing suffix) \u2014 set only
|
|
|
1827
1828
|
}
|
|
1828
1829
|
__name(assertValidTopology, "assertValidTopology");
|
|
1829
1830
|
function resolveTopology(options) {
|
|
1831
|
+
return servingPartition(resolveTopologyPreset(options));
|
|
1832
|
+
}
|
|
1833
|
+
__name(resolveTopology, "resolveTopology");
|
|
1834
|
+
function servingPartition(options) {
|
|
1835
|
+
if (options.partition !== void 0 || options.namespace === void 0) return options;
|
|
1836
|
+
return {
|
|
1837
|
+
...options,
|
|
1838
|
+
partition: options.namespace
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1841
|
+
__name(servingPartition, "servingPartition");
|
|
1842
|
+
function resolveTopologyPreset(options) {
|
|
1830
1843
|
const topology = options.topology;
|
|
1831
1844
|
if (topology === void 0) return options;
|
|
1832
1845
|
if (topology.role === "control-plane") {
|
|
1833
|
-
if (topology.tenant === void 0
|
|
1846
|
+
if (topology.tenant === void 0) return options;
|
|
1834
1847
|
return {
|
|
1835
1848
|
...options,
|
|
1836
|
-
namespace
|
|
1849
|
+
// An explicit `namespace` is already validated equal to `tenant` (assertValidTopology), so
|
|
1850
|
+
// keeping it is a no-op rather than a conflict.
|
|
1851
|
+
namespace: options.namespace ?? topology.tenant,
|
|
1852
|
+
// The tenant is ALSO this node's worker-routing suffix: its engine now dispatches a run's steps
|
|
1853
|
+
// to `<name>@<tenant>` (core's `stepGroup`), so its own co-located worker must SUBSCRIBE those
|
|
1854
|
+
// same tokens. Without this the node would dispatch into queues it is not itself listening on.
|
|
1855
|
+
// `partition` is user-forbidden on this role (assertValidTopology), so we own it here.
|
|
1856
|
+
partition: topology.tenant
|
|
1837
1857
|
};
|
|
1838
1858
|
}
|
|
1839
1859
|
if (options.partition !== void 0) return options;
|
|
@@ -1842,7 +1862,7 @@ function resolveTopology(options) {
|
|
|
1842
1862
|
partition: topology.tenant
|
|
1843
1863
|
};
|
|
1844
1864
|
}
|
|
1845
|
-
__name(
|
|
1865
|
+
__name(resolveTopologyPreset, "resolveTopologyPreset");
|
|
1846
1866
|
var RunGatewayBootstrap = class RunGatewayBootstrap2 {
|
|
1847
1867
|
static {
|
|
1848
1868
|
__name(this, "RunGatewayBootstrap");
|
|
@@ -1886,14 +1906,13 @@ var RunGatewayBootstrap = class RunGatewayBootstrap2 {
|
|
|
1886
1906
|
RunGatewayBootstrap = _ts_decorate12([
|
|
1887
1907
|
Injectable12(),
|
|
1888
1908
|
_ts_param8(1, Inject8(TRANSPORT_CANONICAL3)),
|
|
1889
|
-
_ts_param8(2, Inject8(RUN_GATEWAY)),
|
|
1890
1909
|
_ts_param8(3, Inject8(STATE_STORE_CANONICAL4)),
|
|
1891
1910
|
_ts_param8(4, Inject8(DURABLE_OPTIONS_CANONICAL7)),
|
|
1892
1911
|
_ts_metadata12("design:type", Function),
|
|
1893
1912
|
_ts_metadata12("design:paramtypes", [
|
|
1894
1913
|
typeof WorkflowEngine6 === "undefined" ? Object : WorkflowEngine6,
|
|
1895
1914
|
Object,
|
|
1896
|
-
typeof
|
|
1915
|
+
typeof RunGateway2 === "undefined" ? Object : RunGateway2,
|
|
1897
1916
|
Object,
|
|
1898
1917
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
|
|
1899
1918
|
])
|
|
@@ -2038,7 +2057,7 @@ var DurableModule = class _DurableModule {
|
|
|
2038
2057
|
// or (for a thin worker, no `store`) a `ProxyRunGateway` over `transport` when given, else a
|
|
2039
2058
|
// gateway whose every method rejects with a clear tenant error.
|
|
2040
2059
|
{
|
|
2041
|
-
provide:
|
|
2060
|
+
provide: RunGateway2,
|
|
2042
2061
|
useFactory: /* @__PURE__ */ __name((options, store, engine) => {
|
|
2043
2062
|
if (options.store !== void 0) {
|
|
2044
2063
|
if (!store) {
|
|
@@ -2071,7 +2090,7 @@ var DurableModule = class _DurableModule {
|
|
|
2071
2090
|
TRANSPORT,
|
|
2072
2091
|
TRANSPORT_CANONICAL3,
|
|
2073
2092
|
DURABLE_OPTIONS_CANONICAL7,
|
|
2074
|
-
|
|
2093
|
+
RunGateway2
|
|
2075
2094
|
]
|
|
2076
2095
|
};
|
|
2077
2096
|
}
|