@distilled.cloud/core 1.0.0-rc.16 → 1.0.0-rc.18

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.
Files changed (306) hide show
  1. package/lib/_bundle/aws.js +2 -0
  2. package/lib/_bundle/aws.js.map +1 -0
  3. package/lib/_bundle/base.js +5 -0
  4. package/lib/_bundle/base.js.map +1 -0
  5. package/lib/_bundle/graphql.js +3 -0
  6. package/lib/_bundle/graphql.js.map +1 -0
  7. package/lib/_bundle/rest.js +2 -0
  8. package/lib/_bundle/rest.js.map +1 -0
  9. package/lib/_bundle/xml.js +4 -0
  10. package/lib/_bundle/xml.js.map +1 -0
  11. package/lib/annotations.d.ts +15 -0
  12. package/lib/annotations.d.ts.map +1 -0
  13. package/lib/annotations.js +2 -0
  14. package/lib/annotations.js.map +1 -0
  15. package/lib/api.d.ts +15 -0
  16. package/lib/api.d.ts.map +1 -1
  17. package/lib/api.js +1 -796
  18. package/lib/category.d.ts.map +1 -1
  19. package/lib/category.js +1 -278
  20. package/lib/chunks.js +1 -11
  21. package/lib/config.d.ts +54 -13
  22. package/lib/config.d.ts.map +1 -1
  23. package/lib/config.js +1 -161
  24. package/lib/crypto.js +1 -130
  25. package/lib/debug.d.ts.map +1 -1
  26. package/lib/debug.js +1 -8
  27. package/lib/error-category.d.ts.map +1 -1
  28. package/lib/error-category.js +1 -47
  29. package/lib/errors.d.ts +2 -13
  30. package/lib/errors.d.ts.map +1 -1
  31. package/lib/errors.js +1 -198
  32. package/lib/graphql.d.ts +14 -0
  33. package/lib/graphql.d.ts.map +1 -1
  34. package/lib/graphql.js +1 -1058
  35. package/lib/graphql.types.js +1 -6
  36. package/lib/index.d.ts +3 -2
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +1 -15
  39. package/lib/pagination.d.ts +34 -2
  40. package/lib/pagination.d.ts.map +1 -1
  41. package/lib/pagination.js +1 -271
  42. package/lib/plain-values.js +1 -39
  43. package/lib/plain-values.js.map +1 -1
  44. package/lib/protocol-http.d.ts +30 -6
  45. package/lib/protocol-http.d.ts.map +1 -1
  46. package/lib/protocol-http.js +1 -812
  47. package/lib/protocol-rest.d.ts +53 -39
  48. package/lib/protocol-rest.d.ts.map +1 -1
  49. package/lib/protocol-rest.js +1 -375
  50. package/lib/query.js +1 -27
  51. package/lib/response-validation-strict.js +1 -284
  52. package/lib/response-validation.d.ts +4 -3
  53. package/lib/response-validation.d.ts.map +1 -1
  54. package/lib/response-validation.js +1 -118
  55. package/lib/retry-after.js +1 -112
  56. package/lib/retry.js +1 -197
  57. package/lib/schema-lite-impl.js +1 -341
  58. package/lib/schema-lite-typed.js +1 -27
  59. package/lib/schema-lite.js +1 -31
  60. package/lib/schema.js +1 -220
  61. package/lib/telemetry-debug.d.ts +14 -0
  62. package/lib/telemetry-debug.d.ts.map +1 -0
  63. package/lib/telemetry-debug.js +2 -0
  64. package/lib/telemetry-debug.js.map +1 -0
  65. package/lib/telemetry-hooks.d.ts +32 -0
  66. package/lib/telemetry-hooks.d.ts.map +1 -0
  67. package/lib/telemetry-hooks.js +2 -0
  68. package/lib/telemetry-hooks.js.map +1 -0
  69. package/lib/telemetry-host-rules.d.ts +23 -0
  70. package/lib/telemetry-host-rules.d.ts.map +1 -0
  71. package/lib/telemetry-host-rules.js +2 -0
  72. package/lib/telemetry-host-rules.js.map +1 -0
  73. package/lib/telemetry-lambda-context.d.ts +17 -0
  74. package/lib/telemetry-lambda-context.d.ts.map +1 -0
  75. package/lib/telemetry-lambda-context.js +2 -0
  76. package/lib/telemetry-lambda-context.js.map +1 -0
  77. package/lib/telemetry-message-context.d.ts +52 -0
  78. package/lib/telemetry-message-context.d.ts.map +1 -0
  79. package/lib/telemetry-message-context.js +2 -0
  80. package/lib/telemetry-message-context.js.map +1 -0
  81. package/lib/telemetry-metrics.d.ts +6 -0
  82. package/lib/telemetry-metrics.d.ts.map +1 -0
  83. package/lib/telemetry-metrics.js +2 -0
  84. package/lib/telemetry-metrics.js.map +1 -0
  85. package/lib/telemetry-name-template.d.ts +13 -0
  86. package/lib/telemetry-name-template.d.ts.map +1 -0
  87. package/lib/telemetry-name-template.js +2 -0
  88. package/lib/telemetry-name-template.js.map +1 -0
  89. package/lib/telemetry-stream.d.ts +9 -0
  90. package/lib/telemetry-stream.d.ts.map +1 -0
  91. package/lib/telemetry-stream.js +2 -0
  92. package/lib/telemetry-stream.js.map +1 -0
  93. package/lib/telemetry-xray.d.ts +28 -0
  94. package/lib/telemetry-xray.d.ts.map +1 -0
  95. package/lib/telemetry-xray.js +2 -0
  96. package/lib/telemetry-xray.js.map +1 -0
  97. package/lib/telemetry.d.ts +269 -0
  98. package/lib/telemetry.d.ts.map +1 -0
  99. package/lib/telemetry.js +3 -0
  100. package/lib/telemetry.js.map +1 -0
  101. package/lib/trait.js +1 -131
  102. package/lib/xml.js +1 -323
  103. package/package.json +1 -3
  104. package/src/annotations.ts +37 -0
  105. package/src/api.ts +130 -30
  106. package/src/category.ts +21 -22
  107. package/src/config.ts +58 -29
  108. package/src/debug.ts +9 -6
  109. package/src/error-category.ts +12 -14
  110. package/src/errors.ts +7 -7
  111. package/src/graphql.ts +123 -18
  112. package/src/index.ts +3 -2
  113. package/src/pagination.ts +119 -6
  114. package/src/protocol-http.ts +63 -43
  115. package/src/protocol-rest.ts +201 -140
  116. package/src/response-validation.ts +4 -3
  117. package/src/telemetry-debug.ts +135 -0
  118. package/src/telemetry-hooks.ts +33 -0
  119. package/src/telemetry-host-rules.ts +39 -0
  120. package/src/telemetry-lambda-context.ts +46 -0
  121. package/src/telemetry-message-context.ts +170 -0
  122. package/src/telemetry-metrics.ts +69 -0
  123. package/src/telemetry-name-template.ts +26 -0
  124. package/src/telemetry-stream.ts +91 -0
  125. package/src/telemetry-xray.ts +66 -0
  126. package/src/telemetry.ts +768 -0
  127. package/lib/api.js.map +0 -1
  128. package/lib/category.js.map +0 -1
  129. package/lib/chunks.js.map +0 -1
  130. package/lib/codegen/boolean-string-enums.d.ts +0 -36
  131. package/lib/codegen/boolean-string-enums.d.ts.map +0 -1
  132. package/lib/codegen/boolean-string-enums.js +0 -147
  133. package/lib/codegen/boolean-string-enums.js.map +0 -1
  134. package/lib/codegen/chunk.d.ts +0 -7
  135. package/lib/codegen/chunk.d.ts.map +0 -1
  136. package/lib/codegen/chunk.js +0 -139
  137. package/lib/codegen/chunk.js.map +0 -1
  138. package/lib/codegen/cli.d.ts +0 -80
  139. package/lib/codegen/cli.d.ts.map +0 -1
  140. package/lib/codegen/cli.js +0 -166
  141. package/lib/codegen/cli.js.map +0 -1
  142. package/lib/codegen/datafy.d.ts +0 -14
  143. package/lib/codegen/datafy.d.ts.map +0 -1
  144. package/lib/codegen/datafy.js +0 -853
  145. package/lib/codegen/datafy.js.map +0 -1
  146. package/lib/codegen/dedupe.d.ts +0 -5
  147. package/lib/codegen/dedupe.d.ts.map +0 -1
  148. package/lib/codegen/dedupe.js +0 -153
  149. package/lib/codegen/dedupe.js.map +0 -1
  150. package/lib/codegen/emit.d.ts +0 -125
  151. package/lib/codegen/emit.d.ts.map +0 -1
  152. package/lib/codegen/emit.js +0 -99
  153. package/lib/codegen/emit.js.map +0 -1
  154. package/lib/codegen/format.d.ts +0 -11
  155. package/lib/codegen/format.d.ts.map +0 -1
  156. package/lib/codegen/format.js +0 -32
  157. package/lib/codegen/format.js.map +0 -1
  158. package/lib/codegen/generated-at.d.ts +0 -29
  159. package/lib/codegen/generated-at.d.ts.map +0 -1
  160. package/lib/codegen/generated-at.js +0 -78
  161. package/lib/codegen/generated-at.js.map +0 -1
  162. package/lib/codegen/generator.d.ts +0 -353
  163. package/lib/codegen/generator.d.ts.map +0 -1
  164. package/lib/codegen/generator.js +0 -810
  165. package/lib/codegen/generator.js.map +0 -1
  166. package/lib/codegen/graph.d.ts +0 -36
  167. package/lib/codegen/graph.d.ts.map +0 -1
  168. package/lib/codegen/graph.js +0 -136
  169. package/lib/codegen/graph.js.map +0 -1
  170. package/lib/codegen/graphql-client.d.ts +0 -70
  171. package/lib/codegen/graphql-client.d.ts.map +0 -1
  172. package/lib/codegen/graphql-client.js +0 -439
  173. package/lib/codegen/graphql-client.js.map +0 -1
  174. package/lib/codegen/graphql.d.ts +0 -207
  175. package/lib/codegen/graphql.d.ts.map +0 -1
  176. package/lib/codegen/graphql.js +0 -786
  177. package/lib/codegen/graphql.js.map +0 -1
  178. package/lib/codegen/latin1.d.ts +0 -3
  179. package/lib/codegen/latin1.d.ts.map +0 -1
  180. package/lib/codegen/latin1.js +0 -126
  181. package/lib/codegen/latin1.js.map +0 -1
  182. package/lib/codegen/members.d.ts +0 -32
  183. package/lib/codegen/members.d.ts.map +0 -1
  184. package/lib/codegen/members.js +0 -62
  185. package/lib/codegen/members.js.map +0 -1
  186. package/lib/codegen/model-diff.d.ts +0 -10
  187. package/lib/codegen/model-diff.d.ts.map +0 -1
  188. package/lib/codegen/model-diff.js +0 -67
  189. package/lib/codegen/model-diff.js.map +0 -1
  190. package/lib/codegen/naming.d.ts +0 -29
  191. package/lib/codegen/naming.d.ts.map +0 -1
  192. package/lib/codegen/naming.js +0 -74
  193. package/lib/codegen/naming.js.map +0 -1
  194. package/lib/codegen/openapi-cli.d.ts +0 -52
  195. package/lib/codegen/openapi-cli.d.ts.map +0 -1
  196. package/lib/codegen/openapi-cli.js +0 -84
  197. package/lib/codegen/openapi-cli.js.map +0 -1
  198. package/lib/codegen/openapi.d.ts +0 -209
  199. package/lib/codegen/openapi.d.ts.map +0 -1
  200. package/lib/codegen/openapi.js +0 -1548
  201. package/lib/codegen/openapi.js.map +0 -1
  202. package/lib/codegen/operations.d.ts +0 -24
  203. package/lib/codegen/operations.d.ts.map +0 -1
  204. package/lib/codegen/operations.js +0 -56
  205. package/lib/codegen/operations.js.map +0 -1
  206. package/lib/codegen/pagination.d.ts +0 -39
  207. package/lib/codegen/pagination.d.ts.map +0 -1
  208. package/lib/codegen/pagination.js +0 -31
  209. package/lib/codegen/pagination.js.map +0 -1
  210. package/lib/codegen/patch-audit.d.ts +0 -84
  211. package/lib/codegen/patch-audit.d.ts.map +0 -1
  212. package/lib/codegen/patch-audit.js +0 -366
  213. package/lib/codegen/patch-audit.js.map +0 -1
  214. package/lib/codegen/patches.d.ts +0 -129
  215. package/lib/codegen/patches.d.ts.map +0 -1
  216. package/lib/codegen/patches.js +0 -472
  217. package/lib/codegen/patches.js.map +0 -1
  218. package/lib/codegen/prelude.d.ts +0 -15
  219. package/lib/codegen/prelude.d.ts.map +0 -1
  220. package/lib/codegen/prelude.js +0 -60
  221. package/lib/codegen/prelude.js.map +0 -1
  222. package/lib/codegen/privatize.d.ts +0 -21
  223. package/lib/codegen/privatize.d.ts.map +0 -1
  224. package/lib/codegen/privatize.js +0 -176
  225. package/lib/codegen/privatize.js.map +0 -1
  226. package/lib/codegen/proto.d.ts +0 -121
  227. package/lib/codegen/proto.d.ts.map +0 -1
  228. package/lib/codegen/proto.js +0 -960
  229. package/lib/codegen/proto.js.map +0 -1
  230. package/lib/codegen/pure.d.ts +0 -6
  231. package/lib/codegen/pure.d.ts.map +0 -1
  232. package/lib/codegen/pure.js +0 -91
  233. package/lib/codegen/pure.js.map +0 -1
  234. package/lib/codegen/rewrite-operation-ids.d.ts +0 -154
  235. package/lib/codegen/rewrite-operation-ids.d.ts.map +0 -1
  236. package/lib/codegen/rewrite-operation-ids.js +0 -1117
  237. package/lib/codegen/rewrite-operation-ids.js.map +0 -1
  238. package/lib/codegen/spec-path.d.ts +0 -16
  239. package/lib/codegen/spec-path.d.ts.map +0 -1
  240. package/lib/codegen/spec-path.js +0 -101
  241. package/lib/codegen/spec-path.js.map +0 -1
  242. package/lib/codegen/table.d.ts +0 -5
  243. package/lib/codegen/table.d.ts.map +0 -1
  244. package/lib/codegen/table.js +0 -249
  245. package/lib/codegen/table.js.map +0 -1
  246. package/lib/config.js.map +0 -1
  247. package/lib/crypto.js.map +0 -1
  248. package/lib/debug.js.map +0 -1
  249. package/lib/error-category.js.map +0 -1
  250. package/lib/errors.js.map +0 -1
  251. package/lib/graphql.js.map +0 -1
  252. package/lib/graphql.types.js.map +0 -1
  253. package/lib/index.js.map +0 -1
  254. package/lib/json-patch.d.ts +0 -58
  255. package/lib/json-patch.d.ts.map +0 -1
  256. package/lib/json-patch.js +0 -227
  257. package/lib/json-patch.js.map +0 -1
  258. package/lib/pagination.js.map +0 -1
  259. package/lib/protocol-http.js.map +0 -1
  260. package/lib/protocol-rest.js.map +0 -1
  261. package/lib/query.js.map +0 -1
  262. package/lib/response-validation-strict.js.map +0 -1
  263. package/lib/response-validation.js.map +0 -1
  264. package/lib/retry-after.js.map +0 -1
  265. package/lib/retry.js.map +0 -1
  266. package/lib/schema-lite-impl.js.map +0 -1
  267. package/lib/schema-lite-typed.js.map +0 -1
  268. package/lib/schema-lite.js.map +0 -1
  269. package/lib/schema.js.map +0 -1
  270. package/lib/testing.d.ts +0 -40
  271. package/lib/testing.d.ts.map +0 -1
  272. package/lib/testing.js +0 -42
  273. package/lib/testing.js.map +0 -1
  274. package/lib/trait.js.map +0 -1
  275. package/lib/xml.js.map +0 -1
  276. package/src/codegen/boolean-string-enums.ts +0 -155
  277. package/src/codegen/chunk.ts +0 -147
  278. package/src/codegen/cli.ts +0 -293
  279. package/src/codegen/datafy.ts +0 -874
  280. package/src/codegen/dedupe.ts +0 -173
  281. package/src/codegen/emit.ts +0 -200
  282. package/src/codegen/format.ts +0 -49
  283. package/src/codegen/generated-at.ts +0 -88
  284. package/src/codegen/generator.ts +0 -1229
  285. package/src/codegen/graph.ts +0 -151
  286. package/src/codegen/graphql-client.ts +0 -545
  287. package/src/codegen/graphql.ts +0 -1145
  288. package/src/codegen/latin1.ts +0 -131
  289. package/src/codegen/members.ts +0 -79
  290. package/src/codegen/model-diff.ts +0 -67
  291. package/src/codegen/naming.ts +0 -85
  292. package/src/codegen/openapi-cli.ts +0 -141
  293. package/src/codegen/openapi.ts +0 -1845
  294. package/src/codegen/operations.ts +0 -73
  295. package/src/codegen/pagination.ts +0 -64
  296. package/src/codegen/patch-audit.ts +0 -480
  297. package/src/codegen/patches.ts +0 -581
  298. package/src/codegen/prelude.ts +0 -70
  299. package/src/codegen/privatize.ts +0 -200
  300. package/src/codegen/proto.ts +0 -1092
  301. package/src/codegen/pure.ts +0 -94
  302. package/src/codegen/rewrite-operation-ids.ts +0 -1219
  303. package/src/codegen/spec-path.ts +0 -112
  304. package/src/codegen/table.ts +0 -254
  305. package/src/json-patch.ts +0 -273
  306. package/src/testing.ts +0 -74
