spitch 0.1.0-alpha.1 → 1.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 (439) hide show
  1. package/CHANGELOG.md +21 -8
  2. package/LICENSE +1 -1
  3. package/README.md +170 -71
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +183 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +183 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +464 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +460 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/uploads.d.mts +3 -0
  45. package/core/uploads.d.mts.map +1 -0
  46. package/core/uploads.d.ts +3 -0
  47. package/core/uploads.d.ts.map +1 -0
  48. package/core/uploads.js +6 -0
  49. package/core/uploads.js.map +1 -0
  50. package/core/uploads.mjs +2 -0
  51. package/core/uploads.mjs.map +1 -0
  52. package/error.d.mts +2 -0
  53. package/error.d.mts.map +1 -0
  54. package/error.d.ts +1 -52
  55. package/error.d.ts.map +1 -1
  56. package/error.js +3 -140
  57. package/error.js.map +1 -1
  58. package/error.mjs +1 -126
  59. package/error.mjs.map +1 -1
  60. package/index.d.mts +6 -118
  61. package/index.d.mts.map +1 -0
  62. package/index.d.ts +5 -117
  63. package/index.d.ts.map +1 -1
  64. package/index.js +26 -107
  65. package/index.js.map +1 -1
  66. package/index.mjs +5 -81
  67. package/index.mjs.map +1 -1
  68. package/internal/builtin-types.d.mts +73 -0
  69. package/internal/builtin-types.d.mts.map +1 -0
  70. package/internal/builtin-types.d.ts +73 -0
  71. package/internal/builtin-types.d.ts.map +1 -0
  72. package/internal/builtin-types.js +4 -0
  73. package/internal/builtin-types.js.map +1 -0
  74. package/internal/builtin-types.mjs +3 -0
  75. package/internal/builtin-types.mjs.map +1 -0
  76. package/internal/detect-platform.d.mts +15 -0
  77. package/internal/detect-platform.d.mts.map +1 -0
  78. package/internal/detect-platform.d.ts +15 -0
  79. package/internal/detect-platform.d.ts.map +1 -0
  80. package/internal/detect-platform.js +162 -0
  81. package/internal/detect-platform.js.map +1 -0
  82. package/internal/detect-platform.mjs +157 -0
  83. package/internal/detect-platform.mjs.map +1 -0
  84. package/internal/errors.d.mts +3 -0
  85. package/internal/errors.d.mts.map +1 -0
  86. package/internal/errors.d.ts +3 -0
  87. package/internal/errors.d.ts.map +1 -0
  88. package/internal/errors.js +41 -0
  89. package/internal/errors.js.map +1 -0
  90. package/internal/errors.mjs +36 -0
  91. package/internal/errors.mjs.map +1 -0
  92. package/internal/headers.d.mts +20 -0
  93. package/internal/headers.d.mts.map +1 -0
  94. package/internal/headers.d.ts +20 -0
  95. package/internal/headers.d.ts.map +1 -0
  96. package/internal/headers.js +79 -0
  97. package/internal/headers.js.map +1 -0
  98. package/internal/headers.mjs +74 -0
  99. package/internal/headers.mjs.map +1 -0
  100. package/internal/parse.d.mts +12 -0
  101. package/internal/parse.d.mts.map +1 -0
  102. package/internal/parse.d.ts +12 -0
  103. package/internal/parse.d.ts.map +1 -0
  104. package/internal/parse.js +35 -0
  105. package/internal/parse.js.map +1 -0
  106. package/internal/parse.mjs +32 -0
  107. package/internal/parse.mjs.map +1 -0
  108. package/internal/request-options.d.mts +75 -0
  109. package/internal/request-options.d.mts.map +1 -0
  110. package/internal/request-options.d.ts +75 -0
  111. package/internal/request-options.d.ts.map +1 -0
  112. package/internal/request-options.js +14 -0
  113. package/internal/request-options.js.map +1 -0
  114. package/internal/request-options.mjs +10 -0
  115. package/internal/request-options.mjs.map +1 -0
  116. package/internal/shim-types.d.mts +17 -0
  117. package/internal/shim-types.d.mts.map +1 -0
  118. package/internal/shim-types.d.ts +17 -0
  119. package/internal/shim-types.d.ts.map +1 -0
  120. package/internal/shim-types.js +4 -0
  121. package/internal/shim-types.js.map +1 -0
  122. package/internal/shim-types.mjs +3 -0
  123. package/internal/shim-types.mjs.map +1 -0
  124. package/internal/shims.d.mts +20 -0
  125. package/internal/shims.d.mts.map +1 -0
  126. package/internal/shims.d.ts +20 -0
  127. package/internal/shims.d.ts.map +1 -0
  128. package/internal/shims.js +92 -0
  129. package/internal/shims.js.map +1 -0
  130. package/internal/shims.mjs +85 -0
  131. package/internal/shims.mjs.map +1 -0
  132. package/internal/to-file.d.mts +45 -0
  133. package/internal/to-file.d.mts.map +1 -0
  134. package/internal/to-file.d.ts +45 -0
  135. package/internal/to-file.d.ts.map +1 -0
  136. package/internal/to-file.js +91 -0
  137. package/internal/to-file.js.map +1 -0
  138. package/internal/to-file.mjs +88 -0
  139. package/internal/to-file.mjs.map +1 -0
  140. package/internal/tslib.js +81 -0
  141. package/internal/tslib.mjs +17 -0
  142. package/internal/types.d.mts +69 -0
  143. package/internal/types.d.mts.map +1 -0
  144. package/internal/types.d.ts +69 -0
  145. package/internal/types.d.ts.map +1 -0
  146. package/internal/types.js +4 -0
  147. package/internal/types.js.map +1 -0
  148. package/internal/types.mjs +3 -0
  149. package/internal/types.mjs.map +1 -0
  150. package/internal/uploads.d.mts +42 -0
  151. package/internal/uploads.d.mts.map +1 -0
  152. package/internal/uploads.d.ts +42 -0
  153. package/internal/uploads.d.ts.map +1 -0
  154. package/internal/uploads.js +141 -0
  155. package/internal/uploads.js.map +1 -0
  156. package/internal/uploads.mjs +131 -0
  157. package/internal/uploads.mjs.map +1 -0
  158. package/internal/utils/base64.d.mts +3 -0
  159. package/internal/utils/base64.d.mts.map +1 -0
  160. package/internal/utils/base64.d.ts +3 -0
  161. package/internal/utils/base64.d.ts.map +1 -0
  162. package/internal/utils/base64.js +38 -0
  163. package/internal/utils/base64.js.map +1 -0
  164. package/internal/utils/base64.mjs +33 -0
  165. package/internal/utils/base64.mjs.map +1 -0
  166. package/internal/utils/bytes.d.mts +4 -0
  167. package/internal/utils/bytes.d.mts.map +1 -0
  168. package/internal/utils/bytes.d.ts +4 -0
  169. package/internal/utils/bytes.d.ts.map +1 -0
  170. package/internal/utils/bytes.js +31 -0
  171. package/internal/utils/bytes.js.map +1 -0
  172. package/internal/utils/bytes.mjs +26 -0
  173. package/internal/utils/bytes.mjs.map +1 -0
  174. package/internal/utils/env.d.mts +9 -0
  175. package/internal/utils/env.d.mts.map +1 -0
  176. package/internal/utils/env.d.ts +9 -0
  177. package/internal/utils/env.d.ts.map +1 -0
  178. package/internal/utils/env.js +22 -0
  179. package/internal/utils/env.js.map +1 -0
  180. package/internal/utils/env.mjs +18 -0
  181. package/internal/utils/env.mjs.map +1 -0
  182. package/internal/utils/log.d.mts +37 -0
  183. package/internal/utils/log.d.mts.map +1 -0
  184. package/internal/utils/log.d.ts +37 -0
  185. package/internal/utils/log.d.ts.map +1 -0
  186. package/internal/utils/log.js +85 -0
  187. package/internal/utils/log.js.map +1 -0
  188. package/internal/utils/log.mjs +79 -0
  189. package/internal/utils/log.mjs.map +1 -0
  190. package/internal/utils/path.d.mts +15 -0
  191. package/internal/utils/path.d.mts.map +1 -0
  192. package/internal/utils/path.d.ts +15 -0
  193. package/internal/utils/path.d.ts.map +1 -0
  194. package/internal/utils/path.js +79 -0
  195. package/internal/utils/path.js.map +1 -0
  196. package/internal/utils/path.mjs +74 -0
  197. package/internal/utils/path.mjs.map +1 -0
  198. package/internal/utils/sleep.d.mts +2 -0
  199. package/internal/utils/sleep.d.mts.map +1 -0
  200. package/internal/utils/sleep.d.ts +2 -0
  201. package/internal/utils/sleep.d.ts.map +1 -0
  202. package/internal/utils/sleep.js +7 -0
  203. package/internal/utils/sleep.js.map +1 -0
  204. package/internal/utils/sleep.mjs +3 -0
  205. package/internal/utils/sleep.mjs.map +1 -0
  206. package/internal/utils/uuid.d.mts +5 -0
  207. package/internal/utils/uuid.d.mts.map +1 -0
  208. package/internal/utils/uuid.d.ts +5 -0
  209. package/internal/utils/uuid.d.ts.map +1 -0
  210. package/internal/utils/uuid.js +19 -0
  211. package/internal/utils/uuid.js.map +1 -0
  212. package/internal/utils/uuid.mjs +15 -0
  213. package/internal/utils/uuid.mjs.map +1 -0
  214. package/internal/utils/values.d.mts +18 -0
  215. package/internal/utils/values.d.mts.map +1 -0
  216. package/internal/utils/values.d.ts +18 -0
  217. package/internal/utils/values.d.ts.map +1 -0
  218. package/internal/utils/values.js +112 -0
  219. package/internal/utils/values.js.map +1 -0
  220. package/internal/utils/values.mjs +94 -0
  221. package/internal/utils/values.mjs.map +1 -0
  222. package/internal/utils.d.mts +7 -0
  223. package/internal/utils.d.mts.map +1 -0
  224. package/internal/utils.d.ts +7 -0
  225. package/internal/utils.d.ts.map +1 -0
  226. package/internal/utils.js +11 -0
  227. package/internal/utils.js.map +1 -0
  228. package/internal/utils.mjs +8 -0
  229. package/internal/utils.mjs.map +1 -0
  230. package/package.json +104 -72
  231. package/resource.d.mts +2 -0
  232. package/resource.d.mts.map +1 -0
  233. package/resource.d.ts +1 -5
  234. package/resource.d.ts.map +1 -1
  235. package/resource.js +3 -8
  236. package/resource.js.map +1 -1
  237. package/resource.mjs +1 -6
  238. package/resource.mjs.map +1 -1
  239. package/resources/index.d.mts +3 -0
  240. package/resources/index.d.mts.map +1 -0
  241. package/resources/index.d.ts +2 -2
  242. package/resources/index.d.ts.map +1 -1
  243. package/resources/index.js.map +1 -1
  244. package/resources/index.mjs +1 -1
  245. package/resources/index.mjs.map +1 -1
  246. package/resources/speech.d.mts +44 -0
  247. package/resources/speech.d.mts.map +1 -0
  248. package/resources/speech.d.ts +28 -29
  249. package/resources/speech.d.ts.map +1 -1
  250. package/resources/speech.js +15 -32
  251. package/resources/speech.js.map +1 -1
  252. package/resources/speech.mjs +15 -9
  253. package/resources/speech.mjs.map +1 -1
  254. package/resources/text.d.mts +34 -0
  255. package/resources/text.d.mts.map +1 -0
  256. package/resources/text.d.ts +23 -8
  257. package/resources/text.d.ts.map +1 -1
  258. package/resources/text.js +7 -3
  259. package/resources/text.js.map +1 -1
  260. package/resources/text.mjs +7 -3
  261. package/resources/text.mjs.map +1 -1
  262. package/resources.d.mts +2 -0
  263. package/resources.d.mts.map +1 -0
  264. package/resources.d.ts +2 -0
  265. package/resources.d.ts.map +1 -0
  266. package/resources.js +5 -0
  267. package/resources.js.map +1 -0
  268. package/resources.mjs +2 -0
  269. package/resources.mjs.map +1 -0
  270. package/src/api-promise.ts +2 -0
  271. package/src/client.ts +751 -0
  272. package/src/core/README.md +3 -0
  273. package/src/core/api-promise.ts +92 -0
  274. package/src/core/error.ts +130 -0
  275. package/src/core/resource.ts +11 -0
  276. package/src/core/uploads.ts +2 -0
  277. package/src/error.ts +2 -146
  278. package/src/index.ts +6 -178
  279. package/src/internal/README.md +3 -0
  280. package/src/internal/builtin-types.ts +93 -0
  281. package/src/internal/detect-platform.ts +196 -0
  282. package/src/internal/errors.ts +33 -0
  283. package/src/internal/headers.ts +97 -0
  284. package/src/internal/parse.ts +50 -0
  285. package/src/internal/request-options.ts +91 -0
  286. package/src/internal/shim-types.ts +26 -0
  287. package/src/internal/shims.ts +107 -0
  288. package/src/internal/to-file.ts +154 -0
  289. package/src/internal/types.ts +95 -0
  290. package/src/internal/uploads.ts +187 -0
  291. package/src/internal/utils/base64.ts +40 -0
  292. package/src/internal/utils/bytes.ts +32 -0
  293. package/src/internal/utils/env.ts +18 -0
  294. package/src/internal/utils/log.ts +126 -0
  295. package/src/internal/utils/path.ts +88 -0
  296. package/src/internal/utils/sleep.ts +3 -0
  297. package/src/internal/utils/uuid.ts +17 -0
  298. package/src/internal/utils/values.ts +105 -0
  299. package/src/internal/utils.ts +8 -0
  300. package/src/resource.ts +2 -11
  301. package/src/resources/index.ts +10 -5
  302. package/src/resources/speech.ts +74 -33
  303. package/src/resources/text.ts +38 -9
  304. package/src/resources.ts +1 -0
  305. package/src/tsconfig.json +2 -2
  306. package/src/uploads.ts +2 -255
  307. package/src/version.ts +1 -1
  308. package/uploads.d.mts +2 -0
  309. package/uploads.d.mts.map +1 -0
  310. package/uploads.d.ts +1 -74
  311. package/uploads.d.ts.map +1 -1
  312. package/uploads.js +3 -168
  313. package/uploads.js.map +1 -1
  314. package/uploads.mjs +1 -157
  315. package/uploads.mjs.map +1 -1
  316. package/version.d.mts +2 -0
  317. package/version.d.mts.map +1 -0
  318. package/version.d.ts +1 -1
  319. package/version.d.ts.map +1 -1
  320. package/version.js +1 -1
  321. package/version.js.map +1 -1
  322. package/version.mjs +1 -1
  323. package/version.mjs.map +1 -1
  324. package/_shims/MultipartBody.d.ts +0 -9
  325. package/_shims/MultipartBody.d.ts.map +0 -1
  326. package/_shims/MultipartBody.js +0 -16
  327. package/_shims/MultipartBody.js.map +0 -1
  328. package/_shims/MultipartBody.mjs +0 -12
  329. package/_shims/MultipartBody.mjs.map +0 -1
  330. package/_shims/README.md +0 -46
  331. package/_shims/auto/runtime-bun.d.ts +0 -5
  332. package/_shims/auto/runtime-bun.d.ts.map +0 -1
  333. package/_shims/auto/runtime-bun.js +0 -21
  334. package/_shims/auto/runtime-bun.js.map +0 -1
  335. package/_shims/auto/runtime-bun.mjs +0 -2
  336. package/_shims/auto/runtime-bun.mjs.map +0 -1
  337. package/_shims/auto/runtime-node.d.ts +0 -5
  338. package/_shims/auto/runtime-node.d.ts.map +0 -1
  339. package/_shims/auto/runtime-node.js +0 -21
  340. package/_shims/auto/runtime-node.js.map +0 -1
  341. package/_shims/auto/runtime-node.mjs +0 -2
  342. package/_shims/auto/runtime-node.mjs.map +0 -1
  343. package/_shims/auto/runtime.d.ts +0 -5
  344. package/_shims/auto/runtime.d.ts.map +0 -1
  345. package/_shims/auto/runtime.js +0 -21
  346. package/_shims/auto/runtime.js.map +0 -1
  347. package/_shims/auto/runtime.mjs +0 -2
  348. package/_shims/auto/runtime.mjs.map +0 -1
  349. package/_shims/auto/types-node.d.ts +0 -5
  350. package/_shims/auto/types-node.d.ts.map +0 -1
  351. package/_shims/auto/types-node.js +0 -21
  352. package/_shims/auto/types-node.js.map +0 -1
  353. package/_shims/auto/types-node.mjs +0 -2
  354. package/_shims/auto/types-node.mjs.map +0 -1
  355. package/_shims/auto/types.d.ts +0 -101
  356. package/_shims/auto/types.js +0 -3
  357. package/_shims/auto/types.mjs +0 -3
  358. package/_shims/bun-runtime.d.ts +0 -6
  359. package/_shims/bun-runtime.d.ts.map +0 -1
  360. package/_shims/bun-runtime.js +0 -14
  361. package/_shims/bun-runtime.js.map +0 -1
  362. package/_shims/bun-runtime.mjs +0 -10
  363. package/_shims/bun-runtime.mjs.map +0 -1
  364. package/_shims/index.d.ts +0 -81
  365. package/_shims/index.js +0 -13
  366. package/_shims/index.mjs +0 -7
  367. package/_shims/manual-types.d.ts +0 -12
  368. package/_shims/manual-types.js +0 -3
  369. package/_shims/manual-types.mjs +0 -3
  370. package/_shims/node-runtime.d.ts +0 -3
  371. package/_shims/node-runtime.d.ts.map +0 -1
  372. package/_shims/node-runtime.js +0 -89
  373. package/_shims/node-runtime.js.map +0 -1
  374. package/_shims/node-runtime.mjs +0 -56
  375. package/_shims/node-runtime.mjs.map +0 -1
  376. package/_shims/node-types.d.ts +0 -42
  377. package/_shims/node-types.js +0 -3
  378. package/_shims/node-types.mjs +0 -3
  379. package/_shims/registry.d.ts +0 -37
  380. package/_shims/registry.d.ts.map +0 -1
  381. package/_shims/registry.js +0 -41
  382. package/_shims/registry.js.map +0 -1
  383. package/_shims/registry.mjs +0 -37
  384. package/_shims/registry.mjs.map +0 -1
  385. package/_shims/web-runtime.d.ts +0 -5
  386. package/_shims/web-runtime.d.ts.map +0 -1
  387. package/_shims/web-runtime.js +0 -78
  388. package/_shims/web-runtime.js.map +0 -1
  389. package/_shims/web-runtime.mjs +0 -71
  390. package/_shims/web-runtime.mjs.map +0 -1
  391. package/_shims/web-types.d.ts +0 -83
  392. package/_shims/web-types.js +0 -3
  393. package/_shims/web-types.mjs +0 -3
  394. package/core.d.ts +0 -242
  395. package/core.d.ts.map +0 -1
  396. package/core.js +0 -901
  397. package/core.js.map +0 -1
  398. package/core.mjs +0 -869
  399. package/core.mjs.map +0 -1
  400. package/shims/node.d.ts +0 -30
  401. package/shims/node.d.ts.map +0 -1
  402. package/shims/node.js +0 -31
  403. package/shims/node.js.map +0 -1
  404. package/shims/node.mjs +0 -5
  405. package/shims/node.mjs.map +0 -1
  406. package/shims/web.d.ts +0 -26
  407. package/shims/web.d.ts.map +0 -1
  408. package/shims/web.js +0 -31
  409. package/shims/web.js.map +0 -1
  410. package/shims/web.mjs +0 -5
  411. package/shims/web.mjs.map +0 -1
  412. package/src/_shims/MultipartBody.ts +0 -9
  413. package/src/_shims/README.md +0 -46
  414. package/src/_shims/auto/runtime-bun.ts +0 -4
  415. package/src/_shims/auto/runtime-node.ts +0 -4
  416. package/src/_shims/auto/runtime.ts +0 -4
  417. package/src/_shims/auto/types-node.ts +0 -4
  418. package/src/_shims/auto/types.d.ts +0 -101
  419. package/src/_shims/auto/types.js +0 -3
  420. package/src/_shims/auto/types.mjs +0 -3
  421. package/src/_shims/bun-runtime.ts +0 -14
  422. package/src/_shims/index.d.ts +0 -81
  423. package/src/_shims/index.js +0 -13
  424. package/src/_shims/index.mjs +0 -7
  425. package/src/_shims/manual-types.d.ts +0 -12
  426. package/src/_shims/manual-types.js +0 -3
  427. package/src/_shims/manual-types.mjs +0 -3
  428. package/src/_shims/node-runtime.ts +0 -81
  429. package/src/_shims/node-types.d.ts +0 -42
  430. package/src/_shims/node-types.js +0 -3
  431. package/src/_shims/node-types.mjs +0 -3
  432. package/src/_shims/registry.ts +0 -65
  433. package/src/_shims/web-runtime.ts +0 -103
  434. package/src/_shims/web-types.d.ts +0 -83
  435. package/src/_shims/web-types.js +0 -3
  436. package/src/_shims/web-types.mjs +0 -3
  437. package/src/core.ts +0 -1190
  438. package/src/shims/node.ts +0 -50
  439. package/src/shims/web.ts +0 -50
