@voltro/protocol 0.70.0 → 0.71.1
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 +1341 -111
- package/dist/apikey.d.ts +5 -0
- package/dist/index.d.ts +450 -12
- package/dist/index.js +598 -558
- package/dist/inspect.d.ts +100 -0
- package/dist/inspect.js +160 -0
- package/dist/jwt.d.ts +5 -0
- package/dist/rest.d.ts +111 -6
- package/dist/rest.js +310 -221
- package/dist/{restFormat-Bnngx-zI.js → restFormat-ChSVyufA.js} +93 -38
- package/dist/{scopes-DVtiKKsm.js → scopes-CW9_LbDO.js} +69 -40
- package/dist/session.d.ts +11 -0
- package/dist/session.js +6 -6
- package/package.json +9 -4
package/dist/rest.js
CHANGED
|
@@ -1,74 +1,100 @@
|
|
|
1
|
-
import { F as e,
|
|
2
|
-
import {
|
|
3
|
-
import { Effect as
|
|
4
|
-
import * as
|
|
1
|
+
import { F as e, I as t } from "./scopes-CW9_LbDO.js";
|
|
2
|
+
import { C as n, S as r, T as i, _ as a, a as o, c as s, d as c, f as l, i as u, l as d, n as f, o as p, r as m, s as h, t as g, u as _, v, w as y } from "./restFormat-ChSVyufA.js";
|
|
3
|
+
import { Effect as b, ParseResult as x, Schema as S } from "effect";
|
|
4
|
+
import * as C from "effect/SchemaAST";
|
|
5
5
|
//#region src/publicApi.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
var w = (e, t, n) => t.method ?? (t.resource !== void 0 && n !== void 0 ? D("", t, n).method : void 0) ?? (e === "query" ? "GET" : "POST"), T = (e, t, n) => O(t.path ?? (t.resource !== void 0 && n !== void 0 ? D(e, t, n).path : `/${t.version ?? "v1"}/${e.replace(/\./g, "/")}`)), ee = (e) => {
|
|
7
|
+
let t = e.split("/").pop() ?? e;
|
|
8
|
+
return t.endsWith("ies") ? `${t.slice(0, -3)}y` : t.endsWith("ses") || t.endsWith("xes") ? t.slice(0, -2) : t.endsWith("s") ? t.slice(0, -1) : t;
|
|
9
|
+
}, E = (e, t) => {
|
|
10
|
+
let n = t != null && (typeof t == "object" || typeof t == "function") && "ast" in t ? z(t) : void 0;
|
|
11
|
+
if (n === void 0) return;
|
|
12
|
+
let r = `${ee(e)}Id`;
|
|
13
|
+
return n.has(r) ? r : n.has("id") ? "id" : void 0;
|
|
14
|
+
}, D = (e, t, n) => {
|
|
15
|
+
let r = (t.resource ?? "").replace(/^\/+|\/+$/g, ""), i = `/${t.version ?? "v1"}/${r}`, a = E(r, n.input), o = a === void 0 ? i : `${i}/:${a}`, s = e.split(".").pop() ?? e, c = n.target?.op;
|
|
16
|
+
return n.kind === "query" || n.kind === "stream" ? {
|
|
17
|
+
method: "GET",
|
|
18
|
+
path: o
|
|
19
|
+
} : n.kind === "mutation" && c === "insert" ? {
|
|
20
|
+
method: "POST",
|
|
21
|
+
path: i
|
|
22
|
+
} : n.kind === "mutation" && c === "update" ? {
|
|
23
|
+
method: a === void 0 ? "POST" : "PATCH",
|
|
24
|
+
path: o
|
|
25
|
+
} : n.kind === "mutation" && c === "delete" ? {
|
|
26
|
+
method: a === void 0 ? "POST" : "DELETE",
|
|
27
|
+
path: o
|
|
28
|
+
} : {
|
|
29
|
+
method: "POST",
|
|
30
|
+
path: `${o}/${s}`
|
|
31
|
+
};
|
|
32
|
+
}, O = (e) => e.replace(/\{([A-Za-z0-9_]+)\}/g, ":$1"), k = (e) => [...e.matchAll(/:([A-Za-z0-9_]+)/g)].map((e) => e[1]), A = (e) => {
|
|
33
|
+
if (C.isUnion(e)) {
|
|
34
|
+
let t = e.types.filter((e) => !C.isUndefinedKeyword(e));
|
|
9
35
|
if (t.length === 1) return t[0];
|
|
10
|
-
if (t.length !== e.types.length) return
|
|
36
|
+
if (t.length !== e.types.length) return C.Union.make(t);
|
|
11
37
|
}
|
|
12
38
|
return e;
|
|
13
|
-
},
|
|
14
|
-
let n =
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
39
|
+
}, j = /^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i, M = (e, t) => {
|
|
40
|
+
let n = A(t);
|
|
41
|
+
if (C.isRefinement(n) || C.isTransformation(n)) return M(e, n.from);
|
|
42
|
+
if (C.isUnion(n)) {
|
|
17
43
|
for (let t of n.types) {
|
|
18
|
-
let n =
|
|
44
|
+
let n = M(e, t);
|
|
19
45
|
if (n !== e) return n;
|
|
20
46
|
}
|
|
21
47
|
return e;
|
|
22
48
|
}
|
|
23
|
-
if (
|
|
49
|
+
if (C.isTupleType(n)) {
|
|
24
50
|
let t = Array.isArray(e) ? e : e === void 0 ? void 0 : [e];
|
|
25
51
|
if (t === void 0) return e;
|
|
26
52
|
let r = n.rest[0]?.type ?? n.elements[0]?.type;
|
|
27
|
-
return r === void 0 ? t : t.map((e) =>
|
|
53
|
+
return r === void 0 ? t : t.map((e) => M(e, r));
|
|
28
54
|
}
|
|
29
55
|
if (typeof e != "string") return e;
|
|
30
|
-
if (
|
|
31
|
-
if (
|
|
32
|
-
if (
|
|
56
|
+
if (C.isNumberKeyword(n)) return j.test(e.trim()) ? Number(e) : e;
|
|
57
|
+
if (C.isBooleanKeyword(n)) return e === "true" || e !== "false" && e;
|
|
58
|
+
if (C.isLiteral(n)) {
|
|
33
59
|
let t = n.literal;
|
|
34
|
-
return typeof t == "number" &&
|
|
60
|
+
return typeof t == "number" && j.test(e.trim()) && Number(e) === t || typeof t == "boolean" && String(t) === e ? t : e;
|
|
35
61
|
}
|
|
36
62
|
return e;
|
|
37
|
-
},
|
|
63
|
+
}, N = (e, t) => {
|
|
38
64
|
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
39
|
-
let n =
|
|
40
|
-
if (!
|
|
65
|
+
let n = A(C.encodedAST(t.ast));
|
|
66
|
+
if (!C.isTypeLiteral(n)) return e;
|
|
41
67
|
let r = { ...e };
|
|
42
68
|
for (let e of n.propertySignatures) {
|
|
43
69
|
let t = String(e.name);
|
|
44
|
-
t in r && (r[t] =
|
|
70
|
+
t in r && (r[t] = M(r[t], e.type));
|
|
45
71
|
}
|
|
46
72
|
return r;
|
|
47
|
-
},
|
|
73
|
+
}, P = (e) => {
|
|
48
74
|
let t = /* @__PURE__ */ new Set();
|
|
49
75
|
if (e === void 0) return t;
|
|
50
76
|
let n = (e) => {
|
|
51
|
-
if (
|
|
77
|
+
if (C.isUnion(e)) {
|
|
52
78
|
for (let t of e.types) n(t);
|
|
53
79
|
return;
|
|
54
80
|
}
|
|
55
|
-
if (
|
|
81
|
+
if (C.isTransformation(e)) {
|
|
56
82
|
n(e.from), n(e.to);
|
|
57
83
|
return;
|
|
58
84
|
}
|
|
59
|
-
if (
|
|
85
|
+
if (C.isRefinement(e)) {
|
|
60
86
|
n(e.from);
|
|
61
87
|
return;
|
|
62
88
|
}
|
|
63
|
-
if (
|
|
89
|
+
if (C.isTypeLiteral(e)) {
|
|
64
90
|
let n = e.propertySignatures.find((e) => e.name === "_tag");
|
|
65
|
-
n !== void 0 &&
|
|
91
|
+
n !== void 0 && C.isLiteral(n.type) && typeof n.type.literal == "string" && t.add(n.type.literal);
|
|
66
92
|
}
|
|
67
93
|
};
|
|
68
94
|
return n(e.ast), t;
|
|
69
|
-
},
|
|
95
|
+
}, F = (e, t, n) => {
|
|
70
96
|
if (n !== void 0) try {
|
|
71
|
-
let r =
|
|
97
|
+
let r = S.encodeUnknownSync(n)(e);
|
|
72
98
|
if (typeof r == "object" && r) return {
|
|
73
99
|
error: t,
|
|
74
100
|
...r
|
|
@@ -77,76 +103,107 @@ var S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(
|
|
|
77
103
|
let r = { error: t };
|
|
78
104
|
for (let [t, n] of Object.entries(e)) t !== "stack" && t !== "_tag" && (r[t] = n);
|
|
79
105
|
return r;
|
|
80
|
-
},
|
|
106
|
+
}, I = (e, t, n, r = []) => {
|
|
81
107
|
if (typeof e != "object" || !e) return e;
|
|
82
108
|
let i = e._tag;
|
|
83
109
|
if (typeof i != "string" || i === "ScopeError") return e;
|
|
84
|
-
if (
|
|
85
|
-
let a = r.find((e) =>
|
|
110
|
+
if (P(t.error).has(i)) return new Y(n.errorStatus?.[i] ?? 422, F(e, i, t.error));
|
|
111
|
+
let a = r.find((e) => P(e.schema).has(i));
|
|
86
112
|
if (a === void 0) return e;
|
|
87
113
|
let o = n.errorStatus?.[i] ?? a.rest?.status ?? 422, s = a.rest?.headers?.(e);
|
|
88
|
-
return new
|
|
89
|
-
},
|
|
90
|
-
let o =
|
|
91
|
-
if (!(o instanceof
|
|
92
|
-
let { error: s, _tag:
|
|
114
|
+
return new Y(o, F(e, i, a.schema), s);
|
|
115
|
+
}, te = (e, t, n, r, i, a) => {
|
|
116
|
+
let o = I(e, t, n, r);
|
|
117
|
+
if (!(o instanceof Y) || i.errors === "tagged" && i.encodeError === void 0) return o;
|
|
118
|
+
let { error: s, _tag: c, ...l } = o.body, d = typeof l.message == "string" ? l.message : typeof l.reason == "string" ? l.reason : "", f = u(i, {
|
|
93
119
|
status: o.status,
|
|
94
120
|
tag: s,
|
|
95
121
|
message: d,
|
|
96
|
-
fields:
|
|
122
|
+
fields: l
|
|
97
123
|
}, {
|
|
98
124
|
...a,
|
|
99
125
|
status: o.status
|
|
100
126
|
});
|
|
101
|
-
return new
|
|
127
|
+
return new Y(o.status, f.body, {
|
|
102
128
|
...o.headers ?? {},
|
|
103
129
|
...f.headers ?? {}
|
|
104
130
|
}, f.contentType);
|
|
105
|
-
},
|
|
131
|
+
}, L = (e, t) => {
|
|
106
132
|
if (e === void 0) return;
|
|
107
|
-
let n =
|
|
133
|
+
let n = C.isUnion(e.ast) ? e.ast.types : [e.ast];
|
|
108
134
|
for (let e of n) {
|
|
109
|
-
let n =
|
|
110
|
-
if (
|
|
135
|
+
let n = S.make(e);
|
|
136
|
+
if (P(n).has(t)) return n;
|
|
111
137
|
}
|
|
112
|
-
},
|
|
113
|
-
let t =
|
|
114
|
-
return
|
|
138
|
+
}, R = (e) => e.split(".").map((e, t) => t === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_"), z = (e) => {
|
|
139
|
+
let t = A(C.encodedAST(e.ast));
|
|
140
|
+
return C.isTypeLiteral(t) && t.indexSignatures.length === 0 ? new Set(t.propertySignatures.map((e) => String(e.name))) : void 0;
|
|
115
141
|
}, ne = (e, t) => e === t || JSON.stringify(e) === JSON.stringify(t), re = (e, t) => {
|
|
116
|
-
let n =
|
|
142
|
+
let n = A(C.encodedAST(t.ast)), r = {}, i = C.isTypeLiteral(n) ? new Map(n.propertySignatures.map((e) => [String(e.name), e.type])) : /* @__PURE__ */ new Map();
|
|
117
143
|
for (let [t, n] of Object.entries(e)) {
|
|
118
144
|
let e = i.get(t);
|
|
119
|
-
r[t] = e === void 0 ? n :
|
|
145
|
+
r[t] = e === void 0 ? n : M(n, e);
|
|
120
146
|
}
|
|
121
147
|
return r;
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
148
|
+
}, B = (e, t) => {
|
|
149
|
+
if (e !== void 0) {
|
|
150
|
+
try {
|
|
151
|
+
return S.encodeUnknownSync(t)(e);
|
|
152
|
+
} catch {}
|
|
153
|
+
try {
|
|
154
|
+
return S.decodeUnknownSync(t)(e), e;
|
|
155
|
+
} catch {}
|
|
156
|
+
return e;
|
|
128
157
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
158
|
+
}, ie = (e, t, n) => ({
|
|
159
|
+
...e.request === void 0 ? {} : { request: B(e.request, t) },
|
|
160
|
+
...e.response === void 0 ? {} : { response: B(e.response, n) }
|
|
161
|
+
}), ae = () => (e) => {
|
|
162
|
+
if (e.subject.type !== "anonymous") return;
|
|
163
|
+
let t = e.subject.credentialRejected;
|
|
164
|
+
return t === void 0 ? void 0 : {
|
|
165
|
+
status: 401,
|
|
166
|
+
message: t
|
|
167
|
+
};
|
|
168
|
+
}, V = (e, t, n, r = {}) => {
|
|
169
|
+
let i = e.publicApi;
|
|
170
|
+
if (i === void 0) throw Error(`publicApiRoute: descriptor '${e.name}' has no publicApi annotation`);
|
|
171
|
+
let a = d(r.profile, i.format), s = r.pluginErrors ?? [], l = {
|
|
172
|
+
kind: e.kind,
|
|
173
|
+
input: e.input,
|
|
174
|
+
target: e.target
|
|
175
|
+
}, u = w(e.kind, i, l), f = (e) => a.naming === "snake_case" ? c(e) : e, p = T(e.name, i, l), m = p.replace(/:([A-Za-z0-9_]+)/g, (e, t) => `:${f(t)}`), h = k(m), g = _(e.input, a), v = z(g);
|
|
176
|
+
if (v !== void 0) {
|
|
177
|
+
for (let t of h) if (!v.has(t)) throw Error(`publicApi: descriptor '${e.name}' — path '${p}' binds ':${t}', and the input declares no field of that name` + (v.size > 0 ? ` (fields: ${[...v].join(", ")})` : " (the input declares no fields)"));
|
|
178
|
+
}
|
|
179
|
+
let y = _(e.output, a), C = S.Struct({ value: g }), ee = u !== "GET" && (v === void 0 || [...v].some((e) => !h.includes(e))), E = {
|
|
180
|
+
query: S.Unknown,
|
|
181
|
+
params: S.Unknown,
|
|
182
|
+
form: S.Boolean
|
|
183
|
+
}, D = ee ? S.Struct({
|
|
184
|
+
...E,
|
|
185
|
+
body: S.Unknown
|
|
186
|
+
}) : S.Struct(E), O = S.transformOrFail(D, C, {
|
|
134
187
|
strict: !1,
|
|
135
188
|
decode: (e, t, n) => {
|
|
136
|
-
let r = u === "GET" ?
|
|
137
|
-
if (typeof
|
|
138
|
-
let
|
|
139
|
-
if (
|
|
189
|
+
let r = "body" in e ? e.body : void 0, i = u === "GET" ? N(e.query, g) : e.form ? N(r ?? {}, g) : r ?? {}, a = typeof e.params == "object" && e.params !== null ? re(e.params, g) : {};
|
|
190
|
+
if (typeof i != "object" || !i || Array.isArray(i)) return x.succeed({ value: i });
|
|
191
|
+
let o = i, s = Object.keys(a).filter((e) => e in o && !ne(o[e], a[e]));
|
|
192
|
+
if (s.length > 0) {
|
|
140
193
|
let t = u === "GET" ? "query string" : "body";
|
|
141
|
-
return
|
|
194
|
+
return x.fail(new x.Type(n, e, `${s.map((e) => `'${e}'`).join(", ")} ${s.length === 1 ? "is" : "are"} bound by the path and sent with another value in the ${t}`));
|
|
142
195
|
}
|
|
143
|
-
return
|
|
144
|
-
...
|
|
145
|
-
...
|
|
196
|
+
return x.succeed({ value: {
|
|
197
|
+
...o,
|
|
198
|
+
...a
|
|
146
199
|
} });
|
|
147
200
|
},
|
|
148
|
-
encode: (e) =>
|
|
149
|
-
}),
|
|
201
|
+
encode: (e) => x.succeed(e)
|
|
202
|
+
}), A = [
|
|
203
|
+
ae(),
|
|
204
|
+
...e.openAccess === void 0 ? [W()] : [],
|
|
205
|
+
...(i.scopes ?? []).map((e) => G(e))
|
|
206
|
+
], j = (() => {
|
|
150
207
|
let t = e.source;
|
|
151
208
|
return typeof t == "string" ? t : Array.isArray(t) ? t[0] : void 0;
|
|
152
209
|
})(), M = (t, n = 200) => ({
|
|
@@ -156,94 +213,106 @@ var S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(
|
|
|
156
213
|
query: t.query,
|
|
157
214
|
source: j,
|
|
158
215
|
status: n
|
|
159
|
-
}), F =
|
|
160
|
-
r(
|
|
161
|
-
})) : async (n,
|
|
162
|
-
let
|
|
216
|
+
}), F = i.stream === "sse" && e.kind === "query" && n !== void 0, I = S.encodeUnknown(y), B = F ? (e, t) => ce((r) => n(e.value, t, (e) => {
|
|
217
|
+
r(le(String(e._tag ?? "message"), e));
|
|
218
|
+
})) : async (n, r) => {
|
|
219
|
+
let c;
|
|
163
220
|
try {
|
|
164
|
-
|
|
221
|
+
c = await t(n.value, r);
|
|
165
222
|
} catch (t) {
|
|
166
|
-
throw
|
|
223
|
+
throw te(t, e, i, s, a, M(r));
|
|
167
224
|
}
|
|
168
|
-
let l = await
|
|
169
|
-
return
|
|
225
|
+
let l = await b.runPromise(I(c)), u = o(a, l, M(r));
|
|
226
|
+
return q(u.body, {
|
|
170
227
|
...u.headers === void 0 ? {} : { headers: u.headers },
|
|
171
228
|
...u.contentType === void 0 ? {} : { contentType: u.contentType }
|
|
172
229
|
});
|
|
173
|
-
}, V = e.error, H = [...
|
|
230
|
+
}, V = e.error, H = [...P(V)], U = [];
|
|
174
231
|
for (let e of H) {
|
|
175
|
-
let t =
|
|
232
|
+
let t = L(V, e);
|
|
176
233
|
t !== void 0 && U.push({
|
|
177
|
-
status:
|
|
234
|
+
status: i.errorStatus?.[e] ?? 422,
|
|
178
235
|
tag: e,
|
|
179
236
|
schema: t
|
|
180
237
|
});
|
|
181
238
|
}
|
|
182
|
-
for (let e of
|
|
239
|
+
for (let e of s) for (let t of P(e.schema)) {
|
|
183
240
|
if (H.includes(t)) continue;
|
|
184
|
-
let n =
|
|
241
|
+
let n = i.errorStatus?.[t] ?? e.rest?.status;
|
|
185
242
|
if (n === void 0) continue;
|
|
186
|
-
let r =
|
|
243
|
+
let r = L(e.schema, t) ?? e.schema;
|
|
187
244
|
U.push({
|
|
188
245
|
status: n,
|
|
189
246
|
tag: t,
|
|
190
247
|
schema: r
|
|
191
248
|
});
|
|
192
249
|
}
|
|
193
|
-
let
|
|
250
|
+
let K = i.security === !1 ? "none" : i.security ?? (e.openAccess === void 0 ? "required" : "optional"), J = {
|
|
194
251
|
tag: e.name,
|
|
195
252
|
kind: e.kind,
|
|
196
|
-
version:
|
|
197
|
-
security:
|
|
253
|
+
version: i.version ?? "v1",
|
|
254
|
+
security: K,
|
|
255
|
+
idempotent: i.idempotent === !0,
|
|
198
256
|
input: g,
|
|
199
|
-
pathParams:
|
|
200
|
-
output:
|
|
257
|
+
pathParams: h,
|
|
258
|
+
output: y,
|
|
201
259
|
source: j,
|
|
202
260
|
errorResponses: U,
|
|
203
|
-
format:
|
|
261
|
+
format: a
|
|
204
262
|
};
|
|
205
|
-
return
|
|
263
|
+
return se({
|
|
206
264
|
method: u,
|
|
207
|
-
path:
|
|
208
|
-
input:
|
|
209
|
-
output:
|
|
210
|
-
handler:
|
|
265
|
+
path: m,
|
|
266
|
+
input: O,
|
|
267
|
+
output: S.Unknown,
|
|
268
|
+
handler: B,
|
|
211
269
|
...F ? { streaming: !0 } : {},
|
|
212
|
-
guards:
|
|
213
|
-
operationId:
|
|
214
|
-
tags:
|
|
270
|
+
guards: A,
|
|
271
|
+
operationId: i.operationId ?? R(e.name),
|
|
272
|
+
tags: i.tags ?? [e.name.split(".")[0] ?? e.name],
|
|
215
273
|
projection: J,
|
|
216
|
-
...
|
|
217
|
-
...
|
|
218
|
-
...
|
|
219
|
-
...
|
|
220
|
-
...
|
|
221
|
-
...
|
|
274
|
+
...a.etag && u === "GET" && !F ? { etag: !0 } : {},
|
|
275
|
+
...i.example === void 0 ? {} : { example: ie(i.example, g, y) },
|
|
276
|
+
...i.summary === void 0 ? {} : { summary: i.summary },
|
|
277
|
+
...i.description === void 0 ? {} : { description: i.description },
|
|
278
|
+
...i.deprecated === void 0 ? {} : { deprecated: i.deprecated },
|
|
279
|
+
...i.sunset === void 0 ? {} : { sunset: i.sunset }
|
|
222
280
|
});
|
|
223
|
-
},
|
|
281
|
+
}, H = (e, t = {}) => e.filter((e) => e.descriptor.publicApi !== void 0).map((e) => V(e.descriptor, e.invoke, e.subscribe, t)).sort((e, t) => e.path.localeCompare(t.path)), U = (e) => v(e.filter((e) => e.projection !== void 0).map((e) => {
|
|
282
|
+
let t = e.projection, n = {
|
|
283
|
+
tag: t.tag,
|
|
284
|
+
method: e.method,
|
|
285
|
+
path: e.path,
|
|
286
|
+
pathParams: t.pathParams,
|
|
287
|
+
version: t.version,
|
|
288
|
+
security: t.security,
|
|
289
|
+
errors: [...t.errorResponses].map((e) => `${e.status}:${e.tag}`).sort()
|
|
290
|
+
};
|
|
291
|
+
return `${JSON.stringify(n)} ${a(t.input.ast)} ${a(t.output.ast)}`;
|
|
292
|
+
}).sort().join("\n")), W = () => (e) => {
|
|
224
293
|
if (e.subject.type === "anonymous") return {
|
|
225
294
|
status: 401,
|
|
226
295
|
message: e.subject.credentialRejected ?? "Authentication required"
|
|
227
296
|
};
|
|
228
|
-
},
|
|
297
|
+
}, G = (e) => (t) => {
|
|
229
298
|
let n = t.subject.scopes;
|
|
230
299
|
if (!(n && (n.includes(e) || n.includes("admin:full")))) return {
|
|
231
300
|
status: 403,
|
|
232
301
|
message: `Missing required scope: ${e}`
|
|
233
302
|
};
|
|
234
|
-
},
|
|
303
|
+
}, K = (e) => (t) => {
|
|
235
304
|
let n = t.subject.scopes;
|
|
236
305
|
if (!(n && (n.includes("admin:full") || e.some((e) => n.includes(e))))) return {
|
|
237
306
|
status: 403,
|
|
238
307
|
message: `Missing required scope: one of ${e.join(", ")}`
|
|
239
308
|
};
|
|
240
|
-
},
|
|
309
|
+
}, q = (e, t = {}) => ({
|
|
241
310
|
__voltroRestResponse: !0,
|
|
242
311
|
status: t.status ?? 200,
|
|
243
312
|
body: e,
|
|
244
313
|
...t.headers === void 0 ? {} : { headers: t.headers },
|
|
245
314
|
...t.contentType === void 0 ? {} : { contentType: t.contentType }
|
|
246
|
-
}),
|
|
315
|
+
}), J = (e) => typeof e == "object" && !!e && e.__voltroRestResponse === !0, Y = class extends Error {
|
|
247
316
|
status;
|
|
248
317
|
body;
|
|
249
318
|
headers;
|
|
@@ -251,7 +320,7 @@ var S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(
|
|
|
251
320
|
constructor(e, t, n, r) {
|
|
252
321
|
super(`REST ${e}`), this.name = "RestRouteError", this.status = e, this.body = t, this.headers = n, this.contentType = r;
|
|
253
322
|
}
|
|
254
|
-
},
|
|
323
|
+
}, oe = (e, t, n) => new Y(e, t, n), se = (e) => {
|
|
255
324
|
if (e.version === void 0) return e;
|
|
256
325
|
if (!/^v\d+$/.test(e.version)) throw Error(`defineRestRoute(${e.method} ${e.path}): version "${e.version}" must be 'v' followed by digits — 'v1', 'v2', …`);
|
|
257
326
|
if ((/* @__PURE__ */ RegExp("^/v\\d+(/|$)")).test(e.path)) throw Error(`defineRestRoute(${e.method} ${e.path}): the path already starts with a version segment AND declares version: '${e.version}'. Pick one spelling — either bake the version into the path, or declare version: and keep the path bare ('/customers'). Both would mount '/${e.version}${e.path}', which is never what the author meant.`);
|
|
@@ -259,13 +328,13 @@ var S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(
|
|
|
259
328
|
...e,
|
|
260
329
|
path: `/${e.version}${e.path}`
|
|
261
330
|
};
|
|
262
|
-
},
|
|
331
|
+
}, ce = (e, t = {}) => ({
|
|
263
332
|
__voltroRestStream: !0,
|
|
264
333
|
stream: {
|
|
265
334
|
subscribe: e,
|
|
266
335
|
...t.keepAliveMs === void 0 ? {} : { keepAliveMs: t.keepAliveMs }
|
|
267
336
|
}
|
|
268
|
-
}),
|
|
337
|
+
}), le = (e, t) => `event: ${e}\n${(typeof t == "string" ? t : JSON.stringify(t)).split("\n").map((e) => `data: ${e}`).join("\n")}\n\n`, ue = (e) => typeof e == "object" && !!e && e.__voltroRestStream === !0, de = (e, t = {}) => ({
|
|
269
338
|
__voltroRestBytes: !0,
|
|
270
339
|
byteStream: {
|
|
271
340
|
stream: e,
|
|
@@ -275,49 +344,60 @@ var S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(
|
|
|
275
344
|
...t.contentType === void 0 ? {} : { contentType: t.contentType },
|
|
276
345
|
...t.status === void 0 ? {} : { status: t.status },
|
|
277
346
|
...t.headers === void 0 ? {} : { headers: t.headers }
|
|
278
|
-
}),
|
|
347
|
+
}), X = (e) => typeof e == "object" && !!e && e.__voltroRestBytes === !0, fe = async (e) => {
|
|
279
348
|
let t = await globalThis.crypto.subtle.digest("SHA-1", new TextEncoder().encode(e));
|
|
280
349
|
return [...new Uint8Array(t)].map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
281
|
-
},
|
|
350
|
+
}, Z = (e, t, n, r = "application/json; charset=utf-8") => ({
|
|
282
351
|
status: e,
|
|
283
352
|
contentType: r,
|
|
284
353
|
body: JSON.stringify(t),
|
|
285
354
|
...n ? { headers: n } : {}
|
|
286
|
-
}),
|
|
355
|
+
}), Q = (e, t, n, r, i, a, o) => {
|
|
287
356
|
let s = e.projection;
|
|
288
|
-
if (s === void 0) return
|
|
357
|
+
if (s === void 0) return Z(n, {
|
|
289
358
|
error: i,
|
|
290
359
|
...a
|
|
291
360
|
}, o);
|
|
292
|
-
let
|
|
361
|
+
let c = {
|
|
293
362
|
tag: s.tag,
|
|
294
363
|
method: t.method,
|
|
295
364
|
path: t.path,
|
|
296
365
|
query: t.query,
|
|
297
366
|
source: s.source,
|
|
298
367
|
status: n
|
|
299
|
-
},
|
|
368
|
+
}, l = u(s.format, {
|
|
300
369
|
status: n,
|
|
301
370
|
tag: r,
|
|
302
371
|
message: i,
|
|
303
372
|
fields: a
|
|
304
|
-
},
|
|
305
|
-
return
|
|
373
|
+
}, c);
|
|
374
|
+
return Z(n, l.body, {
|
|
306
375
|
...o,
|
|
307
|
-
...
|
|
308
|
-
},
|
|
309
|
-
},
|
|
376
|
+
...l.headers ?? {}
|
|
377
|
+
}, l.contentType);
|
|
378
|
+
}, pe = (e) => (e.headers["content-type"] ?? "application/json").split(";")[0].trim().toLowerCase(), me = (e, t) => {
|
|
310
379
|
if (e.length === 0) return;
|
|
311
|
-
let
|
|
312
|
-
if (t
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
380
|
+
let n = t === "application/x-www-form-urlencoded";
|
|
381
|
+
if (!n && t !== "application/json" && !/^application\/[^/;\s]+\+json$/.test(t)) return;
|
|
382
|
+
let r = new TextDecoder("utf-8", { fatal: !0 }).decode(e);
|
|
383
|
+
if (r.trim() !== "") {
|
|
384
|
+
if (n) {
|
|
385
|
+
let e = (e) => decodeURIComponent(e.replace(/\+/g, " "));
|
|
386
|
+
return ge(r.split("&").filter(Boolean).map((t) => {
|
|
387
|
+
let n = t.indexOf("=");
|
|
388
|
+
return n < 0 ? [e(t), ""] : [e(t.slice(0, n)), e(t.slice(n + 1))];
|
|
389
|
+
}));
|
|
390
|
+
}
|
|
391
|
+
return JSON.parse(r);
|
|
392
|
+
}
|
|
393
|
+
}, he = (e) => ge(new URLSearchParams(e)), ge = (e) => {
|
|
394
|
+
let t = /* @__PURE__ */ new Map();
|
|
395
|
+
for (let [n, r] of e) {
|
|
396
|
+
let e = t.get(n);
|
|
397
|
+
e === void 0 ? t.set(n, r) : Array.isArray(e) ? e.push(r) : t.set(n, [e, r]);
|
|
318
398
|
}
|
|
319
|
-
return t;
|
|
320
|
-
},
|
|
399
|
+
return Object.fromEntries(t);
|
|
400
|
+
}, _e = (e, t) => {
|
|
321
401
|
let n = e.split("/").filter((e) => e.length > 0), r = t.split("/").filter((e) => e.length > 0), i = {};
|
|
322
402
|
for (let e = 0; e < n.length; e++) {
|
|
323
403
|
let t = n[e];
|
|
@@ -331,7 +411,7 @@ var S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(
|
|
|
331
411
|
}
|
|
332
412
|
}
|
|
333
413
|
return i;
|
|
334
|
-
},
|
|
414
|
+
}, ve = (e, t) => {
|
|
335
415
|
let n = e.path.split("/"), r = n[n.length - 1] === "*", i = r ? n.slice(0, -1) : n, a = t.split("/");
|
|
336
416
|
if (a.length < i.length) return !1;
|
|
337
417
|
for (let e = 0; e < i.length; e++) {
|
|
@@ -341,141 +421,150 @@ var S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(
|
|
|
341
421
|
} else if (t !== n) return !1;
|
|
342
422
|
}
|
|
343
423
|
return a.length === i.length ? !0 : e.match === "exact" && !r ? !1 : a.slice(i.length).some((e) => e.length > 0);
|
|
344
|
-
},
|
|
345
|
-
query:
|
|
424
|
+
}, ye = (e, t, n) => ({
|
|
425
|
+
query: he(e.query),
|
|
346
426
|
params: t,
|
|
347
|
-
body:
|
|
427
|
+
body: n ? me(e.rawBody, pe(e)) : void 0,
|
|
428
|
+
form: pe(e) === "application/x-www-form-urlencoded"
|
|
348
429
|
}), $ = /* @__PURE__ */ new Set([
|
|
349
430
|
"POST",
|
|
350
431
|
"PUT",
|
|
351
432
|
"PATCH",
|
|
352
433
|
"DELETE"
|
|
353
|
-
]),
|
|
354
|
-
if (
|
|
434
|
+
]), be = (t, n, r, i, a) => {
|
|
435
|
+
if (t instanceof Y) return Z(t.status, t.body, {
|
|
355
436
|
...i,
|
|
356
|
-
...
|
|
357
|
-
},
|
|
358
|
-
if (typeof
|
|
359
|
-
let o =
|
|
360
|
-
if (typeof o.status == "number") return
|
|
361
|
-
if (o._tag === "Unauthenticated" ||
|
|
437
|
+
...t.headers
|
|
438
|
+
}, t.contentType);
|
|
439
|
+
if (typeof t == "object" && t) {
|
|
440
|
+
let o = t;
|
|
441
|
+
if (typeof o.status == "number") return Q(r, a, o.status, typeof o._tag == "string" ? o._tag : "Error", typeof o.message == "string" ? o.message : "Error", {}, { ...i });
|
|
442
|
+
if (o._tag === "Unauthenticated" || t instanceof e) return Q(r, a, 401, "Unauthorized", typeof o.reason == "string" ? o.reason : "Authentication required", {}, { ...i });
|
|
362
443
|
if (o._tag === "ScopeError") {
|
|
363
444
|
let e = n.type === "anonymous" ? 401 : 403;
|
|
364
|
-
return
|
|
445
|
+
return Q(r, a, e, e === 401 ? "Unauthorized" : "Forbidden", typeof o.message == "string" ? o.message : "Forbidden", {}, { ...i });
|
|
365
446
|
}
|
|
366
447
|
}
|
|
367
|
-
return
|
|
368
|
-
error:
|
|
448
|
+
return l({
|
|
449
|
+
error: t,
|
|
369
450
|
source: "rest",
|
|
370
451
|
name: `${r.method} ${r.path}`,
|
|
371
452
|
fields: { status: 500 }
|
|
372
453
|
}), {
|
|
373
|
-
...
|
|
374
|
-
cause:
|
|
454
|
+
...Q(r, a, 500, "InternalServerError", "Internal Server Error", {}, { ...i }),
|
|
455
|
+
cause: t
|
|
375
456
|
};
|
|
376
|
-
},
|
|
377
|
-
let
|
|
378
|
-
|
|
457
|
+
}, xe = (a, o) => {
|
|
458
|
+
let s = a.input ? S.decodeUnknown(a.input) : void 0, c = S.encode(a.output), l = a.input === void 0 ? void 0 : C.encodedAST(a.input.ast), u = l !== void 0 && (!C.isTypeLiteral(l) || l.indexSignatures.length > 0 || l.propertySignatures.some((e) => e.name === "body")), d = {};
|
|
459
|
+
a.projection !== void 0 && (d["x-voltro-rest-profile"] = a.projection.format.name);
|
|
460
|
+
let f = (e) => e.replace(/\/$/, "").split("/").length, p = f(a.path);
|
|
461
|
+
return a.deprecated !== void 0 && (d.Deprecation = "true"), a.sunset !== void 0 && (d.Sunset = a.sunset), {
|
|
379
462
|
method: "*",
|
|
380
|
-
path:
|
|
381
|
-
match:
|
|
382
|
-
...
|
|
383
|
-
handle: async (
|
|
384
|
-
if (!
|
|
385
|
-
let
|
|
386
|
-
if (!(
|
|
387
|
-
...
|
|
388
|
-
Allow:
|
|
463
|
+
path: a.path,
|
|
464
|
+
match: a.path.endsWith("/*") ? "prefix" : "exact",
|
|
465
|
+
...a.maxBodyBytes === void 0 ? {} : { maxBodyBytes: a.maxBodyBytes },
|
|
466
|
+
handle: async (l) => {
|
|
467
|
+
if (!a.path.endsWith("/*") && f(l.path) !== p) return Q(a, l, 404, "NotFound", "Not Found", {}, { ...d });
|
|
468
|
+
let m = l.method.toUpperCase();
|
|
469
|
+
if (!(m === a.method || m === "HEAD" && a.method === "GET")) return Q(a, l, 405, "MethodNotAllowed", "Method Not Allowed", { allow: a.method }, {
|
|
470
|
+
...d,
|
|
471
|
+
Allow: a.method
|
|
389
472
|
});
|
|
390
|
-
if (
|
|
391
|
-
let e = Date.parse(
|
|
392
|
-
if (!Number.isNaN(e) && Date.now() >= e) return
|
|
393
|
-
...
|
|
394
|
-
...
|
|
395
|
-
}, { ...
|
|
473
|
+
if (a.sunset !== void 0) {
|
|
474
|
+
let e = Date.parse(a.sunset);
|
|
475
|
+
if (!Number.isNaN(e) && Date.now() >= e) return Q(a, l, 410, "Gone", "Gone", {
|
|
476
|
+
...a.version === void 0 ? {} : { version: a.version },
|
|
477
|
+
...a.deprecated === void 0 ? {} : { replacement: a.deprecated }
|
|
478
|
+
}, { ...d });
|
|
396
479
|
}
|
|
397
|
-
let
|
|
398
|
-
if (
|
|
399
|
-
let e
|
|
480
|
+
let h;
|
|
481
|
+
if (s) {
|
|
482
|
+
let e;
|
|
483
|
+
try {
|
|
484
|
+
e = ye(l, _e(a.path, l.path), u);
|
|
485
|
+
} catch {
|
|
486
|
+
return Q(a, l, 400, "InvalidRequest", "Malformed request body", {}, { ...d });
|
|
487
|
+
}
|
|
488
|
+
let t = await b.runPromise(s(e).pipe(b.map((e) => ({
|
|
400
489
|
ok: !0,
|
|
401
490
|
value: e
|
|
402
|
-
})),
|
|
491
|
+
})), b.catchAll((e) => b.succeed({
|
|
403
492
|
ok: !1,
|
|
404
493
|
cause: e
|
|
405
494
|
}))));
|
|
406
|
-
if (!t.ok) return
|
|
407
|
-
|
|
495
|
+
if (!t.ok) return Q(a, l, 400, "InvalidRequest", "Invalid request", { detail: String(t.cause) }, { ...d });
|
|
496
|
+
h = t.value;
|
|
408
497
|
}
|
|
409
|
-
let
|
|
498
|
+
let g;
|
|
410
499
|
try {
|
|
411
|
-
|
|
412
|
-
} catch (
|
|
413
|
-
if (
|
|
414
|
-
let
|
|
415
|
-
return
|
|
500
|
+
g = o.resolveSubject ? await o.resolveSubject(l.headers) : t(l.headers["x-tenant"] ?? null);
|
|
501
|
+
} catch (t) {
|
|
502
|
+
if (t instanceof e || typeof t == "object" && t && t._tag === "Unauthenticated") {
|
|
503
|
+
let e = t.reason;
|
|
504
|
+
return Q(a, l, 401, "Unauthorized", e ?? "Authentication required", {}, { ...d });
|
|
416
505
|
}
|
|
417
|
-
throw
|
|
506
|
+
throw t;
|
|
418
507
|
}
|
|
419
|
-
let
|
|
508
|
+
let _;
|
|
420
509
|
try {
|
|
421
|
-
|
|
510
|
+
_ = o.buildContext ? await o.buildContext(g, l.headers) : void 0;
|
|
422
511
|
} catch (e) {
|
|
423
|
-
return
|
|
512
|
+
return be(e, g, a, d, l);
|
|
424
513
|
}
|
|
425
|
-
let
|
|
426
|
-
subject:
|
|
427
|
-
headers:
|
|
428
|
-
store:
|
|
429
|
-
method:
|
|
430
|
-
path:
|
|
431
|
-
query:
|
|
432
|
-
rawBody:
|
|
433
|
-
...
|
|
514
|
+
let v = typeof _ == "object" && _ && "store" in _ ? _.store : o.store, x = {
|
|
515
|
+
subject: g,
|
|
516
|
+
headers: l.headers,
|
|
517
|
+
store: v,
|
|
518
|
+
method: m,
|
|
519
|
+
path: l.path,
|
|
520
|
+
query: l.query,
|
|
521
|
+
rawBody: l.rawBody,
|
|
522
|
+
..._ === void 0 ? {} : { app: _ }
|
|
434
523
|
};
|
|
435
|
-
if (
|
|
436
|
-
let t = await e(
|
|
437
|
-
if (t) return
|
|
524
|
+
if (a.guards) for (let e of a.guards) {
|
|
525
|
+
let t = await e(x);
|
|
526
|
+
if (t) return Q(a, l, t.status, t.status === 401 ? "Unauthorized" : t.status === 403 ? "Forbidden" : "GuardRejected", t.message, {}, { ...d });
|
|
438
527
|
}
|
|
439
|
-
let
|
|
440
|
-
if (
|
|
441
|
-
let e = await
|
|
442
|
-
if (e.kind === "replay") return
|
|
443
|
-
...
|
|
528
|
+
let S = o.idempotency, C = S && $.has(a.method) ? l.headers[S.header.toLowerCase()] : void 0, w = S && C ? i(g.tenantId, a.method, a.path) : "";
|
|
529
|
+
if (S && C) {
|
|
530
|
+
let e = await r(S.store, w, C, S.ttlMs, Date.now());
|
|
531
|
+
if (e.kind === "replay") return Z(e.response.status, e.response.body, {
|
|
532
|
+
...d,
|
|
444
533
|
"Idempotency-Replayed": "true"
|
|
445
534
|
});
|
|
446
|
-
if (e.kind === "conflict") return
|
|
535
|
+
if (e.kind === "conflict") return Q(a, l, 409, "Conflict", "A request with this Idempotency-Key is already being processed", {}, { ...d });
|
|
447
536
|
}
|
|
448
537
|
try {
|
|
449
|
-
let e = await
|
|
450
|
-
if (
|
|
538
|
+
let e = await a.handler(h, x);
|
|
539
|
+
if (ue(e) || X(e)) return S && C && await n(S.store, w, C), X(e) ? {
|
|
451
540
|
status: e.status ?? 200,
|
|
452
541
|
headers: {
|
|
453
|
-
...
|
|
542
|
+
...d,
|
|
454
543
|
...e.headers
|
|
455
544
|
},
|
|
456
545
|
byteStream: e.byteStream,
|
|
457
546
|
...e.contentType === void 0 ? {} : { contentType: e.contentType }
|
|
458
547
|
} : {
|
|
459
548
|
status: 200,
|
|
460
|
-
headers:
|
|
549
|
+
headers: d,
|
|
461
550
|
stream: e.stream
|
|
462
551
|
};
|
|
463
|
-
let t =
|
|
464
|
-
...
|
|
552
|
+
let t = J(e) ? e : q(e), r = await b.runPromise(c(t.body)), i = {
|
|
553
|
+
...d,
|
|
465
554
|
...t.headers
|
|
466
555
|
};
|
|
467
|
-
if (
|
|
556
|
+
if (S && C && await y(S.store, w, C, {
|
|
468
557
|
status: t.status,
|
|
469
|
-
body:
|
|
470
|
-
}, Date.now()),
|
|
471
|
-
let e = `W/"${await
|
|
472
|
-
return
|
|
558
|
+
body: r
|
|
559
|
+
}, Date.now()), a.etag === !0 && a.method === "GET") {
|
|
560
|
+
let e = `W/"${await fe(JSON.stringify(r))}"`, n = l.headers["if-none-match"];
|
|
561
|
+
return n !== void 0 && n.split(",").some((t) => t.trim() === e) ? {
|
|
473
562
|
status: 304,
|
|
474
563
|
headers: {
|
|
475
|
-
...
|
|
564
|
+
...d,
|
|
476
565
|
ETag: e
|
|
477
566
|
}
|
|
478
|
-
} :
|
|
567
|
+
} : Z(t.status, r, {
|
|
479
568
|
...i,
|
|
480
569
|
ETag: e
|
|
481
570
|
}, t.contentType);
|
|
@@ -483,21 +572,21 @@ var S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(
|
|
|
483
572
|
return t.status === 204 || t.status === 304 ? {
|
|
484
573
|
status: t.status,
|
|
485
574
|
headers: i
|
|
486
|
-
} :
|
|
575
|
+
} : Z(t.status, r, i, t.contentType);
|
|
487
576
|
} catch (e) {
|
|
488
|
-
return
|
|
577
|
+
return S && C && await n(S.store, w, C), be(e, g, a, d, l);
|
|
489
578
|
}
|
|
490
579
|
}
|
|
491
580
|
};
|
|
492
|
-
},
|
|
581
|
+
}, Se = (e, t = {}) => {
|
|
493
582
|
if (t.idempotency !== void 0) {
|
|
494
583
|
for (let t of e) if (t.streaming === !0 && $.has(t.method)) throw Error(`REST route ${t.method} ${t.path} declares \`streaming: true\` on a method the idempotency binding claims (${[...$].join("/")}). A stream cannot complete an idempotency claim — there is no replayable body to cache — so a retried request would 409 until the claim's TTL. Either serve the stream on GET, or scope the idempotency binding away from this app's streaming routes.`);
|
|
495
584
|
}
|
|
496
|
-
return e.map((e) =>
|
|
497
|
-
},
|
|
585
|
+
return e.map((e) => xe(e, t));
|
|
586
|
+
}, Ce = async (e, t) => {
|
|
498
587
|
let n = await e[0].handle(t);
|
|
499
588
|
for (let r = 1; r < e.length && n.status === 405; r++) n = await e[r].handle(t);
|
|
500
589
|
return n;
|
|
501
590
|
};
|
|
502
591
|
//#endregion
|
|
503
|
-
export {
|
|
592
|
+
export { g as JSONAPI_MEDIA_TYPE, f as PROBLEM_JSON, m as REST_PROFILE_NAMES, Y as RestRouteError, de as bytes, N as coerceQueryObject, M as coerceQueryValue, H as collectPublicApiRoutes, P as declaredErrorTags, se as defineRestRoute, w as derivePublicMethod, T as derivePublicPath, D as deriveResource, Ce as dispatchSharedPath, u as encodeRestError, o as encodeRestSuccess, L as errorMemberSchema, X as isRestByteResponse, J as isRestResponse, ue as isRestStreamResponse, _e as matchPathParams, p as nextLink, O as normalizePathParams, R as operationIdOf, k as pathParamNames, h as problemDetails, s as problemTypeOf, I as projectedFailure, V as publicApiRoute, U as publicSurfaceDigest, K as requireAnyScope, W as requireAuthenticated, G as requireScope, d as resolveRestFormat, E as resourceIdField, q as response, oe as restError, Se as restRoutesToHttpRoutes, _ as restViewSchema, ve as routeAcceptsPath, ce as sse, le as sseFrame, c as toSnakeCase, ie as wireExample };
|