@voltro/protocol 0.69.0 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +168 -0
- package/dist/index.d.ts +460 -11
- package/dist/index.js +204 -196
- package/dist/rest.d.ts +392 -12
- package/dist/rest.js +374 -127
- package/dist/restFormat-Bnngx-zI.js +232 -0
- package/dist/session.d.ts +8 -8
- package/package.json +3 -3
- package/dist/serverErrorBus-BTnTpMqj.js +0 -60
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, K as ee, L as te, M as ne, N as re, O as ie, P as l, R as ae, S as oe, T as se, U as ce, V as le, W as ue, _ as de, a as u, b as fe, c as pe, d as me, f as he, g as d, h as ge, i as _e, j as ve, k as ye, l as be, m as xe, n as Se, o as Ce, p as we, q as Te, r as Ee, s as De, t as Oe, u as ke, v as Ae, w as je, x as Me, y as f, z as Ne } from "./scopes-DVtiKKsm.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Context as
|
|
2
|
+
import { S as Pe, _ as Fe, a as Ie, b as Le, c as Re, d as ze, f as Be, g as Ve, h as p, i as He, l as Ue, m as We, n as Ge, o as Ke, p as qe, r as Je, s as Ye, t as Xe, u as Ze, v as Qe, x as $e, y as et } from "./restFormat-Bnngx-zI.js";
|
|
3
|
+
import { Context as tt, Layer as nt, Schema as m } from "effect";
|
|
4
4
|
import { Rpc as h } from "@effect/rpc";
|
|
5
|
-
import { VersionConflict as
|
|
5
|
+
import { VersionConflict as rt } from "@voltro/database/wire";
|
|
6
6
|
//#region src/rowPatch.ts
|
|
7
|
-
var
|
|
7
|
+
var it = m.Union(m.String, m.Number), g = m.Record({
|
|
8
8
|
key: m.String,
|
|
9
9
|
value: m.Unknown
|
|
10
|
-
}).pipe(m.filter((e) => "id" in e, { message: () => "patch row must carry an id" })),
|
|
10
|
+
}).pipe(m.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), at = m.Union(m.Struct({
|
|
11
11
|
op: m.Literal("add"),
|
|
12
12
|
path: m.String,
|
|
13
|
-
value:
|
|
13
|
+
value: g
|
|
14
14
|
}), m.Struct({
|
|
15
15
|
op: m.Literal("replace"),
|
|
16
16
|
path: m.String,
|
|
17
|
-
value:
|
|
17
|
+
value: g
|
|
18
18
|
}), m.Struct({
|
|
19
19
|
op: m.Literal("remove"),
|
|
20
20
|
path: m.String
|
|
@@ -25,14 +25,14 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
25
25
|
key: m.String,
|
|
26
26
|
value: m.Unknown
|
|
27
27
|
})
|
|
28
|
-
})),
|
|
29
|
-
ops: m.Array(
|
|
30
|
-
order: m.Array(
|
|
31
|
-
}),
|
|
28
|
+
})), ot = m.Struct({
|
|
29
|
+
ops: m.Array(at),
|
|
30
|
+
order: m.Array(it)
|
|
31
|
+
}), _ = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, st = (e) => (e.startsWith("/") ? e.slice(1) : e).replace(/~1/g, "/").replace(/~0/g, "~"), v = (e) => {
|
|
32
32
|
let t = Object.keys(e).sort(), n = {};
|
|
33
33
|
for (let r of t) n[r] = e[r];
|
|
34
34
|
return JSON.stringify(n);
|
|
35
|
-
}, y = (e, t) => v(e) === v(t),
|
|
35
|
+
}, y = (e, t) => v(e) === v(t), ct = (e, t) => {
|
|
36
36
|
if (e instanceof Uint8Array && t instanceof Uint8Array) {
|
|
37
37
|
if (e.length !== t.length) return !1;
|
|
38
38
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
@@ -45,14 +45,14 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
45
45
|
id: 0,
|
|
46
46
|
v: t
|
|
47
47
|
});
|
|
48
|
-
},
|
|
48
|
+
}, lt = (e, t, n = {}) => {
|
|
49
49
|
let r = /* @__PURE__ */ new Map();
|
|
50
50
|
for (let t of e) r.set(t.id, t);
|
|
51
51
|
let i = [], a = [], o = /* @__PURE__ */ new Set(), s = n.crdt, c = (e, t) => {
|
|
52
52
|
if (s === void 0 || s.columns.size === 0) return;
|
|
53
53
|
let n = {}, r = !1;
|
|
54
54
|
for (let i of s.columns) {
|
|
55
|
-
if (!(i in t) ||
|
|
55
|
+
if (!(i in t) || ct(e[i], t[i])) continue;
|
|
56
56
|
let a = s.incremental(i, e[i], t[i]);
|
|
57
57
|
if (a === void 0) return;
|
|
58
58
|
n[i] = a, r = !0;
|
|
@@ -70,43 +70,43 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
70
70
|
let t = r.get(e.id);
|
|
71
71
|
if (t === void 0) i.push({
|
|
72
72
|
op: "add",
|
|
73
|
-
path:
|
|
73
|
+
path: _(e.id),
|
|
74
74
|
value: e
|
|
75
75
|
});
|
|
76
76
|
else if (!y(t, e)) {
|
|
77
77
|
let n = c(t, e);
|
|
78
78
|
n === void 0 ? i.push({
|
|
79
79
|
op: "replace",
|
|
80
|
-
path:
|
|
80
|
+
path: _(e.id),
|
|
81
81
|
value: e
|
|
82
82
|
}) : (y(Object.fromEntries(Object.entries(t).filter(([e]) => !s.columns.has(e))), n.scalars) || i.push({
|
|
83
83
|
op: "replace",
|
|
84
|
-
path:
|
|
84
|
+
path: _(e.id),
|
|
85
85
|
value: n.scalars
|
|
86
86
|
}), i.push({
|
|
87
87
|
op: "mergeCells",
|
|
88
|
-
path:
|
|
88
|
+
path: _(e.id),
|
|
89
89
|
value: n.merges
|
|
90
90
|
}));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
for (let t of e) o.has(t.id) || i.push({
|
|
94
94
|
op: "remove",
|
|
95
|
-
path:
|
|
95
|
+
path: _(t.id)
|
|
96
96
|
});
|
|
97
97
|
return {
|
|
98
98
|
ops: i,
|
|
99
99
|
order: a
|
|
100
100
|
};
|
|
101
|
-
},
|
|
101
|
+
}, ut = (e) => e.every((e) => {
|
|
102
102
|
let t = e.id;
|
|
103
103
|
return typeof t == "string" || typeof t == "number";
|
|
104
|
-
}),
|
|
104
|
+
}), dt = (e, t, n = {}) => {
|
|
105
105
|
let r = /* @__PURE__ */ new Map();
|
|
106
106
|
for (let t of e) r.set(t.id, t);
|
|
107
107
|
for (let e of t.ops) {
|
|
108
108
|
if (e.op === "mergeCells") {
|
|
109
|
-
let t =
|
|
109
|
+
let t = st(e.path), i = r.get(t) ?? r.get(Number(t)), a = r.has(t) ? t : Number(t);
|
|
110
110
|
if (i === void 0) continue;
|
|
111
111
|
let o = { ...i };
|
|
112
112
|
for (let [t, r] of Object.entries(e.value)) o[t] = n.mergeCell === void 0 ? r : n.mergeCell(t, i[t], r);
|
|
@@ -131,7 +131,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
131
131
|
_tag: m.Literal("delta"),
|
|
132
132
|
revision: m.Number,
|
|
133
133
|
emittedAt: m.Number,
|
|
134
|
-
patch:
|
|
134
|
+
patch: ot
|
|
135
135
|
}), m.Struct({
|
|
136
136
|
_tag: m.Literal("error"),
|
|
137
137
|
error: m.Unknown,
|
|
@@ -139,7 +139,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
139
139
|
})), x = (e, t) => {
|
|
140
140
|
let n = `${e ?? "this procedure"} input`;
|
|
141
141
|
return t === !0 ? `${n} (guarded — the guard did NOT run: the payload failed to decode first, so this says nothing about access)` : n;
|
|
142
|
-
},
|
|
142
|
+
}, ft = (e) => {
|
|
143
143
|
let t = e.ast;
|
|
144
144
|
return t._tag === "TypeLiteral" && (t.propertySignatures?.length ?? 0) === 0 && (t.indexSignatures?.length ?? 0) === 0;
|
|
145
145
|
}, S = (e, t, n) => {
|
|
@@ -147,8 +147,8 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
147
147
|
parseOptions: { onExcessProperty: "error" },
|
|
148
148
|
parseIssueTitle: () => r
|
|
149
149
|
});
|
|
150
|
-
return
|
|
151
|
-
},
|
|
150
|
+
return ft(e) ? m.filter((e) => typeof e == "object" && e && Object.keys(e).length > 0 ? `this procedure declares no input; received: ${Object.keys(e).join(", ")}` : void 0)(i).annotations({ identifier: r }) : i;
|
|
151
|
+
}, pt = class extends m.TaggedError()("BusinessRuleViolation", {
|
|
152
152
|
rule: m.String,
|
|
153
153
|
params: m.optional(m.Record({
|
|
154
154
|
key: m.String,
|
|
@@ -157,21 +157,21 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
157
157
|
field: m.optional(m.String),
|
|
158
158
|
message: m.optional(m.String),
|
|
159
159
|
severity: m.Literal("error", "warning")
|
|
160
|
-
}) {},
|
|
160
|
+
}) {}, mt = m.Struct({
|
|
161
161
|
field: m.String,
|
|
162
162
|
message: m.String,
|
|
163
163
|
params: m.optional(m.Record({
|
|
164
164
|
key: m.String,
|
|
165
165
|
value: m.Unknown
|
|
166
166
|
}))
|
|
167
|
-
}),
|
|
167
|
+
}), ht = class extends m.TaggedError()("ValidationError", {
|
|
168
168
|
field: m.String,
|
|
169
169
|
message: m.String,
|
|
170
170
|
params: m.optional(m.Record({
|
|
171
171
|
key: m.String,
|
|
172
172
|
value: m.Unknown
|
|
173
173
|
}))
|
|
174
|
-
}) {},
|
|
174
|
+
}) {}, gt = class extends m.TaggedError()("ValidationErrors", { issues: m.Array(mt).pipe(m.minItems(1)) }) {}, _t = (e) => {
|
|
175
175
|
if (typeof e != "object" || !e) return [];
|
|
176
176
|
let t = e._tag;
|
|
177
177
|
if (t === "ValidationError") {
|
|
@@ -197,34 +197,34 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
197
197
|
}];
|
|
198
198
|
}
|
|
199
199
|
return [];
|
|
200
|
-
},
|
|
200
|
+
}, vt = class extends m.TaggedError()("ApprovalRequired", {
|
|
201
201
|
approvalId: m.String,
|
|
202
202
|
procedure: m.String,
|
|
203
203
|
expiresAt: m.String,
|
|
204
204
|
requiredScopes: m.Array(m.String),
|
|
205
205
|
reason: m.NullOr(m.String),
|
|
206
206
|
created: m.Boolean
|
|
207
|
-
}) {},
|
|
207
|
+
}) {}, yt = class extends m.TaggedError()("ApprovalNotFound", { approvalId: m.String }) {}, bt = class extends m.TaggedError()("ApprovalSelfApproval", {
|
|
208
208
|
approvalId: m.String,
|
|
209
209
|
subjectId: m.NullOr(m.String)
|
|
210
|
-
}) {},
|
|
210
|
+
}) {}, xt = class extends m.TaggedError()("ApprovalRejected", {
|
|
211
211
|
approvalId: m.String,
|
|
212
212
|
decidedBy: m.NullOr(m.String),
|
|
213
213
|
note: m.NullOr(m.String)
|
|
214
214
|
}) {}, C = class extends m.TaggedError()("ApprovalExpired", {
|
|
215
215
|
approvalId: m.String,
|
|
216
216
|
expiredAt: m.String
|
|
217
|
-
}) {},
|
|
217
|
+
}) {}, St = class extends m.TaggedError()("ApprovalNotPending", {
|
|
218
218
|
approvalId: m.String,
|
|
219
219
|
status: m.String
|
|
220
|
-
}) {},
|
|
220
|
+
}) {}, Ct = class extends m.TaggedError()("ApprovalForbidden", {
|
|
221
221
|
approvalId: m.String,
|
|
222
222
|
required: m.NullOr(m.String),
|
|
223
223
|
message: m.String
|
|
224
224
|
}) {}, w = class extends m.TaggedError()("ApprovalUnavailable", {
|
|
225
225
|
procedure: m.String,
|
|
226
226
|
message: m.String
|
|
227
|
-
}) {},
|
|
227
|
+
}) {}, wt = m.Union(vt, xt, C, w), Tt = m.Union(yt, bt, C, St, Ct, w), Et = m.Struct({
|
|
228
228
|
id: m.String,
|
|
229
229
|
procedure: m.String,
|
|
230
230
|
kind: m.Literal("mutation", "action"),
|
|
@@ -238,8 +238,8 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
238
238
|
decidedAt: m.NullOr(m.String),
|
|
239
239
|
note: m.NullOr(m.String),
|
|
240
240
|
relation: m.Literal("to-decide", "requested")
|
|
241
|
-
}), T = "channel:",
|
|
242
|
-
if (!
|
|
241
|
+
}), T = "channel:", Dt = Symbol.for("@voltro/protocol/reactivityChannels"), Ot = globalThis, E = Ot[Dt] ?? (Ot[Dt] = /* @__PURE__ */ new Map()), kt = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, At = (e) => {
|
|
242
|
+
if (!kt.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
|
|
243
243
|
\`billing.usage\`. A \`:\` is refused because it is the namespace separator in
|
|
244
244
|
the routing key (\`${T}<name>\`), and an uppercase letter is\n refused because a key that differs only by case reads as one channel and
|
|
245
245
|
routes as two.`);
|
|
@@ -252,14 +252,14 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
252
252
|
toString: () => n
|
|
253
253
|
});
|
|
254
254
|
return E.set(e, r), r;
|
|
255
|
-
}, D = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", O = (e) => e.startsWith(T), k = () => new Set([...E.values()].map((e) => e.key)), A = (e) => D(e) ? e.key : e, j = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(A) : [A(e)], M = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(A) : A(e),
|
|
255
|
+
}, D = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", O = (e) => e.startsWith(T), k = () => new Set([...E.values()].map((e) => e.key)), A = (e) => D(e) ? e.key : e, j = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(A) : [A(e)], M = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(A) : A(e), jt = (e) => {
|
|
256
256
|
let t = k(), n = [];
|
|
257
257
|
for (let r of e) for (let e of j(r.source)) O(e) && !t.has(e) && n.push({
|
|
258
258
|
procedure: r.name,
|
|
259
259
|
key: e
|
|
260
260
|
});
|
|
261
261
|
return n;
|
|
262
|
-
},
|
|
262
|
+
}, Mt = (e, t) => {
|
|
263
263
|
let n = e?.injectExternalChange;
|
|
264
264
|
return n !== void 0 && (n.call(e, {
|
|
265
265
|
table: t.key,
|
|
@@ -268,13 +268,18 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
268
268
|
old: {},
|
|
269
269
|
origin: "inline"
|
|
270
270
|
}), !0);
|
|
271
|
-
},
|
|
272
|
-
if (
|
|
271
|
+
}, Nt = (e) => e.internal !== !0, N = (e) => {
|
|
272
|
+
if (Pt(e), e.idempotencyScope !== void 0 && e.idempotencyScope !== "subject" && e.idempotencyScope !== "connection") throw Error(`${e.name}: idempotencyScope must be 'subject' or 'connection'`);
|
|
273
|
+
let t = e.serialize;
|
|
274
|
+
if (t !== void 0) {
|
|
275
|
+
if (typeof t.key != "function") throw Error(`${e.name}: serialize.key must be a function of the input`);
|
|
276
|
+
if (t.maxPending !== void 0 && (!Number.isSafeInteger(t.maxPending) || t.maxPending < 1)) throw Error(`${e.name}: serialize.maxPending must be a positive integer`);
|
|
277
|
+
}
|
|
273
278
|
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`);
|
|
274
279
|
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
|
|
275
280
|
unguarded procedure, or list the scopes required to call it.`);
|
|
276
|
-
let
|
|
277
|
-
if (
|
|
281
|
+
let n = typeof e.source == "string" ? [e.source] : Array.isArray(e.source) ? e.source : void 0;
|
|
282
|
+
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,
|
|
278
283
|
which is indistinguishable from "nothing changed". Name the table(s) it
|
|
279
284
|
reads, or omit \`source\` for a non-reactive query.`);
|
|
280
285
|
if (e.internal !== !0) return e;
|
|
@@ -285,10 +290,10 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
285
290
|
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
|
|
286
291
|
wire-reachable — so the plugin's route would vanish with nothing callable
|
|
287
292
|
in its place, and callers would get a 404 for something that used to work.`);
|
|
288
|
-
let
|
|
289
|
-
if (
|
|
290
|
-
throw Error(`${e.name}: \`internal: true\` cannot be combined with ${
|
|
291
|
-
},
|
|
293
|
+
let r = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
294
|
+
if (r.length === 0) return e;
|
|
295
|
+
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.`);
|
|
296
|
+
}, Pt = (e) => {
|
|
292
297
|
let t = e.requiresApproval;
|
|
293
298
|
if (t !== void 0) {
|
|
294
299
|
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
|
|
@@ -298,7 +303,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
298
303
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
299
304
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
300
305
|
}
|
|
301
|
-
},
|
|
306
|
+
}, Ft = (e) => e.action !== void 0 && e.resourceType !== void 0, It = (e) => e.authenticated === !0, Lt = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, P = (e, t, n) => {
|
|
302
307
|
if (n === void 0) return t;
|
|
303
308
|
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
|
|
304
309
|
without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
|
|
@@ -326,6 +331,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
326
331
|
output: e.output,
|
|
327
332
|
error: e.error ?? m.Never,
|
|
328
333
|
...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
|
|
334
|
+
...e.serialize === void 0 ? {} : { serialize: e.serialize },
|
|
329
335
|
target: e.target,
|
|
330
336
|
guards: P(e.name, e.guards, e.openAccess),
|
|
331
337
|
openAccess: e.openAccess,
|
|
@@ -349,7 +355,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
349
355
|
requiresApproval: e.requiresApproval,
|
|
350
356
|
internal: e.internal,
|
|
351
357
|
overridesPlugin: e.overridesPlugin
|
|
352
|
-
}),
|
|
358
|
+
}), Rt = (e) => N({
|
|
353
359
|
kind: "stream",
|
|
354
360
|
name: e.name,
|
|
355
361
|
input: e.input,
|
|
@@ -359,45 +365,45 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
359
365
|
overridesPlugin: e.overridesPlugin,
|
|
360
366
|
guards: P(e.name, e.guards, e.openAccess),
|
|
361
367
|
openAccess: e.openAccess
|
|
362
|
-
}), R = (e, t) => t && t.length > 0 ? m.Union(e, ...t) : e, z = (e) => e !== void 0 && e.some((e) => !d(e)),
|
|
368
|
+
}), R = (e, t) => t && t.length > 0 ? m.Union(e, ...t) : e, z = (e) => e !== void 0 && e.some((e) => !d(e)), zt = (e, t) => z(t) ? m.Union(e, u, l) : e, Bt = (e) => m.Union(e, pt), Vt = (e) => m.Union(e, ht, gt), Ht = (e, t) => t === void 0 ? e : m.Union(e, wt), B = (e, t) => {
|
|
363
369
|
if (t === "stream") return e.error;
|
|
364
|
-
let n =
|
|
370
|
+
let n = zt(e.error, e.guards);
|
|
365
371
|
if (t === "query") return n;
|
|
366
|
-
let r = t === "mutation" ? m.Union(
|
|
367
|
-
return
|
|
368
|
-
},
|
|
372
|
+
let r = t === "mutation" ? m.Union(Bt(n), Ve, rt) : n;
|
|
373
|
+
return Ht(Vt(t === "mutation" && e.idempotencyScope === "connection" ? m.Union(r, p) : r), e.requiresApproval);
|
|
374
|
+
}, Ut = (e, t) => R(zt(e.errorSchema, e.guards), t), Wt = (e, t) => ({
|
|
369
375
|
...e,
|
|
370
376
|
name: t
|
|
371
|
-
}),
|
|
377
|
+
}), Gt = (e, t) => h.make(e.name, {
|
|
372
378
|
payload: S(e.input, e.name, z(e.guards)),
|
|
373
379
|
success: b(e.output),
|
|
374
380
|
error: R(B(e, "query"), t),
|
|
375
381
|
stream: !0
|
|
376
|
-
}),
|
|
382
|
+
}), Kt = (e, t) => h.make(e.name, {
|
|
377
383
|
payload: S(e.input, e.name, z(e.guards)),
|
|
378
384
|
success: e.output,
|
|
379
385
|
error: R(B(e, "mutation"), t)
|
|
380
|
-
}),
|
|
386
|
+
}), qt = (e, t) => h.make(e.name, {
|
|
381
387
|
payload: S(e.input, e.name, z(e.guards)),
|
|
382
388
|
success: e.output,
|
|
383
389
|
error: R(B(e, "action"), t)
|
|
384
|
-
}),
|
|
390
|
+
}), Jt = (e, t) => h.make(e.name, {
|
|
385
391
|
payload: S(e.input, e.name, z(e.guards)),
|
|
386
392
|
success: e.element,
|
|
387
393
|
error: R(e.error, t),
|
|
388
394
|
stream: !0
|
|
389
|
-
}),
|
|
395
|
+
}), Yt = (e) => {
|
|
390
396
|
if (typeof e != "object" || !e) return;
|
|
391
397
|
let t = e._tag;
|
|
392
398
|
return typeof t == "string" ? t : void 0;
|
|
393
|
-
},
|
|
399
|
+
}, Xt = (e) => {
|
|
394
400
|
switch (e.kind) {
|
|
395
|
-
case "query": return
|
|
396
|
-
case "mutation": return
|
|
397
|
-
case "action": return
|
|
398
|
-
case "stream": return
|
|
401
|
+
case "query": return Gt(e);
|
|
402
|
+
case "mutation": return Kt(e);
|
|
403
|
+
case "action": return qt(e);
|
|
404
|
+
case "stream": return Jt(e);
|
|
399
405
|
}
|
|
400
|
-
},
|
|
406
|
+
}, Zt = (e) => {
|
|
401
407
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
402
408
|
if (e.kind === "query") return {
|
|
403
409
|
kind: "query",
|
|
@@ -415,20 +421,22 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
415
421
|
...n,
|
|
416
422
|
...i
|
|
417
423
|
};
|
|
418
|
-
let a = e.target, o = e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope };
|
|
424
|
+
let a = e.target, o = e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope }, s = e.serialize === void 0 ? {} : { serialize: e.serialize };
|
|
419
425
|
if (a === void 0) return {
|
|
420
426
|
kind: "mutation",
|
|
421
427
|
...n,
|
|
422
428
|
...i,
|
|
423
|
-
...o
|
|
429
|
+
...o,
|
|
430
|
+
...s
|
|
424
431
|
};
|
|
425
|
-
let
|
|
432
|
+
let c = Array.isArray(a) ? a : [a];
|
|
426
433
|
return {
|
|
427
434
|
kind: "mutation",
|
|
428
435
|
...n,
|
|
429
436
|
...i,
|
|
430
437
|
...o,
|
|
431
|
-
|
|
438
|
+
...s,
|
|
439
|
+
targets: c.map((e) => ({
|
|
432
440
|
table: e.table,
|
|
433
441
|
op: e.op,
|
|
434
442
|
..."order" in e && e.order !== void 0 ? { order: e.order } : {},
|
|
@@ -441,7 +449,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
441
449
|
..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
|
|
442
450
|
}))
|
|
443
451
|
};
|
|
444
|
-
},
|
|
452
|
+
}, Qt = 7500, $t = (e) => typeof e == "object" && !!e && e.kind === "event", en = (e) => {
|
|
445
453
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
446
454
|
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
|
|
447
455
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -476,60 +484,60 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
476
484
|
webhook: e.webhook,
|
|
477
485
|
delivery: e.delivery
|
|
478
486
|
};
|
|
479
|
-
},
|
|
487
|
+
}, tn = (e) => m.Struct({
|
|
480
488
|
_tag: m.Literal("event"),
|
|
481
489
|
origin: m.String,
|
|
482
490
|
n: m.Number,
|
|
483
491
|
emittedAt: m.Number,
|
|
484
492
|
payload: e
|
|
485
|
-
}),
|
|
493
|
+
}), nn = m.Struct({
|
|
486
494
|
_tag: m.Literal("gap"),
|
|
487
495
|
missed: m.Number,
|
|
488
496
|
reason: m.Literal("buffer", "resume")
|
|
489
|
-
}),
|
|
497
|
+
}), rn = m.Struct({ _tag: m.Literal("attached") }), an = (e) => m.Union(rn, tn(e), nn), on = m.Struct({
|
|
490
498
|
origin: m.String,
|
|
491
499
|
n: m.Number
|
|
492
|
-
}),
|
|
500
|
+
}), sn = (e) => m.Struct({
|
|
493
501
|
key: e,
|
|
494
|
-
resume: m.optional(m.Array(
|
|
495
|
-
}),
|
|
502
|
+
resume: m.optional(m.Array(on))
|
|
503
|
+
}), cn = (e, t) => {
|
|
496
504
|
let n = e.guards !== void 0 && e.guards.some((e) => !d(e)) ? m.Union(u, l) : m.Never, r = t && t.length > 0 ? m.Union(n, ...t) : n;
|
|
497
505
|
return h.make(e.name, {
|
|
498
|
-
payload: S(
|
|
499
|
-
success:
|
|
506
|
+
payload: S(sn(e.key), e.name, z(e.guards)),
|
|
507
|
+
success: an(e.payload),
|
|
500
508
|
error: r,
|
|
501
509
|
stream: !0
|
|
502
510
|
});
|
|
503
|
-
},
|
|
511
|
+
}, ln = class extends m.TaggedError()("EventPayloadInvalid", {
|
|
504
512
|
event: m.String,
|
|
505
513
|
message: m.String
|
|
506
|
-
}) {},
|
|
514
|
+
}) {}, un = class extends m.TaggedError()("EventKeyInvalid", {
|
|
507
515
|
event: m.String,
|
|
508
516
|
message: m.String
|
|
509
|
-
}) {},
|
|
517
|
+
}) {}, dn = class extends m.TaggedError()("EventPayloadTooLarge", {
|
|
510
518
|
event: m.String,
|
|
511
519
|
bytes: m.Number,
|
|
512
520
|
limit: m.Number
|
|
513
|
-
}) {},
|
|
521
|
+
}) {}, fn = (e) => {
|
|
514
522
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
515
523
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
516
524
|
return JSON.stringify(t);
|
|
517
|
-
},
|
|
525
|
+
}, pn = "\0", mn = (e, t, n) => [
|
|
518
526
|
e ?? "~",
|
|
519
527
|
t,
|
|
520
|
-
|
|
521
|
-
].join("\0"),
|
|
528
|
+
fn(n)
|
|
529
|
+
].join("\0"), hn = (e) => {
|
|
522
530
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
523
531
|
return {
|
|
524
532
|
tenantId: t === "~" ? null : t,
|
|
525
533
|
event: n,
|
|
526
534
|
key: r
|
|
527
535
|
};
|
|
528
|
-
},
|
|
536
|
+
}, gn = (e) => e.split("\0").join(" · "), V = Symbol.for("@voltro/protocol/workflow-access"), _n = {
|
|
529
537
|
guards: void 0,
|
|
530
538
|
openAccess: void 0,
|
|
531
539
|
internal: !1
|
|
532
|
-
},
|
|
540
|
+
}, vn = (e, t) => {
|
|
533
541
|
let n = t.guards;
|
|
534
542
|
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
|
|
535
543
|
and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
|
|
@@ -549,16 +557,16 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
549
557
|
openAccess: t.openAccess?.trim(),
|
|
550
558
|
internal: t.internal === !0
|
|
551
559
|
};
|
|
552
|
-
},
|
|
560
|
+
}, yn = (e, t) => {
|
|
553
561
|
Object.defineProperty(e, V, {
|
|
554
562
|
value: t,
|
|
555
563
|
enumerable: !1
|
|
556
564
|
});
|
|
557
565
|
}, H = (e) => {
|
|
558
|
-
if (typeof e != "object" || !e) return
|
|
566
|
+
if (typeof e != "object" || !e) return _n;
|
|
559
567
|
let t = e[V];
|
|
560
|
-
return t === void 0 ?
|
|
561
|
-
},
|
|
568
|
+
return t === void 0 ? _n : t;
|
|
569
|
+
}, bn = (e) => {
|
|
562
570
|
let t = H(e);
|
|
563
571
|
return {
|
|
564
572
|
name: e.name,
|
|
@@ -566,9 +574,9 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
566
574
|
guards: t.guards,
|
|
567
575
|
openAccess: t.openAccess
|
|
568
576
|
};
|
|
569
|
-
},
|
|
570
|
-
if (!
|
|
571
|
-
if (t >=
|
|
577
|
+
}, xn = (e) => typeof e == "object" && !!e && typeof e._tag == "string", Sn = 64, U = (e, t = 0) => {
|
|
578
|
+
if (!xn(e)) return String(e);
|
|
579
|
+
if (t >= Sn) return "…";
|
|
572
580
|
let n = t + 1, r = (t) => U(e[t], n), i = (t) => Array.isArray(e[t]) ? e[t] : [];
|
|
573
581
|
switch (e._tag) {
|
|
574
582
|
case "Transformation": return `T(${r("from")}->${r("to")})`;
|
|
@@ -595,23 +603,23 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
595
603
|
case "Declaration": return `D(${i("typeParameters").map((e) => U(e, n)).join(",")})`;
|
|
596
604
|
default: return String(e);
|
|
597
605
|
}
|
|
598
|
-
},
|
|
606
|
+
}, Cn = (e) => {
|
|
599
607
|
let t = 2166136261;
|
|
600
608
|
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
601
609
|
return t.toString(16).padStart(8, "0");
|
|
602
|
-
},
|
|
610
|
+
}, wn = (e) => Cn([
|
|
603
611
|
U(e.payloadSchema?.ast),
|
|
604
612
|
U(e.successSchema?.ast),
|
|
605
613
|
U(e.errorSchema?.ast)
|
|
606
|
-
].join("\0")),
|
|
614
|
+
].join("\0")), Tn = (e) => {
|
|
607
615
|
let t = {}, n = e.requests, r = n instanceof Map ? n.entries() : Array.isArray(n) ? n.map((e, t) => [t, e]) : [];
|
|
608
616
|
for (let [, e] of r) {
|
|
609
617
|
if (typeof e != "object" && typeof e != "function" || e === null) continue;
|
|
610
618
|
let n = e;
|
|
611
|
-
typeof n._tag == "string" && (t[n._tag] =
|
|
619
|
+
typeof n._tag == "string" && (t[n._tag] = wn(n));
|
|
612
620
|
}
|
|
613
621
|
return t;
|
|
614
|
-
},
|
|
622
|
+
}, En = (e, t) => {
|
|
615
623
|
let n = [], r = [];
|
|
616
624
|
for (let [i, a] of Object.entries(t)) {
|
|
617
625
|
let t = e[i];
|
|
@@ -621,18 +629,18 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
621
629
|
differing: n.sort(),
|
|
622
630
|
missingHere: r.sort()
|
|
623
631
|
};
|
|
624
|
-
},
|
|
632
|
+
}, Dn = (e) => e, On = (e) => e, kn = (e) => {
|
|
625
633
|
let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
|
|
626
634
|
return n !== void 0 && n !== "" ? `${r}#${n}` : r;
|
|
627
|
-
},
|
|
635
|
+
}, An = (e) => {
|
|
628
636
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
629
|
-
},
|
|
630
|
-
let n =
|
|
637
|
+
}, jn = (e, t) => {
|
|
638
|
+
let n = tt.GenericTag(e);
|
|
631
639
|
return {
|
|
632
640
|
Tag: n,
|
|
633
|
-
Live:
|
|
641
|
+
Live: nt.succeed(n, t)
|
|
634
642
|
};
|
|
635
|
-
},
|
|
643
|
+
}, Mn = (e, t, n) => {
|
|
636
644
|
if (!t) return { ok: !0 };
|
|
637
645
|
let r = n === void 0 ? null : W(n);
|
|
638
646
|
if (!r) return {
|
|
@@ -642,7 +650,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
642
650
|
let i = t.trim();
|
|
643
651
|
if (i === "*" || i === "") return { ok: !0 };
|
|
644
652
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
645
|
-
for (let i of a) if (!
|
|
653
|
+
for (let i of a) if (!Nn(i, r)) return {
|
|
646
654
|
ok: !1,
|
|
647
655
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
648
656
|
};
|
|
@@ -655,7 +663,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
655
663
|
patch: Number(t[3]),
|
|
656
664
|
pre: t[4] ?? ""
|
|
657
665
|
} : null;
|
|
658
|
-
}, G = (e, t) => e.major === t.major ? e.minor === t.minor ? e.patch === t.patch ? e.pre && !t.pre ? -1 : !e.pre && t.pre ? 1 : e.pre && t.pre ? e.pre < t.pre ? -1 : +(e.pre > t.pre) : 0 : e.patch - t.patch : e.minor - t.minor : e.major - t.major,
|
|
666
|
+
}, G = (e, t) => e.major === t.major ? e.minor === t.minor ? e.patch === t.patch ? e.pre && !t.pre ? -1 : !e.pre && t.pre ? 1 : e.pre && t.pre ? e.pre < t.pre ? -1 : +(e.pre > t.pre) : 0 : e.patch - t.patch : e.minor - t.minor : e.major - t.major, Nn = (e, t) => {
|
|
659
667
|
if (e === "*") return !0;
|
|
660
668
|
if (e.startsWith("^")) {
|
|
661
669
|
let n = W(e.slice(1));
|
|
@@ -677,50 +685,50 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
677
685
|
}
|
|
678
686
|
let r = W(e);
|
|
679
687
|
return r ? G(t, r) === 0 : !1;
|
|
680
|
-
},
|
|
688
|
+
}, Pn = (e) => {
|
|
681
689
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
682
690
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
|
|
683
|
-
},
|
|
691
|
+
}, Fn = (e) => {
|
|
684
692
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
685
693
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
686
|
-
},
|
|
687
|
-
let e = globalThis, t = e[
|
|
694
|
+
}, In = Symbol.for("@voltro/protocol/pluginAliases"), K = () => {
|
|
695
|
+
let e = globalThis, t = e[In];
|
|
688
696
|
if (t instanceof Map) return t;
|
|
689
697
|
let n = /* @__PURE__ */ new Map();
|
|
690
|
-
return e[
|
|
691
|
-
},
|
|
698
|
+
return e[In] = n, n;
|
|
699
|
+
}, Ln = (e) => {
|
|
692
700
|
let t = K();
|
|
693
701
|
for (let [n, r] of Object.entries(e)) {
|
|
694
702
|
if (r === "") continue;
|
|
695
703
|
let e = t.get(n);
|
|
696
704
|
e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
|
|
697
705
|
}
|
|
698
|
-
},
|
|
706
|
+
}, Rn = () => {
|
|
699
707
|
K().clear();
|
|
700
|
-
},
|
|
708
|
+
}, zn = (e, t) => {
|
|
701
709
|
let n = K().get(e);
|
|
702
|
-
if (n === void 0 || n.size === 0) return `${
|
|
710
|
+
if (n === void 0 || n.size === 0) return `${Pn(e)}.${t}`;
|
|
703
711
|
if (n.size === 1) return `${[...n][0]}.${t}`;
|
|
704
712
|
let r = [...n].filter((e) => !e.includes("#"));
|
|
705
713
|
if (r.length === 1) return `${r[0]}.${t}`;
|
|
706
714
|
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}').`);
|
|
707
|
-
}, q = m.Literal("running", "succeeded", "failed", "cancelled", "suspended"),
|
|
715
|
+
}, q = m.Literal("running", "succeeded", "failed", "cancelled", "suspended"), Bn = m.Literal("cancel", "terminate", "abandon"), Vn = m.Struct({
|
|
708
716
|
mode: m.String,
|
|
709
717
|
dueAt: m.NullOr(m.Number),
|
|
710
718
|
retryAfterMs: m.NullOr(m.Number),
|
|
711
719
|
intentId: m.NullOr(m.String)
|
|
712
|
-
}),
|
|
720
|
+
}), Hn = m.Struct({
|
|
713
721
|
id: m.String,
|
|
714
722
|
workflowName: m.String,
|
|
715
723
|
executionId: m.NullOr(m.String),
|
|
716
724
|
status: m.Literal("running", "queued", "dropped", "skipped", "replayed"),
|
|
717
|
-
deferral: m.optional(
|
|
718
|
-
}),
|
|
725
|
+
deferral: m.optional(Vn)
|
|
726
|
+
}), Un = (e, t) => {
|
|
719
727
|
let n = H(e);
|
|
720
728
|
return h.make(e.name, {
|
|
721
729
|
payload: S(e.payloadSchema, e.name, z(n.guards)),
|
|
722
|
-
success:
|
|
723
|
-
error:
|
|
730
|
+
success: Hn,
|
|
731
|
+
error: Ut({
|
|
724
732
|
errorSchema: e.errorSchema,
|
|
725
733
|
guards: n.guards
|
|
726
734
|
}, t)
|
|
@@ -744,12 +752,12 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
744
752
|
durationMs: m.NullOr(m.Number),
|
|
745
753
|
traceId: m.NullOr(m.String),
|
|
746
754
|
parentExecutionId: m.NullOr(m.String),
|
|
747
|
-
parentClosePolicy: m.NullOr(
|
|
748
|
-
}),
|
|
755
|
+
parentClosePolicy: m.NullOr(Bn)
|
|
756
|
+
}), Wn = m.Struct({
|
|
749
757
|
tag: m.optional(m.String),
|
|
750
758
|
status: m.optional(q),
|
|
751
759
|
limit: m.optional(m.Number)
|
|
752
|
-
}),
|
|
760
|
+
}), Gn = m.Struct({
|
|
753
761
|
id: m.String,
|
|
754
762
|
runId: m.String,
|
|
755
763
|
stepName: m.String,
|
|
@@ -764,7 +772,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
764
772
|
startedAt: m.Date,
|
|
765
773
|
completedAt: m.NullOr(m.Date),
|
|
766
774
|
durationMs: m.NullOr(m.Number)
|
|
767
|
-
}),
|
|
775
|
+
}), Kn = m.Struct({
|
|
768
776
|
id: m.String,
|
|
769
777
|
runId: m.String,
|
|
770
778
|
eventType: m.String,
|
|
@@ -772,7 +780,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
772
780
|
occurredAt: m.Date,
|
|
773
781
|
stepName: m.NullOr(m.String),
|
|
774
782
|
attempt: m.NullOr(m.Number)
|
|
775
|
-
}),
|
|
783
|
+
}), qn = m.Struct({
|
|
776
784
|
id: m.String,
|
|
777
785
|
name: m.String,
|
|
778
786
|
payload: m.Unknown,
|
|
@@ -780,7 +788,7 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
780
788
|
subject: m.NullOr(m.Unknown),
|
|
781
789
|
traceId: m.NullOr(m.String),
|
|
782
790
|
occurredAt: m.Date
|
|
783
|
-
}),
|
|
791
|
+
}), Jn = m.Struct({
|
|
784
792
|
id: m.String,
|
|
785
793
|
eventId: m.String,
|
|
786
794
|
eventName: m.String,
|
|
@@ -793,129 +801,129 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
793
801
|
errorMessage: m.NullOr(m.String),
|
|
794
802
|
createdAt: m.Date,
|
|
795
803
|
completedAt: m.NullOr(m.Date)
|
|
796
|
-
}),
|
|
804
|
+
}), Yn = m.Struct({ id: m.String }), Y = m.Struct({ runId: m.String }), Xn = m.Struct({
|
|
797
805
|
name: m.optional(m.String),
|
|
798
806
|
limit: m.optional(m.Number)
|
|
799
|
-
}),
|
|
807
|
+
}), Zn = m.Struct({ eventId: m.String }), X = m.Struct({
|
|
800
808
|
workflowName: m.String,
|
|
801
809
|
executionId: m.String
|
|
802
|
-
}),
|
|
810
|
+
}), Qn = m.Struct({
|
|
803
811
|
id: m.String,
|
|
804
812
|
signalName: m.String,
|
|
805
813
|
payload: m.optional(m.Unknown)
|
|
806
|
-
}),
|
|
814
|
+
}), $n = m.Struct({
|
|
807
815
|
id: m.String,
|
|
808
816
|
updateName: m.String,
|
|
809
817
|
payload: m.optional(m.Unknown),
|
|
810
818
|
timeoutMs: m.optional(m.Number)
|
|
811
|
-
}),
|
|
819
|
+
}), er = m.Struct({
|
|
812
820
|
eventId: m.String,
|
|
813
821
|
updateId: m.String,
|
|
814
822
|
completedEventId: m.String,
|
|
815
823
|
result: m.Unknown
|
|
816
|
-
}),
|
|
824
|
+
}), tr = F({
|
|
817
825
|
name: "__voltro.workflow.run",
|
|
818
826
|
source: "_voltro_workflow_runs",
|
|
819
|
-
input:
|
|
827
|
+
input: Yn,
|
|
820
828
|
output: m.Array(J)
|
|
821
|
-
}),
|
|
829
|
+
}), nr = F({
|
|
822
830
|
name: "__voltro.workflow.runs",
|
|
823
831
|
source: "_voltro_workflow_runs",
|
|
824
|
-
input:
|
|
832
|
+
input: Wn,
|
|
825
833
|
output: m.Array(J)
|
|
826
|
-
}),
|
|
834
|
+
}), rr = F({
|
|
827
835
|
name: "__voltro.workflow.run.steps",
|
|
828
836
|
source: "_voltro_workflow_run_steps",
|
|
829
837
|
input: Y,
|
|
830
|
-
output: m.Array(
|
|
831
|
-
}),
|
|
838
|
+
output: m.Array(Gn)
|
|
839
|
+
}), ir = F({
|
|
832
840
|
name: "__voltro.workflow.run.events",
|
|
833
841
|
source: "_voltro_workflow_run_events",
|
|
834
842
|
input: Y,
|
|
835
|
-
output: m.Array(
|
|
836
|
-
}),
|
|
843
|
+
output: m.Array(Kn)
|
|
844
|
+
}), ar = F({
|
|
837
845
|
name: "__voltro.workflow.domainEvents",
|
|
838
846
|
source: "_voltro_workflow_events",
|
|
839
|
-
input:
|
|
840
|
-
output: m.Array(
|
|
841
|
-
}),
|
|
847
|
+
input: Xn,
|
|
848
|
+
output: m.Array(qn)
|
|
849
|
+
}), or = F({
|
|
842
850
|
name: "__voltro.workflow.event.deliveries",
|
|
843
851
|
source: "_voltro_workflow_event_deliveries",
|
|
844
|
-
input:
|
|
845
|
-
output: m.Array(
|
|
846
|
-
}),
|
|
852
|
+
input: Zn,
|
|
853
|
+
output: m.Array(Jn)
|
|
854
|
+
}), sr = L({
|
|
847
855
|
name: "__voltro.workflow.cancel",
|
|
848
856
|
input: X,
|
|
849
857
|
output: m.Struct({ ok: m.Boolean })
|
|
850
|
-
}),
|
|
858
|
+
}), cr = L({
|
|
851
859
|
name: "__voltro.workflow.resume",
|
|
852
860
|
input: X,
|
|
853
861
|
output: m.Struct({ ok: m.Boolean })
|
|
854
|
-
}),
|
|
862
|
+
}), lr = L({
|
|
855
863
|
name: "__voltro.workflow.signal",
|
|
856
|
-
input:
|
|
864
|
+
input: Qn,
|
|
857
865
|
output: m.Struct({ eventId: m.String })
|
|
858
|
-
}),
|
|
866
|
+
}), ur = L({
|
|
859
867
|
name: "__voltro.workflow.update",
|
|
860
|
-
input:
|
|
861
|
-
output:
|
|
862
|
-
}),
|
|
868
|
+
input: $n,
|
|
869
|
+
output: er
|
|
870
|
+
}), dr = "__voltro.undo.log", fr = "__voltro.undo.apply", pr = "__voltro.undo.redo", mr = m.Struct({
|
|
863
871
|
id: m.String,
|
|
864
872
|
tag: m.String,
|
|
865
873
|
label: m.NullOr(m.String),
|
|
866
874
|
undone: m.Boolean,
|
|
867
875
|
crossesAction: m.Boolean,
|
|
868
876
|
createdAt: m.String
|
|
869
|
-
}),
|
|
877
|
+
}), hr = class extends m.TaggedError()("UndoNotFound", { invocationId: m.String }) {}, gr = class extends m.TaggedError()("UndoForbidden", { invocationId: m.String }) {}, _r = class extends m.TaggedError()("UndoConflict", {
|
|
870
878
|
invocationId: m.String,
|
|
871
879
|
reason: m.Literal("conflict", "action")
|
|
872
|
-
}) {},
|
|
873
|
-
name:
|
|
880
|
+
}) {}, vr = m.Union(hr, gr, _r), yr = F({
|
|
881
|
+
name: dr,
|
|
874
882
|
source: "_voltro_undo_log",
|
|
875
883
|
input: m.Struct({ limit: m.optional(m.Number) }),
|
|
876
|
-
output: m.Array(
|
|
884
|
+
output: m.Array(mr),
|
|
877
885
|
openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
|
|
878
|
-
}),
|
|
879
|
-
name:
|
|
886
|
+
}), br = I({
|
|
887
|
+
name: fr,
|
|
880
888
|
input: m.Struct({ invocationId: m.String }),
|
|
881
889
|
output: m.Struct({ ok: m.Boolean }),
|
|
882
|
-
error:
|
|
890
|
+
error: vr,
|
|
883
891
|
openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
884
|
-
}),
|
|
885
|
-
name:
|
|
892
|
+
}), xr = I({
|
|
893
|
+
name: pr,
|
|
886
894
|
input: m.Struct({ invocationId: m.String }),
|
|
887
895
|
output: m.Struct({ ok: m.Boolean }),
|
|
888
|
-
error:
|
|
896
|
+
error: vr,
|
|
889
897
|
openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
890
|
-
}),
|
|
898
|
+
}), Sr = class extends m.TaggedError()("TenantScopeViolation", {
|
|
891
899
|
table: m.String,
|
|
892
900
|
reason: m.String
|
|
893
|
-
}) {},
|
|
901
|
+
}) {}, Cr = class extends m.TaggedError()("StoreOperationFailed", {
|
|
894
902
|
operation: m.String,
|
|
895
903
|
table: m.String,
|
|
896
904
|
cause: m.String
|
|
897
|
-
}) {},
|
|
905
|
+
}) {}, wr = class extends m.TaggedError()("NoRowFound", {
|
|
898
906
|
table: m.String,
|
|
899
907
|
found: m.Number
|
|
900
908
|
}) {
|
|
901
909
|
get message() {
|
|
902
910
|
return this.found === 0 ? `expected exactly one row in '${this.table}', found none` : `expected exactly one row in '${this.table}', found more than one`;
|
|
903
911
|
}
|
|
904
|
-
},
|
|
912
|
+
}, Tr = class extends m.TaggedError()("TableValidationFailed", {
|
|
905
913
|
table: m.String,
|
|
906
914
|
summary: m.String,
|
|
907
915
|
issues: m.Array(m.Struct({
|
|
908
916
|
path: m.String,
|
|
909
917
|
message: m.String
|
|
910
918
|
}))
|
|
911
|
-
}) {},
|
|
919
|
+
}) {}, Er = class extends m.TaggedError()("TenantRowNotFound", {
|
|
912
920
|
table: m.String,
|
|
913
921
|
id: m.String,
|
|
914
922
|
reason: m.String
|
|
915
|
-
}) {},
|
|
923
|
+
}) {}, Dr = class extends m.TaggedError()("ServerOnlyColumnWrite", {
|
|
916
924
|
table: m.String,
|
|
917
925
|
columns: m.Array(m.String)
|
|
918
|
-
}) {},
|
|
926
|
+
}) {}, Or = class extends m.TaggedError()("ConstraintViolation", {
|
|
919
927
|
kind: m.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
|
|
920
928
|
table: m.String,
|
|
921
929
|
operation: m.String,
|
|
@@ -934,14 +942,14 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
934
942
|
case "check": return `check constraint ${t}: the row does not satisfy it`;
|
|
935
943
|
}
|
|
936
944
|
}
|
|
937
|
-
},
|
|
938
|
-
name:
|
|
945
|
+
}, Z = "__voltro.approvals.pending", kr = "__voltro.approvals.decide", Ar = F({
|
|
946
|
+
name: Z,
|
|
939
947
|
source: "_voltro_approvals",
|
|
940
948
|
input: m.Struct({ limit: m.optional(m.Number) }),
|
|
941
|
-
output: m.Array(
|
|
949
|
+
output: m.Array(Et),
|
|
942
950
|
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"
|
|
943
|
-
}),
|
|
944
|
-
name:
|
|
951
|
+
}), jr = I({
|
|
952
|
+
name: kr,
|
|
945
953
|
input: m.Struct({
|
|
946
954
|
approvalId: m.String,
|
|
947
955
|
decision: m.Literal("approve", "reject"),
|
|
@@ -951,35 +959,35 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
951
959
|
approvalId: m.String,
|
|
952
960
|
status: m.Literal("approved", "rejected")
|
|
953
961
|
}),
|
|
954
|
-
error:
|
|
962
|
+
error: Tt,
|
|
955
963
|
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"
|
|
956
|
-
}),
|
|
964
|
+
}), Mr = "__voltro.connections.list", Nr = "__voltro.connections.start", Pr = "__voltro.connections.submitToken", Fr = "__voltro.connections.disconnect", Q = m.Literal("oauth2", "pat"), Ir = m.Literal("disconnected", "connected", "expired", "revoked", "error"), Lr = m.Struct({
|
|
957
965
|
connectionId: m.String,
|
|
958
966
|
kind: Q,
|
|
959
967
|
label: m.String,
|
|
960
|
-
status:
|
|
968
|
+
status: Ir,
|
|
961
969
|
accountId: m.NullOr(m.String),
|
|
962
970
|
accountLabel: m.NullOr(m.String),
|
|
963
971
|
scopes: m.Array(m.String),
|
|
964
972
|
expiresAt: m.NullOr(m.String),
|
|
965
973
|
lastError: m.NullOr(m.String),
|
|
966
974
|
connectedAt: m.NullOr(m.String)
|
|
967
|
-
}),
|
|
975
|
+
}), Rr = class extends m.TaggedError()("ConnectionNotDeclared", { connectionId: m.String }) {}, zr = class extends m.TaggedError()("ConnectionSubjectRequired", { connectionId: m.String }) {}, Br = class extends m.TaggedError()("ConnectionKindMismatch", {
|
|
968
976
|
connectionId: m.String,
|
|
969
977
|
expected: Q,
|
|
970
978
|
actual: Q
|
|
971
|
-
}) {},
|
|
979
|
+
}) {}, Vr = class extends m.TaggedError()("ConnectionHandshakeFailed", {
|
|
972
980
|
connectionId: m.String,
|
|
973
981
|
reason: m.String,
|
|
974
982
|
transient: m.Boolean
|
|
975
|
-
}) {}, $ = m.Union(
|
|
976
|
-
name:
|
|
983
|
+
}) {}, $ = m.Union(Rr, zr, Br, Vr), Hr = F({
|
|
984
|
+
name: Mr,
|
|
977
985
|
source: "_voltro_connections",
|
|
978
986
|
input: m.Struct({}),
|
|
979
|
-
output: m.Array(
|
|
987
|
+
output: m.Array(Lr),
|
|
980
988
|
openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
|
|
981
|
-
}),
|
|
982
|
-
name:
|
|
989
|
+
}), Ur = L({
|
|
990
|
+
name: Nr,
|
|
983
991
|
input: m.Struct({
|
|
984
992
|
connectionId: m.String,
|
|
985
993
|
redirectTo: m.optional(m.String)
|
|
@@ -990,8 +998,8 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
990
998
|
}),
|
|
991
999
|
error: $,
|
|
992
1000
|
openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
993
|
-
}),
|
|
994
|
-
name:
|
|
1001
|
+
}), Wr = I({
|
|
1002
|
+
name: Pr,
|
|
995
1003
|
input: m.Struct({
|
|
996
1004
|
connectionId: m.String,
|
|
997
1005
|
token: m.String
|
|
@@ -999,20 +1007,20 @@ var qe = m.Union(m.String, m.Number), Je = m.Record({
|
|
|
999
1007
|
output: m.Struct({ ok: m.Boolean }),
|
|
1000
1008
|
error: $,
|
|
1001
1009
|
openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
1002
|
-
}),
|
|
1003
|
-
name:
|
|
1010
|
+
}), Gr = I({
|
|
1011
|
+
name: Fr,
|
|
1004
1012
|
input: m.Struct({ connectionId: m.String }),
|
|
1005
1013
|
output: m.Struct({ ok: m.Boolean }),
|
|
1006
1014
|
error: $,
|
|
1007
1015
|
openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
|
|
1008
|
-
}),
|
|
1016
|
+
}), Kr = (e) => {
|
|
1009
1017
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
1010
1018
|
return Number.isNaN(t) ? 0 : t;
|
|
1011
|
-
},
|
|
1019
|
+
}, qr = 4001, Jr = /* @__PURE__ */ new Set(["/rpc", "/ws"]), Yr = (e) => {
|
|
1012
1020
|
if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
|
|
1013
|
-
if (
|
|
1021
|
+
if (Jr.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
|
|
1014
1022
|
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)}'`);
|
|
1015
1023
|
return e;
|
|
1016
|
-
},
|
|
1024
|
+
}, Xr = 1;
|
|
1017
1025
|
//#endregion
|
|
1018
|
-
export { Oe as ADMIN_SCOPE, Se as APIKEY_ISSUE_ORG_SCOPE, Ee as APIKEY_ISSUE_OTHER_SCOPE, _e as APIKEY_ISSUE_SELF_SCOPE,
|
|
1026
|
+
export { Oe as ADMIN_SCOPE, Se as APIKEY_ISSUE_ORG_SCOPE, Ee as APIKEY_ISSUE_OTHER_SCOPE, _e as APIKEY_ISSUE_SELF_SCOPE, kr as APPROVALS_DECIDE_TAG, Z as APPROVALS_PENDING_TAG, Tt as ApprovalDecisionErrors, wt as ApprovalErrors, C as ApprovalExpired, Ct as ApprovalForbidden, yt as ApprovalNotFound, St as ApprovalNotPending, xt as ApprovalRejected, vt as ApprovalRequired, bt as ApprovalSelfApproval, w as ApprovalUnavailable, se as AuthMiddleware, pt as BusinessRuleViolation, Mr as CONNECTIONS_LIST_TAG, Fr as CONNECTION_DISCONNECT_TAG, Nr as CONNECTION_START_TAG, Pr as CONNECTION_SUBMIT_TOKEN_TAG, Vr as ConnectionHandshakeFailed, i as ConnectionInfo, r as ConnectionInfoMiddleware, Q as ConnectionKind, Br as ConnectionKindMismatch, Rr as ConnectionNotDeclared, Lr as ConnectionState, Ir as ConnectionStatus, zr as ConnectionSubjectRequired, Or as ConstraintViolation, ie as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, ye as DEFAULT_SCOPE_CACHE_TTL_MS, pn as EVENT_ROUTE_SEP, un as EventKeyInvalid, ln as EventPayloadInvalid, dn as EventPayloadTooLarge, qr as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, e as IMPERSONATION_METADATA_KEY, Xe as JSONAPI_MEDIA_TYPE, Qt as MAX_EVENT_ENVELOPE_BYTES, We as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, p as MutationConnectionRequired, Ve as MutationInFlight, wr as NoRowFound, Ge as PROBLEM_JSON, Xr as PROTOCOL_VERSION, Et as PendingApproval, T as REACTIVITY_CHANNEL_PREFIX, Je as REST_PROFILE_NAMES, u as ScopeError, Dr as ServerOnlyColumnWrite, Cr as StoreOperationFailed, ve as Subject, ne as SubjectIdentity, re as SubjectService, Tr as TableValidationFailed, Er as TenantRowNotFound, Sr as TenantScopeViolation, fr as UNDO_APPLY_TAG, dr as UNDO_LOG_TAG, pr as UNDO_REDO_TAG, l as Unauthenticated, _r as UndoConflict, gr as UndoForbidden, mr as UndoLogEntry, hr as UndoNotFound, ht as ValidationError, gt as ValidationErrors, mt as ValidationIssue, V as WorkflowAccessProperty, X as WorkflowControlInputSchema, qn as WorkflowDomainEventRowSchema, Xn as WorkflowDomainEventsInputSchema, Zn as WorkflowEventDeliveriesInputSchema, Jn as WorkflowEventDeliveryRowSchema, Bn as WorkflowParentClosePolicySchema, Kn as WorkflowRunEventRowSchema, Hn as WorkflowRunHandleSchema, Yn as WorkflowRunRefSchema, J as WorkflowRunRowSchema, q as WorkflowRunStatusSchema, Gn as WorkflowRunStepRowSchema, Y as WorkflowRunTableRefSchema, Wn as WorkflowRunsInputSchema, Qn as WorkflowSignalInputSchema, Vn as WorkflowStartDeferralSchema, $n as WorkflowUpdateInputSchema, er as WorkflowUpdateResultSchema, qt as actionToRpc, Ce as advisoryResourceGuardWarning, a as anonymousSubject, dt as applyRowPatch, c as applyScopeDecision, jr as approvalsDecideDescriptor, Ar as approvalsPendingQueryDescriptor, te as assertAuthenticated, yn as attachWorkflowAccess, Fe as beginIdempotent, Mn as checkFrameworkCompat, De as checkGuards, pe as checkGuardsEffect, En as compareSurfaces, ae as composeAuthStrategies, An as composeRpcInterceptors, Gr as connectionDisconnectDescriptor, Ur as connectionStartDescriptor, Wr as connectionSubmitTokenDescriptor, Hr as connectionsListQueryDescriptor, k as declaredReactivityChannelKeys, L as defineAction, en as defineEvent, I as defineMutation, Dn as definePlugin, On as definePluginRoute, jn as definePluginService, F as defineQuery, Rt as defineStream, Yr as defineWebSocket, lt as diffRows, be as effectiveScopes, fn as encodeEventKey, He as encodeRestError, Ie as encodeRestSuccess, Yt as errorTag, rn as eventAttached, tn as eventEnvelope, nn as eventGap, on as eventResumePoint, mn as eventRoute, an as eventStreamEvent, sn as eventSubscribeInput, cn as eventToRpc, Qe as failIdempotent, _t as fieldIssuesOf, ke as findAdvisoryResourceGuards, et as finishIdempotent, gn as formatEventRoute, me as getPolicyGuardResolver, he as getResourceScopeResolver, H as getWorkflowAccess, Tn as groupShapeDigests, Lt as hasAccessDecision, Ne as hasCallbackRoutes, we as hasEffectiveScope, z as hasEnforcedGuard, xe as hasScope, _ as idToPath, Le as idempotencyScope, x as inputLabel, ge as isAuthenticatedCheck, It as isAuthenticatedGuard, $t as isEventDescriptor, ut as isIdKeyed, d as isOpenAccess, de as isPolicyCheck, Ft as isPolicyGuard, D as isReactivityChannel, O as isReactivityChannelKey, t as isSystemSubject, Nt as isWireReachable, le as makeScopeCache, $e as memoryIdempotencyStore, Ae as missingAccessDecision, Kt as mutationToRpc, Ke as nextLink, Zt as normalizeDescriptor, M as normalizeSource, f as openAccessSpec, s as orderByBearerPrefix, hn as parseEventRoute, st as pathToId, Pn as pluginAlias, kn as pluginInstanceName, Fn as pluginSlug, zn as pluginTag, Ye as problemDetails, Re as problemTypeOf, wn as procedureShapeDigest, Mt as publishReactivity, Be as publishServerError, Gt as queryToRpc, ce as rawImpersonationMark, At as reactivityChannel, Ln as registerPluginAliases, fe as requireScope, Rn as resetPluginAliases, Ue as resolveRestFormat, vn as resolveWorkflowAccess, Ze as restViewSchema, at as rowPatchOpSchema, ot as rowPatchSchema, U as schemaShape, ue as scopeCacheKey, Me as setEffectiveScopes, oe as setPolicyGuardResolver, n as setResourceScopeResolver, Cn as shapeDigest, j as sourceKeys, Jt as streamToRpc, S as strictInput, o as subjectIdentity, je as subjectScopes, qe as subscribeServerErrors, b as subscriptionEvent, ee as systemSubject, Te as tenantScopedSubject, Xt as toRpc, ze as toSnakeCase, Kr as tsMs, jt as undeclaredChannelKeys, br as undoApplyDescriptor, yr as undoLogQueryDescriptor, xr as undoRedoDescriptor, B as wireErrorUnion, Wt as withRpcTag, bn as workflowAccessDescriptor, sr as workflowCancelDescriptor, ar as workflowDomainEventsQueryDescriptor, or as workflowEventDeliveriesQueryDescriptor, cr as workflowResumeDescriptor, ir as workflowRunEventsQueryDescriptor, tr as workflowRunQueryDescriptor, rr as workflowRunStepsQueryDescriptor, nr as workflowRunsQueryDescriptor, lr as workflowSignalDescriptor, Un as workflowToRpc, ur as workflowUpdateDescriptor, Ut as workflowWireErrorUnion, Pe as wsMutationIdempotencyScope };
|