@voltro/runtime 0.35.0 → 0.37.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
@@ -2,12 +2,12 @@ import { Cause as e, Clock as t, Context as n, Cron as r, Deferred as i, Duratio
2
2
  import { ENCRYPTED_PREFIX as S, and as C, attachEagerLoads as w, attributionFields as T, boolean as E, clearRetentions as ee, collectSubqueries as D, contains as te, decryptFieldsOnRead as ne, deserializeArraysOnRead as re, encryptFieldsForWrite as ie, eq as O, evaluatePredicate as k, externalChangeEvent as ae, generateId as A, getRelations as oe, getTable as j, gt as se, gte as ce, hasEagerLoads as le, id as M, inSet as ue, integer as N, isEncrypted as de, isNull as fe, isTableReactive as pe, json as P, listRetentionConflicts as me, listRetentions as he, lt as ge, lte as _e, missingConflictColumns as ve, missingRequiredColumns as ye, neq as be, or as xe, planVersionedUpdate as Se, queryFor as Ce, raiseChangeListenerCeiling as we, readableByColumns as Te, registerRetention as Ee, registerRetention as De, requireTable as Oe, retentionTtlMsFromEnv as ke, retentionTtlMsFromEnv as Ae, runWithWriteAttribution as je, serializeArraysForWrite as Me, serverOnlyColumns as Ne, settleVersionedUpdate as Pe, stampGeneratedId as Fe, startsWith as Ie, sweepRetention as Le, table as F, text as I, timestamp as L, walkLeaves as Re } from "@voltro/database";
3
3
  import { createCipheriv as ze, createDecipheriv as Be, createHash as Ve, randomBytes as He, randomUUID as Ue, scryptSync as We } from "node:crypto";
4
4
  import { EventEmitter as Ge } from "node:events";
5
- import { ADMIN_SCOPE as Ke, APIKEY_ISSUE_ORG_SCOPE as qe, APIKEY_ISSUE_OTHER_SCOPE as Je, APIKEY_ISSUE_SELF_SCOPE as Ye, ApprovalExpired as Xe, ApprovalForbidden as Ze, ApprovalNotFound as Qe, ApprovalNotPending as $e, ApprovalRejected as et, ApprovalRequired as tt, ApprovalSelfApproval as nt, ApprovalUnavailable as rt, AuthMiddleware as it, BusinessRuleViolation as at, ConnectionHandshakeFailed as R, ConnectionInfo as ot, ConnectionInfoMiddleware as st, ConnectionKindMismatch as ct, ConnectionNotDeclared as lt, ConnectionSubjectRequired as ut, EventKeyInvalid as dt, EventPayloadInvalid as ft, EventPayloadTooLarge as pt, MAX_EVENT_ENVELOPE_BYTES as mt, ScopeError as ht, SubjectService as gt, UndoConflict as _t, UndoForbidden as vt, UndoNotFound as yt, WorkflowRunHandleSchema as bt, beginIdempotent as xt, checkGuardsEffect as St, declaredReactivityChannelKeys as Ct, diffRows as wt, effectiveScopes as Tt, eventRoute as Et, failIdempotent as Dt, finishIdempotent as Ot, hasEffectiveScope as kt, isIdKeyed as At, isOpenAccess as jt, isPolicyGuard as Mt, isReactivityChannelKey as Nt, parseEventRoute as Pt, publishServerError as Ft, requireScope as It, setPolicyGuardResolver as Lt, sourceKeys as Rt, systemSubject as zt, tsMs as Bt, wsMutationIdempotencyScope as Vt } from "@voltro/protocol";
6
- import { createLogger as z, log as Ht } from "@voltro/logger";
5
+ import { ADMIN_SCOPE as Ke, APIKEY_ISSUE_ORG_SCOPE as qe, APIKEY_ISSUE_OTHER_SCOPE as Je, APIKEY_ISSUE_SELF_SCOPE as Ye, ApprovalExpired as Xe, ApprovalForbidden as Ze, ApprovalNotFound as Qe, ApprovalNotPending as $e, ApprovalRejected as et, ApprovalRequired as tt, ApprovalSelfApproval as nt, ApprovalUnavailable as rt, AuthMiddleware as it, BusinessRuleViolation as at, ConnectionHandshakeFailed as R, ConnectionInfo as ot, ConnectionInfoMiddleware as st, ConnectionKindMismatch as ct, ConnectionNotDeclared as lt, ConnectionSubjectRequired as ut, EventKeyInvalid as dt, EventPayloadInvalid as ft, EventPayloadTooLarge as pt, MAX_EVENT_ENVELOPE_BYTES as mt, ScopeError as ht, SubjectService as gt, UndoConflict as _t, UndoForbidden as vt, UndoNotFound as yt, WorkflowRunHandleSchema as bt, beginIdempotent as xt, checkGuardsEffect as z, declaredReactivityChannelKeys as St, diffRows as Ct, effectiveScopes as wt, eventRoute as Tt, failIdempotent as Et, finishIdempotent as Dt, hasEffectiveScope as Ot, isIdKeyed as kt, isOpenAccess as At, isPolicyGuard as jt, isReactivityChannelKey as Mt, parseEventRoute as Nt, publishServerError as Pt, requireScope as Ft, setPolicyGuardResolver as It, sourceKeys as Lt, strictInput as Rt, systemSubject as zt, tsMs as Bt, wsMutationIdempotencyScope as Vt } from "@voltro/protocol";
6
+ import { createLogger as B, log as Ht } from "@voltro/logger";
7
7
  import { AsyncLocalStorage as Ut } from "node:async_hooks";
8
8
  import * as Wt from "node:http";
9
9
  import { createServer as Gt } from "node:http";
10
- import { HttpClient as Kt, HttpClientError as qt, HttpClientRequest as Jt, HttpLayerRouter as B, HttpServer as Yt, HttpServerError as Xt, HttpServerRequest as Zt, HttpServerResponse as V, UrlParams as Qt } from "@effect/platform";
10
+ import { HttpClient as Kt, HttpClientError as qt, HttpClientRequest as Jt, HttpLayerRouter as V, HttpServer as Yt, HttpServerError as Xt, HttpServerRequest as Zt, HttpServerResponse as H, UrlParams as Qt } from "@effect/platform";
11
11
  import { NodeContext as $t, NodeHttpServer as en } from "@effect/platform-node";
12
12
  import { Rpc as tn, RpcSerialization as nn, RpcServer as rn } from "@effect/rpc";
13
13
  import { defineRestRoute as an, dispatchSharedPath as on, requireAnyScope as sn, requireScope as cn } from "@voltro/protocol/rest";
@@ -926,11 +926,11 @@ var En = (e) => {
926
926
  let t = e.dbCode, n = e.dbErrno;
927
927
  return t === "57014" || n === 3024 || n === 1969 || t === "ETIMEOUT" || t === "SQLITE_INTERRUPT";
928
928
  }, Qn = (e) => ({
929
- has: (t) => kt(e, t),
930
- hasAny: (t) => t.some((t) => kt(e, t)),
931
- require: (t) => It(e, t),
929
+ has: (t) => Ot(e, t),
930
+ hasAny: (t) => t.some((t) => Ot(e, t)),
931
+ require: (t) => Ft(e, t),
932
932
  get scopes() {
933
- return Tt(e);
933
+ return wt(e);
934
934
  }
935
935
  }), $n = 8, er = 32, tr = (e) => {
936
936
  if (e == null || e === "") return;
@@ -984,7 +984,7 @@ var En = (e) => {
984
984
  }
985
985
  e.op === "exists" || e.op === "not-exists" || t.add(e.column);
986
986
  }
987
- }, H = (e, t, n) => {
987
+ }, U = (e, t, n) => {
988
988
  let r = e.get(t);
989
989
  r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r));
990
990
  for (let e of n) r.add(e);
@@ -996,24 +996,24 @@ var En = (e) => {
996
996
  let o = a === !0 ? {} : a;
997
997
  if (t.kind === "manyToMany") {
998
998
  let r = t.through(), i = t.target();
999
- H(n, r.tableName, [t.sourceKey, t.targetKey]), H(n, e, ["id"]), H(n, i.tableName, ["id"]), gr(i.tableName, o, n), o.with !== void 0 && hr(i.tableName, o.with, n);
999
+ U(n, r.tableName, [t.sourceKey, t.targetKey]), U(n, e, ["id"]), U(n, i.tableName, ["id"]), gr(i.tableName, o, n), o.with !== void 0 && hr(i.tableName, o.with, n);
1000
1000
  continue;
1001
1001
  }
1002
1002
  let s = t.target();
1003
- t.foreignKey !== void 0 && H(n, s.tableName, [t.foreignKey]), t.sourceKey === void 0 ? H(n, e, ["id"]) : H(n, e, [t.sourceKey]), H(n, s.tableName, ["id"]), gr(s.tableName, o, n), o.with !== void 0 && hr(s.tableName, o.with, n);
1003
+ t.foreignKey !== void 0 && U(n, s.tableName, [t.foreignKey]), t.sourceKey === void 0 ? U(n, e, ["id"]) : U(n, e, [t.sourceKey]), U(n, s.tableName, ["id"]), gr(s.tableName, o, n), o.with !== void 0 && hr(s.tableName, o.with, n);
1004
1004
  }
