openlayer 0.17.0 → 0.18.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 (625) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +112 -60
  3. package/api-promise.d.mts +2 -0
  4. package/api-promise.d.mts.map +1 -0
  5. package/api-promise.d.ts +2 -0
  6. package/api-promise.d.ts.map +1 -0
  7. package/api-promise.js +6 -0
  8. package/api-promise.js.map +1 -0
  9. package/api-promise.mjs +2 -0
  10. package/api-promise.mjs.map +1 -0
  11. package/bin/cli +53 -0
  12. package/bin/migration-config.json +6 -0
  13. package/client.d.mts +186 -0
  14. package/client.d.mts.map +1 -0
  15. package/client.d.ts +186 -0
  16. package/client.d.ts.map +1 -0
  17. package/client.js +463 -0
  18. package/client.js.map +1 -0
  19. package/client.mjs +459 -0
  20. package/client.mjs.map +1 -0
  21. package/core/api-promise.d.mts +46 -0
  22. package/core/api-promise.d.mts.map +1 -0
  23. package/core/api-promise.d.ts +46 -0
  24. package/core/api-promise.d.ts.map +1 -0
  25. package/core/api-promise.js +74 -0
  26. package/core/api-promise.js.map +1 -0
  27. package/core/api-promise.mjs +70 -0
  28. package/core/api-promise.mjs.map +1 -0
  29. package/core/error.d.mts +46 -0
  30. package/core/error.d.mts.map +1 -0
  31. package/core/error.d.ts +46 -0
  32. package/core/error.d.ts.map +1 -0
  33. package/core/error.js +113 -0
  34. package/core/error.js.map +1 -0
  35. package/core/error.mjs +97 -0
  36. package/core/error.mjs.map +1 -0
  37. package/core/resource.d.mts +6 -0
  38. package/core/resource.d.mts.map +1 -0
  39. package/core/resource.d.ts +6 -0
  40. package/core/resource.d.ts.map +1 -0
  41. package/core/resource.js +11 -0
  42. package/core/resource.js.map +1 -0
  43. package/core/resource.mjs +7 -0
  44. package/core/resource.mjs.map +1 -0
  45. package/core/uploads.d.mts +3 -0
  46. package/core/uploads.d.mts.map +1 -0
  47. package/core/uploads.d.ts +3 -0
  48. package/core/uploads.d.ts.map +1 -0
  49. package/core/uploads.js +6 -0
  50. package/core/uploads.js.map +1 -0
  51. package/core/uploads.mjs +2 -0
  52. package/core/uploads.mjs.map +1 -0
  53. package/error.d.mts +2 -0
  54. package/error.d.mts.map +1 -0
  55. package/error.d.ts +1 -46
  56. package/error.d.ts.map +1 -1
  57. package/error.js +3 -110
  58. package/error.js.map +1 -1
  59. package/error.mjs +1 -96
  60. package/error.mjs.map +1 -1
  61. package/index.d.mts +6 -124
  62. package/index.d.mts.map +1 -0
  63. package/index.d.ts +5 -123
  64. package/index.d.ts.map +1 -1
  65. package/index.js +12 -140
  66. package/index.js.map +1 -1
  67. package/index.mjs +5 -103
  68. package/index.mjs.map +1 -1
  69. package/internal/builtin-types.d.mts +73 -0
  70. package/internal/builtin-types.d.mts.map +1 -0
  71. package/internal/builtin-types.d.ts +73 -0
  72. package/internal/builtin-types.d.ts.map +1 -0
  73. package/internal/builtin-types.js +4 -0
  74. package/internal/builtin-types.js.map +1 -0
  75. package/internal/builtin-types.mjs +3 -0
  76. package/internal/builtin-types.mjs.map +1 -0
  77. package/internal/detect-platform.d.mts +15 -0
  78. package/internal/detect-platform.d.mts.map +1 -0
  79. package/internal/detect-platform.d.ts +15 -0
  80. package/internal/detect-platform.d.ts.map +1 -0
  81. package/internal/detect-platform.js +162 -0
  82. package/internal/detect-platform.js.map +1 -0
  83. package/internal/detect-platform.mjs +157 -0
  84. package/internal/detect-platform.mjs.map +1 -0
  85. package/internal/errors.d.mts +3 -0
  86. package/internal/errors.d.mts.map +1 -0
  87. package/internal/errors.d.ts +3 -0
  88. package/internal/errors.d.ts.map +1 -0
  89. package/internal/errors.js +41 -0
  90. package/internal/errors.js.map +1 -0
  91. package/internal/errors.mjs +36 -0
  92. package/internal/errors.mjs.map +1 -0
  93. package/internal/headers.d.mts +20 -0
  94. package/internal/headers.d.mts.map +1 -0
  95. package/internal/headers.d.ts +20 -0
  96. package/internal/headers.d.ts.map +1 -0
  97. package/internal/headers.js +79 -0
  98. package/internal/headers.js.map +1 -0
  99. package/internal/headers.mjs +74 -0
  100. package/internal/headers.mjs.map +1 -0
  101. package/internal/parse.d.mts +12 -0
  102. package/internal/parse.d.mts.map +1 -0
  103. package/internal/parse.d.ts +12 -0
  104. package/internal/parse.d.ts.map +1 -0
  105. package/internal/parse.js +35 -0
  106. package/internal/parse.js.map +1 -0
  107. package/internal/parse.mjs +32 -0
  108. package/internal/parse.mjs.map +1 -0
  109. package/internal/qs/formats.d.mts +7 -0
  110. package/internal/qs/formats.d.mts.map +1 -0
  111. package/internal/qs/formats.d.ts +1 -0
  112. package/internal/qs/formats.d.ts.map +1 -1
  113. package/internal/qs/formats.js +4 -2
  114. package/internal/qs/formats.js.map +1 -1
  115. package/internal/qs/formats.mjs +2 -1
  116. package/internal/qs/formats.mjs.map +1 -1
  117. package/internal/qs/index.d.mts +10 -0
  118. package/internal/qs/index.d.mts.map +1 -0
  119. package/internal/qs/index.d.ts.map +1 -1
  120. package/internal/qs/stringify.d.mts +3 -0
  121. package/internal/qs/stringify.d.mts.map +1 -0
  122. package/internal/qs/stringify.d.ts.map +1 -1
  123. package/internal/qs/stringify.js +15 -17
  124. package/internal/qs/stringify.js.map +1 -1
  125. package/internal/qs/stringify.mjs +17 -19
  126. package/internal/qs/stringify.mjs.map +1 -1
  127. package/internal/qs/types.d.mts +57 -0
  128. package/internal/qs/types.d.mts.map +1 -0
  129. package/internal/qs/utils.d.mts +15 -0
  130. package/internal/qs/utils.d.mts.map +1 -0
  131. package/internal/qs/utils.d.ts +1 -0
  132. package/internal/qs/utils.d.ts.map +1 -1
  133. package/internal/qs/utils.js +14 -13
  134. package/internal/qs/utils.js.map +1 -1
  135. package/internal/qs/utils.mjs +12 -12
  136. package/internal/qs/utils.mjs.map +1 -1
  137. package/internal/request-options.d.mts +75 -0
  138. package/internal/request-options.d.mts.map +1 -0
  139. package/internal/request-options.d.ts +75 -0
  140. package/internal/request-options.d.ts.map +1 -0
  141. package/internal/request-options.js +14 -0
  142. package/internal/request-options.js.map +1 -0
  143. package/internal/request-options.mjs +10 -0
  144. package/internal/request-options.mjs.map +1 -0
  145. package/internal/shim-types.d.mts +17 -0
  146. package/internal/shim-types.d.mts.map +1 -0
  147. package/internal/shim-types.d.ts +17 -0
  148. package/internal/shim-types.d.ts.map +1 -0
  149. package/internal/shim-types.js +4 -0
  150. package/internal/shim-types.js.map +1 -0
  151. package/internal/shim-types.mjs +3 -0
  152. package/internal/shim-types.mjs.map +1 -0
  153. package/internal/shims.d.mts +20 -0
  154. package/internal/shims.d.mts.map +1 -0
  155. package/internal/shims.d.ts +20 -0
  156. package/internal/shims.d.ts.map +1 -0
  157. package/internal/shims.js +92 -0
  158. package/internal/shims.js.map +1 -0
  159. package/internal/shims.mjs +85 -0
  160. package/internal/shims.mjs.map +1 -0
  161. package/internal/to-file.d.mts +45 -0
  162. package/internal/to-file.d.mts.map +1 -0
  163. package/internal/to-file.d.ts +45 -0
  164. package/internal/to-file.d.ts.map +1 -0
  165. package/internal/to-file.js +91 -0
  166. package/internal/to-file.js.map +1 -0
  167. package/internal/to-file.mjs +88 -0
  168. package/internal/to-file.mjs.map +1 -0
  169. package/internal/tslib.js +85 -0
  170. package/internal/tslib.mjs +17 -0
  171. package/internal/types.d.mts +69 -0
  172. package/internal/types.d.mts.map +1 -0
  173. package/internal/types.d.ts +69 -0
  174. package/internal/types.d.ts.map +1 -0
  175. package/internal/types.js +4 -0
  176. package/internal/types.js.map +1 -0
  177. package/internal/types.mjs +3 -0
  178. package/internal/types.mjs.map +1 -0
  179. package/internal/uploads.d.mts +42 -0
  180. package/internal/uploads.d.mts.map +1 -0
  181. package/internal/uploads.d.ts +42 -0
  182. package/internal/uploads.d.ts.map +1 -0
  183. package/internal/uploads.js +141 -0
  184. package/internal/uploads.js.map +1 -0
  185. package/internal/uploads.mjs +131 -0
  186. package/internal/uploads.mjs.map +1 -0
  187. package/internal/utils/base64.d.mts +3 -0
  188. package/internal/utils/base64.d.mts.map +1 -0
  189. package/internal/utils/base64.d.ts +3 -0
  190. package/internal/utils/base64.d.ts.map +1 -0
  191. package/internal/utils/base64.js +38 -0
  192. package/internal/utils/base64.js.map +1 -0
  193. package/internal/utils/base64.mjs +33 -0
  194. package/internal/utils/base64.mjs.map +1 -0
  195. package/internal/utils/bytes.d.mts +4 -0
  196. package/internal/utils/bytes.d.mts.map +1 -0
  197. package/internal/utils/bytes.d.ts +4 -0
  198. package/internal/utils/bytes.d.ts.map +1 -0
  199. package/internal/utils/bytes.js +31 -0
  200. package/internal/utils/bytes.js.map +1 -0
  201. package/internal/utils/bytes.mjs +26 -0
  202. package/internal/utils/bytes.mjs.map +1 -0
  203. package/internal/utils/env.d.mts +9 -0
  204. package/internal/utils/env.d.mts.map +1 -0
  205. package/internal/utils/env.d.ts +9 -0
  206. package/internal/utils/env.d.ts.map +1 -0
  207. package/internal/utils/env.js +22 -0
  208. package/internal/utils/env.js.map +1 -0
  209. package/internal/utils/env.mjs +18 -0
  210. package/internal/utils/env.mjs.map +1 -0
  211. package/internal/utils/log.d.mts +37 -0
  212. package/internal/utils/log.d.mts.map +1 -0
  213. package/internal/utils/log.d.ts +37 -0
  214. package/internal/utils/log.d.ts.map +1 -0
  215. package/internal/utils/log.js +85 -0
  216. package/internal/utils/log.js.map +1 -0
  217. package/internal/utils/log.mjs +79 -0
  218. package/internal/utils/log.mjs.map +1 -0
  219. package/internal/utils/path.d.mts +15 -0
  220. package/internal/utils/path.d.mts.map +1 -0
  221. package/internal/utils/path.d.ts +15 -0
  222. package/internal/utils/path.d.ts.map +1 -0
  223. package/internal/utils/path.js +79 -0
  224. package/internal/utils/path.js.map +1 -0
  225. package/internal/utils/path.mjs +74 -0
  226. package/internal/utils/path.mjs.map +1 -0
  227. package/internal/utils/sleep.d.mts +2 -0
  228. package/internal/utils/sleep.d.mts.map +1 -0
  229. package/internal/utils/sleep.d.ts +2 -0
  230. package/internal/utils/sleep.d.ts.map +1 -0
  231. package/internal/utils/sleep.js +7 -0
  232. package/internal/utils/sleep.js.map +1 -0
  233. package/internal/utils/sleep.mjs +3 -0
  234. package/internal/utils/sleep.mjs.map +1 -0
  235. package/internal/utils/uuid.d.mts +5 -0
  236. package/internal/utils/uuid.d.mts.map +1 -0
  237. package/internal/utils/uuid.d.ts +5 -0
  238. package/internal/utils/uuid.d.ts.map +1 -0
  239. package/internal/utils/uuid.js +19 -0
  240. package/internal/utils/uuid.js.map +1 -0
  241. package/internal/utils/uuid.mjs +15 -0
  242. package/internal/utils/uuid.mjs.map +1 -0
  243. package/internal/utils/values.d.mts +18 -0
  244. package/internal/utils/values.d.mts.map +1 -0
  245. package/internal/utils/values.d.ts +18 -0
  246. package/internal/utils/values.d.ts.map +1 -0
  247. package/internal/utils/values.js +112 -0
  248. package/internal/utils/values.js.map +1 -0
  249. package/internal/utils/values.mjs +94 -0
  250. package/internal/utils/values.mjs.map +1 -0
  251. package/internal/utils.d.mts +7 -0
  252. package/internal/utils.d.mts.map +1 -0
  253. package/internal/utils.d.ts +7 -0
  254. package/internal/utils.d.ts.map +1 -0
  255. package/internal/utils.js +11 -0
  256. package/internal/utils.js.map +1 -0
  257. package/internal/utils.mjs +8 -0
  258. package/internal/utils.mjs.map +1 -0
  259. package/lib/core/cli.d.mts +24 -0
  260. package/lib/core/cli.d.mts.map +1 -0
  261. package/lib/core/cli.js +3 -35
  262. package/lib/core/cli.js.map +1 -1
  263. package/lib/core/openai-monitor.d.mts +57 -0
  264. package/lib/core/openai-monitor.d.mts.map +1 -0
  265. package/lib/core/openai-monitor.d.ts.map +1 -1
  266. package/lib/core/openai-monitor.js +2 -4
  267. package/lib/core/openai-monitor.js.map +1 -1
  268. package/lib/integrations/bedrockAgentTracer.d.mts +3 -0
  269. package/lib/integrations/bedrockAgentTracer.d.mts.map +1 -0
  270. package/lib/integrations/bedrockAgentTracer.d.ts.map +1 -1
  271. package/lib/integrations/bedrockAgentTracer.js +2 -4
  272. package/lib/integrations/bedrockAgentTracer.js.map +1 -1
  273. package/lib/integrations/index.d.mts +5 -0
  274. package/lib/integrations/index.d.mts.map +1 -0
  275. package/lib/integrations/index.d.ts.map +1 -1
  276. package/lib/integrations/index.js +5 -18
  277. package/lib/integrations/index.js.map +1 -1
  278. package/lib/integrations/langchainCallback.d.mts +89 -0
  279. package/lib/integrations/langchainCallback.d.mts.map +1 -0
  280. package/lib/integrations/langchainCallback.d.ts.map +1 -1
  281. package/lib/integrations/openAiTracer.d.mts +3 -0
  282. package/lib/integrations/openAiTracer.d.mts.map +1 -0
  283. package/lib/integrations/openAiTracer.d.ts.map +1 -1
  284. package/lib/integrations/openAiTracer.js +2 -4
  285. package/lib/integrations/openAiTracer.js.map +1 -1
  286. package/lib/integrations/tracedTool.d.mts +66 -0
  287. package/lib/integrations/tracedTool.d.mts.map +1 -0
  288. package/lib/integrations/tracedTool.d.ts.map +1 -1
  289. package/lib/integrations/tracedTool.js +0 -1
  290. package/lib/integrations/tracedTool.js.map +1 -1
  291. package/lib/integrations/tracedTool.mjs +0 -1
  292. package/lib/integrations/tracedTool.mjs.map +1 -1
  293. package/lib/tracing/steps.d.mts +174 -0
  294. package/lib/tracing/steps.d.mts.map +1 -0
  295. package/lib/tracing/tracer.d.mts +94 -0
  296. package/lib/tracing/tracer.d.mts.map +1 -0
  297. package/lib/tracing/tracer.d.ts.map +1 -1
  298. package/lib/tracing/tracer.js +2 -4
  299. package/lib/tracing/tracer.js.map +1 -1
  300. package/lib/tracing/traces.d.mts +9 -0
  301. package/lib/tracing/traces.d.mts.map +1 -0
  302. package/lib/tracing/traces.d.ts.map +1 -1
  303. package/package.json +114 -65
  304. package/resource.d.mts +2 -0
  305. package/resource.d.mts.map +1 -0
  306. package/resource.d.ts +1 -5
  307. package/resource.d.ts.map +1 -1
  308. package/resource.js +3 -8
  309. package/resource.js.map +1 -1
  310. package/resource.mjs +1 -6
  311. package/resource.mjs.map +1 -1
  312. package/resources/commits/commits.d.mts +139 -0
  313. package/resources/commits/commits.d.mts.map +1 -0
  314. package/resources/commits/commits.d.ts +4 -3
  315. package/resources/commits/commits.d.ts.map +1 -1
  316. package/resources/commits/commits.js +6 -37
  317. package/resources/commits/commits.js.map +1 -1
  318. package/resources/commits/commits.mjs +4 -3
  319. package/resources/commits/commits.mjs.map +1 -1
  320. package/resources/commits/index.d.mts +3 -0
  321. package/resources/commits/index.d.mts.map +1 -0
  322. package/resources/commits/index.d.ts.map +1 -1
  323. package/resources/commits/test-results.d.mts +214 -0
  324. package/resources/commits/test-results.d.mts.map +1 -0
  325. package/resources/commits/test-results.d.ts +4 -4
  326. package/resources/commits/test-results.d.ts.map +1 -1
  327. package/resources/commits/test-results.js +7 -7
  328. package/resources/commits/test-results.js.map +1 -1
  329. package/resources/commits/test-results.mjs +7 -7
  330. package/resources/commits/test-results.mjs.map +1 -1
  331. package/resources/commits.d.mts +2 -0
  332. package/resources/commits.d.mts.map +1 -0
  333. package/resources/commits.d.ts.map +1 -1
  334. package/resources/commits.js +2 -15
  335. package/resources/commits.js.map +1 -1
  336. package/resources/index.d.mts +5 -0
  337. package/resources/index.d.mts.map +1 -0
  338. package/resources/index.d.ts.map +1 -1
  339. package/resources/inference-pipelines/data.d.mts +257 -0
  340. package/resources/inference-pipelines/data.d.mts.map +1 -0
  341. package/resources/inference-pipelines/data.d.ts +4 -3
  342. package/resources/inference-pipelines/data.d.ts.map +1 -1
  343. package/resources/inference-pipelines/data.js +7 -3
  344. package/resources/inference-pipelines/data.js.map +1 -1
  345. package/resources/inference-pipelines/data.mjs +7 -3
  346. package/resources/inference-pipelines/data.mjs.map +1 -1
  347. package/resources/inference-pipelines/index.d.mts +5 -0
  348. package/resources/inference-pipelines/index.d.mts.map +1 -0
  349. package/resources/inference-pipelines/index.d.ts.map +1 -1
  350. package/resources/inference-pipelines/inference-pipelines.d.mts +507 -0
  351. package/resources/inference-pipelines/inference-pipelines.d.mts.map +1 -0
  352. package/resources/inference-pipelines/inference-pipelines.d.ts +6 -7
  353. package/resources/inference-pipelines/inference-pipelines.d.ts.map +1 -1
  354. package/resources/inference-pipelines/inference-pipelines.js +36 -51
  355. package/resources/inference-pipelines/inference-pipelines.js.map +1 -1
  356. package/resources/inference-pipelines/inference-pipelines.mjs +32 -15
  357. package/resources/inference-pipelines/inference-pipelines.mjs.map +1 -1
  358. package/resources/inference-pipelines/rows.d.mts +65 -0
  359. package/resources/inference-pipelines/rows.d.mts.map +1 -0
  360. package/resources/inference-pipelines/rows.d.ts +4 -3
  361. package/resources/inference-pipelines/rows.d.ts.map +1 -1
  362. package/resources/inference-pipelines/rows.js +4 -3
  363. package/resources/inference-pipelines/rows.js.map +1 -1
  364. package/resources/inference-pipelines/rows.mjs +4 -3
  365. package/resources/inference-pipelines/rows.mjs.map +1 -1
  366. package/resources/inference-pipelines/test-results.d.mts +218 -0
  367. package/resources/inference-pipelines/test-results.d.mts.map +1 -0
  368. package/resources/inference-pipelines/test-results.d.ts +4 -4
  369. package/resources/inference-pipelines/test-results.d.ts.map +1 -1
  370. package/resources/inference-pipelines/test-results.js +15 -7
  371. package/resources/inference-pipelines/test-results.js.map +1 -1
  372. package/resources/inference-pipelines/test-results.mjs +15 -7
  373. package/resources/inference-pipelines/test-results.mjs.map +1 -1
  374. package/resources/inference-pipelines.d.mts +2 -0
  375. package/resources/inference-pipelines.d.mts.map +1 -0
  376. package/resources/inference-pipelines.d.ts.map +1 -1
  377. package/resources/inference-pipelines.js +2 -15
  378. package/resources/inference-pipelines.js.map +1 -1
  379. package/resources/projects/commits.d.mts +323 -0
  380. package/resources/projects/commits.d.mts.map +1 -0
  381. package/resources/projects/commits.d.ts +5 -5
  382. package/resources/projects/commits.d.ts.map +1 -1
  383. package/resources/projects/commits.js +16 -9
  384. package/resources/projects/commits.js.map +1 -1
  385. package/resources/projects/commits.mjs +16 -9
  386. package/resources/projects/commits.mjs.map +1 -1
  387. package/resources/projects/index.d.mts +5 -0
  388. package/resources/projects/index.d.mts.map +1 -0
  389. package/resources/projects/index.d.ts.map +1 -1
  390. package/resources/projects/inference-pipelines.d.mts +533 -0
  391. package/resources/projects/inference-pipelines.d.mts.map +1 -0
  392. package/resources/projects/inference-pipelines.d.ts +5 -5
  393. package/resources/projects/inference-pipelines.d.ts.map +1 -1
  394. package/resources/projects/inference-pipelines.js +17 -9
  395. package/resources/projects/inference-pipelines.js.map +1 -1
  396. package/resources/projects/inference-pipelines.mjs +17 -9
  397. package/resources/projects/inference-pipelines.mjs.map +1 -1
  398. package/resources/projects/projects.d.mts +249 -0
  399. package/resources/projects/projects.d.mts.map +1 -0
  400. package/resources/projects/projects.d.ts +5 -5
  401. package/resources/projects/projects.d.ts.map +1 -1
  402. package/resources/projects/projects.js +13 -41
  403. package/resources/projects/projects.js.map +1 -1
  404. package/resources/projects/projects.mjs +9 -5
  405. package/resources/projects/projects.mjs.map +1 -1
  406. package/resources/projects/tests.d.mts +501 -0
  407. package/resources/projects/tests.d.mts.map +1 -0
  408. package/resources/projects/tests.d.ts +6 -6
  409. package/resources/projects/tests.d.ts.map +1 -1
  410. package/resources/projects/tests.js +18 -11
  411. package/resources/projects/tests.js.map +1 -1
  412. package/resources/projects/tests.mjs +18 -11
  413. package/resources/projects/tests.mjs.map +1 -1
  414. package/resources/projects.d.mts +2 -0
  415. package/resources/projects.d.mts.map +1 -0
  416. package/resources/projects.d.ts.map +1 -1
  417. package/resources/projects.js +2 -15
  418. package/resources/projects.js.map +1 -1
  419. package/resources/storage/index.d.mts +3 -0
  420. package/resources/storage/index.d.mts.map +1 -0
  421. package/resources/storage/index.d.ts.map +1 -1
  422. package/resources/storage/presigned-url.d.mts +33 -0
  423. package/resources/storage/presigned-url.d.mts.map +1 -0
  424. package/resources/storage/presigned-url.d.ts +4 -3
  425. package/resources/storage/presigned-url.d.ts.map +1 -1
  426. package/resources/storage/presigned-url.js +1 -1
  427. package/resources/storage/presigned-url.js.map +1 -1
  428. package/resources/storage/presigned-url.mjs +1 -1
  429. package/resources/storage/presigned-url.mjs.map +1 -1
  430. package/resources/storage/storage.d.mts +10 -0
  431. package/resources/storage/storage.d.mts.map +1 -0
  432. package/resources/storage/storage.d.ts +1 -1
  433. package/resources/storage/storage.d.ts.map +1 -1
  434. package/resources/storage/storage.js +3 -35
  435. package/resources/storage/storage.js.map +1 -1
  436. package/resources/storage/storage.mjs +1 -1
  437. package/resources/storage.d.mts +2 -0
  438. package/resources/storage.d.mts.map +1 -0
  439. package/resources/storage.d.ts.map +1 -1
  440. package/resources/storage.js +2 -15
  441. package/resources/storage.js.map +1 -1
  442. package/resources.d.mts +2 -0
  443. package/resources.d.mts.map +1 -0
  444. package/resources.d.ts.map +1 -1
  445. package/resources.js +2 -15
  446. package/resources.js.map +1 -1
  447. package/src/api-promise.ts +2 -0
  448. package/src/client.ts +756 -0
  449. package/src/core/README.md +3 -0
  450. package/src/core/api-promise.ts +92 -0
  451. package/src/core/error.ts +130 -0
  452. package/src/core/resource.ts +11 -0
  453. package/src/core/uploads.ts +2 -0
  454. package/src/error.ts +2 -130
  455. package/src/index.ts +5 -233
  456. package/src/internal/README.md +3 -0
  457. package/src/internal/builtin-types.ts +93 -0
  458. package/src/internal/detect-platform.ts +196 -0
  459. package/src/internal/errors.ts +33 -0
  460. package/src/internal/headers.ts +97 -0
  461. package/src/internal/parse.ts +50 -0
  462. package/src/internal/qs/formats.ts +2 -1
  463. package/src/internal/qs/stringify.ts +17 -20
  464. package/src/internal/qs/utils.ts +14 -14
  465. package/src/internal/request-options.ts +91 -0
  466. package/src/internal/shim-types.ts +26 -0
  467. package/src/internal/shims.ts +107 -0
  468. package/src/internal/to-file.ts +154 -0
  469. package/src/internal/types.ts +95 -0
  470. package/src/internal/uploads.ts +187 -0
  471. package/src/internal/utils/base64.ts +40 -0
  472. package/src/internal/utils/bytes.ts +32 -0
  473. package/src/internal/utils/env.ts +18 -0
  474. package/src/internal/utils/log.ts +126 -0
  475. package/src/internal/utils/path.ts +88 -0
  476. package/src/internal/utils/sleep.ts +3 -0
  477. package/src/internal/utils/uuid.ts +17 -0
  478. package/src/internal/utils/values.ts +105 -0
  479. package/src/internal/utils.ts +8 -0
  480. package/src/lib/integrations/tracedTool.ts +0 -1
  481. package/src/resource.ts +2 -11
  482. package/src/resources/commits/commits.ts +6 -4
  483. package/src/resources/commits/test-results.ts +9 -17
  484. package/src/resources/inference-pipelines/data.ts +11 -6
  485. package/src/resources/inference-pipelines/inference-pipelines.ts +18 -40
  486. package/src/resources/inference-pipelines/rows.ts +8 -6
  487. package/src/resources/inference-pipelines/test-results.ts +9 -17
  488. package/src/resources/projects/commits.ts +13 -21
  489. package/src/resources/projects/inference-pipelines.ts +13 -21
  490. package/src/resources/projects/projects.ts +7 -12
  491. package/src/resources/projects/tests.ts +17 -25
  492. package/src/resources/storage/presigned-url.ts +4 -6
  493. package/src/resources/storage/storage.ts +1 -1
  494. package/src/tsconfig.json +2 -2
  495. package/src/uploads.ts +2 -256
  496. package/src/version.ts +1 -1
  497. package/uploads.d.mts +2 -0
  498. package/uploads.d.mts.map +1 -0
  499. package/uploads.d.ts +1 -74
  500. package/uploads.d.ts.map +1 -1
  501. package/uploads.js +3 -167
  502. package/uploads.js.map +1 -1
  503. package/uploads.mjs +1 -156
  504. package/uploads.mjs.map +1 -1
  505. package/version.d.mts +2 -0
  506. package/version.d.mts.map +1 -0
  507. package/version.d.ts +1 -1
  508. package/version.js +1 -1
  509. package/version.mjs +1 -1
  510. package/_shims/MultipartBody.d.ts +0 -9
  511. package/_shims/MultipartBody.d.ts.map +0 -1
  512. package/_shims/MultipartBody.js +0 -16
  513. package/_shims/MultipartBody.js.map +0 -1
  514. package/_shims/MultipartBody.mjs +0 -12
  515. package/_shims/MultipartBody.mjs.map +0 -1
  516. package/_shims/README.md +0 -46
  517. package/_shims/auto/runtime-bun.d.ts +0 -5
  518. package/_shims/auto/runtime-bun.d.ts.map +0 -1
  519. package/_shims/auto/runtime-bun.js +0 -21
  520. package/_shims/auto/runtime-bun.js.map +0 -1
  521. package/_shims/auto/runtime-bun.mjs +0 -2
  522. package/_shims/auto/runtime-bun.mjs.map +0 -1
  523. package/_shims/auto/runtime-node.d.ts +0 -5
  524. package/_shims/auto/runtime-node.d.ts.map +0 -1
  525. package/_shims/auto/runtime-node.js +0 -21
  526. package/_shims/auto/runtime-node.js.map +0 -1
  527. package/_shims/auto/runtime-node.mjs +0 -2
  528. package/_shims/auto/runtime-node.mjs.map +0 -1
  529. package/_shims/auto/runtime.d.ts +0 -5
  530. package/_shims/auto/runtime.d.ts.map +0 -1
  531. package/_shims/auto/runtime.js +0 -21
  532. package/_shims/auto/runtime.js.map +0 -1
  533. package/_shims/auto/runtime.mjs +0 -2
  534. package/_shims/auto/runtime.mjs.map +0 -1
  535. package/_shims/auto/types-node.d.ts +0 -5
  536. package/_shims/auto/types-node.d.ts.map +0 -1
  537. package/_shims/auto/types-node.js +0 -21
  538. package/_shims/auto/types-node.js.map +0 -1
  539. package/_shims/auto/types-node.mjs +0 -2
  540. package/_shims/auto/types-node.mjs.map +0 -1
  541. package/_shims/auto/types.d.ts +0 -101
  542. package/_shims/auto/types.js +0 -3
  543. package/_shims/auto/types.mjs +0 -3
  544. package/_shims/bun-runtime.d.ts +0 -6
  545. package/_shims/bun-runtime.d.ts.map +0 -1
  546. package/_shims/bun-runtime.js +0 -13
  547. package/_shims/bun-runtime.js.map +0 -1
  548. package/_shims/bun-runtime.mjs +0 -10
  549. package/_shims/bun-runtime.mjs.map +0 -1
  550. package/_shims/index.d.ts +0 -83
  551. package/_shims/index.js +0 -17
  552. package/_shims/index.mjs +0 -11
  553. package/_shims/manual-types.d.ts +0 -12
  554. package/_shims/manual-types.js +0 -3
  555. package/_shims/manual-types.mjs +0 -3
  556. package/_shims/node-runtime.d.ts +0 -3
  557. package/_shims/node-runtime.d.ts.map +0 -1
  558. package/_shims/node-runtime.js +0 -98
  559. package/_shims/node-runtime.js.map +0 -1
  560. package/_shims/node-runtime.mjs +0 -56
  561. package/_shims/node-runtime.mjs.map +0 -1
  562. package/_shims/node-types.d.ts +0 -42
  563. package/_shims/node-types.js +0 -3
  564. package/_shims/node-types.mjs +0 -3
  565. package/_shims/registry.d.ts +0 -37
  566. package/_shims/registry.d.ts.map +0 -1
  567. package/_shims/registry.js +0 -41
  568. package/_shims/registry.js.map +0 -1
  569. package/_shims/registry.mjs +0 -37
  570. package/_shims/registry.mjs.map +0 -1
  571. package/_shims/web-runtime.d.ts +0 -5
  572. package/_shims/web-runtime.d.ts.map +0 -1
  573. package/_shims/web-runtime.js +0 -77
  574. package/_shims/web-runtime.js.map +0 -1
  575. package/_shims/web-runtime.mjs +0 -71
  576. package/_shims/web-runtime.mjs.map +0 -1
  577. package/_shims/web-types.d.ts +0 -83
  578. package/_shims/web-types.js +0 -3
  579. package/_shims/web-types.mjs +0 -3
  580. package/core.d.ts +0 -253
  581. package/core.d.ts.map +0 -1
  582. package/core.js +0 -924
  583. package/core.js.map +0 -1
  584. package/core.mjs +0 -892
  585. package/core.mjs.map +0 -1
  586. package/shims/node.d.ts +0 -26
  587. package/shims/node.d.ts.map +0 -1
  588. package/shims/node.js +0 -6
  589. package/shims/node.js.map +0 -1
  590. package/shims/node.mjs +0 -4
  591. package/shims/node.mjs.map +0 -1
  592. package/shims/web.d.ts +0 -26
  593. package/shims/web.d.ts.map +0 -1
  594. package/shims/web.js +0 -6
  595. package/shims/web.js.map +0 -1
  596. package/shims/web.mjs +0 -4
  597. package/shims/web.mjs.map +0 -1
  598. package/src/_shims/MultipartBody.ts +0 -9
  599. package/src/_shims/README.md +0 -46
  600. package/src/_shims/auto/runtime-bun.ts +0 -4
  601. package/src/_shims/auto/runtime-node.ts +0 -4
  602. package/src/_shims/auto/runtime.ts +0 -4
  603. package/src/_shims/auto/types-node.ts +0 -4
  604. package/src/_shims/auto/types.d.ts +0 -101
  605. package/src/_shims/auto/types.js +0 -3
  606. package/src/_shims/auto/types.mjs +0 -3
  607. package/src/_shims/bun-runtime.ts +0 -14
  608. package/src/_shims/index.d.ts +0 -83
  609. package/src/_shims/index.js +0 -17
  610. package/src/_shims/index.mjs +0 -11
  611. package/src/_shims/manual-types.d.ts +0 -12
  612. package/src/_shims/manual-types.js +0 -3
  613. package/src/_shims/manual-types.mjs +0 -3
  614. package/src/_shims/node-runtime.ts +0 -81
  615. package/src/_shims/node-types.d.ts +0 -42
  616. package/src/_shims/node-types.js +0 -3
  617. package/src/_shims/node-types.mjs +0 -3
  618. package/src/_shims/registry.ts +0 -67
  619. package/src/_shims/web-runtime.ts +0 -103
  620. package/src/_shims/web-types.d.ts +0 -83
  621. package/src/_shims/web-types.js +0 -3
  622. package/src/_shims/web-types.mjs +0 -3
  623. package/src/core.ts +0 -1236
  624. package/src/shims/node.ts +0 -50
  625. package/src/shims/web.ts +0 -50
