alchemy 0.74.2 → 0.75.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/README.md +1 -1
  2. package/bin/alchemy.js +1781 -1746
  3. package/bin/alchemy.ts +1 -1
  4. package/bin/commands/create.ts +5 -4
  5. package/bin/commands/init.ts +109 -65
  6. package/bin/commands/util.ts +3 -1
  7. package/bin/constants.ts +2 -2
  8. package/bin/services/dependencies.ts +4 -4
  9. package/bin/services/execute-alchemy.ts +5 -3
  10. package/bin/services/get-package-version.ts +4 -4
  11. package/bin/services/github-workflow.ts +9 -10
  12. package/bin/services/package-manager.ts +1 -5
  13. package/bin/services/template-manager.ts +20 -13
  14. package/bin/services/vibe-rules.ts +6 -5
  15. package/bin/trpc.ts +7 -0
  16. package/bin/types.ts +1 -0
  17. package/lib/alchemy.d.ts +1 -1
  18. package/lib/alchemy.d.ts.map +1 -1
  19. package/lib/alchemy.js +30 -2
  20. package/lib/alchemy.js.map +1 -1
  21. package/lib/apply.js +10 -0
  22. package/lib/apply.js.map +1 -1
  23. package/lib/auth.js +1 -1
  24. package/lib/auth.js.map +1 -1
  25. package/lib/aws/control/types.d.ts.map +1 -1
  26. package/lib/aws/control/types.js.map +1 -1
  27. package/lib/clickhouse/api/sdk.gen.d.ts.map +1 -1
  28. package/lib/clickhouse/api/sdk.gen.js.map +1 -1
  29. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  30. package/lib/cloudflare/account-api-token.js.map +1 -1
  31. package/lib/cloudflare/astro/astro.js +1 -1
  32. package/lib/cloudflare/astro/astro.js.map +1 -1
  33. package/lib/cloudflare/bound.d.ts.map +1 -1
  34. package/lib/cloudflare/bucket.d.ts +1 -1
  35. package/lib/cloudflare/bucket.d.ts.map +1 -1
  36. package/lib/cloudflare/bucket.js +1 -1
  37. package/lib/cloudflare/bucket.js.map +1 -1
  38. package/lib/cloudflare/bun-spa/bun-spa.d.ts +1 -1
  39. package/lib/cloudflare/bun-spa/bun-spa.d.ts.map +1 -1
  40. package/lib/cloudflare/bun-spa/bun-spa.js +10 -11
  41. package/lib/cloudflare/bun-spa/bun-spa.js.map +1 -1
  42. package/lib/cloudflare/bun-spa/get-bun-spa-backend.d.ts +11 -0
  43. package/lib/cloudflare/bun-spa/get-bun-spa-backend.d.ts.map +1 -0
  44. package/lib/cloudflare/bun-spa/get-bun-spa-backend.js +26 -0
  45. package/lib/cloudflare/bun-spa/get-bun-spa-backend.js.map +1 -0
  46. package/lib/cloudflare/bun-spa/index.d.ts +2 -0
  47. package/lib/cloudflare/bun-spa/index.d.ts.map +1 -0
  48. package/lib/cloudflare/bun-spa/index.js +2 -0
  49. package/lib/cloudflare/bun-spa/index.js.map +1 -0
  50. package/lib/cloudflare/bundle/internal-worker-bundle.js +1 -1
  51. package/lib/cloudflare/bundle/internal-worker-bundle.js.map +1 -1
  52. package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js +1 -1
  53. package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js.map +1 -1
  54. package/lib/cloudflare/bundle/plugin-node-compat.js +1 -1
  55. package/lib/cloudflare/bundle/plugin-node-compat.js.map +1 -1
  56. package/lib/cloudflare/bundle/plugin-wasm.js +1 -1
  57. package/lib/cloudflare/bundle/plugin-wasm.js.map +1 -1
  58. package/lib/cloudflare/cloudflare-env-proxy.d.ts.map +1 -1
  59. package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
  60. package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
  61. package/lib/cloudflare/d1-migrations.js +1 -1
  62. package/lib/cloudflare/d1-migrations.js.map +1 -1
  63. package/lib/cloudflare/dns-records.js.map +1 -1
  64. package/lib/cloudflare/kv-namespace.d.ts +5 -0
  65. package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
  66. package/lib/cloudflare/kv-namespace.js +44 -19
  67. package/lib/cloudflare/kv-namespace.js.map +1 -1
  68. package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
  69. package/lib/cloudflare/miniflare/delete.js +3 -0
  70. package/lib/cloudflare/miniflare/delete.js.map +1 -1
  71. package/lib/cloudflare/miniflare/miniflare-controller.js +1 -1
  72. package/lib/cloudflare/miniflare/miniflare-controller.js.map +1 -1
  73. package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts.map +1 -1
  74. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js +34 -4
  75. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js.map +1 -1
  76. package/lib/cloudflare/miniflare/paths.d.ts +0 -1
  77. package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
  78. package/lib/cloudflare/miniflare/paths.js +6 -18
  79. package/lib/cloudflare/miniflare/paths.js.map +1 -1
  80. package/lib/cloudflare/next.js +1 -1
  81. package/lib/cloudflare/next.js.map +1 -1
  82. package/lib/cloudflare/nuxt/nuxt.js +1 -1
  83. package/lib/cloudflare/nuxt/nuxt.js.map +1 -1
  84. package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
  85. package/lib/cloudflare/nuxt/plugin.js +2 -2
  86. package/lib/cloudflare/nuxt/plugin.js.map +1 -1
  87. package/lib/cloudflare/react-router/plugin.js +1 -1
  88. package/lib/cloudflare/react-router/plugin.js.map +1 -1
  89. package/lib/cloudflare/react-router/react-router.js +1 -1
  90. package/lib/cloudflare/react-router/react-router.js.map +1 -1
  91. package/lib/cloudflare/redwood/redwood.js +1 -1
  92. package/lib/cloudflare/redwood/redwood.js.map +1 -1
  93. package/lib/cloudflare/sveltekit/sveltekit.js +1 -1
  94. package/lib/cloudflare/sveltekit/sveltekit.js.map +1 -1
  95. package/lib/cloudflare/tanstack-start/tanstack-start.js +1 -1
  96. package/lib/cloudflare/tanstack-start/tanstack-start.js.map +1 -1
  97. package/lib/cloudflare/tunnel.d.ts.map +1 -1
  98. package/lib/cloudflare/tunnel.js +25 -1
  99. package/lib/cloudflare/tunnel.js.map +1 -1
  100. package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
  101. package/lib/cloudflare/vite/plugin.js +4 -4
  102. package/lib/cloudflare/vite/plugin.js.map +1 -1
  103. package/lib/cloudflare/website.d.ts.map +1 -1
  104. package/lib/cloudflare/website.js +1 -5
  105. package/lib/cloudflare/website.js.map +1 -1
  106. package/lib/cloudflare/worker-assets.d.ts +1 -1
  107. package/lib/cloudflare/worker-assets.d.ts.map +1 -1
  108. package/lib/cloudflare/worker-assets.js +1 -1
  109. package/lib/cloudflare/worker-assets.js.map +1 -1
  110. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  111. package/lib/cloudflare/worker-metadata.js.map +1 -1
  112. package/lib/cloudflare/worker-tail.d.ts.map +1 -1
  113. package/lib/cloudflare/worker-tail.js.map +1 -1
  114. package/lib/cloudflare/worker.d.ts.map +1 -1
  115. package/lib/cloudflare/worker.js +1 -1
  116. package/lib/cloudflare/worker.js.map +1 -1
  117. package/lib/cloudflare/wrangler.json.js +1 -2
  118. package/lib/cloudflare/wrangler.json.js.map +1 -1
  119. package/lib/coinbase/evm-account.d.ts.map +1 -1
  120. package/lib/coinbase/evm-account.js.map +1 -1
  121. package/lib/coinbase/evm-smart-account.d.ts.map +1 -1
  122. package/lib/coinbase/evm-smart-account.js.map +1 -1
  123. package/lib/coinbase/faucet.js +2 -2
  124. package/lib/coinbase/faucet.js.map +1 -1
  125. package/lib/docker/api.d.ts.map +1 -1
  126. package/lib/docker/api.js +1 -1
  127. package/lib/docker/api.js.map +1 -1
  128. package/lib/docker/image.js +1 -1
  129. package/lib/docker/image.js.map +1 -1
  130. package/lib/esbuild/bundle.js +1 -1
  131. package/lib/esbuild/bundle.js.map +1 -1
  132. package/lib/fs/file.js +1 -1
  133. package/lib/fs/file.js.map +1 -1
  134. package/lib/github/secret.d.ts.map +1 -1
  135. package/lib/github/secret.js.map +1 -1
  136. package/lib/llms.js +1 -1
  137. package/lib/llms.js.map +1 -1
  138. package/lib/neon/api/sdk.gen.d.ts.map +1 -1
  139. package/lib/neon/api/sdk.gen.js.map +1 -1
  140. package/lib/os/exec.d.ts.map +1 -1
  141. package/lib/os/exec.js +1 -1
  142. package/lib/os/exec.js.map +1 -1
  143. package/lib/planetscale/api/sdk.gen.d.ts.map +1 -1
  144. package/lib/planetscale/api/sdk.gen.js.map +1 -1
  145. package/lib/prisma-postgres/api/sdk.gen.d.ts.map +1 -1
  146. package/lib/prisma-postgres/api/sdk.gen.js.map +1 -1
  147. package/lib/scope.d.ts.map +1 -1
  148. package/lib/scope.js +3 -3
  149. package/lib/scope.js.map +1 -1
  150. package/lib/sentry/client-key.js +1 -1
  151. package/lib/sentry/client-key.js.map +1 -1
  152. package/lib/state/file-system-state-store.js +1 -1
  153. package/lib/state/file-system-state-store.js.map +1 -1
  154. package/lib/state/migrations.js +1 -1
  155. package/lib/state/migrations.js.map +1 -1
  156. package/lib/state/sqlite-state-store.js +1 -1
  157. package/lib/state/sqlite-state-store.js.map +1 -1
  158. package/lib/stripe/file.d.ts +3 -3
  159. package/lib/stripe/file.js +3 -3
  160. package/lib/test/bun.d.ts.map +1 -1
  161. package/lib/test/bun.js +1 -1
  162. package/lib/test/bun.js.map +1 -1
  163. package/lib/test/prune.js +1 -1
  164. package/lib/test/prune.js.map +1 -1
  165. package/lib/test/vitest.d.ts.map +1 -1
  166. package/lib/test/vitest.js +1 -1
  167. package/lib/test/vitest.js.map +1 -1
  168. package/lib/util/api/client/client.gen.d.ts +1 -1
  169. package/lib/util/api/client/client.gen.js +45 -45
  170. package/lib/util/api/client/types.gen.d.ts +22 -22
  171. package/lib/util/api/client/utils.gen.d.ts +3 -3
  172. package/lib/util/api/client/utils.gen.d.ts.map +1 -1
  173. package/lib/util/api/client/utils.gen.js +34 -34
  174. package/lib/util/api/client/utils.gen.js.map +1 -1
  175. package/lib/util/api/core/auth.gen.d.ts +3 -3
  176. package/lib/util/api/core/auth.gen.js +3 -3
  177. package/lib/util/api/core/bodySerializer.gen.d.ts +1 -1
  178. package/lib/util/api/core/bodySerializer.gen.js +3 -3
  179. package/lib/util/api/core/params.gen.d.ts +3 -3
  180. package/lib/util/api/core/params.gen.js +7 -7
  181. package/lib/util/api/core/pathSerializer.gen.d.ts +3 -3
  182. package/lib/util/api/core/pathSerializer.gen.js +36 -36
  183. package/lib/util/api/core/serverSentEvents.gen.d.ts +3 -3
  184. package/lib/util/api/core/serverSentEvents.gen.js +18 -18
  185. package/lib/util/api/core/types.gen.d.ts +4 -4
  186. package/lib/util/api/core/utils.gen.d.ts +1 -1
  187. package/lib/util/api/core/utils.gen.js +17 -17
  188. package/lib/util/camel-to-snake.d.ts.map +1 -1
  189. package/lib/util/content-type.js +1 -1
  190. package/lib/util/content-type.js.map +1 -1
  191. package/lib/util/find-workspace-root.d.ts +3 -0
  192. package/lib/util/find-workspace-root.d.ts.map +1 -0
  193. package/lib/util/find-workspace-root.js +64 -0
  194. package/lib/util/find-workspace-root.js.map +1 -0
  195. package/lib/util/idempotent-spawn.d.ts.map +1 -1
  196. package/lib/util/idempotent-spawn.js +2 -2
  197. package/lib/util/idempotent-spawn.js.map +1 -1
  198. package/lib/util/lock.js +1 -1
  199. package/lib/util/lock.js.map +1 -1
  200. package/lib/util/peer.d.ts.map +1 -1
  201. package/lib/util/peer.js.map +1 -1
  202. package/package.json +6 -1
  203. package/src/alchemy.ts +60 -4
  204. package/src/apply.ts +16 -1
  205. package/src/auth.ts +1 -1
  206. package/src/aws/control/types.ts +87107 -85281
  207. package/src/clickhouse/api/sdk.gen.ts +1 -3
  208. package/src/cloudflare/account-api-token.ts +3 -1
  209. package/src/cloudflare/astro/astro.ts +1 -1
  210. package/src/cloudflare/bound.ts +64 -65
  211. package/src/cloudflare/bucket.ts +4 -7
  212. package/src/cloudflare/bun-spa/bun-spa.ts +13 -13
  213. package/src/cloudflare/bun-spa/get-bun-spa-backend.ts +29 -0
  214. package/src/cloudflare/bun-spa/index.ts +1 -0
  215. package/src/cloudflare/bundle/internal-worker-bundle.ts +1 -1
  216. package/src/cloudflare/bundle/plugin-hybrid-node-compat.ts +1 -1
  217. package/src/cloudflare/bundle/plugin-node-compat.ts +1 -1
  218. package/src/cloudflare/bundle/plugin-wasm.ts +1 -1
  219. package/src/cloudflare/cloudflare-env-proxy.ts +2 -4
  220. package/src/cloudflare/d1-migrations.ts +1 -1
  221. package/src/cloudflare/dns-records.ts +3 -1
  222. package/src/cloudflare/kv-namespace.ts +52 -20
  223. package/src/cloudflare/miniflare/delete.ts +3 -0
  224. package/src/cloudflare/miniflare/miniflare-controller.ts +1 -1
  225. package/src/cloudflare/miniflare/miniflare-worker-proxy.ts +39 -4
  226. package/src/cloudflare/miniflare/paths.ts +6 -26
  227. package/src/cloudflare/next.ts +1 -1
  228. package/src/cloudflare/nuxt/nuxt.ts +1 -1
  229. package/src/cloudflare/nuxt/plugin.ts +1 -4
  230. package/src/cloudflare/react-router/plugin.ts +1 -1
  231. package/src/cloudflare/react-router/react-router.ts +1 -1
  232. package/src/cloudflare/redwood/redwood.ts +1 -1
  233. package/src/cloudflare/sveltekit/sveltekit.ts +1 -1
  234. package/src/cloudflare/tanstack-start/tanstack-start.ts +1 -1
  235. package/src/cloudflare/tunnel.ts +36 -1
  236. package/src/cloudflare/vite/plugin.ts +2 -4
  237. package/src/cloudflare/website.ts +1 -6
  238. package/src/cloudflare/worker-assets.ts +1 -6
  239. package/src/cloudflare/worker-metadata.ts +5 -3
  240. package/src/cloudflare/worker-tail.ts +3 -1
  241. package/src/cloudflare/worker.ts +1 -3
  242. package/src/cloudflare/wrangler.json.ts +1 -2
  243. package/src/coinbase/evm-account.ts +3 -1
  244. package/src/coinbase/evm-smart-account.ts +3 -1
  245. package/src/coinbase/faucet.ts +2 -2
  246. package/src/docker/api.ts +4 -2
  247. package/src/docker/image.ts +1 -1
  248. package/src/esbuild/bundle.ts +1 -1
  249. package/src/fs/file.ts +1 -1
  250. package/src/github/secret.ts +5 -1
  251. package/src/llms.ts +1 -1
  252. package/src/neon/api/sdk.gen.ts +1 -3
  253. package/src/os/exec.ts +4 -2
  254. package/src/planetscale/api/sdk.gen.ts +1 -3
  255. package/src/prisma-postgres/api/sdk.gen.ts +1 -3
  256. package/src/scope.ts +3 -3
  257. package/src/sentry/client-key.ts +1 -5
  258. package/src/state/file-system-state-store.ts +1 -1
  259. package/src/state/migrations.ts +1 -1
  260. package/src/state/sqlite-state-store.ts +1 -1
  261. package/src/stripe/file.ts +3 -3
  262. package/src/test/bun.ts +4 -2
  263. package/src/test/prune.ts +1 -1
  264. package/src/test/vitest.ts +4 -2
  265. package/src/util/api/client/client.gen.ts +49 -49
  266. package/src/util/api/client/types.gen.ts +43 -43
  267. package/src/util/api/client/utils.gen.ts +47 -42
  268. package/src/util/api/core/auth.gen.ts +6 -6
  269. package/src/util/api/core/bodySerializer.gen.ts +4 -4
  270. package/src/util/api/core/params.gen.ts +10 -10
  271. package/src/util/api/core/pathSerializer.gen.ts +39 -39
  272. package/src/util/api/core/serverSentEvents.gen.ts +22 -22
  273. package/src/util/api/core/types.gen.ts +12 -12
  274. package/src/util/api/core/utils.gen.ts +18 -18
  275. package/src/util/camel-to-snake.ts +12 -10
  276. package/src/util/content-type.ts +1 -1
  277. package/{bin/services → src/util}/find-workspace-root.ts +27 -5
  278. package/src/util/idempotent-spawn.ts +2 -6
  279. package/src/util/lock.ts +1 -1
  280. package/src/util/peer.ts +3 -1
  281. package/templates/astro/alchemy.run.ts +0 -2
  282. package/templates/astro/astro.config.mjs +3 -3
  283. package/templates/astro/src/pages/api/hello.ts +16 -13
  284. package/templates/bun-spa/README.md +94 -0
  285. package/templates/bun-spa/_env +1 -0
  286. package/templates/bun-spa/_env.example +1 -0
  287. package/templates/bun-spa/_gitignore +29 -0
  288. package/templates/bun-spa/alchemy.run.ts +21 -0
  289. package/templates/bun-spa/bun-env.d.ts +25 -0
  290. package/templates/bun-spa/eslint.config.js +26 -0
  291. package/templates/bun-spa/package.json +30 -0
  292. package/templates/bun-spa/src/App.css +46 -0
  293. package/templates/bun-spa/src/App.tsx +53 -0
  294. package/templates/bun-spa/src/assets/logo.svg +1 -0
  295. package/templates/bun-spa/src/assets/react.svg +1 -0
  296. package/templates/bun-spa/src/frontend.tsx +14 -0
  297. package/templates/bun-spa/src/index.css +69 -0
  298. package/templates/bun-spa/src/index.html +14 -0
  299. package/templates/bun-spa/src/worker.ts +51 -0
  300. package/templates/bun-spa/tsconfig.json +24 -0
  301. package/templates/hono/alchemy.run.ts +0 -2
  302. package/templates/hono/src/index.ts +13 -13
  303. package/templates/nextjs/alchemy.run.ts +1 -3
  304. package/templates/nextjs/eslint.config.mjs +1 -1
  305. package/templates/nextjs/next-env.d.ts +1 -1
  306. package/templates/nextjs/next.config.ts +1 -1
  307. package/templates/nextjs/open-next.config.ts +1 -1
  308. package/templates/nextjs/src/app/api/hello/route.ts +2 -2
  309. package/templates/nextjs/src/app/layout.tsx +1 -1
  310. package/templates/nextjs/src/app/page.tsx +14 -15
  311. package/templates/nextjs/types/env.d.ts +4 -4
  312. package/templates/nuxt/alchemy.run.ts +0 -2
  313. package/templates/nuxt/server/middleware/auth.ts +1 -1
  314. package/templates/nuxt/server/middleware/hello.ts +2 -2
  315. package/templates/react-router/alchemy.run.ts +0 -2
  316. package/templates/react-router/app/entry.server.tsx +2 -2
  317. package/templates/react-router/package.json +1 -1
  318. package/templates/react-router/vite.config.ts +1 -1
  319. package/templates/react-router/workers/app.ts +2 -2
  320. package/templates/rwsdk/alchemy.run.ts +6 -4
  321. package/templates/rwsdk/package.json +1 -1
  322. package/templates/sveltekit/alchemy.run.ts +0 -2
  323. package/templates/sveltekit/package.json +1 -1
  324. package/templates/sveltekit/src/app.d.ts +7 -7
  325. package/templates/sveltekit/svelte.config.js +4 -4
  326. package/templates/sveltekit/vite.config.ts +3 -3
  327. package/templates/tanstack-start/alchemy.run.ts +0 -2
  328. package/templates/tanstack-start/package.json +1 -1
  329. package/templates/tanstack-start/src/components/Header.tsx +2 -2
  330. package/templates/tanstack-start/src/router.tsx +4 -4
  331. package/templates/tanstack-start/src/routes/__root.tsx +10 -10
  332. package/templates/tanstack-start/src/routes/api.demo-names.ts +6 -6
  333. package/templates/tanstack-start/src/routes/demo.start.api-request.tsx +11 -11
  334. package/templates/tanstack-start/src/routes/demo.start.server-funcs.tsx +30 -30
  335. package/templates/tanstack-start/src/routes/index.tsx +5 -5
  336. package/templates/tanstack-start/vite.config.ts +9 -9
  337. package/templates/typescript/alchemy.run.ts +0 -2
  338. package/templates/typescript/src/worker.ts +5 -1
  339. package/templates/vite/alchemy.run.ts +0 -2
  340. package/templates/vite/eslint.config.js +12 -12
  341. package/templates/vite/package.json +1 -1
  342. package/templates/vite/src/App.tsx +7 -7
  343. package/templates/vite/src/main.tsx +6 -6
  344. package/templates/vite/src/worker.ts +11 -12
  345. package/templates/vite/vite.config.ts +2 -2
  346. package/workers/tunnel-proxy.js +1 -1
  347. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +0 -2
  348. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +0 -1
  349. package/lib/cloudflare/miniflare/symlink-miniflare-state.js +0 -18
  350. package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +0 -1
  351. package/src/cloudflare/miniflare/symlink-miniflare-state.ts +0 -18
