@voltro/workflow 0.87.0 → 0.88.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/CHANGELOG.md +169 -6
- package/THIRD-PARTY-NOTICES.md +3 -1346
- package/dist/admission.js +1 -2
- package/dist/admissionDrainer.js +5 -3
- package/dist/admissionGate.js +1 -2
- package/dist/admissionStore.js +1 -2
- package/dist/admissionSubmission.js +1 -2
- package/dist/admissionTables.js +4 -4
- package/dist/admissionTransaction.js +1 -2
- package/dist/awaitEvent.js +1 -2
- package/dist/budgetHold.js +1 -2
- package/dist/cancelOnPlan.js +1 -2
- package/dist/cancelOnSweep.js +1 -2
- package/dist/cancelPendingStart.js +1 -2
- package/dist/clusterCron.js +1 -2
- package/dist/clusterDiagnostics.js +1 -2
- package/dist/clusterDiagnosticsSql.js +1 -2
- package/dist/clusterLayer.js +1 -2
- package/dist/clusterMigrationGate.js +1 -2
- package/dist/clusterRunnerLayer.js +1 -2
- package/dist/clusterShardGroups.js +1 -2
- package/dist/clusterTestSuite.d.ts +22 -2
- package/dist/clusterTestSuite.js +170 -172
- package/dist/controlMonitor.js +1 -2
- package/dist/controlRequest.js +1 -2
- package/dist/executionRefusal.js +1 -2
- package/dist/failureHandoff.js +1 -2
- package/dist/failureMessage.js +1 -2
- package/dist/failureRecovery.js +1 -2
- package/dist/failureReportStore.js +1 -2
- package/dist/flowControl.js +1 -2
- package/dist/forwardStartReceipts.js +1 -2
- package/dist/inMemoryLayer.js +1 -2
- package/dist/inMemoryRecorder.js +1 -2
- package/dist/index.d.ts +3 -1
- package/dist/inspectWorkflow.js +2 -3
- package/dist/journalEncryption.js +1 -2
- package/dist/journalRoutingGuard.js +1 -2
- package/dist/journalRoutingLayout.js +1 -2
- package/dist/journalRoutingLock.js +1 -2
- package/dist/journalRoutingMaintenance.js +1 -2
- package/dist/journalRoutingMessageStorage.js +1 -2
- package/dist/journalRoutingNamespace.js +1 -2
- package/dist/journalRoutingRuntime.js +1 -2
- package/dist/journalRoutingSharding.js +1 -2
- package/dist/journalRoutingState.js +1 -2
- package/dist/journalRoutingTable.js +1 -2
- package/dist/journalRoutingTransaction.js +2 -3
- package/dist/messages.js +1 -2
- package/dist/nondeterminism.js +1 -2
- package/dist/parentClosure.js +1 -2
- package/dist/parentClosureRecovery.js +1 -2
- package/dist/pendingSubmission.js +1 -2
- package/dist/prepareSubmissionDispatch.js +1 -2
- package/dist/preparedExecution.js +1 -2
- package/dist/primitives.js +1 -2
- package/dist/queuedCancellationRequest.js +1 -2
- package/dist/queuedControl.js +1 -2
- package/dist/recorder.js +1 -2
- package/dist/residentExecutionEvidence.js +1 -2
- package/dist/retryPolicy.js +1 -2
- package/dist/runEventsTable.js +1 -2
- package/dist/runGeneration.js +1 -2
- package/dist/runRecording.js +1 -2
- package/dist/runStepsTable.js +1 -2
- package/dist/runnerStorageGuard.js +1 -2
- package/dist/runsTable.js +1 -2
- package/dist/scheduleDeclaration.js +1 -2
- package/dist/signalHint.js +1 -2
- package/dist/signals.js +1 -2
- package/dist/signalsSuspending.js +1 -2
- package/dist/sqliteWorkflowOwnership.js +1 -2
- package/dist/stalenessSweep.js +1 -2
- package/dist/startContextsTable.js +1 -2
- package/dist/startReceipt.js +1 -2
- package/dist/submissionRecovery.js +1 -2
- package/dist/submissionRejection.js +1 -2
- package/dist/submissionRetry.js +1 -2
- package/dist/suspensionUnavailable.js +1 -2
- package/dist/updates.js +1 -2
- package/dist/watermarkTable.js +1 -2
- package/dist/webCrypto.js +4 -17
- package/dist/workflowDelivery.js +1 -2
- package/dist/workflowExecutorRouting.js +1 -2
- package/dist/workflowJournal.js +1 -2
- package/dist/workflowJournalReset.js +1 -2
- package/dist/workflowReadSelections.js +1 -2
- package/dist/workflowRestartDispatch.js +1 -2
- package/dist/workflowRestartObservation.js +1 -2
- package/dist/workflowRestartPreparation.js +1 -2
- package/dist/workflowRestartReservation.js +4 -4
- package/dist/workflowResumeDispatch.js +1 -2
- package/dist/workflowRuntimeReadiness.js +1 -2
- package/dist/workflowShardRelocation.js +1 -2
- package/dist/workflowShardRelocationSql.js +1 -2
- package/package.json +5 -11
package/dist/signalHint.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/signalHint.ts
|
|
2
2
|
var e = 3e5, t, n = (e) => {
|
|
3
3
|
t = e !== void 0 && Number.isFinite(e) && e > 0 ? e : void 0;
|
|
4
4
|
}, r = () => {
|
|
@@ -19,5 +19,4 @@ var e = 3e5, t, n = (e) => {
|
|
|
19
19
|
let a = e.workflowName === void 0 ? "" : ` in workflow '${e.workflowName}'`;
|
|
20
20
|
return (e.warn ?? ((e) => console.warn(e)))(`awaitSignal('${e.signalName}')${a} declares a ${Math.round(e.timeoutMs / 1e3)}s timeout — a wait that long holds a worker fiber for its whole duration. For human-approval-length waits, awaitSignalSuspending (same call shape, from @voltro/workflow) SUSPENDS the run and frees the slot until the signal arrives. This is a hint, not a behaviour change; it is logged once per workflow. Threshold: workflows.suspendSignalHintMs in app.config.ts, or VOLTRO_WORKFLOW_SUSPEND_HINT_MS.`), !0;
|
|
21
21
|
};
|
|
22
|
-
//#endregion
|
|
23
22
|
export { e as DEFAULT_SUSPEND_HINT_MS, o as maybeHintSuspendingSignal, a as resetSuspendHintsForTest, r as resolveSuspendHintMs, n as setSuspendSignalHintMs };
|
package/dist/signals.js
CHANGED
|
@@ -4,7 +4,7 @@ import { maybeHintSuspendingSignal as i } from "./signalHint.js";
|
|
|
4
4
|
import { Effect as a, Schema as o } from "effect";
|
|
5
5
|
import { and as s, eq as c } from "@voltro/database";
|
|
6
6
|
import { WorkflowInstance as l } from "effect/workflow/WorkflowEngine";
|
|
7
|
-
|
|
7
|
+
// src/signals.ts
|
|
8
8
|
var u = async (e, t) => {
|
|
9
9
|
if (e) try {
|
|
10
10
|
await e.recordEvent(t);
|
|
@@ -66,5 +66,4 @@ var u = async (e, t) => {
|
|
|
66
66
|
execute: p
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
-
//#endregion
|
|
70
69
|
export { d as awaitSignal };
|
|
@@ -4,7 +4,7 @@ import { SuspensionUnavailable as i, WorkflowCannotPark as a } from "./suspensio
|
|
|
4
4
|
import { resolveWorkflowMessageRun as o } from "./messages.js";
|
|
5
5
|
import { DurableClock as s, DurableDeferred as c, Workflow as l, WorkflowEngine as u } from "effect/workflow";
|
|
6
6
|
import { Cause as d, Effect as f, Exit as p, Schema as m } from "effect";
|
|
7
|
-
|
|
7
|
+
// src/signalsSuspending.ts
|
|
8
8
|
var h = 864e5, g = "voltro/suspending-signal", _ = (e, t) => `${g}/${e}/${t}`, v = (n, r) => c.make(n, { success: e(r) ? t(m.Unknown, `signal '${n}' value`) : m.Unknown }), y = async (e, t) => {
|
|
9
9
|
if (e) try {
|
|
10
10
|
await e.recordEvent(t);
|
|
@@ -53,5 +53,4 @@ var h = 864e5, g = "voltro/suspending-signal", _ = (e, t) => `${g}/${e}/${t}`, v
|
|
|
53
53
|
exit: p.succeed(e.payload)
|
|
54
54
|
}), { completed: !0 };
|
|
55
55
|
});
|
|
56
|
-
//#endregion
|
|
57
56
|
export { b as awaitSignalSuspending, x as completeSuspendingSignal, _ as suspendingSignalDeferredName };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect as e } from "effect";
|
|
2
2
|
import { realpath as t } from "node:fs/promises";
|
|
3
|
-
|
|
3
|
+
// src/sqliteWorkflowOwnership.ts
|
|
4
4
|
var n = (n) => e.gen(function* () {
|
|
5
5
|
let i = yield* e.tryPromise({
|
|
6
6
|
try: () => t(n),
|
|
@@ -22,5 +22,4 @@ var n = (n) => e.gen(function* () {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
}), r = (e) => e instanceof Error ? e : Error(String(e));
|
|
25
|
-
//#endregion
|
|
26
25
|
export { n as acquireSqliteWorkflowOwnership };
|
package/dist/stalenessSweep.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { and as e, eq as t, gt as n, inSet as r, lt as i, or as a } from "@voltro/database";
|
|
2
|
-
|
|
2
|
+
// src/stalenessSweep.ts
|
|
3
3
|
var o = 18e5, s = 200, c = 20, l = (e) => {
|
|
4
4
|
if (e instanceof Date) return e;
|
|
5
5
|
if (typeof e == "number") return new Date(e);
|
|
@@ -187,5 +187,4 @@ var o = 18e5, s = 200, c = 20, l = (e) => {
|
|
|
187
187
|
...w === void 0 ? {} : { nextRun: w }
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
|
-
//#endregion
|
|
191
190
|
export { o as DEFAULT_STALL_AFTER_MS, c as DEFAULT_STALL_EVENT_LOOKBACK, s as DEFAULT_STALL_RUN_PAGE, h as sweepStalledRuns };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { id as e, json as t, table as n, text as r, timestamp as i } from "@voltro/database";
|
|
2
|
-
|
|
2
|
+
// src/startContextsTable.ts
|
|
3
3
|
var a = n("_voltro_workflow_start_contexts", {
|
|
4
4
|
id: e({ prefix: "wfctx" }),
|
|
5
5
|
workflowName: r(),
|
|
@@ -16,5 +16,4 @@ var a = n("_voltro_workflow_start_contexts", {
|
|
|
16
16
|
]).nullable(),
|
|
17
17
|
createdAt: i().default("now")
|
|
18
18
|
}).index(["workflowName"]).index(["executionId"]).index(["parentExecutionId"]);
|
|
19
|
-
//#endregion
|
|
20
19
|
export { a as _voltroWorkflowStartContextsTable };
|
package/dist/startReceipt.js
CHANGED
|
@@ -5,7 +5,7 @@ import { PENDING_TABLE as r, toPendingIntent as i } from "./admissionStore.js";
|
|
|
5
5
|
import { Schema as a } from "effect";
|
|
6
6
|
import { WorkflowStartTerminalOutcomeSchema as o } from "@voltro/protocol";
|
|
7
7
|
import { and as s, eq as c, isNull as l } from "@voltro/database";
|
|
8
|
-
|
|
8
|
+
// src/startReceipt.ts
|
|
9
9
|
var u = "_voltro_workflow_start_receipts", d = class extends Error {
|
|
10
10
|
_tag = "WorkflowStartRequestConflictError";
|
|
11
11
|
constructor() {
|
|
@@ -139,5 +139,4 @@ var u = "_voltro_workflow_start_receipts", d = class extends Error {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
//#endregion
|
|
143
142
|
export { u as START_RECEIPTS_TABLE, d as WorkflowStartRequestConflictError, v as bindWorkflowStartReceipts, p as decodeWorkflowStartReceipt, m as readWorkflowStartReceipt, h as readWorkflowStartRequest, _ as recordWorkflowStartReceipt, g as resolveWorkflowStartReceipt, y as settlePendingStartReceipts };
|
|
@@ -4,7 +4,7 @@ import { acknowledgeAdmissionSubmissionInTransaction as n, beginAdmissionSubmiss
|
|
|
4
4
|
import { decodePendingPayload as c, releaseLease as l, retryBackoffMs as u } from "./admissionStore.js";
|
|
5
5
|
import { prepareSubmissionDispatch as d } from "./prepareSubmissionDispatch.js";
|
|
6
6
|
import { Schema as f } from "effect";
|
|
7
|
-
|
|
7
|
+
// src/submissionRecovery.ts
|
|
8
8
|
var p = /* @__PURE__ */ new WeakMap(), m = async (m, h, g, _) => {
|
|
9
9
|
let v = p.get(m), y = await o(m.store, g, v?.afterId), b = 0, x = 0, S = 0, C = 0, w = v?.nextDueAt, T = (e) => {
|
|
10
10
|
w = Math.min(w ?? e, e);
|
|
@@ -118,5 +118,4 @@ var p = /* @__PURE__ */ new WeakMap(), m = async (m, h, g, _) => {
|
|
|
118
118
|
examined: y.length > 0
|
|
119
119
|
});
|
|
120
120
|
};
|
|
121
|
-
//#endregion
|
|
122
121
|
export { m as recoverAdmissionSubmissions };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { readWorkflowFailureRecord as e } from "./failureReportStore.js";
|
|
2
|
-
|
|
2
|
+
// src/submissionRejection.ts
|
|
3
3
|
var t = async (t, n) => {
|
|
4
4
|
if (n.failureId === null) throw Error("Workflow submission has no rejection marker");
|
|
5
5
|
let r = await e(t, n.failureId);
|
|
6
6
|
if (n.executionId !== null || n.dispatchAttempts > 1 || r === void 0 || r.sourceKind !== "submission" || r.sourceId !== n.id || r.workflowName !== n.workflowName || r.tenantId !== n.tenantId || r.report.executionId !== null || r.report.runId !== null) throw Error("Workflow start rejection has contradictory ownership or execution evidence");
|
|
7
7
|
return r.id;
|
|
8
8
|
};
|
|
9
|
-
//#endregion
|
|
10
9
|
export { t as readProvenSubmissionRejection };
|
package/dist/submissionRetry.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readAdmissionSubmission as e } from "./admissionSubmission.js";
|
|
2
2
|
import { ADMISSIONS_TABLE as t } from "./admissionStore.js";
|
|
3
3
|
import { eq as n } from "@voltro/database";
|
|
4
|
-
|
|
4
|
+
// src/submissionRetry.ts
|
|
5
5
|
var r = (e, t) => ({
|
|
6
6
|
kind: "refused",
|
|
7
7
|
submissionId: e,
|
|
@@ -67,5 +67,4 @@ var r = (e, t) => ({
|
|
|
67
67
|
expected: o
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
|
-
//#endregion
|
|
71
70
|
export { o as inspectAdmissionSubmissionRetry, s as retryAdmissionSubmissionInTransaction };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Context as e } from "effect";
|
|
2
|
-
|
|
2
|
+
// src/suspensionUnavailable.ts
|
|
3
3
|
var t = e.Reference("@voltro/workflow/SuspensionUnavailable", { defaultValue: () => void 0 }), n = class extends Error {
|
|
4
4
|
constructor(e, t) {
|
|
5
5
|
super(`${e} cannot wait for a durable result here: ${t}`), this.name = "WorkflowCannotPark";
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { t as SuspensionUnavailable, n as WorkflowCannotPark };
|
package/dist/updates.js
CHANGED
|
@@ -4,7 +4,7 @@ import { CurrentWorkflowRunId as r, WorkflowRunRecorder as i } from "./recorder.
|
|
|
4
4
|
import { terminalUpdates as a } from "./workflowReadSelections.js";
|
|
5
5
|
import { Cause as o, Effect as s, Schema as c } from "effect";
|
|
6
6
|
import { eq as l } from "@voltro/database";
|
|
7
|
-
|
|
7
|
+
// src/updates.ts
|
|
8
8
|
var u = async (e, t) => {
|
|
9
9
|
if (e) try {
|
|
10
10
|
await e.recordEvent(t);
|
|
@@ -83,5 +83,4 @@ var u = async (e, t) => {
|
|
|
83
83
|
execute: f
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
//#endregion
|
|
87
86
|
export { f as awaitUpdate };
|
package/dist/watermarkTable.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { id as e, table as t, timestamp as n } from "@voltro/database";
|
|
2
|
-
|
|
2
|
+
// src/watermarkTable.ts
|
|
3
3
|
var r = t("_voltro_workflow_watermarks", {
|
|
4
4
|
id: e({ prefix: "wfwm" }),
|
|
5
5
|
positionAt: n(),
|
|
6
6
|
updatedAt: n().default("now")
|
|
7
7
|
});
|
|
8
|
-
//#endregion
|
|
9
8
|
export { r as _voltroWorkflowWatermarksTable };
|
package/dist/webCrypto.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
digest: (e, n) => t.tryPromise({
|
|
6
|
-
try: async () => new Uint8Array(await globalThis.crypto.subtle.digest(e, new Uint8Array(n).buffer)),
|
|
7
|
-
catch: (t) => r.systemError({
|
|
8
|
-
_tag: "Unknown",
|
|
9
|
-
module: "Crypto",
|
|
10
|
-
method: "digest",
|
|
11
|
-
description: `digest ${e} failed`,
|
|
12
|
-
cause: t
|
|
13
|
-
})
|
|
14
|
-
})
|
|
15
|
-
}), a = n.succeed(e.Crypto, i);
|
|
16
|
-
//#endregion
|
|
17
|
-
export { i as webCrypto, a as webCryptoLayer };
|
|
1
|
+
import { Digest as e } from "effect/crypto";
|
|
2
|
+
// src/webCrypto.ts
|
|
3
|
+
var t = e.layerWebCrypto;
|
|
4
|
+
export { t as webCryptoLayer };
|
package/dist/workflowDelivery.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context as e, Effect as t } from "effect";
|
|
2
|
-
|
|
2
|
+
// src/workflowDelivery.ts
|
|
3
3
|
var n = "voltro-workflow-restart", r = class extends e.Service()("voltro/CurrentWorkflowDelivery") {}, i = (e) => ({
|
|
4
4
|
...e,
|
|
5
5
|
registerEntity: (n, i, a) => e.registerEntity(n, n.type.startsWith("Workflow/") ? i.pipe(t.map((e) => {
|
|
@@ -20,5 +20,4 @@ var n = "voltro-workflow-restart", r = class extends e.Service()("voltro/Current
|
|
|
20
20
|
};
|
|
21
21
|
})) : i, a)
|
|
22
22
|
});
|
|
23
|
-
//#endregion
|
|
24
23
|
export { r as CurrentWorkflowDelivery, n as WORKFLOW_RESTART_HEADER, i as withWorkflowDelivery };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { journalExecutorGroups as e } from "./journalRoutingLayout.js";
|
|
2
2
|
import { WorkflowEngine as t } from "effect/workflow";
|
|
3
3
|
import { Context as n, Effect as r, Layer as i, Option as a } from "effect";
|
|
4
|
-
|
|
4
|
+
// src/workflowExecutorRouting.ts
|
|
5
5
|
var o = n.Service("@voltro/workflow/WorkflowExecutorRouting"), s = (e, t, r, i, a) => n.add(e, o, Object.freeze({
|
|
6
6
|
engine: t,
|
|
7
7
|
mode: r,
|
|
@@ -29,5 +29,4 @@ var o = n.Service("@voltro/workflow/WorkflowExecutorRouting"), s = (e, t, r, i,
|
|
|
29
29
|
});
|
|
30
30
|
return i.effectDiscard(d).pipe(i.provideMerge(n));
|
|
31
31
|
};
|
|
32
|
-
//#endregion
|
|
33
32
|
export { s as recordWorkflowExecutorRouting, c as withWorkflowExecutorSelection };
|
package/dist/workflowJournal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { latestExitReply as e } from "./workflowReadSelections.js";
|
|
2
2
|
import { Context as t, Effect as n, Option as r, Schema as i } from "effect";
|
|
3
3
|
import { ClusterSchema as a, EntityAddress as o, EntityId as s, EntityType as c, MessageStorage as l, Sharding as u } from "effect/cluster";
|
|
4
|
-
|
|
4
|
+
// src/workflowJournal.ts
|
|
5
5
|
var d = (e, t) => `${e}/${t}`, f = (e, n, r) => {
|
|
6
6
|
let i = s.make(n), l = t.get(e.annotations, a.ShardGroup)(i);
|
|
7
7
|
return new o.EntityAddress({
|
|
@@ -120,5 +120,4 @@ var d = (e, t) => `${e}/${t}`, f = (e, n, r) => {
|
|
|
120
120
|
reason: "run-reset-unconfirmed"
|
|
121
121
|
};
|
|
122
122
|
});
|
|
123
|
-
//#endregion
|
|
124
123
|
export { m as JournalExit, d as activityPrimaryKey, g as classifyRunReply, p as readWorkflowRunReply, _ as redriveFailedRun, v as resumeRunFromStep, f as runEntityAddress };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WORKFLOW_RESTART_HEADER as e } from "./workflowDelivery.js";
|
|
2
2
|
import { Effect as t, Schema as n } from "effect";
|
|
3
3
|
import { SqlClient as r } from "effect/sql";
|
|
4
|
-
|
|
4
|
+
// src/workflowJournalReset.ts
|
|
5
5
|
var i = n.fromJsonString(n.Struct({
|
|
6
6
|
_tag: n.Literal("Success"),
|
|
7
7
|
value: n.Struct({ _tag: n.Literal("Suspended") })
|
|
@@ -107,5 +107,4 @@ var i = n.fromJsonString(n.Struct({
|
|
|
107
107
|
};
|
|
108
108
|
}).pipe(d.withTransaction, t.provideService(r.SafeIntegers, !0));
|
|
109
109
|
}), c = (e, t) => s(e, t === void 0 ? {} : { restart: t }), l = (e) => s([e], { suspension: e });
|
|
110
|
-
//#endregion
|
|
111
110
|
export { o as observeWorkflowSuspension, c as resetExpectedWorkflowReplies, l as resetExpectedWorkflowSuspension };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/workflowReadSelections.ts
|
|
2
2
|
var e = (e) => e.findLast((e, t, n) => t in n && e._tag === "WithExit"), t = (e) => {
|
|
3
3
|
let t = /* @__PURE__ */ new Set();
|
|
4
4
|
for (let n of e) {
|
|
@@ -8,5 +8,4 @@ var e = (e) => e.findLast((e, t, n) => t in n && e._tag === "WithExit"), t = (e)
|
|
|
8
8
|
}
|
|
9
9
|
return t;
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { e as latestExitReply, t as terminalUpdates };
|
|
@@ -6,7 +6,7 @@ import { observeWorkflowRestartReplies as s } from "./workflowRestartObservation
|
|
|
6
6
|
import { Context as c, Effect as l, Option as u } from "effect";
|
|
7
7
|
import { SqlClient as d } from "effect/sql";
|
|
8
8
|
import { MessageStorage as f, Sharding as p } from "effect/cluster";
|
|
9
|
-
|
|
9
|
+
// src/workflowRestartDispatch.ts
|
|
10
10
|
var m = (e) => l.gen(function* () {
|
|
11
11
|
let t = yield* r(e);
|
|
12
12
|
return t.kind === "waiting-capacity" ? t : (yield* (yield* p.Sharding).pollStorage, {
|
|
@@ -31,5 +31,4 @@ var m = (e) => l.gen(function* () {
|
|
|
31
31
|
dispatch: (e) => t(r, m(e)).pipe(l.provideService(d.SqlClient, g), l.provideService(p.Sharding, _))
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
//#endregion
|
|
35
34
|
export { h as WorkflowRestartDispatcher, m as dispatchWorkflowRestart, g as makeWorkflowRestartDispatcher };
|
|
@@ -3,7 +3,7 @@ import { activityPrimaryKey as e, classifyRunReply as t, runEntityAddress as n }
|
|
|
3
3
|
import { Effect as r, Option as i, Schema as a } from "effect";
|
|
4
4
|
import { SqlClient as o } from "effect/sql";
|
|
5
5
|
import { MessageStorage as s, Sharding as c } from "effect/cluster";
|
|
6
|
-
|
|
6
|
+
// src/workflowRestartObservation.ts
|
|
7
7
|
var l = a.fromJsonString(a.Record(a.String, a.String)), u = (u) => r.gen(function* () {
|
|
8
8
|
if (!/^[1-9]\d*$/.test(u.delivery.requestId) || u.executionId.length === 0 || u.activities.some((e) => e.name.length === 0 || !Number.isSafeInteger(e.attempt) || e.attempt < 1)) return yield* r.die(/* @__PURE__ */ Error("Restart observation requires an exact delivery and valid activity attempts"));
|
|
9
9
|
let d = (yield* o.SqlClient).withoutTransforms(), f = yield* s.MessageStorage, p = yield* c.Sharding, m = n(u.workflow, u.executionId, p), h = (e, t) => r.gen(function* () {
|
|
@@ -56,5 +56,4 @@ var l = a.fromJsonString(a.Record(a.String, a.String)), u = (u) => r.gen(functio
|
|
|
56
56
|
}))
|
|
57
57
|
};
|
|
58
58
|
}).pipe(r.provideService(o.SafeIntegers, !0));
|
|
59
|
-
//#endregion
|
|
60
59
|
export { u as observeWorkflowRestartReplies };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readWorkflowRestartCommandInTransaction as e, readWorkflowRestartReservationInTransaction as t, reserveWorkflowRestartInTransaction as n } from "./workflowRestartReservation.js";
|
|
2
2
|
import { Schema as r } from "effect";
|
|
3
3
|
import { eq as i } from "@voltro/database";
|
|
4
|
-
|
|
4
|
+
// src/workflowRestartPreparation.ts
|
|
5
5
|
var a = async (t) => {
|
|
6
6
|
if (t.workflow._tag !== t.command.workflowName || t.control.workflowName !== t.command.workflowName) throw Error("Restart preparation requires the matching workflow");
|
|
7
7
|
let n = await t.transaction(async (n) => {
|
|
@@ -105,5 +105,4 @@ var a = async (t) => {
|
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
|
-
//#endregion
|
|
109
108
|
export { s as prepareWorkflowRestart, a as prepareWorkflowRestartCommand };
|
|
@@ -5,7 +5,7 @@ import { resetExpectedWorkflowReplies as a } from "./workflowJournalReset.js";
|
|
|
5
5
|
import { Effect as o, Schema as s } from "effect";
|
|
6
6
|
import { WorkflowRestartObservationSchema as c, WorkflowRestartSelectionSchema as l, WorkflowRestartTargetSchema as u } from "@voltro/protocol";
|
|
7
7
|
import { and as d, derivedRowId as f, eq as p, id as m, integer as h, json as g, or as _, table as v, text as y, timestamp as b } from "@voltro/database";
|
|
8
|
-
|
|
8
|
+
// src/workflowRestartReservation.ts
|
|
9
9
|
var x = v("_voltro_workflow_restart_requests", {
|
|
10
10
|
id: m({ prefix: "wfrs" }),
|
|
11
11
|
runId: y(),
|
|
@@ -21,8 +21,9 @@ var x = v("_voltro_workflow_restart_requests", {
|
|
|
21
21
|
eviction: g().nullable(),
|
|
22
22
|
requestedAt: b(),
|
|
23
23
|
dispatchAttempts: h().default(0),
|
|
24
|
-
enteredGeneration: y().nullable()
|
|
25
|
-
|
|
24
|
+
enteredGeneration: y().nullable(),
|
|
25
|
+
poolReleaseSettledAt: b().nullable()
|
|
26
|
+
}).unique(["runId", "generation"]).unique(["runId", "token"]).index("_voltro_workflow_restart_requests_pool_settlement_idx", ["poolReleaseSettledAt", "id"]).nonReactive(), S = s.NonEmptyString, C = s.Struct({
|
|
26
27
|
requestId: S,
|
|
27
28
|
restartToken: s.NullOr(S)
|
|
28
29
|
}), w = s.Struct({
|
|
@@ -423,5 +424,4 @@ var x = v("_voltro_workflow_restart_requests", {
|
|
|
423
424
|
})
|
|
424
425
|
};
|
|
425
426
|
};
|
|
426
|
-
//#endregion
|
|
427
427
|
export { z as beginWorkflowRestartDispatchInTransaction, V as consumeWorkflowRestartInTransaction, P as readWorkflowRestartCommandInTransaction, N as readWorkflowRestartObservationInTransaction, I as readWorkflowRestartReservationInTransaction, L as reserveWorkflowRestartInTransaction, B as resetReservedWorkflowJournal, F as withdrawWorkflowRestartInTransaction, x as workflowRestartRequestsTable, E as workflowRestartWithdrawalsTable };
|
|
@@ -4,7 +4,7 @@ import { observeWorkflowSuspension as a, resetExpectedWorkflowSuspension as o }
|
|
|
4
4
|
import { Context as s, Effect as c, Option as l } from "effect";
|
|
5
5
|
import { SqlClient as u } from "effect/sql";
|
|
6
6
|
import { Sharding as d } from "effect/cluster";
|
|
7
|
-
|
|
7
|
+
// src/workflowResumeDispatch.ts
|
|
8
8
|
var f = (n) => c.gen(function* () {
|
|
9
9
|
let i = yield* c.context(), s = yield* r(() => n.transaction((e) => t(e, n.requestId, (e) => c.runPromiseWith(i)(a(e)))));
|
|
10
10
|
if (s.kind !== "bound") return s;
|
|
@@ -26,5 +26,4 @@ var f = (n) => c.gen(function* () {
|
|
|
26
26
|
let e = l.getOrUndefined(yield* c.serviceOption(n)), t = yield* u.SqlClient, r = yield* d.Sharding;
|
|
27
27
|
return p.of({ dispatch: (n) => i(e, f(n)).pipe(c.provideService(u.SqlClient, t), c.provideService(d.Sharding, r)) });
|
|
28
28
|
});
|
|
29
|
-
//#endregion
|
|
30
29
|
export { p as WorkflowResumeDispatcher, f as dispatchWorkflowResume, m as makeWorkflowResumeDispatcher };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { JournalRoutingGuard as e } from "./journalRoutingGuard.js";
|
|
2
2
|
import { Context as t, Effect as n, Option as r } from "effect";
|
|
3
3
|
import { Sharding as i } from "effect/cluster";
|
|
4
|
-
|
|
4
|
+
// src/workflowRuntimeReadiness.ts
|
|
5
5
|
var a = class extends t.Service()("@voltro/workflow/WorkflowRuntimeReadiness") {}, o = n.gen(function* () {
|
|
6
6
|
let t = yield* i.Sharding, a = r.getOrUndefined(yield* n.serviceOption(e)), o = !0;
|
|
7
7
|
return yield* n.addFinalizer(() => n.sync(() => {
|
|
8
8
|
o = !1;
|
|
9
9
|
})), { isReady: () => o && !a?.isClosed() && !n.runSync(t.isShutdown) };
|
|
10
10
|
}), s = n.map(n.serviceOption(a), (e) => r.isSome(e) ? e.value.isReady : () => !0);
|
|
11
|
-
//#endregion
|
|
12
11
|
export { a as WorkflowRuntimeReadiness, s as captureWorkflowRuntimeReadiness, o as makeWorkflowRuntimeReadiness };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { captureWorkflowShardGroups as e } from "./clusterShardGroups.js";
|
|
2
2
|
import { ShardId as t } from "effect/cluster";
|
|
3
|
-
|
|
3
|
+
// src/workflowShardRelocation.ts
|
|
4
4
|
var n = "Workflow/-/DurableClock", r = (r, i) => {
|
|
5
5
|
let a = /* @__PURE__ */ new Map();
|
|
6
6
|
for (let t of i) {
|
|
@@ -54,5 +54,4 @@ var n = "Workflow/-/DurableClock", r = (r, i) => {
|
|
|
54
54
|
return n < r ? -1 : +(n > r);
|
|
55
55
|
}));
|
|
56
56
|
};
|
|
57
|
-
//#endregion
|
|
58
57
|
export { r as planJournalShardRelocation };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { planJournalShardRelocation as e } from "./workflowShardRelocation.js";
|
|
2
2
|
import { Context as t, Effect as n } from "effect";
|
|
3
3
|
import { SqlClient as r } from "effect/sql";
|
|
4
|
-
|
|
4
|
+
// src/workflowShardRelocationSql.ts
|
|
5
5
|
var i = class extends t.Service()("@voltro/workflow/JournalRoutingMaintenance") {}, a = (t, a = 256) => n.gen(function* () {
|
|
6
6
|
if (!Number.isInteger(a) || a < 1 || a > 1e3) return yield* n.fail(/* @__PURE__ */ Error("Journal relocation page size must be between 1 and 1000"));
|
|
7
7
|
let o = t.map((e) => Object.freeze({ ...e }));
|
|
@@ -68,5 +68,4 @@ var i = class extends t.Service()("@voltro/workflow/JournalRoutingMaintenance")
|
|
|
68
68
|
return { moved: r };
|
|
69
69
|
})));
|
|
70
70
|
}).pipe(n.provideService(r.SafeIntegers, !0));
|
|
71
|
-
//#endregion
|
|
72
71
|
export { i as JournalRoutingMaintenance, a as relocateWorkflowJournal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/workflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"description": "Durable workflows for Voltro — the workflow() descriptor + step() / awaitSignal primitives over @effect/cluster, with a browser-safe define subpath.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -48,18 +48,12 @@
|
|
|
48
48
|
"node": ">=24.0.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@voltro/database": "0.
|
|
52
|
-
"@voltro/logger": "0.
|
|
53
|
-
"@voltro/protocol": "0.
|
|
51
|
+
"@voltro/database": "0.88.0",
|
|
52
|
+
"@voltro/logger": "0.88.0",
|
|
53
|
+
"@voltro/protocol": "0.88.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"effect": "4.0
|
|
57
|
-
"vitest": ">=3.0.0"
|
|
58
|
-
},
|
|
59
|
-
"peerDependenciesMeta": {
|
|
60
|
-
"vitest": {
|
|
61
|
-
"optional": true
|
|
62
|
-
}
|
|
56
|
+
"effect": "4.1.0"
|
|
63
57
|
},
|
|
64
58
|
"publishConfig": {
|
|
65
59
|
"access": "public"
|