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