parallel-web 0.1.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.
Files changed (397) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/LICENSE +7 -0
  3. package/README.md +371 -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 +187 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +187 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +462 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +458 -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/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/streaming.d.mts +33 -0
  45. package/core/streaming.d.mts.map +1 -0
  46. package/core/streaming.d.ts +33 -0
  47. package/core/streaming.d.ts.map +1 -0
  48. package/core/streaming.js +263 -0
  49. package/core/streaming.js.map +1 -0
  50. package/core/streaming.mjs +258 -0
  51. package/core/streaming.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 +6 -0
  69. package/index.d.mts.map +1 -0
  70. package/index.d.ts +6 -0
  71. package/index.d.ts.map +1 -0
  72. package/index.js +30 -0
  73. package/index.js.map +1 -0
  74. package/index.mjs +7 -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/decoders/line.d.mts +17 -0
  85. package/internal/decoders/line.d.mts.map +1 -0
  86. package/internal/decoders/line.d.ts +17 -0
  87. package/internal/decoders/line.d.ts.map +1 -0
  88. package/internal/decoders/line.js +113 -0
  89. package/internal/decoders/line.js.map +1 -0
  90. package/internal/decoders/line.mjs +108 -0
  91. package/internal/decoders/line.mjs.map +1 -0
  92. package/internal/detect-platform.d.mts +15 -0
  93. package/internal/detect-platform.d.mts.map +1 -0
  94. package/internal/detect-platform.d.ts +15 -0
  95. package/internal/detect-platform.d.ts.map +1 -0
  96. package/internal/detect-platform.js +162 -0
  97. package/internal/detect-platform.js.map +1 -0
  98. package/internal/detect-platform.mjs +157 -0
  99. package/internal/detect-platform.mjs.map +1 -0
  100. package/internal/errors.d.mts +3 -0
  101. package/internal/errors.d.mts.map +1 -0
  102. package/internal/errors.d.ts +3 -0
  103. package/internal/errors.d.ts.map +1 -0
  104. package/internal/errors.js +41 -0
  105. package/internal/errors.js.map +1 -0
  106. package/internal/errors.mjs +36 -0
  107. package/internal/errors.mjs.map +1 -0
  108. package/internal/headers.d.mts +20 -0
  109. package/internal/headers.d.mts.map +1 -0
  110. package/internal/headers.d.ts +20 -0
  111. package/internal/headers.d.ts.map +1 -0
  112. package/internal/headers.js +79 -0
  113. package/internal/headers.js.map +1 -0
  114. package/internal/headers.mjs +74 -0
  115. package/internal/headers.mjs.map +1 -0
  116. package/internal/parse.d.mts +12 -0
  117. package/internal/parse.d.mts.map +1 -0
  118. package/internal/parse.d.ts +12 -0
  119. package/internal/parse.d.ts.map +1 -0
  120. package/internal/parse.js +45 -0
  121. package/internal/parse.js.map +1 -0
  122. package/internal/parse.mjs +42 -0
  123. package/internal/parse.mjs.map +1 -0
  124. package/internal/request-options.d.mts +77 -0
  125. package/internal/request-options.d.mts.map +1 -0
  126. package/internal/request-options.d.ts +77 -0
  127. package/internal/request-options.d.ts.map +1 -0
  128. package/internal/request-options.js +14 -0
  129. package/internal/request-options.js.map +1 -0
  130. package/internal/request-options.mjs +10 -0
  131. package/internal/request-options.mjs.map +1 -0
  132. package/internal/shim-types.d.mts +17 -0
  133. package/internal/shim-types.d.mts.map +1 -0
  134. package/internal/shim-types.d.ts +17 -0
  135. package/internal/shim-types.d.ts.map +1 -0
  136. package/internal/shim-types.js +4 -0
  137. package/internal/shim-types.js.map +1 -0
  138. package/internal/shim-types.mjs +3 -0
  139. package/internal/shim-types.mjs.map +1 -0
  140. package/internal/shims.d.mts +20 -0
  141. package/internal/shims.d.mts.map +1 -0
  142. package/internal/shims.d.ts +20 -0
  143. package/internal/shims.d.ts.map +1 -0
  144. package/internal/shims.js +92 -0
  145. package/internal/shims.js.map +1 -0
  146. package/internal/shims.mjs +85 -0
  147. package/internal/shims.mjs.map +1 -0
  148. package/internal/to-file.d.mts +45 -0
  149. package/internal/to-file.d.mts.map +1 -0
  150. package/internal/to-file.d.ts +45 -0
  151. package/internal/to-file.d.ts.map +1 -0
  152. package/internal/to-file.js +91 -0
  153. package/internal/to-file.js.map +1 -0
  154. package/internal/to-file.mjs +88 -0
  155. package/internal/to-file.mjs.map +1 -0
  156. package/internal/tslib.js +81 -0
  157. package/internal/tslib.mjs +17 -0
  158. package/internal/types.d.mts +69 -0
  159. package/internal/types.d.mts.map +1 -0
  160. package/internal/types.d.ts +69 -0
  161. package/internal/types.d.ts.map +1 -0
  162. package/internal/types.js +4 -0
  163. package/internal/types.js.map +1 -0
  164. package/internal/types.mjs +3 -0
  165. package/internal/types.mjs.map +1 -0
  166. package/internal/uploads.d.mts +42 -0
  167. package/internal/uploads.d.mts.map +1 -0
  168. package/internal/uploads.d.ts +42 -0
  169. package/internal/uploads.d.ts.map +1 -0
  170. package/internal/uploads.js +141 -0
  171. package/internal/uploads.js.map +1 -0
  172. package/internal/uploads.mjs +131 -0
  173. package/internal/uploads.mjs.map +1 -0
  174. package/internal/utils/base64.d.mts +3 -0
  175. package/internal/utils/base64.d.mts.map +1 -0
  176. package/internal/utils/base64.d.ts +3 -0
  177. package/internal/utils/base64.d.ts.map +1 -0
  178. package/internal/utils/base64.js +38 -0
  179. package/internal/utils/base64.js.map +1 -0
  180. package/internal/utils/base64.mjs +33 -0
  181. package/internal/utils/base64.mjs.map +1 -0
  182. package/internal/utils/bytes.d.mts +4 -0
  183. package/internal/utils/bytes.d.mts.map +1 -0
  184. package/internal/utils/bytes.d.ts +4 -0
  185. package/internal/utils/bytes.d.ts.map +1 -0
  186. package/internal/utils/bytes.js +31 -0
  187. package/internal/utils/bytes.js.map +1 -0
  188. package/internal/utils/bytes.mjs +26 -0
  189. package/internal/utils/bytes.mjs.map +1 -0
  190. package/internal/utils/env.d.mts +9 -0
  191. package/internal/utils/env.d.mts.map +1 -0
  192. package/internal/utils/env.d.ts +9 -0
  193. package/internal/utils/env.d.ts.map +1 -0
  194. package/internal/utils/env.js +22 -0
  195. package/internal/utils/env.js.map +1 -0
  196. package/internal/utils/env.mjs +18 -0
  197. package/internal/utils/env.mjs.map +1 -0
  198. package/internal/utils/log.d.mts +37 -0
  199. package/internal/utils/log.d.mts.map +1 -0
  200. package/internal/utils/log.d.ts +37 -0
  201. package/internal/utils/log.d.ts.map +1 -0
  202. package/internal/utils/log.js +86 -0
  203. package/internal/utils/log.js.map +1 -0
  204. package/internal/utils/log.mjs +80 -0
  205. package/internal/utils/log.mjs.map +1 -0
  206. package/internal/utils/path.d.mts +15 -0
  207. package/internal/utils/path.d.mts.map +1 -0
  208. package/internal/utils/path.d.ts +15 -0
  209. package/internal/utils/path.d.ts.map +1 -0
  210. package/internal/utils/path.js +79 -0
  211. package/internal/utils/path.js.map +1 -0
  212. package/internal/utils/path.mjs +74 -0
  213. package/internal/utils/path.mjs.map +1 -0
  214. package/internal/utils/sleep.d.mts +2 -0
  215. package/internal/utils/sleep.d.mts.map +1 -0
  216. package/internal/utils/sleep.d.ts +2 -0
  217. package/internal/utils/sleep.d.ts.map +1 -0
  218. package/internal/utils/sleep.js +7 -0
  219. package/internal/utils/sleep.js.map +1 -0
  220. package/internal/utils/sleep.mjs +3 -0
  221. package/internal/utils/sleep.mjs.map +1 -0
  222. package/internal/utils/uuid.d.mts +5 -0
  223. package/internal/utils/uuid.d.mts.map +1 -0
  224. package/internal/utils/uuid.d.ts +5 -0
  225. package/internal/utils/uuid.d.ts.map +1 -0
  226. package/internal/utils/uuid.js +19 -0
  227. package/internal/utils/uuid.js.map +1 -0
  228. package/internal/utils/uuid.mjs +15 -0
  229. package/internal/utils/uuid.mjs.map +1 -0
  230. package/internal/utils/values.d.mts +18 -0
  231. package/internal/utils/values.d.mts.map +1 -0
  232. package/internal/utils/values.d.ts +18 -0
  233. package/internal/utils/values.d.ts.map +1 -0
  234. package/internal/utils/values.js +112 -0
  235. package/internal/utils/values.js.map +1 -0
  236. package/internal/utils/values.mjs +94 -0
  237. package/internal/utils/values.mjs.map +1 -0
  238. package/internal/utils.d.mts +7 -0
  239. package/internal/utils.d.mts.map +1 -0
  240. package/internal/utils.d.ts +7 -0
  241. package/internal/utils.d.ts.map +1 -0
  242. package/internal/utils.js +11 -0
  243. package/internal/utils.js.map +1 -0
  244. package/internal/utils.mjs +8 -0
  245. package/internal/utils.mjs.map +1 -0
  246. package/package.json +148 -0
  247. package/resource.d.mts +2 -0
  248. package/resource.d.mts.map +1 -0
  249. package/resource.d.ts +2 -0
  250. package/resource.d.ts.map +1 -0
  251. package/resource.js +6 -0
  252. package/resource.js.map +1 -0
  253. package/resource.mjs +2 -0
  254. package/resource.mjs.map +1 -0
  255. package/resources/beta/beta.d.mts +86 -0
  256. package/resources/beta/beta.d.mts.map +1 -0
  257. package/resources/beta/beta.d.ts +86 -0
  258. package/resources/beta/beta.d.ts.map +1 -0
  259. package/resources/beta/beta.js +25 -0
  260. package/resources/beta/beta.js.map +1 -0
  261. package/resources/beta/beta.mjs +20 -0
  262. package/resources/beta/beta.mjs.map +1 -0
  263. package/resources/beta/index.d.mts +4 -0
  264. package/resources/beta/index.d.mts.map +1 -0
  265. package/resources/beta/index.d.ts +4 -0
  266. package/resources/beta/index.d.ts.map +1 -0
  267. package/resources/beta/index.js +11 -0
  268. package/resources/beta/index.js.map +1 -0
  269. package/resources/beta/index.mjs +5 -0
  270. package/resources/beta/index.mjs.map +1 -0
  271. package/resources/beta/task-group.d.mts +178 -0
  272. package/resources/beta/task-group.d.mts.map +1 -0
  273. package/resources/beta/task-group.d.ts +178 -0
  274. package/resources/beta/task-group.d.ts.map +1 -0
  275. package/resources/beta/task-group.js +62 -0
  276. package/resources/beta/task-group.js.map +1 -0
  277. package/resources/beta/task-group.mjs +58 -0
  278. package/resources/beta/task-group.mjs.map +1 -0
  279. package/resources/beta/task-run.d.mts +411 -0
  280. package/resources/beta/task-run.d.mts.map +1 -0
  281. package/resources/beta/task-run.d.ts +411 -0
  282. package/resources/beta/task-run.d.ts.map +1 -0
  283. package/resources/beta/task-run.js +59 -0
  284. package/resources/beta/task-run.js.map +1 -0
  285. package/resources/beta/task-run.mjs +55 -0
  286. package/resources/beta/task-run.mjs.map +1 -0
  287. package/resources/beta.d.mts +2 -0
  288. package/resources/beta.d.mts.map +1 -0
  289. package/resources/beta.d.ts +2 -0
  290. package/resources/beta.d.ts.map +1 -0
  291. package/resources/beta.js +6 -0
  292. package/resources/beta.js.map +1 -0
  293. package/resources/beta.mjs +3 -0
  294. package/resources/beta.mjs.map +1 -0
  295. package/resources/index.d.mts +4 -0
  296. package/resources/index.d.mts.map +1 -0
  297. package/resources/index.d.ts +4 -0
  298. package/resources/index.d.ts.map +1 -0
  299. package/resources/index.js +11 -0
  300. package/resources/index.js.map +1 -0
  301. package/resources/index.mjs +5 -0
  302. package/resources/index.mjs.map +1 -0
  303. package/resources/shared.d.mts +70 -0
  304. package/resources/shared.d.mts.map +1 -0
  305. package/resources/shared.d.ts +70 -0
  306. package/resources/shared.d.ts.map +1 -0
  307. package/resources/shared.js +4 -0
  308. package/resources/shared.js.map +1 -0
  309. package/resources/shared.mjs +3 -0
  310. package/resources/shared.mjs.map +1 -0
  311. package/resources/task-run.d.mts +338 -0
  312. package/resources/task-run.d.mts.map +1 -0
  313. package/resources/task-run.d.ts +338 -0
  314. package/resources/task-run.d.ts.map +1 -0
  315. package/resources/task-run.js +34 -0
  316. package/resources/task-run.js.map +1 -0
  317. package/resources/task-run.mjs +30 -0
  318. package/resources/task-run.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 +763 -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/resource.ts +11 -0
  333. package/src/core/streaming.ts +315 -0
  334. package/src/core/uploads.ts +2 -0
  335. package/src/error.ts +2 -0
  336. package/src/index.ts +22 -0
  337. package/src/internal/README.md +3 -0
  338. package/src/internal/builtin-types.ts +93 -0
  339. package/src/internal/decoders/line.ts +135 -0
  340. package/src/internal/detect-platform.ts +196 -0
  341. package/src/internal/errors.ts +33 -0
  342. package/src/internal/headers.ts +97 -0
  343. package/src/internal/parse.ts +64 -0
  344. package/src/internal/request-options.ts +93 -0
  345. package/src/internal/shim-types.ts +26 -0
  346. package/src/internal/shims.ts +107 -0
  347. package/src/internal/to-file.ts +154 -0
  348. package/src/internal/types.ts +95 -0
  349. package/src/internal/uploads.ts +187 -0
  350. package/src/internal/utils/base64.ts +40 -0
  351. package/src/internal/utils/bytes.ts +32 -0
  352. package/src/internal/utils/env.ts +18 -0
  353. package/src/internal/utils/log.ts +127 -0
  354. package/src/internal/utils/path.ts +88 -0
  355. package/src/internal/utils/sleep.ts +3 -0
  356. package/src/internal/utils/uuid.ts +17 -0
  357. package/src/internal/utils/values.ts +105 -0
  358. package/src/internal/utils.ts +8 -0
  359. package/src/lib/.keep +4 -0
  360. package/src/resource.ts +2 -0
  361. package/src/resources/beta/beta.ts +157 -0
  362. package/src/resources/beta/index.ts +28 -0
  363. package/src/resources/beta/task-group.ts +270 -0
  364. package/src/resources/beta/task-run.ts +517 -0
  365. package/src/resources/beta.ts +3 -0
  366. package/src/resources/index.ts +19 -0
  367. package/src/resources/shared.ts +76 -0
  368. package/src/resources/task-run.ts +394 -0
  369. package/src/resources.ts +1 -0
  370. package/src/streaming.ts +2 -0
  371. package/src/tsconfig.json +11 -0
  372. package/src/uploads.ts +2 -0
  373. package/src/version.ts +1 -0
  374. package/streaming.d.mts +2 -0
  375. package/streaming.d.mts.map +1 -0
  376. package/streaming.d.ts +2 -0
  377. package/streaming.d.ts.map +1 -0
  378. package/streaming.js +6 -0
  379. package/streaming.js.map +1 -0
  380. package/streaming.mjs +2 -0
  381. package/streaming.mjs.map +1 -0
  382. package/uploads.d.mts +2 -0
  383. package/uploads.d.mts.map +1 -0
  384. package/uploads.d.ts +2 -0
  385. package/uploads.d.ts.map +1 -0
  386. package/uploads.js +6 -0
  387. package/uploads.js.map +1 -0
  388. package/uploads.mjs +2 -0
  389. package/uploads.mjs.map +1 -0
  390. package/version.d.mts +2 -0
  391. package/version.d.mts.map +1 -0
  392. package/version.d.ts +2 -0
  393. package/version.d.ts.map +1 -0
  394. package/version.js +5 -0
  395. package/version.js.map +1 -0
  396. package/version.mjs +2 -0
  397. package/version.mjs.map +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,65 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2025-09-01)
