@chunkify/chunkify 0.5.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 (507) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/LICENSE +201 -0
  3. package/README.md +395 -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 +222 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +222 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +509 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +505 -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 +62 -0
  37. package/core/pagination.d.mts.map +1 -0
  38. package/core/pagination.d.ts +62 -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 +35 -0
  113. package/internal/parse.js.map +1 -0
  114. package/internal/parse.mjs +32 -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/sleep.d.mts +2 -0
  247. package/internal/utils/sleep.d.mts.map +1 -0
  248. package/internal/utils/sleep.d.ts +2 -0
  249. package/internal/utils/sleep.d.ts.map +1 -0
  250. package/internal/utils/sleep.js +7 -0
  251. package/internal/utils/sleep.js.map +1 -0
  252. package/internal/utils/sleep.mjs +3 -0
  253. package/internal/utils/sleep.mjs.map +1 -0
  254. package/internal/utils/uuid.d.mts +5 -0
  255. package/internal/utils/uuid.d.mts.map +1 -0
  256. package/internal/utils/uuid.d.ts +5 -0
  257. package/internal/utils/uuid.d.ts.map +1 -0
  258. package/internal/utils/uuid.js +19 -0
  259. package/internal/utils/uuid.js.map +1 -0
  260. package/internal/utils/uuid.mjs +15 -0
  261. package/internal/utils/uuid.mjs.map +1 -0
  262. package/internal/utils/values.d.mts +18 -0
  263. package/internal/utils/values.d.mts.map +1 -0
  264. package/internal/utils/values.d.ts +18 -0
  265. package/internal/utils/values.d.ts.map +1 -0
  266. package/internal/utils/values.js +112 -0
  267. package/internal/utils/values.js.map +1 -0
  268. package/internal/utils/values.mjs +94 -0
  269. package/internal/utils/values.mjs.map +1 -0
  270. package/internal/utils.d.mts +7 -0
  271. package/internal/utils.d.mts.map +1 -0
  272. package/internal/utils.d.ts +7 -0
  273. package/internal/utils.d.ts.map +1 -0
  274. package/internal/utils.js +11 -0
  275. package/internal/utils.js.map +1 -0
  276. package/internal/utils.mjs +8 -0
  277. package/internal/utils.mjs.map +1 -0
  278. package/package.json +149 -0
  279. package/pagination.d.mts +2 -0
  280. package/pagination.d.mts.map +1 -0
  281. package/pagination.d.ts +2 -0
  282. package/pagination.d.ts.map +1 -0
  283. package/pagination.js +6 -0
  284. package/pagination.js.map +1 -0
  285. package/pagination.mjs +2 -0
  286. package/pagination.mjs.map +1 -0
  287. package/resource.d.mts +2 -0
  288. package/resource.d.mts.map +1 -0
  289. package/resource.d.ts +2 -0
  290. package/resource.d.ts.map +1 -0
  291. package/resource.js +6 -0
  292. package/resource.js.map +1 -0
  293. package/resource.mjs +2 -0
  294. package/resource.mjs.map +1 -0
  295. package/resources/files.d.mts +236 -0
  296. package/resources/files.d.mts.map +1 -0
  297. package/resources/files.d.ts +236 -0
  298. package/resources/files.d.ts.map +1 -0
  299. package/resources/files.js +34 -0
  300. package/resources/files.js.map +1 -0
  301. package/resources/files.mjs +30 -0
  302. package/resources/files.mjs.map +1 -0
  303. package/resources/index.d.mts +11 -0
  304. package/resources/index.d.mts.map +1 -0
  305. package/resources/index.d.ts +11 -0
  306. package/resources/index.d.ts.map +1 -0
  307. package/resources/index.js +25 -0
  308. package/resources/index.js.map +1 -0
  309. package/resources/index.mjs +12 -0
  310. package/resources/index.mjs.map +1 -0
  311. package/resources/jobs/files.d.mts +24 -0
  312. package/resources/jobs/files.d.mts.map +1 -0
  313. package/resources/jobs/files.d.ts +24 -0
  314. package/resources/jobs/files.d.ts.map +1 -0
  315. package/resources/jobs/files.js +16 -0
  316. package/resources/jobs/files.js.map +1 -0
  317. package/resources/jobs/files.mjs +12 -0
  318. package/resources/jobs/files.mjs.map +1 -0
  319. package/resources/jobs/index.d.mts +5 -0
  320. package/resources/jobs/index.d.mts.map +1 -0
  321. package/resources/jobs/index.d.ts +5 -0
  322. package/resources/jobs/index.d.ts.map +1 -0
  323. package/resources/jobs/index.js +13 -0
  324. package/resources/jobs/index.js.map +1 -0
  325. package/resources/jobs/index.mjs +6 -0
  326. package/resources/jobs/index.mjs.map +1 -0
  327. package/resources/jobs/jobs.d.mts +1207 -0
  328. package/resources/jobs/jobs.d.mts.map +1 -0
  329. package/resources/jobs/jobs.d.ts +1207 -0
  330. package/resources/jobs/jobs.d.ts.map +1 -0
  331. package/resources/jobs/jobs.js +64 -0
  332. package/resources/jobs/jobs.js.map +1 -0
  333. package/resources/jobs/jobs.mjs +59 -0
  334. package/resources/jobs/jobs.mjs.map +1 -0
  335. package/resources/jobs/logs.d.mts +63 -0
  336. package/resources/jobs/logs.d.mts.map +1 -0
  337. package/resources/jobs/logs.d.ts +63 -0
  338. package/resources/jobs/logs.d.ts.map +1 -0
  339. package/resources/jobs/logs.js +16 -0
  340. package/resources/jobs/logs.js.map +1 -0
  341. package/resources/jobs/logs.mjs +12 -0
  342. package/resources/jobs/logs.mjs.map +1 -0
  343. package/resources/jobs/transcoders.d.mts +93 -0
  344. package/resources/jobs/transcoders.d.mts.map +1 -0
  345. package/resources/jobs/transcoders.d.ts +93 -0
  346. package/resources/jobs/transcoders.d.ts.map +1 -0
  347. package/resources/jobs/transcoders.js +16 -0
  348. package/resources/jobs/transcoders.js.map +1 -0
  349. package/resources/jobs/transcoders.mjs +12 -0
  350. package/resources/jobs/transcoders.mjs.map +1 -0
  351. package/resources/jobs.d.mts +2 -0
  352. package/resources/jobs.d.mts.map +1 -0
  353. package/resources/jobs.d.ts +2 -0
  354. package/resources/jobs.d.ts.map +1 -0
  355. package/resources/jobs.js +6 -0
  356. package/resources/jobs.js.map +1 -0
  357. package/resources/jobs.mjs +3 -0
  358. package/resources/jobs.mjs.map +1 -0
  359. package/resources/notifications.d.mts +118 -0
  360. package/resources/notifications.d.mts.map +1 -0
  361. package/resources/notifications.d.ts +118 -0
  362. package/resources/notifications.d.ts.map +1 -0
  363. package/resources/notifications.js +42 -0
  364. package/resources/notifications.js.map +1 -0
  365. package/resources/notifications.mjs +38 -0
  366. package/resources/notifications.mjs.map +1 -0
  367. package/resources/projects.d.mts +87 -0
  368. package/resources/projects.d.mts.map +1 -0
  369. package/resources/projects.d.ts +87 -0
  370. package/resources/projects.d.ts.map +1 -0
  371. package/resources/projects.js +51 -0
  372. package/resources/projects.js.map +1 -0
  373. package/resources/projects.mjs +47 -0
  374. package/resources/projects.mjs.map +1 -0
  375. package/resources/shared.d.mts +15 -0
  376. package/resources/shared.d.mts.map +1 -0
  377. package/resources/shared.d.ts +15 -0
  378. package/resources/shared.d.ts.map +1 -0
  379. package/resources/shared.js +4 -0
  380. package/resources/shared.js.map +1 -0
  381. package/resources/shared.mjs +3 -0
  382. package/resources/shared.mjs.map +1 -0
  383. package/resources/sources.d.mts +235 -0
  384. package/resources/sources.d.mts.map +1 -0
  385. package/resources/sources.d.ts +235 -0
  386. package/resources/sources.d.ts.map +1 -0
  387. package/resources/sources.js +43 -0
  388. package/resources/sources.js.map +1 -0
  389. package/resources/sources.mjs +39 -0
  390. package/resources/sources.mjs.map +1 -0
  391. package/resources/storages.d.mts +216 -0
  392. package/resources/storages.d.mts.map +1 -0
  393. package/resources/storages.d.ts +216 -0
  394. package/resources/storages.d.ts.map +1 -0
  395. package/resources/storages.js +41 -0
  396. package/resources/storages.js.map +1 -0
  397. package/resources/storages.mjs +37 -0
  398. package/resources/storages.mjs.map +1 -0
  399. package/resources/tokens.d.mts +74 -0
  400. package/resources/tokens.d.mts.map +1 -0
  401. package/resources/tokens.d.ts +74 -0
  402. package/resources/tokens.d.ts.map +1 -0
  403. package/resources/tokens.js +37 -0
  404. package/resources/tokens.js.map +1 -0
  405. package/resources/tokens.mjs +33 -0
  406. package/resources/tokens.mjs.map +1 -0
  407. package/resources/uploads.d.mts +117 -0
  408. package/resources/uploads.d.mts.map +1 -0
  409. package/resources/uploads.d.ts +117 -0
  410. package/resources/uploads.d.ts.map +1 -0
  411. package/resources/uploads.js +40 -0
  412. package/resources/uploads.js.map +1 -0
  413. package/resources/uploads.mjs +36 -0
  414. package/resources/uploads.mjs.map +1 -0
  415. package/resources/webhooks.d.mts +194 -0
  416. package/resources/webhooks.d.mts.map +1 -0
  417. package/resources/webhooks.d.ts +194 -0
  418. package/resources/webhooks.d.ts.map +1 -0
  419. package/resources/webhooks.js +64 -0
  420. package/resources/webhooks.js.map +1 -0
  421. package/resources/webhooks.mjs +60 -0
  422. package/resources/webhooks.mjs.map +1 -0
  423. package/resources.d.mts +2 -0
  424. package/resources.d.mts.map +1 -0
  425. package/resources.d.ts +2 -0
  426. package/resources.d.ts.map +1 -0
  427. package/resources.js +5 -0
  428. package/resources.js.map +1 -0
  429. package/resources.mjs +2 -0
  430. package/resources.mjs.map +1 -0
  431. package/src/api-promise.ts +2 -0
  432. package/src/client.ts +935 -0
  433. package/src/core/README.md +3 -0
  434. package/src/core/api-promise.ts +92 -0
  435. package/src/core/error.ts +130 -0
  436. package/src/core/pagination.ts +176 -0
  437. package/src/core/resource.ts +11 -0
  438. package/src/core/uploads.ts +2 -0
  439. package/src/error.ts +2 -0
  440. package/src/index.ts +23 -0
  441. package/src/internal/README.md +3 -0
  442. package/src/internal/builtin-types.ts +93 -0
  443. package/src/internal/detect-platform.ts +196 -0
  444. package/src/internal/errors.ts +33 -0
  445. package/src/internal/headers.ts +97 -0
  446. package/src/internal/parse.ts +50 -0
  447. package/src/internal/qs/LICENSE.md +13 -0
  448. package/src/internal/qs/README.md +3 -0
  449. package/src/internal/qs/formats.ts +10 -0
  450. package/src/internal/qs/index.ts +13 -0
  451. package/src/internal/qs/stringify.ts +385 -0
  452. package/src/internal/qs/types.ts +71 -0
  453. package/src/internal/qs/utils.ts +265 -0
  454. package/src/internal/request-options.ts +91 -0
  455. package/src/internal/shim-types.ts +26 -0
  456. package/src/internal/shims.ts +107 -0
  457. package/src/internal/to-file.ts +154 -0
  458. package/src/internal/types.ts +95 -0
  459. package/src/internal/uploads.ts +187 -0
  460. package/src/internal/utils/base64.ts +40 -0
  461. package/src/internal/utils/bytes.ts +32 -0
  462. package/src/internal/utils/env.ts +18 -0
  463. package/src/internal/utils/log.ts +126 -0
  464. package/src/internal/utils/path.ts +88 -0
  465. package/src/internal/utils/sleep.ts +3 -0
  466. package/src/internal/utils/uuid.ts +17 -0
  467. package/src/internal/utils/values.ts +105 -0
  468. package/src/internal/utils.ts +8 -0
  469. package/src/lib/.keep +4 -0
  470. package/src/pagination.ts +2 -0
  471. package/src/resource.ts +2 -0
  472. package/src/resources/files.ts +315 -0
  473. package/src/resources/index.ts +59 -0
  474. package/src/resources/jobs/files.ts +32 -0
  475. package/src/resources/jobs/index.ts +20 -0
  476. package/src/resources/jobs/jobs.ts +1690 -0
  477. package/src/resources/jobs/logs.ts +77 -0
  478. package/src/resources/jobs/transcoders.ts +118 -0
  479. package/src/resources/jobs.ts +3 -0
  480. package/src/resources/notifications.ts +190 -0
  481. package/src/resources/projects.ts +138 -0
  482. package/src/resources/shared.ts +29 -0
  483. package/src/resources/sources.ts +312 -0
  484. package/src/resources/storages.ts +335 -0
  485. package/src/resources/tokens.ts +107 -0
  486. package/src/resources/uploads.ts +164 -0
  487. package/src/resources/webhooks.ts +299 -0
  488. package/src/resources.ts +1 -0
  489. package/src/tsconfig.json +11 -0
  490. package/src/uploads.ts +2 -0
  491. package/src/version.ts +1 -0
  492. package/uploads.d.mts +2 -0
  493. package/uploads.d.mts.map +1 -0
  494. package/uploads.d.ts +2 -0
  495. package/uploads.d.ts.map +1 -0
  496. package/uploads.js +6 -0
  497. package/uploads.js.map +1 -0
  498. package/uploads.mjs +2 -0
  499. package/uploads.mjs.map +1 -0
  500. package/version.d.mts +2 -0
  501. package/version.d.mts.map +1 -0
  502. package/version.d.ts +2 -0
  503. package/version.d.ts.map +1 -0
  504. package/version.js +5 -0
  505. package/version.js.map +1 -0
  506. package/version.mjs +2 -0
  507. package/version.mjs.map +1 -0
