@stainlessdev/xray 0.5.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.
Files changed (390) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/LICENSE +201 -0
  3. package/README.md +401 -0
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +181 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +181 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +477 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +473 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/pagination.d.mts +57 -0
  37. package/core/pagination.d.mts.map +1 -0
  38. package/core/pagination.d.ts +57 -0
  39. package/core/pagination.d.ts.map +1 -0
  40. package/core/pagination.js +108 -0
  41. package/core/pagination.js.map +1 -0
  42. package/core/pagination.mjs +102 -0
  43. package/core/pagination.mjs.map +1 -0
  44. package/core/resource.d.mts +6 -0
  45. package/core/resource.d.mts.map +1 -0
  46. package/core/resource.d.ts +6 -0
  47. package/core/resource.d.ts.map +1 -0
  48. package/core/resource.js +11 -0
  49. package/core/resource.js.map +1 -0
  50. package/core/resource.mjs +7 -0
  51. package/core/resource.mjs.map +1 -0
  52. package/core/uploads.d.mts +3 -0
  53. package/core/uploads.d.mts.map +1 -0
  54. package/core/uploads.d.ts +3 -0
  55. package/core/uploads.d.ts.map +1 -0
  56. package/core/uploads.js +6 -0
  57. package/core/uploads.js.map +1 -0
  58. package/core/uploads.mjs +2 -0
  59. package/core/uploads.mjs.map +1 -0
  60. package/error.d.mts +2 -0
  61. package/error.d.mts.map +1 -0
  62. package/error.d.ts +2 -0
  63. package/error.d.ts.map +1 -0
  64. package/error.js +6 -0
  65. package/error.js.map +1 -0
  66. package/error.mjs +2 -0
  67. package/error.mjs.map +1 -0
  68. package/index.d.mts +7 -0
  69. package/index.d.mts.map +1 -0
  70. package/index.d.ts +7 -0
  71. package/index.d.ts.map +1 -0
  72. package/index.js +32 -0
  73. package/index.js.map +1 -0
  74. package/index.mjs +8 -0
  75. package/index.mjs.map +1 -0
  76. package/internal/builtin-types.d.mts +73 -0
  77. package/internal/builtin-types.d.mts.map +1 -0
  78. package/internal/builtin-types.d.ts +73 -0
  79. package/internal/builtin-types.d.ts.map +1 -0
  80. package/internal/builtin-types.js +4 -0
  81. package/internal/builtin-types.js.map +1 -0
  82. package/internal/builtin-types.mjs +3 -0
  83. package/internal/builtin-types.mjs.map +1 -0
  84. package/internal/detect-platform.d.mts +15 -0
  85. package/internal/detect-platform.d.mts.map +1 -0
  86. package/internal/detect-platform.d.ts +15 -0
  87. package/internal/detect-platform.d.ts.map +1 -0
  88. package/internal/detect-platform.js +162 -0
  89. package/internal/detect-platform.js.map +1 -0
  90. package/internal/detect-platform.mjs +157 -0
  91. package/internal/detect-platform.mjs.map +1 -0
  92. package/internal/errors.d.mts +3 -0
  93. package/internal/errors.d.mts.map +1 -0
  94. package/internal/errors.d.ts +3 -0
  95. package/internal/errors.d.ts.map +1 -0
  96. package/internal/errors.js +41 -0
  97. package/internal/errors.js.map +1 -0
  98. package/internal/errors.mjs +36 -0
  99. package/internal/errors.mjs.map +1 -0
  100. package/internal/headers.d.mts +20 -0
  101. package/internal/headers.d.mts.map +1 -0
  102. package/internal/headers.d.ts +20 -0
  103. package/internal/headers.d.ts.map +1 -0
  104. package/internal/headers.js +79 -0
  105. package/internal/headers.js.map +1 -0
  106. package/internal/headers.mjs +74 -0
  107. package/internal/headers.mjs.map +1 -0
  108. package/internal/parse.d.mts +12 -0
  109. package/internal/parse.d.mts.map +1 -0
  110. package/internal/parse.d.ts +12 -0
  111. package/internal/parse.d.ts.map +1 -0
  112. package/internal/parse.js +40 -0
  113. package/internal/parse.js.map +1 -0
  114. package/internal/parse.mjs +37 -0
  115. package/internal/parse.mjs.map +1 -0
  116. package/internal/qs/formats.d.mts +7 -0
  117. package/internal/qs/formats.d.mts.map +1 -0
  118. package/internal/qs/formats.d.ts +7 -0
  119. package/internal/qs/formats.d.ts.map +1 -0
  120. package/internal/qs/formats.js +13 -0
  121. package/internal/qs/formats.js.map +1 -0
  122. package/internal/qs/formats.mjs +9 -0
  123. package/internal/qs/formats.mjs.map +1 -0
  124. package/internal/qs/index.d.mts +10 -0
  125. package/internal/qs/index.d.mts.map +1 -0
  126. package/internal/qs/index.d.ts +10 -0
  127. package/internal/qs/index.d.ts.map +1 -0
  128. package/internal/qs/index.js +14 -0
  129. package/internal/qs/index.js.map +1 -0
  130. package/internal/qs/index.mjs +10 -0
  131. package/internal/qs/index.mjs.map +1 -0
  132. package/internal/qs/stringify.d.mts +3 -0
  133. package/internal/qs/stringify.d.mts.map +1 -0
  134. package/internal/qs/stringify.d.ts +3 -0
  135. package/internal/qs/stringify.d.ts.map +1 -0
  136. package/internal/qs/stringify.js +277 -0
  137. package/internal/qs/stringify.js.map +1 -0
  138. package/internal/qs/stringify.mjs +274 -0
  139. package/internal/qs/stringify.mjs.map +1 -0
  140. package/internal/qs/types.d.mts +57 -0
  141. package/internal/qs/types.d.mts.map +1 -0
  142. package/internal/qs/types.d.ts +57 -0
  143. package/internal/qs/types.d.ts.map +1 -0
  144. package/internal/qs/types.js +3 -0
  145. package/internal/qs/types.js.map +1 -0
  146. package/internal/qs/types.mjs +2 -0
  147. package/internal/qs/types.mjs.map +1 -0
  148. package/internal/qs/utils.d.mts +15 -0
  149. package/internal/qs/utils.d.mts.map +1 -0
  150. package/internal/qs/utils.d.ts +15 -0
  151. package/internal/qs/utils.d.ts.map +1 -0
  152. package/internal/qs/utils.js +230 -0
  153. package/internal/qs/utils.js.map +1 -0
  154. package/internal/qs/utils.mjs +217 -0
  155. package/internal/qs/utils.mjs.map +1 -0
  156. package/internal/request-options.d.mts +75 -0
  157. package/internal/request-options.d.mts.map +1 -0
  158. package/internal/request-options.d.ts +75 -0
  159. package/internal/request-options.d.ts.map +1 -0
  160. package/internal/request-options.js +14 -0
  161. package/internal/request-options.js.map +1 -0
  162. package/internal/request-options.mjs +10 -0
  163. package/internal/request-options.mjs.map +1 -0
  164. package/internal/shim-types.d.mts +17 -0
  165. package/internal/shim-types.d.mts.map +1 -0
  166. package/internal/shim-types.d.ts +17 -0
  167. package/internal/shim-types.d.ts.map +1 -0
  168. package/internal/shim-types.js +4 -0
  169. package/internal/shim-types.js.map +1 -0
  170. package/internal/shim-types.mjs +3 -0
  171. package/internal/shim-types.mjs.map +1 -0
  172. package/internal/shims.d.mts +20 -0
  173. package/internal/shims.d.mts.map +1 -0
  174. package/internal/shims.d.ts +20 -0
  175. package/internal/shims.d.ts.map +1 -0
  176. package/internal/shims.js +92 -0
  177. package/internal/shims.js.map +1 -0
  178. package/internal/shims.mjs +85 -0
  179. package/internal/shims.mjs.map +1 -0
  180. package/internal/to-file.d.mts +45 -0
  181. package/internal/to-file.d.mts.map +1 -0
  182. package/internal/to-file.d.ts +45 -0
  183. package/internal/to-file.d.ts.map +1 -0
  184. package/internal/to-file.js +91 -0
  185. package/internal/to-file.js.map +1 -0
  186. package/internal/to-file.mjs +88 -0
  187. package/internal/to-file.mjs.map +1 -0
  188. package/internal/tslib.js +81 -0
  189. package/internal/tslib.mjs +17 -0
  190. package/internal/types.d.mts +69 -0
  191. package/internal/types.d.mts.map +1 -0
  192. package/internal/types.d.ts +69 -0
  193. package/internal/types.d.ts.map +1 -0
  194. package/internal/types.js +4 -0
  195. package/internal/types.js.map +1 -0
  196. package/internal/types.mjs +3 -0
  197. package/internal/types.mjs.map +1 -0
  198. package/internal/uploads.d.mts +42 -0
  199. package/internal/uploads.d.mts.map +1 -0
  200. package/internal/uploads.d.ts +42 -0
  201. package/internal/uploads.d.ts.map +1 -0
  202. package/internal/uploads.js +141 -0
  203. package/internal/uploads.js.map +1 -0
  204. package/internal/uploads.mjs +131 -0
  205. package/internal/uploads.mjs.map +1 -0
  206. package/internal/utils/base64.d.mts +3 -0
  207. package/internal/utils/base64.d.mts.map +1 -0
  208. package/internal/utils/base64.d.ts +3 -0
  209. package/internal/utils/base64.d.ts.map +1 -0
  210. package/internal/utils/base64.js +38 -0
  211. package/internal/utils/base64.js.map +1 -0
  212. package/internal/utils/base64.mjs +33 -0
  213. package/internal/utils/base64.mjs.map +1 -0
  214. package/internal/utils/bytes.d.mts +4 -0
  215. package/internal/utils/bytes.d.mts.map +1 -0
  216. package/internal/utils/bytes.d.ts +4 -0
  217. package/internal/utils/bytes.d.ts.map +1 -0
  218. package/internal/utils/bytes.js +31 -0
  219. package/internal/utils/bytes.js.map +1 -0
  220. package/internal/utils/bytes.mjs +26 -0
  221. package/internal/utils/bytes.mjs.map +1 -0
  222. package/internal/utils/env.d.mts +9 -0
  223. package/internal/utils/env.d.mts.map +1 -0
  224. package/internal/utils/env.d.ts +9 -0
  225. package/internal/utils/env.d.ts.map +1 -0
  226. package/internal/utils/env.js +22 -0
  227. package/internal/utils/env.js.map +1 -0
  228. package/internal/utils/env.mjs +18 -0
  229. package/internal/utils/env.mjs.map +1 -0
  230. package/internal/utils/log.d.mts +37 -0
  231. package/internal/utils/log.d.mts.map +1 -0
  232. package/internal/utils/log.d.ts +37 -0
  233. package/internal/utils/log.d.ts.map +1 -0
  234. package/internal/utils/log.js +85 -0
  235. package/internal/utils/log.js.map +1 -0
  236. package/internal/utils/log.mjs +79 -0
  237. package/internal/utils/log.mjs.map +1 -0
  238. package/internal/utils/path.d.mts +15 -0
  239. package/internal/utils/path.d.mts.map +1 -0
  240. package/internal/utils/path.d.ts +15 -0
  241. package/internal/utils/path.d.ts.map +1 -0
  242. package/internal/utils/path.js +79 -0
  243. package/internal/utils/path.js.map +1 -0
  244. package/internal/utils/path.mjs +74 -0
  245. package/internal/utils/path.mjs.map +1 -0
  246. package/internal/utils/query.d.mts +2 -0
  247. package/internal/utils/query.d.mts.map +1 -0
  248. package/internal/utils/query.d.ts +2 -0
  249. package/internal/utils/query.d.ts.map +1 -0
  250. package/internal/utils/query.js +10 -0
  251. package/internal/utils/query.js.map +1 -0
  252. package/internal/utils/query.mjs +6 -0
  253. package/internal/utils/query.mjs.map +1 -0
  254. package/internal/utils/sleep.d.mts +2 -0
  255. package/internal/utils/sleep.d.mts.map +1 -0
  256. package/internal/utils/sleep.d.ts +2 -0
  257. package/internal/utils/sleep.d.ts.map +1 -0
  258. package/internal/utils/sleep.js +7 -0
  259. package/internal/utils/sleep.js.map +1 -0
  260. package/internal/utils/sleep.mjs +3 -0
  261. package/internal/utils/sleep.mjs.map +1 -0
  262. package/internal/utils/uuid.d.mts +5 -0
  263. package/internal/utils/uuid.d.mts.map +1 -0
  264. package/internal/utils/uuid.d.ts +5 -0
  265. package/internal/utils/uuid.d.ts.map +1 -0
  266. package/internal/utils/uuid.js +19 -0
  267. package/internal/utils/uuid.js.map +1 -0
  268. package/internal/utils/uuid.mjs +15 -0
  269. package/internal/utils/uuid.mjs.map +1 -0
  270. package/internal/utils/values.d.mts +18 -0
  271. package/internal/utils/values.d.mts.map +1 -0
  272. package/internal/utils/values.d.ts +18 -0
  273. package/internal/utils/values.d.ts.map +1 -0
  274. package/internal/utils/values.js +112 -0
  275. package/internal/utils/values.js.map +1 -0
  276. package/internal/utils/values.mjs +94 -0
  277. package/internal/utils/values.mjs.map +1 -0
  278. package/internal/utils.d.mts +8 -0
  279. package/internal/utils.d.mts.map +1 -0
  280. package/internal/utils.d.ts +8 -0
  281. package/internal/utils.d.ts.map +1 -0
  282. package/internal/utils.js +12 -0
  283. package/internal/utils.js.map +1 -0
  284. package/internal/utils.mjs +9 -0
  285. package/internal/utils.mjs.map +1 -0
  286. package/package.json +147 -0
  287. package/pagination.d.mts +2 -0
  288. package/pagination.d.mts.map +1 -0
  289. package/pagination.d.ts +2 -0
  290. package/pagination.d.ts.map +1 -0
  291. package/pagination.js +6 -0
  292. package/pagination.js.map +1 -0
  293. package/pagination.mjs +2 -0
  294. package/pagination.mjs.map +1 -0
  295. package/resource.d.mts +2 -0
  296. package/resource.d.mts.map +1 -0
  297. package/resource.d.ts +2 -0
  298. package/resource.d.ts.map +1 -0
  299. package/resource.js +6 -0
  300. package/resource.js.map +1 -0
  301. package/resource.mjs +2 -0
  302. package/resource.mjs.map +1 -0
  303. package/resources/index.d.mts +2 -0
  304. package/resources/index.d.mts.map +1 -0
  305. package/resources/index.d.ts +2 -0
  306. package/resources/index.d.ts.map +1 -0
  307. package/resources/index.js +7 -0
  308. package/resources/index.js.map +1 -0
  309. package/resources/index.mjs +3 -0
  310. package/resources/index.mjs.map +1 -0
  311. package/resources/request-logs.d.mts +324 -0
  312. package/resources/request-logs.d.mts.map +1 -0
  313. package/resources/request-logs.d.ts +324 -0
  314. package/resources/request-logs.d.ts.map +1 -0
  315. package/resources/request-logs.js +62 -0
  316. package/resources/request-logs.js.map +1 -0
  317. package/resources/request-logs.mjs +58 -0
  318. package/resources/request-logs.mjs.map +1 -0
  319. package/resources.d.mts +2 -0
  320. package/resources.d.mts.map +1 -0
  321. package/resources.d.ts +2 -0
  322. package/resources.d.ts.map +1 -0
  323. package/resources.js +5 -0
  324. package/resources.js.map +1 -0
  325. package/resources.mjs +2 -0
  326. package/resources.mjs.map +1 -0
  327. package/src/api-promise.ts +2 -0
  328. package/src/client.ts +768 -0
  329. package/src/core/README.md +3 -0
  330. package/src/core/api-promise.ts +92 -0
  331. package/src/core/error.ts +130 -0
  332. package/src/core/pagination.ts +169 -0
  333. package/src/core/resource.ts +11 -0
  334. package/src/core/uploads.ts +2 -0
  335. package/src/error.ts +2 -0
  336. package/src/index.ts +23 -0
  337. package/src/internal/README.md +3 -0
  338. package/src/internal/builtin-types.ts +93 -0
  339. package/src/internal/detect-platform.ts +196 -0
  340. package/src/internal/errors.ts +33 -0
  341. package/src/internal/headers.ts +97 -0
  342. package/src/internal/parse.ts +56 -0
  343. package/src/internal/qs/LICENSE.md +13 -0
  344. package/src/internal/qs/README.md +3 -0
  345. package/src/internal/qs/formats.ts +10 -0
  346. package/src/internal/qs/index.ts +13 -0
  347. package/src/internal/qs/stringify.ts +385 -0
  348. package/src/internal/qs/types.ts +71 -0
  349. package/src/internal/qs/utils.ts +265 -0
  350. package/src/internal/request-options.ts +91 -0
  351. package/src/internal/shim-types.ts +26 -0
  352. package/src/internal/shims.ts +107 -0
  353. package/src/internal/to-file.ts +154 -0
  354. package/src/internal/types.ts +95 -0
  355. package/src/internal/uploads.ts +187 -0
  356. package/src/internal/utils/base64.ts +40 -0
  357. package/src/internal/utils/bytes.ts +32 -0
  358. package/src/internal/utils/env.ts +18 -0
  359. package/src/internal/utils/log.ts +126 -0
  360. package/src/internal/utils/path.ts +88 -0
  361. package/src/internal/utils/query.ts +7 -0
  362. package/src/internal/utils/sleep.ts +3 -0
  363. package/src/internal/utils/uuid.ts +17 -0
  364. package/src/internal/utils/values.ts +105 -0
  365. package/src/internal/utils.ts +9 -0
  366. package/src/lib/.keep +4 -0
  367. package/src/pagination.ts +2 -0
  368. package/src/resource.ts +2 -0
  369. package/src/resources/index.ts +10 -0
  370. package/src/resources/request-logs.ts +405 -0
  371. package/src/resources.ts +1 -0
  372. package/src/tsconfig.json +11 -0
  373. package/src/uploads.ts +2 -0
  374. package/src/version.ts +1 -0
  375. package/uploads.d.mts +2 -0
  376. package/uploads.d.mts.map +1 -0
  377. package/uploads.d.ts +2 -0
  378. package/uploads.d.ts.map +1 -0
  379. package/uploads.js +6 -0
  380. package/uploads.js.map +1 -0
  381. package/uploads.mjs +2 -0
  382. package/uploads.mjs.map +1 -0
  383. package/version.d.mts +2 -0
  384. package/version.d.mts.map +1 -0
  385. package/version.d.ts +2 -0
  386. package/version.d.ts.map +1 -0
  387. package/version.js +5 -0
  388. package/version.js.map +1 -0
  389. package/version.mjs +2 -0
  390. package/version.mjs.map +1 -0
