@voltro/protocol 0.81.0 → 0.83.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 +1806 -6
- package/dist/apikey.d.ts +2 -2
- package/dist/index.d.ts +613 -69
- package/dist/index.js +881 -644
- package/dist/inspect.d.ts +85 -1
- package/dist/inspect.js +106 -61
- package/dist/jwt.d.ts +1 -1
- package/dist/rest.d.ts +40 -3
- package/dist/rest.js +191 -159
- package/dist/{restFormat-CzdGVkuB.js → restFormat-EZ8k9ZcQ.js} +38 -33
- package/dist/{scopes-CvU5QBQ4.js → scopes-Di756ENh.js} +126 -106
- package/dist/session.d.ts +11 -0
- package/dist/session.js +53 -52
- 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 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
|
|
2
|
-
import { A 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 wt = m.Union(m.String, m.Number), Tt = m.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
|
-
},
|
|
158
|
-
let r =
|
|
171
|
+
}, x = (e, t, n) => {
|
|
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 wt = m.Union(m.String, m.Number), Tt = m.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 wt = m.Union(m.String, m.Number), Tt = m.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,13 +319,13 @@ var wt = m.Union(m.String, m.Number), Tt = m.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) => {
|
|
309
323
|
let t = e.service;
|
|
310
324
|
if (t === void 0) return;
|
|
311
325
|
let n = t.callers;
|
|
312
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'] }\`,
|
|
313
327
|
or drop \`service:\` if the procedure is meant for this app's own clients.`);
|
|
314
|
-
let r = n.filter((e) => typeof e != "string" || !
|
|
328
|
+
let r = n.filter((e) => typeof e != "string" || !gn.test(e));
|
|
315
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
|
|
316
330
|
lists in \`serviceCallers\` and the caller's credential resolves to.`);
|
|
317
331
|
if (new Set(n).size !== n.length) throw Error(`${e.name}: \`service.callers\` lists the same app twice`);
|
|
@@ -325,7 +339,7 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
325
339
|
].filter((e) => e !== void 0);
|
|
326
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
|
|
327
341
|
socket, with their service credential. Drop the other field, or drop \`service:\`.`);
|
|
328
|
-
},
|
|
342
|
+
}, vn = (e) => {
|
|
329
343
|
let t = e.requiresApproval;
|
|
330
344
|
if (t !== void 0) {
|
|
331
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
|
|
@@ -335,43 +349,43 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
335
349
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
336
350
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
337
351
|
}
|
|
338
|
-
},
|
|
339
|
-
if (
|
|
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) {
|
|
340
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
|
|
341
355
|
holds no scopes, and no user may call a service procedure. Keep exactly one.`);
|
|
342
|
-
return Array.isArray(
|
|
356
|
+
return Array.isArray(i.callers) ? [a(i.callers)] : void 0;
|
|
343
357
|
}
|
|
344
358
|
if (n === void 0) return t;
|
|
345
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
|
|
346
360
|
without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
|
|
347
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
|
|
348
362
|
caller must hold a scope; drop them if anyone may call it.`);
|
|
349
|
-
return [
|
|
350
|
-
},
|
|
363
|
+
return [r(n.trim())];
|
|
364
|
+
}, N = (e) => j({
|
|
351
365
|
kind: "query",
|
|
352
366
|
name: e.name,
|
|
353
367
|
input: e.input,
|
|
354
368
|
output: e.output,
|
|
355
|
-
error: e.error ??
|
|
356
|
-
source:
|
|
369
|
+
error: e.error ?? h.Never,
|
|
370
|
+
source: un(e.source),
|
|
357
371
|
cache: e.cache,
|
|
358
|
-
guards:
|
|
372
|
+
guards: M(e.name, e.guards, e.openAccess, e.service),
|
|
359
373
|
openAccess: e.openAccess,
|
|
360
374
|
service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
|
|
361
375
|
publicApi: e.publicApi,
|
|
362
376
|
exposeAsTool: e.exposeAsTool,
|
|
363
377
|
internal: e.internal,
|
|
364
378
|
overridesPlugin: e.overridesPlugin
|
|
365
|
-
}),
|
|
379
|
+
}), P = (e) => j({
|
|
366
380
|
kind: "mutation",
|
|
367
381
|
name: e.name,
|
|
368
382
|
input: e.input,
|
|
369
383
|
output: e.output,
|
|
370
|
-
error: e.error ??
|
|
384
|
+
error: e.error ?? h.Never,
|
|
371
385
|
...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
|
|
372
386
|
...e.serialize === void 0 ? {} : { serialize: e.serialize },
|
|
373
387
|
target: e.target,
|
|
374
|
-
guards:
|
|
388
|
+
guards: M(e.name, e.guards, e.openAccess, e.service),
|
|
375
389
|
openAccess: e.openAccess,
|
|
376
390
|
service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
|
|
377
391
|
publicApi: e.publicApi,
|
|
@@ -379,13 +393,13 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
379
393
|
requiresApproval: e.requiresApproval,
|
|
380
394
|
internal: e.internal,
|
|
381
395
|
overridesPlugin: e.overridesPlugin
|
|
382
|
-
}),
|
|
396
|
+
}), F = (e) => j({
|
|
383
397
|
kind: "action",
|
|
384
398
|
name: e.name,
|
|
385
399
|
input: e.input,
|
|
386
400
|
output: e.output,
|
|
387
|
-
error: e.error ??
|
|
388
|
-
guards:
|
|
401
|
+
error: e.error ?? h.Never,
|
|
402
|
+
guards: M(e.name, e.guards, e.openAccess, e.service),
|
|
389
403
|
openAccess: e.openAccess,
|
|
390
404
|
service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
|
|
391
405
|
source: e.source,
|
|
@@ -395,54 +409,85 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
395
409
|
requiresApproval: e.requiresApproval,
|
|
396
410
|
internal: e.internal,
|
|
397
411
|
overridesPlugin: e.overridesPlugin
|
|
398
|
-
}),
|
|
412
|
+
}), Sn = (e) => j({
|
|
399
413
|
kind: "stream",
|
|
400
414
|
name: e.name,
|
|
401
415
|
input: e.input,
|
|
402
416
|
element: e.element,
|
|
403
|
-
error: e.error ??
|
|
417
|
+
error: e.error ?? h.Never,
|
|
404
418
|
internal: e.internal,
|
|
405
419
|
overridesPlugin: e.overridesPlugin,
|
|
406
|
-
guards:
|
|
420
|
+
guards: M(e.name, e.guards, e.openAccess),
|
|
407
421
|
openAccess: e.openAccess
|
|
408
|
-
}),
|
|
409
|
-
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);
|
|
410
424
|
if (t === "stream" || t === "query") return n;
|
|
411
|
-
let r = t === "mutation" ?
|
|
412
|
-
return
|
|
413
|
-
},
|
|
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) => ({
|
|
414
446
|
...e,
|
|
415
447
|
name: t
|
|
416
|
-
}),
|
|
417
|
-
payload:
|
|
418
|
-
success:
|
|
419
|
-
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),
|
|
420
452
|
stream: !0
|
|
421
|
-
}),
|
|
422
|
-
payload:
|
|
453
|
+
}), Pn = (e, t) => g.make(e.name, {
|
|
454
|
+
payload: x(e.input, e.name, I(e.guards)),
|
|
423
455
|
success: e.output,
|
|
424
|
-
error:
|
|
425
|
-
}),
|
|
426
|
-
payload:
|
|
456
|
+
error: L(e, "mutation", t)
|
|
457
|
+
}), Fn = (e, t) => g.make(e.name, {
|
|
458
|
+
payload: x(e.input, e.name, I(e.guards)),
|
|
427
459
|
success: e.output,
|
|
428
|
-
error:
|
|
429
|
-
}),
|
|
430
|
-
payload:
|
|
460
|
+
error: L(e, "action", t)
|
|
461
|
+
}), In = (e, t) => g.make(e.name, {
|
|
462
|
+
payload: x(e.input, e.name, I(e.guards)),
|
|
431
463
|
success: e.element,
|
|
432
|
-
error:
|
|
464
|
+
error: L(e, "stream", t),
|
|
433
465
|
stream: !0
|
|
434
|
-
}),
|
|
466
|
+
}), R = (e) => {
|
|
435
467
|
if (typeof e != "object" || !e) return;
|
|
436
468
|
let t = e._tag;
|
|
437
469
|
return typeof t == "string" ? t : void 0;
|
|
438
|
-
},
|
|
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) => {
|
|
439
484
|
switch (e.kind) {
|
|
440
|
-
case "query": return
|
|
441
|
-
case "mutation": return
|
|
442
|
-
case "action": return
|
|
443
|
-
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);
|
|
444
489
|
}
|
|
445
|
-
},
|
|
490
|
+
}, Bn = (e) => {
|
|
446
491
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
447
492
|
if (e.kind === "query") return {
|
|
448
493
|
kind: "query",
|
|
@@ -488,7 +533,7 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
488
533
|
..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
|
|
489
534
|
}))
|
|
490
535
|
};
|
|
491
|
-
},
|
|
536
|
+
}, Vn = 7500, Hn = (e) => typeof e == "object" && !!e && e.kind === "event", Un = (e) => {
|
|
492
537
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
493
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
|
|
494
539
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -517,68 +562,68 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
517
562
|
name: e.name,
|
|
518
563
|
key: e.key,
|
|
519
564
|
payload: e.payload,
|
|
520
|
-
guards: e.openAccess === void 0 ? e.guards : [
|
|
565
|
+
guards: e.openAccess === void 0 ? e.guards : [r(e.openAccess.trim())],
|
|
521
566
|
openAccess: e.openAccess,
|
|
522
567
|
rewind: e.rewind,
|
|
523
568
|
webhook: e.webhook,
|
|
524
569
|
delivery: e.delivery
|
|
525
570
|
};
|
|
526
|
-
},
|
|
527
|
-
_tag:
|
|
528
|
-
origin:
|
|
529
|
-
n:
|
|
530
|
-
emittedAt:
|
|
571
|
+
}, Wn = (e) => h.Struct({
|
|
572
|
+
_tag: h.Literal("event"),
|
|
573
|
+
origin: h.String,
|
|
574
|
+
n: h.Number,
|
|
575
|
+
emittedAt: h.Number,
|
|
531
576
|
payload: e
|
|
532
|
-
}),
|
|
533
|
-
_tag:
|
|
534
|
-
missed:
|
|
535
|
-
reason:
|
|
536
|
-
}),
|
|
537
|
-
origin:
|
|
538
|
-
n:
|
|
539
|
-
}),
|
|
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({
|
|
540
585
|
key: e,
|
|
541
|
-
resume:
|
|
542
|
-
}),
|
|
543
|
-
let n = e.guards !== void 0 && e.guards.some((e) => !
|
|
544
|
-
return
|
|
545
|
-
payload:
|
|
546
|
-
success:
|
|
547
|
-
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,
|
|
548
593
|
stream: !0
|
|
549
594
|
});
|
|
550
|
-
},
|
|
551
|
-
event:
|
|
552
|
-
message:
|
|
553
|
-
}) {},
|
|
554
|
-
event:
|
|
555
|
-
message:
|
|
556
|
-
}) {},
|
|
557
|
-
event:
|
|
558
|
-
bytes:
|
|
559
|
-
limit:
|
|
560
|
-
}) {},
|
|
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) => {
|
|
561
606
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
562
607
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
563
608
|
return JSON.stringify(t);
|
|
564
|
-
},
|
|
609
|
+
}, tr = "\0", nr = (e, t, n) => [
|
|
565
610
|
e ?? "~",
|
|
566
611
|
t,
|
|
567
|
-
|
|
568
|
-
].join("\0"),
|
|
612
|
+
er(n)
|
|
613
|
+
].join("\0"), rr = (e) => {
|
|
569
614
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
570
615
|
return {
|
|
571
616
|
tenantId: t === "~" ? null : t,
|
|
572
617
|
event: n,
|
|
573
618
|
key: r
|
|
574
619
|
};
|
|
575
|
-
},
|
|
620
|
+
}, ir = (e) => e.split("\0").join(" · "), z = Symbol.for("@voltro/protocol/workflow-access"), ar = {
|
|
576
621
|
guards: void 0,
|
|
577
622
|
openAccess: void 0,
|
|
578
623
|
internal: !1,
|
|
579
624
|
controls: void 0,
|
|
580
625
|
controlsOpenAccess: void 0
|
|
581
|
-
},
|
|
626
|
+
}, or = (e, t) => {
|
|
582
627
|
let n = t.guards;
|
|
583
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
|
|
584
629
|
and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
|
|
@@ -593,34 +638,34 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
593
638
|
\`openAccess\` (an internal workflow needs no wire decision), or drop
|
|
594
639
|
\`internal: true\` if the workflow really is meant to be startable by clients.`);
|
|
595
640
|
}
|
|
596
|
-
let
|
|
597
|
-
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
|
|
598
643
|
\`controls\` (wire control is then refused for everyone but \`admin:full\`), or
|
|
599
644
|
list the scopes a caller needs to cancel or signal a run.`);
|
|
600
|
-
if (
|
|
601
|
-
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
|
|
602
647
|
run should be able to cancel or signal it — e.g. \`controls: { openAccess:
|
|
603
648
|
'the run belongs to the caller who started it; cancelling it affects nobody else' }\`.`);
|
|
604
|
-
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.`);
|
|
605
650
|
}
|
|
606
651
|
return {
|
|
607
|
-
guards: t.openAccess === void 0 ? t.guards : [
|
|
652
|
+
guards: t.openAccess === void 0 ? t.guards : [r(t.openAccess.trim())],
|
|
608
653
|
openAccess: t.openAccess?.trim(),
|
|
609
654
|
internal: t.internal === !0,
|
|
610
|
-
controls:
|
|
611
|
-
controlsOpenAccess:
|
|
655
|
+
controls: a === void 0 ? i : [r(a.trim())],
|
|
656
|
+
controlsOpenAccess: a?.trim()
|
|
612
657
|
};
|
|
613
|
-
},
|
|
614
|
-
Object.defineProperty(e,
|
|
658
|
+
}, sr = (e, t) => {
|
|
659
|
+
Object.defineProperty(e, z, {
|
|
615
660
|
value: t,
|
|
616
661
|
enumerable: !1
|
|
617
662
|
});
|
|
618
|
-
},
|
|
619
|
-
if (typeof e != "object" || !e) return
|
|
620
|
-
let t = e[
|
|
621
|
-
return t === void 0 ?
|
|
622
|
-
},
|
|
623
|
-
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);
|
|
624
669
|
return {
|
|
625
670
|
name: e.name,
|
|
626
671
|
internal: t.internal,
|
|
@@ -628,25 +673,25 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
628
673
|
openAccess: t.openAccess,
|
|
629
674
|
controls: t.controls
|
|
630
675
|
};
|
|
631
|
-
},
|
|
632
|
-
api:
|
|
633
|
-
tag:
|
|
634
|
-
reason:
|
|
635
|
-
message:
|
|
636
|
-
}) {},
|
|
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) => {
|
|
637
682
|
let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
|
|
638
683
|
return n !== void 0 && n !== "" ? `${r}#${n}` : r;
|
|
639
|
-
},
|
|
684
|
+
}, mr = (e) => {
|
|
640
685
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
641
|
-
},
|
|
642
|
-
let n =
|
|
686
|
+
}, hr = (e, t) => {
|
|
687
|
+
let n = Tt.GenericTag(e);
|
|
643
688
|
return {
|
|
644
689
|
Tag: n,
|
|
645
|
-
Live:
|
|
690
|
+
Live: Ot.succeed(n, t)
|
|
646
691
|
};
|
|
647
|
-
},
|
|
692
|
+
}, gr = (e, t, n) => {
|
|
648
693
|
if (!t) return { ok: !0 };
|
|
649
|
-
let r = n === void 0 ? null :
|
|
694
|
+
let r = n === void 0 ? null : V(n);
|
|
650
695
|
if (!r) return {
|
|
651
696
|
ok: !0,
|
|
652
697
|
unverified: `plugin "${e}" requires framework ${t}, but the running framework version is ${n === void 0 ? "unknown" : `unreadable ("${n}")`} — not checked.`
|
|
@@ -654,12 +699,12 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
654
699
|
let i = t.trim();
|
|
655
700
|
if (i === "*" || i === "") return { ok: !0 };
|
|
656
701
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
657
|
-
for (let i of a) if (!
|
|
702
|
+
for (let i of a) if (!_r(i, r)) return {
|
|
658
703
|
ok: !1,
|
|
659
704
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
660
705
|
};
|
|
661
706
|
return { ok: !0 };
|
|
662
|
-
},
|
|
707
|
+
}, V = (e) => {
|
|
663
708
|
let t = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9a-zA-Z.-]+))?$/.exec(e.trim());
|
|
664
709
|
return t ? {
|
|
665
710
|
major: Number(t[1]),
|
|
@@ -667,109 +712,109 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
667
712
|
patch: Number(t[3]),
|
|
668
713
|
pre: t[4] ?? ""
|
|
669
714
|
} : null;
|
|
670
|
-
},
|
|
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) => {
|
|
671
716
|
if (e === "*") return !0;
|
|
672
717
|
if (e.startsWith("^")) {
|
|
673
|
-
let n =
|
|
674
|
-
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;
|
|
675
720
|
}
|
|
676
721
|
if (e.startsWith("~")) {
|
|
677
|
-
let n =
|
|
678
|
-
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;
|
|
679
724
|
}
|
|
680
725
|
let n = /^(>=|<=|>|<)(.+)$/.exec(e);
|
|
681
726
|
if (n) {
|
|
682
|
-
let e = n[1], r =
|
|
727
|
+
let e = n[1], r = V(n[2]);
|
|
683
728
|
if (!r) return !1;
|
|
684
|
-
let i =
|
|
729
|
+
let i = H(t, r);
|
|
685
730
|
if (e === ">=") return i >= 0;
|
|
686
731
|
if (e === "<=") return i <= 0;
|
|
687
732
|
if (e === ">") return i > 0;
|
|
688
733
|
if (e === "<") return i < 0;
|
|
689
734
|
}
|
|
690
|
-
let r =
|
|
691
|
-
return r ?
|
|
692
|
-
},
|
|
735
|
+
let r = V(e);
|
|
736
|
+
return r ? H(t, r) === 0 : !1;
|
|
737
|
+
}, vr = (e) => {
|
|
693
738
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
694
739
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
|
|
695
|
-
},
|
|
740
|
+
}, yr = (e) => {
|
|
696
741
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
697
742
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
698
|
-
},
|
|
699
|
-
let e = globalThis, t = e[
|
|
743
|
+
}, br = Symbol.for("@voltro/protocol/pluginAliases"), U = () => {
|
|
744
|
+
let e = globalThis, t = e[br];
|
|
700
745
|
if (t instanceof Map) return t;
|
|
701
746
|
let n = /* @__PURE__ */ new Map();
|
|
702
|
-
return e[
|
|
703
|
-
},
|
|
704
|
-
let t =
|
|
747
|
+
return e[br] = n, n;
|
|
748
|
+
}, xr = (e) => {
|
|
749
|
+
let t = U();
|
|
705
750
|
for (let [n, r] of Object.entries(e)) {
|
|
706
751
|
if (r === "") continue;
|
|
707
752
|
let e = t.get(n);
|
|
708
753
|
e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
|
|
709
754
|
}
|
|
710
|
-
},
|
|
711
|
-
|
|
712
|
-
},
|
|
713
|
-
let n =
|
|
714
|
-
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}`;
|
|
715
760
|
if (n.size === 1) return `${[...n][0]}.${t}`;
|
|
716
761
|
let r = [...n].filter((e) => !e.includes("#"));
|
|
717
762
|
if (r.length === 1) return `${r[0]}.${t}`;
|
|
718
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}').`);
|
|
719
|
-
},
|
|
720
|
-
kind:
|
|
721
|
-
at:
|
|
722
|
-
retryAfterMs:
|
|
723
|
-
}),
|
|
724
|
-
kind:
|
|
725
|
-
at:
|
|
726
|
-
executionId:
|
|
727
|
-
runId:
|
|
728
|
-
}),
|
|
729
|
-
kind:
|
|
730
|
-
at:
|
|
731
|
-
}),
|
|
732
|
-
kind:
|
|
733
|
-
at:
|
|
734
|
-
}),
|
|
735
|
-
kind:
|
|
736
|
-
at:
|
|
737
|
-
failureId:
|
|
738
|
-
})),
|
|
739
|
-
id:
|
|
740
|
-
workflowName:
|
|
741
|
-
executionId:
|
|
742
|
-
status:
|
|
743
|
-
output:
|
|
744
|
-
error:
|
|
745
|
-
tag:
|
|
746
|
-
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
|
|
747
792
|
}))
|
|
748
|
-
}),
|
|
749
|
-
operation:
|
|
750
|
-
kind:
|
|
751
|
-
requestId:
|
|
752
|
-
snapshot:
|
|
753
|
-
}).pipe(
|
|
754
|
-
operation:
|
|
755
|
-
workflowName:
|
|
756
|
-
receiptId:
|
|
757
|
-
requestId:
|
|
758
|
-
kind:
|
|
759
|
-
observation:
|
|
760
|
-
kind:
|
|
761
|
-
outcome:
|
|
762
|
-
kind:
|
|
763
|
-
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
|
|
764
809
|
}))
|
|
765
|
-
}),
|
|
766
|
-
kind:
|
|
767
|
-
snapshot:
|
|
768
|
-
}),
|
|
769
|
-
kind:
|
|
770
|
-
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")
|
|
771
816
|
}))
|
|
772
|
-
}).pipe(
|
|
817
|
+
}).pipe(h.filter((e) => {
|
|
773
818
|
let t = e.observation;
|
|
774
819
|
if (t.kind === "unavailable") return e.kind === "unknown" && (t.reason === "missing-request" ? e.requestId === null : e.requestId !== null);
|
|
775
820
|
if (e.requestId === null) return !1;
|
|
@@ -777,307 +822,342 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
777
822
|
if (t.kind === "admission") return e.kind === (t.outcome.kind === "cancelled" ? "confirmed" : "already-terminal");
|
|
778
823
|
let n = t.snapshot;
|
|
779
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");
|
|
780
|
-
}, { message: () => "Queued cancellation acknowledgement contradicts its receipt or observation" })),
|
|
781
|
-
mode:
|
|
782
|
-
dueAt:
|
|
783
|
-
retryAfterMs:
|
|
784
|
-
intentId:
|
|
785
|
-
}),
|
|
786
|
-
id:
|
|
787
|
-
workflowName:
|
|
788
|
-
executionId:
|
|
789
|
-
status:
|
|
790
|
-
deferral:
|
|
791
|
-
}),
|
|
792
|
-
let n =
|
|
793
|
-
return
|
|
794
|
-
payload:
|
|
795
|
-
success:
|
|
796
|
-
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({
|
|
797
842
|
errorSchema: e.errorSchema,
|
|
798
843
|
guards: n.guards
|
|
799
844
|
}, t)
|
|
800
845
|
});
|
|
801
|
-
},
|
|
802
|
-
id:
|
|
803
|
-
tag:
|
|
804
|
-
executionId:
|
|
805
|
-
status:
|
|
806
|
-
payload:
|
|
807
|
-
workflowVersion:
|
|
808
|
-
workflowPatches:
|
|
809
|
-
output:
|
|
810
|
-
subject:
|
|
811
|
-
source:
|
|
812
|
-
errorTag:
|
|
813
|
-
errorMessage:
|
|
814
|
-
cancelled:
|
|
815
|
-
startedAt:
|
|
816
|
-
completedAt:
|
|
817
|
-
durationMs:
|
|
818
|
-
traceId:
|
|
819
|
-
parentExecutionId:
|
|
820
|
-
parentClosePolicy:
|
|
821
|
-
}),
|
|
822
|
-
tag:
|
|
823
|
-
status:
|
|
824
|
-
limit:
|
|
825
|
-
}),
|
|
826
|
-
id:
|
|
827
|
-
runId:
|
|
828
|
-
stepName:
|
|
829
|
-
attempt:
|
|
830
|
-
status:
|
|
831
|
-
input:
|
|
832
|
-
retryPolicy:
|
|
833
|
-
output:
|
|
834
|
-
errorTag:
|
|
835
|
-
errorMessage:
|
|
836
|
-
errorCause:
|
|
837
|
-
startedAt:
|
|
838
|
-
completedAt:
|
|
839
|
-
durationMs:
|
|
840
|
-
}),
|
|
841
|
-
id:
|
|
842
|
-
runId:
|
|
843
|
-
eventType:
|
|
844
|
-
payload:
|
|
845
|
-
occurredAt:
|
|
846
|
-
stepName:
|
|
847
|
-
attempt:
|
|
848
|
-
}),
|
|
849
|
-
id:
|
|
850
|
-
name:
|
|
851
|
-
payload:
|
|
852
|
-
source:
|
|
853
|
-
subject:
|
|
854
|
-
traceId:
|
|
855
|
-
occurredAt:
|
|
856
|
-
}),
|
|
857
|
-
id:
|
|
858
|
-
eventId:
|
|
859
|
-
eventName:
|
|
860
|
-
triggerId:
|
|
861
|
-
workflowName:
|
|
862
|
-
executionId:
|
|
863
|
-
status:
|
|
864
|
-
idempotencyKey:
|
|
865
|
-
skipped:
|
|
866
|
-
errorMessage:
|
|
867
|
-
createdAt:
|
|
868
|
-
completedAt:
|
|
869
|
-
}),
|
|
870
|
-
name:
|
|
871
|
-
limit:
|
|
872
|
-
}),
|
|
873
|
-
requestId:
|
|
874
|
-
cause:
|
|
875
|
-
reason:
|
|
876
|
-
detail:
|
|
877
|
-
key:
|
|
878
|
-
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
|
|
879
924
|
}))
|
|
880
925
|
}), { exact: !0 })
|
|
881
|
-
}),
|
|
882
|
-
workflowName:
|
|
883
|
-
executionId:
|
|
884
|
-
control:
|
|
885
|
-
}),
|
|
886
|
-
workflowName:
|
|
887
|
-
executionId:
|
|
888
|
-
operation:
|
|
889
|
-
requestId:
|
|
890
|
-
}),
|
|
891
|
-
workflowName:
|
|
892
|
-
receiptId:
|
|
893
|
-
requestId:
|
|
894
|
-
}),
|
|
895
|
-
...
|
|
896
|
-
cause:
|
|
897
|
-
}),
|
|
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({
|
|
898
943
|
name: "__voltro.workflow.queued.cancel",
|
|
899
|
-
input:
|
|
900
|
-
output:
|
|
944
|
+
input: Ur,
|
|
945
|
+
output: wr,
|
|
901
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"
|
|
902
|
-
}),
|
|
947
|
+
}), Gr = N({
|
|
903
948
|
name: "__voltro.workflow.queued.control",
|
|
904
|
-
input:
|
|
905
|
-
output:
|
|
949
|
+
input: Hr,
|
|
950
|
+
output: wr,
|
|
906
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"
|
|
907
|
-
}),
|
|
952
|
+
}), Kr = N({
|
|
908
953
|
name: "__voltro.workflow.control",
|
|
909
|
-
input:
|
|
910
|
-
output:
|
|
954
|
+
input: Vr,
|
|
955
|
+
output: q,
|
|
911
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"
|
|
912
|
-
}),
|
|
913
|
-
id:
|
|
914
|
-
signalName:
|
|
915
|
-
payload:
|
|
916
|
-
}),
|
|
917
|
-
id:
|
|
918
|
-
updateName:
|
|
919
|
-
payload:
|
|
920
|
-
timeoutMs:
|
|
921
|
-
}),
|
|
922
|
-
eventId:
|
|
923
|
-
updateId:
|
|
924
|
-
completedEventId:
|
|
925
|
-
result:
|
|
926
|
-
}),
|
|
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({
|
|
927
972
|
name: "__voltro.workflow.run",
|
|
928
973
|
source: "_voltro_workflow_runs",
|
|
929
|
-
input:
|
|
930
|
-
output:
|
|
974
|
+
input: Fr,
|
|
975
|
+
output: h.Array(kr),
|
|
931
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"
|
|
932
|
-
}),
|
|
977
|
+
}), Zr = N({
|
|
933
978
|
name: "__voltro.workflow.runs",
|
|
934
979
|
source: "_voltro_workflow_runs",
|
|
935
|
-
input:
|
|
936
|
-
output:
|
|
980
|
+
input: Ar,
|
|
981
|
+
output: h.Array(kr),
|
|
937
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"
|
|
938
|
-
}),
|
|
983
|
+
}), Qr = N({
|
|
939
984
|
name: "__voltro.workflow.run.steps",
|
|
940
985
|
source: "_voltro_workflow_run_steps",
|
|
941
|
-
input:
|
|
942
|
-
output:
|
|
986
|
+
input: Ir,
|
|
987
|
+
output: h.Array(jr),
|
|
943
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"
|
|
944
|
-
}),
|
|
989
|
+
}), $r = N({
|
|
945
990
|
name: "__voltro.workflow.run.events",
|
|
946
991
|
source: "_voltro_workflow_run_events",
|
|
947
|
-
input:
|
|
948
|
-
output:
|
|
992
|
+
input: Ir,
|
|
993
|
+
output: h.Array(Mr),
|
|
949
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"
|
|
950
|
-
}),
|
|
995
|
+
}), ei = N({
|
|
951
996
|
name: "__voltro.workflow.domainEvents",
|
|
952
997
|
source: "_voltro_workflow_events",
|
|
953
|
-
input:
|
|
954
|
-
output:
|
|
998
|
+
input: Lr,
|
|
999
|
+
output: h.Array(Nr),
|
|
955
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"
|
|
956
|
-
}),
|
|
1001
|
+
}), ti = N({
|
|
957
1002
|
name: "__voltro.workflow.event.deliveries",
|
|
958
1003
|
source: "_voltro_workflow_event_deliveries",
|
|
959
|
-
input:
|
|
960
|
-
output:
|
|
1004
|
+
input: Rr,
|
|
1005
|
+
output: h.Array(Pr),
|
|
961
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"
|
|
962
|
-
}),
|
|
1007
|
+
}), ni = F({
|
|
963
1008
|
name: "__voltro.workflow.cancel",
|
|
964
|
-
input:
|
|
965
|
-
output:
|
|
1009
|
+
input: Br,
|
|
1010
|
+
output: q,
|
|
966
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"
|
|
967
|
-
}),
|
|
1012
|
+
}), ri = F({
|
|
968
1013
|
name: "__voltro.workflow.resume",
|
|
969
|
-
input:
|
|
970
|
-
output:
|
|
1014
|
+
input: Br,
|
|
1015
|
+
output: q,
|
|
971
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"
|
|
972
|
-
}),
|
|
1017
|
+
}), ii = F({
|
|
973
1018
|
name: "__voltro.workflow.signal",
|
|
974
|
-
input:
|
|
975
|
-
output:
|
|
1019
|
+
input: qr,
|
|
1020
|
+
output: h.Struct({ eventId: h.String }),
|
|
976
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"
|
|
977
|
-
}),
|
|
1022
|
+
}), ai = F({
|
|
978
1023
|
name: "__voltro.workflow.update",
|
|
979
|
-
input:
|
|
980
|
-
output:
|
|
1024
|
+
input: Jr,
|
|
1025
|
+
output: Yr,
|
|
981
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"
|
|
982
|
-
}),
|
|
983
|
-
runId:
|
|
984
|
-
requestId:
|
|
985
|
-
}),
|
|
986
|
-
...
|
|
987
|
-
payloadOverride:
|
|
988
|
-
}),
|
|
989
|
-
requestId:
|
|
990
|
-
originalRunId:
|
|
991
|
-
originalExecutionId:
|
|
992
|
-
workflowName:
|
|
993
|
-
},
|
|
994
|
-
...
|
|
995
|
-
kind:
|
|
996
|
-
nextAttemptAt:
|
|
997
|
-
}),
|
|
998
|
-
...
|
|
999
|
-
kind:
|
|
1000
|
-
executionId:
|
|
1001
|
-
}).pipe(
|
|
1002
|
-
...
|
|
1003
|
-
kind:
|
|
1004
|
-
automaticRetryStopped:
|
|
1005
|
-
nextAttemptAt:
|
|
1006
|
-
}).pipe(
|
|
1007
|
-
...
|
|
1008
|
-
kind:
|
|
1009
|
-
outcome:
|
|
1010
|
-
}),
|
|
1011
|
-
...
|
|
1012
|
-
kind:
|
|
1013
|
-
failureId:
|
|
1014
|
-
})),
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
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,
|
|
1026
1106
|
source: "_voltro_undo_log",
|
|
1027
|
-
input:
|
|
1028
|
-
output:
|
|
1107
|
+
input: h.Struct({ limit: h.optional(h.Number) }),
|
|
1108
|
+
output: h.Array(vi),
|
|
1029
1109
|
openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
|
|
1030
|
-
}),
|
|
1031
|
-
name:
|
|
1032
|
-
input:
|
|
1033
|
-
output:
|
|
1034
|
-
error:
|
|
1110
|
+
}), wi = P({
|
|
1111
|
+
name: gi,
|
|
1112
|
+
input: h.Struct({ invocationId: h.String }),
|
|
1113
|
+
output: h.Struct({ ok: h.Boolean }),
|
|
1114
|
+
error: Si,
|
|
1035
1115
|
openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
1036
|
-
}),
|
|
1037
|
-
name:
|
|
1038
|
-
input:
|
|
1039
|
-
output:
|
|
1040
|
-
error:
|
|
1116
|
+
}), Ti = P({
|
|
1117
|
+
name: _i,
|
|
1118
|
+
input: h.Struct({ invocationId: h.String }),
|
|
1119
|
+
output: h.Struct({ ok: h.Boolean }),
|
|
1120
|
+
error: Si,
|
|
1041
1121
|
openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
1042
|
-
}),
|
|
1043
|
-
table:
|
|
1044
|
-
reason:
|
|
1045
|
-
}) {},
|
|
1046
|
-
operation:
|
|
1047
|
-
table:
|
|
1048
|
-
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
|
|
1049
1129
|
}) {
|
|
1050
1130
|
get message() {
|
|
1051
1131
|
return `${this.operation} on '${this.table}' failed: ${this.cause}`;
|
|
1052
1132
|
}
|
|
1053
|
-
},
|
|
1054
|
-
table:
|
|
1055
|
-
found:
|
|
1133
|
+
}, Oi = class extends h.TaggedError()("NoRowFound", {
|
|
1134
|
+
table: h.String,
|
|
1135
|
+
found: h.Number
|
|
1056
1136
|
}) {
|
|
1057
1137
|
get message() {
|
|
1058
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`;
|
|
1059
1139
|
}
|
|
1060
|
-
},
|
|
1061
|
-
table:
|
|
1062
|
-
summary:
|
|
1063
|
-
issues:
|
|
1064
|
-
path:
|
|
1065
|
-
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
|
|
1066
1146
|
}))
|
|
1067
|
-
}) {},
|
|
1068
|
-
table:
|
|
1069
|
-
id:
|
|
1070
|
-
reason:
|
|
1071
|
-
}) {},
|
|
1072
|
-
table:
|
|
1073
|
-
columns:
|
|
1074
|
-
}) {},
|
|
1075
|
-
kind:
|
|
1076
|
-
table:
|
|
1077
|
-
operation:
|
|
1078
|
-
constraint:
|
|
1079
|
-
column:
|
|
1080
|
-
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)
|
|
1081
1161
|
}) {
|
|
1082
1162
|
get message() {
|
|
1083
1163
|
if (this.detail !== void 0) return this.detail;
|
|
@@ -1090,86 +1170,243 @@ var wt = m.Union(m.String, m.Number), Tt = m.Record({
|
|
|
1090
1170
|
case "check": return `check constraint ${t}: the row does not satisfy it`;
|
|
1091
1171
|
}
|
|
1092
1172
|
}
|
|
1093
|
-
},
|
|
1094
|
-
name:
|
|
1173
|
+
}, Ni = "__voltro.approvals.pending", Pi = "__voltro.approvals.decide", Fi = N({
|
|
1174
|
+
name: Ni,
|
|
1095
1175
|
source: "_voltro_approvals",
|
|
1096
|
-
input:
|
|
1097
|
-
output:
|
|
1176
|
+
input: h.Struct({ limit: h.optional(h.Number) }),
|
|
1177
|
+
output: h.Array(en),
|
|
1098
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"
|
|
1099
|
-
}),
|
|
1100
|
-
name:
|
|
1101
|
-
input:
|
|
1102
|
-
approvalId:
|
|
1103
|
-
decision:
|
|
1104
|
-
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)
|
|
1105
1185
|
}),
|
|
1106
|
-
output:
|
|
1107
|
-
approvalId:
|
|
1108
|
-
status:
|
|
1186
|
+
output: h.Struct({
|
|
1187
|
+
approvalId: h.String,
|
|
1188
|
+
status: h.Literal("approved", "rejected")
|
|
1109
1189
|
}),
|
|
1110
|
-
error:
|
|
1190
|
+
error: $t,
|
|
1111
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"
|
|
1112
|
-
}),
|
|
1113
|
-
connectionId:
|
|
1114
|
-
kind:
|
|
1115
|
-
label:
|
|
1116
|
-
status:
|
|
1117
|
-
accountId:
|
|
1118
|
-
accountLabel:
|
|
1119
|
-
scopes:
|
|
1120
|
-
expiresAt:
|
|
1121
|
-
lastError:
|
|
1122
|
-
connectedAt:
|
|
1123
|
-
}),
|
|
1124
|
-
connectionId:
|
|
1125
|
-
expected:
|
|
1126
|
-
actual:
|
|
1127
|
-
}) {},
|
|
1128
|
-
connectionId:
|
|
1129
|
-
reason:
|
|
1130
|
-
transient:
|
|
1131
|
-
}) {},
|
|
1132
|
-
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,
|
|
1133
1213
|
source: "_voltro_connections",
|
|
1134
|
-
input:
|
|
1135
|
-
output:
|
|
1214
|
+
input: h.Struct({}),
|
|
1215
|
+
output: h.Array(Hi),
|
|
1136
1216
|
openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
|
|
1137
|
-
}),
|
|
1138
|
-
name:
|
|
1139
|
-
input:
|
|
1140
|
-
connectionId:
|
|
1141
|
-
redirectTo:
|
|
1217
|
+
}), Yi = F({
|
|
1218
|
+
name: Ri,
|
|
1219
|
+
input: h.Struct({
|
|
1220
|
+
connectionId: h.String,
|
|
1221
|
+
redirectTo: h.optional(h.String)
|
|
1142
1222
|
}),
|
|
1143
|
-
output:
|
|
1144
|
-
authorizeUrl:
|
|
1145
|
-
state:
|
|
1223
|
+
output: h.Struct({
|
|
1224
|
+
authorizeUrl: h.String,
|
|
1225
|
+
state: h.String
|
|
1146
1226
|
}),
|
|
1147
|
-
error:
|
|
1227
|
+
error: qi,
|
|
1148
1228
|
openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
1149
|
-
}),
|
|
1150
|
-
name:
|
|
1151
|
-
input:
|
|
1152
|
-
connectionId:
|
|
1153
|
-
token:
|
|
1229
|
+
}), Xi = P({
|
|
1230
|
+
name: zi,
|
|
1231
|
+
input: h.Struct({
|
|
1232
|
+
connectionId: h.String,
|
|
1233
|
+
token: h.String
|
|
1154
1234
|
}),
|
|
1155
|
-
output:
|
|
1156
|
-
error:
|
|
1235
|
+
output: h.Struct({ ok: h.Boolean }),
|
|
1236
|
+
error: qi,
|
|
1157
1237
|
openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
1158
|
-
}),
|
|
1159
|
-
name:
|
|
1160
|
-
input:
|
|
1161
|
-
output:
|
|
1162
|
-
error:
|
|
1238
|
+
}), Zi = P({
|
|
1239
|
+
name: Bi,
|
|
1240
|
+
input: h.Struct({ connectionId: h.String }),
|
|
1241
|
+
output: h.Struct({ ok: h.Boolean }),
|
|
1242
|
+
error: qi,
|
|
1163
1243
|
openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
|
|
1164
|
-
}),
|
|
1244
|
+
}), Qi = (e) => {
|
|
1165
1245
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
1166
1246
|
return Number.isNaN(t) ? 0 : t;
|
|
1167
|
-
},
|
|
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) => {
|
|
1168
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`);
|
|
1169
1335
|
if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
|
|
1170
|
-
if (
|
|
1336
|
+
if (aa.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
|
|
1171
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)}'`);
|
|
1172
1338
|
return e;
|
|
1173
|
-
},
|
|
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;
|
|
1174
1411
|
//#endregion
|
|
1175
|
-
export { Be as ADMIN_SCOPE,
|
|
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 };
|