@anthropic-ai/sdk 0.6.2 → 0.6.8

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 (265) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/README.md +16 -6
  3. package/_shims/MultipartBody.d.ts +9 -0
  4. package/_shims/MultipartBody.d.ts.map +1 -0
  5. package/_shims/MultipartBody.js +16 -0
  6. package/_shims/MultipartBody.js.map +1 -0
  7. package/_shims/MultipartBody.mjs +12 -0
  8. package/_shims/MultipartBody.mjs.map +1 -0
  9. package/_shims/README.md +46 -0
  10. package/{src/_shims/ReadableStream.node.ts → _shims/auto/runtime-bun.d.ts} +2 -3
  11. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  12. package/_shims/auto/runtime-bun.js +21 -0
  13. package/_shims/auto/runtime-bun.js.map +1 -0
  14. package/_shims/auto/runtime-bun.mjs +2 -0
  15. package/_shims/auto/runtime-bun.mjs.map +1 -0
  16. package/_shims/auto/runtime-node.d.ts +5 -0
  17. package/_shims/auto/runtime-node.d.ts.map +1 -0
  18. package/_shims/auto/runtime-node.js +21 -0
  19. package/_shims/auto/runtime-node.js.map +1 -0
  20. package/_shims/auto/runtime-node.mjs +2 -0
  21. package/_shims/auto/runtime-node.mjs.map +1 -0
  22. package/_shims/auto/runtime.d.ts +5 -0
  23. package/_shims/auto/runtime.d.ts.map +1 -0
  24. package/_shims/auto/runtime.js +21 -0
  25. package/_shims/auto/runtime.js.map +1 -0
  26. package/_shims/auto/runtime.mjs +2 -0
  27. package/_shims/auto/runtime.mjs.map +1 -0
  28. package/_shims/auto/types-node.d.ts +5 -0
  29. package/_shims/auto/types-node.d.ts.map +1 -0
  30. package/_shims/auto/types-node.js +21 -0
  31. package/_shims/auto/types-node.js.map +1 -0
  32. package/_shims/auto/types-node.mjs +2 -0
  33. package/_shims/auto/types-node.mjs.map +1 -0
  34. package/_shims/auto/types.d.ts +101 -0
  35. package/{src/_shims/ReadableStream.js → _shims/auto/types.js} +0 -2
  36. package/_shims/{ReadableStream.js → auto/types.mjs} +0 -2
  37. package/_shims/bun-runtime.d.ts +6 -0
  38. package/_shims/bun-runtime.d.ts.map +1 -0
  39. package/_shims/bun-runtime.js +14 -0
  40. package/_shims/bun-runtime.js.map +1 -0
  41. package/_shims/bun-runtime.mjs +10 -0
  42. package/_shims/bun-runtime.mjs.map +1 -0
  43. package/_shims/index.d.ts +81 -0
  44. package/_shims/index.js +13 -0
  45. package/_shims/index.mjs +7 -0
  46. package/_shims/manual-types.d.ts +12 -0
  47. package/_shims/manual-types.js +3 -0
  48. package/_shims/manual-types.mjs +3 -0
  49. package/_shims/node-runtime.d.ts +3 -0
  50. package/_shims/node-runtime.d.ts.map +1 -0
  51. package/_shims/node-runtime.js +90 -0
  52. package/_shims/node-runtime.js.map +1 -0
  53. package/_shims/node-runtime.mjs +56 -0
  54. package/_shims/node-runtime.mjs.map +1 -0
  55. package/_shims/node-types.d.ts +42 -0
  56. package/_shims/node-types.js +3 -0
  57. package/_shims/node-types.mjs +3 -0
  58. package/_shims/registry.d.ts +37 -0
  59. package/_shims/registry.d.ts.map +1 -0
  60. package/_shims/registry.js +41 -0
  61. package/_shims/registry.js.map +1 -0
  62. package/_shims/registry.mjs +37 -0
  63. package/_shims/registry.mjs.map +1 -0
  64. package/_shims/web-runtime.d.ts +5 -0
  65. package/_shims/web-runtime.d.ts.map +1 -0
  66. package/_shims/web-runtime.js +78 -0
  67. package/_shims/web-runtime.js.map +1 -0
  68. package/_shims/web-runtime.mjs +71 -0
  69. package/_shims/web-runtime.mjs.map +1 -0
  70. package/_shims/web-types.d.ts +83 -0
  71. package/_shims/web-types.js +3 -0
  72. package/_shims/web-types.mjs +3 -0
  73. package/core.d.ts +172 -224
  74. package/core.d.ts.map +1 -1
  75. package/core.js +701 -736
  76. package/core.js.map +1 -1
  77. package/core.mjs +694 -688
  78. package/core.mjs.map +1 -1
  79. package/error.d.ts +32 -32
  80. package/error.d.ts.map +1 -1
  81. package/error.js +105 -106
  82. package/error.js.map +1 -1
  83. package/error.mjs +101 -91
  84. package/error.mjs.map +1 -1
  85. package/index.d.mts +110 -117
  86. package/index.d.ts +110 -117
  87. package/index.d.ts.map +1 -1
  88. package/index.js +107 -159
  89. package/index.js.map +1 -1
  90. package/index.mjs +84 -104
  91. package/index.mjs.map +1 -1
  92. package/package.json +36 -21
  93. package/resource.d.ts +10 -10
  94. package/resource.js +12 -12
  95. package/resource.mjs +10 -10
  96. package/resources/completions.d.ts +136 -142
  97. package/resources/completions.d.ts.map +1 -1
  98. package/resources/completions.js +9 -14
  99. package/resources/completions.js.map +1 -1
  100. package/resources/completions.mjs +6 -11
  101. package/resources/completions.mjs.map +1 -1
  102. package/resources/index.d.ts +2 -9
  103. package/resources/index.d.ts.map +1 -1
  104. package/resources/index.js +5 -10
  105. package/resources/index.js.map +1 -1
  106. package/resources/index.mjs +2 -2
  107. package/resources/index.mjs.map +1 -1
  108. package/resources/top-level.d.ts +1 -1
  109. package/resources/top-level.js +3 -3
  110. package/resources/top-level.mjs +1 -1
  111. package/shims/node.d.ts +29 -0
  112. package/shims/node.d.ts.map +1 -0
  113. package/shims/node.js +31 -0
  114. package/shims/node.js.map +1 -0
  115. package/shims/node.mjs +5 -0
  116. package/shims/node.mjs.map +1 -0
  117. package/shims/web.d.ts +26 -0
  118. package/shims/web.d.ts.map +1 -0
  119. package/shims/web.js +31 -0
  120. package/shims/web.js.map +1 -0
  121. package/shims/web.mjs +5 -0
  122. package/shims/web.mjs.map +1 -0
  123. package/src/_shims/MultipartBody.ts +9 -0
  124. package/src/_shims/README.md +46 -0
  125. package/src/_shims/auto/runtime-bun.ts +4 -0
  126. package/src/_shims/auto/runtime-node.ts +4 -0
  127. package/src/_shims/auto/runtime.ts +4 -0
  128. package/src/_shims/auto/types-node.ts +4 -0
  129. package/src/_shims/auto/types.d.ts +101 -0
  130. package/src/_shims/auto/types.js +3 -0
  131. package/src/_shims/auto/types.mjs +3 -0
  132. package/src/_shims/bun-runtime.ts +14 -0
  133. package/src/_shims/index.d.ts +81 -0
  134. package/src/_shims/index.js +13 -0
  135. package/src/_shims/index.mjs +7 -0
  136. package/src/_shims/manual-types.d.ts +12 -0
  137. package/src/_shims/manual-types.js +3 -0
  138. package/src/_shims/manual-types.mjs +3 -0
  139. package/src/_shims/node-runtime.ts +83 -0
  140. package/src/_shims/node-types.d.ts +42 -0
  141. package/src/_shims/node-types.js +3 -0
  142. package/src/_shims/node-types.mjs +3 -0
  143. package/src/_shims/registry.ts +67 -0
  144. package/src/_shims/web-runtime.ts +103 -0
  145. package/src/_shims/web-types.d.ts +83 -0
  146. package/src/_shims/web-types.js +3 -0
  147. package/src/_shims/web-types.mjs +3 -0
  148. package/src/core.ts +107 -56
  149. package/src/error.ts +20 -8
  150. package/src/index.ts +24 -17
  151. package/src/resources/completions.ts +11 -11
  152. package/src/resources/index.ts +0 -1
  153. package/src/shims/node.ts +50 -0
  154. package/src/shims/web.ts +50 -0
  155. package/src/streaming.ts +164 -59
  156. package/src/tsconfig.json +11 -0
  157. package/src/uploads.ts +11 -15
  158. package/src/version.ts +1 -1
  159. package/streaming.d.ts +11 -8
  160. package/streaming.d.ts.map +1 -1
  161. package/streaming.js +300 -192
  162. package/streaming.js.map +1 -1
  163. package/streaming.mjs +296 -188
  164. package/streaming.mjs.map +1 -1
  165. package/uploads.d.ts +23 -39
  166. package/uploads.d.ts.map +1 -1
  167. package/uploads.js +111 -157
  168. package/uploads.js.map +1 -1
  169. package/uploads.mjs +107 -133
  170. package/uploads.mjs.map +1 -1
  171. package/version.d.ts +2 -2
  172. package/version.js +4 -4
  173. package/version.mjs +2 -2
  174. package/_shims/ReadableStream.d.ts +0 -38
  175. package/_shims/ReadableStream.mjs +0 -7
  176. package/_shims/ReadableStream.node.d.ts +0 -6
  177. package/_shims/ReadableStream.node.d.ts.map +0 -1
  178. package/_shims/ReadableStream.node.js +0 -14
  179. package/_shims/ReadableStream.node.js.map +0 -1
  180. package/_shims/ReadableStream.node.mjs +0 -3
  181. package/_shims/ReadableStream.node.mjs.map +0 -1
  182. package/_shims/agent.d.ts +0 -9
  183. package/_shims/agent.d.ts.map +0 -1
  184. package/_shims/agent.js +0 -14
  185. package/_shims/agent.js.map +0 -1
  186. package/_shims/agent.mjs +0 -10
  187. package/_shims/agent.mjs.map +0 -1
  188. package/_shims/agent.node.d.ts +0 -7
  189. package/_shims/agent.node.d.ts.map +0 -1
  190. package/_shims/agent.node.js +0 -28
  191. package/_shims/agent.node.js.map +0 -1
  192. package/_shims/agent.node.mjs +0 -16
  193. package/_shims/agent.node.mjs.map +0 -1
  194. package/_shims/fetch.d.ts +0 -60
  195. package/_shims/fetch.js +0 -13
  196. package/_shims/fetch.mjs +0 -15
  197. package/_shims/fetch.node.d.ts +0 -64
  198. package/_shims/fetch.node.js +0 -12
  199. package/_shims/fetch.node.mjs +0 -14
  200. package/_shims/fileFromPath.d.ts +0 -22
  201. package/_shims/fileFromPath.d.ts.map +0 -1
  202. package/_shims/fileFromPath.js +0 -16
  203. package/_shims/fileFromPath.js.map +0 -1
  204. package/_shims/fileFromPath.mjs +0 -12
  205. package/_shims/fileFromPath.mjs.map +0 -1
  206. package/_shims/fileFromPath.node.d.ts +0 -17
  207. package/_shims/fileFromPath.node.d.ts.map +0 -1
  208. package/_shims/fileFromPath.node.js +0 -17
  209. package/_shims/fileFromPath.node.js.map +0 -1
  210. package/_shims/fileFromPath.node.mjs +0 -13
  211. package/_shims/fileFromPath.node.mjs.map +0 -1
  212. package/_shims/formdata.d.ts +0 -43
  213. package/_shims/formdata.js +0 -17
  214. package/_shims/formdata.mjs +0 -20
  215. package/_shims/formdata.node.d.ts +0 -45
  216. package/_shims/formdata.node.js +0 -11
  217. package/_shims/formdata.node.mjs +0 -9
  218. package/_shims/getMultipartRequestOptions.d.ts +0 -10
  219. package/_shims/getMultipartRequestOptions.d.ts.map +0 -1
  220. package/_shims/getMultipartRequestOptions.js +0 -12
  221. package/_shims/getMultipartRequestOptions.js.map +0 -1
  222. package/_shims/getMultipartRequestOptions.mjs +0 -8
  223. package/_shims/getMultipartRequestOptions.mjs.map +0 -1
  224. package/_shims/getMultipartRequestOptions.node.d.ts +0 -10
  225. package/_shims/getMultipartRequestOptions.node.d.ts.map +0 -1
  226. package/_shims/getMultipartRequestOptions.node.js +0 -22
  227. package/_shims/getMultipartRequestOptions.node.js.map +0 -1
  228. package/_shims/getMultipartRequestOptions.node.mjs +0 -18
  229. package/_shims/getMultipartRequestOptions.node.mjs.map +0 -1
  230. package/_shims/node-readable.d.ts +0 -23
  231. package/_shims/node-readable.d.ts.map +0 -1
  232. package/_shims/node-readable.js +0 -11
  233. package/_shims/node-readable.js.map +0 -1
  234. package/_shims/node-readable.mjs +0 -7
  235. package/_shims/node-readable.mjs.map +0 -1
  236. package/_shims/node-readable.node.d.ts +0 -8
  237. package/_shims/node-readable.node.d.ts.map +0 -1
  238. package/_shims/node-readable.node.js +0 -9
  239. package/_shims/node-readable.node.js.map +0 -1
  240. package/_shims/node-readable.node.mjs +0 -5
  241. package/_shims/node-readable.node.mjs.map +0 -1
  242. package/src/_shims/ReadableStream.d.ts +0 -38
  243. package/src/_shims/ReadableStream.mjs +0 -7
  244. package/src/_shims/agent.node.ts +0 -22
  245. package/src/_shims/agent.ts +0 -12
  246. package/src/_shims/fetch.d.ts +0 -60
  247. package/src/_shims/fetch.deno.ts +0 -23
  248. package/src/_shims/fetch.js +0 -13
  249. package/src/_shims/fetch.mjs +0 -15
  250. package/src/_shims/fetch.node.d.ts +0 -64
  251. package/src/_shims/fetch.node.js +0 -12
  252. package/src/_shims/fetch.node.mjs +0 -14
  253. package/src/_shims/fileFromPath.node.ts +0 -29
  254. package/src/_shims/fileFromPath.ts +0 -29
  255. package/src/_shims/formdata.d.ts +0 -43
  256. package/src/_shims/formdata.deno.ts +0 -16
  257. package/src/_shims/formdata.js +0 -17
  258. package/src/_shims/formdata.mjs +0 -20
  259. package/src/_shims/formdata.node.d.ts +0 -45
  260. package/src/_shims/formdata.node.js +0 -11
  261. package/src/_shims/formdata.node.mjs +0 -9
  262. package/src/_shims/getMultipartRequestOptions.node.ts +0 -25
  263. package/src/_shims/getMultipartRequestOptions.ts +0 -14
  264. package/src/_shims/node-readable.node.ts +0 -10
  265. package/src/_shims/node-readable.ts +0 -30
