@voltro/protocol 0.74.0 → 0.76.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 +723 -0
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/index.d.ts +149 -5
- package/dist/index.js +261 -213
- package/dist/rest.js +1 -1
- package/dist/{scopes-Dj7KCJab.js → scopes-D2dnEr4U.js} +51 -48
- package/dist/session.js +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as ee, K as te, L as ne, M as re, N as ie, O as ae, P as oe, Q as se, R as ce, S as le, T as ue, U as de, V as fe, W as pe, X as me, Y as he, Z as ge, _ as u, a as _e, b as d, c as ve, d as ye, f as be, g as xe, h as Se, i as Ce, j as we, k as Te, l as Ee, m as De, n as Oe, o as f, p as ke, q as Ae, r as je, s as Me, t as Ne, u as Pe, v as Fe, w as Ie, x as Le, y as Re, z as ze } from "./scopes-
|
|
1
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as ee, K as te, L as ne, M as re, N as ie, O as ae, P as oe, Q as se, R as ce, S as le, T as ue, U as de, V as fe, W as pe, X as me, Y as he, Z as ge, _ as u, a as _e, b as d, c as ve, d as ye, f as be, g as xe, h as Se, i as Ce, j as we, k as Te, l as Ee, m as De, n as Oe, o as f, p as ke, q as Ae, r as je, s as Me, t as Ne, u as Pe, v as Fe, w as Ie, x as Le, y as Re, z as ze } from "./scopes-D2dnEr4U.js";
|
|
2
2
|
import { C as Be, D as Ve, E as He, S as Ue, T as We, _ as Ge, a as Ke, b as qe, c as Je, d as Ye, f as Xe, g as Ze, h as Qe, i as $e, l as et, m as tt, n as nt, o as rt, p as it, r as at, s as ot, t as st, u as ct, v as lt, w as ut, x as dt, y as ft } from "./restFormat-ChSVyufA.js";
|
|
3
3
|
import { Context as pt, Layer as mt, Schema as p } from "effect";
|
|
4
4
|
import { Rpc as m } from "@effect/rpc";
|
|
@@ -252,14 +252,14 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
252
252
|
toString: () => n
|
|
253
253
|
});
|
|
254
254
|
return T.set(e, r), r;
|
|
255
|
-
}, Ut = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", Wt = (e) => e.startsWith(w), Gt = () => new Set([...T.values()].map((e) => e.key)), E = (e) => Ut(e) ? e.key : e,
|
|
255
|
+
}, Ut = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", Wt = (e) => e.startsWith(w), Gt = () => new Set([...T.values()].map((e) => e.key)), E = (e) => Ut(e) ? e.key : e, Kt = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(E) : [E(e)], qt = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(E) : E(e), Jt = (e) => {
|
|
256
256
|
let t = Gt(), n = [];
|
|
257
|
-
for (let r of e) for (let e of
|
|
257
|
+
for (let r of e) for (let e of Kt(r.source)) Wt(e) && !t.has(e) && n.push({
|
|
258
258
|
procedure: r.name,
|
|
259
259
|
key: e
|
|
260
260
|
});
|
|
261
261
|
return n;
|
|
262
|
-
},
|
|
262
|
+
}, Yt = (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 gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
268
268
|
old: {},
|
|
269
269
|
origin: "inline"
|
|
270
270
|
}), !0);
|
|
271
|
-
},
|
|
272
|
-
if (
|
|
271
|
+
}, Xt = (e) => e.internal !== !0, D = (e) => {
|
|
272
|
+
if (Zt(e), e.idempotencyScope !== void 0 && e.idempotencyScope !== "subject" && e.idempotencyScope !== "connection") throw Error(`${e.name}: idempotencyScope must be 'subject' or 'connection'`);
|
|
273
273
|
let t = e.serialize;
|
|
274
274
|
if (t !== void 0) {
|
|
275
275
|
if (typeof t.key != "function") throw Error(`${e.name}: serialize.key must be a function of the input`);
|
|
@@ -293,7 +293,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
293
293
|
let r = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
294
294
|
if (r.length === 0) return e;
|
|
295
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
|
-
},
|
|
296
|
+
}, Zt = (e) => {
|
|
297
297
|
let t = e.requiresApproval;
|
|
298
298
|
if (t !== void 0) {
|
|
299
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
|
|
@@ -303,28 +303,28 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
303
303
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
304
304
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
305
305
|
}
|
|
306
|
-
},
|
|
306
|
+
}, Qt = (e) => e.action !== void 0 && e.resourceType !== void 0, $t = (e) => e.authenticated === !0, en = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, O = (e, t, n) => {
|
|
307
307
|
if (n === void 0) return t;
|
|
308
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
|
|
309
309
|
without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
|
|
310
310
|
if (t !== void 0 && t.length > 0) throw Error(`${e}: \`openAccess\` and \`guards\` are two different access decisions, so\n declaring both says the procedure is protected AND open. Keep the guards if a
|
|
311
311
|
caller must hold a scope; drop them if anyone may call it.`);
|
|
312
312
|
return [d(n.trim())];
|
|
313
|
-
},
|
|
313
|
+
}, k = (e) => D({
|
|
314
314
|
kind: "query",
|
|
315
315
|
name: e.name,
|
|
316
316
|
input: e.input,
|
|
317
317
|
output: e.output,
|
|
318
318
|
error: e.error ?? p.Never,
|
|
319
|
-
source:
|
|
319
|
+
source: qt(e.source),
|
|
320
320
|
cache: e.cache,
|
|
321
|
-
guards:
|
|
321
|
+
guards: O(e.name, e.guards, e.openAccess),
|
|
322
322
|
openAccess: e.openAccess,
|
|
323
323
|
publicApi: e.publicApi,
|
|
324
324
|
exposeAsTool: e.exposeAsTool,
|
|
325
325
|
internal: e.internal,
|
|
326
326
|
overridesPlugin: e.overridesPlugin
|
|
327
|
-
}),
|
|
327
|
+
}), A = (e) => D({
|
|
328
328
|
kind: "mutation",
|
|
329
329
|
name: e.name,
|
|
330
330
|
input: e.input,
|
|
@@ -333,20 +333,20 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
333
333
|
...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
|
|
334
334
|
...e.serialize === void 0 ? {} : { serialize: e.serialize },
|
|
335
335
|
target: e.target,
|
|
336
|
-
guards:
|
|
336
|
+
guards: O(e.name, e.guards, e.openAccess),
|
|
337
337
|
openAccess: e.openAccess,
|
|
338
338
|
publicApi: e.publicApi,
|
|
339
339
|
exposeAsTool: e.exposeAsTool,
|
|
340
340
|
requiresApproval: e.requiresApproval,
|
|
341
341
|
internal: e.internal,
|
|
342
342
|
overridesPlugin: e.overridesPlugin
|
|
343
|
-
}),
|
|
343
|
+
}), j = (e) => D({
|
|
344
344
|
kind: "action",
|
|
345
345
|
name: e.name,
|
|
346
346
|
input: e.input,
|
|
347
347
|
output: e.output,
|
|
348
348
|
error: e.error ?? p.Never,
|
|
349
|
-
guards:
|
|
349
|
+
guards: O(e.name, e.guards, e.openAccess),
|
|
350
350
|
openAccess: e.openAccess,
|
|
351
351
|
source: e.source,
|
|
352
352
|
target: e.target,
|
|
@@ -355,7 +355,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
355
355
|
requiresApproval: e.requiresApproval,
|
|
356
356
|
internal: e.internal,
|
|
357
357
|
overridesPlugin: e.overridesPlugin
|
|
358
|
-
}),
|
|
358
|
+
}), tn = (e) => D({
|
|
359
359
|
kind: "stream",
|
|
360
360
|
name: e.name,
|
|
361
361
|
input: e.input,
|
|
@@ -363,47 +363,47 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
363
363
|
error: e.error ?? p.Never,
|
|
364
364
|
internal: e.internal,
|
|
365
365
|
overridesPlugin: e.overridesPlugin,
|
|
366
|
-
guards:
|
|
366
|
+
guards: O(e.name, e.guards, e.openAccess),
|
|
367
367
|
openAccess: e.openAccess
|
|
368
|
-
}),
|
|
368
|
+
}), M = (e, t) => t && t.length > 0 ? p.Union(e, ...t) : e, N = (e) => e !== void 0 && e.some((e) => !u(e)), nn = (e, t) => N(t) ? p.Union(e, f, l) : e, rn = (e) => p.Union(e, Tt), an = (e) => p.Union(e, Dt, Ot), on = (e, t) => t === void 0 ? e : p.Union(e, It), P = (e, t) => {
|
|
369
369
|
if (t === "stream") return e.error;
|
|
370
|
-
let n =
|
|
370
|
+
let n = nn(e.error, e.guards);
|
|
371
371
|
if (t === "query") return n;
|
|
372
|
-
let r = t === "mutation" ? p.Union(
|
|
373
|
-
return
|
|
374
|
-
},
|
|
372
|
+
let r = t === "mutation" ? p.Union(rn(n), dt, ht) : n;
|
|
373
|
+
return on(an(t === "mutation" && e.idempotencyScope === "connection" ? p.Union(r, qe) : r), e.requiresApproval);
|
|
374
|
+
}, sn = (e, t) => M(nn(e.errorSchema, e.guards), t), cn = (e, t) => ({
|
|
375
375
|
...e,
|
|
376
376
|
name: t
|
|
377
|
-
}),
|
|
378
|
-
payload: x(e.input, e.name,
|
|
377
|
+
}), ln = (e, t) => m.make(e.name, {
|
|
378
|
+
payload: x(e.input, e.name, N(e.guards)),
|
|
379
379
|
success: y(e.output),
|
|
380
|
-
error: P(
|
|
380
|
+
error: M(P(e, "query"), t),
|
|
381
381
|
stream: !0
|
|
382
|
-
}),
|
|
383
|
-
payload: x(e.input, e.name,
|
|
382
|
+
}), un = (e, t) => m.make(e.name, {
|
|
383
|
+
payload: x(e.input, e.name, N(e.guards)),
|
|
384
384
|
success: e.output,
|
|
385
|
-
error: P(
|
|
386
|
-
}),
|
|
387
|
-
payload: x(e.input, e.name,
|
|
385
|
+
error: M(P(e, "mutation"), t)
|
|
386
|
+
}), dn = (e, t) => m.make(e.name, {
|
|
387
|
+
payload: x(e.input, e.name, N(e.guards)),
|
|
388
388
|
success: e.output,
|
|
389
|
-
error: P(
|
|
390
|
-
}),
|
|
391
|
-
payload: x(e.input, e.name,
|
|
389
|
+
error: M(P(e, "action"), t)
|
|
390
|
+
}), fn = (e, t) => m.make(e.name, {
|
|
391
|
+
payload: x(e.input, e.name, N(e.guards)),
|
|
392
392
|
success: e.element,
|
|
393
|
-
error:
|
|
393
|
+
error: M(e.error, t),
|
|
394
394
|
stream: !0
|
|
395
|
-
}),
|
|
395
|
+
}), pn = (e) => {
|
|
396
396
|
if (typeof e != "object" || !e) return;
|
|
397
397
|
let t = e._tag;
|
|
398
398
|
return typeof t == "string" ? t : void 0;
|
|
399
|
-
},
|
|
399
|
+
}, mn = (e) => {
|
|
400
400
|
switch (e.kind) {
|
|
401
|
-
case "query": return
|
|
402
|
-
case "mutation": return
|
|
403
|
-
case "action": return
|
|
404
|
-
case "stream": return
|
|
401
|
+
case "query": return ln(e);
|
|
402
|
+
case "mutation": return un(e);
|
|
403
|
+
case "action": return dn(e);
|
|
404
|
+
case "stream": return fn(e);
|
|
405
405
|
}
|
|
406
|
-
},
|
|
406
|
+
}, hn = (e) => {
|
|
407
407
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
408
408
|
if (e.kind === "query") return {
|
|
409
409
|
kind: "query",
|
|
@@ -449,7 +449,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
449
449
|
..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
|
|
450
450
|
}))
|
|
451
451
|
};
|
|
452
|
-
},
|
|
452
|
+
}, gn = 7500, _n = (e) => typeof e == "object" && !!e && e.kind === "event", vn = (e) => {
|
|
453
453
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
454
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
|
|
455
455
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -484,60 +484,62 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
484
484
|
webhook: e.webhook,
|
|
485
485
|
delivery: e.delivery
|
|
486
486
|
};
|
|
487
|
-
},
|
|
487
|
+
}, yn = (e) => p.Struct({
|
|
488
488
|
_tag: p.Literal("event"),
|
|
489
489
|
origin: p.String,
|
|
490
490
|
n: p.Number,
|
|
491
491
|
emittedAt: p.Number,
|
|
492
492
|
payload: e
|
|
493
|
-
}),
|
|
493
|
+
}), bn = p.Struct({
|
|
494
494
|
_tag: p.Literal("gap"),
|
|
495
495
|
missed: p.Number,
|
|
496
496
|
reason: p.Literal("buffer", "resume")
|
|
497
|
-
}),
|
|
497
|
+
}), xn = p.Struct({ _tag: p.Literal("attached") }), Sn = (e) => p.Union(xn, yn(e), bn), Cn = p.Struct({
|
|
498
498
|
origin: p.String,
|
|
499
499
|
n: p.Number
|
|
500
|
-
}),
|
|
500
|
+
}), wn = (e) => p.Struct({
|
|
501
501
|
key: e,
|
|
502
|
-
resume: p.optional(p.Array(
|
|
503
|
-
}),
|
|
502
|
+
resume: p.optional(p.Array(Cn))
|
|
503
|
+
}), Tn = (e, t) => {
|
|
504
504
|
let n = e.guards !== void 0 && e.guards.some((e) => !u(e)) ? p.Union(f, l) : p.Never, r = t && t.length > 0 ? p.Union(n, ...t) : n;
|
|
505
505
|
return m.make(e.name, {
|
|
506
|
-
payload: x(
|
|
507
|
-
success:
|
|
506
|
+
payload: x(wn(e.key), e.name, N(e.guards)),
|
|
507
|
+
success: Sn(e.payload),
|
|
508
508
|
error: r,
|
|
509
509
|
stream: !0
|
|
510
510
|
});
|
|
511
|
-
},
|
|
511
|
+
}, En = class extends p.TaggedError()("EventPayloadInvalid", {
|
|
512
512
|
event: p.String,
|
|
513
513
|
message: p.String
|
|
514
|
-
}) {},
|
|
514
|
+
}) {}, Dn = class extends p.TaggedError()("EventKeyInvalid", {
|
|
515
515
|
event: p.String,
|
|
516
516
|
message: p.String
|
|
517
|
-
}) {},
|
|
517
|
+
}) {}, On = class extends p.TaggedError()("EventPayloadTooLarge", {
|
|
518
518
|
event: p.String,
|
|
519
519
|
bytes: p.Number,
|
|
520
520
|
limit: p.Number
|
|
521
|
-
}) {},
|
|
521
|
+
}) {}, kn = (e) => {
|
|
522
522
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
523
523
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
524
524
|
return JSON.stringify(t);
|
|
525
|
-
},
|
|
525
|
+
}, An = "\0", jn = (e, t, n) => [
|
|
526
526
|
e ?? "~",
|
|
527
527
|
t,
|
|
528
|
-
|
|
529
|
-
].join("\0"),
|
|
528
|
+
kn(n)
|
|
529
|
+
].join("\0"), Mn = (e) => {
|
|
530
530
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
531
531
|
return {
|
|
532
532
|
tenantId: t === "~" ? null : t,
|
|
533
533
|
event: n,
|
|
534
534
|
key: r
|
|
535
535
|
};
|
|
536
|
-
},
|
|
536
|
+
}, Nn = (e) => e.split("\0").join(" · "), F = Symbol.for("@voltro/protocol/workflow-access"), Pn = {
|
|
537
537
|
guards: void 0,
|
|
538
538
|
openAccess: void 0,
|
|
539
|
-
internal: !1
|
|
540
|
-
|
|
539
|
+
internal: !1,
|
|
540
|
+
controls: void 0,
|
|
541
|
+
controlsOpenAccess: void 0
|
|
542
|
+
}, Fn = (e, t) => {
|
|
541
543
|
let n = t.guards;
|
|
542
544
|
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
|
|
543
545
|
and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
|
|
@@ -552,42 +554,55 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
552
554
|
\`openAccess\` (an internal workflow needs no wire decision), or drop
|
|
553
555
|
\`internal: true\` if the workflow really is meant to be startable by clients.`);
|
|
554
556
|
}
|
|
557
|
+
let r = t.controls?.guards, i = t.controls?.openAccess;
|
|
558
|
+
if (r !== void 0 && r.length === 0) throw Error(`workflow("${e}"): \`controls: { guards: [] }\` is empty, so it enforces nothing —\n but it reads at the call site as if driving this run were protected. Omit
|
|
559
|
+
\`controls\` (wire control is then refused for everyone but \`admin:full\`), or
|
|
560
|
+
list the scopes a caller needs to cancel or signal a run.`);
|
|
561
|
+
if (i !== void 0) {
|
|
562
|
+
if (i.trim() === "") throw Error(`workflow("${e}"): \`controls: { openAccess }\` needs a REASON, not an empty string.\n It is the sentence a reviewer reads to decide whether anyone who can see this
|
|
563
|
+
run should be able to cancel or signal it — e.g. \`controls: { openAccess:
|
|
564
|
+
'the run belongs to the caller who started it; cancelling it affects nobody else' }\`.`);
|
|
565
|
+
if (r !== void 0 && r.length > 0) throw Error(`workflow("${e}"): \`controls\` takes \`guards\` OR \`openAccess\`, not both.\n Two answers to one question; keep the guards if a caller needs a scope.`);
|
|
566
|
+
}
|
|
555
567
|
return {
|
|
556
568
|
guards: t.openAccess === void 0 ? t.guards : [d(t.openAccess.trim())],
|
|
557
569
|
openAccess: t.openAccess?.trim(),
|
|
558
|
-
internal: t.internal === !0
|
|
570
|
+
internal: t.internal === !0,
|
|
571
|
+
controls: i === void 0 ? r : [d(i.trim())],
|
|
572
|
+
controlsOpenAccess: i?.trim()
|
|
559
573
|
};
|
|
560
|
-
},
|
|
561
|
-
Object.defineProperty(e,
|
|
574
|
+
}, In = (e, t) => {
|
|
575
|
+
Object.defineProperty(e, F, {
|
|
562
576
|
value: t,
|
|
563
577
|
enumerable: !1
|
|
564
578
|
});
|
|
565
|
-
},
|
|
566
|
-
if (typeof e != "object" || !e) return
|
|
567
|
-
let t = e[
|
|
568
|
-
return t === void 0 ?
|
|
569
|
-
},
|
|
570
|
-
let t =
|
|
579
|
+
}, I = (e) => {
|
|
580
|
+
if (typeof e != "object" || !e) return Pn;
|
|
581
|
+
let t = e[F];
|
|
582
|
+
return t === void 0 ? Pn : t;
|
|
583
|
+
}, Ln = (e) => {
|
|
584
|
+
let t = I(e);
|
|
571
585
|
return {
|
|
572
586
|
name: e.name,
|
|
573
587
|
internal: t.internal,
|
|
574
588
|
guards: t.guards,
|
|
575
|
-
openAccess: t.openAccess
|
|
589
|
+
openAccess: t.openAccess,
|
|
590
|
+
controls: t.controls
|
|
576
591
|
};
|
|
577
|
-
},
|
|
592
|
+
}, Rn = (e) => e, zn = (e) => e, Bn = (e) => {
|
|
578
593
|
let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
|
|
579
594
|
return n !== void 0 && n !== "" ? `${r}#${n}` : r;
|
|
580
|
-
},
|
|
595
|
+
}, Vn = (e) => {
|
|
581
596
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
582
|
-
},
|
|
597
|
+
}, Hn = (e, t) => {
|
|
583
598
|
let n = pt.GenericTag(e);
|
|
584
599
|
return {
|
|
585
600
|
Tag: n,
|
|
586
601
|
Live: mt.succeed(n, t)
|
|
587
602
|
};
|
|
588
|
-
},
|
|
603
|
+
}, Un = (e, t, n) => {
|
|
589
604
|
if (!t) return { ok: !0 };
|
|
590
|
-
let r = n === void 0 ? null :
|
|
605
|
+
let r = n === void 0 ? null : L(n);
|
|
591
606
|
if (!r) return {
|
|
592
607
|
ok: !0,
|
|
593
608
|
unverified: `plugin "${e}" requires framework ${t}, but the running framework version is ${n === void 0 ? "unknown" : `unreadable ("${n}")`} — not checked.`
|
|
@@ -595,12 +610,12 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
595
610
|
let i = t.trim();
|
|
596
611
|
if (i === "*" || i === "") return { ok: !0 };
|
|
597
612
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
598
|
-
for (let i of a) if (!
|
|
613
|
+
for (let i of a) if (!Wn(i, r)) return {
|
|
599
614
|
ok: !1,
|
|
600
615
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
601
616
|
};
|
|
602
617
|
return { ok: !0 };
|
|
603
|
-
},
|
|
618
|
+
}, L = (e) => {
|
|
604
619
|
let t = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9a-zA-Z.-]+))?$/.exec(e.trim());
|
|
605
620
|
return t ? {
|
|
606
621
|
major: Number(t[1]),
|
|
@@ -608,56 +623,56 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
608
623
|
patch: Number(t[3]),
|
|
609
624
|
pre: t[4] ?? ""
|
|
610
625
|
} : null;
|
|
611
|
-
},
|
|
626
|
+
}, R = (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, Wn = (e, t) => {
|
|
612
627
|
if (e === "*") return !0;
|
|
613
628
|
if (e.startsWith("^")) {
|
|
614
|
-
let n =
|
|
615
|
-
return !n || t.major !== n.major ? !1 :
|
|
629
|
+
let n = L(e.slice(1));
|
|
630
|
+
return !n || t.major !== n.major ? !1 : R(t, n) >= 0;
|
|
616
631
|
}
|
|
617
632
|
if (e.startsWith("~")) {
|
|
618
|
-
let n =
|
|
619
|
-
return !n || t.major !== n.major || t.minor !== n.minor ? !1 :
|
|
633
|
+
let n = L(e.slice(1));
|
|
634
|
+
return !n || t.major !== n.major || t.minor !== n.minor ? !1 : R(t, n) >= 0;
|
|
620
635
|
}
|
|
621
636
|
let n = /^(>=|<=|>|<)(.+)$/.exec(e);
|
|
622
637
|
if (n) {
|
|
623
|
-
let e = n[1], r =
|
|
638
|
+
let e = n[1], r = L(n[2]);
|
|
624
639
|
if (!r) return !1;
|
|
625
|
-
let i =
|
|
640
|
+
let i = R(t, r);
|
|
626
641
|
if (e === ">=") return i >= 0;
|
|
627
642
|
if (e === "<=") return i <= 0;
|
|
628
643
|
if (e === ">") return i > 0;
|
|
629
644
|
if (e === "<") return i < 0;
|
|
630
645
|
}
|
|
631
|
-
let r =
|
|
632
|
-
return r ?
|
|
633
|
-
},
|
|
646
|
+
let r = L(e);
|
|
647
|
+
return r ? R(t, r) === 0 : !1;
|
|
648
|
+
}, Gn = (e) => {
|
|
634
649
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
635
650
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
|
|
636
|
-
},
|
|
651
|
+
}, Kn = (e) => {
|
|
637
652
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
638
653
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
639
|
-
},
|
|
640
|
-
let e = globalThis, t = e[
|
|
654
|
+
}, qn = Symbol.for("@voltro/protocol/pluginAliases"), z = () => {
|
|
655
|
+
let e = globalThis, t = e[qn];
|
|
641
656
|
if (t instanceof Map) return t;
|
|
642
657
|
let n = /* @__PURE__ */ new Map();
|
|
643
|
-
return e[
|
|
644
|
-
},
|
|
645
|
-
let t =
|
|
658
|
+
return e[qn] = n, n;
|
|
659
|
+
}, Jn = (e) => {
|
|
660
|
+
let t = z();
|
|
646
661
|
for (let [n, r] of Object.entries(e)) {
|
|
647
662
|
if (r === "") continue;
|
|
648
663
|
let e = t.get(n);
|
|
649
664
|
e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
|
|
650
665
|
}
|
|
651
|
-
},
|
|
652
|
-
|
|
653
|
-
},
|
|
654
|
-
let n =
|
|
655
|
-
if (n === void 0 || n.size === 0) return `${
|
|
666
|
+
}, Yn = () => {
|
|
667
|
+
z().clear();
|
|
668
|
+
}, Xn = (e, t) => {
|
|
669
|
+
let n = z().get(e);
|
|
670
|
+
if (n === void 0 || n.size === 0) return `${Gn(e)}.${t}`;
|
|
656
671
|
if (n.size === 1) return `${[...n][0]}.${t}`;
|
|
657
672
|
let r = [...n].filter((e) => !e.includes("#"));
|
|
658
673
|
if (r.length === 1) return `${r[0]}.${t}`;
|
|
659
674
|
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}').`);
|
|
660
|
-
},
|
|
675
|
+
}, B = p.Union(p.Struct({
|
|
661
676
|
kind: p.Literal("dropped"),
|
|
662
677
|
at: p.Number,
|
|
663
678
|
retryAfterMs: p.Number
|
|
@@ -676,22 +691,22 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
676
691
|
kind: p.Literal("abandoned"),
|
|
677
692
|
at: p.Number,
|
|
678
693
|
failureId: p.NonEmptyString
|
|
679
|
-
})),
|
|
694
|
+
})), V = p.Literal("running", "succeeded", "failed", "cancelled", "suspended"), H = p.Struct({
|
|
680
695
|
id: p.String,
|
|
681
696
|
workflowName: p.String,
|
|
682
697
|
executionId: p.String,
|
|
683
|
-
status: p.Union(
|
|
698
|
+
status: p.Union(V, p.Literal("unknown")),
|
|
684
699
|
output: p.optional(p.Unknown),
|
|
685
700
|
error: p.optional(p.Struct({
|
|
686
701
|
tag: p.NullOr(p.String),
|
|
687
702
|
message: p.String
|
|
688
703
|
}))
|
|
689
|
-
}),
|
|
704
|
+
}), U = p.Struct({
|
|
690
705
|
operation: p.Literal("cancel", "resume"),
|
|
691
706
|
kind: p.Literal("accepted", "confirmed", "unknown", "already-terminal"),
|
|
692
707
|
requestId: p.NullOr(p.NonEmptyString),
|
|
693
|
-
snapshot:
|
|
694
|
-
}).pipe(p.filter((e) => e.kind === "unknown" ? !0 : e.kind === "accepted" ? e.requestId !== null && (e.snapshot.status === "running" || e.snapshot.status === "suspended") : e.kind === "already-terminal" ? e.snapshot.status === "succeeded" || e.snapshot.status === "failed" || e.snapshot.status === "cancelled" : e.operation === "cancel" ? e.snapshot.status === "cancelled" : e.requestId !== null && e.snapshot.status === "running", { message: () => "Workflow control acknowledgement contradicts its observed state or receipt identity" })),
|
|
708
|
+
snapshot: H
|
|
709
|
+
}).pipe(p.filter((e) => e.kind === "unknown" ? !0 : e.kind === "accepted" ? e.requestId !== null && (e.snapshot.status === "running" || e.snapshot.status === "suspended") : e.kind === "already-terminal" ? e.snapshot.status === "succeeded" || e.snapshot.status === "failed" || e.snapshot.status === "cancelled" : e.operation === "cancel" ? e.snapshot.status === "cancelled" : e.requestId !== null && e.snapshot.status === "running", { message: () => "Workflow control acknowledgement contradicts its observed state or receipt identity" })), W = p.Struct({
|
|
695
710
|
operation: p.Literal("cancel"),
|
|
696
711
|
workflowName: p.NonEmptyString,
|
|
697
712
|
receiptId: p.NonEmptyString,
|
|
@@ -699,13 +714,13 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
699
714
|
kind: p.Literal("accepted", "confirmed", "unknown", "already-terminal"),
|
|
700
715
|
observation: p.Union(p.Struct({ kind: p.Literal("pending") }), p.Struct({
|
|
701
716
|
kind: p.Literal("admission"),
|
|
702
|
-
outcome: p.Union(
|
|
717
|
+
outcome: p.Union(B, p.Struct({
|
|
703
718
|
kind: p.Literal("rejected"),
|
|
704
719
|
failureId: p.NonEmptyString
|
|
705
720
|
}))
|
|
706
721
|
}), p.Struct({
|
|
707
722
|
kind: p.Literal("execution"),
|
|
708
|
-
snapshot:
|
|
723
|
+
snapshot: H
|
|
709
724
|
}), p.Struct({
|
|
710
725
|
kind: p.Literal("unavailable"),
|
|
711
726
|
reason: p.Literal("missing-request", "missing-run", "unconfirmed-generation", "unbound-submission")
|
|
@@ -718,32 +733,32 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
718
733
|
if (t.kind === "admission") return e.kind === (t.outcome.kind === "cancelled" ? "confirmed" : "already-terminal");
|
|
719
734
|
let n = t.snapshot;
|
|
720
735
|
return n.workflowName !== e.workflowName || n.id.length === 0 || n.executionId.length === 0 ? !1 : e.kind === "accepted" ? n.status === "running" || n.status === "suspended" : e.kind === "confirmed" ? n.status === "cancelled" : e.kind === "already-terminal" && (n.status === "succeeded" || n.status === "failed" || n.status === "cancelled");
|
|
721
|
-
}, { message: () => "Queued cancellation acknowledgement contradicts its receipt or observation" })),
|
|
736
|
+
}, { message: () => "Queued cancellation acknowledgement contradicts its receipt or observation" })), Zn = p.Literal("cancel", "terminate", "abandon"), Qn = p.Struct({
|
|
722
737
|
mode: p.String,
|
|
723
738
|
dueAt: p.NullOr(p.Number),
|
|
724
739
|
retryAfterMs: p.NullOr(p.Number),
|
|
725
740
|
intentId: p.NullOr(p.String)
|
|
726
|
-
}),
|
|
741
|
+
}), $n = p.Struct({
|
|
727
742
|
id: p.String,
|
|
728
743
|
workflowName: p.String,
|
|
729
744
|
executionId: p.NullOr(p.String),
|
|
730
745
|
status: p.Literal("running", "succeeded", "queued", "dropped", "skipped", "replayed"),
|
|
731
|
-
deferral: p.optional(
|
|
732
|
-
}),
|
|
733
|
-
let n =
|
|
746
|
+
deferral: p.optional(Qn)
|
|
747
|
+
}), er = (e, t) => {
|
|
748
|
+
let n = I(e);
|
|
734
749
|
return m.make(e.name, {
|
|
735
|
-
payload: x(e.payloadSchema, e.name,
|
|
736
|
-
success:
|
|
737
|
-
error:
|
|
750
|
+
payload: x(e.payloadSchema, e.name, N(n.guards)),
|
|
751
|
+
success: $n,
|
|
752
|
+
error: sn({
|
|
738
753
|
errorSchema: e.errorSchema,
|
|
739
754
|
guards: n.guards
|
|
740
755
|
}, t)
|
|
741
756
|
});
|
|
742
|
-
},
|
|
757
|
+
}, G = p.Struct({
|
|
743
758
|
id: p.String,
|
|
744
759
|
tag: p.String,
|
|
745
760
|
executionId: p.String,
|
|
746
|
-
status:
|
|
761
|
+
status: V,
|
|
747
762
|
payload: p.Unknown,
|
|
748
763
|
workflowVersion: p.NullOr(p.String),
|
|
749
764
|
workflowPatches: p.NullOr(p.Unknown),
|
|
@@ -758,12 +773,12 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
758
773
|
durationMs: p.NullOr(p.Number),
|
|
759
774
|
traceId: p.NullOr(p.String),
|
|
760
775
|
parentExecutionId: p.NullOr(p.String),
|
|
761
|
-
parentClosePolicy: p.NullOr(
|
|
762
|
-
}),
|
|
776
|
+
parentClosePolicy: p.NullOr(Zn)
|
|
777
|
+
}), tr = p.Struct({
|
|
763
778
|
tag: p.optional(p.String),
|
|
764
|
-
status: p.optional(
|
|
779
|
+
status: p.optional(V),
|
|
765
780
|
limit: p.optional(p.Number)
|
|
766
|
-
}),
|
|
781
|
+
}), nr = p.Struct({
|
|
767
782
|
id: p.String,
|
|
768
783
|
runId: p.String,
|
|
769
784
|
stepName: p.String,
|
|
@@ -778,7 +793,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
778
793
|
startedAt: p.Date,
|
|
779
794
|
completedAt: p.NullOr(p.Date),
|
|
780
795
|
durationMs: p.NullOr(p.Number)
|
|
781
|
-
}),
|
|
796
|
+
}), rr = p.Struct({
|
|
782
797
|
id: p.String,
|
|
783
798
|
runId: p.String,
|
|
784
799
|
eventType: p.String,
|
|
@@ -786,7 +801,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
786
801
|
occurredAt: p.Date,
|
|
787
802
|
stepName: p.NullOr(p.String),
|
|
788
803
|
attempt: p.NullOr(p.Number)
|
|
789
|
-
}),
|
|
804
|
+
}), ir = p.Struct({
|
|
790
805
|
id: p.String,
|
|
791
806
|
name: p.String,
|
|
792
807
|
payload: p.Unknown,
|
|
@@ -794,7 +809,7 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
794
809
|
subject: p.NullOr(p.Unknown),
|
|
795
810
|
traceId: p.NullOr(p.String),
|
|
796
811
|
occurredAt: p.Date
|
|
797
|
-
}),
|
|
812
|
+
}), ar = p.Struct({
|
|
798
813
|
id: p.String,
|
|
799
814
|
eventId: p.String,
|
|
800
815
|
eventName: p.String,
|
|
@@ -807,10 +822,10 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
807
822
|
errorMessage: p.NullOr(p.String),
|
|
808
823
|
createdAt: p.Date,
|
|
809
824
|
completedAt: p.NullOr(p.Date)
|
|
810
|
-
}),
|
|
825
|
+
}), or = p.Struct({ id: p.String }), K = p.Struct({ runId: p.String }), sr = p.Struct({
|
|
811
826
|
name: p.optional(p.String),
|
|
812
827
|
limit: p.optional(p.Number)
|
|
813
|
-
}),
|
|
828
|
+
}), cr = p.Struct({ eventId: p.String }), q = p.Struct({
|
|
814
829
|
requestId: p.NonEmptyString,
|
|
815
830
|
cause: p.optionalWith(p.Struct({
|
|
816
831
|
reason: p.NonEmptyString,
|
|
@@ -819,164 +834,196 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
819
834
|
value: p.Unknown
|
|
820
835
|
}))
|
|
821
836
|
}), { exact: !0 })
|
|
822
|
-
}),
|
|
837
|
+
}), J = p.Struct({
|
|
823
838
|
workflowName: p.String,
|
|
824
839
|
executionId: p.String,
|
|
825
|
-
control: p.optional(
|
|
826
|
-
}),
|
|
840
|
+
control: p.optional(q)
|
|
841
|
+
}), lr = p.Struct({
|
|
827
842
|
workflowName: p.NonEmptyString,
|
|
828
843
|
executionId: p.NonEmptyString,
|
|
829
844
|
operation: p.Literal("cancel", "resume"),
|
|
830
845
|
requestId: p.NonEmptyString
|
|
831
|
-
}),
|
|
846
|
+
}), Y = p.Struct({
|
|
832
847
|
workflowName: p.NonEmptyString,
|
|
833
848
|
receiptId: p.NonEmptyString,
|
|
834
849
|
requestId: p.NonEmptyString
|
|
835
|
-
}),
|
|
836
|
-
...
|
|
837
|
-
cause:
|
|
838
|
-
}),
|
|
850
|
+
}), ur = p.Struct({
|
|
851
|
+
...Y.fields,
|
|
852
|
+
cause: q.fields.cause
|
|
853
|
+
}), dr = j({
|
|
839
854
|
name: "__voltro.workflow.queued.cancel",
|
|
840
|
-
input:
|
|
841
|
-
output:
|
|
855
|
+
input: ur,
|
|
856
|
+
output: W,
|
|
842
857
|
openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
|
|
843
|
-
}),
|
|
858
|
+
}), fr = k({
|
|
844
859
|
name: "__voltro.workflow.queued.control",
|
|
845
|
-
input:
|
|
846
|
-
output:
|
|
860
|
+
input: Y,
|
|
861
|
+
output: W,
|
|
847
862
|
openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
|
|
848
|
-
}),
|
|
863
|
+
}), pr = k({
|
|
849
864
|
name: "__voltro.workflow.control",
|
|
850
|
-
input:
|
|
851
|
-
output:
|
|
865
|
+
input: lr,
|
|
866
|
+
output: U,
|
|
852
867
|
openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
|
|
853
|
-
}),
|
|
868
|
+
}), mr = p.Struct({
|
|
854
869
|
id: p.String,
|
|
855
870
|
signalName: p.String,
|
|
856
871
|
payload: p.optional(p.Unknown)
|
|
857
|
-
}),
|
|
872
|
+
}), hr = p.Struct({
|
|
858
873
|
id: p.String,
|
|
859
874
|
updateName: p.String,
|
|
860
875
|
payload: p.optional(p.Unknown),
|
|
861
876
|
timeoutMs: p.optional(p.Number)
|
|
862
|
-
}),
|
|
877
|
+
}), gr = p.Struct({
|
|
863
878
|
eventId: p.String,
|
|
864
879
|
updateId: p.String,
|
|
865
880
|
completedEventId: p.String,
|
|
866
881
|
result: p.Unknown
|
|
867
|
-
}),
|
|
882
|
+
}), _r = k({
|
|
868
883
|
name: "__voltro.workflow.run",
|
|
869
884
|
source: "_voltro_workflow_runs",
|
|
870
|
-
input:
|
|
871
|
-
output: p.Array(
|
|
885
|
+
input: or,
|
|
886
|
+
output: p.Array(G),
|
|
872
887
|
openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
|
|
873
|
-
}),
|
|
888
|
+
}), vr = k({
|
|
874
889
|
name: "__voltro.workflow.runs",
|
|
875
890
|
source: "_voltro_workflow_runs",
|
|
876
|
-
input:
|
|
877
|
-
output: p.Array(
|
|
891
|
+
input: tr,
|
|
892
|
+
output: p.Array(G),
|
|
878
893
|
openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
|
|
879
|
-
}),
|
|
894
|
+
}), yr = k({
|
|
880
895
|
name: "__voltro.workflow.run.steps",
|
|
881
896
|
source: "_voltro_workflow_run_steps",
|
|
882
|
-
input:
|
|
883
|
-
output: p.Array(
|
|
897
|
+
input: K,
|
|
898
|
+
output: p.Array(nr),
|
|
884
899
|
openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
|
|
885
|
-
}),
|
|
900
|
+
}), br = k({
|
|
886
901
|
name: "__voltro.workflow.run.events",
|
|
887
902
|
source: "_voltro_workflow_run_events",
|
|
888
|
-
input:
|
|
889
|
-
output: p.Array(
|
|
903
|
+
input: K,
|
|
904
|
+
output: p.Array(rr),
|
|
890
905
|
openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
|
|
891
|
-
}),
|
|
906
|
+
}), xr = k({
|
|
892
907
|
name: "__voltro.workflow.domainEvents",
|
|
893
908
|
source: "_voltro_workflow_events",
|
|
894
|
-
input:
|
|
895
|
-
output: p.Array(
|
|
909
|
+
input: sr,
|
|
910
|
+
output: p.Array(ir),
|
|
896
911
|
openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
|
|
897
|
-
}),
|
|
912
|
+
}), Sr = k({
|
|
898
913
|
name: "__voltro.workflow.event.deliveries",
|
|
899
914
|
source: "_voltro_workflow_event_deliveries",
|
|
900
|
-
input:
|
|
901
|
-
output: p.Array(
|
|
915
|
+
input: cr,
|
|
916
|
+
output: p.Array(ar),
|
|
902
917
|
openAccess: "the answer is scoped to the caller in the executor — a system or admin:full subject sees every row, an authenticated subject the rows of its own tenant, an anonymous caller none"
|
|
903
|
-
}),
|
|
918
|
+
}), Cr = j({
|
|
904
919
|
name: "__voltro.workflow.cancel",
|
|
905
|
-
input:
|
|
906
|
-
output:
|
|
920
|
+
input: J,
|
|
921
|
+
output: U,
|
|
907
922
|
openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
|
|
908
|
-
}),
|
|
923
|
+
}), wr = j({
|
|
909
924
|
name: "__voltro.workflow.resume",
|
|
910
|
-
input:
|
|
911
|
-
output:
|
|
925
|
+
input: J,
|
|
926
|
+
output: U,
|
|
912
927
|
openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
|
|
913
|
-
}),
|
|
928
|
+
}), Tr = j({
|
|
914
929
|
name: "__voltro.workflow.signal",
|
|
915
|
-
input:
|
|
930
|
+
input: mr,
|
|
916
931
|
output: p.Struct({ eventId: p.String }),
|
|
917
932
|
openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
|
|
918
|
-
}),
|
|
933
|
+
}), Er = j({
|
|
919
934
|
name: "__voltro.workflow.update",
|
|
920
|
-
input:
|
|
921
|
-
output:
|
|
935
|
+
input: hr,
|
|
936
|
+
output: gr,
|
|
922
937
|
openAccess: "authorization happens in the executor against the target run — the caller must be authenticated and belong to the run's tenant, and a missing run answers exactly like a foreign one"
|
|
923
|
-
}),
|
|
938
|
+
}), Dr = p.NonEmptyString.pipe(p.filter((e) => e.trim().length > 0, { message: () => "A workflow retry identity must not be blank" })), Or = p.Struct({
|
|
939
|
+
runId: Dr,
|
|
940
|
+
requestId: Dr
|
|
941
|
+
}), kr = p.Struct({
|
|
942
|
+
...Or.fields,
|
|
943
|
+
payloadOverride: p.optional(p.Unknown)
|
|
944
|
+
}), X = {
|
|
945
|
+
requestId: p.NonEmptyString,
|
|
946
|
+
originalRunId: p.NonEmptyString,
|
|
947
|
+
originalExecutionId: p.NonEmptyString,
|
|
948
|
+
workflowName: p.NonEmptyString
|
|
949
|
+
}, Ar = p.Union(p.Struct({
|
|
950
|
+
...X,
|
|
951
|
+
kind: p.Literal("queued"),
|
|
952
|
+
nextAttemptAt: p.NullOr(p.Number)
|
|
953
|
+
}), p.Struct({
|
|
954
|
+
...X,
|
|
955
|
+
kind: p.Literal("accepted"),
|
|
956
|
+
executionId: p.NonEmptyString
|
|
957
|
+
}).pipe(p.filter((e) => e.executionId !== e.originalExecutionId, { message: () => "A retry cannot accept its original execution identity" })), p.Struct({
|
|
958
|
+
...X,
|
|
959
|
+
kind: p.Literal("unconfirmed"),
|
|
960
|
+
automaticRetryStopped: p.Boolean,
|
|
961
|
+
nextAttemptAt: p.NullOr(p.Number)
|
|
962
|
+
}).pipe(p.filter((e) => !e.automaticRetryStopped || e.nextAttemptAt === null, { message: () => "Stopped automatic retries cannot have a next attempt" })), p.Struct({
|
|
963
|
+
...X,
|
|
964
|
+
kind: p.Literal("not-started"),
|
|
965
|
+
outcome: B
|
|
966
|
+
}), p.Struct({
|
|
967
|
+
...X,
|
|
968
|
+
kind: p.Literal("rejected"),
|
|
969
|
+
failureId: p.NonEmptyString
|
|
970
|
+
})), jr = "__voltro.undo.log", Mr = "__voltro.undo.apply", Nr = "__voltro.undo.redo", Pr = p.Struct({
|
|
924
971
|
id: p.String,
|
|
925
972
|
tag: p.String,
|
|
926
973
|
label: p.NullOr(p.String),
|
|
927
974
|
undone: p.Boolean,
|
|
928
975
|
crossesAction: p.Boolean,
|
|
929
976
|
createdAt: p.String
|
|
930
|
-
}),
|
|
977
|
+
}), Fr = class extends p.TaggedError()("UndoNotFound", { invocationId: p.String }) {}, Ir = class extends p.TaggedError()("UndoForbidden", { invocationId: p.String }) {}, Lr = class extends p.TaggedError()("UndoConflict", {
|
|
931
978
|
invocationId: p.String,
|
|
932
979
|
reason: p.Literal("conflict", "action")
|
|
933
|
-
}) {},
|
|
934
|
-
name:
|
|
980
|
+
}) {}, Rr = p.Union(Fr, Ir, Lr), zr = k({
|
|
981
|
+
name: jr,
|
|
935
982
|
source: "_voltro_undo_log",
|
|
936
983
|
input: p.Struct({ limit: p.optional(p.Number) }),
|
|
937
|
-
output: p.Array(
|
|
984
|
+
output: p.Array(Pr),
|
|
938
985
|
openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
|
|
939
|
-
}),
|
|
940
|
-
name:
|
|
986
|
+
}), Br = A({
|
|
987
|
+
name: Mr,
|
|
941
988
|
input: p.Struct({ invocationId: p.String }),
|
|
942
989
|
output: p.Struct({ ok: p.Boolean }),
|
|
943
|
-
error:
|
|
990
|
+
error: Rr,
|
|
944
991
|
openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
945
|
-
}),
|
|
946
|
-
name:
|
|
992
|
+
}), Vr = A({
|
|
993
|
+
name: Nr,
|
|
947
994
|
input: p.Struct({ invocationId: p.String }),
|
|
948
995
|
output: p.Struct({ ok: p.Boolean }),
|
|
949
|
-
error:
|
|
996
|
+
error: Rr,
|
|
950
997
|
openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
951
|
-
}),
|
|
998
|
+
}), Hr = class extends p.TaggedError()("TenantScopeViolation", {
|
|
952
999
|
table: p.String,
|
|
953
1000
|
reason: p.String
|
|
954
|
-
}) {},
|
|
1001
|
+
}) {}, Ur = class extends p.TaggedError()("StoreOperationFailed", {
|
|
955
1002
|
operation: p.String,
|
|
956
1003
|
table: p.String,
|
|
957
1004
|
cause: p.String
|
|
958
|
-
}) {},
|
|
1005
|
+
}) {}, Wr = class extends p.TaggedError()("NoRowFound", {
|
|
959
1006
|
table: p.String,
|
|
960
1007
|
found: p.Number
|
|
961
1008
|
}) {
|
|
962
1009
|
get message() {
|
|
963
1010
|
return this.found === 0 ? `expected exactly one row in '${this.table}', found none` : `expected exactly one row in '${this.table}', found more than one`;
|
|
964
1011
|
}
|
|
965
|
-
},
|
|
1012
|
+
}, Gr = class extends p.TaggedError()("TableValidationFailed", {
|
|
966
1013
|
table: p.String,
|
|
967
1014
|
summary: p.String,
|
|
968
1015
|
issues: p.Array(p.Struct({
|
|
969
1016
|
path: p.String,
|
|
970
1017
|
message: p.String
|
|
971
1018
|
}))
|
|
972
|
-
}) {},
|
|
1019
|
+
}) {}, Kr = class extends p.TaggedError()("TenantRowNotFound", {
|
|
973
1020
|
table: p.String,
|
|
974
1021
|
id: p.String,
|
|
975
1022
|
reason: p.String
|
|
976
|
-
}) {},
|
|
1023
|
+
}) {}, qr = class extends p.TaggedError()("ServerOnlyColumnWrite", {
|
|
977
1024
|
table: p.String,
|
|
978
1025
|
columns: p.Array(p.String)
|
|
979
|
-
}) {},
|
|
1026
|
+
}) {}, Jr = class extends p.TaggedError()("ConstraintViolation", {
|
|
980
1027
|
kind: p.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
|
|
981
1028
|
table: p.String,
|
|
982
1029
|
operation: p.String,
|
|
@@ -995,14 +1042,14 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
995
1042
|
case "check": return `check constraint ${t}: the row does not satisfy it`;
|
|
996
1043
|
}
|
|
997
1044
|
}
|
|
998
|
-
},
|
|
999
|
-
name:
|
|
1045
|
+
}, Yr = "__voltro.approvals.pending", Xr = "__voltro.approvals.decide", Zr = k({
|
|
1046
|
+
name: Yr,
|
|
1000
1047
|
source: "_voltro_approvals",
|
|
1001
1048
|
input: p.Struct({ limit: p.optional(p.Number) }),
|
|
1002
1049
|
output: p.Array(Rt),
|
|
1003
1050
|
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"
|
|
1004
|
-
}),
|
|
1005
|
-
name:
|
|
1051
|
+
}), Qr = A({
|
|
1052
|
+
name: Xr,
|
|
1006
1053
|
input: p.Struct({
|
|
1007
1054
|
approvalId: p.String,
|
|
1008
1055
|
decision: p.Literal("approve", "reject"),
|
|
@@ -1014,33 +1061,33 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
1014
1061
|
}),
|
|
1015
1062
|
error: Lt,
|
|
1016
1063
|
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"
|
|
1017
|
-
}),
|
|
1064
|
+
}), Z = "__voltro.connections.list", $r = "__voltro.connections.start", ei = "__voltro.connections.submitToken", ti = "__voltro.connections.disconnect", Q = p.Literal("oauth2", "pat"), ni = p.Literal("disconnected", "connected", "expired", "revoked", "error"), ri = p.Struct({
|
|
1018
1065
|
connectionId: p.String,
|
|
1019
1066
|
kind: Q,
|
|
1020
1067
|
label: p.String,
|
|
1021
|
-
status:
|
|
1068
|
+
status: ni,
|
|
1022
1069
|
accountId: p.NullOr(p.String),
|
|
1023
1070
|
accountLabel: p.NullOr(p.String),
|
|
1024
1071
|
scopes: p.Array(p.String),
|
|
1025
1072
|
expiresAt: p.NullOr(p.String),
|
|
1026
1073
|
lastError: p.NullOr(p.String),
|
|
1027
1074
|
connectedAt: p.NullOr(p.String)
|
|
1028
|
-
}),
|
|
1075
|
+
}), ii = class extends p.TaggedError()("ConnectionNotDeclared", { connectionId: p.String }) {}, ai = class extends p.TaggedError()("ConnectionSubjectRequired", { connectionId: p.String }) {}, oi = class extends p.TaggedError()("ConnectionKindMismatch", {
|
|
1029
1076
|
connectionId: p.String,
|
|
1030
1077
|
expected: Q,
|
|
1031
1078
|
actual: Q
|
|
1032
|
-
}) {},
|
|
1079
|
+
}) {}, si = class extends p.TaggedError()("ConnectionHandshakeFailed", {
|
|
1033
1080
|
connectionId: p.String,
|
|
1034
1081
|
reason: p.String,
|
|
1035
1082
|
transient: p.Boolean
|
|
1036
|
-
}) {}, $ = p.Union(
|
|
1037
|
-
name:
|
|
1083
|
+
}) {}, $ = p.Union(ii, ai, oi, si), ci = k({
|
|
1084
|
+
name: Z,
|
|
1038
1085
|
source: "_voltro_connections",
|
|
1039
1086
|
input: p.Struct({}),
|
|
1040
|
-
output: p.Array(
|
|
1087
|
+
output: p.Array(ri),
|
|
1041
1088
|
openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
|
|
1042
|
-
}),
|
|
1043
|
-
name:
|
|
1089
|
+
}), li = j({
|
|
1090
|
+
name: $r,
|
|
1044
1091
|
input: p.Struct({
|
|
1045
1092
|
connectionId: p.String,
|
|
1046
1093
|
redirectTo: p.optional(p.String)
|
|
@@ -1051,8 +1098,8 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
1051
1098
|
}),
|
|
1052
1099
|
error: $,
|
|
1053
1100
|
openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
1054
|
-
}),
|
|
1055
|
-
name:
|
|
1101
|
+
}), ui = A({
|
|
1102
|
+
name: ei,
|
|
1056
1103
|
input: p.Struct({
|
|
1057
1104
|
connectionId: p.String,
|
|
1058
1105
|
token: p.String
|
|
@@ -1060,20 +1107,21 @@ var gt = p.Union(p.String, p.Number), h = p.Record({
|
|
|
1060
1107
|
output: p.Struct({ ok: p.Boolean }),
|
|
1061
1108
|
error: $,
|
|
1062
1109
|
openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
1063
|
-
}),
|
|
1064
|
-
name:
|
|
1110
|
+
}), di = A({
|
|
1111
|
+
name: ti,
|
|
1065
1112
|
input: p.Struct({ connectionId: p.String }),
|
|
1066
1113
|
output: p.Struct({ ok: p.Boolean }),
|
|
1067
1114
|
error: $,
|
|
1068
1115
|
openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
|
|
1069
|
-
}),
|
|
1116
|
+
}), fi = (e) => {
|
|
1070
1117
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
1071
1118
|
return Number.isNaN(t) ? 0 : t;
|
|
1072
|
-
},
|
|
1119
|
+
}, pi = 4001, mi = /* @__PURE__ */ new Set(["/rpc", "/ws"]), hi = (e) => {
|
|
1120
|
+
for (let [t, n] of Object.entries(e.limits ?? {})) if (n !== void 0 && (!Number.isSafeInteger(n) || n <= 0)) throw Error(`defineWebSocket: limits.${t} must be a positive safe integer`);
|
|
1073
1121
|
if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
|
|
1074
|
-
if (
|
|
1122
|
+
if (mi.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
|
|
1075
1123
|
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)}'`);
|
|
1076
1124
|
return e;
|
|
1077
|
-
},
|
|
1125
|
+
}, gi = 1;
|
|
1078
1126
|
//#endregion
|
|
1079
|
-
export { Ne as ADMIN_SCOPE, Oe as APIKEY_ISSUE_ORG_SCOPE, je as APIKEY_ISSUE_OTHER_SCOPE, Ce as APIKEY_ISSUE_SELF_SCOPE,
|
|
1127
|
+
export { Ne as ADMIN_SCOPE, Oe as APIKEY_ISSUE_ORG_SCOPE, je as APIKEY_ISSUE_OTHER_SCOPE, Ce as APIKEY_ISSUE_SELF_SCOPE, Xr as APPROVALS_DECIDE_TAG, Yr as APPROVALS_PENDING_TAG, Lt as ApprovalDecisionErrors, It as ApprovalErrors, S as ApprovalExpired, Ft as ApprovalForbidden, jt as ApprovalNotFound, Pt as ApprovalNotPending, Nt as ApprovalRejected, At as ApprovalRequired, Mt as ApprovalSelfApproval, C as ApprovalUnavailable, i as AuthMiddleware, Tt as BusinessRuleViolation, Z as CONNECTIONS_LIST_TAG, ti as CONNECTION_DISCONNECT_TAG, $r as CONNECTION_START_TAG, ei as CONNECTION_SUBMIT_TOKEN_TAG, si as ConnectionHandshakeFailed, ae as ConnectionInfo, Te as ConnectionInfoMiddleware, Q as ConnectionKind, oi as ConnectionKindMismatch, ii as ConnectionNotDeclared, ri as ConnectionState, ni as ConnectionStatus, ai as ConnectionSubjectRequired, Jr as ConstraintViolation, t as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, we as DEFAULT_SCOPE_CACHE_TTL_MS, _e as DEVICES_MANAGE_SCOPE, An as EVENT_ROUTE_SEP, Dn as EventKeyInvalid, En as EventPayloadInvalid, On as EventPayloadTooLarge, pi as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, re as IMPERSONATION_METADATA_KEY, st as JSONAPI_MEDIA_TYPE, gn as MAX_EVENT_ENVELOPE_BYTES, ft as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, qe as MutationConnectionRequired, dt as MutationInFlight, Wr as NoRowFound, nt as PROBLEM_JSON, gi as PROTOCOL_VERSION, Rt as PendingApproval, w as REACTIVITY_CHANNEL_PREFIX, at as REST_PROFILE_NAMES, f as ScopeError, qr as ServerOnlyColumnWrite, Ur as StoreOperationFailed, ie as Subject, oe as SubjectIdentity, o as SubjectService, Gr as TableValidationFailed, Kr as TenantRowNotFound, Hr as TenantScopeViolation, ge as TenantSelectionRefused, Mr as UNDO_APPLY_TAG, jr as UNDO_LOG_TAG, Nr as UNDO_REDO_TAG, l as Unauthenticated, Lr as UndoConflict, Ir as UndoForbidden, Pr as UndoLogEntry, Fr as UndoNotFound, Dt as ValidationError, Ot as ValidationErrors, Et as ValidationIssue, F as WorkflowAccessProperty, J as WorkflowControlInputSchema, q as WorkflowControlIntentSchema, lr as WorkflowControlReadInputSchema, U as WorkflowControlResultSchema, ir as WorkflowDomainEventRowSchema, sr as WorkflowDomainEventsInputSchema, cr as WorkflowEventDeliveriesInputSchema, ar as WorkflowEventDeliveryRowSchema, Zn as WorkflowParentClosePolicySchema, ur as WorkflowQueuedCancelInputSchema, W as WorkflowQueuedCancellationResultSchema, Y as WorkflowQueuedControlTargetSchema, kr as WorkflowRetryCommandSchema, Ar as WorkflowRetryObservationSchema, Or as WorkflowRetryTargetSchema, rr as WorkflowRunEventRowSchema, $n as WorkflowRunHandleSchema, or as WorkflowRunRefSchema, G as WorkflowRunRowSchema, H as WorkflowRunSnapshotSchema, V as WorkflowRunStatusSchema, nr as WorkflowRunStepRowSchema, K as WorkflowRunTableRefSchema, tr as WorkflowRunsInputSchema, mr as WorkflowSignalInputSchema, Qn as WorkflowStartDeferralSchema, B as WorkflowStartTerminalOutcomeSchema, hr as WorkflowUpdateInputSchema, gr as WorkflowUpdateResultSchema, dn as actionToRpc, Me as advisoryResourceGuardWarning, ne as anonymousSubject, Ct as applyRowPatch, ce as applyScopeDecision, Qr as approvalsDecideDescriptor, Zr as approvalsPendingQueryDescriptor, ze as assertAuthenticated, In as attachWorkflowAccess, Ue as beginIdempotent, Un as checkFrameworkCompat, ve as checkGuards, Ee as checkGuardsEffect, tt as compareSurfaces, n as composeAuthStrategies, Vn as composeRpcInterceptors, di as connectionDisconnectDescriptor, li as connectionStartDescriptor, ui as connectionSubmitTokenDescriptor, ci as connectionsListQueryDescriptor, Gt as declaredReactivityChannelKeys, j as defineAction, vn as defineEvent, A as defineMutation, Rn as definePlugin, zn as definePluginRoute, Hn as definePluginService, k as defineQuery, tn as defineStream, hi as defineWebSocket, xt as diffRows, Pe as effectiveScopes, kn as encodeEventKey, $e as encodeRestError, Ke as encodeRestSuccess, pn as errorTag, xn as eventAttached, yn as eventEnvelope, bn as eventGap, Cn as eventResumePoint, jn as eventRoute, Sn as eventStreamEvent, wn as eventSubscribeInput, Tn as eventToRpc, Be as failIdempotent, kt as fieldIssuesOf, ye as findAdvisoryResourceGuards, ut as finishIdempotent, Nn as formatEventRoute, be as getPolicyGuardResolver, ke as getResourceScopeResolver, I as getWorkflowAccess, Qe as groupShapeDigests, en as hasAccessDecision, fe as hasCallbackRoutes, De as hasEffectiveScope, N as hasEnforcedGuard, Se as hasScope, g as idToPath, We as idempotencyScope, b as inputLabel, xe as isAuthenticatedCheck, $t as isAuthenticatedGuard, _n as isEventDescriptor, St as isIdKeyed, u as isOpenAccess, Fe as isPolicyCheck, Qt as isPolicyGuard, Ut as isReactivityChannel, Wt as isReactivityChannelKey, c as isSystemSubject, se as isTenantSelectable, Xt as isWireReachable, de as makeScopeCache, He as memoryIdempotencyStore, Re as missingAccessDecision, un as mutationToRpc, rt as nextLink, hn as normalizeDescriptor, qt as normalizeSource, d as openAccessSpec, pe as orderByBearerPrefix, Mn as parseEventRoute, yt as pathToId, Gn as pluginAlias, Bn as pluginInstanceName, Kn as pluginSlug, Xn as pluginTag, ot as problemDetails, Je as problemTypeOf, Ze as procedureShapeDigest, Yt as publishReactivity, Xe as publishServerError, ln as queryToRpc, s as rawImpersonationMark, Ht as reactivityChannel, Jn as registerPluginAliases, Le as requireScope, Yn as resetPluginAliases, le as resolvePolicyAction, et as resolveRestFormat, Fn as resolveWorkflowAccess, ct as restViewSchema, _t as rowPatchOpSchema, vt as rowPatchSchema, Ge as schemaShape, te as scopeCacheKey, e as selectSubjectTenant, r as setEffectiveScopes, Ie as setPolicyGuardResolver, ue as setResourceScopeResolver, lt as shapeDigest, Kt as sourceKeys, fn as streamToRpc, x as strictInput, Ae as subjectAuditActorId, ee as subjectIdentity, a as subjectScopes, it as subscribeServerErrors, y as subscriptionEvent, he as systemSubject, me as tenantScopedSubject, mn as toRpc, Ye as toSnakeCase, fi as tsMs, Jt as undeclaredChannelKeys, Br as undoApplyDescriptor, zr as undoLogQueryDescriptor, Vr as undoRedoDescriptor, P as wireErrorUnion, cn as withRpcTag, Ln as workflowAccessDescriptor, Cr as workflowCancelDescriptor, pr as workflowControlQueryDescriptor, xr as workflowDomainEventsQueryDescriptor, Sr as workflowEventDeliveriesQueryDescriptor, dr as workflowQueuedCancelDescriptor, fr as workflowQueuedControlQueryDescriptor, wr as workflowResumeDescriptor, br as workflowRunEventsQueryDescriptor, _r as workflowRunQueryDescriptor, yr as workflowRunStepsQueryDescriptor, vr as workflowRunsQueryDescriptor, Tr as workflowSignalDescriptor, er as workflowToRpc, Er as workflowUpdateDescriptor, sn as workflowWireErrorUnion, Ve as wsMutationIdempotencyScope };
|