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