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