@voltro/protocol 0.36.0 → 0.38.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 +182 -0
- package/dist/{auth-B6YZuSBr.js → auth-CKS3UNnf.js} +45 -45
- package/dist/index.d.ts +42 -0
- package/dist/index.js +379 -373
- package/dist/rest.js +1 -1
- package/dist/session.js +6 -6
- package/package.json +3 -3
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,72 +62,78 @@ 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
|
-
})),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
+
let t = e.ast;
|
|
81
|
+
return t._tag === "TypeLiteral" && (t.propertySignatures?.length ?? 0) === 0 && (t.indexSignatures?.length ?? 0) === 0;
|
|
82
|
+
}, g = (e) => {
|
|
83
|
+
let t = e.annotations({ parseOptions: { onExcessProperty: "error" } });
|
|
84
|
+
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)(t) : t;
|
|
85
|
+
}, _ = class extends c.TaggedError()("BusinessRuleViolation", {
|
|
86
|
+
rule: c.String,
|
|
87
|
+
params: c.optional(c.Record({
|
|
88
|
+
key: c.String,
|
|
89
|
+
value: c.Unknown
|
|
84
90
|
})),
|
|
85
|
-
field:
|
|
86
|
-
message:
|
|
87
|
-
severity:
|
|
88
|
-
}) {}, v = class extends
|
|
89
|
-
approvalId:
|
|
90
|
-
procedure:
|
|
91
|
-
expiresAt:
|
|
92
|
-
requiredScopes:
|
|
93
|
-
reason:
|
|
94
|
-
created:
|
|
95
|
-
}) {}, y = class extends
|
|
96
|
-
approvalId:
|
|
97
|
-
subjectId:
|
|
98
|
-
}) {}, x = class extends
|
|
99
|
-
approvalId:
|
|
100
|
-
decidedBy:
|
|
101
|
-
note:
|
|
102
|
-
}) {}, S = class extends
|
|
103
|
-
approvalId:
|
|
104
|
-
expiredAt:
|
|
105
|
-
}) {}, C = class extends
|
|
106
|
-
approvalId:
|
|
107
|
-
status:
|
|
108
|
-
}) {}, w = class extends
|
|
109
|
-
approvalId:
|
|
110
|
-
required:
|
|
111
|
-
message:
|
|
112
|
-
}) {}, T = class extends
|
|
113
|
-
procedure:
|
|
114
|
-
message:
|
|
115
|
-
}) {}, E =
|
|
116
|
-
id:
|
|
117
|
-
procedure:
|
|
118
|
-
kind:
|
|
119
|
-
requestedBy:
|
|
120
|
-
status:
|
|
121
|
-
reason:
|
|
122
|
-
requiredScopes:
|
|
123
|
-
requestedAt:
|
|
124
|
-
expiresAt:
|
|
125
|
-
decidedBy:
|
|
126
|
-
decidedAt:
|
|
127
|
-
note:
|
|
128
|
-
relation:
|
|
129
|
-
}), k = "channel:", A = Symbol.for("@voltro/protocol/reactivityChannels"), j = globalThis, M = j[A] ?? (j[A] = /* @__PURE__ */ new Map()),
|
|
130
|
-
if (!
|
|
91
|
+
field: c.optional(c.String),
|
|
92
|
+
message: c.optional(c.String),
|
|
93
|
+
severity: c.Literal("error", "warning")
|
|
94
|
+
}) {}, v = class extends c.TaggedError()("ApprovalRequired", {
|
|
95
|
+
approvalId: c.String,
|
|
96
|
+
procedure: c.String,
|
|
97
|
+
expiresAt: c.String,
|
|
98
|
+
requiredScopes: c.Array(c.String),
|
|
99
|
+
reason: c.NullOr(c.String),
|
|
100
|
+
created: c.Boolean
|
|
101
|
+
}) {}, y = class extends c.TaggedError()("ApprovalNotFound", { approvalId: c.String }) {}, b = class extends c.TaggedError()("ApprovalSelfApproval", {
|
|
102
|
+
approvalId: c.String,
|
|
103
|
+
subjectId: c.NullOr(c.String)
|
|
104
|
+
}) {}, x = class extends c.TaggedError()("ApprovalRejected", {
|
|
105
|
+
approvalId: c.String,
|
|
106
|
+
decidedBy: c.NullOr(c.String),
|
|
107
|
+
note: c.NullOr(c.String)
|
|
108
|
+
}) {}, S = class extends c.TaggedError()("ApprovalExpired", {
|
|
109
|
+
approvalId: c.String,
|
|
110
|
+
expiredAt: c.String
|
|
111
|
+
}) {}, C = class extends c.TaggedError()("ApprovalNotPending", {
|
|
112
|
+
approvalId: c.String,
|
|
113
|
+
status: c.String
|
|
114
|
+
}) {}, w = class extends c.TaggedError()("ApprovalForbidden", {
|
|
115
|
+
approvalId: c.String,
|
|
116
|
+
required: c.NullOr(c.String),
|
|
117
|
+
message: c.String
|
|
118
|
+
}) {}, T = class extends c.TaggedError()("ApprovalUnavailable", {
|
|
119
|
+
procedure: c.String,
|
|
120
|
+
message: c.String
|
|
121
|
+
}) {}, E = c.Union(v, x, S, T), D = c.Union(y, b, S, C, w, T), O = c.Struct({
|
|
122
|
+
id: c.String,
|
|
123
|
+
procedure: c.String,
|
|
124
|
+
kind: c.Literal("mutation", "action"),
|
|
125
|
+
requestedBy: c.NullOr(c.String),
|
|
126
|
+
status: c.Literal("pending", "approved", "rejected", "expired", "consumed"),
|
|
127
|
+
reason: c.NullOr(c.String),
|
|
128
|
+
requiredScopes: c.Array(c.String),
|
|
129
|
+
requestedAt: c.String,
|
|
130
|
+
expiresAt: c.String,
|
|
131
|
+
decidedBy: c.NullOr(c.String),
|
|
132
|
+
decidedAt: c.NullOr(c.String),
|
|
133
|
+
note: c.NullOr(c.String),
|
|
134
|
+
relation: c.Literal("to-decide", "requested")
|
|
135
|
+
}), 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) => {
|
|
136
|
+
if (!et.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
|
|
131
137
|
\`billing.usage\`. A \`:\` is refused because it is the namespace separator in
|
|
132
138
|
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
139
|
routes as two.`);
|
|
@@ -140,14 +146,14 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
140
146
|
toString: () => n
|
|
141
147
|
});
|
|
142
148
|
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)],
|
|
149
|
+
}, 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) => {
|
|
144
150
|
let t = F(), n = [];
|
|
145
151
|
for (let r of e) for (let e of L(r.source)) !P(e) || t.has(e) || n.push({
|
|
146
152
|
procedure: r.name,
|
|
147
153
|
key: e
|
|
148
154
|
});
|
|
149
155
|
return n;
|
|
150
|
-
},
|
|
156
|
+
}, it = (e, t) => {
|
|
151
157
|
let n = e?.injectExternalChange;
|
|
152
158
|
return n === void 0 ? !1 : (n.call(e, {
|
|
153
159
|
table: t.key,
|
|
@@ -156,8 +162,8 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
156
162
|
old: {},
|
|
157
163
|
origin: "inline"
|
|
158
164
|
}), !0);
|
|
159
|
-
},
|
|
160
|
-
if (
|
|
165
|
+
}, at = (e) => e.internal !== !0, R = (e) => {
|
|
166
|
+
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
|
|
161
167
|
unguarded procedure, or list the scopes required to call it.`);
|
|
162
168
|
let t = typeof e.source == "string" ? [e.source] : Array.isArray(e.source) ? e.source : void 0;
|
|
163
169
|
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,
|
|
@@ -174,7 +180,7 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
174
180
|
let n = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
175
181
|
if (n.length === 0) return e;
|
|
176
182
|
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.`);
|
|
177
|
-
},
|
|
183
|
+
}, ot = (e) => {
|
|
178
184
|
let t = e.requiresApproval;
|
|
179
185
|
if (t !== void 0) {
|
|
180
186
|
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
|
|
@@ -184,20 +190,20 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
184
190
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
185
191
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
186
192
|
}
|
|
187
|
-
},
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
193
|
+
}, 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) => {
|
|
194
|
+
if (r === void 0) return n;
|
|
195
|
+
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
|
|
190
196
|
without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
|
|
191
|
-
if (
|
|
197
|
+
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
|
|
192
198
|
caller must hold a scope; drop them if anyone may call it.`);
|
|
193
|
-
return [
|
|
199
|
+
return [t(r.trim())];
|
|
194
200
|
}, B = (e) => R({
|
|
195
201
|
kind: "query",
|
|
196
202
|
name: e.name,
|
|
197
203
|
input: e.input,
|
|
198
204
|
output: e.output,
|
|
199
|
-
error: e.error ??
|
|
200
|
-
source:
|
|
205
|
+
error: e.error ?? c.Never,
|
|
206
|
+
source: nt(e.source),
|
|
201
207
|
cache: e.cache,
|
|
202
208
|
guards: z(e.name, e.guards, e.openAccess),
|
|
203
209
|
openAccess: e.openAccess,
|
|
@@ -210,7 +216,7 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
210
216
|
name: e.name,
|
|
211
217
|
input: e.input,
|
|
212
218
|
output: e.output,
|
|
213
|
-
error: e.error ??
|
|
219
|
+
error: e.error ?? c.Never,
|
|
214
220
|
target: e.target,
|
|
215
221
|
guards: z(e.name, e.guards, e.openAccess),
|
|
216
222
|
openAccess: e.openAccess,
|
|
@@ -224,7 +230,7 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
224
230
|
name: e.name,
|
|
225
231
|
input: e.input,
|
|
226
232
|
output: e.output,
|
|
227
|
-
error: e.error ??
|
|
233
|
+
error: e.error ?? c.Never,
|
|
228
234
|
guards: z(e.name, e.guards, e.openAccess),
|
|
229
235
|
openAccess: e.openAccess,
|
|
230
236
|
source: e.source,
|
|
@@ -234,46 +240,46 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
234
240
|
requiresApproval: e.requiresApproval,
|
|
235
241
|
internal: e.internal,
|
|
236
242
|
overridesPlugin: e.overridesPlugin
|
|
237
|
-
}),
|
|
243
|
+
}), lt = (e) => R({
|
|
238
244
|
kind: "stream",
|
|
239
245
|
name: e.name,
|
|
240
246
|
input: e.input,
|
|
241
247
|
element: e.element,
|
|
242
|
-
error: e.error ??
|
|
248
|
+
error: e.error ?? c.Never,
|
|
243
249
|
internal: e.internal,
|
|
244
250
|
overridesPlugin: e.overridesPlugin,
|
|
245
251
|
guards: z(e.name, e.guards, e.openAccess),
|
|
246
252
|
openAccess: e.openAccess
|
|
247
|
-
}), U = (e, t) => t && t.length > 0 ?
|
|
248
|
-
payload: e.input,
|
|
249
|
-
success:
|
|
253
|
+
}), 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, {
|
|
254
|
+
payload: g(e.input),
|
|
255
|
+
success: h(e.output),
|
|
250
256
|
error: U(W(e.error, e.guards), t),
|
|
251
257
|
stream: !0
|
|
252
|
-
}),
|
|
253
|
-
payload: e.input,
|
|
258
|
+
}), G = (e, t) => l.make(e.name, {
|
|
259
|
+
payload: g(e.input),
|
|
254
260
|
success: e.output,
|
|
255
|
-
error: U(
|
|
256
|
-
}),
|
|
257
|
-
payload: e.input,
|
|
261
|
+
error: U(dt(ut(W(e.error, e.guards)), e.requiresApproval), t)
|
|
262
|
+
}), pt = (e, t) => l.make(e.name, {
|
|
263
|
+
payload: g(e.input),
|
|
258
264
|
success: e.output,
|
|
259
|
-
error: U(
|
|
260
|
-
}),
|
|
261
|
-
payload: e.input,
|
|
265
|
+
error: U(dt(W(e.error, e.guards), e.requiresApproval), t)
|
|
266
|
+
}), mt = (e, t) => l.make(e.name, {
|
|
267
|
+
payload: g(e.input),
|
|
262
268
|
success: e.element,
|
|
263
269
|
error: U(e.error, t),
|
|
264
270
|
stream: !0
|
|
265
|
-
}),
|
|
271
|
+
}), ht = (e) => {
|
|
266
272
|
if (typeof e != "object" || !e) return;
|
|
267
273
|
let t = e._tag;
|
|
268
274
|
return typeof t == "string" ? t : void 0;
|
|
269
|
-
},
|
|
275
|
+
}, gt = (e) => {
|
|
270
276
|
switch (e.kind) {
|
|
271
|
-
case "query": return
|
|
272
|
-
case "mutation": return
|
|
273
|
-
case "action": return
|
|
274
|
-
case "stream": return
|
|
277
|
+
case "query": return ft(e);
|
|
278
|
+
case "mutation": return G(e);
|
|
279
|
+
case "action": return pt(e);
|
|
280
|
+
case "stream": return mt(e);
|
|
275
281
|
}
|
|
276
|
-
},
|
|
282
|
+
}, _t = (e) => {
|
|
277
283
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
278
284
|
if (e.kind === "query") return {
|
|
279
285
|
kind: "query",
|
|
@@ -314,7 +320,7 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
314
320
|
..."shapeItem" in e && e.shapeItem !== void 0 ? { shapeItem: e.shapeItem } : {}
|
|
315
321
|
}))
|
|
316
322
|
};
|
|
317
|
-
},
|
|
323
|
+
}, vt = 7500, yt = (e) => typeof e == "object" && !!e && e.kind === "event", bt = (e) => {
|
|
318
324
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
319
325
|
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
|
|
320
326
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -343,73 +349,73 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
343
349
|
name: e.name,
|
|
344
350
|
key: e.key,
|
|
345
351
|
payload: e.payload,
|
|
346
|
-
guards: e.openAccess === void 0 ? e.guards : [
|
|
352
|
+
guards: e.openAccess === void 0 ? e.guards : [t(e.openAccess.trim())],
|
|
347
353
|
openAccess: e.openAccess,
|
|
348
354
|
rewind: e.rewind,
|
|
349
355
|
webhook: e.webhook,
|
|
350
356
|
delivery: e.delivery
|
|
351
357
|
};
|
|
352
|
-
},
|
|
353
|
-
_tag:
|
|
354
|
-
origin:
|
|
355
|
-
n:
|
|
356
|
-
emittedAt:
|
|
358
|
+
}, xt = (e) => c.Struct({
|
|
359
|
+
_tag: c.Literal("event"),
|
|
360
|
+
origin: c.String,
|
|
361
|
+
n: c.Number,
|
|
362
|
+
emittedAt: c.Number,
|
|
357
363
|
payload: e
|
|
358
|
-
}),
|
|
359
|
-
_tag:
|
|
360
|
-
missed:
|
|
361
|
-
reason:
|
|
362
|
-
}),
|
|
363
|
-
origin:
|
|
364
|
-
n:
|
|
365
|
-
}),
|
|
364
|
+
}), St = c.Struct({
|
|
365
|
+
_tag: c.Literal("gap"),
|
|
366
|
+
missed: c.Number,
|
|
367
|
+
reason: c.Literal("buffer", "resume")
|
|
368
|
+
}), Ct = c.Struct({ _tag: c.Literal("attached") }), wt = (e) => c.Union(Ct, xt(e), St), Tt = c.Struct({
|
|
369
|
+
origin: c.String,
|
|
370
|
+
n: c.Number
|
|
371
|
+
}), Et = (e) => c.Struct({
|
|
366
372
|
key: e,
|
|
367
|
-
resume:
|
|
368
|
-
}),
|
|
369
|
-
let n = e.guards !== void 0 && e.guards.some((e) => !
|
|
370
|
-
return
|
|
371
|
-
payload:
|
|
372
|
-
success:
|
|
373
|
-
error:
|
|
373
|
+
resume: c.optional(c.Array(Tt))
|
|
374
|
+
}), Dt = (e, t) => {
|
|
375
|
+
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;
|
|
376
|
+
return l.make(e.name, {
|
|
377
|
+
payload: g(Et(e.key)),
|
|
378
|
+
success: wt(e.payload),
|
|
379
|
+
error: i,
|
|
374
380
|
stream: !0
|
|
375
381
|
});
|
|
376
|
-
},
|
|
377
|
-
event:
|
|
378
|
-
message:
|
|
379
|
-
}) {},
|
|
380
|
-
event:
|
|
381
|
-
message:
|
|
382
|
-
}) {},
|
|
383
|
-
event:
|
|
384
|
-
bytes:
|
|
385
|
-
limit:
|
|
386
|
-
}) {},
|
|
382
|
+
}, Ot = class extends c.TaggedError()("EventPayloadInvalid", {
|
|
383
|
+
event: c.String,
|
|
384
|
+
message: c.String
|
|
385
|
+
}) {}, kt = class extends c.TaggedError()("EventKeyInvalid", {
|
|
386
|
+
event: c.String,
|
|
387
|
+
message: c.String
|
|
388
|
+
}) {}, At = class extends c.TaggedError()("EventPayloadTooLarge", {
|
|
389
|
+
event: c.String,
|
|
390
|
+
bytes: c.Number,
|
|
391
|
+
limit: c.Number
|
|
392
|
+
}) {}, jt = (e) => {
|
|
387
393
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
388
394
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
389
395
|
return JSON.stringify(t);
|
|
390
|
-
},
|
|
396
|
+
}, Mt = "\0", Nt = (e, t, n) => [
|
|
391
397
|
e ?? "~",
|
|
392
398
|
t,
|
|
393
|
-
|
|
394
|
-
].join("\0"),
|
|
399
|
+
jt(n)
|
|
400
|
+
].join("\0"), Pt = (e) => {
|
|
395
401
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
396
402
|
return {
|
|
397
403
|
tenantId: t === "~" ? null : t,
|
|
398
404
|
event: n,
|
|
399
405
|
key: r
|
|
400
406
|
};
|
|
401
|
-
},
|
|
407
|
+
}, Ft = (e) => e.split("\0").join(" · "), It = (e) => e, Lt = (e) => e, Rt = (e) => {
|
|
402
408
|
let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
|
|
403
409
|
return n !== void 0 && n !== "" ? `${r}#${n}` : r;
|
|
404
|
-
},
|
|
410
|
+
}, zt = (e) => {
|
|
405
411
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
406
|
-
},
|
|
407
|
-
let n =
|
|
412
|
+
}, Bt = (e, t) => {
|
|
413
|
+
let n = Ge.GenericTag(e);
|
|
408
414
|
return {
|
|
409
415
|
Tag: n,
|
|
410
|
-
Live:
|
|
416
|
+
Live: Ke.succeed(n, t)
|
|
411
417
|
};
|
|
412
|
-
},
|
|
418
|
+
}, Vt = (e, t, n) => {
|
|
413
419
|
if (!t) return { ok: !0 };
|
|
414
420
|
let r = K(n);
|
|
415
421
|
if (!r) return {
|
|
@@ -419,7 +425,7 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
419
425
|
let i = t.trim();
|
|
420
426
|
if (i === "*" || i === "") return { ok: !0 };
|
|
421
427
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
422
|
-
for (let i of a) if (!
|
|
428
|
+
for (let i of a) if (!Ht(i, r)) return {
|
|
423
429
|
ok: !1,
|
|
424
430
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
425
431
|
};
|
|
@@ -432,7 +438,7 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
432
438
|
patch: Number(t[3]),
|
|
433
439
|
pre: t[4] ?? ""
|
|
434
440
|
} : null;
|
|
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,
|
|
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, Ht = (e, t) => {
|
|
436
442
|
if (e === "*") return !0;
|
|
437
443
|
if (e.startsWith("^")) {
|
|
438
444
|
let n = K(e.slice(1));
|
|
@@ -454,253 +460,253 @@ var We = l.Union(l.String, l.Number), d = l.Record({
|
|
|
454
460
|
}
|
|
455
461
|
let r = K(e);
|
|
456
462
|
return r ? q(t, r) === 0 : !1;
|
|
457
|
-
}, J =
|
|
458
|
-
mode:
|
|
459
|
-
dueAt:
|
|
460
|
-
retryAfterMs:
|
|
461
|
-
intentId:
|
|
462
|
-
}),
|
|
463
|
-
id:
|
|
464
|
-
workflowName:
|
|
465
|
-
executionId:
|
|
466
|
-
status:
|
|
467
|
-
deferral:
|
|
468
|
-
}), Y =
|
|
469
|
-
id:
|
|
470
|
-
tag:
|
|
471
|
-
executionId:
|
|
463
|
+
}, J = c.Literal("running", "succeeded", "failed", "cancelled", "suspended"), Ut = c.Literal("cancel", "terminate", "abandon"), Wt = c.Struct({
|
|
464
|
+
mode: c.String,
|
|
465
|
+
dueAt: c.NullOr(c.Number),
|
|
466
|
+
retryAfterMs: c.NullOr(c.Number),
|
|
467
|
+
intentId: c.NullOr(c.String)
|
|
468
|
+
}), Gt = c.Struct({
|
|
469
|
+
id: c.String,
|
|
470
|
+
workflowName: c.String,
|
|
471
|
+
executionId: c.NullOr(c.String),
|
|
472
|
+
status: c.Literal("running", "queued", "dropped", "skipped"),
|
|
473
|
+
deferral: c.optional(Wt)
|
|
474
|
+
}), Y = c.Struct({
|
|
475
|
+
id: c.String,
|
|
476
|
+
tag: c.String,
|
|
477
|
+
executionId: c.String,
|
|
472
478
|
status: J,
|
|
473
|
-
payload:
|
|
474
|
-
workflowVersion:
|
|
475
|
-
workflowPatches:
|
|
476
|
-
output:
|
|
477
|
-
subject:
|
|
478
|
-
source:
|
|
479
|
-
errorTag:
|
|
480
|
-
errorMessage:
|
|
481
|
-
cancelled:
|
|
482
|
-
startedAt:
|
|
483
|
-
completedAt:
|
|
484
|
-
durationMs:
|
|
485
|
-
traceId:
|
|
486
|
-
parentExecutionId:
|
|
487
|
-
parentClosePolicy:
|
|
488
|
-
}),
|
|
489
|
-
tag:
|
|
490
|
-
status:
|
|
491
|
-
limit:
|
|
492
|
-
}),
|
|
493
|
-
id:
|
|
494
|
-
runId:
|
|
495
|
-
stepName:
|
|
496
|
-
attempt:
|
|
497
|
-
status:
|
|
498
|
-
input:
|
|
499
|
-
retryPolicy:
|
|
500
|
-
output:
|
|
501
|
-
errorTag:
|
|
502
|
-
errorMessage:
|
|
503
|
-
errorCause:
|
|
504
|
-
startedAt:
|
|
505
|
-
completedAt:
|
|
506
|
-
durationMs:
|
|
507
|
-
}),
|
|
508
|
-
id:
|
|
509
|
-
runId:
|
|
510
|
-
eventType:
|
|
511
|
-
payload:
|
|
512
|
-
occurredAt:
|
|
513
|
-
stepName:
|
|
514
|
-
attempt:
|
|
515
|
-
}),
|
|
516
|
-
id:
|
|
517
|
-
name:
|
|
518
|
-
payload:
|
|
519
|
-
source:
|
|
520
|
-
subject:
|
|
521
|
-
traceId:
|
|
522
|
-
occurredAt:
|
|
523
|
-
}),
|
|
524
|
-
id:
|
|
525
|
-
eventId:
|
|
526
|
-
eventName:
|
|
527
|
-
triggerId:
|
|
528
|
-
workflowName:
|
|
529
|
-
executionId:
|
|
530
|
-
status:
|
|
531
|
-
idempotencyKey:
|
|
532
|
-
skipped:
|
|
533
|
-
errorMessage:
|
|
534
|
-
createdAt:
|
|
535
|
-
completedAt:
|
|
536
|
-
}),
|
|
537
|
-
name:
|
|
538
|
-
limit:
|
|
539
|
-
}),
|
|
540
|
-
workflowName:
|
|
541
|
-
executionId:
|
|
542
|
-
}),
|
|
543
|
-
id:
|
|
544
|
-
signalName:
|
|
545
|
-
payload:
|
|
546
|
-
}),
|
|
547
|
-
id:
|
|
548
|
-
updateName:
|
|
549
|
-
payload:
|
|
550
|
-
timeoutMs:
|
|
551
|
-
}),
|
|
552
|
-
eventId:
|
|
553
|
-
updateId:
|
|
554
|
-
completedEventId:
|
|
555
|
-
result:
|
|
556
|
-
}),
|
|
479
|
+
payload: c.Unknown,
|
|
480
|
+
workflowVersion: c.NullOr(c.String),
|
|
481
|
+
workflowPatches: c.NullOr(c.Unknown),
|
|
482
|
+
output: c.NullOr(c.Unknown),
|
|
483
|
+
subject: c.NullOr(c.Unknown),
|
|
484
|
+
source: c.NullOr(c.String),
|
|
485
|
+
errorTag: c.NullOr(c.String),
|
|
486
|
+
errorMessage: c.NullOr(c.String),
|
|
487
|
+
cancelled: c.Boolean,
|
|
488
|
+
startedAt: c.Date,
|
|
489
|
+
completedAt: c.NullOr(c.Date),
|
|
490
|
+
durationMs: c.NullOr(c.Number),
|
|
491
|
+
traceId: c.NullOr(c.String),
|
|
492
|
+
parentExecutionId: c.NullOr(c.String),
|
|
493
|
+
parentClosePolicy: c.NullOr(Ut)
|
|
494
|
+
}), Kt = c.Struct({
|
|
495
|
+
tag: c.optional(c.String),
|
|
496
|
+
status: c.optional(J),
|
|
497
|
+
limit: c.optional(c.Number)
|
|
498
|
+
}), qt = c.Struct({
|
|
499
|
+
id: c.String,
|
|
500
|
+
runId: c.String,
|
|
501
|
+
stepName: c.String,
|
|
502
|
+
attempt: c.Number,
|
|
503
|
+
status: c.Literal("running", "succeeded", "failed"),
|
|
504
|
+
input: c.NullOr(c.Unknown),
|
|
505
|
+
retryPolicy: c.NullOr(c.Unknown),
|
|
506
|
+
output: c.NullOr(c.Unknown),
|
|
507
|
+
errorTag: c.NullOr(c.String),
|
|
508
|
+
errorMessage: c.NullOr(c.String),
|
|
509
|
+
errorCause: c.NullOr(c.Unknown),
|
|
510
|
+
startedAt: c.Date,
|
|
511
|
+
completedAt: c.NullOr(c.Date),
|
|
512
|
+
durationMs: c.NullOr(c.Number)
|
|
513
|
+
}), Jt = c.Struct({
|
|
514
|
+
id: c.String,
|
|
515
|
+
runId: c.String,
|
|
516
|
+
eventType: c.String,
|
|
517
|
+
payload: c.NullOr(c.Unknown),
|
|
518
|
+
occurredAt: c.Date,
|
|
519
|
+
stepName: c.NullOr(c.String),
|
|
520
|
+
attempt: c.NullOr(c.Number)
|
|
521
|
+
}), Yt = c.Struct({
|
|
522
|
+
id: c.String,
|
|
523
|
+
name: c.String,
|
|
524
|
+
payload: c.Unknown,
|
|
525
|
+
source: c.String,
|
|
526
|
+
subject: c.NullOr(c.Unknown),
|
|
527
|
+
traceId: c.NullOr(c.String),
|
|
528
|
+
occurredAt: c.Date
|
|
529
|
+
}), Xt = c.Struct({
|
|
530
|
+
id: c.String,
|
|
531
|
+
eventId: c.String,
|
|
532
|
+
eventName: c.String,
|
|
533
|
+
triggerId: c.String,
|
|
534
|
+
workflowName: c.String,
|
|
535
|
+
executionId: c.NullOr(c.String),
|
|
536
|
+
status: c.Literal("starting", "started", "skipped", "failed"),
|
|
537
|
+
idempotencyKey: c.String,
|
|
538
|
+
skipped: c.Boolean,
|
|
539
|
+
errorMessage: c.NullOr(c.String),
|
|
540
|
+
createdAt: c.Date,
|
|
541
|
+
completedAt: c.NullOr(c.Date)
|
|
542
|
+
}), Zt = c.Struct({ id: c.String }), X = c.Struct({ runId: c.String }), Qt = c.Struct({
|
|
543
|
+
name: c.optional(c.String),
|
|
544
|
+
limit: c.optional(c.Number)
|
|
545
|
+
}), $t = c.Struct({ eventId: c.String }), Z = c.Struct({
|
|
546
|
+
workflowName: c.String,
|
|
547
|
+
executionId: c.String
|
|
548
|
+
}), en = c.Struct({
|
|
549
|
+
id: c.String,
|
|
550
|
+
signalName: c.String,
|
|
551
|
+
payload: c.optional(c.Unknown)
|
|
552
|
+
}), tn = c.Struct({
|
|
553
|
+
id: c.String,
|
|
554
|
+
updateName: c.String,
|
|
555
|
+
payload: c.optional(c.Unknown),
|
|
556
|
+
timeoutMs: c.optional(c.Number)
|
|
557
|
+
}), nn = c.Struct({
|
|
558
|
+
eventId: c.String,
|
|
559
|
+
updateId: c.String,
|
|
560
|
+
completedEventId: c.String,
|
|
561
|
+
result: c.Unknown
|
|
562
|
+
}), rn = B({
|
|
557
563
|
name: "__voltro.workflow.run",
|
|
558
564
|
source: "_voltro_workflow_runs",
|
|
559
|
-
input:
|
|
560
|
-
output:
|
|
561
|
-
}),
|
|
565
|
+
input: Zt,
|
|
566
|
+
output: c.Array(Y)
|
|
567
|
+
}), an = B({
|
|
562
568
|
name: "__voltro.workflow.runs",
|
|
563
569
|
source: "_voltro_workflow_runs",
|
|
564
|
-
input:
|
|
565
|
-
output:
|
|
566
|
-
}),
|
|
570
|
+
input: Kt,
|
|
571
|
+
output: c.Array(Y)
|
|
572
|
+
}), on = B({
|
|
567
573
|
name: "__voltro.workflow.run.steps",
|
|
568
574
|
source: "_voltro_workflow_run_steps",
|
|
569
575
|
input: X,
|
|
570
|
-
output:
|
|
571
|
-
}),
|
|
576
|
+
output: c.Array(qt)
|
|
577
|
+
}), sn = B({
|
|
572
578
|
name: "__voltro.workflow.run.events",
|
|
573
579
|
source: "_voltro_workflow_run_events",
|
|
574
580
|
input: X,
|
|
575
|
-
output:
|
|
576
|
-
}),
|
|
581
|
+
output: c.Array(Jt)
|
|
582
|
+
}), cn = B({
|
|
577
583
|
name: "__voltro.workflow.domainEvents",
|
|
578
584
|
source: "_voltro_workflow_events",
|
|
579
|
-
input:
|
|
580
|
-
output:
|
|
581
|
-
}),
|
|
585
|
+
input: Qt,
|
|
586
|
+
output: c.Array(Yt)
|
|
587
|
+
}), ln = B({
|
|
582
588
|
name: "__voltro.workflow.event.deliveries",
|
|
583
589
|
source: "_voltro_workflow_event_deliveries",
|
|
584
|
-
input:
|
|
585
|
-
output:
|
|
586
|
-
}),
|
|
590
|
+
input: $t,
|
|
591
|
+
output: c.Array(Xt)
|
|
592
|
+
}), un = H({
|
|
587
593
|
name: "__voltro.workflow.cancel",
|
|
588
594
|
input: Z,
|
|
589
|
-
output:
|
|
590
|
-
}),
|
|
595
|
+
output: c.Struct({ ok: c.Boolean })
|
|
596
|
+
}), dn = H({
|
|
591
597
|
name: "__voltro.workflow.resume",
|
|
592
598
|
input: Z,
|
|
593
|
-
output:
|
|
594
|
-
}),
|
|
599
|
+
output: c.Struct({ ok: c.Boolean })
|
|
600
|
+
}), fn = H({
|
|
595
601
|
name: "__voltro.workflow.signal",
|
|
596
|
-
input:
|
|
597
|
-
output:
|
|
598
|
-
}),
|
|
602
|
+
input: en,
|
|
603
|
+
output: c.Struct({ eventId: c.String })
|
|
604
|
+
}), pn = H({
|
|
599
605
|
name: "__voltro.workflow.update",
|
|
600
|
-
input:
|
|
601
|
-
output:
|
|
602
|
-
}),
|
|
603
|
-
id:
|
|
604
|
-
tag:
|
|
605
|
-
label:
|
|
606
|
-
undone:
|
|
607
|
-
crossesAction:
|
|
608
|
-
createdAt:
|
|
609
|
-
}),
|
|
610
|
-
invocationId:
|
|
611
|
-
reason:
|
|
612
|
-
}) {},
|
|
613
|
-
name:
|
|
606
|
+
input: tn,
|
|
607
|
+
output: nn
|
|
608
|
+
}), mn = "__voltro.undo.log", hn = "__voltro.undo.apply", gn = "__voltro.undo.redo", _n = c.Struct({
|
|
609
|
+
id: c.String,
|
|
610
|
+
tag: c.String,
|
|
611
|
+
label: c.NullOr(c.String),
|
|
612
|
+
undone: c.Boolean,
|
|
613
|
+
crossesAction: c.Boolean,
|
|
614
|
+
createdAt: c.String
|
|
615
|
+
}), vn = class extends c.TaggedError()("UndoNotFound", { invocationId: c.String }) {}, yn = class extends c.TaggedError()("UndoForbidden", { invocationId: c.String }) {}, bn = class extends c.TaggedError()("UndoConflict", {
|
|
616
|
+
invocationId: c.String,
|
|
617
|
+
reason: c.Literal("conflict", "action")
|
|
618
|
+
}) {}, xn = c.Union(vn, yn, bn), Sn = B({
|
|
619
|
+
name: mn,
|
|
614
620
|
source: "_voltro_undo_log",
|
|
615
|
-
input:
|
|
616
|
-
output:
|
|
621
|
+
input: c.Struct({ limit: c.optional(c.Number) }),
|
|
622
|
+
output: c.Array(_n),
|
|
617
623
|
openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
|
|
618
|
-
}),
|
|
619
|
-
name:
|
|
620
|
-
input:
|
|
621
|
-
output:
|
|
622
|
-
error:
|
|
624
|
+
}), Cn = V({
|
|
625
|
+
name: hn,
|
|
626
|
+
input: c.Struct({ invocationId: c.String }),
|
|
627
|
+
output: c.Struct({ ok: c.Boolean }),
|
|
628
|
+
error: xn,
|
|
623
629
|
openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
624
|
-
}),
|
|
625
|
-
name:
|
|
626
|
-
input:
|
|
627
|
-
output:
|
|
628
|
-
error:
|
|
630
|
+
}), wn = V({
|
|
631
|
+
name: gn,
|
|
632
|
+
input: c.Struct({ invocationId: c.String }),
|
|
633
|
+
output: c.Struct({ ok: c.Boolean }),
|
|
634
|
+
error: xn,
|
|
629
635
|
openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
630
|
-
}),
|
|
631
|
-
name:
|
|
636
|
+
}), Tn = "__voltro.approvals.pending", En = "__voltro.approvals.decide", Dn = B({
|
|
637
|
+
name: Tn,
|
|
632
638
|
source: "_voltro_approvals",
|
|
633
|
-
input:
|
|
634
|
-
output:
|
|
639
|
+
input: c.Struct({ limit: c.optional(c.Number) }),
|
|
640
|
+
output: c.Array(O),
|
|
635
641
|
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
|
-
}),
|
|
637
|
-
name:
|
|
638
|
-
input:
|
|
639
|
-
approvalId:
|
|
640
|
-
decision:
|
|
641
|
-
note:
|
|
642
|
+
}), On = V({
|
|
643
|
+
name: En,
|
|
644
|
+
input: c.Struct({
|
|
645
|
+
approvalId: c.String,
|
|
646
|
+
decision: c.Literal("approve", "reject"),
|
|
647
|
+
note: c.optional(c.String)
|
|
642
648
|
}),
|
|
643
|
-
output:
|
|
644
|
-
approvalId:
|
|
645
|
-
status:
|
|
649
|
+
output: c.Struct({
|
|
650
|
+
approvalId: c.String,
|
|
651
|
+
status: c.Literal("approved", "rejected")
|
|
646
652
|
}),
|
|
647
653
|
error: D,
|
|
648
654
|
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
|
-
}),
|
|
650
|
-
connectionId:
|
|
655
|
+
}), 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({
|
|
656
|
+
connectionId: c.String,
|
|
651
657
|
kind: Q,
|
|
652
|
-
label:
|
|
653
|
-
status:
|
|
654
|
-
accountId:
|
|
655
|
-
accountLabel:
|
|
656
|
-
scopes:
|
|
657
|
-
expiresAt:
|
|
658
|
-
lastError:
|
|
659
|
-
connectedAt:
|
|
660
|
-
}),
|
|
661
|
-
connectionId:
|
|
658
|
+
label: c.String,
|
|
659
|
+
status: Nn,
|
|
660
|
+
accountId: c.NullOr(c.String),
|
|
661
|
+
accountLabel: c.NullOr(c.String),
|
|
662
|
+
scopes: c.Array(c.String),
|
|
663
|
+
expiresAt: c.NullOr(c.String),
|
|
664
|
+
lastError: c.NullOr(c.String),
|
|
665
|
+
connectedAt: c.NullOr(c.String)
|
|
666
|
+
}), Fn = class extends c.TaggedError()("ConnectionNotDeclared", { connectionId: c.String }) {}, In = class extends c.TaggedError()("ConnectionSubjectRequired", { connectionId: c.String }) {}, Ln = class extends c.TaggedError()("ConnectionKindMismatch", {
|
|
667
|
+
connectionId: c.String,
|
|
662
668
|
expected: Q,
|
|
663
669
|
actual: Q
|
|
664
|
-
}) {},
|
|
665
|
-
connectionId:
|
|
666
|
-
reason:
|
|
667
|
-
transient:
|
|
668
|
-
}) {}, $ =
|
|
669
|
-
name:
|
|
670
|
+
}) {}, Rn = class extends c.TaggedError()("ConnectionHandshakeFailed", {
|
|
671
|
+
connectionId: c.String,
|
|
672
|
+
reason: c.String,
|
|
673
|
+
transient: c.Boolean
|
|
674
|
+
}) {}, $ = c.Union(Fn, In, Ln, Rn), zn = B({
|
|
675
|
+
name: kn,
|
|
670
676
|
source: "_voltro_connections",
|
|
671
|
-
input:
|
|
672
|
-
output:
|
|
677
|
+
input: c.Struct({}),
|
|
678
|
+
output: c.Array(Pn),
|
|
673
679
|
openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
|
|
674
|
-
}),
|
|
675
|
-
name:
|
|
676
|
-
input:
|
|
677
|
-
connectionId:
|
|
678
|
-
redirectTo:
|
|
680
|
+
}), Bn = H({
|
|
681
|
+
name: An,
|
|
682
|
+
input: c.Struct({
|
|
683
|
+
connectionId: c.String,
|
|
684
|
+
redirectTo: c.optional(c.String)
|
|
679
685
|
}),
|
|
680
|
-
output:
|
|
681
|
-
authorizeUrl:
|
|
682
|
-
state:
|
|
686
|
+
output: c.Struct({
|
|
687
|
+
authorizeUrl: c.String,
|
|
688
|
+
state: c.String
|
|
683
689
|
}),
|
|
684
690
|
error: $,
|
|
685
691
|
openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
686
|
-
}),
|
|
687
|
-
name:
|
|
688
|
-
input:
|
|
689
|
-
connectionId:
|
|
690
|
-
token:
|
|
692
|
+
}), Vn = V({
|
|
693
|
+
name: jn,
|
|
694
|
+
input: c.Struct({
|
|
695
|
+
connectionId: c.String,
|
|
696
|
+
token: c.String
|
|
691
697
|
}),
|
|
692
|
-
output:
|
|
698
|
+
output: c.Struct({ ok: c.Boolean }),
|
|
693
699
|
error: $,
|
|
694
700
|
openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
695
|
-
}),
|
|
696
|
-
name:
|
|
697
|
-
input:
|
|
698
|
-
output:
|
|
701
|
+
}), Hn = V({
|
|
702
|
+
name: Mn,
|
|
703
|
+
input: c.Struct({ connectionId: c.String }),
|
|
704
|
+
output: c.Struct({ ok: c.Boolean }),
|
|
699
705
|
error: $,
|
|
700
706
|
openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
|
|
701
|
-
}),
|
|
707
|
+
}), Un = (e) => {
|
|
702
708
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
703
709
|
return Number.isNaN(t) ? 0 : t;
|
|
704
|
-
},
|
|
710
|
+
}, Wn = 1;
|
|
705
711
|
//#endregion
|
|
706
|
-
export {
|
|
712
|
+
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 };
|