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