@voltro/protocol 0.85.0 → 0.87.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +5987 -0
  2. package/README.md +14 -0
  3. package/THIRD-PARTY-NOTICES.md +1122 -31
  4. package/dist/apiRoleEndpoints.js +108 -0
  5. package/dist/apiRoleObservation.js +68 -0
  6. package/dist/apikey.d.ts +10 -0
  7. package/dist/approval.js +64 -0
  8. package/dist/approvalDescriptors.js +26 -0
  9. package/dist/auth.js +389 -0
  10. package/dist/boundedRing.js +27 -0
  11. package/dist/businessRule.js +11 -0
  12. package/dist/canonicalJson.js +14 -0
  13. package/dist/connection.js +73 -0
  14. package/dist/devActivity.js +4 -0
  15. package/dist/errorSchema.js +24 -0
  16. package/dist/errorValue.js +21 -0
  17. package/dist/event.js +110 -0
  18. package/dist/formCapture.js +12 -0
  19. package/dist/httpStreamMaxDuration.js +9 -0
  20. package/dist/idempotency.js +121 -0
  21. package/dist/idempotencyInput.js +123 -0
  22. package/dist/identity.js +5 -9
  23. package/dist/index.d.ts +1095 -139
  24. package/dist/index.js +54 -1700
  25. package/dist/inspect.d.ts +1 -1
  26. package/dist/inspect.js +14 -240
  27. package/dist/inspectBackfill.js +52 -0
  28. package/dist/inspectCommandRejection.js +21 -0
  29. package/dist/inspectProjection.js +133 -0
  30. package/dist/inspectStorageProjection.js +86 -0
  31. package/dist/inspectValueIdentity.js +4 -0
  32. package/dist/inspectWorkflowExecution.js +34 -0
  33. package/dist/inspectWorkflowQueuedStart.js +31 -0
  34. package/dist/jsonSchema.js +54 -0
  35. package/dist/jwt.d.ts +10 -0
  36. package/dist/jwt.js +1 -1
  37. package/dist/outbox.js +10 -0
  38. package/dist/pairing.js +75 -0
  39. package/dist/plugin.js +87 -0
  40. package/dist/pluginAccountMerge.js +88 -0
  41. package/dist/pluginNaming.js +32 -0
  42. package/dist/pluginPrivacy.js +166 -0
  43. package/dist/procedure.js +280 -0
  44. package/dist/publicApi.js +325 -0
  45. package/dist/queryOptionalSources.js +14 -0
  46. package/dist/reactivityChannel.js +34 -0
  47. package/dist/rest.d.ts +260 -64
  48. package/dist/rest.js +345 -499
  49. package/dist/restFormat.js +163 -0
  50. package/dist/restReceipt.js +43 -0
  51. package/dist/revalidate.js +13 -0
  52. package/dist/rowEquality.js +31 -0
  53. package/dist/rowPatch.js +182 -0
  54. package/dist/schemaShape.js +67 -0
  55. package/dist/scopes.js +273 -0
  56. package/dist/secretWindows.js +71 -0
  57. package/dist/serverErrorBus.js +15 -0
  58. package/dist/serviceCall.js +14 -0
  59. package/dist/session.d.ts +89 -6
  60. package/dist/session.js +62 -63
  61. package/dist/{sessionHeader-DriTZhmv.js → sessionHeader.js} +1 -1
  62. package/dist/ssrfPolicy.js +30 -0
  63. package/dist/storageAccess.js +14 -0
  64. package/dist/storeErrors.js +66 -0
  65. package/dist/storeScreenshots.js +90 -0
  66. package/dist/strictInput.js +27 -0
  67. package/dist/subscriptionEvent.js +37 -0
  68. package/dist/tenantSelection.js +40 -0
  69. package/dist/time.js +7 -0
  70. package/dist/undo.js +38 -0
  71. package/dist/validation.js +39 -0
  72. package/dist/webSocketGateway.js +16 -0
  73. package/dist/workflow.js +297 -0
  74. package/dist/workflowAccess.js +61 -0
  75. package/dist/workflowRestart.js +45 -0
  76. package/dist/workflowRetry.js +44 -0
  77. package/dist/workflowStartOutcome.js +30 -0
  78. package/package.json +5 -3
  79. package/dist/restFormat-BlgTLxm1.js +0 -298
  80. package/dist/scopes-ClywBij8.js +0 -548
