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