@dudousxd/nestjs-durable 0.48.0 → 0.48.2
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 +21 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/skills/durable-setup/SKILL.md +11 -3
- package/skills/durable-workflows/SKILL.md +1 -1
package/dist/index.cjs
CHANGED
|
@@ -692,6 +692,7 @@ var ThinWorkerBootstrap = class {
|
|
|
692
692
|
const options = this.options;
|
|
693
693
|
const runtime = this.runtime;
|
|
694
694
|
if (runtime === null || !isPureThinWorker(options) || options.connection === void 0) return;
|
|
695
|
+
if (options.consumers === false) return;
|
|
695
696
|
const handle = await this.runRedisWorker({
|
|
696
697
|
runtime,
|
|
697
698
|
connection: options.connection,
|
|
@@ -1070,6 +1071,7 @@ var InAppWorkerBootstrap = class {
|
|
|
1070
1071
|
const options = this.options;
|
|
1071
1072
|
const runtime = this.runtime;
|
|
1072
1073
|
if (runtime === null || !isCoLocatedWorker(options) || options.connection === void 0) return;
|
|
1074
|
+
if (options.consumers === false) return;
|
|
1073
1075
|
const handle = await this.runRedisWorker({
|
|
1074
1076
|
runtime,
|
|
1075
1077
|
connection: options.connection,
|
|
@@ -2515,6 +2517,8 @@ var WorkflowService = class {
|
|
|
2515
2517
|
* Resolve once a run settles — terminal (completed/failed/cancelled/dead) or suspended. `start`
|
|
2516
2518
|
* only enqueues (a worker runs the body), so pair them when a request needs the outcome:
|
|
2517
2519
|
* `const { runId } = await svc.start(...); const result = await svc.waitForRun(runId)`.
|
|
2520
|
+
* `until: 'terminal'` waits past suspensions until the run completes/fails/is cancelled — what a
|
|
2521
|
+
* delayed start (`opts.startAt`) needs, since it is `suspended` until its timer fires.
|
|
2518
2522
|
*/
|
|
2519
2523
|
waitForRun(runId, opts) {
|
|
2520
2524
|
return this.engine.waitForRun(runId, opts);
|
|
@@ -2626,6 +2630,15 @@ function scopedStore(store, options) {
|
|
|
2626
2630
|
});
|
|
2627
2631
|
}
|
|
2628
2632
|
__name(scopedStore, "scopedStore");
|
|
2633
|
+
function deferTransportConsumers(transport) {
|
|
2634
|
+
const deferrable = transport;
|
|
2635
|
+
if (typeof deferrable.deferConsumers === "function") {
|
|
2636
|
+
deferrable.deferConsumers();
|
|
2637
|
+
return;
|
|
2638
|
+
}
|
|
2639
|
+
console.warn(`[nestjs-durable] consumers: false \u2014 ${transport.constructor?.name ?? "this transport"} cannot defer its consumers and will keep consuming in this process`);
|
|
2640
|
+
}
|
|
2641
|
+
__name(deferTransportConsumers, "deferTransportConsumers");
|
|
2629
2642
|
function assertValidRole(options) {
|
|
2630
2643
|
const hasStore = options.store !== void 0;
|
|
2631
2644
|
const hasConnection = options.connection !== void 0;
|
|
@@ -2852,6 +2865,14 @@ var DurableModule = class _DurableModule {
|
|
|
2852
2865
|
const context = options.context ?? (accessor ? () => carrierFromAccessor(accessor) : void 0);
|
|
2853
2866
|
const runtime = accessor ? await resolveContextRuntime() : void 0;
|
|
2854
2867
|
const rehydrate = runtime && ((carrier, fn) => carrier && Object.keys(carrier).length > 0 ? runtime.deserialize(carrier, fn) : fn());
|
|
2868
|
+
if (options.consumers === false) {
|
|
2869
|
+
for (const t of [
|
|
2870
|
+
transport,
|
|
2871
|
+
...(options.transports ?? []).map((n) => n.transport)
|
|
2872
|
+
]) {
|
|
2873
|
+
if (t) deferTransportConsumers(t);
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2855
2876
|
const engine = new import_nestjs_durable_core16.WorkflowEngine({
|
|
2856
2877
|
store,
|
|
2857
2878
|
transport: transport ?? void 0,
|