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