@voltro/protocol 0.70.0 → 0.71.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/rest.js CHANGED
@@ -1,74 +1,100 @@
1
- import { F as e, P as t } from "./scopes-DVtiKKsm.js";
2
- import { _ as n, a as r, b as i, c as a, d as o, f as s, i as c, l, n as u, o as d, r as f, s as p, t as m, u as h, v as g, y as _ } from "./restFormat-Bnngx-zI.js";
3
- import { Effect as v, ParseResult as y, Schema as b } from "effect";
4
- import * as x from "effect/SchemaAST";
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 S = (e, t) => t.method ?? (e === "query" ? "GET" : "POST"), C = (e, t) => w(t.path ?? `/${t.version ?? "v1"}/${e.replace(/\./g, "/")}`), w = (e) => e.replace(/\{([A-Za-z0-9_]+)\}/g, ":$1"), T = (e) => [...e.matchAll(/:([A-Za-z0-9_]+)/g)].map((e) => e[1]), E = (e) => {
7
- if (x.isUnion(e)) {
8
- let t = e.types.filter((e) => !x.isUndefinedKeyword(e));
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 x.Union.make(t);
36
+ if (t.length !== e.types.length) return C.Union.make(t);
11
37
  }
12
38
  return e;
13
- }, D = /^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i, O = (e, t) => {
14
- let n = E(t);
15
- if (x.isRefinement(n) || x.isTransformation(n)) return O(e, n.from);
16
- if (x.isUnion(n)) {
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 = O(e, t);
44
+ let n = M(e, t);
19
45
  if (n !== e) return n;
20
46
  }
21
47
  return e;
22
48
  }
23
- if (x.isTupleType(n)) {
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) => O(e, r));
53
+ return r === void 0 ? t : t.map((e) => M(e, r));
28
54
  }
29
55
  if (typeof e != "string") return e;
30
- if (x.isNumberKeyword(n)) return D.test(e.trim()) ? Number(e) : e;
31
- if (x.isBooleanKeyword(n)) return e === "true" || e !== "false" && e;
32
- if (x.isLiteral(n)) {
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" && D.test(e.trim()) && Number(e) === t || typeof t == "boolean" && String(t) === e ? t : e;
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
- }, k = (e, t) => {
63
+ }, N = (e, t) => {
38
64
  if (typeof e != "object" || !e || Array.isArray(e)) return e;
39
- let n = E(x.encodedAST(t.ast));
40
- if (!x.isTypeLiteral(n)) return e;
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] = O(r[t], e.type));
70
+ t in r && (r[t] = M(r[t], e.type));
45
71
  }
46
72
  return r;
