@dudousxd/nestjs-durable 0.50.0 → 0.52.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 +169 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -7
- package/dist/index.d.ts +67 -7
- package/dist/index.js +81 -47
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/skills/durable-workflows/SKILL.md +5 -2
package/dist/index.cjs
CHANGED
|
@@ -58,7 +58,7 @@ __export(index_exports, {
|
|
|
58
58
|
ProxyRunGateway: () => ProxyRunGateway,
|
|
59
59
|
RUN_GATEWAY: () => RUN_GATEWAY,
|
|
60
60
|
RUN_REDIS_WORKER: () => RUN_REDIS_WORKER,
|
|
61
|
-
RunGateway: () =>
|
|
61
|
+
RunGateway: () => import_nestjs_durable_core19.RunGateway,
|
|
62
62
|
RunRequestResponder: () => RunRequestResponder,
|
|
63
63
|
STEP_INTERCEPTOR_METADATA: () => STEP_INTERCEPTOR_METADATA,
|
|
64
64
|
Step: () => Step,
|
|
@@ -71,7 +71,7 @@ __export(index_exports, {
|
|
|
71
71
|
UNSUPPORTED_RUN_REQUEST: () => UNSUPPORTED_RUN_REQUEST,
|
|
72
72
|
WORKFLOW_METADATA: () => WORKFLOW_METADATA,
|
|
73
73
|
Workflow: () => Workflow,
|
|
74
|
-
WorkflowEngine: () =>
|
|
74
|
+
WorkflowEngine: () => import_nestjs_durable_core19.WorkflowEngine,
|
|
75
75
|
WorkflowService: () => WorkflowService,
|
|
76
76
|
attributesOf: () => attributesOf,
|
|
77
77
|
entityConfigFor: () => entityConfigFor,
|
|
@@ -79,13 +79,19 @@ __export(index_exports, {
|
|
|
79
79
|
getEntityMeta: () => getEntityMeta,
|
|
80
80
|
getOnEvents: () => getOnEvents,
|
|
81
81
|
getWorkflowMeta: () => getWorkflowMeta,
|
|
82
|
+
hmacTenantVerifier: () => import_nestjs_durable_core19.hmacTenantVerifier,
|
|
82
83
|
inAppWorkerProviders: () => inAppWorkerProviders,
|
|
83
84
|
isDeadLetterHandler: () => isDeadLetterHandler,
|
|
84
85
|
isDrivingOperator: () => isDrivingOperator,
|
|
85
86
|
isOperatorRole: () => isOperatorRole,
|
|
86
87
|
isStepInterceptor: () => isStepInterceptor,
|
|
87
88
|
onErrorCodesOf: () => onErrorCodesOf,
|
|
88
|
-
|
|
89
|
+
prevCronFireMs: () => import_nestjs_durable_core19.prevCronFireMs,
|
|
90
|
+
readSearchAttributes: () => import_nestjs_durable_core19.readSearchAttributes,
|
|
91
|
+
runSchedules: () => import_nestjs_durable_core19.runSchedules,
|
|
92
|
+
scheduleRunIdAt: () => import_nestjs_durable_core19.scheduleRunIdAt,
|
|
93
|
+
scheduledRunId: () => import_nestjs_durable_core19.scheduledRunId,
|
|
94
|
+
signTenantToken: () => import_nestjs_durable_core19.signTenantToken,
|
|
89
95
|
thinWorkerProviders: () => thinWorkerProviders,
|
|
90
96
|
unavailableRunGateway: () => unavailableRunGateway
|
|
91
97
|
});
|
|
@@ -412,7 +418,9 @@ var DurableStartClient = class {
|
|
|
412
418
|
async start(workflow, input, runId = globalThis.crypto.randomUUID(), opts) {
|
|
413
419
|
const name = (0, import_nestjs_durable_core3.workflowName)(workflow);
|
|
414
420
|
await startRun(this.options.connection, {
|
|
415
|
-
tenant
|
|
421
|
+
// The signed token (when configured) rides in the `tenant` field, as on every run request; an
|
|
422
|
+
// operator with `verifyTenant` derives the run's namespace from it.
|
|
423
|
+
tenant: this.options.tenantToken !== void 0 ? await (0, import_nestjs_durable_core3.resolveTenantToken)(this.options.tenantToken) : this.tenant,
|
|
416
424
|
workflow: name,
|
|
417
425
|
input,
|
|
418
426
|
runId,
|
|
@@ -489,28 +497,14 @@ function schemaParser(schema, kind, label) {
|
|
|
489
497
|
if (isStandardSchema(schema)) {
|
|
490
498
|
return async (value) => {
|
|
491
499
|
const result = await schema["~standard"].validate(value);
|
|
492
|
-
if (result.issues)
|
|
493
|
-
const issues = result.issues.map((i) => ({
|
|
494
|
-
message: i.message,
|
|
495
|
-
...i.path ? {
|
|
496
|
-
path: i.path.map((p) => String(typeof p === "object" ? p.key : p))
|
|
497
|
-
} : {}
|
|
498
|
-
}));
|
|
499
|
-
throw new import_nestjs_durable_core4.FatalError(`invalid ${label}: ${formatIssues(issues)}`, code, issues);
|
|
500
|
-
}
|
|
500
|
+
if (result.issues) throw new import_nestjs_durable_core4.SchemaValidationError(label, result.issues, code);
|
|
501
501
|
return result.value;
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
504
|
if (isZodLike(schema)) {
|
|
505
505
|
return async (value) => {
|
|
506
506
|
const result = schema.safeParse(value);
|
|
507
|
-
if (!result.success)
|
|
508
|
-
const issues = result.error.issues.map((i) => ({
|
|
509
|
-
message: i.message,
|
|
510
|
-
path: i.path.map(String)
|
|
511
|
-
}));
|
|
512
|
-
throw new import_nestjs_durable_core4.FatalError(`invalid ${label}: ${formatIssues(issues)}`, code, issues);
|
|
513
|
-
}
|
|
507
|
+
if (!result.success) throw new import_nestjs_durable_core4.SchemaValidationError(label, result.error.issues, code);
|
|
514
508
|
return result.data;
|
|
515
509
|
};
|
|
516
510
|
}
|
|
@@ -530,12 +524,11 @@ function classValidatorParser(cls, code, label) {
|
|
|
530
524
|
}
|
|
531
525
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
532
526
|
const got = value === null ? "null" : Array.isArray(value) ? "an array" : typeof value;
|
|
533
|
-
|
|
534
|
-
throw new import_nestjs_durable_core4.FatalError(`invalid ${label}: ${message}`, code, [
|
|
527
|
+
throw new import_nestjs_durable_core4.SchemaValidationError(label, [
|
|
535
528
|
{
|
|
536
|
-
message
|
|
529
|
+
message: `expected an object, got ${got}`
|
|
537
530
|
}
|
|
538
|
-
]);
|
|
531
|
+
], code);
|
|
539
532
|
}
|
|
540
533
|
const instance = ct.plainToInstance(cls, value);
|
|
541
534
|
const errors = await cv.validate(instance, {
|
|
@@ -550,8 +543,8 @@ function classValidatorParser(cls, code, label) {
|
|
|
550
543
|
String(e.property)
|
|
551
544
|
]
|
|
552
545
|
}));
|
|
553
|
-
const
|
|
554
|
-
throw new import_nestjs_durable_core4.
|
|
546
|
+
const summary = issues.map((i) => i.message).join("; ");
|
|
547
|
+
throw new import_nestjs_durable_core4.SchemaValidationError(label, issues, code, summary);
|
|
555
548
|
}
|
|
556
549
|
return instance;
|
|
557
550
|
};
|
|
@@ -565,10 +558,6 @@ function isZodLike(schema) {
|
|
|
565
558
|
return typeof schema === "object" && schema !== null && typeof schema.safeParse === "function";
|
|
566
559
|
}
|
|
567
560
|
__name(isZodLike, "isZodLike");
|
|
568
|
-
function formatIssues(issues) {
|
|
569
|
-
return issues.map((i) => i.path && i.path.length > 0 ? `${i.path.join(".")}: ${i.message}` : i.message).join("; ");
|
|
570
|
-
}
|
|
571
|
-
__name(formatIssues, "formatIssues");
|
|
572
561
|
|
|
573
562
|
// src/discovery-helpers.ts
|
|
574
563
|
function scanWorkflows(discovery, register) {
|
|
@@ -648,8 +637,8 @@ function workflowIo(meta) {
|
|
|
648
637
|
const validateInput = meta.validateInput;
|
|
649
638
|
return {
|
|
650
639
|
validateAtStart: parseInput || validateInput ? async (input) => {
|
|
651
|
-
|
|
652
|
-
await validateInput?.(
|
|
640
|
+
const parsed = parseInput ? await parseInput(input) : input;
|
|
641
|
+
await validateInput?.(parsed);
|
|
653
642
|
} : void 0,
|
|
654
643
|
wrap: /* @__PURE__ */ __name((body) => !parseInput && !parseOutput ? body : async (ctx, input) => {
|
|
655
644
|
const output = await body(ctx, parseInput ? await parseInput(input) : input);
|
|
@@ -932,7 +921,7 @@ function unavailableRunGateway() {
|
|
|
932
921
|
__name(unavailableRunGateway, "unavailableRunGateway");
|
|
933
922
|
|
|
934
923
|
// src/durable.module.ts
|
|
935
|
-
var
|
|
924
|
+
var import_nestjs_durable_core18 = require("@dudousxd/nestjs-durable-core");
|
|
936
925
|
var import_common12 = require("@nestjs/common");
|
|
937
926
|
var import_core5 = require("@nestjs/core");
|
|
938
927
|
|
|
@@ -1268,10 +1257,11 @@ function inAppWorkerProviders() {
|
|
|
1268
1257
|
__name(inAppWorkerProviders, "inAppWorkerProviders");
|
|
1269
1258
|
|
|
1270
1259
|
// src/proxy-run-gateway.ts
|
|
1271
|
-
var
|
|
1260
|
+
var import_nestjs_durable_core11 = require("@dudousxd/nestjs-durable-core");
|
|
1272
1261
|
var import_common6 = require("@nestjs/common");
|
|
1273
1262
|
|
|
1274
1263
|
// src/run-request-responder.ts
|
|
1264
|
+
var import_nestjs_durable_core10 = require("@dudousxd/nestjs-durable-core");
|
|
1275
1265
|
var UNSUPPORTED_RUN_REQUEST = "unsupported-request";
|
|
1276
1266
|
var KNOWN_KINDS = /* @__PURE__ */ new Set([
|
|
1277
1267
|
"getRunDetail",
|
|
@@ -1293,9 +1283,14 @@ var RunRequestResponder = class {
|
|
|
1293
1283
|
}
|
|
1294
1284
|
transport;
|
|
1295
1285
|
gateway;
|
|
1296
|
-
|
|
1286
|
+
verifyTenant;
|
|
1287
|
+
constructor(transport, gateway, options = {}) {
|
|
1297
1288
|
this.transport = transport;
|
|
1298
1289
|
this.gateway = gateway;
|
|
1290
|
+
this.verifyTenant = options.verifyTenant;
|
|
1291
|
+
if (!this.verifyTenant && options.warnWithoutVerifier !== false) {
|
|
1292
|
+
console.warn("[nestjs-durable] run-request responder started WITHOUT a tenant verifier: the wire `tenant` claim is trusted verbatim (prefix/network isolation only). Any broker client can act as any tenant. Configure `verifyTenant` (e.g. hmacTenantVerifier(secret)) and signed tenant tokens unless your broker is fully isolated per tenant.");
|
|
1293
|
+
}
|
|
1299
1294
|
}
|
|
1300
1295
|
/** Register the consumer on the transport. Each request is answered independently; a handler
|
|
1301
1296
|
* failure never throws back into the transport (errors are captured into an error reply). */
|
|
@@ -1318,7 +1313,24 @@ var RunRequestResponder = class {
|
|
|
1318
1313
|
await this.transport.publishRunReply(reply);
|
|
1319
1314
|
});
|
|
1320
1315
|
}
|
|
1321
|
-
async handle(
|
|
1316
|
+
async handle(wire) {
|
|
1317
|
+
const tenant = await (0, import_nestjs_durable_core10.resolveWireTenant)(wire.tenant, this.verifyTenant);
|
|
1318
|
+
if (tenant === null) {
|
|
1319
|
+
return {
|
|
1320
|
+
requestId: wire.requestId,
|
|
1321
|
+
result: {
|
|
1322
|
+
ok: false,
|
|
1323
|
+
error: {
|
|
1324
|
+
message: "invalid or unauthorized tenant token",
|
|
1325
|
+
code: "unauthorized"
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
const msg = {
|
|
1331
|
+
...wire,
|
|
1332
|
+
tenant
|
|
1333
|
+
};
|
|
1322
1334
|
const { body } = msg;
|
|
1323
1335
|
if (!KNOWN_KINDS.has(body.kind)) {
|
|
1324
1336
|
return {
|
|
@@ -1511,17 +1523,19 @@ var ProxyRunGateway = class {
|
|
|
1511
1523
|
tenant;
|
|
1512
1524
|
timeoutMs;
|
|
1513
1525
|
capabilityTtlMs;
|
|
1526
|
+
tenantToken;
|
|
1514
1527
|
pending = /* @__PURE__ */ new Map();
|
|
1515
1528
|
/** Verb → when to ask the control plane for it again, after it answered that it does not know it.
|
|
1516
1529
|
* During a rolling upgrade the control plane is several pods of mixed versions behind one queue,
|
|
1517
1530
|
* and a reply does not say which pod sent it, so the whole control plane is assumed old until the
|
|
1518
1531
|
* entry expires. */
|
|
1519
1532
|
unsupportedUntil = /* @__PURE__ */ new Map();
|
|
1520
|
-
constructor(transport, tenant, timeoutMs = 1e4, capabilityTtlMs = 6e4) {
|
|
1533
|
+
constructor(transport, tenant, timeoutMs = 1e4, capabilityTtlMs = 6e4, tenantToken) {
|
|
1521
1534
|
this.transport = transport;
|
|
1522
1535
|
this.tenant = tenant;
|
|
1523
1536
|
this.timeoutMs = timeoutMs;
|
|
1524
1537
|
this.capabilityTtlMs = capabilityTtlMs;
|
|
1538
|
+
this.tenantToken = tenantToken;
|
|
1525
1539
|
this.transport.onRunReply?.((reply) => this.handleReply(reply));
|
|
1526
1540
|
}
|
|
1527
1541
|
handleReply(reply) {
|
|
@@ -1534,7 +1548,10 @@ var ProxyRunGateway = class {
|
|
|
1534
1548
|
} else if (reply.result.error.code === UNSUPPORTED_RUN_REQUEST) {
|
|
1535
1549
|
pending.reject(new UnsupportedRunRequestError(reply.result.error.message));
|
|
1536
1550
|
} else {
|
|
1537
|
-
|
|
1551
|
+
const { message, code } = reply.result.error;
|
|
1552
|
+
pending.reject(code !== void 0 ? Object.assign(new Error(message), {
|
|
1553
|
+
code
|
|
1554
|
+
}) : new Error(message));
|
|
1538
1555
|
}
|
|
1539
1556
|
}
|
|
1540
1557
|
request(body) {
|
|
@@ -1549,11 +1566,17 @@ var ProxyRunGateway = class {
|
|
|
1549
1566
|
reject,
|
|
1550
1567
|
timer
|
|
1551
1568
|
});
|
|
1552
|
-
this.
|
|
1569
|
+
const source = this.tenantToken;
|
|
1570
|
+
const dispatched = typeof source === "function" ? (0, import_nestjs_durable_core11.resolveTenantToken)(source).then((tenant) => this.transport.dispatchRunRequest?.({
|
|
1571
|
+
requestId,
|
|
1572
|
+
tenant,
|
|
1573
|
+
body
|
|
1574
|
+
})) : this.transport.dispatchRunRequest?.({
|
|
1553
1575
|
requestId,
|
|
1554
|
-
tenant: this.tenant,
|
|
1576
|
+
tenant: source ?? this.tenant,
|
|
1555
1577
|
body
|
|
1556
|
-
})
|
|
1578
|
+
});
|
|
1579
|
+
dispatched?.catch((error) => {
|
|
1557
1580
|
const stillPending = this.pending.get(requestId);
|
|
1558
1581
|
if (!stillPending) return;
|
|
1559
1582
|
clearTimeout(stillPending.timer);
|
|
@@ -1583,12 +1606,12 @@ var ProxyRunGateway = class {
|
|
|
1583
1606
|
});
|
|
1584
1607
|
const over = options?.summarizeFansOver;
|
|
1585
1608
|
if (over === void 0 || !detail || detail.fans !== void 0) return detail;
|
|
1586
|
-
const { timeline, fans } = (0,
|
|
1587
|
-
const ids = (0,
|
|
1609
|
+
const { timeline, fans } = (0, import_nestjs_durable_core11.summarizeTimeline)(detail.timeline, over);
|
|
1610
|
+
const ids = (0, import_nestjs_durable_core11.childIdsOf)(detail.timeline);
|
|
1588
1611
|
return {
|
|
1589
1612
|
...detail,
|
|
1590
1613
|
timeline,
|
|
1591
|
-
children: ids.slice(0,
|
|
1614
|
+
children: ids.slice(0, import_nestjs_durable_core11.SUMMARY_CHILD_LIMIT),
|
|
1592
1615
|
fans,
|
|
1593
1616
|
childCount: ids.length
|
|
1594
1617
|
};
|
|
@@ -1613,7 +1636,7 @@ var ProxyRunGateway = class {
|
|
|
1613
1636
|
kind: "getRunDetail",
|
|
1614
1637
|
runId
|
|
1615
1638
|
});
|
|
1616
|
-
return detail ? (0,
|
|
1639
|
+
return detail ? (0, import_nestjs_durable_core11.pageFan)(detail.timeline, group, query) : null;
|
|
1617
1640
|
}
|
|
1618
1641
|
knownUnsupported(kind) {
|
|
1619
1642
|
const until = this.unsupportedUntil.get(kind);
|
|
@@ -1711,12 +1734,13 @@ ProxyRunGateway = _ts_decorate6([
|
|
|
1711
1734
|
typeof Transport === "undefined" ? Object : Transport,
|
|
1712
1735
|
String,
|
|
1713
1736
|
void 0,
|
|
1714
|
-
void 0
|
|
1737
|
+
void 0,
|
|
1738
|
+
typeof TenantTokenSource === "undefined" ? Object : TenantTokenSource
|
|
1715
1739
|
])
|
|
1716
1740
|
], ProxyRunGateway);
|
|
1717
1741
|
|
|
1718
1742
|
// src/retention-poller.ts
|
|
1719
|
-
var
|
|
1743
|
+
var import_nestjs_durable_core12 = require("@dudousxd/nestjs-durable-core");
|
|
1720
1744
|
var import_common7 = require("@nestjs/common");
|
|
1721
1745
|
|
|
1722
1746
|
// src/settle-within.ts
|
|
@@ -1782,10 +1806,10 @@ function validateRetention(retention) {
|
|
|
1782
1806
|
if (policy.maxAge == null && policy.maxCount == null) {
|
|
1783
1807
|
throw new Error("durable retention: each policy must set maxAge and/or maxCount");
|
|
1784
1808
|
}
|
|
1785
|
-
if (policy.maxAge != null) (0,
|
|
1809
|
+
if (policy.maxAge != null) (0, import_nestjs_durable_core12.parseDuration)(policy.maxAge);
|
|
1786
1810
|
for (const status of policy.statuses) {
|
|
1787
|
-
if (!
|
|
1788
|
-
throw new Error(`durable retention: status "${status}" is not terminal; only ${
|
|
1811
|
+
if (!import_nestjs_durable_core12.TERMINAL_RUN_STATUSES.includes(status)) {
|
|
1812
|
+
throw new Error(`durable retention: status "${status}" is not terminal; only ${import_nestjs_durable_core12.TERMINAL_RUN_STATUSES.join(", ")} can be pruned`);
|
|
1789
1813
|
}
|
|
1790
1814
|
const key = `${scopeKey}|${status}`;
|
|
1791
1815
|
if (seen.has(key)) {
|
|
@@ -1837,7 +1861,7 @@ var RetentionPoller = class {
|
|
|
1837
1861
|
return;
|
|
1838
1862
|
}
|
|
1839
1863
|
await this.sweep();
|
|
1840
|
-
const intervalMs = retention.sweepInterval != null ? (0,
|
|
1864
|
+
const intervalMs = retention.sweepInterval != null ? (0, import_nestjs_durable_core12.parseDuration)(retention.sweepInterval) : DEFAULT_SWEEP_INTERVAL_MS;
|
|
1841
1865
|
if (intervalMs > 0) {
|
|
1842
1866
|
this.timer = setInterval(() => void this.sweep(), intervalMs);
|
|
1843
1867
|
this.timer.unref?.();
|
|
@@ -1899,8 +1923,8 @@ var RetentionPoller = class {
|
|
|
1899
1923
|
};
|
|
1900
1924
|
RetentionPoller = _ts_decorate7([
|
|
1901
1925
|
(0, import_common7.Injectable)(),
|
|
1902
|
-
_ts_param4(0, (0, import_common7.Inject)(
|
|
1903
|
-
_ts_param4(1, (0, import_common7.Inject)(
|
|
1926
|
+
_ts_param4(0, (0, import_common7.Inject)(import_nestjs_durable_core12.STATE_STORE_CANONICAL)),
|
|
1927
|
+
_ts_param4(1, (0, import_common7.Inject)(import_nestjs_durable_core12.DURABLE_OPTIONS_CANONICAL)),
|
|
1904
1928
|
_ts_metadata7("design:type", Function),
|
|
1905
1929
|
_ts_metadata7("design:paramtypes", [
|
|
1906
1930
|
Object,
|
|
@@ -1909,7 +1933,7 @@ RetentionPoller = _ts_decorate7([
|
|
|
1909
1933
|
], RetentionPoller);
|
|
1910
1934
|
|
|
1911
1935
|
// src/store-run-gateway.ts
|
|
1912
|
-
var
|
|
1936
|
+
var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
|
|
1913
1937
|
var import_common8 = require("@nestjs/common");
|
|
1914
1938
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
1915
1939
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1967,10 +1991,10 @@ var StoreRunGateway = class {
|
|
|
1967
1991
|
children
|
|
1968
1992
|
};
|
|
1969
1993
|
}
|
|
1970
|
-
if ((0,
|
|
1994
|
+
if ((0, import_nestjs_durable_core13.aggregatesCheckpoints)(this.store)) {
|
|
1971
1995
|
const stats = await this.store.checkpointStats(runId);
|
|
1972
|
-
const etag = (0,
|
|
1973
|
-
if ((0,
|
|
1996
|
+
const etag = (0, import_nestjs_durable_core13.runDetailEtag)(run, stats, over);
|
|
1997
|
+
if ((0, import_nestjs_durable_core13.etagMatches)(options?.ifNoneMatch, etag)) {
|
|
1974
1998
|
return {
|
|
1975
1999
|
run,
|
|
1976
2000
|
timeline: [],
|
|
@@ -1981,17 +2005,17 @@ var StoreRunGateway = class {
|
|
|
1981
2005
|
}
|
|
1982
2006
|
return {
|
|
1983
2007
|
run,
|
|
1984
|
-
...await (0,
|
|
2008
|
+
...await (0, import_nestjs_durable_core13.summarizeRunFromStore)(this.store, runId, over, stats),
|
|
1985
2009
|
etag
|
|
1986
2010
|
};
|
|
1987
2011
|
}
|
|
1988
2012
|
const full = await this.store.listCheckpoints(runId);
|
|
1989
|
-
const { timeline, fans } = (0,
|
|
1990
|
-
const ids = (0,
|
|
2013
|
+
const { timeline, fans } = (0, import_nestjs_durable_core13.summarizeTimeline)(full, over);
|
|
2014
|
+
const ids = (0, import_nestjs_durable_core13.childIdsOf)(full);
|
|
1991
2015
|
return {
|
|
1992
2016
|
run,
|
|
1993
2017
|
timeline,
|
|
1994
|
-
children: ids.slice(0,
|
|
2018
|
+
children: ids.slice(0, import_nestjs_durable_core13.SUMMARY_CHILD_LIMIT),
|
|
1995
2019
|
fans,
|
|
1996
2020
|
childCount: ids.length
|
|
1997
2021
|
};
|
|
@@ -2001,12 +2025,12 @@ var StoreRunGateway = class {
|
|
|
2001
2025
|
}
|
|
2002
2026
|
async getFanMembers(runId, group, query) {
|
|
2003
2027
|
if (!await this.store.getRun(runId)) return null;
|
|
2004
|
-
if ((0,
|
|
2028
|
+
if ((0, import_nestjs_durable_core13.aggregatesCheckpoints)(this.store)) {
|
|
2005
2029
|
const stats = await this.store.checkpointStats(runId, {
|
|
2006
2030
|
group
|
|
2007
2031
|
});
|
|
2008
|
-
const etag = (0,
|
|
2009
|
-
if ((0,
|
|
2032
|
+
const etag = (0, import_nestjs_durable_core13.fanPageEtag)(group, stats, query);
|
|
2033
|
+
if ((0, import_nestjs_durable_core13.etagMatches)(query.ifNoneMatch, etag)) {
|
|
2010
2034
|
return {
|
|
2011
2035
|
items: [],
|
|
2012
2036
|
total: 0,
|
|
@@ -2015,17 +2039,17 @@ var StoreRunGateway = class {
|
|
|
2015
2039
|
};
|
|
2016
2040
|
}
|
|
2017
2041
|
return {
|
|
2018
|
-
...await (0,
|
|
2042
|
+
...await (0, import_nestjs_durable_core13.pageFanFromStore)(this.store, runId, group, query, stats),
|
|
2019
2043
|
etag
|
|
2020
2044
|
};
|
|
2021
2045
|
}
|
|
2022
|
-
return (0,
|
|
2046
|
+
return (0, import_nestjs_durable_core13.pageFan)(await this.store.listCheckpoints(runId), group, query);
|
|
2023
2047
|
}
|
|
2024
2048
|
async listRuns(query) {
|
|
2025
2049
|
const runs = await this.store.listRuns(query);
|
|
2026
|
-
const waiterByRun = (0,
|
|
2050
|
+
const waiterByRun = (0, import_nestjs_durable_core13.indexWaitersByRun)(await (0, import_nestjs_durable_core13.listSignalWaitersOfRuns)(this.store, runs.filter((run) => run.status === "suspended").map((run) => run.id)));
|
|
2027
2051
|
return runs.map((run) => {
|
|
2028
|
-
const waiting = (0,
|
|
2052
|
+
const waiting = (0, import_nestjs_durable_core13.resolveRunWaiting)(run, waiterByRun);
|
|
2029
2053
|
return waiting ? {
|
|
2030
2054
|
...run,
|
|
2031
2055
|
waiting
|
|
@@ -2041,7 +2065,7 @@ var StoreRunGateway = class {
|
|
|
2041
2065
|
async runFacets(query) {
|
|
2042
2066
|
if (this.store.runFacets) return this.store.runFacets(query);
|
|
2043
2067
|
const runs = await this.store.listRuns(query);
|
|
2044
|
-
return (0,
|
|
2068
|
+
return (0, import_nestjs_durable_core13.mergeRunFacetRows)(runs.map((r) => ({
|
|
2045
2069
|
status: r.status,
|
|
2046
2070
|
origin: r.origin,
|
|
2047
2071
|
count: 1
|
|
@@ -2076,13 +2100,13 @@ var StoreRunGateway = class {
|
|
|
2076
2100
|
"suspended"
|
|
2077
2101
|
]
|
|
2078
2102
|
}),
|
|
2079
|
-
(0,
|
|
2103
|
+
(0, import_nestjs_durable_core13.listSignalWaitersOfRuns)(this.store, runIds)
|
|
2080
2104
|
]);
|
|
2081
|
-
const waiterByRun = (0,
|
|
2105
|
+
const waiterByRun = (0, import_nestjs_durable_core13.indexWaitersByRun)(waiters);
|
|
2082
2106
|
const result = {};
|
|
2083
2107
|
for (const run of suspended) {
|
|
2084
2108
|
if (!idSet.has(run.id)) continue;
|
|
2085
|
-
const waiting = (0,
|
|
2109
|
+
const waiting = (0, import_nestjs_durable_core13.resolveRunWaiting)(run, waiterByRun);
|
|
2086
2110
|
if (waiting) result[run.id] = waiting;
|
|
2087
2111
|
}
|
|
2088
2112
|
return result;
|
|
@@ -2116,11 +2140,11 @@ var StoreRunGateway = class {
|
|
|
2116
2140
|
};
|
|
2117
2141
|
StoreRunGateway = _ts_decorate8([
|
|
2118
2142
|
(0, import_common8.Injectable)(),
|
|
2119
|
-
_ts_param5(0, (0, import_common8.Inject)(
|
|
2143
|
+
_ts_param5(0, (0, import_common8.Inject)(import_nestjs_durable_core13.STATE_STORE_CANONICAL)),
|
|
2120
2144
|
_ts_metadata8("design:type", Function),
|
|
2121
2145
|
_ts_metadata8("design:paramtypes", [
|
|
2122
2146
|
typeof StateStore === "undefined" ? Object : StateStore,
|
|
2123
|
-
typeof
|
|
2147
|
+
typeof import_nestjs_durable_core13.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core13.WorkflowEngine
|
|
2124
2148
|
])
|
|
2125
2149
|
], StoreRunGateway);
|
|
2126
2150
|
|
|
@@ -2166,7 +2190,7 @@ var TenantEventRepublisher = class {
|
|
|
2166
2190
|
};
|
|
2167
2191
|
|
|
2168
2192
|
// src/timer-poller.ts
|
|
2169
|
-
var
|
|
2193
|
+
var import_nestjs_durable_core14 = require("@dudousxd/nestjs-durable-core");
|
|
2170
2194
|
var import_common9 = require("@nestjs/common");
|
|
2171
2195
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
2172
2196
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2210,6 +2234,7 @@ var TimerPoller = class {
|
|
|
2210
2234
|
this.options = options;
|
|
2211
2235
|
}
|
|
2212
2236
|
async onApplicationBootstrap() {
|
|
2237
|
+
for (const s of this.options.schedules ?? []) (0, import_nestjs_durable_core14.workflowName)(s.workflow);
|
|
2213
2238
|
if (!isDrivingOperator(this.options)) return;
|
|
2214
2239
|
this.unsubscribeEnqueued = this.engine.onEnqueued((runId) => {
|
|
2215
2240
|
void this.engine.runOne(runId).catch((error) => {
|
|
@@ -2279,7 +2304,7 @@ var TimerPoller = class {
|
|
|
2279
2304
|
await this.sweep("sweepStalled", async () => this.engine.sweepStalled?.());
|
|
2280
2305
|
const schedules = this.options.schedules;
|
|
2281
2306
|
if (schedules && schedules.length > 0) {
|
|
2282
|
-
await this.sweep("schedules", () => (0,
|
|
2307
|
+
await this.sweep("schedules", () => (0, import_nestjs_durable_core14.runSchedules)(this.engine, schedules, Date.now()));
|
|
2283
2308
|
}
|
|
2284
2309
|
if (this.options.persistedSchedules) {
|
|
2285
2310
|
await this.sweep("persistedSchedules", () => this.engine.schedules.tick());
|
|
@@ -2297,21 +2322,21 @@ var TimerPoller = class {
|
|
|
2297
2322
|
};
|
|
2298
2323
|
TimerPoller = _ts_decorate9([
|
|
2299
2324
|
(0, import_common9.Injectable)(),
|
|
2300
|
-
_ts_param6(1, (0, import_common9.Inject)(
|
|
2325
|
+
_ts_param6(1, (0, import_common9.Inject)(import_nestjs_durable_core14.DURABLE_OPTIONS_CANONICAL)),
|
|
2301
2326
|
_ts_metadata9("design:type", Function),
|
|
2302
2327
|
_ts_metadata9("design:paramtypes", [
|
|
2303
|
-
typeof
|
|
2328
|
+
typeof import_nestjs_durable_core14.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core14.WorkflowEngine,
|
|
2304
2329
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
|
|
2305
2330
|
])
|
|
2306
2331
|
], TimerPoller);
|
|
2307
2332
|
|
|
2308
2333
|
// src/tokens.ts
|
|
2309
|
-
var
|
|
2334
|
+
var import_nestjs_durable_core15 = require("@dudousxd/nestjs-durable-core");
|
|
2310
2335
|
var CONTEXT_ACCESSOR = Symbol.for("@dudousxd/nestjs-context:accessor");
|
|
2311
|
-
var RUN_GATEWAY =
|
|
2336
|
+
var RUN_GATEWAY = import_nestjs_durable_core15.RunGateway;
|
|
2312
2337
|
|
|
2313
2338
|
// src/workflow.registrar.ts
|
|
2314
|
-
var
|
|
2339
|
+
var import_nestjs_durable_core16 = require("@dudousxd/nestjs-durable-core");
|
|
2315
2340
|
var import_common10 = require("@nestjs/common");
|
|
2316
2341
|
var import_core4 = require("@nestjs/core");
|
|
2317
2342
|
|
|
@@ -2421,11 +2446,11 @@ var WorkflowRegistrar = class {
|
|
|
2421
2446
|
const body = io.wrap((ctx, input) => workflow.run(ctx, input));
|
|
2422
2447
|
const eventBatch = meta.debounce ? {
|
|
2423
2448
|
mode: "debounce",
|
|
2424
|
-
windowMs: (0,
|
|
2449
|
+
windowMs: (0, import_nestjs_durable_core16.parseDuration)(meta.debounce)
|
|
2425
2450
|
} : meta.batch ? {
|
|
2426
2451
|
mode: "batch",
|
|
2427
2452
|
maxSize: meta.batch.maxSize,
|
|
2428
|
-
windowMs: (0,
|
|
2453
|
+
windowMs: (0, import_nestjs_durable_core16.parseDuration)(meta.batch.within)
|
|
2429
2454
|
} : void 0;
|
|
2430
2455
|
const workflowCtor = workflow.constructor;
|
|
2431
2456
|
const onError = onErrorHandlersOf(meta, workflow, this.metadataScanner);
|
|
@@ -2459,11 +2484,11 @@ var WorkflowRegistrar = class {
|
|
|
2459
2484
|
// so a turn dispatched under the wrong token would never be consumed. Absent → the inline fast
|
|
2460
2485
|
// path (unchanged).
|
|
2461
2486
|
...this.inAppWorker ? {
|
|
2462
|
-
group: (0,
|
|
2463
|
-
executor: new
|
|
2487
|
+
group: (0, import_nestjs_durable_core16.tenantGroup)((0, import_nestjs_durable_core16.sanitizeQueueToken)(meta.name), this.inAppWorker.partition),
|
|
2488
|
+
executor: new import_nestjs_durable_core16.RemoteWorkflowExecutor(this.inAppWorker.transport, meta.name, this.inAppWorker.partition)
|
|
2464
2489
|
} : {}
|
|
2465
2490
|
});
|
|
2466
|
-
(0,
|
|
2491
|
+
(0, import_nestjs_durable_core16.bindWorkflowClass)(workflowCtor, {
|
|
2467
2492
|
start: /* @__PURE__ */ __name((name, input, runId, opts) => this.engine.start(name, input, runId, opts), "start"),
|
|
2468
2493
|
waitForRun: /* @__PURE__ */ __name((runId, opts) => this.engine.waitForRun(runId, opts), "waitForRun")
|
|
2469
2494
|
});
|
|
@@ -2478,7 +2503,7 @@ var WorkflowRegistrar = class {
|
|
|
2478
2503
|
});
|
|
2479
2504
|
deadLetterByWorkflow.set(meta.name, dlqName);
|
|
2480
2505
|
} else if (meta.deadLetterWorkflow) {
|
|
2481
|
-
deadLetterByWorkflow.set(meta.name, (0,
|
|
2506
|
+
deadLetterByWorkflow.set(meta.name, (0, import_nestjs_durable_core16.workflowName)(meta.deadLetterWorkflow));
|
|
2482
2507
|
}
|
|
2483
2508
|
});
|
|
2484
2509
|
this.reportUnattributed(unattributed);
|
|
@@ -2526,7 +2551,7 @@ var WorkflowRegistrar = class {
|
|
|
2526
2551
|
* a `dlq:<runId>` id, so re-recovery never double-dispatches.
|
|
2527
2552
|
*/
|
|
2528
2553
|
installDeadLetterRouting(byWorkflow) {
|
|
2529
|
-
const fallback = this.options.deadLetterWorkflow ? (0,
|
|
2554
|
+
const fallback = this.options.deadLetterWorkflow ? (0, import_nestjs_durable_core16.workflowName)(this.options.deadLetterWorkflow) : void 0;
|
|
2530
2555
|
if (byWorkflow.size === 0 && !fallback) return;
|
|
2531
2556
|
this.engine.onDead((run) => {
|
|
2532
2557
|
const target = byWorkflow.get(run.workflow) ?? fallback;
|
|
@@ -2551,14 +2576,14 @@ var WorkflowRegistrar = class {
|
|
|
2551
2576
|
};
|
|
2552
2577
|
WorkflowRegistrar = _ts_decorate10([
|
|
2553
2578
|
(0, import_common10.Injectable)(),
|
|
2554
|
-
_ts_param7(3, (0, import_common10.Inject)(
|
|
2555
|
-
_ts_param7(4, (0, import_common10.Inject)(
|
|
2579
|
+
_ts_param7(3, (0, import_common10.Inject)(import_nestjs_durable_core16.STATE_STORE_CANONICAL)),
|
|
2580
|
+
_ts_param7(4, (0, import_common10.Inject)(import_nestjs_durable_core16.DURABLE_OPTIONS_CANONICAL)),
|
|
2556
2581
|
_ts_param7(5, (0, import_common10.Inject)(IN_APP_WORKER_BINDING)),
|
|
2557
2582
|
_ts_metadata10("design:type", Function),
|
|
2558
2583
|
_ts_metadata10("design:paramtypes", [
|
|
2559
2584
|
typeof import_core4.DiscoveryService === "undefined" ? Object : import_core4.DiscoveryService,
|
|
2560
2585
|
typeof import_core4.MetadataScanner === "undefined" ? Object : import_core4.MetadataScanner,
|
|
2561
|
-
typeof
|
|
2586
|
+
typeof import_nestjs_durable_core16.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core16.WorkflowEngine,
|
|
2562
2587
|
Object,
|
|
2563
2588
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
|
|
2564
2589
|
Object
|
|
@@ -2567,7 +2592,7 @@ WorkflowRegistrar = _ts_decorate10([
|
|
|
2567
2592
|
|
|
2568
2593
|
// src/workflow.service.ts
|
|
2569
2594
|
var import_node_crypto = require("crypto");
|
|
2570
|
-
var
|
|
2595
|
+
var import_nestjs_durable_core17 = require("@dudousxd/nestjs-durable-core");
|
|
2571
2596
|
var import_common11 = require("@nestjs/common");
|
|
2572
2597
|
function _ts_decorate11(decorators, target, key, desc) {
|
|
2573
2598
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2638,7 +2663,7 @@ WorkflowService = _ts_decorate11([
|
|
|
2638
2663
|
(0, import_common11.Injectable)(),
|
|
2639
2664
|
_ts_metadata11("design:type", Function),
|
|
2640
2665
|
_ts_metadata11("design:paramtypes", [
|
|
2641
|
-
typeof
|
|
2666
|
+
typeof import_nestjs_durable_core17.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core17.WorkflowEngine
|
|
2642
2667
|
])
|
|
2643
2668
|
], WorkflowService);
|
|
2644
2669
|
|
|
@@ -2835,7 +2860,15 @@ var RunGatewayBootstrap = class RunGatewayBootstrap2 {
|
|
|
2835
2860
|
onRunRequest: onRunRequest.bind(this.transport),
|
|
2836
2861
|
publishRunReply: publishRunReply.bind(this.transport)
|
|
2837
2862
|
};
|
|
2838
|
-
new RunRequestResponder(runRequestTransport, this.gateway
|
|
2863
|
+
new RunRequestResponder(runRequestTransport, this.gateway, {
|
|
2864
|
+
verifyTenant: this.options.verifyTenant,
|
|
2865
|
+
// Mirrors Agora's rule (`warnWithoutVerifier: role === 'control-plane'`): only a deployment
|
|
2866
|
+
// that EXPLICITLY names itself the control plane is told it runs without tenant auth. A plain
|
|
2867
|
+
// operator (role inferred from `store`) is Agora's `standalone`: anyone with broker access
|
|
2868
|
+
// can already enqueue steps and results there, so the warning would be noise on every boot
|
|
2869
|
+
// of an app that never serves tenants.
|
|
2870
|
+
warnWithoutVerifier: this.options.topology?.role === "control-plane"
|
|
2871
|
+
}).start();
|
|
2839
2872
|
}
|
|
2840
2873
|
if (typeof publishTenantEvent === "function") {
|
|
2841
2874
|
const republisher = new TenantEventRepublisher(store, publishTenantEvent.bind(this.transport));
|
|
@@ -2850,14 +2883,14 @@ var RunGatewayBootstrap = class RunGatewayBootstrap2 {
|
|
|
2850
2883
|
};
|
|
2851
2884
|
RunGatewayBootstrap = _ts_decorate12([
|
|
2852
2885
|
(0, import_common12.Injectable)(),
|
|
2853
|
-
_ts_param8(1, (0, import_common12.Inject)(
|
|
2854
|
-
_ts_param8(3, (0, import_common12.Inject)(
|
|
2855
|
-
_ts_param8(4, (0, import_common12.Inject)(
|
|
2886
|
+
_ts_param8(1, (0, import_common12.Inject)(import_nestjs_durable_core18.TRANSPORT_CANONICAL)),
|
|
2887
|
+
_ts_param8(3, (0, import_common12.Inject)(import_nestjs_durable_core18.STATE_STORE_CANONICAL)),
|
|
2888
|
+
_ts_param8(4, (0, import_common12.Inject)(import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL)),
|
|
2856
2889
|
_ts_metadata12("design:type", Function),
|
|
2857
2890
|
_ts_metadata12("design:paramtypes", [
|
|
2858
|
-
typeof
|
|
2891
|
+
typeof import_nestjs_durable_core18.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core18.WorkflowEngine,
|
|
2859
2892
|
Object,
|
|
2860
|
-
typeof
|
|
2893
|
+
typeof import_nestjs_durable_core18.RunGateway === "undefined" ? Object : import_nestjs_durable_core18.RunGateway,
|
|
2861
2894
|
Object,
|
|
2862
2895
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
|
|
2863
2896
|
])
|
|
@@ -2869,13 +2902,13 @@ var DurableModule = class _DurableModule {
|
|
|
2869
2902
|
static forRoot(options) {
|
|
2870
2903
|
_DurableModule.assertValid(options);
|
|
2871
2904
|
return _DurableModule.build({
|
|
2872
|
-
provide:
|
|
2905
|
+
provide: import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL,
|
|
2873
2906
|
useValue: resolveTopology(options)
|
|
2874
2907
|
});
|
|
2875
2908
|
}
|
|
2876
2909
|
static forRootAsync(options) {
|
|
2877
2910
|
return _DurableModule.build({
|
|
2878
|
-
provide:
|
|
2911
|
+
provide: import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL,
|
|
2879
2912
|
useFactory: /* @__PURE__ */ __name(async (...args) => {
|
|
2880
2913
|
const resolved = await options.useFactory(...args);
|
|
2881
2914
|
_DurableModule.assertValid(resolved);
|
|
@@ -2908,41 +2941,41 @@ var DurableModule = class _DurableModule {
|
|
|
2908
2941
|
providers: [
|
|
2909
2942
|
optionsProvider,
|
|
2910
2943
|
{
|
|
2911
|
-
provide:
|
|
2944
|
+
provide: import_nestjs_durable_core18.STATE_STORE_CANONICAL,
|
|
2912
2945
|
useFactory: /* @__PURE__ */ __name((options) => options.store !== void 0 ? scopedStore(options.store, options) : null, "useFactory"),
|
|
2913
2946
|
inject: [
|
|
2914
|
-
|
|
2947
|
+
import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL
|
|
2915
2948
|
]
|
|
2916
2949
|
},
|
|
2917
2950
|
{
|
|
2918
|
-
provide:
|
|
2951
|
+
provide: import_nestjs_durable_core18.TRANSPORT_CANONICAL,
|
|
2919
2952
|
// With a POOL (`transports`) and no singular `transport`, the canonical transport is the
|
|
2920
2953
|
// pool's PRIMARY — the same one the engine dispatches on first. Leaving it null starved
|
|
2921
2954
|
// the step registrar / in-app worker of a transport, so a pool-configured operator
|
|
2922
2955
|
// registered NO step handlers and its own steps parked in `wait` with no consumer.
|
|
2923
2956
|
useFactory: /* @__PURE__ */ __name((options) => options.transport ?? options.transports?.[0]?.transport ?? null, "useFactory"),
|
|
2924
2957
|
inject: [
|
|
2925
|
-
|
|
2958
|
+
import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL
|
|
2926
2959
|
]
|
|
2927
2960
|
},
|
|
2928
2961
|
// Legacy back-compat aliases (deprecated tokens still resolve to the same instances):
|
|
2929
2962
|
{
|
|
2930
|
-
provide:
|
|
2931
|
-
useExisting:
|
|
2963
|
+
provide: import_nestjs_durable_core18.STATE_STORE,
|
|
2964
|
+
useExisting: import_nestjs_durable_core18.STATE_STORE_CANONICAL
|
|
2932
2965
|
},
|
|
2933
2966
|
{
|
|
2934
|
-
provide:
|
|
2935
|
-
useExisting:
|
|
2967
|
+
provide: import_nestjs_durable_core18.TRANSPORT,
|
|
2968
|
+
useExisting: import_nestjs_durable_core18.TRANSPORT_CANONICAL
|
|
2936
2969
|
},
|
|
2937
2970
|
{
|
|
2938
|
-
provide:
|
|
2939
|
-
useExisting:
|
|
2971
|
+
provide: import_nestjs_durable_core18.DURABLE_OPTIONS,
|
|
2972
|
+
useExisting: import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL
|
|
2940
2973
|
},
|
|
2941
2974
|
{
|
|
2942
2975
|
// Shared token, bound EXACTLY once: a real engine for the operator role, or a store-less
|
|
2943
2976
|
// `DurableStartClient` facade for a thin worker (no `store`) — either way, `WorkflowService`
|
|
2944
2977
|
// and app code call `engine.start(...)` unchanged.
|
|
2945
|
-
provide:
|
|
2978
|
+
provide: import_nestjs_durable_core18.WorkflowEngine,
|
|
2946
2979
|
useFactory: /* @__PURE__ */ __name(async (options, store, transport, moduleRef) => {
|
|
2947
2980
|
if (options.store === void 0) {
|
|
2948
2981
|
return new DurableStartClient(options);
|
|
@@ -2963,7 +2996,7 @@ var DurableModule = class _DurableModule {
|
|
|
2963
2996
|
if (t) deferTransportConsumers(t);
|
|
2964
2997
|
}
|
|
2965
2998
|
}
|
|
2966
|
-
const engine = new
|
|
2999
|
+
const engine = new import_nestjs_durable_core18.WorkflowEngine({
|
|
2967
3000
|
store,
|
|
2968
3001
|
transport: transport ?? void 0,
|
|
2969
3002
|
transports: options.transports,
|
|
@@ -2987,6 +3020,7 @@ var DurableModule = class _DurableModule {
|
|
|
2987
3020
|
context,
|
|
2988
3021
|
rehydrate: rehydrate || void 0,
|
|
2989
3022
|
compensationRetries: options.compensationRetries,
|
|
3023
|
+
verifyTenant: options.verifyTenant,
|
|
2990
3024
|
// A non-driving (dashboard/API) operator must not run workflows: enqueue-only, leaving
|
|
2991
3025
|
// each `pending` run in the store for a DRIVING instance's poll. A driving operator gets
|
|
2992
3026
|
// the engine's default in-process dispatcher: for a body registered inline, it runs
|
|
@@ -3003,9 +3037,9 @@ var DurableModule = class _DurableModule {
|
|
|
3003
3037
|
return engine;
|
|
3004
3038
|
}, "useFactory"),
|
|
3005
3039
|
inject: [
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3040
|
+
import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL,
|
|
3041
|
+
import_nestjs_durable_core18.STATE_STORE_CANONICAL,
|
|
3042
|
+
import_nestjs_durable_core18.TRANSPORT_CANONICAL,
|
|
3009
3043
|
import_core5.ModuleRef
|
|
3010
3044
|
]
|
|
3011
3045
|
},
|
|
@@ -3019,7 +3053,7 @@ var DurableModule = class _DurableModule {
|
|
|
3019
3053
|
// or (for a thin worker, no `store`) a `ProxyRunGateway` over `transport` when given, else a
|
|
3020
3054
|
// gateway whose every method rejects with a clear tenant error.
|
|
3021
3055
|
{
|
|
3022
|
-
provide:
|
|
3056
|
+
provide: import_nestjs_durable_core18.RunGateway,
|
|
3023
3057
|
useFactory: /* @__PURE__ */ __name((options, store, engine) => {
|
|
3024
3058
|
if (options.store !== void 0) {
|
|
3025
3059
|
if (!store) {
|
|
@@ -3027,12 +3061,12 @@ var DurableModule = class _DurableModule {
|
|
|
3027
3061
|
}
|
|
3028
3062
|
return new StoreRunGateway(store, engine);
|
|
3029
3063
|
}
|
|
3030
|
-
return options.transport ? new ProxyRunGateway(options.transport, options.partition ?? "default", options.runGatewayTimeoutMs) : unavailableRunGateway();
|
|
3064
|
+
return options.transport ? new ProxyRunGateway(options.transport, options.partition ?? "default", options.runGatewayTimeoutMs, void 0, options.tenantToken) : unavailableRunGateway();
|
|
3031
3065
|
}, "useFactory"),
|
|
3032
3066
|
inject: [
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3067
|
+
import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL,
|
|
3068
|
+
import_nestjs_durable_core18.STATE_STORE_CANONICAL,
|
|
3069
|
+
import_nestjs_durable_core18.WorkflowEngine
|
|
3036
3070
|
]
|
|
3037
3071
|
},
|
|
3038
3072
|
RunGatewayBootstrap,
|
|
@@ -3046,13 +3080,13 @@ var DurableModule = class _DurableModule {
|
|
|
3046
3080
|
exports: [
|
|
3047
3081
|
WorkflowService,
|
|
3048
3082
|
EntityService,
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3083
|
+
import_nestjs_durable_core18.WorkflowEngine,
|
|
3084
|
+
import_nestjs_durable_core18.STATE_STORE,
|
|
3085
|
+
import_nestjs_durable_core18.STATE_STORE_CANONICAL,
|
|
3086
|
+
import_nestjs_durable_core18.TRANSPORT,
|
|
3087
|
+
import_nestjs_durable_core18.TRANSPORT_CANONICAL,
|
|
3088
|
+
import_nestjs_durable_core18.DURABLE_OPTIONS_CANONICAL,
|
|
3089
|
+
import_nestjs_durable_core18.RunGateway
|
|
3056
3090
|
]
|
|
3057
3091
|
};
|
|
3058
3092
|
}
|
|
@@ -3062,7 +3096,7 @@ DurableModule = _ts_decorate12([
|
|
|
3062
3096
|
], DurableModule);
|
|
3063
3097
|
|
|
3064
3098
|
// src/index.ts
|
|
3065
|
-
var
|
|
3099
|
+
var import_nestjs_durable_core19 = require("@dudousxd/nestjs-durable-core");
|
|
3066
3100
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3067
3101
|
0 && (module.exports = {
|
|
3068
3102
|
CONTEXT_ACCESSOR,
|
|
@@ -3113,13 +3147,19 @@ var import_nestjs_durable_core18 = require("@dudousxd/nestjs-durable-core");
|
|
|
3113
3147
|
getEntityMeta,
|
|
3114
3148
|
getOnEvents,
|
|
3115
3149
|
getWorkflowMeta,
|
|
3150
|
+
hmacTenantVerifier,
|
|
3116
3151
|
inAppWorkerProviders,
|
|
3117
3152
|
isDeadLetterHandler,
|
|
3118
3153
|
isDrivingOperator,
|
|
3119
3154
|
isOperatorRole,
|
|
3120
3155
|
isStepInterceptor,
|
|
3121
3156
|
onErrorCodesOf,
|
|
3157
|
+
prevCronFireMs,
|
|
3122
3158
|
readSearchAttributes,
|
|
3159
|
+
runSchedules,
|
|
3160
|
+
scheduleRunIdAt,
|
|
3161
|
+
scheduledRunId,
|
|
3162
|
+
signTenantToken,
|
|
3123
3163
|
thinWorkerProviders,
|
|
3124
3164
|
unavailableRunGateway
|
|
3125
3165
|
});
|