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