@voltro/protocol 0.23.0 → 0.25.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 +537 -0
- package/dist/index.d.ts +463 -0
- package/dist/index.js +194 -127
- package/dist/rest.js +1 -1
- package/dist/{serverErrorBus-BkKWg0_x.js → serverErrorBus-C3JTqgIc.js} +7 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { C as e, D as t, E as n,
|
|
2
|
-
import { a as
|
|
3
|
-
import { Context as
|
|
1
|
+
import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, a as ee, b as te, c as ne, d as re, f as ie, g as ae, h as oe, i as se, l as ce, m as le, n as ue, o as de, p as s, r as fe, s as pe, t as me, u as he, v as ge, w as _e, x as ve, y as ye } from "./serverErrorBus-C3JTqgIc.js";
|
|
2
|
+
import { a as be, c as xe, d as Se, f as Ce, i as we, l as Te, n as Ee, o as De, p as Oe, r as ke, s as Ae, t as je, u as Me } from "./auth-BPdyOBsd.js";
|
|
3
|
+
import { Context as Ne, Layer as Pe, Schema as c } from "effect";
|
|
4
4
|
import { Rpc as l } from "@effect/rpc";
|
|
5
5
|
//#region src/rowPatch.ts
|
|
6
|
-
var
|
|
6
|
+
var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
7
7
|
key: c.String,
|
|
8
8
|
value: c.Unknown
|
|
9
|
-
}).pipe(c.filter((e) => "id" in e, { message: () => "patch row must carry an id" })),
|
|
9
|
+
}).pipe(c.filter((e) => "id" in e, { message: () => "patch row must carry an id" })), d = c.Union(c.Struct({
|
|
10
10
|
op: c.Literal("add"),
|
|
11
11
|
path: c.String,
|
|
12
|
-
value:
|
|
12
|
+
value: u
|
|
13
13
|
}), c.Struct({
|
|
14
14
|
op: c.Literal("replace"),
|
|
15
15
|
path: c.String,
|
|
16
|
-
value:
|
|
16
|
+
value: u
|
|
17
17
|
}), c.Struct({
|
|
18
18
|
op: c.Literal("remove"),
|
|
19
19
|
path: c.String
|
|
20
|
-
})),
|
|
21
|
-
ops: c.Array(
|
|
22
|
-
order: c.Array(
|
|
23
|
-
}),
|
|
20
|
+
})), f = c.Struct({
|
|
21
|
+
ops: c.Array(d),
|
|
22
|
+
order: c.Array(Fe)
|
|
23
|
+
}), p = (e) => `/${String(e).replace(/~/g, "~0").replace(/\//g, "~1")}`, Ie = (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
|
+
}, Le = (e, t) => m(e) === m(t), Re = (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 Pe = c.Union(c.String, c.Number), Fe = 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: p(e.id),
|
|
37
37
|
value: e
|
|
38
|
-
}) :
|
|
38
|
+
}) : Le(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
|
+
}), Be = (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,7 +62,7 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
62
62
|
t !== void 0 && r.push(t);
|
|
63
63
|
}
|
|
64
64
|
return r;
|
|
65
|
-
},
|
|
65
|
+
}, h = (e) => c.Union(c.Struct({
|
|
66
66
|
_tag: c.Literal("snapshot"),
|
|
67
67
|
revision: c.Number,
|
|
68
68
|
data: e,
|
|
@@ -71,17 +71,17 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
71
71
|
_tag: c.Literal("delta"),
|
|
72
72
|
revision: c.Number,
|
|
73
73
|
emittedAt: c.Number,
|
|
74
|
-
patch:
|
|
74
|
+
patch: f
|
|
75
75
|
}), c.Struct({
|
|
76
76
|
_tag: c.Literal("error"),
|
|
77
77
|
error: c.Unknown,
|
|
78
78
|
revision: c.optional(c.Number)
|
|
79
|
-
})),
|
|
79
|
+
})), Ve = (e) => e.internal !== !0, g = (e) => {
|
|
80
80
|
if (e.internal !== !0) return e;
|
|
81
81
|
let t = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
82
82
|
if (t.length === 0) return e;
|
|
83
83
|
throw Error(`${e.name}: \`internal: true\` cannot be combined with ${t.map((e) => `\`${e}\``).join(" or ")}. \`internal\` takes the procedure OFF the wire; those put it back ON a different one (${t.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 ${t.join(" / ")} annotation if it is not.`);
|
|
84
|
-
},
|
|
84
|
+
}, He = (e) => e.action !== void 0 && e.resourceType !== void 0, _ = (e) => g({
|
|
85
85
|
kind: "query",
|
|
86
86
|
name: e.name,
|
|
87
87
|
input: e.input,
|
|
@@ -93,7 +93,7 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
93
93
|
publicApi: e.publicApi,
|
|
94
94
|
exposeAsTool: e.exposeAsTool,
|
|
95
95
|
internal: e.internal
|
|
96
|
-
}),
|
|
96
|
+
}), v = (e) => g({
|
|
97
97
|
kind: "mutation",
|
|
98
98
|
name: e.name,
|
|
99
99
|
input: e.input,
|
|
@@ -104,7 +104,7 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
104
104
|
publicApi: e.publicApi,
|
|
105
105
|
exposeAsTool: e.exposeAsTool,
|
|
106
106
|
internal: e.internal
|
|
107
|
-
}),
|
|
107
|
+
}), y = (e) => g({
|
|
108
108
|
kind: "action",
|
|
109
109
|
name: e.name,
|
|
110
110
|
input: e.input,
|
|
@@ -116,43 +116,43 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
116
116
|
publicApi: e.publicApi,
|
|
117
117
|
exposeAsTool: e.exposeAsTool,
|
|
118
118
|
internal: e.internal
|
|
119
|
-
}),
|
|
119
|
+
}), Ue = (e) => g({
|
|
120
120
|
kind: "stream",
|
|
121
121
|
name: e.name,
|
|
122
122
|
input: e.input,
|
|
123
123
|
element: e.element,
|
|
124
124
|
error: e.error ?? c.Never,
|
|
125
125
|
internal: e.internal
|
|
126
|
-
}),
|
|
126
|
+
}), b = (e, t) => t && t.length > 0 ? c.Union(e, ...t) : e, x = (e, t) => t && t.length > 0 ? c.Union(e, s) : e, S = (e, t) => l.make(e.name, {
|
|
127
127
|
payload: e.input,
|
|
128
|
-
success:
|
|
129
|
-
error:
|
|
128
|
+
success: h(e.output),
|
|
129
|
+
error: b(x(e.error, e.guards), t),
|
|
130
130
|
stream: !0
|
|
131
|
-
}),
|
|
131
|
+
}), We = (e, t) => l.make(e.name, {
|
|
132
132
|
payload: e.input,
|
|
133
133
|
success: e.output,
|
|
134
|
-
error:
|
|
135
|
-
}),
|
|
134
|
+
error: b(x(e.error, e.guards), t)
|
|
135
|
+
}), Ge = (e, t) => l.make(e.name, {
|
|
136
136
|
payload: e.input,
|
|
137
137
|
success: e.output,
|
|
138
|
-
error:
|
|
139
|
-
}),
|
|
138
|
+
error: b(x(e.error, e.guards), t)
|
|
139
|
+
}), Ke = (e, t) => l.make(e.name, {
|
|
140
140
|
payload: e.input,
|
|
141
141
|
success: e.element,
|
|
142
|
-
error:
|
|
142
|
+
error: b(e.error, t),
|
|
143
143
|
stream: !0
|
|
144
|
-
}),
|
|
144
|
+
}), qe = (e) => {
|
|
145
145
|
if (typeof e != "object" || !e) return;
|
|
146
146
|
let t = e._tag;
|
|
147
147
|
return typeof t == "string" ? t : void 0;
|
|
148
|
-
},
|
|
148
|
+
}, Je = (e) => {
|
|
149
149
|
switch (e.kind) {
|
|
150
|
-
case "query": return
|
|
151
|
-
case "mutation": return
|
|
152
|
-
case "action": return
|
|
153
|
-
case "stream": return
|
|
150
|
+
case "query": return S(e);
|
|
151
|
+
case "mutation": return We(e);
|
|
152
|
+
case "action": return Ge(e);
|
|
153
|
+
case "stream": return Ke(e);
|
|
154
154
|
}
|
|
155
|
-
},
|
|
155
|
+
}, Ye = (e) => {
|
|
156
156
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
157
157
|
if (e.kind === "query") return {
|
|
158
158
|
kind: "query",
|
|
@@ -193,17 +193,84 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
193
193
|
..."shapeItem" in e && e.shapeItem !== void 0 ? { shapeItem: e.shapeItem } : {}
|
|
194
194
|
}))
|
|
195
195
|
};
|
|
196
|
-
},
|
|
196
|
+
}, Xe = 7500, Ze = (e) => typeof e == "object" && !!e && e.kind === "event", Qe = (e) => {
|
|
197
|
+
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
198
|
+
if (e.delivery === "latest" && e.webhook !== void 0) throw Error(`defineEvent(${e.name}): \`delivery: 'latest'\` cannot be combined with \`webhook\`.\n \`latest\` means a superseded delivery did not matter — but a webhook delivery is a
|
|
199
|
+
durable side effect at a third party, and one already sent cannot be superseded.
|
|
200
|
+
A high-rate event with an HTTP audience is also 60 deliveries per second per target;
|
|
201
|
+
the rate limit DEFERS the excess as pending rows, so it grows a table instead of failing.
|
|
202
|
+
Split them: publish the high-rate event for clients, and publish a separate, coarser
|
|
203
|
+
event (a summary, a state change) for the outside world.`);
|
|
204
|
+
return {
|
|
205
|
+
kind: "event",
|
|
206
|
+
name: e.name,
|
|
207
|
+
key: e.key,
|
|
208
|
+
payload: e.payload,
|
|
209
|
+
guards: e.guards,
|
|
210
|
+
rewind: e.rewind,
|
|
211
|
+
webhook: e.webhook,
|
|
212
|
+
delivery: e.delivery
|
|
213
|
+
};
|
|
214
|
+
}, C = (e) => c.Struct({
|
|
215
|
+
_tag: c.Literal("event"),
|
|
216
|
+
origin: c.String,
|
|
217
|
+
n: c.Number,
|
|
218
|
+
emittedAt: c.Number,
|
|
219
|
+
payload: e
|
|
220
|
+
}), w = c.Struct({
|
|
221
|
+
_tag: c.Literal("gap"),
|
|
222
|
+
missed: c.Number,
|
|
223
|
+
reason: c.Literal("buffer", "resume")
|
|
224
|
+
}), T = c.Struct({ _tag: c.Literal("attached") }), E = (e) => c.Union(T, C(e), w), D = c.Struct({
|
|
225
|
+
origin: c.String,
|
|
226
|
+
n: c.Number
|
|
227
|
+
}), O = (e) => c.Struct({
|
|
228
|
+
key: e,
|
|
229
|
+
resume: c.optional(c.Array(D))
|
|
230
|
+
}), $e = (e, t) => {
|
|
231
|
+
let n = e.guards && e.guards.length > 0 ? s : c.Never, r = t && t.length > 0 ? c.Union(n, ...t) : n;
|
|
232
|
+
return l.make(e.name, {
|
|
233
|
+
payload: O(e.key),
|
|
234
|
+
success: E(e.payload),
|
|
235
|
+
error: r,
|
|
236
|
+
stream: !0
|
|
237
|
+
});
|
|
238
|
+
}, et = class extends c.TaggedError()("EventPayloadInvalid", {
|
|
239
|
+
event: c.String,
|
|
240
|
+
message: c.String
|
|
241
|
+
}) {}, tt = class extends c.TaggedError()("EventKeyInvalid", {
|
|
242
|
+
event: c.String,
|
|
243
|
+
message: c.String
|
|
244
|
+
}) {}, nt = class extends c.TaggedError()("EventPayloadTooLarge", {
|
|
245
|
+
event: c.String,
|
|
246
|
+
bytes: c.Number,
|
|
247
|
+
limit: c.Number
|
|
248
|
+
}) {}, k = (e) => {
|
|
249
|
+
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
250
|
+
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
251
|
+
return JSON.stringify(t);
|
|
252
|
+
}, rt = "\0", it = (e, t, n) => [
|
|
253
|
+
e ?? "~",
|
|
254
|
+
t,
|
|
255
|
+
k(n)
|
|
256
|
+
].join("\0"), at = (e) => {
|
|
257
|
+
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
258
|
+
return {
|
|
259
|
+
tenantId: t === "~" ? null : t,
|
|
260
|
+
event: n,
|
|
261
|
+
key: r
|
|
262
|
+
};
|
|
263
|
+
}, ot = (e) => e.split("\0").join(" · "), st = (e) => e, ct = (e) => e, lt = (e) => {
|
|
197
264
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
198
|
-
},
|
|
199
|
-
let n =
|
|
265
|
+
}, ut = (e, t) => {
|
|
266
|
+
let n = Ne.GenericTag(e);
|
|
200
267
|
return {
|
|
201
268
|
Tag: n,
|
|
202
|
-
Live:
|
|
269
|
+
Live: Pe.succeed(n, t)
|
|
203
270
|
};
|
|
204
|
-
},
|
|
271
|
+
}, dt = (e, t, n) => {
|
|
205
272
|
if (!t) return { ok: !0 };
|
|
206
|
-
let r =
|
|
273
|
+
let r = A(n);
|
|
207
274
|
if (!r) return {
|
|
208
275
|
ok: !1,
|
|
209
276
|
reason: `cannot parse runningVersion "${n}"`
|
|
@@ -211,12 +278,12 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
211
278
|
let i = t.trim();
|
|
212
279
|
if (i === "*" || i === "") return { ok: !0 };
|
|
213
280
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
214
|
-
for (let i of a) if (
|
|
281
|
+
for (let i of a) if (!ft(i, r)) return {
|
|
215
282
|
ok: !1,
|
|
216
283
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
217
284
|
};
|
|
218
285
|
return { ok: !0 };
|
|
219
|
-
},
|
|
286
|
+
}, A = (e) => {
|
|
220
287
|
let t = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9a-zA-Z.-]+))?$/.exec(e.trim());
|
|
221
288
|
return t ? {
|
|
222
289
|
major: Number(t[1]),
|
|
@@ -224,38 +291,38 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
224
291
|
patch: Number(t[3]),
|
|
225
292
|
pre: t[4] ?? ""
|
|
226
293
|
} : null;
|
|
227
|
-
},
|
|
294
|
+
}, j = (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, ft = (e, t) => {
|
|
228
295
|
if (e === "*") return !0;
|
|
229
296
|
if (e.startsWith("^")) {
|
|
230
|
-
let n =
|
|
231
|
-
return !n || t.major !== n.major ? !1 :
|
|
297
|
+
let n = A(e.slice(1));
|
|
298
|
+
return !n || t.major !== n.major ? !1 : j(t, n) >= 0;
|
|
232
299
|
}
|
|
233
300
|
if (e.startsWith("~")) {
|
|
234
|
-
let n =
|
|
235
|
-
return !n || t.major !== n.major || t.minor !== n.minor ? !1 :
|
|
301
|
+
let n = A(e.slice(1));
|
|
302
|
+
return !n || t.major !== n.major || t.minor !== n.minor ? !1 : j(t, n) >= 0;
|
|
236
303
|
}
|
|
237
304
|
let n = /^(>=|<=|>|<)(.+)$/.exec(e);
|
|
238
305
|
if (n) {
|
|
239
|
-
let e = n[1], r =
|
|
306
|
+
let e = n[1], r = A(n[2]);
|
|
240
307
|
if (!r) return !1;
|
|
241
|
-
let i =
|
|
308
|
+
let i = j(t, r);
|
|
242
309
|
if (e === ">=") return i >= 0;
|
|
243
310
|
if (e === "<=") return i <= 0;
|
|
244
311
|
if (e === ">") return i > 0;
|
|
245
312
|
if (e === "<") return i < 0;
|
|
246
313
|
}
|
|
247
|
-
let r =
|
|
248
|
-
return r ?
|
|
249
|
-
},
|
|
314
|
+
let r = A(e);
|
|
315
|
+
return r ? j(t, r) === 0 : !1;
|
|
316
|
+
}, M = c.Literal("running", "succeeded", "failed", "cancelled", "suspended"), N = c.Literal("cancel", "terminate", "abandon"), pt = c.Struct({
|
|
250
317
|
id: c.String,
|
|
251
318
|
workflowName: c.String,
|
|
252
319
|
executionId: c.String,
|
|
253
320
|
status: c.Literal("running")
|
|
254
|
-
}),
|
|
321
|
+
}), P = c.Struct({
|
|
255
322
|
id: c.String,
|
|
256
323
|
tag: c.String,
|
|
257
324
|
executionId: c.String,
|
|
258
|
-
status:
|
|
325
|
+
status: M,
|
|
259
326
|
payload: c.Unknown,
|
|
260
327
|
workflowVersion: c.NullOr(c.String),
|
|
261
328
|
workflowPatches: c.NullOr(c.Unknown),
|
|
@@ -270,12 +337,12 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
270
337
|
durationMs: c.NullOr(c.Number),
|
|
271
338
|
traceId: c.NullOr(c.String),
|
|
272
339
|
parentExecutionId: c.NullOr(c.String),
|
|
273
|
-
parentClosePolicy: c.NullOr(
|
|
274
|
-
}),
|
|
340
|
+
parentClosePolicy: c.NullOr(N)
|
|
341
|
+
}), F = c.Struct({
|
|
275
342
|
tag: c.optional(c.String),
|
|
276
|
-
status: c.optional(
|
|
343
|
+
status: c.optional(M),
|
|
277
344
|
limit: c.optional(c.Number)
|
|
278
|
-
}),
|
|
345
|
+
}), I = c.Struct({
|
|
279
346
|
id: c.String,
|
|
280
347
|
runId: c.String,
|
|
281
348
|
stepName: c.String,
|
|
@@ -290,7 +357,7 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
290
357
|
startedAt: c.Date,
|
|
291
358
|
completedAt: c.NullOr(c.Date),
|
|
292
359
|
durationMs: c.NullOr(c.Number)
|
|
293
|
-
}),
|
|
360
|
+
}), L = c.Struct({
|
|
294
361
|
id: c.String,
|
|
295
362
|
runId: c.String,
|
|
296
363
|
eventType: c.String,
|
|
@@ -298,7 +365,7 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
298
365
|
occurredAt: c.Date,
|
|
299
366
|
stepName: c.NullOr(c.String),
|
|
300
367
|
attempt: c.NullOr(c.Number)
|
|
301
|
-
}),
|
|
368
|
+
}), R = c.Struct({
|
|
302
369
|
id: c.String,
|
|
303
370
|
name: c.String,
|
|
304
371
|
payload: c.Unknown,
|
|
@@ -306,7 +373,7 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
306
373
|
subject: c.NullOr(c.Unknown),
|
|
307
374
|
traceId: c.NullOr(c.String),
|
|
308
375
|
occurredAt: c.Date
|
|
309
|
-
}),
|
|
376
|
+
}), z = c.Struct({
|
|
310
377
|
id: c.String,
|
|
311
378
|
eventId: c.String,
|
|
312
379
|
eventName: c.String,
|
|
@@ -319,123 +386,123 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
319
386
|
errorMessage: c.NullOr(c.String),
|
|
320
387
|
createdAt: c.Date,
|
|
321
388
|
completedAt: c.NullOr(c.Date)
|
|
322
|
-
}),
|
|
389
|
+
}), B = c.Struct({ id: c.String }), V = c.Struct({ runId: c.String }), mt = c.Struct({
|
|
323
390
|
name: c.optional(c.String),
|
|
324
391
|
limit: c.optional(c.Number)
|
|
325
|
-
}),
|
|
392
|
+
}), H = c.Struct({ eventId: c.String }), U = c.Struct({
|
|
326
393
|
workflowName: c.String,
|
|
327
394
|
executionId: c.String
|
|
328
|
-
}),
|
|
395
|
+
}), W = c.Struct({
|
|
329
396
|
id: c.String,
|
|
330
397
|
signalName: c.String,
|
|
331
398
|
payload: c.optional(c.Unknown)
|
|
332
|
-
}),
|
|
399
|
+
}), G = c.Struct({
|
|
333
400
|
id: c.String,
|
|
334
401
|
updateName: c.String,
|
|
335
402
|
payload: c.optional(c.Unknown),
|
|
336
403
|
timeoutMs: c.optional(c.Number)
|
|
337
|
-
}),
|
|
404
|
+
}), K = c.Struct({
|
|
338
405
|
eventId: c.String,
|
|
339
406
|
updateId: c.String,
|
|
340
407
|
completedEventId: c.String,
|
|
341
408
|
result: c.Unknown
|
|
342
|
-
}),
|
|
409
|
+
}), ht = _({
|
|
343
410
|
name: "__voltro.workflow.run",
|
|
344
411
|
source: "_voltro_workflow_runs",
|
|
345
|
-
input:
|
|
346
|
-
output: c.Array(
|
|
347
|
-
}),
|
|
412
|
+
input: B,
|
|
413
|
+
output: c.Array(P)
|
|
414
|
+
}), gt = _({
|
|
348
415
|
name: "__voltro.workflow.runs",
|
|
349
416
|
source: "_voltro_workflow_runs",
|
|
350
|
-
input:
|
|
351
|
-
output: c.Array(
|
|
352
|
-
}),
|
|
417
|
+
input: F,
|
|
418
|
+
output: c.Array(P)
|
|
419
|
+
}), _t = _({
|
|
353
420
|
name: "__voltro.workflow.run.steps",
|
|
354
421
|
source: "_voltro_workflow_run_steps",
|
|
355
|
-
input:
|
|
356
|
-
output: c.Array(
|
|
357
|
-
}),
|
|
422
|
+
input: V,
|
|
423
|
+
output: c.Array(I)
|
|
424
|
+
}), vt = _({
|
|
358
425
|
name: "__voltro.workflow.run.events",
|
|
359
426
|
source: "_voltro_workflow_run_events",
|
|
360
|
-
input:
|
|
361
|
-
output: c.Array(
|
|
362
|
-
}),
|
|
427
|
+
input: V,
|
|
428
|
+
output: c.Array(L)
|
|
429
|
+
}), yt = _({
|
|
363
430
|
name: "__voltro.workflow.domainEvents",
|
|
364
431
|
source: "_voltro_workflow_events",
|
|
365
|
-
input:
|
|
366
|
-
output: c.Array(
|
|
367
|
-
}),
|
|
432
|
+
input: mt,
|
|
433
|
+
output: c.Array(R)
|
|
434
|
+
}), bt = _({
|
|
368
435
|
name: "__voltro.workflow.event.deliveries",
|
|
369
436
|
source: "_voltro_workflow_event_deliveries",
|
|
370
|
-
input:
|
|
371
|
-
output: c.Array(
|
|
372
|
-
}),
|
|
437
|
+
input: H,
|
|
438
|
+
output: c.Array(z)
|
|
439
|
+
}), xt = y({
|
|
373
440
|
name: "__voltro.workflow.cancel",
|
|
374
|
-
input:
|
|
441
|
+
input: U,
|
|
375
442
|
output: c.Struct({ ok: c.Boolean })
|
|
376
|
-
}),
|
|
443
|
+
}), St = y({
|
|
377
444
|
name: "__voltro.workflow.resume",
|
|
378
|
-
input:
|
|
445
|
+
input: U,
|
|
379
446
|
output: c.Struct({ ok: c.Boolean })
|
|
380
|
-
}),
|
|
447
|
+
}), Ct = y({
|
|
381
448
|
name: "__voltro.workflow.signal",
|
|
382
|
-
input:
|
|
449
|
+
input: W,
|
|
383
450
|
output: c.Struct({ eventId: c.String })
|
|
384
|
-
}),
|
|
451
|
+
}), wt = y({
|
|
385
452
|
name: "__voltro.workflow.update",
|
|
386
|
-
input:
|
|
387
|
-
output:
|
|
388
|
-
}),
|
|
453
|
+
input: G,
|
|
454
|
+
output: K
|
|
455
|
+
}), q = "__voltro.undo.log", J = "__voltro.undo.apply", Y = "__voltro.undo.redo", X = c.Struct({
|
|
389
456
|
id: c.String,
|
|
390
457
|
tag: c.String,
|
|
391
458
|
label: c.NullOr(c.String),
|
|
392
459
|
undone: c.Boolean,
|
|
393
460
|
crossesAction: c.Boolean,
|
|
394
461
|
createdAt: c.String
|
|
395
|
-
}),
|
|
462
|
+
}), Tt = class extends c.TaggedError()("UndoNotFound", { invocationId: c.String }) {}, Et = class extends c.TaggedError()("UndoForbidden", { invocationId: c.String }) {}, Dt = class extends c.TaggedError()("UndoConflict", {
|
|
396
463
|
invocationId: c.String,
|
|
397
464
|
reason: c.Literal("conflict", "action")
|
|
398
|
-
}) {},
|
|
399
|
-
name:
|
|
465
|
+
}) {}, Ot = c.Union(Tt, Et, Dt), kt = _({
|
|
466
|
+
name: q,
|
|
400
467
|
source: "_voltro_undo_log",
|
|
401
468
|
input: c.Struct({ limit: c.optional(c.Number) }),
|
|
402
|
-
output: c.Array(
|
|
403
|
-
}),
|
|
404
|
-
name:
|
|
469
|
+
output: c.Array(X)
|
|
470
|
+
}), At = v({
|
|
471
|
+
name: J,
|
|
405
472
|
input: c.Struct({ invocationId: c.String }),
|
|
406
473
|
output: c.Struct({ ok: c.Boolean }),
|
|
407
|
-
error:
|
|
408
|
-
}),
|
|
409
|
-
name:
|
|
474
|
+
error: Ot
|
|
475
|
+
}), jt = v({
|
|
476
|
+
name: Y,
|
|
410
477
|
input: c.Struct({ invocationId: c.String }),
|
|
411
478
|
output: c.Struct({ ok: c.Boolean }),
|
|
412
|
-
error:
|
|
413
|
-
}),
|
|
479
|
+
error: Ot
|
|
480
|
+
}), Mt = "__voltro.connections.list", Z = "__voltro.connections.start", Nt = "__voltro.connections.submitToken", Pt = "__voltro.connections.disconnect", Q = c.Literal("oauth2", "pat"), Ft = c.Literal("disconnected", "connected", "expired", "revoked", "error"), It = c.Struct({
|
|
414
481
|
connectionId: c.String,
|
|
415
482
|
kind: Q,
|
|
416
483
|
label: c.String,
|
|
417
|
-
status:
|
|
484
|
+
status: Ft,
|
|
418
485
|
accountId: c.NullOr(c.String),
|
|
419
486
|
accountLabel: c.NullOr(c.String),
|
|
420
487
|
scopes: c.Array(c.String),
|
|
421
488
|
expiresAt: c.NullOr(c.String),
|
|
422
489
|
lastError: c.NullOr(c.String),
|
|
423
490
|
connectedAt: c.NullOr(c.String)
|
|
424
|
-
}),
|
|
491
|
+
}), Lt = class extends c.TaggedError()("ConnectionNotDeclared", { connectionId: c.String }) {}, Rt = class extends c.TaggedError()("ConnectionSubjectRequired", { connectionId: c.String }) {}, zt = class extends c.TaggedError()("ConnectionKindMismatch", {
|
|
425
492
|
connectionId: c.String,
|
|
426
493
|
expected: Q,
|
|
427
494
|
actual: Q
|
|
428
|
-
}) {},
|
|
495
|
+
}) {}, Bt = class extends c.TaggedError()("ConnectionHandshakeFailed", {
|
|
429
496
|
connectionId: c.String,
|
|
430
497
|
reason: c.String,
|
|
431
498
|
transient: c.Boolean
|
|
432
|
-
}) {}, $ = c.Union(
|
|
433
|
-
name:
|
|
499
|
+
}) {}, $ = c.Union(Lt, Rt, zt, Bt), Vt = _({
|
|
500
|
+
name: Mt,
|
|
434
501
|
source: "_voltro_connections",
|
|
435
502
|
input: c.Struct({}),
|
|
436
|
-
output: c.Array(
|
|
437
|
-
}),
|
|
438
|
-
name:
|
|
503
|
+
output: c.Array(It)
|
|
504
|
+
}), Ht = y({
|
|
505
|
+
name: Z,
|
|
439
506
|
input: c.Struct({
|
|
440
507
|
connectionId: c.String,
|
|
441
508
|
redirectTo: c.optional(c.String)
|
|
@@ -445,22 +512,22 @@ var Pe = c.Union(c.String, c.Number), Fe = c.Record({
|
|
|
445
512
|
state: c.String
|
|
446
513
|
}),
|
|
447
514
|
error: $
|
|
448
|
-
}),
|
|
449
|
-
name:
|
|
515
|
+
}), Ut = v({
|
|
516
|
+
name: Nt,
|
|
450
517
|
input: c.Struct({
|
|
451
518
|
connectionId: c.String,
|
|
452
519
|
token: c.String
|
|
453
520
|
}),
|
|
454
521
|
output: c.Struct({ ok: c.Boolean }),
|
|
455
522
|
error: $
|
|
456
|
-
}),
|
|
457
|
-
name:
|
|
523
|
+
}), Wt = v({
|
|
524
|
+
name: Pt,
|
|
458
525
|
input: c.Struct({ connectionId: c.String }),
|
|
459
526
|
output: c.Struct({ ok: c.Boolean }),
|
|
460
527
|
error: $
|
|
461
|
-
}),
|
|
528
|
+
}), Gt = (e) => {
|
|
462
529
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
463
530
|
return Number.isNaN(t) ? 0 : t;
|
|
464
|
-
},
|
|
531
|
+
}, Kt = 1;
|
|
465
532
|
//#endregion
|
|
466
|
-
export {
|
|
533
|
+
export { ce as ADMIN_SCOPE, he as APIKEY_ISSUE_ORG_SCOPE, re as APIKEY_ISSUE_OTHER_SCOPE, ie as APIKEY_ISSUE_SELF_SCOPE, je as AuthMiddleware, Mt as CONNECTIONS_LIST_TAG, Pt as CONNECTION_DISCONNECT_TAG, Z as CONNECTION_START_TAG, Nt as CONNECTION_SUBMIT_TOKEN_TAG, Bt as ConnectionHandshakeFailed, Ee as ConnectionInfo, ke as ConnectionInfoMiddleware, Q as ConnectionKind, zt as ConnectionKindMismatch, Lt as ConnectionNotDeclared, It as ConnectionState, Ft as ConnectionStatus, Rt as ConnectionSubjectRequired, rt as EVENT_ROUTE_SEP, tt as EventKeyInvalid, et as EventPayloadInvalid, nt as EventPayloadTooLarge, Xe as MAX_EVENT_ENVELOPE_BYTES, Kt as PROTOCOL_VERSION, s as ScopeError, we as Subject, be as SubjectService, J as UNDO_APPLY_TAG, q as UNDO_LOG_TAG, Y as UNDO_REDO_TAG, De as Unauthenticated, Dt as UndoConflict, Et as UndoForbidden, X as UndoLogEntry, Tt as UndoNotFound, U as WorkflowControlInputSchema, R as WorkflowDomainEventRowSchema, mt as WorkflowDomainEventsInputSchema, H as WorkflowEventDeliveriesInputSchema, z as WorkflowEventDeliveryRowSchema, N as WorkflowParentClosePolicySchema, L as WorkflowRunEventRowSchema, pt as WorkflowRunHandleSchema, B as WorkflowRunRefSchema, P as WorkflowRunRowSchema, M as WorkflowRunStatusSchema, I as WorkflowRunStepRowSchema, V as WorkflowRunTableRefSchema, F as WorkflowRunsInputSchema, W as WorkflowSignalInputSchema, G as WorkflowUpdateInputSchema, K as WorkflowUpdateResultSchema, Ge as actionToRpc, le as advisoryResourceGuardWarning, Ae as anonymousSubject, Be as applyRowPatch, xe as assertAuthenticated, fe as beginIdempotent, dt as checkFrameworkCompat, oe as checkGuards, ae as checkGuardsEffect, Te as composeAuthStrategies, lt as composeRpcInterceptors, Wt as connectionDisconnectDescriptor, Ht as connectionStartDescriptor, Ut as connectionSubmitTokenDescriptor, Vt as connectionsListQueryDescriptor, y as defineAction, Qe as defineEvent, v as defineMutation, st as definePlugin, ct as definePluginRoute, ut as definePluginService, _ as defineQuery, Ue as defineStream, Re as diffRows, o as effectiveScopes, k as encodeEventKey, qe as errorTag, T as eventAttached, C as eventEnvelope, w as eventGap, D as eventResumePoint, it as eventRoute, E as eventStreamEvent, O as eventSubscribeInput, $e as eventToRpc, se as failIdempotent, ge as findAdvisoryResourceGuards, ee as finishIdempotent, ot as formatEventRoute, ye as getPolicyGuardResolver, te as getResourceScopeResolver, Me as hasCallbackRoutes, ve as hasEffectiveScope, i as hasScope, p as idToPath, de as idempotencyScope, Ze as isEventDescriptor, ze as isIdKeyed, e as isPolicyCheck, He as isPolicyGuard, Se as isSystemSubject, Ve as isWireReachable, pe as memoryIdempotencyStore, We as mutationToRpc, Ye as normalizeDescriptor, at as parseEventRoute, Ie as pathToId, me as publishServerError, S as queryToRpc, _e as requireScope, d as rowPatchOpSchema, f as rowPatchSchema, a as setEffectiveScopes, n as setPolicyGuardResolver, t as setResourceScopeResolver, Ke as streamToRpc, r as subjectScopes, ue as subscribeServerErrors, h as subscriptionEvent, Ce as systemSubject, Oe as tenantScopedSubject, Je as toRpc, Gt as tsMs, At as undoApplyDescriptor, kt as undoLogQueryDescriptor, jt as undoRedoDescriptor, xt as workflowCancelDescriptor, yt as workflowDomainEventsQueryDescriptor, bt as workflowEventDeliveriesQueryDescriptor, St as workflowResumeDescriptor, vt as workflowRunEventsQueryDescriptor, ht as workflowRunQueryDescriptor, _t as workflowRunStepsQueryDescriptor, gt as workflowRunsQueryDescriptor, Ct as workflowSignalDescriptor, wt as workflowUpdateDescriptor, ne as wsMutationIdempotencyScope };
|
package/dist/rest.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, i as t, o as n, r, t as i } from "./serverErrorBus-
|
|
1
|
+
import { a as e, i as t, o as n, r, t as i } from "./serverErrorBus-C3JTqgIc.js";
|
|
2
2
|
import { s as a } from "./auth-BPdyOBsd.js";
|
|
3
3
|
import { Effect as o, Schema as s } from "effect";
|
|
4
4
|
//#region src/publicApi.ts
|
|
@@ -113,13 +113,13 @@ var n = "admin:full", r = "apikeys:issue:self", i = "apikeys:issue:org", a = "ap
|
|
|
113
113
|
}
|
|
114
114
|
return null;
|
|
115
115
|
});
|
|
116
|
-
}, D = (e, t, n) => `${e ?? "(global)"}|${t.toUpperCase()}|${n}`, O = async (e, t, n, r, i) => {
|
|
116
|
+
}, D = (e, t, n) => `${e ?? "(global)"}|${t.toUpperCase()}|${n}`, O = (e, t, n) => `${e ?? "(global)"}|${t ?? "(anon)"}|WS|${n}`, k = async (e, t, n, r, i) => {
|
|
117
117
|
let a = await e.claim(t, n, i, r);
|
|
118
118
|
return a === "claimed" ? { kind: "fresh" } : a.status === "completed" && a.response ? {
|
|
119
119
|
kind: "replay",
|
|
120
120
|
response: a.response
|
|
121
121
|
} : { kind: "conflict" };
|
|
122
|
-
},
|
|
122
|
+
}, A = (e, t, n, r, i) => e.complete(t, n, r, i), j = (e, t, n) => e.release(t, n), M = () => {
|
|
123
123
|
let e = /* @__PURE__ */ new Map(), t = (e, t) => `${e}\u0000${t}`;
|
|
124
124
|
return {
|
|
125
125
|
get: async (n, r) => e.get(t(n, r)) ?? null,
|
|
@@ -146,12 +146,12 @@ var n = "admin:full", r = "apikeys:issue:self", i = "apikeys:issue:org", a = "ap
|
|
|
146
146
|
e.delete(t(n, r));
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
|
-
},
|
|
150
|
-
for (let t of
|
|
149
|
+
}, N = /* @__PURE__ */ new Set(), P = (e) => {
|
|
150
|
+
for (let t of N) try {
|
|
151
151
|
t(e);
|
|
152
152
|
} catch {}
|
|
153
|
-
},
|
|
154
|
-
|
|
153
|
+
}, F = (e) => (N.add(e), () => {
|
|
154
|
+
N.delete(e);
|
|
155
155
|
});
|
|
156
156
|
//#endregion
|
|
157
|
-
export {
|
|
157
|
+
export { m as C, _ as D, S as E, s as O, f as S, l as T, u as _, A as a, b, O as c, a as d, r as f, E as g, w as h, j as i, n as l, y as m, F as n, D as o, o as p, k as r, M as s, P as t, i as u, v, p as w, d as x, C as y };
|