@dudousxd/nestjs-durable-core 0.44.0 → 0.44.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 +5 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -21
- package/dist/index.d.ts +20 -21
- package/dist/index.js +5 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -773,7 +773,6 @@ function eventMatches(payload, match) {
|
|
|
773
773
|
__name(eventMatches, "eventMatches");
|
|
774
774
|
|
|
775
775
|
// src/remote-workflow-executor.ts
|
|
776
|
-
var taskCounter = 0;
|
|
777
776
|
var RemoteWorkflowExecutor = class {
|
|
778
777
|
static {
|
|
779
778
|
__name(this, "RemoteWorkflowExecutor");
|
|
@@ -785,15 +784,13 @@ var RemoteWorkflowExecutor = class {
|
|
|
785
784
|
this.group = group;
|
|
786
785
|
}
|
|
787
786
|
/**
|
|
788
|
-
*
|
|
789
|
-
*
|
|
787
|
+
* Enqueue one workflow turn under the engine-supplied `taskId`. Does NOT await the decision — the
|
|
788
|
+
* engine has already suspended the run on `taskId` and applies the decision durably via `onDecision`.
|
|
790
789
|
*/
|
|
791
|
-
async dispatch(run, history, pendingSignals) {
|
|
790
|
+
async dispatch(run, history, taskId, pendingSignals) {
|
|
792
791
|
if (!this.transport.dispatchWorkflowTask) {
|
|
793
792
|
throw new Error("transport does not support workflow tasks (dispatchWorkflowTask)");
|
|
794
793
|
}
|
|
795
|
-
taskCounter += 1;
|
|
796
|
-
const taskId = `${run.id}:wf:${taskCounter}`;
|
|
797
794
|
const task = {
|
|
798
795
|
taskId,
|
|
799
796
|
runId: run.id,
|
|
@@ -809,9 +806,6 @@ var RemoteWorkflowExecutor = class {
|
|
|
809
806
|
attempt: 1
|
|
810
807
|
};
|
|
811
808
|
await this.transport.dispatchWorkflowTask(task);
|
|
812
|
-
return {
|
|
813
|
-
taskId
|
|
814
|
-
};
|
|
815
809
|
}
|
|
816
810
|
};
|
|
817
811
|
|
|
@@ -3000,19 +2994,9 @@ var WorkflowEngine = class {
|
|
|
3000
2994
|
}
|
|
3001
2995
|
const history = await this.remoteHistory(run.id);
|
|
3002
2996
|
if (remote.executor.dispatch) {
|
|
3003
|
-
const
|
|
2997
|
+
const taskId = `${run.id}:wf:${globalThis.crypto.randomUUID().slice(0, 8)}`;
|
|
3004
2998
|
const silenceMs = this.remoteAdvanceSilenceMs;
|
|
3005
2999
|
const wakeAt = silenceMs != null ? this.clock() + silenceMs : void 0;
|
|
3006
|
-
const fresh = await this.store.getRun(run.id);
|
|
3007
|
-
if (fresh && (fresh.status === "cancelled" || fresh.status === "completed" || fresh.status === "dead")) {
|
|
3008
|
-
await this.store.releaseRunLock(run.id);
|
|
3009
|
-
return {
|
|
3010
|
-
runId: run.id,
|
|
3011
|
-
status: fresh.status,
|
|
3012
|
-
output: fresh.output,
|
|
3013
|
-
error: fresh.error
|
|
3014
|
-
};
|
|
3015
|
-
}
|
|
3016
3000
|
await this.store.updateRun(run.id, {
|
|
3017
3001
|
status: "suspended",
|
|
3018
3002
|
awaitingDecisionTaskId: taskId,
|
|
@@ -3025,6 +3009,7 @@ var WorkflowEngine = class {
|
|
|
3025
3009
|
workflow: run.workflow
|
|
3026
3010
|
});
|
|
3027
3011
|
await this.store.releaseRunLock(run.id);
|
|
3012
|
+
await remote.executor.dispatch(run, history, taskId);
|
|
3028
3013
|
return {
|
|
3029
3014
|
runId: run.id,
|
|
3030
3015
|
status: "suspended"
|