@dudousxd/nestjs-durable 0.43.1 → 0.44.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 +243 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -5
- package/dist/index.d.ts +31 -5
- package/dist/index.js +231 -91
- package/dist/index.js.map +1 -1
- package/package.json +14 -10
package/dist/index.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
-
}) : x)(function(x) {
|
|
6
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
-
});
|
|
9
3
|
|
|
10
4
|
// src/attributes-of.ts
|
|
11
5
|
import { readSearchAttributes } from "@dudousxd/nestjs-durable-core";
|
|
@@ -244,18 +238,47 @@ function attributesOf(workflow, run) {
|
|
|
244
238
|
__name(attributesOf, "attributesOf");
|
|
245
239
|
|
|
246
240
|
// src/durable-start-client.ts
|
|
247
|
-
import { startRun } from "@dudousxd/durable-worker";
|
|
248
241
|
import { workflowName } from "@dudousxd/nestjs-durable-core";
|
|
249
242
|
import { Injectable } from "@nestjs/common";
|
|
243
|
+
|
|
244
|
+
// src/worker-sdk.ts
|
|
245
|
+
async function workerSdk() {
|
|
246
|
+
try {
|
|
247
|
+
return await import("@dudousxd/durable-worker");
|
|
248
|
+
} catch (cause) {
|
|
249
|
+
throw new Error("@dudousxd/durable-worker is not installed. It is an optional peer needed only by the roles that run workflow bodies (`connection` set on DurableModule.forRoot) \u2014 install it, or drop `connection`.", {
|
|
250
|
+
cause
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
__name(workerSdk, "workerSdk");
|
|
255
|
+
var startRun = /* @__PURE__ */ __name(async (connection, options) => (await workerSdk()).startRun(connection, options), "startRun");
|
|
256
|
+
var runRedisWorker = /* @__PURE__ */ __name(async (options) => (await workerSdk()).runRedisWorker(options), "runRedisWorker");
|
|
257
|
+
async function createWorkerRuntime(options) {
|
|
258
|
+
const { DurableWorkerRuntime: Runtime } = await workerSdk();
|
|
259
|
+
return new Runtime(options);
|
|
260
|
+
}
|
|
261
|
+
__name(createWorkerRuntime, "createWorkerRuntime");
|
|
262
|
+
|
|
263
|
+
// src/durable-start-client.ts
|
|
250
264
|
function _ts_decorate(decorators, target, key, desc) {
|
|
251
265
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
252
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
253
|
-
|
|
266
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
267
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
268
|
+
} else {
|
|
269
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
270
|
+
if (d = decorators[i]) {
|
|
271
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
254
275
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
255
276
|
}
|
|
256
277
|
__name(_ts_decorate, "_ts_decorate");
|
|
257
|
-
function _ts_metadata(
|
|
258
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
278
|
+
function _ts_metadata(metadataKey, metadataValue) {
|
|
279
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
280
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
281
|
+
}
|
|
259
282
|
}
|
|
260
283
|
__name(_ts_metadata, "_ts_metadata");
|
|
261
284
|
var DurableStartClient = class {
|
|
@@ -339,7 +362,6 @@ function tenantUnsupported(method) {
|
|
|
339
362
|
__name(tenantUnsupported, "tenantUnsupported");
|
|
340
363
|
|
|
341
364
|
// src/durable-worker.module.ts
|
|
342
|
-
import { DurableWorkerRuntime, runRedisWorker as defaultRunRedisWorker } from "@dudousxd/durable-worker";
|
|
343
365
|
import { DURABLE_OPTIONS_CANONICAL } from "@dudousxd/nestjs-durable-core";
|
|
344
366
|
import { Inject, Injectable as Injectable2 } from "@nestjs/common";
|
|
345
367
|
import { DiscoveryService, MetadataScanner } from "@nestjs/core";
|
|
@@ -384,13 +406,22 @@ __name(scanSteps, "scanSteps");
|
|
|
384
406
|
// src/durable-worker.module.ts
|
|
385
407
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
386
408
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
387
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
388
|
-
|
|
409
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
410
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
411
|
+
} else {
|
|
412
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
413
|
+
if (d = decorators[i]) {
|
|
414
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
389
418
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
390
419
|
}
|
|
391
420
|
__name(_ts_decorate2, "_ts_decorate");
|
|
392
|
-
function _ts_metadata2(
|
|
393
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
421
|
+
function _ts_metadata2(metadataKey, metadataValue) {
|
|
422
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
423
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
424
|
+
}
|
|
394
425
|
}
|
|
395
426
|
__name(_ts_metadata2, "_ts_metadata");
|
|
396
427
|
function _ts_param(paramIndex, decorator) {
|
|
@@ -400,6 +431,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
400
431
|
}
|
|
401
432
|
__name(_ts_param, "_ts_param");
|
|
402
433
|
var RUN_REDIS_WORKER = Symbol("nestjs-durable:run-redis-worker");
|
|
434
|
+
var DURABLE_WORKER_RUNTIME = Symbol("nestjs-durable:worker-runtime");
|
|
403
435
|
var DURABLE_WORKER_RUNNERS = Symbol("nestjs-durable:worker-runners");
|
|
404
436
|
function isPureThinWorker(options) {
|
|
405
437
|
return options.store === void 0 && options.connection !== void 0;
|
|
@@ -418,8 +450,9 @@ var ThinWorkflowRegistrar = class {
|
|
|
418
450
|
this.options = options;
|
|
419
451
|
}
|
|
420
452
|
onModuleInit() {
|
|
421
|
-
|
|
422
|
-
|
|
453
|
+
const runtime = this.runtime;
|
|
454
|
+
if (runtime === null || !isPureThinWorker(this.options)) return;
|
|
455
|
+
scanWorkflows(this.discovery, (meta, instance, origin) => runtime.registerWorkflow(meta.name, (ctx, input) => instance.run(ctx, input), {
|
|
423
456
|
version: meta.version,
|
|
424
457
|
...meta.requires !== void 0 ? {
|
|
425
458
|
requires: meta.requires
|
|
@@ -432,11 +465,12 @@ var ThinWorkflowRegistrar = class {
|
|
|
432
465
|
};
|
|
433
466
|
ThinWorkflowRegistrar = _ts_decorate2([
|
|
434
467
|
Injectable2(),
|
|
468
|
+
_ts_param(1, Inject(DURABLE_WORKER_RUNTIME)),
|
|
435
469
|
_ts_param(2, Inject(DURABLE_OPTIONS_CANONICAL)),
|
|
436
470
|
_ts_metadata2("design:type", Function),
|
|
437
471
|
_ts_metadata2("design:paramtypes", [
|
|
438
472
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
439
|
-
|
|
473
|
+
Object,
|
|
440
474
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
|
|
441
475
|
])
|
|
442
476
|
], ThinWorkflowRegistrar);
|
|
@@ -455,18 +489,20 @@ var ThinStepRegistrar = class {
|
|
|
455
489
|
this.options = options;
|
|
456
490
|
}
|
|
457
491
|
onModuleInit() {
|
|
458
|
-
|
|
459
|
-
|
|
492
|
+
const runtime = this.runtime;
|
|
493
|
+
if (runtime === null || !isPureThinWorker(this.options)) return;
|
|
494
|
+
scanSteps(this.discovery, this.metadataScanner, (meta, handler) => runtime.registerStep(meta.name, handler));
|
|
460
495
|
}
|
|
461
496
|
};
|
|
462
497
|
ThinStepRegistrar = _ts_decorate2([
|
|
463
498
|
Injectable2(),
|
|
499
|
+
_ts_param(2, Inject(DURABLE_WORKER_RUNTIME)),
|
|
464
500
|
_ts_param(3, Inject(DURABLE_OPTIONS_CANONICAL)),
|
|
465
501
|
_ts_metadata2("design:type", Function),
|
|
466
502
|
_ts_metadata2("design:paramtypes", [
|
|
467
503
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
468
504
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
469
|
-
|
|
505
|
+
Object,
|
|
470
506
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions
|
|
471
507
|
])
|
|
472
508
|
], ThinStepRegistrar);
|
|
@@ -479,17 +515,18 @@ var ThinWorkerBootstrap = class {
|
|
|
479
515
|
runRedisWorker;
|
|
480
516
|
runnersSink;
|
|
481
517
|
runners = [];
|
|
482
|
-
constructor(runtime, options,
|
|
518
|
+
constructor(runtime, options, runRedisWorker2, runnersSink) {
|
|
483
519
|
this.runtime = runtime;
|
|
484
520
|
this.options = options;
|
|
485
|
-
this.runRedisWorker =
|
|
521
|
+
this.runRedisWorker = runRedisWorker2;
|
|
486
522
|
this.runnersSink = runnersSink;
|
|
487
523
|
}
|
|
488
524
|
async onApplicationBootstrap() {
|
|
489
525
|
const options = this.options;
|
|
490
|
-
|
|
526
|
+
const runtime = this.runtime;
|
|
527
|
+
if (runtime === null || !isPureThinWorker(options) || options.connection === void 0) return;
|
|
491
528
|
const handle = await this.runRedisWorker({
|
|
492
|
-
runtime
|
|
529
|
+
runtime,
|
|
493
530
|
connection: options.connection,
|
|
494
531
|
...options.partition !== void 0 ? {
|
|
495
532
|
partition: options.partition
|
|
@@ -513,12 +550,13 @@ var ThinWorkerBootstrap = class {
|
|
|
513
550
|
};
|
|
514
551
|
ThinWorkerBootstrap = _ts_decorate2([
|
|
515
552
|
Injectable2(),
|
|
553
|
+
_ts_param(0, Inject(DURABLE_WORKER_RUNTIME)),
|
|
516
554
|
_ts_param(1, Inject(DURABLE_OPTIONS_CANONICAL)),
|
|
517
555
|
_ts_param(2, Inject(RUN_REDIS_WORKER)),
|
|
518
556
|
_ts_param(3, Inject(DURABLE_WORKER_RUNNERS)),
|
|
519
557
|
_ts_metadata2("design:type", Function),
|
|
520
558
|
_ts_metadata2("design:paramtypes", [
|
|
521
|
-
|
|
559
|
+
Object,
|
|
522
560
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
|
|
523
561
|
typeof RunRedisWorkerFn === "undefined" ? Object : RunRedisWorkerFn,
|
|
524
562
|
Array
|
|
@@ -527,7 +565,7 @@ ThinWorkerBootstrap = _ts_decorate2([
|
|
|
527
565
|
function thinWorkerProviders() {
|
|
528
566
|
return [
|
|
529
567
|
{
|
|
530
|
-
provide:
|
|
568
|
+
provide: DURABLE_WORKER_RUNTIME,
|
|
531
569
|
// The runtime's `WorkflowWorker` falls back to its own `group` ctor param as the WORKFLOW's
|
|
532
570
|
// `workflowPartition` for any `ctx.step` call (see `workflow-context.ts`'s `resolveCallGroup`)
|
|
533
571
|
// — that fallback MUST equal this module's own `partition`, or a dispatched step's decision
|
|
@@ -535,16 +573,20 @@ function thinWorkerProviders() {
|
|
|
535
573
|
// to. Explicit `''` (never
|
|
536
574
|
// `undefined`) so it does NOT fall through to `WorkflowWorker`'s unrelated `'workflows'`
|
|
537
575
|
// default parameter.
|
|
538
|
-
|
|
576
|
+
//
|
|
577
|
+
// The role gate lives HERE, not just in the consumers: constructing the runtime resolves the
|
|
578
|
+
// optional `@dudousxd/durable-worker` peer, so an operator that never runs a worker must not
|
|
579
|
+
// reach this branch at all.
|
|
580
|
+
useFactory: /* @__PURE__ */ __name((options) => isPureThinWorker(options) ? createWorkerRuntime({
|
|
539
581
|
workflowGroup: options.partition ?? ""
|
|
540
|
-
}), "useFactory"),
|
|
582
|
+
}) : null, "useFactory"),
|
|
541
583
|
inject: [
|
|
542
584
|
DURABLE_OPTIONS_CANONICAL
|
|
543
585
|
]
|
|
544
586
|
},
|
|
545
587
|
{
|
|
546
588
|
provide: RUN_REDIS_WORKER,
|
|
547
|
-
useValue:
|
|
589
|
+
useValue: runRedisWorker
|
|
548
590
|
},
|
|
549
591
|
{
|
|
550
592
|
provide: DURABLE_WORKER_RUNNERS,
|
|
@@ -631,13 +673,22 @@ __name(isDrivingOperator, "isDrivingOperator");
|
|
|
631
673
|
// src/durable-step.registrar.ts
|
|
632
674
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
633
675
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
634
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
635
|
-
|
|
676
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
677
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
678
|
+
} else {
|
|
679
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
680
|
+
if (d = decorators[i]) {
|
|
681
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
636
685
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
637
686
|
}
|
|
638
687
|
__name(_ts_decorate3, "_ts_decorate");
|
|
639
|
-
function _ts_metadata3(
|
|
640
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
688
|
+
function _ts_metadata3(metadataKey, metadataValue) {
|
|
689
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
690
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
691
|
+
}
|
|
641
692
|
}
|
|
642
693
|
__name(_ts_metadata3, "_ts_metadata");
|
|
643
694
|
function _ts_param2(paramIndex, decorator) {
|
|
@@ -690,13 +741,22 @@ import { Injectable as Injectable4 } from "@nestjs/common";
|
|
|
690
741
|
import "reflect-metadata";
|
|
691
742
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
692
743
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
693
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
694
|
-
|
|
744
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
745
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
746
|
+
} else {
|
|
747
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
748
|
+
if (d = decorators[i]) {
|
|
749
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
695
753
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
696
754
|
}
|
|
697
755
|
__name(_ts_decorate4, "_ts_decorate");
|
|
698
|
-
function _ts_metadata4(
|
|
699
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
756
|
+
function _ts_metadata4(metadataKey, metadataValue) {
|
|
757
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
758
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
759
|
+
}
|
|
700
760
|
}
|
|
701
761
|
__name(_ts_metadata4, "_ts_metadata");
|
|
702
762
|
var ENTITY_METADATA = Symbol("nestjs-durable:entity");
|
|
@@ -764,19 +824,27 @@ EntityService = _ts_decorate4([
|
|
|
764
824
|
], EntityService);
|
|
765
825
|
|
|
766
826
|
// src/in-app-worker.ts
|
|
767
|
-
import { DurableWorkerRuntime as DurableWorkerRuntime2, runRedisWorker as defaultRunRedisWorker2 } from "@dudousxd/durable-worker";
|
|
768
827
|
import { DURABLE_OPTIONS_CANONICAL as DURABLE_OPTIONS_CANONICAL3, TRANSPORT_CANONICAL as TRANSPORT_CANONICAL2 } from "@dudousxd/nestjs-durable-core";
|
|
769
828
|
import { Inject as Inject3, Injectable as Injectable5 } from "@nestjs/common";
|
|
770
829
|
import { DiscoveryService as DiscoveryService3, MetadataScanner as MetadataScanner3 } from "@nestjs/core";
|
|
771
830
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
772
831
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
773
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
774
|
-
|
|
832
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
833
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
834
|
+
} else {
|
|
835
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
836
|
+
if (d = decorators[i]) {
|
|
837
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
775
841
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
776
842
|
}
|
|
777
843
|
__name(_ts_decorate5, "_ts_decorate");
|
|
778
|
-
function _ts_metadata5(
|
|
779
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
844
|
+
function _ts_metadata5(metadataKey, metadataValue) {
|
|
845
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
846
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
847
|
+
}
|
|
780
848
|
}
|
|
781
849
|
__name(_ts_metadata5, "_ts_metadata");
|
|
782
850
|
function _ts_param3(paramIndex, decorator) {
|
|
@@ -817,17 +885,18 @@ var InAppWorkerBootstrap = class {
|
|
|
817
885
|
runRedisWorker;
|
|
818
886
|
runnersSink;
|
|
819
887
|
runners = [];
|
|
820
|
-
constructor(discovery, metadataScanner, options, runtime,
|
|
888
|
+
constructor(discovery, metadataScanner, options, runtime, runRedisWorker2, runnersSink) {
|
|
821
889
|
this.discovery = discovery;
|
|
822
890
|
this.metadataScanner = metadataScanner;
|
|
823
891
|
this.options = options;
|
|
824
892
|
this.runtime = runtime;
|
|
825
|
-
this.runRedisWorker =
|
|
893
|
+
this.runRedisWorker = runRedisWorker2;
|
|
826
894
|
this.runnersSink = runnersSink;
|
|
827
895
|
}
|
|
828
896
|
onModuleInit() {
|
|
829
|
-
|
|
830
|
-
|
|
897
|
+
const runtime = this.runtime;
|
|
898
|
+
if (runtime === null || !isCoLocatedWorker(this.options)) return;
|
|
899
|
+
scanWorkflows(this.discovery, (meta, instance, origin) => runtime.registerWorkflow(meta.name, (ctx, input) => instance.run(ctx, input), {
|
|
831
900
|
version: meta.version,
|
|
832
901
|
...meta.requires !== void 0 ? {
|
|
833
902
|
requires: meta.requires
|
|
@@ -836,13 +905,14 @@ var InAppWorkerBootstrap = class {
|
|
|
836
905
|
origin
|
|
837
906
|
} : {}
|
|
838
907
|
}));
|
|
839
|
-
scanSteps(this.discovery, this.metadataScanner, (meta, handler) =>
|
|
908
|
+
scanSteps(this.discovery, this.metadataScanner, (meta, handler) => runtime.registerStep(meta.name, handler));
|
|
840
909
|
}
|
|
841
910
|
async onApplicationBootstrap() {
|
|
842
911
|
const options = this.options;
|
|
843
|
-
|
|
912
|
+
const runtime = this.runtime;
|
|
913
|
+
if (runtime === null || !isCoLocatedWorker(options) || options.connection === void 0) return;
|
|
844
914
|
const handle = await this.runRedisWorker({
|
|
845
|
-
runtime
|
|
915
|
+
runtime,
|
|
846
916
|
connection: options.connection,
|
|
847
917
|
...options.partition !== void 0 ? {
|
|
848
918
|
partition: options.partition
|
|
@@ -875,7 +945,7 @@ InAppWorkerBootstrap = _ts_decorate5([
|
|
|
875
945
|
typeof DiscoveryService3 === "undefined" ? Object : DiscoveryService3,
|
|
876
946
|
typeof MetadataScanner3 === "undefined" ? Object : MetadataScanner3,
|
|
877
947
|
typeof DurableModuleOptions === "undefined" ? Object : DurableModuleOptions,
|
|
878
|
-
|
|
948
|
+
Object,
|
|
879
949
|
typeof RunRedisWorkerFn === "undefined" ? Object : RunRedisWorkerFn,
|
|
880
950
|
Array
|
|
881
951
|
])
|
|
@@ -899,16 +969,20 @@ function inAppWorkerProviders() {
|
|
|
899
969
|
// to. Explicit `''` (never
|
|
900
970
|
// `undefined`) so it does NOT fall through to `WorkflowWorker`'s unrelated `'workflows'`
|
|
901
971
|
// default parameter.
|
|
902
|
-
|
|
972
|
+
//
|
|
973
|
+
// The role gate lives HERE, not just in the consumer: constructing the runtime resolves the
|
|
974
|
+
// optional `@dudousxd/durable-worker` peer, so an operator that never runs a worker must not
|
|
975
|
+
// reach this branch at all.
|
|
976
|
+
useFactory: /* @__PURE__ */ __name((options) => isCoLocatedWorker(options) ? createWorkerRuntime({
|
|
903
977
|
workflowGroup: options.partition ?? ""
|
|
904
|
-
}), "useFactory"),
|
|
978
|
+
}) : null, "useFactory"),
|
|
905
979
|
inject: [
|
|
906
980
|
DURABLE_OPTIONS_CANONICAL3
|
|
907
981
|
]
|
|
908
982
|
},
|
|
909
983
|
{
|
|
910
984
|
provide: IN_APP_RUN_REDIS_WORKER,
|
|
911
|
-
useValue:
|
|
985
|
+
useValue: runRedisWorker
|
|
912
986
|
},
|
|
913
987
|
{
|
|
914
988
|
provide: IN_APP_WORKER_RUNNERS,
|
|
@@ -923,13 +997,22 @@ __name(inAppWorkerProviders, "inAppWorkerProviders");
|
|
|
923
997
|
import { Injectable as Injectable6 } from "@nestjs/common";
|
|
924
998
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
925
999
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
926
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
927
|
-
|
|
1000
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1001
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1002
|
+
} else {
|
|
1003
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1004
|
+
if (d = decorators[i]) {
|
|
1005
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
928
1009
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
929
1010
|
}
|
|
930
1011
|
__name(_ts_decorate6, "_ts_decorate");
|
|
931
|
-
function _ts_metadata6(
|
|
932
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1012
|
+
function _ts_metadata6(metadataKey, metadataValue) {
|
|
1013
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1014
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1015
|
+
}
|
|
933
1016
|
}
|
|
934
1017
|
__name(_ts_metadata6, "_ts_metadata");
|
|
935
1018
|
var ProxyRunGateway = class {
|
|
@@ -1091,13 +1174,22 @@ import { DURABLE_OPTIONS_CANONICAL as DURABLE_OPTIONS_CANONICAL4, STATE_STORE_CA
|
|
|
1091
1174
|
import { Inject as Inject4, Injectable as Injectable7 } from "@nestjs/common";
|
|
1092
1175
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
1093
1176
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1094
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1095
|
-
|
|
1177
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1178
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1179
|
+
} else {
|
|
1180
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1181
|
+
if (d = decorators[i]) {
|
|
1182
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1096
1186
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1097
1187
|
}
|
|
1098
1188
|
__name(_ts_decorate7, "_ts_decorate");
|
|
1099
|
-
function _ts_metadata7(
|
|
1100
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1189
|
+
function _ts_metadata7(metadataKey, metadataValue) {
|
|
1190
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1191
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1192
|
+
}
|
|
1101
1193
|
}
|
|
1102
1194
|
__name(_ts_metadata7, "_ts_metadata");
|
|
1103
1195
|
function _ts_param4(paramIndex, decorator) {
|
|
@@ -1368,13 +1460,22 @@ import { STATE_STORE_CANONICAL as STATE_STORE_CANONICAL2, WorkflowEngine as Work
|
|
|
1368
1460
|
import { Inject as Inject5, Injectable as Injectable8 } from "@nestjs/common";
|
|
1369
1461
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
1370
1462
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1371
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1372
|
-
|
|
1463
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1464
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1465
|
+
} else {
|
|
1466
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1467
|
+
if (d = decorators[i]) {
|
|
1468
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1373
1472
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1374
1473
|
}
|
|
1375
1474
|
__name(_ts_decorate8, "_ts_decorate");
|
|
1376
|
-
function _ts_metadata8(
|
|
1377
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1475
|
+
function _ts_metadata8(metadataKey, metadataValue) {
|
|
1476
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1477
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1478
|
+
}
|
|
1378
1479
|
}
|
|
1379
1480
|
__name(_ts_metadata8, "_ts_metadata");
|
|
1380
1481
|
function _ts_param5(paramIndex, decorator) {
|
|
@@ -1560,13 +1661,22 @@ import { DURABLE_OPTIONS_CANONICAL as DURABLE_OPTIONS_CANONICAL5, WorkflowEngine
|
|
|
1560
1661
|
import { Inject as Inject6, Injectable as Injectable9 } from "@nestjs/common";
|
|
1561
1662
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
1562
1663
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1563
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1564
|
-
|
|
1664
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1665
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1666
|
+
} else {
|
|
1667
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1668
|
+
if (d = decorators[i]) {
|
|
1669
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1565
1673
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1566
1674
|
}
|
|
1567
1675
|
__name(_ts_decorate9, "_ts_decorate");
|
|
1568
|
-
function _ts_metadata9(
|
|
1569
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1676
|
+
function _ts_metadata9(metadataKey, metadataValue) {
|
|
1677
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1678
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1679
|
+
}
|
|
1570
1680
|
}
|
|
1571
1681
|
__name(_ts_metadata9, "_ts_metadata");
|
|
1572
1682
|
function _ts_param6(paramIndex, decorator) {
|
|
@@ -1668,15 +1778,15 @@ import { DiscoveryService as DiscoveryService4, MetadataScanner as MetadataScann
|
|
|
1668
1778
|
|
|
1669
1779
|
// src/input-validation.ts
|
|
1670
1780
|
function classValidatorInput(cls) {
|
|
1671
|
-
let cv;
|
|
1672
|
-
let ct;
|
|
1673
|
-
try {
|
|
1674
|
-
cv = __require("class-validator");
|
|
1675
|
-
ct = __require("class-transformer");
|
|
1676
|
-
} catch {
|
|
1677
|
-
throw new Error('@Workflow({ inputSchema }) needs the optional peers "class-validator" and "class-transformer" \u2014 install them, or pass a `validateInput` function instead.');
|
|
1678
|
-
}
|
|
1679
1781
|
return async (input) => {
|
|
1782
|
+
let cv;
|
|
1783
|
+
let ct;
|
|
1784
|
+
try {
|
|
1785
|
+
cv = await import("class-validator");
|
|
1786
|
+
ct = await import("class-transformer");
|
|
1787
|
+
} catch {
|
|
1788
|
+
throw new Error('@Workflow({ inputSchema }) needs the optional peers "class-validator" and "class-transformer" \u2014 install them, or pass a `validateInput` function instead.');
|
|
1789
|
+
}
|
|
1680
1790
|
const instance = ct.plainToInstance(cls, input);
|
|
1681
1791
|
const errors = await cv.validate(instance, {
|
|
1682
1792
|
whitelist: true
|
|
@@ -1708,13 +1818,22 @@ __name(isStepInterceptor, "isStepInterceptor");
|
|
|
1708
1818
|
// src/workflow.registrar.ts
|
|
1709
1819
|
function _ts_decorate10(decorators, target, key, desc) {
|
|
1710
1820
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1711
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1712
|
-
|
|
1821
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1822
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1823
|
+
} else {
|
|
1824
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1825
|
+
if (d = decorators[i]) {
|
|
1826
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1713
1830
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1714
1831
|
}
|
|
1715
1832
|
__name(_ts_decorate10, "_ts_decorate");
|
|
1716
|
-
function _ts_metadata10(
|
|
1717
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1833
|
+
function _ts_metadata10(metadataKey, metadataValue) {
|
|
1834
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1835
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1836
|
+
}
|
|
1718
1837
|
}
|
|
1719
1838
|
__name(_ts_metadata10, "_ts_metadata");
|
|
1720
1839
|
function _ts_param7(paramIndex, decorator) {
|
|
@@ -1913,13 +2032,22 @@ import { WorkflowEngine as WorkflowEngine5 } from "@dudousxd/nestjs-durable-core
|
|
|
1913
2032
|
import { Injectable as Injectable11 } from "@nestjs/common";
|
|
1914
2033
|
function _ts_decorate11(decorators, target, key, desc) {
|
|
1915
2034
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1916
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1917
|
-
|
|
2035
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2036
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2037
|
+
} else {
|
|
2038
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
2039
|
+
if (d = decorators[i]) {
|
|
2040
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
1918
2044
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1919
2045
|
}
|
|
1920
2046
|
__name(_ts_decorate11, "_ts_decorate");
|
|
1921
|
-
function _ts_metadata11(
|
|
1922
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2047
|
+
function _ts_metadata11(metadataKey, metadataValue) {
|
|
2048
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2049
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
2050
|
+
}
|
|
1923
2051
|
}
|
|
1924
2052
|
__name(_ts_metadata11, "_ts_metadata");
|
|
1925
2053
|
var WorkflowService = class {
|
|
@@ -1976,13 +2104,22 @@ WorkflowService = _ts_decorate11([
|
|
|
1976
2104
|
// src/durable.module.ts
|
|
1977
2105
|
function _ts_decorate12(decorators, target, key, desc) {
|
|
1978
2106
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1979
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1980
|
-
|
|
2107
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2108
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2109
|
+
} else {
|
|
2110
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
2111
|
+
if (d = decorators[i]) {
|
|
2112
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
1981
2116
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1982
2117
|
}
|
|
1983
2118
|
__name(_ts_decorate12, "_ts_decorate");
|
|
1984
|
-
function _ts_metadata12(
|
|
1985
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2119
|
+
function _ts_metadata12(metadataKey, metadataValue) {
|
|
2120
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2121
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
2122
|
+
}
|
|
1986
2123
|
}
|
|
1987
2124
|
__name(_ts_metadata12, "_ts_metadata");
|
|
1988
2125
|
function _ts_param8(paramIndex, decorator) {
|
|
@@ -2277,6 +2414,8 @@ var DurableModule = class _DurableModule {
|
|
|
2277
2414
|
admission: options.admission,
|
|
2278
2415
|
maxRecoveryAttempts: options.maxRecoveryAttempts,
|
|
2279
2416
|
remoteAdvanceSilenceMs: options.remoteAdvanceSilenceMs,
|
|
2417
|
+
remoteRedispatchMs: options.remoteRedispatchMs,
|
|
2418
|
+
remoteRedispatchMax: options.remoteRedispatchMax,
|
|
2280
2419
|
instanceId: options.instanceId,
|
|
2281
2420
|
namespace: options.namespace,
|
|
2282
2421
|
webhookUrl: options.webhookUrl,
|
|
@@ -2364,6 +2503,7 @@ export {
|
|
|
2364
2503
|
DEAD_LETTER_METADATA,
|
|
2365
2504
|
DURABLE_STEP_METADATA,
|
|
2366
2505
|
DURABLE_WORKER_RUNNERS,
|
|
2506
|
+
DURABLE_WORKER_RUNTIME,
|
|
2367
2507
|
DeadLetter,
|
|
2368
2508
|
DurableModule,
|
|
2369
2509
|
DurableStartClient,
|