4
+
5
+ Full Changelog: [v0.0.1-alpha.0...v0.1.0](https://github.com/parallel-web/parallel-sdk-typescript/compare/v0.0.1-alpha.0...v0.1.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([f4b9bff](https://github.com/parallel-web/parallel-sdk-typescript/commit/f4b9bff96e41c4e31546276be440fb8f721ef595))
10
+ * **api:** update via SDK Studio ([7a985fb](https://github.com/parallel-web/parallel-sdk-typescript/commit/7a985fbf420eed89c87940cef40efb650b554c9b))
11
+ * **api:** update via SDK Studio ([bea2209](https://github.com/parallel-web/parallel-sdk-typescript/commit/bea220934b8d11d97e35599dbc68ef3e69bb9523))
12
+ * **api:** update via SDK Studio ([e555533](https://github.com/parallel-web/parallel-sdk-typescript/commit/e5555331ceb4722741248522936df737ab26176e))
13
+ * **api:** update via SDK Studio ([e0922b7](https://github.com/parallel-web/parallel-sdk-typescript/commit/e0922b7ab408dd85495164111d53c3b9a1967da9))
14
+ * **api:** update via SDK Studio ([496a13a](https://github.com/parallel-web/parallel-sdk-typescript/commit/496a13a6922fc072d62c34fa5fb9917824bee881))
15
+ * **api:** update via SDK Studio ([bb43e98](https://github.com/parallel-web/parallel-sdk-typescript/commit/bb43e9850dcb30878dc67d8d5422917d951645b9))
16
+ * **client:** add support for endpoint-specific base URLs ([6ca9e40](https://github.com/parallel-web/parallel-sdk-typescript/commit/6ca9e405e47920c42ab274da43a40f20864fa7c7))
17
+ * **client:** add withOptions helper ([2dc5df5](https://github.com/parallel-web/parallel-sdk-typescript/commit/2dc5df50cfca28e611a360559c694889b9592939))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **client:** always overwrite when merging headers ([1b74500](https://github.com/parallel-web/parallel-sdk-typescript/commit/1b745008bbcff7583e8483a3989225fb6eb2719e))
23
+ * **client:** explicitly copy fetch in withOptions ([1e3c4cb](https://github.com/parallel-web/parallel-sdk-typescript/commit/1e3c4cbb08404440b34dc10dc67beb273fa658f3))
24
+ * **client:** get fetchOptions type more reliably ([c90df05](https://github.com/parallel-web/parallel-sdk-typescript/commit/c90df05c6ed462bffb1004861f33ed3f2ff4cdcc))
25
+ * compat with more runtimes ([b197b9f](https://github.com/parallel-web/parallel-sdk-typescript/commit/b197b9ffc02621b1743ba5ff52b59b524aef94b1))
26
+ * publish script — handle NPM errors correctly ([4c38358](https://github.com/parallel-web/parallel-sdk-typescript/commit/4c38358bade9566927ba83f123b06ea70d4c2140))
27
+
28
+
29
+ ### Chores
30
+
31
+ * add docs to RequestOptions type ([6aae9a9](https://github.com/parallel-web/parallel-sdk-typescript/commit/6aae9a9b10709a8b53886f74e1a768f1b25e66d0))
32
+ * adjust eslint.config.mjs ignore pattern ([1685764](https://github.com/parallel-web/parallel-sdk-typescript/commit/1685764727dd8d217dad3a24257dac5777839b44))
33
+ * avoid type error in certain environments ([dc40584](https://github.com/parallel-web/parallel-sdk-typescript/commit/dc405849f7a23810049ea0409f9bdf4db785d149))
34
+ * change publish docs url ([cd7500b](https://github.com/parallel-web/parallel-sdk-typescript/commit/cd7500b70c2ec7d1dc9534a582619042be13eb53))
35
+ * **ci:** enable for pull requests ([2bd8a50](https://github.com/parallel-web/parallel-sdk-typescript/commit/2bd8a5000c5e442499ab1e7bd4186303e6e0539b))
36
+ * **ci:** only run for pushes and fork pull requests ([07a77b8](https://github.com/parallel-web/parallel-sdk-typescript/commit/07a77b81a447dc1b0f195a44db309913cd6eebcf))
37
+ * **client:** drop support for EOL node versions ([ae8f0d0](https://github.com/parallel-web/parallel-sdk-typescript/commit/ae8f0d0732f35ae967d1285cd3b6255f78822031))
38
+ * **client:** improve path param validation ([c64babf](https://github.com/parallel-web/parallel-sdk-typescript/commit/c64babf6852c1f078b4151f1a9a9e047686dc21f))
39
+ * **client:** refactor imports ([9ed8458](https://github.com/parallel-web/parallel-sdk-typescript/commit/9ed845857b38ff482b624eb171a4767965ce6562))
40
+ * **deps:** bump eslint-plugin-prettier ([326f222](https://github.com/parallel-web/parallel-sdk-typescript/commit/326f222fd6f1f305370681a2aad70ee2776f62e1))
41
+ * **docs:** grammar improvements ([9afb7db](https://github.com/parallel-web/parallel-sdk-typescript/commit/9afb7db5530567fc606fc2084172705b5cf3a627))
42
+ * **docs:** use top-level-await in example snippets ([15c8ab4](https://github.com/parallel-web/parallel-sdk-typescript/commit/15c8ab49b9e9438ccbb3b066def8d2c4ef0f8748))
43
+ * go live ([5e6dbbb](https://github.com/parallel-web/parallel-sdk-typescript/commit/5e6dbbb6f668125403e5261b6ce4bc80861eb627))
44
+ * improve publish-npm script --latest tag logic ([9feb9eb](https://github.com/parallel-web/parallel-sdk-typescript/commit/9feb9eb2fb9ee5d993872a8b8bc4ce30180f8084))
45
+ * **internal:** add pure annotations, make base APIResource abstract ([cf3a8d2](https://github.com/parallel-web/parallel-sdk-typescript/commit/cf3a8d27388f773c166c8283b0e89e9a16ae04e4))
46
+ * **internal:** codegen related update ([7dfd25b](https://github.com/parallel-web/parallel-sdk-typescript/commit/7dfd25bb7ed0a0b7d6a40d74d137b7f2d34c332c))
47
+ * **internal:** fix readablestream types in node 20 ([340f07e](https://github.com/parallel-web/parallel-sdk-typescript/commit/340f07e2c4f1db967f2f00c909b1283c5b0dbad3))
48
+ * **internal:** refactor utils ([95c2945](https://github.com/parallel-web/parallel-sdk-typescript/commit/95c2945cef58d5d7b13c968c70de500148705720))
49
+ * **internal:** share typescript helpers ([fa5b3f1](https://github.com/parallel-web/parallel-sdk-typescript/commit/fa5b3f1e6e9ad059adf73bc8475455247ec71df3))
50
+ * **internal:** update jest config ([b740c53](https://github.com/parallel-web/parallel-sdk-typescript/commit/b740c5312f264b90fd8b8690a5770209486f2e1f))
51
+ * make some internal functions async ([ae148ed](https://github.com/parallel-web/parallel-sdk-typescript/commit/ae148ede844821590bb04b6b5f07e7419660cda4))
52
+ * **package:** remove engines ([8c81289](https://github.com/parallel-web/parallel-sdk-typescript/commit/8c812899a5099a2a5fae23d9863effef9ae66581))
53
+ * **readme:** update badges ([10d3e6a](https://github.com/parallel-web/parallel-sdk-typescript/commit/10d3e6abff37d19ad633430f390f8d899d069bb3))
54
+ * **readme:** use better example snippet for undocumented params ([6b403ec](https://github.com/parallel-web/parallel-sdk-typescript/commit/6b403ecc4ed7dc04bf80d719cd357b3bfd32d47e))
55
+ * **ts:** reorder package.json imports ([4e6e456](https://github.com/parallel-web/parallel-sdk-typescript/commit/4e6e456893e96f2fb0d6cbbf4022193e4207f99e))
56
+
57
+
58
+ ### Documentation
59
+
60
+ * **readme:** fix typo ([0c499fe](https://github.com/parallel-web/parallel-sdk-typescript/commit/0c499fe10500f3a667941cf8acbdf5d88cb67182))
61
+
62
+
63
+ ### Refactors
64
+
65
+ * **types:** replace Record with mapped types ([ab87e9c](https://github.com/parallel-web/parallel-sdk-typescript/commit/ab87e9c8c2fdceaf24a3f310647bf0912c1c3dcb))
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2025 Parallel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,371 @@
1
+ # Parallel TypeScript API Library
2
+
3
+ [![NPM version](<https://img.shields.io/npm/v/parallel-web.svg?label=npm%20(stable)>)](https://npmjs.org/package/parallel-web) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/parallel-web)
4
+
5
+ This library provides convenient access to the Parallel REST API from server-side TypeScript or JavaScript.
6
+
7
+ The REST API documentation can be found on [docs.parallel.ai](https://docs.parallel.ai). The full API of this library can be found in [api.md](api.md).
8
+
9
+ It is generated with [Stainless](https://www.stainless.com/).
10
+
11
+ ## Installation
12
+
13
+ ```sh
14
+ npm install parallel-web
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ The full API of this library can be found in [api.md](api.md).
20
+
21
+ <!-- prettier-ignore -->
22
+ ```js
23
+ import Parallel from 'parallel-web';
24
+
25
+ const client = new Parallel({
26
+ apiKey: process.env['PARALLEL_API_KEY'], // This is the default and can be omitted
27
+ });
28
+
29
+ const taskRun = await client.taskRun.create({
30
+ input: 'What was the GDP of France in 2023?',
31
+ processor: 'base',
32
+ });
33
+
34
+ console.log(taskRun.run_id);
35
+ ```
36
+
37
+ ### Request & Response types
38
+
39
+ This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
40
+
41
+ <!-- prettier-ignore -->
42
+ ```ts
43
+ import Parallel from 'parallel-web';
44
+
45
+ const client = new Parallel({
46
+ apiKey: process.env['PARALLEL_API_KEY'], // This is the default and can be omitted
47
+ });
48
+
49
+ const params: Parallel.TaskRunCreateParams = {
50
+ input: 'What was the GDP of France in 2023?',
51
+ processor: 'base',
52
+ };
53
+ const taskRun: Parallel.TaskRun = await client.taskRun.create(params);
54
+ ```
55
+
56
+ Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
57
+
58
+ ## Handling errors
59
+
60
+ When the library is unable to connect to the API,
61
+ or if the API returns a non-success status code (i.e., 4xx or 5xx response),
62
+ a subclass of `APIError` will be thrown:
63
+
64
+ <!-- prettier-ignore -->
65
+ ```ts
66
+ const taskRun = await client.taskRun
67
+ .create({ input: 'What was the GDP of France in 2023?', processor: 'base' })
68
+ .catch(async (err) => {
69
+ if (err instanceof Parallel.APIError) {
70
+ console.log(err.status); // 400
71
+ console.log(err.name); // BadRequestError
72
+ console.log(err.headers); // {server: 'nginx', ...}
73
+ } else {
74
+ throw err;
75
+ }
76
+ });
77
+ ```
78
+
79
+ Error codes are as follows:
80
+
81
+ | Status Code | Error Type |
82
+ | ----------- | -------------------------- |
83
+ | 400 | `BadRequestError` |
84
+ | 401 | `AuthenticationError` |
85
+ | 403 | `PermissionDeniedError` |
86
+ | 404 | `NotFoundError` |
87
+ | 422 | `UnprocessableEntityError` |
88
+ | 429 | `RateLimitError` |
89
+ | >=500 | `InternalServerError` |
90
+ | N/A | `APIConnectionError` |
91
+
92
+ ### Retries
93
+
94
+ Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
95
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
96
+ 429 Rate Limit, and >=500 Internal errors will all be retried by default.
97
+
98
+ You can use the `maxRetries` option to configure or disable this:
99
+
100
+ <!-- prettier-ignore -->
101
+ ```js
102
+ // Configure the default for all requests:
103
+ const client = new Parallel({
104
+ maxRetries: 0, // default is 2
105
+ });
106
+
107
+ // Or, configure per-request:
108
+ await client.taskRun.create({ input: 'What was the GDP of France in 2023?', processor: 'base' }, {
109
+ maxRetries: 5,
110
+ });
111
+ ```
112
+
113
+ ### Timeouts
114
+
115
+ Requests time out after 1 minute by default. You can configure this with a `timeout` option:
116
+
117
+ <!-- prettier-ignore -->
118
+ ```ts
119
+ // Configure the default for all requests:
120
+ const client = new Parallel({
121
+ timeout: 20 * 1000, // 20 seconds (default is 1 minute)
122
+ });
123
+
124
+ // Override per-request:
125
+ await client.taskRun.create({ input: 'What was the GDP of France in 2023?', processor: 'base' }, {
126
+ timeout: 5 * 1000,
127
+ });
128
+ ```
129
+
130
+ On timeout, an `APIConnectionTimeoutError` is thrown.
131
+
132
+ Note that requests which time out will be [retried twice by default](#retries).
133
+
134
+ ## Advanced Usage
135
+
136
+ ### Accessing raw Response data (e.g., headers)
137
+
138
+ The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
139
+ This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
140
+
141
+ You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
142
+ Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
143
+
144
+ <!-- prettier-ignore -->
145
+ ```ts
146
+ const client = new Parallel();
147
+
148
+ const response = await client.taskRun
149
+ .create({ input: 'What was the GDP of France in 2023?', processor: 'base' })
150
+ .asResponse();
151
+ console.log(response.headers.get('X-My-Header'));
152
+ console.log(response.statusText); // access the underlying Response object
153
+
154
+ const { data: taskRun, response: raw } = await client.taskRun
155
+ .create({ input: 'What was the GDP of France in 2023?', processor: 'base' })
156
+ .withResponse();
157
+ console.log(raw.headers.get('X-My-Header'));
158
+ console.log(taskRun.run_id);
159
+ ```
160
+
161
+ ### Logging
162
+
163
+ > [!IMPORTANT]
164
+ > All log messages are intended for debugging only. The format and content of log messages
165
+ > may change between releases.
166
+
167
+ #### Log levels
168
+
169
+ The log level can be configured in two ways:
170
+
171
+ 1. Via the `PARALLEL_LOG` environment variable
172
+ 2. Using the `logLevel` client option (overrides the environment variable if set)
173
+
174
+ ```ts
175
+ import Parallel from 'parallel-web';
176
+
177
+ const client = new Parallel({
178
+ logLevel: 'debug', // Show all log messages
179
+ });
180
+ ```
181
+
182
+ Available log levels, from most to least verbose:
183
+
184
+ - `'debug'` - Show debug messages, info, warnings, and errors
185
+ - `'info'` - Show info messages, warnings, and errors
186
+ - `'warn'` - Show warnings and errors (default)
187
+ - `'error'` - Show only errors
188
+ - `'off'` - Disable all logging
189
+
190
+ At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
191
+ Some authentication-related headers are redacted, but sensitive data in request and response bodies
192
+ may still be visible.
193
+
194
+ #### Custom logger
195
+
196
+ By default, this library logs to `globalThis.console`. You can also provide a custom logger.
197
+ Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
198
+
199
+ When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
200
+ below the configured level will not be sent to your logger.
201
+
202
+ ```ts
203
+ import Parallel from 'parallel-web';
204
+ import pino from 'pino';
205
+
206
+ const logger = pino();
207
+
208
+ const client = new Parallel({
209
+ logger: logger.child({ name: 'Parallel' }),
210
+ logLevel: 'debug', // Send all messages to pino, allowing it to filter
211
+ });
212
+ ```
213
+
214
+ ### Making custom/undocumented requests
215
+
216
+ This library is typed for convenient access to the documented API. If you need to access undocumented
217
+ endpoints, params, or response properties, the library can still be used.
218
+
219
+ #### Undocumented endpoints
220
+
221
+ To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
222
+ Options on the client, such as retries, will be respected when making these requests.
223
+
224
+ ```ts
225
+ await client.post('/some/path', {
226
+ body: { some_prop: 'foo' },
227
+ query: { some_query_arg: 'bar' },
228
+ });
229
+ ```
230
+
231
+ #### Undocumented request params
232
+
233
+ To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
234
+ parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
235
+ send will be sent as-is.
236
+
237
+ ```ts
238
+ client.taskRun.create({
239
+ // ...
240
+ // @ts-expect-error baz is not yet public
241
+ baz: 'undocumented option',
242
+ });
243
+ ```
244
+
245
+ For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
246
+ extra param in the body.
247
+
248
+ If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
249
+ options.
250
+
251
+ #### Undocumented response properties
252
+
253
+ To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
254
+ the response object, or cast the response object to the requisite type. Like the request params, we do not
255
+ validate or strip extra properties from the response from the API.
256
+
257
+ ### Customizing the fetch client
258
+
259
+ By default, this library expects a global `fetch` function is defined.
260
+
261
+ If you want to use a different `fetch` function, you can either polyfill the global:
262
+
263
+ ```ts
264
+ import fetch from 'my-fetch';
265
+
266
+ globalThis.fetch = fetch;
267
+ ```
268
+
269
+ Or pass it to the client:
270
+
271
+ ```ts
272
+ import Parallel from 'parallel-web';
273
+ import fetch from 'my-fetch';
274
+
275
+ const client = new Parallel({ fetch });
276
+ ```
277
+
278
+ ### Fetch options
279
+
280
+ If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
281
+
282
+ ```ts
283
+ import Parallel from 'parallel-web';
284
+
285
+ const client = new Parallel({
286
+ fetchOptions: {
287
+ // `RequestInit` options
288
+ },
289
+ });
290
+ ```
291
+
292
+ #### Configuring proxies
293
+
294
+ To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
295
+ options to requests:
296
+
297
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
298
+
299
+ ```ts
300
+ import Parallel from 'parallel-web';
301
+ import * as undici from 'undici';
302
+
303
+ const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
304
+ const client = new Parallel({
305
+ fetchOptions: {
306
+ dispatcher: proxyAgent,
307
+ },
308
+ });
309
+ ```
310
+
311
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
312
+
313
+ ```ts
314
+ import Parallel from 'parallel-web';
315
+
316
+ const client = new Parallel({
317
+ fetchOptions: {
318
+ proxy: 'http://localhost:8888',
319
+ },
320
+ });
321
+ ```
322
+
323
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
324
+
325
+ ```ts
326
+ import Parallel from 'npm:parallel-web';
327
+
328
+ const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
329
+ const client = new Parallel({
330
+ fetchOptions: {
331
+ client: httpClient,
332
+ },
333
+ });
334
+ ```
335
+
336
+ ## Frequently Asked Questions
337
+
338
+ ## Semantic versioning
339
+
340
+ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
341
+
342
+ 1. Changes that only affect static types, without breaking runtime behavior.
343
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
344
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
345
+
346
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
347
+
348
+ We are keen for your feedback; please open an [issue](https://www.github.com/parallel-web/parallel-sdk-typescript/issues) with questions, bugs, or suggestions.
349
+
350
+ ## Requirements
351
+
352
+ TypeScript >= 4.9 is supported.
353
+
354
+ The following runtimes are supported:
355
+
356
+ - Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
357
+ - Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
358
+ - Deno v1.28.0 or higher.
359
+ - Bun 1.0 or later.
360
+ - Cloudflare Workers.
361
+ - Vercel Edge Runtime.
362
+ - Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
363
+ - Nitro v2.6 or greater.
364
+
365
+ Note that React Native is not supported at this time.
366
+
367
+ If you are interested in other runtime environments, please open or upvote an issue on GitHub.
368
+
369
+ ## Contributing
370
+
371
+ See [the contributing documentation](./CONTRIBUTING.md).
@@ -0,0 +1,2 @@
1
+ export * from "./core/api-promise.mjs";
2
+ //# sourceMappingURL=api-promise.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./core/api-promise.js";
2
+ //# sourceMappingURL=api-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
package/api-promise.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("./internal/tslib.js");
4
+ /** @deprecated Import from ./core/api-promise instead */
5
+ tslib_1.__exportStar(require("./core/api-promise.js"), exports);
6
+ //# sourceMappingURL=api-promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.js","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,gEAAmC"}
@@ -0,0 +1,2 @@
1
+ export * from "./core/api-promise.mjs";
2
+ //# sourceMappingURL=api-promise.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.mjs","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":""}
package/client.d.mts ADDED
@@ -0,0 +1,187 @@
1
+ import type { RequestInit, RequestInfo } from "./internal/builtin-types.mjs";
2
+ import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.mjs";
3
+ export type { Logger, LogLevel } from "./internal/utils/log.mjs";
4
+ import * as Opts from "./internal/request-options.mjs";
5
+ import * as Errors from "./core/error.mjs";
6
+ import * as Uploads from "./core/uploads.mjs";
7
+ import * as API from "./resources/index.mjs";
8
+ import { APIPromise } from "./core/api-promise.mjs";
9
+ import { AutoSchema, Citation, FieldBasis, JsonSchema, RunInput, TaskRun, TaskRunCreateParams, TaskRunJsonOutput, TaskRunResult, TaskRunResultParams, TaskRunTextOutput, TaskSpec, TextSchema } from "./resources/task-run.mjs";
10
+ import { Beta } from "./resources/beta/beta.mjs";
11
+ import { type Fetch } from "./internal/builtin-types.mjs";
12
+ import { HeadersLike, NullableHeaders } from "./internal/headers.mjs";
13
+ import { FinalRequestOptions, RequestOptions } from "./internal/request-options.mjs";
14
+ import { type LogLevel, type Logger } from "./internal/utils/log.mjs";
15
+ export interface ClientOptions {
16
+ /**
17
+ * Defaults to process.env['PARALLEL_API_KEY'].
18
+ */
19
+ apiKey?: string | undefined;
20
+ /**
21
+ * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
22
+ *
23
+ * Defaults to process.env['PARALLEL_BASE_URL'].
24
+ */
25
+ baseURL?: string | null | undefined;
26
+ /**
27
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
28
+ * from the server before timing out a single request.
29
+ *
30
+ * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
31
+ * much longer than this timeout before the promise succeeds or fails.
32
+ *
33
+ * @unit milliseconds
34
+ */
35
+ timeout?: number | undefined;
36
+ /**
37
+ * Additional `RequestInit` options to be passed to `fetch` calls.
38
+ * Properties will be overridden by per-request `fetchOptions`.
39
+ */
40
+ fetchOptions?: MergedRequestInit | undefined;
41
+ /**
42
+ * Specify a custom `fetch` function implementation.
43
+ *
44
+ * If not provided, we expect that `fetch` is defined globally.
45
+ */
46
+ fetch?: Fetch | undefined;
47
+ /**
48
+ * The maximum number of times that the client will retry a request in case of a
49
+ * temporary failure, like a network error or a 5XX error from the server.
50
+ *
51
+ * @default 2
52
+ */
53
+ maxRetries?: number | undefined;
54
+ /**
55
+ * Default headers to include with every request to the API.
56
+ *
57
+ * These can be removed in individual requests by explicitly setting the
58
+ * header to `null` in request options.
59
+ */
60
+ defaultHeaders?: HeadersLike | undefined;
61
+ /**
62
+ * Default query parameters to include with every request to the API.
63
+ *
64
+ * These can be removed in individual requests by explicitly setting the
65
+ * param to `undefined` in request options.
66
+ */
67
+ defaultQuery?: Record<string, string | undefined> | undefined;
68
+ /**
69
+ * Set the log level.
70
+ *
71
+ * Defaults to process.env['PARALLEL_LOG'] or 'warn' if it isn't set.
72
+ */
73
+ logLevel?: LogLevel | undefined;
74
+ /**
75
+ * Set the logger.
76
+ *
77
+ * Defaults to globalThis.console.
78
+ */
79
+ logger?: Logger | undefined;
80
+ }
81
+ /**
82
+ * API Client for interfacing with the Parallel API.
83
+ */
84
+ export declare class Parallel {
85
+ #private;
86
+ apiKey: string;
87
+ baseURL: string;
88
+ maxRetries: number;
89
+ timeout: number;
90
+ logger: Logger | undefined;
91
+ logLevel: LogLevel | undefined;
92
+ fetchOptions: MergedRequestInit | undefined;
93
+ private fetch;
94
+ protected idempotencyHeader?: string;
95
+ private _options;
96
+ /**
97
+ * API Client for interfacing with the Parallel API.
98
+ *
99
+ * @param {string | undefined} [opts.apiKey=process.env['PARALLEL_API_KEY'] ?? undefined]
100
+ * @param {string} [opts.baseURL=process.env['PARALLEL_BASE_URL'] ?? https://api.parallel.ai] - Override the default base URL for the API.
101
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
102
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
103
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
104
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
105
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
106
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
107
+ */
108
+ constructor({ baseURL, apiKey, ...opts }?: ClientOptions);
109
+ /**
110
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
111
+ */
112
+ withOptions(options: Partial<ClientOptions>): this;
113
+ protected defaultQuery(): Record<string, string | undefined> | undefined;
114
+ protected validateHeaders({ values, nulls }: NullableHeaders): void;
115
+ protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
116
+ /**
117
+ * Basic re-implementation of `qs.stringify` for primitive types.
118
+ */
119
+ protected stringifyQuery(query: Record<string, unknown>): string;
120
+ private getUserAgent;
121
+ protected defaultIdempotencyKey(): string;
122
+ protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
123
+ buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
124
+ /**
125
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
126
+ */
127
+ protected prepareOptions(options: FinalRequestOptions): Promise<void>;
128
+ /**
129
+ * Used as a callback for mutating the given `RequestInit` object.
130
+ *
131
+ * This is useful for cases where you want to add certain headers based off of
132
+ * the request properties, e.g. `method` or `url`.
133
+ */
134
+ protected prepareRequest(request: RequestInit, { url, options }: {
135
+ url: string;
136
+ options: FinalRequestOptions;
137
+ }): Promise<void>;
138
+ get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
139
+ post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
140
+ patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
141
+ put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
142
+ delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
143
+ private methodRequest;
144
+ request<Rsp>(options: PromiseOrValue<FinalRequestOptions>, remainingRetries?: number | null): APIPromise<Rsp>;
145
+ private makeRequest;
146
+ fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
147
+ private shouldRetry;
148
+ private retryRequest;
149
+ private calculateDefaultRetryTimeoutMillis;
150
+ buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
151
+ retryCount?: number;
152
+ }): Promise<{
153
+ req: FinalizedRequestInit;
154
+ url: string;
155
+ timeout: number;
156
+ }>;
157
+ private buildHeaders;
158
+ private buildBody;
159
+ static Parallel: typeof Parallel;
160
+ static DEFAULT_TIMEOUT: number;
161
+ static ParallelError: typeof Errors.ParallelError;
162
+ static APIError: typeof Errors.APIError;
163
+ static APIConnectionError: typeof Errors.APIConnectionError;
164
+ static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
165
+ static APIUserAbortError: typeof Errors.APIUserAbortError;
166
+ static NotFoundError: typeof Errors.NotFoundError;
167
+ static ConflictError: typeof Errors.ConflictError;
168
+ static RateLimitError: typeof Errors.RateLimitError;
169
+ static BadRequestError: typeof Errors.BadRequestError;
170
+ static AuthenticationError: typeof Errors.AuthenticationError;
171
+ static InternalServerError: typeof Errors.InternalServerError;
172
+ static PermissionDeniedError: typeof Errors.PermissionDeniedError;
173
+ static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
174
+ static toFile: typeof Uploads.toFile;
175
+ taskRun: API.TaskRun;
176
+ beta: API.Beta;
177
+ }
178
+ export declare namespace Parallel {
179
+ export type RequestOptions = Opts.RequestOptions;
180
+ export { type TaskRun as TaskRun, type AutoSchema as AutoSchema, type Citation as Citation, type FieldBasis as FieldBasis, type JsonSchema as JsonSchema, type RunInput as RunInput, type TaskRunJsonOutput as TaskRunJsonOutput, type TaskRunResult as TaskRunResult, type TaskRunTextOutput as TaskRunTextOutput, type TaskSpec as TaskSpec, type TextSchema as TextSchema, type TaskRunCreateParams as TaskRunCreateParams, type TaskRunResultParams as TaskRunResultParams, };
181
+ export { Beta as Beta };
182
+ export type ErrorObject = API.ErrorObject;
183
+ export type ErrorResponse = API.ErrorResponse;
184
+ export type SourcePolicy = API.SourcePolicy;
185
+ export type Warning = API.Warning;
186
+ }
187
+ //# sourceMappingURL=client.d.mts.map