@voltro/workflow 0.80.0 → 0.81.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,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, 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-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,17 +1,17 @@
1
1
  import { Activity as e, Activity as t, DurableClock as n, DurableClock as r, DurableQueue as i, DurableQueue as a, DurableRateLimiter as o, DurableRateLimiter as s, Workflow as c, Workflow as l, WorkflowEngine as u } from "@effect/workflow";
2
- import { Cause as d, Context as f, Cron as p, Duration as m, Effect as h, Either as g, Exit as ee, FiberRef as _, Option as v, Schedule as y, Schema as b } from "effect";
3
- import { attachWorkflowAccess as x, resolveWorkflowAccess as S } from "@voltro/protocol";
2
+ import { Cause as d, Context as f, Cron as p, Duration as m, Effect as h, Either as g, Exit as ee, FiberRef as _, Option as v, Schedule as y, Schema as te } from "effect";
3
+ import { attachWorkflowAccess as ne, resolveWorkflowAccess as b } from "@voltro/protocol";
4
4
  //#region src/preparedExecution.ts
5
- var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
6
- Object.defineProperty(e, C, {
5
+ var x = Symbol.for("@voltro/workflow/PreparedExecution"), S = (e, t) => {
6
+ Object.defineProperty(e, x, {
7
7
  value: t,
8
8
  enumerable: !0
9
9
  });
10
- }, te = (e) => typeof e == "object" && !!e && typeof e[C] == "function", ne = (e, t, n, r) => h.suspend(() => {
10
+ }, re = (e) => typeof e == "object" && !!e && typeof e[x] == "function", ie = (e, t, n, r) => h.suspend(() => {
11
11
  if (n.length === 0) return h.die(/* @__PURE__ */ Error("Prepared workflow execution requires a non-empty identity"));
12
- let i = e[C];
12
+ let i = e[x];
13
13
  return typeof i == "function" ? i(t, n, r?.discard ?? !0) : h.die(/* @__PURE__ */ Error("Workflow definition has no prepared-execution capability"));
14
- }), re = (e) => e !== void 0 && (e.debounce !== void 0 || e.singleton !== void 0 || e.concurrency !== void 0 || e.throttle !== void 0 || e.rateLimit !== void 0 || e.batch !== void 0 || e.timeouts?.startMs !== void 0 || e.timeouts?.finishMs !== void 0), ie = (e) => e?.cancelOn !== void 0 && e.cancelOn.length > 0, ae = [
14
+ }), C = (e) => e !== void 0 && (e.debounce !== void 0 || e.singleton !== void 0 || e.concurrency !== void 0 || e.throttle !== void 0 || e.rateLimit !== void 0 || e.batch !== void 0 || e.timeouts?.startMs !== void 0 || e.timeouts?.finishMs !== void 0), w = (e) => e?.cancelOn !== void 0 && e.cancelOn.length > 0, ae = [
15
15
  "debounce",
16
16
  "batch",
17
17
  "throttle",
@@ -35,12 +35,12 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
35
35
  }, O = (e, t, n) => {
36
36
  if (typeof e != "function") throw Error(`workflow '${n}': ${t} must be a function of the payload`);
37
37
  return e;
38
- }, oe = (e) => {
38
+ }, k = (e) => {
39
39
  let t = e?.ast?.propertySignatures;
40
40
  if (!Array.isArray(t)) return !1;
41
41
  let n = t.find((e) => e.name === "items");
42
42
  return n !== void 0 && n.type?._tag === "TupleType";
43
- }, k = (e) => {
43
+ }, A = (e) => {
44
44
  let { workflowName: t, control: n } = e;
45
45
  if (n === void 0) return;
46
46
  let r = { workflowName: t };
@@ -88,7 +88,7 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
88
88
  }
89
89
  if (n.batch !== void 0) {
90
90
  let i = n.batch;
91
- if (e.payloadSchema !== void 0 && !oe(e.payloadSchema)) throw Error(`workflow '${t}': batch is declared, so the workflow's own \`payload\` must be the BATCH shape — \`Schema.Struct({ items: Schema.Array(Item) })\` — while callers start it with a SINGLE item. Declare the item's schema as \`batch.item\`. Checked here rather than at admission because a decode failure on the batching replica is a failure nobody is watching.`);
91
+ if (e.payloadSchema !== void 0 && !k(e.payloadSchema)) throw Error(`workflow '${t}': batch is declared, so the workflow's own \`payload\` must be the BATCH shape — \`Schema.Struct({ items: Schema.Array(Item) })\` — while callers start it with a SINGLE item. Declare the item's schema as \`batch.item\`. Checked here rather than at admission because a decode failure on the batching replica is a failure nobody is watching.`);
92
92
  r.batch = {
93
93
  ...i.key === void 0 ? {} : { key: O(i.key, "batch.key", t) },
94
94
  maxSize: D(i.maxSize, "batch.maxSize", t),
@@ -134,7 +134,7 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
134
134
  }
135
135
  if (r.timeouts?.startMs !== void 0 && T(r).length === 0) throw Error(`workflow '${t}': timeouts.start bounds how long a run may sit in the ADMISSION queue, but this workflow declares no control that can defer one (debounce, batch, throttle, concurrency). It would never fire. Use timeouts.finish to bound the run itself.`);
136
136
  return r;
137
- }, se = (e) => {
137
+ }, oe = (e) => {
138
138
  let t = /* @__PURE__ */ new Map();
139
139
  for (let n of e) {
140
140
  let e = n?.concurrency;
@@ -147,25 +147,31 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
147
147
  else if (r.limit !== e.limit) throw Error(`concurrency pool '${e.pool}': '${n.workflowName}' declares limit ${e.limit}, but ${r.workflows.map((e) => `'${e}'`).join(", ")} declare${r.workflows.length === 1 ? "s" : ""} limit ${r.limit}. A pool is ONE budget — every member must declare the same number, or the enforced limit would depend on which workflow's start arrived first. Align the limits, or give the workflows different pool names if they were never meant to share.`);
148
148
  else r.workflows.push(n.workflowName);
149
149
  }
150
- }, A = class extends f.Tag("@voltro/WorkflowRunRecorder")() {}, j = _.unsafeMake(void 0), M = _.unsafeMake(void 0), ce = _.unsafeMake(void 0), N = _.unsafeMake(void 0), P = _.unsafeMake([]), le = () => _.get(j), ue = () => _.get(M), F = class extends f.Tag("@voltro/WorkflowStepInterceptor")() {}, I = 864e5, L = /* @__PURE__ */ new Set([
150
+ }, j = class extends f.Tag("@voltro/WorkflowRunRecorder")() {}, M = _.unsafeMake(void 0), N = _.unsafeMake(void 0), P = _.unsafeMake(void 0), se = h.gen(function* () {
151
+ let e = yield* _.get(N), t = yield* _.get(P);
152
+ return e === void 0 || t === void 0 ? void 0 : {
153
+ executionId: e,
154
+ step: t
155
+ };
156
+ }), ce = _.unsafeMake(void 0), F = _.unsafeMake(void 0), I = _.unsafeMake([]), le = () => _.get(M), L = () => _.get(N), R = class extends f.Tag("@voltro/WorkflowStepInterceptor")() {}, z = 864e5, B = /* @__PURE__ */ new Set([
151
157
  "skip",
152
158
  "buffer",
153
159
  "cancelOther"
154
- ]), R = /* @__PURE__ */ new Set([
160
+ ]), V = /* @__PURE__ */ new Set([
155
161
  "skip",
156
162
  "latest",
157
163
  "all"
158
- ]), z = (e, t) => {
164
+ ]), H = (e, t) => {
159
165
  if (t === void 0) return;
160
166
  if (typeof t.timezone != "string" || t.timezone.trim() === "") throw Error(`workflow '${e}': schedule.timezone is required (e.g. "UTC", "Europe/Berlin") — never server-local, which differs between your machine and the container.`);
161
167
  let n = p.parse(t.cron, t.timezone);
162
168
  if (g.isLeft(n)) throw Error(`workflow '${e}': schedule.cron "${t.cron}" (tz="${t.timezone}") is not a valid cron expression — ${String(n.left)}`);
163
169
  let r = t.onOverlap ?? "skip";
164
- if (!L.has(r)) throw Error(`workflow '${e}': schedule.onOverlap must be 'skip' | 'buffer' | 'cancelOther', got ${JSON.stringify(r)}`);
170
+ if (!B.has(r)) throw Error(`workflow '${e}': schedule.onOverlap must be 'skip' | 'buffer' | 'cancelOther', got ${JSON.stringify(r)}`);
165
171
  let i = t.backfill ?? "skip";
166
- if (!R.has(i)) throw Error(`workflow '${e}': schedule.backfill must be 'skip' | 'latest' | 'all', got ${JSON.stringify(i)}`);
167
- let a = I;
168
- return t.maxRuntime !== void 0 && (a = B(t.maxRuntime, e)), {
172
+ if (!V.has(i)) throw Error(`workflow '${e}': schedule.backfill must be 'skip' | 'latest' | 'all', got ${JSON.stringify(i)}`);
173
+ let a = z;
174
+ return t.maxRuntime !== void 0 && (a = U(t.maxRuntime, e)), {
169
175
  cron: t.cron,
170
176
  timezone: t.timezone,
171
177
  ...t.payload === void 0 ? {} : { payload: t.payload },
@@ -173,7 +179,7 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
173
179
  backfill: i,
174
180
  maxRuntimeMs: a
175
181
  };
176
- }, B = (e, t) => {
182
+ }, U = (e, t) => {
177
183
  let n;
178
184
  try {
179
185
  n = m.toMillis(m.decode(e));
@@ -182,11 +188,11 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
182
188
  }
183
189
  if (!Number.isFinite(n) || n <= 0) throw Error(`workflow '${t}': schedule.maxRuntime must be a positive finite duration`);
184
190
  return n;
185
- }, V = "__voltroWorkflowSchedule", H = (e) => {
191
+ }, W = "__voltroWorkflowSchedule", ue = (e) => {
186
192
  if (typeof e != "object" || !e) return;
187
- let t = e[V];
193
+ let t = e[W];
188
194
  return t === void 0 ? void 0 : t;
189
- }, U = (e) => {
195
+ }, de = (e) => {
190
196
  let t = /* @__PURE__ */ new Map();
191
197
  for (let n of e) t.set(n.stepName, (t.get(n.stepName) ?? 0) + 1);
192
198
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = (e) => !r.has(e) && (r.add(e), !0);
@@ -215,52 +221,52 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
215
221
  return e;
216
222
  }
217
223
  };
218
- }, W = _.unsafeMake(void 0), G = (e) => ({
224
+ }, G = _.unsafeMake(void 0), K = (e) => ({
219
225
  kind: e.kind,
220
226
  stepName: e.stepName,
221
227
  recorded: e.recorded,
222
228
  reached: e.reached,
223
229
  detail: e.detail
224
- }), K = (e) => h.gen(function* () {
230
+ }), q = (e) => h.gen(function* () {
225
231
  if (e.length === 0) return;
226
- let t = yield* _.get(j), n = yield* h.serviceOption(A);
232
+ let t = yield* _.get(M), n = yield* h.serviceOption(j);
227
233
  if (t === void 0 || n._tag !== "Some") return;
228
234
  let r = n.value;
229
235
  for (let n of e) yield* h.promise(() => r.recordEvent({
230
236
  runId: t,
231
237
  eventType: "nondeterminism-suspected",
232
- payload: G(n)
238
+ payload: K(n)
233
239
  }).then(() => void 0).catch(() => void 0));
234
- }), de = (e) => {
240
+ }), fe = (e) => {
235
241
  if (typeof e != "object" || !e) return;
236
242
  let t = e.retryAfterMillis;
237
243
  if (typeof t == "number" && Number.isFinite(t) && t >= 0) return m.millis(t);
238
244
  let n = e.retryAfter;
239
245
  if (typeof n == "number" && Number.isFinite(n) && n >= 0) return m.seconds(n);
240
- }, q = (e) => m.decode(e), fe = (e) => typeof e == "object" && e && "_tag" in e ? String(e._tag) : void 0, pe = (e) => e !== void 0 && (e.maxAttempts ?? 3) > 1, me = (e) => {
246
+ }, J = (e) => m.decode(e), pe = (e) => typeof e == "object" && e && "_tag" in e ? String(e._tag) : void 0, me = (e) => e !== void 0 && (e.maxAttempts ?? 3) > 1, he = (e) => {
241
247
  if (e.retryable) return e.retryable;
242
248
  if (e.retryableErrors && e.retryableErrors.length > 0) {
243
249
  let t = new Set(e.retryableErrors);
244
250
  return (e) => {
245
- let n = fe(e);
251
+ let n = pe(e);
246
252
  return n !== void 0 && t.has(n);
247
253
  };
248
254
  }
249
255
  return () => !0;
250
- }, he = (e) => {
251
- let t = e.baseDelay ?? "200 millis", n = e.strategy ?? "exponential", r = e.maxAttempts ?? 3, i = n === "linear" ? y.linear(q(e.step ?? t)) : n === "fixed" ? y.spaced(q(t)) : y.exponential(q(t), e.factor ?? 2);
256
+ }, ge = (e) => {
257
+ let t = e.baseDelay ?? "200 millis", n = e.strategy ?? "exponential", r = e.maxAttempts ?? 3, i = n === "linear" ? y.linear(J(e.step ?? t)) : n === "fixed" ? y.spaced(J(t)) : y.exponential(J(t), e.factor ?? 2);
252
258
  if (e.maxDelay !== void 0) {
253
- let t = q(e.maxDelay);
259
+ let t = J(e.maxDelay);
254
260
  i = y.modifyDelay(i, (e, n) => m.min(n, t));
255
261
  }
256
262
  (e.jitter ?? !0) === !0 && (i = y.jittered(i));
257
263
  let a = y.intersect(i, y.recurs(Math.max(0, r - 1)));
258
- return e.maxElapsed !== void 0 && (a = y.upTo(q(e.maxElapsed))(a)), a;
259
- }, ge = (e, t) => {
260
- let n = m.toMillis(q(e.baseDelay ?? "200 millis")), r = e.strategy ?? "exponential", i = r === "fixed" ? n : r === "linear" ? n + m.toMillis(q(e.step ?? e.baseDelay ?? "200 millis")) * (t - 1) : n * (e.factor ?? 2) ** (t - 1);
261
- return e.maxDelay !== void 0 && (i = Math.min(i, m.toMillis(q(e.maxDelay)))), (e.jitter ?? !0) === !0 && (i *= Math.random()), i;
262
- }, _e = (e, t, n, r) => h.gen(function* () {
263
- let i = t.maxAttempts ?? 3, a = t.maxElapsed === void 0 ? Infinity : m.toMillis(q(t.maxElapsed)), o = yield* h.sync(() => Date.now()), s = 0;
264
+ return e.maxElapsed !== void 0 && (a = y.upTo(J(e.maxElapsed))(a)), a;
265
+ }, _e = (e, t) => {
266
+ let n = m.toMillis(J(e.baseDelay ?? "200 millis")), r = e.strategy ?? "exponential", i = r === "fixed" ? n : r === "linear" ? n + m.toMillis(J(e.step ?? e.baseDelay ?? "200 millis")) * (t - 1) : n * (e.factor ?? 2) ** (t - 1);
267
+ return e.maxDelay !== void 0 && (i = Math.min(i, m.toMillis(J(e.maxDelay)))), (e.jitter ?? !0) === !0 && (i *= Math.random()), i;
268
+ }, ve = (e, t, n, r) => h.gen(function* () {
269
+ let i = t.maxAttempts ?? 3, a = t.maxElapsed === void 0 ? Infinity : m.toMillis(J(t.maxElapsed)), o = yield* h.sync(() => Date.now()), s = 0;
264
270
  for (;;) {
265
271
  let c = yield* h.exit(e);
266
272
  if (ee.isSuccess(c)) return c.value;
@@ -269,27 +275,27 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
269
275
  let p = (yield* h.sync(() => Date.now())) - o;
270
276
  if (s >= i || !n(f) || p >= a) return yield* h.failCause(l);
271
277
  r?.(f);
272
- let g = de(f), _ = g === void 0 ? ge(t, s) : m.toMillis(g);
278
+ let g = fe(f), _ = g === void 0 ? _e(t, s) : m.toMillis(g);
273
279
  yield* h.sleep(m.millis(_));
274
280
  }
275
- }), ve = (e, t, n) => {
276
- if (!pe(t)) return e;
277
- let r = me(t);
278
- if (t.respectRetryAfter === !0) return _e(e, t, r, n);
279
- let i = he(t), a = n ? h.tapError(e, (e) => h.sync(() => {
281
+ }), ye = (e, t, n) => {
282
+ if (!me(t)) return e;
283
+ let r = he(t);
284
+ if (t.respectRetryAfter === !0) return ve(e, t, r, n);
285
+ let i = ge(t), a = n ? h.tapError(e, (e) => h.sync(() => {
280
286
  r(e) && n(e);
281
287
  })) : e;
282
288
  return h.retry(a, {
283
289
  schedule: i,
284
290
  while: r
285
291
  });
286
- }, J = Symbol.for("voltro.workflow.workerLayer"), Y = Symbol.for("voltro.workflow.version"), X = "__voltroWorkflowMessages", Z = "__voltroWorkflowFlowControl", ye = (e) => typeof e == "object" && !!e && e[J] === !0, be = (e) => typeof e == "object" && e && e[Y] !== void 0 ? e[Y] : {
292
+ }, Y = Symbol.for("voltro.workflow.workerLayer"), X = Symbol.for("voltro.workflow.version"), Z = "__voltroWorkflowMessages", Q = "__voltroWorkflowFlowControl", be = (e) => typeof e == "object" && !!e && e[Y] === !0, xe = (e) => typeof e == "object" && e && e[X] !== void 0 ? e[X] : {
287
293
  version: "1",
288
294
  compatibleWith: ["1"],
289
295
  patches: []
290
- }, xe = ((e) => {
296
+ }, Se = ((e) => {
291
297
  let t = c.make(e), n = e.suspendOnFailure === !0 ? t.annotate(c.SuspendOnFailure, !0) : t;
292
- w(n, (t, r, i) => h.gen(function* () {
298
+ S(n, (t, r, i) => h.gen(function* () {
293
299
  let a = n.payloadSchema.make(t), o = yield* u.WorkflowEngine;
294
300
  return yield* h.annotateCurrentSpan({ executionId: r }), yield* o.execute(n, {
295
301
  executionId: r,
@@ -306,41 +312,41 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
306
312
  signals: { ...e.messages?.signals ?? {} },
307
313
  updates: { ...e.messages?.updates ?? {} }
308
314
  };
309
- Object.defineProperty(n, Y, {
315
+ Object.defineProperty(n, X, {
310
316
  value: i,
311
317
  enumerable: !1
312
- }), Object.defineProperty(n, X, {
318
+ }), Object.defineProperty(n, Z, {
313
319
  value: a,
314
320
  enumerable: !1
315
- }), x(n, S(e.name, e));
316
- let o = k({
321
+ }), ne(n, b(e.name, e));
322
+ let o = A({
317
323
  workflowName: e.name,
318
324
  payloadSchema: e.payload,
319
325
  control: e
320
326
  });
321
- o !== void 0 && Object.defineProperty(n, Z, {
327
+ o !== void 0 && Object.defineProperty(n, Q, {
322
328
  value: o,
323
329
  enumerable: !1
324
330
  });
325
- let s = z(e.name, e.schedule);
326
- return s !== void 0 && Object.defineProperty(n, V, {
331
+ let s = H(e.name, e.schedule);
332
+ return s !== void 0 && Object.defineProperty(n, W, {
327
333
  value: s,
328
334
  enumerable: !1
329
335
  }), n;
330
- }), Se = (e) => {
336
+ }), Ce = (e) => {
331
337
  if (typeof e != "object" || !e) return;
332
- let t = e[Z];
338
+ let t = e[Q];
333
339
  return t === void 0 ? void 0 : t;
334
- }, Ce = i.make, we = i.process, Te = ((...e) => {
340
+ }, we = i.make, Te = i.process, Ee = ((...e) => {
335
341
  let t = i.worker(...e);
336
- return Object.defineProperty(t, J, {
342
+ return Object.defineProperty(t, Y, {
337
343
  value: !0,
338
344
  enumerable: !1
339
345
  }), t;
340
- }), Ee = o.rateLimit, Q = (e) => h.gen(function* () {
341
- let t = yield* j, r = yield* h.serviceOption(A), i = m.toMillis(m.decode(e.duration));
346
+ }), De = o.rateLimit, $ = (e) => h.gen(function* () {
347
+ let t = yield* M, r = yield* h.serviceOption(j), i = m.toMillis(m.decode(e.duration));
342
348
  if (t !== void 0 && r._tag === "Some") {
343
- let a = r.value, o = new Date(Date.now() + i).toISOString(), s = yield* N;
349
+ let a = r.value, o = new Date(Date.now() + i).toISOString(), s = yield* F;
344
350
  yield* h.promise(() => a.recordEvent({
345
351
  runId: t,
346
352
  eventType: "timer-set",
@@ -364,18 +370,18 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
364
370
  return;
365
371
  }
366
372
  yield* n.sleep(e);
367
- }), De = (t) => h.gen(function* () {
373
+ }), Oe = (t) => h.gen(function* () {
368
374
  let n = (yield* e.make({
369
375
  name: `sleepUntil:${t.name}`,
370
- success: b.Number,
376
+ success: te.Number,
371
377
  execute: h.sync(() => t.until instanceof Date ? t.until.getTime() : t.until)
372
378
  })) - Date.now();
373
- n <= 0 || (yield* Q({
379
+ n <= 0 || (yield* $({
374
380
  name: t.name,
375
381
  duration: `${n} millis`
376
382
  }));
377
- }), $ = (t, n, r, i) => h.gen(function* () {
378
- let a = yield* j, o = yield* e.CurrentAttempt, s = yield* h.serviceOption(A), c = yield* h.serviceOption(F), l = c._tag === "Some" ? c.value.interceptor(n, {
383
+ }), ke = (t, n, r, i) => h.gen(function* () {
384
+ let a = yield* M, o = yield* e.CurrentAttempt, s = yield* h.serviceOption(j), c = yield* h.serviceOption(R), l = c._tag === "Some" ? c.value.interceptor(n, {
379
385
  runId: a ?? "unrecorded",
380
386
  stepName: t,
381
387
  attempt: o
@@ -396,7 +402,7 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
396
402
  }
397
403
  }
398
404
  let p = Date.now();
399
- return yield* ve(l, i).pipe(h.tap((e) => u && f ? h.promise(async () => {
405
+ return yield* h.locally(ye(l, i), P, t).pipe(h.tap((e) => u && f ? h.promise(async () => {
400
406
  try {
401
407
  await f.endStepSuccess({
402
408
  stepRecordId: u,
@@ -420,23 +426,23 @@ var C = Symbol.for("@voltro/workflow/PreparedExecution"), w = (e, t) => {
420
426
  });
421
427
  } catch {}
422
428
  }) : h.void));
423
- }), Oe = (e) => h.gen(function* () {
424
- let t = yield* _.get(W);
429
+ }), Ae = (e) => h.gen(function* () {
430
+ let t = yield* _.get(G);
425
431
  if (t === void 0) return;
426
432
  let n = t.reach(e);
427
- n !== void 0 && (yield* K([n]));
428
- }), ke = (e, t) => {
433
+ n !== void 0 && (yield* q([n]));
434
+ }), je = (e, t) => {
429
435
  let n = e;
430
436
  return {
431
437
  ...e,
432
- commit: () => h.zipRight(Oe(t), n)
438
+ commit: () => h.zipRight(Ae(t), n)
433
439
  };
434
- }, Ae = (t) => {
440
+ }, Me = (t) => {
435
441
  let { input: n, retry: r, ...i } = t;
436
- return ke(e.make({
442
+ return je(e.make({
437
443
  ...i,
438
- execute: $(i.name, i.execute, n, r)
444
+ execute: ke(i.name, i.execute, n, r)
439
445
  }), i.name);
440
- }, je = (e) => h.map(_.get(P), (t) => t.includes(e)), Me = c.withCompensation, Ne = e.idempotencyKey;
446
+ }, Ne = (e) => h.map(_.get(I), (t) => t.includes(e)), Pe = c.withCompensation, Fe = e.idempotencyKey;
441
447
  //#endregion
442
- export { H as A, le as B, l as C, K as D, G as E, j as F, re as G, se as H, N as I, ne as J, k as K, A as L, M, ce as N, I as O, P, F as R, xe as S, U as T, T as U, ae as V, ie as W, te as Y, De as _, r as a, t as b, s as c, ye as d, je as f, Q as g, Ee as h, J as i, z as j, V as k, Se as l, Te as m, X as n, Ce as o, we as p, w as q, Y as r, a as s, Z as t, be as u, Ae as v, W as w, Me as x, Ne as y, ue as z };
448
+ export { ue as A, se as B, l as C, q as D, K as E, M as F, T as G, le as H, P as I, A as J, w as K, F as L, N as M, ce as N, z as O, I as P, j as R, Se as S, de as T, ae as U, L as V, oe as W, ie as X, S as Y, re as Z, Oe as _, r as a, t as b, s as c, be as d, Ne as f, $ as g, De as h, Y as i, H as j, W as k, Ce as l, Ee as m, Z as n, we as o, Te as p, C as q, X as r, a as s, Q as t, xe as u, Me as v, G as w, Pe as x, Fe as y, R as z };
@@ -1,2 +1,2 @@
1
- import { A as e, C as t, D as n, E as r, G as i, H as a, K as o, O as s, S as c, T as l, U as u, V as d, W as f, _ as p, a as m, b as h, c as g, d as _, f as v, g as y, h as b, i as x, j as S, k as C, l as w, m as T, n as E, o as D, p as O, r as k, s as A, t as j, u as M, v as N, w as P, x as F, y as I } from "./primitives-bv2JHUfk.js";
2
- export { P as CurrentWorkflowReplayShape, s as DEFAULT_WORKFLOW_SCHEDULE_MAX_RUNTIME_MS, d as DEFERRING_CONTROLS, j as WorkflowFlowControlProperty, E as WorkflowMessagesProperty, C as WorkflowScheduleProperty, k as WorkflowVersionTypeId, x as WorkflowWorkerLayerTypeId, a as assertConsistentPools, u as deferringControlsOf, m as durableClock, D as durableQueue, A as durableQueueModule, g as durableRateLimiterModule, w as getWorkflowFlowControl, e as getWorkflowSchedule, M as getWorkflowVersionMetadata, f as hasCancelOn, i as hasFlowControl, _ as isWorkflowWorkerLayer, l as makeReplayShapeTracker, r as nondeterminismEventPayload, v as patch, O as processQueue, T as queueWorker, b as rateLimit, n as reportNondeterminism, y as sleep, p as sleepUntil, N as step, I as stepIdempotencyKey, h as stepModule, o as validateFlowControl, S as validateWorkflowSchedule, F as withCompensation, c as workflow, t as workflowModule };
1
+ import { A as e, C as t, D as n, E as r, G as i, J as a, K as o, O as s, S as c, T as l, U as u, W as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, j as x, k as S, l as C, m as w, n as T, o as E, p as D, q as O, r as k, s as A, t as j, u as M, v as N, w as P, x as F, y as I } from "./primitives-BJBn8tiH.js";
2
+ export { P as CurrentWorkflowReplayShape, s as DEFAULT_WORKFLOW_SCHEDULE_MAX_RUNTIME_MS, u as DEFERRING_CONTROLS, j as WorkflowFlowControlProperty, T as WorkflowMessagesProperty, S as WorkflowScheduleProperty, k as WorkflowVersionTypeId, b as WorkflowWorkerLayerTypeId, d as assertConsistentPools, i as deferringControlsOf, p as durableClock, E as durableQueue, A as durableQueueModule, h as durableRateLimiterModule, C as getWorkflowFlowControl, e as getWorkflowSchedule, M as getWorkflowVersionMetadata, o as hasCancelOn, O as hasFlowControl, g as isWorkflowWorkerLayer, l as makeReplayShapeTracker, r as nondeterminismEventPayload, _ as patch, D as processQueue, w as queueWorker, y as rateLimit, n as reportNondeterminism, v as sleep, f as sleepUntil, N as step, I as stepIdempotencyKey, m as stepModule, a as validateFlowControl, x as validateWorkflowSchedule, F as withCompensation, c as workflow, t as workflowModule };