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