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