@voltro/protocol 0.63.0 → 0.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,46 +1,47 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as ee, L as te, M as ne, N as c, O as re, P as ie, R as ae, S as oe, T as se, U as ce, V as le, W as ue, _ as de, a as l, b as fe, c as pe, d as me, f as he, g as ge, h as u, i as _e, j as ve, k as ye, l as be, m as xe, n as Se, o as Ce, p as we, r as Te, s as Ee, t as De, u as Oe, v as d, w as ke, x as Ae, y as je, z as Me } from "./scopes-B0kGvAnI.js";
2
- import { a as Ne, c as Pe, i as Fe, n as Ie, o as Le, r as Re, s as ze, t as Be } from "./serverErrorBus-BeN9pOpY.js";
3
- import { Context as Ve, Layer as He, Schema as f } from "effect";
4
- import { Rpc as p } from "@effect/rpc";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as ee, L as te, M as ne, N as c, O as re, P as ie, R as ae, S as oe, T as se, U as ce, V as le, W as ue, _ as de, a as l, b as fe, c as pe, d as me, f as he, g as ge, h as u, i as _e, j as ve, k as ye, l as be, m as xe, n as Se, o as Ce, p as we, r as Te, s as Ee, t as De, u as Oe, v as d, w as ke, x as Ae, y as je, z as Me } from "./scopes-D9t3tYc7.js";
2
+ import { a as Ne, c as Pe, i as f, l as Fe, n as Ie, o as Le, r as Re, s as ze, t as Be, u as Ve } from "./serverErrorBus-QQgyq6fV.js";
3
+ import { Context as He, Layer as Ue, Schema as p } from "effect";
4
+ import { Rpc as m } from "@effect/rpc";
5
+ import { VersionConflict as We } from "@voltro/database/wire";
5
6
  //#region src/rowPatch.ts
