@voltro/workflow 0.81.0 → 0.82.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 +1520 -6
- package/README.md +4 -0
- package/dist/cluster-MboOAwcv.js +604 -0
- package/dist/cluster.d.ts +553 -26
- package/dist/cluster.js +2 -2
- package/dist/clusterDiagnostics-Dc7yBP3b.js +2069 -0
- package/dist/clusterTestSuite.d.ts +2 -0
- package/dist/clusterTestSuite.js +309 -117
- package/dist/index.d.ts +257 -115
- package/dist/index.js +5 -4
- package/dist/journalEncryption--n5VDdYO.js +148 -0
- package/dist/primitives-Btjhjm8P.js +483 -0
- package/dist/primitives.d.ts +28 -72
- package/dist/primitives.js +1 -1
- package/dist/{src-D_GRCNhv.js → src-BAN5Xovf.js} +1015 -2129
- package/package.json +4 -4
- package/dist/cluster-D7VuRhM0.js +0 -500
- package/dist/clusterDiagnostics-Cwt-WFec.js +0 -395
- package/dist/primitives-BJBn8tiH.js +0 -448
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, M as d, O as f, P as p, R as m, S as h, T as g, U as _, V as v, W as y, X as b, Y as x, Z as S, _ as C, a as w, b as T, c as E, d as D, f as O, g as k, h as A, i as j, j as M, k as N, l as P, m as F, n as I, o as L, p as R, q as z, r as B, s as V, t as H, u as U, v as W, w as G, x as K, y as q, z as J } from "./primitives-
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
|
|
1
|
+
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, M as d, O as f, P as p, R as m, S as h, T as g, U as _, V as v, W as y, X as b, Y as x, Z as S, _ as C, a as w, b as T, c as E, d as D, f as O, g as k, h as A, i as j, j as M, k as N, l as P, m as F, n as I, o as L, p as R, q as z, r as B, s as V, t as H, u as U, v as W, w as G, x as K, y as q, z as J } from "./primitives-Btjhjm8P.js";
|
|
2
|
+
import { D as Y, E as X, S as Z, _ as Q, c as $, g as ee, h as te, l as ne, m as re, n as ie, o as ae, r as oe, v as se } from "./journalEncryption--n5VDdYO.js";
|
|
3
|
+
import { $ as ce, A as le, B as ue, C as de, Ct as fe, D as pe, E as me, Et as he, F as ge, G as _e, H as ve, I as ye, J as be, K as xe, L as Se, M as Ce, N as we, O as Te, P as Ee, Q as De, R as Oe, S as ke, St as Ae, T as je, Tt as Me, U as Ne, V as Pe, W as Fe, X as Ie, Y as Le, Z as Re, _ as ze, _t as Be, a as Ve, at as He, b as Ue, bt as We, c as Ge, ct as Ke, d as qe, dt as Je, et as Ye, f as Xe, ft as Ze, g as Qe, gt as $e, h as et, ht as tt, i as nt, it as rt, j as it, k as at, l as ot, lt as st, m as ct, mt as lt, n as ut, nt as dt, o as ft, ot as pt, p as mt, pt as ht, q as gt, r as _t, rt as vt, s as yt, st as bt, t as xt, tt as St, u as Ct, ut as wt, v as Tt, vt as Et, w as Dt, wt as Ot, x as kt, xt as At, y as jt, yt as Mt, z as Nt } from "./src-BAN5Xovf.js";
|
|
4
|
+
import { $ as Pt, A as Ft, At as It, B as Lt, Bt as Rt, Ct as zt, D as Bt, Dt as Vt, Et as Ht, F as Ut, Ft as Wt, G as Gt, Gt as Kt, H as qt, Ht as Jt, It as Yt, J as Xt, K as Zt, L as Qt, Lt as $t, M as en, N as tn, Nt as nn, P as rn, Q as an, R as on, Rt as sn, St as cn, Tt as ln, U as un, Ut as dn, Vt as fn, W as pn, Wt as mn, X as hn, Y as gn, Z as _n, at as vn, b as yn, bt as bn, ct as xn, d as Sn, et as Cn, f as wn, ft as Tn, ht as En, j as Dn, lt as On, n as kn, nt as An, o as jn, pt as Mn, q as Nn, r as Pn, st as Fn, t as In, u as Ln, vt as Rn, x as zn, y as Bn, yt as Vn, z as Hn, zt as Un } from "./clusterDiagnostics-Dc7yBP3b.js";
|
|
5
|
+
export { Ft as ADMISSIONS_TABLE, Tn as ADMISSION_SUBMISSION_ID_PREFIX, Xe as BUDGET_HOLDS_TABLE, mt as BudgetHoldExpired, _e as CANCEL_ON_WATERMARK, In as CLUSTER_REREAD_WINDOW_MS, kn as ClusterDiagnostics, d as CurrentWorkflowExecutionId, p as CurrentWorkflowPatches, G as CurrentWorkflowReplayShape, a as CurrentWorkflowRunId, c as CurrentWorkflowStep, ct as DEFAULT_BUDGET_HOLD_TIMEOUT_MS, xe as DEFAULT_COLD_LOOKBACK_MS, Se as DEFAULT_DRAIN_BATCH, gt as DEFAULT_EVENT_BATCH, Dn as DEFAULT_LEASE_MS, xt as DEFAULT_MAX_RUN_RECLAIMS, ut as DEFAULT_REPLAY_SHAPE_LIMIT, Pe as DEFAULT_STALL_AFTER_MS, ve as DEFAULT_STALL_EVENT_LOOKBACK, Ne as DEFAULT_STALL_RUN_PAGE, Ce as DEFAULT_SUSPEND_HINT_MS, f as DEFAULT_WORKFLOW_SCHEDULE_MAX_RUNTIME_MS, _ as DEFERRING_CONTROLS, be as EVENTS_TABLE, $t as FlowControlKeyError, en as PAUSES_TABLE, tn as PENDING_TABLE, ie as STEP_JOURNAL_BINDING, Le as WATERMARKS_TABLE, oe as WORKFLOW_JOURNAL_BINDING, H as WorkflowFlowControlProperty, I as WorkflowMessagesProperty, m as WorkflowRunRecorder, N as WorkflowScheduleProperty, J as WorkflowStepInterceptorTag, B as WorkflowVersionTypeId, j as WorkflowWorkerLayerTypeId, et as _voltroBudgetHoldsTable, ht as _voltroWorkflowAdmissionLocksTable, lt as _voltroWorkflowAdmissionsTable, tt as _voltroWorkflowControlRequestsTable, $e as _voltroWorkflowFailureReportsTable, Be as _voltroWorkflowParentClosuresTable, Et as _voltroWorkflowPausesTable, Mt as _voltroWorkflowPendingTable, fe as _voltroWorkflowRunEventsTable, Ot as _voltroWorkflowRunStepsTable, Me as _voltroWorkflowRunsTable, Ae as _voltroWorkflowStartContextsTable, We as _voltroWorkflowStartReceiptsTable, At as _voltroWorkflowSubmissionsTable, St as _voltroWorkflowWatermarksTable, Oe as acceptAdmissionSubmission, Bn as acceptWorkflowControlInTransaction, Mn as acknowledgeAdmissionSubmission, dt as admitStart, rn as allIntents, y as assertConsistentPools, x as attachPreparedWorkflowExecution, le as awaitEvent, it as awaitSignal, de as awaitSignalSuspending, qe as awaitUpdate, En as beginAdmissionSubmissionDispatchInTransaction, yn as beginWorkflowControlDispatchInTransaction, zn as bindWorkflowResumeJournalInTransaction, vn as bindWorkflowStartReceipts, Qe as budgetHoldGeneration, ze as budgetHoldKey, Tt as budgetHoldSignalName, pt as cancelQueuedWorkflowStartInTransaction, st as cancelSuspendedWorkflowRunInTransaction, sn as comparePendingOrder, Dt as completeSuspendingSignal, wt as completeWorkflowRunGenerationInTransaction, t as currentWorkflowStep, Ut as deadLetterIntent, Un as decideAdmission, o as deferringControlsOf, Qt as deleteIntent, Pn as describeStalledRun, on as discardIntent, Hn as discardIntentInTransaction, Nt as drainTick, Lt as dueIntents, w as durableClock, L as durableQueue, V as durableQueueModule, E as durableRateLimiterModule, Je as enterWorkflowRunGenerationInTransaction, qt as evaluateAdmission, b as executePreparedWorkflow, v as getCurrentWorkflowExecutionId, s as getCurrentWorkflowRunId, P as getWorkflowFlowControl, ae as getWorkflowJournalCipher, e as getWorkflowSchedule, U as getWorkflowVersionMetadata, It as handoffWorkflowFailureInTransaction, u as hasCancelOn, z as hasFlowControl, S as hasPreparedWorkflowExecution, jt as heldBudgets, he as inMemoryWorkflowEngineLayer, Ct as inspectWorkflow, Rt as isFinishExpired, $ as isSealedJournalValue, fn as isStartExpired, ue as isUnacknowledgedSubmission, ne as isWorkflowEncrypted, D as isWorkflowWorkerLayer, vt as linkExecution, ot as makeInMemoryRecorder, g as makeReplayShapeTracker, _t as makeWorkflowRunRecorder, me as makeWorkflowUpdateId, we as maybeHintSuspendingSignal, Rn as newAdmissionSubmissionId, ce as newestEventAt, Jt as nextSlotAt, i as nondeterminismEventPayload, nt as normaliseWorkflowPatches, Vn as noteAdmissionSubmissionFailure, un as noteIntentAttempt, re as openErrorText, te as openEventPayload, ee as openJournalValue, Q as openPayloadFields, se as openWorkflowRow, pn as parkDelayedStart, O as patch, Gt as pauseWorkflow, bn as pendingAdmissionSubmissions, Ue as pendingBudgetHolds, Zt as pendingSlotId, Nn as pendingWindow, Xt as persistDefer, Ye as planCancellations, dn as pooledConcurrencyKey, cn as prepareAdmissionSubmissionExecutionInTransaction, R as processQueue, gn as pruneAdmissions, F as queueWorker, Ke as queuedCancellationRequestsTable, A as rateLimit, hn as readAdmissionState, zt as readAdmissionSubmission, _n as readPausedWorkflows, bt as readQueuedWorkflowCancellationInTransaction, Ie as readWatermark, Bt as readWorkflowControlInTransaction, Wt as readWorkflowFailureRecord, jn as readWorkflowRestartObservationInTransaction, Fn as readWorkflowStartReceipt, nn as reconcileWorkflowFailureInTransaction, an as recordAdmission, Yt as recordWorkflowFailureInTransaction, xn as recordWorkflowStartReceipt, ln as rejectAdmissionSubmissionInTransaction, kt as releaseBudgetHolds, Pt as releaseLease, r as reportNondeterminism, Ht as reserveAdmissionSubmission, Vt as reserveAdmissionSubmissionInTransaction, Ee as resetSuspendHintsForTest, mn as resolveAdmissionKeys, Ve as resolveRunGuardTuning, ge as resolveSuspendHintMs, pe as resolveWorkflowMessageRun, On as resolveWorkflowStartReceipt, Cn as resumeWorkflow, An as retryDeadLetterIntent, Z as sealJournalValue, Te as sendWorkflowSignal, at as sendWorkflowUpdate, ft as serialiseWorkflowRowForWire, ye as setSuspendSignalHintMs, X as setWorkflowJournalCipher, k as sleep, C as sleepUntil, Ze as stageWorkflowParentClosureInTransaction, W as step, q as stepIdempotencyKey, T as stepModule, ke as suspendForBudget, je as suspendingSignalDeferredName, Re as sweepCancelOn, Fe as sweepStalledRuns, rt as takeAdmittedSubmissionInTransaction, He as takePendingAdmissionSubmission, yt as truncateWorkflowValue, Y as tryOpenJournalValue, l as validateFlowControl, M as validateWorkflowSchedule, Kt as withAdmissionTransaction, K as withCompensation, Ln as withdrawWorkflowRestartInTransaction, h as workflow, n as workflowModule, Sn as workflowRestartRequestsTable, wn as workflowRestartWithdrawalsTable, Ge as wrapWorkflowExecuteWithRunRecording, De as writeWatermark };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Activity as e } from "@effect/workflow";
|
|
2
|
+
import { Effect as t, FiberRef as n, ParseResult as r, Schema as i, SchemaAST as a } from "effect";
|
|
3
|
+
//#region src/journalEncryption.ts
|
|
4
|
+
var o = () => void 0, s = (e) => {
|
|
5
|
+
o = typeof e == "function" ? e : () => e;
|
|
6
|
+
}, c = () => o(), l = n.unsafeMake(!1), u = { column: "workflow-journal" }, d = /* @__PURE__ */ new Set(), f = (e) => {
|
|
7
|
+
d.add(e);
|
|
8
|
+
}, p = /* @__PURE__ */ new Set(), m = (e) => {
|
|
9
|
+
p.add(e);
|
|
10
|
+
}, h = (e) => p.has(e), g = (e) => d.has(e), _ = (e) => typeof e == "string" && (e.startsWith("enc:v1:") || e.startsWith("enc:v2:")), v = (e) => /* @__PURE__ */ Error(`${e}: the workflow is declared encrypted, but no field-encryption key is registered — set VOLTRO_FIELD_ENCRYPTION_KEY (\`voltro secret generate field-encryption\`). Nothing was written in plaintext instead.`), y = (e, t, n = u) => {
|
|
11
|
+
if (e == null) return e;
|
|
12
|
+
let r = o();
|
|
13
|
+
if (r === void 0) throw v(t);
|
|
14
|
+
return r.encrypt(JSON.stringify(e), n);
|
|
15
|
+
}, b = (e, t, n = u) => {
|
|
16
|
+
if (!_(e)) return e;
|
|
17
|
+
let r = o();
|
|
18
|
+
if (r === void 0) throw v(t);
|
|
19
|
+
return JSON.parse(r.decrypt(e, n));
|
|
20
|
+
}, x = (e) => a.isVoidKeyword(e) || a.isNeverKeyword(e) || a.isUndefinedKeyword(e), S = (e, t) => x(e.ast) ? e : i.transformOrFail(i.Unknown, e, {
|
|
21
|
+
strict: !0,
|
|
22
|
+
decode: (e, n, i) => {
|
|
23
|
+
try {
|
|
24
|
+
return r.succeed(Array.isArray(e) ? e.map((e) => b(e, t)) : b(e, t));
|
|
25
|
+
} catch (t) {
|
|
26
|
+
return r.fail(new r.Type(i, e, t.message));
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
encode: (e, n, i) => {
|
|
30
|
+
try {
|
|
31
|
+
return r.succeed(e === void 0 ? void 0 : y(e, t));
|
|
32
|
+
} catch (t) {
|
|
33
|
+
return r.fail(new r.Type(i, e, t.message));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}), C = (e, t) => {
|
|
37
|
+
let n = i.isSchema(t) ? t.fields : t, r = `workflow '${e}' payload`, a = {};
|
|
38
|
+
for (let [t, o] of Object.entries(n)) {
|
|
39
|
+
if (i.isSchema(o)) {
|
|
40
|
+
a[t] = S(o, `${r}.${t}`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
let n = o.ast;
|
|
44
|
+
if (n._tag === "PropertySignatureDeclaration" && n.defaultValue === void 0) {
|
|
45
|
+
let e = S(i.make(n.type), `${r}.${t}`);
|
|
46
|
+
a[t] = n.isOptional ? i.optional(e) : e;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
throw Error(`workflow '${e}' is declared encrypted, but payload field '${t}' is a property-signature transformation (a default or a renamed key), which the encryption cannot wrap without changing it. Declare the field as a plain schema (or \`Schema.optional(...)\`) and apply the default in the body.`);
|
|
50
|
+
}
|
|
51
|
+
return a;
|
|
52
|
+
}, w = (e) => typeof e == "object" && !!e && !Array.isArray(e), T = (e, t) => {
|
|
53
|
+
if (!w(e)) return b(e, t);
|
|
54
|
+
let n = {};
|
|
55
|
+
for (let [r, i] of Object.entries(e)) n[r] = b(i, `${t}.${r}`);
|
|
56
|
+
return n;
|
|
57
|
+
}, E = (e, t) => {
|
|
58
|
+
let n = {};
|
|
59
|
+
for (let [r, i] of Object.entries(e)) n[r] = y(i, `${t}.${r}`);
|
|
60
|
+
return n;
|
|
61
|
+
}, D = "VoltroSealedDefect", O = (e, t) => {
|
|
62
|
+
if (e instanceof Error && e.name === "VoltroSealedDefect") return e;
|
|
63
|
+
let n = e instanceof Error ? {
|
|
64
|
+
name: e.name,
|
|
65
|
+
message: e.message,
|
|
66
|
+
...e.stack === void 0 ? {} : { stack: e.stack }
|
|
67
|
+
} : {
|
|
68
|
+
name: "Defect",
|
|
69
|
+
message: typeof e == "string" ? e : A(e)
|
|
70
|
+
}, r = Error(String(y(n, t)));
|
|
71
|
+
return r.name = D, r.stack = `${D}: ${r.message}`, r;
|
|
72
|
+
}, k = (e, t) => {
|
|
73
|
+
let n = e?.name, r = e?.message;
|
|
74
|
+
if (n !== "VoltroSealedDefect" || typeof r != "string" || !_(r)) return e;
|
|
75
|
+
try {
|
|
76
|
+
let e = b(r, t), n = Error(e.message ?? "");
|
|
77
|
+
return n.name = e.name ?? "Error", e.stack !== void 0 && (n.stack = e.stack), n;
|
|
78
|
+
} catch {
|
|
79
|
+
return e;
|
|
80
|
+
}
|
|
81
|
+
}, A = (e) => {
|
|
82
|
+
try {
|
|
83
|
+
return JSON.stringify(e) ?? String(e);
|
|
84
|
+
} catch {
|
|
85
|
+
return String(e);
|
|
86
|
+
}
|
|
87
|
+
}, j = () => d.size > 0, M = (e, t) => t == null ? null : g(e) ? String(y(t, `workflow '${e}' error message`)) : t, N = (e, t) => {
|
|
88
|
+
try {
|
|
89
|
+
return b(e, t);
|
|
90
|
+
} catch {
|
|
91
|
+
return e;
|
|
92
|
+
}
|
|
93
|
+
}, P = (e) => {
|
|
94
|
+
if (e == null) return null;
|
|
95
|
+
let t = N(e, "workflow error message");
|
|
96
|
+
return typeof t == "string" ? t : e;
|
|
97
|
+
}, F = [
|
|
98
|
+
"value",
|
|
99
|
+
"result",
|
|
100
|
+
"errorMessage"
|
|
101
|
+
], I = (e, t) => {
|
|
102
|
+
if (t == null) return null;
|
|
103
|
+
if (!g(e)) return t;
|
|
104
|
+
let n = { ...t };
|
|
105
|
+
for (let t of F) t in n && n[t] !== void 0 && n[t] !== null && !_(n[t]) && (n[t] = y(n[t], `workflow '${e}' event ${t}`));
|
|
106
|
+
return n;
|
|
107
|
+
}, L = (e) => {
|
|
108
|
+
if (!w(e)) return e;
|
|
109
|
+
let t = { ...e };
|
|
110
|
+
for (let e of F) _(t[e]) && (t[e] = N(t[e], `workflow event ${e}`));
|
|
111
|
+
return t;
|
|
112
|
+
}, R = (r) => {
|
|
113
|
+
let i = e.make(r), a, o = `wait '${r.name}'`, s = () => a ??= e.make({
|
|
114
|
+
...r,
|
|
115
|
+
success: S(r.success, `${o} value`),
|
|
116
|
+
execute: r.execute.pipe(t.catchAllDefect((e) => t.die(O(e, `${o} defect`))))
|
|
117
|
+
}), c = i;
|
|
118
|
+
return {
|
|
119
|
+
...i,
|
|
120
|
+
commit: () => t.flatMap(n.get(l), (e) => e ? s().pipe(t.catchAllDefect((e) => t.die(k(e, `${o} defect`)))) : c)
|
|
121
|
+
};
|
|
122
|
+
}, z = { column: "_voltro_workflow_run_steps:payload" }, B = (e) => {
|
|
123
|
+
if (!_(e)) return e;
|
|
124
|
+
try {
|
|
125
|
+
return b(e, "workflow step value", z);
|
|
126
|
+
} catch {
|
|
127
|
+
return e;
|
|
128
|
+
}
|
|
129
|
+
}, V = (e) => {
|
|
130
|
+
if (!w(e)) return e;
|
|
131
|
+
let t = { ...e };
|
|
132
|
+
if ("eventType" in t) return "payload" in t && (t.payload = L(t.payload)), t;
|
|
133
|
+
if ("stepName" in t && ("input" in t || "errorCause" in t)) {
|
|
134
|
+
for (let e of [
|
|
135
|
+
"input",
|
|
136
|
+
"output",
|
|
137
|
+
"errorCause",
|
|
138
|
+
"errorMessage"
|
|
139
|
+
]) e in t && (t[e] = B(t[e]));
|
|
140
|
+
return t;
|
|
141
|
+
}
|
|
142
|
+
if ("payload" in t) try {
|
|
143
|
+
t.payload = T(t.payload, "workflow run payload");
|
|
144
|
+
} catch {}
|
|
145
|
+
return "output" in t && (t.output = N(t.output, "workflow run result")), typeof t.errorMessage == "string" && (t.errorMessage = P(t.errorMessage)), t;
|
|
146
|
+
}, H = (e, t) => e === void 0 || !g(e) ? String(t) : `${t instanceof Error ? t.name : typeof t}: [withheld — workflow '${e}' is declared encrypted; the full cause is recorded sealed on its row]`;
|
|
147
|
+
//#endregion
|
|
148
|
+
export { E as C, N as D, s as E, y as S, S as T, T as _, R as a, M as b, _ as c, m as d, f, b as g, L as h, j as i, g as l, P as m, z as n, c as o, k as p, u as r, h as s, l as t, H as u, V as v, C as w, I as x, O as y };
|