@@ -1,812 +1 @@
1
- import * as Headers from "effect/http/Headers";
2
- import * as HttpBody from "effect/http/HttpBody";
3
- import * as HttpClientRequest from "effect/http/HttpClientRequest";
4
- import { debugHttp } from "./debug.js";
5
- import { isOpaqueValue } from "./plain-values.js";
6
- import { bodySymbol, deepQuerySymbol, formDataFileSymbol, getErrorMatchers, headerSymbol, httpBodySymbol, httpSymbol, keyDictionarySymbol, labelSymbol, labelEncodingSymbol, querySymbol, stringEncodedSymbol, unionCasesSymbol, } from "./trait.js";
7
- //#region AST helpers (survive S.optional / Suspend / transforms)
8
- export const getProps = (ast) => {
9
- if (ast._tag === "Objects")
10
- return ast.propertySignatures;
11
- if (ast._tag === "Suspend")
12
- return getProps(ast.thunk());
13
- if (ast.encoding && ast.encoding.length > 0)
14
- return getProps(ast.encoding[0].to);
15
- return [];
16
- };
17
- export const getAnn = (ast, symbol) => {
18
- const direct = ast.annotations?.[symbol];
19
- if (direct !== undefined)
20
- return direct;
21
- if (ast._tag === "Suspend")
22
- return getAnn(ast.thunk(), symbol);
23
- if (ast.encoding && ast.encoding.length > 0)
24
- return getAnn(ast.encoding[0].to, symbol);
25
- // S.optional -> Union[self, Undefined]; descend into the single real member.
26
- if (ast._tag === "Union") {
27
- const real = ast.types.filter((t) => t._tag !== "Undefined" && !(t._tag === "Literal" && t.literal === null));
28
- if (real.length === 1)
29
- return getAnn(real[0], symbol);
30
- }
31
- return undefined;
32
- };
33
- export const getPropAnn = (prop, symbol) => getAnn(prop.type, symbol);
34
- export const hasPropAnn = (prop, symbol) => getPropAnn(prop, symbol) !== undefined;
35
- export const nameOf = (prop, symbol) => {
36
- const v = getPropAnn(prop, symbol);
37
- return typeof v === "string" ? v : String(prop.name);
38
- };
39
-
40
- export const resolveNode = (ast) => {
41
- if (ast._tag === "Suspend")
42
- return resolveNode(ast.thunk());
43
- if (ast.encoding && ast.encoding.length > 0)
44
- return resolveNode(ast.encoding[0].to);
45
- if (ast._tag === "Union") {
46
- const real = ast.types.filter((t) => t._tag !== "Undefined" &&
47
- t._tag !== "Null" &&
48
- !(t._tag === "Literal" && t.literal === null));
49
- if (real.length === 1)
50
- return resolveNode(real[0]);
51
- }
52
- return ast;
53
- };
54
- const noHeaderMembers = [];
55
- const headerMemberCache = /*@__PURE__*/ new WeakMap();
56
-
57
- export const responseHeaderMembers = (outputAst) => {
58
- let members = headerMemberCache.get(outputAst);
59
- if (members !== undefined)
60
- return members;
61
- const found = [];
62
- for (const prop of getProps(outputAst)) {
63
- if (!hasPropAnn(prop, headerSymbol))
64
- continue;
65
- found.push({
66
- key: String(prop.name),
67
- wire: nameOf(prop, headerSymbol).toLowerCase(),
68
- number: resolveNode(prop.type)._tag === "Number",
69
- });
70
- }
71
- members = found.length === 0 ? noHeaderMembers : found;
72
- headerMemberCache.set(outputAst, members);
73
- return members;
74
- };
75
-
76
-
77
-
78
-
79
-
80
-
81
- export const withResponseHeaders = (members, body, headers) => {
82
- if (members.length === 0 || body === null || typeof body !== "object" || Array.isArray(body)) {
83
- return body;
84
- }
85
- let result;
86
- for (const m of members) {
87
- const raw = headers[m.wire];
88
- if (raw === undefined)
89
- continue;
90
- result ??= { ...body };
91
- const parsed = m.number && raw.trim() !== "" ? Number(raw) : Number.NaN;
92
- result[m.key] = Number.isNaN(parsed) ? raw : parsed;
93
- }
94
- return result ?? body;
95
- };
96
- //#endregion
97
- //#region Recursive wire-name mapping
98
- export { isOpaqueValue };
99
-
100
-
101
-
102
-
103
-
104
- export const mapKeysByDictionary = (dict, value, direction) => {
105
- if (value === null || typeof value !== "object" || isOpaqueValue(value)) {
106
- return value;
107
- }
108
- if (Array.isArray(value)) {
109
- return value.map((v) => mapKeysByDictionary(dict, v, direction));
110
- }
111
- const rename = direction === "decode"
112
- ? Object.fromEntries(Object.entries(dict).flatMap(([ts, wire]) => typeof wire === "string" ? [[wire, ts]] : wire.map((w) => [w, ts])))
113
- : Object.fromEntries(Object.entries(dict).map(([ts, wire]) => [
114
- ts,
115
- typeof wire === "string" ? wire : wire[0],
116
- ]));
117
- const out = {};
118
- for (const [k, v] of Object.entries(value)) {
119
- if (v === undefined)
120
- continue;
121
- out[rename[k] ?? k] = mapKeysByDictionary(dict, v, direction);
122
- }
123
- return out;
124
- };
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
- const stringEncode = (value) => value === null ? null : Array.isArray(value) ? value.map(stringEncode) : String(value);
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
- export const mapsVerbatim = (root, direction) => {
148
- const cache = direction === "encode" ? verbatimEncode : verbatimDecode;
149
- let result = cache.get(root);
150
- if (result !== undefined)
151
- return result;
152
- result = true;
153
- const seen = new Set();
154
- const stack = [root];
155
- walk: while (stack.length > 0) {
156
- const ast = stack.pop();
157
- if (seen.has(ast))
158
- continue;
159
- seen.add(ast);
160
- if (getAnn(ast, keyDictionarySymbol) !== undefined) {
161
- result = false;
162
- break;
163
- }
164
- if (direction === "decode" && getAnn(ast, unionCasesSymbol) !== undefined) {
165
- result = false;
166
- break;
167
- }
168
- const node = resolveNode(ast);
169
- if (node._tag === "Union") {
170
- for (const t of node.types)
171
- stack.push(resolveNode(t));
172
- }
173
- else if (node._tag === "Arrays") {
174
- const elem = node.rest?.[0];
175
- if (elem)
176
- stack.push(elem);
177
- }
178
- else if (node._tag === "Objects") {
179
- for (const p of node.propertySignatures) {
180
- if (nameOf(p, bodySymbol) !== String(p.name) ||
181
- (direction === "encode" && hasPropAnn(p, stringEncodedSymbol))) {
182
- result = false;
183
- break walk;
184
- }
185
- stack.push(p.type);
186
- }
187
- for (const s of (node.indexSignatures ?? [])) {
188
- stack.push(s.type);
189
- }
190
- }
191
- }
192
- cache.set(root, result);
193
- return result;
194
- };
195
- const verbatimEncode = /*@__PURE__*/ new WeakMap();
196
- const verbatimDecode = /*@__PURE__*/ new WeakMap();
197
- export const mapKeys = (ast, value, direction, fallback) => {
198
- if (value === null || value === undefined || typeof value !== "object" || isOpaqueValue(value)) {
199
- return value;
200
- }
201
- const dict = getAnn(ast, keyDictionarySymbol) ?? fallback;
202
- // Discriminated union whose cases the API returns merged (every case's
203
- // keys present, `null` for the inactive ones). Map wire names, then keep
204
- // only the active case's keys. The case is read off the union's
205
- // discriminator when it has one -- cases that share a key set (every
206
- // resource kind of `resource_tagging`, every page-rule action) are
207
- // indistinguishable by keys alone. Without one, a case does NOT need every
208
- // key present -- arms carry optional members the wire may omit -- so the
209
- // active case is the one that best EXPLAINS the value: most present,
210
- // non-null keys covered, minus present keys the case cannot explain (ties
211
- // break by coverage, then declaration order).
212
- const unionCases = getAnn(ast, unionCasesSymbol);
213
- if (unionCases && direction === "decode" && !Array.isArray(value)) {
214
- const obj = (dict ? mapKeysByDictionary(dict, value, "decode") : value);
215
- const present = Object.keys(obj).filter((k) => obj[k] !== undefined && obj[k] !== null);
216
- const disc = unionCases.discriminator;
217
- const tag = disc ? obj[disc.key] : undefined;
218
- const tagged = typeof tag === "string" ? disc.values.indexOf(tag) : -1;
219
- let best;
220
- if (tagged >= 0) {
221
- best = { keys: unionCases.cases[tagged], score: 0, matched: 0 };
222
- }
223
- else {
224
- for (const keys of unionCases.cases) {
225
- const set = new Set(keys);
226
- let matched = 0;
227
- let excess = 0;
228
- for (const k of present) {
229
- if (set.has(k))
230
- matched++;
231
- else
232
- excess++;
233
- }
234
- const score = matched - excess;
235
- if (matched > 0 &&
236
- (!best || score > best.score || (score === best.score && matched > best.matched))) {
237
- best = { keys, score, matched };
238
- }
239
- }
240
- }
241
- if (best) {
242
- const out = {};
243
- for (const k of best.keys)
244
- out[k] = obj[k];
245
- return out;
246
- }
247
- return obj;
248
- }
249
- const node = resolveNode(ast);
250
- // Schema-level union member (a merged response struct whose arms disagree
251
- // on a member's type -- see the codegen's response-union merge): pick the
252
- // arm that explains the value best and map with it. Object values score
253
- // arms by how many of their declared keys are present; array values take
254
- // the first array arm. Anything unmatched deep-renames via the dictionary
255
- // fallback, like other opaque content. (Single-real-member unions --
256
- // optional/null wrappers -- were already collapsed by resolveNode; the
257
- // opaque `T.UnionCases` mechanism never produces a Union node and is
258
- // handled above.)
259
- if (node._tag === "Union") {
260
- const arms = node.types.map(resolveNode);
261
- if (Array.isArray(value)) {
262
- const arr = arms.find((t) => t._tag === "Arrays");
263
- if (arr)
264
- return mapKeys(arr, value, direction, dict);
265
- }
266
- else {
267
- let best;
268
- let bestScore = 0;
269
- for (const t of arms) {
270
- if (t._tag !== "Objects")
271
- continue;
272
- let score = 0;
273
- for (const p of t.propertySignatures) {
274
- const from = direction === "encode" ? String(p.name) : nameOf(p, bodySymbol);
275
- if (value[from] !== undefined)
276
- score++;
277
- }
278
- if (score > bestScore) {
279
- best = t;
280
- bestScore = score;
281
- }
282
- }
283
- if (best)
284
- return mapKeys(best, value, direction, dict);
285
- }
286
- return dict ? mapKeysByDictionary(dict, value, direction) : value;
287
- }
288
- if (node._tag === "Arrays") {
289
- if (!Array.isArray(value))
290
- return value;
291
- const elem = node.rest?.[0];
292
- return elem
293
- ? value.map((v) => mapKeys(elem, v, direction, dict))
294
- : dict
295
- ? mapKeysByDictionary(dict, value, direction)
296
- : value;
297
- }
298
- if (node._tag === "Objects" && !Array.isArray(value)) {
299
- const props = node.propertySignatures;
300
- const isigs = node.indexSignatures;
301
- if (props.length === 0 && !(isigs && isigs.length)) {
302
- // opaque object -- dictionary fallback or verbatim
303
- return dict ? mapKeysByDictionary(dict, value, direction) : value;
304
- }
305
- const out = {};
306
- const consumed = new Set();
307
- for (const p of props) {
308
- const tsName = String(p.name);
309
- const wire = nameOf(p, bodySymbol);
310
- const from = direction === "encode" ? tsName : wire;
311
- const to = direction === "encode" ? wire : tsName;
312
- consumed.add(from);
313
- const v = value[from];
314
- if (v === undefined)
315
- continue;
316
- // A `StringEncoded()` member nested in a body struct (e.g. Azure's
317
- // `hardwareProfile.dynamicMemoryEnabled`) stringifies here -- the
318
- // top-level pass in `buildRequest` only sees the outermost member.
319
- out[to] =
320
- direction === "encode" && hasPropAnn(p, stringEncodedSymbol)
321
- ? stringEncode(v)
322
- : mapKeys(p.type, v, direction, dict);
323
- }
324
- for (const [k, v] of Object.entries(value)) {
325
- if (consumed.has(k) || v === undefined)
326
- continue;
327
- const renamed = dict
328
- ? direction === "encode"
329
- ? (dict[k] ?? k)
330
- : (Object.entries(dict).find(([, w]) => w === k)?.[0] ?? k)
331
- : k;
332
- out[typeof renamed === "string" ? renamed : renamed[0]] =
333
- isigs && isigs.length
334
- ? mapKeys(isigs[0].type, v, direction, dict)
335
- : dict
336
- ? mapKeysByDictionary(dict, v, direction)
337
- : v;
338
- }
339
- return out;
340
- }
341
- // Scalar-typed schema node holding object content (spec drift) --
342
- // dictionary fallback or verbatim.
343
- return dict ? mapKeysByDictionary(dict, value, direction) : value;
344
- };
345
- //#endregion
346
- //#region Request building
347
- const BODYLESS = /*@__PURE__*/ new Set(["GET", "HEAD"]);
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
- const appendQuery = (query, name, value) => {
359
- if (Array.isArray(value)) {
360
- for (const v of value)
361
- appendQuery(query, name, v);
362
- }
363
- else if (value !== null && typeof value === "object" && !(value instanceof Date)) {
364
- for (const [k, v] of Object.entries(value)) {
365
- if (v !== undefined)
366
- appendQuery(query, `${name}.${k}`, v);
367
- }
368
- }
369
- else {
370
- query.append(name, String(value));
371
- }
372
- };
373
-
374
-
375
-
376
-
377
-
378
-
379
- export const encodeGreedyLabel = (value) => value.replace(/^\/+/, "").split("/").map(encodeURIComponent).join("/");
380
-
381
-
382
-
383
-
384
-
385
- const flattenToFormPairs = (obj, prefix = "") => {
386
- const pairs = [];
387
- for (const [key, value] of Object.entries(obj)) {
388
- if (value === undefined || value === null)
389
- continue;
390
- const fullKey = prefix ? `${prefix}[${key}]` : key;
391
- if (Array.isArray(value)) {
392
- for (let i = 0; i < value.length; i++) {
393
- const item = value[i];
394
- if (item === undefined || item === null)
395
- continue;
396
- if (typeof item === "object" && !Array.isArray(item)) {
397
- pairs.push(...flattenToFormPairs(item, `${fullKey}[${i}]`));
398
- }
399
- else {
400
- pairs.push([`${fullKey}[${i}]`, String(item)]);
401
- }
402
- }
403
- }
404
- else if (typeof value === "object") {
405
- pairs.push(...flattenToFormPairs(value, fullKey));
406
- }
407
- else {
408
- pairs.push([fullKey, String(value)]);
409
- }
410
- }
411
- return pairs;
412
- };
413
- const plans = /*@__PURE__*/ new WeakMap();
414
- const planFor = (inputAst) => {
415
- let plan = plans.get(inputAst);
416
- if (plan !== undefined)
417
- return plan;
418
- const http = getAnn(inputAst, httpSymbol);
419
- if (!http) {
420
- throw new Error("operation input is missing the Http() trait");
421
- }
422
- const rootDict = getAnn(inputAst, keyDictionarySymbol);
423
- const members = [];
424
- const known = new Set();
425
- let hasBodyMembers = false;
426
- for (const prop of getProps(inputAst)) {
427
- const key = String(prop.name);
428
- known.add(key);
429
- let bind;
430
- let name;
431
- let greedy = false;
432
- if (hasPropAnn(prop, labelSymbol)) {
433
- bind = "label";
434
- name = nameOf(prop, labelSymbol);
435
- greedy = http.uri.includes(`{${name}+}`);
436
- }
437
- else if (hasPropAnn(prop, headerSymbol)) {
438
- bind = "header";
439
- name = nameOf(prop, headerSymbol).toLowerCase();
440
- }
441
- else if (hasPropAnn(prop, querySymbol)) {
442
- bind = "query";
443
- name = nameOf(prop, querySymbol);
444
- }
445
- else if (hasPropAnn(prop, deepQuerySymbol)) {
446
- bind = "deepQuery";
447
- name = nameOf(prop, deepQuerySymbol);
448
- }
449
- else {
450
- hasBodyMembers = true;
451
- bind = hasPropAnn(prop, formDataFileSymbol)
452
- ? "file"
453
- : hasPropAnn(prop, httpBodySymbol)
454
- ? "httpBody"
455
- : "body";
456
- name = nameOf(prop, bodySymbol);
457
- }
458
- const preserve = getPropAnn(prop, labelEncodingSymbol);
459
- members.push({
460
- key,
461
- bind,
462
- name,
463
- type: prop.type,
464
- preserve: typeof preserve === "string" ? preserve : undefined,
465
- greedy,
466
- stringEncoded: hasPropAnn(prop, stringEncodedSymbol),
467
- verbatim: rootDict === undefined && mapsVerbatim(prop.type, "encode"),
468
- });
469
- }
470
- plan = { http, rootDict, members, known, hasBodyMembers };
471
- plans.set(inputAst, plan);
472
- return plan;
473
- };
474
- const emptyRequest = /*@__PURE__*/ HttpClientRequest.get("");
475
-
476
-
477
-
478
-
479
-
480
- export const makeRequest = (method, url, headers) => HttpClientRequest.makeWith(method, url, emptyRequest.urlParams, emptyRequest.hash, Headers.fromInput(headers), HttpBody.empty);
481
-
482
-
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
- export const buildRequest = ({ input, inputAst, baseUrl, headers: baseHeaders, mapMemberHeader, unknownKeyToWire, }) => {
499
- const inputObj = (input ?? {});
500
- const plan = planFor(inputAst);
501
- const { http, rootDict, members, known } = plan;
502
- let hasBodyMembers = plan.hasBodyMembers;
503
- const headers = { ...baseHeaders };
504
- const body = {};
505
- let bodyKeys = 0;
506
- let rawBody; // whole-body member (T.HttpBody) -- sent as-is
507
- let files;
508
- let query;
509
- let uri = http.uri;
510
- // Value of a modeled `Content-Type` header member, e.g. R2 putObject's
511
- // `contentType`. A raw body is sent under it (see below).
512
- let memberContentType;
513
- for (let i = 0; i < members.length; i++) {
514
- const m = members[i];
515
- const value = inputObj[m.key];
516
- if (value === undefined)
517
- continue;
518
- switch (m.bind) {
519
- case "label": {
520
- // The URL parser resolves a `.` or `..` segment, percent-encoded or
521
- // not, so no encoding can carry one: it would address another path
522
- // (`/projects/p1/branches/..` -> `/projects/p1/`). A greedy label keeps
523
- // its `/`, so each of its segments counts.
524
- if ((m.greedy ? String(value).split("/") : [String(value)]).some((s) => s === "." || s === "..")) {
525
- throw new Error(`invalid value for input HTTP label: ${m.key}`);
526
- }
527
- const encoded = encodeURIComponent(String(value));
528
- const preserve = m.preserve;
529
- const label = preserve !== undefined
530
- ? encoded.replace(/%[0-9A-F]{2}/g, (escape) => {
531
- const character = String.fromCharCode(Number.parseInt(escape.slice(1), 16));
532
- return preserve.includes(character) ? character : escape;
533
- })
534
- : encoded;
535
- uri = m.greedy
536
- ? uri.replace(`{${m.name}+}`, () => encodeGreedyLabel(String(value)))
537
- : uri.replace(`{${m.name}}`, () => label);
538
- break;
539
- }
540
- case "header": {
541
- const hVal = String(value);
542
- headers[m.name] = mapMemberHeader ? mapMemberHeader(m.name, hVal) : hVal;
543
- if (m.name === "content-type")
544
- memberContentType = headers[m.name];
545
- break;
546
- }
547
- case "query":
548
- appendQuery((query ??= new URLSearchParams()), m.name, value);
549
- break;
550
- case "deepQuery": {
551
- // Deep-object query member (T.DeepQuery): a nested struct expands into
552
- // dotted query keys (`account.id=...`) under the member's wire name.
553
- // Wire-name the nested content via the schema first, skip null/
554
- // undefined entries; deeper nesting recurses through appendQuery.
555
- const mapped = m.verbatim ? value : mapKeys(m.type, value, "encode", rootDict);
556
- if (mapped !== null && typeof mapped === "object") {
557
- for (const [k, v] of Object.entries(mapped)) {
558
- if (v !== undefined && v !== null) {
559
- appendQuery((query ??= new URLSearchParams()), `${m.name}.${k}`, v);
560
- }
561
- }
562
- }
563
- break;
564
- }
565
- case "file":
566
- files ??= [];
567
- for (const f of Array.isArray(value) ? value : [value]) {
568
- files.push(f);
569
- }
570
- break;
571
- case "httpBody":
572
- rawBody = m.verbatim ? value : mapKeys(m.type, value, "encode", rootDict);
573
- break;
574
- default:
575
- // T.StringEncoded(): the API takes this member's value only as its
576
- // string spelling (`true` -> `"true"`), while the TS surface keeps the
577
- // natural type. Explicit here so a JSON body carries the string too,
578
- // rather than relying on the multipart encoder's own `String()`.
579
- body[m.name] = m.stringEncoded
580
- ? stringEncode(value)
581
- : m.verbatim
582
- ? value
583
- : mapKeys(m.type, value, "encode", rootDict);
584
- bodyKeys++;
585
- }
586
- }
587
- // Input keys the schema doesn't know pass through as body fields -- the
588
- // generated schemas can lag the real API, and silently dropping them
589
- // would break working callers. The key dictionary maps them when it knows
590
- // the key, otherwise `unknownKeyToWire` decides the wire name.
591
- for (const key in inputObj) {
592
- if (known.has(key) || !Object.hasOwn(inputObj, key))
593
- continue;
594
- const value = inputObj[key];
595
- if (value === undefined)
596
- continue;
597
- const wire = rootDict?.[key] ?? (unknownKeyToWire ? unknownKeyToWire(key) : key);
598
- body[typeof wire === "string" ? wire : wire[0]] = rootDict
599
- ? mapKeysByDictionary(rootDict, value, "encode")
600
- : value;
601
- bodyKeys++;
602
- hasBodyMembers = true;
603
- }
604
- const qs = query === undefined ? "" : query.toString();
605
- const url = qs ? `${baseUrl}${uri}?${qs}` : `${baseUrl}${uri}`;
606
- if (debugHttp()) {
607
- console.error(`[distilled] -> ${http.method} ${http.uri}`);
608
- }
609
- const request = makeRequest(http.method, url, headers);
610
- const bodied = !BODYLESS.has(http.method);
611
- if (http.contentType === "multipart") {
612
- // Multipart upload: each body member is a form part (objects
613
- // JSON-encoded under their wire name), each file appends under its own
614
- // filename. A whole-body member (T.HttpBody) that is a record of files
615
- // becomes one part per entry (e.g. asset upload: { <hash>: File }).
616
- // Files and byte buffers become binary parts; objects become JSON parts.
617
- const form = new FormData();
618
- const parts = rawBody !== undefined && typeof rawBody === "object"
619
- ? rawBody
620
- : body;
621
- const isFileOrBlob = (v) => v instanceof Blob || v instanceof File;
622
- for (const [key, value] of Object.entries(parts)) {
623
- if (value === undefined || value === null)
624
- continue;
625
- if (isFileOrBlob(value)) {
626
- form.append(key, value, value instanceof File ? value.name : key);
627
- }
628
- else if (value instanceof Uint8Array || value instanceof ArrayBuffer) {
629
- const bytes = value instanceof Uint8Array ? new Uint8Array(value).buffer : value;
630
- form.append(key, new Blob([bytes]), key);
631
- }
632
- else if (Array.isArray(value) && value.length > 0 && isFileOrBlob(value[0])) {
633
- for (const file of value) {
634
- if (isFileOrBlob(file)) {
635
- form.append(file instanceof File ? file.name : key, file, file instanceof File ? file.name : undefined);
636
- }
637
- }
638
- }
639
- else if (typeof value === "object") {
640
- form.append(key, JSON.stringify(value));
641
- }
642
- else {
643
- form.append(key, String(value));
644
- }
645
- }
646
- for (const f of files ?? []) {
647
- const filename = f.name ?? "file";
648
- form.append(filename, f, filename);
649
- }
650
- return HttpClientRequest.setBody(request, HttpBody.formData(form));
651
- }
652
- if (http.contentType === "form-urlencoded" && bodied) {
653
- // application/x-www-form-urlencoded with Stripe-style deepObject bracket
654
- // notation: { shipping: { address: { city } } } -> shipping[address][city],
655
- // arrays indexed ({ expand: ["a"] } -> expand[0]=a).
656
- const source = rawBody !== undefined && typeof rawBody === "object"
657
- ? rawBody
658
- : body;
659
- const params = new URLSearchParams();
660
- for (const [k, v] of flattenToFormPairs(source))
661
- params.append(k, v);
662
- return HttpClientRequest.setBody(request, HttpBody.text(params.toString(), "application/x-www-form-urlencoded"));
663
- }
664
- if (rawBody !== undefined && bodied) {
665
- // Whole-body member (raw arrays/scalars) -- sent as the body itself.
666
- // Binary payloads (Blob / ArrayBuffer / Uint8Array) send verbatim
667
- // (raw object uploads). With a bodyMediaType, the member is a
668
- // preserialized payload (string / bytes) sent verbatim; otherwise it's
669
- // JSON.
670
- //
671
- // `setBody` overwrites the Content-Type header with the body's media
672
- // type (and removes it when that is undefined), so the body carries the
673
- // modeled Content-Type member when the caller set one, else the declared
674
- // bodyMediaType (e.g. application/x-ndjson for Vectorize insert/upsert).
675
- const mediaType = memberContentType ?? http.bodyMediaType;
676
- if (rawBody instanceof Blob || rawBody instanceof ArrayBuffer) {
677
- // With no media type at all, fetch falls back to the Blob's own type.
678
- return HttpClientRequest.setBody(request, HttpBody.raw(rawBody, { contentType: mediaType }));
679
- }
680
- if (rawBody instanceof Uint8Array) {
681
- return HttpClientRequest.setBody(request, HttpBody.uint8Array(rawBody, mediaType));
682
- }
683
- if (http.bodyMediaType) {
684
- return HttpClientRequest.setBody(request, typeof rawBody === "string"
685
- ? HttpBody.text(rawBody, mediaType)
686
- : HttpBody.uint8Array(rawBody, mediaType));
687
- }
688
- return HttpClientRequest.setBody(request, HttpBody.jsonUnsafe(rawBody));
689
- }
690
- if (
691
- // A GET/HEAD sends a body only when body members actually carry values.
692
- // Some APIs really do document GET-with-body: MongoDB Atlas's
693
- // `.../lineItems:search` declares a `requestBody` on `get`, and AWS EFS's
694
- // DescribeAccountPreferences takes `{ MaxResults, NextToken }` on a GET.
695
- // Suppressing it outright dropped those members silently -- the request
696
- // succeeded, unfiltered, with nothing on the wire to show why.
697
- //
698
- // The `{}`-when-empty rule below stays limited to methods that expect a
699
- // body, so a bodyless method with nothing set still sends nothing.
700
- bodyKeys > 0 ||
701
- (hasBodyMembers && bodied && http.method !== "DELETE")) {
702
- // Send `{}` rather than no body when the schema declares body members --
703
- // some endpoints reject a missing JSON body outright.
704
- return HttpClientRequest.setBody(request, HttpBody.jsonUnsafe(body));
705
- }
706
- return request;
707
- };
708
- const matchesText = (matcher, value) => {
709
- if (typeof value !== "string")
710
- return false;
711
- if (typeof matcher === "string")
712
- return matcher === value;
713
- const { includes, matches } = matcher;
714
- return ((includes !== undefined || matches !== undefined) &&
715
- (includes === undefined || value.includes(includes)) &&
716
- (matches === undefined || new RegExp(matches).test(value)));
717
- };
718
- // Own properties only: inherited properties are not JSON response members.
719
- const atPointer = (body, pointer) => {
720
- if (pointer === "")
721
- return body;
722
- if (!pointer.startsWith("/") || /~(?![01])/u.test(pointer))
723
- return undefined;
724
- let value = body;
725
- for (const segment of pointer.slice(1).split("/")) {
726
- const key = segment.replace(/~1/g, "/").replace(/~0/g, "~");
727
- if (value === null ||
728
- typeof value !== "object" ||
729
- !Object.hasOwn(value, key) ||
730
- (Array.isArray(value) && !/^(0|[1-9][0-9]*)$/.test(key)))
731
- return undefined;
732
- value = value[key];
733
- }
734
- return value;
735
- };
736
- const matcherSpecificity = (m) => (m.code !== undefined ? 1 : 0) +
737
- (m.status !== undefined ? 1 : 0) +
738
- (m.message !== undefined ? 1 : 0) +
739
- (m.body === undefined ? 0 : Object.keys(m.body).length) +
740
- (m.headers === undefined ? 0 : Object.keys(m.headers).length);
741
-
742
- export const matchesExpression = (m, code, status, message, response = {}) => {
743
- if (m.code === undefined &&
744
- m.status === undefined &&
745
- m.message === undefined &&
746
- matcherSpecificity(m) === 0)
747
- return false;
748
- if (m.code !== undefined && m.code !== code)
749
- return false;
750
- if (m.status !== undefined && m.status !== status)
751
- return false;
752
- if (m.message !== undefined && !matchesText(m.message, message))
753
- return false;
754
- if (m.body !== undefined) {
755
- for (const [pointer, expected] of Object.entries(m.body)) {
756
- const actual = atPointer(response.body, pointer);
757
- if (typeof expected === "string" || (expected !== null && typeof expected === "object")) {
758
- if (!matchesText(expected, actual))
759
- return false;
760
- }
761
- else if (actual !== expected)
762
- return false;
763
- }
764
- }
765
- if (m.headers !== undefined) {
766
- for (const [name, expected] of Object.entries(m.headers)) {
767
- if (response.headers === undefined)
768
- return false;
769
- const actual = Object.entries(response.headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
770
- if (!matchesText(expected, actual))
771
- return false;
772
- }
773
- }
774
- return true;
775
- };
776
-
777
-
778
-
779
-
780
-
781
-
782
-
783
-
784
- export const matchTypedError = (errorClasses, status, errors, response = {}) => {
785
- let best;
786
- const wireErrors = errors.length > 0 ? errors : [{ message: `HTTP ${status}` }];
787
- for (const cls of errorClasses) {
788
- const matchers = getErrorMatchers(cls);
789
- if (!matchers)
790
- continue;
791
- for (const m of matchers) {
792
- for (const e of wireErrors) {
793
- if (!matchesExpression(m, e.code, status, e.message, response))
794
- continue;
795
- const specificity = matcherSpecificity(m);
796
- if (!best || specificity > best.specificity) {
797
- best = { cls, specificity, code: e.code, message: e.message };
798
- }
799
- }
800
- }
801
- }
802
- if (!best)
803
- return undefined;
804
- return new best.cls({
805
- code: best.code ?? 0,
806
- message: best.message,
807
- body: response.body,
808
- headers: response.headers,
809
- });
810
- };
811
- //#endregion
812
- //# sourceMappingURL=protocol-http.js.map
1
+ export { protocol_http$InvalidInput as InvalidInput, protocol_http$buildRequest as buildRequest, protocol_http$encodeGreedyLabel as encodeGreedyLabel, protocol_http$getAnn as getAnn, protocol_http$getPropAnn as getPropAnn, protocol_http$getProps as getProps, protocol_http$hasPropAnn as hasPropAnn, protocol_http$invalidLabel as invalidLabel, protocol_http$isOpaqueValue as isOpaqueValue, protocol_http$makeRequest as makeRequest, protocol_http$mapKeys as mapKeys, protocol_http$mapKeysByDictionary as mapKeysByDictionary, protocol_http$mapsVerbatim as mapsVerbatim, protocol_http$matchTypedError as matchTypedError, protocol_http$matchesExpression as matchesExpression, protocol_http$nameOf as nameOf, protocol_http$resolveNode as resolveNode, protocol_http$responseHeaderMembers as responseHeaderMembers, protocol_http$withResponseHeaders as withResponseHeaders } from "./_bundle/rest.js";