@voltro/protocol 0.41.0 → 0.43.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 +188 -0
- package/dist/apikey.d.ts +1 -1
- package/dist/index.d.ts +199 -8
- package/dist/index.js +188 -150
- package/dist/jwt.d.ts +1 -1
- package/dist/rest.d.ts +3 -3
- package/dist/session.d.ts +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -138,12 +138,12 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
138
138
|
decidedAt: d.NullOr(d.String),
|
|
139
139
|
note: d.NullOr(d.String),
|
|
140
140
|
relation: d.Literal("to-decide", "requested")
|
|
141
|
-
}), N = "channel:",
|
|
142
|
-
if (
|
|
141
|
+
}), N = "channel:", P = Symbol.for("@voltro/protocol/reactivityChannels"), Ze = globalThis, F = Ze[P] ?? (Ze[P] = /* @__PURE__ */ new Map()), Qe = /^[a-z][a-z0-9-]*(\.[a-z0-9-]+)*$/, $e = (e) => {
|
|
142
|
+
if (!Qe.test(e)) throw Error(`reactivityChannel('${e}'): invalid channel name.\n Use lowercase kebab segments separated by dots — \`presence\`, \`job-queue\`,
|
|
143
143
|
\`billing.usage\`. A \`:\` is refused because it is the namespace separator in
|
|
144
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
|
|
145
145
|
routes as two.`);
|
|
146
|
-
let t =
|
|
146
|
+
let t = F.get(e);
|
|
147
147
|
if (t !== void 0) return t;
|
|
148
148
|
let n = `${N}${e}`, r = Object.freeze({
|
|
149
149
|
kind: "reactivity-channel",
|
|
@@ -151,15 +151,15 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
151
151
|
key: n,
|
|
152
152
|
toString: () => n
|
|
153
153
|
});
|
|
154
|
-
return
|
|
155
|
-
},
|
|
156
|
-
let t =
|
|
157
|
-
for (let r of e) for (let e of
|
|
154
|
+
return F.set(e, r), r;
|
|
155
|
+
}, et = (e) => typeof e == "object" && !!e && e.kind === "reactivity-channel", tt = (e) => e.startsWith(N), nt = () => new Set([...F.values()].map((e) => e.key)), I = (e) => et(e) ? e.key : e, rt = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map(I) : [I(e)], it = (e) => e === void 0 ? void 0 : Array.isArray(e) ? e.map(I) : I(e), at = (e) => {
|
|
156
|
+
let t = nt(), n = [];
|
|
157
|
+
for (let r of e) for (let e of rt(r.source)) !tt(e) || t.has(e) || n.push({
|
|
158
158
|
procedure: r.name,
|
|
159
159
|
key: e
|
|
160
160
|
});
|
|
161
161
|
return n;
|
|
162
|
-
},
|
|
162
|
+
}, ot = (e, t) => {
|
|
163
163
|
let n = e?.injectExternalChange;
|
|
164
164
|
return n !== void 0 && (n.call(e, {
|
|
165
165
|
table: t.key,
|
|
@@ -168,8 +168,8 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
168
168
|
old: {},
|
|
169
169
|
origin: "inline"
|
|
170
170
|
}), !0);
|
|
171
|
-
},
|
|
172
|
-
if (
|
|
171
|
+
}, st = (e) => e.internal !== !0, L = (e) => {
|
|
172
|
+
if (ct(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
|
|
173
173
|
unguarded procedure, or list the scopes required to call it.`);
|
|
174
174
|
let t = typeof e.source == "string" ? [e.source] : Array.isArray(e.source) ? e.source : void 0;
|
|
175
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,
|
|
@@ -186,7 +186,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
186
186
|
let n = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
187
187
|
if (n.length === 0) return e;
|
|
188
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.`);
|
|
189
|
-
},
|
|
189
|
+
}, ct = (e) => {
|
|
190
190
|
let t = e.requiresApproval;
|
|
191
191
|
if (t !== void 0) {
|
|
192
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
|
|
@@ -196,48 +196,48 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
196
196
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
197
197
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
198
198
|
}
|
|
199
|
-
},
|
|
199
|
+
}, lt = (e) => e.action !== void 0 && e.resourceType !== void 0, ut = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, R = (e, t, n) => {
|
|
200
200
|
if (n === void 0) return t;
|
|
201
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
|
|
202
202
|
without an authorization check — e.g. \`openAccess: 'public pricing, no caller data'\`.`);
|
|
203
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
|
|
204
204
|
caller must hold a scope; drop them if anyone may call it.`);
|
|
205
205
|
return [u(n.trim())];
|
|
206
|
-
},
|
|
206
|
+
}, z = (e) => L({
|
|
207
207
|
kind: "query",
|
|
208
208
|
name: e.name,
|
|
209
209
|
input: e.input,
|
|
210
210
|
output: e.output,
|
|
211
211
|
error: e.error ?? d.Never,
|
|
212
|
-
source:
|
|
212
|
+
source: it(e.source),
|
|
213
213
|
cache: e.cache,
|
|
214
|
-
guards:
|
|
214
|
+
guards: R(e.name, e.guards, e.openAccess),
|
|
215
215
|
openAccess: e.openAccess,
|
|
216
216
|
publicApi: e.publicApi,
|
|
217
217
|
exposeAsTool: e.exposeAsTool,
|
|
218
218
|
internal: e.internal,
|
|
219
219
|
overridesPlugin: e.overridesPlugin
|
|
220
|
-
}),
|
|
220
|
+
}), B = (e) => L({
|
|
221
221
|
kind: "mutation",
|
|
222
222
|
name: e.name,
|
|
223
223
|
input: e.input,
|
|
224
224
|
output: e.output,
|
|
225
225
|
error: e.error ?? d.Never,
|
|
226
226
|
target: e.target,
|
|
227
|
-
guards:
|
|
227
|
+
guards: R(e.name, e.guards, e.openAccess),
|
|
228
228
|
openAccess: e.openAccess,
|
|
229
229
|
publicApi: e.publicApi,
|
|
230
230
|
exposeAsTool: e.exposeAsTool,
|
|
231
231
|
requiresApproval: e.requiresApproval,
|
|
232
232
|
internal: e.internal,
|
|
233
233
|
overridesPlugin: e.overridesPlugin
|
|
234
|
-
}),
|
|
234
|
+
}), V = (e) => L({
|
|
235
235
|
kind: "action",
|
|
236
236
|
name: e.name,
|
|
237
237
|
input: e.input,
|
|
238
238
|
output: e.output,
|
|
239
239
|
error: e.error ?? d.Never,
|
|
240
|
-
guards:
|
|
240
|
+
guards: R(e.name, e.guards, e.openAccess),
|
|
241
241
|
openAccess: e.openAccess,
|
|
242
242
|
source: e.source,
|
|
243
243
|
target: e.target,
|
|
@@ -246,7 +246,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
246
246
|
requiresApproval: e.requiresApproval,
|
|
247
247
|
internal: e.internal,
|
|
248
248
|
overridesPlugin: e.overridesPlugin
|
|
249
|
-
}),
|
|
249
|
+
}), dt = (e) => L({
|
|
250
250
|
kind: "stream",
|
|
251
251
|
name: e.name,
|
|
252
252
|
input: e.input,
|
|
@@ -254,42 +254,42 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
254
254
|
error: e.error ?? d.Never,
|
|
255
255
|
internal: e.internal,
|
|
256
256
|
overridesPlugin: e.overridesPlugin,
|
|
257
|
-
guards:
|
|
257
|
+
guards: R(e.name, e.guards, e.openAccess),
|
|
258
258
|
openAccess: e.openAccess
|
|
259
|
-
}),
|
|
259
|
+
}), H = (e, t) => t && t.length > 0 ? d.Union(e, ...t) : e, U = (e) => e !== void 0 && e.some((e) => !l(e)), ft = (e, t) => U(t) ? d.Union(e, c, s) : e, pt = (e) => d.Union(e, x), mt = (e, t) => t === void 0 ? e : d.Union(e, A), W = (e, t) => {
|
|
260
260
|
if (t === "stream") return e.error;
|
|
261
|
-
let n =
|
|
262
|
-
return t === "query" ? n :
|
|
263
|
-
},
|
|
264
|
-
payload: b(e.input, e.name,
|
|
261
|
+
let n = ft(e.error, e.guards);
|
|
262
|
+
return t === "query" ? n : mt(t === "mutation" ? pt(n) : n, e.requiresApproval);
|
|
263
|
+
}, ht = (e, t) => f.make(e.name, {
|
|
264
|
+
payload: b(e.input, e.name, U(e.guards)),
|
|
265
265
|
success: v(e.output),
|
|
266
|
-
error:
|
|
266
|
+
error: H(W(e, "query"), t),
|
|
267
267
|
stream: !0
|
|
268
|
+
}), gt = (e, t) => f.make(e.name, {
|
|
269
|
+
payload: b(e.input, e.name, U(e.guards)),
|
|
270
|
+
success: e.output,
|
|
271
|
+
error: H(W(e, "mutation"), t)
|
|
268
272
|
}), _t = (e, t) => f.make(e.name, {
|
|
269
|
-
payload: b(e.input, e.name,
|
|
273
|
+
payload: b(e.input, e.name, U(e.guards)),
|
|
270
274
|
success: e.output,
|
|
271
|
-
error:
|
|
275
|
+
error: H(W(e, "action"), t)
|
|
272
276
|
}), vt = (e, t) => f.make(e.name, {
|
|
273
|
-
payload: b(e.input, e.name,
|
|
274
|
-
success: e.output,
|
|
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)),
|
|
277
|
+
payload: b(e.input, e.name, U(e.guards)),
|
|
278
278
|
success: e.element,
|
|
279
|
-
error:
|
|
279
|
+
error: H(e.error, t),
|
|
280
280
|
stream: !0
|
|
281
|
-
}),
|
|
281
|
+
}), yt = (e) => {
|
|
282
282
|
if (typeof e != "object" || !e) return;
|
|
283
283
|
let t = e._tag;
|
|
284
284
|
return typeof t == "string" ? t : void 0;
|
|
285
|
-
},
|
|
285
|
+
}, bt = (e) => {
|
|
286
286
|
switch (e.kind) {
|
|
287
|
-
case "query": return
|
|
288
|
-
case "mutation": return
|
|
289
|
-
case "action": return
|
|
290
|
-
case "stream": return
|
|
287
|
+
case "query": return ht(e);
|
|
288
|
+
case "mutation": return gt(e);
|
|
289
|
+
case "action": return _t(e);
|
|
290
|
+
case "stream": return vt(e);
|
|
291
291
|
}
|
|
292
|
-
},
|
|
292
|
+
}, xt = (e) => {
|
|
293
293
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
294
294
|
if (e.kind === "query") return {
|
|
295
295
|
kind: "query",
|
|
@@ -330,7 +330,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
330
330
|
..."shapeItem" in e && e.shapeItem !== void 0 ? { shapeItem: e.shapeItem } : {}
|
|
331
331
|
}))
|
|
332
332
|
};
|
|
333
|
-
},
|
|
333
|
+
}, St = 7500, Ct = (e) => typeof e == "object" && !!e && e.kind === "event", wt = (e) => {
|
|
334
334
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
335
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
|
|
336
336
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -365,69 +365,69 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
365
365
|
webhook: e.webhook,
|
|
366
366
|
delivery: e.delivery
|
|
367
367
|
};
|
|
368
|
-
},
|
|
368
|
+
}, Tt = (e) => d.Struct({
|
|
369
369
|
_tag: d.Literal("event"),
|
|
370
370
|
origin: d.String,
|
|
371
371
|
n: d.Number,
|
|
372
372
|
emittedAt: d.Number,
|
|
373
373
|
payload: e
|
|
374
|
-
}),
|
|
374
|
+
}), Et = d.Struct({
|
|
375
375
|
_tag: d.Literal("gap"),
|
|
376
376
|
missed: d.Number,
|
|
377
377
|
reason: d.Literal("buffer", "resume")
|
|
378
|
-
}),
|
|
378
|
+
}), Dt = d.Struct({ _tag: d.Literal("attached") }), Ot = (e) => d.Union(Dt, Tt(e), Et), kt = d.Struct({
|
|
379
379
|
origin: d.String,
|
|
380
380
|
n: d.Number
|
|
381
|
-
}),
|
|
381
|
+
}), At = (e) => d.Struct({
|
|
382
382
|
key: e,
|
|
383
|
-
resume: d.optional(d.Array(
|
|
384
|
-
}),
|
|
383
|
+
resume: d.optional(d.Array(kt))
|
|
384
|
+
}), jt = (e, t) => {
|
|
385
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
386
|
return f.make(e.name, {
|
|
387
|
-
payload: b(
|
|
388
|
-
success:
|
|
387
|
+
payload: b(At(e.key), e.name, U(e.guards)),
|
|
388
|
+
success: Ot(e.payload),
|
|
389
389
|
error: r,
|
|
390
390
|
stream: !0
|
|
391
391
|
});
|
|
392
|
-
},
|
|
392
|
+
}, Mt = class extends d.TaggedError()("EventPayloadInvalid", {
|
|
393
393
|
event: d.String,
|
|
394
394
|
message: d.String
|
|
395
|
-
}) {},
|
|
395
|
+
}) {}, Nt = class extends d.TaggedError()("EventKeyInvalid", {
|
|
396
396
|
event: d.String,
|
|
397
397
|
message: d.String
|
|
398
|
-
}) {},
|
|
398
|
+
}) {}, Pt = class extends d.TaggedError()("EventPayloadTooLarge", {
|
|
399
399
|
event: d.String,
|
|
400
400
|
bytes: d.Number,
|
|
401
401
|
limit: d.Number
|
|
402
|
-
}) {},
|
|
402
|
+
}) {}, Ft = (e) => {
|
|
403
403
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
404
404
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
405
405
|
return JSON.stringify(t);
|
|
406
|
-
},
|
|
406
|
+
}, It = "\0", Lt = (e, t, n) => [
|
|
407
407
|
e ?? "~",
|
|
408
408
|
t,
|
|
409
|
-
|
|
410
|
-
].join("\0"),
|
|
409
|
+
Ft(n)
|
|
410
|
+
].join("\0"), Rt = (e) => {
|
|
411
411
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
412
412
|
return {
|
|
413
413
|
tenantId: t === "~" ? null : t,
|
|
414
414
|
event: n,
|
|
415
415
|
key: r
|
|
416
416
|
};
|
|
417
|
-
},
|
|
417
|
+
}, zt = (e) => e.split("\0").join(" · "), Bt = (e) => e, Vt = (e) => e, Ht = (e) => {
|
|
418
418
|
let t = e.alias?.trim(), n = e.instance?.trim(), r = t !== void 0 && t !== "" ? t : e.base;
|
|
419
419
|
return n !== void 0 && n !== "" ? `${r}#${n}` : r;
|
|
420
|
-
},
|
|
420
|
+
}, Ut = (e) => {
|
|
421
421
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
422
|
-
},
|
|
422
|
+
}, Wt = (e, t) => {
|
|
423
423
|
let n = He.GenericTag(e);
|
|
424
424
|
return {
|
|
425
425
|
Tag: n,
|
|
426
426
|
Live: Ue.succeed(n, t)
|
|
427
427
|
};
|
|
428
|
-
},
|
|
428
|
+
}, Gt = (e, t, n) => {
|
|
429
429
|
if (!t) return { ok: !0 };
|
|
430
|
-
let r =
|
|
430
|
+
let r = G(n);
|
|
431
431
|
if (!r) return {
|
|
432
432
|
ok: !1,
|
|
433
433
|
reason: `cannot parse runningVersion "${n}"`
|
|
@@ -435,12 +435,12 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
435
435
|
let i = t.trim();
|
|
436
436
|
if (i === "*" || i === "") return { ok: !0 };
|
|
437
437
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
438
|
-
for (let i of a) if (!
|
|
438
|
+
for (let i of a) if (!Kt(i, r)) return {
|
|
439
439
|
ok: !1,
|
|
440
440
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
441
441
|
};
|
|
442
442
|
return { ok: !0 };
|
|
443
|
-
},
|
|
443
|
+
}, G = (e) => {
|
|
444
444
|
let t = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9a-zA-Z.-]+))?$/.exec(e.trim());
|
|
445
445
|
return t ? {
|
|
446
446
|
major: Number(t[1]),
|
|
@@ -448,44 +448,44 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
448
448
|
patch: Number(t[3]),
|
|
449
449
|
pre: t[4] ?? ""
|
|
450
450
|
} : null;
|
|
451
|
-
},
|
|
451
|
+
}, K = (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, Kt = (e, t) => {
|
|
452
452
|
if (e === "*") return !0;
|
|
453
453
|
if (e.startsWith("^")) {
|
|
454
|
-
let n =
|
|
455
|
-
return !n || t.major !== n.major ? !1 :
|
|
454
|
+
let n = G(e.slice(1));
|
|
455
|
+
return !n || t.major !== n.major ? !1 : K(t, n) >= 0;
|
|
456
456
|
}
|
|
457
457
|
if (e.startsWith("~")) {
|
|
458
|
-
let n =
|
|
459
|
-
return !n || t.major !== n.major || t.minor !== n.minor ? !1 :
|
|
458
|
+
let n = G(e.slice(1));
|
|
459
|
+
return !n || t.major !== n.major || t.minor !== n.minor ? !1 : K(t, n) >= 0;
|
|
460
460
|
}
|
|
461
461
|
let n = /^(>=|<=|>|<)(.+)$/.exec(e);
|
|
462
462
|
if (n) {
|
|
463
|
-
let e = n[1], r =
|
|
463
|
+
let e = n[1], r = G(n[2]);
|
|
464
464
|
if (!r) return !1;
|
|
465
|
-
let i =
|
|
465
|
+
let i = K(t, r);
|
|
466
466
|
if (e === ">=") return i >= 0;
|
|
467
467
|
if (e === "<=") return i <= 0;
|
|
468
468
|
if (e === ">") return i > 0;
|
|
469
469
|
if (e === "<") return i < 0;
|
|
470
470
|
}
|
|
471
|
-
let r =
|
|
472
|
-
return r ?
|
|
473
|
-
},
|
|
471
|
+
let r = G(e);
|
|
472
|
+
return r ? K(t, r) === 0 : !1;
|
|
473
|
+
}, q = d.Literal("running", "succeeded", "failed", "cancelled", "suspended"), qt = d.Literal("cancel", "terminate", "abandon"), Jt = d.Struct({
|
|
474
474
|
mode: d.String,
|
|
475
475
|
dueAt: d.NullOr(d.Number),
|
|
476
476
|
retryAfterMs: d.NullOr(d.Number),
|
|
477
477
|
intentId: d.NullOr(d.String)
|
|
478
|
-
}),
|
|
478
|
+
}), Yt = d.Struct({
|
|
479
479
|
id: d.String,
|
|
480
480
|
workflowName: d.String,
|
|
481
481
|
executionId: d.NullOr(d.String),
|
|
482
482
|
status: d.Literal("running", "queued", "dropped", "skipped"),
|
|
483
|
-
deferral: d.optional(
|
|
484
|
-
}),
|
|
483
|
+
deferral: d.optional(Jt)
|
|
484
|
+
}), J = d.Struct({
|
|
485
485
|
id: d.String,
|
|
486
486
|
tag: d.String,
|
|
487
487
|
executionId: d.String,
|
|
488
|
-
status:
|
|
488
|
+
status: q,
|
|
489
489
|
payload: d.Unknown,
|
|
490
490
|
workflowVersion: d.NullOr(d.String),
|
|
491
491
|
workflowPatches: d.NullOr(d.Unknown),
|
|
@@ -500,12 +500,12 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
500
500
|
durationMs: d.NullOr(d.Number),
|
|
501
501
|
traceId: d.NullOr(d.String),
|
|
502
502
|
parentExecutionId: d.NullOr(d.String),
|
|
503
|
-
parentClosePolicy: d.NullOr(
|
|
504
|
-
}),
|
|
503
|
+
parentClosePolicy: d.NullOr(qt)
|
|
504
|
+
}), Xt = d.Struct({
|
|
505
505
|
tag: d.optional(d.String),
|
|
506
|
-
status: d.optional(
|
|
506
|
+
status: d.optional(q),
|
|
507
507
|
limit: d.optional(d.Number)
|
|
508
|
-
}),
|
|
508
|
+
}), Zt = d.Struct({
|
|
509
509
|
id: d.String,
|
|
510
510
|
runId: d.String,
|
|
511
511
|
stepName: d.String,
|
|
@@ -520,7 +520,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
520
520
|
startedAt: d.Date,
|
|
521
521
|
completedAt: d.NullOr(d.Date),
|
|
522
522
|
durationMs: d.NullOr(d.Number)
|
|
523
|
-
}),
|
|
523
|
+
}), Qt = d.Struct({
|
|
524
524
|
id: d.String,
|
|
525
525
|
runId: d.String,
|
|
526
526
|
eventType: d.String,
|
|
@@ -528,7 +528,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
528
528
|
occurredAt: d.Date,
|
|
529
529
|
stepName: d.NullOr(d.String),
|
|
530
530
|
attempt: d.NullOr(d.Number)
|
|
531
|
-
}),
|
|
531
|
+
}), $t = d.Struct({
|
|
532
532
|
id: d.String,
|
|
533
533
|
name: d.String,
|
|
534
534
|
payload: d.Unknown,
|
|
@@ -536,7 +536,7 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
536
536
|
subject: d.NullOr(d.Unknown),
|
|
537
537
|
traceId: d.NullOr(d.String),
|
|
538
538
|
occurredAt: d.Date
|
|
539
|
-
}),
|
|
539
|
+
}), en = d.Struct({
|
|
540
540
|
id: d.String,
|
|
541
541
|
eventId: d.String,
|
|
542
542
|
eventName: d.String,
|
|
@@ -549,108 +549,146 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
549
549
|
errorMessage: d.NullOr(d.String),
|
|
550
550
|
createdAt: d.Date,
|
|
551
551
|
completedAt: d.NullOr(d.Date)
|
|
552
|
-
}),
|
|
552
|
+
}), tn = d.Struct({ id: d.String }), Y = d.Struct({ runId: d.String }), nn = d.Struct({
|
|
553
553
|
name: d.optional(d.String),
|
|
554
554
|
limit: d.optional(d.Number)
|
|
555
|
-
}),
|
|
555
|
+
}), rn = d.Struct({ eventId: d.String }), X = d.Struct({
|
|
556
556
|
workflowName: d.String,
|
|
557
557
|
executionId: d.String
|
|
558
|
-
}),
|
|
558
|
+
}), an = d.Struct({
|
|
559
559
|
id: d.String,
|
|
560
560
|
signalName: d.String,
|
|
561
561
|
payload: d.optional(d.Unknown)
|
|
562
|
-
}),
|
|
562
|
+
}), on = d.Struct({
|
|
563
563
|
id: d.String,
|
|
564
564
|
updateName: d.String,
|
|
565
565
|
payload: d.optional(d.Unknown),
|
|
566
566
|
timeoutMs: d.optional(d.Number)
|
|
567
|
-
}),
|
|
567
|
+
}), sn = d.Struct({
|
|
568
568
|
eventId: d.String,
|
|
569
569
|
updateId: d.String,
|
|
570
570
|
completedEventId: d.String,
|
|
571
571
|
result: d.Unknown
|
|
572
|
-
}),
|
|
572
|
+
}), cn = z({
|
|
573
573
|
name: "__voltro.workflow.run",
|
|
574
574
|
source: "_voltro_workflow_runs",
|
|
575
|
-
input:
|
|
576
|
-
output: d.Array(
|
|
577
|
-
}),
|
|
575
|
+
input: tn,
|
|
576
|
+
output: d.Array(J)
|
|
577
|
+
}), ln = z({
|
|
578
578
|
name: "__voltro.workflow.runs",
|
|
579
579
|
source: "_voltro_workflow_runs",
|
|
580
|
-
input:
|
|
581
|
-
output: d.Array(
|
|
582
|
-
}),
|
|
580
|
+
input: Xt,
|
|
581
|
+
output: d.Array(J)
|
|
582
|
+
}), un = z({
|
|
583
583
|
name: "__voltro.workflow.run.steps",
|
|
584
584
|
source: "_voltro_workflow_run_steps",
|
|
585
|
-
input:
|
|
586
|
-
output: d.Array(
|
|
587
|
-
}),
|
|
585
|
+
input: Y,
|
|
586
|
+
output: d.Array(Zt)
|
|
587
|
+
}), dn = z({
|
|
588
588
|
name: "__voltro.workflow.run.events",
|
|
589
589
|
source: "_voltro_workflow_run_events",
|
|
590
|
-
input:
|
|
591
|
-
output: d.Array(
|
|
592
|
-
}),
|
|
590
|
+
input: Y,
|
|
591
|
+
output: d.Array(Qt)
|
|
592
|
+
}), fn = z({
|
|
593
593
|
name: "__voltro.workflow.domainEvents",
|
|
594
594
|
source: "_voltro_workflow_events",
|
|
595
|
-
input:
|
|
596
|
-
output: d.Array(
|
|
597
|
-
}),
|
|
595
|
+
input: nn,
|
|
596
|
+
output: d.Array($t)
|
|
597
|
+
}), pn = z({
|
|
598
598
|
name: "__voltro.workflow.event.deliveries",
|
|
599
599
|
source: "_voltro_workflow_event_deliveries",
|
|
600
|
-
input:
|
|
601
|
-
output: d.Array(
|
|
602
|
-
}),
|
|
600
|
+
input: rn,
|
|
601
|
+
output: d.Array(en)
|
|
602
|
+
}), mn = V({
|
|
603
603
|
name: "__voltro.workflow.cancel",
|
|
604
|
-
input:
|
|
604
|
+
input: X,
|
|
605
605
|
output: d.Struct({ ok: d.Boolean })
|
|
606
|
-
}),
|
|
606
|
+
}), hn = V({
|
|
607
607
|
name: "__voltro.workflow.resume",
|
|
608
|
-
input:
|
|
608
|
+
input: X,
|
|
609
609
|
output: d.Struct({ ok: d.Boolean })
|
|
610
|
-
}),
|
|
610
|
+
}), gn = V({
|
|
611
611
|
name: "__voltro.workflow.signal",
|
|
612
|
-
input:
|
|
612
|
+
input: an,
|
|
613
613
|
output: d.Struct({ eventId: d.String })
|
|
614
|
-
}),
|
|
614
|
+
}), _n = V({
|
|
615
615
|
name: "__voltro.workflow.update",
|
|
616
|
-
input:
|
|
617
|
-
output:
|
|
618
|
-
}),
|
|
616
|
+
input: on,
|
|
617
|
+
output: sn
|
|
618
|
+
}), vn = "__voltro.undo.log", yn = "__voltro.undo.apply", bn = "__voltro.undo.redo", xn = d.Struct({
|
|
619
619
|
id: d.String,
|
|
620
620
|
tag: d.String,
|
|
621
621
|
label: d.NullOr(d.String),
|
|
622
622
|
undone: d.Boolean,
|
|
623
623
|
crossesAction: d.Boolean,
|
|
624
624
|
createdAt: d.String
|
|
625
|
-
}),
|
|
625
|
+
}), Sn = class extends d.TaggedError()("UndoNotFound", { invocationId: d.String }) {}, Cn = class extends d.TaggedError()("UndoForbidden", { invocationId: d.String }) {}, wn = class extends d.TaggedError()("UndoConflict", {
|
|
626
626
|
invocationId: d.String,
|
|
627
627
|
reason: d.Literal("conflict", "action")
|
|
628
|
-
}) {}, Tn = d.Union(Cn, wn
|
|
629
|
-
name:
|
|
628
|
+
}) {}, Tn = d.Union(Sn, Cn, wn), En = z({
|
|
629
|
+
name: vn,
|
|
630
630
|
source: "_voltro_undo_log",
|
|
631
631
|
input: d.Struct({ limit: d.optional(d.Number) }),
|
|
632
|
-
output: d.Array(
|
|
632
|
+
output: d.Array(xn),
|
|
633
633
|
openAccess: "subject-scoped by construction: lists only the calling subject's own undoable actions"
|
|
634
|
-
}), Dn =
|
|
635
|
-
name:
|
|
634
|
+
}), Dn = B({
|
|
635
|
+
name: yn,
|
|
636
636
|
input: d.Struct({ invocationId: d.String }),
|
|
637
637
|
output: d.Struct({ ok: d.Boolean }),
|
|
638
638
|
error: Tn,
|
|
639
639
|
openAccess: "subject-scoped by construction: undo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
640
|
-
}), On =
|
|
641
|
-
name:
|
|
640
|
+
}), On = B({
|
|
641
|
+
name: bn,
|
|
642
642
|
input: d.Struct({ invocationId: d.String }),
|
|
643
643
|
output: d.Struct({ ok: d.Boolean }),
|
|
644
644
|
error: Tn,
|
|
645
645
|
openAccess: "subject-scoped by construction: redo is per-actor — another subject's invocation fails typed with UndoForbidden"
|
|
646
|
-
}), kn =
|
|
647
|
-
|
|
646
|
+
}), kn = class extends d.TaggedError()("TenantScopeViolation", {
|
|
647
|
+
table: d.String,
|
|
648
|
+
reason: d.String
|
|
649
|
+
}) {}, An = class extends d.TaggedError()("StoreOperationFailed", {
|
|
650
|
+
operation: d.String,
|
|
651
|
+
table: d.String,
|
|
652
|
+
cause: d.String
|
|
653
|
+
}) {}, jn = class extends d.TaggedError()("TableValidationFailed", {
|
|
654
|
+
table: d.String,
|
|
655
|
+
summary: d.String,
|
|
656
|
+
issues: d.Array(d.Struct({
|
|
657
|
+
path: d.String,
|
|
658
|
+
message: d.String
|
|
659
|
+
}))
|
|
660
|
+
}) {}, Mn = class extends d.TaggedError()("TenantRowNotFound", {
|
|
661
|
+
table: d.String,
|
|
662
|
+
id: d.String,
|
|
663
|
+
reason: d.String
|
|
664
|
+
}) {}, Nn = class extends d.TaggedError()("ServerOnlyColumnWrite", {
|
|
665
|
+
table: d.String,
|
|
666
|
+
columns: d.Array(d.String)
|
|
667
|
+
}) {}, Pn = class extends d.TaggedError()("ConstraintViolation", {
|
|
668
|
+
kind: d.Literal("foreignKey", "foreignKeyInUse", "unique", "notNull", "check"),
|
|
669
|
+
table: d.String,
|
|
670
|
+
operation: d.String,
|
|
671
|
+
constraint: d.optional(d.String),
|
|
672
|
+
column: d.optional(d.String)
|
|
673
|
+
}) {
|
|
674
|
+
get message() {
|
|
675
|
+
let e = this.constraint ?? this.column, t = e === void 0 ? `on ${this.table}` : `${e} on ${this.table}`;
|
|
676
|
+
switch (this.kind) {
|
|
677
|
+
case "foreignKey": return `foreign key ${t}: the referenced row does not exist`;
|
|
678
|
+
case "foreignKeyInUse": return `foreign key ${t}: the row is still referenced by other rows`;
|
|
679
|
+
case "unique": return `unique constraint ${t}: a row with this value already exists`;
|
|
680
|
+
case "notNull": return `not-null constraint ${t}: the column requires a value`;
|
|
681
|
+
case "check": return `check constraint ${t}: the row does not satisfy it`;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}, Fn = "__voltro.approvals.pending", Z = "__voltro.approvals.decide", In = z({
|
|
685
|
+
name: Fn,
|
|
648
686
|
source: "_voltro_approvals",
|
|
649
687
|
input: d.Struct({ limit: d.optional(d.Number) }),
|
|
650
688
|
output: d.Array(M),
|
|
651
689
|
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"
|
|
652
|
-
}),
|
|
653
|
-
name:
|
|
690
|
+
}), Ln = B({
|
|
691
|
+
name: Z,
|
|
654
692
|
input: d.Struct({
|
|
655
693
|
approvalId: d.String,
|
|
656
694
|
decision: d.Literal("approve", "reject"),
|
|
@@ -662,33 +700,33 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
662
700
|
}),
|
|
663
701
|
error: j,
|
|
664
702
|
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"
|
|
665
|
-
}),
|
|
703
|
+
}), Rn = "__voltro.connections.list", zn = "__voltro.connections.start", Bn = "__voltro.connections.submitToken", Vn = "__voltro.connections.disconnect", Q = d.Literal("oauth2", "pat"), Hn = d.Literal("disconnected", "connected", "expired", "revoked", "error"), Un = d.Struct({
|
|
666
704
|
connectionId: d.String,
|
|
667
|
-
kind:
|
|
705
|
+
kind: Q,
|
|
668
706
|
label: d.String,
|
|
669
|
-
status:
|
|
707
|
+
status: Hn,
|
|
670
708
|
accountId: d.NullOr(d.String),
|
|
671
709
|
accountLabel: d.NullOr(d.String),
|
|
672
710
|
scopes: d.Array(d.String),
|
|
673
711
|
expiresAt: d.NullOr(d.String),
|
|
674
712
|
lastError: d.NullOr(d.String),
|
|
675
713
|
connectedAt: d.NullOr(d.String)
|
|
676
|
-
}),
|
|
714
|
+
}), Wn = class extends d.TaggedError()("ConnectionNotDeclared", { connectionId: d.String }) {}, Gn = class extends d.TaggedError()("ConnectionSubjectRequired", { connectionId: d.String }) {}, Kn = class extends d.TaggedError()("ConnectionKindMismatch", {
|
|
677
715
|
connectionId: d.String,
|
|
678
|
-
expected:
|
|
679
|
-
actual:
|
|
680
|
-
}) {},
|
|
716
|
+
expected: Q,
|
|
717
|
+
actual: Q
|
|
718
|
+
}) {}, qn = class extends d.TaggedError()("ConnectionHandshakeFailed", {
|
|
681
719
|
connectionId: d.String,
|
|
682
720
|
reason: d.String,
|
|
683
721
|
transient: d.Boolean
|
|
684
|
-
}) {}, $ = d.Union(
|
|
685
|
-
name:
|
|
722
|
+
}) {}, $ = d.Union(Wn, Gn, Kn, qn), Jn = z({
|
|
723
|
+
name: Rn,
|
|
686
724
|
source: "_voltro_connections",
|
|
687
725
|
input: d.Struct({}),
|
|
688
|
-
output: d.Array(
|
|
726
|
+
output: d.Array(Un),
|
|
689
727
|
openAccess: "self-scoped read: projects the declared connections for the calling subject only (its own connect/disconnect state)"
|
|
690
|
-
}),
|
|
691
|
-
name:
|
|
728
|
+
}), Yn = V({
|
|
729
|
+
name: zn,
|
|
692
730
|
input: d.Struct({
|
|
693
731
|
connectionId: d.String,
|
|
694
732
|
redirectTo: d.optional(d.String)
|
|
@@ -699,8 +737,8 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
699
737
|
}),
|
|
700
738
|
error: $,
|
|
701
739
|
openAccess: "self-service: begins an oauth handshake that stores a credential for the calling subject only; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
702
|
-
}),
|
|
703
|
-
name:
|
|
740
|
+
}), Xn = B({
|
|
741
|
+
name: Bn,
|
|
704
742
|
input: d.Struct({
|
|
705
743
|
connectionId: d.String,
|
|
706
744
|
token: d.String
|
|
@@ -708,15 +746,15 @@ var We = d.Union(d.String, d.Number), p = d.Record({
|
|
|
708
746
|
output: d.Struct({ ok: d.Boolean }),
|
|
709
747
|
error: $,
|
|
710
748
|
openAccess: "self-service: stores a pasted token as the calling subject's own credential; anonymous callers fail typed with ConnectionSubjectRequired"
|
|
711
|
-
}),
|
|
712
|
-
name:
|
|
749
|
+
}), Zn = B({
|
|
750
|
+
name: Vn,
|
|
713
751
|
input: d.Struct({ connectionId: d.String }),
|
|
714
752
|
output: d.Struct({ ok: d.Boolean }),
|
|
715
753
|
error: $,
|
|
716
754
|
openAccess: "self-service: deletes only the calling subject's own credential row for this connection"
|
|
717
|
-
}),
|
|
755
|
+
}), Qn = (e) => {
|
|
718
756
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
719
757
|
return Number.isNaN(t) ? 0 : t;
|
|
720
|
-
},
|
|
758
|
+
}, $n = 1;
|
|
721
759
|
//#endregion
|
|
722
|
-
export { Oe as ADMIN_SCOPE, Ce as APIKEY_ISSUE_ORG_SCOPE, Ee as APIKEY_ISSUE_OTHER_SCOPE, ve as APIKEY_ISSUE_SELF_SCOPE,
|
|
760
|
+
export { Oe as ADMIN_SCOPE, Ce as APIKEY_ISSUE_ORG_SCOPE, Ee as APIKEY_ISSUE_OTHER_SCOPE, ve as APIKEY_ISSUE_SELF_SCOPE, Z as APPROVALS_DECIDE_TAG, Fn 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, Rn as CONNECTIONS_LIST_TAG, Vn as CONNECTION_DISCONNECT_TAG, zn as CONNECTION_START_TAG, Bn as CONNECTION_SUBMIT_TOKEN_TAG, qn as ConnectionHandshakeFailed, ce as ConnectionInfo, i as ConnectionInfoMiddleware, Q as ConnectionKind, Kn as ConnectionKindMismatch, Wn as ConnectionNotDeclared, Un as ConnectionState, Hn as ConnectionStatus, Gn as ConnectionSubjectRequired, Pn as ConstraintViolation, r as DEFAULT_SCOPE_CACHE_MAX_ENTRIES, ie as DEFAULT_SCOPE_CACHE_TTL_MS, It as EVENT_ROUTE_SEP, Nt as EventKeyInvalid, Mt as EventPayloadInvalid, Pt as EventPayloadTooLarge, be as IMPERSONATION_METADATA_KEY, St as MAX_EVENT_ENVELOPE_BYTES, $n as PROTOCOL_VERSION, M as PendingApproval, N as REACTIVITY_CHANNEL_PREFIX, c as ScopeError, Nn as ServerOnlyColumnWrite, An as StoreOperationFailed, e as Subject, ye as SubjectIdentity, re as SubjectService, jn as TableValidationFailed, Mn as TenantRowNotFound, kn as TenantScopeViolation, yn as UNDO_APPLY_TAG, vn as UNDO_LOG_TAG, bn as UNDO_REDO_TAG, s as Unauthenticated, wn as UndoConflict, Cn as UndoForbidden, xn as UndoLogEntry, Sn as UndoNotFound, X as WorkflowControlInputSchema, $t as WorkflowDomainEventRowSchema, nn as WorkflowDomainEventsInputSchema, rn as WorkflowEventDeliveriesInputSchema, en as WorkflowEventDeliveryRowSchema, qt as WorkflowParentClosePolicySchema, Qt as WorkflowRunEventRowSchema, Yt as WorkflowRunHandleSchema, tn as WorkflowRunRefSchema, J as WorkflowRunRowSchema, q as WorkflowRunStatusSchema, Zt as WorkflowRunStepRowSchema, Y as WorkflowRunTableRefSchema, Xt as WorkflowRunsInputSchema, an as WorkflowSignalInputSchema, Jt as WorkflowStartDeferralSchema, on as WorkflowUpdateInputSchema, sn as WorkflowUpdateResultSchema, _t as actionToRpc, we as advisoryResourceGuardWarning, ae as anonymousSubject, Ye as applyRowPatch, a as applyScopeDecision, Ln as approvalsDecideDescriptor, In as approvalsPendingQueryDescriptor, te as assertAuthenticated, ze as beginIdempotent, Gt as checkFrameworkCompat, De as checkGuards, me as checkGuardsEffect, ne as composeAuthStrategies, Ut as composeRpcInterceptors, Zn as connectionDisconnectDescriptor, Yn as connectionStartDescriptor, Xn as connectionSubmitTokenDescriptor, Jn as connectionsListQueryDescriptor, nt as declaredReactivityChannelKeys, V as defineAction, wt as defineEvent, B as defineMutation, Bt as definePlugin, Vt as definePluginRoute, Wt as definePluginService, z as defineQuery, dt as defineStream, qe as diffRows, xe as effectiveScopes, Ft as encodeEventKey, yt as errorTag, Dt as eventAttached, Tt as eventEnvelope, Et as eventGap, kt as eventResumePoint, Lt as eventRoute, Ot as eventStreamEvent, At as eventSubscribeInput, jt as eventToRpc, Ie as failIdempotent, ke as findAdvisoryResourceGuards, Pe as finishIdempotent, zt as formatEventRoute, he as getPolicyGuardResolver, ge as getResourceScopeResolver, ut as hasAccessDecision, oe as hasCallbackRoutes, Te as hasEffectiveScope, U as hasEnforcedGuard, Se as hasScope, g as idToPath, Re as idempotencyScope, y as inputLabel, Ct as isEventDescriptor, Je as isIdKeyed, l as isOpenAccess, _e as isPolicyCheck, lt as isPolicyGuard, et as isReactivityChannel, tt as isReactivityChannelKey, Ne as isSystemSubject, st as isWireReachable, t as makeScopeCache, Be as memoryIdempotencyStore, fe as missingAccessDecision, gt as mutationToRpc, xt as normalizeDescriptor, it as normalizeSource, u as openAccessSpec, Rt as parseEventRoute, Ge as pathToId, Ht as pluginInstanceName, ot as publishReactivity, Ve as publishServerError, ht as queryToRpc, ue as rawImpersonationMark, $e as reactivityChannel, Me as requireScope, m as rowPatchOpSchema, h as rowPatchSchema, ee as scopeCacheKey, pe as setEffectiveScopes, je as setPolicyGuardResolver, se as setResourceScopeResolver, rt as sourceKeys, vt as streamToRpc, b as strictInput, le as subjectIdentity, n as subjectScopes, Le as subscribeServerErrors, v as subscriptionEvent, de as systemSubject, o as tenantScopedSubject, bt as toRpc, Qn as tsMs, at as undeclaredChannelKeys, Dn as undoApplyDescriptor, En as undoLogQueryDescriptor, On as undoRedoDescriptor, W as wireErrorUnion, mn as workflowCancelDescriptor, fn as workflowDomainEventsQueryDescriptor, pn as workflowEventDeliveriesQueryDescriptor, hn as workflowResumeDescriptor, dn as workflowRunEventsQueryDescriptor, cn as workflowRunQueryDescriptor, un as workflowRunStepsQueryDescriptor, ln as workflowRunsQueryDescriptor, gn as workflowSignalDescriptor, _n as workflowUpdateDescriptor, Fe as wsMutationIdempotencyScope };
|