@anthropic-ai/sdk 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/{dist/esm/_shims → _shims}/agent.d.ts +2 -2
  2. package/_shims/agent.d.ts.map +1 -0
  3. package/_shims/agent.js.map +1 -0
  4. package/{dist/esm/_shims/agent.js → _shims/agent.mjs} +1 -1
  5. package/_shims/agent.mjs.map +1 -0
  6. package/{dist/cjs/_shims → _shims}/agent.node.d.ts +1 -0
  7. package/_shims/agent.node.d.ts.map +1 -0
  8. package/_shims/agent.node.js.map +1 -0
  9. package/{dist/esm/_shims/agent.node.js → _shims/agent.node.mjs} +1 -1
  10. package/_shims/agent.node.mjs.map +1 -0
  11. package/_shims/fetch.d.ts +52 -0
  12. package/_shims/fetch.js +13 -0
  13. package/_shims/fetch.mjs +15 -0
  14. package/_shims/fetch.node.d.ts +53 -0
  15. package/_shims/fetch.node.js +12 -0
  16. package/_shims/fetch.node.mjs +14 -0
  17. package/{dist/cjs/_shims → _shims}/fileFromPath.d.ts +1 -2
  18. package/_shims/fileFromPath.d.ts.map +1 -0
  19. package/_shims/fileFromPath.js +16 -0
  20. package/_shims/fileFromPath.js.map +1 -0
  21. package/{dist/esm/_shims/fileFromPath.js → _shims/fileFromPath.mjs} +1 -1
  22. package/_shims/fileFromPath.mjs.map +1 -0
  23. package/{dist/cjs/_shims → _shims}/fileFromPath.node.d.ts +1 -2
  24. package/_shims/fileFromPath.node.d.ts.map +1 -0
  25. package/_shims/fileFromPath.node.js +17 -0
  26. package/_shims/fileFromPath.node.js.map +1 -0
  27. package/{dist/esm/_shims/fileFromPath.node.js → _shims/fileFromPath.node.mjs} +1 -1
  28. package/_shims/fileFromPath.node.mjs.map +1 -0
  29. package/_shims/formdata.d.ts +43 -0
  30. package/_shims/formdata.js +9 -0
  31. package/{dist/esm/_shims/formdata.js → _shims/formdata.mjs} +7 -11
  32. package/_shims/formdata.node.d.ts +44 -0
  33. package/_shims/formdata.node.js +11 -0
  34. package/_shims/getMultipartRequestOptions.d.ts.map +1 -0
  35. package/_shims/getMultipartRequestOptions.js +12 -0
  36. package/_shims/getMultipartRequestOptions.js.map +1 -0
  37. package/_shims/getMultipartRequestOptions.mjs +8 -0
  38. package/_shims/getMultipartRequestOptions.mjs.map +1 -0
  39. package/_shims/getMultipartRequestOptions.node.d.ts.map +1 -0
  40. package/_shims/getMultipartRequestOptions.node.js +22 -0
  41. package/_shims/getMultipartRequestOptions.node.js.map +1 -0
  42. package/{dist/esm/_shims/getMultipartRequestOptions.node.js → _shims/getMultipartRequestOptions.node.mjs} +3 -2
  43. package/_shims/getMultipartRequestOptions.node.mjs.map +1 -0
  44. package/_shims/node-readable.d.ts +23 -0
  45. package/_shims/node-readable.d.ts.map +1 -0
  46. package/_shims/node-readable.js +11 -0
  47. package/_shims/node-readable.js.map +1 -0
  48. package/_shims/node-readable.mjs +7 -0
  49. package/_shims/node-readable.mjs.map +1 -0
  50. package/_shims/node-readable.node.d.ts +8 -0
  51. package/_shims/node-readable.node.d.ts.map +1 -0
  52. package/_shims/node-readable.node.js +9 -0
  53. package/_shims/node-readable.node.js.map +1 -0
  54. package/_shims/node-readable.node.mjs +5 -0
  55. package/_shims/node-readable.node.mjs.map +1 -0
  56. package/{dist/esm/core.d.ts → core.d.ts} +15 -10
  57. package/core.d.ts.map +1 -0
  58. package/{dist/cjs/core.js → core.js} +191 -333
  59. package/core.js.map +1 -0
  60. package/{dist/esm/core.js → core.mjs} +56 -25
  61. package/core.mjs.map +1 -0
  62. package/error.d.ts.map +1 -0
  63. package/{dist/cjs/error.js → error.js} +1 -1
  64. package/error.js.map +1 -0
  65. package/{dist/esm/error.js → error.mjs} +5 -3
  66. package/error.mjs.map +1 -0
  67. package/{dist/cjs/index.d.ts → index.d.mts} +42 -7
  68. package/{dist/esm/index.d.ts → index.d.ts} +38 -3
  69. package/index.d.ts.map +1 -0
  70. package/{dist/cjs/index.js → index.js} +17 -15
  71. package/index.js.map +1 -0
  72. package/{dist/esm/index.js → index.mjs} +12 -6
  73. package/index.mjs.map +1 -0
  74. package/package.json +34 -77
  75. package/resource.d.ts.map +1 -0
  76. package/resource.js.map +1 -0
  77. package/{dist/esm/resource.js → resource.mjs} +1 -1
  78. package/resource.mjs.map +1 -0
  79. package/{dist/esm/resources → resources}/completions.d.ts +3 -3
  80. package/resources/completions.d.ts.map +1 -0
  81. package/{dist/cjs/resources → resources}/completions.js +7 -7
  82. package/resources/completions.js.map +1 -0
  83. package/resources/completions.mjs +15 -0
  84. package/resources/completions.mjs.map +1 -0
  85. package/resources/index.d.ts.map +1 -0
  86. package/{dist/cjs/resources → resources}/index.js +1 -1
  87. package/resources/index.js.map +1 -0
  88. package/resources/index.mjs +3 -0
  89. package/resources/index.mjs.map +1 -0
  90. package/resources/top-level.d.ts.map +1 -0
  91. package/resources/top-level.js.map +1 -0
  92. package/{dist/esm/resources/top-level.js → resources/top-level.mjs} +1 -1
  93. package/resources/top-level.mjs.map +1 -0
  94. package/{_shims → src/_shims}/agent.node.ts +2 -0
  95. package/{_shims → src/_shims}/agent.ts +2 -2
  96. package/src/_shims/fetch.d.ts +52 -0
  97. package/src/_shims/fetch.js +13 -0
  98. package/src/_shims/fetch.mjs +15 -0
  99. package/src/_shims/fetch.node.d.ts +53 -0
  100. package/src/_shims/fetch.node.js +12 -0
  101. package/src/_shims/fetch.node.mjs +14 -0
  102. package/{_shims → src/_shims}/fileFromPath.node.ts +1 -2
  103. package/{_shims → src/_shims}/fileFromPath.ts +1 -2
  104. package/src/_shims/formdata.d.ts +43 -0
  105. package/src/_shims/formdata.js +9 -0
  106. package/src/_shims/formdata.mjs +11 -0
  107. package/src/_shims/formdata.node.d.ts +44 -0
  108. package/src/_shims/formdata.node.js +11 -0
  109. package/{dist/esm/_shims/formdata.node.js → src/_shims/formdata.node.mjs} +3 -1
  110. package/{_shims → src/_shims}/getMultipartRequestOptions.node.ts +2 -1
  111. package/{_shims → src/_shims}/getMultipartRequestOptions.ts +2 -1
  112. package/src/_shims/node-readable.node.ts +10 -0
  113. package/src/_shims/node-readable.ts +30 -0
  114. package/{core.ts → src/core.ts} +42 -20
  115. package/{index.ts → src/index.ts} +50 -3
  116. package/{resources → src/resources}/completions.ts +4 -4
  117. package/{streaming.ts → src/streaming.ts} +6 -3
  118. package/src/uploads.ts +248 -0
  119. package/src/version.ts +1 -0
  120. package/{dist/esm/streaming.d.ts → streaming.d.ts} +2 -0
  121. package/streaming.d.ts.map +1 -0
  122. package/streaming.js +168 -0
  123. package/streaming.js.map +1 -0
  124. package/{dist/esm/streaming.js → streaming.mjs} +5 -4
  125. package/streaming.mjs.map +1 -0
  126. package/uploads.d.ts +90 -0
  127. package/uploads.d.ts.map +1 -0
  128. package/uploads.js +207 -0
  129. package/uploads.js.map +1 -0
  130. package/uploads.mjs +174 -0
  131. package/uploads.mjs.map +1 -0
  132. package/version.d.ts +2 -0
  133. package/version.d.ts.map +1 -0
  134. package/{dist/cjs/version.js → version.js} +1 -1
  135. package/version.js.map +1 -0
  136. package/version.mjs +2 -0
  137. package/version.mjs.map +1 -0
  138. package/LICENSE +0 -8
  139. package/README.md +0 -305
  140. package/_shims/fetch.node.ts +0 -11
  141. package/_shims/fetch.ts +0 -32
  142. package/_shims/formdata.ts +0 -22
  143. package/_shims/newFileArgs.ts +0 -94
  144. package/_shims/toFile.node.ts +0 -25
  145. package/_shims/toFile.ts +0 -26
  146. package/_shims/uploadable.node.ts +0 -21
  147. package/_shims/uploadable.ts +0 -82
  148. package/check-version.ts +0 -18
  149. package/dist/cjs/_shims/agent.d.ts +0 -9
  150. package/dist/cjs/_shims/agent.d.ts.map +0 -1
  151. package/dist/cjs/_shims/agent.js.map +0 -1
  152. package/dist/cjs/_shims/agent.node.d.ts.map +0 -1
  153. package/dist/cjs/_shims/agent.node.js.map +0 -1
  154. package/dist/cjs/_shims/fetch.d.ts +0 -19
  155. package/dist/cjs/_shims/fetch.d.ts.map +0 -1
  156. package/dist/cjs/_shims/fetch.js +0 -24
  157. package/dist/cjs/_shims/fetch.js.map +0 -1
  158. package/dist/cjs/_shims/fetch.node.d.ts +0 -9
  159. package/dist/cjs/_shims/fetch.node.d.ts.map +0 -1
  160. package/dist/cjs/_shims/fetch.node.js +0 -68
  161. package/dist/cjs/_shims/fetch.node.js.map +0 -1
  162. package/dist/cjs/_shims/fileFromPath.d.ts.map +0 -1
  163. package/dist/cjs/_shims/fileFromPath.js +0 -49
  164. package/dist/cjs/_shims/fileFromPath.js.map +0 -1
  165. package/dist/cjs/_shims/fileFromPath.node.d.ts.map +0 -1
  166. package/dist/cjs/_shims/fileFromPath.node.js +0 -50
  167. package/dist/cjs/_shims/fileFromPath.node.js.map +0 -1
  168. package/dist/cjs/_shims/formdata.d.ts +0 -13
  169. package/dist/cjs/_shims/formdata.d.ts.map +0 -1
  170. package/dist/cjs/_shims/formdata.js +0 -20
  171. package/dist/cjs/_shims/formdata.js.map +0 -1
  172. package/dist/cjs/_shims/formdata.node.d.ts +0 -7
  173. package/dist/cjs/_shims/formdata.node.d.ts.map +0 -1
  174. package/dist/cjs/_shims/formdata.node.js +0 -27
  175. package/dist/cjs/_shims/formdata.node.js.map +0 -1
  176. package/dist/cjs/_shims/getMultipartRequestOptions.d.ts +0 -10
  177. package/dist/cjs/_shims/getMultipartRequestOptions.d.ts.map +0 -1
  178. package/dist/cjs/_shims/getMultipartRequestOptions.js +0 -44
  179. package/dist/cjs/_shims/getMultipartRequestOptions.js.map +0 -1
  180. package/dist/cjs/_shims/getMultipartRequestOptions.node.d.ts +0 -10
  181. package/dist/cjs/_shims/getMultipartRequestOptions.node.d.ts.map +0 -1
  182. package/dist/cjs/_shims/getMultipartRequestOptions.node.js +0 -52
  183. package/dist/cjs/_shims/getMultipartRequestOptions.node.js.map +0 -1
  184. package/dist/cjs/_shims/newFileArgs.d.ts +0 -19
  185. package/dist/cjs/_shims/newFileArgs.d.ts.map +0 -1
  186. package/dist/cjs/_shims/newFileArgs.js +0 -169
  187. package/dist/cjs/_shims/newFileArgs.js.map +0 -1
  188. package/dist/cjs/_shims/toFile.d.ts +0 -21
  189. package/dist/cjs/_shims/toFile.d.ts.map +0 -1
  190. package/dist/cjs/_shims/toFile.js +0 -56
  191. package/dist/cjs/_shims/toFile.js.map +0 -1
  192. package/dist/cjs/_shims/toFile.node.d.ts +0 -20
  193. package/dist/cjs/_shims/toFile.node.d.ts.map +0 -1
  194. package/dist/cjs/_shims/toFile.node.js +0 -56
  195. package/dist/cjs/_shims/toFile.node.js.map +0 -1
  196. package/dist/cjs/_shims/uploadable.d.ts +0 -56
  197. package/dist/cjs/_shims/uploadable.d.ts.map +0 -1
  198. package/dist/cjs/_shims/uploadable.js +0 -37
  199. package/dist/cjs/_shims/uploadable.js.map +0 -1
  200. package/dist/cjs/_shims/uploadable.node.d.ts +0 -7
  201. package/dist/cjs/_shims/uploadable.node.d.ts.map +0 -1
  202. package/dist/cjs/_shims/uploadable.node.js +0 -23
  203. package/dist/cjs/_shims/uploadable.node.js.map +0 -1
  204. package/dist/cjs/check-version.d.ts +0 -2
  205. package/dist/cjs/check-version.d.ts.map +0 -1
  206. package/dist/cjs/check-version.js +0 -23
  207. package/dist/cjs/check-version.js.map +0 -1
  208. package/dist/cjs/core.d.ts +0 -221
  209. package/dist/cjs/core.d.ts.map +0 -1
  210. package/dist/cjs/core.js.map +0 -1
  211. package/dist/cjs/error.d.ts +0 -48
  212. package/dist/cjs/error.d.ts.map +0 -1
  213. package/dist/cjs/error.js.map +0 -1
  214. package/dist/cjs/index.d.ts.map +0 -1
  215. package/dist/cjs/index.js.map +0 -1
  216. package/dist/cjs/resource.d.ts +0 -12
  217. package/dist/cjs/resource.d.ts.map +0 -1
  218. package/dist/cjs/resource.js.map +0 -1
  219. package/dist/cjs/resources/completions.d.ts +0 -311
  220. package/dist/cjs/resources/completions.d.ts.map +0 -1
  221. package/dist/cjs/resources/completions.js.map +0 -1
  222. package/dist/cjs/resources/index.d.ts +0 -2
  223. package/dist/cjs/resources/index.d.ts.map +0 -1
  224. package/dist/cjs/resources/index.js.map +0 -1
  225. package/dist/cjs/resources/top-level.d.ts.map +0 -1
  226. package/dist/cjs/resources/top-level.js.map +0 -1
  227. package/dist/cjs/streaming.d.ts +0 -12
  228. package/dist/cjs/streaming.d.ts.map +0 -1
  229. package/dist/cjs/streaming.js +0 -297
  230. package/dist/cjs/streaming.js.map +0 -1
  231. package/dist/cjs/uploads.d.ts +0 -24
  232. package/dist/cjs/uploads.d.ts.map +0 -1
  233. package/dist/cjs/uploads.js +0 -121
  234. package/dist/cjs/uploads.js.map +0 -1
  235. package/dist/cjs/version.d.ts +0 -2
  236. package/dist/cjs/version.d.ts.map +0 -1
  237. package/dist/cjs/version.js.map +0 -1
  238. package/dist/esm/_shims/agent.d.ts.map +0 -1
  239. package/dist/esm/_shims/agent.js.map +0 -1
  240. package/dist/esm/_shims/agent.node.d.ts +0 -6
  241. package/dist/esm/_shims/agent.node.d.ts.map +0 -1
  242. package/dist/esm/_shims/agent.node.js.map +0 -1
  243. package/dist/esm/_shims/fetch.d.ts +0 -19
  244. package/dist/esm/_shims/fetch.d.ts.map +0 -1
  245. package/dist/esm/_shims/fetch.js +0 -18
  246. package/dist/esm/_shims/fetch.js.map +0 -1
  247. package/dist/esm/_shims/fetch.node.d.ts +0 -9
  248. package/dist/esm/_shims/fetch.node.d.ts.map +0 -1
  249. package/dist/esm/_shims/fetch.node.js +0 -7
  250. package/dist/esm/_shims/fetch.node.js.map +0 -1
  251. package/dist/esm/_shims/fileFromPath.d.ts +0 -23
  252. package/dist/esm/_shims/fileFromPath.d.ts.map +0 -1
  253. package/dist/esm/_shims/fileFromPath.js.map +0 -1
  254. package/dist/esm/_shims/fileFromPath.node.d.ts +0 -18
  255. package/dist/esm/_shims/fileFromPath.node.d.ts.map +0 -1
  256. package/dist/esm/_shims/fileFromPath.node.js.map +0 -1
  257. package/dist/esm/_shims/formdata.d.ts +0 -13
  258. package/dist/esm/_shims/formdata.d.ts.map +0 -1
  259. package/dist/esm/_shims/formdata.js.map +0 -1
  260. package/dist/esm/_shims/formdata.node.d.ts +0 -7
  261. package/dist/esm/_shims/formdata.node.d.ts.map +0 -1
  262. package/dist/esm/_shims/formdata.node.js.map +0 -1
  263. package/dist/esm/_shims/getMultipartRequestOptions.d.ts.map +0 -1
  264. package/dist/esm/_shims/getMultipartRequestOptions.js +0 -7
  265. package/dist/esm/_shims/getMultipartRequestOptions.js.map +0 -1
  266. package/dist/esm/_shims/getMultipartRequestOptions.node.d.ts.map +0 -1
  267. package/dist/esm/_shims/getMultipartRequestOptions.node.js.map +0 -1
  268. package/dist/esm/_shims/newFileArgs.d.ts +0 -19
  269. package/dist/esm/_shims/newFileArgs.d.ts.map +0 -1
  270. package/dist/esm/_shims/newFileArgs.js +0 -66
  271. package/dist/esm/_shims/newFileArgs.js.map +0 -1
  272. package/dist/esm/_shims/toFile.d.ts +0 -21
  273. package/dist/esm/_shims/toFile.d.ts.map +0 -1
  274. package/dist/esm/_shims/toFile.js +0 -19
  275. package/dist/esm/_shims/toFile.js.map +0 -1
  276. package/dist/esm/_shims/toFile.node.d.ts +0 -20
  277. package/dist/esm/_shims/toFile.node.d.ts.map +0 -1
  278. package/dist/esm/_shims/toFile.node.js +0 -19
  279. package/dist/esm/_shims/toFile.node.js.map +0 -1
  280. package/dist/esm/_shims/uploadable.d.ts +0 -56
  281. package/dist/esm/_shims/uploadable.d.ts.map +0 -1
  282. package/dist/esm/_shims/uploadable.js +0 -30
  283. package/dist/esm/_shims/uploadable.js.map +0 -1
  284. package/dist/esm/_shims/uploadable.node.d.ts +0 -7
  285. package/dist/esm/_shims/uploadable.node.d.ts.map +0 -1
  286. package/dist/esm/_shims/uploadable.node.js +0 -10
  287. package/dist/esm/_shims/uploadable.node.js.map +0 -1
  288. package/dist/esm/check-version.d.ts +0 -2
  289. package/dist/esm/check-version.d.ts.map +0 -1
  290. package/dist/esm/check-version.js +0 -16
  291. package/dist/esm/check-version.js.map +0 -1
  292. package/dist/esm/core.d.ts.map +0 -1
  293. package/dist/esm/core.js.map +0 -1
  294. package/dist/esm/error.d.ts.map +0 -1
  295. package/dist/esm/error.js.map +0 -1
  296. package/dist/esm/index.d.ts.map +0 -1
  297. package/dist/esm/index.js.map +0 -1
  298. package/dist/esm/package.json +0 -3
  299. package/dist/esm/resource.d.ts.map +0 -1
  300. package/dist/esm/resource.js.map +0 -1
  301. package/dist/esm/resources/completions.d.ts.map +0 -1
  302. package/dist/esm/resources/completions.js +0 -9
  303. package/dist/esm/resources/completions.js.map +0 -1
  304. package/dist/esm/resources/index.d.ts.map +0 -1
  305. package/dist/esm/resources/index.js +0 -3
  306. package/dist/esm/resources/index.js.map +0 -1
  307. package/dist/esm/resources/top-level.d.ts +0 -2
  308. package/dist/esm/resources/top-level.d.ts.map +0 -1
  309. package/dist/esm/resources/top-level.js.map +0 -1
  310. package/dist/esm/streaming.d.ts.map +0 -1
  311. package/dist/esm/streaming.js.map +0 -1
  312. package/dist/esm/uploads.d.ts +0 -24
  313. package/dist/esm/uploads.d.ts.map +0 -1
  314. package/dist/esm/uploads.js +0 -61
  315. package/dist/esm/uploads.js.map +0 -1
  316. package/dist/esm/version.d.ts +0 -2
  317. package/dist/esm/version.d.ts.map +0 -1
  318. package/dist/esm/version.js +0 -2
  319. package/dist/esm/version.js.map +0 -1
  320. package/uploads.ts +0 -81
  321. package/version.ts +0 -1
  322. /package/{dist/cjs/_shims → _shims}/agent.js +0 -0
  323. /package/{dist/cjs/_shims → _shims}/agent.node.js +0 -0
  324. /package/_shims/{formdata.node.ts → formdata.node.mjs} +0 -0
  325. /package/{dist/esm/_shims → _shims}/getMultipartRequestOptions.d.ts +0 -0
  326. /package/{dist/esm/_shims → _shims}/getMultipartRequestOptions.node.d.ts +0 -0
  327. /package/{dist/esm/error.d.ts → error.d.ts} +0 -0
  328. /package/{dist/esm/resource.d.ts → resource.d.ts} +0 -0
  329. /package/{dist/cjs/resource.js → resource.js} +0 -0
  330. /package/{dist/esm/resources → resources}/index.d.ts +0 -0
  331. /package/{dist/cjs/resources → resources}/top-level.d.ts +0 -0
  332. /package/{dist/cjs/resources → resources}/top-level.js +0 -0
  333. /package/{error.ts → src/error.ts} +0 -0
  334. /package/{resource.ts → src/resource.ts} +0 -0
  335. /package/{resources → src/resources}/index.ts +0 -0
  336. /package/{resources → src/resources}/top-level.ts +0 -0