@@ -1,7 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import * as Core from '../../core';
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
5
7
 
6
8
  export class Rows extends APIResource {
7
9
  /**
@@ -16,12 +18,12 @@ export class Rows extends APIResource {
16
18
  * ```
17
19
  */
18
20
  update(
19
- inferencePipelineId: string,
21
+ inferencePipelineID: string,
20
22
  params: RowUpdateParams,
21
- options?: Core.RequestOptions,
22
- ): Core.APIPromise<RowUpdateResponse> {
23
+ options?: RequestOptions,
24
+ ): APIPromise<RowUpdateResponse> {
23
25
  const { inferenceId, ...body } = params;
24
- return this._client.put(`/inference-pipelines/${inferencePipelineId}/rows`, {
26
+ return this._client.put(path`/inference-pipelines/${inferencePipelineID}/rows`, {
25
27
  query: { inferenceId },
26
28
  body,
27
29
  ...options,
@@ -1,8 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import { isRequestOptions } from '../../core';
5
- import * as Core from '../../core';
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
6
7
 
7
8
  export class TestResults extends APIResource {
8
9
  /**
@@ -17,20 +18,11 @@ export class TestResults extends APIResource {
17
18
  * ```
18
19
  */
19
20
  list(
20
- inferencePipelineId: string,
21
- query?: TestResultListParams,
22
- options?: Core.RequestOptions,
23
- ): Core.APIPromise<TestResultListResponse>;
24
- list(inferencePipelineId: string, options?: Core.RequestOptions): Core.APIPromise<TestResultListResponse>;
25
- list(
26
- inferencePipelineId: string,
27
- query: TestResultListParams | Core.RequestOptions = {},
28
- options?: Core.RequestOptions,
29
- ): Core.APIPromise<TestResultListResponse> {
30
- if (isRequestOptions(query)) {
31
- return this.list(inferencePipelineId, {}, query);
32
- }
33
- return this._client.get(`/inference-pipelines/${inferencePipelineId}/results`, { query, ...options });
21
+ inferencePipelineID: string,
22
+ query: TestResultListParams | null | undefined = {},
23
+ options?: RequestOptions,
24
+ ): APIPromise<TestResultListResponse> {
25
+ return this._client.get(path`/inference-pipelines/${inferencePipelineID}/results`, { query, ...options });
34
26
  }
35
27
  }
36
28
 
@@ -1,8 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import { isRequestOptions } from '../../core';
5
- import * as Core from '../../core';
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
6
7
 
7
8
  export class Commits extends APIResource {
8
9
  /**
@@ -20,11 +21,11 @@ export class Commits extends APIResource {
20
21
  * ```
21
22
  */
22
23
  create(
23
- projectId: string,
24
+ projectID: string,
24
25
  body: CommitCreateParams,
25
- options?: Core.RequestOptions,
26
- ): Core.APIPromise<CommitCreateResponse> {
27
- return this._client.post(`/projects/${projectId}/versions`, { body, ...options });
26
+ options?: RequestOptions,
27
+ ): APIPromise<CommitCreateResponse> {
28
+ return this._client.post(path`/projects/${projectID}/versions`, { body, ...options });
28
29
  }
29
30
 
30
31
  /**
@@ -38,20 +39,11 @@ export class Commits extends APIResource {
38
39
  * ```
39
40
  */
40
41
  list(
41
- projectId: string,
42
- query?: CommitListParams,
43
- options?: Core.RequestOptions,
44
- ): Core.APIPromise<CommitListResponse>;
45
- list(projectId: string, options?: Core.RequestOptions): Core.APIPromise<CommitListResponse>;
46
- list(
47
- projectId: string,
48
- query: CommitListParams | Core.RequestOptions = {},
49
- options?: Core.RequestOptions,
50
- ): Core.APIPromise<CommitListResponse> {
51
- if (isRequestOptions(query)) {
52
- return this.list(projectId, {}, query);
53
- }
54
- return this._client.get(`/projects/${projectId}/versions`, { query, ...options });
42
+ projectID: string,
43
+ query: CommitListParams | null | undefined = {},
44
+ options?: RequestOptions,
45
+ ): APIPromise<CommitListResponse> {
46
+ return this._client.get(path`/projects/${projectID}/versions`, { query, ...options });
55
47
  }
56
48
  }
57
49
 
@@ -1,8 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import { isRequestOptions } from '../../core';
5
- import * as Core from '../../core';
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
6
7
 
7
8
  export class InferencePipelines extends APIResource {
8
9
  /**
@@ -21,11 +22,11 @@ export class InferencePipelines extends APIResource {
21
22
  * ```
22
23
  */
23
24
  create(
24
- projectId: string,
25
+ projectID: string,
25
26
  body: InferencePipelineCreateParams,
26
- options?: Core.RequestOptions,
27
- ): Core.APIPromise<InferencePipelineCreateResponse> {
28
- return this._client.post(`/projects/${projectId}/inference-pipelines`, { body, ...options });
27
+ options?: RequestOptions,
28
+ ): APIPromise<InferencePipelineCreateResponse> {
29
+ return this._client.post(path`/projects/${projectID}/inference-pipelines`, { body, ...options });
29
30
  }
30
31
 
31
32
  /**
@@ -40,20 +41,11 @@ export class InferencePipelines extends APIResource {
40
41
  * ```
41
42
  */
42
43
  list(
43
- projectId: string,
44
- query?: InferencePipelineListParams,
45
- options?: Core.RequestOptions,
46
- ): Core.APIPromise<InferencePipelineListResponse>;
47
- list(projectId: string, options?: Core.RequestOptions): Core.APIPromise<InferencePipelineListResponse>;
48
- list(
49
- projectId: string,
50
- query: InferencePipelineListParams | Core.RequestOptions = {},
51
- options?: Core.RequestOptions,
52
- ): Core.APIPromise<InferencePipelineListResponse> {
53
- if (isRequestOptions(query)) {
54
- return this.list(projectId, {}, query);
55
- }
56
- return this._client.get(`/projects/${projectId}/inference-pipelines`, { query, ...options });
44
+ projectID: string,
45
+ query: InferencePipelineListParams | null | undefined = {},
46
+ options?: RequestOptions,
47
+ ): APIPromise<InferencePipelineListResponse> {
48
+ return this._client.get(path`/projects/${projectID}/inference-pipelines`, { query, ...options });
57
49
  }
58
50
  }
59
51
 
@@ -1,8 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import { isRequestOptions } from '../../core';
5
- import * as Core from '../../core';
3
+ import { APIResource } from '../../core/resource';
6
4
  import * as CommitsAPI from './commits';
7
5
  import {
8
6
  CommitCreateParams,
@@ -29,6 +27,8 @@ import {
29
27
  TestUpdateResponse,
30
28
  Tests,
31
29
  } from './tests';
30
+ import { APIPromise } from '../../core/api-promise';
31
+ import { RequestOptions } from '../../internal/request-options';
32
32
 
33
33
  export class Projects extends APIResource {
34
34
  commits: CommitsAPI.Commits = new CommitsAPI.Commits(this._client);
@@ -48,7 +48,7 @@ export class Projects extends APIResource {
48
48
  * });
49
49
  * ```
50
50
  */
51
- create(body: ProjectCreateParams, options?: Core.RequestOptions): Core.APIPromise<ProjectCreateResponse> {
51
+ create(body: ProjectCreateParams, options?: RequestOptions): APIPromise<ProjectCreateResponse> {
52
52
  return this._client.post('/projects', { body, ...options });
53
53
  }
54
54
 
@@ -60,15 +60,10 @@ export class Projects extends APIResource {
60
60
  * const projects = await client.projects.list();
61
61
  * ```
62
62
  */
63
- list(query?: ProjectListParams, options?: Core.RequestOptions): Core.APIPromise<ProjectListResponse>;
64
- list(options?: Core.RequestOptions): Core.APIPromise<ProjectListResponse>;
65
63
  list(
66
- query: ProjectListParams | Core.RequestOptions = {},
67
- options?: Core.RequestOptions,
68
- ): Core.APIPromise<ProjectListResponse> {
69
- if (isRequestOptions(query)) {
70
- return this.list({}, query);
71
- }
64
+ query: ProjectListParams | null | undefined = {},
65
+ options?: RequestOptions,
66
+ ): APIPromise<ProjectListResponse> {
72
67
  return this._client.get('/projects', { query, ...options });
73
68
  }
74
69
  }
@@ -1,8 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import { isRequestOptions } from '../../core';
5
- import * as Core from '../../core';
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
6
7
 
7
8
  export class Tests extends APIResource {
8
9
  /**
@@ -24,11 +25,11 @@ export class Tests extends APIResource {
24
25
  * ```
25
26
  */
26
27
  create(
27
- projectId: string,
28
+ projectID: string,
28
29
  body: TestCreateParams,
29
- options?: Core.RequestOptions,
30
- ): Core.APIPromise<TestCreateResponse> {
31
- return this._client.post(`/projects/${projectId}/tests`, { body, ...options });
30
+ options?: RequestOptions,
31
+ ): APIPromise<TestCreateResponse> {
32
+ return this._client.post(path`/projects/${projectID}/tests`, { body, ...options });
32
33
  }
33
34
 
34
35
  /**
@@ -47,11 +48,11 @@ export class Tests extends APIResource {
47
48
  * ```
48
49
  */
49
50
  update(
50
- projectId: string,
51
+ projectID: string,
51
52
  body: TestUpdateParams,
52
- options?: Core.RequestOptions,
53
- ): Core.APIPromise<TestUpdateResponse> {
54
- return this._client.put(`/projects/${projectId}/tests`, { body, ...options });
53
+ options?: RequestOptions,
54
+ ): APIPromise<TestUpdateResponse> {
55
+ return this._client.put(path`/projects/${projectID}/tests`, { body, ...options });
55
56
  }
56
57
 
57
58
  /**
@@ -65,20 +66,11 @@ export class Tests extends APIResource {
65
66
  * ```
66
67
  */
67
68
  list(
68
- projectId: string,
69
- query?: TestListParams,
70
- options?: Core.RequestOptions,
71
- ): Core.APIPromise<TestListResponse>;
72
- list(projectId: string, options?: Core.RequestOptions): Core.APIPromise<TestListResponse>;
73
- list(
74
- projectId: string,
75
- query: TestListParams | Core.RequestOptions = {},
76
- options?: Core.RequestOptions,
77
- ): Core.APIPromise<TestListResponse> {
78
- if (isRequestOptions(query)) {
79
- return this.list(projectId, {}, query);
80
- }
81
- return this._client.get(`/projects/${projectId}/tests`, { query, ...options });
69
+ projectID: string,
70
+ query: TestListParams | null | undefined = {},
71
+ options?: RequestOptions,
72
+ ): APIPromise<TestListResponse> {
73
+ return this._client.get(path`/projects/${projectID}/tests`, { query, ...options });
82
74
  }
83
75
  }
84
76
 
@@ -1,16 +1,14 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
4
- import * as Core from '../../core';
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
5
6
 
6
7
  export class PresignedURL extends APIResource {
7
8
  /**
8
9
  * Retrieve a presigned url to post storage artifacts.
9
10
  */
10
- create(
11
- params: PresignedURLCreateParams,
12
- options?: Core.RequestOptions,
13
- ): Core.APIPromise<PresignedURLCreateResponse> {
11
+ create(params: PresignedURLCreateParams, options?: RequestOptions): APIPromise<PresignedURLCreateResponse> {
14
12
  const { objectName } = params;
15
13
  return this._client.post('/storage/presigned-url', { query: { objectName }, ...options });
16
14
  }
@@ -1,6 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../resource';
3
+ import { APIResource } from '../../core/resource';
4
4
  import * as PresignedURLAPI from './presigned-url';
5
5
  import { PresignedURL, PresignedURLCreateParams, PresignedURLCreateResponse } from './presigned-url';
6
6
 
package/src/tsconfig.json CHANGED
@@ -4,8 +4,8 @@
4
4
  // via declaration maps
5
5
  "include": ["index.ts"],
6
6
  "compilerOptions": {
7
- "target": "es2015",
8
- "lib": ["DOM"],
7
+ "target": "ES2015",
8
+ "lib": ["DOM", "DOM.Iterable", "ES2018"],
9
9
  "moduleResolution": "node"
10
10
  }
11
11
  }
package/src/uploads.ts CHANGED
@@ -1,256 +1,2 @@
1
- import { type RequestOptions } from './core';
2
- import {
3
- FormData,
4
- File,
5
- type Blob,
6
- type FilePropertyBag,
7
- getMultipartRequestOptions,
8
- type FsReadStream,
9
- isFsReadStream,
10
- } from './_shims/index';
11
- import { MultipartBody } from './_shims/MultipartBody';
12
- export { fileFromPath } from './_shims/index';
13
-
14
- type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | Uint8Array | DataView;
15
- export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Array | DataView;
16
-
17
- /**
18
- * Typically, this is a native "File" class.
19
- *
20
- * We provide the {@link toFile} utility to convert a variety of objects
21
- * into the File class.
22
- *
23
- * For convenience, you can also pass a fetch Response, or in Node,
24
- * the result of fs.createReadStream().
25
- */
26
- export type Uploadable = FileLike | ResponseLike | FsReadStream;
27
-
28
- /**
29
- * Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
30
- */
31
- export interface BlobLike {
32
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
33
- readonly size: number;
34
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
35
- readonly type: string;
36
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
37
- text(): Promise<string>;
38
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
39
- slice(start?: number, end?: number): BlobLike;
40
- // unfortunately @types/node-fetch@^2.6.4 doesn't type the arrayBuffer method
41
- }
42
-
43
- /**
44
- * Intended to match web.File, node.File, node-fetch.File, etc.
45
- */
46
- export interface FileLike extends BlobLike {
47
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
48
- readonly lastModified: number;
49
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
50
- readonly name: string;
51
- }
52
-
53
- /**
54
- * Intended to match web.Response, node.Response, node-fetch.Response, etc.
55
- */
56
- export interface ResponseLike {
57
- url: string;
58
- blob(): Promise<BlobLike>;
59
- }
60
-
61
- export const isResponseLike = (value: any): value is ResponseLike =>
62
- value != null &&
63
- typeof value === 'object' &&
64
- typeof value.url === 'string' &&
65
- typeof value.blob === 'function';
66
-
67
- export const isFileLike = (value: any): value is FileLike =>
68
- value != null &&
69
- typeof value === 'object' &&
70
- typeof value.name === 'string' &&
71
- typeof value.lastModified === 'number' &&
72
- isBlobLike(value);
73
-
74
- /**
75
- * The BlobLike type omits arrayBuffer() because @types/node-fetch@^2.6.4 lacks it; but this check
76
- * adds the arrayBuffer() method type because it is available and used at runtime
77
- */
78
- export const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise<ArrayBuffer> } =>
79
- value != null &&
80
- typeof value === 'object' &&
81
- typeof value.size === 'number' &&
82
- typeof value.type === 'string' &&
83
- typeof value.text === 'function' &&
84
- typeof value.slice === 'function' &&
85
- typeof value.arrayBuffer === 'function';
86
-
87
- export const isUploadable = (value: any): value is Uploadable => {
88
- return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
89
- };
90
-
91
- export type ToFileInput = Uploadable | Exclude<BlobLikePart, string> | AsyncIterable<BlobLikePart>;
92
-
93
- /**
94
- * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
95
- * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s
96
- * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
97
- * @param {Object=} options additional properties
98
- * @param {string=} options.type the MIME type of the content
99
- * @param {number=} options.lastModified the last modified timestamp
100
- * @returns a {@link File} with the given properties
101
- */
102
- export async function toFile(
103
- value: ToFileInput | PromiseLike<ToFileInput>,
104
- name?: string | null | undefined,
105
- options?: FilePropertyBag | undefined,
106
- ): Promise<FileLike> {
107
- // If it's a promise, resolve it.
108
- value = await value;
109
-
110
- // If we've been given a `File` we don't need to do anything
111
- if (isFileLike(value)) {
112
- return value;
113
- }
114
-
115
- if (isResponseLike(value)) {
116
- const blob = await value.blob();
117
- name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file';
118
-
119
- // we need to convert the `Blob` into an array buffer because the `Blob` class
120
- // that `node-fetch` defines is incompatible with the web standard which results
121
- // in `new File` interpreting it as a string instead of binary data.
122
- const data = isBlobLike(blob) ? [(await blob.arrayBuffer()) as any] : [blob];
123
-
124
- return new File(data, name, options);
125
- }
126
-
127
- const bits = await getBytes(value);
128
-
129
- name ||= getName(value) ?? 'unknown_file';
130
-
131
- if (!options?.type) {
132
- const type = (bits[0] as any)?.type;
133
- if (typeof type === 'string') {
134
- options = { ...options, type };
135
- }
136
- }
137
-
138
- return new File(bits, name, options);
139
- }
140
-
141
- async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
142
- let parts: Array<BlobPart> = [];
143
- if (
144
- typeof value === 'string' ||
145
- ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
146
- value instanceof ArrayBuffer
147
- ) {
148
- parts.push(value);
149
- } else if (isBlobLike(value)) {
150
- parts.push(await value.arrayBuffer());
151
- } else if (
152
- isAsyncIterableIterator(value) // includes Readable, ReadableStream, etc.
153
- ) {
154
- for await (const chunk of value) {
155
- parts.push(chunk as BlobPart); // TODO, consider validating?
156
- }
157
- } else {
158
- throw new Error(
159
- `Unexpected data type: ${typeof value}; constructor: ${
160
- value?.constructor?.name
161
- }; props: ${propsForError(value)}`,
162
- );
163
- }
164
-
165
- return parts;
166
- }
167
-
168
- function propsForError(value: any): string {
169
- const props = Object.getOwnPropertyNames(value);
170
- return `[${props.map((p) => `"${p}"`).join(', ')}]`;
171
- }
172
-
173
- function getName(value: any): string | undefined {
174
- return (
175
- getStringFromMaybeBuffer(value.name) ||
176
- getStringFromMaybeBuffer(value.filename) ||
177
- // For fs.ReadStream
178
- getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop()
179
- );
180
- }
181
-
182
- const getStringFromMaybeBuffer = (x: string | Buffer | unknown): string | undefined => {
183
- if (typeof x === 'string') return x;
184
- if (typeof Buffer !== 'undefined' && x instanceof Buffer) return String(x);
185
- return undefined;
186
- };
187
-
188
- const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator<unknown> =>
189
- value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function';
190
-
191
- export const isMultipartBody = (body: any): body is MultipartBody =>
192
- body && typeof body === 'object' && body.body && body[Symbol.toStringTag] === 'MultipartBody';
193
-
194
- /**
195
- * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
196
- * Otherwise returns the request as is.
197
- */
198
- export const maybeMultipartFormRequestOptions = async <T = Record<string, unknown>>(
199
- opts: RequestOptions<T>,
200
- ): Promise<RequestOptions<T | MultipartBody>> => {
201
- if (!hasUploadableValue(opts.body)) return opts;
202
-
203
- const form = await createForm(opts.body);
204
- return getMultipartRequestOptions(form, opts);
205
- };
206
-
207
- export const multipartFormRequestOptions = async <T = Record<string, unknown>>(
208
- opts: RequestOptions<T>,
209
- ): Promise<RequestOptions<T | MultipartBody>> => {
210
- const form = await createForm(opts.body);
211
- return getMultipartRequestOptions(form, opts);
212
- };
213
-
214
- export const createForm = async <T = Record<string, unknown>>(body: T | undefined): Promise<FormData> => {
215
- const form = new FormData();
216
- await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
217
- return form;
218
- };
219
-
220
- const hasUploadableValue = (value: unknown): boolean => {
221
- if (isUploadable(value)) return true;
222
- if (Array.isArray(value)) return value.some(hasUploadableValue);
223
- if (value && typeof value === 'object') {
224
- for (const k in value) {
225
- if (hasUploadableValue((value as any)[k])) return true;
226
- }
227
- }
228
- return false;
229
- };
230
-
231
- const addFormValue = async (form: FormData, key: string, value: unknown): Promise<void> => {
232
- if (value === undefined) return;
233
- if (value == null) {
234
- throw new TypeError(
235
- `Received null for "${key}"; to pass null in FormData, you must use the string 'null'`,
236
- );
237
- }
238
-
239
- // TODO: make nested formats configurable
240
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
241
- form.append(key, String(value));
242
- } else if (isUploadable(value)) {
243
- const file = await toFile(value);
244
- form.append(key, file as File);
245
- } else if (Array.isArray(value)) {
246
- await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry)));
247
- } else if (typeof value === 'object') {
248
- await Promise.all(
249
- Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)),
250
- );
251
- } else {
252
- throw new TypeError(
253
- `Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`,
254
- );
255
- }
256
- };
1
+ /** @deprecated Import from ./core/uploads instead */
2
+ export * from './core/uploads';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.17.0'; // x-release-please-version
1
+ export const VERSION = '0.18.0'; // x-release-please-version
package/uploads.d.mts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./core/uploads.mjs";
2
+ //# sourceMappingURL=uploads.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}