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