@voltro/protocol 0.68.0 → 0.69.1
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 +310 -0
- package/dist/index.d.ts +184 -4
- package/dist/index.js +179 -179
- package/dist/rest.d.ts +47 -5
- package/dist/rest.js +201 -99
- package/dist/{scopes-C86BDyNJ.js → scopes-DVtiKKsm.js} +25 -15
- package/dist/session.js +6 -6
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
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,
|
|
2
|
-
import { a as
|
|
3
|
-
import { Context as
|
|
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 { a as Pe, c as Fe, d as Ie, i as p, l as Le, n as Re, o as ze, r as Be, s as Ve, t as He, u as Ue } from "./serverErrorBus-BTnTpMqj.js";
|
|
3
|
+
import { Context as We, Layer as Ge, Schema as m } from "effect";
|
|
4
4
|
import { Rpc as h } from "@effect/rpc";
|
|
5
|
-
import { VersionConflict as
|
|
5
|
+
import { VersionConflict as Ke } from "@voltro/database/wire";
|
|
6
6
|
//#region src/rowPatch.ts
|
|
7
|
-
var
|
|
7
|
+
var qe = m.Union(m.String, m.Number), Je = 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" })), Ye = m.Union(m.Struct({
|
|
11
11
|
op: m.Literal("add"),
|
|
12
12
|
path: m.String,
|
|
13
|
-
value:
|
|
13
|
+
value: Je
|
|
14
14
|
}), m.Struct({
|
|
15
15
|
op: m.Literal("replace"),
|
|
16
16
|
path: m.String,
|
|
17
|
-
value:
|
|
17
|
+
value: Je
|
|
18
18
|
}), m.Struct({
|
|
19
19
|
op: m.Literal("remove"),
|
|
20
20
|
path: m.String
|
|
@@ -25,14 +25,14 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
25
25
|
key: m.String,
|
|
26
26
|
value: m.Unknown
|
|
27
27
|
})
|
|
28
|
-
})),
|
|
29
|
-
ops: m.Array(
|
|
30
|
-
order: m.Array(
|
|
28
|
+
})), Xe = m.Struct({
|
|
29
|
+
ops: m.Array(Ye),
|
|
30
|
+
order: m.Array(qe)
|
|
31
31
|
}), g = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, _ = (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), Ze = (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 Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
45
45
|
id: 0,
|
|
46
46
|
v: t
|
|
47
47
|
});
|
|
48
|
-
},
|
|
48
|
+
}, Qe = (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) || Ze(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;
|
|
@@ -98,10 +98,10 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
98
98
|
ops: i,
|
|
99
99
|
order: a
|
|
100
100
|
};
|
|
101
|
-
},
|
|
101
|
+
}, $e = (e) => e.every((e) => {
|
|
102
102
|
let t = e.id;
|
|
103
103
|
return typeof t == "string" || typeof t == "number";
|
|
104
|
-
}),
|
|
104
|
+
}), et = (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) {
|
|
@@ -131,7 +131,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
131
131
|
_tag: m.Literal("delta"),
|
|
132
132
|
revision: m.Number,
|
|
133
133
|
emittedAt: m.Number,
|
|
134
|
-
patch:
|
|
134
|
+
patch: Xe
|
|
135
135
|
}), m.Struct({
|
|
136
136
|
_tag: m.Literal("error"),
|
|
137
137
|
error: m.Unknown,
|
|
@@ -139,7 +139,7 @@ var Ke = m.Union(m.String, m.Number), qe = 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
|
+
}, tt = (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 Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
147
147
|
parseOptions: { onExcessProperty: "error" },
|
|
148
148
|
parseIssueTitle: () => r
|
|
149
149
|
});
|
|
150
|
-
return
|
|
151
|
-
},
|
|
150
|
+
return tt(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
|
+
}, nt = 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 Ke = m.Union(m.String, m.Number), qe = 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
|
+
}) {}, rt = 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
|
+
}), it = 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
|
+
}) {}, at = class extends m.TaggedError()("ValidationErrors", { issues: m.Array(rt).pipe(m.minItems(1)) }) {}, ot = (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 Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
197
197
|
}];
|
|
198
198
|
}
|
|
199
199
|
return [];
|
|
200
|
-
},
|
|
200
|
+
}, st = 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
|
+
}) {}, ct = class extends m.TaggedError()("ApprovalNotFound", { approvalId: m.String }) {}, lt = class extends m.TaggedError()("ApprovalSelfApproval", {
|
|
208
208
|
approvalId: m.String,
|
|
209
209
|
subjectId: m.NullOr(m.String)
|
|
210
|
-
}) {},
|
|
210
|
+
}) {}, ut = 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
|
+
}) {}, dt = class extends m.TaggedError()("ApprovalNotPending", {
|
|
218
218
|
approvalId: m.String,
|
|
219
219
|
status: m.String
|
|
220
|
-
}) {},
|
|
220
|
+
}) {}, ft = 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
|
+
}) {}, pt = m.Union(st, ut, C, w), mt = m.Union(ct, lt, C, dt, ft, w), ht = m.Struct({
|
|
228
228
|
id: m.String,
|
|
229
229
|
procedure: m.String,
|
|
230
230
|
kind: m.Literal("mutation", "action"),
|
|
@@ -238,8 +238,8 @@ var Ke = m.Union(m.String, m.Number), qe = 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:", gt = Symbol.for("@voltro/protocol/reactivityChannels"), _t = globalThis, E = _t[gt] ?? (_t[gt] = /* @__PURE__ */ new Map()), vt = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, yt = (e) => {
|
|
242
|
+
if (!vt.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 Ke = m.Union(m.String, m.Number), qe = 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), bt = (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
|
+
}, xt = (e, t) => {
|
|
263
263
|
let n = e?.injectExternalChange;
|
|
264
264
|
return n !== void 0 && (n.call(e, {
|
|
265
265
|
table: t.key,
|
|
@@ -268,8 +268,8 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
268
268
|
old: {},
|
|
269
269
|
origin: "inline"
|
|
270
270
|
}), !0);
|
|
271
|
-
},
|
|
272
|
-
if (
|
|
271
|
+
}, St = (e) => e.internal !== !0, N = (e) => {
|
|
272
|
+
if (Ct(e), e.idempotencyScope !== void 0 && e.idempotencyScope !== "subject" && e.idempotencyScope !== "connection") throw Error(`${e.name}: idempotencyScope must be 'subject' or 'connection'`);
|
|
273
273
|
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
274
|
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
275
|
unguarded procedure, or list the scopes required to call it.`);
|
|
@@ -288,7 +288,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
288
288
|
let n = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
289
289
|
if (n.length === 0) return e;
|
|
290
290
|
throw Error(`${e.name}: \`internal: true\` cannot be combined with ${n.map((e) => `\`${e}\``).join(" or ")}. \`internal\` takes the procedure OFF the wire; those put it back ON a different one (${n.includes("publicApi") ? "a REST route" : "an agent tool"}), and that surface is projected without consulting the flag — so the procedure would be unreachable from your client and reachable from the internet. Drop \`internal: true\` if the wider surface is intended, or remove the ${n.join(" / ")} annotation if it is not.`);
|
|
291
|
-
},
|
|
291
|
+
}, Ct = (e) => {
|
|
292
292
|
let t = e.requiresApproval;
|
|
293
293
|
if (t !== void 0) {
|
|
294
294
|
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 +298,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
298
298
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
299
299
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
300
300
|
}
|
|
301
|
-
},
|
|
301
|
+
}, wt = (e) => e.action !== void 0 && e.resourceType !== void 0, Tt = (e) => e.authenticated === !0, Et = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, P = (e, t, n) => {
|
|
302
302
|
if (n === void 0) return t;
|
|
303
303
|
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
304
|
without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
|
|
@@ -349,7 +349,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
349
349
|
requiresApproval: e.requiresApproval,
|
|
350
350
|
internal: e.internal,
|
|
351
351
|
overridesPlugin: e.overridesPlugin
|
|
352
|
-
}),
|
|
352
|
+
}), Dt = (e) => N({
|
|
353
353
|
kind: "stream",
|
|
354
354
|
name: e.name,
|
|
355
355
|
input: e.input,
|
|
@@ -359,45 +359,45 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
359
359
|
overridesPlugin: e.overridesPlugin,
|
|
360
360
|
guards: P(e.name, e.guards, e.openAccess),
|
|
361
361
|
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)),
|
|
362
|
+
}), R = (e, t) => t && t.length > 0 ? m.Union(e, ...t) : e, z = (e) => e !== void 0 && e.some((e) => !d(e)), Ot = (e, t) => z(t) ? m.Union(e, u, l) : e, kt = (e) => m.Union(e, nt), At = (e) => m.Union(e, it, at), jt = (e, t) => t === void 0 ? e : m.Union(e, pt), B = (e, t) => {
|
|
363
363
|
if (t === "stream") return e.error;
|
|
364
|
-
let n =
|
|
364
|
+
let n = Ot(e.error, e.guards);
|
|
365
365
|
if (t === "query") return n;
|
|
366
|
-
let r = t === "mutation" ? m.Union(
|
|
367
|
-
return At(
|
|
368
|
-
},
|
|
366
|
+
let r = t === "mutation" ? m.Union(kt(n), Pe, Ke) : n;
|
|
367
|
+
return jt(At(t === "mutation" && e.idempotencyScope === "connection" ? m.Union(r, p) : r), e.requiresApproval);
|
|
368
|
+
}, Mt = (e, t) => R(Ot(e.errorSchema, e.guards), t), Nt = (e, t) => ({
|
|
369
369
|
...e,
|
|
370
370
|
name: t
|
|
371
|
-
}),
|
|
371
|
+
}), Pt = (e, t) => h.make(e.name, {
|
|
372
372
|
payload: S(e.input, e.name, z(e.guards)),
|
|
373
373
|
success: b(e.output),
|
|
374
374
|
error: R(B(e, "query"), t),
|
|
375
375
|
stream: !0
|
|
376
|
-
}),
|
|
376
|
+
}), Ft = (e, t) => h.make(e.name, {
|
|
377
377
|
payload: S(e.input, e.name, z(e.guards)),
|
|
378
378
|
success: e.output,
|
|
379
379
|
error: R(B(e, "mutation"), t)
|
|
380
|
-
}),
|
|
380
|
+
}), It = (e, t) => h.make(e.name, {
|
|
381
381
|
payload: S(e.input, e.name, z(e.guards)),
|
|
382
382
|
success: e.output,
|
|
383
383
|
error: R(B(e, "action"), t)
|
|
384
|
-
}),
|
|
384
|
+
}), Lt = (e, t) => h.make(e.name, {
|
|
385
385
|
payload: S(e.input, e.name, z(e.guards)),
|
|
386
386
|
success: e.element,
|
|
387
387
|
error: R(e.error, t),
|
|
388
388
|
stream: !0
|
|
389
|
-
}),
|
|
389
|
+
}), Rt = (e) => {
|
|
390
390
|
if (typeof e != "object" || !e) return;
|
|
391
391
|
let t = e._tag;
|
|
392
392
|
return typeof t == "string" ? t : void 0;
|
|
393
|
-
},
|
|
393
|
+
}, zt = (e) => {
|
|
394
394
|
switch (e.kind) {
|
|
395
|
-
case "query": return
|
|
396
|
-
case "mutation": return
|
|
397
|
-
case "action": return
|
|
398
|
-
case "stream": return
|
|
395
|
+
case "query": return Pt(e);
|
|
396
|
+
case "mutation": return Ft(e);
|
|
397
|
+
case "action": return It(e);
|
|
398
|
+
case "stream": return Lt(e);
|
|
399
399
|
}
|
|
400
|
-
},
|
|
400
|
+
}, Bt = (e) => {
|
|
401
401
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
402
402
|
if (e.kind === "query") return {
|
|
403
403
|
kind: "query",
|
|
@@ -441,7 +441,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
441
441
|
..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
|
|
442
442
|
}))
|
|
443
443
|
};
|
|
444
|
-
},
|
|
444
|
+
}, Vt = 7500, Ht = (e) => typeof e == "object" && !!e && e.kind === "event", Ut = (e) => {
|
|
445
445
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
446
446
|
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
447
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -476,60 +476,60 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
476
476
|
webhook: e.webhook,
|
|
477
477
|
delivery: e.delivery
|
|
478
478
|
};
|
|
479
|
-
},
|
|
479
|
+
}, Wt = (e) => m.Struct({
|
|
480
480
|
_tag: m.Literal("event"),
|
|
481
481
|
origin: m.String,
|
|
482
482
|
n: m.Number,
|
|
483
483
|
emittedAt: m.Number,
|
|
484
484
|
payload: e
|
|
485
|
-
}),
|
|
485
|
+
}), Gt = m.Struct({
|
|
486
486
|
_tag: m.Literal("gap"),
|
|
487
487
|
missed: m.Number,
|
|
488
488
|
reason: m.Literal("buffer", "resume")
|
|
489
|
-
}),
|
|
489
|
+
}), Kt = m.Struct({ _tag: m.Literal("attached") }), qt = (e) => m.Union(Kt, Wt(e), Gt), Jt = m.Struct({
|
|
490
490
|
origin: m.String,
|
|
491
491
|
n: m.Number
|
|
492
|
-
}),
|
|
492
|
+
}), Yt = (e) => m.Struct({
|
|
493
493
|
key: e,
|
|
494
|
-
resume: m.optional(m.Array(
|
|
495
|
-
}),
|
|
494
|
+
resume: m.optional(m.Array(Jt))
|
|
495
|
+
}), Xt = (e, t) => {
|
|
496
496
|
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
497
|
return h.make(e.name, {
|
|
498
|
-
payload: S(
|
|
499
|
-
success:
|
|
498
|
+
payload: S(Yt(e.key), e.name, z(e.guards)),
|
|
499
|
+
success: qt(e.payload),
|
|
500
500
|
error: r,
|
|
501
501
|
stream: !0
|
|
502
502
|
});
|
|
503
|
-
},
|
|
503
|
+
}, Zt = class extends m.TaggedError()("EventPayloadInvalid", {
|
|
504
504
|
event: m.String,
|
|
505
505
|
message: m.String
|
|
506
|
-
}) {},
|
|
506
|
+
}) {}, Qt = class extends m.TaggedError()("EventKeyInvalid", {
|
|
507
507
|
event: m.String,
|
|
508
508
|
message: m.String
|
|
509
|
-
}) {},
|
|
509
|
+
}) {}, $t = class extends m.TaggedError()("EventPayloadTooLarge", {
|
|
510
510
|
event: m.String,
|
|
511
511
|
bytes: m.Number,
|
|
512
512
|
limit: m.Number
|
|
513
|
-
}) {},
|
|
513
|
+
}) {}, en = (e) => {
|
|
514
514
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
515
515
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
516
516
|
return JSON.stringify(t);
|
|
517
|
-
},
|
|
517
|
+
}, tn = "\0", nn = (e, t, n) => [
|
|
518
518
|
e ?? "~",
|
|
519
519
|
t,
|
|
520
|
-
|
|
521
|
-
].join("\0"),
|
|
520
|
+
en(n)
|
|
521
|
+
].join("\0"), rn = (e) => {
|
|
522
522
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
523
523
|
return {
|
|
524
524
|
tenantId: t === "~" ? null : t,
|
|
525
525
|
event: n,
|
|
526
526
|
key: r
|
|
527
527
|
};
|
|
528
|
-
},
|
|
528
|
+
}, an = (e) => e.split("\0").join(" · "), V = Symbol.for("@voltro/protocol/workflow-access"), on = {
|
|
529
529
|
guards: void 0,
|
|
530
530
|
openAccess: void 0,
|
|
531
531
|
internal: !1
|
|
532
|
-
},
|
|
532
|
+
}, sn = (e, t) => {
|
|
533
533
|
let n = t.guards;
|
|
534
534
|
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
535
|
and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
|
|
@@ -549,16 +549,16 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
549
549
|
openAccess: t.openAccess?.trim(),
|
|
550
550
|
internal: t.internal === !0
|
|
551
551
|
};
|
|
552
|
-
},
|
|
552
|
+
}, cn = (e, t) => {
|
|
553
553
|
Object.defineProperty(e, V, {
|
|
554
554
|
value: t,
|
|
555
555
|
enumerable: !1
|
|
556
556
|
});
|
|
557
557
|
}, H = (e) => {
|
|
558
|
-
if (typeof e != "object" || !e) return
|
|
558
|
+
if (typeof e != "object" || !e) return on;
|
|
559
559
|
let t = e[V];
|
|
560
|
-
return t === void 0 ?
|
|
561
|
-
},
|
|
560
|
+
return t === void 0 ? on : t;
|
|
561
|
+
}, ln = (e) => {
|
|
562
562
|
let t = H(e);
|
|
563
563
|
return {
|
|
564
564
|
name: e.name,
|
|
@@ -566,9 +566,9 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
566
566
|
guards: t.guards,
|
|
567
567
|
openAccess: t.openAccess
|
|
568
568
|
};
|
|
569
|
-
},
|
|
570
|
-
if (!
|
|
571
|
-
if (t >=
|
|
569
|
+
}, un = (e) => typeof e == "object" && !!e && typeof e._tag == "string", dn = 64, U = (e, t = 0) => {
|
|
570
|
+
if (!un(e)) return String(e);
|
|
571
|
+
if (t >= dn) return "…";
|
|
572
572
|
let n = t + 1, r = (t) => U(e[t], n), i = (t) => Array.isArray(e[t]) ? e[t] : [];
|
|
573
573
|
switch (e._tag) {
|
|
574
574
|
case "Transformation": return `T(${r("from")}->${r("to")})`;
|
|
@@ -595,23 +595,23 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
595
595
|
case "Declaration": return `D(${i("typeParameters").map((e) => U(e, n)).join(",")})`;
|
|
596
596
|
default: return String(e);
|
|
597
597
|
}
|
|
598
|
-
},
|
|
598
|
+
}, fn = (e) => {
|
|
599
599
|
let t = 2166136261;
|
|
600
600
|
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
601
601
|
return t.toString(16).padStart(8, "0");
|
|
602
|
-
},
|
|
602
|
+
}, pn = (e) => fn([
|
|
603
603
|
U(e.payloadSchema?.ast),
|
|
604
604
|
U(e.successSchema?.ast),
|
|
605
605
|
U(e.errorSchema?.ast)
|
|
606
|
-
].join("\0")),
|
|
606
|
+
].join("\0")), mn = (e) => {
|
|
607
607
|
let t = {}, n = e.requests, r = n instanceof Map ? n.entries() : Array.isArray(n) ? n.map((e, t) => [t, e]) : [];
|
|
608
608
|
for (let [, e] of r) {
|
|
609
609
|
if (typeof e != "object" && typeof e != "function" || e === null) continue;
|
|
610
610
|
let n = e;
|
|
611
|
-
typeof n._tag == "string" && (t[n._tag] =
|
|
611
|
+
typeof n._tag == "string" && (t[n._tag] = pn(n));
|
|
612
612
|
}
|
|
613
613
|
return t;
|
|
614
|
-
},
|
|
614
|
+
}, hn = (e, t) => {
|
|
615
615
|
let n = [], r = [];
|
|
616
616
|
for (let [i, a] of Object.entries(t)) {
|
|
617
617
|
let t = e[i];
|
|
@@ -621,18 +621,18 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
621
621
|
differing: n.sort(),
|
|
622
622
|
missingHere: r.sort()
|
|
623
623
|
};
|
|
624
|
-
},
|
|
624
|
+
}, gn = (e) => e, _n = (e) => e, vn = (e) => {
|
|
625
625
|
let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
|
|
626
626
|
return n !== void 0 && n !== "" ? `${r}#${n}` : r;
|
|
627
|
-
},
|
|
627
|
+
}, yn = (e) => {
|
|
628
628
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
629
|
-
},
|
|
630
|
-
let n =
|
|
629
|
+
}, bn = (e, t) => {
|
|
630
|
+
let n = We.GenericTag(e);
|
|
631
631
|
return {
|
|
632
632
|
Tag: n,
|
|
633
|
-
Live:
|
|
633
|
+
Live: Ge.succeed(n, t)
|
|
634
634
|
};
|
|
635
|
-
},
|
|
635
|
+
}, xn = (e, t, n) => {
|
|
636
636
|
if (!t) return { ok: !0 };
|
|
637
637
|
let r = n === void 0 ? null : W(n);
|
|
638
638
|
if (!r) return {
|
|
@@ -642,7 +642,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
642
642
|
let i = t.trim();
|
|
643
643
|
if (i === "*" || i === "") return { ok: !0 };
|
|
644
644
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
645
|
-
for (let i of a) if (!
|
|
645
|
+
for (let i of a) if (!Sn(i, r)) return {
|
|
646
646
|
ok: !1,
|
|
647
647
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
648
648
|
};
|
|
@@ -655,7 +655,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
655
655
|
patch: Number(t[3]),
|
|
656
656
|
pre: t[4] ?? ""
|
|
657
657
|
} : 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,
|
|
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, Sn = (e, t) => {
|
|
659
659
|
if (e === "*") return !0;
|
|
660
660
|
if (e.startsWith("^")) {
|
|
661
661
|
let n = W(e.slice(1));
|
|
@@ -677,50 +677,50 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
677
677
|
}
|
|
678
678
|
let r = W(e);
|
|
679
679
|
return r ? G(t, r) === 0 : !1;
|
|
680
|
-
},
|
|
680
|
+
}, Cn = (e) => {
|
|
681
681
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
682
682
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
|
|
683
|
-
},
|
|
683
|
+
}, wn = (e) => {
|
|
684
684
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
685
685
|
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[
|
|
686
|
+
}, Tn = Symbol.for("@voltro/protocol/pluginAliases"), K = () => {
|
|
687
|
+
let e = globalThis, t = e[Tn];
|
|
688
688
|
if (t instanceof Map) return t;
|
|
689
689
|
let n = /* @__PURE__ */ new Map();
|
|
690
|
-
return e[
|
|
691
|
-
},
|
|
690
|
+
return e[Tn] = n, n;
|
|
691
|
+
}, En = (e) => {
|
|
692
692
|
let t = K();
|
|
693
693
|
for (let [n, r] of Object.entries(e)) {
|
|
694
694
|
if (r === "") continue;
|
|
695
695
|
let e = t.get(n);
|
|
696
696
|
e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
|
|
697
697
|
}
|
|
698
|
-
},
|
|
698
|
+
}, Dn = () => {
|
|
699
699
|
K().clear();
|
|
700
|
-
},
|
|
700
|
+
}, On = (e, t) => {
|
|
701
701
|
let n = K().get(e);
|
|
702
|
-
if (n === void 0 || n.size === 0) return `${
|
|
702
|
+
if (n === void 0 || n.size === 0) return `${Cn(e)}.${t}`;
|
|
703
703
|
if (n.size === 1) return `${[...n][0]}.${t}`;
|
|
704
704
|
let r = [...n].filter((e) => !e.includes("#"));
|
|
705
705
|
if (r.length === 1) return `${r[0]}.${t}`;
|
|
706
706
|
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"),
|
|
707
|
+
}, q = m.Literal("running", "succeeded", "failed", "cancelled", "suspended"), kn = m.Literal("cancel", "terminate", "abandon"), An = m.Struct({
|
|
708
708
|
mode: m.String,
|
|
709
709
|
dueAt: m.NullOr(m.Number),
|
|
710
710
|
retryAfterMs: m.NullOr(m.Number),
|
|
711
711
|
intentId: m.NullOr(m.String)
|
|
712
|
-
}),
|
|
712
|
+
}), jn = m.Struct({
|
|
713
713
|
id: m.String,
|
|
714
714
|
workflowName: m.String,
|
|
715
715
|
executionId: m.NullOr(m.String),
|
|
716
716
|
status: m.Literal("running", "queued", "dropped", "skipped", "replayed"),
|
|
717
|
-
deferral: m.optional(
|
|
718
|
-
}),
|
|
717
|
+
deferral: m.optional(An)
|
|
718
|
+
}), Mn = (e, t) => {
|
|
719
719
|
let n = H(e);
|
|
720
720
|
return h.make(e.name, {
|
|
721
721
|
payload: S(e.payloadSchema, e.name, z(n.guards)),
|
|
722
|
-
success:
|
|
723
|
-
error:
|
|
722
|
+
success: jn,
|
|
723
|
+
error: Mt({
|
|
724
724
|
errorSchema: e.errorSchema,
|
|
725
725
|
guards: n.guards
|
|
726
726
|
}, t)
|
|
@@ -744,12 +744,12 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
744
744
|
durationMs: m.NullOr(m.Number),
|
|
745
745
|
traceId: m.NullOr(m.String),
|
|
746
746
|
parentExecutionId: m.NullOr(m.String),
|
|
747
|
-
parentClosePolicy: m.NullOr(
|
|
748
|
-
}),
|
|
747
|
+
parentClosePolicy: m.NullOr(kn)
|
|
748
|
+
}), Nn = m.Struct({
|
|
749
749
|
tag: m.optional(m.String),
|
|
750
750
|
status: m.optional(q),
|
|
751
751
|
limit: m.optional(m.Number)
|
|
752
|
-
}),
|
|
752
|
+
}), Pn = m.Struct({
|
|
753
753
|
id: m.String,
|
|
754
754
|
runId: m.String,
|
|
755
755
|
stepName: m.String,
|
|
@@ -764,7 +764,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
764
764
|
startedAt: m.Date,
|
|
765
765
|
completedAt: m.NullOr(m.Date),
|
|
766
766
|
durationMs: m.NullOr(m.Number)
|
|
767
|
-
}),
|
|
767
|
+
}), Fn = m.Struct({
|
|
768
768
|
id: m.String,
|
|
769
769
|
runId: m.String,
|
|
770
770
|
eventType: m.String,
|
|
@@ -772,7 +772,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
772
772
|
occurredAt: m.Date,
|
|
773
773
|
stepName: m.NullOr(m.String),
|
|
774
774
|
attempt: m.NullOr(m.Number)
|
|
775
|
-
}),
|
|
775
|
+
}), In = m.Struct({
|
|
776
776
|
id: m.String,
|
|
777
777
|
name: m.String,
|
|
778
778
|
payload: m.Unknown,
|
|
@@ -780,7 +780,7 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
780
780
|
subject: m.NullOr(m.Unknown),
|
|
781
781
|
traceId: m.NullOr(m.String),
|
|
782
782
|
occurredAt: m.Date
|
|
783
|
-
}),
|
|
783
|
+
}), Ln = m.Struct({
|
|
784
784
|
id: m.String,
|
|
785
785
|
eventId: m.String,
|
|
786
786
|
eventName: m.String,
|
|
@@ -793,129 +793,129 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
793
793
|
errorMessage: m.NullOr(m.String),
|
|
794
794
|
createdAt: m.Date,
|
|
795
795
|
completedAt: m.NullOr(m.Date)
|
|
796
|
-
}),
|
|
796
|
+
}), Rn = m.Struct({ id: m.String }), Y = m.Struct({ runId: m.String }), zn = m.Struct({
|
|
797
797
|
name: m.optional(m.String),
|
|
798
798
|
limit: m.optional(m.Number)
|
|
799
|
-
}),
|
|
799
|
+
}), Bn = m.Struct({ eventId: m.String }), X = m.Struct({
|
|
800
800
|
workflowName: m.String,
|
|
801
801
|
executionId: m.String
|
|
802
|
-
}),
|
|
802
|
+
}), Vn = m.Struct({
|
|
803
803
|
id: m.String,
|
|
804
804
|
signalName: m.String,
|
|
805
805
|
payload: m.optional(m.Unknown)
|
|
806
|
-
}),
|
|
806
|
+
}), Hn = m.Struct({
|
|
807
807
|
id: m.String,
|
|
808
808
|
updateName: m.String,
|
|
809
809
|
payload: m.optional(m.Unknown),
|
|
810
810
|
timeoutMs: m.optional(m.Number)
|
|
811
|
-
}),
|
|
811
|
+
}), Un = m.Struct({
|
|
812
812
|
eventId: m.String,
|
|
813
813
|
updateId: m.String,
|
|
814
814
|
completedEventId: m.String,
|
|
815
815
|
result: m.Unknown
|
|
816
|
-
}),
|
|
816
|
+
}), Wn = F({
|
|
817
817
|
name: "__voltro.workflow.run",
|
|
818
818
|
source: "_voltro_workflow_runs",
|
|
819
|
-
input:
|
|
819
|
+
input: Rn,
|
|
820
820
|
output: m.Array(J)
|
|
821
|
-
}),
|
|
821
|
+
}), Gn = F({
|
|
822
822
|
name: "__voltro.workflow.runs",
|
|
823
823
|
source: "_voltro_workflow_runs",
|
|
824
|
-
input:
|
|
824
|
+
input: Nn,
|
|
825
825
|
output: m.Array(J)
|
|
826
|
-
}),
|
|
826
|
+
}), Kn = F({
|
|
827
827
|
name: "__voltro.workflow.run.steps",
|
|
828
828
|
source: "_voltro_workflow_run_steps",
|
|
829
829
|
input: Y,
|
|
830
|
-
output: m.Array(
|
|
831
|
-
}),
|
|
830
|
+
output: m.Array(Pn)
|
|
831
|
+
}), qn = F({
|
|
832
832
|
name: "__voltro.workflow.run.events",
|
|
833
833
|
source: "_voltro_workflow_run_events",
|
|
834
834
|
input: Y,
|
|
835
|
-
output: m.Array(Pn)
|
|
836
|
-
}), qn = F({
|
|
837
|
-
name: "__voltro.workflow.domainEvents",
|
|
838
|
-
source: "_voltro_workflow_events",
|
|
839
|
-
input: Rn,
|
|
840
835
|
output: m.Array(Fn)
|
|
841
836
|
}), Jn = F({
|
|
842
|
-
name: "__voltro.workflow.
|
|
843
|
-
source: "
|
|
837
|
+
name: "__voltro.workflow.domainEvents",
|
|
838
|
+
source: "_voltro_workflow_events",
|
|
844
839
|
input: zn,
|
|
845
840
|
output: m.Array(In)
|
|
846
|
-
}), Yn =
|
|
841
|
+
}), Yn = F({
|
|
842
|
+
name: "__voltro.workflow.event.deliveries",
|
|
843
|
+
source: "_voltro_workflow_event_deliveries",
|
|
844
|
+
input: Bn,
|
|
845
|
+
output: m.Array(Ln)
|
|
846
|
+
}), Xn = L({
|
|
847
847
|
name: "__voltro.workflow.cancel",
|
|
848
848
|
input: X,
|
|
849
849
|
output: m.Struct({ ok: m.Boolean })
|
|
850
|
-
}),
|
|
850
|
+
}), Zn = L({
|
|
851
851
|
name: "__voltro.workflow.resume",
|
|
852
852
|
input: X,
|
|
853
853
|
output: m.Struct({ ok: m.Boolean })
|
|
854
|
-
}),
|
|
854
|
+
}), Qn = L({
|
|
855
855
|
name: "__voltro.workflow.signal",
|
|
856
|
-
input:
|
|
856
|
+
input: Vn,
|
|
857
857
|
output: m.Struct({ eventId: m.String })
|
|
858
|
-
}),
|
|
858
|
+
}), $n = L({
|
|
859
859
|
name: "__voltro.workflow.update",
|
|
860
|
-
input:
|
|
861
|
-
output:
|
|
862
|
-
}),
|
|
860
|
+
input: Hn,
|
|
861
|
+
output: Un
|
|
862
|
+
}), er = "__voltro.undo.log", tr = "__voltro.undo.apply", nr = "__voltro.undo.redo", rr = m.Struct({
|
|
863
863
|
id: m.String,
|
|
864
864
|
tag: m.String,
|
|
865
865
|
label: m.NullOr(m.String),
|
|
866
866
|
undone: m.Boolean,
|
|
867
867
|
crossesAction: m.Boolean,
|
|
868
868
|
createdAt: m.String
|
|
869
|
-
}),
|
|
869
|
+
}), ir = class extends m.TaggedError()("UndoNotFound", { invocationId: m.String }) {}, ar = class extends m.TaggedError()("UndoForbidden", { invocationId: m.String }) {}, or = class extends m.TaggedError()("UndoConflict", {
|
|
870
870
|
invocationId: m.String,
|
|
871
871
|
reason: m.Literal("conflict", "action")
|
|
872
|
-
}) {}, Z = m.Union(
|
|
873
|
-
name:
|
|
872
|
+
}) {}, Z = m.Union(ir, ar, or), sr = F({
|
|
873
|
+
name: er,
|
|
874
874
|
source: "_voltro_undo_log",
|
|
875
875
|
input: m.Struct({ limit: m.optional(m.Number) }),
|
|
876
|
-
output: m.Array(
|
|
876
|
+
output: m.Array(rr),
|
|
877
877
|
openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
|
|
878
|
-
}),
|
|
879
|
-
name:
|
|
878
|
+
}), cr = I({
|
|
879
|
+
name: tr,
|
|
880
880
|
input: m.Struct({ invocationId: m.String }),
|
|
881
881
|
output: m.Struct({ ok: m.Boolean }),
|
|
882
882
|
error: Z,
|
|
883
883
|
openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
884
|
-
}),
|
|
885
|
-
name:
|
|
884
|
+
}), lr = I({
|
|
885
|
+
name: nr,
|
|
886
886
|
input: m.Struct({ invocationId: m.String }),
|
|
887
887
|
output: m.Struct({ ok: m.Boolean }),
|
|
888
888
|
error: Z,
|
|
889
889
|
openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
890
|
-
}),
|
|
890
|
+
}), ur = class extends m.TaggedError()("TenantScopeViolation", {
|
|
891
891
|
table: m.String,
|
|
892
892
|
reason: m.String
|
|
893
|
-
}) {},
|
|
893
|
+
}) {}, dr = class extends m.TaggedError()("StoreOperationFailed", {
|
|
894
894
|
operation: m.String,
|
|
895
895
|
table: m.String,
|
|
896
896
|
cause: m.String
|
|
897
|
-
}) {},
|
|
897
|
+
}) {}, fr = class extends m.TaggedError()("NoRowFound", {
|
|
898
898
|
table: m.String,
|
|
899
899
|
found: m.Number
|
|
900
900
|
}) {
|
|
901
901
|
get message() {
|
|
902
902
|
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
903
|
}
|
|
904
|
-
},
|
|
904
|
+
}, pr = class extends m.TaggedError()("TableValidationFailed", {
|
|
905
905
|
table: m.String,
|
|
906
906
|
summary: m.String,
|
|
907
907
|
issues: m.Array(m.Struct({
|
|
908
908
|
path: m.String,
|
|
909
909
|
message: m.String
|
|
910
910
|
}))
|
|
911
|
-
}) {},
|
|
911
|
+
}) {}, mr = class extends m.TaggedError()("TenantRowNotFound", {
|
|
912
912
|
table: m.String,
|
|
913
913
|
id: m.String,
|
|
914
914
|
reason: m.String
|
|
915
|
-
}) {},
|
|
915
|
+
}) {}, hr = class extends m.TaggedError()("ServerOnlyColumnWrite", {
|
|
916
916
|
table: m.String,
|
|
917
917
|
columns: m.Array(m.String)
|
|
918
|
-
}) {},
|
|
918
|
+
}) {}, gr = class extends m.TaggedError()("ConstraintViolation", {
|
|
919
919
|
kind: m.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
|
|
920
920
|
table: m.String,
|
|
921
921
|
operation: m.String,
|
|
@@ -934,14 +934,14 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
934
934
|
case "check": return `check constraint ${t}: the row does not satisfy it`;
|
|
935
935
|
}
|
|
936
936
|
}
|
|
937
|
-
},
|
|
938
|
-
name:
|
|
937
|
+
}, _r = "__voltro.approvals.pending", vr = "__voltro.approvals.decide", yr = F({
|
|
938
|
+
name: _r,
|
|
939
939
|
source: "_voltro_approvals",
|
|
940
940
|
input: m.Struct({ limit: m.optional(m.Number) }),
|
|
941
|
-
output: m.Array(
|
|
941
|
+
output: m.Array(ht),
|
|
942
942
|
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:
|
|
943
|
+
}), br = I({
|
|
944
|
+
name: vr,
|
|
945
945
|
input: m.Struct({
|
|
946
946
|
approvalId: m.String,
|
|
947
947
|
decision: m.Literal("approve", "reject"),
|
|
@@ -951,35 +951,35 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
951
951
|
approvalId: m.String,
|
|
952
952
|
status: m.Literal("approved", "rejected")
|
|
953
953
|
}),
|
|
954
|
-
error:
|
|
954
|
+
error: mt,
|
|
955
955
|
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
|
-
}),
|
|
956
|
+
}), xr = "__voltro.connections.list", Sr = "__voltro.connections.start", Cr = "__voltro.connections.submitToken", wr = "__voltro.connections.disconnect", Q = m.Literal("oauth2", "pat"), Tr = m.Literal("disconnected", "connected", "expired", "revoked", "error"), Er = m.Struct({
|
|
957
957
|
connectionId: m.String,
|
|
958
958
|
kind: Q,
|
|
959
959
|
label: m.String,
|
|
960
|
-
status:
|
|
960
|
+
status: Tr,
|
|
961
961
|
accountId: m.NullOr(m.String),
|
|
962
962
|
accountLabel: m.NullOr(m.String),
|
|
963
963
|
scopes: m.Array(m.String),
|
|
964
964
|
expiresAt: m.NullOr(m.String),
|
|
965
965
|
lastError: m.NullOr(m.String),
|
|
966
966
|
connectedAt: m.NullOr(m.String)
|
|
967
|
-
}),
|
|
967
|
+
}), Dr = class extends m.TaggedError()("ConnectionNotDeclared", { connectionId: m.String }) {}, Or = class extends m.TaggedError()("ConnectionSubjectRequired", { connectionId: m.String }) {}, kr = class extends m.TaggedError()("ConnectionKindMismatch", {
|
|
968
968
|
connectionId: m.String,
|
|
969
969
|
expected: Q,
|
|
970
970
|
actual: Q
|
|
971
|
-
}) {},
|
|
971
|
+
}) {}, Ar = class extends m.TaggedError()("ConnectionHandshakeFailed", {
|
|
972
972
|
connectionId: m.String,
|
|
973
973
|
reason: m.String,
|
|
974
974
|
transient: m.Boolean
|
|
975
|
-
}) {}, $ = m.Union(
|
|
976
|
-
name:
|
|
975
|
+
}) {}, $ = m.Union(Dr, Or, kr, Ar), jr = F({
|
|
976
|
+
name: xr,
|
|
977
977
|
source: "_voltro_connections",
|
|
978
978
|
input: m.Struct({}),
|
|
979
|
-
output: m.Array(
|
|
979
|
+
output: m.Array(Er),
|
|
980
980
|
openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
|
|
981
|
-
}),
|
|
982
|
-
name:
|
|
981
|
+
}), Mr = L({
|
|
982
|
+
name: Sr,
|
|
983
983
|
input: m.Struct({
|
|
984
984
|
connectionId: m.String,
|
|
985
985
|
redirectTo: m.optional(m.String)
|
|
@@ -990,8 +990,8 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
990
990
|
}),
|
|
991
991
|
error: $,
|
|
992
992
|
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:
|
|
993
|
+
}), Nr = I({
|
|
994
|
+
name: Cr,
|
|
995
995
|
input: m.Struct({
|
|
996
996
|
connectionId: m.String,
|
|
997
997
|
token: m.String
|
|
@@ -999,20 +999,20 @@ var Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
|
999
999
|
output: m.Struct({ ok: m.Boolean }),
|
|
1000
1000
|
error: $,
|
|
1001
1001
|
openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
1002
|
-
}),
|
|
1003
|
-
name:
|
|
1002
|
+
}), Pr = I({
|
|
1003
|
+
name: wr,
|
|
1004
1004
|
input: m.Struct({ connectionId: m.String }),
|
|
1005
1005
|
output: m.Struct({ ok: m.Boolean }),
|
|
1006
1006
|
error: $,
|
|
1007
1007
|
openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
|
|
1008
|
-
}),
|
|
1008
|
+
}), Fr = (e) => {
|
|
1009
1009
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
1010
1010
|
return Number.isNaN(t) ? 0 : t;
|
|
1011
|
-
},
|
|
1011
|
+
}, Ir = 4001, Lr = /* @__PURE__ */ new Set(["/rpc", "/ws"]), Rr = (e) => {
|
|
1012
1012
|
if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
|
|
1013
|
-
if (
|
|
1013
|
+
if (Lr.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
|
|
1014
1014
|
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
1015
|
return e;
|
|
1016
|
-
},
|
|
1016
|
+
}, zr = 1;
|
|
1017
1017
|
//#endregion
|
|
1018
|
-
export {
|
|
1018
|
+
export { Oe as ADMIN_SCOPE, Se as APIKEY_ISSUE_ORG_SCOPE, Ee as APIKEY_ISSUE_OTHER_SCOPE, _e as APIKEY_ISSUE_SELF_SCOPE, vr as APPROVALS_DECIDE_TAG, _r as APPROVALS_PENDING_TAG, mt as ApprovalDecisionErrors, pt as ApprovalErrors, C as ApprovalExpired, ft as ApprovalForbidden, ct as ApprovalNotFound, dt as ApprovalNotPending, ut as ApprovalRejected, st as ApprovalRequired, lt as ApprovalSelfApproval, w as ApprovalUnavailable, se as AuthMiddleware, nt as BusinessRuleViolation, xr as CONNECTIONS_LIST_TAG, wr as CONNECTION_DISCONNECT_TAG, Sr as CONNECTION_START_TAG, Cr as CONNECTION_SUBMIT_TOKEN_TAG, Ar as ConnectionHandshakeFailed, i as ConnectionInfo, r as ConnectionInfoMiddleware, Q as ConnectionKind, kr as ConnectionKindMismatch, Dr as ConnectionNotDeclared, Er as ConnectionState, Tr as ConnectionStatus, Or as ConnectionSubjectRequired, gr as ConstraintViolation, ie as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, ye as DEFAULT_SCOPE_CACHE_TTL_MS, tn as EVENT_ROUTE_SEP, Qt as EventKeyInvalid, Zt as EventPayloadInvalid, $t as EventPayloadTooLarge, Ir as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, e as IMPERSONATION_METADATA_KEY, Vt as MAX_EVENT_ENVELOPE_BYTES, Be as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, p as MutationConnectionRequired, Pe as MutationInFlight, fr as NoRowFound, zr as PROTOCOL_VERSION, ht as PendingApproval, T as REACTIVITY_CHANNEL_PREFIX, u as ScopeError, hr as ServerOnlyColumnWrite, dr as StoreOperationFailed, ve as Subject, ne as SubjectIdentity, re as SubjectService, pr as TableValidationFailed, mr as TenantRowNotFound, ur as TenantScopeViolation, tr as UNDO_APPLY_TAG, er as UNDO_LOG_TAG, nr as UNDO_REDO_TAG, l as Unauthenticated, or as UndoConflict, ar as UndoForbidden, rr as UndoLogEntry, ir as UndoNotFound, it as ValidationError, at as ValidationErrors, rt as ValidationIssue, V as WorkflowAccessProperty, X as WorkflowControlInputSchema, In as WorkflowDomainEventRowSchema, zn as WorkflowDomainEventsInputSchema, Bn as WorkflowEventDeliveriesInputSchema, Ln as WorkflowEventDeliveryRowSchema, kn as WorkflowParentClosePolicySchema, Fn as WorkflowRunEventRowSchema, jn as WorkflowRunHandleSchema, Rn as WorkflowRunRefSchema, J as WorkflowRunRowSchema, q as WorkflowRunStatusSchema, Pn as WorkflowRunStepRowSchema, Y as WorkflowRunTableRefSchema, Nn as WorkflowRunsInputSchema, Vn as WorkflowSignalInputSchema, An as WorkflowStartDeferralSchema, Hn as WorkflowUpdateInputSchema, Un as WorkflowUpdateResultSchema, It as actionToRpc, Ce as advisoryResourceGuardWarning, a as anonymousSubject, et as applyRowPatch, c as applyScopeDecision, br as approvalsDecideDescriptor, yr as approvalsPendingQueryDescriptor, te as assertAuthenticated, cn as attachWorkflowAccess, ze as beginIdempotent, xn as checkFrameworkCompat, De as checkGuards, pe as checkGuardsEffect, hn as compareSurfaces, ae as composeAuthStrategies, yn as composeRpcInterceptors, Pr as connectionDisconnectDescriptor, Mr as connectionStartDescriptor, Nr as connectionSubmitTokenDescriptor, jr as connectionsListQueryDescriptor, k as declaredReactivityChannelKeys, L as defineAction, Ut as defineEvent, I as defineMutation, gn as definePlugin, _n as definePluginRoute, bn as definePluginService, F as defineQuery, Dt as defineStream, Rr as defineWebSocket, Qe as diffRows, be as effectiveScopes, en as encodeEventKey, Rt as errorTag, Kt as eventAttached, Wt as eventEnvelope, Gt as eventGap, Jt as eventResumePoint, nn as eventRoute, qt as eventStreamEvent, Yt as eventSubscribeInput, Xt as eventToRpc, Ve as failIdempotent, ot as fieldIssuesOf, ke as findAdvisoryResourceGuards, Fe as finishIdempotent, an as formatEventRoute, me as getPolicyGuardResolver, he as getResourceScopeResolver, H as getWorkflowAccess, mn as groupShapeDigests, Et as hasAccessDecision, Ne as hasCallbackRoutes, we as hasEffectiveScope, z as hasEnforcedGuard, xe as hasScope, g as idToPath, Le as idempotencyScope, x as inputLabel, ge as isAuthenticatedCheck, Tt as isAuthenticatedGuard, Ht as isEventDescriptor, $e as isIdKeyed, d as isOpenAccess, de as isPolicyCheck, wt as isPolicyGuard, D as isReactivityChannel, O as isReactivityChannelKey, t as isSystemSubject, St as isWireReachable, le as makeScopeCache, Ue as memoryIdempotencyStore, Ae as missingAccessDecision, Ft as mutationToRpc, Bt as normalizeDescriptor, M as normalizeSource, f as openAccessSpec, s as orderByBearerPrefix, rn as parseEventRoute, _ as pathToId, Cn as pluginAlias, vn as pluginInstanceName, wn as pluginSlug, On as pluginTag, pn as procedureShapeDigest, xt as publishReactivity, He as publishServerError, Pt as queryToRpc, ce as rawImpersonationMark, yt as reactivityChannel, En as registerPluginAliases, fe as requireScope, Dn as resetPluginAliases, sn as resolveWorkflowAccess, Ye as rowPatchOpSchema, Xe as rowPatchSchema, U as schemaShape, ue as scopeCacheKey, Me as setEffectiveScopes, oe as setPolicyGuardResolver, n as setResourceScopeResolver, fn as shapeDigest, j as sourceKeys, Lt as streamToRpc, S as strictInput, o as subjectIdentity, je as subjectScopes, Re as subscribeServerErrors, b as subscriptionEvent, ee as systemSubject, Te as tenantScopedSubject, zt as toRpc, Fr as tsMs, bt as undeclaredChannelKeys, cr as undoApplyDescriptor, sr as undoLogQueryDescriptor, lr as undoRedoDescriptor, B as wireErrorUnion, Nt as withRpcTag, ln as workflowAccessDescriptor, Xn as workflowCancelDescriptor, Jn as workflowDomainEventsQueryDescriptor, Yn as workflowEventDeliveriesQueryDescriptor, Zn as workflowResumeDescriptor, qn as workflowRunEventsQueryDescriptor, Wn as workflowRunQueryDescriptor, Kn as workflowRunStepsQueryDescriptor, Gn as workflowRunsQueryDescriptor, Qn as workflowSignalDescriptor, Mn as workflowToRpc, $n as workflowUpdateDescriptor, Mt as workflowWireErrorUnion, Ie as wsMutationIdempotencyScope };
|