@@ -1,94 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
-
5
- import { type BlobPart, type Uploadable, isResponseLike, isBlobLike } from './uploadable';
6
-
7
- export type ToFileInput = Uploadable | Exclude<BlobPart, string> | AsyncIterable<BlobPart>;
8
-
9
- export type FilePropertyBag = {
10
- type?: string;
11
- lastModified?: number;
12
- };
13
-
14
- export async function newFileArgs(
15
- value: ToFileInput,
16
- name?: string | null,
17
- options: FilePropertyBag = {},
18
- ): Promise<{
19
- bits: BlobPart[];
20
- name: string;
21
- options: FilePropertyBag;
22
- }> {
23
- if (isResponseLike(value)) {
24
- const blob = await value.blob();
25
- name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file';
26
-
27
- return { bits: [blob as any], name, options };
28
- }
29
-
30
- const bits = await getBytes(value);
31
-
32
- name ||= getName(value) ?? 'unknown_file';
33
-
34
- if (!options.type) {
35
- const type = (bits[0] as any)?.type;
36
- if (typeof type === 'string') {
37
- options = { ...options, type };
38
- }
39
- }
40
-
41
- return { bits, name, options };
42
- }
43
-
44
- async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
45
- if (value instanceof Promise) return getBytes(await (value as any));
46
-
47
- let parts: Array<BlobPart> = [];
48
- if (
49
- typeof value === 'string' ||
50
- ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
51
- value instanceof ArrayBuffer
52
- ) {
53
- parts.push(value);
54
- } else if (isBlobLike(value)) {
55
- parts.push(await value.arrayBuffer());
56
- } else if (
57
- isAsyncIterableIterator(value) // includes Readable, ReadableStream, etc.
58
- ) {
59
- for await (const chunk of value) {
60
- parts.push(chunk as BlobPart); // TODO, consider validating?
61
- }
62
- } else {
63
- throw new Error(
64
- `Unexpected data type: ${typeof value}; constructor: ${
65
- value?.constructor?.name
66
- }; props: ${propsForError(value)}`,
67
- );
68
- }
69
-
70
- return parts;
71
- }
72
-
73
- function propsForError(value: any): string {
74
- const props = Object.getOwnPropertyNames(value);
75
- return `[${props.map((p) => `"${p}"`).join(', ')}]`;
76
- }
77
-
78
- function getName(value: any): string | undefined {
79
- return (
80
- getStringFromMaybeBuffer(value.name) ||
81
- getStringFromMaybeBuffer(value.filename) ||
82
- // For fs.ReadStream
83
- getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop()
84
- );
85
- }
86
-
87
- const getStringFromMaybeBuffer = (x: string | Buffer | unknown): string | undefined => {
88
- if (typeof x === 'string') return x;
89
- if (typeof Buffer !== 'undefined' && x instanceof Buffer) return String(x);
90
- return undefined;
91
- };
92
-
93
- const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator<unknown> =>
94
- value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function';
@@ -1,25 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
-
5
- import { File } from 'formdata-node';
6
- import { type ToFileInput, newFileArgs, type FilePropertyBag } from './newFileArgs';
7
- import type { Uploadable, BlobPart, FileLike } from './uploadable.node'; // eslint-disable-line
8
-
9
- /**
10
- * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
11
- * @param bits the raw content of the file. Can be an {@link Uploadable}, {@link BlobPart}, or {@link AsyncIterable} of {@link BlobPart}s
12
- * @param name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
13
- * @param {Object=} options additional properties
14
- * @param {string=} options.type the MIME type of the content
15
- * @param {number=} options.lastModified the last modified timestamp
16
- * @returns a {@link File} with the given properties
17
- */
18
- export async function toFile(
19
- bits: ToFileInput,
20
- name?: string | null | undefined,
21
- options: FilePropertyBag | undefined = {},
22
- ): Promise<FileLike> {
23
- const args = await newFileArgs(bits, name, options);
24
- return new File(args.bits, args.name, args.options);
25
- }
package/_shims/toFile.ts DELETED
@@ -1,26 +0,0 @@
1
- /// <reference lib="dom" />;
2
-
3
- /**
4
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
5
- */
6
-
7
- import { type ToFileInput, newFileArgs, type FilePropertyBag } from './newFileArgs';
8
- import type { FileLike, Uploadable } from './uploadable'; // eslint-disable-line
9
-
10
- /**
11
- * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
12
- * @param bits the raw content of the file. Can be an {@link Uploadable}, {@link BlobPart}, or {@link AsyncIterable} of {@link BlobPart}s
13
- * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
14
- * @param {Object=} options additional properties
15
- * @param {string=} options.type the MIME type of the content
16
- * @param {number=} options.lastModified the last modified timestamp
17
- * @returns a {@link File} with the given properties
18
- */
19
- export async function toFile(
20
- bits: ToFileInput,
21
- name?: string | null | undefined,
22
- options: FilePropertyBag | undefined = {},
23
- ): Promise<FileLike> {
24
- const args = await newFileArgs(bits, name, options);
25
- return new File(args.bits as BlobPart[], args.name, args.options);
26
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
-
5
- import { ReadStream } from 'node:fs';
6
- import {
7
- BlobPart,
8
- Uploadable,
9
- BlobLike,
10
- FileLike,
11
- ResponseLike,
12
- isBlobLike,
13
- isFileLike,
14
- isResponseLike,
15
- } from './uploadable';
16
-
17
- export { BlobPart, BlobLike, FileLike, ResponseLike, isBlobLike, Uploadable };
18
-
19
- export const isUploadable = (value: any): value is Uploadable => {
20
- return isFileLike(value) || isResponseLike(value) || value instanceof ReadStream;
21
- };
@@ -1,82 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
-
5
- import type * as fs from 'node:fs';
6
- import type { toFile } from '@anthropic-ai/sdk/_shims/toFile'; // eslint-disable-line
7
-
8
- export type BlobPart = string | ArrayBuffer | ArrayBufferView | BlobLike | Uint8Array | DataView;
9
-
10
- /**
11
- * Typically, this is a native "File" class.
12
- *
13
- * We provide the {@link toFile} utility to convert a variety of objects
14
- * into the File class.
15
- *
16
- * For convenience, you can also pass a fetch Response
17
- * or, on Node, the result of {@link fs.createReadStream}('./myfile').
18
- */
19
- export type Uploadable = FileLike | ResponseLike | fs.ReadStream;
20
-
21
- /**
22
- * Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
23
- */
24
- export interface BlobLike {
25
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
26
- readonly size: number;
27
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
28
- readonly type: string;
29
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
30
- text(): Promise<string>;
31
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
32
- slice(start?: number, end?: number): BlobLike;
33
- // unfortunately @types/node-fetch@^2.6.4 doesn't type the arrayBuffer method
34
- }
35
-
36
- /**
37
- * Intended to match web.File, node.File, node-fetch.File, etc.
38
- */
39
- export interface FileLike extends BlobLike {
40
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
41
- readonly lastModified: number;
42
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
43
- readonly name: string;
44
- }
45
-
46
- /**
47
- * Intended to match web.Response, node.Response, node-fetch.Response, etc.
48
- */
49
- export interface ResponseLike {
50
- url: string;
51
- blob(): Promise<BlobLike>;
52
- }
53
-
54
- export const isResponseLike = (value: any): value is ResponseLike =>
55
- value != null &&
56
- typeof value === 'object' &&
57
- typeof value.url === 'string' &&
58
- typeof value.blob === 'function';
59
-
60
- export const isFileLike = (value: any): value is FileLike =>
61
- value != null &&
62
- typeof value === 'object' &&
63
- typeof value.name === 'string' &&
64
- typeof value.lastModified === 'number' &&
65
- isBlobLike(value);
66
-
67
- /**
68
- * The BlobLike type omits arrayBuffer() because @types/node-fetch@^2.6.4 lacks it; but this check
69
- * adds the arrayBuffer() method type because it is available and used at runtime
70
- */
71
- export const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise<ArrayBuffer> } =>
72
- value != null &&
73
- typeof value === 'object' &&
74
- typeof value.size === 'number' &&
75
- typeof value.type === 'string' &&
76
- typeof value.text === 'function' &&
77
- typeof value.slice === 'function' &&
78
- typeof value.arrayBuffer === 'function';
79
-
80
- export const isUploadable = (value: any): value is Uploadable => {
81
- return isFileLike(value) || isResponseLike(value);
82
- };
package/check-version.ts DELETED
@@ -1,18 +0,0 @@
1
- import fs from 'fs';
2
-
3
- const main = () => {
4
- const pkg = JSON.parse(fs.readFileSync('package.json').toString()) as Record<string, unknown>;
5
- const version = pkg['version'];
6
- if (!version) throw 'The version property is not set in the package.json file';
7
- if (typeof version !== 'string') {
8
- throw `Unexpected type for the package.json version field; got ${typeof version}, expected string`;
9
- }
10
-
11
- const contents = fs.readFileSync('version.ts', 'utf8');
12
- const output = contents.replace(/(export const VERSION = ')(.*)(')/g, `$1${version}$3`);
13
- fs.writeFileSync('version.ts', output);
14
- };
15
-
16
- if (require.main === module) {
17
- main();
18
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- *
4
- * This is a stub for non-node environments.
5
- * In node environments, it gets replaced agent.node.ts by the package export map
6
- */
7
- import type { Agent } from 'node:http';
8
- export declare const getDefaultAgent: (url: string) => Agent | undefined;
9
- //# sourceMappingURL=agent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../_shims/agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,KAAK,GAAG,SAErD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../_shims/agent.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAII,MAAM,eAAe,GAAG,CAAC,GAAW,EAAqB,EAAE;IAChE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.node.d.ts","sourceRoot":"","sources":["../../../_shims/agent.node.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAWvC,eAAO,MAAM,eAAe,QAAS,MAAM,KAAG,KAAK,GAAG,SAGrD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.node.js","sourceRoot":"","sources":["../../../_shims/agent.node.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,oEAA4C;AAE5C,uDAA8E;AAE9E,MAAM,gBAAgB,GAAU,IAAI,wBAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AAChG,MAAM,iBAAiB,GAAU,IAAI,wBAAc,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AAE5G,oCAAoC;AACpC,IAAI,OAAO,eAAe,KAAK,WAAW,EAAE;IAC1C,eAAe,GAAG,kCAAwD,CAAC;CAC5E;AAEM,MAAM,eAAe,GAAG,CAAC,GAAW,EAAqB,EAAE;IAChE,IAAI,iBAAiB,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAC3E,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- import type * as nf from 'node-fetch';
5
- declare const _fetch: typeof nf.default;
6
- type _fetch = typeof nf.default;
7
- declare const _Request: typeof nf.Request;
8
- type _Request = nf.Request;
9
- declare const _Response: typeof nf.Response;
10
- type _Response = nf.Response;
11
- declare const _Headers: typeof nf.Headers;
12
- type _Headers = nf.Headers;
13
- export declare const isPolyfilled = false;
14
- export { _fetch as fetch, _Request as Request, _Response as Response, _Headers as Headers };
15
- type _RequestInfo = nf.RequestInfo;
16
- type _RequestInit = nf.RequestInit;
17
- type _BodyInit = nf.BodyInit;
18
- export type { _RequestInit as RequestInit, _RequestInfo as RequestInfo, _BodyInit as BodyInit };
19
- //# sourceMappingURL=fetch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../_shims/fetch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAA,MAAM,MAAM,EAAE,OAAO,EAAE,CAAC,OAEV,CAAC;AACf,KAAK,MAAM,GAAG,OAAO,EAAE,CAAC,OAAO,CAAC;AAChC,QAAA,MAAM,QAAQ,EAAE,OAAO,EAAE,CAAC,OAEV,CAAC;AACjB,KAAK,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC;AAC3B,QAAA,MAAM,SAAS,EAAE,OAAO,EAAE,CAAC,QAEV,CAAC;AAClB,KAAK,SAAS,GAAG,EAAE,CAAC,QAAQ,CAAC;AAC7B,QAAA,MAAM,QAAQ,EAAE,OAAO,EAAE,CAAC,OAEV,CAAC;AACjB,KAAK,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC;AAE3B,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,QAAQ,IAAI,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAAE,CAAC;AAE5F,KAAK,YAAY,GAAG,EAAE,CAAC,WAAW,CAAC;AACnC,KAAK,YAAY,GAAG,EAAE,CAAC,WAAW,CAAC;AACnC,KAAK,SAAS,GAAG,EAAE,CAAC,QAAQ,CAAC;AAE7B,YAAY,EAAE,YAAY,IAAI,WAAW,EAAE,YAAY,IAAI,WAAW,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC"}
@@ -1,24 +0,0 @@
1
- 'use strict';
2
- /**
3
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
4
- */
5
- Object.defineProperty(exports, '__esModule', { value: true });
6
- exports.Headers = exports.Response = exports.Request = exports.fetch = exports.isPolyfilled = void 0;
7
- const _fetch =
8
- // @ts-ignore
9
- fetch;
10
- exports.fetch = _fetch;
11
- const _Request =
12
- // @ts-ignore
13
- Request;
14
- exports.Request = _Request;
15
- const _Response =
16
- // @ts-ignore
17
- Response;
18
- exports.Response = _Response;
19
- const _Headers =
20
- // @ts-ignore
21
- Headers;
22
- exports.Headers = _Headers;
23
- exports.isPolyfilled = false;
24
- //# sourceMappingURL=fetch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../_shims/fetch.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,MAAM,MAAM;AACV,aAAa;AACb,KAAY,CAAC;AAiBI,uBAAK;AAfxB,MAAM,QAAQ;AACZ,aAAa;AACb,OAAc,CAAC;AAaqB,2BAAO;AAX7C,MAAM,SAAS;AACb,aAAa;AACb,QAAe,CAAC;AAS0C,6BAAQ;AAPpE,MAAM,QAAQ;AACZ,aAAa;AACb,OAAc,CAAC;AAKiE,2BAAO;AAF5E,QAAA,YAAY,GAAG,KAAK,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- import fetch, { Request, Response, Headers } from 'node-fetch';
5
- import type { RequestInfo, RequestInit, BodyInit } from 'node-fetch';
6
- export { fetch, Request, Response, Headers };
7
- export type { RequestInfo, RequestInit, BodyInit };
8
- export declare const isPolyfilled = true;
9
- //# sourceMappingURL=fetch.node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.node.d.ts","sourceRoot":"","sources":["../../../_shims/fetch.node.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAEnD,eAAO,MAAM,YAAY,OAAO,CAAC"}
@@ -1,68 +0,0 @@
1
- 'use strict';
2
- /**
3
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
4
- */
5
- var __createBinding =
6
- (this && this.__createBinding) ||
7
- (Object.create ?
8
- function (o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = {
13
- enumerable: true,
14
- get: function () {
15
- return m[k];
16
- },
17
- };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }
21
- : function (o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- });
25
- var __setModuleDefault =
26
- (this && this.__setModuleDefault) ||
27
- (Object.create ?
28
- function (o, v) {
29
- Object.defineProperty(o, 'default', { enumerable: true, value: v });
30
- }
31
- : function (o, v) {
32
- o['default'] = v;
33
- });
34
- var __importStar =
35
- (this && this.__importStar) ||
36
- function (mod) {
37
- if (mod && mod.__esModule) return mod;
38
- var result = {};
39
- if (mod != null)
40
- for (var k in mod)
41
- if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
45
- Object.defineProperty(exports, '__esModule', { value: true });
46
- exports.isPolyfilled = exports.Headers = exports.Response = exports.Request = exports.fetch = void 0;
47
- const node_fetch_1 = __importStar(require('node-fetch'));
48
- exports.fetch = node_fetch_1.default;
49
- Object.defineProperty(exports, 'Request', {
50
- enumerable: true,
51
- get: function () {
52
- return node_fetch_1.Request;
53
- },
54
- });
55
- Object.defineProperty(exports, 'Response', {
56
- enumerable: true,
57
- get: function () {
58
- return node_fetch_1.Response;
59
- },
60
- });
61
- Object.defineProperty(exports, 'Headers', {
62
- enumerable: true,
63
- get: function () {
64
- return node_fetch_1.Headers;
65
- },
66
- });
67
- exports.isPolyfilled = true;
68
- //# sourceMappingURL=fetch.node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.node.js","sourceRoot":"","sources":["../../../_shims/fetch.node.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yDAA+D;AAGtD,gBAHF,oBAAK,CAGE;AAAE,wFAHA,oBAAO,OAGA;AAAE,yFAHA,qBAAQ,OAGA;AAAE,wFAHA,oBAAO,OAGA;AAG7B,QAAA,YAAY,GAAG,IAAI,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fileFromPath.d.ts","sourceRoot":"","sources":["../../../_shims/fileFromPath.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;AAExE;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAChE,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACnF,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/F,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,49 +0,0 @@
1
- 'use strict';
2
- /**
3
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
4
- *
5
- * This is a stub that gets replaced by fileFromPath.node.js for node environments
6
- * in the package export map
7
- */
8
- var __awaiter =
9
- (this && this.__awaiter) ||
10
- function (thisArg, _arguments, P, generator) {
11
- function adopt(value) {
12
- return value instanceof P ? value : (
13
- new P(function (resolve) {
14
- resolve(value);
15
- })
16
- );
17
- }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) {
20
- try {
21
- step(generator.next(value));
22
- } catch (e) {
23
- reject(e);
24
- }
25
- }
26
- function rejected(value) {
27
- try {
28
- step(generator['throw'](value));
29
- } catch (e) {
30
- reject(e);
31
- }
32
- }
33
- function step(result) {
34
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
35
- }
36
- step((generator = generator.apply(thisArg, _arguments || [])).next());
37
- });
38
- };
39
- Object.defineProperty(exports, '__esModule', { value: true });
40
- exports.fileFromPath = void 0;
41
- function fileFromPath() {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- throw new Error(
44
- 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/anthropics/anthropic-sdk-typescript#file-uploads',
45
- );
46
- });
47
- }
48
- exports.fileFromPath = fileFromPath;
49
- //# sourceMappingURL=fileFromPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fileFromPath.js","sourceRoot":"","sources":["../../../_shims/fileFromPath.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;AAoBH,SAAsB,YAAY;;QAChC,MAAM,IAAI,KAAK,CACb,iKAAiK,CAClK,CAAC;IACJ,CAAC;CAAA;AAJD,oCAIC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fileFromPath.node.d.ts","sourceRoot":"","sources":["../../../_shims/fileFromPath.node.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;AAIxE;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAChE,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACnF,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/F,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,50 +0,0 @@
1
- 'use strict';
2
- /**
3
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
4
- */
5
- var __awaiter =
6
- (this && this.__awaiter) ||
7
- function (thisArg, _arguments, P, generator) {
8
- function adopt(value) {
9
- return value instanceof P ? value : (
10
- new P(function (resolve) {
11
- resolve(value);
12
- })
13
- );
14
- }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) {
17
- try {
18
- step(generator.next(value));
19
- } catch (e) {
20
- reject(e);
21
- }
22
- }
23
- function rejected(value) {
24
- try {
25
- step(generator['throw'](value));
26
- } catch (e) {
27
- reject(e);
28
- }
29
- }
30
- function step(result) {
31
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
32
- }
33
- step((generator = generator.apply(thisArg, _arguments || [])).next());
34
- });
35
- };
36
- Object.defineProperty(exports, '__esModule', { value: true });
37
- exports.fileFromPath = void 0;
38
- const file_from_path_1 = require('formdata-node/file-from-path');
39
- let warned = false;
40
- function fileFromPath(path, ...args) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- if (!warned) {
43
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
44
- warned = true;
45
- }
46
- return yield (0, file_from_path_1.fileFromPath)(path, ...args);
47
- });
48
- }
49
- exports.fileFromPath = fileFromPath;
50
- //# sourceMappingURL=fileFromPath.node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fileFromPath.node.js","sourceRoot":"","sources":["../../../_shims/fileFromPath.node.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAGH,iEAA6E;AAK7E,IAAI,MAAM,GAAG,KAAK,CAAC;AAanB,SAAsB,YAAY,CAAC,IAAY,EAAE,GAAG,IAAW;;QAC7D,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,uDAAuD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACrG,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,IAAA,6BAAa,EAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;CAAA;AAND,oCAMC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- import type * as fd from 'formdata-node';
5
- declare const _FormData: typeof fd.FormData;
6
- type _FormData = fd.FormData;
7
- declare const _File: typeof fd.File;
8
- type _File = fd.File;
9
- declare const _Blob: typeof fd.Blob;
10
- type _Blob = fd.Blob;
11
- export declare const isPolyfilled = false;
12
- export { _FormData as FormData, _File as File, _Blob as Blob };
13
- //# sourceMappingURL=formdata.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formdata.d.ts","sourceRoot":"","sources":["../../../_shims/formdata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAEzC,QAAA,MAAM,SAAS,EAAE,OAAO,EAAE,CAAC,QAEV,CAAC;AAClB,KAAK,SAAS,GAAG,EAAE,CAAC,QAAQ,CAAC;AAC7B,QAAA,MAAM,KAAK,EAAE,OAAO,EAAE,CAAC,IAEV,CAAC;AACd,KAAK,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC;AACrB,QAAA,MAAM,KAAK,EAAE,OAAO,EAAE,CAAC,IAEV,CAAC;AACd,KAAK,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC;AAErB,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC"}
@@ -1,20 +0,0 @@
1
- 'use strict';
2
- /**
3
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
4
- */
5
- Object.defineProperty(exports, '__esModule', { value: true });
6
- exports.Blob = exports.File = exports.FormData = exports.isPolyfilled = void 0;
7
- const _FormData =
8
- // @ts-ignore
9
- FormData;
10
- exports.FormData = _FormData;
11
- const _File =
12
- // @ts-ignore
13
- File;
14
- exports.File = _File;
15
- const _Blob =
16
- // @ts-ignore
17
- Blob;
18
- exports.Blob = _Blob;
19
- exports.isPolyfilled = false;
20
- //# sourceMappingURL=formdata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formdata.js","sourceRoot":"","sources":["../../../_shims/formdata.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,MAAM,SAAS;AACb,aAAa;AACb,QAAe,CAAC;AAaI,6BAAQ;AAX9B,MAAM,KAAK;AACT,aAAa;AACb,IAAW,CAAC;AAS2B,qBAAI;AAP7C,MAAM,KAAK;AACT,aAAa;AACb,IAAW,CAAC;AAK0C,qBAAI;AAF/C,QAAA,YAAY,GAAG,KAAK,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- import { FormData, File, Blob } from 'formdata-node';
5
- export { FormData, File, Blob };
6
- export declare const isPolyfilled = true;
7
- //# sourceMappingURL=formdata.node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formdata.node.d.ts","sourceRoot":"","sources":["../../../_shims/formdata.node.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEhC,eAAO,MAAM,YAAY,OAAO,CAAC"}
@@ -1,27 +0,0 @@
1
- 'use strict';
2
- /**
3
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
4
- */
5
- Object.defineProperty(exports, '__esModule', { value: true });
6
- exports.isPolyfilled = exports.Blob = exports.File = exports.FormData = void 0;
7
- const formdata_node_1 = require('formdata-node');
8
- Object.defineProperty(exports, 'FormData', {
9
- enumerable: true,
10
- get: function () {
11
- return formdata_node_1.FormData;
12
- },
13
- });
14
- Object.defineProperty(exports, 'File', {
15
- enumerable: true,
16
- get: function () {
17
- return formdata_node_1.File;
18
- },
19
- });
20
- Object.defineProperty(exports, 'Blob', {
21
- enumerable: true,
22
- get: function () {
23
- return formdata_node_1.Blob;
24
- },
25
- });
26
- exports.isPolyfilled = true;
27
- //# sourceMappingURL=formdata.node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formdata.node.js","sourceRoot":"","sources":["../../../_shims/formdata.node.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iDAAqD;AAE5C,yFAFA,wBAAQ,OAEA;AAAE,qFAFA,oBAAI,OAEA;AAAE,qFAFA,oBAAI,OAEA;AAEhB,QAAA,YAAY,GAAG,IAAI,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
- */
4
- import { FormData } from './formdata';
5
- import type { RequestOptions } from '../core';
6
- export declare function getMultipartRequestOptions<T extends {} = Record<string, unknown>>(
7
- form: FormData,
8
- opts: RequestOptions<T>,
9
- ): Promise<RequestOptions<T>>;
10
- //# sourceMappingURL=getMultipartRequestOptions.d.ts.map