@dudousxd/nestjs-durable 0.32.0 → 0.34.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 +101 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -3
- package/dist/index.d.ts +69 -3
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -56,8 +56,9 @@ __export(index_exports, {
|
|
|
56
56
|
ThinWorkflowRegistrar: () => ThinWorkflowRegistrar,
|
|
57
57
|
WORKFLOW_METADATA: () => WORKFLOW_METADATA,
|
|
58
58
|
Workflow: () => Workflow,
|
|
59
|
-
WorkflowEngine: () =>
|
|
59
|
+
WorkflowEngine: () => import_nestjs_durable_core14.WorkflowEngine,
|
|
60
60
|
WorkflowService: () => WorkflowService,
|
|
61
|
+
attributesOf: () => attributesOf,
|
|
61
62
|
entityConfigFor: () => entityConfigFor,
|
|
62
63
|
getDurableStepMeta: () => getDurableStepMeta,
|
|
63
64
|
getEntityMeta: () => getEntityMeta,
|
|
@@ -68,11 +69,15 @@ __export(index_exports, {
|
|
|
68
69
|
isDrivingOperator: () => isDrivingOperator,
|
|
69
70
|
isOperatorRole: () => isOperatorRole,
|
|
70
71
|
isStepInterceptor: () => isStepInterceptor,
|
|
72
|
+
readSearchAttributes: () => import_nestjs_durable_core14.readSearchAttributes,
|
|
71
73
|
thinWorkerProviders: () => thinWorkerProviders,
|
|
72
74
|
unavailableRunGateway: () => unavailableRunGateway
|
|
73
75
|
});
|
|
74
76
|
module.exports = __toCommonJS(index_exports);
|
|
75
77
|
|
|
78
|
+
// src/attributes-of.ts
|
|
79
|
+
var import_nestjs_durable_core2 = require("@dudousxd/nestjs-durable-core");
|
|
80
|
+
|
|
76
81
|
// src/decorators.ts
|
|
77
82
|
var import_nestjs_durable_core = require("@dudousxd/nestjs-durable-core");
|
|
78
83
|
var import_reflect_metadata = require("reflect-metadata");
|
|
@@ -180,9 +185,22 @@ function getOnEvents(meta, target) {
|
|
|
180
185
|
}
|
|
181
186
|
__name(getOnEvents, "getOnEvents");
|
|
182
187
|
|
|
188
|
+
// src/attributes-of.ts
|
|
189
|
+
function attributesOf(workflow, run) {
|
|
190
|
+
const meta = getWorkflowMeta(workflow);
|
|
191
|
+
if (!meta) {
|
|
192
|
+
throw new Error(`attributesOf: ${workflow.name} is not a @Workflow class \u2014 is it decorated with @Workflow({ name, searchAttributes })?`);
|
|
193
|
+
}
|
|
194
|
+
if (!meta.searchAttributes) {
|
|
195
|
+
throw new Error(`attributesOf: workflow '${meta.name}' declares no searchAttributes schema \u2014 reading attributes by class requires the workflow to declare its schema: @Workflow({ name: '${meta.name}', searchAttributes: mySchema }).`);
|
|
196
|
+
}
|
|
197
|
+
return (0, import_nestjs_durable_core2.readSearchAttributes)(meta.searchAttributes, run);
|
|
198
|
+
}
|
|
199
|
+
__name(attributesOf, "attributesOf");
|
|
200
|
+
|
|
183
201
|
// src/durable-start-client.ts
|
|
184
202
|
var import_durable_worker = require("@dudousxd/durable-worker");
|
|
185
|
-
var
|
|
203
|
+
var import_nestjs_durable_core3 = require("@dudousxd/nestjs-durable-core");
|
|
186
204
|
var import_common = require("@nestjs/common");
|
|
187
205
|
function _ts_decorate(decorators, target, key, desc) {
|
|
188
206
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -208,7 +226,7 @@ var DurableStartClient = class {
|
|
|
208
226
|
this.tenant = options.partition ?? "default";
|
|
209
227
|
}
|
|
210
228
|
async start(workflow, input, runId = globalThis.crypto.randomUUID(), opts) {
|
|
211
|
-
const name = (0,
|
|
229
|
+
const name = (0, import_nestjs_durable_core3.workflowName)(workflow);
|
|
212
230
|
await (0, import_durable_worker.startRun)(this.options.connection, {
|
|
213
231
|
tenant: this.tenant,
|
|
214
232
|
workflow: name,
|
|
@@ -277,7 +295,7 @@ __name(tenantUnsupported, "tenantUnsupported");
|
|
|
277
295
|
|
|
278
296
|
// src/durable-worker.module.ts
|
|
279
297
|
var import_durable_worker2 = require("@dudousxd/durable-worker");
|
|
280
|
-
var
|
|
298
|
+
var import_nestjs_durable_core4 = require("@dudousxd/nestjs-durable-core");
|
|
281
299
|
var import_common2 = require("@nestjs/common");
|
|
282
300
|
var import_core = require("@nestjs/core");
|
|
283
301
|
|
|
@@ -361,7 +379,7 @@ var ThinWorkflowRegistrar = class {
|
|
|
361
379
|
};
|
|
362
380
|
ThinWorkflowRegistrar = _ts_decorate2([
|
|
363
381
|
(0, import_common2.Injectable)(),
|
|
364
|
-
_ts_param(2, (0, import_common2.Inject)(
|
|
382
|
+
_ts_param(2, (0, import_common2.Inject)(import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL)),
|
|
365
383
|
_ts_metadata2("design:type", Function),
|
|
366
384
|
_ts_metadata2("design:paramtypes", [
|
|
367
385
|
typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
|
|
@@ -390,7 +408,7 @@ var ThinStepRegistrar = class {
|
|
|
390
408
|
};
|
|
391
409
|
ThinStepRegistrar = _ts_decorate2([
|
|
392
410
|
(0, import_common2.Injectable)(),
|
|
393
|
-
_ts_param(3, (0, import_common2.Inject)(
|
|
411
|
+
_ts_param(3, (0, import_common2.Inject)(import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL)),
|
|
394
412
|
_ts_metadata2("design:type", Function),
|
|
395
413
|
_ts_metadata2("design:paramtypes", [
|
|
396
414
|
typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
|
|
@@ -442,7 +460,7 @@ var ThinWorkerBootstrap = class {
|
|
|
442
460
|
};
|
|
443
461
|
ThinWorkerBootstrap = _ts_decorate2([
|
|
444
462
|
(0, import_common2.Injectable)(),
|
|
445
|
-
_ts_param(1, (0, import_common2.Inject)(
|
|
463
|
+
_ts_param(1, (0, import_common2.Inject)(import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL)),
|
|
446
464
|
_ts_param(2, (0, import_common2.Inject)(RUN_REDIS_WORKER)),
|
|
447
465
|
_ts_param(3, (0, import_common2.Inject)(DURABLE_WORKER_RUNNERS)),
|
|
448
466
|
_ts_metadata2("design:type", Function),
|
|
@@ -468,7 +486,7 @@ function thinWorkerProviders() {
|
|
|
468
486
|
workflowGroup: options.partition ?? ""
|
|
469
487
|
}), "useFactory"),
|
|
470
488
|
inject: [
|
|
471
|
-
|
|
489
|
+
import_nestjs_durable_core4.DURABLE_OPTIONS_CANONICAL
|
|
472
490
|
]
|
|
473
491
|
},
|
|
474
492
|
{
|
|
@@ -532,12 +550,12 @@ function unavailableRunGateway() {
|
|
|
532
550
|
__name(unavailableRunGateway, "unavailableRunGateway");
|
|
533
551
|
|
|
534
552
|
// src/durable.module.ts
|
|
535
|
-
var
|
|
553
|
+
var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
|
|
536
554
|
var import_common12 = require("@nestjs/common");
|
|
537
555
|
var import_core5 = require("@nestjs/core");
|
|
538
556
|
|
|
539
557
|
// src/durable-step.registrar.ts
|
|
540
|
-
var
|
|
558
|
+
var import_nestjs_durable_core5 = require("@dudousxd/nestjs-durable-core");
|
|
541
559
|
var import_common3 = require("@nestjs/common");
|
|
542
560
|
var import_core2 = require("@nestjs/core");
|
|
543
561
|
|
|
@@ -596,8 +614,8 @@ var DurableStepRegistrar = class {
|
|
|
596
614
|
};
|
|
597
615
|
DurableStepRegistrar = _ts_decorate3([
|
|
598
616
|
(0, import_common3.Injectable)(),
|
|
599
|
-
_ts_param2(2, (0, import_common3.Inject)(
|
|
600
|
-
_ts_param2(3, (0, import_common3.Inject)(
|
|
617
|
+
_ts_param2(2, (0, import_common3.Inject)(import_nestjs_durable_core5.TRANSPORT_CANONICAL)),
|
|
618
|
+
_ts_param2(3, (0, import_common3.Inject)(import_nestjs_durable_core5.DURABLE_OPTIONS_CANONICAL)),
|
|
601
619
|
_ts_metadata3("design:type", Function),
|
|
602
620
|
_ts_metadata3("design:paramtypes", [
|
|
603
621
|
typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
|
|
@@ -608,7 +626,7 @@ DurableStepRegistrar = _ts_decorate3([
|
|
|
608
626
|
], DurableStepRegistrar);
|
|
609
627
|
|
|
610
628
|
// src/entity.ts
|
|
611
|
-
var
|
|
629
|
+
var import_nestjs_durable_core6 = require("@dudousxd/nestjs-durable-core");
|
|
612
630
|
var import_common4 = require("@nestjs/common");
|
|
613
631
|
var import_reflect_metadata2 = require("reflect-metadata");
|
|
614
632
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
@@ -682,13 +700,13 @@ EntityService = _ts_decorate4([
|
|
|
682
700
|
(0, import_common4.Injectable)(),
|
|
683
701
|
_ts_metadata4("design:type", Function),
|
|
684
702
|
_ts_metadata4("design:paramtypes", [
|
|
685
|
-
typeof
|
|
703
|
+
typeof import_nestjs_durable_core6.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core6.WorkflowEngine
|
|
686
704
|
])
|
|
687
705
|
], EntityService);
|
|
688
706
|
|
|
689
707
|
// src/in-app-worker.ts
|
|
690
708
|
var import_durable_worker3 = require("@dudousxd/durable-worker");
|
|
691
|
-
var
|
|
709
|
+
var import_nestjs_durable_core7 = require("@dudousxd/nestjs-durable-core");
|
|
692
710
|
var import_common5 = require("@nestjs/common");
|
|
693
711
|
var import_core3 = require("@nestjs/core");
|
|
694
712
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
@@ -781,7 +799,7 @@ var InAppWorkerBootstrap = class {
|
|
|
781
799
|
};
|
|
782
800
|
InAppWorkerBootstrap = _ts_decorate5([
|
|
783
801
|
(0, import_common5.Injectable)(),
|
|
784
|
-
_ts_param3(2, (0, import_common5.Inject)(
|
|
802
|
+
_ts_param3(2, (0, import_common5.Inject)(import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL)),
|
|
785
803
|
_ts_param3(3, (0, import_common5.Inject)(IN_APP_WORKER_RUNTIME)),
|
|
786
804
|
_ts_param3(4, (0, import_common5.Inject)(IN_APP_RUN_REDIS_WORKER)),
|
|
787
805
|
_ts_param3(5, (0, import_common5.Inject)(IN_APP_WORKER_RUNNERS)),
|
|
@@ -801,8 +819,8 @@ function inAppWorkerProviders() {
|
|
|
801
819
|
provide: IN_APP_WORKER_BINDING,
|
|
802
820
|
useFactory: /* @__PURE__ */ __name((transport, options) => inAppWorkerBinding(transport, options), "useFactory"),
|
|
803
821
|
inject: [
|
|
804
|
-
|
|
805
|
-
|
|
822
|
+
import_nestjs_durable_core7.TRANSPORT_CANONICAL,
|
|
823
|
+
import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL
|
|
806
824
|
]
|
|
807
825
|
},
|
|
808
826
|
{
|
|
@@ -818,7 +836,7 @@ function inAppWorkerProviders() {
|
|
|
818
836
|
workflowGroup: options.partition ?? ""
|
|
819
837
|
}), "useFactory"),
|
|
820
838
|
inject: [
|
|
821
|
-
|
|
839
|
+
import_nestjs_durable_core7.DURABLE_OPTIONS_CANONICAL
|
|
822
840
|
]
|
|
823
841
|
},
|
|
824
842
|
{
|
|
@@ -985,7 +1003,7 @@ ProxyRunGateway = _ts_decorate6([
|
|
|
985
1003
|
], ProxyRunGateway);
|
|
986
1004
|
|
|
987
1005
|
// src/retention-poller.ts
|
|
988
|
-
var
|
|
1006
|
+
var import_nestjs_durable_core8 = require("@dudousxd/nestjs-durable-core");
|
|
989
1007
|
var import_common7 = require("@nestjs/common");
|
|
990
1008
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
991
1009
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1016,10 +1034,10 @@ function validateRetention(retention) {
|
|
|
1016
1034
|
if (policy.maxAge == null && policy.maxCount == null) {
|
|
1017
1035
|
throw new Error("durable retention: each policy must set maxAge and/or maxCount");
|
|
1018
1036
|
}
|
|
1019
|
-
if (policy.maxAge != null) (0,
|
|
1037
|
+
if (policy.maxAge != null) (0, import_nestjs_durable_core8.parseDuration)(policy.maxAge);
|
|
1020
1038
|
for (const status of policy.statuses) {
|
|
1021
|
-
if (!
|
|
1022
|
-
throw new Error(`durable retention: status "${status}" is not terminal; only ${
|
|
1039
|
+
if (!import_nestjs_durable_core8.TERMINAL_RUN_STATUSES.includes(status)) {
|
|
1040
|
+
throw new Error(`durable retention: status "${status}" is not terminal; only ${import_nestjs_durable_core8.TERMINAL_RUN_STATUSES.join(", ")} can be pruned`);
|
|
1023
1041
|
}
|
|
1024
1042
|
if (seen.has(status)) {
|
|
1025
1043
|
throw new Error(`durable retention: status "${status}" appears in more than one policy; status sets must be disjoint`);
|
|
@@ -1058,7 +1076,7 @@ var RetentionPoller = class {
|
|
|
1058
1076
|
return;
|
|
1059
1077
|
}
|
|
1060
1078
|
await this.sweep();
|
|
1061
|
-
const intervalMs = retention.sweepInterval != null ? (0,
|
|
1079
|
+
const intervalMs = retention.sweepInterval != null ? (0, import_nestjs_durable_core8.parseDuration)(retention.sweepInterval) : DEFAULT_SWEEP_INTERVAL_MS;
|
|
1062
1080
|
if (intervalMs > 0) {
|
|
1063
1081
|
this.timer = setInterval(() => void this.sweep(), intervalMs);
|
|
1064
1082
|
this.timer.unref?.();
|
|
@@ -1090,8 +1108,8 @@ var RetentionPoller = class {
|
|
|
1090
1108
|
};
|
|
1091
1109
|
RetentionPoller = _ts_decorate7([
|
|
1092
1110
|
(0, import_common7.Injectable)(),
|
|
1093
|
-
_ts_param4(0, (0, import_common7.Inject)(
|
|
1094
|
-
_ts_param4(1, (0, import_common7.Inject)(
|
|
1111
|
+
_ts_param4(0, (0, import_common7.Inject)(import_nestjs_durable_core8.STATE_STORE_CANONICAL)),
|
|
1112
|
+
_ts_param4(1, (0, import_common7.Inject)(import_nestjs_durable_core8.DURABLE_OPTIONS_CANONICAL)),
|
|
1095
1113
|
_ts_metadata7("design:type", Function),
|
|
1096
1114
|
_ts_metadata7("design:paramtypes", [
|
|
1097
1115
|
Object,
|
|
@@ -1225,7 +1243,7 @@ var RunRequestResponder = class {
|
|
|
1225
1243
|
};
|
|
1226
1244
|
|
|
1227
1245
|
// src/store-run-gateway.ts
|
|
1228
|
-
var
|
|
1246
|
+
var import_nestjs_durable_core9 = require("@dudousxd/nestjs-durable-core");
|
|
1229
1247
|
var import_common8 = require("@nestjs/common");
|
|
1230
1248
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
1231
1249
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1274,9 +1292,9 @@ var StoreRunGateway = class {
|
|
|
1274
1292
|
}
|
|
1275
1293
|
async listRuns(query) {
|
|
1276
1294
|
const runs = await this.store.listRuns(query);
|
|
1277
|
-
const waiterByRun = (0,
|
|
1295
|
+
const waiterByRun = (0, import_nestjs_durable_core9.indexWaitersByRun)(await this.store.listSignalWaiters(""));
|
|
1278
1296
|
return runs.map((run) => {
|
|
1279
|
-
const waiting = (0,
|
|
1297
|
+
const waiting = (0, import_nestjs_durable_core9.resolveRunWaiting)(run, waiterByRun);
|
|
1280
1298
|
return waiting ? {
|
|
1281
1299
|
...run,
|
|
1282
1300
|
waiting
|
|
@@ -1304,11 +1322,11 @@ var StoreRunGateway = class {
|
|
|
1304
1322
|
}),
|
|
1305
1323
|
this.store.listSignalWaiters("")
|
|
1306
1324
|
]);
|
|
1307
|
-
const waiterByRun = (0,
|
|
1325
|
+
const waiterByRun = (0, import_nestjs_durable_core9.indexWaitersByRun)(waiters);
|
|
1308
1326
|
const result = {};
|
|
1309
1327
|
for (const run of suspended) {
|
|
1310
1328
|
if (!idSet.has(run.id)) continue;
|
|
1311
|
-
const waiting = (0,
|
|
1329
|
+
const waiting = (0, import_nestjs_durable_core9.resolveRunWaiting)(run, waiterByRun);
|
|
1312
1330
|
if (waiting) result[run.id] = waiting;
|
|
1313
1331
|
}
|
|
1314
1332
|
return result;
|
|
@@ -1342,11 +1360,11 @@ var StoreRunGateway = class {
|
|
|
1342
1360
|
};
|
|
1343
1361
|
StoreRunGateway = _ts_decorate8([
|
|
1344
1362
|
(0, import_common8.Injectable)(),
|
|
1345
|
-
_ts_param5(0, (0, import_common8.Inject)(
|
|
1363
|
+
_ts_param5(0, (0, import_common8.Inject)(import_nestjs_durable_core9.STATE_STORE_CANONICAL)),
|
|
1346
1364
|
_ts_metadata8("design:type", Function),
|
|
1347
1365
|
_ts_metadata8("design:paramtypes", [
|
|
1348
1366
|
typeof StateStore === "undefined" ? Object : StateStore,
|
|
1349
|
-
typeof
|
|
1367
|
+
typeof import_nestjs_durable_core9.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core9.WorkflowEngine
|
|
1350
1368
|
])
|
|
1351
1369
|
], StoreRunGateway);
|
|
1352
1370
|
|
|
@@ -1392,7 +1410,7 @@ var TenantEventRepublisher = class {
|
|
|
1392
1410
|
};
|
|
1393
1411
|
|
|
1394
1412
|
// src/timer-poller.ts
|
|
1395
|
-
var
|
|
1413
|
+
var import_nestjs_durable_core10 = require("@dudousxd/nestjs-durable-core");
|
|
1396
1414
|
var import_common9 = require("@nestjs/common");
|
|
1397
1415
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
1398
1416
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1448,7 +1466,7 @@ var TimerPoller = class {
|
|
|
1448
1466
|
await this.engine.sweepTimeouts();
|
|
1449
1467
|
const schedules = this.options.schedules;
|
|
1450
1468
|
if (schedules && schedules.length > 0) {
|
|
1451
|
-
await (0,
|
|
1469
|
+
await (0, import_nestjs_durable_core10.runSchedules)(this.engine, schedules, Date.now());
|
|
1452
1470
|
}
|
|
1453
1471
|
} finally {
|
|
1454
1472
|
this.polling = false;
|
|
@@ -1457,10 +1475,10 @@ var TimerPoller = class {
|
|
|
1457
1475
|
};
|
|
1458
1476
|
TimerPoller = _ts_decorate9([
|
|
1459
1477
|
(0, import_common9.Injectable)(),
|
|
1460
|
-
_ts_param6(1, (0, import_common9.Inject)(
|
|
1478
|
+
_ts_param6(1, (0, import_common9.Inject)(import_nestjs_durable_core10.DURABLE_OPTIONS_CANONICAL)),
|
|
1461
1479
|
_ts_metadata9("design:type", Function),
|
|
1462
1480
|
_ts_metadata9("design:paramtypes", [
|
|
1463
|
-
typeof
|
|
1481
|
+
typeof import_nestjs_durable_core10.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core10.WorkflowEngine,
|
|
1464
1482
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
|
|
1465
1483
|
])
|
|
1466
1484
|
], TimerPoller);
|
|
@@ -1470,7 +1488,7 @@ var CONTEXT_ACCESSOR = Symbol.for("@dudousxd/nestjs-context:accessor");
|
|
|
1470
1488
|
var RUN_GATEWAY = Symbol.for("nestjs-durable:run-gateway");
|
|
1471
1489
|
|
|
1472
1490
|
// src/workflow.registrar.ts
|
|
1473
|
-
var
|
|
1491
|
+
var import_nestjs_durable_core11 = require("@dudousxd/nestjs-durable-core");
|
|
1474
1492
|
var import_common10 = require("@nestjs/common");
|
|
1475
1493
|
var import_core4 = require("@nestjs/core");
|
|
1476
1494
|
|
|
@@ -1592,11 +1610,11 @@ var WorkflowRegistrar = class {
|
|
|
1592
1610
|
const validateInput = meta.validateInput ?? (meta.inputSchema ? classValidatorInput(meta.inputSchema) : void 0);
|
|
1593
1611
|
const eventBatch = meta.debounce ? {
|
|
1594
1612
|
mode: "debounce",
|
|
1595
|
-
windowMs: (0,
|
|
1613
|
+
windowMs: (0, import_nestjs_durable_core11.parseDuration)(meta.debounce)
|
|
1596
1614
|
} : meta.batch ? {
|
|
1597
1615
|
mode: "batch",
|
|
1598
1616
|
maxSize: meta.batch.maxSize,
|
|
1599
|
-
windowMs: (0,
|
|
1617
|
+
windowMs: (0, import_nestjs_durable_core11.parseDuration)(meta.batch.within)
|
|
1600
1618
|
} : void 0;
|
|
1601
1619
|
const workflowCtor = workflow.constructor;
|
|
1602
1620
|
this.engine.register(meta.name, meta.version, (ctx, input) => workflow.run(ctx, input), {
|
|
@@ -1617,11 +1635,11 @@ var WorkflowRegistrar = class {
|
|
|
1617
1635
|
// so a turn dispatched under the wrong token would never be consumed. Absent → the inline fast
|
|
1618
1636
|
// path (unchanged).
|
|
1619
1637
|
...this.inAppWorker ? {
|
|
1620
|
-
group: (0,
|
|
1621
|
-
executor: new
|
|
1638
|
+
group: (0, import_nestjs_durable_core11.tenantGroup)((0, import_nestjs_durable_core11.sanitizeQueueToken)(meta.name), this.inAppWorker.partition),
|
|
1639
|
+
executor: new import_nestjs_durable_core11.RemoteWorkflowExecutor(this.inAppWorker.transport, meta.name, this.inAppWorker.partition)
|
|
1622
1640
|
} : {}
|
|
1623
1641
|
});
|
|
1624
|
-
(0,
|
|
1642
|
+
(0, import_nestjs_durable_core11.bindWorkflowClass)(workflowCtor, {
|
|
1625
1643
|
start: /* @__PURE__ */ __name((name, input, runId, opts) => this.engine.start(name, input, runId, opts), "start"),
|
|
1626
1644
|
waitForRun: /* @__PURE__ */ __name((runId, opts) => this.engine.waitForRun(runId, opts), "waitForRun")
|
|
1627
1645
|
});
|
|
@@ -1634,7 +1652,7 @@ var WorkflowRegistrar = class {
|
|
|
1634
1652
|
this.engine.register(dlqName, meta.version, inline);
|
|
1635
1653
|
deadLetterByWorkflow.set(meta.name, dlqName);
|
|
1636
1654
|
} else if (meta.deadLetterWorkflow) {
|
|
1637
|
-
deadLetterByWorkflow.set(meta.name, (0,
|
|
1655
|
+
deadLetterByWorkflow.set(meta.name, (0, import_nestjs_durable_core11.workflowName)(meta.deadLetterWorkflow));
|
|
1638
1656
|
}
|
|
1639
1657
|
});
|
|
1640
1658
|
this.installDeadLetterRouting(deadLetterByWorkflow);
|
|
@@ -1656,7 +1674,7 @@ var WorkflowRegistrar = class {
|
|
|
1656
1674
|
* a `dlq:<runId>` id, so re-recovery never double-dispatches.
|
|
1657
1675
|
*/
|
|
1658
1676
|
installDeadLetterRouting(byWorkflow) {
|
|
1659
|
-
const fallback = this.options.deadLetterWorkflow ? (0,
|
|
1677
|
+
const fallback = this.options.deadLetterWorkflow ? (0, import_nestjs_durable_core11.workflowName)(this.options.deadLetterWorkflow) : void 0;
|
|
1660
1678
|
if (byWorkflow.size === 0 && !fallback) return;
|
|
1661
1679
|
this.engine.onDead((run) => {
|
|
1662
1680
|
const target = byWorkflow.get(run.workflow) ?? fallback;
|
|
@@ -1681,14 +1699,14 @@ var WorkflowRegistrar = class {
|
|
|
1681
1699
|
};
|
|
1682
1700
|
WorkflowRegistrar = _ts_decorate10([
|
|
1683
1701
|
(0, import_common10.Injectable)(),
|
|
1684
|
-
_ts_param7(3, (0, import_common10.Inject)(
|
|
1685
|
-
_ts_param7(4, (0, import_common10.Inject)(
|
|
1702
|
+
_ts_param7(3, (0, import_common10.Inject)(import_nestjs_durable_core11.STATE_STORE_CANONICAL)),
|
|
1703
|
+
_ts_param7(4, (0, import_common10.Inject)(import_nestjs_durable_core11.DURABLE_OPTIONS_CANONICAL)),
|
|
1686
1704
|
_ts_param7(5, (0, import_common10.Inject)(IN_APP_WORKER_BINDING)),
|
|
1687
1705
|
_ts_metadata10("design:type", Function),
|
|
1688
1706
|
_ts_metadata10("design:paramtypes", [
|
|
1689
1707
|
typeof import_core4.DiscoveryService === "undefined" ? Object : import_core4.DiscoveryService,
|
|
1690
1708
|
typeof import_core4.MetadataScanner === "undefined" ? Object : import_core4.MetadataScanner,
|
|
1691
|
-
typeof
|
|
1709
|
+
typeof import_nestjs_durable_core11.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core11.WorkflowEngine,
|
|
1692
1710
|
Object,
|
|
1693
1711
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
|
|
1694
1712
|
Object
|
|
@@ -1697,7 +1715,7 @@ WorkflowRegistrar = _ts_decorate10([
|
|
|
1697
1715
|
|
|
1698
1716
|
// src/workflow.service.ts
|
|
1699
1717
|
var import_node_crypto = require("crypto");
|
|
1700
|
-
var
|
|
1718
|
+
var import_nestjs_durable_core12 = require("@dudousxd/nestjs-durable-core");
|
|
1701
1719
|
var import_common11 = require("@nestjs/common");
|
|
1702
1720
|
function _ts_decorate11(decorators, target, key, desc) {
|
|
1703
1721
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1753,7 +1771,7 @@ WorkflowService = _ts_decorate11([
|
|
|
1753
1771
|
(0, import_common11.Injectable)(),
|
|
1754
1772
|
_ts_metadata11("design:type", Function),
|
|
1755
1773
|
_ts_metadata11("design:paramtypes", [
|
|
1756
|
-
typeof
|
|
1774
|
+
typeof import_nestjs_durable_core12.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core12.WorkflowEngine
|
|
1757
1775
|
])
|
|
1758
1776
|
], WorkflowService);
|
|
1759
1777
|
|
|
@@ -1928,13 +1946,13 @@ var RunGatewayBootstrap = class RunGatewayBootstrap2 {
|
|
|
1928
1946
|
};
|
|
1929
1947
|
RunGatewayBootstrap = _ts_decorate12([
|
|
1930
1948
|
(0, import_common12.Injectable)(),
|
|
1931
|
-
_ts_param8(1, (0, import_common12.Inject)(
|
|
1949
|
+
_ts_param8(1, (0, import_common12.Inject)(import_nestjs_durable_core13.TRANSPORT_CANONICAL)),
|
|
1932
1950
|
_ts_param8(2, (0, import_common12.Inject)(RUN_GATEWAY)),
|
|
1933
|
-
_ts_param8(3, (0, import_common12.Inject)(
|
|
1934
|
-
_ts_param8(4, (0, import_common12.Inject)(
|
|
1951
|
+
_ts_param8(3, (0, import_common12.Inject)(import_nestjs_durable_core13.STATE_STORE_CANONICAL)),
|
|
1952
|
+
_ts_param8(4, (0, import_common12.Inject)(import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL)),
|
|
1935
1953
|
_ts_metadata12("design:type", Function),
|
|
1936
1954
|
_ts_metadata12("design:paramtypes", [
|
|
1937
|
-
typeof
|
|
1955
|
+
typeof import_nestjs_durable_core13.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core13.WorkflowEngine,
|
|
1938
1956
|
Object,
|
|
1939
1957
|
typeof RunGateway === "undefined" ? Object : RunGateway,
|
|
1940
1958
|
Object,
|
|
@@ -1948,13 +1966,13 @@ var DurableModule = class _DurableModule {
|
|
|
1948
1966
|
static forRoot(options) {
|
|
1949
1967
|
_DurableModule.assertValid(options);
|
|
1950
1968
|
return _DurableModule.build({
|
|
1951
|
-
provide:
|
|
1969
|
+
provide: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
|
|
1952
1970
|
useValue: resolveTopology(options)
|
|
1953
1971
|
});
|
|
1954
1972
|
}
|
|
1955
1973
|
static forRootAsync(options) {
|
|
1956
1974
|
return _DurableModule.build({
|
|
1957
|
-
provide:
|
|
1975
|
+
provide: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
|
|
1958
1976
|
useFactory: /* @__PURE__ */ __name(async (...args) => {
|
|
1959
1977
|
const resolved = await options.useFactory(...args);
|
|
1960
1978
|
_DurableModule.assertValid(resolved);
|
|
@@ -1987,37 +2005,37 @@ var DurableModule = class _DurableModule {
|
|
|
1987
2005
|
providers: [
|
|
1988
2006
|
optionsProvider,
|
|
1989
2007
|
{
|
|
1990
|
-
provide:
|
|
2008
|
+
provide: import_nestjs_durable_core13.STATE_STORE_CANONICAL,
|
|
1991
2009
|
useFactory: /* @__PURE__ */ __name((options) => options.store !== void 0 ? scopedStore(options.store, options) : null, "useFactory"),
|
|
1992
2010
|
inject: [
|
|
1993
|
-
|
|
2011
|
+
import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
|
|
1994
2012
|
]
|
|
1995
2013
|
},
|
|
1996
2014
|
{
|
|
1997
|
-
provide:
|
|
2015
|
+
provide: import_nestjs_durable_core13.TRANSPORT_CANONICAL,
|
|
1998
2016
|
useFactory: /* @__PURE__ */ __name((options) => options.transport ?? null, "useFactory"),
|
|
1999
2017
|
inject: [
|
|
2000
|
-
|
|
2018
|
+
import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
|
|
2001
2019
|
]
|
|
2002
2020
|
},
|
|
2003
2021
|
// Legacy back-compat aliases (deprecated tokens still resolve to the same instances):
|
|
2004
2022
|
{
|
|
2005
|
-
provide:
|
|
2006
|
-
useExisting:
|
|
2023
|
+
provide: import_nestjs_durable_core13.STATE_STORE,
|
|
2024
|
+
useExisting: import_nestjs_durable_core13.STATE_STORE_CANONICAL
|
|
2007
2025
|
},
|
|
2008
2026
|
{
|
|
2009
|
-
provide:
|
|
2010
|
-
useExisting:
|
|
2027
|
+
provide: import_nestjs_durable_core13.TRANSPORT,
|
|
2028
|
+
useExisting: import_nestjs_durable_core13.TRANSPORT_CANONICAL
|
|
2011
2029
|
},
|
|
2012
2030
|
{
|
|
2013
|
-
provide:
|
|
2014
|
-
useExisting:
|
|
2031
|
+
provide: import_nestjs_durable_core13.DURABLE_OPTIONS,
|
|
2032
|
+
useExisting: import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL
|
|
2015
2033
|
},
|
|
2016
2034
|
{
|
|
2017
2035
|
// Shared token, bound EXACTLY once: a real engine for the operator role, or a store-less
|
|
2018
2036
|
// `DurableStartClient` facade for a thin worker (no `store`) — either way, `WorkflowService`
|
|
2019
2037
|
// and app code call `engine.start(...)` unchanged.
|
|
2020
|
-
provide:
|
|
2038
|
+
provide: import_nestjs_durable_core13.WorkflowEngine,
|
|
2021
2039
|
useFactory: /* @__PURE__ */ __name(async (options, store, transport, moduleRef) => {
|
|
2022
2040
|
if (options.store === void 0) {
|
|
2023
2041
|
return new DurableStartClient(options);
|
|
@@ -2030,7 +2048,7 @@ var DurableModule = class _DurableModule {
|
|
|
2030
2048
|
const context = options.context ?? (accessor ? () => carrierFromAccessor(accessor) : void 0);
|
|
2031
2049
|
const runtime = accessor ? await resolveContextRuntime() : void 0;
|
|
2032
2050
|
const rehydrate = runtime && ((carrier, fn) => carrier && Object.keys(carrier).length > 0 ? runtime.deserialize(carrier, fn) : fn());
|
|
2033
|
-
const engine = new
|
|
2051
|
+
const engine = new import_nestjs_durable_core13.WorkflowEngine({
|
|
2034
2052
|
store,
|
|
2035
2053
|
transport: transport ?? void 0,
|
|
2036
2054
|
transports: options.transports,
|
|
@@ -2061,9 +2079,9 @@ var DurableModule = class _DurableModule {
|
|
|
2061
2079
|
return engine;
|
|
2062
2080
|
}, "useFactory"),
|
|
2063
2081
|
inject: [
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2082
|
+
import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
|
|
2083
|
+
import_nestjs_durable_core13.STATE_STORE_CANONICAL,
|
|
2084
|
+
import_nestjs_durable_core13.TRANSPORT_CANONICAL,
|
|
2067
2085
|
import_core5.ModuleRef
|
|
2068
2086
|
]
|
|
2069
2087
|
},
|
|
@@ -2088,9 +2106,9 @@ var DurableModule = class _DurableModule {
|
|
|
2088
2106
|
return options.transport ? new ProxyRunGateway(options.transport, options.partition ?? "default", options.runGatewayTimeoutMs) : unavailableRunGateway();
|
|
2089
2107
|
}, "useFactory"),
|
|
2090
2108
|
inject: [
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2109
|
+
import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
|
|
2110
|
+
import_nestjs_durable_core13.STATE_STORE_CANONICAL,
|
|
2111
|
+
import_nestjs_durable_core13.WorkflowEngine
|
|
2094
2112
|
]
|
|
2095
2113
|
},
|
|
2096
2114
|
RunGatewayBootstrap,
|
|
@@ -2104,12 +2122,12 @@ var DurableModule = class _DurableModule {
|
|
|
2104
2122
|
exports: [
|
|
2105
2123
|
WorkflowService,
|
|
2106
2124
|
EntityService,
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2125
|
+
import_nestjs_durable_core13.WorkflowEngine,
|
|
2126
|
+
import_nestjs_durable_core13.STATE_STORE,
|
|
2127
|
+
import_nestjs_durable_core13.STATE_STORE_CANONICAL,
|
|
2128
|
+
import_nestjs_durable_core13.TRANSPORT,
|
|
2129
|
+
import_nestjs_durable_core13.TRANSPORT_CANONICAL,
|
|
2130
|
+
import_nestjs_durable_core13.DURABLE_OPTIONS_CANONICAL,
|
|
2113
2131
|
RUN_GATEWAY
|
|
2114
2132
|
]
|
|
2115
2133
|
};
|
|
@@ -2120,7 +2138,7 @@ DurableModule = _ts_decorate12([
|
|
|
2120
2138
|
], DurableModule);
|
|
2121
2139
|
|
|
2122
2140
|
// src/index.ts
|
|
2123
|
-
var
|
|
2141
|
+
var import_nestjs_durable_core14 = require("@dudousxd/nestjs-durable-core");
|
|
2124
2142
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2125
2143
|
0 && (module.exports = {
|
|
2126
2144
|
CONTEXT_ACCESSOR,
|
|
@@ -2160,6 +2178,7 @@ var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
|
|
|
2160
2178
|
Workflow,
|
|
2161
2179
|
WorkflowEngine,
|
|
2162
2180
|
WorkflowService,
|
|
2181
|
+
attributesOf,
|
|
2163
2182
|
entityConfigFor,
|
|
2164
2183
|
getDurableStepMeta,
|
|
2165
2184
|
getEntityMeta,
|
|
@@ -2170,6 +2189,7 @@ var import_nestjs_durable_core13 = require("@dudousxd/nestjs-durable-core");
|
|
|
2170
2189
|
isDrivingOperator,
|
|
2171
2190
|
isOperatorRole,
|
|
2172
2191
|
isStepInterceptor,
|
|
2192
|
+
readSearchAttributes,
|
|
2173
2193
|
thinWorkerProviders,
|
|
2174
2194
|
unavailableRunGateway
|
|
2175
2195
|
});
|