47
- }, A = (e) => {
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 (x.isUnion(e)) {
77
+ if (C.isUnion(e)) {
52
78
  for (let t of e.types) n(t);
53
79
  return;
54
80
  }
55
- if (x.isTransformation(e)) {
81
+ if (C.isTransformation(e)) {
56
82
  n(e.from), n(e.to);
57
83
  return;
58
84
  }
59
- if (x.isRefinement(e)) {
85
+ if (C.isRefinement(e)) {
60
86
  n(e.from);
61
87
  return;
62
88
  }
63
- if (x.isTypeLiteral(e)) {
89
+ if (C.isTypeLiteral(e)) {
64
90
  let n = e.propertySignatures.find((e) => e.name === "_tag");
65
- n !== void 0 && x.isLiteral(n.type) && typeof n.type.literal == "string" && t.add(n.type.literal);
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
- }, j = (e, t, n) => {
95
+ }, F = (e, t, n) => {
70
96
  if (n !== void 0) try {
71
- let r = b.encodeUnknownSync(n)(e);
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
- }, M = (e, t, n, r = []) => {
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 (A(t.error).has(i)) return new H(n.errorStatus?.[i] ?? 422, j(e, i, t.error));
85
- let a = r.find((e) => A(e.schema).has(i));
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 H(o, j(e, i, a.schema), s);
89
- }, ee = (e, t, n, r, i, a) => {
90
- let o = M(e, t, n, r);
91
- if (!(o instanceof H) || i.errors === "tagged" && i.encodeError === void 0) return o;
92
- let { error: s, _tag: l, ...u } = o.body, d = typeof u.message == "string" ? u.message : typeof u.reason == "string" ? u.reason : "", f = c(i, {
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: u
122
+ fields: l
97
123
  }, {
98
124
  ...a,
99
125
  status: o.status
100
126
  });
101
- return new H(o.status, f.body, {
127
+ return new Y(o.status, f.body, {
102
128
  ...o.headers ?? {},
103
129
  ...f.headers ?? {}
104
130
  }, f.contentType);
105
- }, N = (e, t) => {
131
+ }, L = (e, t) => {
106
132
  if (e === void 0) return;
107
- let n = x.isUnion(e.ast) ? e.ast.types : [e.ast];
133
+ let n = C.isUnion(e.ast) ? e.ast.types : [e.ast];
108
134
  for (let e of n) {
109
- let n = b.make(e);
110
- if (A(n).has(t)) return n;
135
+ let n = S.make(e);
136
+ if (P(n).has(t)) return n;
111
137
  }
112
- }, P = (e) => e.split(".").map((e, t) => t === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_"), te = (e) => {
113
- let t = E(x.encodedAST(e.ast));
114
- return x.isTypeLiteral(t) ? new Set(t.propertySignatures.map((e) => String(e.name))) : void 0;
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 = E(x.encodedAST(t.ast)), r = {}, i = x.isTypeLiteral(n) ? new Map(n.propertySignatures.map((e) => [String(e.name), e.type])) : /* @__PURE__ */ new Map();
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 : O(n, e);
145
+ r[t] = e === void 0 ? n : M(n, e);
120
146
  }
121
147
  return r;
122
- }, F = (e, t, n, i = {}) => {
123
- let a = e.publicApi;
124
- if (a === void 0) throw Error(`publicApiRoute: descriptor '${e.name}' has no publicApi annotation`);
125
- let s = l(i.profile, a.format), c = i.pluginErrors ?? [], u = S(e.kind, a), d = (e) => s.naming === "snake_case" ? o(e) : e, f = C(e.name, a), p = f.replace(/:([A-Za-z0-9_]+)/g, (e, t) => `:${d(t)}`), m = T(p), g = h(e.input, s), _ = te(g);
126
- if (_ !== void 0) {
127
- for (let t of m) if (!_.has(t)) throw Error(`publicApi: descriptor '${e.name}' — path '${f}' binds ':${t}', and the input declares no field of that name` + (_.size > 0 ? ` (fields: ${[..._].join(", ")})` : " (the input declares no fields)"));
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
- let x = h(e.output, s), w = b.Struct({ value: g }), E = b.Struct({
130
- query: b.Unknown,
131
- params: b.Unknown,
132
- body: b.Unknown
133
- }), D = b.transformOrFail(E, w, {
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" ? k(e.query, g) : e.body ?? {}, i = typeof e.params == "object" && e.params !== null ? re(e.params, g) : {};
137
- if (typeof r != "object" || !r || Array.isArray(r)) return y.succeed({ value: r });
138
- let a = r, o = Object.keys(i).filter((e) => e in a && !ne(a[e], i[e]));
139
- if (o.length > 0) {
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 y.fail(new y.Type(n, e, `${o.map((e) => `'${e}'`).join(", ")} ${o.length === 1 ? "is" : "are"} bound by the path and sent with another value in the ${t}`));
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 y.succeed({ value: {
144
- ...a,
145
- ...i
196
+ return x.succeed({ value: {
197
+ ...o,
198
+ ...a
146
199
  } });
147
200
  },
148
- encode: (e) => y.succeed(e)
149
- }), O = [...e.openAccess === void 0 ? [L()] : [], ...(a.scopes ?? []).map((e) => R(e))], j = (() => {
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 = a.stream === "sse" && e.kind === "query" && n !== void 0, I = b.encodeUnknown(x), z = F ? (e, t) => G((r) => n(e.value, t, (e) => {
160
- r(K(String(e._tag ?? "message"), e));
161
- })) : async (n, i) => {
162
- let o;
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
- o = await t(n.value, i);
221
+ c = await t(n.value, r);
165
222
  } catch (t) {
166
- throw ee(t, e, a, c, s, M(i));
223
+ throw te(t, e, i, s, a, M(r));
167
224
  }
168
- let l = await v.runPromise(I(o)), u = r(s, l, M(i));
169
- return B(u.body, {
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 = [...A(V)], U = [];
230
+ }, V = e.error, H = [...P(V)], U = [];
174
231
  for (let e of H) {
175
- let t = N(V, e);
232
+ let t = L(V, e);
176
233
  t !== void 0 && U.push({
177
- status: a.errorStatus?.[e] ?? 422,
234
+ status: i.errorStatus?.[e] ?? 422,
178
235
  tag: e,
179
236
  schema: t
180
237
  });
181
238
  }
182
- for (let e of c) for (let t of A(e.schema)) {
239
+ for (let e of s) for (let t of P(e.schema)) {
183
240
  if (H.includes(t)) continue;
184
- let n = a.errorStatus?.[t] ?? e.rest?.status;
241
+ let n = i.errorStatus?.[t] ?? e.rest?.status;
185
242
  if (n === void 0) continue;
186
- let r = N(e.schema, t) ?? e.schema;
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 q = a.security === !1 ? "none" : a.security ?? (e.openAccess === void 0 ? "required" : "optional"), J = {
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: a.version ?? "v1",
197
- security: q,
253
+ version: i.version ?? "v1",
254
+ security: K,
255
+ idempotent: i.idempotent === !0,
198
256
  input: g,
199
- pathParams: m,
200
- output: x,
257
+ pathParams: h,
258
+ output: y,
201
259
  source: j,
202
260
  errorResponses: U,
203
- format: s
261
+ format: a
204
262
  };
205
- return W({
263
+ return se({
206
264
  method: u,
207
- path: p,
208
- input: D,
209
- output: b.Unknown,
210
- handler: z,
265
+ path: m,
266
+ input: O,
267
+ output: S.Unknown,
268
+ handler: B,
211
269
  ...F ? { streaming: !0 } : {},
212
- guards: O,
213
- operationId: a.operationId ?? P(e.name),
214
- tags: a.tags ?? [e.name.split(".")[0] ?? e.name],
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
- ...s.etag && u === "GET" && !F ? { etag: !0 } : {},
217
- ...a.example === void 0 ? {} : { example: a.example },
218
- ...a.summary === void 0 ? {} : { summary: a.summary },
219
- ...a.description === void 0 ? {} : { description: a.description },
220
- ...a.deprecated === void 0 ? {} : { deprecated: a.deprecated },
221
- ...a.sunset === void 0 ? {} : { sunset: a.sunset }
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
- }, I = (e, t = {}) => e.filter((e) => e.descriptor.publicApi !== void 0).map((e) => F(e.descriptor, e.invoke, e.subscribe, t)).sort((e, t) => e.path.localeCompare(t.path)), L = () => (e) => {
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
- }, R = (e) => (t) => {
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
- }, z = (e) => (t) => {
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
- }, B = (e, t = {}) => ({
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
- }), V = (e) => typeof e == "object" && !!e && e.__voltroRestResponse === !0, H = class extends Error {
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
- }, U = (e, t, n) => new H(e, t, n), W = (e) => {
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
- }, G = (e, t = {}) => ({
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
- }), K = (e, t) => `event: ${e}\n${(typeof t == "string" ? t : JSON.stringify(t)).split("\n").map((e) => `data: ${e}`).join("\n")}\n\n`, q = (e) => typeof e == "object" && !!e && e.__voltroRestStream === !0, J = (e, t = {}) => ({
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
- }), Y = (e) => typeof e == "object" && !!e && e.__voltroRestBytes === !0, ie = async (e) => {
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
- }, X = (e, t, n, r = "application/json; charset=utf-8") => ({
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
- }), Z = (e, t, n, r, i, a, o) => {
355
+ }), Q = (e, t, n, r, i, a, o) => {
287
356
  let s = e.projection;
288
- if (s === void 0) return X(n, {
357
+ if (s === void 0) return Z(n, {
289
358
  error: i,
290
359
  ...a
291
360
  }, o);
292
- let l = {
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
- }, u = c(s.format, {
368
+ }, l = u(s.format, {
300
369
  status: n,
301
370
  tag: r,
302
371
  message: i,
303
372
  fields: a
304
- }, l);
305
- return X(n, u.body, {
373
+ }, c);
374
+ return Z(n, l.body, {
306
375
  ...o,
307
- ...u.headers ?? {}
308
- }, u.contentType);
309
- }, ae = (e) => {
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 t = new TextDecoder().decode(e);
312
- if (t.trim() !== "") return JSON.parse(t);
313
- }, oe = (e) => {
314
- let t = {};
315
- for (let [n, r] of new URLSearchParams(e)) {
316
- let e = t[n];
317
- e === void 0 ? t[n] = r : Array.isArray(e) ? e.push(r) : t[n] = [e, r];
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
- }, Q = (e, t) => {
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
- }, se = (e, t) => {
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
- }, ce = (e, t) => ({
345
- query: oe(e.query),
424
+ }, ye = (e, t, n) => ({
425
+ query: he(e.query),
346
426
  params: t,
347
- body: ae(e.rawBody)
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
- ]), le = (e, n, r, i, a) => {
354
- if (e instanceof H) return X(e.status, e.body, {
434
+ ]), be = (t, n, r, i, a) => {
435
+ if (t instanceof Y) return Z(t.status, t.body, {
355
436
  ...i,
356
- ...e.headers
357
- }, e.contentType);
358
- if (typeof e == "object" && e) {
359
- let o = e;
360
- if (typeof o.status == "number") return Z(r, a, o.status, typeof o._tag == "string" ? o._tag : "Error", typeof o.message == "string" ? o.message : "Error", {}, { ...i });
361
- if (o._tag === "Unauthenticated" || e instanceof t) return Z(r, a, 401, "Unauthorized", typeof o.reason == "string" ? o.reason : "Authentication required", {}, { ...i });
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 Z(r, a, e, e === 401 ? "Unauthorized" : "Forbidden", typeof o.message == "string" ? o.message : "Forbidden", {}, { ...i });
445
+ return Q(r, a, e, e === 401 ? "Unauthorized" : "Forbidden", typeof o.message == "string" ? o.message : "Forbidden", {}, { ...i });
365
446
  }
366
447
  }
367
- return s({
368
- error: e,
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
- ...Z(r, a, 500, "InternalServerError", "Internal Server Error", {}, { ...i }),
374
- cause: e
454
+ ...Q(r, a, 500, "InternalServerError", "Internal Server Error", {}, { ...i }),
455
+ cause: t
375
456
  };
376
- }, ue = (r, a) => {
377
- let o = r.input ? b.decodeUnknown(r.input) : void 0, s = b.encode(r.output), c = {}, l = (e) => e.replace(/\/$/, "").split("/").length, u = l(r.path);
378
- return r.deprecated !== void 0 && (c.Deprecation = "true"), r.sunset !== void 0 && (c.Sunset = r.sunset), {
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: r.path,
381
- match: r.path.endsWith("/*") ? "prefix" : "exact",
382
- ...r.maxBodyBytes === void 0 ? {} : { maxBodyBytes: r.maxBodyBytes },
383
- handle: async (d) => {
384
- if (!r.path.endsWith("/*") && l(d.path) !== u) return Z(r, d, 404, "NotFound", "Not Found", {}, { ...c });
385
- let f = d.method.toUpperCase();
386
- if (!(f === r.method || f === "HEAD" && r.method === "GET")) return Z(r, d, 405, "MethodNotAllowed", "Method Not Allowed", { allow: r.method }, {
387
- ...c,
388
- Allow: r.method
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 (r.sunset !== void 0) {
391
- let e = Date.parse(r.sunset);
392
- if (!Number.isNaN(e) && Date.now() >= e) return Z(r, d, 410, "Gone", "Gone", {
393
- ...r.version === void 0 ? {} : { version: r.version },
394
- ...r.deprecated === void 0 ? {} : { replacement: r.deprecated }
395
- }, { ...c });
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 p;
398
- if (o) {
399
- let e = ce(d, Q(r.path, d.path)), t = await v.runPromise(o(e).pipe(v.map((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
- })), v.catchAll((e) => v.succeed({
491
+ })), b.catchAll((e) => b.succeed({
403
492
  ok: !1,
404
493
  cause: e
405
494
  }))));
406
- if (!t.ok) return Z(r, d, 400, "InvalidRequest", "Invalid request", { detail: String(t.cause) }, { ...c });
407
- p = t.value;
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 m;
498
+ let g;
410
499
  try {
411
- m = a.resolveSubject ? await a.resolveSubject(d.headers) : e(d.headers["x-tenant"] ?? null);
412
- } catch (e) {
413
- if (e instanceof t || typeof e == "object" && e && e._tag === "Unauthenticated") {
414
- let t = e.reason;
415
- return Z(r, d, 401, "Unauthorized", t ?? "Authentication required", {}, { ...c });
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 e;
506
+ throw t;
418
507
  }
419
- let h;
508
+ let _;
420
509
  try {
421
- h = a.buildContext ? await a.buildContext(m, d.headers) : void 0;
510
+ _ = o.buildContext ? await o.buildContext(g, l.headers) : void 0;
422
511
  } catch (e) {
423
- return le(e, m, r, c, d);
512
+ return be(e, g, a, d, l);
424
513
  }
425
- let y = typeof h == "object" && h && "store" in h ? h.store : a.store, b = {
426
- subject: m,
427
- headers: d.headers,
428
- store: y,
429
- method: f,
430
- path: d.path,
431
- query: d.query,
432
- rawBody: d.rawBody,
433
- ...h === void 0 ? {} : { app: h }
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 (r.guards) for (let e of r.guards) {
436
- let t = await e(b);
437
- if (t) return Z(r, d, t.status, t.status === 401 ? "Unauthorized" : t.status === 403 ? "Forbidden" : "GuardRejected", t.message, {}, { ...c });
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 x = a.idempotency, S = x && $.has(r.method) ? d.headers[x.header.toLowerCase()] : void 0, C = x && S ? i(m.tenantId, r.method, r.path) : "";
440
- if (x && S) {
441
- let e = await n(x.store, C, S, x.ttlMs, Date.now());
442
- if (e.kind === "replay") return X(e.response.status, e.response.body, {
443
- ...c,
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 Z(r, d, 409, "Conflict", "A request with this Idempotency-Key is already being processed", {}, { ...c });
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 r.handler(p, b);
450
- if (q(e) || Y(e)) return x && S && await g(x.store, C, S), Y(e) ? {
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
- ...c,
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: c,
549
+ headers: d,
461
550
  stream: e.stream
462
551
  };
463
- let t = V(e) ? e : B(e), n = await v.runPromise(s(t.body)), i = {
464
- ...c,
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 (x && S && await _(x.store, C, S, {
556
+ if (S && C && await y(S.store, w, C, {
468
557
  status: t.status,
469
- body: n
470
- }, Date.now()), r.etag === !0 && r.method === "GET") {
471
- let e = `W/"${await ie(JSON.stringify(n))}"`, r = d.headers["if-none-match"];
472
- return r !== void 0 && r.split(",").some((t) => t.trim() === e) ? {
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
- ...c,
564
+ ...d,
476
565
  ETag: e
477
566
  }
478
- } : X(t.status, n, {
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
- } : X(t.status, n, i, t.contentType);
575
+ } : Z(t.status, r, i, t.contentType);
487
576
  } catch (e) {
488
- return x && S && await g(x.store, C, S), le(e, m, r, c, d);
577
+ return S && C && await n(S.store, w, C), be(e, g, a, d, l);
489
578
  }
490
579
  }
491
580
  };
492
- }, de = (e, t = {}) => {
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) => ue(e, t));
497
- }, fe = async (e, t) => {
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 { m as JSONAPI_MEDIA_TYPE, u as PROBLEM_JSON, f as REST_PROFILE_NAMES, H as RestRouteError, J as bytes, k as coerceQueryObject, O as coerceQueryValue, I as collectPublicApiRoutes, A as declaredErrorTags, W as defineRestRoute, S as derivePublicMethod, C as derivePublicPath, fe as dispatchSharedPath, c as encodeRestError, r as encodeRestSuccess, N as errorMemberSchema, Y as isRestByteResponse, V as isRestResponse, q as isRestStreamResponse, Q as matchPathParams, d as nextLink, w as normalizePathParams, P as operationIdOf, T as pathParamNames, p as problemDetails, a as problemTypeOf, M as projectedFailure, F as publicApiRoute, z as requireAnyScope, L as requireAuthenticated, R as requireScope, l as resolveRestFormat, B as response, U as restError, de as restRoutesToHttpRoutes, h as restViewSchema, se as routeAcceptsPath, G as sse, K as sseFrame, o as toSnakeCase };
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 };