@@ -8,15 +8,15 @@ export interface Auth {
8
8
  *
9
9
  * @default 'header'
10
10
  */
11
- in?: 'header' | 'query' | 'cookie';
11
+ in?: "header" | "query" | "cookie";
12
12
  /**
13
13
  * Header or query parameter name.
14
14
  *
15
15
  * @default 'Authorization'
16
16
  */
17
17
  name?: string;
18
- scheme?: 'basic' | 'bearer';
19
- type: 'apiKey' | 'http';
18
+ scheme?: "basic" | "bearer";
19
+ type: "apiKey" | "http";
20
20
  }
21
21
 
22
22
  export const getAuthToken = async (
@@ -24,17 +24,17 @@ export const getAuthToken = async (
24
24
  callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
25
25
  ): Promise<string | undefined> => {
26
26
  const token =
27
- typeof callback === 'function' ? await callback(auth) : callback;
27
+ typeof callback === "function" ? await callback(auth) : callback;
28
28
 
29
29
  if (!token) {
30
30
  return;
31
31
  }
32
32
 
33
- if (auth.scheme === 'bearer') {
33
+ if (auth.scheme === "bearer") {
34
34
  return `Bearer ${token}`;
35
35
  }
36
36
 
37
- if (auth.scheme === 'basic') {
37
+ if (auth.scheme === "basic") {
38
38
  return `Basic ${btoa(token)}`;
39
39
  }
40
40
 
@@ -4,7 +4,7 @@ import type {
4
4
  ArrayStyle,
5
5
  ObjectStyle,
6
6
  SerializerOptions,
7
- } from './pathSerializer.gen';
7
+ } from "./pathSerializer.gen";
8
8
 
9
9
  export type QuerySerializer = (query: Record<string, unknown>) => string;
10
10
 
@@ -21,7 +21,7 @@ const serializeFormDataPair = (
21
21
  key: string,
22
22
  value: unknown,
23
23
  ): void => {
24
- if (typeof value === 'string' || value instanceof Blob) {
24
+ if (typeof value === "string" || value instanceof Blob) {
25
25
  data.append(key, value);
26
26
  } else if (value instanceof Date) {
27
27
  data.append(key, value.toISOString());
@@ -35,7 +35,7 @@ const serializeUrlSearchParamsPair = (
35
35
  key: string,
36
36
  value: unknown,
37
37
  ): void => {
38
- if (typeof value === 'string') {
38
+ if (typeof value === "string") {
39
39
  data.append(key, value);
40
40
  } else {
41
41
  data.append(key, JSON.stringify(value));
@@ -66,7 +66,7 @@ export const formDataBodySerializer = {
66
66
  export const jsonBodySerializer = {
67
67
  bodySerializer: <T>(body: T): string =>
68
68
  JSON.stringify(body, (_key, value) =>
69
- typeof value === 'bigint' ? value.toString() : value,
69
+ typeof value === "bigint" ? value.toString() : value,
70
70
  ),
71
71
  };
72
72
 
@@ -1,10 +1,10 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- type Slot = 'body' | 'headers' | 'path' | 'query';
3
+ type Slot = "body" | "headers" | "path" | "query";
4
4
 
5
5
  export type Field =
6
6
  | {
7
- in: Exclude<Slot, 'body'>;
7
+ in: Exclude<Slot, "body">;
8
8
  /**
9
9
  * Field name. This is the name we want the user to see and use.
10
10
  */
@@ -16,7 +16,7 @@ export type Field =
16
16
  map?: string;
17
17
  }
18
18
  | {
19
- in: Extract<Slot, 'body'>;
19
+ in: Extract<Slot, "body">;
20
20
  /**
21
21
  * Key isn't required for bodies.
22
22
  */
@@ -32,10 +32,10 @@ export interface Fields {
32
32
  export type FieldsConfig = ReadonlyArray<Field | Fields>;
33
33
 
34
34
  const extraPrefixesMap: Record<string, Slot> = {
35
- $body_: 'body',
36
- $headers_: 'headers',
37
- $path_: 'path',
38
- $query_: 'query',
35
+ $body_: "body",
36
+ $headers_: "headers",
37
+ $path_: "path",
38
+ $query_: "query",
39
39
  };
40
40
  const extraPrefixes = Object.entries(extraPrefixesMap);
41
41
 
@@ -53,7 +53,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
53
53
  }
54
54
 
55
55
  for (const config of fields) {
56
- if ('in' in config) {
56
+ if ("in" in config) {
57
57
  if (config.key) {
58
58
  map.set(config.key, {
59
59
  in: config.in,
@@ -77,7 +77,7 @@ interface Params {
77
77
 
78
78
  const stripEmptySlots = (params: Params) => {
79
79
  for (const [slot, value] of Object.entries(params)) {
80
- if (value && typeof value === 'object' && !Object.keys(value).length) {
80
+ if (value && typeof value === "object" && !Object.keys(value).length) {
81
81
  delete params[slot as Slot];
82
82
  }
83
83
  }
@@ -107,7 +107,7 @@ export const buildClientParams = (
107
107
  continue;
108
108
  }
109
109
 
110
- if ('in' in config) {
110
+ if ("in" in config) {
111
111
  if (config.key) {
112
112
  const field = map.get(config.key)!;
113
113
  const name = field.map || config.key;
@@ -17,10 +17,10 @@ export interface SerializerOptions<T> {
17
17
  style: T;
18
18
  }
19
19
 
20
- export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
20
+ export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
21
21
  export type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
22
- type MatrixStyle = 'label' | 'matrix' | 'simple';
23
- export type ObjectStyle = 'form' | 'deepObject';
22
+ type MatrixStyle = "label" | "matrix" | "simple";
23
+ export type ObjectStyle = "form" | "deepObject";
24
24
  type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
25
25
 
26
26
  interface SerializePrimitiveParam extends SerializePrimitiveOptions {
@@ -29,40 +29,40 @@ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
29
29
 
30
30
  export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
31
31
  switch (style) {
32
- case 'label':
33
- return '.';
34
- case 'matrix':
35
- return ';';
36
- case 'simple':
37
- return ',';
32
+ case "label":
33
+ return ".";
34
+ case "matrix":
35
+ return ";";
36
+ case "simple":
37
+ return ",";
38
38
  default:
39
- return '&';
39
+ return "&";
40
40
  }
41
41
  };
42
42
 
43
43
  export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
44
44
  switch (style) {
45
- case 'form':
46
- return ',';
47
- case 'pipeDelimited':
48
- return '|';
49
- case 'spaceDelimited':
50
- return '%20';
45
+ case "form":
46
+ return ",";
47
+ case "pipeDelimited":
48
+ return "|";
49
+ case "spaceDelimited":
50
+ return "%20";
51
51
  default:
52
- return ',';
52
+ return ",";
53
53
  }
54
54
  };
55
55
 
56
56
  export const separatorObjectExplode = (style: ObjectSeparatorStyle) => {
57
57
  switch (style) {
58
- case 'label':
59
- return '.';
60
- case 'matrix':
61
- return ';';
62
- case 'simple':
63
- return ',';
58
+ case "label":
59
+ return ".";
60
+ case "matrix":
61
+ return ";";
62
+ case "simple":
63
+ return ",";
64
64
  default:
65
- return '&';
65
+ return "&";
66
66
  }
67
67
  };
68
68
 
@@ -80,11 +80,11 @@ export const serializeArrayParam = ({
80
80
  allowReserved ? value : value.map((v) => encodeURIComponent(v as string))
81
81
  ).join(separatorArrayNoExplode(style));
82
82
  switch (style) {
83
- case 'label':
83
+ case "label":
84
84
  return `.${joinedValues}`;
85
- case 'matrix':
85
+ case "matrix":
86
86
  return `;${name}=${joinedValues}`;
87
- case 'simple':
87
+ case "simple":
88
88
  return joinedValues;
89
89
  default:
90
90
  return `${name}=${joinedValues}`;
@@ -94,7 +94,7 @@ export const serializeArrayParam = ({
94
94
  const separator = separatorArrayExplode(style);
95
95
  const joinedValues = value
96
96
  .map((v) => {
97
- if (style === 'label' || style === 'simple') {
97
+ if (style === "label" || style === "simple") {
98
98
  return allowReserved ? v : encodeURIComponent(v as string);
99
99
  }
100
100
 
@@ -105,7 +105,7 @@ export const serializeArrayParam = ({
105
105
  });
106
106
  })
107
107
  .join(separator);
108
- return style === 'label' || style === 'matrix'
108
+ return style === "label" || style === "matrix"
109
109
  ? separator + joinedValues
110
110
  : joinedValues;
111
111
  };
@@ -116,12 +116,12 @@ export const serializePrimitiveParam = ({
116
116
  value,
117
117
  }: SerializePrimitiveParam) => {
118
118
  if (value === undefined || value === null) {
119
- return '';
119
+ return "";
120
120
  }
121
121
 
122
- if (typeof value === 'object') {
122
+ if (typeof value === "object") {
123
123
  throw new Error(
124
- 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.',
124
+ "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.",
125
125
  );
126
126
  }
127
127
 
@@ -143,7 +143,7 @@ export const serializeObjectParam = ({
143
143
  return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
144
144
  }
145
145
 
146
- if (style !== 'deepObject' && !explode) {
146
+ if (style !== "deepObject" && !explode) {
147
147
  let values: string[] = [];
148
148
  Object.entries(value).forEach(([key, v]) => {
149
149
  values = [
@@ -152,13 +152,13 @@ export const serializeObjectParam = ({
152
152
  allowReserved ? (v as string) : encodeURIComponent(v as string),
153
153
  ];
154
154
  });
155
- const joinedValues = values.join(',');
155
+ const joinedValues = values.join(",");
156
156
  switch (style) {
157
- case 'form':
157
+ case "form":
158
158
  return `${name}=${joinedValues}`;
159
- case 'label':
159
+ case "label":
160
160
  return `.${joinedValues}`;
161
- case 'matrix':
161
+ case "matrix":
162
162
  return `;${name}=${joinedValues}`;
163
163
  default:
164
164
  return joinedValues;
@@ -170,12 +170,12 @@ export const serializeObjectParam = ({
170
170
  .map(([key, v]) =>
171
171
  serializePrimitiveParam({
172
172
  allowReserved,
173
- name: style === 'deepObject' ? `${name}[${key}]` : key,
173
+ name: style === "deepObject" ? `${name}[${key}]` : key,
174
174
  value: v as string,
175
175
  }),
176
176
  )
177
177
  .join(separator);
178
- return style === 'label' || style === 'matrix'
178
+ return style === "label" || style === "matrix"
179
179
  ? separator + joinedValues
180
180
  : joinedValues;
181
181
  };
@@ -1,12 +1,12 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- import type { Config } from './types.gen';
3
+ import type { Config } from "./types.gen";
4
4
 
5
5
  export type ServerSentEventsOptions<TData = unknown> = Omit<
6
6
  RequestInit,
7
- 'method'
7
+ "method"
8
8
  > &
9
- Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & {
9
+ Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
10
10
  /**
11
11
  * Fetch API implementation. You can use this option to provide a custom
12
12
  * fetch instance.
@@ -35,7 +35,7 @@ export type ServerSentEventsOptions<TData = unknown> = Omit<
35
35
  * @returns Nothing (void).
36
36
  */
37
37
  onSseEvent?: (event: StreamEvent<TData>) => void;
38
- serializedBody?: RequestInit['body'];
38
+ serializedBody?: RequestInit["body"];
39
39
  /**
40
40
  * Default retry delay in milliseconds.
41
41
  *
@@ -121,12 +121,12 @@ export const createSseClient = <TData = unknown>({
121
121
  : new Headers(options.headers as Record<string, string> | undefined);
122
122
 
123
123
  if (lastEventId !== undefined) {
124
- headers.set('Last-Event-ID', lastEventId);
124
+ headers.set("Last-Event-ID", lastEventId);
125
125
  }
126
126
 
127
127
  try {
128
128
  const requestInit: RequestInit = {
129
- redirect: 'follow',
129
+ redirect: "follow",
130
130
  ...options,
131
131
  body: options.serializedBody,
132
132
  headers,
@@ -146,13 +146,13 @@ export const createSseClient = <TData = unknown>({
146
146
  `SSE failed: ${response.status} ${response.statusText}`,
147
147
  );
148
148
 
149
- if (!response.body) throw new Error('No body in SSE response');
149
+ if (!response.body) throw new Error("No body in SSE response");
150
150
 
151
151
  const reader = response.body
152
152
  .pipeThrough(new TextDecoderStream())
153
153
  .getReader();
154
154
 
155
- let buffer = '';
155
+ let buffer = "";
156
156
 
157
157
  const abortHandler = () => {
158
158
  try {
@@ -162,7 +162,7 @@ export const createSseClient = <TData = unknown>({
162
162
  }
163
163
  };
164
164
 
165
- signal.addEventListener('abort', abortHandler);
165
+ signal.addEventListener("abort", abortHandler);
166
166
 
167
167
  try {
168
168
  while (true) {
@@ -170,24 +170,24 @@ export const createSseClient = <TData = unknown>({
170
170
  if (done) break;
171
171
  buffer += value;
172
172
 
173
- const chunks = buffer.split('\n\n');
174
- buffer = chunks.pop() ?? '';
173
+ const chunks = buffer.split("\n\n");
174
+ buffer = chunks.pop() ?? "";
175
175
 
176
176
  for (const chunk of chunks) {
177
- const lines = chunk.split('\n');
177
+ const lines = chunk.split("\n");
178
178
  const dataLines: Array<string> = [];
179
179
  let eventName: string | undefined;
180
180
 
181
181
  for (const line of lines) {
182
- if (line.startsWith('data:')) {
183
- dataLines.push(line.replace(/^data:\s*/, ''));
184
- } else if (line.startsWith('event:')) {
185
- eventName = line.replace(/^event:\s*/, '');
186
- } else if (line.startsWith('id:')) {
187
- lastEventId = line.replace(/^id:\s*/, '');
188
- } else if (line.startsWith('retry:')) {
182
+ if (line.startsWith("data:")) {
183
+ dataLines.push(line.replace(/^data:\s*/, ""));
184
+ } else if (line.startsWith("event:")) {
185
+ eventName = line.replace(/^event:\s*/, "");
186
+ } else if (line.startsWith("id:")) {
187
+ lastEventId = line.replace(/^id:\s*/, "");
188
+ } else if (line.startsWith("retry:")) {
189
189
  const parsed = Number.parseInt(
190
- line.replace(/^retry:\s*/, ''),
190
+ line.replace(/^retry:\s*/, ""),
191
191
  10,
192
192
  );
193
193
  if (!Number.isNaN(parsed)) {
@@ -200,7 +200,7 @@ export const createSseClient = <TData = unknown>({
200
200
  let parsedJson = false;
201
201
 
202
202
  if (dataLines.length) {
203
- const rawData = dataLines.join('\n');
203
+ const rawData = dataLines.join("\n");
204
204
  try {
205
205
  data = JSON.parse(rawData);
206
206
  parsedJson = true;
@@ -232,7 +232,7 @@ export const createSseClient = <TData = unknown>({
232
232
  }
233
233
  }
234
234
  } finally {
235
- signal.removeEventListener('abort', abortHandler);
235
+ signal.removeEventListener("abort", abortHandler);
236
236
  reader.releaseLock();
237
237
  }
238
238
 
@@ -1,22 +1,22 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- import type { Auth, AuthToken } from './auth.gen';
3
+ import type { Auth, AuthToken } from "./auth.gen";
4
4
  import type {
5
5
  BodySerializer,
6
6
  QuerySerializer,
7
7
  QuerySerializerOptions,
8
- } from './bodySerializer.gen';
8
+ } from "./bodySerializer.gen";
9
9
 
10
10
  export type HttpMethod =
11
- | 'connect'
12
- | 'delete'
13
- | 'get'
14
- | 'head'
15
- | 'options'
16
- | 'patch'
17
- | 'post'
18
- | 'put'
19
- | 'trace';
11
+ | "connect"
12
+ | "delete"
13
+ | "get"
14
+ | "head"
15
+ | "options"
16
+ | "patch"
17
+ | "post"
18
+ | "put"
19
+ | "trace";
20
20
 
21
21
  export type Client<
22
22
  RequestFn = never,
@@ -56,7 +56,7 @@ export interface Config {
56
56
  * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
57
57
  */
58
58
  headers?:
59
- | RequestInit['headers']
59
+ | RequestInit["headers"]
60
60
  | Record<
61
61
  string,
62
62
  | string
@@ -1,12 +1,12 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- import type { BodySerializer, QuerySerializer } from './bodySerializer.gen';
3
+ import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen";
4
4
  import {
5
5
  type ArraySeparatorStyle,
6
6
  serializeArrayParam,
7
7
  serializeObjectParam,
8
8
  serializePrimitiveParam,
9
- } from './pathSerializer.gen';
9
+ } from "./pathSerializer.gen";
10
10
 
11
11
  export interface PathSerializer {
12
12
  path: Record<string, unknown>;
@@ -22,19 +22,19 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
22
22
  for (const match of matches) {
23
23
  let explode = false;
24
24
  let name = match.substring(1, match.length - 1);
25
- let style: ArraySeparatorStyle = 'simple';
25
+ let style: ArraySeparatorStyle = "simple";
26
26
 
27
- if (name.endsWith('*')) {
27
+ if (name.endsWith("*")) {
28
28
  explode = true;
29
29
  name = name.substring(0, name.length - 1);
30
30
  }
31
31
 
32
- if (name.startsWith('.')) {
32
+ if (name.startsWith(".")) {
33
33
  name = name.substring(1);
34
- style = 'label';
35
- } else if (name.startsWith(';')) {
34
+ style = "label";
35
+ } else if (name.startsWith(";")) {
36
36
  name = name.substring(1);
37
- style = 'matrix';
37
+ style = "matrix";
38
38
  }
39
39
 
40
40
  const value = path[name];
@@ -51,7 +51,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
51
51
  continue;
52
52
  }
53
53
 
54
- if (typeof value === 'object') {
54
+ if (typeof value === "object") {
55
55
  url = url.replace(
56
56
  match,
57
57
  serializeObjectParam({
@@ -65,7 +65,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
65
65
  continue;
66
66
  }
67
67
 
68
- if (style === 'matrix') {
68
+ if (style === "matrix") {
69
69
  url = url.replace(
70
70
  match,
71
71
  `;${serializePrimitiveParam({
@@ -77,7 +77,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
77
77
  }
78
78
 
79
79
  const replaceValue = encodeURIComponent(
80
- style === 'label' ? `.${value as string}` : (value as string),
80
+ style === "label" ? `.${value as string}` : (value as string),
81
81
  );
82
82
  url = url.replace(match, replaceValue);
83
83
  }
@@ -98,13 +98,13 @@ export const getUrl = ({
98
98
  querySerializer: QuerySerializer;
99
99
  url: string;
100
100
  }) => {
101
- const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
102
- let url = (baseUrl ?? '') + pathUrl;
101
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
102
+ let url = (baseUrl ?? "") + pathUrl;
103
103
  if (path) {
104
104
  url = defaultPathSerializer({ path, url });
105
105
  }
106
- let search = query ? querySerializer(query) : '';
107
- if (search.startsWith('?')) {
106
+ let search = query ? querySerializer(query) : "";
107
+ if (search.startsWith("?")) {
108
108
  search = search.substring(1);
109
109
  }
110
110
  if (search) {
@@ -122,15 +122,15 @@ export function getValidRequestBody(options: {
122
122
  const isSerializedBody = hasBody && options.bodySerializer;
123
123
 
124
124
  if (isSerializedBody) {
125
- if ('serializedBody' in options) {
125
+ if ("serializedBody" in options) {
126
126
  const hasSerializedBody =
127
- options.serializedBody !== undefined && options.serializedBody !== '';
127
+ options.serializedBody !== undefined && options.serializedBody !== "";
128
128
 
129
129
  return hasSerializedBody ? options.serializedBody : null;
130
130
  }
131
131
 
132
132
  // not all clients implement a serializedBody property (i.e. client-axios)
133
- return options.body !== '' ? options.body : null;
133
+ return options.body !== "" ? options.body : null;
134
134
  }
135
135
 
136
136
  // plain/text body
@@ -25,18 +25,20 @@ export function camelToSnakeObjectDeep<T extends object | undefined>(
25
25
  }
26
26
 
27
27
  // Helper to check if a character is uppercase
28
- type IsUpper<C extends string> = C extends Uppercase<C>
29
- ? C extends Lowercase<C>
30
- ? false // Not a letter
31
- : true // Uppercase letter
32
- : false;
28
+ type IsUpper<C extends string> =
29
+ C extends Uppercase<C>
30
+ ? C extends Lowercase<C>
31
+ ? false // Not a letter
32
+ : true // Uppercase letter
33
+ : false;
33
34
 
34
35
  // Helper to check if a character is lowercase
35
- type IsLower<C extends string> = C extends Lowercase<C>
36
- ? C extends Uppercase<C>
37
- ? false // Not a letter
38
- : true // Lowercase letter
39
- : false;
36
+ type IsLower<C extends string> =
37
+ C extends Lowercase<C>
38
+ ? C extends Uppercase<C>
39
+ ? false // Not a letter
40
+ : true // Lowercase letter
41
+ : false;
40
42
 
41
43
  // Convert a camelCase string to snake_case at the type level
42
44
  type CamelToSnakeString<
@@ -1,4 +1,4 @@
1
- import path from "node:path";
1
+ import path from "pathe";
2
2
 
3
3
  // Common MIME types
4
4
  const mimeTypes: Record<string, string> = {
@@ -1,8 +1,22 @@
1
- import fs from "node:fs/promises";
2
- import path from "node:path";
1
+ import fs from "node:fs";
2
+ import fsp from "node:fs/promises";
3
+ import path from "pathe";
4
+
5
+ export function findWorkspaceRootSync(dir: string = process.cwd()) {
6
+ if (fs.statSync(dir).isDirectory()) {
7
+ if (fs.existsSync(path.join(dir, ".git"))) {
8
+ return dir;
9
+ } else if (readSync(dir, "package.json")?.workspaces) {
10
+ return dir;
11
+ } else if (rootFiles.some((file) => fs.existsSync(path.join(dir, file)))) {
12
+ return dir;
13
+ }
14
+ }
15
+ return findWorkspaceRootSync(path.resolve(dir, ".."));
16
+ }
3
17
 
4
18
  export async function findWorkspaceRoot(dir: string = process.cwd()) {
5
- if ((await fs.stat(dir)).isDirectory()) {
19
+ if ((await fsp.stat(dir)).isDirectory()) {
6
20
  if (await exists(dir, ".git")) {
7
21
  // the root of the git repo is usually the workspace root and we should always stop here
8
22
  return dir;
@@ -17,13 +31,21 @@ export async function findWorkspaceRoot(dir: string = process.cwd()) {
17
31
  }
18
32
 
19
33
  const read = (...p: string[]): Promise<any> =>
20
- fs
34
+ fsp
21
35
  .readFile(path.join(...p), "utf8")
22
36
  .then(JSON.parse)
23
37
  .catch(() => undefined);
24
38
 
39
+ const readSync = (...p: string[]): any => {
40
+ try {
41
+ return JSON.parse(fs.readFileSync(path.join(...p), "utf8"));
42
+ } catch {
43
+ return undefined;
44
+ }
45
+ };
46
+
25
47
  const exists = (...p: string[]) =>
26
- fs
48
+ fsp
27
49
  .access(path.join(...p))
28
50
  .then(() => true)
29
51
  .catch(() => false);