@voltro/protocol 0.52.0 → 0.53.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 +229 -0
- package/dist/index.d.ts +161 -2
- package/dist/index.js +526 -428
- package/dist/rest.d.ts +20 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,165 +1,263 @@
|
|
|
1
|
-
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as
|
|
2
|
-
import { a as
|
|
3
|
-
import { Context as
|
|
4
|
-
import { Rpc as
|
|
1
|
+
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, L as ee, M as te, N as l, O as ne, P as re, R as ie, S as ae, T as oe, U as se, V as ce, W as le, _ as ue, a as u, b as de, c as fe, d as pe, f as me, g as he, h as d, i as ge, j as _e, k as ve, l as ye, m as be, n as xe, o as Se, p as Ce, r as we, s as Te, t as Ee, u as De, v as f, w as Oe, x as ke, y as Ae, z as je } from "./scopes-B0kGvAnI.js";
|
|
2
|
+
import { a as Me, c as Ne, i as Pe, n as Fe, o as Ie, r as Le, s as Re, t as ze } from "./serverErrorBus-BeN9pOpY.js";
|
|
3
|
+
import { Context as Be, Layer as Ve, Schema as p } from "effect";
|
|
4
|
+
import { Rpc as m } from "@effect/rpc";
|
|
5
5
|
//#region src/rowPatch.ts
|
|
6
|
-
var
|
|
7
|
-
key:
|
|
8
|
-
value:
|
|
9
|
-
}).pipe(
|
|
10
|
-
op:
|
|
11
|
-
path:
|
|
12
|
-
value:
|
|
13
|
-
}),
|
|
14
|
-
op:
|
|
15
|
-
path:
|
|
16
|
-
value:
|
|
17
|
-
}),
|
|
18
|
-
op:
|
|
19
|
-
path:
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
var He = p.Union(p.String, p.Number), Ue = p.Record({
|
|
7
|
+
key: p.String,
|
|
8
|
+
value: p.Unknown
|
|
9
|
+
}).pipe(p.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), We = p.Union(p.Struct({
|
|
10
|
+
op: p.Literal("add"),
|
|
11
|
+
path: p.String,
|
|
12
|
+
value: Ue
|
|
13
|
+
}), p.Struct({
|
|
14
|
+
op: p.Literal("replace"),
|
|
15
|
+
path: p.String,
|
|
16
|
+
value: Ue
|
|
17
|
+
}), p.Struct({
|
|
18
|
+
op: p.Literal("remove"),
|
|
19
|
+
path: p.String
|
|
20
|
+
}), p.Struct({
|
|
21
|
+
op: p.Literal("mergeCells"),
|
|
22
|
+
path: p.String,
|
|
23
|
+
value: p.Record({
|
|
24
|
+
key: p.String,
|
|
25
|
+
value: p.Unknown
|
|
26
|
+
})
|
|
27
|
+
})), Ge = p.Struct({
|
|
28
|
+
ops: p.Array(We),
|
|
29
|
+
order: p.Array(He)
|
|
30
|
+
}), h = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, Ke = (e) => (e.startsWith("/") ? e.slice(1) : e).replace(/~1/g, "/").replace(/~0/g, "~"), g = (e) => {
|
|
24
31
|
let t = Object.keys(e).sort(), n = {};
|
|
25
32
|
for (let r of t) n[r] = e[r];
|
|
26
33
|
return JSON.stringify(n);
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
}, qe = (e, t) => g(e) === g(t), Je = (e, t) => {
|
|
35
|
+
if (e instanceof Uint8Array && t instanceof Uint8Array) {
|
|
36
|
+
if (e.length !== t.length) return !1;
|
|
37
|
+
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
38
|
+
return !0;
|
|
39
|
+
}
|
|
40
|
+
return g({
|
|
41
|
+
id: 0,
|
|
42
|
+
v: e
|
|
43
|
+
}) === g({
|
|
44
|
+
id: 0,
|
|
45
|
+
v: t
|
|
46
|
+
});
|
|
47
|
+
}, Ye = (e, t, n = {}) => {
|
|
48
|
+
let r = /* @__PURE__ */ new Map();
|
|
49
|
+
for (let t of e) r.set(t.id, t);
|
|
50
|
+
let i = [], a = [], o = /* @__PURE__ */ new Set(), s = n.crdt, c = (e, t) => {
|
|
51
|
+
if (s === void 0 || s.columns.size === 0) return;
|
|
52
|
+
let n = {}, r = !1;
|
|
53
|
+
for (let i of s.columns) {
|
|
54
|
+
if (!(i in t) || Je(e[i], t[i])) continue;
|
|
55
|
+
let a = s.incremental(i, e[i], t[i]);
|
|
56
|
+
if (a === void 0) return;
|
|
57
|
+
n[i] = a, r = !0;
|
|
58
|
+
}
|
|
59
|
+
if (!r) return;
|
|
60
|
+
let i = {};
|
|
61
|
+
for (let [e, n] of Object.entries(t)) s.columns.has(e) || (i[e] = n);
|
|
62
|
+
return {
|
|
63
|
+
scalars: i,
|
|
64
|
+
merges: n
|
|
65
|
+
};
|
|
66
|
+
};
|
|
31
67
|
for (let e of t) {
|
|
32
|
-
|
|
33
|
-
let t =
|
|
34
|
-
t === void 0
|
|
68
|
+
a.push(e.id), o.add(e.id);
|
|
69
|
+
let t = r.get(e.id);
|
|
70
|
+
if (t === void 0) i.push({
|
|
35
71
|
op: "add",
|
|
36
|
-
path:
|
|
37
|
-
value: e
|
|
38
|
-
}) : Ke(t, e) || r.push({
|
|
39
|
-
op: "replace",
|
|
40
|
-
path: g(e.id),
|
|
72
|
+
path: h(e.id),
|
|
41
73
|
value: e
|
|
42
74
|
});
|
|
75
|
+
else if (!qe(t, e)) {
|
|
76
|
+
let n = c(t, e);
|
|
77
|
+
n === void 0 ? i.push({
|
|
78
|
+
op: "replace",
|
|
79
|
+
path: h(e.id),
|
|
80
|
+
value: e
|
|
81
|
+
}) : (qe(Object.fromEntries(Object.entries(t).filter(([e]) => !s.columns.has(e))), n.scalars) || i.push({
|
|
82
|
+
op: "replace",
|
|
83
|
+
path: h(e.id),
|
|
84
|
+
value: n.scalars
|
|
85
|
+
}), i.push({
|
|
86
|
+
op: "mergeCells",
|
|
87
|
+
path: h(e.id),
|
|
88
|
+
value: n.merges
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
43
91
|
}
|
|
44
|
-
for (let t of e)
|
|
92
|
+
for (let t of e) o.has(t.id) || i.push({
|
|
45
93
|
op: "remove",
|
|
46
|
-
path:
|
|
94
|
+
path: h(t.id)
|
|
47
95
|
});
|
|
48
96
|
return {
|
|
49
|
-
ops:
|
|
50
|
-
order:
|
|
97
|
+
ops: i,
|
|
98
|
+
order: a
|
|
51
99
|
};
|
|
52
|
-
},
|
|
100
|
+
}, Xe = (e) => e.every((e) => {
|
|
53
101
|
let t = e.id;
|
|
54
102
|
return typeof t == "string" || typeof t == "number";
|
|
55
|
-
}),
|
|
56
|
-
let
|
|
57
|
-
for (let t of e)
|
|
58
|
-
for (let e of t.ops)
|
|
59
|
-
|
|
103
|
+
}), Ze = (e, t, n = {}) => {
|
|
104
|
+
let r = /* @__PURE__ */ new Map();
|
|
105
|
+
for (let t of e) r.set(t.id, t);
|
|
106
|
+
for (let e of t.ops) {
|
|
107
|
+
if (e.op === "mergeCells") {
|
|
108
|
+
let t = Ke(e.path), i = r.get(t) ?? r.get(Number(t)), a = r.has(t) ? t : Number(t);
|
|
109
|
+
if (i === void 0) continue;
|
|
110
|
+
let o = { ...i };
|
|
111
|
+
for (let [t, r] of Object.entries(e.value)) o[t] = n.mergeCell === void 0 ? r : n.mergeCell(t, i[t], r);
|
|
112
|
+
r.set(a, o);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
(e.op === "add" || e.op === "replace") && r.set(e.value.id, e.value);
|
|
116
|
+
}
|
|
117
|
+
let i = [];
|
|
60
118
|
for (let e of t.order) {
|
|
61
|
-
let t =
|
|
62
|
-
t !== void 0 &&
|
|
119
|
+
let t = r.get(e);
|
|
120
|
+
t !== void 0 && i.push(t);
|
|
63
121
|
}
|
|
64
|
-
return
|
|
65
|
-
},
|
|
66
|
-
_tag:
|
|
67
|
-
revision:
|
|
122
|
+
return i;
|
|
123
|
+
}, Qe = (e) => p.Union(p.Struct({
|
|
124
|
+
_tag: p.Literal("snapshot"),
|
|
125
|
+
revision: p.Number,
|
|
68
126
|
data: e,
|
|
69
|
-
computed:
|
|
70
|
-
}),
|
|
71
|
-
_tag:
|
|
72
|
-
revision:
|
|
73
|
-
emittedAt:
|
|
74
|
-
patch:
|
|
75
|
-
}),
|
|
76
|
-
_tag:
|
|
77
|
-
error:
|
|
78
|
-
revision:
|
|
79
|
-
})),
|
|
127
|
+
computed: p.optional(p.Boolean)
|
|
128
|
+
}), p.Struct({
|
|
129
|
+
_tag: p.Literal("delta"),
|
|
130
|
+
revision: p.Number,
|
|
131
|
+
emittedAt: p.Number,
|
|
132
|
+
patch: Ge
|
|
133
|
+
}), p.Struct({
|
|
134
|
+
_tag: p.Literal("error"),
|
|
135
|
+
error: p.Unknown,
|
|
136
|
+
revision: p.optional(p.Number)
|
|
137
|
+
})), $e = (e, t) => {
|
|
80
138
|
let n = `${e ?? "this procedure"} input`;
|
|
81
139
|
return t === !0 ? `${n} (guarded — the guard did NOT run: the payload failed to decode first, so this says nothing about access)` : n;
|
|
82
|
-
},
|
|
140
|
+
}, et = (e) => {
|
|
83
141
|
let t = e.ast;
|
|
84
142
|
return t._tag === "TypeLiteral" && (t.propertySignatures?.length ?? 0) === 0 && (t.indexSignatures?.length ?? 0) === 0;
|
|
85
|
-
},
|
|
86
|
-
let r =
|
|
143
|
+
}, _ = (e, t, n) => {
|
|
144
|
+
let r = $e(t, n), i = e.annotations({
|
|
87
145
|
parseOptions: { onExcessProperty: "error" },
|
|
88
146
|
parseIssueTitle: () => r
|
|
89
147
|
});
|
|
90
|
-
return
|
|
91
|
-
},
|
|
92
|
-
rule:
|
|
93
|
-
params:
|
|
94
|
-
key:
|
|
95
|
-
value:
|
|
148
|
+
return et(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;
|
|
149
|
+
}, v = class extends p.TaggedError()("BusinessRuleViolation", {
|
|
150
|
+
rule: p.String,
|
|
151
|
+
params: p.optional(p.Record({
|
|
152
|
+
key: p.String,
|
|
153
|
+
value: p.Unknown
|
|
96
154
|
})),
|
|
97
|
-
field:
|
|
98
|
-
message:
|
|
99
|
-
severity:
|
|
100
|
-
}) {},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}) {},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
155
|
+
field: p.optional(p.String),
|
|
156
|
+
message: p.optional(p.String),
|
|
157
|
+
severity: p.Literal("error", "warning")
|
|
158
|
+
}) {}, y = p.Struct({
|
|
159
|
+
field: p.String,
|
|
160
|
+
message: p.String,
|
|
161
|
+
params: p.optional(p.Record({
|
|
162
|
+
key: p.String,
|
|
163
|
+
value: p.Unknown
|
|
164
|
+
}))
|
|
165
|
+
}), b = class extends p.TaggedError()("ValidationError", {
|
|
166
|
+
field: p.String,
|
|
167
|
+
message: p.String,
|
|
168
|
+
params: p.optional(p.Record({
|
|
169
|
+
key: p.String,
|
|
170
|
+
value: p.Unknown
|
|
171
|
+
}))
|
|
172
|
+
}) {}, x = class extends p.TaggedError()("ValidationErrors", { issues: p.Array(y).pipe(p.minItems(1)) }) {}, tt = (e) => {
|
|
173
|
+
if (typeof e != "object" || !e) return [];
|
|
174
|
+
let t = e._tag;
|
|
175
|
+
if (t === "ValidationError") {
|
|
176
|
+
let t = e;
|
|
177
|
+
return [{
|
|
178
|
+
field: t.field,
|
|
179
|
+
message: t.message,
|
|
180
|
+
...t.params === void 0 ? {} : { params: t.params }
|
|
181
|
+
}];
|
|
182
|
+
}
|
|
183
|
+
if (t === "ValidationErrors") {
|
|
184
|
+
let t = e;
|
|
185
|
+
return Array.isArray(t.issues) ? t.issues : [];
|
|
186
|
+
}
|
|
187
|
+
if (t === "BusinessRuleViolation") {
|
|
188
|
+
let t = e;
|
|
189
|
+
if (typeof t.field != "string" || t.field.length === 0) return [];
|
|
190
|
+
let n = typeof t.message == "string" && t.message.length > 0 ? t.message : String(t.rule ?? "validation.invalid");
|
|
191
|
+
return [{
|
|
192
|
+
field: t.field,
|
|
193
|
+
message: n,
|
|
194
|
+
...t.params === void 0 ? {} : { params: t.params }
|
|
195
|
+
}];
|
|
196
|
+
}
|
|
197
|
+
return [];
|
|
198
|
+
}, S = class extends p.TaggedError()("ApprovalRequired", {
|
|
199
|
+
approvalId: p.String,
|
|
200
|
+
procedure: p.String,
|
|
201
|
+
expiresAt: p.String,
|
|
202
|
+
requiredScopes: p.Array(p.String),
|
|
203
|
+
reason: p.NullOr(p.String),
|
|
204
|
+
created: p.Boolean
|
|
205
|
+
}) {}, C = class extends p.TaggedError()("ApprovalNotFound", { approvalId: p.String }) {}, w = class extends p.TaggedError()("ApprovalSelfApproval", {
|
|
206
|
+
approvalId: p.String,
|
|
207
|
+
subjectId: p.NullOr(p.String)
|
|
208
|
+
}) {}, nt = class extends p.TaggedError()("ApprovalRejected", {
|
|
209
|
+
approvalId: p.String,
|
|
210
|
+
decidedBy: p.NullOr(p.String),
|
|
211
|
+
note: p.NullOr(p.String)
|
|
212
|
+
}) {}, T = class extends p.TaggedError()("ApprovalExpired", {
|
|
213
|
+
approvalId: p.String,
|
|
214
|
+
expiredAt: p.String
|
|
215
|
+
}) {}, rt = class extends p.TaggedError()("ApprovalNotPending", {
|
|
216
|
+
approvalId: p.String,
|
|
217
|
+
status: p.String
|
|
218
|
+
}) {}, it = class extends p.TaggedError()("ApprovalForbidden", {
|
|
219
|
+
approvalId: p.String,
|
|
220
|
+
required: p.NullOr(p.String),
|
|
221
|
+
message: p.String
|
|
222
|
+
}) {}, E = class extends p.TaggedError()("ApprovalUnavailable", {
|
|
223
|
+
procedure: p.String,
|
|
224
|
+
message: p.String
|
|
225
|
+
}) {}, at = p.Union(S, nt, T, E), ot = p.Union(C, w, T, rt, it, E), st = p.Struct({
|
|
226
|
+
id: p.String,
|
|
227
|
+
procedure: p.String,
|
|
228
|
+
kind: p.Literal("mutation", "action"),
|
|
229
|
+
requestedBy: p.NullOr(p.String),
|
|
230
|
+
status: p.Literal("pending", "approved", "rejected", "expired", "consumed"),
|
|
231
|
+
reason: p.NullOr(p.String),
|
|
232
|
+
requiredScopes: p.Array(p.String),
|
|
233
|
+
requestedAt: p.String,
|
|
234
|
+
expiresAt: p.String,
|
|
235
|
+
decidedBy: p.NullOr(p.String),
|
|
236
|
+
decidedAt: p.NullOr(p.String),
|
|
237
|
+
note: p.NullOr(p.String),
|
|
238
|
+
relation: p.Literal("to-decide", "requested")
|
|
239
|
+
}), D = "channel:", O = Symbol.for("@voltro/protocol/reactivityChannels"), k = globalThis, A = k[O] ?? (k[O] = /* @__PURE__ */ new Map()), ct = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, lt = (e) => {
|
|
240
|
+
if (!ct.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
|
|
143
241
|
\`billing.usage\`. A \`:\` is refused because it is the namespace separator in
|
|
144
|
-
the routing key (\`${
|
|
242
|
+
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
|
|
145
243
|
routes as two.`);
|
|
146
|
-
let t =
|
|
244
|
+
let t = A.get(e);
|
|
147
245
|
if (t !== void 0) return t;
|
|
148
|
-
let n = `${
|
|
246
|
+
let n = `${D}${e}`, r = Object.freeze({
|
|
149
247
|
kind: "reactivity-channel",
|
|
150
248
|
name: e,
|
|
151
249
|
key: n,
|
|
152
250
|
toString: () => n
|
|
153
251
|
});
|
|
154
|
-
return
|
|
155
|
-
},
|
|
156
|
-
let t =
|
|
157
|
-
for (let r of e) for (let e of
|
|
252
|
+
return A.set(e, r), r;
|
|
253
|
+
}, j = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", M = (e) => e.startsWith(D), N = () => new Set([...A.values()].map((e) => e.key)), P = (e) => j(e) ? e.key : e, F = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(P) : [P(e)], I = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(P) : P(e), ut = (e) => {
|
|
254
|
+
let t = N(), n = [];
|
|
255
|
+
for (let r of e) for (let e of F(r.source)) !M(e) || t.has(e) || n.push({
|
|
158
256
|
procedure: r.name,
|
|
159
257
|
key: e
|
|
160
258
|
});
|
|
161
259
|
return n;
|
|
162
|
-
},
|
|
260
|
+
}, dt = (e, t) => {
|
|
163
261
|
let n = e?.injectExternalChange;
|
|
164
262
|
return n !== void 0 && (n.call(e, {
|
|
165
263
|
table: t.key,
|
|
@@ -168,8 +266,8 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
168
266
|
old: {},
|
|
169
267
|
origin: "inline"
|
|
170
268
|
}), !0);
|
|
171
|
-
},
|
|
172
|
-
if (
|
|
269
|
+
}, ft = (e) => e.internal !== !0, L = (e) => {
|
|
270
|
+
if (pt(e), Array.isArray(e.guards) && e.guards.length === 0) throw Error(`${e.name}: \`guards: []\` is empty, so it enforces nothing — but it reads\n at the call site as if this procedure were protected. Omit the field for an
|
|
173
271
|
unguarded procedure, or list the scopes required to call it.`);
|
|
174
272
|
let t = typeof e.source == "string" ? [e.source] : Array.isArray(e.source) ? e.source : void 0;
|
|
175
273
|
if (t !== void 0 && (t.length === 0 || t.some((e) => String(e).trim() === ""))) throw Error(`${e.name}: \`source\` is empty, so this query declares reactivity and\n subscribes to nothing — it serves one snapshot and never updates again,
|
|
@@ -186,7 +284,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
186
284
|
let n = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
187
285
|
if (n.length === 0) return e;
|
|
188
286
|
throw Error(`${e.name}: \`internal: true\` cannot be combined with ${n.map((e) => `\`${e}\``).join(" or ")}. \`internal\` takes the procedure OFF the wire; those put it back ON a different one (${n.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 ${n.join(" / ")} annotation if it is not.`);
|
|
189
|
-
},
|
|
287
|
+
}, pt = (e) => {
|
|
190
288
|
let t = e.requiresApproval;
|
|
191
289
|
if (t !== void 0) {
|
|
192
290
|
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
|
|
@@ -196,20 +294,20 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
196
294
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
197
295
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
198
296
|
}
|
|
199
|
-
},
|
|
297
|
+
}, mt = (e) => e.action !== void 0 && e.resourceType !== void 0, ht = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, R = (e, t, n) => {
|
|
200
298
|
if (n === void 0) return t;
|
|
201
299
|
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
|
|
202
300
|
without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
|
|
203
301
|
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
|
|
204
302
|
caller must hold a scope; drop them if anyone may call it.`);
|
|
205
|
-
return [
|
|
303
|
+
return [f(n.trim())];
|
|
206
304
|
}, z = (e) => L({
|
|
207
305
|
kind: "query",
|
|
208
306
|
name: e.name,
|
|
209
307
|
input: e.input,
|
|
210
308
|
output: e.output,
|
|
211
|
-
error: e.error ??
|
|
212
|
-
source:
|
|
309
|
+
error: e.error ?? p.Never,
|
|
310
|
+
source: I(e.source),
|
|
213
311
|
cache: e.cache,
|
|
214
312
|
guards: R(e.name, e.guards, e.openAccess),
|
|
215
313
|
openAccess: e.openAccess,
|
|
@@ -222,7 +320,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
222
320
|
name: e.name,
|
|
223
321
|
input: e.input,
|
|
224
322
|
output: e.output,
|
|
225
|
-
error: e.error ??
|
|
323
|
+
error: e.error ?? p.Never,
|
|
226
324
|
target: e.target,
|
|
227
325
|
guards: R(e.name, e.guards, e.openAccess),
|
|
228
326
|
openAccess: e.openAccess,
|
|
@@ -236,7 +334,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
236
334
|
name: e.name,
|
|
237
335
|
input: e.input,
|
|
238
336
|
output: e.output,
|
|
239
|
-
error: e.error ??
|
|
337
|
+
error: e.error ?? p.Never,
|
|
240
338
|
guards: R(e.name, e.guards, e.openAccess),
|
|
241
339
|
openAccess: e.openAccess,
|
|
242
340
|
source: e.source,
|
|
@@ -246,50 +344,50 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
246
344
|
requiresApproval: e.requiresApproval,
|
|
247
345
|
internal: e.internal,
|
|
248
346
|
overridesPlugin: e.overridesPlugin
|
|
249
|
-
}),
|
|
347
|
+
}), gt = (e) => L({
|
|
250
348
|
kind: "stream",
|
|
251
349
|
name: e.name,
|
|
252
350
|
input: e.input,
|
|
253
351
|
element: e.element,
|
|
254
|
-
error: e.error ??
|
|
352
|
+
error: e.error ?? p.Never,
|
|
255
353
|
internal: e.internal,
|
|
256
354
|
overridesPlugin: e.overridesPlugin,
|
|
257
355
|
guards: R(e.name, e.guards, e.openAccess),
|
|
258
356
|
openAccess: e.openAccess
|
|
259
|
-
}), H = (e, t) => t && t.length > 0 ?
|
|
357
|
+
}), H = (e, t) => t && t.length > 0 ? p.Union(e, ...t) : e, U = (e) => e !== void 0 && e.some((e) => !d(e)), _t = (e, t) => U(t) ? p.Union(e, u, l) : e, vt = (e) => p.Union(e, v), yt = (e) => p.Union(e, b, x), bt = (e, t) => t === void 0 ? e : p.Union(e, at), W = (e, t) => {
|
|
260
358
|
if (t === "stream") return e.error;
|
|
261
|
-
let n =
|
|
262
|
-
return t === "query" ? n :
|
|
263
|
-
},
|
|
264
|
-
payload:
|
|
265
|
-
success:
|
|
359
|
+
let n = _t(e.error, e.guards);
|
|
360
|
+
return t === "query" ? n : bt(yt(t === "mutation" ? vt(n) : n), e.requiresApproval);
|
|
361
|
+
}, xt = (e, t) => m.make(e.name, {
|
|
362
|
+
payload: _(e.input, e.name, U(e.guards)),
|
|
363
|
+
success: Qe(e.output),
|
|
266
364
|
error: H(W(e, "query"), t),
|
|
267
365
|
stream: !0
|
|
268
|
-
}),
|
|
269
|
-
payload:
|
|
366
|
+
}), St = (e, t) => m.make(e.name, {
|
|
367
|
+
payload: _(e.input, e.name, U(e.guards)),
|
|
270
368
|
success: e.output,
|
|
271
369
|
error: H(W(e, "mutation"), t)
|
|
272
|
-
}),
|
|
273
|
-
payload:
|
|
370
|
+
}), Ct = (e, t) => m.make(e.name, {
|
|
371
|
+
payload: _(e.input, e.name, U(e.guards)),
|
|
274
372
|
success: e.output,
|
|
275
373
|
error: H(W(e, "action"), t)
|
|
276
|
-
}),
|
|
277
|
-
payload:
|
|
374
|
+
}), wt = (e, t) => m.make(e.name, {
|
|
375
|
+
payload: _(e.input, e.name, U(e.guards)),
|
|
278
376
|
success: e.element,
|
|
279
377
|
error: H(e.error, t),
|
|
280
378
|
stream: !0
|
|
281
|
-
}),
|
|
379
|
+
}), Tt = (e) => {
|
|
282
380
|
if (typeof e != "object" || !e) return;
|
|
283
381
|
let t = e._tag;
|
|
284
382
|
return typeof t == "string" ? t : void 0;
|
|
285
|
-
},
|
|
383
|
+
}, Et = (e) => {
|
|
286
384
|
switch (e.kind) {
|
|
287
|
-
case "query": return
|
|
288
|
-
case "mutation": return
|
|
289
|
-
case "action": return
|
|
290
|
-
case "stream": return
|
|
385
|
+
case "query": return xt(e);
|
|
386
|
+
case "mutation": return St(e);
|
|
387
|
+
case "action": return Ct(e);
|
|
388
|
+
case "stream": return wt(e);
|
|
291
389
|
}
|
|
292
|
-
},
|
|
390
|
+
}, Dt = (e) => {
|
|
293
391
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
294
392
|
if (e.kind === "query") return {
|
|
295
393
|
kind: "query",
|
|
@@ -330,7 +428,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
330
428
|
..."shapeItem" in e && e.shapeItem !== void 0 ? { shapeItem: e.shapeItem } : {}
|
|
331
429
|
}))
|
|
332
430
|
};
|
|
333
|
-
},
|
|
431
|
+
}, Ot = 7500, kt = (e) => typeof e == "object" && !!e && e.kind === "event", At = (e) => {
|
|
334
432
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
335
433
|
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
|
|
336
434
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -359,73 +457,73 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
359
457
|
name: e.name,
|
|
360
458
|
key: e.key,
|
|
361
459
|
payload: e.payload,
|
|
362
|
-
guards: e.openAccess === void 0 ? e.guards : [
|
|
460
|
+
guards: e.openAccess === void 0 ? e.guards : [f(e.openAccess.trim())],
|
|
363
461
|
openAccess: e.openAccess,
|
|
364
462
|
rewind: e.rewind,
|
|
365
463
|
webhook: e.webhook,
|
|
366
464
|
delivery: e.delivery
|
|
367
465
|
};
|
|
368
|
-
},
|
|
369
|
-
_tag:
|
|
370
|
-
origin:
|
|
371
|
-
n:
|
|
372
|
-
emittedAt:
|
|
466
|
+
}, jt = (e) => p.Struct({
|
|
467
|
+
_tag: p.Literal("event"),
|
|
468
|
+
origin: p.String,
|
|
469
|
+
n: p.Number,
|
|
470
|
+
emittedAt: p.Number,
|
|
373
471
|
payload: e
|
|
374
|
-
}),
|
|
375
|
-
_tag:
|
|
376
|
-
missed:
|
|
377
|
-
reason:
|
|
378
|
-
}),
|
|
379
|
-
origin:
|
|
380
|
-
n:
|
|
381
|
-
}), G = (e) =>
|
|
472
|
+
}), Mt = p.Struct({
|
|
473
|
+
_tag: p.Literal("gap"),
|
|
474
|
+
missed: p.Number,
|
|
475
|
+
reason: p.Literal("buffer", "resume")
|
|
476
|
+
}), Nt = p.Struct({ _tag: p.Literal("attached") }), Pt = (e) => p.Union(Nt, jt(e), Mt), Ft = p.Struct({
|
|
477
|
+
origin: p.String,
|
|
478
|
+
n: p.Number
|
|
479
|
+
}), G = (e) => p.Struct({
|
|
382
480
|
key: e,
|
|
383
|
-
resume:
|
|
384
|
-
}),
|
|
385
|
-
let n = e.guards !== void 0 && e.guards.some((e) => !
|
|
386
|
-
return
|
|
387
|
-
payload:
|
|
388
|
-
success:
|
|
481
|
+
resume: p.optional(p.Array(Ft))
|
|
482
|
+
}), It = (e, t) => {
|
|
483
|
+
let n = e.guards !== void 0 && e.guards.some((e) => !d(e)) ? p.Union(u, l) : p.Never, r = t && t.length > 0 ? p.Union(n, ...t) : n;
|
|
484
|
+
return m.make(e.name, {
|
|
485
|
+
payload: _(G(e.key), e.name, U(e.guards)),
|
|
486
|
+
success: Pt(e.payload),
|
|
389
487
|
error: r,
|
|
390
488
|
stream: !0
|
|
391
489
|
});
|
|
392
|
-
},
|
|
393
|
-
event:
|
|
394
|
-
message:
|
|
395
|
-
}) {},
|
|
396
|
-
event:
|
|
397
|
-
message:
|
|
398
|
-
}) {},
|
|
399
|
-
event:
|
|
400
|
-
bytes:
|
|
401
|
-
limit:
|
|
402
|
-
}) {},
|
|
490
|
+
}, Lt = class extends p.TaggedError()("EventPayloadInvalid", {
|
|
491
|
+
event: p.String,
|
|
492
|
+
message: p.String
|
|
493
|
+
}) {}, Rt = class extends p.TaggedError()("EventKeyInvalid", {
|
|
494
|
+
event: p.String,
|
|
495
|
+
message: p.String
|
|
496
|
+
}) {}, zt = class extends p.TaggedError()("EventPayloadTooLarge", {
|
|
497
|
+
event: p.String,
|
|
498
|
+
bytes: p.Number,
|
|
499
|
+
limit: p.Number
|
|
500
|
+
}) {}, Bt = (e) => {
|
|
403
501
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
404
502
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
405
503
|
return JSON.stringify(t);
|
|
406
|
-
},
|
|
504
|
+
}, Vt = "\0", Ht = (e, t, n) => [
|
|
407
505
|
e ?? "~",
|
|
408
506
|
t,
|
|
409
|
-
|
|
410
|
-
].join("\0"),
|
|
507
|
+
Bt(n)
|
|
508
|
+
].join("\0"), Ut = (e) => {
|
|
411
509
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
412
510
|
return {
|
|
413
511
|
tenantId: t === "~" ? null : t,
|
|
414
512
|
event: n,
|
|
415
513
|
key: r
|
|
416
514
|
};
|
|
417
|
-
},
|
|
515
|
+
}, Wt = (e) => e.split("\0").join(" · "), Gt = (e) => e, Kt = (e) => e, qt = (e) => {
|
|
418
516
|
let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
|
|
419
517
|
return n !== void 0 && n !== "" ? `${r}#${n}` : r;
|
|
420
|
-
},
|
|
518
|
+
}, Jt = (e) => {
|
|
421
519
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
422
|
-
},
|
|
423
|
-
let n =
|
|
520
|
+
}, Yt = (e, t) => {
|
|
521
|
+
let n = Be.GenericTag(e);
|
|
424
522
|
return {
|
|
425
523
|
Tag: n,
|
|
426
|
-
Live:
|
|
524
|
+
Live: Ve.succeed(n, t)
|
|
427
525
|
};
|
|
428
|
-
},
|
|
526
|
+
}, Xt = (e, t, n) => {
|
|
429
527
|
if (!t) return { ok: !0 };
|
|
430
528
|
let r = K(n);
|
|
431
529
|
if (!r) return {
|
|
@@ -435,7 +533,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
435
533
|
let i = t.trim();
|
|
436
534
|
if (i === "*" || i === "") return { ok: !0 };
|
|
437
535
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
438
|
-
for (let i of a) if (!
|
|
536
|
+
for (let i of a) if (!Zt(i, r)) return {
|
|
439
537
|
ok: !1,
|
|
440
538
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
441
539
|
};
|
|
@@ -448,7 +546,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
448
546
|
patch: Number(t[3]),
|
|
449
547
|
pre: t[4] ?? ""
|
|
450
548
|
} : null;
|
|
451
|
-
}, q = (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,
|
|
549
|
+
}, q = (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, Zt = (e, t) => {
|
|
452
550
|
if (e === "*") return !0;
|
|
453
551
|
if (e.startsWith("^")) {
|
|
454
552
|
let n = K(e.slice(1));
|
|
@@ -470,206 +568,206 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
470
568
|
}
|
|
471
569
|
let r = K(e);
|
|
472
570
|
return r ? q(t, r) === 0 : !1;
|
|
473
|
-
}, J =
|
|
474
|
-
mode:
|
|
475
|
-
dueAt:
|
|
476
|
-
retryAfterMs:
|
|
477
|
-
intentId:
|
|
478
|
-
}),
|
|
479
|
-
id:
|
|
480
|
-
workflowName:
|
|
481
|
-
executionId:
|
|
482
|
-
status:
|
|
483
|
-
deferral:
|
|
484
|
-
}), Y =
|
|
485
|
-
id:
|
|
486
|
-
tag:
|
|
487
|
-
executionId:
|
|
571
|
+
}, J = p.Literal("running", "succeeded", "failed", "cancelled", "suspended"), Qt = p.Literal("cancel", "terminate", "abandon"), $t = p.Struct({
|
|
572
|
+
mode: p.String,
|
|
573
|
+
dueAt: p.NullOr(p.Number),
|
|
574
|
+
retryAfterMs: p.NullOr(p.Number),
|
|
575
|
+
intentId: p.NullOr(p.String)
|
|
576
|
+
}), en = p.Struct({
|
|
577
|
+
id: p.String,
|
|
578
|
+
workflowName: p.String,
|
|
579
|
+
executionId: p.NullOr(p.String),
|
|
580
|
+
status: p.Literal("running", "queued", "dropped", "skipped"),
|
|
581
|
+
deferral: p.optional($t)
|
|
582
|
+
}), Y = p.Struct({
|
|
583
|
+
id: p.String,
|
|
584
|
+
tag: p.String,
|
|
585
|
+
executionId: p.String,
|
|
488
586
|
status: J,
|
|
489
|
-
payload:
|
|
490
|
-
workflowVersion:
|
|
491
|
-
workflowPatches:
|
|
492
|
-
output:
|
|
493
|
-
subject:
|
|
494
|
-
source:
|
|
495
|
-
errorTag:
|
|
496
|
-
errorMessage:
|
|
497
|
-
cancelled:
|
|
498
|
-
startedAt:
|
|
499
|
-
completedAt:
|
|
500
|
-
durationMs:
|
|
501
|
-
traceId:
|
|
502
|
-
parentExecutionId:
|
|
503
|
-
parentClosePolicy:
|
|
504
|
-
}),
|
|
505
|
-
tag:
|
|
506
|
-
status:
|
|
507
|
-
limit:
|
|
508
|
-
}),
|
|
509
|
-
id:
|
|
510
|
-
runId:
|
|
511
|
-
stepName:
|
|
512
|
-
attempt:
|
|
513
|
-
status:
|
|
514
|
-
input:
|
|
515
|
-
retryPolicy:
|
|
516
|
-
output:
|
|
517
|
-
errorTag:
|
|
518
|
-
errorMessage:
|
|
519
|
-
errorCause:
|
|
520
|
-
startedAt:
|
|
521
|
-
completedAt:
|
|
522
|
-
durationMs:
|
|
523
|
-
}),
|
|
524
|
-
id:
|
|
525
|
-
runId:
|
|
526
|
-
eventType:
|
|
527
|
-
payload:
|
|
528
|
-
occurredAt:
|
|
529
|
-
stepName:
|
|
530
|
-
attempt:
|
|
531
|
-
}),
|
|
532
|
-
id:
|
|
533
|
-
name:
|
|
534
|
-
payload:
|
|
535
|
-
source:
|
|
536
|
-
subject:
|
|
537
|
-
traceId:
|
|
538
|
-
occurredAt:
|
|
539
|
-
}),
|
|
540
|
-
id:
|
|
541
|
-
eventId:
|
|
542
|
-
eventName:
|
|
543
|
-
triggerId:
|
|
544
|
-
workflowName:
|
|
545
|
-
executionId:
|
|
546
|
-
status:
|
|
547
|
-
idempotencyKey:
|
|
548
|
-
skipped:
|
|
549
|
-
errorMessage:
|
|
550
|
-
createdAt:
|
|
551
|
-
completedAt:
|
|
552
|
-
}),
|
|
553
|
-
name:
|
|
554
|
-
limit:
|
|
555
|
-
}),
|
|
556
|
-
workflowName:
|
|
557
|
-
executionId:
|
|
558
|
-
}),
|
|
559
|
-
id:
|
|
560
|
-
signalName:
|
|
561
|
-
payload:
|
|
562
|
-
}),
|
|
563
|
-
id:
|
|
564
|
-
updateName:
|
|
565
|
-
payload:
|
|
566
|
-
timeoutMs:
|
|
567
|
-
}),
|
|
568
|
-
eventId:
|
|
569
|
-
updateId:
|
|
570
|
-
completedEventId:
|
|
571
|
-
result:
|
|
572
|
-
}),
|
|
587
|
+
payload: p.Unknown,
|
|
588
|
+
workflowVersion: p.NullOr(p.String),
|
|
589
|
+
workflowPatches: p.NullOr(p.Unknown),
|
|
590
|
+
output: p.NullOr(p.Unknown),
|
|
591
|
+
subject: p.NullOr(p.Unknown),
|
|
592
|
+
source: p.NullOr(p.String),
|
|
593
|
+
errorTag: p.NullOr(p.String),
|
|
594
|
+
errorMessage: p.NullOr(p.String),
|
|
595
|
+
cancelled: p.Boolean,
|
|
596
|
+
startedAt: p.Date,
|
|
597
|
+
completedAt: p.NullOr(p.Date),
|
|
598
|
+
durationMs: p.NullOr(p.Number),
|
|
599
|
+
traceId: p.NullOr(p.String),
|
|
600
|
+
parentExecutionId: p.NullOr(p.String),
|
|
601
|
+
parentClosePolicy: p.NullOr(Qt)
|
|
602
|
+
}), tn = p.Struct({
|
|
603
|
+
tag: p.optional(p.String),
|
|
604
|
+
status: p.optional(J),
|
|
605
|
+
limit: p.optional(p.Number)
|
|
606
|
+
}), nn = p.Struct({
|
|
607
|
+
id: p.String,
|
|
608
|
+
runId: p.String,
|
|
609
|
+
stepName: p.String,
|
|
610
|
+
attempt: p.Number,
|
|
611
|
+
status: p.Literal("running", "succeeded", "failed"),
|
|
612
|
+
input: p.NullOr(p.Unknown),
|
|
613
|
+
retryPolicy: p.NullOr(p.Unknown),
|
|
614
|
+
output: p.NullOr(p.Unknown),
|
|
615
|
+
errorTag: p.NullOr(p.String),
|
|
616
|
+
errorMessage: p.NullOr(p.String),
|
|
617
|
+
errorCause: p.NullOr(p.Unknown),
|
|
618
|
+
startedAt: p.Date,
|
|
619
|
+
completedAt: p.NullOr(p.Date),
|
|
620
|
+
durationMs: p.NullOr(p.Number)
|
|
621
|
+
}), rn = p.Struct({
|
|
622
|
+
id: p.String,
|
|
623
|
+
runId: p.String,
|
|
624
|
+
eventType: p.String,
|
|
625
|
+
payload: p.NullOr(p.Unknown),
|
|
626
|
+
occurredAt: p.Date,
|
|
627
|
+
stepName: p.NullOr(p.String),
|
|
628
|
+
attempt: p.NullOr(p.Number)
|
|
629
|
+
}), an = p.Struct({
|
|
630
|
+
id: p.String,
|
|
631
|
+
name: p.String,
|
|
632
|
+
payload: p.Unknown,
|
|
633
|
+
source: p.String,
|
|
634
|
+
subject: p.NullOr(p.Unknown),
|
|
635
|
+
traceId: p.NullOr(p.String),
|
|
636
|
+
occurredAt: p.Date
|
|
637
|
+
}), on = p.Struct({
|
|
638
|
+
id: p.String,
|
|
639
|
+
eventId: p.String,
|
|
640
|
+
eventName: p.String,
|
|
641
|
+
triggerId: p.String,
|
|
642
|
+
workflowName: p.String,
|
|
643
|
+
executionId: p.NullOr(p.String),
|
|
644
|
+
status: p.Literal("starting", "started", "skipped", "failed"),
|
|
645
|
+
idempotencyKey: p.String,
|
|
646
|
+
skipped: p.Boolean,
|
|
647
|
+
errorMessage: p.NullOr(p.String),
|
|
648
|
+
createdAt: p.Date,
|
|
649
|
+
completedAt: p.NullOr(p.Date)
|
|
650
|
+
}), sn = p.Struct({ id: p.String }), X = p.Struct({ runId: p.String }), cn = p.Struct({
|
|
651
|
+
name: p.optional(p.String),
|
|
652
|
+
limit: p.optional(p.Number)
|
|
653
|
+
}), ln = p.Struct({ eventId: p.String }), Z = p.Struct({
|
|
654
|
+
workflowName: p.String,
|
|
655
|
+
executionId: p.String
|
|
656
|
+
}), un = p.Struct({
|
|
657
|
+
id: p.String,
|
|
658
|
+
signalName: p.String,
|
|
659
|
+
payload: p.optional(p.Unknown)
|
|
660
|
+
}), dn = p.Struct({
|
|
661
|
+
id: p.String,
|
|
662
|
+
updateName: p.String,
|
|
663
|
+
payload: p.optional(p.Unknown),
|
|
664
|
+
timeoutMs: p.optional(p.Number)
|
|
665
|
+
}), fn = p.Struct({
|
|
666
|
+
eventId: p.String,
|
|
667
|
+
updateId: p.String,
|
|
668
|
+
completedEventId: p.String,
|
|
669
|
+
result: p.Unknown
|
|
670
|
+
}), pn = z({
|
|
573
671
|
name: "__voltro.workflow.run",
|
|
574
672
|
source: "_voltro_workflow_runs",
|
|
575
|
-
input:
|
|
576
|
-
output:
|
|
577
|
-
}),
|
|
673
|
+
input: sn,
|
|
674
|
+
output: p.Array(Y)
|
|
675
|
+
}), mn = z({
|
|
578
676
|
name: "__voltro.workflow.runs",
|
|
579
677
|
source: "_voltro_workflow_runs",
|
|
580
|
-
input:
|
|
581
|
-
output:
|
|
582
|
-
}),
|
|
678
|
+
input: tn,
|
|
679
|
+
output: p.Array(Y)
|
|
680
|
+
}), hn = z({
|
|
583
681
|
name: "__voltro.workflow.run.steps",
|
|
584
682
|
source: "_voltro_workflow_run_steps",
|
|
585
683
|
input: X,
|
|
586
|
-
output:
|
|
587
|
-
}),
|
|
684
|
+
output: p.Array(nn)
|
|
685
|
+
}), gn = z({
|
|
588
686
|
name: "__voltro.workflow.run.events",
|
|
589
687
|
source: "_voltro_workflow_run_events",
|
|
590
688
|
input: X,
|
|
591
|
-
output:
|
|
592
|
-
}),
|
|
689
|
+
output: p.Array(rn)
|
|
690
|
+
}), _n = z({
|
|
593
691
|
name: "__voltro.workflow.domainEvents",
|
|
594
692
|
source: "_voltro_workflow_events",
|
|
595
|
-
input:
|
|
596
|
-
output:
|
|
597
|
-
}),
|
|
693
|
+
input: cn,
|
|
694
|
+
output: p.Array(an)
|
|
695
|
+
}), vn = z({
|
|
598
696
|
name: "__voltro.workflow.event.deliveries",
|
|
599
697
|
source: "_voltro_workflow_event_deliveries",
|
|
600
|
-
input:
|
|
601
|
-
output:
|
|
602
|
-
}),
|
|
698
|
+
input: ln,
|
|
699
|
+
output: p.Array(on)
|
|
700
|
+
}), yn = V({
|
|
603
701
|
name: "__voltro.workflow.cancel",
|
|
604
702
|
input: Z,
|
|
605
|
-
output:
|
|
606
|
-
}),
|
|
703
|
+
output: p.Struct({ ok: p.Boolean })
|
|
704
|
+
}), bn = V({
|
|
607
705
|
name: "__voltro.workflow.resume",
|
|
608
706
|
input: Z,
|
|
609
|
-
output:
|
|
610
|
-
}),
|
|
707
|
+
output: p.Struct({ ok: p.Boolean })
|
|
708
|
+
}), xn = V({
|
|
611
709
|
name: "__voltro.workflow.signal",
|
|
612
|
-
input:
|
|
613
|
-
output:
|
|
614
|
-
}),
|
|
710
|
+
input: un,
|
|
711
|
+
output: p.Struct({ eventId: p.String })
|
|
712
|
+
}), Sn = V({
|
|
615
713
|
name: "__voltro.workflow.update",
|
|
616
|
-
input:
|
|
617
|
-
output:
|
|
618
|
-
}),
|
|
619
|
-
id:
|
|
620
|
-
tag:
|
|
621
|
-
label:
|
|
622
|
-
undone:
|
|
623
|
-
crossesAction:
|
|
624
|
-
createdAt:
|
|
625
|
-
}),
|
|
626
|
-
invocationId:
|
|
627
|
-
reason:
|
|
628
|
-
}) {},
|
|
629
|
-
name:
|
|
714
|
+
input: dn,
|
|
715
|
+
output: fn
|
|
716
|
+
}), Cn = "__voltro.undo.log", wn = "__voltro.undo.apply", Tn = "__voltro.undo.redo", En = p.Struct({
|
|
717
|
+
id: p.String,
|
|
718
|
+
tag: p.String,
|
|
719
|
+
label: p.NullOr(p.String),
|
|
720
|
+
undone: p.Boolean,
|
|
721
|
+
crossesAction: p.Boolean,
|
|
722
|
+
createdAt: p.String
|
|
723
|
+
}), Dn = class extends p.TaggedError()("UndoNotFound", { invocationId: p.String }) {}, On = class extends p.TaggedError()("UndoForbidden", { invocationId: p.String }) {}, kn = class extends p.TaggedError()("UndoConflict", {
|
|
724
|
+
invocationId: p.String,
|
|
725
|
+
reason: p.Literal("conflict", "action")
|
|
726
|
+
}) {}, An = p.Union(Dn, On, kn), jn = z({
|
|
727
|
+
name: Cn,
|
|
630
728
|
source: "_voltro_undo_log",
|
|
631
|
-
input:
|
|
632
|
-
output:
|
|
729
|
+
input: p.Struct({ limit: p.optional(p.Number) }),
|
|
730
|
+
output: p.Array(En),
|
|
633
731
|
openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
|
|
634
|
-
}),
|
|
635
|
-
name:
|
|
636
|
-
input:
|
|
637
|
-
output:
|
|
638
|
-
error:
|
|
732
|
+
}), Mn = B({
|
|
733
|
+
name: wn,
|
|
734
|
+
input: p.Struct({ invocationId: p.String }),
|
|
735
|
+
output: p.Struct({ ok: p.Boolean }),
|
|
736
|
+
error: An,
|
|
639
737
|
openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
640
|
-
}),
|
|
641
|
-
name:
|
|
642
|
-
input:
|
|
643
|
-
output:
|
|
644
|
-
error:
|
|
738
|
+
}), Nn = B({
|
|
739
|
+
name: Tn,
|
|
740
|
+
input: p.Struct({ invocationId: p.String }),
|
|
741
|
+
output: p.Struct({ ok: p.Boolean }),
|
|
742
|
+
error: An,
|
|
645
743
|
openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
646
|
-
}),
|
|
647
|
-
table:
|
|
648
|
-
reason:
|
|
649
|
-
}) {},
|
|
650
|
-
operation:
|
|
651
|
-
table:
|
|
652
|
-
cause:
|
|
653
|
-
}) {},
|
|
654
|
-
table:
|
|
655
|
-
summary:
|
|
656
|
-
issues:
|
|
657
|
-
path:
|
|
658
|
-
message:
|
|
744
|
+
}), Pn = class extends p.TaggedError()("TenantScopeViolation", {
|
|
745
|
+
table: p.String,
|
|
746
|
+
reason: p.String
|
|
747
|
+
}) {}, Fn = class extends p.TaggedError()("StoreOperationFailed", {
|
|
748
|
+
operation: p.String,
|
|
749
|
+
table: p.String,
|
|
750
|
+
cause: p.String
|
|
751
|
+
}) {}, In = class extends p.TaggedError()("TableValidationFailed", {
|
|
752
|
+
table: p.String,
|
|
753
|
+
summary: p.String,
|
|
754
|
+
issues: p.Array(p.Struct({
|
|
755
|
+
path: p.String,
|
|
756
|
+
message: p.String
|
|
659
757
|
}))
|
|
660
|
-
}) {},
|
|
661
|
-
table:
|
|
662
|
-
id:
|
|
663
|
-
reason:
|
|
664
|
-
}) {},
|
|
665
|
-
table:
|
|
666
|
-
columns:
|
|
667
|
-
}) {},
|
|
668
|
-
kind:
|
|
669
|
-
table:
|
|
670
|
-
operation:
|
|
671
|
-
constraint:
|
|
672
|
-
column:
|
|
758
|
+
}) {}, Ln = class extends p.TaggedError()("TenantRowNotFound", {
|
|
759
|
+
table: p.String,
|
|
760
|
+
id: p.String,
|
|
761
|
+
reason: p.String
|
|
762
|
+
}) {}, Rn = class extends p.TaggedError()("ServerOnlyColumnWrite", {
|
|
763
|
+
table: p.String,
|
|
764
|
+
columns: p.Array(p.String)
|
|
765
|
+
}) {}, zn = class extends p.TaggedError()("ConstraintViolation", {
|
|
766
|
+
kind: p.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
|
|
767
|
+
table: p.String,
|
|
768
|
+
operation: p.String,
|
|
769
|
+
constraint: p.optional(p.String),
|
|
770
|
+
column: p.optional(p.String)
|
|
673
771
|
}) {
|
|
674
772
|
get message() {
|
|
675
773
|
let e = this.constraint ?? this.column, t = e === void 0 ? `on ${this.table}` : `${e} on ${this.table}`;
|
|
@@ -681,85 +779,85 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
681
779
|
case "check": return `check constraint ${t}: the row does not satisfy it`;
|
|
682
780
|
}
|
|
683
781
|
}
|
|
684
|
-
},
|
|
685
|
-
name:
|
|
782
|
+
}, Bn = "__voltro.approvals.pending", Vn = "__voltro.approvals.decide", Hn = z({
|
|
783
|
+
name: Bn,
|
|
686
784
|
source: "_voltro_approvals",
|
|
687
|
-
input:
|
|
688
|
-
output:
|
|
785
|
+
input: p.Struct({ limit: p.optional(p.Number) }),
|
|
786
|
+
output: p.Array(st),
|
|
689
787
|
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"
|
|
690
|
-
}),
|
|
691
|
-
name:
|
|
692
|
-
input:
|
|
693
|
-
approvalId:
|
|
694
|
-
decision:
|
|
695
|
-
note:
|
|
788
|
+
}), Un = B({
|
|
789
|
+
name: Vn,
|
|
790
|
+
input: p.Struct({
|
|
791
|
+
approvalId: p.String,
|
|
792
|
+
decision: p.Literal("approve", "reject"),
|
|
793
|
+
note: p.optional(p.String)
|
|
696
794
|
}),
|
|
697
|
-
output:
|
|
698
|
-
approvalId:
|
|
699
|
-
status:
|
|
795
|
+
output: p.Struct({
|
|
796
|
+
approvalId: p.String,
|
|
797
|
+
status: p.Literal("approved", "rejected")
|
|
700
798
|
}),
|
|
701
|
-
error:
|
|
799
|
+
error: ot,
|
|
702
800
|
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"
|
|
703
|
-
}),
|
|
704
|
-
connectionId:
|
|
801
|
+
}), Wn = "__voltro.connections.list", Gn = "__voltro.connections.start", Kn = "__voltro.connections.submitToken", qn = "__voltro.connections.disconnect", Q = p.Literal("oauth2", "pat"), Jn = p.Literal("disconnected", "connected", "expired", "revoked", "error"), Yn = p.Struct({
|
|
802
|
+
connectionId: p.String,
|
|
705
803
|
kind: Q,
|
|
706
|
-
label:
|
|
707
|
-
status:
|
|
708
|
-
accountId:
|
|
709
|
-
accountLabel:
|
|
710
|
-
scopes:
|
|
711
|
-
expiresAt:
|
|
712
|
-
lastError:
|
|
713
|
-
connectedAt:
|
|
714
|
-
}),
|
|
715
|
-
connectionId:
|
|
804
|
+
label: p.String,
|
|
805
|
+
status: Jn,
|
|
806
|
+
accountId: p.NullOr(p.String),
|
|
807
|
+
accountLabel: p.NullOr(p.String),
|
|
808
|
+
scopes: p.Array(p.String),
|
|
809
|
+
expiresAt: p.NullOr(p.String),
|
|
810
|
+
lastError: p.NullOr(p.String),
|
|
811
|
+
connectedAt: p.NullOr(p.String)
|
|
812
|
+
}), Xn = class extends p.TaggedError()("ConnectionNotDeclared", { connectionId: p.String }) {}, Zn = class extends p.TaggedError()("ConnectionSubjectRequired", { connectionId: p.String }) {}, Qn = class extends p.TaggedError()("ConnectionKindMismatch", {
|
|
813
|
+
connectionId: p.String,
|
|
716
814
|
expected: Q,
|
|
717
815
|
actual: Q
|
|
718
|
-
}) {},
|
|
719
|
-
connectionId:
|
|
720
|
-
reason:
|
|
721
|
-
transient:
|
|
722
|
-
}) {}, $ =
|
|
723
|
-
name:
|
|
816
|
+
}) {}, $n = class extends p.TaggedError()("ConnectionHandshakeFailed", {
|
|
817
|
+
connectionId: p.String,
|
|
818
|
+
reason: p.String,
|
|
819
|
+
transient: p.Boolean
|
|
820
|
+
}) {}, $ = p.Union(Xn, Zn, Qn, $n), er = z({
|
|
821
|
+
name: Wn,
|
|
724
822
|
source: "_voltro_connections",
|
|
725
|
-
input:
|
|
726
|
-
output:
|
|
823
|
+
input: p.Struct({}),
|
|
824
|
+
output: p.Array(Yn),
|
|
727
825
|
openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
|
|
728
|
-
}),
|
|
729
|
-
name:
|
|
730
|
-
input:
|
|
731
|
-
connectionId:
|
|
732
|
-
redirectTo:
|
|
826
|
+
}), tr = V({
|
|
827
|
+
name: Gn,
|
|
828
|
+
input: p.Struct({
|
|
829
|
+
connectionId: p.String,
|
|
830
|
+
redirectTo: p.optional(p.String)
|
|
733
831
|
}),
|
|
734
|
-
output:
|
|
735
|
-
authorizeUrl:
|
|
736
|
-
state:
|
|
832
|
+
output: p.Struct({
|
|
833
|
+
authorizeUrl: p.String,
|
|
834
|
+
state: p.String
|
|
737
835
|
}),
|
|
738
836
|
error: $,
|
|
739
837
|
openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
740
|
-
}),
|
|
741
|
-
name:
|
|
742
|
-
input:
|
|
743
|
-
connectionId:
|
|
744
|
-
token:
|
|
838
|
+
}), nr = B({
|
|
839
|
+
name: Kn,
|
|
840
|
+
input: p.Struct({
|
|
841
|
+
connectionId: p.String,
|
|
842
|
+
token: p.String
|
|
745
843
|
}),
|
|
746
|
-
output:
|
|
844
|
+
output: p.Struct({ ok: p.Boolean }),
|
|
747
845
|
error: $,
|
|
748
846
|
openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
749
|
-
}),
|
|
750
|
-
name:
|
|
751
|
-
input:
|
|
752
|
-
output:
|
|
847
|
+
}), rr = B({
|
|
848
|
+
name: qn,
|
|
849
|
+
input: p.Struct({ connectionId: p.String }),
|
|
850
|
+
output: p.Struct({ ok: p.Boolean }),
|
|
753
851
|
error: $,
|
|
754
852
|
openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
|
|
755
|
-
}),
|
|
853
|
+
}), ir = (e) => {
|
|
756
854
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
757
855
|
return Number.isNaN(t) ? 0 : t;
|
|
758
|
-
},
|
|
856
|
+
}, ar = 4001, or = /* @__PURE__ */ new Set(["/rpc", "/ws"]), sr = (e) => {
|
|
759
857
|
if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
|
|
760
|
-
if (
|
|
858
|
+
if (or.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
|
|
761
859
|
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)}'`);
|
|
762
860
|
return e;
|
|
763
|
-
},
|
|
861
|
+
}, cr = 1;
|
|
764
862
|
//#endregion
|
|
765
|
-
export {
|
|
863
|
+
export { Ee as ADMIN_SCOPE, xe as APIKEY_ISSUE_ORG_SCOPE, we as APIKEY_ISSUE_OTHER_SCOPE, ge as APIKEY_ISSUE_SELF_SCOPE, Vn as APPROVALS_DECIDE_TAG, Bn as APPROVALS_PENDING_TAG, ot as ApprovalDecisionErrors, at as ApprovalErrors, T as ApprovalExpired, it as ApprovalForbidden, C as ApprovalNotFound, rt as ApprovalNotPending, nt as ApprovalRejected, S as ApprovalRequired, w as ApprovalSelfApproval, E as ApprovalUnavailable, Oe as AuthMiddleware, v as BusinessRuleViolation, Wn as CONNECTIONS_LIST_TAG, qn as CONNECTION_DISCONNECT_TAG, Gn as CONNECTION_START_TAG, Kn as CONNECTION_SUBMIT_TOKEN_TAG, $n as ConnectionHandshakeFailed, oe as ConnectionInfo, i as ConnectionInfoMiddleware, Q as ConnectionKind, Qn as ConnectionKindMismatch, Xn as ConnectionNotDeclared, Yn as ConnectionState, Jn as ConnectionStatus, Zn as ConnectionSubjectRequired, zn as ConstraintViolation, r as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, ne as DEFAULT_SCOPE_CACHE_TTL_MS, Vt as EVENT_ROUTE_SEP, Rt as EventKeyInvalid, Lt as EventPayloadInvalid, zt as EventPayloadTooLarge, ar as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, ve as IMPERSONATION_METADATA_KEY, Ot as MAX_EVENT_ENVELOPE_BYTES, cr as PROTOCOL_VERSION, st as PendingApproval, D as REACTIVITY_CHANNEL_PREFIX, u as ScopeError, Rn as ServerOnlyColumnWrite, Fn as StoreOperationFailed, e as Subject, _e as SubjectIdentity, te as SubjectService, In as TableValidationFailed, Ln as TenantRowNotFound, Pn as TenantScopeViolation, wn as UNDO_APPLY_TAG, Cn as UNDO_LOG_TAG, Tn as UNDO_REDO_TAG, l as Unauthenticated, kn as UndoConflict, On as UndoForbidden, En as UndoLogEntry, Dn as UndoNotFound, b as ValidationError, x as ValidationErrors, y as ValidationIssue, Z as WorkflowControlInputSchema, an as WorkflowDomainEventRowSchema, cn as WorkflowDomainEventsInputSchema, ln as WorkflowEventDeliveriesInputSchema, on as WorkflowEventDeliveryRowSchema, Qt as WorkflowParentClosePolicySchema, rn as WorkflowRunEventRowSchema, en as WorkflowRunHandleSchema, sn as WorkflowRunRefSchema, Y as WorkflowRunRowSchema, J as WorkflowRunStatusSchema, nn as WorkflowRunStepRowSchema, X as WorkflowRunTableRefSchema, tn as WorkflowRunsInputSchema, un as WorkflowSignalInputSchema, $t as WorkflowStartDeferralSchema, dn as WorkflowUpdateInputSchema, fn as WorkflowUpdateResultSchema, Ct as actionToRpc, Se as advisoryResourceGuardWarning, re as anonymousSubject, Ze as applyRowPatch, a as applyScopeDecision, Un as approvalsDecideDescriptor, Hn as approvalsPendingQueryDescriptor, c as assertAuthenticated, Le as beginIdempotent, Xt as checkFrameworkCompat, Te as checkGuards, fe as checkGuardsEffect, ee as composeAuthStrategies, Jt as composeRpcInterceptors, rr as connectionDisconnectDescriptor, tr as connectionStartDescriptor, nr as connectionSubmitTokenDescriptor, er as connectionsListQueryDescriptor, N as declaredReactivityChannelKeys, V as defineAction, At as defineEvent, B as defineMutation, Gt as definePlugin, Kt as definePluginRoute, Yt as definePluginService, z as defineQuery, gt as defineStream, sr as defineWebSocket, Ye as diffRows, ye as effectiveScopes, Bt as encodeEventKey, Tt as errorTag, Nt as eventAttached, jt as eventEnvelope, Mt as eventGap, Ft as eventResumePoint, Ht as eventRoute, Pt as eventStreamEvent, G as eventSubscribeInput, It as eventToRpc, Pe as failIdempotent, tt as fieldIssuesOf, De as findAdvisoryResourceGuards, Me as finishIdempotent, Wt as formatEventRoute, pe as getPolicyGuardResolver, me as getResourceScopeResolver, ht as hasAccessDecision, ie as hasCallbackRoutes, Ce as hasEffectiveScope, U as hasEnforcedGuard, be as hasScope, h as idToPath, Ie as idempotencyScope, $e as inputLabel, kt as isEventDescriptor, Xe as isIdKeyed, d as isOpenAccess, he as isPolicyCheck, mt as isPolicyGuard, j as isReactivityChannel, M as isReactivityChannelKey, je as isSystemSubject, ft as isWireReachable, t as makeScopeCache, Re as memoryIdempotencyStore, ue as missingAccessDecision, St as mutationToRpc, Dt as normalizeDescriptor, I as normalizeSource, f as openAccessSpec, Ut as parseEventRoute, Ke as pathToId, qt as pluginInstanceName, dt as publishReactivity, ze as publishServerError, xt as queryToRpc, ce as rawImpersonationMark, lt as reactivityChannel, Ae as requireScope, We as rowPatchOpSchema, Ge as rowPatchSchema, s as scopeCacheKey, de as setEffectiveScopes, ke as setPolicyGuardResolver, ae as setResourceScopeResolver, F as sourceKeys, wt as streamToRpc, _ as strictInput, se as subjectIdentity, n as subjectScopes, Fe as subscribeServerErrors, Qe as subscriptionEvent, le as systemSubject, o as tenantScopedSubject, Et as toRpc, ir as tsMs, ut as undeclaredChannelKeys, Mn as undoApplyDescriptor, jn as undoLogQueryDescriptor, Nn as undoRedoDescriptor, W as wireErrorUnion, yn as workflowCancelDescriptor, _n as workflowDomainEventsQueryDescriptor, vn as workflowEventDeliveriesQueryDescriptor, bn as workflowResumeDescriptor, gn as workflowRunEventsQueryDescriptor, pn as workflowRunQueryDescriptor, hn as workflowRunStepsQueryDescriptor, mn as workflowRunsQueryDescriptor, xn as workflowSignalDescriptor, Sn as workflowUpdateDescriptor, Ne as wsMutationIdempotencyScope };
|