6
- var Ue = f.Union(f.String, f.Number), m = f.Record({
7
- key: f.String,
8
- value: f.Unknown
9
- }).pipe(f.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), h = f.Union(f.Struct({
10
- op: f.Literal("add"),
11
- path: f.String,
12
- value: m
13
- }), f.Struct({
14
- op: f.Literal("replace"),
15
- path: f.String,
16
- value: m
17
- }), f.Struct({
18
- op: f.Literal("remove"),
19
- path: f.String
20
- }), f.Struct({
21
- op: f.Literal("mergeCells"),
22
- path: f.String,
23
- value: f.Record({
24
- key: f.String,
25
- value: f.Unknown
7
+ var Ge = p.Union(p.String, p.Number), h = p.Record({
8
+ key: p.String,
9
+ value: p.Unknown
10
+ }).pipe(p.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), g = p.Union(p.Struct({
11
+ op: p.Literal("add"),
12
+ path: p.String,
13
+ value: h
14
+ }), p.Struct({
15
+ op: p.Literal("replace"),
16
+ path: p.String,
17
+ value: h
18
+ }), p.Struct({
19
+ op: p.Literal("remove"),
20
+ path: p.String
21
+ }), p.Struct({
22
+ op: p.Literal("mergeCells"),
23
+ path: p.String,
24
+ value: p.Record({
25
+ key: p.String,
26
+ value: p.Unknown
26
27
  })
27
- })), We = f.Struct({
28
- ops: f.Array(h),
29
- order: f.Array(Ue)
30
- }), g = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, Ge = (e) => (e.startsWith("/") ? e.slice(1) : e).replace(/~1/g, "/").replace(/~0/g, "~"), _ = (e) => {
28
+ })), _ = p.Struct({
29
+ ops: p.Array(g),
30
+ order: p.Array(Ge)
31
+ }), v = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, y = (e) => (e.startsWith("/") ? e.slice(1) : e).replace(/~1/g, "/").replace(/~0/g, "~"), b = (e) => {
31
32
  let t = Object.keys(e).sort(), n = {};
32
33
  for (let r of t) n[r] = e[r];
33
34
  return JSON.stringify(n);
34
- }, v = (e, t) => _(e) === _(t), Ke = (e, t) => {
35
+ }, x = (e, t) => b(e) === b(t), Ke = (e, t) => {
35
36
  if (e instanceof Uint8Array && t instanceof Uint8Array) {
36
37
  if (e.length !== t.length) return !1;
37
38
  for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
38
39
  return !0;
39
40
  }
40
- return _({
41
+ return b({
41
42
  id: 0,
42
43
  v: e
43
- }) === _({
44
+ }) === b({
44
45
  id: 0,
45
46
  v: t
46
47
  });
@@ -69,29 +70,29 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
69
70
  let t = r.get(e.id);
70
71
  if (t === void 0) i.push({
71
72
  op: "add",
72
- path: g(e.id),
73
+ path: v(e.id),
73
74
  value: e
74
75
  });
75
- else if (!v(t, e)) {
76
+ else if (!x(t, e)) {
76
77
  let n = ee(t, e);
77
78
  n === void 0 ? i.push({
78
79
  op: "replace",
79
- path: g(e.id),
80
+ path: v(e.id),
80
81
  value: e
81
- }) : (v(Object.fromEntries(Object.entries(t).filter(([e]) => !s.columns.has(e))), n.scalars) || i.push({
82
+ }) : (x(Object.fromEntries(Object.entries(t).filter(([e]) => !s.columns.has(e))), n.scalars) || i.push({
82
83
  op: "replace",
83
- path: g(e.id),
84
+ path: v(e.id),
84
85
  value: n.scalars
85
86
  }), i.push({
86
87
  op: "mergeCells",
87
- path: g(e.id),
88
+ path: v(e.id),
88
89
  value: n.merges
89
90
  }));
90
91
  }
91
92
  }
92
93
  for (let t of e) o.has(t.id) || i.push({
93
94
  op: "remove",
94
- path: g(t.id)
95
+ path: v(t.id)
95
96
  });
96
97
  return {
97
98
  ops: i,
@@ -105,7 +106,7 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
105
106
  for (let t of e) r.set(t.id, t);
106
107
  for (let e of t.ops) {
107
108
  if (e.op === "mergeCells") {
108
- let t = Ge(e.path), i = r.get(t) ?? r.get(Number(t)), a = r.has(t) ? t : Number(t);
109
+ let t = y(e.path), i = r.get(t) ?? r.get(Number(t)), a = r.has(t) ? t : Number(t);
109
110
  if (i === void 0) continue;
110
111
  let o = { ...i };
111
112
  for (let [t, r] of Object.entries(e.value)) o[t] = n.mergeCell === void 0 ? r : n.mergeCell(t, i[t], r);
@@ -120,56 +121,56 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
120
121
  t !== void 0 && i.push(t);
121
122
  }
122
123
  return i;
123
- }, y = (e) => f.Union(f.Struct({
124
- _tag: f.Literal("snapshot"),
125
- revision: f.Number,
124
+ }, S = (e) => p.Union(p.Struct({
125
+ _tag: p.Literal("snapshot"),
126
+ revision: p.Number,
126
127
  data: e,
127
- computed: f.optional(f.Boolean)
128
- }), f.Struct({
129
- _tag: f.Literal("delta"),
130
- revision: f.Number,
131
- emittedAt: f.Number,
132
- patch: We
133
- }), f.Struct({
134
- _tag: f.Literal("error"),
135
- error: f.Unknown,
136
- revision: f.optional(f.Number)
137
- })), b = (e, t) => {
128
+ computed: p.optional(p.Boolean)
129
+ }), p.Struct({
130
+ _tag: p.Literal("delta"),
131
+ revision: p.Number,
132
+ emittedAt: p.Number,
133
+ patch: _
134
+ }), p.Struct({
135
+ _tag: p.Literal("error"),
136
+ error: p.Unknown,
137
+ revision: p.optional(p.Number)
138
+ })), C = (e, t) => {
138
139
  let n = `${e ?? "this procedure"} input`;
139
140
  return t === !0 ? `${n} (guarded — the guard did NOT run: the payload failed to decode first, so this says nothing about access)` : n;
140
141
  }, Xe = (e) => {
141
142
  let t = e.ast;
142
143
  return t._tag === "TypeLiteral" && (t.propertySignatures?.length ?? 0) === 0 && (t.indexSignatures?.length ?? 0) === 0;
143
- }, x = (e, t, n) => {
144
- let r = b(t, n), i = e.annotations({
144
+ }, w = (e, t, n) => {
145
+ let r = C(t, n), i = e.annotations({
145
146
  parseOptions: { onExcessProperty: "error" },
146
147
  parseIssueTitle: () => r
147
148
  });
148
- return Xe(e) ? f.filter((e) => typeof e == "object" && e && Object.keys(e).length > 0 ? `this procedure declares no input; received: ${Object.keys(e).join(", ")}` : void 0)(i).annotations({ identifier: r }) : i;
149
- }, S = class extends f.TaggedError()("BusinessRuleViolation", {
150
- rule: f.String,
151
- params: f.optional(f.Record({
152
- key: f.String,
153
- value: f.Unknown
149
+ return Xe(e) ? p.filter((e) => typeof e == "object" && e && Object.keys(e).length > 0 ? `this procedure declares no input; received: ${Object.keys(e).join(", ")}` : void 0)(i).annotations({ identifier: r }) : i;
150
+ }, T = class extends p.TaggedError()("BusinessRuleViolation", {
151
+ rule: p.String,
152
+ params: p.optional(p.Record({
153
+ key: p.String,
154
+ value: p.Unknown
154
155
  })),
155
- field: f.optional(f.String),
156
- message: f.optional(f.String),
157
- severity: f.Literal("error", "warning")
158
- }) {}, C = f.Struct({
159
- field: f.String,
160
- message: f.String,
161
- params: f.optional(f.Record({
162
- key: f.String,
163
- value: f.Unknown
156
+ field: p.optional(p.String),
157
+ message: p.optional(p.String),
158
+ severity: p.Literal("error", "warning")
159
+ }) {}, E = p.Struct({
160
+ field: p.String,
161
+ message: p.String,
162
+ params: p.optional(p.Record({
163
+ key: p.String,
164
+ value: p.Unknown
164
165
  }))
165
- }), w = class extends f.TaggedError()("ValidationError", {
166
- field: f.String,
167
- message: f.String,
168
- params: f.optional(f.Record({
169
- key: f.String,
170
- value: f.Unknown
166
+ }), D = class extends p.TaggedError()("ValidationError", {
167
+ field: p.String,
168
+ message: p.String,
169
+ params: p.optional(p.Record({
170
+ key: p.String,
171
+ value: p.Unknown
171
172
  }))
172
- }) {}, Ze = class extends f.TaggedError()("ValidationErrors", { issues: f.Array(C).pipe(f.minItems(1)) }) {}, Qe = (e) => {
173
+ }) {}, O = class extends p.TaggedError()("ValidationErrors", { issues: p.Array(E).pipe(p.minItems(1)) }) {}, Ze = (e) => {
173
174
  if (typeof e != "object" || !e) return [];
174
175
  let t = e._tag;
175
176
  if (t === "ValidationError") {
@@ -195,69 +196,69 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
195
196
  }];
196
197
  }
197
198
  return [];
198
- }, $e = class extends f.TaggedError()("ApprovalRequired", {
199
- approvalId: f.String,
200
- procedure: f.String,
201
- expiresAt: f.String,
202
- requiredScopes: f.Array(f.String),
203
- reason: f.NullOr(f.String),
204
- created: f.Boolean
205
- }) {}, et = class extends f.TaggedError()("ApprovalNotFound", { approvalId: f.String }) {}, tt = class extends f.TaggedError()("ApprovalSelfApproval", {
206
- approvalId: f.String,
207
- subjectId: f.NullOr(f.String)
208
- }) {}, nt = class extends f.TaggedError()("ApprovalRejected", {
209
- approvalId: f.String,
210
- decidedBy: f.NullOr(f.String),
211
- note: f.NullOr(f.String)
212
- }) {}, T = class extends f.TaggedError()("ApprovalExpired", {
213
- approvalId: f.String,
214
- expiredAt: f.String
215
- }) {}, rt = class extends f.TaggedError()("ApprovalNotPending", {
216
- approvalId: f.String,
217
- status: f.String
218
- }) {}, it = class extends f.TaggedError()("ApprovalForbidden", {
219
- approvalId: f.String,
220
- required: f.NullOr(f.String),
221
- message: f.String
222
- }) {}, E = class extends f.TaggedError()("ApprovalUnavailable", {
223
- procedure: f.String,
224
- message: f.String
225
- }) {}, at = f.Union($e, nt, T, E), ot = f.Union(et, tt, T, rt, it, E), st = f.Struct({
226
- id: f.String,
227
- procedure: f.String,
228
- kind: f.Literal("mutation", "action"),
229
- requestedBy: f.NullOr(f.String),
230
- status: f.Literal("pending", "approved", "rejected", "expired", "consumed"),
231
- reason: f.NullOr(f.String),
232
- requiredScopes: f.Array(f.String),
233
- requestedAt: f.String,
234
- expiresAt: f.String,
235
- decidedBy: f.NullOr(f.String),
236
- decidedAt: f.NullOr(f.String),
237
- note: f.NullOr(f.String),
238
- relation: f.Literal("to-decide", "requested")
239
- }), D = "channel:", ct = Symbol.for("@voltro/protocol/reactivityChannels"), O = globalThis, k = O[ct] ?? (O[ct] = /* @__PURE__ */ new Map()), lt = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, ut = (e) => {
199
+ }, Qe = class extends p.TaggedError()("ApprovalRequired", {
200
+ approvalId: p.String,
201
+ procedure: p.String,
202
+ expiresAt: p.String,
203
+ requiredScopes: p.Array(p.String),
204
+ reason: p.NullOr(p.String),
205
+ created: p.Boolean
206
+ }) {}, $e = class extends p.TaggedError()("ApprovalNotFound", { approvalId: p.String }) {}, et = class extends p.TaggedError()("ApprovalSelfApproval", {
207
+ approvalId: p.String,
208
+ subjectId: p.NullOr(p.String)
209
+ }) {}, tt = class extends p.TaggedError()("ApprovalRejected", {
210
+ approvalId: p.String,
211
+ decidedBy: p.NullOr(p.String),
212
+ note: p.NullOr(p.String)
213
+ }) {}, k = class extends p.TaggedError()("ApprovalExpired", {
214
+ approvalId: p.String,
215
+ expiredAt: p.String
216
+ }) {}, nt = class extends p.TaggedError()("ApprovalNotPending", {
217
+ approvalId: p.String,
218
+ status: p.String
219
+ }) {}, rt = class extends p.TaggedError()("ApprovalForbidden", {
220
+ approvalId: p.String,
221
+ required: p.NullOr(p.String),
222
+ message: p.String
223
+ }) {}, A = class extends p.TaggedError()("ApprovalUnavailable", {
224
+ procedure: p.String,
225
+ message: p.String
226
+ }) {}, it = p.Union(Qe, tt, k, A), at = p.Union($e, et, k, nt, rt, A), ot = p.Struct({
227
+ id: p.String,
228
+ procedure: p.String,
229
+ kind: p.Literal("mutation", "action"),
230
+ requestedBy: p.NullOr(p.String),
231
+ status: p.Literal("pending", "approved", "rejected", "expired", "consumed"),
232
+ reason: p.NullOr(p.String),
233
+ requiredScopes: p.Array(p.String),
234
+ requestedAt: p.String,
235
+ expiresAt: p.String,
236
+ decidedBy: p.NullOr(p.String),
237
+ decidedAt: p.NullOr(p.String),
238
+ note: p.NullOr(p.String),
239
+ relation: p.Literal("to-decide", "requested")
240
+ }), j = "channel:", st = Symbol.for("@voltro/protocol/reactivityChannels"), ct = globalThis, M = ct[st] ?? (ct[st] = /* @__PURE__ */ new Map()), lt = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, ut = (e) => {
240
241
  if (!lt.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
241
242
  \`billing.usage\`. A \`:\` is refused because it is the namespace separator in
242
- the routing key (\`${D}<name>\`), and an uppercase letter is\n refused because a key that differs only by case reads as one channel and
243
+ the routing key (\`${j}<name>\`), and an uppercase letter is\n refused because a key that differs only by case reads as one channel and
243
244
  routes as two.`);
244
- let t = k.get(e);
245
+ let t = M.get(e);
245
246
  if (t !== void 0) return t;
246
- let n = `${D}${e}`, r = Object.freeze({
247
+ let n = `${j}${e}`, r = Object.freeze({
247
248
  kind: "reactivity-channel",
248
249
  name: e,
249
250
  key: n,
250
251
  toString: () => n
251
252
  });
252
- return k.set(e, r), r;
253
- }, A = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", j = (e) => e.startsWith(D), M = () => new Set([...k.values()].map((e) => e.key)), N = (e) => A(e) ? e.key : e, P = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(N) : [N(e)], F = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(N) : N(e), dt = (e) => {
254
- let t = M(), n = [];
255
- for (let r of e) for (let e of P(r.source)) !j(e) || t.has(e) || n.push({
253
+ return M.set(e, r), r;
254
+ }, dt = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", ft = (e) => e.startsWith(j), pt = () => new Set([...M.values()].map((e) => e.key)), N = (e) => dt(e) ? e.key : e, mt = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(N) : [N(e)], ht = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(N) : N(e), gt = (e) => {
255
+ let t = pt(), n = [];
256
+ for (let r of e) for (let e of mt(r.source)) !ft(e) || t.has(e) || n.push({
256
257
  procedure: r.name,
257
258
  key: e
258
259
  });
259
260
  return n;
260
- }, ft = (e, t) => {
261
+ }, _t = (e, t) => {
261
262
  let n = e?.injectExternalChange;
262
263
  return n !== void 0 && (n.call(e, {
263
264
  table: t.key,
@@ -266,8 +267,8 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
266
267
  old: {},
267
268
  origin: "inline"
268
269
  }), !0);
269
- }, pt = (e) => e.internal !== !0, I = (e) => {
270
- if (mt(e), Array.isArray(e.guards) && e.guards.length === 0) throw Error(`${e.name}: \`guards: []\` is empty, so it enforces nothing — but it reads\n at the call site as if this procedure were protected. Omit the field for an
270
+ }, vt = (e) => e.internal !== !0, P = (e) => {
271
+ if (yt(e), Array.isArray(e.guards) && e.guards.length === 0) throw Error(`${e.name}: \`guards: []\` is empty, so it enforces nothing — but it reads\n at the call site as if this procedure were protected. Omit the field for an
271
272
  unguarded procedure, or list the scopes required to call it.`);
272
273
  let t = typeof e.source == "string" ? [e.source] : Array.isArray(e.source) ? e.source : void 0;
273
274
  if (t !== void 0 && (t.length === 0 || t.some((e) => String(e).trim() === ""))) throw Error(`${e.name}: \`source\` is empty, so this query declares reactivity and\n subscribes to nothing — it serves one snapshot and never updates again,
@@ -284,7 +285,7 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
284
285
  let n = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
285
286
  if (n.length === 0) return e;
286
287
  throw Error(`${e.name}: \`internal: true\` cannot be combined with ${n.map((e) => `\`${e}\``).join(" or ")}. \`internal\` takes the procedure OFF the wire; those put it back ON a different one (${n.includes("publicApi") ? "a REST route" : "an agent tool"}), and that surface is projected without consulting the flag — so the procedure would be unreachable from your client and reachable from the internet. Drop \`internal: true\` if the wider surface is intended, or remove the ${n.join(" / ")} annotation if it is not.`);
287
- }, mt = (e) => {
288
+ }, yt = (e) => {
288
289
  let t = e.requiresApproval;
289
290
  if (t !== void 0) {
290
291
  if (!Array.isArray(t.approvers) || t.approvers.length === 0) throw Error(`${e.name}: \`requiresApproval.approvers\` is empty, so NOBODY can approve this\n procedure and every call would park forever. Name the scope(s) an approver must hold
@@ -294,48 +295,48 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
294
295
  human from every other, and the second-pair-of-eyes control would enforce nothing.
295
296
  Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
296
297
  }
297
- }, ht = (e) => e.action !== void 0 && e.resourceType !== void 0, gt = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, L = (e, t, n) => {
298
+ }, bt = (e) => e.action !== void 0 && e.resourceType !== void 0, xt = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, F = (e, t, n) => {
298
299
  if (n === void 0) return t;
299
300
  if (n.trim() === "") throw Error(`${e}: \`openAccess\` needs a REASON, not an empty string. It is the sentence a\n reviewer reads to decide whether this procedure should really be callable
300
301
  without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
301
302
  if (t !== void 0 && t.length > 0) throw Error(`${e}: \`openAccess\` and \`guards\` are two different access decisions, so\n declaring both says the procedure is protected AND open. Keep the guards if a
302
303
  caller must hold a scope; drop them if anyone may call it.`);
303
304
  return [d(n.trim())];
304
- }, R = (e) => I({
305
+ }, I = (e) => P({
305
306
  kind: "query",
306
307
  name: e.name,
307
308
  input: e.input,
308
309
  output: e.output,
309
- error: e.error ?? f.Never,
310
- source: F(e.source),
310
+ error: e.error ?? p.Never,
311
+ source: ht(e.source),
311
312
  cache: e.cache,
312
- guards: L(e.name, e.guards, e.openAccess),
313
+ guards: F(e.name, e.guards, e.openAccess),
313
314
  openAccess: e.openAccess,
314
315
  publicApi: e.publicApi,
315
316
  exposeAsTool: e.exposeAsTool,
316
317
  internal: e.internal,
317
318
  overridesPlugin: e.overridesPlugin
318
- }), z = (e) => I({
319
+ }), L = (e) => P({
319
320
  kind: "mutation",
320
321
  name: e.name,
321
322
  input: e.input,
322
323
  output: e.output,
323
- error: e.error ?? f.Never,
324
+ error: e.error ?? p.Never,
324
325
  target: e.target,
325
- guards: L(e.name, e.guards, e.openAccess),
326
+ guards: F(e.name, e.guards, e.openAccess),
326
327
  openAccess: e.openAccess,
327
328
  publicApi: e.publicApi,
328
329
  exposeAsTool: e.exposeAsTool,
329
330
  requiresApproval: e.requiresApproval,
330
331
  internal: e.internal,
331
332
  overridesPlugin: e.overridesPlugin
332
- }), B = (e) => I({
333
+ }), R = (e) => P({
333
334
  kind: "action",
334
335
  name: e.name,
335
336
  input: e.input,
336
337
  output: e.output,
337
- error: e.error ?? f.Never,
338
- guards: L(e.name, e.guards, e.openAccess),
338
+ error: e.error ?? p.Never,
339
+ guards: F(e.name, e.guards, e.openAccess),
339
340
  openAccess: e.openAccess,
340
341
  source: e.source,
341
342
  target: e.target,
@@ -344,53 +345,53 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
344
345
  requiresApproval: e.requiresApproval,
345
346
  internal: e.internal,
346
347
  overridesPlugin: e.overridesPlugin
347
- }), _t = (e) => I({
348
+ }), St = (e) => P({
348
349
  kind: "stream",
349
350
  name: e.name,
350
351
  input: e.input,
351
352
  element: e.element,
352
- error: e.error ?? f.Never,
353
+ error: e.error ?? p.Never,
353
354
  internal: e.internal,
354
355
  overridesPlugin: e.overridesPlugin,
355
- guards: L(e.name, e.guards, e.openAccess),
356
+ guards: F(e.name, e.guards, e.openAccess),
356
357
  openAccess: e.openAccess
357
- }), V = (e, t) => t && t.length > 0 ? f.Union(e, ...t) : e, H = (e) => e !== void 0 && e.some((e) => !u(e)), vt = (e, t) => H(t) ? f.Union(e, l, c) : e, yt = (e) => f.Union(e, S), bt = (e) => f.Union(e, w, Ze), xt = (e, t) => t === void 0 ? e : f.Union(e, at), U = (e, t) => {
358
+ }), z = (e, t) => t && t.length > 0 ? p.Union(e, ...t) : e, B = (e) => e !== void 0 && e.some((e) => !u(e)), Ct = (e, t) => B(t) ? p.Union(e, l, c) : e, wt = (e) => p.Union(e, T), Tt = (e) => p.Union(e, D, O), Et = (e, t) => t === void 0 ? e : p.Union(e, it), V = (e, t) => {
358
359
  if (t === "stream") return e.error;
359
- let n = vt(e.error, e.guards);
360
- return t === "query" ? n : xt(bt(t === "mutation" ? yt(n) : n), e.requiresApproval);
361
- }, St = (e, t) => ({
360
+ let n = Ct(e.error, e.guards);
361
+ return t === "query" ? n : Et(Tt(t === "mutation" ? p.Union(wt(n), f, We) : n), e.requiresApproval);
362
+ }, Dt = (e, t) => z(Ct(e.errorSchema, e.guards), t), Ot = (e, t) => ({
362
363
  ...e,
363
364
  name: t
364
- }), Ct = (e, t) => p.make(e.name, {
365
- payload: x(e.input, e.name, H(e.guards)),
366
- success: y(e.output),
367
- error: V(U(e, "query"), t),
365
+ }), kt = (e, t) => m.make(e.name, {
366
+ payload: w(e.input, e.name, B(e.guards)),
367
+ success: S(e.output),
368
+ error: z(V(e, "query"), t),
368
369
  stream: !0
369
- }), wt = (e, t) => p.make(e.name, {
370
- payload: x(e.input, e.name, H(e.guards)),
370
+ }), At = (e, t) => m.make(e.name, {
371
+ payload: w(e.input, e.name, B(e.guards)),
371
372
  success: e.output,
372
- error: V(U(e, "mutation"), t)
373
- }), Tt = (e, t) => p.make(e.name, {
374
- payload: x(e.input, e.name, H(e.guards)),
373
+ error: z(V(e, "mutation"), t)
374
+ }), jt = (e, t) => m.make(e.name, {
375
+ payload: w(e.input, e.name, B(e.guards)),
375
376
  success: e.output,
376
- error: V(U(e, "action"), t)
377
- }), Et = (e, t) => p.make(e.name, {
378
- payload: x(e.input, e.name, H(e.guards)),
377
+ error: z(V(e, "action"), t)
378
+ }), Mt = (e, t) => m.make(e.name, {
379
+ payload: w(e.input, e.name, B(e.guards)),
379
380
  success: e.element,
380
- error: V(e.error, t),
381
+ error: z(e.error, t),
381
382
  stream: !0
382
- }), Dt = (e) => {
383
+ }), Nt = (e) => {
383
384
  if (typeof e != "object" || !e) return;
384
385
  let t = e._tag;
385
386
  return typeof t == "string" ? t : void 0;
386
- }, Ot = (e) => {
387
+ }, Pt = (e) => {
387
388
  switch (e.kind) {
388
- case "query": return Ct(e);
389
- case "mutation": return wt(e);
390
- case "action": return Tt(e);
391
- case "stream": return Et(e);
389
+ case "query": return kt(e);
390
+ case "mutation": return At(e);
391
+ case "action": return jt(e);
392
+ case "stream": return Mt(e);
392
393
  }
393
- }, kt = (e) => {
394
+ }, Ft = (e) => {
394
395
  let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
395
396
  if (e.kind === "query") return {
396
397
  kind: "query",
@@ -432,7 +433,7 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
432
433
  ..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
433
434
  }))
434
435
  };
435
- }, At = 7500, jt = (e) => typeof e == "object" && !!e && e.kind === "event", Mt = (e) => {
436
+ }, It = 7500, Lt = (e) => typeof e == "object" && !!e && e.kind === "event", Rt = (e) => {
436
437
  if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
437
438
  if (/\s/.test(e.name)) throw Error(`defineEvent("${e.name}"): \`name\` must not contain whitespace.\n The name is used as a broker subject segment. NATS refuses a subject with
438
439
  whitespace and delivers nothing — silently, and only on that broker, so an
@@ -467,67 +468,108 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
467
468
  webhook: e.webhook,
468
469
  delivery: e.delivery
469
470
  };
470
- }, Nt = (e) => f.Struct({
471
- _tag: f.Literal("event"),
472
- origin: f.String,
473
- n: f.Number,
474
- emittedAt: f.Number,
471
+ }, zt = (e) => p.Struct({
472
+ _tag: p.Literal("event"),
473
+ origin: p.String,
474
+ n: p.Number,
475
+ emittedAt: p.Number,
475
476
  payload: e
476
- }), Pt = f.Struct({
477
- _tag: f.Literal("gap"),
478
- missed: f.Number,
479
- reason: f.Literal("buffer", "resume")
480
- }), Ft = f.Struct({ _tag: f.Literal("attached") }), It = (e) => f.Union(Ft, Nt(e), Pt), Lt = f.Struct({
481
- origin: f.String,
482
- n: f.Number
483
- }), Rt = (e) => f.Struct({
477
+ }), Bt = p.Struct({
478
+ _tag: p.Literal("gap"),
479
+ missed: p.Number,
480
+ reason: p.Literal("buffer", "resume")
481
+ }), Vt = p.Struct({ _tag: p.Literal("attached") }), Ht = (e) => p.Union(Vt, zt(e), Bt), Ut = p.Struct({
482
+ origin: p.String,
483
+ n: p.Number
484
+ }), Wt = (e) => p.Struct({
484
485
  key: e,
485
- resume: f.optional(f.Array(Lt))
486
- }), zt = (e, t) => {
487
- let n = e.guards !== void 0 && e.guards.some((e) => !u(e)) ? f.Union(l, c) : f.Never, r = t && t.length > 0 ? f.Union(n, ...t) : n;
488
- return p.make(e.name, {
489
- payload: x(Rt(e.key), e.name, H(e.guards)),
490
- success: It(e.payload),
486
+ resume: p.optional(p.Array(Ut))
487
+ }), Gt = (e, t) => {
488
+ let n = e.guards !== void 0 && e.guards.some((e) => !u(e)) ? p.Union(l, c) : p.Never, r = t && t.length > 0 ? p.Union(n, ...t) : n;
489
+ return m.make(e.name, {
490
+ payload: w(Wt(e.key), e.name, B(e.guards)),
491
+ success: Ht(e.payload),
491
492
  error: r,
492
493
  stream: !0
493
494
  });
494
- }, Bt = class extends f.TaggedError()("EventPayloadInvalid", {
495
- event: f.String,
496
- message: f.String
497
- }) {}, Vt = class extends f.TaggedError()("EventKeyInvalid", {
498
- event: f.String,
499
- message: f.String
500
- }) {}, Ht = class extends f.TaggedError()("EventPayloadTooLarge", {
501
- event: f.String,
502
- bytes: f.Number,
503
- limit: f.Number
504
- }) {}, Ut = (e) => {
495
+ }, Kt = class extends p.TaggedError()("EventPayloadInvalid", {
496
+ event: p.String,
497
+ message: p.String
498
+ }) {}, qt = class extends p.TaggedError()("EventKeyInvalid", {
499
+ event: p.String,
500
+ message: p.String
501
+ }) {}, Jt = class extends p.TaggedError()("EventPayloadTooLarge", {
502
+ event: p.String,
503
+ bytes: p.Number,
504
+ limit: p.Number
505
+ }) {}, Yt = (e) => {
505
506
  if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
506
507
  let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
507
508
  return JSON.stringify(t);
508
- }, Wt = "\0", Gt = (e, t, n) => [
509
+ }, Xt = "\0", Zt = (e, t, n) => [
509
510
  e ?? "~",
510
511
  t,
511
- Ut(n)
512
- ].join("\0"), Kt = (e) => {
512
+ Yt(n)
513
+ ].join("\0"), Qt = (e) => {
513
514
  let [t = "~", n = "", r = ""] = e.split("\0");
514
515
  return {
515
516
  tenantId: t === "~" ? null : t,
516
517
  event: n,
517
518
  key: r
518
519
  };
519
- }, qt = (e) => e.split("\0").join(" · "), Jt = (e) => e, Yt = (e) => e, Xt = (e) => {
520
+ }, $t = (e) => e.split("\0").join(" · "), H = Symbol.for("@voltro/protocol/workflow-access"), en = {
521
+ guards: void 0,
522
+ openAccess: void 0,
523
+ internal: !1
524
+ }, tn = (e, t) => {
525
+ let n = t.guards;
526
+ if (n !== void 0 && n.length === 0) throw Error(`workflow("${e}"): \`guards: []\` is empty, so it enforces nothing —\n but it reads at the call site as if the start were protected. Omit the field
527
+ and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
528
+ if (t.openAccess !== void 0) {
529
+ if (t.openAccess.trim() === "") throw Error(`workflow("${e}"): \`openAccess\` needs a REASON, not an empty string. It is\n the sentence a reviewer reads to decide whether anyone should really be able to
530
+ start durable work without an authorization check — e.g. \`openAccess: 'public
531
+ newsletter signup; the payload carries only the address being confirmed'\`.`);
532
+ if (n !== void 0 && n.length > 0) throw Error(`workflow("${e}"): \`openAccess\` and \`guards\` are two different access\n decisions, so declaring both says the start is protected AND open. Keep the
533
+ guards if a caller must hold a scope; drop them if anyone may start it.`);
534
+ if (t.internal === !0) throw Error(`workflow("${e}"): \`internal: true\` cannot be combined with \`openAccess\`.\n \`internal\` takes the start OFF the wire, and \`openAccess\` declares who may
535
+ start it over the wire — a decision about a door that does not exist. Drop
536
+ \`openAccess\` (an internal workflow needs no wire decision), or drop
537
+ \`internal: true\` if the workflow really is meant to be startable by clients.`);
538
+ }
539
+ return {
540
+ guards: t.openAccess === void 0 ? t.guards : [d(t.openAccess.trim())],
541
+ openAccess: t.openAccess?.trim(),
542
+ internal: t.internal === !0
543
+ };
544
+ }, nn = (e, t) => {
545
+ Object.defineProperty(e, H, {
546
+ value: t,
547
+ enumerable: !1
548
+ });
549
+ }, U = (e) => {
550
+ if (typeof e != "object" || !e) return en;
551
+ let t = e[H];
552
+ return t === void 0 ? en : t;
553
+ }, rn = (e) => {
554
+ let t = U(e);
555
+ return {
556
+ name: e.name,
557
+ internal: t.internal,
558
+ guards: t.guards,
559
+ openAccess: t.openAccess
560
+ };
561
+ }, an = (e) => e, on = (e) => e, sn = (e) => {
520
562
  let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
521
563
  return n !== void 0 && n !== "" ? `${r}#${n}` : r;
522
- }, Zt = (e) => {
564
+ }, cn = (e) => {
523
565
  if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
524
- }, Qt = (e, t) => {
525
- let n = Ve.GenericTag(e);
566
+ }, ln = (e, t) => {
567
+ let n = He.GenericTag(e);
526
568
  return {
527
569
  Tag: n,
528
- Live: He.succeed(n, t)
570
+ Live: Ue.succeed(n, t)
529
571
  };
530
- }, $t = (e, t, n) => {
572
+ }, un = (e, t, n) => {
531
573
  if (!t) return { ok: !0 };
532
574
  let r = n === void 0 ? null : W(n);
533
575
  if (!r) return {
@@ -537,7 +579,7 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
537
579
  let i = t.trim();
538
580
  if (i === "*" || i === "") return { ok: !0 };
539
581
  let a = i.split(/\s+/).filter((e) => e.length > 0);
540
- for (let i of a) if (!en(i, r)) return {
582
+ for (let i of a) if (!dn(i, r)) return {
541
583
  ok: !1,
542
584
  reason: `plugin "${e}" requires framework ${t}, running ${n}`
543
585
  };
@@ -550,7 +592,7 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
550
592
  patch: Number(t[3]),
551
593
  pre: t[4] ?? ""
552
594
  } : null;
553
- }, G = (e, t) => e.major === t.major ? e.minor === t.minor ? e.patch === t.patch ? e.pre && !t.pre ? -1 : !e.pre && t.pre ? 1 : e.pre && t.pre ? e.pre < t.pre ? -1 : +(e.pre > t.pre) : 0 : e.patch - t.patch : e.minor - t.minor : e.major - t.major, en = (e, t) => {
595
+ }, G = (e, t) => e.major === t.major ? e.minor === t.minor ? e.patch === t.patch ? e.pre && !t.pre ? -1 : !e.pre && t.pre ? 1 : e.pre && t.pre ? e.pre < t.pre ? -1 : +(e.pre > t.pre) : 0 : e.patch - t.patch : e.minor - t.minor : e.major - t.major, dn = (e, t) => {
554
596
  if (e === "*") return !0;
555
597
  if (e.startsWith("^")) {
556
598
  let n = W(e.slice(1));
@@ -572,234 +614,244 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
572
614
  }
573
615
  let r = W(e);
574
616
  return r ? G(t, r) === 0 : !1;
575
- }, tn = (e) => {
617
+ }, fn = (e) => {
576
618
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
577
619
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
578
- }, nn = (e) => {
620
+ }, pn = (e) => {
579
621
  let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
580
622
  return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
581
- }, rn = Symbol.for("@voltro/protocol/pluginAliases"), K = () => {
582
- let e = globalThis, t = e[rn];
623
+ }, mn = Symbol.for("@voltro/protocol/pluginAliases"), K = () => {
624
+ let e = globalThis, t = e[mn];
583
625
  if (t instanceof Map) return t;
584
626
  let n = /* @__PURE__ */ new Map();
585
- return e[rn] = n, n;
586
- }, an = (e) => {
627
+ return e[mn] = n, n;
628
+ }, hn = (e) => {
587
629
  let t = K();
588
630
  for (let [n, r] of Object.entries(e)) {
589
631
  if (r === "") continue;
590
632
  let e = t.get(n);
591
633
  e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
592
634
  }
593
- }, on = () => {
635
+ }, gn = () => {
594
636
  K().clear();
595
- }, sn = (e, t) => {
637
+ }, _n = (e, t) => {
596
638
  let n = K().get(e);
597
- if (n === void 0 || n.size === 0) return `${tn(e)}.${t}`;
639
+ if (n === void 0 || n.size === 0) return `${fn(e)}.${t}`;
598
640
  if (n.size === 1) return `${[...n][0]}.${t}`;
599
641
  let r = [...n].filter((e) => !e.includes("#"));
600
642
  if (r.length === 1) return `${r[0]}.${t}`;
601
643
  throw Error(`[voltro] ${e} is installed more than once (${[...n].sort().join(", ")}) and no single install is the primary one, so a plugin hook cannot tell which of them it addresses. Call the route by its full tag instead — e.g. useSubscription(api, '${[...n].sort()[0]}.${t}').`);
602
- }, q = f.Literal("running", "succeeded", "failed", "cancelled", "suspended"), cn = f.Literal("cancel", "terminate", "abandon"), ln = f.Struct({
603
- mode: f.String,
604
- dueAt: f.NullOr(f.Number),
605
- retryAfterMs: f.NullOr(f.Number),
606
- intentId: f.NullOr(f.String)
607
- }), un = f.Struct({
608
- id: f.String,
609
- workflowName: f.String,
610
- executionId: f.NullOr(f.String),
611
- status: f.Literal("running", "queued", "dropped", "skipped"),
612
- deferral: f.optional(ln)
613
- }), J = f.Struct({
614
- id: f.String,
615
- tag: f.String,
616
- executionId: f.String,
644
+ }, q = p.Literal("running", "succeeded", "failed", "cancelled", "suspended"), vn = p.Literal("cancel", "terminate", "abandon"), yn = p.Struct({
645
+ mode: p.String,
646
+ dueAt: p.NullOr(p.Number),
647
+ retryAfterMs: p.NullOr(p.Number),
648
+ intentId: p.NullOr(p.String)
649
+ }), bn = p.Struct({
650
+ id: p.String,
651
+ workflowName: p.String,
652
+ executionId: p.NullOr(p.String),
653
+ status: p.Literal("running", "queued", "dropped", "skipped", "replayed"),
654
+ deferral: p.optional(yn)
655
+ }), xn = (e, t) => {
656
+ let n = U(e);
657
+ return m.make(e.name, {
658
+ payload: w(e.payloadSchema, e.name, B(n.guards)),
659
+ success: bn,
660
+ error: Dt({
661
+ errorSchema: e.errorSchema,
662
+ guards: n.guards
663
+ }, t)
664
+ });
665
+ }, J = p.Struct({
666
+ id: p.String,
667
+ tag: p.String,
668
+ executionId: p.String,
617
669
  status: q,
618
- payload: f.Unknown,
619
- workflowVersion: f.NullOr(f.String),
620
- workflowPatches: f.NullOr(f.Unknown),
621
- output: f.NullOr(f.Unknown),
622
- subject: f.NullOr(f.Unknown),
623
- source: f.NullOr(f.String),
624
- errorTag: f.NullOr(f.String),
625
- errorMessage: f.NullOr(f.String),
626
- cancelled: f.Boolean,
627
- startedAt: f.Date,
628
- completedAt: f.NullOr(f.Date),
629
- durationMs: f.NullOr(f.Number),
630
- traceId: f.NullOr(f.String),
631
- parentExecutionId: f.NullOr(f.String),
632
- parentClosePolicy: f.NullOr(cn)
633
- }), dn = f.Struct({
634
- tag: f.optional(f.String),
635
- status: f.optional(q),
636
- limit: f.optional(f.Number)
637
- }), fn = f.Struct({
638
- id: f.String,
639
- runId: f.String,
640
- stepName: f.String,
641
- attempt: f.Number,
642
- status: f.Literal("running", "succeeded", "failed"),
643
- input: f.NullOr(f.Unknown),
644
- retryPolicy: f.NullOr(f.Unknown),
645
- output: f.NullOr(f.Unknown),
646
- errorTag: f.NullOr(f.String),
647
- errorMessage: f.NullOr(f.String),
648
- errorCause: f.NullOr(f.Unknown),
649
- startedAt: f.Date,
650
- completedAt: f.NullOr(f.Date),
651
- durationMs: f.NullOr(f.Number)
652
- }), pn = f.Struct({
653
- id: f.String,
654
- runId: f.String,
655
- eventType: f.String,
656
- payload: f.NullOr(f.Unknown),
657
- occurredAt: f.Date,
658
- stepName: f.NullOr(f.String),
659
- attempt: f.NullOr(f.Number)
660
- }), mn = f.Struct({
661
- id: f.String,
662
- name: f.String,
663
- payload: f.Unknown,
664
- source: f.String,
665
- subject: f.NullOr(f.Unknown),
666
- traceId: f.NullOr(f.String),
667
- occurredAt: f.Date
668
- }), hn = f.Struct({
669
- id: f.String,
670
- eventId: f.String,
671
- eventName: f.String,
672
- triggerId: f.String,
673
- workflowName: f.String,
674
- executionId: f.NullOr(f.String),
675
- status: f.Literal("starting", "started", "skipped", "failed"),
676
- idempotencyKey: f.String,
677
- skipped: f.Boolean,
678
- errorMessage: f.NullOr(f.String),
679
- createdAt: f.Date,
680
- completedAt: f.NullOr(f.Date)
681
- }), gn = f.Struct({ id: f.String }), Y = f.Struct({ runId: f.String }), _n = f.Struct({
682
- name: f.optional(f.String),
683
- limit: f.optional(f.Number)
684
- }), vn = f.Struct({ eventId: f.String }), X = f.Struct({
685
- workflowName: f.String,
686
- executionId: f.String
687
- }), yn = f.Struct({
688
- id: f.String,
689
- signalName: f.String,
690
- payload: f.optional(f.Unknown)
691
- }), bn = f.Struct({
692
- id: f.String,
693
- updateName: f.String,
694
- payload: f.optional(f.Unknown),
695
- timeoutMs: f.optional(f.Number)
696
- }), xn = f.Struct({
697
- eventId: f.String,
698
- updateId: f.String,
699
- completedEventId: f.String,
700
- result: f.Unknown
701
- }), Sn = R({
670
+ payload: p.Unknown,
671
+ workflowVersion: p.NullOr(p.String),
672
+ workflowPatches: p.NullOr(p.Unknown),
673
+ output: p.NullOr(p.Unknown),
674
+ subject: p.NullOr(p.Unknown),
675
+ source: p.NullOr(p.String),
676
+ errorTag: p.NullOr(p.String),
677
+ errorMessage: p.NullOr(p.String),
678
+ cancelled: p.Boolean,
679
+ startedAt: p.Date,
680
+ completedAt: p.NullOr(p.Date),
681
+ durationMs: p.NullOr(p.Number),
682
+ traceId: p.NullOr(p.String),
683
+ parentExecutionId: p.NullOr(p.String),
684
+ parentClosePolicy: p.NullOr(vn)
685
+ }), Sn = p.Struct({
686
+ tag: p.optional(p.String),
687
+ status: p.optional(q),
688
+ limit: p.optional(p.Number)
689
+ }), Cn = p.Struct({
690
+ id: p.String,
691
+ runId: p.String,
692
+ stepName: p.String,
693
+ attempt: p.Number,
694
+ status: p.Literal("running", "succeeded", "failed"),
695
+ input: p.NullOr(p.Unknown),
696
+ retryPolicy: p.NullOr(p.Unknown),
697
+ output: p.NullOr(p.Unknown),
698
+ errorTag: p.NullOr(p.String),
699
+ errorMessage: p.NullOr(p.String),
700
+ errorCause: p.NullOr(p.Unknown),
701
+ startedAt: p.Date,
702
+ completedAt: p.NullOr(p.Date),
703
+ durationMs: p.NullOr(p.Number)
704
+ }), wn = p.Struct({
705
+ id: p.String,
706
+ runId: p.String,
707
+ eventType: p.String,
708
+ payload: p.NullOr(p.Unknown),
709
+ occurredAt: p.Date,
710
+ stepName: p.NullOr(p.String),
711
+ attempt: p.NullOr(p.Number)
712
+ }), Tn = p.Struct({
713
+ id: p.String,
714
+ name: p.String,
715
+ payload: p.Unknown,
716
+ source: p.String,
717
+ subject: p.NullOr(p.Unknown),
718
+ traceId: p.NullOr(p.String),
719
+ occurredAt: p.Date
720
+ }), En = p.Struct({
721
+ id: p.String,
722
+ eventId: p.String,
723
+ eventName: p.String,
724
+ triggerId: p.String,
725
+ workflowName: p.String,
726
+ executionId: p.NullOr(p.String),
727
+ status: p.Literal("starting", "started", "skipped", "failed"),
728
+ idempotencyKey: p.String,
729
+ skipped: p.Boolean,
730
+ errorMessage: p.NullOr(p.String),
731
+ createdAt: p.Date,
732
+ completedAt: p.NullOr(p.Date)
733
+ }), Dn = p.Struct({ id: p.String }), Y = p.Struct({ runId: p.String }), On = p.Struct({
734
+ name: p.optional(p.String),
735
+ limit: p.optional(p.Number)
736
+ }), kn = p.Struct({ eventId: p.String }), X = p.Struct({
737
+ workflowName: p.String,
738
+ executionId: p.String
739
+ }), An = p.Struct({
740
+ id: p.String,
741
+ signalName: p.String,
742
+ payload: p.optional(p.Unknown)
743
+ }), jn = p.Struct({
744
+ id: p.String,
745
+ updateName: p.String,
746
+ payload: p.optional(p.Unknown),
747
+ timeoutMs: p.optional(p.Number)
748
+ }), Mn = p.Struct({
749
+ eventId: p.String,
750
+ updateId: p.String,
751
+ completedEventId: p.String,
752
+ result: p.Unknown
753
+ }), Nn = I({
702
754
  name: "__voltro.workflow.run",
703
755
  source: "_voltro_workflow_runs",
704
- input: gn,
705
- output: f.Array(J)
706
- }), Cn = R({
756
+ input: Dn,
757
+ output: p.Array(J)
758
+ }), Pn = I({
707
759
  name: "__voltro.workflow.runs",
708
760
  source: "_voltro_workflow_runs",
709
- input: dn,
710
- output: f.Array(J)
711
- }), wn = R({
761
+ input: Sn,
762
+ output: p.Array(J)
763
+ }), Fn = I({
712
764
  name: "__voltro.workflow.run.steps",
713
765
  source: "_voltro_workflow_run_steps",
714
766
  input: Y,
715
- output: f.Array(fn)
716
- }), Tn = R({
767
+ output: p.Array(Cn)
768
+ }), In = I({
717
769
  name: "__voltro.workflow.run.events",
718
770
  source: "_voltro_workflow_run_events",
719
771
  input: Y,
720
- output: f.Array(pn)
721
- }), En = R({
772
+ output: p.Array(wn)
773
+ }), Ln = I({
722
774
  name: "__voltro.workflow.domainEvents",
723
775
  source: "_voltro_workflow_events",
724
- input: _n,
725
- output: f.Array(mn)
726
- }), Dn = R({
776
+ input: On,
777
+ output: p.Array(Tn)
778
+ }), Rn = I({
727
779
  name: "__voltro.workflow.event.deliveries",
728
780
  source: "_voltro_workflow_event_deliveries",
729
- input: vn,
730
- output: f.Array(hn)
731
- }), On = B({
781
+ input: kn,
782
+ output: p.Array(En)
783
+ }), zn = R({
732
784
  name: "__voltro.workflow.cancel",
733
785
  input: X,
734
- output: f.Struct({ ok: f.Boolean })
735
- }), kn = B({
786
+ output: p.Struct({ ok: p.Boolean })
787
+ }), Bn = R({
736
788
  name: "__voltro.workflow.resume",
737
789
  input: X,
738
- output: f.Struct({ ok: f.Boolean })
739
- }), An = B({
790
+ output: p.Struct({ ok: p.Boolean })
791
+ }), Vn = R({
740
792
  name: "__voltro.workflow.signal",
741
- input: yn,
742
- output: f.Struct({ eventId: f.String })
743
- }), jn = B({
793
+ input: An,
794
+ output: p.Struct({ eventId: p.String })
795
+ }), Hn = R({
744
796
  name: "__voltro.workflow.update",
745
- input: bn,
746
- output: xn
747
- }), Mn = "__voltro.undo.log", Nn = "__voltro.undo.apply", Pn = "__voltro.undo.redo", Fn = f.Struct({
748
- id: f.String,
749
- tag: f.String,
750
- label: f.NullOr(f.String),
751
- undone: f.Boolean,
752
- crossesAction: f.Boolean,
753
- createdAt: f.String
754
- }), In = class extends f.TaggedError()("UndoNotFound", { invocationId: f.String }) {}, Ln = class extends f.TaggedError()("UndoForbidden", { invocationId: f.String }) {}, Rn = class extends f.TaggedError()("UndoConflict", {
755
- invocationId: f.String,
756
- reason: f.Literal("conflict", "action")
757
- }) {}, zn = f.Union(In, Ln, Rn), Bn = R({
758
- name: Mn,
797
+ input: jn,
798
+ output: Mn
799
+ }), Un = "__voltro.undo.log", Wn = "__voltro.undo.apply", Gn = "__voltro.undo.redo", Kn = p.Struct({
800
+ id: p.String,
801
+ tag: p.String,
802
+ label: p.NullOr(p.String),
803
+ undone: p.Boolean,
804
+ crossesAction: p.Boolean,
805
+ createdAt: p.String
806
+ }), qn = class extends p.TaggedError()("UndoNotFound", { invocationId: p.String }) {}, Jn = class extends p.TaggedError()("UndoForbidden", { invocationId: p.String }) {}, Yn = class extends p.TaggedError()("UndoConflict", {
807
+ invocationId: p.String,
808
+ reason: p.Literal("conflict", "action")
809
+ }) {}, Xn = p.Union(qn, Jn, Yn), Zn = I({
810
+ name: Un,
759
811
  source: "_voltro_undo_log",
760
- input: f.Struct({ limit: f.optional(f.Number) }),
761
- output: f.Array(Fn),
812
+ input: p.Struct({ limit: p.optional(p.Number) }),
813
+ output: p.Array(Kn),
762
814
  openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
763
- }), Vn = z({
764
- name: Nn,
765
- input: f.Struct({ invocationId: f.String }),
766
- output: f.Struct({ ok: f.Boolean }),
767
- error: zn,
815
+ }), Qn = L({
816
+ name: Wn,
817
+ input: p.Struct({ invocationId: p.String }),
818
+ output: p.Struct({ ok: p.Boolean }),
819
+ error: Xn,
768
820
  openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
769
- }), Hn = z({
770
- name: Pn,
771
- input: f.Struct({ invocationId: f.String }),
772
- output: f.Struct({ ok: f.Boolean }),
773
- error: zn,
821
+ }), $n = L({
822
+ name: Gn,
823
+ input: p.Struct({ invocationId: p.String }),
824
+ output: p.Struct({ ok: p.Boolean }),
825
+ error: Xn,
774
826
  openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
775
- }), Un = class extends f.TaggedError()("TenantScopeViolation", {
776
- table: f.String,
777
- reason: f.String
778
- }) {}, Wn = class extends f.TaggedError()("StoreOperationFailed", {
779
- operation: f.String,
780
- table: f.String,
781
- cause: f.String
782
- }) {}, Gn = class extends f.TaggedError()("TableValidationFailed", {
783
- table: f.String,
784
- summary: f.String,
785
- issues: f.Array(f.Struct({
786
- path: f.String,
787
- message: f.String
827
+ }), er = class extends p.TaggedError()("TenantScopeViolation", {
828
+ table: p.String,
829
+ reason: p.String
830
+ }) {}, tr = class extends p.TaggedError()("StoreOperationFailed", {
831
+ operation: p.String,
832
+ table: p.String,
833
+ cause: p.String
834
+ }) {}, nr = class extends p.TaggedError()("TableValidationFailed", {
835
+ table: p.String,
836
+ summary: p.String,
837
+ issues: p.Array(p.Struct({
838
+ path: p.String,
839
+ message: p.String
788
840
  }))
789
- }) {}, Kn = class extends f.TaggedError()("TenantRowNotFound", {
790
- table: f.String,
791
- id: f.String,
792
- reason: f.String
793
- }) {}, qn = class extends f.TaggedError()("ServerOnlyColumnWrite", {
794
- table: f.String,
795
- columns: f.Array(f.String)
796
- }) {}, Jn = class extends f.TaggedError()("ConstraintViolation", {
797
- kind: f.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
798
- table: f.String,
799
- operation: f.String,
800
- constraint: f.optional(f.String),
801
- column: f.optional(f.String),
802
- detail: f.optional(f.String)
841
+ }) {}, rr = class extends p.TaggedError()("TenantRowNotFound", {
842
+ table: p.String,
843
+ id: p.String,
844
+ reason: p.String
845
+ }) {}, ir = class extends p.TaggedError()("ServerOnlyColumnWrite", {
846
+ table: p.String,
847
+ columns: p.Array(p.String)
848
+ }) {}, ar = class extends p.TaggedError()("ConstraintViolation", {
849
+ kind: p.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
850
+ table: p.String,
851
+ operation: p.String,
852
+ constraint: p.optional(p.String),
853
+ column: p.optional(p.String),
854
+ detail: p.optional(p.String)
803
855
  }) {
804
856
  get message() {
805
857
  if (this.detail !== void 0) return this.detail;
@@ -812,85 +864,85 @@ var Ue = f.Union(f.String, f.Number), m = f.Record({
812
864
  case "check": return `check constraint ${t}: the row does not satisfy it`;
813
865
  }
814
866
  }
815
- }, Yn = "__voltro.approvals.pending", Xn = "__voltro.approvals.decide", Zn = R({
816
- name: Yn,
867
+ }, or = "__voltro.approvals.pending", sr = "__voltro.approvals.decide", cr = I({
868
+ name: or,
817
869
  source: "_voltro_approvals",
818
- input: f.Struct({ limit: f.optional(f.Number) }),
819
- output: f.Array(st),
870
+ input: p.Struct({ limit: p.optional(p.Number) }),
871
+ output: p.Array(ot),
820
872
  openAccess: "the answer is scoped to the caller — a row appears only if they requested it or hold its recorded approver scopes, so an anonymous caller sees nothing"
821
- }), Qn = z({
822
- name: Xn,
823
- input: f.Struct({
824
- approvalId: f.String,
825
- decision: f.Literal("approve", "reject"),
826
- note: f.optional(f.String)
873
+ }), lr = L({
874
+ name: sr,
875
+ input: p.Struct({
876
+ approvalId: p.String,
877
+ decision: p.Literal("approve", "reject"),
878
+ note: p.optional(p.String)
827
879
  }),
828
- output: f.Struct({
829
- approvalId: f.String,
830
- status: f.Literal("approved", "rejected")
880
+ output: p.Struct({
881
+ approvalId: p.String,
882
+ status: p.Literal("approved", "rejected")
831
883
  }),
832
- error: ot,
884
+ error: at,
833
885
  openAccess: "the approver authority is the PENDING ROW's own recorded scopes (plus an unconditional self-approval refusal), checked in-handler — a descriptor-level scope would have to be the union of every approval-requiring procedure in the app"
834
- }), $n = "__voltro.connections.list", er = "__voltro.connections.start", Z = "__voltro.connections.submitToken", tr = "__voltro.connections.disconnect", Q = f.Literal("oauth2", "pat"), nr = f.Literal("disconnected", "connected", "expired", "revoked", "error"), rr = f.Struct({
835
- connectionId: f.String,
886
+ }), Z = "__voltro.connections.list", ur = "__voltro.connections.start", dr = "__voltro.connections.submitToken", fr = "__voltro.connections.disconnect", Q = p.Literal("oauth2", "pat"), pr = p.Literal("disconnected", "connected", "expired", "revoked", "error"), mr = p.Struct({
887
+ connectionId: p.String,
836
888
  kind: Q,
837
- label: f.String,
838
- status: nr,
839
- accountId: f.NullOr(f.String),
840
- accountLabel: f.NullOr(f.String),
841
- scopes: f.Array(f.String),
842
- expiresAt: f.NullOr(f.String),
843
- lastError: f.NullOr(f.String),
844
- connectedAt: f.NullOr(f.String)
845
- }), ir = class extends f.TaggedError()("ConnectionNotDeclared", { connectionId: f.String }) {}, ar = class extends f.TaggedError()("ConnectionSubjectRequired", { connectionId: f.String }) {}, or = class extends f.TaggedError()("ConnectionKindMismatch", {
846
- connectionId: f.String,
889
+ label: p.String,
890
+ status: pr,
891
+ accountId: p.NullOr(p.String),
892
+ accountLabel: p.NullOr(p.String),
893
+ scopes: p.Array(p.String),
894
+ expiresAt: p.NullOr(p.String),
895
+ lastError: p.NullOr(p.String),
896
+ connectedAt: p.NullOr(p.String)
897
+ }), hr = class extends p.TaggedError()("ConnectionNotDeclared", { connectionId: p.String }) {}, gr = class extends p.TaggedError()("ConnectionSubjectRequired", { connectionId: p.String }) {}, _r = class extends p.TaggedError()("ConnectionKindMismatch", {
898
+ connectionId: p.String,
847
899
  expected: Q,
848
900
  actual: Q
849
- }) {}, sr = class extends f.TaggedError()("ConnectionHandshakeFailed", {
850
- connectionId: f.String,
851
- reason: f.String,
852
- transient: f.Boolean
853
- }) {}, $ = f.Union(ir, ar, or, sr), cr = R({
854
- name: $n,
901
+ }) {}, vr = class extends p.TaggedError()("ConnectionHandshakeFailed", {
902
+ connectionId: p.String,
903
+ reason: p.String,
904
+ transient: p.Boolean
905
+ }) {}, $ = p.Union(hr, gr, _r, vr), yr = I({
906
+ name: Z,
855
907
  source: "_voltro_connections",
856
- input: f.Struct({}),
857
- output: f.Array(rr),
908
+ input: p.Struct({}),
909
+ output: p.Array(mr),
858
910
  openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
859
- }), lr = B({
860
- name: er,
861
- input: f.Struct({
862
- connectionId: f.String,
863
- redirectTo: f.optional(f.String)
911
+ }), br = R({
912
+ name: ur,
913
+ input: p.Struct({
914
+ connectionId: p.String,
915
+ redirectTo: p.optional(p.String)
864
916
  }),
865
- output: f.Struct({
866
- authorizeUrl: f.String,
867
- state: f.String
917
+ output: p.Struct({
918
+ authorizeUrl: p.String,
919
+ state: p.String
868
920
  }),
869
921
  error: $,
870
922
  openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
871
- }), ur = z({
872
- name: Z,
873
- input: f.Struct({
874
- connectionId: f.String,
875
- token: f.String
923
+ }), xr = L({
924
+ name: dr,
925
+ input: p.Struct({
926
+ connectionId: p.String,
927
+ token: p.String
876
928
  }),
877
- output: f.Struct({ ok: f.Boolean }),
929
+ output: p.Struct({ ok: p.Boolean }),
878
930
  error: $,
879
931
  openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
880
- }), dr = z({
881
- name: tr,
882
- input: f.Struct({ connectionId: f.String }),
883
- output: f.Struct({ ok: f.Boolean }),
932
+ }), Sr = L({
933
+ name: fr,
934
+ input: p.Struct({ connectionId: p.String }),
935
+ output: p.Struct({ ok: p.Boolean }),
884
936
  error: $,
885
937
  openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
886
- }), fr = (e) => {
938
+ }), Cr = (e) => {
887
939
  let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
888
940
  return Number.isNaN(t) ? 0 : t;
889
- }, pr = 4001, mr = /* @__PURE__ */ new Set(["/rpc", "/ws"]), hr = (e) => {
941
+ }, wr = 4001, Tr = /* @__PURE__ */ new Set(["/rpc", "/ws"]), Er = (e) => {
890
942
  if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
891
- if (mr.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
943
+ if (Tr.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
892
944
  if (e.auth !== "subject" && e.auth !== "public") throw Error(`defineWebSocket: auth must be 'subject' or 'public' (explicitly — an unauthenticated socket has to be a decision somebody wrote down), got '${String(e.auth)}'`);
893
945
  return e;
894
- }, gr = 1;
946
+ }, Dr = 1;
895
947
  //#endregion
896
- export { De as ADMIN_SCOPE, Se as APIKEY_ISSUE_ORG_SCOPE, Te as APIKEY_ISSUE_OTHER_SCOPE, _e as APIKEY_ISSUE_SELF_SCOPE, Xn as APPROVALS_DECIDE_TAG, Yn as APPROVALS_PENDING_TAG, ot as ApprovalDecisionErrors, at as ApprovalErrors, T as ApprovalExpired, it as ApprovalForbidden, et as ApprovalNotFound, rt as ApprovalNotPending, nt as ApprovalRejected, $e as ApprovalRequired, tt as ApprovalSelfApproval, E as ApprovalUnavailable, ke as AuthMiddleware, S as BusinessRuleViolation, $n as CONNECTIONS_LIST_TAG, tr as CONNECTION_DISCONNECT_TAG, er as CONNECTION_START_TAG, Z as CONNECTION_SUBMIT_TOKEN_TAG, sr as ConnectionHandshakeFailed, se as ConnectionInfo, i as ConnectionInfoMiddleware, Q as ConnectionKind, or as ConnectionKindMismatch, ir as ConnectionNotDeclared, rr as ConnectionState, nr as ConnectionStatus, ar as ConnectionSubjectRequired, Jn as ConstraintViolation, r as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, re as DEFAULT_SCOPE_CACHE_TTL_MS, Wt as EVENT_ROUTE_SEP, Vt as EventKeyInvalid, Bt as EventPayloadInvalid, Ht as EventPayloadTooLarge, pr as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, ye as IMPERSONATION_METADATA_KEY, At as MAX_EVENT_ENVELOPE_BYTES, gr as PROTOCOL_VERSION, st as PendingApproval, D as REACTIVITY_CHANNEL_PREFIX, l as ScopeError, qn as ServerOnlyColumnWrite, Wn as StoreOperationFailed, e as Subject, ve as SubjectIdentity, ne as SubjectService, Gn as TableValidationFailed, Kn as TenantRowNotFound, Un as TenantScopeViolation, Nn as UNDO_APPLY_TAG, Mn as UNDO_LOG_TAG, Pn as UNDO_REDO_TAG, c as Unauthenticated, Rn as UndoConflict, Ln as UndoForbidden, Fn as UndoLogEntry, In as UndoNotFound, w as ValidationError, Ze as ValidationErrors, C as ValidationIssue, X as WorkflowControlInputSchema, mn as WorkflowDomainEventRowSchema, _n as WorkflowDomainEventsInputSchema, vn as WorkflowEventDeliveriesInputSchema, hn as WorkflowEventDeliveryRowSchema, cn as WorkflowParentClosePolicySchema, pn as WorkflowRunEventRowSchema, un as WorkflowRunHandleSchema, gn as WorkflowRunRefSchema, J as WorkflowRunRowSchema, q as WorkflowRunStatusSchema, fn as WorkflowRunStepRowSchema, Y as WorkflowRunTableRefSchema, dn as WorkflowRunsInputSchema, yn as WorkflowSignalInputSchema, ln as WorkflowStartDeferralSchema, bn as WorkflowUpdateInputSchema, xn as WorkflowUpdateResultSchema, Tt as actionToRpc, Ce as advisoryResourceGuardWarning, ie as anonymousSubject, Ye as applyRowPatch, a as applyScopeDecision, Qn as approvalsDecideDescriptor, Zn as approvalsPendingQueryDescriptor, ee as assertAuthenticated, Re as beginIdempotent, $t as checkFrameworkCompat, Ee as checkGuards, pe as checkGuardsEffect, te as composeAuthStrategies, Zt as composeRpcInterceptors, dr as connectionDisconnectDescriptor, lr as connectionStartDescriptor, ur as connectionSubmitTokenDescriptor, cr as connectionsListQueryDescriptor, M as declaredReactivityChannelKeys, B as defineAction, Mt as defineEvent, z as defineMutation, Jt as definePlugin, Yt as definePluginRoute, Qt as definePluginService, R as defineQuery, _t as defineStream, hr as defineWebSocket, qe as diffRows, be as effectiveScopes, Ut as encodeEventKey, Dt as errorTag, Ft as eventAttached, Nt as eventEnvelope, Pt as eventGap, Lt as eventResumePoint, Gt as eventRoute, It as eventStreamEvent, Rt as eventSubscribeInput, zt as eventToRpc, Fe as failIdempotent, Qe as fieldIssuesOf, Oe as findAdvisoryResourceGuards, Ne as finishIdempotent, qt as formatEventRoute, me as getPolicyGuardResolver, he as getResourceScopeResolver, gt as hasAccessDecision, ae as hasCallbackRoutes, we as hasEffectiveScope, H as hasEnforcedGuard, xe as hasScope, g as idToPath, Le as idempotencyScope, b as inputLabel, jt as isEventDescriptor, Je as isIdKeyed, u as isOpenAccess, ge as isPolicyCheck, ht as isPolicyGuard, A as isReactivityChannel, j as isReactivityChannelKey, Me as isSystemSubject, pt as isWireReachable, t as makeScopeCache, ze as memoryIdempotencyStore, de as missingAccessDecision, wt as mutationToRpc, kt as normalizeDescriptor, F as normalizeSource, d as openAccessSpec, Kt as parseEventRoute, Ge as pathToId, tn as pluginAlias, Xt as pluginInstanceName, nn as pluginSlug, sn as pluginTag, ft as publishReactivity, Be as publishServerError, Ct as queryToRpc, le as rawImpersonationMark, ut as reactivityChannel, an as registerPluginAliases, je as requireScope, on as resetPluginAliases, h as rowPatchOpSchema, We as rowPatchSchema, s as scopeCacheKey, fe as setEffectiveScopes, Ae as setPolicyGuardResolver, oe as setResourceScopeResolver, P as sourceKeys, Et as streamToRpc, x as strictInput, ce as subjectIdentity, n as subjectScopes, Ie as subscribeServerErrors, y as subscriptionEvent, ue as systemSubject, o as tenantScopedSubject, Ot as toRpc, fr as tsMs, dt as undeclaredChannelKeys, Vn as undoApplyDescriptor, Bn as undoLogQueryDescriptor, Hn as undoRedoDescriptor, U as wireErrorUnion, St as withRpcTag, On as workflowCancelDescriptor, En as workflowDomainEventsQueryDescriptor, Dn as workflowEventDeliveriesQueryDescriptor, kn as workflowResumeDescriptor, Tn as workflowRunEventsQueryDescriptor, Sn as workflowRunQueryDescriptor, wn as workflowRunStepsQueryDescriptor, Cn as workflowRunsQueryDescriptor, An as workflowSignalDescriptor, jn as workflowUpdateDescriptor, Pe as wsMutationIdempotencyScope };
948
+ export { De as ADMIN_SCOPE, Se as APIKEY_ISSUE_ORG_SCOPE, Te as APIKEY_ISSUE_OTHER_SCOPE, _e as APIKEY_ISSUE_SELF_SCOPE, sr as APPROVALS_DECIDE_TAG, or as APPROVALS_PENDING_TAG, at as ApprovalDecisionErrors, it as ApprovalErrors, k as ApprovalExpired, rt as ApprovalForbidden, $e as ApprovalNotFound, nt as ApprovalNotPending, tt as ApprovalRejected, Qe as ApprovalRequired, et as ApprovalSelfApproval, A as ApprovalUnavailable, ke as AuthMiddleware, T as BusinessRuleViolation, Z as CONNECTIONS_LIST_TAG, fr as CONNECTION_DISCONNECT_TAG, ur as CONNECTION_START_TAG, dr as CONNECTION_SUBMIT_TOKEN_TAG, vr as ConnectionHandshakeFailed, se as ConnectionInfo, i as ConnectionInfoMiddleware, Q as ConnectionKind, _r as ConnectionKindMismatch, hr as ConnectionNotDeclared, mr as ConnectionState, pr as ConnectionStatus, gr as ConnectionSubjectRequired, ar as ConstraintViolation, r as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, re as DEFAULT_SCOPE_CACHE_TTL_MS, Xt as EVENT_ROUTE_SEP, qt as EventKeyInvalid, Kt as EventPayloadInvalid, Jt as EventPayloadTooLarge, wr as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, ye as IMPERSONATION_METADATA_KEY, It as MAX_EVENT_ENVELOPE_BYTES, Re as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, f as MutationInFlight, Dr as PROTOCOL_VERSION, ot as PendingApproval, j as REACTIVITY_CHANNEL_PREFIX, l as ScopeError, ir as ServerOnlyColumnWrite, tr as StoreOperationFailed, e as Subject, ve as SubjectIdentity, ne as SubjectService, nr as TableValidationFailed, rr as TenantRowNotFound, er as TenantScopeViolation, Wn as UNDO_APPLY_TAG, Un as UNDO_LOG_TAG, Gn as UNDO_REDO_TAG, c as Unauthenticated, Yn as UndoConflict, Jn as UndoForbidden, Kn as UndoLogEntry, qn as UndoNotFound, D as ValidationError, O as ValidationErrors, E as ValidationIssue, H as WorkflowAccessProperty, X as WorkflowControlInputSchema, Tn as WorkflowDomainEventRowSchema, On as WorkflowDomainEventsInputSchema, kn as WorkflowEventDeliveriesInputSchema, En as WorkflowEventDeliveryRowSchema, vn as WorkflowParentClosePolicySchema, wn as WorkflowRunEventRowSchema, bn as WorkflowRunHandleSchema, Dn as WorkflowRunRefSchema, J as WorkflowRunRowSchema, q as WorkflowRunStatusSchema, Cn as WorkflowRunStepRowSchema, Y as WorkflowRunTableRefSchema, Sn as WorkflowRunsInputSchema, An as WorkflowSignalInputSchema, yn as WorkflowStartDeferralSchema, jn as WorkflowUpdateInputSchema, Mn as WorkflowUpdateResultSchema, jt as actionToRpc, Ce as advisoryResourceGuardWarning, ie as anonymousSubject, Ye as applyRowPatch, a as applyScopeDecision, lr as approvalsDecideDescriptor, cr as approvalsPendingQueryDescriptor, ee as assertAuthenticated, nn as attachWorkflowAccess, Ne as beginIdempotent, un as checkFrameworkCompat, Ee as checkGuards, pe as checkGuardsEffect, te as composeAuthStrategies, cn as composeRpcInterceptors, Sr as connectionDisconnectDescriptor, br as connectionStartDescriptor, xr as connectionSubmitTokenDescriptor, yr as connectionsListQueryDescriptor, pt as declaredReactivityChannelKeys, R as defineAction, Rt as defineEvent, L as defineMutation, an as definePlugin, on as definePluginRoute, ln as definePluginService, I as defineQuery, St as defineStream, Er as defineWebSocket, qe as diffRows, be as effectiveScopes, Yt as encodeEventKey, Nt as errorTag, Vt as eventAttached, zt as eventEnvelope, Bt as eventGap, Ut as eventResumePoint, Zt as eventRoute, Ht as eventStreamEvent, Wt as eventSubscribeInput, Gt as eventToRpc, Le as failIdempotent, Ze as fieldIssuesOf, Oe as findAdvisoryResourceGuards, ze as finishIdempotent, $t as formatEventRoute, me as getPolicyGuardResolver, he as getResourceScopeResolver, U as getWorkflowAccess, xt as hasAccessDecision, ae as hasCallbackRoutes, we as hasEffectiveScope, B as hasEnforcedGuard, xe as hasScope, v as idToPath, Pe as idempotencyScope, C as inputLabel, Lt as isEventDescriptor, Je as isIdKeyed, u as isOpenAccess, ge as isPolicyCheck, bt as isPolicyGuard, dt as isReactivityChannel, ft as isReactivityChannelKey, Me as isSystemSubject, vt as isWireReachable, t as makeScopeCache, Fe as memoryIdempotencyStore, de as missingAccessDecision, At as mutationToRpc, Ft as normalizeDescriptor, ht as normalizeSource, d as openAccessSpec, Qt as parseEventRoute, y as pathToId, fn as pluginAlias, sn as pluginInstanceName, pn as pluginSlug, _n as pluginTag, _t as publishReactivity, Be as publishServerError, kt as queryToRpc, le as rawImpersonationMark, ut as reactivityChannel, hn as registerPluginAliases, je as requireScope, gn as resetPluginAliases, tn as resolveWorkflowAccess, g as rowPatchOpSchema, _ as rowPatchSchema, s as scopeCacheKey, fe as setEffectiveScopes, Ae as setPolicyGuardResolver, oe as setResourceScopeResolver, mt as sourceKeys, Mt as streamToRpc, w as strictInput, ce as subjectIdentity, n as subjectScopes, Ie as subscribeServerErrors, S as subscriptionEvent, ue as systemSubject, o as tenantScopedSubject, Pt as toRpc, Cr as tsMs, gt as undeclaredChannelKeys, Qn as undoApplyDescriptor, Zn as undoLogQueryDescriptor, $n as undoRedoDescriptor, V as wireErrorUnion, Ot as withRpcTag, rn as workflowAccessDescriptor, zn as workflowCancelDescriptor, Ln as workflowDomainEventsQueryDescriptor, Rn as workflowEventDeliveriesQueryDescriptor, Bn as workflowResumeDescriptor, In as workflowRunEventsQueryDescriptor, Nn as workflowRunQueryDescriptor, Fn as workflowRunStepsQueryDescriptor, Pn as workflowRunsQueryDescriptor, Vn as workflowSignalDescriptor, xn as workflowToRpc, Hn as workflowUpdateDescriptor, Dt as workflowWireErrorUnion, Ve as wsMutationIdempotencyScope };