@voltro/protocol 0.66.1 → 0.68.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 +259 -0
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/dist/index.d.ts +73 -3
- package/dist/index.js +551 -495
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
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, K as ee, L as te, M as ne, N as re, O as ie, P as l, R as ae, S as oe, T as se, U as ce, V as le, W as ue, _ as de, a as u, b as fe, c as pe, d as me, f as he, g as d, h as ge, i as _e, j as ve, k as ye, l as be, m as xe, n as Se, o as Ce, p as we, r as Te, s as Ee, t as De, u as Oe, v as ke, w as Ae, x as je, y as f, z as Me } from "./scopes-C86BDyNJ.js";
|
|
2
|
-
import { a as
|
|
3
|
-
import { Context as
|
|
4
|
-
import { Rpc as
|
|
5
|
-
import { VersionConflict as
|
|
2
|
+
import { a as Ne, c as Pe, d as Fe, i as p, l as Ie, n as Le, o as Re, r as ze, s as Be, t as Ve, u as He } from "./serverErrorBus-BTnTpMqj.js";
|
|
3
|
+
import { Context as Ue, Layer as We, Schema as m } from "effect";
|
|
4
|
+
import { Rpc as h } from "@effect/rpc";
|
|
5
|
+
import { VersionConflict as Ge } 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 Ke = m.Union(m.String, m.Number), qe = m.Record({
|
|
8
|
+
key: m.String,
|
|
9
|
+
value: m.Unknown
|
|
10
|
+
}).pipe(m.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), Je = m.Union(m.Struct({
|
|
11
|
+
op: m.Literal("add"),
|
|
12
|
+
path: m.String,
|
|
13
|
+
value: qe
|
|
14
|
+
}), m.Struct({
|
|
15
|
+
op: m.Literal("replace"),
|
|
16
|
+
path: m.String,
|
|
17
|
+
value: qe
|
|
18
|
+
}), m.Struct({
|
|
19
|
+
op: m.Literal("remove"),
|
|
20
|
+
path: m.String
|
|
21
|
+
}), m.Struct({
|
|
22
|
+
op: m.Literal("mergeCells"),
|
|
23
|
+
path: m.String,
|
|
24
|
+
value: m.Record({
|
|
25
|
+
key: m.String,
|
|
26
|
+
value: m.Unknown
|
|
27
27
|
})
|
|
28
|
-
})),
|
|
29
|
-
ops:
|
|
30
|
-
order:
|
|
31
|
-
}),
|
|
28
|
+
})), Ye = m.Struct({
|
|
29
|
+
ops: m.Array(Je),
|
|
30
|
+
order: m.Array(Ke)
|
|
31
|
+
}), g = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, _ = (e) => (e.startsWith("/") ? e.slice(1) : e).replace(/~1/g, "/").replace(/~0/g, "~"), v = (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
|
+
}, y = (e, t) => v(e) === v(t), Xe = (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 v({
|
|
42
42
|
id: 0,
|
|
43
43
|
v: e
|
|
44
|
-
}) ===
|
|
44
|
+
}) === v({
|
|
45
45
|
id: 0,
|
|
46
46
|
v: t
|
|
47
47
|
});
|
|
48
|
-
},
|
|
48
|
+
}, Ze = (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) || Xe(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 Ge = h.Union(h.String, h.Number), _ = h.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 (!y(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
|
+
}) : (y(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
|
+
}, Qe = (e) => e.every((e) => {
|
|
102
102
|
let t = e.id;
|
|
103
103
|
return typeof t == "string" || typeof t == "number";
|
|
104
|
-
}),
|
|
104
|
+
}), $e = (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 = _(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,56 +121,57 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
121
121
|
t !== void 0 && i.push(t);
|
|
122
122
|
}
|
|
123
123
|
return i;
|
|
124
|
-
},
|
|
125
|
-
_tag:
|
|
126
|
-
revision:
|
|
124
|
+
}, b = (e) => m.Union(m.Struct({
|
|
125
|
+
_tag: m.Literal("snapshot"),
|
|
126
|
+
revision: m.Number,
|
|
127
127
|
data: e,
|
|
128
|
-
computed:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
128
|
+
computed: m.optional(m.Boolean),
|
|
129
|
+
reconciles: m.optional(m.String)
|
|
130
|
+
}), m.Struct({
|
|
131
|
+
_tag: m.Literal("delta"),
|
|
132
|
+
revision: m.Number,
|
|
133
|
+
emittedAt: m.Number,
|
|
134
|
+
patch: Ye
|
|
135
|
+
}), m.Struct({
|
|
136
|
+
_tag: m.Literal("error"),
|
|
137
|
+
error: m.Unknown,
|
|
138
|
+
revision: m.optional(m.Number)
|
|
139
|
+
})), x = (e, t) => {
|
|
139
140
|
let n = `${e ?? "this procedure"} input`;
|
|
140
141
|
return t === !0 ? `${n} (guarded — the guard did NOT run: the payload failed to decode first, so this says nothing about access)` : n;
|
|
141
|
-
},
|
|
142
|
+
}, et = (e) => {
|
|
142
143
|
let t = e.ast;
|
|
143
144
|
return t._tag === "TypeLiteral" && (t.propertySignatures?.length ?? 0) === 0 && (t.indexSignatures?.length ?? 0) === 0;
|
|
144
|
-
},
|
|
145
|
-
let r =
|
|
145
|
+
}, S = (e, t, n) => {
|
|
146
|
+
let r = x(t, n), i = e.annotations({
|
|
146
147
|
parseOptions: { onExcessProperty: "error" },
|
|
147
148
|
parseIssueTitle: () => r
|
|
148
149
|
});
|
|
149
|
-
return
|
|
150
|
-
},
|
|
151
|
-
rule:
|
|
152
|
-
params:
|
|
153
|
-
key:
|
|
154
|
-
value:
|
|
150
|
+
return et(e) ? m.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 m.TaggedError()("BusinessRuleViolation", {
|
|
152
|
+
rule: m.String,
|
|
153
|
+
params: m.optional(m.Record({
|
|
154
|
+
key: m.String,
|
|
155
|
+
value: m.Unknown
|
|
155
156
|
})),
|
|
156
|
-
field:
|
|
157
|
-
message:
|
|
158
|
-
severity:
|
|
159
|
-
}) {},
|
|
160
|
-
field:
|
|
161
|
-
message:
|
|
162
|
-
params:
|
|
163
|
-
key:
|
|
164
|
-
value:
|
|
157
|
+
field: m.optional(m.String),
|
|
158
|
+
message: m.optional(m.String),
|
|
159
|
+
severity: m.Literal("error", "warning")
|
|
160
|
+
}) {}, nt = m.Struct({
|
|
161
|
+
field: m.String,
|
|
162
|
+
message: m.String,
|
|
163
|
+
params: m.optional(m.Record({
|
|
164
|
+
key: m.String,
|
|
165
|
+
value: m.Unknown
|
|
165
166
|
}))
|
|
166
|
-
}),
|
|
167
|
-
field:
|
|
168
|
-
message:
|
|
169
|
-
params:
|
|
170
|
-
key:
|
|
171
|
-
value:
|
|
167
|
+
}), rt = class extends m.TaggedError()("ValidationError", {
|
|
168
|
+
field: m.String,
|
|
169
|
+
message: m.String,
|
|
170
|
+
params: m.optional(m.Record({
|
|
171
|
+
key: m.String,
|
|
172
|
+
value: m.Unknown
|
|
172
173
|
}))
|
|
173
|
-
}) {},
|
|
174
|
+
}) {}, it = class extends m.TaggedError()("ValidationErrors", { issues: m.Array(nt).pipe(m.minItems(1)) }) {}, at = (e) => {
|
|
174
175
|
if (typeof e != "object" || !e) return [];
|
|
175
176
|
let t = e._tag;
|
|
176
177
|
if (t === "ValidationError") {
|
|
@@ -196,69 +197,69 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
196
197
|
}];
|
|
197
198
|
}
|
|
198
199
|
return [];
|
|
199
|
-
},
|
|
200
|
-
approvalId:
|
|
201
|
-
procedure:
|
|
202
|
-
expiresAt:
|
|
203
|
-
requiredScopes:
|
|
204
|
-
reason:
|
|
205
|
-
created:
|
|
206
|
-
}) {},
|
|
207
|
-
approvalId:
|
|
208
|
-
subjectId:
|
|
209
|
-
}) {},
|
|
210
|
-
approvalId:
|
|
211
|
-
decidedBy:
|
|
212
|
-
note:
|
|
213
|
-
}) {},
|
|
214
|
-
approvalId:
|
|
215
|
-
expiredAt:
|
|
216
|
-
}) {},
|
|
217
|
-
approvalId:
|
|
218
|
-
status:
|
|
219
|
-
}) {},
|
|
220
|
-
approvalId:
|
|
221
|
-
required:
|
|
222
|
-
message:
|
|
223
|
-
}) {},
|
|
224
|
-
procedure:
|
|
225
|
-
message:
|
|
226
|
-
}) {},
|
|
227
|
-
id:
|
|
228
|
-
procedure:
|
|
229
|
-
kind:
|
|
230
|
-
requestedBy:
|
|
231
|
-
status:
|
|
232
|
-
reason:
|
|
233
|
-
requiredScopes:
|
|
234
|
-
requestedAt:
|
|
235
|
-
expiresAt:
|
|
236
|
-
decidedBy:
|
|
237
|
-
decidedAt:
|
|
238
|
-
note:
|
|
239
|
-
relation:
|
|
240
|
-
}),
|
|
241
|
-
if (!
|
|
200
|
+
}, ot = class extends m.TaggedError()("ApprovalRequired", {
|
|
201
|
+
approvalId: m.String,
|
|
202
|
+
procedure: m.String,
|
|
203
|
+
expiresAt: m.String,
|
|
204
|
+
requiredScopes: m.Array(m.String),
|
|
205
|
+
reason: m.NullOr(m.String),
|
|
206
|
+
created: m.Boolean
|
|
207
|
+
}) {}, st = class extends m.TaggedError()("ApprovalNotFound", { approvalId: m.String }) {}, ct = class extends m.TaggedError()("ApprovalSelfApproval", {
|
|
208
|
+
approvalId: m.String,
|
|
209
|
+
subjectId: m.NullOr(m.String)
|
|
210
|
+
}) {}, lt = class extends m.TaggedError()("ApprovalRejected", {
|
|
211
|
+
approvalId: m.String,
|
|
212
|
+
decidedBy: m.NullOr(m.String),
|
|
213
|
+
note: m.NullOr(m.String)
|
|
214
|
+
}) {}, C = class extends m.TaggedError()("ApprovalExpired", {
|
|
215
|
+
approvalId: m.String,
|
|
216
|
+
expiredAt: m.String
|
|
217
|
+
}) {}, ut = class extends m.TaggedError()("ApprovalNotPending", {
|
|
218
|
+
approvalId: m.String,
|
|
219
|
+
status: m.String
|
|
220
|
+
}) {}, dt = class extends m.TaggedError()("ApprovalForbidden", {
|
|
221
|
+
approvalId: m.String,
|
|
222
|
+
required: m.NullOr(m.String),
|
|
223
|
+
message: m.String
|
|
224
|
+
}) {}, w = class extends m.TaggedError()("ApprovalUnavailable", {
|
|
225
|
+
procedure: m.String,
|
|
226
|
+
message: m.String
|
|
227
|
+
}) {}, ft = m.Union(ot, lt, C, w), pt = m.Union(st, ct, C, ut, dt, w), mt = m.Struct({
|
|
228
|
+
id: m.String,
|
|
229
|
+
procedure: m.String,
|
|
230
|
+
kind: m.Literal("mutation", "action"),
|
|
231
|
+
requestedBy: m.NullOr(m.String),
|
|
232
|
+
status: m.Literal("pending", "approved", "rejected", "expired", "consumed"),
|
|
233
|
+
reason: m.NullOr(m.String),
|
|
234
|
+
requiredScopes: m.Array(m.String),
|
|
235
|
+
requestedAt: m.String,
|
|
236
|
+
expiresAt: m.String,
|
|
237
|
+
decidedBy: m.NullOr(m.String),
|
|
238
|
+
decidedAt: m.NullOr(m.String),
|
|
239
|
+
note: m.NullOr(m.String),
|
|
240
|
+
relation: m.Literal("to-decide", "requested")
|
|
241
|
+
}), T = "channel:", ht = Symbol.for("@voltro/protocol/reactivityChannels"), gt = globalThis, E = gt[ht] ?? (gt[ht] = /* @__PURE__ */ new Map()), _t = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, vt = (e) => {
|
|
242
|
+
if (!_t.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
|
|
242
243
|
\`billing.usage\`. A \`:\` is refused because it is the namespace separator in
|
|
243
|
-
the routing key (\`${
|
|
244
|
+
the routing key (\`${T}<name>\`), and an uppercase letter is\n refused because a key that differs only by case reads as one channel and
|
|
244
245
|
routes as two.`);
|
|
245
|
-
let t =
|
|
246
|
+
let t = E.get(e);
|
|
246
247
|
if (t !== void 0) return t;
|
|
247
|
-
let n = `${
|
|
248
|
+
let n = `${T}${e}`, r = Object.freeze({
|
|
248
249
|
kind: "reactivity-channel",
|
|
249
250
|
name: e,
|
|
250
251
|
key: n,
|
|
251
252
|
toString: () => n
|
|
252
253
|
});
|
|
253
|
-
return
|
|
254
|
-
},
|
|
255
|
-
let t =
|
|
256
|
-
for (let r of e) for (let e of
|
|
254
|
+
return E.set(e, r), r;
|
|
255
|
+
}, D = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", O = (e) => e.startsWith(T), k = () => new Set([...E.values()].map((e) => e.key)), A = (e) => D(e) ? e.key : e, j = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(A) : [A(e)], M = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(A) : A(e), yt = (e) => {
|
|
256
|
+
let t = k(), n = [];
|
|
257
|
+
for (let r of e) for (let e of j(r.source)) O(e) && !t.has(e) && n.push({
|
|
257
258
|
procedure: r.name,
|
|
258
259
|
key: e
|
|
259
260
|
});
|
|
260
261
|
return n;
|
|
261
|
-
},
|
|
262
|
+
}, bt = (e, t) => {
|
|
262
263
|
let n = e?.injectExternalChange;
|
|
263
264
|
return n !== void 0 && (n.call(e, {
|
|
264
265
|
table: t.key,
|
|
@@ -267,8 +268,8 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
267
268
|
old: {},
|
|
268
269
|
origin: "inline"
|
|
269
270
|
}), !0);
|
|
270
|
-
},
|
|
271
|
-
if (
|
|
271
|
+
}, xt = (e) => e.internal !== !0, N = (e) => {
|
|
272
|
+
if (St(e), e.idempotencyScope !== void 0 && e.idempotencyScope !== "subject" && e.idempotencyScope !== "connection") throw Error(`${e.name}: idempotencyScope must be 'subject' or 'connection'`);
|
|
272
273
|
if (e.idempotencyScope === "connection" && (e.internal === !0 || e.publicApi !== void 0 || e.exposeAsTool !== void 0)) throw Error(`${e.name}: connection-scoped mutations require the native WebSocket RPC surface; internal, publicApi and exposeAsTool cannot establish its connection state`);
|
|
273
274
|
if (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
|
|
274
275
|
unguarded procedure, or list the scopes required to call it.`);
|
|
@@ -287,7 +288,7 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
287
288
|
let n = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
288
289
|
if (n.length === 0) return e;
|
|
289
290
|
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.`);
|
|
290
|
-
},
|
|
291
|
+
}, St = (e) => {
|
|
291
292
|
let t = e.requiresApproval;
|
|
292
293
|
if (t !== void 0) {
|
|
293
294
|
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
|
|
@@ -297,49 +298,49 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
297
298
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
298
299
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
299
300
|
}
|
|
300
|
-
},
|
|
301
|
+
}, Ct = (e) => e.action !== void 0 && e.resourceType !== void 0, wt = (e) => e.authenticated === !0, Tt = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, P = (e, t, n) => {
|
|
301
302
|
if (n === void 0) return t;
|
|
302
303
|
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
|
|
303
304
|
without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
|
|
304
305
|
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
|
|
305
306
|
caller must hold a scope; drop them if anyone may call it.`);
|
|
306
307
|
return [f(n.trim())];
|
|
307
|
-
},
|
|
308
|
+
}, F = (e) => N({
|
|
308
309
|
kind: "query",
|
|
309
310
|
name: e.name,
|
|
310
311
|
input: e.input,
|
|
311
312
|
output: e.output,
|
|
312
|
-
error: e.error ??
|
|
313
|
-
source:
|
|
313
|
+
error: e.error ?? m.Never,
|
|
314
|
+
source: M(e.source),
|
|
314
315
|
cache: e.cache,
|
|
315
|
-
guards:
|
|
316
|
+
guards: P(e.name, e.guards, e.openAccess),
|
|
316
317
|
openAccess: e.openAccess,
|
|
317
318
|
publicApi: e.publicApi,
|
|
318
319
|
exposeAsTool: e.exposeAsTool,
|
|
319
320
|
internal: e.internal,
|
|
320
321
|
overridesPlugin: e.overridesPlugin
|
|
321
|
-
}),
|
|
322
|
+
}), I = (e) => N({
|
|
322
323
|
kind: "mutation",
|
|
323
324
|
name: e.name,
|
|
324
325
|
input: e.input,
|
|
325
326
|
output: e.output,
|
|
326
|
-
error: e.error ??
|
|
327
|
+
error: e.error ?? m.Never,
|
|
327
328
|
...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
|
|
328
329
|
target: e.target,
|
|
329
|
-
guards:
|
|
330
|
+
guards: P(e.name, e.guards, e.openAccess),
|
|
330
331
|
openAccess: e.openAccess,
|
|
331
332
|
publicApi: e.publicApi,
|
|
332
333
|
exposeAsTool: e.exposeAsTool,
|
|
333
334
|
requiresApproval: e.requiresApproval,
|
|
334
335
|
internal: e.internal,
|
|
335
336
|
overridesPlugin: e.overridesPlugin
|
|
336
|
-
}),
|
|
337
|
+
}), L = (e) => N({
|
|
337
338
|
kind: "action",
|
|
338
339
|
name: e.name,
|
|
339
340
|
input: e.input,
|
|
340
341
|
output: e.output,
|
|
341
|
-
error: e.error ??
|
|
342
|
-
guards:
|
|
342
|
+
error: e.error ?? m.Never,
|
|
343
|
+
guards: P(e.name, e.guards, e.openAccess),
|
|
343
344
|
openAccess: e.openAccess,
|
|
344
345
|
source: e.source,
|
|
345
346
|
target: e.target,
|
|
@@ -348,55 +349,55 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
348
349
|
requiresApproval: e.requiresApproval,
|
|
349
350
|
internal: e.internal,
|
|
350
351
|
overridesPlugin: e.overridesPlugin
|
|
351
|
-
}),
|
|
352
|
+
}), Et = (e) => N({
|
|
352
353
|
kind: "stream",
|
|
353
354
|
name: e.name,
|
|
354
355
|
input: e.input,
|
|
355
356
|
element: e.element,
|
|
356
|
-
error: e.error ??
|
|
357
|
+
error: e.error ?? m.Never,
|
|
357
358
|
internal: e.internal,
|
|
358
359
|
overridesPlugin: e.overridesPlugin,
|
|
359
|
-
guards:
|
|
360
|
+
guards: P(e.name, e.guards, e.openAccess),
|
|
360
361
|
openAccess: e.openAccess
|
|
361
|
-
}),
|
|
362
|
+
}), R = (e, t) => t && t.length > 0 ? m.Union(e, ...t) : e, z = (e) => e !== void 0 && e.some((e) => !d(e)), Dt = (e, t) => z(t) ? m.Union(e, u, l) : e, Ot = (e) => m.Union(e, tt), kt = (e) => m.Union(e, rt, it), At = (e, t) => t === void 0 ? e : m.Union(e, ft), B = (e, t) => {
|
|
362
363
|
if (t === "stream") return e.error;
|
|
363
|
-
let n =
|
|
364
|
+
let n = Dt(e.error, e.guards);
|
|
364
365
|
if (t === "query") return n;
|
|
365
|
-
let r = t === "mutation" ?
|
|
366
|
-
return kt(
|
|
367
|
-
},
|
|
366
|
+
let r = t === "mutation" ? m.Union(Ot(n), Ne, Ge) : n;
|
|
367
|
+
return At(kt(t === "mutation" && e.idempotencyScope === "connection" ? m.Union(r, p) : r), e.requiresApproval);
|
|
368
|
+
}, jt = (e, t) => R(Dt(e.errorSchema, e.guards), t), Mt = (e, t) => ({
|
|
368
369
|
...e,
|
|
369
370
|
name: t
|
|
370
|
-
}),
|
|
371
|
-
payload:
|
|
372
|
-
success:
|
|
373
|
-
error:
|
|
371
|
+
}), Nt = (e, t) => h.make(e.name, {
|
|
372
|
+
payload: S(e.input, e.name, z(e.guards)),
|
|
373
|
+
success: b(e.output),
|
|
374
|
+
error: R(B(e, "query"), t),
|
|
374
375
|
stream: !0
|
|
375
|
-
}),
|
|
376
|
-
payload:
|
|
376
|
+
}), Pt = (e, t) => h.make(e.name, {
|
|
377
|
+
payload: S(e.input, e.name, z(e.guards)),
|
|
377
378
|
success: e.output,
|
|
378
|
-
error:
|
|
379
|
-
}),
|
|
380
|
-
payload:
|
|
379
|
+
error: R(B(e, "mutation"), t)
|
|
380
|
+
}), Ft = (e, t) => h.make(e.name, {
|
|
381
|
+
payload: S(e.input, e.name, z(e.guards)),
|
|
381
382
|
success: e.output,
|
|
382
|
-
error:
|
|
383
|
-
}),
|
|
384
|
-
payload:
|
|
383
|
+
error: R(B(e, "action"), t)
|
|
384
|
+
}), It = (e, t) => h.make(e.name, {
|
|
385
|
+
payload: S(e.input, e.name, z(e.guards)),
|
|
385
386
|
success: e.element,
|
|
386
|
-
error:
|
|
387
|
+
error: R(e.error, t),
|
|
387
388
|
stream: !0
|
|
388
|
-
}),
|
|
389
|
+
}), Lt = (e) => {
|
|
389
390
|
if (typeof e != "object" || !e) return;
|
|
390
391
|
let t = e._tag;
|
|
391
392
|
return typeof t == "string" ? t : void 0;
|
|
392
|
-
},
|
|
393
|
+
}, Rt = (e) => {
|
|
393
394
|
switch (e.kind) {
|
|
394
|
-
case "query": return
|
|
395
|
-
case "mutation": return
|
|
396
|
-
case "action": return
|
|
397
|
-
case "stream": return
|
|
395
|
+
case "query": return Nt(e);
|
|
396
|
+
case "mutation": return Pt(e);
|
|
397
|
+
case "action": return Ft(e);
|
|
398
|
+
case "stream": return It(e);
|
|
398
399
|
}
|
|
399
|
-
},
|
|
400
|
+
}, zt = (e) => {
|
|
400
401
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
401
402
|
if (e.kind === "query") return {
|
|
402
403
|
kind: "query",
|
|
@@ -440,7 +441,7 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
440
441
|
..."relations" in e && e.relations !== void 0 ? { relations: e.relations } : {}
|
|
441
442
|
}))
|
|
442
443
|
};
|
|
443
|
-
},
|
|
444
|
+
}, Bt = 7500, Vt = (e) => typeof e == "object" && !!e && e.kind === "event", Ht = (e) => {
|
|
444
445
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
445
446
|
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
|
|
446
447
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -475,60 +476,60 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
475
476
|
webhook: e.webhook,
|
|
476
477
|
delivery: e.delivery
|
|
477
478
|
};
|
|
478
|
-
},
|
|
479
|
-
_tag:
|
|
480
|
-
origin:
|
|
481
|
-
n:
|
|
482
|
-
emittedAt:
|
|
479
|
+
}, Ut = (e) => m.Struct({
|
|
480
|
+
_tag: m.Literal("event"),
|
|
481
|
+
origin: m.String,
|
|
482
|
+
n: m.Number,
|
|
483
|
+
emittedAt: m.Number,
|
|
483
484
|
payload: e
|
|
484
|
-
}),
|
|
485
|
-
_tag:
|
|
486
|
-
missed:
|
|
487
|
-
reason:
|
|
488
|
-
}),
|
|
489
|
-
origin:
|
|
490
|
-
n:
|
|
491
|
-
}),
|
|
485
|
+
}), Wt = m.Struct({
|
|
486
|
+
_tag: m.Literal("gap"),
|
|
487
|
+
missed: m.Number,
|
|
488
|
+
reason: m.Literal("buffer", "resume")
|
|
489
|
+
}), Gt = m.Struct({ _tag: m.Literal("attached") }), Kt = (e) => m.Union(Gt, Ut(e), Wt), qt = m.Struct({
|
|
490
|
+
origin: m.String,
|
|
491
|
+
n: m.Number
|
|
492
|
+
}), Jt = (e) => m.Struct({
|
|
492
493
|
key: e,
|
|
493
|
-
resume:
|
|
494
|
-
}),
|
|
495
|
-
let n = e.guards !== void 0 && e.guards.some((e) => !d(e)) ?
|
|
496
|
-
return
|
|
497
|
-
payload:
|
|
498
|
-
success:
|
|
494
|
+
resume: m.optional(m.Array(qt))
|
|
495
|
+
}), Yt = (e, t) => {
|
|
496
|
+
let n = e.guards !== void 0 && e.guards.some((e) => !d(e)) ? m.Union(u, l) : m.Never, r = t && t.length > 0 ? m.Union(n, ...t) : n;
|
|
497
|
+
return h.make(e.name, {
|
|
498
|
+
payload: S(Jt(e.key), e.name, z(e.guards)),
|
|
499
|
+
success: Kt(e.payload),
|
|
499
500
|
error: r,
|
|
500
501
|
stream: !0
|
|
501
502
|
});
|
|
502
|
-
},
|
|
503
|
-
event:
|
|
504
|
-
message:
|
|
505
|
-
}) {},
|
|
506
|
-
event:
|
|
507
|
-
message:
|
|
508
|
-
}) {},
|
|
509
|
-
event:
|
|
510
|
-
bytes:
|
|
511
|
-
limit:
|
|
512
|
-
}) {},
|
|
503
|
+
}, Xt = class extends m.TaggedError()("EventPayloadInvalid", {
|
|
504
|
+
event: m.String,
|
|
505
|
+
message: m.String
|
|
506
|
+
}) {}, Zt = class extends m.TaggedError()("EventKeyInvalid", {
|
|
507
|
+
event: m.String,
|
|
508
|
+
message: m.String
|
|
509
|
+
}) {}, Qt = class extends m.TaggedError()("EventPayloadTooLarge", {
|
|
510
|
+
event: m.String,
|
|
511
|
+
bytes: m.Number,
|
|
512
|
+
limit: m.Number
|
|
513
|
+
}) {}, $t = (e) => {
|
|
513
514
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
514
515
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
515
516
|
return JSON.stringify(t);
|
|
516
|
-
},
|
|
517
|
+
}, en = "\0", tn = (e, t, n) => [
|
|
517
518
|
e ?? "~",
|
|
518
519
|
t,
|
|
519
|
-
|
|
520
|
-
].join("\0"),
|
|
520
|
+
$t(n)
|
|
521
|
+
].join("\0"), nn = (e) => {
|
|
521
522
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
522
523
|
return {
|
|
523
524
|
tenantId: t === "~" ? null : t,
|
|
524
525
|
event: n,
|
|
525
526
|
key: r
|
|
526
527
|
};
|
|
527
|
-
},
|
|
528
|
+
}, rn = (e) => e.split("\0").join(" · "), V = Symbol.for("@voltro/protocol/workflow-access"), an = {
|
|
528
529
|
guards: void 0,
|
|
529
530
|
openAccess: void 0,
|
|
530
531
|
internal: !1
|
|
531
|
-
},
|
|
532
|
+
}, on = (e, t) => {
|
|
532
533
|
let n = t.guards;
|
|
533
534
|
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
|
|
534
535
|
and decide with \`openAccess\` or \`internal\`, or list the scopes that may start it.`);
|
|
@@ -548,37 +549,92 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
548
549
|
openAccess: t.openAccess?.trim(),
|
|
549
550
|
internal: t.internal === !0
|
|
550
551
|
};
|
|
551
|
-
},
|
|
552
|
-
Object.defineProperty(e,
|
|
552
|
+
}, sn = (e, t) => {
|
|
553
|
+
Object.defineProperty(e, V, {
|
|
553
554
|
value: t,
|
|
554
555
|
enumerable: !1
|
|
555
556
|
});
|
|
556
|
-
},
|
|
557
|
-
if (typeof e != "object" || !e) return
|
|
558
|
-
let t = e[
|
|
559
|
-
return t === void 0 ?
|
|
560
|
-
},
|
|
561
|
-
let t =
|
|
557
|
+
}, H = (e) => {
|
|
558
|
+
if (typeof e != "object" || !e) return an;
|
|
559
|
+
let t = e[V];
|
|
560
|
+
return t === void 0 ? an : t;
|
|
561
|
+
}, cn = (e) => {
|
|
562
|
+
let t = H(e);
|
|
562
563
|
return {
|
|
563
564
|
name: e.name,
|
|
564
565
|
internal: t.internal,
|
|
565
566
|
guards: t.guards,
|
|
566
567
|
openAccess: t.openAccess
|
|
567
568
|
};
|
|
568
|
-
},
|
|
569
|
+
}, ln = (e) => typeof e == "object" && !!e && typeof e._tag == "string", un = 64, U = (e, t = 0) => {
|
|
570
|
+
if (!ln(e)) return String(e);
|
|
571
|
+
if (t >= un) return "…";
|
|
572
|
+
let n = t + 1, r = (t) => U(e[t], n), i = (t) => Array.isArray(e[t]) ? e[t] : [];
|
|
573
|
+
switch (e._tag) {
|
|
574
|
+
case "Transformation": return `T(${r("from")}->${r("to")})`;
|
|
575
|
+
case "Refinement": return `R(${r("from")})`;
|
|
576
|
+
case "Suspend": return "S(…)";
|
|
577
|
+
case "TypeLiteral": {
|
|
578
|
+
let e = i("propertySignatures").map((e) => {
|
|
579
|
+
let t = e;
|
|
580
|
+
return `${String(t.name)}${t.isOptional === !0 ? "?" : ""}:${U(t.type, n)}`;
|
|
581
|
+
}).join(","), t = i("indexSignatures").map((e) => {
|
|
582
|
+
let t = e;
|
|
583
|
+
return `[${U(t.parameter, n)}]:${U(t.type, n)}`;
|
|
584
|
+
}).join(",");
|
|
585
|
+
return t === "" ? `{${e}}` : `{${e};${t}}`;
|
|
586
|
+
}
|
|
587
|
+
case "Union": return `U(${i("types").map((e) => U(e, n)).join("|")})`;
|
|
588
|
+
case "TupleType": {
|
|
589
|
+
let e = i("elements").map((e) => {
|
|
590
|
+
let t = e;
|
|
591
|
+
return `${U(t.type, n)}${t.isOptional === !0 ? "?" : ""}`;
|
|
592
|
+
}).join(","), t = i("rest").map((e) => U(e.type, n)).join(",");
|
|
593
|
+
return `A(${e}${t === "" ? "" : `...${t}`})`;
|
|
594
|
+
}
|
|
595
|
+
case "Declaration": return `D(${i("typeParameters").map((e) => U(e, n)).join(",")})`;
|
|
596
|
+
default: return String(e);
|
|
597
|
+
}
|
|
598
|
+
}, dn = (e) => {
|
|
599
|
+
let t = 2166136261;
|
|
600
|
+
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
601
|
+
return t.toString(16).padStart(8, "0");
|
|
602
|
+
}, fn = (e) => dn([
|
|
603
|
+
U(e.payloadSchema?.ast),
|
|
604
|
+
U(e.successSchema?.ast),
|
|
605
|
+
U(e.errorSchema?.ast)
|
|
606
|
+
].join("\0")), pn = (e) => {
|
|
607
|
+
let t = {}, n = e.requests, r = n instanceof Map ? n.entries() : Array.isArray(n) ? n.map((e, t) => [t, e]) : [];
|
|
608
|
+
for (let [, e] of r) {
|
|
609
|
+
if (typeof e != "object" && typeof e != "function" || e === null) continue;
|
|
610
|
+
let n = e;
|
|
611
|
+
typeof n._tag == "string" && (t[n._tag] = fn(n));
|
|
612
|
+
}
|
|
613
|
+
return t;
|
|
614
|
+
}, mn = (e, t) => {
|
|
615
|
+
let n = [], r = [];
|
|
616
|
+
for (let [i, a] of Object.entries(t)) {
|
|
617
|
+
let t = e[i];
|
|
618
|
+
t === void 0 ? r.push(i) : t !== a && n.push(i);
|
|
619
|
+
}
|
|
620
|
+
return {
|
|
621
|
+
differing: n.sort(),
|
|
622
|
+
missingHere: r.sort()
|
|
623
|
+
};
|
|
624
|
+
}, hn = (e) => e, gn = (e) => e, _n = (e) => {
|
|
569
625
|
let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
|
|
570
626
|
return n !== void 0 && n !== "" ? `${r}#${n}` : r;
|
|
571
|
-
},
|
|
627
|
+
}, vn = (e) => {
|
|
572
628
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
573
|
-
},
|
|
574
|
-
let n =
|
|
629
|
+
}, yn = (e, t) => {
|
|
630
|
+
let n = Ue.GenericTag(e);
|
|
575
631
|
return {
|
|
576
632
|
Tag: n,
|
|
577
|
-
Live:
|
|
633
|
+
Live: We.succeed(n, t)
|
|
578
634
|
};
|
|
579
|
-
},
|
|
635
|
+
}, bn = (e, t, n) => {
|
|
580
636
|
if (!t) return { ok: !0 };
|
|
581
|
-
let r = n === void 0 ? null :
|
|
637
|
+
let r = n === void 0 ? null : W(n);
|
|
582
638
|
if (!r) return {
|
|
583
639
|
ok: !0,
|
|
584
640
|
unverified: `plugin "${e}" requires framework ${t}, but the running framework version is ${n === void 0 ? "unknown" : `unreadable ("${n}")`} — not checked.`
|
|
@@ -586,12 +642,12 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
586
642
|
let i = t.trim();
|
|
587
643
|
if (i === "*" || i === "") return { ok: !0 };
|
|
588
644
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
589
|
-
for (let i of a) if (!
|
|
645
|
+
for (let i of a) if (!xn(i, r)) return {
|
|
590
646
|
ok: !1,
|
|
591
647
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
592
648
|
};
|
|
593
649
|
return { ok: !0 };
|
|
594
|
-
},
|
|
650
|
+
}, W = (e) => {
|
|
595
651
|
let t = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9a-zA-Z.-]+))?$/.exec(e.trim());
|
|
596
652
|
return t ? {
|
|
597
653
|
major: Number(t[1]),
|
|
@@ -599,273 +655,273 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
599
655
|
patch: Number(t[3]),
|
|
600
656
|
pre: t[4] ?? ""
|
|
601
657
|
} : null;
|
|
602
|
-
},
|
|
658
|
+
}, G = (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, xn = (e, t) => {
|
|
603
659
|
if (e === "*") return !0;
|
|
604
660
|
if (e.startsWith("^")) {
|
|
605
|
-
let n =
|
|
606
|
-
return !n || t.major !== n.major ? !1 :
|
|
661
|
+
let n = W(e.slice(1));
|
|
662
|
+
return !n || t.major !== n.major ? !1 : G(t, n) >= 0;
|
|
607
663
|
}
|
|
608
664
|
if (e.startsWith("~")) {
|
|
609
|
-
let n =
|
|
610
|
-
return !n || t.major !== n.major || t.minor !== n.minor ? !1 :
|
|
665
|
+
let n = W(e.slice(1));
|
|
666
|
+
return !n || t.major !== n.major || t.minor !== n.minor ? !1 : G(t, n) >= 0;
|
|
611
667
|
}
|
|
612
668
|
let n = /^(>=|<=|>|<)(.+)$/.exec(e);
|
|
613
669
|
if (n) {
|
|
614
|
-
let e = n[1], r =
|
|
670
|
+
let e = n[1], r = W(n[2]);
|
|
615
671
|
if (!r) return !1;
|
|
616
|
-
let i =
|
|
672
|
+
let i = G(t, r);
|
|
617
673
|
if (e === ">=") return i >= 0;
|
|
618
674
|
if (e === "<=") return i <= 0;
|
|
619
675
|
if (e === ">") return i > 0;
|
|
620
676
|
if (e === "<") return i < 0;
|
|
621
677
|
}
|
|
622
|
-
let r =
|
|
623
|
-
return r ?
|
|
624
|
-
},
|
|
678
|
+
let r = W(e);
|
|
679
|
+
return r ? G(t, r) === 0 : !1;
|
|
680
|
+
}, Sn = (e) => {
|
|
625
681
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
626
682
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
|
|
627
|
-
},
|
|
683
|
+
}, Cn = (e) => {
|
|
628
684
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
629
685
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
630
|
-
},
|
|
631
|
-
let e = globalThis, t = e[
|
|
686
|
+
}, wn = Symbol.for("@voltro/protocol/pluginAliases"), K = () => {
|
|
687
|
+
let e = globalThis, t = e[wn];
|
|
632
688
|
if (t instanceof Map) return t;
|
|
633
689
|
let n = /* @__PURE__ */ new Map();
|
|
634
|
-
return e[
|
|
635
|
-
},
|
|
636
|
-
let t =
|
|
690
|
+
return e[wn] = n, n;
|
|
691
|
+
}, Tn = (e) => {
|
|
692
|
+
let t = K();
|
|
637
693
|
for (let [n, r] of Object.entries(e)) {
|
|
638
694
|
if (r === "") continue;
|
|
639
695
|
let e = t.get(n);
|
|
640
696
|
e === void 0 ? t.set(n, /* @__PURE__ */ new Set([r])) : e.add(r);
|
|
641
697
|
}
|
|
642
|
-
},
|
|
643
|
-
|
|
644
|
-
},
|
|
645
|
-
let n =
|
|
646
|
-
if (n === void 0 || n.size === 0) return `${
|
|
698
|
+
}, En = () => {
|
|
699
|
+
K().clear();
|
|
700
|
+
}, Dn = (e, t) => {
|
|
701
|
+
let n = K().get(e);
|
|
702
|
+
if (n === void 0 || n.size === 0) return `${Sn(e)}.${t}`;
|
|
647
703
|
if (n.size === 1) return `${[...n][0]}.${t}`;
|
|
648
704
|
let r = [...n].filter((e) => !e.includes("#"));
|
|
649
705
|
if (r.length === 1) return `${r[0]}.${t}`;
|
|
650
706
|
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}').`);
|
|
651
|
-
},
|
|
652
|
-
mode:
|
|
653
|
-
dueAt:
|
|
654
|
-
retryAfterMs:
|
|
655
|
-
intentId:
|
|
656
|
-
}),
|
|
657
|
-
id:
|
|
658
|
-
workflowName:
|
|
659
|
-
executionId:
|
|
660
|
-
status:
|
|
661
|
-
deferral:
|
|
662
|
-
}),
|
|
663
|
-
let n =
|
|
664
|
-
return
|
|
665
|
-
payload:
|
|
666
|
-
success:
|
|
667
|
-
error:
|
|
707
|
+
}, q = m.Literal("running", "succeeded", "failed", "cancelled", "suspended"), On = m.Literal("cancel", "terminate", "abandon"), kn = m.Struct({
|
|
708
|
+
mode: m.String,
|
|
709
|
+
dueAt: m.NullOr(m.Number),
|
|
710
|
+
retryAfterMs: m.NullOr(m.Number),
|
|
711
|
+
intentId: m.NullOr(m.String)
|
|
712
|
+
}), An = m.Struct({
|
|
713
|
+
id: m.String,
|
|
714
|
+
workflowName: m.String,
|
|
715
|
+
executionId: m.NullOr(m.String),
|
|
716
|
+
status: m.Literal("running", "queued", "dropped", "skipped", "replayed"),
|
|
717
|
+
deferral: m.optional(kn)
|
|
718
|
+
}), jn = (e, t) => {
|
|
719
|
+
let n = H(e);
|
|
720
|
+
return h.make(e.name, {
|
|
721
|
+
payload: S(e.payloadSchema, e.name, z(n.guards)),
|
|
722
|
+
success: An,
|
|
723
|
+
error: jt({
|
|
668
724
|
errorSchema: e.errorSchema,
|
|
669
725
|
guards: n.guards
|
|
670
726
|
}, t)
|
|
671
727
|
});
|
|
672
|
-
},
|
|
673
|
-
id:
|
|
674
|
-
tag:
|
|
675
|
-
executionId:
|
|
676
|
-
status:
|
|
677
|
-
payload:
|
|
678
|
-
workflowVersion:
|
|
679
|
-
workflowPatches:
|
|
680
|
-
output:
|
|
681
|
-
subject:
|
|
682
|
-
source:
|
|
683
|
-
errorTag:
|
|
684
|
-
errorMessage:
|
|
685
|
-
cancelled:
|
|
686
|
-
startedAt:
|
|
687
|
-
completedAt:
|
|
688
|
-
durationMs:
|
|
689
|
-
traceId:
|
|
690
|
-
parentExecutionId:
|
|
691
|
-
parentClosePolicy:
|
|
692
|
-
}),
|
|
693
|
-
tag:
|
|
694
|
-
status:
|
|
695
|
-
limit:
|
|
696
|
-
}),
|
|
697
|
-
id:
|
|
698
|
-
runId:
|
|
699
|
-
stepName:
|
|
700
|
-
attempt:
|
|
701
|
-
status:
|
|
702
|
-
input:
|
|
703
|
-
retryPolicy:
|
|
704
|
-
output:
|
|
705
|
-
errorTag:
|
|
706
|
-
errorMessage:
|
|
707
|
-
errorCause:
|
|
708
|
-
startedAt:
|
|
709
|
-
completedAt:
|
|
710
|
-
durationMs:
|
|
711
|
-
}),
|
|
712
|
-
id:
|
|
713
|
-
runId:
|
|
714
|
-
eventType:
|
|
715
|
-
payload:
|
|
716
|
-
occurredAt:
|
|
717
|
-
stepName:
|
|
718
|
-
attempt:
|
|
719
|
-
}),
|
|
720
|
-
id:
|
|
721
|
-
name:
|
|
722
|
-
payload:
|
|
723
|
-
source:
|
|
724
|
-
subject:
|
|
725
|
-
traceId:
|
|
726
|
-
occurredAt:
|
|
727
|
-
}),
|
|
728
|
-
id:
|
|
729
|
-
eventId:
|
|
730
|
-
eventName:
|
|
731
|
-
triggerId:
|
|
732
|
-
workflowName:
|
|
733
|
-
executionId:
|
|
734
|
-
status:
|
|
735
|
-
idempotencyKey:
|
|
736
|
-
skipped:
|
|
737
|
-
errorMessage:
|
|
738
|
-
createdAt:
|
|
739
|
-
completedAt:
|
|
740
|
-
}),
|
|
741
|
-
name:
|
|
742
|
-
limit:
|
|
743
|
-
}),
|
|
744
|
-
workflowName:
|
|
745
|
-
executionId:
|
|
746
|
-
}),
|
|
747
|
-
id:
|
|
748
|
-
signalName:
|
|
749
|
-
payload:
|
|
750
|
-
}),
|
|
751
|
-
id:
|
|
752
|
-
updateName:
|
|
753
|
-
payload:
|
|
754
|
-
timeoutMs:
|
|
755
|
-
}),
|
|
756
|
-
eventId:
|
|
757
|
-
updateId:
|
|
758
|
-
completedEventId:
|
|
759
|
-
result:
|
|
760
|
-
}),
|
|
728
|
+
}, J = m.Struct({
|
|
729
|
+
id: m.String,
|
|
730
|
+
tag: m.String,
|
|
731
|
+
executionId: m.String,
|
|
732
|
+
status: q,
|
|
733
|
+
payload: m.Unknown,
|
|
734
|
+
workflowVersion: m.NullOr(m.String),
|
|
735
|
+
workflowPatches: m.NullOr(m.Unknown),
|
|
736
|
+
output: m.NullOr(m.Unknown),
|
|
737
|
+
subject: m.NullOr(m.Unknown),
|
|
738
|
+
source: m.NullOr(m.String),
|
|
739
|
+
errorTag: m.NullOr(m.String),
|
|
740
|
+
errorMessage: m.NullOr(m.String),
|
|
741
|
+
cancelled: m.Boolean,
|
|
742
|
+
startedAt: m.Date,
|
|
743
|
+
completedAt: m.NullOr(m.Date),
|
|
744
|
+
durationMs: m.NullOr(m.Number),
|
|
745
|
+
traceId: m.NullOr(m.String),
|
|
746
|
+
parentExecutionId: m.NullOr(m.String),
|
|
747
|
+
parentClosePolicy: m.NullOr(On)
|
|
748
|
+
}), Mn = m.Struct({
|
|
749
|
+
tag: m.optional(m.String),
|
|
750
|
+
status: m.optional(q),
|
|
751
|
+
limit: m.optional(m.Number)
|
|
752
|
+
}), Nn = m.Struct({
|
|
753
|
+
id: m.String,
|
|
754
|
+
runId: m.String,
|
|
755
|
+
stepName: m.String,
|
|
756
|
+
attempt: m.Number,
|
|
757
|
+
status: m.Literal("running", "succeeded", "failed"),
|
|
758
|
+
input: m.NullOr(m.Unknown),
|
|
759
|
+
retryPolicy: m.NullOr(m.Unknown),
|
|
760
|
+
output: m.NullOr(m.Unknown),
|
|
761
|
+
errorTag: m.NullOr(m.String),
|
|
762
|
+
errorMessage: m.NullOr(m.String),
|
|
763
|
+
errorCause: m.NullOr(m.Unknown),
|
|
764
|
+
startedAt: m.Date,
|
|
765
|
+
completedAt: m.NullOr(m.Date),
|
|
766
|
+
durationMs: m.NullOr(m.Number)
|
|
767
|
+
}), Pn = m.Struct({
|
|
768
|
+
id: m.String,
|
|
769
|
+
runId: m.String,
|
|
770
|
+
eventType: m.String,
|
|
771
|
+
payload: m.NullOr(m.Unknown),
|
|
772
|
+
occurredAt: m.Date,
|
|
773
|
+
stepName: m.NullOr(m.String),
|
|
774
|
+
attempt: m.NullOr(m.Number)
|
|
775
|
+
}), Fn = m.Struct({
|
|
776
|
+
id: m.String,
|
|
777
|
+
name: m.String,
|
|
778
|
+
payload: m.Unknown,
|
|
779
|
+
source: m.String,
|
|
780
|
+
subject: m.NullOr(m.Unknown),
|
|
781
|
+
traceId: m.NullOr(m.String),
|
|
782
|
+
occurredAt: m.Date
|
|
783
|
+
}), In = m.Struct({
|
|
784
|
+
id: m.String,
|
|
785
|
+
eventId: m.String,
|
|
786
|
+
eventName: m.String,
|
|
787
|
+
triggerId: m.String,
|
|
788
|
+
workflowName: m.String,
|
|
789
|
+
executionId: m.NullOr(m.String),
|
|
790
|
+
status: m.Literal("starting", "started", "skipped", "failed"),
|
|
791
|
+
idempotencyKey: m.String,
|
|
792
|
+
skipped: m.Boolean,
|
|
793
|
+
errorMessage: m.NullOr(m.String),
|
|
794
|
+
createdAt: m.Date,
|
|
795
|
+
completedAt: m.NullOr(m.Date)
|
|
796
|
+
}), Ln = m.Struct({ id: m.String }), Y = m.Struct({ runId: m.String }), Rn = m.Struct({
|
|
797
|
+
name: m.optional(m.String),
|
|
798
|
+
limit: m.optional(m.Number)
|
|
799
|
+
}), zn = m.Struct({ eventId: m.String }), X = m.Struct({
|
|
800
|
+
workflowName: m.String,
|
|
801
|
+
executionId: m.String
|
|
802
|
+
}), Bn = m.Struct({
|
|
803
|
+
id: m.String,
|
|
804
|
+
signalName: m.String,
|
|
805
|
+
payload: m.optional(m.Unknown)
|
|
806
|
+
}), Vn = m.Struct({
|
|
807
|
+
id: m.String,
|
|
808
|
+
updateName: m.String,
|
|
809
|
+
payload: m.optional(m.Unknown),
|
|
810
|
+
timeoutMs: m.optional(m.Number)
|
|
811
|
+
}), Hn = m.Struct({
|
|
812
|
+
eventId: m.String,
|
|
813
|
+
updateId: m.String,
|
|
814
|
+
completedEventId: m.String,
|
|
815
|
+
result: m.Unknown
|
|
816
|
+
}), Un = F({
|
|
761
817
|
name: "__voltro.workflow.run",
|
|
762
818
|
source: "_voltro_workflow_runs",
|
|
763
|
-
input:
|
|
764
|
-
output:
|
|
765
|
-
}),
|
|
819
|
+
input: Ln,
|
|
820
|
+
output: m.Array(J)
|
|
821
|
+
}), Wn = F({
|
|
766
822
|
name: "__voltro.workflow.runs",
|
|
767
823
|
source: "_voltro_workflow_runs",
|
|
768
|
-
input:
|
|
769
|
-
output:
|
|
770
|
-
}),
|
|
824
|
+
input: Mn,
|
|
825
|
+
output: m.Array(J)
|
|
826
|
+
}), Gn = F({
|
|
771
827
|
name: "__voltro.workflow.run.steps",
|
|
772
828
|
source: "_voltro_workflow_run_steps",
|
|
773
|
-
input:
|
|
774
|
-
output:
|
|
775
|
-
}),
|
|
829
|
+
input: Y,
|
|
830
|
+
output: m.Array(Nn)
|
|
831
|
+
}), Kn = F({
|
|
776
832
|
name: "__voltro.workflow.run.events",
|
|
777
833
|
source: "_voltro_workflow_run_events",
|
|
778
|
-
input:
|
|
779
|
-
output:
|
|
780
|
-
}),
|
|
834
|
+
input: Y,
|
|
835
|
+
output: m.Array(Pn)
|
|
836
|
+
}), qn = F({
|
|
781
837
|
name: "__voltro.workflow.domainEvents",
|
|
782
838
|
source: "_voltro_workflow_events",
|
|
783
|
-
input:
|
|
784
|
-
output:
|
|
785
|
-
}),
|
|
839
|
+
input: Rn,
|
|
840
|
+
output: m.Array(Fn)
|
|
841
|
+
}), Jn = F({
|
|
786
842
|
name: "__voltro.workflow.event.deliveries",
|
|
787
843
|
source: "_voltro_workflow_event_deliveries",
|
|
788
|
-
input:
|
|
789
|
-
output:
|
|
790
|
-
}),
|
|
844
|
+
input: zn,
|
|
845
|
+
output: m.Array(In)
|
|
846
|
+
}), Yn = L({
|
|
791
847
|
name: "__voltro.workflow.cancel",
|
|
792
|
-
input:
|
|
793
|
-
output:
|
|
794
|
-
}),
|
|
848
|
+
input: X,
|
|
849
|
+
output: m.Struct({ ok: m.Boolean })
|
|
850
|
+
}), Xn = L({
|
|
795
851
|
name: "__voltro.workflow.resume",
|
|
796
|
-
input:
|
|
797
|
-
output:
|
|
798
|
-
}),
|
|
852
|
+
input: X,
|
|
853
|
+
output: m.Struct({ ok: m.Boolean })
|
|
854
|
+
}), Zn = L({
|
|
799
855
|
name: "__voltro.workflow.signal",
|
|
800
|
-
input:
|
|
801
|
-
output:
|
|
802
|
-
}),
|
|
856
|
+
input: Bn,
|
|
857
|
+
output: m.Struct({ eventId: m.String })
|
|
858
|
+
}), Qn = L({
|
|
803
859
|
name: "__voltro.workflow.update",
|
|
804
|
-
input:
|
|
805
|
-
output:
|
|
806
|
-
}),
|
|
807
|
-
id:
|
|
808
|
-
tag:
|
|
809
|
-
label:
|
|
810
|
-
undone:
|
|
811
|
-
crossesAction:
|
|
812
|
-
createdAt:
|
|
813
|
-
}),
|
|
814
|
-
invocationId:
|
|
815
|
-
reason:
|
|
816
|
-
}) {},
|
|
817
|
-
name:
|
|
860
|
+
input: Vn,
|
|
861
|
+
output: Hn
|
|
862
|
+
}), $n = "__voltro.undo.log", er = "__voltro.undo.apply", tr = "__voltro.undo.redo", nr = m.Struct({
|
|
863
|
+
id: m.String,
|
|
864
|
+
tag: m.String,
|
|
865
|
+
label: m.NullOr(m.String),
|
|
866
|
+
undone: m.Boolean,
|
|
867
|
+
crossesAction: m.Boolean,
|
|
868
|
+
createdAt: m.String
|
|
869
|
+
}), rr = class extends m.TaggedError()("UndoNotFound", { invocationId: m.String }) {}, ir = class extends m.TaggedError()("UndoForbidden", { invocationId: m.String }) {}, ar = class extends m.TaggedError()("UndoConflict", {
|
|
870
|
+
invocationId: m.String,
|
|
871
|
+
reason: m.Literal("conflict", "action")
|
|
872
|
+
}) {}, Z = m.Union(rr, ir, ar), or = F({
|
|
873
|
+
name: $n,
|
|
818
874
|
source: "_voltro_undo_log",
|
|
819
|
-
input:
|
|
820
|
-
output:
|
|
875
|
+
input: m.Struct({ limit: m.optional(m.Number) }),
|
|
876
|
+
output: m.Array(nr),
|
|
821
877
|
openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
|
|
822
|
-
}),
|
|
823
|
-
name:
|
|
824
|
-
input:
|
|
825
|
-
output:
|
|
826
|
-
error:
|
|
878
|
+
}), sr = I({
|
|
879
|
+
name: er,
|
|
880
|
+
input: m.Struct({ invocationId: m.String }),
|
|
881
|
+
output: m.Struct({ ok: m.Boolean }),
|
|
882
|
+
error: Z,
|
|
827
883
|
openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
828
|
-
}),
|
|
829
|
-
name:
|
|
830
|
-
input:
|
|
831
|
-
output:
|
|
832
|
-
error:
|
|
884
|
+
}), cr = I({
|
|
885
|
+
name: tr,
|
|
886
|
+
input: m.Struct({ invocationId: m.String }),
|
|
887
|
+
output: m.Struct({ ok: m.Boolean }),
|
|
888
|
+
error: Z,
|
|
833
889
|
openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
834
|
-
}),
|
|
835
|
-
table:
|
|
836
|
-
reason:
|
|
837
|
-
}) {},
|
|
838
|
-
operation:
|
|
839
|
-
table:
|
|
840
|
-
cause:
|
|
841
|
-
}) {},
|
|
842
|
-
table:
|
|
843
|
-
found:
|
|
890
|
+
}), lr = class extends m.TaggedError()("TenantScopeViolation", {
|
|
891
|
+
table: m.String,
|
|
892
|
+
reason: m.String
|
|
893
|
+
}) {}, ur = class extends m.TaggedError()("StoreOperationFailed", {
|
|
894
|
+
operation: m.String,
|
|
895
|
+
table: m.String,
|
|
896
|
+
cause: m.String
|
|
897
|
+
}) {}, dr = class extends m.TaggedError()("NoRowFound", {
|
|
898
|
+
table: m.String,
|
|
899
|
+
found: m.Number
|
|
844
900
|
}) {
|
|
845
901
|
get message() {
|
|
846
902
|
return this.found === 0 ? `expected exactly one row in '${this.table}', found none` : `expected exactly one row in '${this.table}', found more than one`;
|
|
847
903
|
}
|
|
848
|
-
},
|
|
849
|
-
table:
|
|
850
|
-
summary:
|
|
851
|
-
issues:
|
|
852
|
-
path:
|
|
853
|
-
message:
|
|
904
|
+
}, fr = class extends m.TaggedError()("TableValidationFailed", {
|
|
905
|
+
table: m.String,
|
|
906
|
+
summary: m.String,
|
|
907
|
+
issues: m.Array(m.Struct({
|
|
908
|
+
path: m.String,
|
|
909
|
+
message: m.String
|
|
854
910
|
}))
|
|
855
|
-
}) {},
|
|
856
|
-
table:
|
|
857
|
-
id:
|
|
858
|
-
reason:
|
|
859
|
-
}) {},
|
|
860
|
-
table:
|
|
861
|
-
columns:
|
|
862
|
-
}) {},
|
|
863
|
-
kind:
|
|
864
|
-
table:
|
|
865
|
-
operation:
|
|
866
|
-
constraint:
|
|
867
|
-
column:
|
|
868
|
-
detail:
|
|
911
|
+
}) {}, pr = class extends m.TaggedError()("TenantRowNotFound", {
|
|
912
|
+
table: m.String,
|
|
913
|
+
id: m.String,
|
|
914
|
+
reason: m.String
|
|
915
|
+
}) {}, mr = class extends m.TaggedError()("ServerOnlyColumnWrite", {
|
|
916
|
+
table: m.String,
|
|
917
|
+
columns: m.Array(m.String)
|
|
918
|
+
}) {}, hr = class extends m.TaggedError()("ConstraintViolation", {
|
|
919
|
+
kind: m.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
|
|
920
|
+
table: m.String,
|
|
921
|
+
operation: m.String,
|
|
922
|
+
constraint: m.optional(m.String),
|
|
923
|
+
column: m.optional(m.String),
|
|
924
|
+
detail: m.optional(m.String)
|
|
869
925
|
}) {
|
|
870
926
|
get message() {
|
|
871
927
|
if (this.detail !== void 0) return this.detail;
|
|
@@ -878,85 +934,85 @@ var Ge = h.Union(h.String, h.Number), _ = h.Record({
|
|
|
878
934
|
case "check": return `check constraint ${t}: the row does not satisfy it`;
|
|
879
935
|
}
|
|
880
936
|
}
|
|
881
|
-
},
|
|
882
|
-
name:
|
|
937
|
+
}, gr = "__voltro.approvals.pending", _r = "__voltro.approvals.decide", vr = F({
|
|
938
|
+
name: gr,
|
|
883
939
|
source: "_voltro_approvals",
|
|
884
|
-
input:
|
|
885
|
-
output:
|
|
940
|
+
input: m.Struct({ limit: m.optional(m.Number) }),
|
|
941
|
+
output: m.Array(mt),
|
|
886
942
|
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"
|
|
887
|
-
}),
|
|
888
|
-
name:
|
|
889
|
-
input:
|
|
890
|
-
approvalId:
|
|
891
|
-
decision:
|
|
892
|
-
note:
|
|
943
|
+
}), yr = I({
|
|
944
|
+
name: _r,
|
|
945
|
+
input: m.Struct({
|
|
946
|
+
approvalId: m.String,
|
|
947
|
+
decision: m.Literal("approve", "reject"),
|
|
948
|
+
note: m.optional(m.String)
|
|
893
949
|
}),
|
|
894
|
-
output:
|
|
895
|
-
approvalId:
|
|
896
|
-
status:
|
|
950
|
+
output: m.Struct({
|
|
951
|
+
approvalId: m.String,
|
|
952
|
+
status: m.Literal("approved", "rejected")
|
|
897
953
|
}),
|
|
898
|
-
error:
|
|
954
|
+
error: pt,
|
|
899
955
|
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"
|
|
900
|
-
}),
|
|
901
|
-
connectionId:
|
|
956
|
+
}), br = "__voltro.connections.list", xr = "__voltro.connections.start", Sr = "__voltro.connections.submitToken", Cr = "__voltro.connections.disconnect", Q = m.Literal("oauth2", "pat"), wr = m.Literal("disconnected", "connected", "expired", "revoked", "error"), Tr = m.Struct({
|
|
957
|
+
connectionId: m.String,
|
|
902
958
|
kind: Q,
|
|
903
|
-
label:
|
|
904
|
-
status:
|
|
905
|
-
accountId:
|
|
906
|
-
accountLabel:
|
|
907
|
-
scopes:
|
|
908
|
-
expiresAt:
|
|
909
|
-
lastError:
|
|
910
|
-
connectedAt:
|
|
911
|
-
}),
|
|
912
|
-
connectionId:
|
|
959
|
+
label: m.String,
|
|
960
|
+
status: wr,
|
|
961
|
+
accountId: m.NullOr(m.String),
|
|
962
|
+
accountLabel: m.NullOr(m.String),
|
|
963
|
+
scopes: m.Array(m.String),
|
|
964
|
+
expiresAt: m.NullOr(m.String),
|
|
965
|
+
lastError: m.NullOr(m.String),
|
|
966
|
+
connectedAt: m.NullOr(m.String)
|
|
967
|
+
}), Er = class extends m.TaggedError()("ConnectionNotDeclared", { connectionId: m.String }) {}, Dr = class extends m.TaggedError()("ConnectionSubjectRequired", { connectionId: m.String }) {}, Or = class extends m.TaggedError()("ConnectionKindMismatch", {
|
|
968
|
+
connectionId: m.String,
|
|
913
969
|
expected: Q,
|
|
914
970
|
actual: Q
|
|
915
|
-
}) {},
|
|
916
|
-
connectionId:
|
|
917
|
-
reason:
|
|
918
|
-
transient:
|
|
919
|
-
}) {}, $ =
|
|
920
|
-
name:
|
|
971
|
+
}) {}, kr = class extends m.TaggedError()("ConnectionHandshakeFailed", {
|
|
972
|
+
connectionId: m.String,
|
|
973
|
+
reason: m.String,
|
|
974
|
+
transient: m.Boolean
|
|
975
|
+
}) {}, $ = m.Union(Er, Dr, Or, kr), Ar = F({
|
|
976
|
+
name: br,
|
|
921
977
|
source: "_voltro_connections",
|
|
922
|
-
input:
|
|
923
|
-
output:
|
|
978
|
+
input: m.Struct({}),
|
|
979
|
+
output: m.Array(Tr),
|
|
924
980
|
openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
|
|
925
|
-
}),
|
|
926
|
-
name:
|
|
927
|
-
input:
|
|
928
|
-
connectionId:
|
|
929
|
-
redirectTo:
|
|
981
|
+
}), jr = L({
|
|
982
|
+
name: xr,
|
|
983
|
+
input: m.Struct({
|
|
984
|
+
connectionId: m.String,
|
|
985
|
+
redirectTo: m.optional(m.String)
|
|
930
986
|
}),
|
|
931
|
-
output:
|
|
932
|
-
authorizeUrl:
|
|
933
|
-
state:
|
|
987
|
+
output: m.Struct({
|
|
988
|
+
authorizeUrl: m.String,
|
|
989
|
+
state: m.String
|
|
934
990
|
}),
|
|
935
991
|
error: $,
|
|
936
992
|
openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
937
|
-
}),
|
|
938
|
-
name:
|
|
939
|
-
input:
|
|
940
|
-
connectionId:
|
|
941
|
-
token:
|
|
993
|
+
}), Mr = I({
|
|
994
|
+
name: Sr,
|
|
995
|
+
input: m.Struct({
|
|
996
|
+
connectionId: m.String,
|
|
997
|
+
token: m.String
|
|
942
998
|
}),
|
|
943
|
-
output:
|
|
999
|
+
output: m.Struct({ ok: m.Boolean }),
|
|
944
1000
|
error: $,
|
|
945
1001
|
openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
946
|
-
}),
|
|
947
|
-
name:
|
|
948
|
-
input:
|
|
949
|
-
output:
|
|
1002
|
+
}), Nr = I({
|
|
1003
|
+
name: Cr,
|
|
1004
|
+
input: m.Struct({ connectionId: m.String }),
|
|
1005
|
+
output: m.Struct({ ok: m.Boolean }),
|
|
950
1006
|
error: $,
|
|
951
1007
|
openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
|
|
952
|
-
}),
|
|
1008
|
+
}), Pr = (e) => {
|
|
953
1009
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
954
1010
|
return Number.isNaN(t) ? 0 : t;
|
|
955
|
-
},
|
|
1011
|
+
}, Fr = 4001, Ir = /* @__PURE__ */ new Set(["/rpc", "/ws"]), Lr = (e) => {
|
|
956
1012
|
if (!e.path.startsWith("/")) throw Error(`defineWebSocket: path must be absolute, got '${e.path}'`);
|
|
957
|
-
if (
|
|
1013
|
+
if (Ir.has(e.path)) throw Error(`defineWebSocket: '${e.path}' is the framework's own socket surface — mount the gateway elsewhere`);
|
|
958
1014
|
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)}'`);
|
|
959
1015
|
return e;
|
|
960
|
-
},
|
|
1016
|
+
}, Rr = 1;
|
|
961
1017
|
//#endregion
|
|
962
|
-
export { De as ADMIN_SCOPE, Se as APIKEY_ISSUE_ORG_SCOPE, Te as APIKEY_ISSUE_OTHER_SCOPE, _e as APIKEY_ISSUE_SELF_SCOPE,
|
|
1018
|
+
export { De as ADMIN_SCOPE, Se as APIKEY_ISSUE_ORG_SCOPE, Te as APIKEY_ISSUE_OTHER_SCOPE, _e as APIKEY_ISSUE_SELF_SCOPE, _r as APPROVALS_DECIDE_TAG, gr as APPROVALS_PENDING_TAG, pt as ApprovalDecisionErrors, ft as ApprovalErrors, C as ApprovalExpired, dt as ApprovalForbidden, st as ApprovalNotFound, ut as ApprovalNotPending, lt as ApprovalRejected, ot as ApprovalRequired, ct as ApprovalSelfApproval, w as ApprovalUnavailable, se as AuthMiddleware, tt as BusinessRuleViolation, br as CONNECTIONS_LIST_TAG, Cr as CONNECTION_DISCONNECT_TAG, xr as CONNECTION_START_TAG, Sr as CONNECTION_SUBMIT_TOKEN_TAG, kr as ConnectionHandshakeFailed, i as ConnectionInfo, r as ConnectionInfoMiddleware, Q as ConnectionKind, Or as ConnectionKindMismatch, Er as ConnectionNotDeclared, Tr as ConnectionState, wr as ConnectionStatus, Dr as ConnectionSubjectRequired, hr as ConstraintViolation, ie as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, ye as DEFAULT_SCOPE_CACHE_TTL_MS, en as EVENT_ROUTE_SEP, Zt as EventKeyInvalid, Xt as EventPayloadInvalid, Qt as EventPayloadTooLarge, Fr as GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE, e as IMPERSONATION_METADATA_KEY, Bt as MAX_EVENT_ENVELOPE_BYTES, ze as MUTATION_IN_FLIGHT_RETRY_AFTER_MS, p as MutationConnectionRequired, Ne as MutationInFlight, dr as NoRowFound, Rr as PROTOCOL_VERSION, mt as PendingApproval, T as REACTIVITY_CHANNEL_PREFIX, u as ScopeError, mr as ServerOnlyColumnWrite, ur as StoreOperationFailed, ve as Subject, ne as SubjectIdentity, re as SubjectService, fr as TableValidationFailed, pr as TenantRowNotFound, lr as TenantScopeViolation, er as UNDO_APPLY_TAG, $n as UNDO_LOG_TAG, tr as UNDO_REDO_TAG, l as Unauthenticated, ar as UndoConflict, ir as UndoForbidden, nr as UndoLogEntry, rr as UndoNotFound, rt as ValidationError, it as ValidationErrors, nt as ValidationIssue, V as WorkflowAccessProperty, X as WorkflowControlInputSchema, Fn as WorkflowDomainEventRowSchema, Rn as WorkflowDomainEventsInputSchema, zn as WorkflowEventDeliveriesInputSchema, In as WorkflowEventDeliveryRowSchema, On as WorkflowParentClosePolicySchema, Pn as WorkflowRunEventRowSchema, An as WorkflowRunHandleSchema, Ln as WorkflowRunRefSchema, J as WorkflowRunRowSchema, q as WorkflowRunStatusSchema, Nn as WorkflowRunStepRowSchema, Y as WorkflowRunTableRefSchema, Mn as WorkflowRunsInputSchema, Bn as WorkflowSignalInputSchema, kn as WorkflowStartDeferralSchema, Vn as WorkflowUpdateInputSchema, Hn as WorkflowUpdateResultSchema, Ft as actionToRpc, Ce as advisoryResourceGuardWarning, a as anonymousSubject, $e as applyRowPatch, c as applyScopeDecision, yr as approvalsDecideDescriptor, vr as approvalsPendingQueryDescriptor, te as assertAuthenticated, sn as attachWorkflowAccess, Re as beginIdempotent, bn as checkFrameworkCompat, Ee as checkGuards, pe as checkGuardsEffect, mn as compareSurfaces, ae as composeAuthStrategies, vn as composeRpcInterceptors, Nr as connectionDisconnectDescriptor, jr as connectionStartDescriptor, Mr as connectionSubmitTokenDescriptor, Ar as connectionsListQueryDescriptor, k as declaredReactivityChannelKeys, L as defineAction, Ht as defineEvent, I as defineMutation, hn as definePlugin, gn as definePluginRoute, yn as definePluginService, F as defineQuery, Et as defineStream, Lr as defineWebSocket, Ze as diffRows, be as effectiveScopes, $t as encodeEventKey, Lt as errorTag, Gt as eventAttached, Ut as eventEnvelope, Wt as eventGap, qt as eventResumePoint, tn as eventRoute, Kt as eventStreamEvent, Jt as eventSubscribeInput, Yt as eventToRpc, Be as failIdempotent, at as fieldIssuesOf, Oe as findAdvisoryResourceGuards, Pe as finishIdempotent, rn as formatEventRoute, me as getPolicyGuardResolver, he as getResourceScopeResolver, H as getWorkflowAccess, pn as groupShapeDigests, Tt as hasAccessDecision, Me as hasCallbackRoutes, we as hasEffectiveScope, z as hasEnforcedGuard, xe as hasScope, g as idToPath, Ie as idempotencyScope, x as inputLabel, ge as isAuthenticatedCheck, wt as isAuthenticatedGuard, Vt as isEventDescriptor, Qe as isIdKeyed, d as isOpenAccess, de as isPolicyCheck, Ct as isPolicyGuard, D as isReactivityChannel, O as isReactivityChannelKey, t as isSystemSubject, xt as isWireReachable, le as makeScopeCache, He as memoryIdempotencyStore, ke as missingAccessDecision, Pt as mutationToRpc, zt as normalizeDescriptor, M as normalizeSource, f as openAccessSpec, nn as parseEventRoute, _ as pathToId, Sn as pluginAlias, _n as pluginInstanceName, Cn as pluginSlug, Dn as pluginTag, fn as procedureShapeDigest, bt as publishReactivity, Ve as publishServerError, Nt as queryToRpc, s as rawImpersonationMark, vt as reactivityChannel, Tn as registerPluginAliases, fe as requireScope, En as resetPluginAliases, on as resolveWorkflowAccess, Je as rowPatchOpSchema, Ye as rowPatchSchema, U as schemaShape, ce as scopeCacheKey, je as setEffectiveScopes, oe as setPolicyGuardResolver, n as setResourceScopeResolver, dn as shapeDigest, j as sourceKeys, It as streamToRpc, S as strictInput, ue as subjectIdentity, Ae as subjectScopes, Le as subscribeServerErrors, b as subscriptionEvent, o as systemSubject, ee as tenantScopedSubject, Rt as toRpc, Pr as tsMs, yt as undeclaredChannelKeys, sr as undoApplyDescriptor, or as undoLogQueryDescriptor, cr as undoRedoDescriptor, B as wireErrorUnion, Mt as withRpcTag, cn as workflowAccessDescriptor, Yn as workflowCancelDescriptor, qn as workflowDomainEventsQueryDescriptor, Jn as workflowEventDeliveriesQueryDescriptor, Xn as workflowResumeDescriptor, Kn as workflowRunEventsQueryDescriptor, Un as workflowRunQueryDescriptor, Gn as workflowRunStepsQueryDescriptor, Wn as workflowRunsQueryDescriptor, Zn as workflowSignalDescriptor, jn as workflowToRpc, Qn as workflowUpdateDescriptor, jt as workflowWireErrorUnion, Fe as wsMutationIdempotencyScope };
|