@dudousxd/nestjs-durable-core 0.29.0 → 0.29.1
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 +239 -212
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -15
- package/dist/index.d.ts +10 -15
- package/dist/index.js +239 -212
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1232,6 +1232,8 @@ declare class WorkflowEngine {
|
|
|
1232
1232
|
private readonly trackStepStart;
|
|
1233
1233
|
/** Where a freshly-started run executes — in-process by default (see {@link RunDispatcher}). */
|
|
1234
1234
|
private readonly runDispatcher;
|
|
1235
|
+
/** Per-key serialization for singleton workflows (admission, back-pressure, notify-on-release). */
|
|
1236
|
+
private readonly singletons;
|
|
1235
1237
|
/** Every registered workflow, keyed by `name@version` — so old versions stay runnable. */
|
|
1236
1238
|
private readonly workflows;
|
|
1237
1239
|
/** The newest registered version per workflow name — used to `start` new runs. */
|
|
@@ -1552,21 +1554,6 @@ declare class WorkflowEngine {
|
|
|
1552
1554
|
private completeStep;
|
|
1553
1555
|
/** Checkpoint a step that failed terminally, so the failure point is visible (not just the run). */
|
|
1554
1556
|
private failStep;
|
|
1555
|
-
/**
|
|
1556
|
-
* Whether `run` may run now under its singleton key: it's among the `limit` oldest in-flight runs
|
|
1557
|
-
* (running or suspended) sharing the key, by `(createdAt, id)` order. A consistent store gives every
|
|
1558
|
-
* instance the same ordering, so admission is race-free + FIFO.
|
|
1559
|
-
*/
|
|
1560
|
-
private admitSingleton;
|
|
1561
|
-
/**
|
|
1562
|
-
* Notify-on-release: a singleton run just settled (freeing a slot), so wake the gated waiters that
|
|
1563
|
-
* can now be admitted — immediately, instead of letting them sleep until their ~1s retry timer.
|
|
1564
|
-
* Dispatches up to `limit` of the oldest gated (`suspended` + same singleton tag) waiters by
|
|
1565
|
-
* `(createdAt, id)`; each re-checks admission in `runExecution` and runs only if it actually wins a
|
|
1566
|
-
* slot, so this never breaks the FIFO + race-free guarantees (the durable timer remains the
|
|
1567
|
-
* cross-instance / crash fallback — this just removes the poll latency on the happy path).
|
|
1568
|
-
*/
|
|
1569
|
-
private wakeNextSingletons;
|
|
1570
1557
|
private execute;
|
|
1571
1558
|
/**
|
|
1572
1559
|
* Advance a remote (cross-SDK) workflow one turn: hand its history to the executor (which dispatches
|
|
@@ -1574,6 +1561,14 @@ declare class WorkflowEngine {
|
|
|
1574
1561
|
* {@link runExecution}'s settle/suspend; the lease is held by {@link execute}. The result that lands
|
|
1575
1562
|
* us back here (a remote step finished, a timer fired) goes through `resume` like any TS workflow.
|
|
1576
1563
|
*/
|
|
1564
|
+
/**
|
|
1565
|
+
* Apply a terminal/suspended transition once: persist the new run status, emit the matching
|
|
1566
|
+
* lifecycle event, and (on completion/failure) wake a waiting parent. Both the TS and remote
|
|
1567
|
+
* executors funnel their completed/failed/suspended outcomes through here so a status update can
|
|
1568
|
+
* never drift from its event or `notifyParent` call. Does NOT touch the run lock — each executor
|
|
1569
|
+
* keeps its own lease handling (the TS executor's `finally`, the remote path's caller).
|
|
1570
|
+
*/
|
|
1571
|
+
private settleRun;
|
|
1577
1572
|
private runRemoteExecution;
|
|
1578
1573
|
/** The run's resolved durable ops as replay inputs: completed/failed steps + elapsed timers. */
|
|
1579
1574
|
private remoteHistory;
|
package/dist/index.d.ts
CHANGED
|
@@ -1232,6 +1232,8 @@ declare class WorkflowEngine {
|
|
|
1232
1232
|
private readonly trackStepStart;
|
|
1233
1233
|
/** Where a freshly-started run executes — in-process by default (see {@link RunDispatcher}). */
|
|
1234
1234
|
private readonly runDispatcher;
|
|
1235
|
+
/** Per-key serialization for singleton workflows (admission, back-pressure, notify-on-release). */
|
|
1236
|
+
private readonly singletons;
|
|
1235
1237
|
/** Every registered workflow, keyed by `name@version` — so old versions stay runnable. */
|
|
1236
1238
|
private readonly workflows;
|
|
1237
1239
|
/** The newest registered version per workflow name — used to `start` new runs. */
|
|
@@ -1552,21 +1554,6 @@ declare class WorkflowEngine {
|
|
|
1552
1554
|
private completeStep;
|
|
1553
1555
|
/** Checkpoint a step that failed terminally, so the failure point is visible (not just the run). */
|
|
1554
1556
|
private failStep;
|
|
1555
|
-
/**
|
|
1556
|
-
* Whether `run` may run now under its singleton key: it's among the `limit` oldest in-flight runs
|
|
1557
|
-
* (running or suspended) sharing the key, by `(createdAt, id)` order. A consistent store gives every
|
|
1558
|
-
* instance the same ordering, so admission is race-free + FIFO.
|
|
1559
|
-
*/
|
|
1560
|
-
private admitSingleton;
|
|
1561
|
-
/**
|
|
1562
|
-
* Notify-on-release: a singleton run just settled (freeing a slot), so wake the gated waiters that
|
|
1563
|
-
* can now be admitted — immediately, instead of letting them sleep until their ~1s retry timer.
|
|
1564
|
-
* Dispatches up to `limit` of the oldest gated (`suspended` + same singleton tag) waiters by
|
|
1565
|
-
* `(createdAt, id)`; each re-checks admission in `runExecution` and runs only if it actually wins a
|
|
1566
|
-
* slot, so this never breaks the FIFO + race-free guarantees (the durable timer remains the
|
|
1567
|
-
* cross-instance / crash fallback — this just removes the poll latency on the happy path).
|
|
1568
|
-
*/
|
|
1569
|
-
private wakeNextSingletons;
|
|
1570
1557
|
private execute;
|
|
1571
1558
|
/**
|
|
1572
1559
|
* Advance a remote (cross-SDK) workflow one turn: hand its history to the executor (which dispatches
|
|
@@ -1574,6 +1561,14 @@ declare class WorkflowEngine {
|
|
|
1574
1561
|
* {@link runExecution}'s settle/suspend; the lease is held by {@link execute}. The result that lands
|
|
1575
1562
|
* us back here (a remote step finished, a timer fired) goes through `resume` like any TS workflow.
|
|
1576
1563
|
*/
|
|
1564
|
+
/**
|
|
1565
|
+
* Apply a terminal/suspended transition once: persist the new run status, emit the matching
|
|
1566
|
+
* lifecycle event, and (on completion/failure) wake a waiting parent. Both the TS and remote
|
|
1567
|
+
* executors funnel their completed/failed/suspended outcomes through here so a status update can
|
|
1568
|
+
* never drift from its event or `notifyParent` call. Does NOT touch the run lock — each executor
|
|
1569
|
+
* keeps its own lease handling (the TS executor's `finally`, the remote path's caller).
|
|
1570
|
+
*/
|
|
1571
|
+
private settleRun;
|
|
1577
1572
|
private runRemoteExecution;
|
|
1578
1573
|
/** The run's resolved durable ops as replay inputs: completed/failed steps + elapsed timers. */
|
|
1579
1574
|
private remoteHistory;
|