@@ -0,0 +1,74 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { isReadonlyArray } from "./utils/values.mjs";
3
+ const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders');
4
+ function* iterateHeaders(headers) {
5
+ if (!headers)
6
+ return;
7
+ if (brand_privateNullableHeaders in headers) {
8
+ const { values, nulls } = headers;
9
+ yield* values.entries();
10
+ for (const name of nulls) {
11
+ yield [name, null];
12
+ }
13
+ return;
14
+ }
15
+ let shouldClear = false;
16
+ let iter;
17
+ if (headers instanceof Headers) {
18
+ iter = headers.entries();
19
+ }
20
+ else if (isReadonlyArray(headers)) {
21
+ iter = headers;
22
+ }
23
+ else {
24
+ shouldClear = true;
25
+ iter = Object.entries(headers ?? {});
26
+ }
27
+ for (let row of iter) {
28
+ const name = row[0];
29
+ if (typeof name !== 'string')
30
+ throw new TypeError('expected header name to be a string');
31
+ const values = isReadonlyArray(row[1]) ? row[1] : [row[1]];
32
+ let didClear = false;
33
+ for (const value of values) {
34
+ if (value === undefined)
35
+ continue;
36
+ // Objects keys always overwrite older headers, they never append.
37
+ // Yield a null to clear the header before adding the new values.
38
+ if (shouldClear && !didClear) {
39
+ didClear = true;
40
+ yield [name, null];
41
+ }
42
+ yield [name, value];
43
+ }
44
+ }
45
+ }
46
+ export const buildHeaders = (newHeaders) => {
47
+ const targetHeaders = new Headers();
48
+ const nullHeaders = new Set();
49
+ for (const headers of newHeaders) {
50
+ const seenHeaders = new Set();
51
+ for (const [name, value] of iterateHeaders(headers)) {
52
+ const lowerName = name.toLowerCase();
53
+ if (!seenHeaders.has(lowerName)) {
54
+ targetHeaders.delete(name);
55
+ seenHeaders.add(lowerName);
56
+ }
57
+ if (value === null) {
58
+ targetHeaders.delete(name);
59
+ nullHeaders.add(lowerName);
60
+ }
61
+ else {
62
+ targetHeaders.append(name, value);
63
+ nullHeaders.delete(lowerName);
64
+ }
65
+ }
66
+ }
67
+ return { [brand_privateNullableHeaders]: true, values: targetHeaders, nulls: nullHeaders };
68
+ };
69
+ export const isEmptyHeaders = (headers) => {
70
+ for (const _ of iterateHeaders(headers))
71
+ return false;
72
+ return true;
73
+ };
74
+ //# sourceMappingURL=headers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.mjs","sourceRoot":"","sources":["../src/internal/headers.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,12 @@
1
+ import type { FinalRequestOptions } from "./request-options.mjs";
2
+ import { type Xray } from "../client.mjs";
3
+ export type APIResponseProps = {
4
+ response: Response;
5
+ options: FinalRequestOptions;
6
+ controller: AbortController;
7
+ requestLogID: string;
8
+ retryOfRequestLogID: string | undefined;
9
+ startTime: number;
10
+ };
11
+ export declare function defaultParseResponse<T>(client: Xray, props: APIResponseProps): Promise<T>;
12
+ //# sourceMappingURL=parse.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.mts","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,mBAAmB,EAAE;OAC5B,EAAE,KAAK,IAAI,EAAE;AAGpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,EAAE,eAAe,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,CAwC/F"}
@@ -0,0 +1,12 @@
1
+ import type { FinalRequestOptions } from "./request-options.js";
2
+ import { type Xray } from "../client.js";
3
+ export type APIResponseProps = {
4
+ response: Response;
5
+ options: FinalRequestOptions;
6
+ controller: AbortController;
7
+ requestLogID: string;
8
+ retryOfRequestLogID: string | undefined;
9
+ startTime: number;
10
+ };
11
+ export declare function defaultParseResponse<T>(client: Xray, props: APIResponseProps): Promise<T>;
12
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,mBAAmB,EAAE;OAC5B,EAAE,KAAK,IAAI,EAAE;AAGpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,EAAE,eAAe,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,CAAC,CAwC/F"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.defaultParseResponse = defaultParseResponse;
5
+ const log_1 = require("./utils/log.js");
6
+ async function defaultParseResponse(client, props) {
7
+ const { response, requestLogID, retryOfRequestLogID, startTime } = props;
8
+ const body = await (async () => {
9
+ // fetch refuses to read the body when the status code is 204.
10
+ if (response.status === 204) {
11
+ return null;
12
+ }
13
+ if (props.options.__binaryResponse) {
14
+ return response;
15
+ }
16
+ const contentType = response.headers.get('content-type');
17
+ const mediaType = contentType?.split(';')[0]?.trim();
18
+ const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
19
+ if (isJSON) {
20
+ const contentLength = response.headers.get('content-length');
21
+ if (contentLength === '0') {
22
+ // if there is no content we can't do anything
23
+ return undefined;
24
+ }
25
+ const json = await response.json();
26
+ return json;
27
+ }
28
+ const text = await response.text();
29
+ return text;
30
+ })();
31
+ (0, log_1.loggerFor)(client).debug(`[${requestLogID}] response parsed`, (0, log_1.formatRequestDetails)({
32
+ retryOfRequestLogID,
33
+ url: response.url,
34
+ status: response.status,
35
+ body,
36
+ durationMs: Date.now() - startTime,
37
+ }));
38
+ return body;
39
+ }
40
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAetF,oDAwCC;AAnDD,wCAA8D;AAWvD,KAAK,UAAU,oBAAoB,CAAI,MAAY,EAAE,KAAuB;IACjF,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE;QAC7B,8DAA8D;QAC9D,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,OAAO,IAAS,CAAC;QACnB,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACnC,OAAO,QAAwB,CAAC;QAClC,CAAC;QAED,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACrD,MAAM,MAAM,GAAG,SAAS,EAAE,QAAQ,CAAC,kBAAkB,CAAC,IAAI,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvF,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC7D,IAAI,aAAa,KAAK,GAAG,EAAE,CAAC;gBAC1B,8CAA8C;gBAC9C,OAAO,SAAc,CAAC;YACxB,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,IAAS,CAAC;QACnB,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,IAAoB,CAAC;IAC9B,CAAC,CAAC,EAAE,CAAC;IACL,IAAA,eAAS,EAAC,MAAM,CAAC,CAAC,KAAK,CACrB,IAAI,YAAY,mBAAmB,EACnC,IAAA,0BAAoB,EAAC;QACnB,mBAAmB;QACnB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI;QACJ,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;KACnC,CAAC,CACH,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,37 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { formatRequestDetails, loggerFor } from "./utils/log.mjs";
3
+ export async function defaultParseResponse(client, props) {
4
+ const { response, requestLogID, retryOfRequestLogID, startTime } = props;
5
+ const body = await (async () => {
6
+ // fetch refuses to read the body when the status code is 204.
7
+ if (response.status === 204) {
8
+ return null;
9
+ }
10
+ if (props.options.__binaryResponse) {
11
+ return response;
12
+ }
13
+ const contentType = response.headers.get('content-type');
14
+ const mediaType = contentType?.split(';')[0]?.trim();
15
+ const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
16
+ if (isJSON) {
17
+ const contentLength = response.headers.get('content-length');
18
+ if (contentLength === '0') {
19
+ // if there is no content we can't do anything
20
+ return undefined;
21
+ }
22
+ const json = await response.json();
23
+ return json;
24
+ }
25
+ const text = await response.text();
26
+ return text;
27
+ })();
28
+ loggerFor(client).debug(`[${requestLogID}] response parsed`, formatRequestDetails({
29
+ retryOfRequestLogID,
30
+ url: response.url,
31
+ status: response.status,
32
+ body,
33
+ durationMs: Date.now() - startTime,
34
+ }));
35
+ return body;
36
+ }
37
+ //# sourceMappingURL=parse.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.mjs","sourceRoot":"","sources":["../src/internal/parse.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAI/E,EAAE,oBAAoB,EAAE,SAAS,EAAE;AAW1C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAI,MAAY,EAAE,KAAuB;IACjF,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,mBAAmB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE;QAC7B,8DAA8D;QAC9D,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,OAAO,IAAS,CAAC;QACnB,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACnC,OAAO,QAAwB,CAAC;QAClC,CAAC;QAED,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACrD,MAAM,MAAM,GAAG,SAAS,EAAE,QAAQ,CAAC,kBAAkB,CAAC,IAAI,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvF,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC7D,IAAI,aAAa,KAAK,GAAG,EAAE,CAAC;gBAC1B,8CAA8C;gBAC9C,OAAO,SAAc,CAAC;YACxB,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,IAAS,CAAC;QACnB,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,IAAoB,CAAC;IAC9B,CAAC,CAAC,EAAE,CAAC;IACL,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CACrB,IAAI,YAAY,mBAAmB,EACnC,oBAAoB,CAAC;QACnB,mBAAmB;QACnB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI;QACJ,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;KACnC,CAAC,CACH,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Format } from "./types.mjs";
2
+ export declare const default_format: Format;
3
+ export declare const default_formatter: (v: PropertyKey) => string;
4
+ export declare const formatters: Record<Format, (str: PropertyKey) => string>;
5
+ export declare const RFC1738 = "RFC1738";
6
+ export declare const RFC3986 = "RFC3986";
7
+ //# sourceMappingURL=formats.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.d.mts","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,MAAM,EAAE;AAEtB,eAAO,MAAM,cAAc,EAAE,MAAkB,CAAC;AAChD,eAAO,MAAM,iBAAiB,GAAI,GAAG,WAAW,WAAc,CAAC;AAC/D,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,MAAM,CAGnE,CAAC;AACF,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,OAAO,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Format } from "./types.js";
2
+ export declare const default_format: Format;
3
+ export declare const default_formatter: (v: PropertyKey) => string;
4
+ export declare const formatters: Record<Format, (str: PropertyKey) => string>;
5
+ export declare const RFC1738 = "RFC1738";
6
+ export declare const RFC3986 = "RFC3986";
7
+ //# sourceMappingURL=formats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,MAAM,EAAE;AAEtB,eAAO,MAAM,cAAc,EAAE,MAAkB,CAAC;AAChD,eAAO,MAAM,iBAAiB,GAAI,GAAG,WAAW,WAAc,CAAC;AAC/D,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,MAAM,CAGnE,CAAC;AACF,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,OAAO,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RFC3986 = exports.RFC1738 = exports.formatters = exports.default_formatter = exports.default_format = void 0;
4
+ exports.default_format = 'RFC3986';
5
+ const default_formatter = (v) => String(v);
6
+ exports.default_formatter = default_formatter;
7
+ exports.formatters = {
8
+ RFC1738: (v) => String(v).replace(/%20/g, '+'),
9
+ RFC3986: exports.default_formatter,
10
+ };
11
+ exports.RFC1738 = 'RFC1738';
12
+ exports.RFC3986 = 'RFC3986';
13
+ //# sourceMappingURL=formats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.js","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAW,SAAS,CAAC;AACzC,MAAM,iBAAiB,GAAG,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAAlD,QAAA,iBAAiB,qBAAiC;AAClD,QAAA,UAAU,GAAiD;IACtE,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3D,OAAO,EAAE,yBAAiB;CAC3B,CAAC;AACW,QAAA,OAAO,GAAG,SAAS,CAAC;AACpB,QAAA,OAAO,GAAG,SAAS,CAAC"}
@@ -0,0 +1,9 @@
1
+ export const default_format = 'RFC3986';
2
+ export const default_formatter = (v) => String(v);
3
+ export const formatters = {
4
+ RFC1738: (v) => String(v).replace(/%20/g, '+'),
5
+ RFC3986: default_formatter,
6
+ };
7
+ export const RFC1738 = 'RFC1738';
8
+ export const RFC3986 = 'RFC3986';
9
+ //# sourceMappingURL=formats.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.mjs","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAW,SAAS,CAAC;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,UAAU,GAAiD;IACtE,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3D,OAAO,EAAE,iBAAiB;CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ declare const formats: {
2
+ formatters: Record<import("./types").Format, (str: PropertyKey) => string>;
3
+ RFC1738: string;
4
+ RFC3986: string;
5
+ default: import("./types").Format;
6
+ };
7
+ export { stringify } from "./stringify.mjs";
8
+ export { formats };
9
+ export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from "./types.mjs";
10
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO;;;;;CAKZ,CAAC;OAEK,EAAE,SAAS,EAAE;AACpB,OAAO,EAAE,OAAO,EAAE,CAAC;YAEP,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE"}
@@ -0,0 +1,10 @@
1
+ declare const formats: {
2
+ formatters: Record<import("./types").Format, (str: PropertyKey) => string>;
3
+ RFC1738: string;
4
+ RFC3986: string;
5
+ default: import("./types").Format;
6
+ };
7
+ export { stringify } from "./stringify.js";
8
+ export { formats };
9
+ export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from "./types.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO;;;;;CAKZ,CAAC;OAEK,EAAE,SAAS,EAAE;AACpB,OAAO,EAAE,OAAO,EAAE,CAAC;YAEP,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formats = exports.stringify = void 0;
4
+ const formats_1 = require("./formats.js");
5
+ const formats = {
6
+ formatters: formats_1.formatters,
7
+ RFC1738: formats_1.RFC1738,
8
+ RFC3986: formats_1.RFC3986,
9
+ default: formats_1.default_format,
10
+ };
11
+ exports.formats = formats;
12
+ var stringify_1 = require("./stringify.js");
13
+ Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return stringify_1.stringify; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":";;;AAAA,0CAAyE;AAEzE,MAAM,OAAO,GAAG;IACd,UAAU,EAAV,oBAAU;IACV,OAAO,EAAP,iBAAO;IACP,OAAO,EAAP,iBAAO;IACP,OAAO,EAAE,wBAAc;CACxB,CAAC;AAGO,0BAAO;AADhB,4CAAwC;AAA/B,sGAAA,SAAS,OAAA"}
@@ -0,0 +1,10 @@
1
+ import { default_format, formatters, RFC1738, RFC3986 } from "./formats.mjs";
2
+ const formats = {
3
+ formatters,
4
+ RFC1738,
5
+ RFC3986,
6
+ default: default_format,
7
+ };
8
+ export { stringify } from "./stringify.mjs";
9
+ export { formats };
10
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE;AAEvD,MAAM,OAAO,GAAG;IACd,UAAU;IACV,OAAO;IACP,OAAO;IACP,OAAO,EAAE,cAAc;CACxB,CAAC;OAEK,EAAE,SAAS,EAAE;AACpB,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { StringifyOptions } from "./types.mjs";
2
+ export declare function stringify(object: any, opts?: StringifyOptions): string;
3
+ //# sourceMappingURL=stringify.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringify.d.mts","sourceRoot":"","sources":["../../src/internal/qs/stringify.ts"],"names":[],"mappings":"OAEO,KAAK,EAAyB,gBAAgB,EAAE;AA+SvD,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,gBAAqB,UA+EjE"}
@@ -0,0 +1,3 @@
1
+ import type { StringifyOptions } from "./types.js";
2
+ export declare function stringify(object: any, opts?: StringifyOptions): string;
3
+ //# sourceMappingURL=stringify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../src/internal/qs/stringify.ts"],"names":[],"mappings":"OAEO,KAAK,EAAyB,gBAAgB,EAAE;AA+SvD,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,gBAAqB,UA+EjE"}
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringify = stringify;
4
+ const utils_1 = require("./utils.js");
5
+ const formats_1 = require("./formats.js");
6
+ const values_1 = require("../utils/values.js");
7
+ const array_prefix_generators = {
8
+ brackets(prefix) {
9
+ return String(prefix) + '[]';
10
+ },
11
+ comma: 'comma',
12
+ indices(prefix, key) {
13
+ return String(prefix) + '[' + key + ']';
14
+ },
15
+ repeat(prefix) {
16
+ return String(prefix);
17
+ },
18
+ };
19
+ const push_to_array = function (arr, value_or_array) {
20
+ Array.prototype.push.apply(arr, (0, values_1.isArray)(value_or_array) ? value_or_array : [value_or_array]);
21
+ };
22
+ let toISOString;
23
+ const defaults = {
24
+ addQueryPrefix: false,
25
+ allowDots: false,
26
+ allowEmptyArrays: false,
27
+ arrayFormat: 'indices',
28
+ charset: 'utf-8',
29
+ charsetSentinel: false,
30
+ delimiter: '&',
31
+ encode: true,
32
+ encodeDotInKeys: false,
33
+ encoder: utils_1.encode,
34
+ encodeValuesOnly: false,
35
+ format: formats_1.default_format,
36
+ formatter: formats_1.default_formatter,
37
+ /** @deprecated */
38
+ indices: false,
39
+ serializeDate(date) {
40
+ return (toISOString ?? (toISOString = Function.prototype.call.bind(Date.prototype.toISOString)))(date);
41
+ },
42
+ skipNulls: false,
43
+ strictNullHandling: false,
44
+ };
45
+ function is_non_nullish_primitive(v) {
46
+ return (typeof v === 'string' ||
47
+ typeof v === 'number' ||
48
+ typeof v === 'boolean' ||
49
+ typeof v === 'symbol' ||
50
+ typeof v === 'bigint');
51
+ }
52
+ const sentinel = {};
53
+ function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
54
+ let obj = object;
55
+ let tmp_sc = sideChannel;
56
+ let step = 0;
57
+ let find_flag = false;
58
+ while ((tmp_sc = tmp_sc.get(sentinel)) !== void undefined && !find_flag) {
59
+ // Where object last appeared in the ref tree
60
+ const pos = tmp_sc.get(object);
61
+ step += 1;
62
+ if (typeof pos !== 'undefined') {
63
+ if (pos === step) {
64
+ throw new RangeError('Cyclic object value');
65
+ }
66
+ else {
67
+ find_flag = true; // Break while
68
+ }
69
+ }
70
+ if (typeof tmp_sc.get(sentinel) === 'undefined') {
71
+ step = 0;
72
+ }
73
+ }
74
+ if (typeof filter === 'function') {
75
+ obj = filter(prefix, obj);
76
+ }
77
+ else if (obj instanceof Date) {
78
+ obj = serializeDate?.(obj);
79
+ }
80
+ else if (generateArrayPrefix === 'comma' && (0, values_1.isArray)(obj)) {
81
+ obj = (0, utils_1.maybe_map)(obj, function (value) {
82
+ if (value instanceof Date) {
83
+ return serializeDate?.(value);
84
+ }
85
+ return value;
86
+ });
87
+ }
88
+ if (obj === null) {
89
+ if (strictNullHandling) {
90
+ return encoder && !encodeValuesOnly ?
91
+ // @ts-expect-error
92
+ encoder(prefix, defaults.encoder, charset, 'key', format)
93
+ : prefix;
94
+ }
95
+ obj = '';
96
+ }
97
+ if (is_non_nullish_primitive(obj) || (0, utils_1.is_buffer)(obj)) {
98
+ if (encoder) {
99
+ const key_value = encodeValuesOnly ? prefix
100
+ // @ts-expect-error
101
+ : encoder(prefix, defaults.encoder, charset, 'key', format);
102
+ return [
103
+ formatter?.(key_value) +
104
+ '=' +
105
+ // @ts-expect-error
106
+ formatter?.(encoder(obj, defaults.encoder, charset, 'value', format)),
107
+ ];
108
+ }
109
+ return [formatter?.(prefix) + '=' + formatter?.(String(obj))];
110
+ }
111
+ const values = [];
112
+ if (typeof obj === 'undefined') {
113
+ return values;
114
+ }
115
+ let obj_keys;
116
+ if (generateArrayPrefix === 'comma' && (0, values_1.isArray)(obj)) {
117
+ // we need to join elements in
118
+ if (encodeValuesOnly && encoder) {
119
+ // @ts-expect-error values only
120
+ obj = (0, utils_1.maybe_map)(obj, encoder);
121
+ }
122
+ obj_keys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
123
+ }
124
+ else if ((0, values_1.isArray)(filter)) {
125
+ obj_keys = filter;
126
+ }
127
+ else {
128
+ const keys = Object.keys(obj);
129
+ obj_keys = sort ? keys.sort(sort) : keys;
130
+ }
131
+ const encoded_prefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix);
132
+ const adjusted_prefix = commaRoundTrip && (0, values_1.isArray)(obj) && obj.length === 1 ? encoded_prefix + '[]' : encoded_prefix;
133
+ if (allowEmptyArrays && (0, values_1.isArray)(obj) && obj.length === 0) {
134
+ return adjusted_prefix + '[]';
135
+ }
136
+ for (let j = 0; j < obj_keys.length; ++j) {
137
+ const key = obj_keys[j];
138
+ const value =
139
+ // @ts-ignore
140
+ typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
141
+ if (skipNulls && value === null) {
142
+ continue;
143
+ }
144
+ // @ts-ignore
145
+ const encoded_key = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key;
146
+ const key_prefix = (0, values_1.isArray)(obj) ?
147
+ typeof generateArrayPrefix === 'function' ?
148
+ generateArrayPrefix(adjusted_prefix, encoded_key)
149
+ : adjusted_prefix
150
+ : adjusted_prefix + (allowDots ? '.' + encoded_key : '[' + encoded_key + ']');
151
+ sideChannel.set(object, step);
152
+ const valueSideChannel = new WeakMap();
153
+ valueSideChannel.set(sentinel, sideChannel);
154
+ push_to_array(values, inner_stringify(value, key_prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys,
155
+ // @ts-ignore
156
+ generateArrayPrefix === 'comma' && encodeValuesOnly && (0, values_1.isArray)(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
157
+ }
158
+ return values;
159
+ }
160
+ function normalize_stringify_options(opts = defaults) {
161
+ if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
162
+ throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
163
+ }
164
+ if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') {
165
+ throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');
166
+ }
167
+ if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
168
+ throw new TypeError('Encoder has to be a function.');
169
+ }
170
+ const charset = opts.charset || defaults.charset;
171
+ if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
172
+ throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
173
+ }
174
+ let format = formats_1.default_format;
175
+ if (typeof opts.format !== 'undefined') {
176
+ if (!(0, utils_1.has)(formats_1.formatters, opts.format)) {
177
+ throw new TypeError('Unknown format option provided.');
178
+ }
179
+ format = opts.format;
180
+ }
181
+ const formatter = formats_1.formatters[format];
182
+ let filter = defaults.filter;
183
+ if (typeof opts.filter === 'function' || (0, values_1.isArray)(opts.filter)) {
184
+ filter = opts.filter;
185
+ }
186
+ let arrayFormat;
187
+ if (opts.arrayFormat && opts.arrayFormat in array_prefix_generators) {
188
+ arrayFormat = opts.arrayFormat;
189
+ }
190
+ else if ('indices' in opts) {
191
+ arrayFormat = opts.indices ? 'indices' : 'repeat';
192
+ }
193
+ else {
194
+ arrayFormat = defaults.arrayFormat;
195
+ }
196
+ if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
197
+ throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
198
+ }
199
+ const allowDots = typeof opts.allowDots === 'undefined' ?
200
+ !!opts.encodeDotInKeys === true ?
201
+ true
202
+ : defaults.allowDots
203
+ : !!opts.allowDots;
204
+ return {
205
+ addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
206
+ // @ts-ignore
207
+ allowDots: allowDots,
208
+ allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
209
+ arrayFormat: arrayFormat,
210
+ charset: charset,
211
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
212
+ commaRoundTrip: !!opts.commaRoundTrip,
213
+ delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
214
+ encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
215
+ encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
216
+ encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
217
+ encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
218
+ filter: filter,
219
+ format: format,
220
+ formatter: formatter,
221
+ serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
222
+ skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
223
+ // @ts-ignore
224
+ sort: typeof opts.sort === 'function' ? opts.sort : null,
225
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
226
+ };
227
+ }
228
+ function stringify(object, opts = {}) {
229
+ let obj = object;
230
+ const options = normalize_stringify_options(opts);
231
+ let obj_keys;
232
+ let filter;
233
+ if (typeof options.filter === 'function') {
234
+ filter = options.filter;
235
+ obj = filter('', obj);
236
+ }
237
+ else if ((0, values_1.isArray)(options.filter)) {
238
+ filter = options.filter;
239
+ obj_keys = filter;
240
+ }
241
+ const keys = [];
242
+ if (typeof obj !== 'object' || obj === null) {
243
+ return '';
244
+ }
245
+ const generateArrayPrefix = array_prefix_generators[options.arrayFormat];
246
+ const commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip;
247
+ if (!obj_keys) {
248
+ obj_keys = Object.keys(obj);
249
+ }
250
+ if (options.sort) {
251
+ obj_keys.sort(options.sort);
252
+ }
253
+ const sideChannel = new WeakMap();
254
+ for (let i = 0; i < obj_keys.length; ++i) {
255
+ const key = obj_keys[i];
256
+ if (options.skipNulls && obj[key] === null) {
257
+ continue;
258
+ }
259
+ push_to_array(keys, inner_stringify(obj[key], key,
260
+ // @ts-expect-error
261
+ generateArrayPrefix, commaRoundTrip, options.allowEmptyArrays, options.strictNullHandling, options.skipNulls, options.encodeDotInKeys, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel));
262
+ }
263
+ const joined = keys.join(options.delimiter);
264
+ let prefix = options.addQueryPrefix === true ? '?' : '';
265
+ if (options.charsetSentinel) {
266
+ if (options.charset === 'iso-8859-1') {
267
+ // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
268
+ prefix += 'utf8=%26%2310003%3B&';
269
+ }
270
+ else {
271
+ // encodeURIComponent('✓')
272
+ prefix += 'utf8=%E2%9C%93&';
273
+ }
274
+ }
275
+ return joined.length > 0 ? prefix + joined : '';
276
+ }
277
+ //# sourceMappingURL=stringify.js.map