package/index.js CHANGED
@@ -1,111 +1,30 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- var _a;
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.fileFromPath = exports.toFile = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.SpitchError = exports.Spitch = void 0;
29
- const Errors = __importStar(require("./error.js"));
30
- const Uploads = __importStar(require("./uploads.js"));
31
- const Core = __importStar(require("./core.js"));
32
- const API = __importStar(require("./resources/index.js"));
33
- /**
34
- * API Client for interfacing with the Spitch API.
35
- */
36
- class Spitch extends Core.APIClient {
37
- /**
38
- * API Client for interfacing with the Spitch API.
39
- *
40
- * @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
41
- * @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spi-tch.com] - Override the default base URL for the API.
42
- * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
43
- * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
44
- * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
45
- * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
46
- * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
47
- * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
48
- */
49
- constructor({ baseURL = Core.readEnv('SPITCH_BASE_URL'), apiKey = Core.readEnv('SPITCH_API_KEY'), ...opts } = {}) {
50
- if (apiKey === undefined) {
51
- throw new Errors.SpitchError("The SPITCH_API_KEY environment variable is missing or empty; either provide it, or instantiate the Spitch client with an apiKey option, like new Spitch({ apiKey: 'My API Key' }).");
52
- }
53
- const options = {
54
- apiKey,
55
- ...opts,
56
- baseURL: baseURL || `https://api.spi-tch.com`,
57
- };
58
- super({
59
- baseURL: options.baseURL,
60
- timeout: options.timeout ?? 60000 /* 1 minute */,
61
- httpAgent: options.httpAgent,
62
- maxRetries: options.maxRetries,
63
- fetch: options.fetch,
64
- });
65
- this.speech = new API.Speech(this);
66
- this.text = new API.Text(this);
67
- this._options = options;
68
- this.apiKey = apiKey;
69
- }
70
- defaultQuery() {
71
- return this._options.defaultQuery;
72
- }
73
- defaultHeaders(opts) {
74
- return {
75
- ...super.defaultHeaders(opts),
76
- ...this._options.defaultHeaders,
77
- };
78
- }
79
- authHeaders(opts) {
80
- return { Authorization: `Bearer ${this.apiKey}` };
81
- }
3
+ exports = module.exports = function (...args) {
4
+ return new exports.default(...args)
82
5
  }
83
- exports.Spitch = Spitch;
84
- _a = Spitch;
85
- Spitch.Spitch = _a;
86
- Spitch.DEFAULT_TIMEOUT = 60000; // 1 minute
87
- Spitch.SpitchError = Errors.SpitchError;
88
- Spitch.APIError = Errors.APIError;
89
- Spitch.APIConnectionError = Errors.APIConnectionError;
90
- Spitch.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
91
- Spitch.APIUserAbortError = Errors.APIUserAbortError;
92
- Spitch.NotFoundError = Errors.NotFoundError;
93
- Spitch.ConflictError = Errors.ConflictError;
94
- Spitch.RateLimitError = Errors.RateLimitError;
95
- Spitch.BadRequestError = Errors.BadRequestError;
96
- Spitch.AuthenticationError = Errors.AuthenticationError;
97
- Spitch.InternalServerError = Errors.InternalServerError;
98
- Spitch.PermissionDeniedError = Errors.PermissionDeniedError;
99
- Spitch.UnprocessableEntityError = Errors.UnprocessableEntityError;
100
- Spitch.toFile = Uploads.toFile;
101
- Spitch.fileFromPath = Uploads.fileFromPath;
102
- exports.SpitchError = Errors.SpitchError, exports.APIError = Errors.APIError, exports.APIConnectionError = Errors.APIConnectionError, exports.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError, exports.APIUserAbortError = Errors.APIUserAbortError, exports.NotFoundError = Errors.NotFoundError, exports.ConflictError = Errors.ConflictError, exports.RateLimitError = Errors.RateLimitError, exports.BadRequestError = Errors.BadRequestError, exports.AuthenticationError = Errors.AuthenticationError, exports.InternalServerError = Errors.InternalServerError, exports.PermissionDeniedError = Errors.PermissionDeniedError, exports.UnprocessableEntityError = Errors.UnprocessableEntityError;
103
- exports.toFile = Uploads.toFile;
104
- exports.fileFromPath = Uploads.fileFromPath;
105
- (function (Spitch) {
106
- Spitch.Speech = API.Speech;
107
- Spitch.Text = API.Text;
108
- })(Spitch = exports.Spitch || (exports.Spitch = {}));
109
- exports = module.exports = Spitch;
110
- exports.default = Spitch;
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.SpitchError = exports.Spitch = exports.APIPromise = exports.toFile = exports.default = void 0;
8
+ var client_1 = require("./client.js");
9
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.Spitch; } });
10
+ var uploads_1 = require("./core/uploads.js");
11
+ Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
12
+ var api_promise_1 = require("./core/api-promise.js");
13
+ Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_1.APIPromise; } });
14
+ var client_2 = require("./client.js");
15
+ Object.defineProperty(exports, "Spitch", { enumerable: true, get: function () { return client_2.Spitch; } });
16
+ var error_1 = require("./core/error.js");
17
+ Object.defineProperty(exports, "SpitchError", { enumerable: true, get: function () { return error_1.SpitchError; } });
18
+ Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
19
+ Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return error_1.APIConnectionError; } });
20
+ Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return error_1.APIConnectionTimeoutError; } });
21
+ Object.defineProperty(exports, "APIUserAbortError", { enumerable: true, get: function () { return error_1.APIUserAbortError; } });
22
+ Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return error_1.NotFoundError; } });
23
+ Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return error_1.ConflictError; } });
24
+ Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_1.RateLimitError; } });
25
+ Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return error_1.BadRequestError; } });
26
+ Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return error_1.AuthenticationError; } });
27
+ Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
28
+ Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
29
+ Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
111
30
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAA6C;AAApC,iGAAA,MAAM,OAAW;AAE1B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAsD;AAA7C,gGAAA,MAAM,OAAA;AACf,yCAcsB;AAbpB,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA"}
package/index.mjs CHANGED
@@ -1,83 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- var _a;
3
- import * as Errors from "./error.mjs";
4
- import * as Uploads from "./uploads.mjs";
5
- import * as Core from "./core.mjs";
6
- import * as API from "./resources/index.mjs";
7
- /**
8
- * API Client for interfacing with the Spitch API.
9
- */
10
- export class Spitch extends Core.APIClient {
11
- /**
12
- * API Client for interfacing with the Spitch API.
13
- *
14
- * @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
15
- * @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spi-tch.com] - Override the default base URL for the API.
16
- * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
17
- * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
18
- * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
19
- * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
20
- * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
21
- * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
22
- */
23
- constructor({ baseURL = Core.readEnv('SPITCH_BASE_URL'), apiKey = Core.readEnv('SPITCH_API_KEY'), ...opts } = {}) {
24
- if (apiKey === undefined) {
25
- throw new Errors.SpitchError("The SPITCH_API_KEY environment variable is missing or empty; either provide it, or instantiate the Spitch client with an apiKey option, like new Spitch({ apiKey: 'My API Key' }).");
26
- }
27
- const options = {
28
- apiKey,
29
- ...opts,
30
- baseURL: baseURL || `https://api.spi-tch.com`,
31
- };
32
- super({
33
- baseURL: options.baseURL,
34
- timeout: options.timeout ?? 60000 /* 1 minute */,
35
- httpAgent: options.httpAgent,
36
- maxRetries: options.maxRetries,
37
- fetch: options.fetch,
38
- });
39
- this.speech = new API.Speech(this);
40
- this.text = new API.Text(this);
41
- this._options = options;
42
- this.apiKey = apiKey;
43
- }
44
- defaultQuery() {
45
- return this._options.defaultQuery;
46
- }
47
- defaultHeaders(opts) {
48
- return {
49
- ...super.defaultHeaders(opts),
50
- ...this._options.defaultHeaders,
51
- };
52
- }
53
- authHeaders(opts) {
54
- return { Authorization: `Bearer ${this.apiKey}` };
55
- }
56
- }
57
- _a = Spitch;
58
- Spitch.Spitch = _a;
59
- Spitch.DEFAULT_TIMEOUT = 60000; // 1 minute
60
- Spitch.SpitchError = Errors.SpitchError;
61
- Spitch.APIError = Errors.APIError;
62
- Spitch.APIConnectionError = Errors.APIConnectionError;
63
- Spitch.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
64
- Spitch.APIUserAbortError = Errors.APIUserAbortError;
65
- Spitch.NotFoundError = Errors.NotFoundError;
66
- Spitch.ConflictError = Errors.ConflictError;
67
- Spitch.RateLimitError = Errors.RateLimitError;
68
- Spitch.BadRequestError = Errors.BadRequestError;
69
- Spitch.AuthenticationError = Errors.AuthenticationError;
70
- Spitch.InternalServerError = Errors.InternalServerError;
71
- Spitch.PermissionDeniedError = Errors.PermissionDeniedError;
72
- Spitch.UnprocessableEntityError = Errors.UnprocessableEntityError;
73
- Spitch.toFile = Uploads.toFile;
74
- Spitch.fileFromPath = Uploads.fileFromPath;
75
- export const { SpitchError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } = Errors;
76
- export var toFile = Uploads.toFile;
77
- export var fileFromPath = Uploads.fileFromPath;
78
- (function (Spitch) {
79
- Spitch.Speech = API.Speech;
80
- Spitch.Text = API.Text;
81
- })(Spitch || (Spitch = {}));
82
- export default Spitch;
2
+ export { Spitch as default } from "./client.mjs";
3
+ export { toFile } from "./core/uploads.mjs";
4
+ export { APIPromise } from "./core/api-promise.mjs";
5
+ export { Spitch } from "./client.mjs";
6
+ export { SpitchError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
83
7
  //# sourceMappingURL=index.mjs.map
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,MAAM,IAAI,OAAO,EAAE;OAErB,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAsB;OAC9B,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
@@ -0,0 +1,73 @@
1
+ export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
2
+ /**
3
+ * An alias to the builtin `RequestInit` type so we can
4
+ * easily alias it in import statements if there are name clashes.
5
+ *
6
+ * https://developer.mozilla.org/docs/Web/API/RequestInit
7
+ */
8
+ type _RequestInit = RequestInit;
9
+ /**
10
+ * An alias to the builtin `Response` type so we can
11
+ * easily alias it in import statements if there are name clashes.
12
+ *
13
+ * https://developer.mozilla.org/docs/Web/API/Response
14
+ */
15
+ type _Response = Response;
16
+ /**
17
+ * The type for the first argument to `fetch`.
18
+ *
19
+ * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
20
+ */
21
+ type _RequestInfo = Request | URL | string;
22
+ /**
23
+ * The type for constructing `RequestInit` Headers.
24
+ *
25
+ * https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers
26
+ */
27
+ type _HeadersInit = RequestInit['headers'];
28
+ /**
29
+ * The type for constructing `RequestInit` body.
30
+ *
31
+ * https://developer.mozilla.org/docs/Web/API/RequestInit#body
32
+ */
33
+ type _BodyInit = RequestInit['body'];
34
+ /**
35
+ * An alias to the builtin `Array<T>` type so we can
36
+ * easily alias it in import statements if there are name clashes.
37
+ */
38
+ type _Array<T> = Array<T>;
39
+ /**
40
+ * An alias to the builtin `Record<K, T>` type so we can
41
+ * easily alias it in import statements if there are name clashes.
42
+ */
43
+ type _Record<K extends keyof any, T> = Record<K, T>;
44
+ export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response, };
45
+ /**
46
+ * A copy of the builtin `EndingType` type as it isn't fully supported in certain
47
+ * environments and attempting to reference the global version will error.
48
+ *
49
+ * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941
50
+ */
51
+ type EndingType = 'native' | 'transparent';
52
+ /**
53
+ * A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain
54
+ * environments and attempting to reference the global version will error.
55
+ *
56
+ * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154
57
+ * https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options
58
+ */
59
+ export interface BlobPropertyBag {
60
+ endings?: EndingType;
61
+ type?: string;
62
+ }
63
+ /**
64
+ * A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain
65
+ * environments and attempting to reference the global version will error.
66
+ *
67
+ * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503
68
+ * https://developer.mozilla.org/en-US/docs/Web/API/File/File#options
69
+ */
70
+ export interface FilePropertyBag extends BlobPropertyBag {
71
+ lastModified?: number;
72
+ }
73
+ //# sourceMappingURL=builtin-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-types.d.mts","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,KAAK,SAAS,GAAG,QAAQ,CAAC;AAE1B;;;;GAIG;AACH,KAAK,YAAY,GAAG,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;GAIG;AACH,KAAK,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErC;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EACV,MAAM,IAAI,KAAK,EACf,SAAS,IAAI,QAAQ,EACrB,YAAY,IAAI,WAAW,EAC3B,OAAO,IAAI,MAAM,EACjB,YAAY,IAAI,WAAW,EAC3B,YAAY,IAAI,WAAW,EAC3B,SAAS,IAAI,QAAQ,GACtB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,73 @@
1
+ export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
2
+ /**
3
+ * An alias to the builtin `RequestInit` type so we can
4
+ * easily alias it in import statements if there are name clashes.
5
+ *
6
+ * https://developer.mozilla.org/docs/Web/API/RequestInit
7
+ */
8
+ type _RequestInit = RequestInit;
9
+ /**
10
+ * An alias to the builtin `Response` type so we can
11
+ * easily alias it in import statements if there are name clashes.
12
+ *
13
+ * https://developer.mozilla.org/docs/Web/API/Response
14
+ */
15
+ type _Response = Response;
16
+ /**
17
+ * The type for the first argument to `fetch`.
18
+ *
19
+ * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource
20
+ */
21
+ type _RequestInfo = Request | URL | string;
22
+ /**
23
+ * The type for constructing `RequestInit` Headers.
24
+ *
25
+ * https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers
26
+ */
27
+ type _HeadersInit = RequestInit['headers'];
28
+ /**
29
+ * The type for constructing `RequestInit` body.
30
+ *
31
+ * https://developer.mozilla.org/docs/Web/API/RequestInit#body
32
+ */
33
+ type _BodyInit = RequestInit['body'];
34
+ /**
35
+ * An alias to the builtin `Array<T>` type so we can
36
+ * easily alias it in import statements if there are name clashes.
37
+ */
38
+ type _Array<T> = Array<T>;
39
+ /**
40
+ * An alias to the builtin `Record<K, T>` type so we can
41
+ * easily alias it in import statements if there are name clashes.
42
+ */
43
+ type _Record<K extends keyof any, T> = Record<K, T>;
44
+ export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response, };
45
+ /**
46
+ * A copy of the builtin `EndingType` type as it isn't fully supported in certain
47
+ * environments and attempting to reference the global version will error.
48
+ *
49
+ * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941
50
+ */
51
+ type EndingType = 'native' | 'transparent';
52
+ /**
53
+ * A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain
54
+ * environments and attempting to reference the global version will error.
55
+ *
56
+ * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154
57
+ * https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options
58
+ */
59
+ export interface BlobPropertyBag {
60
+ endings?: EndingType;
61
+ type?: string;
62
+ }
63
+ /**
64
+ * A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain
65
+ * environments and attempting to reference the global version will error.
66
+ *
67
+ * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503
68
+ * https://developer.mozilla.org/en-US/docs/Web/API/File/File#options
69
+ */
70
+ export interface FilePropertyBag extends BlobPropertyBag {
71
+ lastModified?: number;
72
+ }
73
+ //# sourceMappingURL=builtin-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-types.d.ts","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC;AAEhC;;;;;GAKG;AACH,KAAK,SAAS,GAAG,QAAQ,CAAC;AAE1B;;;;GAIG;AACH,KAAK,YAAY,GAAG,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,KAAK,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAE3C;;;;GAIG;AACH,KAAK,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAErC;;;GAGG;AACH,KAAK,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1B;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpD,YAAY,EACV,MAAM,IAAI,KAAK,EACf,SAAS,IAAI,QAAQ,EACrB,YAAY,IAAI,WAAW,EAC3B,OAAO,IAAI,MAAM,EACjB,YAAY,IAAI,WAAW,EAC3B,YAAY,IAAI,WAAW,EAC3B,SAAS,IAAI,QAAQ,GACtB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=builtin-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-types.js","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export {};
3
+ //# sourceMappingURL=builtin-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-types.mjs","sourceRoot":"","sources":["../src/internal/builtin-types.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
@@ -0,0 +1,15 @@
1
+ export declare const isRunningInBrowser: () => boolean;
2
+ type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown';
3
+ type PlatformName = 'MacOS' | 'Linux' | 'Windows' | 'FreeBSD' | 'OpenBSD' | 'iOS' | 'Android' | `Other:${string}` | 'Unknown';
4
+ type Browser = 'ie' | 'edge' | 'chrome' | 'firefox' | 'safari';
5
+ type PlatformProperties = {
6
+ 'X-Stainless-Lang': 'js';
7
+ 'X-Stainless-Package-Version': string;
8
+ 'X-Stainless-OS': PlatformName;
9
+ 'X-Stainless-Arch': Arch;
10
+ 'X-Stainless-Runtime': 'node' | 'deno' | 'edge' | `browser:${Browser}` | 'unknown';
11
+ 'X-Stainless-Runtime-Version': string;
12
+ };
13
+ export declare const getPlatformHeaders: () => PlatformProperties;
14
+ export {};
15
+ //# sourceMappingURL=detect-platform.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-platform.d.mts","sourceRoot":"","sources":["../src/internal/detect-platform.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,eAS9B,CAAC;AA0BF,KAAK,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;AAC5E,KAAK,YAAY,GACb,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,KAAK,GACL,SAAS,GACT,SAAS,MAAM,EAAE,GACjB,SAAS,CAAC;AACd,KAAK,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC/D,KAAK,kBAAkB,GAAG;IACxB,kBAAkB,EAAE,IAAI,CAAC;IACzB,6BAA6B,EAAE,MAAM,CAAC;IACtC,gBAAgB,EAAE,YAAY,CAAC;IAC/B,kBAAkB,EAAE,IAAI,CAAC;IACzB,qBAAqB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,OAAO,EAAE,GAAG,SAAS,CAAC;IACnF,6BAA6B,EAAE,MAAM,CAAC;CACvC,CAAC;AAuIF,eAAO,MAAM,kBAAkB,0BAE9B,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare const isRunningInBrowser: () => boolean;
2
+ type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown';
3
+ type PlatformName = 'MacOS' | 'Linux' | 'Windows' | 'FreeBSD' | 'OpenBSD' | 'iOS' | 'Android' | `Other:${string}` | 'Unknown';
4
+ type Browser = 'ie' | 'edge' | 'chrome' | 'firefox' | 'safari';
5
+ type PlatformProperties = {
6
+ 'X-Stainless-Lang': 'js';
7
+ 'X-Stainless-Package-Version': string;
8
+ 'X-Stainless-OS': PlatformName;
9
+ 'X-Stainless-Arch': Arch;
10
+ 'X-Stainless-Runtime': 'node' | 'deno' | 'edge' | `browser:${Browser}` | 'unknown';
11
+ 'X-Stainless-Runtime-Version': string;
12
+ };
13
+ export declare const getPlatformHeaders: () => PlatformProperties;
14
+ export {};
15
+ //# sourceMappingURL=detect-platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-platform.d.ts","sourceRoot":"","sources":["../src/internal/detect-platform.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,eAS9B,CAAC;AA0BF,KAAK,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;AAC5E,KAAK,YAAY,GACb,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,KAAK,GACL,SAAS,GACT,SAAS,MAAM,EAAE,GACjB,SAAS,CAAC;AACd,KAAK,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC/D,KAAK,kBAAkB,GAAG;IACxB,kBAAkB,EAAE,IAAI,CAAC;IACzB,6BAA6B,EAAE,MAAM,CAAC;IACtC,gBAAgB,EAAE,YAAY,CAAC;IAC/B,kBAAkB,EAAE,IAAI,CAAC;IACzB,qBAAqB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,OAAO,EAAE,GAAG,SAAS,CAAC;IACnF,6BAA6B,EAAE,MAAM,CAAC;CACvC,CAAC;AAuIF,eAAO,MAAM,kBAAkB,0BAE9B,CAAC"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getPlatformHeaders = exports.isRunningInBrowser = void 0;
5
+ const version_1 = require("../version.js");
6
+ const isRunningInBrowser = () => {
7
+ return (
8
+ // @ts-ignore
9
+ typeof window !== 'undefined' &&
10
+ // @ts-ignore
11
+ typeof window.document !== 'undefined' &&
12
+ // @ts-ignore
13
+ typeof navigator !== 'undefined');
14
+ };
15
+ exports.isRunningInBrowser = isRunningInBrowser;
16
+ /**
17
+ * Note this does not detect 'browser'; for that, use getBrowserInfo().
18
+ */
19
+ function getDetectedPlatform() {
20
+ if (typeof Deno !== 'undefined' && Deno.build != null) {
21
+ return 'deno';
22
+ }
23
+ if (typeof EdgeRuntime !== 'undefined') {
24
+ return 'edge';
25
+ }
26
+ if (Object.prototype.toString.call(typeof globalThis.process !== 'undefined' ? globalThis.process : 0) === '[object process]') {
27
+ return 'node';
28
+ }
29
+ return 'unknown';
30
+ }
31
+ const getPlatformProperties = () => {
32
+ const detectedPlatform = getDetectedPlatform();
33
+ if (detectedPlatform === 'deno') {
34
+ return {
35
+ 'X-Stainless-Lang': 'js',
36
+ 'X-Stainless-Package-Version': version_1.VERSION,
37
+ 'X-Stainless-OS': normalizePlatform(Deno.build.os),
38
+ 'X-Stainless-Arch': normalizeArch(Deno.build.arch),
39
+ 'X-Stainless-Runtime': 'deno',
40
+ 'X-Stainless-Runtime-Version': typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
41
+ };
42
+ }
43
+ if (typeof EdgeRuntime !== 'undefined') {
44
+ return {
45
+ 'X-Stainless-Lang': 'js',
46
+ 'X-Stainless-Package-Version': version_1.VERSION,
47
+ 'X-Stainless-OS': 'Unknown',
48
+ 'X-Stainless-Arch': `other:${EdgeRuntime}`,
49
+ 'X-Stainless-Runtime': 'edge',
50
+ 'X-Stainless-Runtime-Version': globalThis.process.version,
51
+ };
52
+ }
53
+ // Check if Node.js
54
+ if (detectedPlatform === 'node') {
55
+ return {
56
+ 'X-Stainless-Lang': 'js',
57
+ 'X-Stainless-Package-Version': version_1.VERSION,
58
+ 'X-Stainless-OS': normalizePlatform(globalThis.process.platform ?? 'unknown'),
59
+ 'X-Stainless-Arch': normalizeArch(globalThis.process.arch ?? 'unknown'),
60
+ 'X-Stainless-Runtime': 'node',
61
+ 'X-Stainless-Runtime-Version': globalThis.process.version ?? 'unknown',
62
+ };
63
+ }
64
+ const browserInfo = getBrowserInfo();
65
+ if (browserInfo) {
66
+ return {
67
+ 'X-Stainless-Lang': 'js',
68
+ 'X-Stainless-Package-Version': version_1.VERSION,
69
+ 'X-Stainless-OS': 'Unknown',
70
+ 'X-Stainless-Arch': 'unknown',
71
+ 'X-Stainless-Runtime': `browser:${browserInfo.browser}`,
72
+ 'X-Stainless-Runtime-Version': browserInfo.version,
73
+ };
74
+ }
75
+ // TODO add support for Cloudflare workers, etc.
76
+ return {
77
+ 'X-Stainless-Lang': 'js',
78
+ 'X-Stainless-Package-Version': version_1.VERSION,
79
+ 'X-Stainless-OS': 'Unknown',
80
+ 'X-Stainless-Arch': 'unknown',
81
+ 'X-Stainless-Runtime': 'unknown',
82
+ 'X-Stainless-Runtime-Version': 'unknown',
83
+ };
84
+ };
85
+ // Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts
86
+ function getBrowserInfo() {
87
+ if (typeof navigator === 'undefined' || !navigator) {
88
+ return null;
89
+ }
90
+ // NOTE: The order matters here!
91
+ const browserPatterns = [
92
+ { key: 'edge', pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
93
+ { key: 'ie', pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
94
+ { key: 'ie', pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ },
95
+ { key: 'chrome', pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
96
+ { key: 'firefox', pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
97
+ { key: 'safari', pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ },
98
+ ];
99
+ // Find the FIRST matching browser
100
+ for (const { key, pattern } of browserPatterns) {
101
+ const match = pattern.exec(navigator.userAgent);
102
+ if (match) {
103
+ const major = match[1] || 0;
104
+ const minor = match[2] || 0;
105
+ const patch = match[3] || 0;
106
+ return { browser: key, version: `${major}.${minor}.${patch}` };
107
+ }
108
+ }
109
+ return null;
110
+ }
111
+ const normalizeArch = (arch) => {
112
+ // Node docs:
113
+ // - https://nodejs.org/api/process.html#processarch
114
+ // Deno docs:
115
+ // - https://doc.deno.land/deno/stable/~/Deno.build
116
+ if (arch === 'x32')
117
+ return 'x32';
118
+ if (arch === 'x86_64' || arch === 'x64')
119
+ return 'x64';
120
+ if (arch === 'arm')
121
+ return 'arm';
122
+ if (arch === 'aarch64' || arch === 'arm64')
123
+ return 'arm64';
124
+ if (arch)
125
+ return `other:${arch}`;
126
+ return 'unknown';
127
+ };
128
+ const normalizePlatform = (platform) => {
129
+ // Node platforms:
130
+ // - https://nodejs.org/api/process.html#processplatform
131
+ // Deno platforms:
132
+ // - https://doc.deno.land/deno/stable/~/Deno.build
133
+ // - https://github.com/denoland/deno/issues/14799
134
+ platform = platform.toLowerCase();
135
+ // NOTE: this iOS check is untested and may not work
136
+ // Node does not work natively on IOS, there is a fork at
137
+ // https://github.com/nodejs-mobile/nodejs-mobile
138
+ // however it is unknown at the time of writing how to detect if it is running
139
+ if (platform.includes('ios'))
140
+ return 'iOS';
141
+ if (platform === 'android')
142
+ return 'Android';
143
+ if (platform === 'darwin')
144
+ return 'MacOS';
145
+ if (platform === 'win32')
146
+ return 'Windows';
147
+ if (platform === 'freebsd')
148
+ return 'FreeBSD';
149
+ if (platform === 'openbsd')
150
+ return 'OpenBSD';
151
+ if (platform === 'linux')
152
+ return 'Linux';
153
+ if (platform)
154
+ return `Other:${platform}`;
155
+ return 'Unknown';
156
+ };
157
+ let _platformHeaders;
158
+ const getPlatformHeaders = () => {
159
+ return (_platformHeaders ?? (_platformHeaders = getPlatformProperties()));
160
+ };
161
+ exports.getPlatformHeaders = getPlatformHeaders;
162
+ //# sourceMappingURL=detect-platform.js.map