1005
1005
  }, gr = (e, t, n) => {
1006
1006
  if (t.where !== void 0) {
1007
1007
  let r = /* @__PURE__ */ new Set();
1008
- mr(t.where, r), H(n, e, r);
1008
+ mr(t.where, r), U(n, e, r);
1009
1009
  }
1010
- t.orderBy !== void 0 && H(n, e, t.orderBy.map((e) => e.column));
1010
+ t.orderBy !== void 0 && U(n, e, t.orderBy.map((e) => e.column));
1011
1011
  let r = j(e);
1012
- r === void 0 ? H(n, e, ["*"]) : H(n, e, Object.keys(r.fields));
1012
+ r === void 0 ? U(n, e, ["*"]) : U(n, e, Object.keys(r.fields));
1013
1013
  }, _r = (e) => {
1014
1014
  let t = /* @__PURE__ */ new Map();
1015
1015
  if (fr(e)) {
1016
- for (let n of lr(e)) H(t, n, ["*"]);
1016
+ for (let n of lr(e)) U(t, n, ["*"]);
1017
1017
  return t;
1018
1018
  }
1019
1019
  let n = /* @__PURE__ */ new Set();
@@ -1021,7 +1021,7 @@ var En = (e) => {
1021
1021
  else n.add("*");
1022
1022
  mr(e.predicate, n);
1023
1023
  for (let t of e.order) n.add(t.column);
1024
- return H(t, e.table, n), e.eager !== void 0 && hr(e.table, e.eager, t), t;
1024
+ return U(t, e.table, n), e.eager !== void 0 && hr(e.table, e.eager, t), t;
1025
1025
  }, vr = (e) => {
1026
1026
  if (e.op === "insert" || e.op === "delete" || e.old === null || e.new === null) return pr;
1027
1027
  let t = /* @__PURE__ */ new Set(), n = e.old, r = e.new, i = /* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(r)]);
@@ -1160,9 +1160,9 @@ var En = (e) => {
1160
1160
  let r = Ne(n), i = Te(n);
1161
1161
  if (i.length === 0) return r;
1162
1162
  let a = [...r];
1163
- for (let { column: e, scopes: n } of i) n.some((e) => kt(t, e)) || a.push(e);
1163
+ for (let { column: e, scopes: n } of i) n.some((e) => Ot(t, e)) || a.push(e);
1164
1164
  return a;
1165
- }, Ei = (e, t, n) => Ci(t, Ti(e, n)), U = z({ scope: "voltro:dispatcher" }), Di = (e) => Array.isArray(e) ? e.length : e == null ? 0 : 1, Oi = (e) => typeof e == "object" && !!e && e._tag === "ScopeError", ki = class {
1165
+ }, Ei = (e, t, n) => Ci(t, Ti(e, n)), W = B({ scope: "voltro:dispatcher" }), Di = (e) => Array.isArray(e) ? e.length : e == null ? 0 : 1, Oi = (e) => typeof e == "object" && !!e && e._tag === "ScopeError", ki = class {
1166
1166
  deps;
1167
1167
  subscriptionRegistry;
1168
1168
  matcher;
@@ -1181,7 +1181,7 @@ var En = (e) => {
1181
1181
  warnUndeclaredRawReads(e, t) {
1182
1182
  if (t.length !== 0 && !this.rawReadWarned.has(e)) {
1183
1183
  this.rawReadWarned.add(e);
1184
- for (let n of t) U.warn(`${e}: a raw SQL read in this live query declares no dependsOn, so no write can invalidate it — every subscriber keeps its first result until it reconnects. Declare the tables it reads: ctx.store.raw(fragment, { dependsOn: ['orders'] }) — or on the fragment itself. The read: ${n.sql}`, {
1184
+ for (let n of t) W.warn(`${e}: a raw SQL read in this live query declares no dependsOn, so no write can invalidate it — every subscriber keeps its first result until it reconnects. Declare the tables it reads: ctx.store.raw(fragment, { dependsOn: ['orders'] }) — or on the fragment itself. The read: ${n.sql}`, {
1185
1185
  label: e,
1186
1186
  sql: n.sql
1187
1187
  });
@@ -1247,7 +1247,7 @@ var En = (e) => {
1247
1247
  let n = this.dependentByTable.get(t);
1248
1248
  n !== void 0 && (n.delete(e.id), n.size === 0 && this.dependentByTable.delete(t));
1249
1249
  }
1250
- U.warn(`subscription revoked mid-stream — ${n}`, {
1250
+ W.warn(`subscription revoked mid-stream — ${n}`, {
1251
1251
  id: e.id,
1252
1252
  label: e.label,
1253
1253
  traceId: e.context.traceId
@@ -1262,7 +1262,7 @@ var En = (e) => {
1262
1262
  let n = this.computedByTable.get(t);
1263
1263
  n !== void 0 && (n.delete(e.id), n.size === 0 && this.computedByTable.delete(t));
1264
1264
  }
1265
- U.warn("computed subscription revoked mid-stream — guards no longer satisfied", {
1265
+ W.warn("computed subscription revoked mid-stream — guards no longer satisfied", {
1266
1266
  id: e.id,
1267
1267
  label: e.label,
1268
1268
  traceId: e.context.traceId
@@ -1346,7 +1346,7 @@ var En = (e) => {
1346
1346
  this.revokeComputed(e, t);
1347
1347
  return;
1348
1348
  }
1349
- U.warn("computed recompute failed; subscriber left on last value", {
1349
+ W.warn("computed recompute failed; subscriber left on last value", {
1350
1350
  id: e.id,
1351
1351
  label: e.label,
1352
1352
  traceId: e.context.traceId
@@ -1370,7 +1370,7 @@ var En = (e) => {
1370
1370
  for (let e of this.subscriptions.values()) t.add(e.descriptor.table);
1371
1371
  for (let e of this.computedByTable.keys()) t.add(e);
1372
1372
  if (t.size !== 0) {
1373
- U.warn("refreshing every live subscription", {
1373
+ W.warn("refreshing every live subscription", {
1374
1374
  reason: e,
1375
1375
  tables: t.size,
1376
1376
  subscriptions: this.subscriptions.size
@@ -1400,7 +1400,7 @@ var En = (e) => {
1400
1400
  if (t) for (let [t, n] of this.subscriptions) n.descriptor.table === e.table && i.add(t);
1401
1401
  let a = this.dependentByTable.get(e.table);
1402
1402
  if (a !== void 0) for (let e of a) i.add(e);
1403
- if (U.trace("handleChange", {
1403
+ if (W.trace("handleChange", {
1404
1404
  table: e.table,
1405
1405
  op: e.op,
1406
1406
  matcher: r.length,
@@ -1410,7 +1410,7 @@ var En = (e) => {
1410
1410
  let o = Date.now(), s = 0, c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = async (n) => {
1411
1411
  let r = this.subscriptions.get(n);
1412
1412
  if (!r) {
1413
- U.trace("missing subscription", { subscriberId: n });
1413
+ W.trace("missing subscription", { subscriberId: n });
1414
1414
  return;
1415
1415
  }
1416
1416
  if (!t && !yr(e, r.relevantFields)) {
@@ -1444,17 +1444,17 @@ var En = (e) => {
1444
1444
  p === void 0 && (p = /* @__PURE__ */ new Map(), u.set(a, p));
1445
1445
  let m = p.get(f);
1446
1446
  if (m === void 0 && (m = !ji(d, f), p.set(f, m)), !m) {
1447
- U.trace("suppressed no-op delta", {
1447
+ W.trace("suppressed no-op delta", {
1448
1448
  subscriberId: n,
1449
1449
  table: e.table
1450
1450
  });
1451
1451
  return;
1452
1452
  }
1453
- if (r.lastDelivered = d, this.deps.cache !== void 0 && r.cacheBinding !== void 0 && this.deps.cache.put(r.cacheBinding, Array.from(r.dependentTables), d), At(f) && At(d)) {
1453
+ if (r.lastDelivered = d, this.deps.cache !== void 0 && r.cacheBinding !== void 0 && this.deps.cache.put(r.cacheBinding, Array.from(r.dependentTables), d), kt(f) && kt(d)) {
1454
1454
  let e = l.get(a);
1455
1455
  e === void 0 && (e = /* @__PURE__ */ new Map(), l.set(a, e));
1456
1456
  let t = e.get(f);
1457
- t === void 0 && (t = wt(f, d), e.set(f, t)), r.emit({
1457
+ t === void 0 && (t = Ct(f, d), e.set(f, t)), r.emit({
1458
1458
  _tag: "delta",
1459
1459
  revision: o,
1460
1460
  emittedAt: o,
@@ -1483,7 +1483,7 @@ var En = (e) => {
1483
1483
  traceId: r.context.traceId
1484
1484
  });
1485
1485
  } catch (t) {
1486
- U.warn("reactive re-query failed; subscriber left on last snapshot", {
1486
+ W.warn("reactive re-query failed; subscriber left on last snapshot", {
1487
1487
  subscriberId: n,
1488
1488
  label: r.label,
1489
1489
  table: e.table,
@@ -1497,7 +1497,7 @@ var En = (e) => {
1497
1497
  await d(f[e]);
1498
1498
  }
1499
1499
  };
1500
- await Promise.all(Array.from({ length: p }, () => h())), s > 0 && U.trace("handleChange/prefiltered", {
1500
+ await Promise.all(Array.from({ length: p }, () => h())), s > 0 && W.trace("handleChange/prefiltered", {
1501
1501
  table: e.table,
1502
1502
  op: e.op,
1503
1503
  skipped: s
@@ -1556,22 +1556,22 @@ var En = (e) => {
1556
1556
  for (let [t, n] of Fi) n.touchedAt < e && Fi.delete(t);
1557
1557
  }, Pi);
1558
1558
  typeof Wi == "object" && Wi && "unref" in Wi && Wi.unref();
1559
- var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
1560
- let n = W.get(e);
1561
- return n || (n = /* @__PURE__ */ new Set(), W.set(e, n)), n.add(t), () => {
1562
- let n = W.get(e);
1563
- n && (n.delete(t), n.size === 0 && W.delete(e));
1559
+ var G = /* @__PURE__ */ new Map(), Gi = (e, t) => {
1560
+ let n = G.get(e);
1561
+ return n || (n = /* @__PURE__ */ new Set(), G.set(e, n)), n.add(t), () => {
1562
+ let n = G.get(e);
1563
+ n && (n.delete(t), n.size === 0 && G.delete(e));
1564
1564
  };
1565
1565
  }, Ki = (e) => {
1566
- let t = W.get(e);
1566
+ let t = G.get(e);
1567
1567
  if (t) {
1568
1568
  for (let e of [...t]) try {
1569
1569
  e();
1570
1570
  } catch {}
1571
- W.delete(e);
1571
+ G.delete(e);
1572
1572
  }
1573
- }, qi = (e) => W.get(e)?.size ?? 0, Ji = () => {
1574
- Fi.clear(), Ii.clear(), W.clear();
1573
+ }, qi = (e) => G.get(e)?.size ?? 0, Ji = () => {
1574
+ Fi.clear(), Ii.clear(), G.clear();
1575
1575
  }, Yi = /^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/, Xi = (e) => `00-${e.traceId}-${e.spanId}-${e.sampled ? "01" : "00"}`, Zi = (e) => {
1576
1576
  if (typeof e != "string") return null;
1577
1577
  let t = Yi.exec(e.trim().toLowerCase());
@@ -1625,13 +1625,13 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
1625
1625
  };
1626
1626
  }, oa = (e) => aa(ia(e)), sa, ca = (e) => {
1627
1627
  sa = e;
1628
- }, G = () => sa, la = "no field cipher registered — enable `@voltro/plugin-governance` `governancePlugin({ fieldEncryption: { key } })` (or call setFieldCipher) so a key is available.", ua = (e) => {
1629
- let t = G();
1628
+ }, K = () => sa, la = "no field cipher registered — enable `@voltro/plugin-governance` `governancePlugin({ fieldEncryption: { key } })` (or call setFieldCipher) so a key is available.", ua = (e) => {
1629
+ let t = K();
1630
1630
  if (!t) throw Error(`encryptField: ${la}`);
1631
1631
  return t.encrypt(e);
1632
1632
  }, da = (e) => {
1633
1633
  if (!de(e)) return e;
1634
- let t = G();
1634
+ let t = K();
1635
1635
  if (!t) throw Error(`decryptField: ${la}`);
1636
1636
  return t.decrypt(e);
1637
1637
  }, fa = new Ut(), pa = /* @__PURE__ */ new Set(), ma = /* @__PURE__ */ new Set(), ha = "\0", ga = process.env.VOLTRO_OBSERVE_GRAPH === "1", _a = () => {
@@ -1914,7 +1914,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
1914
1914
  let n = Ca(e);
1915
1915
  ir();
1916
1916
  let r = Ua(t.subject), i = t.subject.tenantId;
1917
- if (t.rowFilter === void 0 && hi()) throw Error("row filter registered, but this store was scoped without one — refusing to serve an unfiltered read.\n\nThis app called `setRowFilter`, so every scoped store must receive a resolved `rowFilter` (the serve pipeline's `withRowFilter` does this per request). Reaching here with none means a read path was built outside that spine, and continuing would serve rows the filter exists to hide — silently, which is how this was found in the first place.\n\nIf this path is deliberately unfiltered (a system sweep, a migration), pass `rowFilter: NO_ROW_FILTER` explicitly.");
1917
+ if (t.rowFilter === void 0 && t.subject.type !== "system" && hi()) throw Error("row filter registered, but this store was scoped without one — refusing to serve an unfiltered read.\n\nThis app called `setRowFilter`, so every scoped store must receive a resolved `rowFilter` (the serve pipeline's `withRowFilter` does this per request). Reaching here with none means a read path was built outside that spine, and continuing would serve rows the filter exists to hide — silently, which is how this was found in the first place.\n\nIf this path is deliberately unfiltered (a system sweep, a migration), pass `rowFilter: NO_ROW_FILTER` explicitly.");
1918
1918
  let a = t.rowFilter ?? gi, o = (e, n) => {
1919
1919
  let a = { ...n }, o = t.schemaRegistry, s = o.idScheme(e);
1920
1920
  if (s !== void 0 && a[Ra] == null) if (s.kind === "numeric") delete a[Ra];
@@ -2017,8 +2017,8 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
2017
2017
  });
2018
2018
  }, m = t.dialect, h = (e, t) => {
2019
2019
  let n = j(e);
2020
- return ie(m ? Me(t, n, m) : t, n, G());
2021
- }, g = process.env.VOLTRO_FIELD_DECRYPT_ON_ERROR === "null" ? "null" : "throw", _ = z({ scope: "store.fieldEncryption" }), v = /* @__PURE__ */ new Set(), b = (e) => {
2020
+ return ie(m ? Me(t, n, m) : t, n, K());
2021
+ }, g = process.env.VOLTRO_FIELD_DECRYPT_ON_ERROR === "null" ? "null" : "throw", _ = B({ scope: "store.fieldEncryption" }), v = /* @__PURE__ */ new Set(), b = (e) => {
2022
2022
  let t = `${e.table}.${e.column}`;
2023
2023
  v.has(t) || (v.add(t), _.warn("encrypted column degraded to null — could not decrypt with the active key", {
2024
2024
  table: e.table,
@@ -2027,7 +2027,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
2027
2027
  hint: "VOLTRO_FIELD_DECRYPT_ON_ERROR=null is set — this row was likely encrypted under a different key"
2028
2028
  }));
2029
2029
  }, x = (e, t) => {
2030
- let n = j(e), r = ne(t, n, G(), {
2030
+ let n = j(e), r = ne(t, n, K(), {
2031
2031
  onError: g,
2032
2032
  ...g === "null" ? { warn: b } : {}
2033
2033
  });
@@ -2420,7 +2420,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
2420
2420
  return o.size;
2421
2421
  }
2422
2422
  };
2423
- }, Xa = z({ scope: "voltro:replication" }), Za = new Ut(), Qa = (e, t) => Za.run(e, t), $a = () => Za.getStore(), eo = class {
2423
+ }, Xa = B({ scope: "voltro:replication" }), Za = new Ut(), Qa = (e, t) => Za.run(e, t), $a = () => Za.getStore(), eo = class {
2424
2424
  primary;
2425
2425
  replicas;
2426
2426
  adapter;
@@ -3128,7 +3128,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3128
3128
  }).pipe(o.withSpan(n, { attributes: { "framework.kind": "subscription" } }))), rs = (e, t = "rpc.stream", n, r) => b.unwrap(o.gen(function* () {
3129
3129
  let a = yield* gt, s = yield* ot, c = yield* qo;
3130
3130
  Yo(c, t, a);
3131
- let l = Ko(a, c, s.clientId), u = Uo(t, () => e(l)), d = o.isEffect(u) ? yield* u.pipe(o.orDie) : u, f = n === void 0 || n.length === 0 ? void 0 : () => St(a, n, r), p = io(f === void 0 ? d : b.unwrap(f().pipe(o.map((e) => e ? b.fail(e) : b.flatMap(d, (e) => b.unwrap(f().pipe(o.map((t) => t ? b.fail(t) : b.make(e)))))))), s.credentialExpiresAt, b.empty);
3131
+ let l = Ko(a, c, s.clientId), u = Uo(t, () => e(l)), d = o.isEffect(u) ? yield* u.pipe(o.orDie) : u, f = n === void 0 || n.length === 0 ? void 0 : () => z(a, n, r), p = io(f === void 0 ? d : b.unwrap(f().pipe(o.map((e) => e ? b.fail(e) : b.flatMap(d, (e) => b.unwrap(f().pipe(o.map((t) => t ? b.fail(t) : b.make(e)))))))), s.credentialExpiresAt, b.empty);
3132
3132
  if (l.clientId === void 0) return p;
3133
3133
  let m = l.clientId;
3134
3134
  return b.unwrapScoped(o.gen(function* () {
@@ -3137,7 +3137,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3137
3137
  });
3138
3138
  return yield* o.addFinalizer(() => o.sync(() => t())), p.pipe(b.interruptWhen(i.await(e)));
3139
3139
  }));
3140
- }).pipe(o.withSpan(t, { attributes: { "framework.kind": "stream" } }))), is = z({ scope: "voltro:rpc" }), as = z({ scope: "voltro:http" }), os = z({ scope: "voltro:shutdown" }), ss = (t, n, r) => {
3140
+ }).pipe(o.withSpan(t, { attributes: { "framework.kind": "stream" } }))), is = B({ scope: "voltro:rpc" }), as = B({ scope: "voltro:http" }), os = B({ scope: "voltro:shutdown" }), ss = (t, n, r) => {
3141
3141
  if (e.isInterruptedOnly(r)) return;
3142
3142
  let i = e.squash(r), a = i?._tag, o = i instanceof Error ? i.message : i?.message ?? String(i), s = e.dieOption(r)._tag === "Some", c = Yn(i), l = {
3143
3143
  traceId: n,
@@ -3224,38 +3224,38 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3224
3224
  try: () => Promise.resolve(m),
3225
3225
  catch: (e) => e
3226
3226
  });
3227
- return yield* (d ? h.pipe(o.tap((e) => o.promise(() => Ot(d.store, d.scope, d.key, {
3227
+ return yield* (d ? h.pipe(o.tap((e) => o.promise(() => Dt(d.store, d.scope, d.key, {
3228
3228
  status: 200,
3229
3229
  body: r ? r.encode(e) : e
3230
- }, Date.now())).pipe(o.ignore)), o.tapErrorCause(() => o.promise(() => Dt(d.store, d.scope, d.key)).pipe(o.ignore))) : h).pipe(o.tapErrorCause((e) => o.sync(() => ss(n, u.traceId, e))), o.catchIf(ls, () => o.die(ds(u.traceId))), o.catchIf((e) => e instanceof Error && typeof e._tag != "string", (e) => o.die(ds(u.traceId, fs(e)))), o.catchIf((e) => a !== void 0 && typeof e?._tag == "string" && !us(a, e), (e) => o.die(ds(u.traceId, fs(e)))), o.catchAllDefect((e) => e?._tag === "InternalError" ? o.die(e) : o.die(ds(u.traceId, fs(e)))), o.annotateLogs(Jo(u)));
3230
+ }, Date.now())).pipe(o.ignore)), o.tapErrorCause(() => o.promise(() => Et(d.store, d.scope, d.key)).pipe(o.ignore))) : h).pipe(o.tapErrorCause((e) => o.sync(() => ss(n, u.traceId, e))), o.catchIf(ls, () => o.die(ds(u.traceId))), o.catchIf((e) => e instanceof Error && typeof e._tag != "string", (e) => o.die(ds(u.traceId, fs(e)))), o.catchIf((e) => a !== void 0 && typeof e?._tag == "string" && !us(a, e), (e) => o.die(ds(u.traceId, fs(e)))), o.catchAllDefect((e) => e?._tag === "InternalError" ? o.die(e) : o.die(ds(u.traceId, fs(e)))), o.annotateLogs(Jo(u)));
3231
3231
  }).pipe(o.withSpan(n, { attributes: { "framework.kind": "mutation" } })), _s = 8 * 1024 * 1024, vs = (t) => {
3232
3232
  let n = t.port ?? 4e3, r = t.host, i = t.path ?? "/ws", a = i;
3233
3233
  Vo(t.webhookRoutes);
3234
3234
  let s = Gt(), c = (e) => Zt.HttpServerRequest.pipe(o.flatMap((e) => o.gen(function* () {
3235
- if (!t.inspectRoute) return V.text("inspect route not configured", { status: 404 });
3235
+ if (!t.inspectRoute) return H.text("inspect route not configured", { status: 404 });
3236
3236
  let n = {};
3237
3237
  for (let [t, r] of Object.entries(e.headers)) r !== void 0 && (n[t.toLowerCase()] = Array.isArray(r) ? r.join(", ") : r);
3238
3238
  let r;
3239
3239
  e.method !== "GET" && e.method !== "HEAD" && e.method !== "OPTIONS" && (r = yield* e.text.pipe(o.orElseSucceed(() => "")));
3240
3240
  let i = t.inspectRoute.handle(e.url, n, e.method, r), a = i instanceof Promise ? yield* o.promise(() => i) : i;
3241
- return a === null ? V.text("inspect route not found", { status: 404 }) : V.text(a.body, {
3241
+ return a === null ? H.text("inspect route not found", { status: 404 }) : H.text(a.body, {
3242
3242
  status: a.status,
3243
3243
  contentType: a.contentType,
3244
3244
  headers: a.headers ?? {}
3245
3245
  });
3246
3246
  }))), d = () => Zt.HttpServerRequest.pipe(o.flatMap((e) => {
3247
3247
  let n = t.inspectStream;
3248
- if (!n) return o.succeed(V.text("inspect stream not configured", { status: 404 }));
3248
+ if (!n) return o.succeed(H.text("inspect stream not configured", { status: 404 }));
3249
3249
  let r = {};
3250
3250
  for (let [t, n] of Object.entries(e.headers)) n !== void 0 && (r[t.toLowerCase()] = Array.isArray(n) ? n.join(", ") : n);
3251
3251
  let i = n.corsHeaders(r.origin);
3252
- if (n.isDisabled()) return o.succeed(V.text(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }), {
3252
+ if (n.isDisabled()) return o.succeed(H.text(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }), {
3253
3253
  status: 503,
3254
3254
  contentType: "application/json; charset=utf-8",
3255
3255
  headers: i
3256
3256
  }));
3257
3257
  let a = n.authorize(r);
3258
- if (!a.ok) return o.succeed(V.text(JSON.stringify({
3258
+ if (!a.ok) return o.succeed(H.text(JSON.stringify({
3259
3259
  error: "unauthorized",
3260
3260
  reason: a.reason
3261
3261
  }), {
@@ -3278,7 +3278,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3278
3278
  clearInterval(r), t();
3279
3279
  }));
3280
3280
  }));
3281
- return o.succeed(V.stream(h, {
3281
+ return o.succeed(H.stream(h, {
3282
3282
  status: 200,
3283
3283
  headers: {
3284
3284
  "content-type": "text/event-stream; charset=utf-8",
@@ -3288,20 +3288,20 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3288
3288
  ...i
3289
3289
  }
3290
3290
  }));
3291
- })), f = B.add("*", "/_voltro/inspect/*", Zt.HttpServerRequest.pipe(o.flatMap((e) => o.gen(function* () {
3292
- if (!t.inspectRoute) return V.text("inspect route not configured", { status: 404 });
3291
+ })), f = V.add("*", "/_voltro/inspect/*", Zt.HttpServerRequest.pipe(o.flatMap((e) => o.gen(function* () {
3292
+ if (!t.inspectRoute) return H.text("inspect route not configured", { status: 404 });
3293
3293
  let n = {};
3294
3294
  for (let [t, r] of Object.entries(e.headers)) r !== void 0 && (n[t.toLowerCase()] = Array.isArray(r) ? r.join(", ") : r);
3295
3295
  let r;
3296
3296
  e.method !== "GET" && e.method !== "HEAD" && e.method !== "OPTIONS" && (r = yield* e.text.pipe(o.orElseSucceed(() => "")));
3297
3297
  let i = t.inspectRoute.handle(e.url, n, e.method, r), a = i instanceof Promise ? yield* o.promise(() => i) : i;
3298
- return a === null ? V.text("inspect route not found", { status: 404 }) : V.text(a.body, {
3298
+ return a === null ? H.text("inspect route not found", { status: 404 }) : H.text(a.body, {
3299
3299
  status: a.status,
3300
3300
  contentType: a.contentType,
3301
3301
  headers: a.headers ?? {}
3302
3302
  });
3303
3303
  })))), p = u.empty;
3304
- t.inspectRoute !== void 0 && (p = t.inspectStream === void 0 ? u.mergeAll(B.add("*", "/_voltro/inspect", c(!0)), f) : u.mergeAll(B.add("GET", "/_voltro/inspect/stream", d()), B.add("*", "/_voltro/inspect", c(!0)), f));
3304
+ t.inspectRoute !== void 0 && (p = t.inspectStream === void 0 ? u.mergeAll(V.add("*", "/_voltro/inspect", c(!0)), f) : u.mergeAll(V.add("GET", "/_voltro/inspect/stream", d()), V.add("*", "/_voltro/inspect", c(!0)), f));
3305
3305
  let m = u.empty;
3306
3306
  if (t.webhookRoutes !== void 0 && t.webhookRoutes.size > 0) {
3307
3307
  let e = (e) => Zt.HttpServerRequest.pipe(o.flatMap((t) => o.gen(function* () {
@@ -3319,11 +3319,11 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3319
3319
  },
3320
3320
  ...s ? { parent: s } : {}
3321
3321
  }));
3322
- return V.text(c.body, {
3322
+ return H.text(c.body, {
3323
3323
  status: c.status,
3324
3324
  contentType: c.contentType
3325
3325
  });
3326
- }))), n = Array.from(t.webhookRoutes.entries()).map(([t, n]) => B.add("*", t, e(n)));
3326
+ }))), n = Array.from(t.webhookRoutes.entries()).map(([t, n]) => V.add("*", t, e(n)));
3327
3327
  m = u.mergeAll(...n);
3328
3328
  }
3329
3329
  let h = Do(t.security?.trustedProxies), g = u.empty;
@@ -3373,7 +3373,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3373
3373
  a !== void 0 && clearInterval(a), i();
3374
3374
  }));
3375
3375
  }));
3376
- return V.stream(i, {
3376
+ return H.stream(i, {
3377
3377
  status: p.status,
3378
3378
  headers: {
3379
3379
  ...m,
@@ -3384,7 +3384,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3384
3384
  }
3385
3385
  });
3386
3386
  }
3387
- return p.body instanceof Uint8Array ? V.uint8Array(p.body, g) : V.text(p.body ?? "", g);
3387
+ return p.body instanceof Uint8Array ? H.uint8Array(p.body, g) : H.text(p.body ?? "", g);
3388
3388
  })), o.tapErrorCause((t) => e.isInterruptedOnly(t) ? o.void : o.sync(() => as.error(`${n.map((e) => e.method).join("|")} ${n[0].path} threw`, { path: n[0].path }, e.squash(t))))), r = /* @__PURE__ */ new Map();
3389
3389
  for (let e of t.httpRoutes) {
3390
3390
  let t = r.get(e.path);
@@ -3392,7 +3392,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3392
3392
  }
3393
3393
  let i = [...r.entries()].flatMap(([e, t]) => {
3394
3394
  let r = t.length === 1 ? t[0].method : "*", i = n(t);
3395
- return [B.add(r, e, i), B.add(r, `${e}/*`, i)];
3395
+ return [V.add(r, e, i), V.add(r, `${e}/*`, i)];
3396
3396
  });
3397
3397
  g = u.mergeAll(...i);
3398
3398
  }
@@ -3408,13 +3408,13 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3408
3408
  }), ne = co({
3409
3409
  ...t.webhookRoutes === void 0 ? {} : { webhookPaths: t.webhookRoutes.keys() },
3410
3410
  ...t.httpRoutes === void 0 ? {} : { httpRoutes: t.httpRoutes }
3411
- }), re = Fo(t.security?.headers), ie = z({ scope: "voltro:security" }), O = (e, t) => {
3411
+ }), re = Fo(t.security?.headers), ie = B({ scope: "voltro:security" }), O = (e, t) => {
3412
3412
  let n = e.headers, r = Io(re, {
3413
3413
  contentType: n["content-type"],
3414
3414
  https: t
3415
3415
  }), i = {};
3416
3416
  for (let [e, t] of Object.entries(r)) n[e] === void 0 && (i[e] = t);
3417
- return Object.keys(i).length === 0 ? e : V.setHeaders(e, i);
3417
+ return Object.keys(i).length === 0 ? e : H.setHeaders(e, i);
3418
3418
  }, k = (e, t) => e.toUpperCase() === "GET" && (t.upgrade ?? "").toLowerCase().includes("websocket"), ae = (e) => o.gen(function* () {
3419
3419
  let t = yield* Zt.HttpServerRequest, n = {};
3420
3420
  for (let [e, r] of Object.entries(t.headers)) r !== void 0 && (n[e.toLowerCase()] = Array.isArray(r) ? r.join(", ") : r);
@@ -3433,21 +3433,21 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3433
3433
  }), u = (e) => O(e, l);
