@voltro/workflow 0.80.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/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, J as c, K as l, L 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, Y as b, _ as x, a as S, b as C, c as w, d as T, f as E, g as D, h as O, i as k, j as A, k as j, l as M, m as N, n as P, o as F, p as I, q as L, r as R, s as z, t as B, u as V, v as H, w as U, x as W, y as G, z as K } from "./primitives-bv2JHUfk.js";
2
- import { $ as q, $t as J, A as Y, At as X, B as Z, Bt as Q, C as $, Cn as ee, Ct as te, D as ne, Dt as re, E as ie, Et as ae, F as oe, Ft as se, G as ce, Gt as le, H as ue, Ht as de, I as fe, It as pe, J as me, Jt as he, K as ge, Kt as _e, L as ve, Lt as ye, M as be, Mt as xe, N as Se, Nt as Ce, O as we, Ot as Te, P as Ee, Pt as De, Q as Oe, Qt as ke, R as Ae, Rt as je, S as Me, Sn as Ne, St as Pe, T as Fe, Tn as Ie, Tt as Le, U as Re, Ut as ze, V as Be, Vt as Ve, W as He, Wt as Ue, X as We, Xt as Ge, Y as Ke, Yt as qe, Z as Je, Zt as Ye, _ as Xe, _n as Ze, _t as Qe, a as $e, an as et, at as tt, b as nt, bn as rt, bt as it, c as at, cn as ot, ct as st, d as ct, dn as lt, dt as ut, en as dt, et as ft, f as pt, fn as mt, ft as ht, g as gt, gn as _t, gt as vt, h as yt, hn as bt, ht as xt, i as St, in as Ct, it as wt, j as Tt, jt as Et, k as Dt, kt as Ot, l as kt, ln as At, lt as jt, m as Mt, mn as Nt, mt as Pt, n as Ft, nn as It, nt as Lt, o as Rt, on as zt, ot as Bt, p as Vt, pn as Ht, pt as Ut, q as Wt, qt as Gt, r as Kt, rn as qt, rt as Jt, s as Yt, sn as Xt, st as Zt, t as Qt, tn as $t, tt as en, u as tn, un as nn, ut as rn, v as an, vn as on, vt as sn, w as cn, wn as ln, wt as un, x as dn, xn as fn, xt as pn, y as mn, yn as hn, yt as gn, z as _n, zt as vn } from "./src-C8oxXvy6.js";
3
- import { c as yn, g as bn, l as xn, n as Sn, r as Cn, t as wn, u as Tn } from "./clusterDiagnostics-Cwt-WFec.js";
4
- export { Pt as ADMISSIONS_TABLE, de as ADMISSION_SUBMISSION_ID_PREFIX, pt as BUDGET_HOLDS_TABLE, Vt as BudgetHoldExpired, ce as CANCEL_ON_WATERMARK, wn as CLUSTER_REREAD_WINDOW_MS, Sn as ClusterDiagnostics, d as CurrentWorkflowExecutionId, p as CurrentWorkflowPatches, U as CurrentWorkflowReplayShape, a as CurrentWorkflowRunId, Mt as DEFAULT_BUDGET_HOLD_TIMEOUT_MS, ge as DEFAULT_COLD_LOOKBACK_MS, ve as DEFAULT_DRAIN_BATCH, Wt as DEFAULT_EVENT_BATCH, xt as DEFAULT_LEASE_MS, Qt as DEFAULT_MAX_RUN_RECLAIMS, Ft as DEFAULT_REPLAY_SHAPE_LIMIT, Be as DEFAULT_STALL_AFTER_MS, ue as DEFAULT_STALL_EVENT_LOOKBACK, Re as DEFAULT_STALL_RUN_PAGE, be as DEFAULT_SUSPEND_HINT_MS, f as DEFAULT_WORKFLOW_SCHEDULE_MAX_RUNTIME_MS, v as DEFERRING_CONTROLS, me as EVENTS_TABLE, qt as FlowControlKeyError, vt as PAUSES_TABLE, Qe as PENDING_TABLE, Ke as WATERMARKS_TABLE, B as WorkflowFlowControlProperty, P as WorkflowMessagesProperty, u as WorkflowRunRecorder, j as WorkflowScheduleProperty, m as WorkflowStepInterceptorTag, R as WorkflowVersionTypeId, k as WorkflowWorkerLayerTypeId, yt as _voltroBudgetHoldsTable, mt as _voltroWorkflowAdmissionLocksTable, Ht as _voltroWorkflowAdmissionsTable, Nt as _voltroWorkflowControlRequestsTable, bt as _voltroWorkflowFailureReportsTable, _t as _voltroWorkflowParentClosuresTable, Ze as _voltroWorkflowPausesTable, on as _voltroWorkflowPendingTable, Ne as _voltroWorkflowRunEventsTable, ee as _voltroWorkflowRunStepsTable, ln as _voltroWorkflowRunsTable, fn as _voltroWorkflowStartContextsTable, hn as _voltroWorkflowStartReceiptsTable, rt as _voltroWorkflowSubmissionsTable, en as _voltroWorkflowWatermarksTable, Ae as acceptAdmissionSubmission, yn as acceptWorkflowControlInTransaction, ze as acknowledgeAdmissionSubmission, Lt as admitStart, sn as allIntents, s as assertConsistentPools, L as attachPreparedWorkflowExecution, Y as awaitEvent, Tt as awaitSignal, $ as awaitSignalSuspending, ct as awaitUpdate, Ue as beginAdmissionSubmissionDispatchInTransaction, xn as beginWorkflowControlDispatchInTransaction, Tn as bindWorkflowResumeJournalInTransaction, je as bindWorkflowStartReceipts, gt as budgetHoldGeneration, Xe as budgetHoldKey, an as budgetHoldSignalName, Bt as cancelQueuedWorkflowStartInTransaction, jt as cancelSuspendedWorkflowRunInTransaction, Ct as comparePendingOrder, cn as completeSuspendingSignal, rn as completeWorkflowRunGenerationInTransaction, gn as deadLetterIntent, et as decideAdmission, _ as deferringControlsOf, it as deleteIntent, Cn as describeStalledRun, pn as discardIntent, Pe as discardIntentInTransaction, _n as drainTick, te as dueIntents, S as durableClock, F as durableQueue, z as durableQueueModule, w as durableRateLimiterModule, ut as enterWorkflowRunGenerationInTransaction, un as evaluateAdmission, c as executePreparedWorkflow, K as getCurrentWorkflowExecutionId, t as getCurrentWorkflowRunId, M as getWorkflowFlowControl, e as getWorkflowSchedule, V as getWorkflowVersionMetadata, J as handoffWorkflowFailureInTransaction, y as hasCancelOn, o as hasFlowControl, b as hasPreparedWorkflowExecution, mn as heldBudgets, Ie as inMemoryWorkflowEngineLayer, tn as inspectWorkflow, zt as isFinishExpired, Xt as isStartExpired, Z as isUnacknowledgedSubmission, T as isWorkflowWorkerLayer, Jt as linkExecution, kt as makeInMemoryRecorder, g as makeReplayShapeTracker, Kt as makeWorkflowRunRecorder, ie as makeWorkflowUpdateId, Se as maybeHintSuspendingSignal, le as newAdmissionSubmissionId, q as newestEventAt, ot as nextSlotAt, i as nondeterminismEventPayload, St as normaliseWorkflowPatches, _e as noteAdmissionSubmissionFailure, Le as noteIntentAttempt, ae as parkDelayedStart, E as patch, re as pauseWorkflow, Gt as pendingAdmissionSubmissions, nt as pendingBudgetHolds, Te as pendingSlotId, Ot as pendingWindow, X as persistDefer, ft as planCancellations, At as pooledConcurrencyKey, he as prepareAdmissionSubmissionExecutionInTransaction, I as processQueue, Et as pruneAdmissions, N as queueWorker, st as queuedCancellationRequestsTable, O as rateLimit, xe as readAdmissionState, qe as readAdmissionSubmission, Ce as readPausedWorkflows, Zt as readQueuedWorkflowCancellationInTransaction, We as readWatermark, bn as readWorkflowControlInTransaction, $t as readWorkflowFailureRecord, vn as readWorkflowStartReceipt, dt as reconcileWorkflowFailureInTransaction, De as recordAdmission, It as recordWorkflowFailureInTransaction, Q as recordWorkflowStartReceipt, Ge as rejectAdmissionSubmissionInTransaction, dn as releaseBudgetHolds, se as releaseLease, r as reportNondeterminism, Ye as reserveAdmissionSubmission, ke as reserveAdmissionSubmissionInTransaction, Ee as resetSuspendHintsForTest, nn as resolveAdmissionKeys, $e as resolveRunGuardTuning, oe as resolveSuspendHintMs, ne as resolveWorkflowMessageRun, Ve as resolveWorkflowStartReceipt, pe as resumeWorkflow, ye as retryDeadLetterIntent, we as sendWorkflowSignal, Dt as sendWorkflowUpdate, Rt as serialiseWorkflowRowForWire, fe as setSuspendSignalHintMs, D as sleep, x as sleepUntil, Ut as stageWorkflowParentClosureInTransaction, H as step, G as stepIdempotencyKey, C as stepModule, Me as suspendForBudget, Fe as suspendingSignalDeferredName, Je as sweepCancelOn, He as sweepStalledRuns, wt as takeAdmittedSubmissionInTransaction, tt as takePendingAdmissionSubmission, Yt as truncateWorkflowValue, l as validateFlowControl, A as validateWorkflowSchedule, lt as withAdmissionTransaction, W as withCompensation, h as workflow, n as workflowModule, ht as workflowRestartRequestsTable, at as wrapWorkflowExecuteWithRunRecording, Oe as writeWatermark };
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 };