@voltro/workflow 0.85.0 → 0.87.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 +5987 -0
- package/THIRD-PARTY-NOTICES.md +1122 -31
- package/dist/admission.js +140 -0
- package/dist/admissionDrainer.js +705 -0
- package/dist/admissionGate.js +115 -0
- package/dist/admissionStore.js +347 -0
- package/dist/admissionSubmission.js +297 -0
- package/dist/admissionTables.js +137 -0
- package/dist/admissionTransaction.js +21 -0
- package/dist/awaitEvent.js +82 -0
- package/dist/budgetHold.js +136 -0
- package/dist/cancelOnPlan.js +75 -0
- package/dist/cancelOnSweep.js +188 -0
- package/dist/cancelPendingStart.js +50 -0
- package/dist/cluster.d.ts +111 -27
- package/dist/cluster.js +12 -2
- package/dist/clusterCron.js +19 -0
- package/dist/clusterDiagnostics.js +20 -0
- package/dist/clusterDiagnosticsSql.js +145 -0
- package/dist/clusterLayer.js +145 -0
- package/dist/clusterMigrationGate.js +61 -0
- package/dist/clusterRunnerLayer.js +31 -0
- package/dist/clusterShardGroups.js +33 -0
- package/dist/clusterTestSuite.d.ts +23 -0
- package/dist/clusterTestSuite.js +209 -179
- package/dist/controlMonitor.js +13 -0
- package/dist/controlRequest.js +367 -0
- package/dist/executionRefusal.js +162 -0
- package/dist/failureHandoff.js +183 -0
- package/dist/failureMessage.js +12 -0
- package/dist/failureRecovery.js +50 -0
- package/dist/failureReportStore.js +60 -0
- package/dist/flowControl.js +142 -0
- package/dist/forwardStartReceipts.js +41 -0
- package/dist/inMemoryLayer.js +7 -0
- package/dist/inMemoryRecorder.js +56 -0
- package/dist/index.d.ts +129 -30
- package/dist/index.js +50 -5
- package/dist/inspectWorkflow.js +101 -0
- package/dist/{journalEncryption-DTyhUzaS.js → journalEncryption.js} +30 -37
- package/dist/journalRoutingGuard.js +50 -0
- package/dist/journalRoutingLayout.js +47 -0
- package/dist/journalRoutingLock.js +39 -0
- package/dist/journalRoutingMaintenance.js +24 -0
- package/dist/journalRoutingMessageStorage.js +32 -0
- package/dist/journalRoutingNamespace.js +23 -0
- package/dist/journalRoutingRuntime.js +33 -0
- package/dist/journalRoutingSharding.js +28 -0
- package/dist/journalRoutingState.js +93 -0
- package/dist/journalRoutingTable.js +11 -0
- package/dist/journalRoutingTransaction.js +16 -0
- package/dist/messages.js +92 -0
- package/dist/nondeterminism.js +51 -0
- package/dist/parentClosure.js +141 -0
- package/dist/parentClosureRecovery.js +54 -0
- package/dist/pendingSubmission.js +85 -0
- package/dist/prepareSubmissionDispatch.js +17 -0
- package/dist/preparedExecution.js +14 -0
- package/dist/primitives.js +225 -2
- package/dist/queuedCancellationRequest.js +364 -0
- package/dist/queuedControl.js +21 -0
- package/dist/recorder.js +11 -0
- package/dist/residentExecutionEvidence.js +64 -0
- package/dist/retryPolicy.js +57 -0
- package/dist/runEventsTable.js +17 -0
- package/dist/runGeneration.js +345 -0
- package/dist/runRecording.js +615 -0
- package/dist/runStepsTable.js +28 -0
- package/dist/runnerStorageGuard.js +29 -0
- package/dist/runsTable.js +42 -0
- package/dist/scheduleDeclaration.js +44 -0
- package/dist/signalHint.js +23 -0
- package/dist/signals.js +70 -0
- package/dist/signalsSuspending.js +57 -0
- package/dist/sqliteWorkflowOwnership.js +26 -0
- package/dist/stalenessSweep.js +191 -0
- package/dist/startContextsTable.js +20 -0
- package/dist/startReceipt.js +143 -0
- package/dist/submissionRecovery.js +122 -0
- package/dist/submissionRejection.js +10 -0
- package/dist/submissionRetry.js +71 -0
- package/dist/suspensionUnavailable.js +9 -0
- package/dist/updates.js +87 -0
- package/dist/watermarkTable.js +9 -0
- package/dist/webCrypto.js +17 -0
- package/dist/workflowDelivery.js +24 -0
- package/dist/workflowExecutorRouting.js +33 -0
- package/dist/workflowJournal.js +124 -0
- package/dist/workflowJournalReset.js +111 -0
- package/dist/workflowReadSelections.js +12 -0
- package/dist/workflowRestartDispatch.js +35 -0
- package/dist/workflowRestartObservation.js +60 -0
- package/dist/workflowRestartPreparation.js +109 -0
- package/dist/workflowRestartReservation.js +427 -0
- package/dist/workflowResumeDispatch.js +30 -0
- package/dist/workflowRuntimeReadiness.js +12 -0
- package/dist/workflowShardRelocation.js +58 -0
- package/dist/workflowShardRelocationSql.js +72 -0
- package/package.json +4 -4
- package/dist/cluster-F_bhqVP7.js +0 -679
- package/dist/primitives-DX04WTWh.js +0 -507
- package/dist/src-C2NEyUM8.js +0 -3925
- package/dist/workflowReadSelections-CZAUjP7f.js +0 -2096
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
//#region src/admission.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
workflowName;
|
|
4
|
+
field;
|
|
5
|
+
constructor(e, t, n) {
|
|
6
|
+
super(`workflow '${e}': ${t}(payload) threw — a flow-control key function must be total over every payload the workflow accepts, because it runs before the run exists and there is nowhere to report a partial failure to. Cause: ${n instanceof Error ? n.message : String(n)}`), this.name = "FlowControlKeyError", this.workflowName = e, this.field = t, this.cause = n;
|
|
7
|
+
}
|
|
8
|
+
}, t = (t, n, r, i) => {
|
|
9
|
+
try {
|
|
10
|
+
let e = r(i);
|
|
11
|
+
if (typeof e != "string" || e.length === 0) throw Error(`returned ${e === "" ? "an empty string" : String(e)}; expected a non-empty string`);
|
|
12
|
+
return e;
|
|
13
|
+
} catch (r) {
|
|
14
|
+
throw new e(t, n, r);
|
|
15
|
+
}
|
|
16
|
+
}, n = (e, t) => JSON.stringify([e ?? null, t]), r = (r, i) => {
|
|
17
|
+
let a = r.workflowName, o = 0;
|
|
18
|
+
if (r.priority !== void 0) try {
|
|
19
|
+
let e = r.priority(i);
|
|
20
|
+
if (!Number.isFinite(e)) throw Error(`returned ${String(e)}; expected a finite number`);
|
|
21
|
+
o = Math.trunc(e);
|
|
22
|
+
} catch (t) {
|
|
23
|
+
throw new e(a, "priority", t);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
...r.debounce === void 0 ? {} : { debounceKey: t(a, "debounce.key", r.debounce.key, i) },
|
|
27
|
+
...r.singleton === void 0 ? {} : { singletonKey: t(a, "singleton.key", r.singleton.key, i) },
|
|
28
|
+
...r.concurrency === void 0 ? {} : { concurrencyKey: n(r.concurrency.pool, r.concurrency.key === void 0 ? "" : t(a, "concurrency.key", r.concurrency.key, i)) },
|
|
29
|
+
...r.throttle?.key === void 0 ? r.throttle === void 0 ? {} : { throttleKey: "" } : { throttleKey: t(a, "throttle.key", r.throttle.key, i) },
|
|
30
|
+
...r.rateLimit?.key === void 0 ? r.rateLimit === void 0 ? {} : { rateLimitKey: "" } : { rateLimitKey: t(a, "rateLimit.key", r.rateLimit.key, i) },
|
|
31
|
+
...r.batch?.key === void 0 ? r.batch === void 0 ? {} : { batchKey: "" } : { batchKey: t(a, "batch.key", r.batch.key, i) },
|
|
32
|
+
priority: o
|
|
33
|
+
};
|
|
34
|
+
}, i = (e, t, n, r) => {
|
|
35
|
+
let i = e.filter((e) => e > r - n);
|
|
36
|
+
if (i.length < t) return;
|
|
37
|
+
let a = [...i].sort((e, t) => t - e)[t - 1];
|
|
38
|
+
if (a !== void 0) return a + n;
|
|
39
|
+
}, a = (e) => {
|
|
40
|
+
let { control: t, keys: n, state: r, now: a, reconsidering: c } = e;
|
|
41
|
+
if (r.paused === !0) return {
|
|
42
|
+
kind: "defer",
|
|
43
|
+
mode: "paused",
|
|
44
|
+
dueAt: a,
|
|
45
|
+
collapse: c ? "hold" : "append",
|
|
46
|
+
keys: n
|
|
47
|
+
};
|
|
48
|
+
if (t.rateLimit !== void 0) {
|
|
49
|
+
let e = i(r.recentAdmissions ?? [], t.rateLimit.limit, t.rateLimit.periodMs, a);
|
|
50
|
+
if (e !== void 0) return {
|
|
51
|
+
kind: "drop",
|
|
52
|
+
reason: "rate-limit",
|
|
53
|
+
retryAfterMs: Math.max(0, e - a),
|
|
54
|
+
keys: n
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (t.singleton !== void 0 && r.singletonUnacknowledged === !0) return {
|
|
58
|
+
kind: "defer",
|
|
59
|
+
mode: "singleton",
|
|
60
|
+
dueAt: a,
|
|
61
|
+
collapse: c ? "hold" : "append",
|
|
62
|
+
keys: n
|
|
63
|
+
};
|
|
64
|
+
if (t.singleton !== void 0 && t.singleton.mode === "skip" && r.singletonHolder !== void 0) return {
|
|
65
|
+
kind: "skip",
|
|
66
|
+
incumbent: r.singletonHolder,
|
|
67
|
+
keys: n
|
|
68
|
+
};
|
|
69
|
+
if (t.debounce !== void 0) {
|
|
70
|
+
let e = r.debouncePending, i = e?.firstSeenAt ?? a, o = e?.deadlineAt ?? (t.debounce.timeoutMs === void 0 ? void 0 : i + t.debounce.timeoutMs);
|
|
71
|
+
return c ? o !== void 0 && a >= o ? {
|
|
72
|
+
kind: "admit",
|
|
73
|
+
reason: "debounce-deadline",
|
|
74
|
+
keys: n,
|
|
75
|
+
...s(t, r)
|
|
76
|
+
} : {
|
|
77
|
+
kind: "admit",
|
|
78
|
+
reason: "debounce-elapsed",
|
|
79
|
+
keys: n,
|
|
80
|
+
...s(t, r)
|
|
81
|
+
} : {
|
|
82
|
+
kind: "defer",
|
|
83
|
+
mode: "debounce",
|
|
84
|
+
dueAt: o === void 0 ? a + t.debounce.periodMs : Math.min(a + t.debounce.periodMs, o),
|
|
85
|
+
...o === void 0 ? {} : { deadlineAt: o },
|
|
86
|
+
collapse: "replace",
|
|
87
|
+
keys: n
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (t.batch !== void 0) {
|
|
91
|
+
let e = r.batchPending, i = (e?.count ?? 0) + +!c, o = (e?.firstSeenAt ?? a) + t.batch.timeoutMs;
|
|
92
|
+
return i >= t.batch.maxSize ? {
|
|
93
|
+
kind: "admit",
|
|
94
|
+
reason: "batch-full",
|
|
95
|
+
keys: n,
|
|
96
|
+
...s(t, r)
|
|
97
|
+
} : c && a >= o ? {
|
|
98
|
+
kind: "admit",
|
|
99
|
+
reason: "batch-timeout",
|
|
100
|
+
keys: n,
|
|
101
|
+
...s(t, r)
|
|
102
|
+
} : {
|
|
103
|
+
kind: "defer",
|
|
104
|
+
mode: "batch",
|
|
105
|
+
dueAt: o,
|
|
106
|
+
collapse: c ? "hold" : "append",
|
|
107
|
+
keys: n
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (t.throttle !== void 0) {
|
|
111
|
+
let e = i(r.recentAdmissions ?? [], t.throttle.limit, t.throttle.periodMs, a);
|
|
112
|
+
if (e !== void 0) return {
|
|
113
|
+
kind: "defer",
|
|
114
|
+
mode: "throttle",
|
|
115
|
+
dueAt: e,
|
|
116
|
+
collapse: c ? "hold" : "append",
|
|
117
|
+
keys: n
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return t.concurrency !== void 0 && (r.inFlight ?? 0) >= t.concurrency.limit ? {
|
|
121
|
+
kind: "defer",
|
|
122
|
+
mode: "concurrency",
|
|
123
|
+
dueAt: a,
|
|
124
|
+
collapse: c ? "hold" : "append",
|
|
125
|
+
keys: n
|
|
126
|
+
} : {
|
|
127
|
+
kind: "admit",
|
|
128
|
+
reason: o(t) ? "under-limits" : "no-controls",
|
|
129
|
+
keys: n,
|
|
130
|
+
...s(t, r)
|
|
131
|
+
};
|
|
132
|
+
}, o = (e) => e.debounce !== void 0 || e.singleton !== void 0 || e.concurrency !== void 0 || e.throttle !== void 0 || e.rateLimit !== void 0 || e.batch !== void 0, s = (e, t) => e.singleton?.mode === "cancel" && t.singletonHolder !== void 0 ? { evict: t.singletonHolder } : {}, c = (e, t, n) => {
|
|
133
|
+
let r = e.timeouts?.startMs;
|
|
134
|
+
return r !== void 0 && n - t.firstSeenAt >= r;
|
|
135
|
+
}, l = (e, t, n) => {
|
|
136
|
+
let r = e.timeouts?.finishMs;
|
|
137
|
+
return r === void 0 || t.terminal ? !1 : n - t.startedAt >= r;
|
|
138
|
+
}, u = (e, t) => e.priority === t.priority ? e.firstSeenAt === t.firstSeenAt ? e.id < t.id ? -1 : +(e.id > t.id) : e.firstSeenAt - t.firstSeenAt : t.priority - e.priority;
|
|
139
|
+
//#endregion
|
|
140
|
+
export { e as FlowControlKeyError, u as comparePendingOrder, a as decideAdmission, l as isFinishExpired, c as isStartExpired, i as nextSlotAt, n as pooledConcurrencyKey, r as resolveAdmissionKeys };
|