3434
3434
  if (t.method === "POST" && i === "/rpc") {
3435
3435
  let e = n["content-length"];
3436
- if (e !== void 0 && Number(e) > ee) return u(V.text("rpc payload too large", {
3436
+ if (e !== void 0 && Number(e) > ee) return u(H.text("rpc payload too large", {
3437
3437
  status: 413,
3438
3438
  headers: D
3439
3439
  }));
3440
3440
  }
3441
- if (T && (i === "/internal/liveness" || i === "/internal/readiness")) return i === "/internal/liveness" ? u(V.text("ok", {
3441
+ if (T && (i === "/internal/liveness" || i === "/internal/readiness")) return i === "/internal/liveness" ? u(H.text("ok", {
3442
3442
  status: 200,
3443
3443
  headers: D
3444
- })) : T.isReady() ? T.ping && !(yield* o.tryPromise(() => T.ping()).pipe(o.orElseSucceed(() => !1))) ? u(V.text("not-ready: dependency", {
3444
+ })) : T.isReady() ? T.ping && !(yield* o.tryPromise(() => T.ping()).pipe(o.orElseSucceed(() => !1))) ? u(H.text("not-ready: dependency", {
3445
3445
  status: 503,
3446
3446
  headers: D
3447
- })) : u(V.text("ready", {
3447
+ })) : u(H.text("ready", {
3448
3448
  status: 200,
3449
3449
  headers: D
3450
- })) : u(V.text("not-ready", {
3450
+ })) : u(H.text("not-ready", {
3451
3451
  status: 503,
3452
3452
  headers: D
3453
3453
  }));
@@ -3463,14 +3463,14 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3463
3463
  reason: e.reason,
3464
3464
  origin: e.origin,
3465
3465
  surface: f ? "websocket-upgrade" : d ? "rpc" : "http-route"
3466
- }), u(V.text("origin not allowed", {
3466
+ }), u(H.text("origin not allowed", {
3467
3467
  status: 403,
3468
3468
  headers: D
3469
3469
  }));
3470
3470
  }
3471
3471
  let p = d ? o.gen(function* () {
3472
3472
  let r = yield* no(t.source, ee);
3473
- return r._tag === "aborted" ? u(V.text("rpc request body incomplete", {
3473
+ return r._tag === "aborted" ? u(H.text("rpc request body incomplete", {
3474
3474
  status: 400,
3475
3475
  headers: D
3476
3476
  })) : r._tag === "too-large" ? (ie.warn("refused an over-cap rpc body", {
@@ -3478,14 +3478,14 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3478
3478
  cap: ee,
3479
3479
  receivedAtLeast: r.received,
3480
3480
  declaredLength: n["content-length"] ?? null
3481
- }), u(V.text("rpc payload too large", {
3481
+ }), u(H.text("rpc payload too large", {
3482
3482
  status: 413,
3483
3483
  headers: D
3484
3484
  }))) : yield* o.provideService(e, Zt.HttpServerRequest, ro(t, r.bytes));
3485
3485
  }) : e;
3486
3486
  if (!w) {
3487
3487
  let e = yield* p;
3488
- return V.isServerResponse(e) ? u(e) : e;
3488
+ return H.isServerResponse(e) ? u(e) : e;
3489
3489
  }
3490
3490
  let m = Oo({
3491
3491
  socketAddress: s,
@@ -3497,18 +3497,18 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3497
3497
  headers: n,
3498
3498
  remoteAddr: m
3499
3499
  })).pipe(o.orElseSucceed(() => null));
3500
- if (g !== null) return u(V.text(g.body ?? "", {
3500
+ if (g !== null) return u(H.text(g.body ?? "", {
3501
3501
  status: g.status,
3502
3502
  ...g.headers ? { headers: g.headers } : {}
3503
3503
  }));
3504
3504
  let _ = yield* p;
3505
- return V.isServerResponse(_) ? u(_) : _;
3506
- }), A = u.unwrapEffect(B.toHttpEffect(C).pipe(o.map((e) => Yt.serve(ae(e))))).pipe(u.provide(en.layer(() => s, r === void 0 ? { port: n } : {
3505
+ return H.isServerResponse(_) ? u(_) : _;
3506
+ }), A = u.unwrapEffect(V.toHttpEffect(C).pipe(o.map((e) => Yt.serve(ae(e))))).pipe(u.provide(en.layer(() => s, r === void 0 ? { port: n } : {
3507
3507
  port: n,
3508
3508
  host: r
3509
3509
  })), u.provide($t.layer));
3510
3510
  t.tracerLayer && (A = A.pipe(u.provide(t.tracerLayer)));
3511
- let oe = z({ scope: "voltro:rpc" }), j = u.launch(A).pipe(o.catchAllCause((t) => o.sync(() => {
3511
+ let oe = B({ scope: "voltro:rpc" }), j = u.launch(A).pipe(o.catchAllCause((t) => o.sync(() => {
3512
3512
  oe.error("rpc server crashed", {}, e.squash(t)), process.exit(1);
3513
3513
  }))), se = o.runFork(j);
3514
3514
  return ys.add(se), Os(), {
@@ -3795,7 +3795,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3795
3795
  let r = await rc(e, t, n);
3796
3796
  r && await e.delete(ec, r.id);
3797
3797
  }
3798
- }), K = "_voltro_kv", ac = (e) => {
3798
+ }), q = "_voltro_kv", ac = (e) => {
3799
3799
  if (e == null) return null;
3800
3800
  if (e instanceof Date) return e.getTime();
3801
3801
  if (typeof e == "number") return e;
@@ -3805,7 +3805,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3805
3805
  let n = ac(e.expiresAt);
3806
3806
  return n !== null && n <= t;
3807
3807
  }, sc = (e) => e === null ? null : JSON.parse(e), cc = async (e, t) => (await e.query({
3808
- table: K,
3808
+ table: q,
3809
3809
  predicate: O("key", t),
3810
3810
  order: [],
3811
3811
  take: 1,
@@ -3823,14 +3823,14 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3823
3823
  return {
3824
3824
  get: (n) => t("get", n, async () => {
3825
3825
  let t = await cc(e, n);
3826
- return t === null ? h.none() : oc(t, Date.now()) ? (await e.delete(K, t.id), h.none()) : h.some(sc(t.value));
3826
+ return t === null ? h.none() : oc(t, Date.now()) ? (await e.delete(q, t.id), h.none()) : h.some(sc(t.value));
3827
3827
  }),
3828
3828
  set: (n, r, i) => t("set", n, async () => {
3829
3829
  let t = Date.now(), a = i?.ttlMs !== void 0 && i.ttlMs > 0 ? new Date(t + i.ttlMs) : null, o = A({
3830
3830
  kind: "typeid",
3831
3831
  prefix: "kv"
3832
- }, K);
3833
- await e.upsert(K, {
3832
+ }, q);
3833
+ await e.upsert(q, {
3834
3834
  id: o,
3835
3835
  key: n,
3836
3836
  value: JSON.stringify(r),
@@ -3849,15 +3849,15 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3849
3849
  let t = await cc(e, n);
3850
3850
  if (t === null) return !1;
3851
3851
  let r = !oc(t, Date.now());
3852
- return await e.delete(K, t.id), r;
3852
+ return await e.delete(q, t.id), r;
3853
3853
  }),
3854
3854
  has: (n) => t("has", n, async () => {
3855
3855
  let t = await cc(e, n);
3856
- return t === null ? !1 : oc(t, Date.now()) ? (await e.delete(K, t.id), !1) : !0;
3856
+ return t === null ? !1 : oc(t, Date.now()) ? (await e.delete(q, t.id), !1) : !0;
3857
3857
  }),
3858
3858
  list: (n) => t("list", "", async () => {
3859
3859
  let t = Date.now(), r = xe(fe("expiresAt"), se("expiresAt", new Date(t))), i = n === "" ? r : C(te("key", n), r), a = await e.query({
3860
- table: K,
3860
+ table: q,
3861
3861
  predicate: i,
3862
3862
  order: [],
3863
3863
  take: void 0,
@@ -3868,7 +3868,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
3868
3868
  return o;
3869
3869
  }),
3870
3870
  clear: () => t("clear", "", async () => {
3871
- await e.deleteMany(K, { where: {
3871
+ await e.deleteMany(q, { where: {
3872
3872
  column: "id",
3873
3873
  op: "isNotNull"
3874
3874
  } });
@@ -4172,7 +4172,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
4172
4172
  delete: (t, n) => kc("delete", t, () => e.delete(t, n)),
4173
4173
  hardDelete: (t, n) => kc("hardDelete", t, () => e.hardDelete(t, n))
4174
4174
  }), jc = (e) => tn.make(e.name, {
4175
- payload: e.payloadSchema,
4175
+ payload: Rt(e.payloadSchema),
4176
4176
  success: bt,
4177
4177
  error: e.errorSchema
4178
4178
  }), Mc = (e, t) => ({
@@ -4722,7 +4722,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
4722
4722
  triggered: p
4723
4723
  };
4724
4724
  } };
4725
- }, ol = z({ scope: "voltro:events" }), sl = 64, cl = 5 * 6e4, ll = 1e4, ul = class {
4725
+ }, ol = B({ scope: "voltro:events" }), sl = 64, cl = 5 * 6e4, ll = 1e4, ul = class {
4726
4726
  routes = /* @__PURE__ */ new Map();
4727
4727
  origin;
4728
4728
  ringSize;
@@ -4772,7 +4772,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
4772
4772
  if (t !== void 0) return t.lastTouched = this.now(), t;
4773
4773
  this.evictIfOverCapacity();
4774
4774
  let n = {
4775
- latest: this.deliveryOf?.(Pt(e).event) === "latest",
4775
+ latest: this.deliveryOf?.(Nt(e).event) === "latest",
4776
4776
  listeners: /* @__PURE__ */ new Set(),
4777
4777
  watermark: /* @__PURE__ */ new Map(),
4778
4778
  localNext: 1,
@@ -4803,7 +4803,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
4803
4803
  i > 0 && e.ring.splice(0, i);
4804
4804
  }
4805
4805
  publish(e) {
4806
- let t = Et(e.tenantId, e.event, e.key), n = this.state(t), r = {
4806
+ let t = Tt(e.tenantId, e.event, e.key), n = this.state(t), r = {
4807
4807
  route: t,
4808
4808
  event: e.event,
4809
4809
  origin: this.origin,
@@ -4850,7 +4850,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
4850
4850
  }
4851
4851
  }
4852
4852
  subscribe(e) {
4853
- let t = Et(e.tenantId, e.event, e.key), n = this.state(t);
4853
+ let t = Tt(e.tenantId, e.event, e.key), n = this.state(t);
4854
4854
  e.onAttach?.(new Map(n.watermark));
4855
4855
  let r = !0, i = [], a = (t) => {
4856
4856
  if (r) {
@@ -4918,7 +4918,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
4918
4918
  snapshot() {
4919
4919
  return [...this.routes.entries()].map(([e, t]) => ({
4920
4920
  route: e,
4921
- event: t.ring[t.ring.length - 1]?.envelope.event ?? Pt(e).event,
4921
+ event: t.ring[t.ring.length - 1]?.envelope.event ?? Nt(e).event,
4922
4922
  subscribers: t.listeners.size,
4923
4923
  buffered: t.ring.length,
4924
4924
  lastEmittedAt: t.ring[t.ring.length - 1]?.envelope.emittedAt
@@ -4982,9 +4982,9 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
4982
4982
  return t.set(e.origin, Math.max(r, e.n)), r === 0 && n === 0 ? 0 : Math.max(0, e.n - r - 1);
4983
4983
  };
4984
4984
  }, yl = (e) => b.unwrapScoped(o.gen(function* () {
4985
- let t = yield* gt, n = yield* ot, r = t.tenantId ?? null, i = e.guards === void 0 ? void 0 : e.guards.filter((e) => !jt(e));
4985
+ let t = yield* gt, n = yield* ot, r = t.tenantId ?? null, i = e.guards === void 0 ? void 0 : e.guards.filter((e) => !At(e));
4986
4986
  if (i !== void 0 && i.length > 0) {
4987
- let n = yield* St(t, i, e.key);
4987
+ let n = yield* z(t, i, e.key);
4988
4988
  if (n) return yield* o.fail(n);
4989
4989
  }
4990
4990
  let a = e.bus.deliveryFor(e.event) === "latest", s = yield* g.sliding(e.queueSize ?? (a ? 1 : 64)), c = /* @__PURE__ */ new Map(), l = e.bus.subscribe({
@@ -5009,7 +5009,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5009
5009
  e();
5010
5010
  }));
5011
5011
  }
5012
- let u = a ? () => 0 : vl(c), d = i === void 0 || i.length === 0 ? void 0 : () => St(t, i, e.key), f = b.fromQueue(s, { shutdown: !0 }).pipe(b.flatMap((e) => d === void 0 ? p(e) : b.unwrap(d().pipe(o.map((t) => t ? b.fail(t) : p(e))))));
5012
+ let u = a ? () => 0 : vl(c), d = i === void 0 || i.length === 0 ? void 0 : () => z(t, i, e.key), f = b.fromQueue(s, { shutdown: !0 }).pipe(b.flatMap((e) => d === void 0 ? p(e) : b.unwrap(d().pipe(o.map((t) => t ? b.fail(t) : p(e))))));
5013
5013
  function p(t) {
5014
5014
  return b.suspend(() => {
5015
5015
  if (t.kind === "gap") return b.make(_l(t));
@@ -5028,7 +5028,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5028
5028
  }
5029
5029
  let m = { _tag: "attached" };
5030
5030
  return io(b.concat(b.fromIterable([m]), f), n.credentialExpiresAt, b.fromIterable([m]));
5031
- })), bl = z({ scope: "voltro:members" }), xl = 5e3, Sl = class {
5031
+ })), bl = B({ scope: "voltro:members" }), xl = 5e3, Sl = class {
5032
5032
  members = /* @__PURE__ */ new Map();
5033
5033
  listeners = /* @__PURE__ */ new Set();
5034
5034
  instanceId;
@@ -5126,10 +5126,10 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5126
5126
  });
5127
5127
  }
5128
5128
  }
5129
- }, Cl = z({ scope: "voltro:outbox" }), q = "_voltro_outbox", wl = {
5129
+ }, Cl = B({ scope: "voltro:outbox" }), J = "_voltro_outbox", wl = {
5130
5130
  kind: "typeid",
5131
5131
  prefix: "obx"
5132
- }, Tl = F(q, {
5132
+ }, Tl = F(J, {
5133
5133
  id: M({ prefix: "obx" }),
5134
5134
  effect: I(),
5135
5135
  payload: P(),
@@ -5180,7 +5180,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5180
5180
  let i = (e.now ?? (() => /* @__PURE__ */ new Date()))(), a = r?.idempotencyKey;
5181
5181
  if (a !== void 0) {
5182
5182
  let t = (await e.store.query({
5183
- table: q,
5183
+ table: J,
5184
5184
  predicate: C(O("idempotencyKey", a), O("status", "pending")),
5185
5185
  order: [],
5186
5186
  take: 1,
@@ -5190,7 +5190,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5190
5190
  if (t !== void 0) return t.id;
5191
5191
  }
5192
5192
  let o = {
5193
- id: A(wl, q),
5193
+ id: A(wl, J),
5194
5194
  effect: t,
5195
5195
  payload: n,
5196
5196
  status: "pending",
@@ -5207,7 +5207,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5207
5207
  resendRequestedBy: null,
5208
5208
  resendReason: null,
5209
5209
  resendCount: 0
5210
- }, s = await e.store.insert(q, o);
5210
+ }, s = await e.store.insert(J, o);
5211
5211
  if (e.afterCommit !== void 0 && e.nudge !== void 0) {
5212
5212
  let t = e.nudge;
5213
5213
  e.afterCommit(async () => {
@@ -5218,7 +5218,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5218
5218
  },
5219
5219
  resend: async (t, n) => {
5220
5220
  let r = (e.now ?? (() => /* @__PURE__ */ new Date()))(), i = (await e.store.query({
5221
- table: q,
5221
+ table: J,
5222
5222
  predicate: O("id", t),
5223
5223
  order: [],
5224
5224
  take: 1,
@@ -5228,7 +5228,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5228
5228
  if (i === void 0) throw Error(`outbox.resend: no entry "${t}"`);
5229
5229
  if (i.status === "delivering") throw Error(`outbox.resend("${t}"): an attempt is in flight — retry once it settles`);
5230
5230
  let a = i.attempts ?? 0, o = Math.max(1, Math.floor(n?.attempts ?? 1));
5231
- if (await e.store.update(q, t, {
5231
+ if (await e.store.update(J, t, {
5232
5232
  status: "pending",
5233
5233
  nextAttemptAt: r,
5234
5234
  maxAttempts: a + o,
@@ -5300,7 +5300,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5300
5300
  }
5301
5301
  }, Ll = async (e) => {
5302
5302
  let t = (e.now ?? (() => /* @__PURE__ */ new Date()))(), n = await e.store.query({
5303
- table: q,
5303
+ table: J,
5304
5304
  predicate: O("status", "pending"),
5305
5305
  order: [{
5306
5306
  column: "nextAttemptAt",
@@ -5341,7 +5341,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5341
5341
  finishedAt: /* @__PURE__ */ new Date(),
5342
5342
  error: null,
5343
5343
  response: t
5344
- }, p), await e.store.update(q, r, {
5344
+ }, p), await e.store.update(J, r, {
5345
5345
  status: "delivered",
5346
5346
  attempts: o,
5347
5347
  deliveredAt: /* @__PURE__ */ new Date(),
@@ -5359,7 +5359,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5359
5359
  finishedAt: /* @__PURE__ */ new Date(),
5360
5360
  error: s,
5361
5361
  response: null
5362
- }, p), await e.store.update(q, r, {
5362
+ }, p), await e.store.update(J, r, {
5363
5363
  status: u ? "dead" : "pending",
5364
5364
  attempts: o,
5365
5365
  lastError: s,
@@ -5388,10 +5388,10 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5388
5388
  scanned: a.length,
5389
5389
  ...o === void 0 ? {} : { nextAttemptAt: o }
5390
5390
  };
5391
- }, Rl = z({ scope: "voltro:connections" }), J = "_voltro_connections", zl = {
5391
+ }, Rl = B({ scope: "voltro:connections" }), Y = "_voltro_connections", zl = {
5392
5392
  kind: "typeid",
5393
5393
  prefix: "conn"
5394
- }, Bl = F(J, {
5394
+ }, Bl = F(Y, {
5395
5395
  id: M({ prefix: "conn" }),
5396
5396
  connectionId: I(),
5397
5397
  subjectId: I(),
@@ -5439,7 +5439,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5439
5439
  }
5440
5440
  return e;
5441
5441
  }, Kl = (e) => e.label ?? e.id, ql = (e) => {
5442
- if (e.length !== 0 && G() === void 0) throw Error(`connections: ${e.length} connection(s) declared (${e.map((e) => e.id).join(", ")}) but no field cipher is registered. Connection tokens are stored encrypted and there is no plaintext fallback. Enable \`@voltro/plugin-governance\` with \`governancePlugin({ fieldEncryption: { key: env.FIELD_ENCRYPTION_KEY } })\` (or call setFieldCipher at boot).`);
5442
+ if (e.length !== 0 && K() === void 0) throw Error(`connections: ${e.length} connection(s) declared (${e.map((e) => e.id).join(", ")}) but no field cipher is registered. Connection tokens are stored encrypted and there is no plaintext fallback. Enable \`@voltro/plugin-governance\` with \`governancePlugin({ fieldEncryption: { key: env.FIELD_ENCRYPTION_KEY } })\` (or call setFieldCipher at boot).`);
5443
5443
  }, Jl = (e) => {
5444
5444
  let t = /* @__PURE__ */ new Map();
5445
5445
  for (let n of e) {
@@ -5477,7 +5477,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5477
5477
  lastError: t.lastError ?? null,
5478
5478
  connectedAt: Xl(t.connectedAt)
5479
5479
  }, $l = async (e, t, n) => (await e.query({
5480
- table: J,
5480
+ table: Y,
5481
5481
  predicate: C(O("connectionId", t), O("subjectId", n)),
5482
5482
  order: [],
5483
5483
  take: 1,
@@ -5485,7 +5485,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5485
5485
  projection: void 0
5486
5486
  }))[0], eu = async (e) => {
5487
5487
  let t = (e.now ?? (() => /* @__PURE__ */ new Date()))(), n = e.tokens.expiresAt === void 0 ? null : new Date(e.tokens.expiresAt), r = {
5488
- id: A(zl, J),
5488
+ id: A(zl, Y),
5489
5489
  connectionId: e.definition.id,
5490
5490
  subjectId: e.subjectId,
5491
5491
  tenantId: e.tenantId,
@@ -5504,7 +5504,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5504
5504
  updatedAt: t
5505
5505
  };
5506
5506
  return tu(e.store, r);
5507
- }, tu = (e, t) => e.upsert(J, t, {
5507
+ }, tu = (e, t) => e.upsert(Y, t, {
5508
5508
  conflictColumns: ["connectionId", "subjectId"],
5509
5509
  update: [
5510
5510
  "kind",
@@ -5522,10 +5522,10 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5522
5522
  ]
5523
5523
  }), nu = async (e, t, n) => {
5524
5524
  let r = await $l(e, t, n);
5525
- return r !== void 0 && e.delete(J, r.id);
5525
+ return r !== void 0 && e.delete(Y, r.id);
5526
5526
  }, ru = async (e, t, n) => {
5527
5527
  let r = await e.query({
5528
- table: J,
5528
+ table: Y,
5529
5529
  predicate: O("subjectId", n),
5530
5530
  order: [],
5531
5531
  take: void 0,
@@ -5638,7 +5638,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5638
5638
  });
5639
5639
  }
5640
5640
  let c = e.row.refreshToken;
5641
- if (c == null) throw await t.update(J, s, {
5641
+ if (c == null) throw await t.update(Y, s, {
5642
5642
  status: "expired",
5643
5643
  lastError: "access token expired and no refresh token is on file — reconnect required",
5644
5644
  refreshLockedUntil: /* @__PURE__ */ new Date(0),
@@ -5657,7 +5657,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5657
5657
  reason: String(e),
5658
5658
  transient: !0
5659
5659
  });
5660
- throw await t.update(J, s, {
5660
+ throw await t.update(Y, s, {
5661
5661
  status: n.transient ? "error" : "revoked",
5662
5662
  lastError: n.reason,
5663
5663
  refreshLockedUntil: /* @__PURE__ */ new Date(0),
@@ -5683,7 +5683,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5683
5683
  refreshLockedUntil: /* @__PURE__ */ new Date(0),
5684
5684
  updatedAt: new Date(r())
5685
5685
  };
5686
- return hu(i, await t.update(J, s, u) ?? {
5686
+ return hu(i, await t.update(Y, s, u) ?? {
5687
5687
  ...e.row,
5688
5688
  ...u
5689
5689
  });
@@ -5961,10 +5961,10 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
5961
5961
  return e.filter((e) => !n.has(e.id)).map((e) => e.id);
5962
5962
  }, td = new Ut(), nd = (e) => {
5963
5963
  td.enterWith(e);
5964
- }, rd = () => td.getStore(), id = (e, t) => td.run(e, t), ad = z({ scope: "voltro:policy" }), od, sd = (e) => {
5964
+ }, rd = () => td.getStore(), id = (e, t) => td.run(e, t), ad = B({ scope: "voltro:policy" }), od, sd = (e) => {
5965
5965
  od = e;
5966
5966
  }, cd = () => od, ld = () => {
5967
- Lt((e) => o.gen(function* () {
5967
+ It((e) => o.gen(function* () {
5968
5968
  let t = Gu(e.resourceType);
5969
5969
  if (t === void 0) return ad.warn("policy guard denied — no resource policy registered for this type", {
5970
5970
  resourceType: e.resourceType,
@@ -6182,7 +6182,7 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
6182
6182
  insertSchema: (e) => t.get(e)?.insertSchema,
6183
6183
  validatePatchSchema: (e) => t.get(e)?.validatePatchSchema
6184
6184
  };
6185
- }, Ed = /* @__PURE__ */ new Map(), Dd = /* @__PURE__ */ new Map(), Od = /* @__PURE__ */ new Set(), kd = /* @__PURE__ */ new Set(), Ad = Td([]), jd = z({ scope: "store.fieldEncryption" }), Md = (e, t) => {
6185
+ }, Ed = /* @__PURE__ */ new Map(), Dd = /* @__PURE__ */ new Map(), Od = /* @__PURE__ */ new Set(), kd = /* @__PURE__ */ new Set(), Ad = Td([]), jd = B({ scope: "store.fieldEncryption" }), Md = (e, t) => {
6186
6186
  let n = t, r = process.env.VOLTRO_FIELD_DECRYPT_ON_ERROR === "null" ? "null" : "throw", i = /* @__PURE__ */ new Set(), a = (e) => {
6187
6187
  let t = `${e.table}.${e.column}`;
6188
6188
  i.has(t) || (i.add(t), jd.warn("encrypted column degraded to null — could not decrypt with the active key", {
@@ -6193,9 +6193,9 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
6193
6193
  }));
6194
6194
  }, o = (e, t) => {
6195
6195
  let r = j(e);
6196
- return ie(n ? Me(t, r, n) : t, r, G());
6196
+ return ie(n ? Me(t, r, n) : t, r, K());
6197
6197
  }, s = (e, t) => {
6198
- let i = j(e), o = ne(t, i, G(), {
6198
+ let i = j(e), o = ne(t, i, K(), {
6199
6199
  onError: r,
6200
6200
  ...r === "null" ? { warn: a } : {}
6201
6201
  });
@@ -6380,9 +6380,9 @@ var W = /* @__PURE__ */ new Map(), Gi = (e, t) => {
6380
6380
  }
6381
6381
  return n;
6382
6382
  }, Jd = (e, t) => {
6383
- let n = Ct(), r = [];
6384
- for (let i of e) for (let e of Rt(i.source)) {
6385
- if (Nt(e)) {
6383
+ let n = St(), r = [];
6384
+ for (let i of e) for (let e of Lt(i.source)) {
6385
+ if (Mt(e)) {
6386
6386
  if (n.has(e)) continue;
6387
6387
  r.push({
6388
6388
  procedure: i.name,
@@ -6640,14 +6640,14 @@ behind quietly.` + n;
6640
6640
  let a = bf(e), o = [], s = r.next(a, t);
6641
6641
  for (; s.getTime() <= n.getTime() && o.length <= i;) o.push(s), s = r.next(a, s);
6642
6642
  return o;
6643
- }, Y = "_voltro_wakeups", Cf = (e) => `${e.tenantId}:${e.kind}:${e.refId}`, wf = (e) => ({
6643
+ }, X = "_voltro_wakeups", Cf = (e) => `${e.tenantId}:${e.kind}:${e.refId}`, wf = (e) => ({
6644
6644
  tenantId: String(e.tenantId),
6645
6645
  kind: String(e.kind),
6646
6646
  refId: String(e.refId),
6647
6647
  wakeAt: e.wakeAt instanceof Date ? e.wakeAt : new Date(String(e.wakeAt)),
6648
6648
  status: e.status === "fired" ? "fired" : "pending"
6649
6649
  }), Tf = async (e, t) => {
6650
- await e.upsert(Y, {
6650
+ await e.upsert(X, {
6651
6651
  id: Cf(t),
6652
6652
  tenantId: t.tenantId,
6653
6653
  kind: t.kind,
@@ -6658,7 +6658,7 @@ behind quietly.` + n;
6658
6658
  conflictColumns: ["id"],
6659
6659
  update: ["wakeAt", "status"]
6660
6660
  });
6661
- }, Ef = async (e, t) => e.delete(Y, Cf(t)), Df = async (e, t) => await e.update(Y, Cf(t), { status: "fired" }) !== null, Of = (e, t) => ({ and: [{
6661
+ }, Ef = async (e, t) => e.delete(X, Cf(t)), Df = async (e, t) => await e.update(X, Cf(t), { status: "fired" }) !== null, Of = (e, t) => ({ and: [{
6662
6662
  column: "id",
6663
6663
  op: "eq",
6664
6664
  value: e
@@ -6666,15 +6666,15 @@ behind quietly.` + n;
6666
6666
  column: "status",
6667
6667
  op: "eq",
6668
6668
  value: t
6669
- }] }), kf = async (e, t) => await e.updateMany(Y, { status: "fired" }, { where: Of(Cf(t), "pending") }) > 0, Af = async (e, t) => {
6670
- await e.updateMany(Y, { status: "pending" }, { where: Of(Cf(t), "fired") });
6669
+ }] }), kf = async (e, t) => await e.updateMany(X, { status: "fired" }, { where: Of(Cf(t), "pending") }) > 0, Af = async (e, t) => {
6670
+ await e.updateMany(X, { status: "pending" }, { where: Of(Cf(t), "fired") });
6671
6671
  }, jf = {
6672
6672
  column: "status",
6673
6673
  op: "eq",
6674
6674
  value: "pending"
6675
6675
  }, Mf = async (e, t) => {
6676
6676
  let n = {
6677
- table: Y,
6677
+ table: X,
6678
6678
  predicate: jf,
6679
6679
  order: [{
6680
6680
  column: "wakeAt",
@@ -6694,7 +6694,7 @@ behind quietly.` + n;
6694
6694
  value: "fired"
6695
6695
  }, If = async (e, t = {}) => {
6696
6696
  let n = {
6697
- table: Y,
6697
+ table: X,
6698
6698
  predicate: Ff,
6699
6699
  order: [{
6700
6700
  column: "wakeAt",
@@ -6704,7 +6704,7 @@ behind quietly.` + n;
6704
6704
  skip: void 0,
6705
6705
  projection: void 0
6706
6706
  }, r = await e.query(n), i = t.firedOlderThan?.getTime(), a = 0;
6707
- for (let t of r) i !== void 0 && (t.wakeAt instanceof Date ? t.wakeAt : new Date(String(t.wakeAt))).getTime() >= i || await e.delete(Y, String(t.id)) && a++;
6707
+ for (let t of r) i !== void 0 && (t.wakeAt instanceof Date ? t.wakeAt : new Date(String(t.wakeAt))).getTime() >= i || await e.delete(X, String(t.id)) && a++;
6708
6708
  return a;
6709
6709
  }, Lf = Ec, Rf = "default", zf = {
6710
6710
  kind: "single",
@@ -6776,7 +6776,7 @@ behind quietly.` + n;
6776
6776
  } catch (t) {
6777
6777
  s.warn("schedule: failed to record run start", {
6778
6778
  name: e.name,
6779
- reason: X(t)
6779
+ reason: Z(t)
6780
6780
  });
6781
6781
  return;
6782
6782
  }
@@ -6787,7 +6787,7 @@ behind quietly.` + n;
6787
6787
  } catch (t) {
6788
6788
  s.warn("schedule: failed to record run finish", {
6789
6789
  runId: e,
6790
- reason: X(t)
6790
+ reason: Z(t)
6791
6791
  });
6792
6792
  }
6793
6793
  }, b = async (e) => {
@@ -6812,7 +6812,7 @@ behind quietly.` + n;
6812
6812
  } catch (t) {
6813
6813
  return s.warn("schedule: cluster-running check failed", {
6814
6814
  name: e,
6815
- reason: X(t)
6815
+ reason: Z(t)
6816
6816
  }), !1;
6817
6817
  }
6818
6818
  }, x = async (e, t, n, r) => {
@@ -6861,7 +6861,7 @@ behind quietly.` + n;
6861
6861
  completedAtSec: Date.now() / 1e3
6862
6862
  });
6863
6863
  } catch (t) {
6864
- let n = X(t).includes("exceeded maxRuntimeMs"), r = Yn(t).dbMessage, i = typeof r == "string" && r !== "" ? `${X(t)} — ${r}` : X(t);
6864
+ let n = Z(t).includes("exceeded maxRuntimeMs"), r = Yn(t).dbMessage, i = typeof r == "string" && r !== "" ? `${Z(t)} — ${r}` : Z(t);
6865
6865
  o && await y(o, {
6866
6866
  status: "failed",
6867
6867
  errorTag: n ? "timeout" : qf(t),
@@ -6871,7 +6871,7 @@ behind quietly.` + n;
6871
6871
  });
6872
6872
  let a = {
6873
6873
  name: e.name,
6874
- reason: X(t),
6874
+ reason: Z(t),
6875
6875
  timeout: n,
6876
6876
  ...Yn(t)
6877
6877
  };
@@ -6879,7 +6879,7 @@ behind quietly.` + n;
6879
6879
  name: e.name,
6880
6880
  status: "failed",
6881
6881
  durationMs: Date.now() - c
6882
- }), Ft({
6882
+ }), Pt({
6883
6883
  error: t,
6884
6884
  source: "schedule",
6885
6885
  name: e.name,
@@ -6938,7 +6938,7 @@ behind quietly.` + n;
6938
6938
  } catch (t) {
6939
6939
  s.warn("schedule: wakeup register failed", {
6940
6940
  name: e.name,
6941
- reason: X(t)
6941
+ reason: Z(t)
6942
6942
  });
6943
6943
  }
6944
6944
  }, T = 2147483647, E = (e) => {
@@ -6954,7 +6954,7 @@ behind quietly.` + n;
6954
6954
  let r = setTimeout(() => {
6955
6955
  S(e, i, e.trigger ?? t.defaultTrigger).catch((t) => s.warn("schedule: fire rejected", {
6956
6956
  name: e.name,
6957
- reason: X(t)
6957
+ reason: Z(t)
6958
6958
  })).finally(() => E(e));
6959
6959
  }, Math.max(0, n));
6960
6960
  f.set(e.name, r);
@@ -6979,7 +6979,7 @@ behind quietly.` + n;
6979
6979
  } catch (t) {
6980
6980
  s.warn("schedule: backfill lookup failed", {
6981
6981
  name: e.name,
6982
- reason: X(t)
6982
+ reason: Z(t)
6983
6983
  });
6984
6984
  return;
6985
6985
  }
@@ -7046,7 +7046,7 @@ behind quietly.` + n;
7046
7046
  f.clear(), s.info("scheduler: stopped");
7047
7047
  }
7048
7048
  };
7049
- }, X = (e) => e?.message ?? String(e), qf = (e) => e && typeof e == "object" && "_tag" in e ? String(e._tag) : null, Jf = (e) => {
7049
+ }, Z = (e) => e?.message ?? String(e), qf = (e) => e && typeof e == "object" && "_tag" in e ? String(e._tag) : null, Jf = (e) => {
7050
7050
  let t = {};
7051
7051
  for (let [n, r] of Object.entries(e)) t[n] = r instanceof Date ? r.toISOString() : r;
7052
7052
  return t;
@@ -7535,7 +7535,7 @@ behind quietly.` + n;
7535
7535
  timeColumn: "requestedAt",
7536
7536
  ttlMs: Ae(process.env.VOLTRO_APPROVALS_TTL_HOURS, 720)
7537
7537
  });
7538
- }, Lp = (e, t) => e.map((e) => Mt(e) ? {
7538
+ }, Lp = (e, t) => e.map((e) => jt(e) ? {
7539
7539
  kind: "policy",
7540
7540
  action: e.action,
7541
7541
  resourceType: e.resourceType,
@@ -7719,7 +7719,7 @@ behind quietly.` + n;
7719
7719
  approvalId: t.approvalId,
7720
7720
  subjectId: a
7721
7721
  });
7722
- let s = Rp(Wp(r.approverGuards)), c = await o.runPromise(St(t.approver, s, JSON.parse(String(r.payload ?? "null"))));
7722
+ let s = Rp(Wp(r.approverGuards)), c = await o.runPromise(z(t.approver, s, JSON.parse(String(r.payload ?? "null"))));
7723
7723
  if (c) throw new Ze({
7724
7724
  approvalId: t.approvalId,
7725
7725
  required: c.required ?? null,
@@ -7753,7 +7753,7 @@ behind quietly.` + n;
7753
7753
  for (let e of a) {
7754
7754
  if (i() > Up(e.expiresAt)) continue;
7755
7755
  let n = Wp(e.approverGuards), a = (e.requestedBy ?? null) === r, c = a ? "requested" : null;
7756
- a || await o.runPromise(St(t, Rp(n), JSON.parse(String(e.payload ?? "null")))) === null && String(e.status) === "pending" && (c = "to-decide"), c !== null && s.push({
7756
+ a || await o.runPromise(z(t, Rp(n), JSON.parse(String(e.payload ?? "null")))) === null && String(e.status) === "pending" && (c = "to-decide"), c !== null && s.push({
7757
7757
  id: String(e.id),
7758
7758
  procedure: String(e.procedure),
7759
7759
  kind: String(e.kind) === "action" ? "action" : "mutation",
@@ -8122,36 +8122,36 @@ behind quietly.` + n;
8122
8122
  "info",
8123
8123
  "warn",
8124
8124
  "critical"
8125
- ]), Z = (e, t) => /* @__PURE__ */ Error(`defineExpectation(${JSON.stringify(e)}): ${t}`), Hm = (e) => {
8125
+ ]), Q = (e, t) => /* @__PURE__ */ Error(`defineExpectation(${JSON.stringify(e)}): ${t}`), Hm = (e) => {
8126
8126
  let t = e.name;
8127
8127
  if (typeof t != "string" || t.length === 0) throw Error("defineExpectation: a non-empty `name` is required");
8128
- if (e.on === void 0 || typeof e.on.table != "string" || e.on.table.length === 0) throw Z(t, "on.table is required — the table whose writes drive the expectation");
8129
- if (e.on.where !== void 0 && typeof e.on.where != "function") throw Z(t, "on.where, when present, must be a predicate function");
8128
+ if (e.on === void 0 || typeof e.on.table != "string" || e.on.table.length === 0) throw Q(t, "on.table is required — the table whose writes drive the expectation");
8129
+ if (e.on.where !== void 0 && typeof e.on.where != "function") throw Q(t, "on.where, when present, must be a predicate function");
8130
8130
  let n = e.invariant;
8131
- if (n === void 0 || typeof n.kind != "string") throw Z(t, "invariant is required");
8131
+ if (n === void 0 || typeof n.kind != "string") throw Q(t, "invariant is required");
8132
8132
  switch (n.kind) {
8133
8133
  case "freshness":
8134
- if (typeof n.column != "string" || n.column.length === 0) throw Z(t, "freshness invariant requires a `column` (the timestamp column)");
8135
- if (!(typeof n.maxAgeMs == "number" && n.maxAgeMs > 0)) throw Z(t, "freshness invariant requires a positive `maxAgeMs`");
8134
+ if (typeof n.column != "string" || n.column.length === 0) throw Q(t, "freshness invariant requires a `column` (the timestamp column)");
8135
+ if (!(typeof n.maxAgeMs == "number" && n.maxAgeMs > 0)) throw Q(t, "freshness invariant requires a positive `maxAgeMs`");
8136
8136
  break;
8137
8137
  case "nullRate":
8138
- if (typeof n.column != "string" || n.column.length === 0) throw Z(t, "nullRate invariant requires a `column`");
8139
- if (!(typeof n.maxRate == "number" && n.maxRate >= 0 && n.maxRate <= 1)) throw Z(t, "nullRate invariant requires `maxRate` in [0, 1]");
8138
+ if (typeof n.column != "string" || n.column.length === 0) throw Q(t, "nullRate invariant requires a `column`");
8139
+ if (!(typeof n.maxRate == "number" && n.maxRate >= 0 && n.maxRate <= 1)) throw Q(t, "nullRate invariant requires `maxRate` in [0, 1]");
8140
8140
  break;
8141
8141
  case "rowCount":
8142
- if (n.min === void 0 && n.max === void 0) throw Z(t, "rowCount invariant requires at least one of `min` / `max`");
8143
- if (n.min !== void 0 && n.max !== void 0 && n.min > n.max) throw Z(t, "rowCount invariant: `min` must not exceed `max`");
8142
+ if (n.min === void 0 && n.max === void 0) throw Q(t, "rowCount invariant requires at least one of `min` / `max`");
8143
+ if (n.min !== void 0 && n.max !== void 0 && n.min > n.max) throw Q(t, "rowCount invariant: `min` must not exceed `max`");
8144
8144
  break;
8145
8145
  case "valueBounds":
8146
- if (typeof n.column != "string" || n.column.length === 0) throw Z(t, "valueBounds invariant requires a `column`");
8147
- if (n.min === void 0 && n.max === void 0) throw Z(t, "valueBounds invariant requires at least one of `min` / `max`");
8148
- if (n.min !== void 0 && n.max !== void 0 && n.min > n.max) throw Z(t, "valueBounds invariant: `min` must not exceed `max`");
8149
- if (n.maxViolationRate !== void 0 && !(typeof n.maxViolationRate == "number" && n.maxViolationRate >= 0 && n.maxViolationRate <= 1)) throw Z(t, "valueBounds invariant: `maxViolationRate`, when set, must be in [0, 1]");
8146
+ if (typeof n.column != "string" || n.column.length === 0) throw Q(t, "valueBounds invariant requires a `column`");
8147
+ if (n.min === void 0 && n.max === void 0) throw Q(t, "valueBounds invariant requires at least one of `min` / `max`");
8148
+ if (n.min !== void 0 && n.max !== void 0 && n.min > n.max) throw Q(t, "valueBounds invariant: `min` must not exceed `max`");
8149
+ if (n.maxViolationRate !== void 0 && !(typeof n.maxViolationRate == "number" && n.maxViolationRate >= 0 && n.maxViolationRate <= 1)) throw Q(t, "valueBounds invariant: `maxViolationRate`, when set, must be in [0, 1]");
8150
8150
  break;
8151
- default: throw Z(t, `unknown invariant kind ${JSON.stringify(n.kind)}`);
8151
+ default: throw Q(t, `unknown invariant kind ${JSON.stringify(n.kind)}`);
8152
8152
  }
8153
8153
  let r = e.severity ?? "warn";
8154
- if (!Vm.has(r)) throw Z(t, `severity must be one of info | warn | critical (got ${JSON.stringify(r)})`);
8154
+ if (!Vm.has(r)) throw Q(t, `severity must be one of info | warn | critical (got ${JSON.stringify(r)})`);
8155
8155
  return {
8156
8156
  _voltroExpectation: !0,
8157
8157
  name: t,
@@ -8699,7 +8699,7 @@ behind quietly.` + n;
8699
8699
  registered: i.map((e) => e.name),
8700
8700
  runTick: l
8701
8701
  };
8702
- }, _h = "holdout", Q = (e, t) => /* @__PURE__ */ Error(`defineExperiment(${JSON.stringify(e)}): ${t}`), vh = (e) => {
8702
+ }, _h = "holdout", $ = (e, t) => /* @__PURE__ */ Error(`defineExperiment(${JSON.stringify(e)}): ${t}`), vh = (e) => {
8703
8703
  if (e == null) return null;
8704
8704
  if (typeof e == "number") return Number.isFinite(e) ? String(e) : null;
8705
8705
  let t = String(e);
@@ -8707,35 +8707,35 @@ behind quietly.` + n;
8707
8707
  }, yh = (e) => {
8708
8708
  let t = e.name;
8709
8709
  if (typeof t != "string" || t.length === 0) throw Error("defineExperiment: a non-empty `name` is required");
8710
- if (e.on === void 0 || typeof e.on.table != "string" || e.on.table.length === 0) throw Q(t, "on.table is required — the table whose writes drive the experiment");
8711
- if (e.on.where !== void 0 && typeof e.on.where != "function") throw Q(t, "on.where, when present, must be a predicate function");
8710
+ if (e.on === void 0 || typeof e.on.table != "string" || e.on.table.length === 0) throw $(t, "on.table is required — the table whose writes drive the experiment");
8711
+ if (e.on.where !== void 0 && typeof e.on.where != "function") throw $(t, "on.where, when present, must be a predicate function");
8712
8712
  let n = e.subject !== void 0, r = e.variantFrom !== void 0;
8713
- if (n && r) throw Q(t, "declare `subject` OR `variantFrom`, not both — they are two answers to \"which arm is this row in?\"");
8713
+ if (n && r) throw $(t, "declare `subject` OR `variantFrom`, not both — they are two answers to \"which arm is this row in?\"");
8714
8714
  let i = null, a = null;
8715
8715
  if (r) if (typeof e.variantFrom == "string") {
8716
- if (e.variantFrom.length === 0) throw Q(t, "variantFrom, when a column name, must be non-empty");
8716
+ if (e.variantFrom.length === 0) throw $(t, "variantFrom, when a column name, must be non-empty");
8717
8717
  let n = e.variantFrom;
8718
8718
  a = (e) => vh(e[n]);
8719
8719
  } else if (typeof e.variantFrom == "function") {
8720
8720
  let t = e.variantFrom;
8721
8721
  a = (e) => vh(t(e));
8722
- } else throw Q(t, "variantFrom must be a column name or a (row) => variantName function");
8722
+ } else throw $(t, "variantFrom must be a column name or a (row) => variantName function");
8723
8723
  else if (typeof e.subject == "string") {
8724
- if (e.subject.length === 0) throw Q(t, "subject, when a column name, must be non-empty");
8724
+ if (e.subject.length === 0) throw $(t, "subject, when a column name, must be non-empty");
8725
8725
  let n = e.subject;
8726
8726
  i = (e) => vh(e[n]);
8727
8727
  } else if (typeof e.subject == "function") {
8728
8728
  let t = e.subject;
8729
8729
  i = (e) => vh(t(e));
8730
- } else throw Q(t, "subject is required — a column name or a (row) => key function (or use `variantFrom` to measure an arm something else assigned)");
8731
- if (!Array.isArray(e.variants) || e.variants.length < 2) throw Q(t, "at least two variants are required (a control + one treatment)");
8730
+ } else throw $(t, "subject is required — a column name or a (row) => key function (or use `variantFrom` to measure an arm something else assigned)");
8731
+ if (!Array.isArray(e.variants) || e.variants.length < 2) throw $(t, "at least two variants are required (a control + one treatment)");
8732
8732
  let o = /* @__PURE__ */ new Set(), s = [];
8733
8733
  for (let n of e.variants) {
8734
- if (typeof n != "object" || !n || typeof n.name != "string" || n.name.length === 0) throw Q(t, "each variant needs a non-empty `name`");
8735
- if (o.has(n.name)) throw Q(t, `duplicate variant name ${JSON.stringify(n.name)}`);
8734
+ if (typeof n != "object" || !n || typeof n.name != "string" || n.name.length === 0) throw $(t, "each variant needs a non-empty `name`");
8735
+ if (o.has(n.name)) throw $(t, `duplicate variant name ${JSON.stringify(n.name)}`);
8736
8736
  o.add(n.name);
8737
8737
  let e = n.weight ?? 1;
8738
- if (!(typeof e == "number" && Number.isFinite(e) && e > 0)) throw Q(t, `variant ${JSON.stringify(n.name)} weight must be a positive, finite number`);
8738
+ if (!(typeof e == "number" && Number.isFinite(e) && e > 0)) throw $(t, `variant ${JSON.stringify(n.name)} weight must be a positive, finite number`);
8739
8739
  s.push({
8740
8740
  name: n.name,
8741
8741
  weight: e
@@ -8743,25 +8743,25 @@ behind quietly.` + n;
8743
8743
  }
8744
8744
  let c = 0;
8745
8745
  if (e.holdout !== void 0) {
8746
- if (a !== null && e.holdout > 0) throw Q(t, `holdout is meaningless with \`variantFrom\` — a holdout is carved out AT ASSIGNMENT, and this experiment does not assign. Declare the holdout arm on whatever does (a flag variant named "${_h}", say) and list it in \`variants\`.`);
8747
- if (!(typeof e.holdout == "number" && e.holdout >= 0 && e.holdout < 1)) throw Q(t, "holdout, when present, must be a fraction in [0, 1)");
8748
- if (c = e.holdout, c > 0 && o.has("holdout")) throw Q(t, `a variant may not be named ${JSON.stringify(_h)} when holdout > 0 (reserved)`);
8746
+ if (a !== null && e.holdout > 0) throw $(t, `holdout is meaningless with \`variantFrom\` — a holdout is carved out AT ASSIGNMENT, and this experiment does not assign. Declare the holdout arm on whatever does (a flag variant named "${_h}", say) and list it in \`variants\`.`);
8747
+ if (!(typeof e.holdout == "number" && e.holdout >= 0 && e.holdout < 1)) throw $(t, "holdout, when present, must be a fraction in [0, 1)");
8748
+ if (c = e.holdout, c > 0 && o.has("holdout")) throw $(t, `a variant may not be named ${JSON.stringify(_h)} when holdout > 0 (reserved)`);
8749
8749
  }
8750
8750
  let l = e.metric;
8751
- if (l === void 0 || typeof l.kind != "string") throw Q(t, "metric is required");
8751
+ if (l === void 0 || typeof l.kind != "string") throw $(t, "metric is required");
8752
8752
  switch (l.kind) {
8753
8753
  case "count": break;
8754
8754
  case "sum":
8755
8755
  case "avg":
8756
- if (typeof l.column != "string" || l.column.length === 0) throw Q(t, `${l.kind} metric requires a numeric \`column\``);
8756
+ if (typeof l.column != "string" || l.column.length === 0) throw $(t, `${l.kind} metric requires a numeric \`column\``);
8757
8757
  break;
8758
8758
  case "conversionRate":
8759
- if (typeof l.column != "string" || l.column.length === 0) throw Q(t, "conversionRate metric requires a `column`");
8759
+ if (typeof l.column != "string" || l.column.length === 0) throw $(t, "conversionRate metric requires a `column`");
8760
8760
  break;
8761
- default: throw Q(t, `unknown metric kind ${JSON.stringify(l.kind)}`);
8761
+ default: throw $(t, `unknown metric kind ${JSON.stringify(l.kind)}`);
8762
8762
  }
8763
8763
  let u = e.baseline ?? s[0].name;
8764
- if (!o.has(u)) throw Q(t, `baseline ${JSON.stringify(u)} is not one of the declared variants`);
8764
+ if (!o.has(u)) throw $(t, `baseline ${JSON.stringify(u)} is not one of the declared variants`);
8765
8765
  return {
8766
8766
  _voltroExperiment: !0,
8767
8767
  name: t,
@@ -8789,7 +8789,7 @@ behind quietly.` + n;
8789
8789
  return e.variants[e.variants.length - 1].name;
8790
8790
  }, Ch = (e) => e.holdout > 0 ? [...e.variants.map((e) => e.name), _h] : e.variants.map((e) => e.name), wh = class extends n.Tag("@voltro/ExperimentRegistry")() {}, Th = (e) => o.gen(function* () {
8791
8791
  return (yield* wh).get(e.name);
8792
- }), $ = "__voltro_variant", Eh = "__voltro_metric", Dh = class {
8792
+ }), Eh = "__voltro_variant", Dh = "__voltro_metric", Oh = class {
8793
8793
  project;
8794
8794
  maintainer;
8795
8795
  constructor(e, t) {
@@ -8817,56 +8817,56 @@ behind quietly.` + n;
8817
8817
  byVariant() {
8818
8818
  let e = /* @__PURE__ */ new Map();
8819
8819
  for (let t of this.maintainer.materialize()) {
8820
- let n = t.group[$];
8820
+ let n = t.group[Eh];
8821
8821
  typeof n == "string" && e.set(n, t.value);
8822
8822
  }
8823
8823
  return e;
8824
8824
  }
8825
- }, Oh = (e) => typeof e == "number" && Number.isFinite(e), kh = (e) => {
8826
- if (Oh(e)) return e;
8825
+ }, kh = (e) => typeof e == "number" && Number.isFinite(e), Ah = (e) => {
8826
+ if (kh(e)) return e;
8827
8827
  let t = Number(e);
8828
8828
  return Number.isFinite(t) ? t : null;
8829
- }, Ah = (e, t) => new Dh(e.kind === "count" ? {
8829
+ }, jh = (e, t) => new Oh(e.kind === "count" ? {
8830
8830
  op: "count",
8831
- groupBy: [$]
8831
+ groupBy: [Eh]
8832
8832
  } : {
8833
8833
  op: e.kind === "sum" ? "sum" : "avg",
8834
- column: Eh,
8835
- groupBy: [$]
8834
+ column: Dh,
8835
+ groupBy: [Eh]
8836
8836
  }, (n) => {
8837
8837
  let r = t(n);
8838
8838
  if (r === null) return null;
8839
8839
  switch (e.kind) {
8840
- case "count": return { [$]: r };
8840
+ case "count": return { [Eh]: r };
8841
8841
  case "sum":
8842
8842
  case "avg": {
8843
- let t = kh(n[e.column]);
8843
+ let t = Ah(n[e.column]);
8844
8844
  return t === null ? null : {
8845
- [$]: r,
8846
- [Eh]: t
8845
+ [Eh]: r,
8846
+ [Dh]: t
8847
8847
  };
8848
8848
  }
8849
8849
  case "conversionRate": {
8850
8850
  let t = n[e.column], i = e.equals === void 0 ? !!t : t === e.equals;
8851
8851
  return {
8852
- [$]: r,
8853
- [Eh]: +!!i
8852
+ [Eh]: r,
8853
+ [Dh]: +!!i
8854
8854
  };
8855
8855
  }
8856
8856
  }
8857
- }), jh = (e) => new Dh({
8857
+ }), Mh = (e) => new Oh({
8858
8858
  op: "count",
8859
- groupBy: [$]
8859
+ groupBy: [Eh]
8860
8860
  }, (t) => {
8861
8861
  let n = e(t);
8862
- return n === null ? null : { [$]: n };
8863
- }), Mh = (e) => ({
8862
+ return n === null ? null : { [Eh]: n };
8863
+ }), Nh = (e) => ({
8864
8864
  table: e.table,
8865
8865
  op: e.op,
8866
8866
  traceId: e.traceId ?? null,
8867
8867
  subjectId: e.subjectId ?? null,
8868
8868
  procedure: e.procedure ?? null
8869
- }), Nh = class {
8869
+ }), Ph = class {
8870
8870
  def;
8871
8871
  deps;
8872
8872
  exposure;
@@ -8879,7 +8879,7 @@ behind quietly.` + n;
8879
8879
  constructor(e, t) {
8880
8880
  this.def = e, this.deps = t, this.now = t.now ?? Date.now, this.declaredVariants = new Set(Ch(e));
8881
8881
  let n = (e) => this.variantOf(e);
8882
- this.exposure = jh(n), this.metricIsCount = e.metric.kind === "count", this.metric = this.metricIsCount ? this.exposure : Ah(e.metric, n);
8882
+ this.exposure = Mh(n), this.metricIsCount = e.metric.kind === "count", this.metric = this.metricIsCount ? this.exposure : jh(e.metric, n);
8883
8883
  }
8884
8884
  variantOf(e) {
8885
8885
  if (e == null) return null;
@@ -8911,7 +8911,7 @@ behind quietly.` + n;
8911
8911
  };
8912
8912
  return this.exposure.apply(r), this.metricIsCount || this.metric.apply(r), this.lastUpdatedAt = new Date(this.now()), {
8913
8913
  result: this.result(),
8914
- cause: Mh(e)
8914
+ cause: Nh(e)
8915
8915
  };
8916
8916
  }
8917
8917
  result() {
@@ -8953,7 +8953,7 @@ behind quietly.` + n;
8953
8953
  get isSeeded() {
8954
8954
  return this.seeded;
8955
8955
  }
8956
- }, Ph = (e) => {
8956
+ }, Fh = (e) => {
8957
8957
  let t = e.now ?? Date.now, n = e.log, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = (e) => {
8958
8958
  for (let t of r) try {
8959
8959
  t(e);
@@ -8970,7 +8970,7 @@ behind quietly.` + n;
8970
8970
  }), s = /* @__PURE__ */ new Map();
8971
8971
  for (let { definition: r } of e.discovered) {
8972
8972
  if (i.has(r.name)) throw Error(`experiment: duplicate name '${r.name}' — names must be unique across all experiments`);
8973
- let e = new Nh(r, {
8973
+ let e = new Ph(r, {
8974
8974
  queryBase: o(r.on.table),
8975
8975
  now: t,
8976
8976
  ...n === void 0 ? {} : { log: n }
@@ -9012,14 +9012,14 @@ behind quietly.` + n;
9012
9012
  },
9013
9013
  registered: [...i.keys()]
9014
9014
  };
9015
- }, Fh = F("_voltro_wakeups", {
9015
+ }, Ih = F("_voltro_wakeups", {
9016
9016
  id: M({ prefix: "wakeup" }),
9017
9017
  tenantId: I(),
9018
9018
  kind: I(),
9019
9019
  refId: I(),
9020
9020
  wakeAt: L(),
9021
9021
  status: I()
9022
- }).index(["status", "wakeAt"]).index(["tenantId"]), Ih = async (e) => {
9022
+ }).index(["status", "wakeAt"]).index(["tenantId"]), Lh = async (e) => {
9023
9023
  let t = e.now?.() ?? /* @__PURE__ */ new Date(), n = await Nf(e.store, t, e.batchLimit ?? 100);
9024
9024
  if (n.length === 0) return 0;
9025
9025
  let r = 0;
@@ -9034,11 +9034,11 @@ behind quietly.` + n;
9034
9034
  });
9035
9035
  }
9036
9036
  return r > 0 && e.log?.info("wake: woke due deployments", { count: r }), r;
9037
- }, Lh = (e, t = 1e3) => {
9037
+ }, Rh = (e, t = 1e3) => {
9038
9038
  let n = !1, r, i = async () => {
9039
9039
  if (!n) {
9040
9040
  try {
9041
- await Ih(e);
9041
+ await Lh(e);
9042
9042
  } catch (t) {
9043
9043
  e.log?.warn("wake: tick failed", { reason: t instanceof Error ? t.message : String(t) });
9044
9044
  }
@@ -9048,10 +9048,10 @@ behind quietly.` + n;
9048
9048
  return i(), { stop: () => {
9049
9049
  n = !0, r !== void 0 && clearTimeout(r);
9050
9050
  } };
9051
- }, Rh = (e) => ({ wake: async () => {
9051
+ }, zh = (e) => ({ wake: async () => {
9052
9052
  await e.start();
9053
- } }), zh = (e) => new Promise((t) => setTimeout(t, e)), Bh = (e) => {
9054
- let t = e.fetchImpl ?? fetch, n = e.now ?? Date.now, r = e.sleep ?? zh, i = e.spawnImpl ?? Tn, a = e.startTimeoutMs ?? 3e4, o = e.healthPollMs ?? 200, s = e.stopSignal ?? "SIGTERM", c = e.stopGraceMs ?? 1e4, l, u, d = e.healthCheck ?? ((e) => e.ok), f = async () => {
9053
+ } }), Bh = (e) => new Promise((t) => setTimeout(t, e)), Vh = (e) => {
9054
+ let t = e.fetchImpl ?? fetch, n = e.now ?? Date.now, r = e.sleep ?? Bh, i = e.spawnImpl ?? Tn, a = e.startTimeoutMs ?? 3e4, o = e.healthPollMs ?? 200, s = e.stopSignal ?? "SIGTERM", c = e.stopGraceMs ?? 1e4, l, u, d = e.healthCheck ?? ((e) => e.ok), f = async () => {
9055
9055
  try {
9056
9056
  let n = await t(e.healthUrl);
9057
9057
  return d(n);
@@ -9105,11 +9105,11 @@ behind quietly.` + n;
9105
9105
  },
9106
9106
  stop: m
9107
9107
  };
9108
- }, Vh = async (e) => {
9108
+ }, Hh = async (e) => {
9109
9109
  if (e.signals.connectedClients() > 0 || e.signals.inFlightRequests() > 0 || e.signals.activeWorkflowExecutions() > 0) return !1;
9110
9110
  let t = (e.now?.() ?? /* @__PURE__ */ new Date()).getTime() + (e.wakeLookaheadMs ?? 3e4), n = await Pf(e.store);
9111
9111
  return !(n !== null && n.wakeAt.getTime() <= t);
9112
- }, Hh = (e, t = Date.now) => {
9112
+ }, Uh = (e, t = Date.now) => {
9113
9113
  let n;
9114
9114
  return {
9115
9115
  update: (r) => {
@@ -9121,7 +9121,7 @@ behind quietly.` + n;
9121
9121
  n = void 0;
9122
9122
  }
9123
9123
  };
9124
- }, Uh = () => {
9124
+ }, Wh = () => {
9125
9125
  let e = 0, t = 0;
9126
9126
  return {
9127
9127
  onRequestStart: () => {
@@ -9139,7 +9139,7 @@ behind quietly.` + n;
9139
9139
  inFlightRequests: () => e,
9140
9140
  openConnections: () => t
9141
9141
  };
9142
- }, Wh = (e) => ({ run: async (t) => (e.onActivity?.(), await e.ensureAwake(), t()) }), Gh = (e, t, n, r) => new Promise((i, a) => {
9142
+ }, Gh = (e) => ({ run: async (t) => (e.onActivity?.(), await e.ensureAwake(), t()) }), Kh = (e, t, n, r) => new Promise((i, a) => {
9143
9143
  let o = Wt.request({
9144
9144
  host: n,
9145
9145
  port: r,
@@ -9150,7 +9150,7 @@ behind quietly.` + n;
9150
9150
  t.writeHead(e.statusCode ?? 502, e.headers), e.pipe(t), e.on("end", i), e.on("error", a);
9151
9151
  });
9152
9152
  o.on("error", a), e.pipe(o);
9153
- }), Kh = (e, t, n, r, i) => new Promise((a, o) => {
9153
+ }), qh = (e, t, n, r, i) => new Promise((a, o) => {
9154
9154
  let s = Wt.request({
9155
9155
  host: r,
9156
9156
  port: i,
@@ -9165,21 +9165,21 @@ behind quietly.` + n;
9165
9165
  };
9166
9166
  t.on("close", s), r.on("close", s), r.on("error", o);
9167
9167
  }), s.on("error", o), s.end();
9168
- }), qh = (e) => {
9169
- let t = Wh({
9168
+ }), Jh = (e) => {
9169
+ let t = Gh({
9170
9170
  ensureAwake: () => e.supervisor.start(),
9171
9171
  ...e.onActivity === void 0 ? {} : { onActivity: e.onActivity }
9172
9172
  }), n = e.activity, r = Wt.createServer((r, i) => {
9173
- n?.onRequestStart(), i.on("close", () => n?.onRequestEnd()), t.run(() => Gh(r, i, e.targetHost, e.targetPort)).catch((t) => {
9173
+ n?.onRequestStart(), i.on("close", () => n?.onRequestEnd()), t.run(() => Kh(r, i, e.targetHost, e.targetPort)).catch((t) => {
9174
9174
  e.log?.warn("wake-router: proxy failed", { reason: t instanceof Error ? t.message : String(t) }), i.headersSent || i.writeHead(502), i.end("wake/proxy failed");
9175
9175
  });
9176
9176
  });
9177
9177
  return r.on("upgrade", (r, i, a) => {
9178
- n?.onConnect(), i.on("close", () => n?.onDisconnect()), t.run(() => Kh(r, i, a, e.targetHost, e.targetPort)).catch((t) => {
9178
+ n?.onConnect(), i.on("close", () => n?.onDisconnect()), t.run(() => qh(r, i, a, e.targetHost, e.targetPort)).catch((t) => {
9179
9179
  e.log?.warn("wake-router: upgrade proxy failed", { reason: t instanceof Error ? t.message : String(t) }), i.destroy();
9180
9180
  });
9181
9181
  }), r;
9182
- }, Jh = async (e) => {
9182
+ }, Yh = async (e) => {
9183
9183
  try {
9184
9184
  return (await e.query({
9185
9185
  table: "_voltro_workflow_runs",
@@ -9196,15 +9196,15 @@ behind quietly.` + n;
9196
9196
  } catch {
9197
9197
  return 0;
9198
9198
  }
9199
- }, Yh = async (e) => {
9200
- let t = Rh(e.supervisor), n = await Ih({
9199
+ }, Xh = async (e) => {
9200
+ let t = zh(e.supervisor), n = await Lh({
9201
9201
  store: e.store,
9202
9202
  adapter: t,
9203
9203
  ...e.now === void 0 ? {} : { now: e.now },
9204
9204
  ...e.log === void 0 ? {} : { log: e.log }
9205
9205
  });
9206
9206
  n > 0 && e.idleGate.reset();
9207
- let r = await Vh({
9207
+ let r = await Hh({
9208
9208
  store: e.store,
9209
9209
  signals: e.signals,
9210
9210
  ...e.wakeLookaheadMs === void 0 ? {} : { wakeLookaheadMs: e.wakeLookaheadMs },
@@ -9214,12 +9214,12 @@ behind quietly.` + n;
9214
9214
  woke: n,
9215
9215
  stopped: i
9216
9216
  };
9217
- }, Xh = async (e) => {
9218
- let t = Hh(e.idleGraceMs ?? 6e4), n = e.tickMs ?? 1e3, r = Uh(), i = 0, a = e.signals === void 0, o = e.signals ?? {
9217
+ }, Zh = async (e) => {
9218
+ let t = Uh(e.idleGraceMs ?? 6e4), n = e.tickMs ?? 1e3, r = Wh(), i = 0, a = e.signals === void 0, o = e.signals ?? {
9219
9219
  connectedClients: () => r.openConnections(),
9220
9220
  inFlightRequests: () => r.inFlightRequests(),
9221
9221
  activeWorkflowExecutions: () => i
9222
- }, s = qh({
9222
+ }, s = Jh({
9223
9223
  supervisor: e.supervisor,
9224
9224
  targetHost: e.targetHost,
9225
9225
  targetPort: e.targetPort,
@@ -9238,7 +9238,7 @@ behind quietly.` + n;
9238
9238
  let l = !1, u, d = e.firedRetentionMs ?? 10 * 6e4, f = 0, p = async () => {
9239
9239
  if (!l) {
9240
9240
  try {
9241
- if (a && (i = await Jh(e.store)), await Yh({
9241
+ if (a && (i = await Yh(e.store)), await Xh({
9242
9242
  store: e.store,
9243
9243
  supervisor: e.supervisor,
9244
9244
  signals: o,
@@ -9261,14 +9261,14 @@ behind quietly.` + n;
9261
9261
  l = !0, u !== void 0 && clearTimeout(u), await new Promise((e) => s.close(() => e()));
9262
9262
  }
9263
9263
  };
9264
- }, Zh = (e) => e, Qh = class extends y.TaggedError()("AnalyticsError", {
9264
+ }, Qh = (e) => e, $h = class extends y.TaggedError()("AnalyticsError", {
9265
9265
  provider: y.String,
9266
9266
  operation: y.String,
9267
9267
  cause: y.String
9268
- }) {}, $h = class extends y.TaggedError()("AnalyticsCapabilityNotSupported", {
9268
+ }) {}, eg = class extends y.TaggedError()("AnalyticsCapabilityNotSupported", {
9269
9269
  provider: y.String,
9270
9270
  capability: y.String
9271
- }) {}, eg = class extends n.Tag("@voltro/AnalyticsSink")() {}, tg = (e, t) => ({
9271
+ }) {}, tg = class extends n.Tag("@voltro/AnalyticsSink")() {}, ng = (e, t) => ({
9272
9272
  info: e.info,
9273
9273
  track: (n) => e.track(n.tenantId === void 0 ? {
9274
9274
  ...n,
@@ -9287,20 +9287,20 @@ behind quietly.` + n;
9287
9287
  tenantId: t
9288
9288
  } : n),
9289
9289
  ...e.mirror === void 0 ? {} : { mirror: e.mirror }
9290
- }), ng = () => o.gen(function* () {
9291
- let e = yield* eg, t = yield* o.serviceOption(gt), n = h.match(t, {
9290
+ }), rg = () => o.gen(function* () {
9291
+ let e = yield* tg, t = yield* o.serviceOption(gt), n = h.match(t, {
9292
9292
  onNone: () => null,
9293
9293
  onSome: (e) => e.tenantId ?? null
9294
9294
  });
9295
- return n === null ? e : tg(e, n);
9296
- }), rg = "noop", ig = () => {
9297
- let e = (e) => o.fail(new $h({
9298
- provider: rg,
9295
+ return n === null ? e : ng(e, n);
9296
+ }), ig = "noop", ag = () => {
9297
+ let e = (e) => o.fail(new eg({
9298
+ provider: ig,
9299
9299
  capability: e
9300
9300
  }));
9301
9301
  return {
9302
9302
  info: {
9303
- provider: rg,
9303
+ provider: ig,
9304
9304
  capabilities: {
9305
9305
  track: !0,
9306
9306
  aggregate: !1,
@@ -9314,8 +9314,8 @@ behind quietly.` + n;
9314
9314
  timeseries: () => e("timeseries"),
9315
9315
  topN: () => e("topN")
9316
9316
  };
9317
- }, ag = (e) => {
9318
- if (e.length === 0) return ig();
9317
+ }, og = (e) => {
9318
+ if (e.length === 0) return ag();
9319
9319
  if (e.length === 1) return e[0];
9320
9320
  let t = {
9321
9321
  provider: "compose",
@@ -9332,7 +9332,7 @@ behind quietly.` + n;
9332
9332
  discard: !0
9333
9333
  }), r = (t, n) => {
9334
9334
  let r = e.find((e) => e.info.capabilities[t]);
9335
- return r === void 0 ? o.fail(new $h({
9335
+ return r === void 0 ? o.fail(new eg({
9336
9336
  provider: "compose",
9337
9337
  capability: t
9338
9338
  })) : n(r);
@@ -9359,11 +9359,11 @@ behind quietly.` + n;
9359
9359
  topN: (e) => r("topN", (t) => t.topN(e)),
9360
9360
  ...a === void 0 ? {} : { mirror: a }
9361
9361
  };
9362
- }, og = (e) => {
9362
+ }, sg = (e) => {
9363
9363
  let t = e.filter((e) => e.dispose !== void 0);
9364
9364
  return {
9365
9365
  kind: "compose",
9366
- build: (t) => ag(e.map((e) => e.build(t))),
9366
+ build: (t) => og(e.map((e) => e.build(t))),
9367
9367
  tables: e.flatMap((e) => e.tables ?? []),
9368
9368
  initialize: (t) => o.forEach(e, (e) => e.initialize ? e.initialize(t) : o.void, {
9369
9369
  concurrency: 1,
@@ -9374,34 +9374,34 @@ behind quietly.` + n;
9374
9374
  discard: !0
9375
9375
  }) } : {}
9376
9376
  };
9377
- }, sg = {
9377
+ }, cg = {
9378
9378
  kind: "noop",
9379
- build: () => ig()
9380
- }, cg = f.counter("voltro_analytics_mirror_forwarded_total", { description: "Reactive-table changes successfully applied to the analytics mirror." }), lg = f.counter("voltro_analytics_mirror_retries_total", { description: "Analytics-mirror write attempts that failed (each is retried until the budget runs out)." }), ug = f.counter("voltro_analytics_mirror_repair_queued_total", { description: "Analytics-mirror changes whose retries were exhausted and were queued for repair." }), dg = f.counter("voltro_analytics_mirror_dropped_total", { description: "Analytics-mirror changes provably lost (repair queue overflow)." }), fg = (e) => {
9379
+ build: () => ag()
9380
+ }, lg = f.counter("voltro_analytics_mirror_forwarded_total", { description: "Reactive-table changes successfully applied to the analytics mirror." }), ug = f.counter("voltro_analytics_mirror_retries_total", { description: "Analytics-mirror write attempts that failed (each is retried until the budget runs out)." }), dg = f.counter("voltro_analytics_mirror_repair_queued_total", { description: "Analytics-mirror changes whose retries were exhausted and were queued for repair." }), fg = f.counter("voltro_analytics_mirror_dropped_total", { description: "Analytics-mirror changes provably lost (repair queue overflow)." }), pg = (e) => {
9381
9381
  o.runSync(f.increment(e));
9382
- }, pg = (t) => e.pretty(t), mg = {
9382
+ }, mg = (t) => e.pretty(t), hg = {
9383
9383
  retryAttempts: 5,
9384
9384
  retryBaseDelayMs: 100,
9385
9385
  retryMaxDelayMs: 3e4,
9386
9386
  repairIntervalMs: 6e4,
9387
9387
  repairQueueLimit: 1e4,
9388
9388
  versionStateLimit: 1e5
9389
- }, hg = (e) => {
9389
+ }, gg = (e) => {
9390
9390
  let t = process.env[e];
9391
9391
  if (t === void 0 || t.trim() === "") return;
9392
9392
  let n = Number(t);
9393
9393
  return Number.isFinite(n) && n >= 0 ? n : void 0;
9394
- }, gg = (e) => {
9395
- let t = mg, n = e ?? {};
9394
+ }, _g = (e) => {
9395
+ let t = hg, n = e ?? {};
9396
9396
  return {
9397
- retryAttempts: Math.max(1, n.retryAttempts ?? hg("VOLTRO_ANALYTICS_MIRROR_RETRY_ATTEMPTS") ?? t.retryAttempts),
9398
- retryBaseDelayMs: n.retryBaseDelayMs ?? hg("VOLTRO_ANALYTICS_MIRROR_RETRY_BASE_MS") ?? t.retryBaseDelayMs,
9399
- retryMaxDelayMs: n.retryMaxDelayMs ?? hg("VOLTRO_ANALYTICS_MIRROR_RETRY_MAX_MS") ?? t.retryMaxDelayMs,
9400
- repairIntervalMs: n.repairIntervalMs ?? hg("VOLTRO_ANALYTICS_MIRROR_REPAIR_INTERVAL_MS") ?? t.repairIntervalMs,
9401
- repairQueueLimit: Math.max(1, n.repairQueueLimit ?? hg("VOLTRO_ANALYTICS_MIRROR_REPAIR_QUEUE_LIMIT") ?? t.repairQueueLimit),
9402
- versionStateLimit: Math.max(1, n.versionStateLimit ?? hg("VOLTRO_ANALYTICS_MIRROR_VERSION_STATE_LIMIT") ?? t.versionStateLimit)
9403
- };
9404
- }, _g = {
9397
+ retryAttempts: Math.max(1, n.retryAttempts ?? gg("VOLTRO_ANALYTICS_MIRROR_RETRY_ATTEMPTS") ?? t.retryAttempts),
9398
+ retryBaseDelayMs: n.retryBaseDelayMs ?? gg("VOLTRO_ANALYTICS_MIRROR_RETRY_BASE_MS") ?? t.retryBaseDelayMs,
9399
+ retryMaxDelayMs: n.retryMaxDelayMs ?? gg("VOLTRO_ANALYTICS_MIRROR_RETRY_MAX_MS") ?? t.retryMaxDelayMs,
9400
+ repairIntervalMs: n.repairIntervalMs ?? gg("VOLTRO_ANALYTICS_MIRROR_REPAIR_INTERVAL_MS") ?? t.repairIntervalMs,
9401
+ repairQueueLimit: Math.max(1, n.repairQueueLimit ?? gg("VOLTRO_ANALYTICS_MIRROR_REPAIR_QUEUE_LIMIT") ?? t.repairQueueLimit),
9402
+ versionStateLimit: Math.max(1, n.versionStateLimit ?? gg("VOLTRO_ANALYTICS_MIRROR_VERSION_STATE_LIMIT") ?? t.versionStateLimit)
9403
+ };
9404
+ }, vg = {
9405
9405
  tables: [],
9406
9406
  detach: () => {},
9407
9407
  flush: () => Promise.resolve(),
@@ -9412,10 +9412,10 @@ behind quietly.` + n;
9412
9412
  awaitingRepair: 0,
9413
9413
  dropped: 0
9414
9414
  })
9415
- }, vg = (e, t) => `${e}\u0000${String(t)}`, yg = (e) => {
9415
+ }, yg = (e, t) => `${e}\u0000${String(t)}`, bg = (e) => {
9416
9416
  let { store: t, sink: n, log: r } = e, i = n.mirror;
9417
- if (i === void 0 || i.tables.length === 0) return _g;
9418
- let s = gg(e), c = e.run ?? ((e) => o.runPromise(e)), l = i.primaryKey ?? "id", u = new Set(i.tables), d = n.info.provider, f = t.changeScope === "fleet", p = 0, m = () => {
9417
+ if (i === void 0 || i.tables.length === 0) return vg;
9418
+ let s = _g(e), c = e.run ?? ((e) => o.runPromise(e)), l = i.primaryKey ?? "id", u = new Set(i.tables), d = n.info.provider, f = t.changeScope === "fleet", p = 0, m = () => {
9419
9419
  let e = Date.now() * 1e3;
9420
9420
  return p = e > p ? e : p + 1, p;
9421
9421
  }, h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), b = 0, x = 0, S = /* @__PURE__ */ new Map(), C = (e) => {
@@ -9435,7 +9435,7 @@ behind quietly.` + n;
9435
9435
  primaryKeyValue: t.pk
9436
9436
  }).pipe(o.map((e) => (n.baseline = e ?? 0, n.baseline))) : o.succeed(n.baseline);
9437
9437
  }), T = (e, t, n) => n.kind === "clock" ? o.succeed(n.version) : w(e, t).pipe(o.map((e) => e + n.ordinal)), E = v.exponential(a.millis(Math.max(1, s.retryBaseDelayMs)), 2).pipe(v.either(v.spaced(a.millis(Math.max(1, s.retryMaxDelayMs)))), v.intersect(v.recurs(s.retryAttempts - 1))), ee = (e, t) => o.gen(function* () {
9438
- let n = yield* T(vg(e.table, e.pk), e, t.stamp);
9438
+ let n = yield* T(yg(e.table, e.pk), e, t.stamp);
9439
9439
  yield* t.kind === "upsert" ? i.upsert({
9440
9440
  table: e.table,
9441
9441
  row: t.row,
@@ -9446,27 +9446,27 @@ behind quietly.` + n;
9446
9446
  version: n
9447
9447
  });
9448
9448
  }), D = (e) => e instanceof Error ? `${e.name}: ${e.message}` : String(e), te = (e, t) => ee(e, t).pipe(o.tapErrorCause(() => o.sync(() => {
9449
- fg(lg);
9449
+ pg(ug);
9450
9450
  })), o.retry(E), o.matchCauseEffect({
9451
9451
  onSuccess: () => o.sync(() => {
9452
- b += 1, fg(cg);
9452
+ b += 1, pg(lg);
9453
9453
  }),
9454
9454
  onFailure: (n) => o.sync(() => {
9455
- ne(e, t, pg(n));
9455
+ ne(e, t, mg(n));
9456
9456
  })
9457
9457
  })), ne = (e, t, n) => {
9458
- let i = vg(e.table, e.pk);
9458
+ let i = yg(e.table, e.pk);
9459
9459
  for (r.warn("analytics-mirror: change forward failed, queued for repair", {
9460
9460
  provider: d,
9461
9461
  table: e.table,
9462
9462
  op: t.kind,
9463
9463
  attempts: s.retryAttempts,
9464
9464
  err: n
9465
- }), _.set(i, e), fg(ug); _.size > s.repairQueueLimit;) {
9465
+ }), _.set(i, e), pg(dg); _.size > s.repairQueueLimit;) {
9466
9466
  let e = _.keys().next();
9467
9467
  if (e.done === !0) break;
9468
9468
  let t = _.get(e.value);
9469
- _.delete(e.value), x += 1, fg(dg), r.error("analytics-mirror: repair queue full — change dropped, mirror is diverged", {
9469
+ _.delete(e.value), x += 1, pg(fg), r.error("analytics-mirror: repair queue full — change dropped, mirror is diverged", {
9470
9470
  provider: d,
9471
9471
  table: t?.table ?? "<unknown>",
9472
9472
  limit: s.repairQueueLimit
@@ -9496,7 +9496,7 @@ behind quietly.` + n;
9496
9496
  y.delete(t);
9497
9497
  });
9498
9498
  }, ae = (e, t) => {
9499
- let n = vg(e.table, e.pk);
9499
+ let n = yg(e.table, e.pk);
9500
9500
  h.set(n, t), !g.has(n) && (g.add(n), k(ie(n, e)));
9501
9501
  }, A = (e) => o.tryPromise({
9502
9502
  try: () => t.query({
@@ -9518,11 +9518,11 @@ behind quietly.` + n;
9518
9518
  table: t.table,
9519
9519
  row: r,
9520
9520
  version: n
9521
- }), _.delete(e), b += 1, fg(cg), !0;
9521
+ }), _.delete(e), b += 1, pg(lg), !0;
9522
9522
  }).pipe(o.catchAllCause((e) => o.sync(() => (r.warn("analytics-mirror: repair pass failed, key stays queued", {
9523
9523
  provider: d,
9524
9524
  table: t.table,
9525
- err: pg(e)
9525
+ err: mg(e)
9526
9526
  }), !1)))), j = () => o.gen(function* () {
9527
9527
  let e = [..._.entries()];
9528
9528
  if (e.length === 0) return 0;
@@ -9546,7 +9546,7 @@ behind quietly.` + n;
9546
9546
  kind: "clock",
9547
9547
  version: m()
9548
9548
  };
9549
- let t = C(vg(e.table, e.pk));
9549
+ let t = C(yg(e.table, e.pk));
9550
9550
  return t.ordinal += 1, {
9551
9551
  kind: "ordinal",
9552
9552
  ordinal: t.ordinal
@@ -9602,7 +9602,7 @@ behind quietly.` + n;
9602
9602
  dropped: x
9603
9603
  })
9604
9604
  };
9605
- }, bg = (e) => {
9605
+ }, xg = (e) => {
9606
9606
  let t = typeof e.refresh == "string" ? { interval: e.refresh } : e.refresh, n = e.strategy ?? "replace";
9607
9607
  if (n === "merge" && (e.mergeKey === void 0 || e.mergeKey.length === 0)) throw Error(`defineAggregate("${e.name}"): strategy: 'merge' requires mergeKey — the property on each row to upsert by`);
9608
9608
  if (e.incremental !== void 0) {
@@ -9628,45 +9628,45 @@ behind quietly.` + n;
9628
9628
  build: e.build,
9629
9629
  ...e.incremental === void 0 ? {} : { incremental: e.incremental }
9630
9630
  };
9631
- }, xg = (e) => typeof e == "object" && !!e && e._voltroAggregate === !0, Sg = class extends y.TaggedError()("AggregateStale", {
9631
+ }, Sg = (e) => typeof e == "object" && !!e && e._voltroAggregate === !0, Cg = class extends y.TaggedError()("AggregateStale", {
9632
9632
  name: y.String,
9633
9633
  ageMs: y.Number,
9634
9634
  maxAgeMs: y.Number
9635
- }) {}, Cg = class extends y.TaggedError()("AggregateNotFound", { name: y.String }) {}, wg = class extends y.TaggedError()("AggregateError", {
9635
+ }) {}, wg = class extends y.TaggedError()("AggregateNotFound", { name: y.String }) {}, Tg = class extends y.TaggedError()("AggregateError", {
9636
9636
  name: y.String,
9637
9637
  operation: y.String,
9638
9638
  cause: y.String
9639
- }) {}, Tg = class extends n.Tag("@voltro/AggregateRegistry")() {}, Eg = (e) => o.gen(function* () {
9640
- return (yield* Tg).getHandle(e);
9641
- }), Dg = (e, t, n) => {
9639
+ }) {}, Eg = class extends n.Tag("@voltro/AggregateRegistry")() {}, Dg = (e) => o.gen(function* () {
9640
+ return (yield* Eg).getHandle(e);
9641
+ }), Og = (e, t, n) => {
9642
9642
  if (e.crossTenant || !t.has(e.table) || n == null) return e;
9643
9643
  let r = O("tenantId", n);
9644
9644
  return {
9645
9645
  ...e,
9646
9646
  predicate: e.predicate ? C(e.predicate, r) : r
9647
9647
  };
9648
- }, Og = (e, t, n) => n === "" && !e.crossTenant && t.has(e.table), kg = (e) => e?.type === "user" && e.tenantId === "", Ag = (e, t) => {
9648
+ }, kg = (e, t, n) => n === "" && !e.crossTenant && t.has(e.table), Ag = (e) => e?.type === "user" && e.tenantId === "", jg = (e, t) => {
9649
9649
  if (e.includeDeleted || !t.has(e.table)) return e;
9650
9650
  let n = fe("deletedAt");
9651
9651
  return {
9652
9652
  ...e,
9653
9653
  predicate: e.predicate ? C(e.predicate, n) : n
9654
9654
  };
9655
- }, jg = (e) => (t, n) => {
9655
+ }, Mg = (e) => (t, n) => {
9656
9656
  e.observe?.beforeScope?.({ ...t }, n);
9657
- let r = Ag(Dg(t, e.tenantScopedTables, n.tenantId), e.softDeleteScopedTables);
9657
+ let r = jg(Og(t, e.tenantScopedTables, n.tenantId), e.softDeleteScopedTables);
9658
9658
  return e.observe?.afterScope?.({ ...r }), r;
9659
- }, Mg = (e, t) => t, Ng = (t) => o.runPromiseExit(t).then((t) => {
9659
+ }, Ng = (e, t) => t, Pg = (t) => o.runPromiseExit(t).then((t) => {
9660
9660
  if (c.isSuccess(t)) return t.value;
9661
9661
  let n = e.failureOption(t.cause);
9662
9662
  throw h.isSome(n) ? n.value : e.squash(t.cause);
9663
- }), Pg = (e, t) => e.pipe(o.provideService(gt, t)), Fg = async (e, t, n, r) => {
9664
- let i = await o.runPromise(St(t, e.guards, n, {
9663
+ }), Fg = (e, t) => e.pipe(o.provideService(gt, t)), Ig = async (e, t, n, r) => {
9664
+ let i = await o.runPromise(z(t, e.guards, n, {
9665
9665
  defaultDeny: r === !0,
9666
9666
  procedure: e.name
9667
9667
  }));
9668
9668
  if (i) throw i;
9669
- }, Ig = async (e, t, n, r) => {
9669
+ }, Lg = async (e, t, n, r) => {
9670
9670
  e.requiresApproval !== void 0 && await em({
9671
9671
  procedure: e.name,
9672
9672
  kind: t,
@@ -9675,16 +9675,16 @@ behind quietly.` + n;
9675
9675
  input: r,
9676
9676
  traceId: n.traceId
9677
9677
  });
9678
- }, Lg = async (e) => {
9678
+ }, Rg = async (e) => {
9679
9679
  if (mi() === void 0) return e;
9680
- let t = await Ng(_i(e.subject, (e) => {
9680
+ let t = await Pg(_i(e.subject, (e) => {
9681
9681
  console.error("[voltro] row filter failed to load", e);
9682
9682
  }));
9683
9683
  return {
9684
9684
  ...e,
9685
9685
  rowFilter: t
9686
9686
  };
9687
- }, Rg = (e) => {
9687
+ }, zg = (e) => {
9688
9688
  let t = e.descriptor.target;
9689
9689
  if (t == null) return [];
9690
9690
  let n = Array.isArray(t) ? t : [t], r = /* @__PURE__ */ new Set();
@@ -9693,7 +9693,7 @@ behind quietly.` + n;
9693
9693
  typeof t == "string" && t.length > 0 && r.add(t);
9694
9694
  }
9695
9695
  return [...r];
9696
- }, zg = async (t) => {
9696
+ }, Bg = async (t) => {
9697
9697
  let n = `${t.kind}.${t.name}`, r = Date.now(), i = "ok";
9698
9698
  try {
9699
9699
  if (t.interceptor) {
@@ -9723,41 +9723,41 @@ behind quietly.` + n;
9723
9723
  status: i
9724
9724
  });
9725
9725
  }
9726
- }, Bg = /* @__PURE__ */ new Set([1213, 1205]), Vg = /* @__PURE__ */ new Set([
9726
+ }, Vg = /* @__PURE__ */ new Set([1213, 1205]), Hg = /* @__PURE__ */ new Set([
9727
9727
  "ER_LOCK_DEADLOCK",
9728
9728
  "ER_LOCK_WAIT_TIMEOUT",
9729
9729
  "40001",
9730
9730
  "40P01"
9731
- ]), Hg = (e) => {
9731
+ ]), Ug = (e) => {
9732
9732
  let t = e;
9733
9733
  for (let e = 0; e < 6 && typeof t == "object" && t; e++) {
9734
9734
  let e = t;
9735
- if (typeof e.errno == "number" && Bg.has(e.errno) || typeof e.code == "string" && Vg.has(e.code) || typeof e.sqlState == "string" && Vg.has(e.sqlState)) return !0;
9735
+ if (typeof e.errno == "number" && Vg.has(e.errno) || typeof e.code == "string" && Hg.has(e.code) || typeof e.sqlState == "string" && Hg.has(e.sqlState)) return !0;
9736
9736
  t = e.cause;
9737
9737
  }
9738
9738
  return !1;
9739
- }, Ug = 3, Wg = (e) => new Promise((t) => setTimeout(t, e)), Gg = async (e, t) => {
9740
- let n = t?.delay ?? ((e) => Wg(e * 20 + Math.floor(Math.random() * 30)));
9739
+ }, Wg = 3, Gg = (e) => new Promise((t) => setTimeout(t, e)), Kg = async (e, t) => {
9740
+ let n = t?.delay ?? ((e) => Gg(e * 20 + Math.floor(Math.random() * 30)));
9741
9741
  for (let t = 1;; t++) try {
9742
9742
  return await e();
9743
9743
  } catch (e) {
9744
- if (t >= Ug || !Hg(e)) throw e;
9744
+ if (t >= Wg || !Ug(e)) throw e;
9745
9745
  await n(t);
9746
9746
  }
9747
- }, Kg = (e) => (t, n, r) => zg({
9747
+ }, qg = (e) => (t, n, r) => Bg({
9748
9748
  name: t.descriptor.name,
9749
9749
  kind: "mutation",
9750
9750
  input: n,
9751
9751
  requestContext: r,
9752
- target: Rg(t),
9752
+ target: zg(t),
9753
9753
  ...e.interceptor ? { interceptor: e.interceptor } : {},
9754
9754
  ...e.recordMetric ? { recordMetric: e.recordMetric } : {},
9755
9755
  runExecutor: async () => {
9756
- await Fg(t.descriptor, r.subject, n, e.defaultDeny), await Ig(t.descriptor, "mutation", r, n);
9757
- let i = await Lg(r), a = [], s = await Gg(async () => (a.length = 0, e.store.transactional(async (s) => {
9756
+ await Ig(t.descriptor, r.subject, n, e.defaultDeny), await Lg(t.descriptor, "mutation", r, n);
9757
+ let i = await Rg(r), a = [], s = await Kg(async () => (a.length = 0, e.store.transactional(async (s) => {
9758
9758
  let c = e.undoCapture?.(s), l = fp(c ? c.tx : s), u = e.buildContext(i, l.tx, { afterCommit: (e) => {
9759
9759
  a.push(e);
9760
- } }), d = t.executor(n, u), f = o.isEffect(d) ? await e.runEffect(Pg(d, r.subject), u.store) : await d;
9760
+ } }), d = t.executor(n, u), f = o.isEffect(d) ? await e.runEffect(Fg(d, r.subject), u.store) : await d;
9761
9761
  return c && await c.persist(u.store, {
9762
9762
  tag: t.descriptor.name,
9763
9763
  subject: r.subject,
@@ -9771,36 +9771,40 @@ behind quietly.` + n;
9771
9771
  for (let e of a) await e();
9772
9772
  return s;
9773
9773
  }
9774
- }), qg = (e) => e && typeof e == "object" && "descriptor" in e ? e.descriptor : e, Jg = (e) => typeof e == "object" && !!e && !Array.isArray(e) && "table" in e && "order" in e, Yg = (e) => {
9774
+ }), Jg = (e) => e && typeof e == "object" && "descriptor" in e ? e.descriptor : e, Yg = (e) => typeof e == "object" && !!e && !Array.isArray(e) && "table" in e && "order" in e, Xg = (e) => {
9775
9775
  let t = e.descriptor.source;
9776
9776
  return t == null ? [] : typeof t == "string" ? [t] : [...t];
9777
- }, Xg = (e, t, n) => (r) => () => {
9777
+ }, Zg = (e, t, n) => (r) => () => {
9778
9778
  let i = e.descriptor.guards;
9779
- return (!i || i.length === 0) && n !== !0 ? Promise.resolve(null) : o.runPromise(St(r, i, t, {
9779
+ return (!i || i.length === 0) && n !== !0 ? Promise.resolve(null) : o.runPromise(z(r, i, t, {
9780
9780
  defaultDeny: n === !0,
9781
9781
  procedure: e.descriptor.name
9782
9782
  }));
9783
- }, Zg = (e) => (t, n) => (r) => {
9784
- let i = e.buildContext(r), a = Xg(t, n, e.defaultDeny)(r.subject), s = async () => {
9783
+ }, Qg = (e, t) => e.rowFilter !== void 0 || mi() === void 0 ? t(e) : o.promise(() => Rg(e)).pipe(o.flatMap((e) => {
9784
+ let n = t(e);
9785
+ return o.isEffect(n) ? n : o.succeed(n);
9786
+ })), $g = (e) => (t, n) => (r) => {
9787
+ if (r.rowFilter === void 0 && mi() !== void 0) return Qg(r, (r) => $g(e)(t, n)(r));
9788
+ let i = e.buildContext(r), a = Zg(t, n, e.defaultDeny)(r.subject), s = async () => {
9785
9789
  let i = await a();
9786
9790
  if (i) throw i;
9787
- let s = e.buildContext(await Lg(r)), c = t.executor(n, s);
9788
- return o.isEffect(c) ? o.runPromise(e.provideEffect(Pg(c, r.subject), s.store)) : qg(await Promise.resolve(c));
9791
+ let s = e.buildContext(await Rg(r)), c = t.executor(n, s);
9792
+ return o.isEffect(c) ? o.runPromise(e.provideEffect(Fg(c, r.subject), s.store)) : Jg(await Promise.resolve(c));
9789
9793
  }, c = (n) => {
9790
- let i = qg(n);
9791
- return Jg(i) ? e.finalize(i, r) : {
9794
+ let i = Jg(n);
9795
+ return Yg(i) ? e.finalize(i, r) : {
9792
9796
  __voltroComputed: !0,
9793
9797
  value: i,
9794
- dependentTables: Yg(t),
9798
+ dependentTables: Xg(t),
9795
9799
  tenantId: r.subject?.tenantId ?? null,
9796
9800
  recompute: s
9797
9801
  };
9798
9802
  }, l = () => {
9799
9803
  let a = t.executor(n, i);
9800
- return o.isEffect(a) ? e.provideEffect(Pg(a, r.subject), i.store).pipe(o.map(c)) : a instanceof Promise ? o.promise(() => a).pipe(o.map(c)) : c(a);
9804
+ return o.isEffect(a) ? e.provideEffect(Fg(a, r.subject), i.store).pipe(o.map(c)) : a instanceof Promise ? o.promise(() => a).pipe(o.map(c)) : c(a);
9801
9805
  }, u = () => {
9802
9806
  let i = t.descriptor.guards;
9803
- return (!i || i.length === 0) && e.defaultDeny !== !0 ? l() : St(r.subject, i, n, {
9807
+ return (!i || i.length === 0) && e.defaultDeny !== !0 ? l() : z(r.subject, i, n, {
9804
9808
  defaultDeny: e.defaultDeny === !0,
9805
9809
  procedure: t.descriptor.name
9806
9810
  }).pipe(o.flatMap((e) => {
@@ -9822,14 +9826,14 @@ behind quietly.` + n;
9822
9826
  traceId: r.traceId,
9823
9827
  ...r.spanId === void 0 ? {} : { spanId: r.spanId }
9824
9828
  });
9825
- }, Qg = (e) => async (t, n, r) => {
9826
- let i = await Lg(r), a = Zg(e)(t, n)(i), s = o.isEffect(a) ? await Ng(a) : a;
9829
+ }, e_ = (e) => async (t, n, r) => {
9830
+ let i = await Rg(r), a = $g(e)(t, n)(i), s = o.isEffect(a) ? await Pg(a) : a;
9827
9831
  return Mi(s) ? s.value : e.queryRows(s, i);
9828
- }, $g = (e) => (t, n, r, i) => {
9832
+ }, t_ = (e) => (t, n, r, i) => {
9829
9833
  let a = !1, s;
9830
9834
  return (async () => {
9831
9835
  try {
9832
- let c = await Lg(r), l = Zg(e)(t, n)(c), u = o.isEffect(l) ? await Ng(l) : l, d = (e) => i(e), f = Mi(u) ? await e.subscribeComputed(u, d, c) : await e.subscribeDescriptor(u, d, c);
9836
+ let c = await Rg(r), l = $g(e)(t, n)(c), u = o.isEffect(l) ? await Pg(l) : l, d = (e) => i(e), f = Mi(u) ? await e.subscribeComputed(u, d, c) : await e.subscribeDescriptor(u, d, c);
9833
9837
  a ? f() : s = f;
9834
9838
  } catch (e) {
9835
9839
  i({
@@ -9840,25 +9844,25 @@ behind quietly.` + n;
9840
9844
  })(), () => {
9841
9845
  a = !0, s?.();
9842
9846
  };
9843
- }, e_ = (e) => (t, n, r) => zg({
9847
+ }, n_ = (e) => (t, n, r) => Bg({
9844
9848
  name: t.descriptor.name,
9845
9849
  kind: "action",
9846
9850
  input: n,
9847
9851
  requestContext: r,
9848
- target: Rg(t),
9852
+ target: zg(t),
9849
9853
  ...e.interceptor ? { interceptor: e.interceptor } : {},
9850
9854
  ...e.recordMetric ? { recordMetric: e.recordMetric } : {},
9851
9855
  runExecutor: async () => {
9852
- await Fg(t.descriptor, r.subject, n, e.defaultDeny), await Ig(t.descriptor, "action", r, n);
9853
- let i = e.buildContext(await Lg(r)), a = t.executor(n, i);
9854
- return o.isEffect(a) ? e.runEffect(Pg(a, r.subject), i.store) : a;
9856
+ await Ig(t.descriptor, r.subject, n, e.defaultDeny), await Lg(t.descriptor, "action", r, n);
9857
+ let i = e.buildContext(await Rg(r)), a = t.executor(n, i);
9858
+ return o.isEffect(a) ? e.runEffect(Fg(a, r.subject), i.store) : a;
9855
9859
  }
9856
- }), t_ = (e) => e instanceof Date ? e.toISOString() : typeof e == "string" && e.length > 0 ? e : null, n_ = (e) => typeof e == "string" && e.length > 0 ? e : null, r_ = [
9860
+ }), r_ = (e) => e instanceof Date ? e.toISOString() : typeof e == "string" && e.length > 0 ? e : null, i_ = (e) => typeof e == "string" && e.length > 0 ? e : null, a_ = [
9857
9861
  "updatedAt",
9858
9862
  "createdAt",
9859
9863
  "updatedBy",
9860
9864
  "createdBy"
9861
- ], i_ = (e) => r_.some((t) => t in e), a_ = (e, t, n) => {
9865
+ ], o_ = (e) => a_.some((t) => t in e), s_ = (e, t, n) => {
9862
9866
  let r = {
9863
9867
  table: t.table,
9864
9868
  id: t.id,
@@ -9873,14 +9877,14 @@ behind quietly.` + n;
9873
9877
  found: !1
9874
9878
  };
9875
9879
  let i = t.column === void 0 ? void 0 : e[t.column];
9876
- if (!i_(e)) return {
9880
+ if (!o_(e)) return {
9877
9881
  ...r,
9878
9882
  value: i,
9879
9883
  lastWrite: null,
9880
9884
  attribution: "none",
9881
9885
  found: !0
9882
9886
  };
9883
- let a = n_(e.updatedBy) ?? n_(e.createdBy), o = t_(e.updatedAt) ?? t_(e.createdAt);
9887
+ let a = i_(e.updatedBy) ?? i_(e.createdBy), o = r_(e.updatedAt) ?? r_(e.createdAt);
9884
9888
  return {
9885
9889
  ...r,
9886
9890
  value: i,
@@ -9892,12 +9896,12 @@ behind quietly.` + n;
9892
9896
  attribution: "audit",
9893
9897
  found: !0
9894
9898
  };
9895
- }, o_ = (e, t) => {
9899
+ }, c_ = (e, t) => {
9896
9900
  let n = e.map((e) => {
9897
9901
  let n = e.newValue ?? e.value, r = t.column !== void 0 && n && typeof n == "object" ? n[t.column] : e.newValue ?? e.value;
9898
9902
  return {
9899
- actor: { id: n_(e.actor) ?? n_(e.changedBy) },
9900
- at: t_(e.at) ?? t_(e.changedAt),
9903
+ actor: { id: i_(e.actor) ?? i_(e.changedBy) },
9904
+ at: r_(e.at) ?? r_(e.changedAt),
9901
9905
  ...e.traceId === void 0 ? {} : { traceId: e.traceId },
9902
9906
  value: r
9903
9907
  };
@@ -9912,12 +9916,12 @@ behind quietly.` + n;
9912
9916
  history: n,
9913
9917
  found: n.length > 0
9914
9918
  };
9915
- }, s_ = (e) => {
9919
+ }, l_ = (e) => {
9916
9920
  let t = e.new?.id;
9917
9921
  if (typeof t == "string") return t;
9918
9922
  let n = e.old?.id;
9919
9923
  return typeof n == "string" ? n : void 0;
9920
- }, c_ = (e) => {
9924
+ }, u_ = (e) => {
9921
9925
  let t = {};
9922
9926
  if (e.op === "insert") for (let [n, r] of Object.entries(e.new ?? {})) t[n] = {
9923
9927
  from: void 0,
@@ -9937,11 +9941,11 @@ behind quietly.` + n;
9937
9941
  return {
9938
9942
  table: e.table,
9939
9943
  op: e.op,
9940
- id: s_(e),
9944
+ id: l_(e),
9941
9945
  fields: t
9942
9946
  };
9943
- }, l_ = (e) => {
9944
- let t = e.map(c_);
9947
+ }, d_ = (e) => {
9948
+ let t = e.map(u_);
9945
9949
  return {
9946
9950
  rows: t,
9947
9951
  summary: {
@@ -9950,21 +9954,21 @@ behind quietly.` + n;
9950
9954
  deletes: t.filter((e) => e.op === "delete").length
9951
9955
  }
9952
9956
  };
9953
- }, u_ = class extends Error {
9957
+ }, f_ = class extends Error {
9954
9958
  constructor() {
9955
9959
  super("voltro:preview-rollback"), this.name = "PreviewRollback";
9956
9960
  }
9957
- }, d_ = async (e, t) => {
9961
+ }, p_ = async (e, t) => {
9958
9962
  let n, r = !1;
9959
9963
  try {
9960
9964
  await e.transactional(async (e) => {
9961
- throw n = await t(e), r = !0, new u_();
9965
+ throw n = await t(e), r = !0, new f_();
9962
9966
  });
9963
9967
  } catch (e) {
9964
- if (!(e instanceof u_)) throw e;
9968
+ if (!(e instanceof f_)) throw e;
9965
9969
  }
9966
9970
  if (!r) throw Error("preview: handler did not complete");
9967
9971
  return n;
9968
- }, f_ = "framework-runtime";
9972
+ }, m_ = "framework-runtime";
9969
9973
  //#endregion
9970
- export { Ao as API_CSP, fc as API_KEYS_TABLE, Np as APPROVALS_TABLE, Hu as AccessDenied, wg as AggregateError, Om as AggregateMaintainer, Cg as AggregateNotFound, Tg as AggregateRegistry, Sg as AggregateStale, $h as AnalyticsCapabilityNotSupported, Qh as AnalyticsError, eg as AnalyticsSink, Hf as CLAIM_RETENTION_BUCKETS, J as CONNECTIONS_TABLE, Vl as CONNECTION_GRANTS_TABLE, of as CircuitBreaker, rf as CircuitOpen, uu as ConnectionNotConnected, hh as CostAccountant, ch as CostRegistry, mg as DEFAULT_ANALYTICS_MIRROR_TUNABLES, Pp as DEFAULT_APPROVAL_EXPIRY_MS, Vf as DEFAULT_CLAIM_BUCKET_MS, $n as DEFAULT_DELIVERY_CONCURRENCY, Mo as DEFAULT_HSTS, Yf as DEFAULT_MAX_IDLE_INTERVAL_MS, _s as DEFAULT_MAX_RPC_BODY_BYTES, er as DEFAULT_RAW_READ_TRACKING_LIMIT, cu as DEFAULT_REFRESH_SKEW_MS, li as DEFAULT_ROW_FILTER_RETRY, Rf as DORMANCY_WAKEUP_TENANT, ja as DeleteBuilder, ki as Dispatcher, hl as EVENT_CLIENT_QUEUE_SIZE, gl as EVENT_LATEST_QUEUE_SIZE, Dc as EffectStore, ul as EventBus, eh as ExpectationEvaluator, Wm as ExpectationRegistry, Nh as ExperimentEvaluator, wh as ExperimentRegistry, Su as GRANT_TTL_MS, _h as HOLDOUT_VARIANT, jo as HTML_CSP, qn as InMemoryDataStore, Pn as IndexedMatcher, Sl as InstanceMembership, Dn as LinearScanMatcher, p as MetricBoundaries, rg as NOOP_ANALYTICS_PROVIDER, gi as NO_ROW_FILTER, vo as NO_TRUSTED_PROXIES, wa as NoRowFound, El as OUTBOX_ATTEMPTS_TABLE, Nl as OUTBOX_ATTEMPT_LOG_CAP, q as OUTBOX_TABLE, Ta as OptimisticLockError, Vu as REBAC_ADMIN_SCOPE, lu as REFRESH_LEASE_MS, f_ as RUNTIME_NAME, Rm as ReactionRateLimiter, eo as ReplicatedDataStore, ci as RowFilterUnavailable, Lf as SCHEDULE_SUBJECT, Ec as SYSTEM_SUBJECT, ka as SelectBuilder, La as ServerOnlyColumnWrite, pd as SsrfBlockedError, Pa as StoreOperationFailed, Ln as SubscriptionRegistry, Fa as TableValidationFailed, Ia as TenantRowNotFound, Na as TenantScopeViolation, pm as TimelineRecorder, vp as UndoBoundaryError, bp as UndoStack, Bo as UnverifiedWebhookRoute, Aa as UpdateBuilder, bd as VOLTRO_AUDIT_MIXIN_ID, Sd as VOLTRO_EXPIRES_MIXIN_ID, wd as VOLTRO_LOCAL_FIRST_MIXIN_ID, xd as VOLTRO_SOFT_DELETE_MIXIN_ID, Cd as VOLTRO_TENANT_MIXIN_ID, Lo as WEBHOOK_VERIFICATION_PROPERTY, Pc as WorkflowDeferredResultError, Hc as WorkflowPayloadError, Fc as WorkflowRateLimitedError, Ic as WorkflowSingletonHeldError, qi as _connectionStreamCount, Ji as _resetConnectionCredentialsForTest, Fp as _voltroApprovalsTable, Ul as _voltroConnectionGrantsTable, Bl as _voltroConnectionsTable, km as _voltroRebacTuplesTable, tp as _voltroScheduleClaimsTable, ep as _voltroScheduleRunsTable, np as _voltroTracesTable, rp as _voltroUndoLogTable, Fh as _voltroWakeupsTable, il as _voltroWorkflowEventDeliveriesTable, rl as _voltroWorkflowEventsTable, Ua as actingUserId, Tc as apiKeyManagementRoutes, Ui as applyConnectionCredential, Ba as applyDefined, Em as applyDelta, Sp as applyInverse, Cp as applyInverses, tf as applyPluginRefRules, bi as applyRowFilter, xi as applyRowFilterToDescriptor, Ag as applySoftDeleteScope, Dg as applyTenantScope, jp as applyUndoInvocation, Vp as approvalIntentKey, rm as approvalNonce, am as approvalsPendingExecutor, Qu as assertCan, ql as assertConnectionCipherConfigured, Vo as assertWebhookRoutesDeclareVerification, Sh as assignVariant, yg as attachAnalyticsMirror, th as attachExpectations, Ph as attachExperiments, gh as attachFinops, ks as awaitServerListening, Ml as backoffMs, Eu as beginOAuthConnect, zi as bindConnectionCredential, yl as bindEvent, gs as bindMutation, rs as bindStream, ns as bindSubscription, Zo as bindSubscriptionUntyped, wm as buildIvmState, l_ as buildPreview, Mm as buildRebacInterceptor, Pm as buildRebacReadFilter, Ja as buildSubjectKey, Is as buildTracingLayer, Gd as cacheScopeLeaks, Zs as cachedBackend, Zu as can, Ef as cancelWakeup, Bp as canonicalJson, Fn as canonicalize, Uf as claimGraceMs, go as classifyRequestOrigin, ym as classifyShape, $p as clearApprovalGate, mu as clearConnectionRefreshFlights, qu as clearResourcePolicies, ee as clearRetentions, lf as clearSystemStoreHandle, nf as collectPluginRefRules, bf as compileCron, Du as completeOAuthConnect, og as composeAnalytics, ag as composeAnalyticsSinks, Cu as connectionCallbackPath, Kl as connectionLabel, Jh as countRunningWorkflows, ni as counter, Sf as cronOccurrences, Bd as crud, or as currentRawReads, rd as currentRequestLoader, $a as currentRoutingContext, ta as currentTraceContext, Sc as dataStoreApiKeyStore, ic as dataStoreIdempotencyStore, lc as dataStoreKvStore, tm as decideApproval, om as decideApprovalInvocation, da as decryptField, fs as defectMessage, bg as defineAggregate, Gl as defineConnection, oh as defineCostBudget, Qc as defineEventTrigger, Mg as defineExecutor, Hm as defineExpectation, yh as defineExperiment, kl as defineOutboxHandler, Fm as defineReaction, Wu as defineResourcePolicy, yf as defineSchedule, Zh as defineSubscriber, Di as deliveredRowCount, ia as deriveKey, c_ as diffChange, Ds as drainForShutdown, Ll as drainOutbox, Nf as dueWakeups, Xu as effectiveRelations, Ad as emptySchemaRegistry, _a as enableGraphObservation, ua as encryptField, em as enforceApproval, nd as enterRequestLoader, Gs as envSecretsBackend, mp as evaluateTouchedRules, Wr as eventMetricTagCacheSizeForTests, ou as exchangeAuthorizationCode, Qi as externalSpanFromTraceparent, Yn as extractDbCause, In as fingerprintFor, Ti as forbiddenColumnsForSubject, nu as forgetCredential, Kd as formatCacheScopeLeaks, Wd as formatServerOnlyLeaks, Xi as formatTraceparent, Yd as formatUnresolvedSources, xp as forwardChangeFromCdc, Cc as frameworkApiKeyStrategy, ri as gauge, mc as generateApiKeyToken, Qp as getApprovalGate, Bi as getConnectionCredential, ju as getConnectionResolver, Ri as getCredentialExpiry, G as getFieldCipher, Gu as getResourcePolicy, mi as getRowFilter, uf as getSystemStoreHandle, hm as getTimelineRecorder, cd as getTupleSource, xm as groupKeyOf, xh as hashUnitInterval, ii as histogramMetric, o_ as historyProvenance, Qs as httpSecretsBackend, Cn as inspectWorkflow, Zp as installApprovalGate, ld as installPolicyGuardResolver, Ki as interruptConnectionStreams, gp as invertChange, So as ipToBytes, xg as isAggregateDefinition, sh as isCostBudgetDefinition, Og as isEmptyTenantScopedRead, Um as isExpectationDefinition, bh as isExperimentDefinition, Xn as isForeignKeyViolation, Vh as isIdleNow, ls as isInfraError, va as isObservingGraph, kg as isOrglessUserSubject, Zn as isQueryTimeout, yp as isSafeToApply, _f as isScheduleDefinition, $d as isSoftDelete, ao as isStateChangingMethod, Eo as isTrustedProxy, $c as isWorkflowEventTriggerDefinition, ir as isolateRawReadScope, Cm as ivmValue, a_ as lastWriteProvenance, ru as listConnectionStates, Ku as listResourcePolicies, me as listRetentionConflicts, he as listRetentions, Am as loadResourceTuples, Nm as loadSubjectTuples, pf as localityAwareSelector, e_ as makeActionRunner, Wf as makeAdvisoryLockCoordinator, aa as makeAesCipher, _c as makeApiKeyService, yd as makeApiKeyUsageBuffer, xc as makeApiKeyUsageFlusher, Qn as makeAppAccess, Yp as makeApprovalGate, uc as makeAsyncKv, ff as makeAuthMiddlewareLayers, vl as makeBufferGapDetector, Ws as makeBufferingSpanProcessor, Jl as makeConnectionRegistry, Nu as makeConnectionResolver, Pu as makeConnectionsFacade, $f as makeCoordinatedScheduler, dd as makeDataLoader, Bu as makeDisconnectConnectionExecutor, Ac as makeEffectStoreLayer, ml as makeEventPublisher, al as makeEventsFacade, oa as makeFieldCipher, Ma as makeFluentStore, Hh as makeIdleGate, Jc as makeLazyWorkflowFacade, Lu as makeListConnectionsExecutor, ms as makeMutationOutputCodec, Kg as makeMutationRunner, Qg as makeOneShotQueryRunner, co as makeOriginGuardExemption, jl as makeOutboxFacade, Kc as makePostCommitWorkflowFacade, Rh as makeProcessAdapter, Zg as makeQueryDescriptorProducer, jg as makeQueryFinalizer, Xg as makeQueryReauthorizer, $g as makeQuerySubscriber, Uh as makeRouterActivity, fp as makeRuleCapture, Td as makeSchemaRegistry, Ru as makeStartConnectionExecutor, zu as makeSubmitTokenExecutor, lp as makeUndoCapture, Wh as makeWakeGate, qh as makeWakeProxyServer, Gc as makeWorkflowFacade, qc as makeWorkflowFacadeWithCallerContext, Yc as makeWorkflowHandlers, Xc as makeWorkflowLayers, Rc as makeWorkflowRunHandle, Df as markWakeupFired, Tm as materializeIvm, vc as memoryApiKeyStore, hf as memoryReplicationAdapter, qa as memoryRywPositionStore, Hi as mergeCookieHeader, Qf as nextDelay, xf as nextFiring, Pf as nextWakeup, Bh as nodeProcessSupervisor, ig as noopAnalytics, sg as noopAnalyticsSpec, dc as noopKv, yo as normalizeIp, uo as normalizeOrigin, Ca as observeStore, xa as observedGraph, Ss as onProcessShutdown, Ns as otelImportFailure, Ol as outboxAttemptsTable, Tl as outboxTable, Jp as parseApprovalInterval, Zi as parseTraceparent, Uc as payloadPropertyNames, nm as pendingApprovalsFor, Ga as powerOfTwoSelector, d_ as previewInRollback, Ql as projectConnectionState, If as pruneWakeups, fl as publishEvent, cr as rawSqlPreview, Xf as readPollCeilingMs, Ju as rebacPolicyGraph, Li as recordCredentialExpiry, Kr as recordEventDelivered, qr as recordEventDropped, Gr as recordEventPublished, Jr as recordEventSubscribers, ar as recordRawRead, Yr as recordSample, ei as recordScheduleRun, $r as recordSubscriptionActive, Zr as recordSubscriptionDelivery, ba as recordTableAccess, _m as recordTimelineEvent, ti as recordWorkflowRun, Id as redactColumns, um as redactRow, Ya as redisRywPositionStore, Mp as redoUndoInvocation, su as refreshAccessToken, Gi as registerConnectionStream, Ee as registerRetention, Tf as registerWakeup, Rp as rehydrateGuards, Af as releaseWakeup, Ka as replicaHealth, $o as resetComputedQueryCacheWarnings, Ur as resetEventMetricTagCacheForTests, Sa as resetObservedGraph, Js as resetSecretsBackend, Oo as resolveClientAddress, _u as resolveConnection, Mu as resolveConnectionForSubject, mf as resolveCurrentRegion, lr as resolveDependentTables, _o as resolveOriginGuardConfig, nr as resolveReactiveConfig, Tu as resolveRedirectUri, ko as resolveRequestIsHttps, Dm as resolveRescan, _i as resolveRowFilterScope, vi as resolveRowFilterScopeFor, Ys as resolveSecret, Xs as resolveSecretSync, $s as resolveSecretsBackend, Fo as resolveSecurityHeaders, sm as resolveTimelineMode, Do as resolveTrustedProxies, Ch as resultVariantNames, ke as retentionTtlMsFromEnv, fm as reverseEventOverRows, ed as revokedIds, hi as rowFilterRegistered, ef as rulesFor, df as runAsSystem, Yh as runOrchestratorTick, Ng as runProvidedEffect, Bm as runReaction, Xh as runSingleNodeOrchestrator, Lh as runWakeLoop, Gg as runWithDeadlockRetry, ya as runWithObservedProcedure, sr as runWithRawReadScope, id as runWithRequestLoader, Qa as runWithRoutingContext, ea as runWithTraceContext, wu as sanitizeRedirectTo, Zf as scheduleCoordinated, Vd as schemaPropertyNames, zp as scopeStringsOf, Io as securityHeadersFor, Lp as serializeGuards, Si as serverOnlyColumnNames, Ud as serverOnlyLeaks, Au as setConnectionResolver, ca as setFieldCipher, pi as setRowFilter, qs as setSecretsBackend, cf as setSystemStoreHandle, gm as setTimelineRecorderForTest, sd as setTupleSource, En as settleHandlerBody, pc as sha256Hex, Es as shutdownGraceMsFromEnv, zf as singleCoordinator, oi as snapshotMetrics, si as snapshotMetricsSync, vd as ssrfGuardHttpClientLayer, _d as ssrfReason, vs as startRpcServer, Kf as startScheduler, eu as storeCredential, Ci as stripColumnsFromRows, Ei as stripForbiddenForWire, wi as stripServerOnlyForWire, Ou as sweepExpiredGrants, Le as sweepRetention, _p as synthesizeInverse, fd as tracingHttpClientLayer, Zc as triggerWorkflow, kf as tryClaimWakeup, Vi as unbindConnection, ip as undoCaptureEnabled, kp as undoLogExecutor, ap as undoSurfaceEnabled, Jd as unresolvedSources, Eg as useAggregate, ng as useAnalytics, lh as useCostBudget, Gm as useExpectation, Th as useExperiment, $u as visibleRows, Ih as wakeDueOnce, zo as webhookVerificationOf, Lg as withRowFilter, jc as workflowToRpc, cp as wrapCaptureStore, Md as wrapStoreWithBootCodec, Wa as wrapStoreWithMixinBehaviour };
9974
+ export { Ao as API_CSP, fc as API_KEYS_TABLE, Np as APPROVALS_TABLE, Hu as AccessDenied, Tg as AggregateError, Om as AggregateMaintainer, wg as AggregateNotFound, Eg as AggregateRegistry, Cg as AggregateStale, eg as AnalyticsCapabilityNotSupported, $h as AnalyticsError, tg as AnalyticsSink, Hf as CLAIM_RETENTION_BUCKETS, Y as CONNECTIONS_TABLE, Vl as CONNECTION_GRANTS_TABLE, of as CircuitBreaker, rf as CircuitOpen, uu as ConnectionNotConnected, hh as CostAccountant, ch as CostRegistry, hg as DEFAULT_ANALYTICS_MIRROR_TUNABLES, Pp as DEFAULT_APPROVAL_EXPIRY_MS, Vf as DEFAULT_CLAIM_BUCKET_MS, $n as DEFAULT_DELIVERY_CONCURRENCY, Mo as DEFAULT_HSTS, Yf as DEFAULT_MAX_IDLE_INTERVAL_MS, _s as DEFAULT_MAX_RPC_BODY_BYTES, er as DEFAULT_RAW_READ_TRACKING_LIMIT, cu as DEFAULT_REFRESH_SKEW_MS, li as DEFAULT_ROW_FILTER_RETRY, Rf as DORMANCY_WAKEUP_TENANT, ja as DeleteBuilder, ki as Dispatcher, hl as EVENT_CLIENT_QUEUE_SIZE, gl as EVENT_LATEST_QUEUE_SIZE, Dc as EffectStore, ul as EventBus, eh as ExpectationEvaluator, Wm as ExpectationRegistry, Ph as ExperimentEvaluator, wh as ExperimentRegistry, Su as GRANT_TTL_MS, _h as HOLDOUT_VARIANT, jo as HTML_CSP, qn as InMemoryDataStore, Pn as IndexedMatcher, Sl as InstanceMembership, Dn as LinearScanMatcher, p as MetricBoundaries, ig as NOOP_ANALYTICS_PROVIDER, gi as NO_ROW_FILTER, vo as NO_TRUSTED_PROXIES, wa as NoRowFound, El as OUTBOX_ATTEMPTS_TABLE, Nl as OUTBOX_ATTEMPT_LOG_CAP, J as OUTBOX_TABLE, Ta as OptimisticLockError, Vu as REBAC_ADMIN_SCOPE, lu as REFRESH_LEASE_MS, m_ as RUNTIME_NAME, Rm as ReactionRateLimiter, eo as ReplicatedDataStore, ci as RowFilterUnavailable, Lf as SCHEDULE_SUBJECT, Ec as SYSTEM_SUBJECT, ka as SelectBuilder, La as ServerOnlyColumnWrite, pd as SsrfBlockedError, Pa as StoreOperationFailed, Ln as SubscriptionRegistry, Fa as TableValidationFailed, Ia as TenantRowNotFound, Na as TenantScopeViolation, pm as TimelineRecorder, vp as UndoBoundaryError, bp as UndoStack, Bo as UnverifiedWebhookRoute, Aa as UpdateBuilder, bd as VOLTRO_AUDIT_MIXIN_ID, Sd as VOLTRO_EXPIRES_MIXIN_ID, wd as VOLTRO_LOCAL_FIRST_MIXIN_ID, xd as VOLTRO_SOFT_DELETE_MIXIN_ID, Cd as VOLTRO_TENANT_MIXIN_ID, Lo as WEBHOOK_VERIFICATION_PROPERTY, Pc as WorkflowDeferredResultError, Hc as WorkflowPayloadError, Fc as WorkflowRateLimitedError, Ic as WorkflowSingletonHeldError, qi as _connectionStreamCount, Ji as _resetConnectionCredentialsForTest, Fp as _voltroApprovalsTable, Ul as _voltroConnectionGrantsTable, Bl as _voltroConnectionsTable, km as _voltroRebacTuplesTable, tp as _voltroScheduleClaimsTable, ep as _voltroScheduleRunsTable, np as _voltroTracesTable, rp as _voltroUndoLogTable, Ih as _voltroWakeupsTable, il as _voltroWorkflowEventDeliveriesTable, rl as _voltroWorkflowEventsTable, Ua as actingUserId, Tc as apiKeyManagementRoutes, Ui as applyConnectionCredential, Ba as applyDefined, Em as applyDelta, Sp as applyInverse, Cp as applyInverses, tf as applyPluginRefRules, bi as applyRowFilter, xi as applyRowFilterToDescriptor, jg as applySoftDeleteScope, Og as applyTenantScope, jp as applyUndoInvocation, Vp as approvalIntentKey, rm as approvalNonce, am as approvalsPendingExecutor, Qu as assertCan, ql as assertConnectionCipherConfigured, Vo as assertWebhookRoutesDeclareVerification, Sh as assignVariant, bg as attachAnalyticsMirror, th as attachExpectations, Fh as attachExperiments, gh as attachFinops, ks as awaitServerListening, Ml as backoffMs, Eu as beginOAuthConnect, zi as bindConnectionCredential, yl as bindEvent, gs as bindMutation, rs as bindStream, ns as bindSubscription, Zo as bindSubscriptionUntyped, wm as buildIvmState, d_ as buildPreview, Mm as buildRebacInterceptor, Pm as buildRebacReadFilter, Ja as buildSubjectKey, Is as buildTracingLayer, Gd as cacheScopeLeaks, Zs as cachedBackend, Zu as can, Ef as cancelWakeup, Bp as canonicalJson, Fn as canonicalize, Uf as claimGraceMs, go as classifyRequestOrigin, ym as classifyShape, $p as clearApprovalGate, mu as clearConnectionRefreshFlights, qu as clearResourcePolicies, ee as clearRetentions, lf as clearSystemStoreHandle, nf as collectPluginRefRules, bf as compileCron, Du as completeOAuthConnect, sg as composeAnalytics, og as composeAnalyticsSinks, Cu as connectionCallbackPath, Kl as connectionLabel, Yh as countRunningWorkflows, ni as counter, Sf as cronOccurrences, Bd as crud, or as currentRawReads, rd as currentRequestLoader, $a as currentRoutingContext, ta as currentTraceContext, Sc as dataStoreApiKeyStore, ic as dataStoreIdempotencyStore, lc as dataStoreKvStore, tm as decideApproval, om as decideApprovalInvocation, da as decryptField, fs as defectMessage, xg as defineAggregate, Gl as defineConnection, oh as defineCostBudget, Qc as defineEventTrigger, Ng as defineExecutor, Hm as defineExpectation, yh as defineExperiment, kl as defineOutboxHandler, Fm as defineReaction, Wu as defineResourcePolicy, yf as defineSchedule, Qh as defineSubscriber, Di as deliveredRowCount, ia as deriveKey, u_ as diffChange, Ds as drainForShutdown, Ll as drainOutbox, Nf as dueWakeups, Xu as effectiveRelations, Ad as emptySchemaRegistry, _a as enableGraphObservation, ua as encryptField, em as enforceApproval, nd as enterRequestLoader, Gs as envSecretsBackend, mp as evaluateTouchedRules, Wr as eventMetricTagCacheSizeForTests, ou as exchangeAuthorizationCode, Qi as externalSpanFromTraceparent, Yn as extractDbCause, In as fingerprintFor, Ti as forbiddenColumnsForSubject, nu as forgetCredential, Kd as formatCacheScopeLeaks, Wd as formatServerOnlyLeaks, Xi as formatTraceparent, Yd as formatUnresolvedSources, xp as forwardChangeFromCdc, Cc as frameworkApiKeyStrategy, ri as gauge, mc as generateApiKeyToken, Qp as getApprovalGate, Bi as getConnectionCredential, ju as getConnectionResolver, Ri as getCredentialExpiry, K as getFieldCipher, Gu as getResourcePolicy, mi as getRowFilter, uf as getSystemStoreHandle, hm as getTimelineRecorder, cd as getTupleSource, xm as groupKeyOf, xh as hashUnitInterval, ii as histogramMetric, c_ as historyProvenance, Qs as httpSecretsBackend, Cn as inspectWorkflow, Zp as installApprovalGate, ld as installPolicyGuardResolver, Ki as interruptConnectionStreams, gp as invertChange, So as ipToBytes, Sg as isAggregateDefinition, sh as isCostBudgetDefinition, kg as isEmptyTenantScopedRead, Um as isExpectationDefinition, bh as isExperimentDefinition, Xn as isForeignKeyViolation, Hh as isIdleNow, ls as isInfraError, va as isObservingGraph, Ag as isOrglessUserSubject, Zn as isQueryTimeout, yp as isSafeToApply, _f as isScheduleDefinition, $d as isSoftDelete, ao as isStateChangingMethod, Eo as isTrustedProxy, $c as isWorkflowEventTriggerDefinition, ir as isolateRawReadScope, Cm as ivmValue, s_ as lastWriteProvenance, ru as listConnectionStates, Ku as listResourcePolicies, me as listRetentionConflicts, he as listRetentions, Am as loadResourceTuples, Nm as loadSubjectTuples, pf as localityAwareSelector, n_ as makeActionRunner, Wf as makeAdvisoryLockCoordinator, aa as makeAesCipher, _c as makeApiKeyService, yd as makeApiKeyUsageBuffer, xc as makeApiKeyUsageFlusher, Qn as makeAppAccess, Yp as makeApprovalGate, uc as makeAsyncKv, ff as makeAuthMiddlewareLayers, vl as makeBufferGapDetector, Ws as makeBufferingSpanProcessor, Jl as makeConnectionRegistry, Nu as makeConnectionResolver, Pu as makeConnectionsFacade, $f as makeCoordinatedScheduler, dd as makeDataLoader, Bu as makeDisconnectConnectionExecutor, Ac as makeEffectStoreLayer, ml as makeEventPublisher, al as makeEventsFacade, oa as makeFieldCipher, Ma as makeFluentStore, Uh as makeIdleGate, Jc as makeLazyWorkflowFacade, Lu as makeListConnectionsExecutor, ms as makeMutationOutputCodec, qg as makeMutationRunner, e_ as makeOneShotQueryRunner, co as makeOriginGuardExemption, jl as makeOutboxFacade, Kc as makePostCommitWorkflowFacade, zh as makeProcessAdapter, $g as makeQueryDescriptorProducer, Mg as makeQueryFinalizer, Zg as makeQueryReauthorizer, t_ as makeQuerySubscriber, Wh as makeRouterActivity, fp as makeRuleCapture, Td as makeSchemaRegistry, Ru as makeStartConnectionExecutor, zu as makeSubmitTokenExecutor, lp as makeUndoCapture, Gh as makeWakeGate, Jh as makeWakeProxyServer, Gc as makeWorkflowFacade, qc as makeWorkflowFacadeWithCallerContext, Yc as makeWorkflowHandlers, Xc as makeWorkflowLayers, Rc as makeWorkflowRunHandle, Df as markWakeupFired, Tm as materializeIvm, vc as memoryApiKeyStore, hf as memoryReplicationAdapter, qa as memoryRywPositionStore, Hi as mergeCookieHeader, Qf as nextDelay, xf as nextFiring, Pf as nextWakeup, Vh as nodeProcessSupervisor, ag as noopAnalytics, cg as noopAnalyticsSpec, dc as noopKv, yo as normalizeIp, uo as normalizeOrigin, Ca as observeStore, xa as observedGraph, Ss as onProcessShutdown, Ns as otelImportFailure, Ol as outboxAttemptsTable, Tl as outboxTable, Jp as parseApprovalInterval, Zi as parseTraceparent, Uc as payloadPropertyNames, nm as pendingApprovalsFor, Ga as powerOfTwoSelector, p_ as previewInRollback, Ql as projectConnectionState, If as pruneWakeups, fl as publishEvent, cr as rawSqlPreview, Xf as readPollCeilingMs, Ju as rebacPolicyGraph, Li as recordCredentialExpiry, Kr as recordEventDelivered, qr as recordEventDropped, Gr as recordEventPublished, Jr as recordEventSubscribers, ar as recordRawRead, Yr as recordSample, ei as recordScheduleRun, $r as recordSubscriptionActive, Zr as recordSubscriptionDelivery, ba as recordTableAccess, _m as recordTimelineEvent, ti as recordWorkflowRun, Id as redactColumns, um as redactRow, Ya as redisRywPositionStore, Mp as redoUndoInvocation, su as refreshAccessToken, Gi as registerConnectionStream, Ee as registerRetention, Tf as registerWakeup, Rp as rehydrateGuards, Af as releaseWakeup, Ka as replicaHealth, $o as resetComputedQueryCacheWarnings, Ur as resetEventMetricTagCacheForTests, Sa as resetObservedGraph, Js as resetSecretsBackend, Oo as resolveClientAddress, _u as resolveConnection, Mu as resolveConnectionForSubject, mf as resolveCurrentRegion, lr as resolveDependentTables, _o as resolveOriginGuardConfig, nr as resolveReactiveConfig, Tu as resolveRedirectUri, ko as resolveRequestIsHttps, Dm as resolveRescan, _i as resolveRowFilterScope, vi as resolveRowFilterScopeFor, Ys as resolveSecret, Xs as resolveSecretSync, $s as resolveSecretsBackend, Fo as resolveSecurityHeaders, sm as resolveTimelineMode, Do as resolveTrustedProxies, Ch as resultVariantNames, ke as retentionTtlMsFromEnv, fm as reverseEventOverRows, ed as revokedIds, hi as rowFilterRegistered, ef as rulesFor, df as runAsSystem, Xh as runOrchestratorTick, Pg as runProvidedEffect, Bm as runReaction, Zh as runSingleNodeOrchestrator, Rh as runWakeLoop, Kg as runWithDeadlockRetry, ya as runWithObservedProcedure, sr as runWithRawReadScope, id as runWithRequestLoader, Qa as runWithRoutingContext, ea as runWithTraceContext, wu as sanitizeRedirectTo, Zf as scheduleCoordinated, Vd as schemaPropertyNames, zp as scopeStringsOf, Io as securityHeadersFor, Lp as serializeGuards, Si as serverOnlyColumnNames, Ud as serverOnlyLeaks, Au as setConnectionResolver, ca as setFieldCipher, pi as setRowFilter, qs as setSecretsBackend, cf as setSystemStoreHandle, gm as setTimelineRecorderForTest, sd as setTupleSource, En as settleHandlerBody, pc as sha256Hex, Es as shutdownGraceMsFromEnv, zf as singleCoordinator, oi as snapshotMetrics, si as snapshotMetricsSync, vd as ssrfGuardHttpClientLayer, _d as ssrfReason, vs as startRpcServer, Kf as startScheduler, eu as storeCredential, Ci as stripColumnsFromRows, Ei as stripForbiddenForWire, wi as stripServerOnlyForWire, Ou as sweepExpiredGrants, Le as sweepRetention, _p as synthesizeInverse, fd as tracingHttpClientLayer, Zc as triggerWorkflow, kf as tryClaimWakeup, Vi as unbindConnection, ip as undoCaptureEnabled, kp as undoLogExecutor, ap as undoSurfaceEnabled, Jd as unresolvedSources, Dg as useAggregate, rg as useAnalytics, lh as useCostBudget, Gm as useExpectation, Th as useExperiment, $u as visibleRows, Lh as wakeDueOnce, zo as webhookVerificationOf, Rg as withRowFilter, Qg as withScopedRequest, jc as workflowToRpc, cp as wrapCaptureStore, Md as wrapStoreWithBootCodec, Wa as wrapStoreWithMixinBehaviour };