@voltro/protocol 0.28.0 → 0.30.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 +655 -0
- package/dist/index.d.ts +80 -5
- package/dist/index.js +115 -100
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -274,6 +274,29 @@ export declare interface AuthStrategyWithCallback extends AuthStrategy {
|
|
|
274
274
|
*/
|
|
275
275
|
export declare const beginIdempotent: (store: IdempotencyStore, scope: string, key: string, ttlMs: number, now: number) => Promise<IdempotencyOutcome>;
|
|
276
276
|
|
|
277
|
+
/**
|
|
278
|
+
* A cross-table business rule was violated inside a mutation's transaction; the
|
|
279
|
+
* write was rolled back.
|
|
280
|
+
*
|
|
281
|
+
* - `rule` — the declared rule name (`<table>.<name>`-ish, the author's choice).
|
|
282
|
+
* - `params` — i18n params for the violation message (the offending values).
|
|
283
|
+
* - `field` — the field path the violation pinpoints, when the rule can.
|
|
284
|
+
* - `severity` — always `'error'` on the wire (a `'warning'` rule does not
|
|
285
|
+
* fail the mutation, so it never reaches the client as an error).
|
|
286
|
+
*/
|
|
287
|
+
export declare class BusinessRuleViolation extends BusinessRuleViolation_base {
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
declare const BusinessRuleViolation_base: Schema.TaggedErrorClass<BusinessRuleViolation, "BusinessRuleViolation", {
|
|
291
|
+
readonly _tag: Schema.tag<"BusinessRuleViolation">;
|
|
292
|
+
} & {
|
|
293
|
+
rule: typeof Schema.String;
|
|
294
|
+
params: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
295
|
+
field: Schema.optional<typeof Schema.String>;
|
|
296
|
+
message: Schema.optional<typeof Schema.String>;
|
|
297
|
+
severity: Schema.Literal<["error", "warning"]>;
|
|
298
|
+
}>;
|
|
299
|
+
|
|
277
300
|
/**
|
|
278
301
|
* Validate `plugin.framework` (npm-semver range) against the running
|
|
279
302
|
* voltro version. Returns either `{ ok: true }` or
|
|
@@ -3811,14 +3834,44 @@ export declare const workflowRunEventsQueryDescriptor: QueryProcedureDescriptor<
|
|
|
3811
3834
|
export declare type WorkflowRunHandle = Schema.Schema.Type<typeof WorkflowRunHandleSchema>;
|
|
3812
3835
|
|
|
3813
3836
|
export declare const WorkflowRunHandleSchema: Schema.Struct<{
|
|
3814
|
-
/** Stable handle callers pass to `useWorkflowRun(...)
|
|
3837
|
+
/** Stable handle callers pass to `useWorkflowRun(...)`. The durable execution
|
|
3838
|
+
* id for a started run; the pending-intent id for a queued one. */
|
|
3815
3839
|
id: typeof Schema.String;
|
|
3816
3840
|
/** Workflow tag, e.g. `notes.summarise`. */
|
|
3817
3841
|
workflowName: typeof Schema.String;
|
|
3818
|
-
/**
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3842
|
+
/**
|
|
3843
|
+
* Deterministic durable id derived from workflow name + idempotency key.
|
|
3844
|
+
*
|
|
3845
|
+
* NULL when flow control deferred, dropped, or skipped the start — because
|
|
3846
|
+
* there is no execution yet, and there may never be one. It used to be a
|
|
3847
|
+
* required string, and keeping it that way would have meant inventing a value:
|
|
3848
|
+
* either an empty string or the id the run WOULD have had. Both are polls that
|
|
3849
|
+
* return `status: 'unknown'` forever, which is the failure mode this whole
|
|
3850
|
+
* feature set exists to remove.
|
|
3851
|
+
*
|
|
3852
|
+
* For a `skipped` singleton it is the INCUMBENT's execution id — a real,
|
|
3853
|
+
* pollable run, which is the entire point of `mode: 'skip'`.
|
|
3854
|
+
*/
|
|
3855
|
+
executionId: Schema.NullOr<typeof Schema.String>;
|
|
3856
|
+
/**
|
|
3857
|
+
* `running` — the engine has it; starting is fire-and-return.
|
|
3858
|
+
* `queued` — flow control deferred it; see `deferral.dueAt`.
|
|
3859
|
+
* `dropped` — over a `rateLimit` cap. It will NOT run.
|
|
3860
|
+
* `skipped` — a `singleton: { mode: 'skip' }` key was held; `executionId`
|
|
3861
|
+
* names the run that holds it.
|
|
3862
|
+
*/
|
|
3863
|
+
status: Schema.Literal<["running", "queued", "dropped", "skipped"]>;
|
|
3864
|
+
deferral: Schema.optional<Schema.Struct<{
|
|
3865
|
+
/** `debounce` | `batch` | `throttle` | `concurrency` | `paused` |
|
|
3866
|
+
* `rateLimit` | `singleton`. */
|
|
3867
|
+
mode: typeof Schema.String;
|
|
3868
|
+
/** Epoch ms this may first be admitted. Null for a drop or a skip. */
|
|
3869
|
+
dueAt: Schema.NullOr<typeof Schema.Number>;
|
|
3870
|
+
/** How long until the rate window reopens. Null unless dropped. */
|
|
3871
|
+
retryAfterMs: Schema.NullOr<typeof Schema.Number>;
|
|
3872
|
+
/** The `_voltro_workflow_pending` row holding this start. Null unless queued. */
|
|
3873
|
+
intentId: Schema.NullOr<typeof Schema.String>;
|
|
3874
|
+
}>>;
|
|
3822
3875
|
}>;
|
|
3823
3876
|
|
|
3824
3877
|
export declare const workflowRunQueryDescriptor: QueryProcedureDescriptor<"__voltro.workflow.run", Schema.Struct<{
|
|
@@ -3971,6 +4024,28 @@ export declare const WorkflowSignalInputSchema: Schema.Struct<{
|
|
|
3971
4024
|
payload: Schema.optional<typeof Schema.Unknown>;
|
|
3972
4025
|
}>;
|
|
3973
4026
|
|
|
4027
|
+
export declare type WorkflowStartDeferral = Schema.Schema.Type<typeof WorkflowStartDeferralSchema>;
|
|
4028
|
+
|
|
4029
|
+
/**
|
|
4030
|
+
* What flow control did to a start that did not become a run.
|
|
4031
|
+
*
|
|
4032
|
+
* Present only when `status !== 'running'`. Every field is a fact the caller
|
|
4033
|
+
* would otherwise have to guess at: a drop with no `retryAfterMs` is
|
|
4034
|
+
* indistinguishable from a failure, and a queued start with no `dueAt` is
|
|
4035
|
+
* indistinguishable from one that was lost.
|
|
4036
|
+
*/
|
|
4037
|
+
export declare const WorkflowStartDeferralSchema: Schema.Struct<{
|
|
4038
|
+
/** `debounce` | `batch` | `throttle` | `concurrency` | `paused` |
|
|
4039
|
+
* `rateLimit` | `singleton`. */
|
|
4040
|
+
mode: typeof Schema.String;
|
|
4041
|
+
/** Epoch ms this may first be admitted. Null for a drop or a skip. */
|
|
4042
|
+
dueAt: Schema.NullOr<typeof Schema.Number>;
|
|
4043
|
+
/** How long until the rate window reopens. Null unless dropped. */
|
|
4044
|
+
retryAfterMs: Schema.NullOr<typeof Schema.Number>;
|
|
4045
|
+
/** The `_voltro_workflow_pending` row holding this start. Null unless queued. */
|
|
4046
|
+
intentId: Schema.NullOr<typeof Schema.String>;
|
|
4047
|
+
}>;
|
|
4048
|
+
|
|
3974
4049
|
/**
|
|
3975
4050
|
* Per-step plugin interceptor. Wraps every `step()` (==
|
|
3976
4051
|
* `Activity.make`) invocation inside a workflow body. Composed
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
62
62
|
t !== void 0 && r.push(t);
|
|
63
63
|
}
|
|
64
64
|
return r;
|
|
65
|
-
},
|
|
65
|
+
}, Ve = (e) => c.Union(c.Struct({
|
|
66
66
|
_tag: c.Literal("snapshot"),
|
|
67
67
|
revision: c.Number,
|
|
68
68
|
data: e,
|
|
@@ -76,7 +76,16 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
76
76
|
_tag: c.Literal("error"),
|
|
77
77
|
error: c.Unknown,
|
|
78
78
|
revision: c.optional(c.Number)
|
|
79
|
-
})),
|
|
79
|
+
})), h = class extends c.TaggedError()("BusinessRuleViolation", {
|
|
80
|
+
rule: c.String,
|
|
81
|
+
params: c.optional(c.Record({
|
|
82
|
+
key: c.String,
|
|
83
|
+
value: c.Unknown
|
|
84
|
+
})),
|
|
85
|
+
field: c.optional(c.String),
|
|
86
|
+
message: c.optional(c.String),
|
|
87
|
+
severity: c.Literal("error", "warning")
|
|
88
|
+
}) {}, He = (e) => e.internal !== !0, g = (e) => {
|
|
80
89
|
if (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
|
|
81
90
|
unguarded procedure, or list the scopes required to call it.`);
|
|
82
91
|
let t = typeof e.source == "string" ? [e.source] : Array.isArray(e.source) ? e.source : void 0;
|
|
@@ -90,7 +99,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
90
99
|
let n = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
91
100
|
if (n.length === 0) return e;
|
|
92
101
|
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.`);
|
|
93
|
-
},
|
|
102
|
+
}, Ue = (e) => e.action !== void 0 && e.resourceType !== void 0, _ = (e) => g({
|
|
94
103
|
kind: "query",
|
|
95
104
|
name: e.name,
|
|
96
105
|
input: e.input,
|
|
@@ -128,7 +137,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
128
137
|
exposeAsTool: e.exposeAsTool,
|
|
129
138
|
internal: e.internal,
|
|
130
139
|
overridesPlugin: e.overridesPlugin
|
|
131
|
-
}),
|
|
140
|
+
}), We = (e) => g({
|
|
132
141
|
kind: "stream",
|
|
133
142
|
name: e.name,
|
|
134
143
|
input: e.input,
|
|
@@ -137,36 +146,36 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
137
146
|
internal: e.internal,
|
|
138
147
|
overridesPlugin: e.overridesPlugin,
|
|
139
148
|
guards: e.guards
|
|
140
|
-
}), b = (e, t) => t && t.length > 0 ? c.Union(e, ...t) : e, x = (e, t) => t && t.length > 0 ? c.Union(e, s) : e,
|
|
149
|
+
}), b = (e, t) => t && t.length > 0 ? c.Union(e, ...t) : e, x = (e, t) => t && t.length > 0 ? c.Union(e, s) : e, Ge = (e) => c.Union(e, h), Ke = (e, t) => l.make(e.name, {
|
|
141
150
|
payload: e.input,
|
|
142
|
-
success:
|
|
151
|
+
success: Ve(e.output),
|
|
143
152
|
error: b(x(e.error, e.guards), t),
|
|
144
153
|
stream: !0
|
|
145
|
-
}),
|
|
154
|
+
}), qe = (e, t) => l.make(e.name, {
|
|
146
155
|
payload: e.input,
|
|
147
156
|
success: e.output,
|
|
148
|
-
error: b(x(e.error, e.guards), t)
|
|
149
|
-
}),
|
|
157
|
+
error: b(Ge(x(e.error, e.guards)), t)
|
|
158
|
+
}), Je = (e, t) => l.make(e.name, {
|
|
150
159
|
payload: e.input,
|
|
151
160
|
success: e.output,
|
|
152
161
|
error: b(x(e.error, e.guards), t)
|
|
153
|
-
}),
|
|
162
|
+
}), S = (e, t) => l.make(e.name, {
|
|
154
163
|
payload: e.input,
|
|
155
164
|
success: e.element,
|
|
156
165
|
error: b(e.error, t),
|
|
157
166
|
stream: !0
|
|
158
|
-
}),
|
|
167
|
+
}), Ye = (e) => {
|
|
159
168
|
if (typeof e != "object" || !e) return;
|
|
160
169
|
let t = e._tag;
|
|
161
170
|
return typeof t == "string" ? t : void 0;
|
|
162
|
-
},
|
|
171
|
+
}, Xe = (e) => {
|
|
163
172
|
switch (e.kind) {
|
|
164
|
-
case "query": return
|
|
165
|
-
case "mutation": return
|
|
166
|
-
case "action": return
|
|
167
|
-
case "stream": return
|
|
173
|
+
case "query": return Ke(e);
|
|
174
|
+
case "mutation": return qe(e);
|
|
175
|
+
case "action": return Je(e);
|
|
176
|
+
case "stream": return S(e);
|
|
168
177
|
}
|
|
169
|
-
},
|
|
178
|
+
}, Ze = (e) => {
|
|
170
179
|
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r };
|
|
171
180
|
if (e.kind === "query") return {
|
|
172
181
|
kind: "query",
|
|
@@ -207,7 +216,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
207
216
|
..."shapeItem" in e && e.shapeItem !== void 0 ? { shapeItem: e.shapeItem } : {}
|
|
208
217
|
}))
|
|
209
218
|
};
|
|
210
|
-
},
|
|
219
|
+
}, Qe = 7500, $e = (e) => typeof e == "object" && !!e && e.kind === "event", et = (e) => {
|
|
211
220
|
if (e.name.length === 0) throw Error("defineEvent: `name` must not be empty");
|
|
212
221
|
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
|
|
213
222
|
whitespace and delivers nothing — silently, and only on that broker, so an
|
|
@@ -250,7 +259,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
250
259
|
}), O = (e) => c.Struct({
|
|
251
260
|
key: e,
|
|
252
261
|
resume: c.optional(c.Array(D))
|
|
253
|
-
}),
|
|
262
|
+
}), tt = (e, t) => {
|
|
254
263
|
let n = e.guards && e.guards.length > 0 ? s : c.Never, r = t && t.length > 0 ? c.Union(n, ...t) : n;
|
|
255
264
|
return l.make(e.name, {
|
|
256
265
|
payload: O(e.key),
|
|
@@ -258,13 +267,13 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
258
267
|
error: r,
|
|
259
268
|
stream: !0
|
|
260
269
|
});
|
|
261
|
-
},
|
|
270
|
+
}, nt = class extends c.TaggedError()("EventPayloadInvalid", {
|
|
262
271
|
event: c.String,
|
|
263
272
|
message: c.String
|
|
264
|
-
}) {},
|
|
273
|
+
}) {}, rt = class extends c.TaggedError()("EventKeyInvalid", {
|
|
265
274
|
event: c.String,
|
|
266
275
|
message: c.String
|
|
267
|
-
}) {},
|
|
276
|
+
}) {}, it = class extends c.TaggedError()("EventPayloadTooLarge", {
|
|
268
277
|
event: c.String,
|
|
269
278
|
bytes: c.Number,
|
|
270
279
|
limit: c.Number
|
|
@@ -272,26 +281,26 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
272
281
|
if (typeof e != "object" || !e) return JSON.stringify(e) ?? "null";
|
|
273
282
|
let t = Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t));
|
|
274
283
|
return JSON.stringify(t);
|
|
275
|
-
},
|
|
284
|
+
}, at = "\0", ot = (e, t, n) => [
|
|
276
285
|
e ?? "~",
|
|
277
286
|
t,
|
|
278
287
|
k(n)
|
|
279
|
-
].join("\0"),
|
|
288
|
+
].join("\0"), st = (e) => {
|
|
280
289
|
let [t = "~", n = "", r = ""] = e.split("\0");
|
|
281
290
|
return {
|
|
282
291
|
tenantId: t === "~" ? null : t,
|
|
283
292
|
event: n,
|
|
284
293
|
key: r
|
|
285
294
|
};
|
|
286
|
-
},
|
|
295
|
+
}, ct = (e) => e.split("\0").join(" · "), lt = (e) => e, ut = (e) => e, dt = (e) => {
|
|
287
296
|
if (e.length !== 0) return (t, n) => e.reduceRight((e, t) => t(e, n), t);
|
|
288
|
-
},
|
|
297
|
+
}, ft = (e, t) => {
|
|
289
298
|
let n = Ne.GenericTag(e);
|
|
290
299
|
return {
|
|
291
300
|
Tag: n,
|
|
292
301
|
Live: Pe.succeed(n, t)
|
|
293
302
|
};
|
|
294
|
-
},
|
|
303
|
+
}, pt = (e, t, n) => {
|
|
295
304
|
if (!t) return { ok: !0 };
|
|
296
305
|
let r = A(n);
|
|
297
306
|
if (!r) return {
|
|
@@ -301,7 +310,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
301
310
|
let i = t.trim();
|
|
302
311
|
if (i === "*" || i === "") return { ok: !0 };
|
|
303
312
|
let a = i.split(/\s+/).filter((e) => e.length > 0);
|
|
304
|
-
for (let i of a) if (!
|
|
313
|
+
for (let i of a) if (!mt(i, r)) return {
|
|
305
314
|
ok: !1,
|
|
306
315
|
reason: `plugin "${e}" requires framework ${t}, running ${n}`
|
|
307
316
|
};
|
|
@@ -314,7 +323,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
314
323
|
patch: Number(t[3]),
|
|
315
324
|
pre: t[4] ?? ""
|
|
316
325
|
} : null;
|
|
317
|
-
}, 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,
|
|
326
|
+
}, 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, mt = (e, t) => {
|
|
318
327
|
if (e === "*") return !0;
|
|
319
328
|
if (e.startsWith("^")) {
|
|
320
329
|
let n = A(e.slice(1));
|
|
@@ -336,12 +345,18 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
336
345
|
}
|
|
337
346
|
let r = A(e);
|
|
338
347
|
return r ? j(t, r) === 0 : !1;
|
|
339
|
-
}, M = c.Literal("running", "succeeded", "failed", "cancelled", "suspended"), N = c.Literal("cancel", "terminate", "abandon"),
|
|
348
|
+
}, M = c.Literal("running", "succeeded", "failed", "cancelled", "suspended"), N = c.Literal("cancel", "terminate", "abandon"), P = c.Struct({
|
|
349
|
+
mode: c.String,
|
|
350
|
+
dueAt: c.NullOr(c.Number),
|
|
351
|
+
retryAfterMs: c.NullOr(c.Number),
|
|
352
|
+
intentId: c.NullOr(c.String)
|
|
353
|
+
}), ht = c.Struct({
|
|
340
354
|
id: c.String,
|
|
341
355
|
workflowName: c.String,
|
|
342
|
-
executionId: c.String,
|
|
343
|
-
status: c.Literal("running")
|
|
344
|
-
|
|
356
|
+
executionId: c.NullOr(c.String),
|
|
357
|
+
status: c.Literal("running", "queued", "dropped", "skipped"),
|
|
358
|
+
deferral: c.optional(P)
|
|
359
|
+
}), F = c.Struct({
|
|
345
360
|
id: c.String,
|
|
346
361
|
tag: c.String,
|
|
347
362
|
executionId: c.String,
|
|
@@ -361,11 +376,11 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
361
376
|
traceId: c.NullOr(c.String),
|
|
362
377
|
parentExecutionId: c.NullOr(c.String),
|
|
363
378
|
parentClosePolicy: c.NullOr(N)
|
|
364
|
-
}),
|
|
379
|
+
}), I = c.Struct({
|
|
365
380
|
tag: c.optional(c.String),
|
|
366
381
|
status: c.optional(M),
|
|
367
382
|
limit: c.optional(c.Number)
|
|
368
|
-
}),
|
|
383
|
+
}), L = c.Struct({
|
|
369
384
|
id: c.String,
|
|
370
385
|
runId: c.String,
|
|
371
386
|
stepName: c.String,
|
|
@@ -380,7 +395,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
380
395
|
startedAt: c.Date,
|
|
381
396
|
completedAt: c.NullOr(c.Date),
|
|
382
397
|
durationMs: c.NullOr(c.Number)
|
|
383
|
-
}),
|
|
398
|
+
}), R = c.Struct({
|
|
384
399
|
id: c.String,
|
|
385
400
|
runId: c.String,
|
|
386
401
|
eventType: c.String,
|
|
@@ -388,7 +403,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
388
403
|
occurredAt: c.Date,
|
|
389
404
|
stepName: c.NullOr(c.String),
|
|
390
405
|
attempt: c.NullOr(c.Number)
|
|
391
|
-
}),
|
|
406
|
+
}), z = c.Struct({
|
|
392
407
|
id: c.String,
|
|
393
408
|
name: c.String,
|
|
394
409
|
payload: c.Unknown,
|
|
@@ -396,7 +411,7 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
396
411
|
subject: c.NullOr(c.Unknown),
|
|
397
412
|
traceId: c.NullOr(c.String),
|
|
398
413
|
occurredAt: c.Date
|
|
399
|
-
}),
|
|
414
|
+
}), B = c.Struct({
|
|
400
415
|
id: c.String,
|
|
401
416
|
eventId: c.String,
|
|
402
417
|
eventName: c.String,
|
|
@@ -409,123 +424,123 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
409
424
|
errorMessage: c.NullOr(c.String),
|
|
410
425
|
createdAt: c.Date,
|
|
411
426
|
completedAt: c.NullOr(c.Date)
|
|
412
|
-
}),
|
|
427
|
+
}), V = c.Struct({ id: c.String }), H = c.Struct({ runId: c.String }), U = c.Struct({
|
|
413
428
|
name: c.optional(c.String),
|
|
414
429
|
limit: c.optional(c.Number)
|
|
415
|
-
}),
|
|
430
|
+
}), W = c.Struct({ eventId: c.String }), G = c.Struct({
|
|
416
431
|
workflowName: c.String,
|
|
417
432
|
executionId: c.String
|
|
418
|
-
}),
|
|
433
|
+
}), K = c.Struct({
|
|
419
434
|
id: c.String,
|
|
420
435
|
signalName: c.String,
|
|
421
436
|
payload: c.optional(c.Unknown)
|
|
422
|
-
}),
|
|
437
|
+
}), q = c.Struct({
|
|
423
438
|
id: c.String,
|
|
424
439
|
updateName: c.String,
|
|
425
440
|
payload: c.optional(c.Unknown),
|
|
426
441
|
timeoutMs: c.optional(c.Number)
|
|
427
|
-
}),
|
|
442
|
+
}), J = c.Struct({
|
|
428
443
|
eventId: c.String,
|
|
429
444
|
updateId: c.String,
|
|
430
445
|
completedEventId: c.String,
|
|
431
446
|
result: c.Unknown
|
|
432
|
-
}),
|
|
447
|
+
}), gt = _({
|
|
433
448
|
name: "__voltro.workflow.run",
|
|
434
449
|
source: "_voltro_workflow_runs",
|
|
435
|
-
input:
|
|
436
|
-
output: c.Array(
|
|
437
|
-
}),
|
|
450
|
+
input: V,
|
|
451
|
+
output: c.Array(F)
|
|
452
|
+
}), _t = _({
|
|
438
453
|
name: "__voltro.workflow.runs",
|
|
439
454
|
source: "_voltro_workflow_runs",
|
|
440
|
-
input:
|
|
441
|
-
output: c.Array(
|
|
442
|
-
}),
|
|
455
|
+
input: I,
|
|
456
|
+
output: c.Array(F)
|
|
457
|
+
}), vt = _({
|
|
443
458
|
name: "__voltro.workflow.run.steps",
|
|
444
459
|
source: "_voltro_workflow_run_steps",
|
|
445
|
-
input:
|
|
446
|
-
output: c.Array(I)
|
|
447
|
-
}), vt = _({
|
|
448
|
-
name: "__voltro.workflow.run.events",
|
|
449
|
-
source: "_voltro_workflow_run_events",
|
|
450
|
-
input: V,
|
|
460
|
+
input: H,
|
|
451
461
|
output: c.Array(L)
|
|
452
462
|
}), yt = _({
|
|
453
|
-
name: "__voltro.workflow.
|
|
454
|
-
source: "
|
|
455
|
-
input:
|
|
463
|
+
name: "__voltro.workflow.run.events",
|
|
464
|
+
source: "_voltro_workflow_run_events",
|
|
465
|
+
input: H,
|
|
456
466
|
output: c.Array(R)
|
|
457
467
|
}), bt = _({
|
|
468
|
+
name: "__voltro.workflow.domainEvents",
|
|
469
|
+
source: "_voltro_workflow_events",
|
|
470
|
+
input: U,
|
|
471
|
+
output: c.Array(z)
|
|
472
|
+
}), xt = _({
|
|
458
473
|
name: "__voltro.workflow.event.deliveries",
|
|
459
474
|
source: "_voltro_workflow_event_deliveries",
|
|
460
|
-
input:
|
|
461
|
-
output: c.Array(
|
|
462
|
-
}),
|
|
475
|
+
input: W,
|
|
476
|
+
output: c.Array(B)
|
|
477
|
+
}), St = y({
|
|
463
478
|
name: "__voltro.workflow.cancel",
|
|
464
|
-
input:
|
|
479
|
+
input: G,
|
|
465
480
|
output: c.Struct({ ok: c.Boolean })
|
|
466
|
-
}),
|
|
481
|
+
}), Ct = y({
|
|
467
482
|
name: "__voltro.workflow.resume",
|
|
468
|
-
input:
|
|
483
|
+
input: G,
|
|
469
484
|
output: c.Struct({ ok: c.Boolean })
|
|
470
|
-
}),
|
|
485
|
+
}), wt = y({
|
|
471
486
|
name: "__voltro.workflow.signal",
|
|
472
|
-
input:
|
|
487
|
+
input: K,
|
|
473
488
|
output: c.Struct({ eventId: c.String })
|
|
474
|
-
}),
|
|
489
|
+
}), Tt = y({
|
|
475
490
|
name: "__voltro.workflow.update",
|
|
476
|
-
input:
|
|
477
|
-
output:
|
|
478
|
-
}),
|
|
491
|
+
input: q,
|
|
492
|
+
output: J
|
|
493
|
+
}), Y = "__voltro.undo.log", X = "__voltro.undo.apply", Et = "__voltro.undo.redo", Dt = c.Struct({
|
|
479
494
|
id: c.String,
|
|
480
495
|
tag: c.String,
|
|
481
496
|
label: c.NullOr(c.String),
|
|
482
497
|
undone: c.Boolean,
|
|
483
498
|
crossesAction: c.Boolean,
|
|
484
499
|
createdAt: c.String
|
|
485
|
-
}),
|
|
500
|
+
}), Ot = class extends c.TaggedError()("UndoNotFound", { invocationId: c.String }) {}, kt = class extends c.TaggedError()("UndoForbidden", { invocationId: c.String }) {}, At = class extends c.TaggedError()("UndoConflict", {
|
|
486
501
|
invocationId: c.String,
|
|
487
502
|
reason: c.Literal("conflict", "action")
|
|
488
|
-
}) {},
|
|
489
|
-
name:
|
|
503
|
+
}) {}, jt = c.Union(Ot, kt, At), Mt = _({
|
|
504
|
+
name: Y,
|
|
490
505
|
source: "_voltro_undo_log",
|
|
491
506
|
input: c.Struct({ limit: c.optional(c.Number) }),
|
|
492
|
-
output: c.Array(
|
|
493
|
-
}),
|
|
494
|
-
name:
|
|
507
|
+
output: c.Array(Dt)
|
|
508
|
+
}), Nt = v({
|
|
509
|
+
name: X,
|
|
495
510
|
input: c.Struct({ invocationId: c.String }),
|
|
496
511
|
output: c.Struct({ ok: c.Boolean }),
|
|
497
|
-
error:
|
|
498
|
-
}),
|
|
499
|
-
name:
|
|
512
|
+
error: jt
|
|
513
|
+
}), Pt = v({
|
|
514
|
+
name: Et,
|
|
500
515
|
input: c.Struct({ invocationId: c.String }),
|
|
501
516
|
output: c.Struct({ ok: c.Boolean }),
|
|
502
|
-
error:
|
|
503
|
-
}),
|
|
517
|
+
error: jt
|
|
518
|
+
}), Ft = "__voltro.connections.list", It = "__voltro.connections.start", Lt = "__voltro.connections.submitToken", Rt = "__voltro.connections.disconnect", Z = c.Literal("oauth2", "pat"), zt = c.Literal("disconnected", "connected", "expired", "revoked", "error"), Q = c.Struct({
|
|
504
519
|
connectionId: c.String,
|
|
505
|
-
kind:
|
|
520
|
+
kind: Z,
|
|
506
521
|
label: c.String,
|
|
507
|
-
status:
|
|
522
|
+
status: zt,
|
|
508
523
|
accountId: c.NullOr(c.String),
|
|
509
524
|
accountLabel: c.NullOr(c.String),
|
|
510
525
|
scopes: c.Array(c.String),
|
|
511
526
|
expiresAt: c.NullOr(c.String),
|
|
512
527
|
lastError: c.NullOr(c.String),
|
|
513
528
|
connectedAt: c.NullOr(c.String)
|
|
514
|
-
}),
|
|
529
|
+
}), Bt = class extends c.TaggedError()("ConnectionNotDeclared", { connectionId: c.String }) {}, Vt = class extends c.TaggedError()("ConnectionSubjectRequired", { connectionId: c.String }) {}, Ht = class extends c.TaggedError()("ConnectionKindMismatch", {
|
|
515
530
|
connectionId: c.String,
|
|
516
|
-
expected:
|
|
517
|
-
actual:
|
|
518
|
-
}) {},
|
|
531
|
+
expected: Z,
|
|
532
|
+
actual: Z
|
|
533
|
+
}) {}, Ut = class extends c.TaggedError()("ConnectionHandshakeFailed", {
|
|
519
534
|
connectionId: c.String,
|
|
520
535
|
reason: c.String,
|
|
521
536
|
transient: c.Boolean
|
|
522
|
-
}) {}, $ = c.Union(
|
|
523
|
-
name:
|
|
537
|
+
}) {}, $ = c.Union(Bt, Vt, Ht, Ut), Wt = _({
|
|
538
|
+
name: Ft,
|
|
524
539
|
source: "_voltro_connections",
|
|
525
540
|
input: c.Struct({}),
|
|
526
|
-
output: c.Array(
|
|
527
|
-
}),
|
|
528
|
-
name:
|
|
541
|
+
output: c.Array(Q)
|
|
542
|
+
}), Gt = y({
|
|
543
|
+
name: It,
|
|
529
544
|
input: c.Struct({
|
|
530
545
|
connectionId: c.String,
|
|
531
546
|
redirectTo: c.optional(c.String)
|
|
@@ -535,22 +550,22 @@ var Fe = c.Union(c.String, c.Number), u = c.Record({
|
|
|
535
550
|
state: c.String
|
|
536
551
|
}),
|
|
537
552
|
error: $
|
|
538
|
-
}),
|
|
539
|
-
name:
|
|
553
|
+
}), Kt = v({
|
|
554
|
+
name: Lt,
|
|
540
555
|
input: c.Struct({
|
|
541
556
|
connectionId: c.String,
|
|
542
557
|
token: c.String
|
|
543
558
|
}),
|
|
544
559
|
output: c.Struct({ ok: c.Boolean }),
|
|
545
560
|
error: $
|
|
546
|
-
}),
|
|
547
|
-
name:
|
|
561
|
+
}), qt = v({
|
|
562
|
+
name: Rt,
|
|
548
563
|
input: c.Struct({ connectionId: c.String }),
|
|
549
564
|
output: c.Struct({ ok: c.Boolean }),
|
|
550
565
|
error: $
|
|
551
|
-
}),
|
|
566
|
+
}), Jt = (e) => {
|
|
552
567
|
let t = e instanceof Date ? e.getTime() : typeof e == "number" ? e : typeof e == "string" ? new Date(e).getTime() : 0;
|
|
553
568
|
return Number.isNaN(t) ? 0 : t;
|
|
554
|
-
},
|
|
569
|
+
}, Yt = 1;
|
|
555
570
|
//#endregion
|
|
556
|
-
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,
|
|
571
|
+
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, h as BusinessRuleViolation, Ft as CONNECTIONS_LIST_TAG, Rt as CONNECTION_DISCONNECT_TAG, It as CONNECTION_START_TAG, Lt as CONNECTION_SUBMIT_TOKEN_TAG, Ut as ConnectionHandshakeFailed, Ee as ConnectionInfo, ke as ConnectionInfoMiddleware, Z as ConnectionKind, Ht as ConnectionKindMismatch, Bt as ConnectionNotDeclared, Q as ConnectionState, zt as ConnectionStatus, Vt as ConnectionSubjectRequired, at as EVENT_ROUTE_SEP, rt as EventKeyInvalid, nt as EventPayloadInvalid, it as EventPayloadTooLarge, Qe as MAX_EVENT_ENVELOPE_BYTES, Yt as PROTOCOL_VERSION, s as ScopeError, we as Subject, be as SubjectService, X as UNDO_APPLY_TAG, Y as UNDO_LOG_TAG, Et as UNDO_REDO_TAG, De as Unauthenticated, At as UndoConflict, kt as UndoForbidden, Dt as UndoLogEntry, Ot as UndoNotFound, G as WorkflowControlInputSchema, z as WorkflowDomainEventRowSchema, U as WorkflowDomainEventsInputSchema, W as WorkflowEventDeliveriesInputSchema, B as WorkflowEventDeliveryRowSchema, N as WorkflowParentClosePolicySchema, R as WorkflowRunEventRowSchema, ht as WorkflowRunHandleSchema, V as WorkflowRunRefSchema, F as WorkflowRunRowSchema, M as WorkflowRunStatusSchema, L as WorkflowRunStepRowSchema, H as WorkflowRunTableRefSchema, I as WorkflowRunsInputSchema, K as WorkflowSignalInputSchema, P as WorkflowStartDeferralSchema, q as WorkflowUpdateInputSchema, J as WorkflowUpdateResultSchema, Je as actionToRpc, le as advisoryResourceGuardWarning, Ae as anonymousSubject, Be as applyRowPatch, xe as assertAuthenticated, fe as beginIdempotent, pt as checkFrameworkCompat, oe as checkGuards, ae as checkGuardsEffect, Te as composeAuthStrategies, dt as composeRpcInterceptors, qt as connectionDisconnectDescriptor, Gt as connectionStartDescriptor, Kt as connectionSubmitTokenDescriptor, Wt as connectionsListQueryDescriptor, y as defineAction, et as defineEvent, v as defineMutation, lt as definePlugin, ut as definePluginRoute, ft as definePluginService, _ as defineQuery, We as defineStream, Re as diffRows, o as effectiveScopes, k as encodeEventKey, Ye as errorTag, T as eventAttached, C as eventEnvelope, w as eventGap, D as eventResumePoint, ot as eventRoute, E as eventStreamEvent, O as eventSubscribeInput, tt as eventToRpc, se as failIdempotent, ge as findAdvisoryResourceGuards, ee as finishIdempotent, ct as formatEventRoute, ye as getPolicyGuardResolver, te as getResourceScopeResolver, Me as hasCallbackRoutes, ve as hasEffectiveScope, i as hasScope, p as idToPath, de as idempotencyScope, $e as isEventDescriptor, ze as isIdKeyed, e as isPolicyCheck, Ue as isPolicyGuard, Se as isSystemSubject, He as isWireReachable, pe as memoryIdempotencyStore, qe as mutationToRpc, Ze as normalizeDescriptor, st as parseEventRoute, Ie as pathToId, me as publishServerError, Ke as queryToRpc, _e as requireScope, d as rowPatchOpSchema, f as rowPatchSchema, a as setEffectiveScopes, n as setPolicyGuardResolver, t as setResourceScopeResolver, S as streamToRpc, r as subjectScopes, ue as subscribeServerErrors, Ve as subscriptionEvent, Ce as systemSubject, Oe as tenantScopedSubject, Xe as toRpc, Jt as tsMs, Nt as undoApplyDescriptor, Mt as undoLogQueryDescriptor, Pt as undoRedoDescriptor, St as workflowCancelDescriptor, bt as workflowDomainEventsQueryDescriptor, xt as workflowEventDeliveriesQueryDescriptor, Ct as workflowResumeDescriptor, yt as workflowRunEventsQueryDescriptor, gt as workflowRunQueryDescriptor, vt as workflowRunStepsQueryDescriptor, _t as workflowRunsQueryDescriptor, wt as workflowSignalDescriptor, Tt as workflowUpdateDescriptor, ne as wsMutationIdempotencyScope };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "The Voltro wire + plugin contract — defineQuery/Mutation/Action/Stream, definePlugin, sessions / JWT / API-keys, and the RPC protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@effect/sql": "^0.52.0",
|
|
56
|
-
"@voltro/database": "0.
|
|
56
|
+
"@voltro/database": "0.30.0",
|
|
57
57
|
"jose": "^6.2.4"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|