@voltro/protocol 0.86.0 → 0.88.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 +5484 -0
- package/THIRD-PARTY-NOTICES.md +3 -227
- package/dist/apiRoleEndpoints.js +107 -0
- package/dist/apiRoleObservation.js +67 -0
- package/dist/apikey.d.ts +10 -0
- package/dist/apikey.js +1 -2
- package/dist/approval.js +1 -2
- package/dist/approvalDescriptors.js +1 -2
- package/dist/auth.js +40 -21
- package/dist/boundedRing.js +1 -2
- package/dist/businessRule.js +1 -2
- package/dist/canonicalJson.js +13 -0
- package/dist/connection.js +1 -2
- package/dist/devActivity.js +1 -2
- package/dist/errorSchema.js +23 -0
- package/dist/errorValue.js +1 -2
- package/dist/event.js +52 -47
- package/dist/formCapture.js +11 -0
- package/dist/httpStreamMaxDuration.js +8 -0
- package/dist/idempotency.js +89 -35
- package/dist/idempotencyInput.js +122 -0
- package/dist/identity.js +1 -2
- package/dist/index.d.ts +876 -124
- package/dist/index.js +51 -40
- package/dist/inspect.d.ts +1 -1
- package/dist/inspect.js +1 -2
- package/dist/inspectBackfill.js +1 -2
- package/dist/inspectCommandRejection.js +1 -2
- package/dist/inspectProjection.js +1 -2
- package/dist/inspectStorageProjection.js +1 -2
- package/dist/inspectValueIdentity.js +1 -2
- package/dist/inspectWorkflowExecution.js +1 -2
- package/dist/inspectWorkflowQueuedStart.js +1 -2
- package/dist/jsonSchema.js +1 -2
- package/dist/jwt.d.ts +10 -0
- package/dist/jwt.js +2 -3
- package/dist/outbox.js +1 -2
- package/dist/pairing.js +1 -2
- package/dist/plugin.js +44 -19
- package/dist/pluginAccountMerge.js +87 -0
- package/dist/pluginNaming.js +1 -2
- package/dist/pluginPrivacy.js +165 -0
- package/dist/procedure.js +115 -98
- package/dist/publicApi.js +191 -211
- package/dist/queryOptionalSources.js +13 -0
- package/dist/reactivityChannel.js +1 -2
- package/dist/rest.d.ts +227 -64
- package/dist/rest.js +296 -194
- package/dist/restFormat.js +1 -2
- package/dist/restReceipt.js +42 -0
- package/dist/revalidate.js +12 -0
- package/dist/rowEquality.js +1 -2
- package/dist/rowPatch.js +1 -2
- package/dist/schemaShape.js +1 -2
- package/dist/scopes.js +72 -40
- package/dist/secretWindows.js +70 -0
- package/dist/serverErrorBus.js +1 -2
- package/dist/serviceCall.js +1 -2
- package/dist/session.d.ts +89 -6
- package/dist/session.js +56 -56
- package/dist/sessionHeader.js +1 -2
- package/dist/ssrfPolicy.js +29 -0
- package/dist/storageAccess.js +1 -2
- package/dist/storeErrors.js +1 -2
- package/dist/storeScreenshots.js +1 -2
- package/dist/strictInput.js +1 -2
- package/dist/subscriptionEvent.js +1 -2
- package/dist/tenantSelection.js +1 -2
- package/dist/time.js +1 -2
- package/dist/undo.js +1 -2
- package/dist/validation.js +1 -2
- package/dist/webSocketGateway.js +8 -3
- package/dist/workflow.js +1 -2
- package/dist/workflowAccess.js +1 -2
- package/dist/workflowRestart.js +1 -2
- package/dist/workflowRetry.js +1 -2
- package/dist/workflowStartOutcome.js +1 -2
- package/package.json +7 -5
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { Effect as e, Schema as t } from "effect";
|
|
2
|
+
// src/pluginPrivacy.ts
|
|
3
|
+
var n = t.Literals([
|
|
4
|
+
"prepare",
|
|
5
|
+
"data",
|
|
6
|
+
"identity",
|
|
7
|
+
"finalize"
|
|
8
|
+
]), r = class extends t.TaggedError()("PluginPrivacyFailure", {
|
|
9
|
+
code: t.Literals([
|
|
10
|
+
"invalid_request",
|
|
11
|
+
"coverage_missing",
|
|
12
|
+
"hook_failed",
|
|
13
|
+
"unavailable"
|
|
14
|
+
]),
|
|
15
|
+
operation: t.Literals(["export", "erase"]),
|
|
16
|
+
requestId: t.String,
|
|
17
|
+
plugin: t.NullOr(t.String),
|
|
18
|
+
completed: t.Array(t.String),
|
|
19
|
+
missing: t.Array(t.String)
|
|
20
|
+
}) {}, i = (e) => typeof e == "object" && e && "tableName" in e && typeof e.tableName == "string" ? e.tableName : void 0, a = (e) => {
|
|
21
|
+
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
22
|
+
if (e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e)) return;
|
|
23
|
+
if (typeof e != "object" || !e || t.has(e)) throw Error("Invalid privacy JSON");
|
|
24
|
+
let r = Array.isArray(e), i = Object.getPrototypeOf(e);
|
|
25
|
+
if (r && i !== Array.prototype || !r && i !== Object.prototype && i !== null || Object.getOwnPropertySymbols(e).length !== 0) throw Error("Invalid privacy JSON");
|
|
26
|
+
t.add(e);
|
|
27
|
+
let a = Object.getOwnPropertyDescriptors(e);
|
|
28
|
+
if (r) {
|
|
29
|
+
let e = a.length?.value;
|
|
30
|
+
if (typeof e != "number" || Object.keys(a).length !== e + 1) throw Error("Invalid privacy JSON");
|
|
31
|
+
for (let t = 0; t < e; t++) {
|
|
32
|
+
let e = a[t];
|
|
33
|
+
if (!e || !e.enumerable || !("value" in e)) throw Error("Invalid privacy JSON");
|
|
34
|
+
n(e.value);
|
|
35
|
+
}
|
|
36
|
+
} else for (let e of Object.values(a)) {
|
|
37
|
+
if (!e.enumerable || !("value" in e)) throw Error("Invalid privacy JSON");
|
|
38
|
+
n(e.value);
|
|
39
|
+
}
|
|
40
|
+
t.delete(e);
|
|
41
|
+
};
|
|
42
|
+
return n(e), JSON.parse(JSON.stringify(e));
|
|
43
|
+
}, o = (o) => {
|
|
44
|
+
let s = /* @__PURE__ */ new Set(), c = o.map((e) => {
|
|
45
|
+
if (s.has(e.name)) throw Error(`Duplicate privacy plugin instance: ${e.name}`);
|
|
46
|
+
s.add(e.name);
|
|
47
|
+
let r = e.subjectPrivacy, a = [...e.extendSchema?.tables ?? []].map(i);
|
|
48
|
+
if (r !== void 0 || e.onErase !== void 0 || e.onExport !== void 0) {
|
|
49
|
+
if (r === void 0 || e.onErase === void 0 || e.onExport === void 0) throw Error(`Subject privacy requires a declaration and both hooks: ${e.name}`);
|
|
50
|
+
if (r.kinds.length === 0 || r.kinds.some((e) => e !== "user" && e !== "guest") || new Set(r.kinds).size !== r.kinds.length || r.tables.some((e) => typeof e != "string" || !e.trim()) || new Set(r.tables).size !== r.tables.length || r.erasePhase !== void 0 && !t.is(n)(r.erasePhase)) throw Error(`Invalid subject privacy declaration: ${e.name}`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
name: e.name,
|
|
54
|
+
tables: a,
|
|
55
|
+
declaration: r === void 0 ? void 0 : {
|
|
56
|
+
tables: [...r.tables],
|
|
57
|
+
kinds: [...r.kinds],
|
|
58
|
+
erasePhase: r.erasePhase ?? "data"
|
|
59
|
+
},
|
|
60
|
+
onErase: e.onErase,
|
|
61
|
+
onExport: e.onExport
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
for (let e of ["user", "guest"]) if (c.filter((t) => t.declaration?.erasePhase === "finalize" && t.declaration.kinds.includes(e)).length > 1) throw Error(`Subject privacy allows one completion owner per kind: ${e}`);
|
|
65
|
+
let l = (e) => {
|
|
66
|
+
let t = [], n = [];
|
|
67
|
+
for (let r of c) {
|
|
68
|
+
let i = r.declaration;
|
|
69
|
+
(i === void 0 || i.kinds.includes(e)) && (i !== void 0 && t.push({
|
|
70
|
+
name: r.name,
|
|
71
|
+
tables: [...i.tables],
|
|
72
|
+
erasePhase: i.erasePhase
|
|
73
|
+
}), r.tables.some((e) => e === void 0 || !i?.tables.includes(e)) && n.push(r.name));
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
participants: t,
|
|
77
|
+
missing: n
|
|
78
|
+
};
|
|
79
|
+
}, u = (t, n) => e.gen(function* () {
|
|
80
|
+
let i = typeof t?.requestId == "string" ? t.requestId : "", a = t?.target;
|
|
81
|
+
if (!i.trim() || typeof a?.subjectId != "string" || !a.subjectId.trim() || !(a.tenantId === null || typeof a.tenantId == "string" && a.tenantId.trim()) || a.kind !== "user" && a.kind !== "guest") return yield* e.fail(new r({
|
|
82
|
+
code: "invalid_request",
|
|
83
|
+
operation: n,
|
|
84
|
+
requestId: i,
|
|
85
|
+
plugin: null,
|
|
86
|
+
completed: [],
|
|
87
|
+
missing: []
|
|
88
|
+
}));
|
|
89
|
+
let o = l(a.kind);
|
|
90
|
+
return o.missing.length > 0 || o.participants.length === 0 ? yield* e.fail(new r({
|
|
91
|
+
code: "coverage_missing",
|
|
92
|
+
operation: n,
|
|
93
|
+
requestId: i,
|
|
94
|
+
plugin: null,
|
|
95
|
+
completed: [],
|
|
96
|
+
missing: o.missing
|
|
97
|
+
})) : {
|
|
98
|
+
requestId: i,
|
|
99
|
+
target: Object.freeze({
|
|
100
|
+
subjectId: a.subjectId,
|
|
101
|
+
tenantId: a.tenantId,
|
|
102
|
+
kind: a.kind
|
|
103
|
+
}),
|
|
104
|
+
context: Object.freeze({
|
|
105
|
+
requestId: i,
|
|
106
|
+
tenantId: a.tenantId,
|
|
107
|
+
kind: a.kind
|
|
108
|
+
}),
|
|
109
|
+
participants: o.participants
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
coverage: l,
|
|
114
|
+
exportSubject: (t) => e.gen(function* () {
|
|
115
|
+
let n = yield* u(t, "export"), i = [];
|
|
116
|
+
for (let t of n.participants) {
|
|
117
|
+
let o = c.find((e) => e.name === t.name).onExport, s = yield* e.suspend(() => o(n.target.subjectId, n.context)).pipe(e.map(a), e.catchCause(() => e.fail(new r({
|
|
118
|
+
code: "hook_failed",
|
|
119
|
+
operation: "export",
|
|
120
|
+
requestId: n.requestId,
|
|
121
|
+
plugin: t.name,
|
|
122
|
+
completed: i.map((e) => e.name),
|
|
123
|
+
missing: []
|
|
124
|
+
}))));
|
|
125
|
+
i.push({
|
|
126
|
+
name: t.name,
|
|
127
|
+
data: s
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
requestId: n.requestId,
|
|
132
|
+
target: n.target,
|
|
133
|
+
plugins: i
|
|
134
|
+
};
|
|
135
|
+
}),
|
|
136
|
+
eraseSubject: (t) => e.gen(function* () {
|
|
137
|
+
let n = yield* u(t, "erase"), i = [], a = [
|
|
138
|
+
...n.participants.filter((e) => e.erasePhase === "prepare"),
|
|
139
|
+
...n.participants.filter((e) => e.erasePhase === "data"),
|
|
140
|
+
...n.participants.filter((e) => e.erasePhase === "identity"),
|
|
141
|
+
...n.participants.filter((e) => e.erasePhase === "finalize")
|
|
142
|
+
];
|
|
143
|
+
for (let t of a) {
|
|
144
|
+
let a = c.find((e) => e.name === t.name).onErase, o = t.erasePhase === "finalize" ? Object.freeze({
|
|
145
|
+
...n.context,
|
|
146
|
+
completed: Object.freeze([...i])
|
|
147
|
+
}) : n.context;
|
|
148
|
+
yield* e.suspend(() => a(n.target.subjectId, o)).pipe(e.catchCause(() => e.fail(new r({
|
|
149
|
+
code: "hook_failed",
|
|
150
|
+
operation: "erase",
|
|
151
|
+
requestId: n.requestId,
|
|
152
|
+
plugin: t.name,
|
|
153
|
+
completed: [...i],
|
|
154
|
+
missing: []
|
|
155
|
+
})))), i.push(t.name);
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
requestId: n.requestId,
|
|
159
|
+
target: n.target,
|
|
160
|
+
completed: i
|
|
161
|
+
};
|
|
162
|
+
})
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export { n as PluginPrivacyErasePhaseSchema, r as PluginPrivacyFailure, o as createPluginPrivacyRegistry };
|
package/dist/procedure.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { subscriptionEvent as e } from "./subscriptionEvent.js";
|
|
2
2
|
import { RequestedTenantRefused as t } from "./tenantSelection.js";
|
|
3
3
|
import { Unauthenticated as n } from "./auth.js";
|
|
4
|
-
import { NoSuchResource as r, ScopeError as i, declaresResourceGuard as a, isOpenAccess as o, openAccessSpec as s, serviceAccessSpec as c } from "./scopes.js";
|
|
5
|
-
import { strictInput as
|
|
6
|
-
import { BusinessRuleViolation as
|
|
7
|
-
import { MutationConnectionRequired as
|
|
8
|
-
import { ValidationError as
|
|
9
|
-
import { ApprovalErrors as
|
|
10
|
-
import { normalizeSource as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
import { NoSuchResource as r, ScopeError as i, declaresResourceGuard as a, isOpenAccess as o, openAccessSpec as s, serviceAccessSpec as c, upgradedGuardShapeError as l } from "./scopes.js";
|
|
5
|
+
import { strictInput as u } from "./strictInput.js";
|
|
6
|
+
import { BusinessRuleViolation as d } from "./businessRule.js";
|
|
7
|
+
import { MutationConnectionRequired as f, MutationIdempotencyRefused as p, MutationInFlight as m } from "./idempotency.js";
|
|
8
|
+
import { ValidationError as h, ValidationErrors as g } from "./validation.js";
|
|
9
|
+
import { ApprovalErrors as _ } from "./approval.js";
|
|
10
|
+
import { normalizeSource as v } from "./reactivityChannel.js";
|
|
11
|
+
import { captureOptionalQuerySources as y } from "./queryOptionalSources.js";
|
|
12
|
+
import { Schema as b } from "effect";
|
|
13
|
+
import { Rpc as x } from "effect/rpc";
|
|
14
|
+
import { VersionConflict as S } from "@voltro/database/wire";
|
|
15
|
+
// src/procedure.ts
|
|
16
|
+
var C = (e) => e.internal !== !0, w = (e) => e.service === void 0 ? "client" : "service", T = (e) => C(e) && e.service === void 0, E = (e) => C(e) && e.service !== void 0, D = /^[a-z][a-z0-9-]{0,55}$/i, O = (e) => {
|
|
17
|
+
if (A(e), k(e), e.undo !== void 0 && (e.undo === null || e.undo.capture !== !1 || typeof e.undo.reason != "string" || e.undo.reason.trim() === "")) throw Error(`${e.name}: undo requires capture: false and a non-empty reason`);
|
|
18
|
+
if (e.idempotencyScope !== void 0 && e.idempotencyScope !== "subject" && e.idempotencyScope !== "connection") throw Error(`${e.name}: idempotencyScope must be 'subject' or 'connection'`);
|
|
17
19
|
let t = e.serialize;
|
|
18
20
|
if (t !== void 0) {
|
|
19
21
|
if (typeof t.key != "function") throw Error(`${e.name}: serialize.key must be a function of the input`);
|
|
@@ -37,13 +39,13 @@ var b = (e) => e.internal !== !0, x = (e) => e.service === void 0 ? "client" : "
|
|
|
37
39
|
let r = [e.publicApi === void 0 ? void 0 : "publicApi", e.exposeAsTool === void 0 ? void 0 : "exposeAsTool"].filter((e) => e !== void 0);
|
|
38
40
|
if (r.length === 0) return e;
|
|
39
41
|
throw Error(`${e.name}: \`internal: true\` cannot be combined with ${r.map((e) => `\`${e}\``).join(" or ")}. \`internal\` takes the procedure OFF the wire; those put it back ON a different one (${r.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 ${r.join(" / ")} annotation if it is not.`);
|
|
40
|
-
},
|
|
42
|
+
}, k = (e) => {
|
|
41
43
|
let t = e.service;
|
|
42
44
|
if (t === void 0) return;
|
|
43
45
|
let n = t.callers;
|
|
44
46
|
if (!Array.isArray(n) || n.length === 0) throw Error(`${e.name}: \`service.callers\` is empty, so NO app may call this procedure —\n and no browser either. Name the calling app(s), e.g. \`service: { callers: ['worker'] }\`,
|
|
45
47
|
or drop \`service:\` if the procedure is meant for this app's own clients.`);
|
|
46
|
-
let r = n.filter((e) => typeof e != "string" || !
|
|
48
|
+
let r = n.filter((e) => typeof e != "string" || !D.test(e));
|
|
47
49
|
if (r.length > 0) throw Error(`${e.name}: \`service.callers\` holds ${r.map((e) => JSON.stringify(e)).join(", ")} — a caller is an\n app name (letters, digits, dashes; starting with a letter; at most 56 characters), the same name this app
|
|
48
50
|
lists in \`serviceCallers\` and the caller's credential resolves to.`);
|
|
49
51
|
if (new Set(n).size !== n.length) throw Error(`${e.name}: \`service.callers\` lists the same app twice`);
|
|
@@ -57,7 +59,7 @@ var b = (e) => e.internal !== !0, x = (e) => e.service === void 0 ? "client" : "
|
|
|
57
59
|
].filter((e) => e !== void 0);
|
|
58
60
|
if (i.length !== 0) throw Error(`${e.name}: \`service:\` cannot be combined with ${i.join("; ")}.\n A service procedure is callable only by the listed apps of this project, over the
|
|
59
61
|
socket, with their service credential. Drop the other field, or drop \`service:\`.`);
|
|
60
|
-
},
|
|
62
|
+
}, A = (e) => {
|
|
61
63
|
let t = e.requiresApproval;
|
|
62
64
|
if (t !== void 0) {
|
|
63
65
|
if (!Array.isArray(t.approvers) || t.approvers.length === 0) throw Error(`${e.name}: \`requiresApproval.approvers\` is empty, so NOBODY can approve this\n procedure and every call would park forever. Name the scope(s) an approver must hold
|
|
@@ -67,7 +69,11 @@ var b = (e) => e.internal !== !0, x = (e) => e.service === void 0 ? "client" : "
|
|
|
67
69
|
human from every other, and the second-pair-of-eyes control would enforce nothing.
|
|
68
70
|
Give the procedure a \`guards:\` decision, or drop \`requiresApproval\`.`);
|
|
69
71
|
}
|
|
70
|
-
},
|
|
72
|
+
}, ee = () => ({ upgraded: !0 }), te = (e) => e.action !== void 0 && e.resourceType !== void 0, ne = (e) => e.authenticated === !0, j = (e) => e.upgraded === !0, M = (e) => e.openAccess !== void 0 || e.guards !== void 0 && e.guards.length > 0, N = (e, t, n, r) => {
|
|
73
|
+
for (let e of t ?? []) {
|
|
74
|
+
let t = l(e);
|
|
75
|
+
if (t) throw t;
|
|
76
|
+
}
|
|
71
77
|
if (r !== void 0) {
|
|
72
78
|
if (n !== void 0 || t !== void 0 && t.length > 0) throw Error(`${e}: \`service:\` is an access decision of its own — only the listed apps may\n call this procedure — so it cannot sit beside \`guards:\` or \`openAccess:\`. A service
|
|
73
79
|
holds no scopes, and no user may call a service procedure. Keep exactly one.`);
|
|
@@ -79,31 +85,36 @@ var b = (e) => e.internal !== !0, x = (e) => e.service === void 0 ? "client" : "
|
|
|
79
85
|
if (t !== void 0 && t.length > 0) throw Error(`${e}: \`openAccess\` and \`guards\` are two different access decisions, so\n declaring both says the procedure is protected AND open. Keep the guards if a
|
|
80
86
|
caller must hold a scope; drop them if anyone may call it.`);
|
|
81
87
|
return [s(n.trim())];
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
}, P = (e) => {
|
|
89
|
+
let t = v(e.source), n = y(e.name, t, e.optionalSource);
|
|
90
|
+
return O({
|
|
91
|
+
kind: "query",
|
|
92
|
+
name: e.name,
|
|
93
|
+
input: e.input,
|
|
94
|
+
output: e.output,
|
|
95
|
+
error: e.error ?? b.Never,
|
|
96
|
+
source: t,
|
|
97
|
+
...n === void 0 ? {} : { optionalSource: n },
|
|
98
|
+
cache: e.cache,
|
|
99
|
+
guards: N(e.name, e.guards, e.openAccess, e.service),
|
|
100
|
+
openAccess: e.openAccess,
|
|
101
|
+
service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
|
|
102
|
+
publicApi: e.publicApi,
|
|
103
|
+
exposeAsTool: e.exposeAsTool,
|
|
104
|
+
internal: e.internal,
|
|
105
|
+
overridesPlugin: e.overridesPlugin
|
|
106
|
+
});
|
|
107
|
+
}, F = (e) => O({
|
|
98
108
|
kind: "mutation",
|
|
99
109
|
name: e.name,
|
|
100
110
|
input: e.input,
|
|
101
111
|
output: e.output,
|
|
102
|
-
error: e.error ??
|
|
112
|
+
error: e.error ?? b.Never,
|
|
103
113
|
...e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope },
|
|
104
114
|
...e.serialize === void 0 ? {} : { serialize: e.serialize },
|
|
115
|
+
...e.undo === void 0 ? {} : { undo: e.undo },
|
|
105
116
|
target: e.target,
|
|
106
|
-
guards:
|
|
117
|
+
guards: N(e.name, e.guards, e.openAccess, e.service),
|
|
107
118
|
openAccess: e.openAccess,
|
|
108
119
|
service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
|
|
109
120
|
publicApi: e.publicApi,
|
|
@@ -111,13 +122,13 @@ var b = (e) => e.internal !== !0, x = (e) => e.service === void 0 ? "client" : "
|
|
|
111
122
|
requiresApproval: e.requiresApproval,
|
|
112
123
|
internal: e.internal,
|
|
113
124
|
overridesPlugin: e.overridesPlugin
|
|
114
|
-
}),
|
|
125
|
+
}), I = (e) => O({
|
|
115
126
|
kind: "action",
|
|
116
127
|
name: e.name,
|
|
117
128
|
input: e.input,
|
|
118
129
|
output: e.output,
|
|
119
|
-
error: e.error ??
|
|
120
|
-
guards:
|
|
130
|
+
error: e.error ?? b.Never,
|
|
131
|
+
guards: N(e.name, e.guards, e.openAccess, e.service),
|
|
121
132
|
openAccess: e.openAccess,
|
|
122
133
|
service: e.service === void 0 ? void 0 : { callers: Array.isArray(e.service.callers) ? [...e.service.callers] : e.service.callers },
|
|
123
134
|
source: e.source,
|
|
@@ -127,35 +138,40 @@ var b = (e) => e.internal !== !0, x = (e) => e.service === void 0 ? "client" : "
|
|
|
127
138
|
requiresApproval: e.requiresApproval,
|
|
128
139
|
internal: e.internal,
|
|
129
140
|
overridesPlugin: e.overridesPlugin
|
|
130
|
-
}),
|
|
141
|
+
}), L = (e) => O({
|
|
131
142
|
kind: "stream",
|
|
132
143
|
name: e.name,
|
|
133
144
|
input: e.input,
|
|
134
145
|
element: e.element,
|
|
135
|
-
error: e.error ??
|
|
146
|
+
error: e.error ?? b.Never,
|
|
136
147
|
internal: e.internal,
|
|
137
148
|
overridesPlugin: e.overridesPlugin,
|
|
138
|
-
guards:
|
|
149
|
+
guards: N(e.name, e.guards, e.openAccess),
|
|
139
150
|
openAccess: e.openAccess
|
|
140
|
-
}),
|
|
151
|
+
}), R = (e, t) => t && t.length > 0 ? b.Union([e, ...new Set(t)]) : e, z = (e) => e !== void 0 && e.some((e) => !o(e)), B = (e) => b.Union([
|
|
141
152
|
e,
|
|
142
153
|
i,
|
|
143
154
|
n,
|
|
144
155
|
t
|
|
145
|
-
]),
|
|
156
|
+
]), V = (e) => b.Union([e, d]), H = (e) => b.Union([
|
|
146
157
|
e,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
]),
|
|
150
|
-
let n =
|
|
158
|
+
h,
|
|
159
|
+
g
|
|
160
|
+
]), U = (e, t) => t === void 0 ? e : b.Union([e, _]), W = (e, t) => a(t) ? b.Union([e, r]) : e, G = (e, t, n) => R(K(e, t), n), K = (e, t) => {
|
|
161
|
+
let n = W(B(e.error), e.guards);
|
|
151
162
|
if (t === "stream" || t === "query") return n;
|
|
152
|
-
let r = t === "mutation" ?
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
163
|
+
let r = t === "mutation" ? b.Union([
|
|
164
|
+
V(n),
|
|
165
|
+
m,
|
|
166
|
+
p,
|
|
167
|
+
S
|
|
168
|
+
]) : b.Union([
|
|
169
|
+
n,
|
|
170
|
+
m,
|
|
171
|
+
p
|
|
172
|
+
]);
|
|
173
|
+
return U(H(t === "mutation" && e.idempotencyScope === "connection" ? b.Union([r, f]) : r), e.requiresApproval);
|
|
174
|
+
}, q = {
|
|
159
175
|
query: [
|
|
160
176
|
i,
|
|
161
177
|
n,
|
|
@@ -170,81 +186,83 @@ var b = (e) => e.internal !== !0, x = (e) => e.service === void 0 ? "client" : "
|
|
|
170
186
|
i,
|
|
171
187
|
n,
|
|
172
188
|
t,
|
|
189
|
+
m,
|
|
173
190
|
p,
|
|
174
|
-
|
|
191
|
+
h,
|
|
192
|
+
g
|
|
175
193
|
],
|
|
176
194
|
mutation: [
|
|
177
195
|
i,
|
|
178
196
|
n,
|
|
179
197
|
t,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
y,
|
|
198
|
+
d,
|
|
199
|
+
m,
|
|
183
200
|
p,
|
|
184
|
-
|
|
201
|
+
S,
|
|
202
|
+
h,
|
|
203
|
+
g
|
|
185
204
|
]
|
|
186
|
-
},
|
|
205
|
+
}, J = (e, t) => R(W(B(e.errorSchema), e.guards), t), Y = (e, t) => ({
|
|
187
206
|
...e,
|
|
188
207
|
name: t
|
|
189
|
-
}),
|
|
190
|
-
payload:
|
|
208
|
+
}), X = (t, n) => x.make(t.name, {
|
|
209
|
+
payload: u(t.input, t.name, z(t.guards)),
|
|
191
210
|
success: e(t.output),
|
|
192
|
-
error:
|
|
211
|
+
error: G(t, "query", n),
|
|
193
212
|
stream: !0
|
|
194
|
-
}),
|
|
195
|
-
payload:
|
|
213
|
+
}), Z = (e, t) => x.make(e.name, {
|
|
214
|
+
payload: u(e.input, e.name, z(e.guards)),
|
|
196
215
|
success: e.output,
|
|
197
|
-
error:
|
|
198
|
-
}),
|
|
199
|
-
payload:
|
|
216
|
+
error: G(e, "mutation", t)
|
|
217
|
+
}), Q = (e, t) => x.make(e.name, {
|
|
218
|
+
payload: u(e.input, e.name, z(e.guards)),
|
|
200
219
|
success: e.output,
|
|
201
|
-
error:
|
|
202
|
-
}),
|
|
203
|
-
payload:
|
|
220
|
+
error: G(e, "action", t)
|
|
221
|
+
}), $ = (e, t) => x.make(e.name, {
|
|
222
|
+
payload: u(e.input, e.name, z(e.guards)),
|
|
204
223
|
success: e.element,
|
|
205
|
-
error:
|
|
224
|
+
error: G(e, "stream", t),
|
|
206
225
|
stream: !0
|
|
207
|
-
}),
|
|
226
|
+
}), re = (e) => {
|
|
208
227
|
switch (e.kind) {
|
|
209
|
-
case "query": return
|
|
210
|
-
case "mutation": return
|
|
211
|
-
case "action": return
|
|
212
|
-
case "stream": return
|
|
228
|
+
case "query": return X(e);
|
|
229
|
+
case "mutation": return Z(e);
|
|
230
|
+
case "action": return Q(e);
|
|
231
|
+
case "stream": return $(e);
|
|
213
232
|
}
|
|
214
|
-
},
|
|
215
|
-
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r }
|
|
233
|
+
}, ie = (e) => {
|
|
234
|
+
let t = e.input, n = t === void 0 ? {} : { input: t }, r = e.output, i = r === void 0 ? {} : { output: r }, a = {
|
|
235
|
+
...n,
|
|
236
|
+
...i,
|
|
237
|
+
error: e.error
|
|
238
|
+
};
|
|
216
239
|
if (e.kind === "query") return {
|
|
217
240
|
kind: "query",
|
|
218
241
|
source: e.source,
|
|
219
|
-
...
|
|
220
|
-
...i
|
|
242
|
+
...a
|
|
221
243
|
};
|
|
222
244
|
if (e.kind === "action") return {
|
|
223
245
|
kind: "action",
|
|
224
|
-
...
|
|
225
|
-
...i
|
|
246
|
+
...a
|
|
226
247
|
};
|
|
227
248
|
if (e.kind === "stream") return {
|
|
228
249
|
kind: "stream",
|
|
229
|
-
...
|
|
230
|
-
...i
|
|
250
|
+
...a
|
|
231
251
|
};
|
|
232
|
-
let
|
|
233
|
-
if (
|
|
252
|
+
let o = e.target, s = e.idempotencyScope === void 0 ? {} : { idempotencyScope: e.idempotencyScope }, c = e.serialize === void 0 ? {} : { serialize: e.serialize };
|
|
253
|
+
if (o === void 0) return {
|
|
234
254
|
kind: "mutation",
|
|
235
|
-
...
|
|
236
|
-
...
|
|
237
|
-
...
|
|
238
|
-
...s
|
|
255
|
+
...a,
|
|
256
|
+
...s,
|
|
257
|
+
...c
|
|
239
258
|
};
|
|
240
|
-
let
|
|
259
|
+
let l = Array.isArray(o) ? o : [o];
|
|
241
260
|
return {
|
|
242
261
|
kind: "mutation",
|
|
243
|
-
...
|
|
244
|
-
...i,
|
|
245
|
-
...o,
|
|
262
|
+
...a,
|
|
246
263
|
...s,
|
|
247
|
-
|
|
264
|
+
...c,
|
|
265
|
+
targets: l.map((e) => ({
|
|
248
266
|
table: e.table,
|
|
249
267
|
op: e.op,
|
|
250
268
|
..."order" in e && e.order !== void 0 ? { order: e.order } : {},
|
|
@@ -258,5 +276,4 @@ var b = (e) => e.internal !== !0, x = (e) => e.service === void 0 ? "client" : "
|
|
|
258
276
|
}))
|
|
259
277
|
};
|
|
260
278
|
};
|
|
261
|
-
|
|
262
|
-
export { G as FRAMEWORK_WIRE_ERRORS, w as SERVICE_NAME_PATTERN, X as actionToRpc, P as defineAction, N as defineMutation, M as defineQuery, F as defineStream, A as hasAccessDecision, L as hasEnforcedGuard, k as isAuthenticatedGuard, S as isClientReachable, O as isPolicyGuard, C as isServiceReachable, b as isWireReachable, Y as mutationToRpc, $ as normalizeDescriptor, J as queryToRpc, Z as streamToRpc, Q as toRpc, x as wireAudienceOf, U as wireErrorUnion, q as withRpcTag, K as workflowWireErrorUnion };
|
|
279
|
+
export { q as FRAMEWORK_WIRE_ERRORS, D as SERVICE_NAME_PATTERN, Q as actionToRpc, I as defineAction, F as defineMutation, P as defineQuery, L as defineStream, M as hasAccessDecision, z as hasEnforcedGuard, ne as isAuthenticatedGuard, T as isClientReachable, te as isPolicyGuard, E as isServiceReachable, j as isUpgradedGuard, C as isWireReachable, Z as mutationToRpc, ie as normalizeDescriptor, X as queryToRpc, ee as requireUpgraded, $ as streamToRpc, re as toRpc, w as wireAudienceOf, G as wireErrorUnion, Y as withRpcTag, J as workflowWireErrorUnion };
|