package/client.mjs ADDED
@@ -0,0 +1,505 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ var _Chunkify_instances, _a, _Chunkify_encoder, _Chunkify_baseURLOverridden;
3
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "./internal/tslib.mjs";
4
+ import { uuid4 } from "./internal/utils/uuid.mjs";
5
+ import { validatePositiveInteger, isAbsoluteURL, safeJSON } from "./internal/utils/values.mjs";
6
+ import { sleep } from "./internal/utils/sleep.mjs";
7
+ import { castToError, isAbortError } from "./internal/errors.mjs";
8
+ import { getPlatformHeaders } from "./internal/detect-platform.mjs";
9
+ import * as Shims from "./internal/shims.mjs";
10
+ import * as Opts from "./internal/request-options.mjs";
11
+ import * as qs from "./internal/qs/index.mjs";
12
+ import { VERSION } from "./version.mjs";
13
+ import * as Errors from "./core/error.mjs";
14
+ import * as Pagination from "./core/pagination.mjs";
15
+ import * as Uploads from "./core/uploads.mjs";
16
+ import * as API from "./resources/index.mjs";
17
+ import { APIPromise } from "./core/api-promise.mjs";
18
+ import { Files } from "./resources/files.mjs";
19
+ import { Notifications, } from "./resources/notifications.mjs";
20
+ import { Projects, } from "./resources/projects.mjs";
21
+ import { Sources, } from "./resources/sources.mjs";
22
+ import { Storages } from "./resources/storages.mjs";
23
+ import { Tokens } from "./resources/tokens.mjs";
24
+ import { Uploads as UploadsAPIUploads, } from "./resources/uploads.mjs";
25
+ import { Webhooks, } from "./resources/webhooks.mjs";
26
+ import { Jobs, } from "./resources/jobs/jobs.mjs";
27
+ import { buildHeaders } from "./internal/headers.mjs";
28
+ import { readEnv } from "./internal/utils/env.mjs";
29
+ import { formatRequestDetails, loggerFor, parseLogLevel, } from "./internal/utils/log.mjs";
30
+ import { isEmptyObj } from "./internal/utils/values.mjs";
31
+ /**
32
+ * API Client for interfacing with the Chunkify API.
33
+ */
34
+ export class Chunkify {
35
+ /**
36
+ * API Client for interfacing with the Chunkify API.
37
+ *
38
+ * @param {string | null | undefined} [opts.projectAccessToken=process.env['CHUNKIFY_TOKEN'] ?? null]
39
+ * @param {string | null | undefined} [opts.teamAccessToken=process.env['CHUNKIFY_TEAM_TOKEN'] ?? null]
40
+ * @param {string | null | undefined} [opts.webhookKey=process.env['CHUNKIFY_WEBHOOK_SECRET'] ?? null]
41
+ * @param {string} [opts.baseURL=process.env['CHUNKIFY_BASE_URL'] ?? https://api.chunkify.dev/v1] - Override the default base URL for the API.
42
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
43
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
44
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
45
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
46
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
47
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
48
+ */
49
+ constructor({ baseURL = readEnv('CHUNKIFY_BASE_URL'), projectAccessToken = readEnv('CHUNKIFY_TOKEN') ?? null, teamAccessToken = readEnv('CHUNKIFY_TEAM_TOKEN') ?? null, webhookKey = readEnv('CHUNKIFY_WEBHOOK_SECRET') ?? null, ...opts } = {}) {
50
+ _Chunkify_instances.add(this);
51
+ _Chunkify_encoder.set(this, void 0);
52
+ this.files = new API.Files(this);
53
+ this.jobs = new API.Jobs(this);
54
+ this.notifications = new API.Notifications(this);
55
+ this.projects = new API.Projects(this);
56
+ this.sources = new API.Sources(this);
57
+ this.storages = new API.Storages(this);
58
+ this.tokens = new API.Tokens(this);
59
+ this.uploads = new API.Uploads(this);
60
+ this.webhooks = new API.Webhooks(this);
61
+ const options = {
62
+ projectAccessToken,
63
+ teamAccessToken,
64
+ webhookKey,
65
+ ...opts,
66
+ baseURL: baseURL || `https://api.chunkify.dev/v1`,
67
+ };
68
+ this.baseURL = options.baseURL;
69
+ this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1 minute */;
70
+ this.logger = options.logger ?? console;
71
+ const defaultLogLevel = 'warn';
72
+ // Set default logLevel early so that we can log a warning in parseLogLevel.
73
+ this.logLevel = defaultLogLevel;
74
+ this.logLevel =
75
+ parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
76
+ parseLogLevel(readEnv('CHUNKIFY_LOG'), "process.env['CHUNKIFY_LOG']", this) ??
77
+ defaultLogLevel;
78
+ this.fetchOptions = options.fetchOptions;
79
+ this.maxRetries = options.maxRetries ?? 2;
80
+ this.fetch = options.fetch ?? Shims.getDefaultFetch();
81
+ __classPrivateFieldSet(this, _Chunkify_encoder, Opts.FallbackEncoder, "f");
82
+ this._options = options;
83
+ this.projectAccessToken = projectAccessToken;
84
+ this.teamAccessToken = teamAccessToken;
85
+ this.webhookKey = webhookKey;
86
+ }
87
+ /**
88
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
89
+ */
90
+ withOptions(options) {
91
+ const client = new this.constructor({
92
+ ...this._options,
93
+ baseURL: this.baseURL,
94
+ maxRetries: this.maxRetries,
95
+ timeout: this.timeout,
96
+ logger: this.logger,
97
+ logLevel: this.logLevel,
98
+ fetch: this.fetch,
99
+ fetchOptions: this.fetchOptions,
100
+ projectAccessToken: this.projectAccessToken,
101
+ teamAccessToken: this.teamAccessToken,
102
+ webhookKey: this.webhookKey,
103
+ ...options,
104
+ });
105
+ return client;
106
+ }
107
+ defaultQuery() {
108
+ return this._options.defaultQuery;
109
+ }
110
+ validateHeaders({ values, nulls }) {
111
+ if (this.projectAccessToken && values.get('authorization')) {
112
+ return;
113
+ }
114
+ if (nulls.has('authorization')) {
115
+ return;
116
+ }
117
+ if (this.teamAccessToken && values.get('authorization')) {
118
+ return;
119
+ }
120
+ if (nulls.has('authorization')) {
121
+ return;
122
+ }
123
+ throw new Error('Could not resolve authentication method. Expected either projectAccessToken or teamAccessToken to be set. Or for one of the "Authorization" or "Authorization" headers to be explicitly omitted');
124
+ }
125
+ async authHeaders(opts) {
126
+ return buildHeaders([await this.projectAccessTokenAuth(opts), await this.teamAccessTokenAuth(opts)]);
127
+ }
128
+ async projectAccessTokenAuth(opts) {
129
+ if (this.projectAccessToken == null) {
130
+ return undefined;
131
+ }
132
+ return buildHeaders([{ Authorization: `Bearer ${this.projectAccessToken}` }]);
133
+ }
134
+ async teamAccessTokenAuth(opts) {
135
+ if (this.teamAccessToken == null) {
136
+ return undefined;
137
+ }
138
+ return buildHeaders([{ Authorization: `Bearer ${this.teamAccessToken}` }]);
139
+ }
140
+ stringifyQuery(query) {
141
+ return qs.stringify(query, { arrayFormat: 'repeat' });
142
+ }
143
+ getUserAgent() {
144
+ return `${this.constructor.name}/JS ${VERSION}`;
145
+ }
146
+ defaultIdempotencyKey() {
147
+ return `stainless-node-retry-${uuid4()}`;
148
+ }
149
+ makeStatusError(status, error, message, headers) {
150
+ return Errors.APIError.generate(status, error, message, headers);
151
+ }
152
+ buildURL(path, query, defaultBaseURL) {
153
+ const baseURL = (!__classPrivateFieldGet(this, _Chunkify_instances, "m", _Chunkify_baseURLOverridden).call(this) && defaultBaseURL) || this.baseURL;
154
+ const url = isAbsoluteURL(path) ?
155
+ new URL(path)
156
+ : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
157
+ const defaultQuery = this.defaultQuery();
158
+ if (!isEmptyObj(defaultQuery)) {
159
+ query = { ...defaultQuery, ...query };
160
+ }
161
+ if (typeof query === 'object' && query && !Array.isArray(query)) {
162
+ url.search = this.stringifyQuery(query);
163
+ }
164
+ return url.toString();
165
+ }
166
+ /**
167
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
168
+ */
169
+ async prepareOptions(options) { }
170
+ /**
171
+ * Used as a callback for mutating the given `RequestInit` object.
172
+ *
173
+ * This is useful for cases where you want to add certain headers based off of
174
+ * the request properties, e.g. `method` or `url`.
175
+ */
176
+ async prepareRequest(request, { url, options }) { }
177
+ get(path, opts) {
178
+ return this.methodRequest('get', path, opts);
179
+ }
180
+ post(path, opts) {
181
+ return this.methodRequest('post', path, opts);
182
+ }
183
+ patch(path, opts) {
184
+ return this.methodRequest('patch', path, opts);
185
+ }
186
+ put(path, opts) {
187
+ return this.methodRequest('put', path, opts);
188
+ }
189
+ delete(path, opts) {
190
+ return this.methodRequest('delete', path, opts);
191
+ }
192
+ methodRequest(method, path, opts) {
193
+ return this.request(Promise.resolve(opts).then((opts) => {
194
+ return { method, path, ...opts };
195
+ }));
196
+ }
197
+ request(options, remainingRetries = null) {
198
+ return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
199
+ }
200
+ async makeRequest(optionsInput, retriesRemaining, retryOfRequestLogID) {
201
+ const options = await optionsInput;
202
+ const maxRetries = options.maxRetries ?? this.maxRetries;
203
+ if (retriesRemaining == null) {
204
+ retriesRemaining = maxRetries;
205
+ }
206
+ await this.prepareOptions(options);
207
+ const { req, url, timeout } = await this.buildRequest(options, {
208
+ retryCount: maxRetries - retriesRemaining,
209
+ });
210
+ await this.prepareRequest(req, { url, options });
211
+ /** Not an API request ID, just for correlating local log entries. */
212
+ const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
213
+ const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
214
+ const startTime = Date.now();
215
+ loggerFor(this).debug(`[${requestLogID}] sending request`, formatRequestDetails({
216
+ retryOfRequestLogID,
217
+ method: options.method,
218
+ url,
219
+ options,
220
+ headers: req.headers,
221
+ }));
222
+ if (options.signal?.aborted) {
223
+ throw new Errors.APIUserAbortError();
224
+ }
225
+ const controller = new AbortController();
226
+ const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
227
+ const headersTime = Date.now();
228
+ if (response instanceof globalThis.Error) {
229
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
230
+ if (options.signal?.aborted) {
231
+ throw new Errors.APIUserAbortError();
232
+ }
233
+ // detect native connection timeout errors
234
+ // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
235
+ // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
236
+ // others do not provide enough information to distinguish timeouts from other connection errors
237
+ const isTimeout = isAbortError(response) ||
238
+ /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
239
+ if (retriesRemaining) {
240
+ loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`);
241
+ loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, formatRequestDetails({
242
+ retryOfRequestLogID,
243
+ url,
244
+ durationMs: headersTime - startTime,
245
+ message: response.message,
246
+ }));
247
+ return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
248
+ }
249
+ loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`);
250
+ loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, formatRequestDetails({
251
+ retryOfRequestLogID,
252
+ url,
253
+ durationMs: headersTime - startTime,
254
+ message: response.message,
255
+ }));
256
+ if (isTimeout) {
257
+ throw new Errors.APIConnectionTimeoutError();
258
+ }
259
+ throw new Errors.APIConnectionError({ cause: response });
260
+ }
261
+ const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
262
+ if (!response.ok) {
263
+ const shouldRetry = await this.shouldRetry(response);
264
+ if (retriesRemaining && shouldRetry) {
265
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
266
+ // We don't need the body of this response.
267
+ await Shims.CancelReadableStream(response.body);
268
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
269
+ loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
270
+ retryOfRequestLogID,
271
+ url: response.url,
272
+ status: response.status,
273
+ headers: response.headers,
274
+ durationMs: headersTime - startTime,
275
+ }));
276
+ return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
277
+ }
278
+ const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
279
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
280
+ const errText = await response.text().catch((err) => castToError(err).message);
281
+ const errJSON = safeJSON(errText);
282
+ const errMessage = errJSON ? undefined : errText;
283
+ loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({
284
+ retryOfRequestLogID,
285
+ url: response.url,
286
+ status: response.status,
287
+ headers: response.headers,
288
+ message: errMessage,
289
+ durationMs: Date.now() - startTime,
290
+ }));
291
+ const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
292
+ throw err;
293
+ }
294
+ loggerFor(this).info(responseInfo);
295
+ loggerFor(this).debug(`[${requestLogID}] response start`, formatRequestDetails({
296
+ retryOfRequestLogID,
297
+ url: response.url,
298
+ status: response.status,
299
+ headers: response.headers,
300
+ durationMs: headersTime - startTime,
301
+ }));
302
+ return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
303
+ }
304
+ getAPIList(path, Page, opts) {
305
+ return this.requestAPIList(Page, { method: 'get', path, ...opts });
306
+ }
307
+ requestAPIList(Page, options) {
308
+ const request = this.makeRequest(options, null, undefined);
309
+ return new Pagination.PagePromise(this, request, Page);
310
+ }
311
+ async fetchWithTimeout(url, init, ms, controller) {
312
+ const { signal, method, ...options } = init || {};
313
+ if (signal)
314
+ signal.addEventListener('abort', () => controller.abort());
315
+ const timeout = setTimeout(() => controller.abort(), ms);
316
+ const isReadableBody = (globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream) ||
317
+ (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
318
+ const fetchOptions = {
319
+ signal: controller.signal,
320
+ ...(isReadableBody ? { duplex: 'half' } : {}),
321
+ method: 'GET',
322
+ ...options,
323
+ };
324
+ if (method) {
325
+ // Custom methods like 'patch' need to be uppercased
326
+ // See https://github.com/nodejs/undici/issues/2294
327
+ fetchOptions.method = method.toUpperCase();
328
+ }
329
+ try {
330
+ // use undefined this binding; fetch errors if bound to something else in browser/cloudflare
331
+ return await this.fetch.call(undefined, url, fetchOptions);
332
+ }
333
+ finally {
334
+ clearTimeout(timeout);
335
+ }
336
+ }
337
+ async shouldRetry(response) {
338
+ // Note this is not a standard header.
339
+ const shouldRetryHeader = response.headers.get('x-should-retry');
340
+ // If the server explicitly says whether or not to retry, obey.
341
+ if (shouldRetryHeader === 'true')
342
+ return true;
343
+ if (shouldRetryHeader === 'false')
344
+ return false;
345
+ // Retry on request timeouts.
346
+ if (response.status === 408)
347
+ return true;
348
+ // Retry on lock timeouts.
349
+ if (response.status === 409)
350
+ return true;
351
+ // Retry on rate limits.
352
+ if (response.status === 429)
353
+ return true;
354
+ // Retry internal errors.
355
+ if (response.status >= 500)
356
+ return true;
357
+ return false;
358
+ }
359
+ async retryRequest(options, retriesRemaining, requestLogID, responseHeaders) {
360
+ let timeoutMillis;
361
+ // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
362
+ const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
363
+ if (retryAfterMillisHeader) {
364
+ const timeoutMs = parseFloat(retryAfterMillisHeader);
365
+ if (!Number.isNaN(timeoutMs)) {
366
+ timeoutMillis = timeoutMs;
367
+ }
368
+ }
369
+ // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
370
+ const retryAfterHeader = responseHeaders?.get('retry-after');
371
+ if (retryAfterHeader && !timeoutMillis) {
372
+ const timeoutSeconds = parseFloat(retryAfterHeader);
373
+ if (!Number.isNaN(timeoutSeconds)) {
374
+ timeoutMillis = timeoutSeconds * 1000;
375
+ }
376
+ else {
377
+ timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
378
+ }
379
+ }
380
+ // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
381
+ // just do what it says, but otherwise calculate a default
382
+ if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
383
+ const maxRetries = options.maxRetries ?? this.maxRetries;
384
+ timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
385
+ }
386
+ await sleep(timeoutMillis);
387
+ return this.makeRequest(options, retriesRemaining - 1, requestLogID);
388
+ }
389
+ calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries) {
390
+ const initialRetryDelay = 0.5;
391
+ const maxRetryDelay = 8.0;
392
+ const numRetries = maxRetries - retriesRemaining;
393
+ // Apply exponential backoff, but not more than the max.
394
+ const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
395
+ // Apply some jitter, take up to at most 25 percent of the retry time.
396
+ const jitter = 1 - Math.random() * 0.25;
397
+ return sleepSeconds * jitter * 1000;
398
+ }
399
+ async buildRequest(inputOptions, { retryCount = 0 } = {}) {
400
+ const options = { ...inputOptions };
401
+ const { method, path, query, defaultBaseURL } = options;
402
+ const url = this.buildURL(path, query, defaultBaseURL);
403
+ if ('timeout' in options)
404
+ validatePositiveInteger('timeout', options.timeout);
405
+ options.timeout = options.timeout ?? this.timeout;
406
+ const { bodyHeaders, body } = this.buildBody({ options });
407
+ const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
408
+ const req = {
409
+ method,
410
+ headers: reqHeaders,
411
+ ...(options.signal && { signal: options.signal }),
412
+ ...(globalThis.ReadableStream &&
413
+ body instanceof globalThis.ReadableStream && { duplex: 'half' }),
414
+ ...(body && { body }),
415
+ ...(this.fetchOptions ?? {}),
416
+ ...(options.fetchOptions ?? {}),
417
+ };
418
+ return { req, url, timeout: options.timeout };
419
+ }
420
+ async buildHeaders({ options, method, bodyHeaders, retryCount, }) {
421
+ let idempotencyHeaders = {};
422
+ if (this.idempotencyHeader && method !== 'get') {
423
+ if (!options.idempotencyKey)
424
+ options.idempotencyKey = this.defaultIdempotencyKey();
425
+ idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
426
+ }
427
+ const headers = buildHeaders([
428
+ idempotencyHeaders,
429
+ {
430
+ Accept: 'application/json',
431
+ 'User-Agent': this.getUserAgent(),
432
+ 'X-Stainless-Retry-Count': String(retryCount),
433
+ ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
434
+ ...getPlatformHeaders(),
435
+ },
436
+ await this.authHeaders(options),
437
+ this._options.defaultHeaders,
438
+ bodyHeaders,
439
+ options.headers,
440
+ ]);
441
+ this.validateHeaders(headers);
442
+ return headers.values;
443
+ }
444
+ buildBody({ options: { body, headers: rawHeaders } }) {
445
+ if (!body) {
446
+ return { bodyHeaders: undefined, body: undefined };
447
+ }
448
+ const headers = buildHeaders([rawHeaders]);
449
+ if (
450
+ // Pass raw type verbatim
451
+ ArrayBuffer.isView(body) ||
452
+ body instanceof ArrayBuffer ||
453
+ body instanceof DataView ||
454
+ (typeof body === 'string' &&
455
+ // Preserve legacy string encoding behavior for now
456
+ headers.values.has('content-type')) ||
457
+ // `Blob` is superset of `File`
458
+ (globalThis.Blob && body instanceof globalThis.Blob) ||
459
+ // `FormData` -> `multipart/form-data`
460
+ body instanceof FormData ||
461
+ // `URLSearchParams` -> `application/x-www-form-urlencoded`
462
+ body instanceof URLSearchParams ||
463
+ // Send chunked stream (each chunk has own `length`)
464
+ (globalThis.ReadableStream && body instanceof globalThis.ReadableStream)) {
465
+ return { bodyHeaders: undefined, body: body };
466
+ }
467
+ else if (typeof body === 'object' &&
468
+ (Symbol.asyncIterator in body ||
469
+ (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))) {
470
+ return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body) };
471
+ }
472
+ else {
473
+ return __classPrivateFieldGet(this, _Chunkify_encoder, "f").call(this, { body, headers });
474
+ }
475
+ }
476
+ }
477
+ _a = Chunkify, _Chunkify_encoder = new WeakMap(), _Chunkify_instances = new WeakSet(), _Chunkify_baseURLOverridden = function _Chunkify_baseURLOverridden() {
478
+ return this.baseURL !== 'https://api.chunkify.dev/v1';
479
+ };
480
+ Chunkify.Chunkify = _a;
481
+ Chunkify.DEFAULT_TIMEOUT = 60000; // 1 minute
482
+ Chunkify.ChunkifyError = Errors.ChunkifyError;
483
+ Chunkify.APIError = Errors.APIError;
484
+ Chunkify.APIConnectionError = Errors.APIConnectionError;
485
+ Chunkify.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
486
+ Chunkify.APIUserAbortError = Errors.APIUserAbortError;
487
+ Chunkify.NotFoundError = Errors.NotFoundError;
488
+ Chunkify.ConflictError = Errors.ConflictError;
489
+ Chunkify.RateLimitError = Errors.RateLimitError;
490
+ Chunkify.BadRequestError = Errors.BadRequestError;
491
+ Chunkify.AuthenticationError = Errors.AuthenticationError;
492
+ Chunkify.InternalServerError = Errors.InternalServerError;
493
+ Chunkify.PermissionDeniedError = Errors.PermissionDeniedError;
494
+ Chunkify.UnprocessableEntityError = Errors.UnprocessableEntityError;
495
+ Chunkify.toFile = Uploads.toFile;
496
+ Chunkify.Files = Files;
497
+ Chunkify.Jobs = Jobs;
498
+ Chunkify.Notifications = Notifications;
499
+ Chunkify.Projects = Projects;
500
+ Chunkify.Sources = Sources;
501
+ Chunkify.Storages = Storages;
502
+ Chunkify.Tokens = Tokens;
503
+ Chunkify.Uploads = UploadsAPIUploads;
504
+ Chunkify.Webhooks = Webhooks;
505
+ //# sourceMappingURL=client.mjs.map
package/client.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"AAAA,sFAAsF;;;OAI/E,EAAE,KAAK,EAAE;OACT,EAAE,uBAAuB,EAAE,aAAa,EAAE,QAAQ,EAAE;OACpD,EAAE,KAAK,EAAE;OAET,EAAE,WAAW,EAAE,YAAY,EAAE;OAE7B,EAAE,kBAAkB,EAAE;OACtB,KAAK,KAAK;OACV,KAAK,IAAI;OACT,KAAK,EAAE;OACP,EAAE,OAAO,EAAE;OACX,KAAK,MAAM;OACX,KAAK,UAAU;OAEf,KAAK,OAAO;OACZ,KAAK,GAAG;OACR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AmB,AAA7B,CAA8B;AACjD,4BAAmB,GAAG,MAAM,CAAC,mBAAmB,AAA7B,CAA8B;AACjD,8BAAqB,GAAG,MAAM,CAAC,qBAAqB,AAA/B,CAAgC;AACrD,iCAAwB,GAAG,MAAM,CAAC,wBAAwB,AAAlC,CAAmC;AAE3D,eAAM,GAAG,OAAO,CAAC,MAAM,AAAjB,CAAkB;AAajC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;AACvB,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,QAAQ,CAAC,aAAa,GAAG,aAAa,CAAC;AACvC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7B,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7B,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;AACzB,QAAQ,CAAC,OAAO,GAAG,iBAAiB,CAAC;AACrC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { type Chunkify } from "../client.mjs";
2
+ import { type PromiseOrValue } from "../internal/types.mjs";
3
+ import { APIResponseProps } from "../internal/parse.mjs";
4
+ /**
5
+ * A subclass of `Promise` providing additional helper methods
6
+ * for interacting with the SDK.
7
+ */
8
+ export declare class APIPromise<T> extends Promise<T> {
9
+ #private;
10
+ private responsePromise;
11
+ private parseResponse;
12
+ private parsedPromise;
13
+ constructor(client: Chunkify, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: Chunkify, props: APIResponseProps) => PromiseOrValue<T>);
14
+ _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
15
+ /**
16
+ * Gets the raw `Response` instance instead of parsing the response
17
+ * data.
18
+ *
19
+ * If you want to parse the response body but still get the `Response`
20
+ * instance, you can use {@link withResponse()}.
21
+ *
22
+ * 👋 Getting the wrong TypeScript type for `Response`?
23
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
24
+ * to your `tsconfig.json`.
25
+ */
26
+ asResponse(): Promise<Response>;
27
+ /**
28
+ * Gets the parsed response data and the raw `Response` instance.
29
+ *
30
+ * If you just want to get the raw `Response` instance without parsing it,
31
+ * you can use {@link asResponse()}.
32
+ *
33
+ * 👋 Getting the wrong TypeScript type for `Response`?
34
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
35
+ * to your `tsconfig.json`.
36
+ */
37
+ withResponse(): Promise<{
38
+ data: T;
39
+ response: Response;
40
+ }>;
41
+ private parse;
42
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
43
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
44
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
45
+ }
46
+ //# sourceMappingURL=api-promise.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["../src/core/api-promise.ts"],"names":[],"mappings":"OAEO,EAAE,KAAK,QAAQ,EAAE;OAEjB,EAAE,KAAK,cAAc,EAAE;OACvB,EAAE,gBAAgB,EAAwB;AAEjD;;;GAGG;AACH,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;;IAMzC,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,aAAa;IANvB,OAAO,CAAC,aAAa,CAAyB;gBAI5C,MAAM,EAAE,QAAQ,EACR,eAAe,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAC1C,aAAa,GAAE,CACrB,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,gBAAgB,KACpB,cAAc,CAAC,CAAC,CAAwB;IAW/C,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAMjF;;;;;;;;;;OAUG;IACH,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI/B;;;;;;;;;OASG;IACG,YAAY,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC;IAK9D,OAAO,CAAC,KAAK;IAOJ,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EAC1C,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EACjF,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAClF,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAItB,KAAK,CAAC,OAAO,GAAG,KAAK,EAC5B,UAAU,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAChF,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAId,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;CAG1E"}
@@ -0,0 +1,46 @@
1
+ import { type Chunkify } from "../client.js";
2
+ import { type PromiseOrValue } from "../internal/types.js";
3
+ import { APIResponseProps } from "../internal/parse.js";
4
+ /**
5
+ * A subclass of `Promise` providing additional helper methods
6
+ * for interacting with the SDK.
7
+ */
8
+ export declare class APIPromise<T> extends Promise<T> {
9
+ #private;
10
+ private responsePromise;
11
+ private parseResponse;
12
+ private parsedPromise;
13
+ constructor(client: Chunkify, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: Chunkify, props: APIResponseProps) => PromiseOrValue<T>);
14
+ _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
15
+ /**
16
+ * Gets the raw `Response` instance instead of parsing the response
17
+ * data.
18
+ *
19
+ * If you want to parse the response body but still get the `Response`
20
+ * instance, you can use {@link withResponse()}.
21
+ *
22
+ * 👋 Getting the wrong TypeScript type for `Response`?
23
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
24
+ * to your `tsconfig.json`.
25
+ */
26
+ asResponse(): Promise<Response>;
27
+ /**
28
+ * Gets the parsed response data and the raw `Response` instance.
29
+ *
30
+ * If you just want to get the raw `Response` instance without parsing it,
31
+ * you can use {@link asResponse()}.
32
+ *
33
+ * 👋 Getting the wrong TypeScript type for `Response`?
34
+ * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
35
+ * to your `tsconfig.json`.
36
+ */
37
+ withResponse(): Promise<{
38
+ data: T;
39
+ response: Response;
40
+ }>;
41
+ private parse;
42
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
43
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
44
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
45
+ }
46
+ //# sourceMappingURL=api-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["../src/core/api-promise.ts"],"names":[],"mappings":"OAEO,EAAE,KAAK,QAAQ,EAAE;OAEjB,EAAE,KAAK,cAAc,EAAE;OACvB,EAAE,gBAAgB,EAAwB;AAEjD;;;GAGG;AACH,qBAAa,UAAU,CA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