package/CHANGELOG.md CHANGED
@@ -1,5 +1,122 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.8 (2023-10-17)
4
+
5
+ Full Changelog: [v0.6.7...v0.6.8](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.7...v0.6.8)
6
+
7
+ ### Bug Fixes
8
+
9
+ * import web-streams-polyfill without overriding globals ([#186](https://github.com/anthropics/anthropic-sdk-typescript/issues/186)) ([e774e17](https://github.com/anthropics/anthropic-sdk-typescript/commit/e774e1774642668e080de5233aeaa33cf5f1b3ae))
10
+
11
+ ## 0.6.7 (2023-10-16)
12
+
13
+ Full Changelog: [v0.6.6...v0.6.7](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.6...v0.6.7)
14
+
15
+ ### Bug Fixes
16
+
17
+ * improve status code in error messages ([#183](https://github.com/anthropics/anthropic-sdk-typescript/issues/183)) ([7d3bbd4](https://github.com/anthropics/anthropic-sdk-typescript/commit/7d3bbd485c9628bb7c3fb5d1660934198981fcc7))
18
+
19
+
20
+ ### Chores
21
+
22
+ * add case insensitive get header function ([#178](https://github.com/anthropics/anthropic-sdk-typescript/issues/178)) ([13c398d](https://github.com/anthropics/anthropic-sdk-typescript/commit/13c398dee3ff2eaa3b6046630eda9831580348f4))
23
+ * **internal:** add debug logs for stream responses ([#182](https://github.com/anthropics/anthropic-sdk-typescript/issues/182)) ([a1fa1b7](https://github.com/anthropics/anthropic-sdk-typescript/commit/a1fa1b7766248f3178cb55ac5342409a57c1dbb8))
24
+ * update comment ([#179](https://github.com/anthropics/anthropic-sdk-typescript/issues/179)) ([27a425e](https://github.com/anthropics/anthropic-sdk-typescript/commit/27a425ee64dcdc569b92ac27b501bca0dadf2dea))
25
+
26
+
27
+ ### Documentation
28
+
29
+ * organisation -> organization (UK to US English) ([#185](https://github.com/anthropics/anthropic-sdk-typescript/issues/185)) ([70257d4](https://github.com/anthropics/anthropic-sdk-typescript/commit/70257d43296f5b448b5649a34b67a3a3a26704ab))
30
+
31
+
32
+ ### Refactors
33
+
34
+ * **streaming:** change Stream constructor signature ([#174](https://github.com/anthropics/anthropic-sdk-typescript/issues/174)) ([1951824](https://github.com/anthropics/anthropic-sdk-typescript/commit/195182432c41a2a8a4fc425788267e60f36f5820))
35
+ * **test:** refactor authentication tests ([#176](https://github.com/anthropics/anthropic-sdk-typescript/issues/176)) ([f59daad](https://github.com/anthropics/anthropic-sdk-typescript/commit/f59daad06cab4c5df3068ea7f71ecbb20d8af141))
36
+
37
+ ## 0.6.6 (2023-10-11)
38
+
39
+ Full Changelog: [v0.6.5...v0.6.6](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.5...v0.6.6)
40
+
41
+ ### Chores
42
+
43
+ * update README ([#173](https://github.com/anthropics/anthropic-sdk-typescript/issues/173)) ([5f50c1b](https://github.com/anthropics/anthropic-sdk-typescript/commit/5f50c1b2f160610c89f158a10d83029c356d925a))
44
+
45
+ ## 0.6.5 (2023-10-11)
46
+
47
+ Full Changelog: [v0.6.4...v0.6.5](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.4...v0.6.5)
48
+
49
+ ### Features
50
+
51
+ * **client:** handle retry-after with a date ([#162](https://github.com/anthropics/anthropic-sdk-typescript/issues/162)) ([31bd609](https://github.com/anthropics/anthropic-sdk-typescript/commit/31bd60905858a6532414665a1368ae9f5fd29370))
52
+ * **client:** retry on 408 Request Timeout ([#151](https://github.com/anthropics/anthropic-sdk-typescript/issues/151)) ([3523ffe](https://github.com/anthropics/anthropic-sdk-typescript/commit/3523ffe5647448d5a5960b1339c9a17374e85dd5))
53
+ * **client:** support importing node or web shims manually ([#157](https://github.com/anthropics/anthropic-sdk-typescript/issues/157)) ([c1237fe](https://github.com/anthropics/anthropic-sdk-typescript/commit/c1237feaea9ca2d244720f2f75e023450a78019f))
54
+ * **errors:** add status code to error message ([#155](https://github.com/anthropics/anthropic-sdk-typescript/issues/155)) ([76cf128](https://github.com/anthropics/anthropic-sdk-typescript/commit/76cf128b68f206038945ac4f54f6f50e8a6a2c1b))
55
+ * **package:** export a root error type ([#160](https://github.com/anthropics/anthropic-sdk-typescript/issues/160)) ([51d8d60](https://github.com/anthropics/anthropic-sdk-typescript/commit/51d8d60b72fbe99dcb4d5a9ec32abbcb21ba1460))
56
+
57
+
58
+ ### Bug Fixes
59
+
60
+ * **client:** eliminate circular imports, which cause runtime errors in webpack dev bundles ([#170](https://github.com/anthropics/anthropic-sdk-typescript/issues/170)) ([4a86733](https://github.com/anthropics/anthropic-sdk-typescript/commit/4a86733b9d11349fca041683ac9d89685133557d))
61
+ * fix namespace exports regression ([#171](https://github.com/anthropics/anthropic-sdk-typescript/issues/171)) ([0689a91](https://github.com/anthropics/anthropic-sdk-typescript/commit/0689a9196619d968870b7fd2e1a0f037a1aee282))
62
+ * prevent ReferenceError, update compatibility to ES2020 and Node 18+ ([#169](https://github.com/anthropics/anthropic-sdk-typescript/issues/169)) ([9753314](https://github.com/anthropics/anthropic-sdk-typescript/commit/9753314b7e36a270bb4c29f2981c521ec9c17773))
63
+
64
+
65
+ ### Chores
66
+
67
+ * **internal:** bump lock file ([#159](https://github.com/anthropics/anthropic-sdk-typescript/issues/159)) ([e6030fa](https://github.com/anthropics/anthropic-sdk-typescript/commit/e6030fa915f26569f9c48c478a5e6c01910a6557))
68
+ * **internal:** minor formatting improvement ([#168](https://github.com/anthropics/anthropic-sdk-typescript/issues/168)) ([6447608](https://github.com/anthropics/anthropic-sdk-typescript/commit/644760883802bc2769a916fa477f2c6491f018fd))
69
+ * **internal:** update lock file ([#161](https://github.com/anthropics/anthropic-sdk-typescript/issues/161)) ([370ce3c](https://github.com/anthropics/anthropic-sdk-typescript/commit/370ce3c34b87591071fefc8b53977078603b6ca4))
70
+ * **internal:** update lock file ([#163](https://github.com/anthropics/anthropic-sdk-typescript/issues/163)) ([4a37181](https://github.com/anthropics/anthropic-sdk-typescript/commit/4a37181e0ceada13e3ed61d6df7aa34492dc57a7))
71
+ * **internal:** update lock file ([#164](https://github.com/anthropics/anthropic-sdk-typescript/issues/164)) ([939c155](https://github.com/anthropics/anthropic-sdk-typescript/commit/939c155277e67c19f7b2ff956f7cf0d40d4671cd))
72
+
73
+
74
+ ### Documentation
75
+
76
+ * **api.md:** add shared models ([#158](https://github.com/anthropics/anthropic-sdk-typescript/issues/158)) ([33e5518](https://github.com/anthropics/anthropic-sdk-typescript/commit/33e5518bdeca83bbbde0e144e444609f569f1477))
77
+ * declare Bun 1.0 officially supported ([#154](https://github.com/anthropics/anthropic-sdk-typescript/issues/154)) ([429d8f4](https://github.com/anthropics/anthropic-sdk-typescript/commit/429d8f44b113a91599f0ebb69128636da82a5050))
78
+ * **readme:** remove incorrect wording in opening ([#156](https://github.com/anthropics/anthropic-sdk-typescript/issues/156)) ([01973fe](https://github.com/anthropics/anthropic-sdk-typescript/commit/01973fe50b13ce2981656f8c13603975e7c43efd))
79
+
80
+ ## 0.6.4 (2023-09-08)
81
+
82
+ Full Changelog: [v0.6.3...v0.6.4](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.3...v0.6.4)
83
+
84
+ ### Features
85
+
86
+ * **package:** add Bun export map ([#139](https://github.com/anthropics/anthropic-sdk-typescript/issues/139)) ([ba3310d](https://github.com/anthropics/anthropic-sdk-typescript/commit/ba3310d903cd5fda91168266335f4e445e60cad4))
87
+
88
+
89
+ ### Bug Fixes
90
+
91
+ * **client:** fix TS errors that appear when users Go to Source in VSCode ([#142](https://github.com/anthropics/anthropic-sdk-typescript/issues/142)) ([f7bfbea](https://github.com/anthropics/anthropic-sdk-typescript/commit/f7bfbeaa54d364201bbe5cddf3132875ae2a3ccf))
92
+ * **client:** handle case where the client is instantiated with a undefined baseURL ([#143](https://github.com/anthropics/anthropic-sdk-typescript/issues/143)) ([10e5203](https://github.com/anthropics/anthropic-sdk-typescript/commit/10e52034990d90dcdaf26672ea384545b88ddf35))
93
+ * **client:** use explicit file extensions in _shims imports ([#141](https://github.com/anthropics/anthropic-sdk-typescript/issues/141)) ([10fd687](https://github.com/anthropics/anthropic-sdk-typescript/commit/10fd68742a202c5c0a8b520db190c239dce9b676))
94
+ * fix module not found errors in Vercel edge ([#148](https://github.com/anthropics/anthropic-sdk-typescript/issues/148)) ([72e51a1](https://github.com/anthropics/anthropic-sdk-typescript/commit/72e51a170855281a8d099b00c6fb1e9ccb276212))
95
+ * **readme:** update link to api.md to use the correct branch ([#145](https://github.com/anthropics/anthropic-sdk-typescript/issues/145)) ([5db78ed](https://github.com/anthropics/anthropic-sdk-typescript/commit/5db78edec4826f86b2fc21ee3f470b49a4987029))
96
+
97
+
98
+ ### Chores
99
+
100
+ * **internal:** export helper from core ([#147](https://github.com/anthropics/anthropic-sdk-typescript/issues/147)) ([7e79de1](https://github.com/anthropics/anthropic-sdk-typescript/commit/7e79de14edeab8110d740e996653e9f9cc2299a4))
101
+
102
+
103
+ ### Documentation
104
+
105
+ * **readme:** add link to api.md ([#144](https://github.com/anthropics/anthropic-sdk-typescript/issues/144)) ([716c9f0](https://github.com/anthropics/anthropic-sdk-typescript/commit/716c9f0714c0e9c26cb6cdcb007457aff1284cf4))
106
+
107
+ ## 0.6.3 (2023-08-28)
108
+
109
+ Full Changelog: [v0.6.2...v0.6.3](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.2...v0.6.3)
110
+
111
+ ### Bug Fixes
112
+
113
+ * **types:** improve getNextPage() return type ([#137](https://github.com/anthropics/anthropic-sdk-typescript/issues/137)) ([713d603](https://github.com/anthropics/anthropic-sdk-typescript/commit/713d6032c2c3b3630314a9625a1672147ef19258))
114
+
115
+
116
+ ### Chores
117
+
118
+ * **ci:** setup workflows to create releases and release PRs ([#135](https://github.com/anthropics/anthropic-sdk-typescript/issues/135)) ([56229d9](https://github.com/anthropics/anthropic-sdk-typescript/commit/56229d964733a8b00625dac4ff138b3ade7e4202))
119
+
3
120
  ## [0.6.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/v0.6.1...v0.6.2) (2023-08-26)
4
121
 
5
122
 
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/@anthropic-ai/sdk.svg)](https://npmjs.org/package/@anthropic-ai/sdk)
4
4
 
5
- This library provides convenient access to the Anthropic TypeScript REST API from server-side TypeScript or JavaScript.
5
+ This library provides convenient access to the Anthropic REST API from server-side TypeScript or JavaScript.
6
+
7
+ For the AWS Bedrock API, see [`@anthropic-ai/bedrock-sdk`](github.com/anthropics/anthropic-bedrock-typescript).
6
8
 
7
9
  ## Migration from v0.4.x and below
8
10
 
@@ -90,6 +92,8 @@ yarn add @anthropic-ai/sdk
90
92
 
91
93
  ## Usage
92
94
 
95
+ The full API of this library can be found in [api.md](https://www.github.com/anthropics/anthropic-sdk-typescript/blob/main/api.md).
96
+
93
97
  ```js
94
98
  import Anthropic from '@anthropic-ai/sdk';
95
99
 
@@ -206,8 +210,8 @@ Error codes are as followed:
206
210
  ### Retries
207
211
 
208
212
  Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
209
- Connection errors (for example, due to a network connectivity problem), 409 Conflict, 429 Rate Limit,
210
- and >=500 Internal errors will all be retried by default.
213
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
214
+ 429 Rate Limit, and >=500 Internal errors will all be retried by default.
211
215
 
212
216
  You can use the `maxRetries` option to configure or disable this:
213
217
 
@@ -318,7 +322,7 @@ await anthropic.completions.create(
318
322
 
319
323
  ## Semantic Versioning
320
324
 
321
- This package generally attempts to follow [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
325
+ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
322
326
 
323
327
  1. Changes that only affect static types, without breaking runtime behavior.
324
328
  2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
@@ -330,12 +334,18 @@ We are keen for your feedback; please open an [issue](https://www.github.com/ant
330
334
 
331
335
  ## Requirements
332
336
 
337
+ TypeScript >= 4.5 is supported.
338
+
333
339
  The following runtimes are supported:
334
340
 
335
- - Node.js 16 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
341
+ - Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
336
342
  - Deno v1.28.0 or higher, using `import Anthropic from "npm:@anthropic-ai/sdk"`.
337
- Deno Deploy is not yet supported.
343
+ - Bun 1.0 or later.
338
344
  - Cloudflare Workers.
339
345
  - Vercel Edge Runtime.
346
+ - Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
347
+ - Nitro v2.6 or greater.
348
+
349
+ Note that React Native is not supported at this time.
340
350
 
341
351
  If you are interested in other runtime environments, please open or upvote an issue on GitHub.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export declare class MultipartBody {
5
+ body: any;
6
+ constructor(body: any);
7
+ get [Symbol.toStringTag](): string;
8
+ }
9
+ //# sourceMappingURL=MultipartBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.d.ts","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAa;IACL,IAAI,EAAE,GAAG;gBAAT,IAAI,EAAE,GAAG;IAC5B,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;CACF"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultipartBody = void 0;
4
+ /**
5
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
6
+ */
7
+ class MultipartBody {
8
+ constructor(body) {
9
+ this.body = body;
10
+ }
11
+ get [Symbol.toStringTag]() {
12
+ return 'MultipartBody';
13
+ }
14
+ }
15
+ exports.MultipartBody = MultipartBody;
16
+ //# sourceMappingURL=MultipartBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.js","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AALD,sCAKC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export class MultipartBody {
5
+ constructor(body) {
6
+ this.body = body;
7
+ }
8
+ get [Symbol.toStringTag]() {
9
+ return 'MultipartBody';
10
+ }
11
+ }
12
+ //# sourceMappingURL=MultipartBody.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.mjs","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,46 @@
1
+ # 👋 Wondering what everything in here does?
2
+
3
+ `@anthropic-ai/sdk` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
4
+ edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
5
+
6
+ To do this, `@anthropic-ai/sdk` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
7
+
8
+ It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
9
+ automatically select the correct shims for each environment. However, conditional exports are a fairly new
10
+ feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"`
11
+
12
+ setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does.
13
+ Unfortunately that's still the default setting, and it can result in errors like
14
+ getting the wrong raw `Response` type from `.asResponse()`, for example.
15
+
16
+ The user can work around these issues by manually importing one of:
17
+
18
+ - `import '@anthropic-ai/sdk/shims/node'`
19
+ - `import '@anthropic-ai/sdk/shims/web'`
20
+
21
+ All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
22
+
23
+ ### How it works - Runtime
24
+
25
+ Runtime shims get installed by calling `setShims` exported by `@anthropic-ai/sdk/_shims/registry`.
26
+
27
+ Manually importing `@anthropic-ai/sdk/shims/node` or `@anthropic-ai/sdk/shims/web`, calls `setShims` with the respective runtime shims.
28
+
29
+ All client code imports shims from `@anthropic-ai/sdk/_shims/index`, which:
30
+
31
+ - checks if shims have been set manually
32
+ - if not, calls `setShims` with the shims from `@anthropic-ai/sdk/_shims/auto/runtime`
33
+ - re-exports the installed shims from `@anthropic-ai/sdk/_shims/registry`.
34
+
35
+ `@anthropic-ai/sdk/_shims/auto/runtime` exports web runtime shims.
36
+ If the `node` export condition is set, the export map replaces it with `@anthropic-ai/sdk/_shims/auto/runtime-node`.
37
+
38
+ ### How it works - Type time
39
+
40
+ All client code imports shim types from `@anthropic-ai/sdk/_shims/index`, which selects the manual types from `@anthropic-ai/sdk/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@anthropic-ai/sdk/_shims/auto/types`.
41
+
42
+ `@anthropic-ai/sdk/_shims/manual-types` exports an empty namespace.
43
+ Manually importing `@anthropic-ai/sdk/shims/node` or `@anthropic-ai/sdk/shims/web` merges declarations into this empty namespace, so they get picked up by `@anthropic-ai/sdk/_shims/index`.
44
+
45
+ `@anthropic-ai/sdk/_shims/auto/types` exports web type definitions.
46
+ If the `node` export condition is set, the export map replaces it with `@anthropic-ai/sdk/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
3
  */
4
- import { ReadableStream } from 'web-streams-polyfill';
5
-
6
- export { ReadableStream };
4
+ export * from "../bun-runtime.js";
5
+ //# sourceMappingURL=runtime-bun.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../bun-runtime.js"), exports);
21
+ //# sourceMappingURL=runtime-bun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
@@ -0,0 +1,2 @@
1
+ export * from "../bun-runtime.mjs";
2
+ //# sourceMappingURL=runtime-bun.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../node-runtime.js";
5
+ //# sourceMappingURL=runtime-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../node-runtime.js"), exports);
21
+ //# sourceMappingURL=runtime-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-node.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,qDAAgC"}
@@ -0,0 +1,2 @@
1
+ export * from "../node-runtime.mjs";
2
+ //# sourceMappingURL=runtime-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-node.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../web-runtime.js";
5
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../web-runtime.js"), exports);
21
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
@@ -0,0 +1,2 @@
1
+ export * from "../web-runtime.mjs";
2
+ //# sourceMappingURL=runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../node-types.js";
5
+ //# sourceMappingURL=types-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,eAAe,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../node-types.js"), exports);
21
+ //# sourceMappingURL=types-node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-node.js","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,mDAA8B"}
@@ -0,0 +1,2 @@
1
+ export * from "../node-types.mjs";
2
+ //# sourceMappingURL=types-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-node.mjs","sourceRoot":"","sources":["../../src/_shims/auto/types-node.ts"],"names":[],"mappings":""}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export type Agent = any;
5
+
6
+ // @ts-ignore
7
+ declare const _fetch: unknown extends typeof fetch ? never : typeof fetch;
8
+ export { _fetch as fetch };
9
+
10
+ // @ts-ignore
11
+ type _Request = unknown extends Request ? never : Request;
12
+ export { _Request as Request };
13
+
14
+ // @ts-ignore
15
+ type _RequestInfo = unknown extends RequestInfo ? never : RequestInfo;
16
+ export { type _RequestInfo as RequestInfo };
17
+
18
+ // @ts-ignore
19
+ type _RequestInit = unknown extends RequestInit ? never : RequestInit;
20
+ export { type _RequestInit as RequestInit };
21
+
22
+ // @ts-ignore
23
+ type _Response = unknown extends Response ? never : Response;
24
+ export { _Response as Response };
25
+
26
+ // @ts-ignore
27
+ type _ResponseInit = unknown extends ResponseInit ? never : ResponseInit;
28
+ export { type _ResponseInit as ResponseInit };
29
+
30
+ // @ts-ignore
31
+ type _ResponseType = unknown extends ResponseType ? never : ResponseType;
32
+ export { type _ResponseType as ResponseType };
33
+
34
+ // @ts-ignore
35
+ type _BodyInit = unknown extends BodyInit ? never : BodyInit;
36
+ export { type _BodyInit as BodyInit };
37
+
38
+ // @ts-ignore
39
+ type _Headers = unknown extends Headers ? never : Headers;
40
+ export { _Headers as Headers };
41
+
42
+ // @ts-ignore
43
+ type _HeadersInit = unknown extends HeadersInit ? never : HeadersInit;
44
+ export { type _HeadersInit as HeadersInit };
45
+
46
+ type EndingType = 'native' | 'transparent';
47
+
48
+ export interface BlobPropertyBag {
49
+ endings?: EndingType;
50
+ type?: string;
51
+ }
52
+
53
+ export interface FilePropertyBag extends BlobPropertyBag {
54
+ lastModified?: number;
55
+ }
56
+
57
+ export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
58
+
59
+ // @ts-ignore
60
+ type _FormData = unknown extends FormData ? never : FormData;
61
+ // @ts-ignore
62
+ declare const _FormData: unknown extends typeof FormData ? never : typeof FormData;
63
+ export { _FormData as FormData };
64
+
65
+ // @ts-ignore
66
+ type _File = unknown extends File ? never : File;
67
+ // @ts-ignore
68
+ declare const _File: unknown extends typeof File ? never : typeof File;
69
+ export { _File as File };
70
+
71
+ // @ts-ignore
72
+ type _Blob = unknown extends Blob ? never : Blob;
73
+ // @ts-ignore
74
+ declare const _Blob: unknown extends typeof Blob ? never : typeof Blob;
75
+ export { _Blob as Blob };
76
+
77
+ export declare class Readable {
78
+ readable: boolean;
79
+ readonly readableEnded: boolean;
80
+ readonly readableFlowing: boolean | null;
81
+ readonly readableHighWaterMark: number;
82
+ readonly readableLength: number;
83
+ readonly readableObjectMode: boolean;
84
+ destroyed: boolean;
85
+ read(size?: number): any;
86
+ pause(): this;
87
+ resume(): this;
88
+ isPaused(): boolean;
89
+ destroy(error?: Error): this;
90
+ [Symbol.asyncIterator](): AsyncIterableIterator<any>;
91
+ }
92
+
93
+ export declare class FsReadStream extends Readable {
94
+ path: {}; // node type is string | Buffer
95
+ }
96
+
97
+ // @ts-ignore
98
+ type _ReadableStream<R = any> = unknown extends ReadableStream<R> ? never : ReadableStream<R>;
99
+ // @ts-ignore
100
+ declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream;
101
+ export { _ReadableStream as ReadableStream };
@@ -1,5 +1,3 @@
1
1
  /**
2
2
  * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
3
  */
4
-
5
- exports.ReadableStream = ReadableStream;
@@ -1,5 +1,3 @@
1
1
  /**
2
2
  * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
3
  */
4
-
5
- exports.ReadableStream = ReadableStream;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ import { type Shims } from "./registry.js";
5
+ export declare function getRuntime(): Shims;
6
+ //# sourceMappingURL=bun-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-runtime.d.ts","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC,wBAAgB,UAAU,IAAI,KAAK,CAMlC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntime = void 0;
4
+ const web_runtime_1 = require("./web-runtime.js");
5
+ const node_fs_1 = require("node:fs");
6
+ function getRuntime() {
7
+ const runtime = (0, web_runtime_1.getRuntime)();
8
+ function isFsReadStream(value) {
9
+ return value instanceof node_fs_1.ReadStream;
10
+ }
11
+ return { ...runtime, isFsReadStream };
12
+ }
13
+ exports.getRuntime = getRuntime;
14
+ //# sourceMappingURL=bun-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-runtime.js","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":";;;AAIA,kDAA4D;AAC5D,qCAAqD;AAErD,SAAgB,UAAU;IACxB,MAAM,OAAO,GAAG,IAAA,wBAAa,GAAE,CAAC;IAChC,SAAS,cAAc,CAAC,KAAU;QAChC,OAAO,KAAK,YAAY,oBAAY,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC;AAND,gCAMC"}
@@ -0,0 +1,10 @@
1
+ import { getRuntime as getWebRuntime } from "./web-runtime.mjs";
2
+ import { ReadStream as FsReadStream } from 'node:fs';
3
+ export function getRuntime() {
4
+ const runtime = getWebRuntime();
5
+ function isFsReadStream(value) {
6
+ return value instanceof FsReadStream;
7
+ }
8
+ return { ...runtime, isFsReadStream };
9
+ }
10
+ //# sourceMappingURL=bun-runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-runtime.mjs","sourceRoot":"","sources":["../src/_shims/bun-runtime.ts"],"names":[],"mappings":"OAIO,EAAE,UAAU,IAAI,aAAa,EAAE;OAC/B,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,SAAS;AAEpD,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,SAAS,cAAc,CAAC,KAAU;QAChC,OAAO,KAAK,YAAY,YAAY,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC;AACxC,CAAC"}