package/dist/index.js CHANGED
@@ -1,1701 +1,55 @@
1
- import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as ee, K as te, L as ne, M as re, N as ie, O as ae, P as oe, Q as se, R as ce, S as le, T as ue, U as de, V as u, W as fe, X as pe, Y as me, Z as he, _ as ge, a as _e, at as ve, b as ye, c as be, d as xe, et as Se, f as Ce, g as we, h as Te, i as Ee, it as De, j as Oe, k as ke, l as Ae, m as je, n as Me, nt as Ne, o as d, ot as Pe, p as Fe, q as Ie, r as Le, rt as Re, s as f, st as ze, t as Be, tt as Ve, u as He, v as Ue, w as We, x as Ge, y as Ke, z as qe } from "./scopes-ClywBij8.js";
2
- import { A as Je, C as Ye, D as Xe, E as Ze, O as Qe, S as $e, T as et, _ as tt, a as nt, b as rt, c as it, d as at, f as ot, g as st, h as ct, i as lt, j as ut, k as dt, l as ft, m as pt, n as mt, o as ht, p as gt, r as _t, s as vt, t as yt, u as bt, v as xt, w as St, x as Ct, y as wt } from "./restFormat-BlgTLxm1.js";
3
- import { n as Tt, t as Et } from "./sessionHeader-DriTZhmv.js";
4
- import { Context as Dt, Effect as Ot, Layer as kt, Result as At, Schema as p, SchemaAST as m, SchemaGetter as jt, SchemaIssue as Mt } from "effect";
5
- import { Rpc as h } from "effect/rpc";
6
- import * as Nt from "effect/encoding/Base64";
7
- import * as g from "effect/SchemaAST";
8
- import { VersionConflict as Pt } from "@voltro/database/wire";
9
- //#region src/rowEquality.ts
10
- var Ft = (e) => e instanceof Uint8Array && Object.getPrototypeOf(e) === Uint8Array.prototype && !("toJSON" in e) && Object.keys(e).length === e.length, It = (e) => {
11
- let t = Object.getPrototypeOf(e);
12
- return (t === null || t === Object.prototype) && !("toJSON" in e) && !("toJSON" in Object.prototype);
13
- }, Lt = (e) => e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" || Ft(e), Rt = (e, t) => {
14
- let n = typeof e == "number" && !Number.isFinite(e) ? null : e, r = typeof t == "number" && !Number.isFinite(t) ? null : t;
15
- if (n === r) return !0;
16
- if (n instanceof Uint8Array && r instanceof Uint8Array) {
17
- if (n.length !== r.length) return !1;
18
- for (let e = 0; e < n.length; e++) if (n[e] !== r[e]) return !1;
19
- return !0;
20
- }
21
- return !1;
22
- }, zt = (e, t) => {
23
- if (!It(e) || !It(t)) return;
24
- let n = Object.keys(e), r = e === t ? n : Object.keys(t);
25
- if (n.length !== r.length) return;
26
- let i = !0;
27
- for (let r = 0; r < n.length; r++) {
28
- let a = n[r];
29
- if (a === "__proto__" || a in Object.prototype && Object.getOwnPropertyDescriptor(Object.prototype, a)?.set !== void 0) return;
30
- let o = Object.getOwnPropertyDescriptor(e, a), s = e === t ? o : Object.getOwnPropertyDescriptor(t, a);
31
- if (o === void 0 || s === void 0 || s.enumerable !== !0 || !("value" in o) || !("value" in s)) return;
32
- let c = o.value, l = s.value;
33
- if (!Lt(c) || !Lt(l)) return;
34
- Rt(c, l) || (i = !1);
35
- }
36
- return i;
37
- }, Bt = p.Union([p.String, p.Number]), Vt = (e) => typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1 && typeof e.$bytes == "string", Ht = p.Unknown.pipe(p.decodeTo(p.Unknown, {
38
- decode: jt.transform((e) => {
39
- if (!Vt(e)) return e;
40
- let t = Nt.decode(e.$bytes);
41
- return At.isSuccess(t) ? t.success : e;
42
- }),
43
- encode: jt.transform((e) => e instanceof Uint8Array ? { $bytes: Nt.encode(e) } : e instanceof Date ? e.toISOString() : e)
44
- })), Ut = p.Record(p.String, Ht).pipe(p.refine((e) => "id" in e, { message: "patch row must carry an id" })), Wt = p.Union([
45
- p.Struct({
46
- op: p.Literal("add"),
47
- path: p.String,
48
- value: Ut
49
- }),
50
- p.Struct({
51
- op: p.Literal("replace"),
52
- path: p.String,
53
- value: Ut
54
- }),
55
- p.Struct({
56
- op: p.Literal("remove"),
57
- path: p.String
58
- }),
59
- p.Struct({
60
- op: p.Literal("mergeCells"),
61
- path: p.String,
62
- value: p.Record(p.String, Ht)
63
- })
64
- ]), Gt = p.Struct({
65
- ops: p.Array(Wt),
66
- order: p.NullOr(p.Array(Bt))
67
- }), _ = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, v = (e) => (e.startsWith("/") ? e.slice(1) : e).replace(/~1/g, "/").replace(/~0/g, "~"), y = (e) => {
68
- let t = Object.keys(e).sort(), n = {};
69
- for (let r of t) n[r] = e[r];
70
- return JSON.stringify(n);
71
- }, Kt = (e, t) => zt(e, t) ?? y(e) === y(t), qt = (e, t) => {
72
- if (e instanceof Uint8Array && t instanceof Uint8Array) {
73
- if (e.length !== t.length) return !1;
74
- for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
75
- return !0;
76
- }
77
- return y({
78
- id: 0,
79
- v: e
80
- }) === y({
81
- id: 0,
82
- v: t
83
- });
84
- }, Jt = (e, t, n = {}) => {
85
- let r = /* @__PURE__ */ new Map();
86
- for (let t of e) r.set(t.id, t);
87
- let i = [], a = e.length === t.length && t.every((t, n) => t.id === e[n].id) ? null : [], o = /* @__PURE__ */ new Set(), s = n.crdt, c = (e, t) => {
88
- if (s === void 0 || s.columns.size === 0) return;
89
- let n = {}, r = !1;
90
- for (let i of s.columns) {
91
- if (!(i in t) || qt(e[i], t[i])) continue;
92
- let a = s.incremental(i, e[i], t[i]);
93
- if (a === void 0) return;
94
- n[i] = a, r = !0;
95
- }
96
- if (!r) return;
97
- let i = {};
98
- for (let [e, n] of Object.entries(t)) s.columns.has(e) || (i[e] = n);
99
- return {
100
- scalars: i,
101
- merges: n
102
- };
103
- };
104
- for (let e of t) {
105
- a?.push(e.id), o.add(e.id);
106
- let t = r.get(e.id);
107
- if (t === void 0) i.push({
108
- op: "add",
109
- path: _(e.id),
110
- value: e
111
- });
112
- else if (!Kt(t, e)) {
113
- let n = c(t, e);
114
- n === void 0 ? i.push({
115
- op: "replace",
116
- path: _(e.id),
117
- value: e
118
- }) : (Kt(Object.fromEntries(Object.entries(t).filter(([e]) => !s.columns.has(e))), n.scalars) || i.push({
119
- op: "replace",
120
- path: _(e.id),
121
- value: n.scalars
122
- }), i.push({
123
- op: "mergeCells",
124
- path: _(e.id),
125
- value: n.merges
126
- }));
127
- }
128
- }
129
- for (let t of e) o.has(t.id) || i.push({
130
- op: "remove",
131
- path: _(t.id)
132
- });
133
- return {
134
- ops: i,
135
- order: a
136
- };
137
- }, Yt = (e) => e.every((e) => {
138
- let t = e.id;
139
- return typeof t == "string" || typeof t == "number";
140
- }), Xt = (e, t, n = {}) => {
141
- let r = /* @__PURE__ */ new Map();
142
- for (let t of e) r.set(t.id, t);
143
- return Zt(e, t, n, r);
144
- }, Zt = (e, t, n, r, i) => {
145
- let a = /* @__PURE__ */ new Map();
146
- for (let e of t.ops) e.op === "mergeCells" && a.set(v(e.path), Object.keys(e.value));
147
- for (let e of t.ops) {
148
- if (e.op === "mergeCells") {
149
- let t = v(e.path), i = r.get(t) ?? r.get(Number(t)), a = r.has(t) ? t : Number(t);
150
- if (i === void 0) continue;
151
- let o = { ...i };
152
- for (let [t, r] of Object.entries(e.value)) o[t] = n.mergeCell === void 0 ? r : n.mergeCell(t, i[t], r);
153
- r.set(a, o);
154
- continue;
155
- }
156
- if (e.op === "add" && (t.order !== null || r.has(e.value.id)) && r.set(e.value.id, e.value), e.op === "replace") {
157
- let n = r.get(e.value.id), i = (n === void 0 ? [] : a.get(String(e.value.id)) ?? []).filter((t) => !(t in e.value) && t in n);
158
- (t.order !== null || n !== void 0) && r.set(e.value.id, i.length === 0 ? e.value : {
159
- ...e.value,
160
- ...Object.fromEntries(i.map((e) => [e, n[e]]))
161
- });
162
- }
163
- }
164
- if (t.order === null && i !== void 0) {
165
- let n = e.slice();
166
- for (let e of t.ops) {
167
- if (e.op === "remove") continue;
168
- let t = e.op === "mergeCells" ? v(e.path) : void 0, a = e.op === "mergeCells" ? r.has(t) ? t : Number(t) : e.value.id, o = i.get(a), s = r.get(a);
169
- o !== void 0 && s !== void 0 && (n[o] = s);
170
- }
171
- return n;
172
- }
173
- let o = [];
174
- if (t.order === null) for (let t of e) {
175
- let e = r.get(t.id);
176
- e !== void 0 && o.push(e);
177
- }
178
- else for (let e of t.order) {
179
- let t = r.get(e);
180
- t !== void 0 && o.push(t);
181
- }
182
- return o;
183
- }, Qt = () => {
184
- let e, t, n, r = () => {
185
- e = void 0, t = void 0, n = void 0;
186
- }, i = (e) => {
187
- let r = /* @__PURE__ */ new Map(), i = Object.getPrototypeOf(e) === Array.prototype;
188
- for (let t = 0; t < e.length; t++) {
189
- let n = e[t];
190
- r.has(n.id) && (i = !1), r.set(n.id, t);
191
- }
192
- n = i ? r : void 0, t = i ? void 0 : new Map(e.map((e) => [e.id, e]));
193
- };
194
- return {
195
- reset: r,
196
- apply: (a, o, s = {}) => {
197
- (a !== e || n === void 0 && t === void 0) && i(a);
198
- try {
199
- let r = n, c = /* @__PURE__ */ new Map(), l = Zt(a, o, s, r === void 0 ? t : {
200
- get: (e) => {
201
- if (c.has(e)) return c.get(e);
202
- let t = r.get(e);
203
- return t === void 0 ? void 0 : a[t];
204
- },
205
- has: (e) => c.has(e) || r.has(e),
206
- set: (e, t) => {
207
- c.set(e, t);
208
- }
209
- }, r);
210
- return (o.order !== null || o.ops.some((e) => e.op === "mergeCells" && "id" in e.value)) && i(l), e = l, l;
211
- } catch (e) {
212
- throw r(), e;
213
- }
214
- }
215
- };
216
- }, $t = (e) => p.Union([
217
- p.Struct({
218
- _tag: p.Literal("snapshot"),
219
- revision: p.Number,
220
- data: e,
221
- computed: p.optional(p.Boolean),
222
- reconciles: p.optional(p.String)
223
- }),
224
- p.Struct({
225
- _tag: p.Literal("delta"),
226
- revision: p.Number,
227
- emittedAt: p.Number,
228
- patch: Gt
229
- }),
230
- p.Struct({
231
- _tag: p.Literal("error"),
232
- error: p.Unknown,
233
- revision: p.optional(p.Number)
234
- })
235
- ]), en = (e, t, n) => {
236
- if (!t || typeof t != "object" || !("_tag" in t)) return t;
237
- let r = t;
238
- switch (r._tag) {
239
- case "snapshot": return r.data;
240
- case "error": throw r.error === void 0 ? Error(`${n} ${e}: the rpc refused without an error value`) : r.error;
241
- case "delta": throw Error(`${n} ${e}: received a 'delta' as the first event, which should be impossible — a subscription always opens with a snapshot. This is a framework bug.`);
242
- default: return t;
243
- }
244
- }, tn = (e, t) => {
245
- let n = `${e ?? "this procedure"} input`;
246
- return t === !0 ? `${n} (guarded — the guard did NOT run: the payload failed to decode first, so this says nothing about access)` : n;
247
- }, nn = Mt.makeFormatterDefault(), rn = (e) => p.Never.annotate({ message: e.size === 0 ? "is unexpected: the input declares no keys" : `is unexpected: the input declares ${[...e].map(String).join(", ")}` }).ast, an = (e) => p.String.check(p.makeFilter((t) => e.has(t) ? "a declared key" : void 0)).ast, b = (e, t = /* @__PURE__ */ new Map()) => {
248
- let n = t.get(e);
249
- if (n !== void 0) return n;
250
- let r = on(e, t);
251
- return t.set(e, r), r;
252
- }, on = (e, t) => {
253
- if (e.encoding !== void 0) {
254
- let n = g.toEncoded(e), r = b(n, t);
255
- return r === n ? e : p.make(r).pipe(p.decodeTo(p.make(e))).ast;
256
- }
257
- if (g.isObjects(e)) {
258
- let n = e.propertySignatures.map((e) => new g.PropertySignature(e.name, b(e.type, t))), r = new Set(n.map((e) => e.name)), i = e.indexSignatures.length > 0 ? e.indexSignatures.map((e) => new g.IndexSignature(e.parameter, b(e.type, t))) : [new g.IndexSignature(an(r), rn(r))];
259
- return new g.Objects(n, i, e.annotations, e.checks, void 0, e.context);
260
- }
261
- return g.isArrays(e) ? new g.Arrays(e.isMutable, e.elements.map((e) => b(e, t)), e.rest.map((e) => b(e, t)), e.annotations, e.checks, void 0, e.context) : g.isUnion(e) ? new g.Union(e.types.map((e) => b(e, t)), e.options, e.annotations, e.checks, void 0, e.context) : g.isSuspend(e) ? new g.Suspend(() => b(e.thunk(), t), e.annotations, e.checks, void 0, e.context) : e;
262
- }, x = (e, t, n) => {
263
- let r = tn(t, n);
264
- return p.make(b(e.ast)).pipe(p.middlewareDecoding((e) => Ot.catch(e, (e) => Ot.fail(new Mt.InvalidValue({ message: `${r}\n${nn(e)}` })))));
265
- }, sn = class extends p.TaggedError()("BusinessRuleViolation", {
266
- rule: p.String,
267
- params: p.optional(p.Record(p.String, p.Unknown)),
268
- field: p.optional(p.String),
269
- message: p.optional(p.String),
270
- severity: p.Literals(["error", "warning"])
271
- }) {}, cn = p.Struct({
272
- field: p.String,
273
- message: p.String,
274
- params: p.optional(p.Record(p.String, p.Unknown))
275
- }), S = class extends p.TaggedError()("ValidationError", {
276
- field: p.String,
277
- message: p.String,
278
- params: p.optional(p.Record(p.String, p.Unknown))
279
- }) {}, C = class extends p.TaggedError()("ValidationErrors", { issues: p.Array(cn).pipe(p.check(p.isMinLength(1))) }) {}, ln = (e) => {
280
- if (typeof e != "object" || !e) return [];
281
- let t = e._tag;
282
- if (t === "ValidationError") {
283
- let t = e;
284
- return [{
285
- field: t.field,
286
- message: t.message,
287
- ...t.params === void 0 ? {} : { params: t.params }
288
- }];
289
- }
290
- if (t === "ValidationErrors") {
291
- let t = e;
292
- return Array.isArray(t.issues) ? t.issues : [];
293
- }
294
- if (t === "BusinessRuleViolation") {
295
- let t = e;
296
- if (typeof t.field != "string" || t.field.length === 0) return [];
297
- let n = typeof t.message == "string" && t.message.length > 0 ? t.message : String(t.rule ?? "validation.invalid");
298
- return [{
299
- field: t.field,
300
- message: n,
301
- ...t.params === void 0 ? {} : { params: t.params }
302
- }];
303
- }
304
- return [];
305
- }, un = class extends p.TaggedError()("ApprovalRequired", {
306
- approvalId: p.String,
307
- procedure: p.String,
308
- expiresAt: p.String,
309
- requiredScopes: p.Array(p.String),
310
- reason: p.NullOr(p.String),
311
- created: p.Boolean
312
- }) {}, dn = class extends p.TaggedError()("ApprovalNotFound", { approvalId: p.String }) {}, fn = class extends p.TaggedError()("ApprovalSelfApproval", {
313
- approvalId: p.String,
314
- subjectId: p.NullOr(p.String)
315
- }) {}, pn = class extends p.TaggedError()("ApprovalRejected", {
316
- approvalId: p.String,
317
- decidedBy: p.NullOr(p.String),
318
- note: p.NullOr(p.String)
319
- }) {}, mn = class extends p.TaggedError()("ApprovalExpired", {
320
- approvalId: p.String,
321
- expiredAt: p.String
322
- }) {}, hn = class extends p.TaggedError()("ApprovalNotPending", {
323
- approvalId: p.String,
324
- status: p.String
325
- }) {}, gn = class extends p.TaggedError()("ApprovalForbidden", {
326
- approvalId: p.String,
327
- required: p.NullOr(p.String),
328
- message: p.String
329
- }) {}, _n = class extends p.TaggedError()("ApprovalUnavailable", {
330
- procedure: p.String,
331
- message: p.String
332
- }) {}, vn = p.Union([
333
- un,
334
- pn,
335
- mn,
336
- _n
337
- ]), yn = p.Union([
338
- dn,
339
- fn,
340
- mn,
341
- hn,
342
- gn,
343
- _n
344
- ]), bn = p.Struct({
345
- id: p.String,
346
- procedure: p.String,
347
- kind: p.Literals(["mutation", "action"]),
348
- requestedBy: p.NullOr(p.String),
349
- status: p.Literals([
350
- "pending",
351
- "approved",
352
- "rejected",
353
- "expired",
354
- "consumed"
355
- ]),
356
- reason: p.NullOr(p.String),
357
- requiredScopes: p.Array(p.String),
358
- requestedAt: p.String,
359
- expiresAt: p.String,
360
- decidedBy: p.NullOr(p.String),
361
- decidedAt: p.NullOr(p.String),
362
- note: p.NullOr(p.String),
363
- relation: p.Literals(["to-decide", "requested"])
364
- }), w = "channel:", xn = Symbol.for("@voltro/protocol/reactivityChannels"), Sn = globalThis, T = Sn[xn] ?? (Sn[xn] = /* @__PURE__ */ new Map()), Cn = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, wn = (e) => {
365
- if (!Cn.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
366
- \`billing.usage\`. A \`:\` is refused because it is the namespace separator in
367
- the routing key (\`${w}<name>\`), and an uppercase letter is\n refused because a key that differs only by case reads as one channel and
368
- routes as two.`);
369
- let t = T.get(e);
370
- if (t !== void 0) return t;
371
- let n = `${w}${e}`, r = Object.freeze({
372
- kind: "reactivity-channel",
373
- name: e,
374
- key: n,
375
- toString: () => n
376
- });
377
- return T.set(e, r), r;
378
- }, Tn = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", En = (e) => e.startsWith(w), Dn = () => new Set([...T.values()].map((e) => e.key)), E = (e) => Tn(e) ? e.key : e, On = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(E) : [E(e)], kn = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(E) : E(e), An = (e) => {
379
- let t = Dn(), n = [];
380
- for (let r of e) for (let e of On(r.source)) En(e) && !t.has(e) && n.push({
381
- procedure: r.name,
382
- key: e
383
- });
384
- return n;
385
- }, jn = (e, t) => {
386
- let n = e?.injectExternalChange;
387
- return n !== void 0 && (n.call(e, {
388
- table: t.key,
389
- op: "update",
390
- new: {},
391
- old: {},
392
- origin: "inline"
393
- }), !0);
394
- }, Mn = (e) => e.internal !== !0, Nn = (e) => e.service === void 0 ? "client" : "service", Pn = (e) => Mn(e) && e.service === void 0, Fn = (e) => Mn(e) && e.service !== void 0, In = /^[a-z][a-z0-9-]{0,55}$/i, D = (e) => {
395
- if (Rn(e), Ln(e), e.idempotencyScope !== void 0 && e.idempotencyScope !== "subject" && e.idempotencyScope !== "connection") throw Error(`${e.name}: idempotencyScope must be 'subject' or 'connection'`);
396
- let t = e.serialize;
397
- if (t !== void 0) {
398
- if (typeof t.key != "function") throw Error(`${e.name}: serialize.key must be a function of the input`);
399
- if (t.maxPending !== void 0 && (!Number.isSafeInteger(t.maxPending) || t.maxPending < 1)) throw Error(`${e.name}: serialize.maxPending must be a positive integer`);
400
- }
401
- if (e.idempotencyScope === "connection" && (e.internal === !0 || e.publicApi !== void 0 || e.exposeAsTool !== void 0)) throw Error(`${e.name}: connection-scoped mutations require the native WebSocket RPC surface; internal, publicApi and exposeAsTool cannot establish its connection state`);
402
- if (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
403
- unguarded procedure, or list the scopes required to call it.`);
404
- let n = typeof e.source == "string" ? [e.source] : Array.isArray(e.source) ? e.source : void 0;
405
- if (n !== void 0 && (n.length === 0 || n.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,
406
- which is indistinguishable from "nothing changed". Name the table(s) it
407
- reads, or omit \`source\` for a non-reactive query.`);
408
- if (e.internal !== !0) return e;
409
- if (e.openAccess !== void 0) throw Error(`${e.name}: \`internal: true\` cannot be combined with \`openAccess\`.\n \`internal\` takes the procedure OFF the wire, and \`openAccess\` declares who may
410
- call it there — together they describe a decision about a surface that does not
411
- exist. Drop \`openAccess\` (an internal procedure needs no wire decision), or drop
412
- \`internal: true\` if the procedure really is meant to be callable.`);
413
- if (e.overridesPlugin === !0) throw Error(`${e.name}: \`internal: true\` cannot be combined with \`overridesPlugin\`.\n The override REMOVES the plugin route, and an internal procedure is not
414
- wire-reachable — so the plugin's route would vanish with nothing callable
415
- in its place, and callers would get a 404 for something that used to work.`);
416
- let r = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
417
- if (r.length === 0) return e;
418
- throw Error(`${e.name}: \`internal: true\` cannot be combined with ${r.map((e) => `\`${e}\``).join(" or ")}. \`internal\` takes the procedure OFF the wire; those put it back ON a different one (${r.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 ${r.join(" / ")} annotation if it is not.`);
419
- }, Ln = (e) => {
420
- let t = e.service;
421
- if (t === void 0) return;
422
- let n = t.callers;
423
- if (!Array.isArray(n) || n.length === 0) throw Error(`${e.name}: \`service.callers\` is empty, so NO app may call this procedure —\n and no browser either. Name the calling app(s), e.g. \`service: { callers: ['worker'] }\`,
424
- or drop \`service:\` if the procedure is meant for this app's own clients.`);
425
- let r = n.filter((e) => typeof e != "string" || !In.test(e));
426
- if (r.length > 0) throw Error(`${e.name}: \`service.callers\` holds ${r.map((e) => JSON.stringify(e)).join(", ")} — a caller is an\n app name (letters, digits, dashes; starting with a letter; at most 56 characters), the same name this app
427
- lists in \`serviceCallers\` and the caller's credential resolves to.`);
428
- if (new Set(n).size !== n.length) throw Error(`${e.name}: \`service.callers\` lists the same app twice`);
429
- let i = [
430
- e.internal === !0 ? "`internal: true` (it removes the wire surface a service calls over)" : void 0,
431
- e.publicApi === void 0 ? void 0 : "`publicApi` (a REST route is for callers that are not the listed apps)",
432
- e.exposeAsTool === void 0 ? void 0 : "`exposeAsTool` (an agent tool is not one of the listed apps)",
433
- e.requiresApproval === void 0 ? void 0 : "`requiresApproval` (a second HUMAN cannot approve a machine call)",
434
- e.overridesPlugin === !0 ? "`overridesPlugin` (a plugin route is a client surface; replacing it with a service-only one breaks its clients)" : void 0,
435
- e.idempotencyScope === "connection" ? "`idempotencyScope: 'connection'` (a service call dedups per service, across reconnects)" : void 0
436
- ].filter((e) => e !== void 0);
437
- if (i.length !== 0) throw Error(`${e.name}: \`service:\` cannot be combined with ${i.join("; ")}.\n A service procedure is callable only by the listed apps of this project, over the
438
- socket, with their service credential. Drop the other field, or drop \`service:\`.`);
439
- }, Rn = (e) => {
440
- let t = e.requiresApproval;
441
- if (t !== void 0) {
442
- 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
443
- — e.g. \`approvers: [{ scope: 'invoices:approve' }]\`.`);
444
- if (e.openAccess !== void 0) throw Error(`${e.name}: \`requiresApproval\` cannot be combined with \`openAccess\`.\n The self-approval refusal compares subject ids, and an unauthenticated caller has
445
- none — so on an open procedure every anonymous caller would count as a DIFFERENT
446
- human from every other, and the second-pair-of-eyes control would enforce nothing.
447
- Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
448
- }
449
- }, zn = (e) => e.action !== void 0 && e.resourceType !== void 0, Bn = (e) => e.authenticated === !0, Vn = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, O = (e, t, n, i) => {
450
- if (i !== void 0) {
451
- if (n !== void 0 || t !== void 0 && t.length > 0) throw Error(`${e}: \`service:\` is an access decision of its own — only the listed apps may\n call this procedure — so it cannot sit beside \`guards:\` or \`openAccess:\`. A service
452
- holds no scopes, and no user may call a service procedure. Keep exactly one.`);
453
- return Array.isArray(i.callers) ? [a(i.callers)] : void 0;
454
- }
455
- if (n === void 0) return t;
456
- 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
457
- without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
458
- 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
459
- caller must hold a scope; drop them if anyone may call it.`);
460
- return [r(n.trim())];
461
- }, k = (e) => D({
462
- kind: "query",
463
- name: e.name,
464
- input: e.input,
465
- output: e.output,
466
- error: e.error ?? p.Never,
467
- source: kn(e.source),
468
- cache: e.cache,
469
- guards: O(e.name, e.guards, e.openAccess, e.service),
470
- openAccess: e.openAccess,
471
- service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
472
- publicApi: e.publicApi,
473
- exposeAsTool: e.exposeAsTool,
474
- internal: e.internal,
475
- overridesPlugin: e.overridesPlugin
476
- }), A = (e) => D({
477
- kind: "mutation",
478
- name: e.name,
479
- input: e.input,
480
- output: e.output,
481
- error: e.error ?? p.Never,
482
- ...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
483
- ...e.serialize === void 0 ? {} : { serialize: e.serialize },
484
- target: e.target,
485
- guards: O(e.name, e.guards, e.openAccess, e.service),
486
- openAccess: e.openAccess,
487
- service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
488
- publicApi: e.publicApi,
489
- exposeAsTool: e.exposeAsTool,
490
- requiresApproval: e.requiresApproval,
491
- internal: e.internal,
492
- overridesPlugin: e.overridesPlugin
493
- }), j = (e) => D({
494
- kind: "action",
495
- name: e.name,
496
- input: e.input,
497
- output: e.output,
498
- error: e.error ?? p.Never,
499
- guards: O(e.name, e.guards, e.openAccess, e.service),
500
- openAccess: e.openAccess,
501
- service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
502
- source: e.source,
503
- target: e.target,
504
- publicApi: e.publicApi,
505
- exposeAsTool: e.exposeAsTool,
506
- requiresApproval: e.requiresApproval,
507
- internal: e.internal,
508
- overridesPlugin: e.overridesPlugin
509
- }), Hn = (e) => D({
510
- kind: "stream",
511
- name: e.name,
512
- input: e.input,
513
- element: e.element,
514
- error: e.error ?? p.Never,
515
- internal: e.internal,
516
- overridesPlugin: e.overridesPlugin,
517
- guards: O(e.name, e.guards, e.openAccess),
518
- openAccess: e.openAccess
519
- }), Un = (e, t) => t && t.length > 0 ? p.Union([e, ...t]) : e, M = (e) => e !== void 0 && e.some((e) => !Ke(e)), Wn = (e) => p.Union([
520
- e,
521
- f,
522
- u
523
- ]), Gn = (e) => p.Union([e, sn]), Kn = (e) => p.Union([
524
- e,
525
- S,
526
- C
527
- ]), qn = (e, t) => t === void 0 ? e : p.Union([e, vn]), Jn = (e, t) => xe(t) ? p.Union([e, d]) : e, N = (e, t, n) => Un(Yn(e, t), n), Yn = (e, t) => {
528
- let n = Jn(Wn(e.error), e.guards);
529
- if (t === "stream" || t === "query") return n;
530
- let r = t === "mutation" ? p.Union([
531
- Gn(n),
532
- Ye,
533
- Pt
534
- ]) : n;
535
- return qn(Kn(t === "mutation" && e.idempotencyScope === "connection" ? p.Union([r, $e]) : r), e.requiresApproval);
536
- }, Xn = {
537
- query: [f, u],
538
- stream: [f, u],
539
- action: [
540
- f,
541
- u,
542
- S,
543
- C
544
- ],
545
- mutation: [
546
- f,
547
- u,
548
- sn,
549
- Ye,
550
- Pt,
551
- S,
552
- C
553
- ]
554
- }, Zn = (e, t) => Un(Jn(Wn(e.errorSchema), e.guards), t), Qn = (e, t) => ({
555
- ...e,
556
- name: t
557
- }), $n = (e, t) => h.make(e.name, {
558
- payload: x(e.input, e.name, M(e.guards)),
559
- success: $t(e.output),
560
- error: N(e, "query", t),
561
- stream: !0
562
- }), er = (e, t) => h.make(e.name, {
563
- payload: x(e.input, e.name, M(e.guards)),
564
- success: e.output,
565
- error: N(e, "mutation", t)
566
- }), tr = (e, t) => h.make(e.name, {
567
- payload: x(e.input, e.name, M(e.guards)),
568
- success: e.output,
569
- error: N(e, "action", t)
570
- }), nr = (e, t) => h.make(e.name, {
571
- payload: x(e.input, e.name, M(e.guards)),
572
- success: e.element,
573
- error: N(e, "stream", t),
574
- stream: !0
575
- }), rr = (e) => {
576
- if (typeof e != "object" || !e) return;
577
- let t = e._tag;
578
- return typeof t == "string" ? t : void 0;
579
- }, ir = (e) => {
580
- if (typeof e == "string") return e;
581
- if (typeof e == "object" && e) {
582
- let t = e.message;
583
- if (typeof t == "string" && t !== "") return t;
584
- let n = rr(e);
585
- if (n !== void 0) return n;
586
- }
587
- return String(e);
588
- }, ar = (e) => {
589
- if (e instanceof Error) return e;
590
- let t = Error(ir(e), { cause: e });
591
- return t.name = rr(e) ?? "NonErrorThrown", t;
592
- }, or = (e) => {
593
- switch (e.kind) {
594
- case "query": return $n(e);
595
- case "mutation": return er(e);
596
- case "action": return tr(e);
597
- case "stream": return nr(e);
598
- }
599
- }, sr = (e) => {
600
- let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
601
- if (e.kind === "query") return {
602
- kind: "query",
603
- source: e.source,
604
- ...n,
605
- ...i
606
- };
607
- if (e.kind === "action") return {
608
- kind: "action",
609
- ...n,
610
- ...i
611
- };
612
- if (e.kind === "stream") return {
613
- kind: "stream",
614
- ...n,
615
- ...i
616
- };
617
- let a = e.target, o = e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope }, s = e.serialize === void 0 ? {} : { serialize: e.serialize };
618
- if (a === void 0) return {
619
- kind: "mutation",
620
- ...n,
621
- ...i,
622
- ...o,
623
- ...s
624
- };
625
- let c = Array.isArray(a) ? a : [a];
626
- return {
627
- kind: "mutation",
628
- ...n,
629
- ...i,
630
- ...o,
631
- ...s,
632
- targets: c.map((e) => ({
633
- table: e.table,
634
- op: e.op,
635
- ..."order" in e && e.order !== void 0 ? { order: e.order } : {},
636
- ..."shape" in e && e.shape !== void 0 ? { shape: e.shape } : {},
637
- ..."identify" in e && e.identify !== void 0 ? { identify: e.identify } : {},
638
- ..."path" in e && e.path !== void 0 ? { path: e.path } : {},
639
- ..."by" in e && e.by !== void 0 ? { by: e.by } : {},
640
- ..."match" in e && e.match !== void 0 ? { match: e.match } : {},
641
- ..."shapeItem" in e && e.shapeItem !== void 0 ? { shapeItem: e.shapeItem } : {},
642
- ..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
643
- }))
644
- };
645
- }, cr = 7500, lr = (e) => typeof e == "object" && !!e && e.kind === "event", ur = (e) => {
646
- if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
647
- 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
648
- whitespace and delivers nothing — silently, and only on that broker, so an
649
- app that works on Redis stops working when the transport changes.
650
- Use a dot for namespacing: "orders.paid".`);
651
- if (e.guards !== void 0 && e.guards.length === 0) throw Error(`defineEvent("${e.name}"): \`guards: []\` is empty, so it enforces nothing —\n but it reads at the call site as if the event were protected. Omit the field
652
- for an unguarded event, or list the scopes that may subscribe.`);
653
- if (e.openAccess !== void 0) {
654
- if (e.openAccess.trim() === "") throw Error(`defineEvent("${e.name}"): \`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
655
- subscribe without an authorization check — e.g. \`openAccess: 'public scoreboard,
656
- no caller data'\`.`);
657
- if (e.guards !== void 0 && e.guards.length > 0) throw Error(`defineEvent("${e.name}"): \`openAccess\` and \`guards\` are two different access\n decisions, so declaring both says the event is protected AND open. Keep the guards
658
- if a subscriber must hold a scope; drop them if anyone may listen.`);
659
- }
660
- if (e.webhook?.rateLimit !== void 0 && e.webhook.rateLimit.perMinute < 1) throw Error(`defineEvent("${e.name}"): \`webhook.rateLimit.perMinute\` is ${e.webhook.rateLimit.perMinute}, which defers every delivery forever.\n There is no "unlimited" spelling here — omit \`rateLimit\` for no ceiling.`);
661
- if (e.webhook?.version !== void 0 && e.webhook.version < 1) throw Error(`defineEvent("${e.name}"): \`webhook.version\` must be >= 1 (default 1).\n A subscriber pinned to 1 would read this event as BEHIND its own version,
662
- which is the opposite of what a version bump is for.`);
663
- if (e.delivery === "latest" && e.webhook !== void 0) throw Error(`defineEvent(${e.name}): \`delivery: 'latest'\` cannot be combined with \`webhook\`.\n \`latest\` means a superseded delivery did not matter — but a webhook delivery is a
664
- durable side effect at a third party, and one already sent cannot be superseded.
665
- A high-rate event with an HTTP audience is also 60 deliveries per second per target;
666
- the rate limit DEFERS the excess as pending rows, so it grows a table instead of failing.
667
- Split them: publish the high-rate event for clients, and publish a separate, coarser
668
- event (a summary, a state change) for the outside world.`);
669
- return {
670
- kind: "event",
671
- name: e.name,
672
- key: e.key,
673
- payload: e.payload,
674
- guards: e.openAccess === void 0 ? e.guards : [r(e.openAccess.trim())],
675
- openAccess: e.openAccess,
676
- rewind: e.rewind,
677
- webhook: e.webhook,
678
- delivery: e.delivery
679
- };
680
- }, dr = (e) => p.Struct({
681
- _tag: p.Literal("event"),
682
- origin: p.String,
683
- n: p.Number,
684
- emittedAt: p.Number,
685
- payload: e
686
- }), fr = p.Struct({
687
- _tag: p.Literal("gap"),
688
- missed: p.Number,
689
- reason: p.Literals(["buffer", "resume"])
690
- }), pr = p.Struct({ _tag: p.Literal("attached") }), mr = (e) => p.Union([
691
- pr,
692
- dr(e),
693
- fr
694
- ]), hr = p.Struct({
695
- origin: p.String,
696
- n: p.Number
697
- }), gr = (e) => p.Struct({
698
- key: e,
699
- resume: p.optional(p.Array(hr))
700
- }), _r = (e, t) => {
701
- let n = e.guards !== void 0 && e.guards.some((e) => !Ke(e)) ? p.Union([f, u]) : u, r = xe(e.guards) ? p.Union([n, d]) : n, i = t && t.length > 0 ? p.Union([r, ...t]) : r;
702
- return h.make(e.name, {
703
- payload: x(gr(e.key), e.name, M(e.guards)),
704
- success: mr(e.payload),
705
- error: i,
706
- stream: !0
707
- });
708
- }, vr = class extends p.TaggedError()("EventPayloadInvalid", {
709
- event: p.String,
710
- message: p.String
711
- }) {}, yr = class extends p.TaggedError()("EventKeyInvalid", {
712
- event: p.String,
713
- message: p.String
714
- }) {}, br = class extends p.TaggedError()("EventPayloadTooLarge", {
715
- event: p.String,
716
- bytes: p.Number,
717
- limit: p.Number
718
- }) {}, xr = (e) => {
719
- if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
720
- let t = Object.entries(e), n = 0;
721
- for (let e of t) e[1] !== void 0 && (t[n++] = e);
722
- return t.length = n, t.sort(([e], [t]) => e < t ? -1 : +(e > t)), JSON.stringify(t);
723
- }, Sr = "\0", Cr = (e, t, n) => [
724
- e ?? "~",
725
- t,
726
- xr(n)
727
- ].join("\0"), wr = (e) => {
728
- let [t = "~", n = "", r = ""] = e.split("\0");
729
- return {
730
- tenantId: t === "~" ? null : t,
731
- event: n,
732
- key: r
733
- };
734
- }, Tr = (e) => e.split("\0").join(" · "), Er = Symbol.for("@voltro/protocol/workflow-access"), Dr = {
735
- guards: void 0,
736
- openAccess: void 0,
737
- internal: !1,
738
- controls: void 0,
739
- controlsOpenAccess: void 0
740
- }, Or = (e, t) => {
741
- let n = t.guards;
742
- 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
743
- and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
744
- if (t.openAccess !== void 0) {
745
- 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
746
- start durable work without an authorization check — e.g. \`openAccess: 'public
747
- newsletter signup; the payload carries only the address being confirmed'\`.`);
748
- 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
749
- guards if a caller must hold a scope; drop them if anyone may start it.`);
750
- 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
751
- start it over the wire — a decision about a door that does not exist. Drop
752
- \`openAccess\` (an internal workflow needs no wire decision), or drop
753
- \`internal: true\` if the workflow really is meant to be startable by clients.`);
754
- }
755
- let i = t.controls?.guards, a = t.controls?.openAccess;
756
- if (i !== void 0 && i.length === 0) throw Error(`workflow("${e}"): \`controls: { guards: [] }\` is empty, so it enforces nothing —\n but it reads at the call site as if driving this run were protected. Omit
757
- \`controls\` (wire control is then refused for everyone but \`admin:full\`), or
758
- list the scopes a caller needs to cancel or signal a run.`);
759
- if (a !== void 0) {
760
- if (a.trim() === "") throw Error(`workflow("${e}"): \`controls: { openAccess }\` needs a REASON, not an empty string.\n It is the sentence a reviewer reads to decide whether anyone who can see this
761
- run should be able to cancel or signal it — e.g. \`controls: { openAccess:
762
- 'the run belongs to the caller who started it; cancelling it affects nobody else' }\`.`);
763
- if (i !== void 0 && i.length > 0) throw Error(`workflow("${e}"): \`controls\` takes \`guards\` OR \`openAccess\`, not both.\n Two answers to one question; keep the guards if a caller needs a scope.`);
764
- }
765
- return {
766
- guards: t.openAccess === void 0 ? t.guards : [r(t.openAccess.trim())],
767
- openAccess: t.openAccess?.trim(),
768
- internal: t.internal === !0,
769
- controls: a === void 0 ? i : [r(a.trim())],
770
- controlsOpenAccess: a?.trim()
771
- };
772
- }, kr = (e, t) => {
773
- Object.defineProperty(e, Er, {
774
- value: t,
775
- enumerable: !1
776
- });
777
- }, Ar = (e) => {
778
- if (typeof e != "object" && typeof e != "function" || e === null) return Dr;
779
- let t = e[Er];
780
- return t === void 0 ? Dr : t;
781
- }, jr = (e) => {
782
- let t = Ar(e);
783
- return {
784
- name: e.name,
785
- internal: t.internal,
786
- guards: t.guards,
787
- openAccess: t.openAccess,
788
- controls: t.controls
789
- };
790
- }, Mr = class extends p.TaggedError()("ApiUnavailable", {
791
- api: p.String,
792
- tag: p.String,
793
- reason: p.Literals([
794
- "timeout",
795
- "transport",
796
- "closed"
797
- ]),
798
- message: p.String
799
- }) {}, Nr = (e) => typeof e == "object" && !!e && e._tag === "ApiUnavailable", Pr = (e) => e, Fr = (e) => e, Ir = (e) => {
800
- let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
801
- return n !== void 0 && n !== "" ? `${r}#${n}` : r;
802
- }, Lr = (e) => {
803
- if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
804
- }, Rr = (e, t) => {
805
- let n = Dt.Service(e);
806
- return {
807
- Tag: n,
808
- Live: kt.succeed(n, t)
809
- };
810
- }, zr = (e, t, n) => {
811
- if (!t) return { ok: !0 };
812
- let r = n === void 0 ? null : P(n);
813
- if (!r) return {
814
- ok: !0,
815
- unverified: `plugin "${e}" requires framework ${t}, but the running framework version is ${n === void 0 ? "unknown" : `unreadable ("${n}")`} — not checked.`
816
- };
817
- let i = t.trim();
818
- if (i === "*" || i === "") return { ok: !0 };
819
- let a = i.split(/\s+/);
820
- for (let i of a) if (!Br(i, r)) return {
821
- ok: !1,
822
- reason: `plugin "${e}" requires framework ${t}, running ${n}`
823
- };
824
- return { ok: !0 };
825
- }, P = (e) => {
826
- let t = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9a-zA-Z.-]+))?$/.exec(e.trim());
827
- return t ? {
828
- major: Number(t[1]),
829
- minor: Number(t[2]),
830
- patch: Number(t[3]),
831
- pre: t[4] ?? ""
832
- } : null;
833
- }, F = (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, Br = (e, t) => {
834
- if (e === "*") return !0;
835
- if (e.startsWith("^")) {
836
- let n = P(e.slice(1));
837
- return !n || t.major !== n.major ? !1 : F(t, n) >= 0;
838
- }
839
- if (e.startsWith("~")) {
840
- let n = P(e.slice(1));
841
- return !n || t.major !== n.major || t.minor !== n.minor ? !1 : F(t, n) >= 0;
842
- }
843
- let n = /^(>=|<=|>|<)(.+)$/.exec(e);
844
- if (n) {
845
- let e = n[1], r = P(n[2]);
846
- if (!r) return !1;
847
- let i = F(t, r);
848
- if (e === ">=") return i >= 0;
849
- if (e === "<=") return i <= 0;
850
- if (e === ">") return i > 0;
851
- if (e === "<") return i < 0;
852
- }
853
- let r = P(e);
854
- return r ? F(t, r) === 0 : !1;
855
- }, Vr = (e) => {
856
- let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
857
- return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
858
- }, Hr = (e) => {
859
- let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
860
- return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
861
- }, Ur = Symbol.for("@voltro/protocol/pluginAliases"), I = () => {
862
- let e = globalThis, t = e[Ur];
863
- if (t instanceof Map) return t;
864
- let n = /* @__PURE__ */ new Map();
865
- return e[Ur] = n, n;
866
- }, Wr = (e) => {
867
- let t = I();
868
- for (let [n, r] of Object.entries(e)) {
869
- if (r === "") continue;
870
- let e = t.get(n);
871
- e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
872
- }
873
- }, Gr = () => {
874
- I().clear();
875
- }, Kr = (e, t) => {
876
- let n = I().get(e);
877
- if (n === void 0 || n.size === 0) return `${Vr(e)}.${t}`;
878
- if (n.size === 1) for (let e of n) return `${e}.${t}`;
879
- let r, i = 0;
880
- for (let e of n) e.includes("#") || (r = e, i++);
881
- if (i === 1) return `${r}.${t}`;
882
- 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}').`);
883
- }, L = p.Union([
884
- p.Struct({
885
- kind: p.Literal("dropped"),
886
- at: p.Number,
887
- retryAfterMs: p.Number
888
- }),
889
- p.Struct({
890
- kind: p.Literal("skipped"),
891
- at: p.Number,
892
- executionId: p.String,
893
- runId: p.String
894
- }),
895
- p.Struct({
896
- kind: p.Literal("superseded"),
897
- at: p.Number
898
- }),
899
- p.Struct({
900
- kind: p.Literal("cancelled"),
901
- at: p.Number
902
- }),
903
- p.Struct({
904
- kind: p.Literal("abandoned"),
905
- at: p.Number,
906
- failureId: p.NonEmptyString
907
- })
908
- ]), R = p.Literals([
909
- "running",
910
- "succeeded",
911
- "failed",
912
- "cancelled",
913
- "suspended"
914
- ]), z = p.Struct({
915
- id: p.String,
916
- workflowName: p.String,
917
- executionId: p.String,
918
- status: p.Union([R, p.Literal("unknown")]),
919
- output: p.optional(p.Unknown),
920
- error: p.optional(p.Struct({
921
- tag: p.NullOr(p.String),
922
- message: p.String
923
- }))
924
- }), B = p.Struct({
925
- operation: p.Literals(["cancel", "resume"]),
926
- kind: p.Literals([
927
- "accepted",
928
- "confirmed",
929
- "unknown",
930
- "already-terminal"
931
- ]),
932
- requestId: p.NullOr(p.NonEmptyString),
933
- snapshot: z
934
- }).pipe(p.check(p.makeFilter((e) => e.kind === "unknown" ? !0 : e.kind === "accepted" ? e.requestId !== null && (e.snapshot.status === "running" || e.snapshot.status === "suspended") : e.kind === "already-terminal" ? e.snapshot.status === "succeeded" || e.snapshot.status === "failed" || e.snapshot.status === "cancelled" : e.operation === "cancel" ? e.snapshot.status === "cancelled" : e.requestId !== null && e.snapshot.status === "running", { message: "Workflow control acknowledgement contradicts its observed state or receipt identity" }))), V = p.Struct({
935
- operation: p.Literal("cancel"),
936
- workflowName: p.NonEmptyString,
937
- receiptId: p.NonEmptyString,
938
- requestId: p.NullOr(p.NonEmptyString),
939
- kind: p.Literals([
940
- "accepted",
941
- "confirmed",
942
- "unknown",
943
- "already-terminal"
944
- ]),
945
- observation: p.Union([
946
- p.Struct({ kind: p.Literal("pending") }),
947
- p.Struct({
948
- kind: p.Literal("admission"),
949
- outcome: p.Union([L, p.Struct({
950
- kind: p.Literal("rejected"),
951
- failureId: p.NonEmptyString
952
- })])
953
- }),
954
- p.Struct({
955
- kind: p.Literal("execution"),
956
- snapshot: z
957
- }),
958
- p.Struct({
959
- kind: p.Literal("unavailable"),
960
- reason: p.Literals([
961
- "missing-request",
962
- "missing-run",
963
- "unconfirmed-generation",
964
- "unbound-submission"
965
- ])
966
- })
967
- ])
968
- }).pipe(p.check(p.makeFilter((e) => {
969
- let t = e.observation;
970
- if (t.kind === "unavailable") return e.kind === "unknown" && (t.reason === "missing-request" ? e.requestId === null : e.requestId !== null);
971
- if (e.requestId === null) return !1;
972
- if (t.kind === "pending") return e.kind === "accepted";
973
- if (t.kind === "admission") return e.kind === (t.outcome.kind === "cancelled" ? "confirmed" : "already-terminal");
974
- let n = t.snapshot;
975
- return n.workflowName !== e.workflowName || n.id.length === 0 || n.executionId.length === 0 ? !1 : e.kind === "accepted" ? n.status === "running" || n.status === "suspended" : e.kind === "confirmed" ? n.status === "cancelled" : e.kind === "already-terminal" && (n.status === "succeeded" || n.status === "failed" || n.status === "cancelled");
976
- }, { message: "Queued cancellation acknowledgement contradicts its receipt or observation" }))), qr = p.Literals([
977
- "cancel",
978
- "terminate",
979
- "abandon"
980
- ]), Jr = p.Struct({
981
- mode: p.String,
982
- dueAt: p.NullOr(p.Number),
983
- retryAfterMs: p.NullOr(p.Number),
984
- intentId: p.NullOr(p.String)
985
- }), Yr = p.Struct({
986
- id: p.String,
987
- workflowName: p.String,
988
- executionId: p.NullOr(p.String),
989
- status: p.Literals([
990
- "running",
991
- "succeeded",
992
- "queued",
993
- "dropped",
994
- "skipped",
995
- "replayed"
996
- ]),
997
- deferral: p.optional(Jr)
998
- }), Xr = (e, t) => {
999
- let n = Ar(e);
1000
- return h.make(e.name, {
1001
- payload: x(e.payloadSchema, e.name, M(n.guards)),
1002
- success: Yr,
1003
- error: Zn({
1004
- errorSchema: e.errorSchema,
1005
- guards: n.guards
1006
- }, t)
1007
- });
1008
- }, H = p.Struct({
1009
- id: p.String,
1010
- tag: p.String,
1011
- executionId: p.String,
1012
- status: R,
1013
- payload: p.Unknown,
1014
- workflowVersion: p.NullOr(p.String),
1015
- workflowPatches: p.NullOr(p.Unknown),
1016
- output: p.NullOr(p.Unknown),
1017
- subject: p.NullOr(p.Unknown),
1018
- source: p.NullOr(p.String),
1019
- errorTag: p.NullOr(p.String),
1020
- errorMessage: p.NullOr(p.String),
1021
- cancelled: p.Boolean,
1022
- startedAt: p.DateFromString,
1023
- completedAt: p.NullOr(p.DateFromString),
1024
- durationMs: p.NullOr(p.Number),
1025
- traceId: p.NullOr(p.String),
1026
- parentExecutionId: p.NullOr(p.String),
1027
- parentClosePolicy: p.NullOr(qr)
1028
- }), Zr = p.Struct({
1029
- tag: p.optional(p.String),
1030
- status: p.optional(R),
1031
- limit: p.optional(p.Number)
1032
- }), Qr = p.Struct({
1033
- id: p.String,
1034
- runId: p.String,
1035
- stepName: p.String,
1036
- attempt: p.Number,
1037
- status: p.Literals([
1038
- "running",
1039
- "succeeded",
1040
- "failed"
1041
- ]),
1042
- input: p.NullOr(p.Unknown),
1043
- retryPolicy: p.NullOr(p.Unknown),
1044
- output: p.NullOr(p.Unknown),
1045
- errorTag: p.NullOr(p.String),
1046
- errorMessage: p.NullOr(p.String),
1047
- errorCause: p.NullOr(p.Unknown),
1048
- startedAt: p.DateFromString,
1049
- completedAt: p.NullOr(p.DateFromString),
1050
- durationMs: p.NullOr(p.Number)
1051
- }), $r = p.Struct({
1052
- id: p.String,
1053
- runId: p.String,
1054
- eventType: p.String,
1055
- payload: p.NullOr(p.Unknown),
1056
- occurredAt: p.DateFromString,
1057
- stepName: p.NullOr(p.String),
1058
- attempt: p.NullOr(p.Number)
1059
- }), ei = p.Struct({
1060
- id: p.String,
1061
- name: p.String,
1062
- payload: p.Unknown,
1063
- source: p.String,
1064
- subject: p.NullOr(p.Unknown),
1065
- traceId: p.NullOr(p.String),
1066
- occurredAt: p.DateFromString
1067
- }), ti = p.Struct({
1068
- id: p.String,
1069
- eventId: p.String,
1070
- eventName: p.String,
1071
- triggerId: p.String,
1072
- workflowName: p.String,
1073
- executionId: p.NullOr(p.String),
1074
- status: p.Literals([
1075
- "starting",
1076
- "started",
1077
- "skipped",
1078
- "failed"
1079
- ]),
1080
- idempotencyKey: p.String,
1081
- skipped: p.Boolean,
1082
- errorMessage: p.NullOr(p.String),
1083
- createdAt: p.DateFromString,
1084
- completedAt: p.NullOr(p.DateFromString)
1085
- }), ni = p.Struct({ id: p.String }), U = p.Struct({ runId: p.String }), ri = p.Struct({
1086
- name: p.optional(p.String),
1087
- limit: p.optional(p.Number)
1088
- }), ii = p.Struct({ eventId: p.String }), ai = p.Struct({
1089
- requestId: p.NonEmptyString,
1090
- cause: p.optionalKey(p.Struct({
1091
- reason: p.NonEmptyString,
1092
- detail: p.optional(p.Record(p.String, p.Unknown))
1093
- }))
1094
- }), oi = p.Struct({
1095
- workflowName: p.String,
1096
- executionId: p.String,
1097
- control: p.optional(ai)
1098
- }), si = p.Struct({
1099
- workflowName: p.NonEmptyString,
1100
- executionId: p.NonEmptyString,
1101
- operation: p.Literals(["cancel", "resume"]),
1102
- requestId: p.NonEmptyString
1103
- }), ci = p.Struct({
1104
- workflowName: p.NonEmptyString,
1105
- receiptId: p.NonEmptyString,
1106
- requestId: p.NonEmptyString
1107
- }), li = p.Struct({
1108
- ...ci.fields,
1109
- cause: ai.fields.cause
1110
- }), ui = j({
1111
- name: "__voltro.workflow.queued.cancel",
1112
- input: li,
1113
- output: V,
1114
- openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
1115
- }), di = k({
1116
- name: "__voltro.workflow.queued.control",
1117
- input: ci,
1118
- output: V,
1119
- openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
1120
- }), fi = k({
1121
- name: "__voltro.workflow.control",
1122
- input: si,
1123
- output: B,
1124
- openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
1125
- }), pi = p.Struct({
1126
- id: p.String,
1127
- signalName: p.String,
1128
- payload: p.optional(p.Unknown)
1129
- }), mi = p.Struct({
1130
- id: p.String,
1131
- updateName: p.String,
1132
- payload: p.optional(p.Unknown),
1133
- timeoutMs: p.optional(p.Number)
1134
- }), hi = p.Struct({
1135
- eventId: p.String,
1136
- updateId: p.String,
1137
- completedEventId: p.String,
1138
- result: p.Unknown
1139
- }), gi = k({
1140
- name: "__voltro.workflow.run",
1141
- source: "_voltro_workflow_runs",
1142
- input: ni,
1143
- output: p.Array(H),
1144
- openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
1145
- }), _i = k({
1146
- name: "__voltro.workflow.runs",
1147
- source: "_voltro_workflow_runs",
1148
- input: Zr,
1149
- output: p.Array(H),
1150
- openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
1151
- }), vi = k({
1152
- name: "__voltro.workflow.run.steps",
1153
- source: "_voltro_workflow_run_steps",
1154
- input: U,
1155
- output: p.Array(Qr),
1156
- openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
1157
- }), yi = k({
1158
- name: "__voltro.workflow.run.events",
1159
- source: "_voltro_workflow_run_events",
1160
- input: U,
1161
- output: p.Array($r),
1162
- openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
1163
- }), bi = k({
1164
- name: "__voltro.workflow.domainEvents",
1165
- source: "_voltro_workflow_events",
1166
- input: ri,
1167
- output: p.Array(ei),
1168
- openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
1169
- }), xi = k({
1170
- name: "__voltro.workflow.event.deliveries",
1171
- source: "_voltro_workflow_event_deliveries",
1172
- input: ii,
1173
- output: p.Array(ti),
1174
- openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
1175
- }), Si = j({
1176
- name: "__voltro.workflow.cancel",
1177
- input: oi,
1178
- output: B,
1179
- openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
1180
- }), Ci = j({
1181
- name: "__voltro.workflow.resume",
1182
- input: oi,
1183
- output: B,
1184
- openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
1185
- }), wi = j({
1186
- name: "__voltro.workflow.signal",
1187
- input: pi,
1188
- output: p.Struct({ eventId: p.String }),
1189
- openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
1190
- }), Ti = j({
1191
- name: "__voltro.workflow.update",
1192
- input: mi,
1193
- output: hi,
1194
- openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
1195
- }), Ei = p.NonEmptyString.pipe(p.check(p.makeFilter((e) => e.trim().length > 0, { message: "A workflow retry identity must not be blank" }))), Di = p.Struct({
1196
- runId: Ei,
1197
- requestId: Ei
1198
- }), Oi = p.Struct({
1199
- ...Di.fields,
1200
- payloadOverride: p.optional(p.Unknown)
1201
- }), W = {
1202
- requestId: p.NonEmptyString,
1203
- originalRunId: p.NonEmptyString,
1204
- originalExecutionId: p.NonEmptyString,
1205
- workflowName: p.NonEmptyString
1206
- }, ki = p.Union([
1207
- p.Struct({
1208
- ...W,
1209
- kind: p.Literal("queued"),
1210
- nextAttemptAt: p.NullOr(p.Number)
1211
- }),
1212
- p.Struct({
1213
- ...W,
1214
- kind: p.Literal("accepted"),
1215
- executionId: p.NonEmptyString
1216
- }).pipe(p.check(p.makeFilter((e) => e.executionId !== e.originalExecutionId, { message: "A retry cannot accept its original execution identity" }))),
1217
- p.Struct({
1218
- ...W,
1219
- kind: p.Literal("unconfirmed"),
1220
- automaticRetryStopped: p.Boolean,
1221
- nextAttemptAt: p.NullOr(p.Number)
1222
- }).pipe(p.check(p.makeFilter((e) => !e.automaticRetryStopped || e.nextAttemptAt === null, { message: "Stopped automatic retries cannot have a next attempt" }))),
1223
- p.Struct({
1224
- ...W,
1225
- kind: p.Literal("not-started"),
1226
- outcome: L
1227
- }),
1228
- p.Struct({
1229
- ...W,
1230
- kind: p.Literal("rejected"),
1231
- failureId: p.NonEmptyString
1232
- })
1233
- ]), G = p.NonEmptyString.pipe(p.check(p.makeFilter((e) => e.trim().length > 0, { message: "A workflow restart identity must not be blank" }))), Ai = p.Union([p.Struct({ kind: p.Literal("failed-steps") }), p.Struct({
1234
- kind: p.Literal("from-step"),
1235
- stepName: G
1236
- })]), K = p.Struct({
1237
- requestId: G.pipe(p.check(p.isMaxLength(64))),
1238
- runId: G
1239
- }), ji = p.Struct({
1240
- ...K.fields,
1241
- selection: Ai
1242
- }), Mi = {
1243
- ...ji.fields,
1244
- workflowName: G,
1245
- executionId: G,
1246
- originalGeneration: G,
1247
- requestedAt: p.Number.pipe(p.check(p.isFinite())),
1248
- dispatchAttempts: p.Number.check(p.isInt(), p.isGreaterThanOrEqualTo(0))
1249
- }, Ni = p.Union([
1250
- p.Struct({
1251
- ...K.fields,
1252
- kind: p.Literal("not-found")
1253
- }),
1254
- p.Struct({
1255
- ...ji.fields,
1256
- kind: p.Literal("withdrawn"),
1257
- workflowName: G,
1258
- withdrawnAt: p.Number.pipe(p.check(p.isFinite()))
1259
- }),
1260
- p.Struct({
1261
- ...Mi,
1262
- kind: p.Literal("pending")
1263
- }),
1264
- p.Struct({
1265
- ...Mi,
1266
- kind: p.Literal("entered"),
1267
- enteredGeneration: G
1268
- }).pipe(p.check(p.makeFilter((e) => e.enteredGeneration !== e.originalGeneration && e.dispatchAttempts > 0, { message: "Restart entry requires a dispatched command and a new generation" })))
1269
- ]), Pi = p.Union([Ni, p.Struct({
1270
- ...K.fields,
1271
- kind: p.Literal("not-reserved"),
1272
- reason: p.Literals(["admission", "journal"])
1273
- })]), Fi = "__voltro.undo.log", Ii = "__voltro.undo.apply", Li = "__voltro.undo.redo", Ri = p.Struct({
1274
- id: p.String,
1275
- tag: p.String,
1276
- label: p.NullOr(p.String),
1277
- undone: p.Boolean,
1278
- crossesAction: p.Boolean,
1279
- createdAt: p.String
1280
- }), zi = class extends p.TaggedError()("UndoNotFound", { invocationId: p.String }) {}, Bi = class extends p.TaggedError()("UndoForbidden", { invocationId: p.String }) {}, Vi = class extends p.TaggedError()("UndoConflict", {
1281
- invocationId: p.String,
1282
- reason: p.Literals(["conflict", "action"])
1283
- }) {}, Hi = p.Union([
1284
- zi,
1285
- Bi,
1286
- Vi
1287
- ]), Ui = k({
1288
- name: Fi,
1289
- source: "_voltro_undo_log",
1290
- input: p.Struct({ limit: p.optional(p.Number) }),
1291
- output: p.Array(Ri),
1292
- openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
1293
- }), Wi = A({
1294
- name: Ii,
1295
- input: p.Struct({ invocationId: p.String }),
1296
- output: p.Struct({ ok: p.Boolean }),
1297
- error: Hi,
1298
- openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
1299
- }), Gi = A({
1300
- name: Li,
1301
- input: p.Struct({ invocationId: p.String }),
1302
- output: p.Struct({ ok: p.Boolean }),
1303
- error: Hi,
1304
- openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
1305
- }), Ki = class extends p.TaggedError()("TenantScopeViolation", {
1306
- table: p.String,
1307
- reason: p.String
1308
- }) {}, qi = class extends p.TaggedError()("StoreOperationFailed", {
1309
- operation: p.String,
1310
- table: p.String,
1311
- cause: p.String
1312
- }) {
1313
- get message() {
1314
- return `${this.operation} on '${this.table}' failed: ${this.cause}`;
1315
- }
1316
- }, Ji = class extends p.TaggedError()("NoRowFound", {
1317
- table: p.String,
1318
- found: p.Number
1319
- }) {
1320
- get message() {
1321
- return this.found === 0 ? `expected exactly one row in '${this.table}', found none` : `expected exactly one row in '${this.table}', found more than one`;
1322
- }
1323
- }, Yi = class extends p.TaggedError()("TableValidationFailed", {
1324
- table: p.String,
1325
- summary: p.String,
1326
- issues: p.Array(p.Struct({
1327
- path: p.String,
1328
- message: p.String
1329
- }))
1330
- }) {
1331
- get message() {
1332
- return this.summary;
1333
- }
1334
- }, Xi = class extends p.TaggedError()("TenantRowNotFound", {
1335
- table: p.String,
1336
- id: p.String,
1337
- reason: p.String
1338
- }) {}, Zi = class extends p.TaggedError()("ServerOnlyColumnWrite", {
1339
- table: p.String,
1340
- columns: p.Array(p.String)
1341
- }) {}, Qi = class extends p.TaggedError()("ConstraintViolation", {
1342
- kind: p.Literals([
1343
- "foreignKey",
1344
- "foreignKeyInUse",
1345
- "unique",
1346
- "notNull",
1347
- "check"
1348
- ]),
1349
- table: p.String,
1350
- operation: p.String,
1351
- constraint: p.optional(p.String),
1352
- column: p.optional(p.String),
1353
- detail: p.optional(p.String)
1354
- }) {
1355
- get message() {
1356
- if (this.detail !== void 0) return this.detail;
1357
- let e = this.constraint ?? this.column, t = e === void 0 ? `on ${this.table}` : `${e} on ${this.table}`;
1358
- switch (this.kind) {
1359
- case "foreignKey": return `foreign key ${t}: the referenced row does not exist`;
1360
- case "foreignKeyInUse": return `foreign key ${t}: the row is still referenced by other rows`;
1361
- case "unique": return `unique constraint ${t}: a row with this value already exists`;
1362
- case "notNull": return `not-null constraint ${t}: the column requires a value`;
1363
- case "check": return `check constraint ${t}: the row does not satisfy it`;
1364
- }
1365
- }
1366
- }, $i = "__voltro.approvals.pending", ea = "__voltro.approvals.decide", ta = k({
1367
- name: $i,
1368
- source: "_voltro_approvals",
1369
- input: p.Struct({ limit: p.optional(p.Number) }),
1370
- output: p.Array(bn),
1371
- 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"
1372
- }), na = A({
1373
- name: ea,
1374
- input: p.Struct({
1375
- approvalId: p.String,
1376
- decision: p.Literals(["approve", "reject"]),
1377
- note: p.optional(p.String)
1378
- }),
1379
- output: p.Struct({
1380
- approvalId: p.String,
1381
- status: p.Literals(["approved", "rejected"])
1382
- }),
1383
- error: yn,
1384
- 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"
1385
- }), ra = "__voltro.connections.list", ia = "__voltro.connections.start", aa = "__voltro.connections.submitToken", oa = "__voltro.connections.disconnect", q = p.Literals(["oauth2", "pat"]), sa = p.Literals([
1386
- "disconnected",
1387
- "connected",
1388
- "expired",
1389
- "revoked",
1390
- "error"
1391
- ]), ca = p.Struct({
1392
- connectionId: p.String,
1393
- kind: q,
1394
- label: p.String,
1395
- status: sa,
1396
- accountId: p.NullOr(p.String),
1397
- accountLabel: p.NullOr(p.String),
1398
- scopes: p.Array(p.String),
1399
- expiresAt: p.NullOr(p.String),
1400
- lastError: p.NullOr(p.String),
1401
- connectedAt: p.NullOr(p.String)
1402
- }), la = class extends p.TaggedError()("ConnectionNotDeclared", { connectionId: p.String }) {}, ua = class extends p.TaggedError()("ConnectionSubjectRequired", { connectionId: p.String }) {}, da = class extends p.TaggedError()("ConnectionKindMismatch", {
1403
- connectionId: p.String,
1404
- expected: q,
1405
- actual: q
1406
- }) {}, fa = class extends p.TaggedError()("ConnectionHandshakeFailed", {
1407
- connectionId: p.String,
1408
- reason: p.String,
1409
- transient: p.Boolean
1410
- }) {
1411
- get message() {
1412
- return this.reason;
1413
- }
1414
- }, J = p.Union([
1415
- la,
1416
- ua,
1417
- da,
1418
- fa
1419
- ]), pa = k({
1420
- name: ra,
1421
- source: "_voltro_connections",
1422
- input: p.Struct({}),
1423
- output: p.Array(ca),
1424
- openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
1425
- }), ma = j({
1426
- name: ia,
1427
- input: p.Struct({
1428
- connectionId: p.String,
1429
- redirectTo: p.optional(p.String)
1430
- }),
1431
- output: p.Struct({
1432
- authorizeUrl: p.String,
1433
- state: p.String
1434
- }),
1435
- error: J,
1436
- openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
1437
- }), ha = A({
1438
- name: aa,
1439
- input: p.Struct({
1440
- connectionId: p.String,
1441
- token: p.String
1442
- }),
1443
- output: p.Struct({ ok: p.Boolean }),
1444
- error: J,
1445
- openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
1446
- }), ga = A({
1447
- name: oa,
1448
- input: p.Struct({ connectionId: p.String }),
1449
- output: p.Struct({ ok: p.Boolean }),
1450
- error: J,
1451
- openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
1452
- }), _a = (e) => {
1453
- let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
1454
- return Number.isNaN(t) ? 0 : t;
1455
- }, va = [
1456
- "app-store",
1457
- "play",
1458
- "mac-app-store",
1459
- "microsoft-store"
1460
- ], Y = [
1461
- {
1462
- name: "iphone-6.7",
1463
- label: "iPhone 6.7″ — 1290×2796",
1464
- kind: "phone",
1465
- viewport: {
1466
- width: 430,
1467
- height: 932
1468
- },
1469
- deviceScaleFactor: 3,
1470
- stores: ["app-store"]
1471
- },
1472
- {
1473
- name: "iphone-6.5",
1474
- label: "iPhone 6.5″ — 1242×2688",
1475
- kind: "phone",
1476
- viewport: {
1477
- width: 414,
1478
- height: 896
1479
- },
1480
- deviceScaleFactor: 3,
1481
- stores: ["app-store"]
1482
- },
1483
- {
1484
- name: "ipad-12.9",
1485
- label: "iPad 12.9″ — 2048×2732",
1486
- kind: "tablet",
1487
- viewport: {
1488
- width: 1024,
1489
- height: 1366
1490
- },
1491
- deviceScaleFactor: 2,
1492
- stores: ["app-store"]
1493
- },
1494
- {
1495
- name: "android-phone",
1496
- label: "Android phone — 1080×2160",
1497
- kind: "phone",
1498
- viewport: {
1499
- width: 360,
1500
- height: 720
1501
- },
1502
- deviceScaleFactor: 3,
1503
- stores: ["play"]
1504
- },
1505
- {
1506
- name: "android-tablet-10",
1507
- label: "Android 10″ tablet — 1600×2560",
1508
- kind: "tablet",
1509
- viewport: {
1510
- width: 800,
1511
- height: 1280
1512
- },
1513
- deviceScaleFactor: 2,
1514
- stores: ["play"]
1515
- },
1516
- {
1517
- name: "mac",
1518
- label: "Mac — 2880×1800",
1519
- kind: "desktop",
1520
- viewport: {
1521
- width: 1440,
1522
- height: 900
1523
- },
1524
- deviceScaleFactor: 2,
1525
- stores: ["mac-app-store"]
1526
- },
1527
- {
1528
- name: "windows",
1529
- label: "Windows — 1366×768",
1530
- kind: "desktop",
1531
- viewport: {
1532
- width: 1366,
1533
- height: 768
1534
- },
1535
- deviceScaleFactor: 1,
1536
- stores: ["microsoft-store"]
1537
- }
1538
- ], ya = Y.map((e) => e.name), ba = (e) => Y.find((t) => t.name === e), xa = (e) => ({
1539
- width: e.viewport.width * e.deviceScaleFactor,
1540
- height: e.viewport.height * e.deviceScaleFactor
1541
- }), Sa = (e) => Y.filter((t) => t.stores.includes(e)), Ca = 4001, wa = /* @__PURE__ */ new Set(["/rpc", "/ws"]), Ta = (e) => {
1542
- for (let [t, n] of Object.entries(e.limits ?? {})) if (n !== void 0 && (!Number.isSafeInteger(n) || n <= 0)) throw Error(`defineWebSocket: limits.${t} must be a positive safe integer`);
1543
- if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
1544
- if (wa.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
1545
- 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)}'`);
1546
- return e;
1547
- }, X = (e) => typeof e == "object" && !!e && !Array.isArray(e), Z = (e, t = /* @__PURE__ */ new Map()) => {
1548
- let n = t.get(e);
1549
- if (n !== void 0) return n;
1550
- let r = Ea(e, t);
1551
- return t.set(e, r), r;
1552
- }, Ea = (e, t) => e.encoding === void 0 ? m.isNumber(e) ? p.make(e).check(p.isFinite()).ast : m.isObjects(e) ? new m.Objects(e.propertySignatures.map((e) => new m.PropertySignature(e.name, Z(e.type, t))), e.indexSignatures.map((e) => new m.IndexSignature(e.parameter, Z(e.type, t))), e.annotations, e.checks, void 0, e.context) : m.isArrays(e) ? new m.Arrays(e.isMutable, e.elements.map((e) => Z(e, t)), e.rest.map((e) => Z(e, t)), e.annotations, e.checks, void 0, e.context) : m.isUnion(e) ? new m.Union(e.types.map((e) => Z(e, t)), e.options, e.annotations, e.checks, void 0, e.context) : m.isSuspend(e) ? new m.Suspend(() => Z(e.thunk(), t), e.annotations, e.checks, void 0, e.context) : e : e, Q = (e) => {
1553
- if (Array.isArray(e)) return e.map(Q);
1554
- if (!X(e)) return e;
1555
- let t = e.not;
1556
- if (X(t) && t.type === "null" && Object.keys(e).length === 1) return {
1557
- type: "object",
1558
- properties: {},
1559
- additionalProperties: !1
1560
- };
1561
- let n = e.anyOf;
1562
- if (Array.isArray(n)) {
1563
- if (n.length === 2) {
1564
- let t = n.find((e) => X(e) && e.type === "number"), r = n.find((e) => X(e) && e.type === "string" && Array.isArray(e.enum) && e.enum.includes("Infinity"));
1565
- if (X(t) && r !== void 0) {
1566
- let { anyOf: n, ...r } = e;
1567
- return Q({
1568
- ...r,
1569
- ...t
1570
- });
1571
- }
1572
- }
1573
- if (n.length === 1 && X(n[0])) {
1574
- let { anyOf: t, ...r } = e;
1575
- return Q({
1576
- ...r,
1577
- ...n[0]
1578
- });
1579
- }
1580
- }
1581
- let r = {};
1582
- for (let [t, n] of Object.entries(e)) r[t] = Q(n);
1583
- return r;
1584
- }, Da = (e, t = {}) => {
1585
- let n = p.make(Z(e.ast)), r = p.toJsonSchemaDocument(n, t.closed === !1 ? {} : { onExcessProperty: "error" });
1586
- return {
1587
- schema: Q(r.schema),
1588
- definitions: Q(r.definitions)
1589
- };
1590
- }, Oa = (e, t = {}) => {
1591
- let { schema: n, definitions: r } = Da(e, t);
1592
- return Object.keys(r).length === 0 ? n : {
1593
- ...n,
1594
- $defs: r
1595
- };
1596
- }, ka = "voltro-dev", Aa = "pair", $ = "voltro:pairing", ja = (e) => {
1597
- try {
1598
- let t = new URL(e);
1599
- return t.protocol === "http:" || t.protocol === "https:";
1600
- } catch {
1601
- return !1;
1602
- }
1603
- }, Ma = (e) => {
1604
- try {
1605
- let t = new URL(e).hostname;
1606
- return t === "localhost" || t === "127.0.0.1" || t === "::1" || t === "[::1]";
1607
- } catch {
1608
- return !1;
1609
- }
1610
- }, Na = (e) => {
1611
- if (!ja(e.api)) throw Error(`pairingLink: api must be an http(s) url, got ${JSON.stringify(e.api)}`);
1612
- if (Ma(e.api)) throw Error("pairingLink: api must be the LAN address — a device cannot reach localhost on this machine");
1613
- if (!/^[A-Za-z0-9_-]+$/.test(e.name)) throw Error(`pairingLink: name must be a plain identifier, got ${JSON.stringify(e.name)}`);
1614
- let t = new URLSearchParams({
1615
- api: e.api,
1616
- name: e.name
1617
- });
1618
- return e.token !== void 0 && e.token.length > 0 && t.set("token", e.token), `${ka}://${Aa}?${t.toString()}`;
1619
- }, Pa = (e) => {
1620
- let t;
1621
- try {
1622
- t = new URL(e);
1623
- } catch {
1624
- return null;
1625
- }
1626
- if (t.protocol !== "voltro-dev:" || (t.host || t.pathname.replace(/^\/+/, "")) !== "pair") return null;
1627
- let n = t.searchParams.get("api") ?? "", r = t.searchParams.get("name") ?? "", i = t.searchParams.get("token");
1628
- return !ja(n) || Ma(n) || !/^[A-Za-z0-9_-]+$/.test(r) ? null : {
1629
- api: n,
1630
- name: r,
1631
- ...i !== null && i.length > 0 ? { token: i } : {}
1632
- };
1633
- }, Fa = (e) => "getItem" in e ? {
1634
- get: async (t) => e.getItem(t),
1635
- set: async (t, n) => {
1636
- await e.setItem(t, n);
1637
- },
1638
- remove: e.removeItem ? async (t) => {
1639
- await e.removeItem(t);
1640
- } : null
1641
- } : {
1642
- get: async (t) => e.get(t),
1643
- set: async (t, n) => {
1644
- await e.set(t, n);
1645
- },
1646
- remove: e.remove ? async (t) => {
1647
- await e.remove(t);
1648
- } : null
1649
- }, Ia = async (e, t) => {
1650
- await Fa(e).set($, JSON.stringify(t));
1651
- }, La = async (e) => {
1652
- let t = await Fa(e).get($);
1653
- if (t === null || t === "") return null;
1654
- try {
1655
- let e = JSON.parse(t);
1656
- return typeof e.api != "string" || typeof e.name != "string" || !ja(e.api) ? null : {
1657
- api: e.api,
1658
- name: e.name,
1659
- ...typeof e.token == "string" && e.token.length > 0 ? { token: e.token } : {}
1660
- };
1661
- } catch {
1662
- return null;
1663
- }
1664
- }, Ra = async (e) => {
1665
- let t = Fa(e);
1666
- t.remove ? await t.remove($) : await t.set($, "");
1667
- }, za = p.Struct({
1668
- owner: p.optional(p.Boolean),
1669
- roles: p.optional(p.Array(p.String)),
1670
- groups: p.optional(p.Array(p.String)),
1671
- scopes: p.optional(p.Array(p.String)),
1672
- tenant: p.optional(p.Boolean),
1673
- apiKey: p.optional(p.Boolean),
1674
- password: p.optional(p.Boolean),
1675
- guard: p.optional(p.String)
1676
- }), Ba = p.Array(za), Va = class {
1677
- slots = [];
1678
- head = 0;
1679
- size = 0;
1680
- capacity;
1681
- constructor(e) {
1682
- this.capacity = Number.isNaN(e) ? Infinity : Math.max(0, Math.floor(e));
1683
- }
1684
- get length() {
1685
- return this.size;
1686
- }
1687
- get(e) {
1688
- if (!(!Number.isInteger(e) || e < 0 || e >= this.size)) return this.slots[(this.head + e) % this.capacity];
1689
- }
1690
- push(e) {
1691
- this.capacity !== 0 && (this.size < this.capacity ? (this.slots[(this.head + this.size) % this.capacity] = e, this.size++) : (this.slots[this.head] = e, this.head = (this.head + 1) % this.capacity));
1692
- }
1693
- clear() {
1694
- this.slots.length = 0, this.head = 0, this.size = 0;
1695
- }
1696
- *[Symbol.iterator]() {
1697
- for (let e = 0; e < this.size; e++) yield this.get(e);
1698
- }
1699
- }, Ha = 2;
1
+ import { applyRowPatch as e, createRowPatchApplier as t, diffRows as n, idToPath as r, isIdKeyed as i, patchCellSchema as a, pathToId as o, rowPatchOpSchema as s, rowPatchSchema as c } from "./rowPatch.js";
2
+ import { firstEventValue as l, subscriptionEvent as u } from "./subscriptionEvent.js";
3
+ import { RequestedTenantRefused as d, TenantSelectionRefused as f, isTenantSelectable as p, selectSubjectTenant as m } from "./tenantSelection.js";
4
+ import { AuthMiddleware as h, ConnectionInfo as g, ConnectionInfoMiddleware as _, DEFAULT_SCOPE_CACHE_MAX_ENTRIES as v, DEFAULT_SCOPE_CACHE_TTL_MS as y, IMPERSONATION_METADATA_KEY as b, Subject as x, SubjectIdentity as S, SubjectService as C, Unauthenticated as w, anonymousSubject as T, applyScopeDecision as E, assertAuthenticated as D, bindSubjectAuthority as O, composeAuthStrategies as k, currentSubjectAuthority as A, hasCallbackRoutes as j, isMachineSubject as M, isServiceSubject as N, isSystemSubject as P, makeScopeCache as F, orderByBearerPrefix as I, rawImpersonationMark as L, reauthorizeSubject as R, resolveIdentityAuthority as z, scopeCacheKey as B, serviceSubject as V, subjectAuditActorId as H, subjectIdentity as U, systemSubject as W, tenantScopedSubject as G } from "./auth.js";
5
+ import { ADMIN_SCOPE as K, APIKEY_ISSUE_ORG_SCOPE as q, APIKEY_ISSUE_OTHER_SCOPE as J, APIKEY_ISSUE_SELF_SCOPE as Y, DEVICES_MANAGE_SCOPE as X, NoSuchResource as Z, ScopeError as Q, advisoryResourceGuardWarning as $, checkGuards as ee, checkGuardsEffect as te, declaresResourceGuard as ne, effectiveScopes as re, findAdvisoryResourceGuards as ie, getPolicyGuardResolver as ae, getResourceScopeResolver as oe, hasEffectiveScope as se, hasScope as ce, isAuthenticatedCheck as le, isOpenAccess as ue, isPolicyCheck as de, isServiceAccess as fe, isUpgradedCheck as pe, missingAccessDecision as me, openAccessSpec as he, recheckGuardsEffect as ge, refreshEffectiveScopes as _e, requireScope as ve, resolvePolicyAction as ye, serviceAccessSpec as be, serviceCallersOf as xe, setEffectiveScopes as Se, setEffectiveScopesRefresher as Ce, setPolicyGuardResolver as we, setResourceScopeResolver as Te, subjectScopes as Ee, upgradedGuardShapeError as De } from "./scopes.js";
6
+ import { inputLabel as Oe, strictInput as ke } from "./strictInput.js";
7
+ import { BusinessRuleViolation as Ae } from "./businessRule.js";
8
+ import { DEFAULT_IN_FLIGHT_LEASE_MS as je, MUTATION_IN_FLIGHT_RETRY_AFTER_MS as Me, MutationConnectionRequired as Ne, MutationIdempotencyRefused as Pe, MutationInFlight as Fe, beginIdempotent as Ie, failIdempotent as Le, finishIdempotent as Re, freshFor as ze, holdIdempotentClaim as Be, idempotencyScope as Ve, memoryIdempotencyStore as He, wsMutationIdempotencyScope as Ue } from "./idempotency.js";
9
+ import { ValidationError as We, ValidationErrors as Ge, ValidationIssue as Ke, fieldIssuesOf as qe } from "./validation.js";
10
+ import { ApprovalDecisionErrors as Je, ApprovalErrors as Ye, ApprovalExpired as Xe, ApprovalForbidden as Ze, ApprovalNotFound as Qe, ApprovalNotPending as $e, ApprovalRejected as et, ApprovalRequired as tt, ApprovalSelfApproval as nt, ApprovalUnavailable as rt, PendingApproval as it } from "./approval.js";
11
+ import { REACTIVITY_CHANNEL_PREFIX as at, declaredReactivityChannelKeys as ot, isReactivityChannel as st, isReactivityChannelKey as ct, normalizeSource as lt, publishReactivity as ut, reactivityChannel as dt, sourceKeys as ft, undeclaredChannelKeys as pt } from "./reactivityChannel.js";
12
+ import { captureOptionalQuerySources as mt } from "./queryOptionalSources.js";
13
+ import { FRAMEWORK_WIRE_ERRORS as ht, SERVICE_NAME_PATTERN as gt, actionToRpc as _t, defineAction as vt, defineMutation as yt, defineQuery as bt, defineStream as xt, hasAccessDecision as St, hasEnforcedGuard as Ct, isAuthenticatedGuard as wt, isClientReachable as Tt, isPolicyGuard as Et, isServiceReachable as Dt, isUpgradedGuard as Ot, isWireReachable as kt, mutationToRpc as At, normalizeDescriptor as jt, queryToRpc as Mt, requireUpgraded as Nt, streamToRpc as Pt, toRpc as Ft, wireAudienceOf as It, wireErrorUnion as Lt, withRpcTag as Rt, workflowWireErrorUnion as zt } from "./procedure.js";
14
+ import { errorMessage as Bt, errorTag as Vt, reportableError as Ht } from "./errorValue.js";
15
+ import { declaredErrorTags as Ut, errorMemberSchema as Wt } from "./errorSchema.js";
16
+ import { canonicalJson as Gt } from "./canonicalJson.js";
17
+ import { prepareIdempotentInput as Kt } from "./idempotencyInput.js";
18
+ import { EVENT_ROUTE_SEP as qt, EventKeyInvalid as Jt, EventPayloadInvalid as Yt, EventPayloadTooLarge as Xt, EventRpcWorkload as Zt, MAX_EVENT_ENVELOPE_BYTES as Qt, defineEvent as $t, encodeEventKey as en, eventAttached as tn, eventEnvelope as nn, eventGap as rn, eventResumePoint as an, eventRoute as on, eventStreamEvent as sn, eventSubscribeInput as cn, eventToRpc as ln, formatEventRoute as un, isEventDescriptor as dn, parseEventRoute as fn } from "./event.js";
19
+ import { DEV_ACTIVITY_EVENT as pn } from "./devActivity.js";
20
+ import { WorkflowAccessProperty as mn, attachWorkflowAccess as hn, getWorkflowAccess as gn, resolveWorkflowAccess as _n, workflowAccessDescriptor as vn } from "./workflowAccess.js";
21
+ import { compareSurfaces as yn, groupShapeDigests as bn, procedureShapeDigest as xn, schemaShape as Sn, shapeDigest as Cn } from "./schemaShape.js";
22
+ import { parseRevalidateMs as wn } from "./revalidate.js";
23
+ import { ApiUnavailable as Tn, isApiUnavailable as En } from "./serviceCall.js";
24
+ import { API_WORKLOADS as Dn, checkFrameworkCompat as On, composeReplayAuthorityBindings as kn, composeRpcInterceptors as An, definePlugin as jn, definePluginRoute as Mn, definePluginService as Nn, pluginInstanceName as Pn } from "./plugin.js";
25
+ import { PluginPrivacyErasePhaseSchema as Fn, PluginPrivacyFailure as In, createPluginPrivacyRegistry as Ln } from "./pluginPrivacy.js";
26
+ import { PluginAccountMergeFailure as Rn, createPluginAccountMergeRegistry as zn } from "./pluginAccountMerge.js";
27
+ import { validateHttpStreamMaxDuration as Bn } from "./httpStreamMaxDuration.js";
28
+ import { validateOutboxHandlerDefinition as Vn } from "./outbox.js";
29
+ import { pluginAlias as Hn, pluginSlug as Un, pluginTag as Wn, registerPluginAliases as Gn, resetPluginAliases as Kn } from "./pluginNaming.js";
30
+ import { publishServerError as qn, subscribeServerErrors as Jn, withheldServerError as Yn } from "./serverErrorBus.js";
31
+ import { WorkflowStartTerminalOutcomeSchema as Xn } from "./workflowStartOutcome.js";
32
+ import { WorkflowControlInputSchema as Zn, WorkflowControlIntentSchema as Qn, WorkflowControlReadInputSchema as $n, WorkflowControlResultSchema as er, WorkflowDomainEventRowSchema as tr, WorkflowDomainEventsInputSchema as nr, WorkflowEventDeliveriesInputSchema as rr, WorkflowEventDeliveryRowSchema as ir, WorkflowParentClosePolicySchema as ar, WorkflowQueuedCancelInputSchema as or, WorkflowQueuedCancellationResultSchema as sr, WorkflowQueuedControlTargetSchema as cr, WorkflowRunEventRowSchema as lr, WorkflowRunHandleSchema as ur, WorkflowRunRefSchema as dr, WorkflowRunRowSchema as fr, WorkflowRunSnapshotSchema as pr, WorkflowRunStatusSchema as mr, WorkflowRunStepRowSchema as hr, WorkflowRunTableRefSchema as gr, WorkflowRunsInputSchema as _r, WorkflowSignalInputSchema as vr, WorkflowStartDeferralSchema as yr, WorkflowUpdateInputSchema as br, WorkflowUpdateResultSchema as xr, workflowCancelDescriptor as Sr, workflowControlQueryDescriptor as Cr, workflowDomainEventsQueryDescriptor as wr, workflowEventDeliveriesQueryDescriptor as Tr, workflowQueuedCancelDescriptor as Er, workflowQueuedControlQueryDescriptor as Dr, workflowResumeDescriptor as Or, workflowRunEventsQueryDescriptor as kr, workflowRunQueryDescriptor as Ar, workflowRunStepsQueryDescriptor as jr, workflowRunsQueryDescriptor as Mr, workflowSignalDescriptor as Nr, workflowToRpc as Pr, workflowUpdateDescriptor as Fr } from "./workflow.js";
33
+ import { WorkflowRetryCommandSchema as Ir, WorkflowRetryObservationSchema as Lr, WorkflowRetryTargetSchema as Rr } from "./workflowRetry.js";
34
+ import { WorkflowRestartCommandSchema as zr, WorkflowRestartObservationSchema as Br, WorkflowRestartResultSchema as Vr, WorkflowRestartSelectionSchema as Hr, WorkflowRestartTargetSchema as Ur } from "./workflowRestart.js";
35
+ import { UNDO_APPLY_TAG as Wr, UNDO_LOG_TAG as Gr, UNDO_REDO_TAG as Kr, UndoConflict as qr, UndoForbidden as Jr, UndoLogEntry as Yr, UndoNotFound as Xr, undoApplyDescriptor as Zr, undoLogQueryDescriptor as Qr, undoRedoDescriptor as $r } from "./undo.js";
36
+ import { ssrfReason as ei } from "./ssrfPolicy.js";
37
+ import { ConstraintViolation as ti, NoRowFound as ni, ServerOnlyColumnWrite as ri, StoreOperationFailed as ii, TableValidationFailed as ai, TenantRowNotFound as oi, TenantScopeViolation as si } from "./storeErrors.js";
38
+ import { APPROVALS_DECIDE_TAG as ci, APPROVALS_PENDING_TAG as li, approvalsDecideDescriptor as ui, approvalsPendingQueryDescriptor as di } from "./approvalDescriptors.js";
39
+ import { CONNECTIONS_LIST_TAG as fi, CONNECTION_DISCONNECT_TAG as pi, CONNECTION_START_TAG as mi, CONNECTION_SUBMIT_TOKEN_TAG as hi, ConnectionHandshakeFailed as gi, ConnectionKind as _i, ConnectionKindMismatch as vi, ConnectionNotDeclared as yi, ConnectionState as bi, ConnectionStatus as xi, ConnectionSubjectRequired as Si, connectionDisconnectDescriptor as Ci, connectionStartDescriptor as wi, connectionSubmitTokenDescriptor as Ti, connectionsListQueryDescriptor as Ei } from "./connection.js";
40
+ import { tsMs as Di } from "./time.js";
41
+ import { STORE_SCREENSHOT_PRESETS as Oi, STORE_SCREENSHOT_PRESET_NAMES as ki, STORE_SCREENSHOT_STORES as Ai, storeScreenshotPixels as ji, storeScreenshotPreset as Mi, storeScreenshotPresetsFor as Ni } from "./storeScreenshots.js";
42
+ import { GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE as Pi, defineWebSocket as Fi } from "./webSocketGateway.js";
43
+ import { SESSION_HEADER_NAME as Ii, sessionValueFromHeaders as Li } from "./sessionHeader.js";
44
+ import { JSONAPI_MEDIA_TYPE as Ri, PROBLEM_JSON as zi, REST_PROFILE_NAMES as Bi, encodeRestError as Vi, encodeRestSuccess as Hi, nextLink as Ui, problemDetails as Wi, problemTypeOf as Gi, resolveRestFormat as Ki, restViewSchema as qi, toSnakeCase as Ji } from "./restFormat.js";
45
+ import { finiteNumberView as Yi, jsonSchemaDocumentOf as Xi, jsonSchemaOf as Zi, plainJsonSchema as Qi } from "./jsonSchema.js";
46
+ import { PAIRING_HOST as $i, PAIRING_SCHEME as ea, PAIRING_STORAGE_KEY as ta, applyPairing as na, clearPairing as ra, pairingLink as ia, parsePairingLink as aa, readPairing as oa } from "./pairing.js";
47
+ import { apiRoleEndpointUrl as sa, apiRoleProxyBasePath as ca, captureApiRoleEndpoints as la, selectApiRoleEndpoint as ua } from "./apiRoleEndpoints.js";
48
+ import { ApiRoleObservationSchema as da } from "./apiRoleObservation.js";
49
+ import { StorageAccessPolicySchema as fa, StorageAccessRuleSchema as pa } from "./storageAccess.js";
50
+ import { BoundedRing as ma } from "./boundedRing.js";
51
+ import { FORM_CAPTURE_FIELD as ha, FORM_CAPTURE_META_NAME as ga, encodeNativeFormCapture as _a, formCaptureSource as va, readFormCaptureSource as ya } from "./formCapture.js";
52
+ //#region src/index.ts
53
+ var ba = 2;
1700
54
  //#endregion
1701
- export { Be as ADMIN_SCOPE, Me as APIKEY_ISSUE_ORG_SCOPE, Le as APIKEY_ISSUE_OTHER_SCOPE, Ee as APIKEY_ISSUE_SELF_SCOPE, ea as APPROVALS_DECIDE_TAG, $i as APPROVALS_PENDING_TAG, Mr as ApiUnavailable, yn as ApprovalDecisionErrors, vn as ApprovalErrors, mn as ApprovalExpired, gn as ApprovalForbidden, dn as ApprovalNotFound, hn as ApprovalNotPending, pn as ApprovalRejected, un as ApprovalRequired, fn as ApprovalSelfApproval, _n as ApprovalUnavailable, re as AuthMiddleware, Va as BoundedRing, sn as BusinessRuleViolation, ra as CONNECTIONS_LIST_TAG, oa as CONNECTION_DISCONNECT_TAG, ia as CONNECTION_START_TAG, aa as CONNECTION_SUBMIT_TOKEN_TAG, fa as ConnectionHandshakeFailed, ie as ConnectionInfo, oe as ConnectionInfoMiddleware, q as ConnectionKind, da as ConnectionKindMismatch, la as ConnectionNotDeclared, ca as ConnectionState, sa as ConnectionStatus, ua as ConnectionSubjectRequired, Qi as ConstraintViolation, rt as DEFAULT_IN_FLIGHT_LEASE_MS, o as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, l as DEFAULT_SCOPE_CACHE_TTL_MS, _e as DEVICES_MANAGE_SCOPE, Sr as EVENT_ROUTE_SEP, yr as EventKeyInvalid, vr as EventPayloadInvalid, br as EventPayloadTooLarge, Xn as FRAMEWORK_WIRE_ERRORS, Ca as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, ne as IMPERSONATION_METADATA_KEY, yt as JSONAPI_MEDIA_TYPE, cr as MAX_EVENT_ENVELOPE_BYTES, Ct as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, $e as MutationConnectionRequired, Ye as MutationInFlight, Ji as NoRowFound, d as NoSuchResource, Aa as PAIRING_HOST, ka as PAIRING_SCHEME, $ as PAIRING_STORAGE_KEY, mt as PROBLEM_JSON, Ha as PROTOCOL_VERSION, bn as PendingApproval, w as REACTIVITY_CHANNEL_PREFIX, _t as REST_PROFILE_NAMES, In as SERVICE_NAME_PATTERN, Et as SESSION_HEADER_NAME, Y as STORE_SCREENSHOT_PRESETS, ya as STORE_SCREENSHOT_PRESET_NAMES, va as STORE_SCREENSHOT_STORES, f as ScopeError, Zi as ServerOnlyColumnWrite, Ba as StorageAccessPolicySchema, za as StorageAccessRuleSchema, qi as StoreOperationFailed, ce as Subject, qe as SubjectIdentity, n as SubjectService, Yi as TableValidationFailed, Xi as TenantRowNotFound, Ki as TenantScopeViolation, ve as TenantSelectionRefused, Ii as UNDO_APPLY_TAG, Fi as UNDO_LOG_TAG, Li as UNDO_REDO_TAG, u as Unauthenticated, Vi as UndoConflict, Bi as UndoForbidden, Ri as UndoLogEntry, zi as UndoNotFound, S as ValidationError, C as ValidationErrors, cn as ValidationIssue, Er as WorkflowAccessProperty, oi as WorkflowControlInputSchema, ai as WorkflowControlIntentSchema, si as WorkflowControlReadInputSchema, B as WorkflowControlResultSchema, ei as WorkflowDomainEventRowSchema, ri as WorkflowDomainEventsInputSchema, ii as WorkflowEventDeliveriesInputSchema, ti as WorkflowEventDeliveryRowSchema, qr as WorkflowParentClosePolicySchema, li as WorkflowQueuedCancelInputSchema, V as WorkflowQueuedCancellationResultSchema, ci as WorkflowQueuedControlTargetSchema, ji as WorkflowRestartCommandSchema, Ni as WorkflowRestartObservationSchema, Pi as WorkflowRestartResultSchema, Ai as WorkflowRestartSelectionSchema, K as WorkflowRestartTargetSchema, Oi as WorkflowRetryCommandSchema, ki as WorkflowRetryObservationSchema, Di as WorkflowRetryTargetSchema, $r as WorkflowRunEventRowSchema, Yr as WorkflowRunHandleSchema, ni as WorkflowRunRefSchema, H as WorkflowRunRowSchema, z as WorkflowRunSnapshotSchema, R as WorkflowRunStatusSchema, Qr as WorkflowRunStepRowSchema, U as WorkflowRunTableRefSchema, Zr as WorkflowRunsInputSchema, pi as WorkflowSignalInputSchema, Jr as WorkflowStartDeferralSchema, L as WorkflowStartTerminalOutcomeSchema, mi as WorkflowUpdateInputSchema, hi as WorkflowUpdateResultSchema, tr as actionToRpc, be as advisoryResourceGuardWarning, c as anonymousSubject, Ia as applyPairing, Xt as applyRowPatch, de as applyScopeDecision, na as approvalsDecideDescriptor, ta as approvalsPendingQueryDescriptor, fe as assertAuthenticated, kr as attachWorkflowAccess, St as beginIdempotent, zr as checkFrameworkCompat, Ae as checkGuards, He as checkGuardsEffect, Ra as clearPairing, ct as compareSurfaces, s as composeAuthStrategies, Lr as composeRpcInterceptors, ga as connectionDisconnectDescriptor, ma as connectionStartDescriptor, ha as connectionSubmitTokenDescriptor, pa as connectionsListQueryDescriptor, Qt as createRowPatchApplier, Dn as declaredReactivityChannelKeys, xe as declaresResourceGuard, j as defineAction, ur as defineEvent, A as defineMutation, Pr as definePlugin, Fr as definePluginRoute, Rr as definePluginService, k as defineQuery, Hn as defineStream, Ta as defineWebSocket, Jt as diffRows, Ce as effectiveScopes, xr as encodeEventKey, lt as encodeRestError, nt as encodeRestSuccess, ir as errorMessage, rr as errorTag, pr as eventAttached, dr as eventEnvelope, fr as eventGap, hr as eventResumePoint, Cr as eventRoute, mr as eventStreamEvent, gr as eventSubscribeInput, _r as eventToRpc, et as failIdempotent, ln as fieldIssuesOf, Fe as findAdvisoryResourceGuards, Ze as finishIdempotent, Z as finiteNumberView, en as firstEventValue, Tr as formatEventRoute, Xe as freshFor, je as getPolicyGuardResolver, Te as getResourceScopeResolver, Ar as getWorkflowAccess, st as groupShapeDigests, Vn as hasAccessDecision, te as hasCallbackRoutes, we as hasEffectiveScope, M as hasEnforcedGuard, ge as hasScope, Qe as holdIdempotentClaim, _ as idToPath, dt as idempotencyScope, tn as inputLabel, Nr as isApiUnavailable, Ue as isAuthenticatedCheck, Bn as isAuthenticatedGuard, Pn as isClientReachable, lr as isEventDescriptor, Yt as isIdKeyed, Ie as isMachineSubject, Ke as isOpenAccess, ye as isPolicyCheck, zn as isPolicyGuard, Tn as isReactivityChannel, En as isReactivityChannelKey, Ge as isServiceAccess, Fn as isServiceReachable, ee as isServiceSubject, me as isSystemSubject, Pe as isTenantSelectable, Mn as isWireReachable, Da as jsonSchemaDocumentOf, Oa as jsonSchemaOf, pe as makeScopeCache, Je as memoryIdempotencyStore, le as missingAccessDecision, er as mutationToRpc, ht as nextLink, sr as normalizeDescriptor, kn as normalizeSource, r as openAccessSpec, he as orderByBearerPrefix, Na as pairingLink, wr as parseEventRoute, Pa as parsePairingLink, Ht as patchCellSchema, v as pathToId, Q as plainJsonSchema, Vr as pluginAlias, Ir as pluginInstanceName, Hr as pluginSlug, Kr as pluginTag, vt as problemDetails, it as problemTypeOf, tt as procedureShapeDigest, jn as publishReactivity, ot as publishServerError, $n as queryToRpc, se as rawImpersonationMark, wn as reactivityChannel, La as readPairing, Wr as registerPluginAliases, ar as reportableError, We as requireScope, Gr as resetPluginAliases, ue as resolvePolicyAction, ft as resolveRestFormat, Or as resolveWorkflowAccess, bt as restViewSchema, Wt as rowPatchOpSchema, Gt as rowPatchSchema, xt as schemaShape, e as scopeCacheKey, ze as selectSubjectTenant, a as serviceAccessSpec, i as serviceCallersOf, Se as serviceSubject, Tt as sessionValueFromHeaders, ae as setEffectiveScopes, ke as setPolicyGuardResolver, t as setResourceScopeResolver, wt as shapeDigest, On as sourceKeys, xa as storeScreenshotPixels, ba as storeScreenshotPreset, Sa as storeScreenshotPresetsFor, nr as streamToRpc, x as strictInput, Ve as subjectAuditActorId, Ne as subjectIdentity, Oe as subjectScopes, gt as subscribeServerErrors, $t as subscriptionEvent, Re as systemSubject, De as tenantScopedSubject, or as toRpc, at as toSnakeCase, _a as tsMs, An as undeclaredChannelKeys, Wi as undoApplyDescriptor, Ui as undoLogQueryDescriptor, Gi as undoRedoDescriptor, Nn as wireAudienceOf, N as wireErrorUnion, Qn as withRpcTag, pt as withheldServerError, jr as workflowAccessDescriptor, Si as workflowCancelDescriptor, fi as workflowControlQueryDescriptor, bi as workflowDomainEventsQueryDescriptor, xi as workflowEventDeliveriesQueryDescriptor, ui as workflowQueuedCancelDescriptor, di as workflowQueuedControlQueryDescriptor, Ci as workflowResumeDescriptor, yi as workflowRunEventsQueryDescriptor, gi as workflowRunQueryDescriptor, vi as workflowRunStepsQueryDescriptor, _i as workflowRunsQueryDescriptor, wi as workflowSignalDescriptor, Xr as workflowToRpc, Ti as workflowUpdateDescriptor, Zn as workflowWireErrorUnion, ut as wsMutationIdempotencyScope };
55
+ export { K as ADMIN_SCOPE, q as APIKEY_ISSUE_ORG_SCOPE, J as APIKEY_ISSUE_OTHER_SCOPE, Y as APIKEY_ISSUE_SELF_SCOPE, Dn as API_WORKLOADS, ci as APPROVALS_DECIDE_TAG, li as APPROVALS_PENDING_TAG, da as ApiRoleObservationSchema, Tn as ApiUnavailable, Je as ApprovalDecisionErrors, Ye as ApprovalErrors, Xe as ApprovalExpired, Ze as ApprovalForbidden, Qe as ApprovalNotFound, $e as ApprovalNotPending, et as ApprovalRejected, tt as ApprovalRequired, nt as ApprovalSelfApproval, rt as ApprovalUnavailable, h as AuthMiddleware, ma as BoundedRing, Ae as BusinessRuleViolation, fi as CONNECTIONS_LIST_TAG, pi as CONNECTION_DISCONNECT_TAG, mi as CONNECTION_START_TAG, hi as CONNECTION_SUBMIT_TOKEN_TAG, gi as ConnectionHandshakeFailed, g as ConnectionInfo, _ as ConnectionInfoMiddleware, _i as ConnectionKind, vi as ConnectionKindMismatch, yi as ConnectionNotDeclared, bi as ConnectionState, xi as ConnectionStatus, Si as ConnectionSubjectRequired, ti as ConstraintViolation, je as DEFAULT_IN_FLIGHT_LEASE_MS, v as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, y as DEFAULT_SCOPE_CACHE_TTL_MS, X as DEVICES_MANAGE_SCOPE, pn as DEV_ACTIVITY_EVENT, qt as EVENT_ROUTE_SEP, Jt as EventKeyInvalid, Yt as EventPayloadInvalid, Xt as EventPayloadTooLarge, Zt as EventRpcWorkload, ha as FORM_CAPTURE_FIELD, ga as FORM_CAPTURE_META_NAME, ht as FRAMEWORK_WIRE_ERRORS, Pi as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, b as IMPERSONATION_METADATA_KEY, Ri as JSONAPI_MEDIA_TYPE, Qt as MAX_EVENT_ENVELOPE_BYTES, Me as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, Ne as MutationConnectionRequired, Pe as MutationIdempotencyRefused, Fe as MutationInFlight, ni as NoRowFound, Z as NoSuchResource, $i as PAIRING_HOST, ea as PAIRING_SCHEME, ta as PAIRING_STORAGE_KEY, zi as PROBLEM_JSON, ba as PROTOCOL_VERSION, it as PendingApproval, Rn as PluginAccountMergeFailure, Fn as PluginPrivacyErasePhaseSchema, In as PluginPrivacyFailure, at as REACTIVITY_CHANNEL_PREFIX, Bi as REST_PROFILE_NAMES, d as RequestedTenantRefused, gt as SERVICE_NAME_PATTERN, Ii as SESSION_HEADER_NAME, Oi as STORE_SCREENSHOT_PRESETS, ki as STORE_SCREENSHOT_PRESET_NAMES, Ai as STORE_SCREENSHOT_STORES, Q as ScopeError, ri as ServerOnlyColumnWrite, fa as StorageAccessPolicySchema, pa as StorageAccessRuleSchema, ii as StoreOperationFailed, x as Subject, S as SubjectIdentity, C as SubjectService, ai as TableValidationFailed, oi as TenantRowNotFound, si as TenantScopeViolation, f as TenantSelectionRefused, Wr as UNDO_APPLY_TAG, Gr as UNDO_LOG_TAG, Kr as UNDO_REDO_TAG, w as Unauthenticated, qr as UndoConflict, Jr as UndoForbidden, Yr as UndoLogEntry, Xr as UndoNotFound, We as ValidationError, Ge as ValidationErrors, Ke as ValidationIssue, mn as WorkflowAccessProperty, Zn as WorkflowControlInputSchema, Qn as WorkflowControlIntentSchema, $n as WorkflowControlReadInputSchema, er as WorkflowControlResultSchema, tr as WorkflowDomainEventRowSchema, nr as WorkflowDomainEventsInputSchema, rr as WorkflowEventDeliveriesInputSchema, ir as WorkflowEventDeliveryRowSchema, ar as WorkflowParentClosePolicySchema, or as WorkflowQueuedCancelInputSchema, sr as WorkflowQueuedCancellationResultSchema, cr as WorkflowQueuedControlTargetSchema, zr as WorkflowRestartCommandSchema, Br as WorkflowRestartObservationSchema, Vr as WorkflowRestartResultSchema, Hr as WorkflowRestartSelectionSchema, Ur as WorkflowRestartTargetSchema, Ir as WorkflowRetryCommandSchema, Lr as WorkflowRetryObservationSchema, Rr as WorkflowRetryTargetSchema, lr as WorkflowRunEventRowSchema, ur as WorkflowRunHandleSchema, dr as WorkflowRunRefSchema, fr as WorkflowRunRowSchema, pr as WorkflowRunSnapshotSchema, mr as WorkflowRunStatusSchema, hr as WorkflowRunStepRowSchema, gr as WorkflowRunTableRefSchema, _r as WorkflowRunsInputSchema, vr as WorkflowSignalInputSchema, yr as WorkflowStartDeferralSchema, Xn as WorkflowStartTerminalOutcomeSchema, br as WorkflowUpdateInputSchema, xr as WorkflowUpdateResultSchema, _t as actionToRpc, $ as advisoryResourceGuardWarning, T as anonymousSubject, sa as apiRoleEndpointUrl, ca as apiRoleProxyBasePath, na as applyPairing, e as applyRowPatch, E as applyScopeDecision, ui as approvalsDecideDescriptor, di as approvalsPendingQueryDescriptor, D as assertAuthenticated, hn as attachWorkflowAccess, Ie as beginIdempotent, O as bindSubjectAuthority, Gt as canonicalJson, la as captureApiRoleEndpoints, mt as captureOptionalQuerySources, On as checkFrameworkCompat, ee as checkGuards, te as checkGuardsEffect, ra as clearPairing, yn as compareSurfaces, k as composeAuthStrategies, kn as composeReplayAuthorityBindings, An as composeRpcInterceptors, Ci as connectionDisconnectDescriptor, wi as connectionStartDescriptor, Ti as connectionSubmitTokenDescriptor, Ei as connectionsListQueryDescriptor, zn as createPluginAccountMergeRegistry, Ln as createPluginPrivacyRegistry, t as createRowPatchApplier, A as currentSubjectAuthority, Ut as declaredErrorTags, ot as declaredReactivityChannelKeys, ne as declaresResourceGuard, vt as defineAction, $t as defineEvent, yt as defineMutation, jn as definePlugin, Mn as definePluginRoute, Nn as definePluginService, bt as defineQuery, xt as defineStream, Fi as defineWebSocket, n as diffRows, re as effectiveScopes, en as encodeEventKey, _a as encodeNativeFormCapture, Vi as encodeRestError, Hi as encodeRestSuccess, Wt as errorMemberSchema, Bt as errorMessage, Vt as errorTag, tn as eventAttached, nn as eventEnvelope, rn as eventGap, an as eventResumePoint, on as eventRoute, sn as eventStreamEvent, cn as eventSubscribeInput, ln as eventToRpc, Le as failIdempotent, qe as fieldIssuesOf, ie as findAdvisoryResourceGuards, Re as finishIdempotent, Yi as finiteNumberView, l as firstEventValue, va as formCaptureSource, un as formatEventRoute, ze as freshFor, ae as getPolicyGuardResolver, oe as getResourceScopeResolver, gn as getWorkflowAccess, bn as groupShapeDigests, St as hasAccessDecision, j as hasCallbackRoutes, se as hasEffectiveScope, Ct as hasEnforcedGuard, ce as hasScope, Be as holdIdempotentClaim, r as idToPath, Ve as idempotencyScope, Oe as inputLabel, En as isApiUnavailable, le as isAuthenticatedCheck, wt as isAuthenticatedGuard, Tt as isClientReachable, dn as isEventDescriptor, i as isIdKeyed, M as isMachineSubject, ue as isOpenAccess, de as isPolicyCheck, Et as isPolicyGuard, st as isReactivityChannel, ct as isReactivityChannelKey, fe as isServiceAccess, Dt as isServiceReachable, N as isServiceSubject, P as isSystemSubject, p as isTenantSelectable, pe as isUpgradedCheck, Ot as isUpgradedGuard, kt as isWireReachable, Xi as jsonSchemaDocumentOf, Zi as jsonSchemaOf, F as makeScopeCache, He as memoryIdempotencyStore, me as missingAccessDecision, At as mutationToRpc, Ui as nextLink, jt as normalizeDescriptor, lt as normalizeSource, he as openAccessSpec, I as orderByBearerPrefix, ia as pairingLink, fn as parseEventRoute, aa as parsePairingLink, wn as parseRevalidateMs, a as patchCellSchema, o as pathToId, Qi as plainJsonSchema, Hn as pluginAlias, Pn as pluginInstanceName, Un as pluginSlug, Wn as pluginTag, Kt as prepareIdempotentInput, Wi as problemDetails, Gi as problemTypeOf, xn as procedureShapeDigest, ut as publishReactivity, qn as publishServerError, Mt as queryToRpc, L as rawImpersonationMark, dt as reactivityChannel, ya as readFormCaptureSource, oa as readPairing, R as reauthorizeSubject, ge as recheckGuardsEffect, _e as refreshEffectiveScopes, Gn as registerPluginAliases, Ht as reportableError, ve as requireScope, Nt as requireUpgraded, Kn as resetPluginAliases, z as resolveIdentityAuthority, ye as resolvePolicyAction, Ki as resolveRestFormat, _n as resolveWorkflowAccess, qi as restViewSchema, s as rowPatchOpSchema, c as rowPatchSchema, Sn as schemaShape, B as scopeCacheKey, ua as selectApiRoleEndpoint, m as selectSubjectTenant, be as serviceAccessSpec, xe as serviceCallersOf, V as serviceSubject, Li as sessionValueFromHeaders, Se as setEffectiveScopes, Ce as setEffectiveScopesRefresher, we as setPolicyGuardResolver, Te as setResourceScopeResolver, Cn as shapeDigest, ft as sourceKeys, ei as ssrfReason, ji as storeScreenshotPixels, Mi as storeScreenshotPreset, Ni as storeScreenshotPresetsFor, Pt as streamToRpc, ke as strictInput, H as subjectAuditActorId, U as subjectIdentity, Ee as subjectScopes, Jn as subscribeServerErrors, u as subscriptionEvent, W as systemSubject, G as tenantScopedSubject, Ft as toRpc, Ji as toSnakeCase, Di as tsMs, pt as undeclaredChannelKeys, Zr as undoApplyDescriptor, Qr as undoLogQueryDescriptor, $r as undoRedoDescriptor, De as upgradedGuardShapeError, Bn as validateHttpStreamMaxDuration, Vn as validateOutboxHandlerDefinition, It as wireAudienceOf, Lt as wireErrorUnion, Rt as withRpcTag, Yn as withheldServerError, vn as workflowAccessDescriptor, Sr as workflowCancelDescriptor, Cr as workflowControlQueryDescriptor, wr as workflowDomainEventsQueryDescriptor, Tr as workflowEventDeliveriesQueryDescriptor, Er as workflowQueuedCancelDescriptor, Dr as workflowQueuedControlQueryDescriptor, Or as workflowResumeDescriptor, kr as workflowRunEventsQueryDescriptor, Ar as workflowRunQueryDescriptor, jr as workflowRunStepsQueryDescriptor, Mr as workflowRunsQueryDescriptor, Nr as workflowSignalDescriptor, Pr as workflowToRpc, Fr as workflowUpdateDescriptor, zt as workflowWireErrorUnion, Ue as wsMutationIdempotencyScope };