alchemy 0.66.0 → 0.68.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 (825) hide show
  1. package/bin/alchemy.js +25554 -26250
  2. package/bin/alchemy.ts +6 -2
  3. package/bin/commands/configure.ts +194 -0
  4. package/bin/commands/login.ts +99 -55
  5. package/bin/commands/logout.ts +66 -0
  6. package/bin/services/find-workspace-root.ts +1 -1
  7. package/bin/trpc.ts +27 -2
  8. package/lib/alchemy.d.ts +6 -0
  9. package/lib/alchemy.d.ts.map +1 -1
  10. package/lib/alchemy.js +1 -0
  11. package/lib/alchemy.js.map +1 -1
  12. package/lib/apply.d.ts +2 -2
  13. package/lib/apply.d.ts.map +1 -1
  14. package/lib/apply.js +18 -15
  15. package/lib/apply.js.map +1 -1
  16. package/lib/auth.d.ts +72 -0
  17. package/lib/auth.d.ts.map +1 -0
  18. package/lib/auth.js +163 -0
  19. package/lib/auth.js.map +1 -0
  20. package/lib/aws/bucket.d.ts +12 -3
  21. package/lib/aws/bucket.d.ts.map +1 -1
  22. package/lib/aws/bucket.js +2 -2
  23. package/lib/aws/bucket.js.map +1 -1
  24. package/lib/aws/control/resource.d.ts +34 -3
  25. package/lib/aws/control/resource.d.ts.map +1 -1
  26. package/lib/aws/control/resource.js +3 -3
  27. package/lib/aws/control/resource.js.map +1 -1
  28. package/lib/aws/ec2/internet-gateway-attachment.d.ts +1 -2
  29. package/lib/aws/ec2/internet-gateway-attachment.d.ts.map +1 -1
  30. package/lib/aws/ec2/internet-gateway-attachment.js +4 -4
  31. package/lib/aws/ec2/internet-gateway-attachment.js.map +1 -1
  32. package/lib/aws/ec2/internet-gateway.d.ts +1 -2
  33. package/lib/aws/ec2/internet-gateway.d.ts.map +1 -1
  34. package/lib/aws/ec2/internet-gateway.js +2 -2
  35. package/lib/aws/ec2/internet-gateway.js.map +1 -1
  36. package/lib/aws/ec2/nat-gateway.d.ts +1 -2
  37. package/lib/aws/ec2/nat-gateway.d.ts.map +1 -1
  38. package/lib/aws/ec2/nat-gateway.js +2 -2
  39. package/lib/aws/ec2/nat-gateway.js.map +1 -1
  40. package/lib/aws/ec2/route-table-association.d.ts +1 -2
  41. package/lib/aws/ec2/route-table-association.d.ts.map +1 -1
  42. package/lib/aws/ec2/route-table-association.js +2 -2
  43. package/lib/aws/ec2/route-table-association.js.map +1 -1
  44. package/lib/aws/ec2/route-table.d.ts +1 -2
  45. package/lib/aws/ec2/route-table.d.ts.map +1 -1
  46. package/lib/aws/ec2/route-table.js +2 -2
  47. package/lib/aws/ec2/route-table.js.map +1 -1
  48. package/lib/aws/ec2/route.d.ts +1 -2
  49. package/lib/aws/ec2/route.d.ts.map +1 -1
  50. package/lib/aws/ec2/route.js +2 -2
  51. package/lib/aws/ec2/route.js.map +1 -1
  52. package/lib/aws/ec2/security-group-rule.d.ts +1 -2
  53. package/lib/aws/ec2/security-group-rule.d.ts.map +1 -1
  54. package/lib/aws/ec2/security-group-rule.js +2 -2
  55. package/lib/aws/ec2/security-group-rule.js.map +1 -1
  56. package/lib/aws/ec2/security-group.d.ts +1 -2
  57. package/lib/aws/ec2/security-group.d.ts.map +1 -1
  58. package/lib/aws/ec2/security-group.js +2 -2
  59. package/lib/aws/ec2/security-group.js.map +1 -1
  60. package/lib/aws/ec2/subnet.d.ts +1 -2
  61. package/lib/aws/ec2/subnet.d.ts.map +1 -1
  62. package/lib/aws/ec2/subnet.js +2 -2
  63. package/lib/aws/ec2/subnet.js.map +1 -1
  64. package/lib/aws/ec2/vpc.d.ts +1 -2
  65. package/lib/aws/ec2/vpc.d.ts.map +1 -1
  66. package/lib/aws/ec2/vpc.js +2 -2
  67. package/lib/aws/ec2/vpc.js.map +1 -1
  68. package/lib/aws/function.d.ts +116 -3
  69. package/lib/aws/function.d.ts.map +1 -1
  70. package/lib/aws/function.js +2 -2
  71. package/lib/aws/function.js.map +1 -1
  72. package/lib/aws/oidc/github-oidc-provider.d.ts +13 -2
  73. package/lib/aws/oidc/github-oidc-provider.d.ts.map +1 -1
  74. package/lib/aws/oidc/oidc-provider.d.ts +48 -3
  75. package/lib/aws/oidc/oidc-provider.d.ts.map +1 -1
  76. package/lib/aws/oidc/oidc-provider.js +2 -2
  77. package/lib/aws/oidc/oidc-provider.js.map +1 -1
  78. package/lib/aws/policy-attachment.d.ts +2 -3
  79. package/lib/aws/policy-attachment.d.ts.map +1 -1
  80. package/lib/aws/policy-attachment.js +1 -1
  81. package/lib/aws/policy-attachment.js.map +1 -1
  82. package/lib/aws/policy.d.ts +1 -2
  83. package/lib/aws/policy.d.ts.map +1 -1
  84. package/lib/aws/policy.js +4 -4
  85. package/lib/aws/policy.js.map +1 -1
  86. package/lib/aws/queue.d.ts +1 -2
  87. package/lib/aws/queue.d.ts.map +1 -1
  88. package/lib/aws/queue.js +4 -4
  89. package/lib/aws/queue.js.map +1 -1
  90. package/lib/aws/role.d.ts +1 -2
  91. package/lib/aws/role.d.ts.map +1 -1
  92. package/lib/aws/role.js +2 -2
  93. package/lib/aws/role.js.map +1 -1
  94. package/lib/aws/ses.d.ts +1 -2
  95. package/lib/aws/ses.d.ts.map +1 -1
  96. package/lib/aws/ses.js +2 -2
  97. package/lib/aws/ses.js.map +1 -1
  98. package/lib/aws/ssm-parameter.d.ts +1 -2
  99. package/lib/aws/ssm-parameter.d.ts.map +1 -1
  100. package/lib/aws/ssm-parameter.js +2 -2
  101. package/lib/aws/ssm-parameter.js.map +1 -1
  102. package/lib/aws/table.d.ts +1 -2
  103. package/lib/aws/table.d.ts.map +1 -1
  104. package/lib/aws/table.js +2 -2
  105. package/lib/aws/table.js.map +1 -1
  106. package/lib/cloudflare/account-api-token.d.ts +1 -2
  107. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  108. package/lib/cloudflare/account-api-token.js +2 -2
  109. package/lib/cloudflare/account-api-token.js.map +1 -1
  110. package/lib/cloudflare/ai-gateway.d.ts +1 -2
  111. package/lib/cloudflare/ai-gateway.d.ts.map +1 -1
  112. package/lib/cloudflare/ai-gateway.js +2 -2
  113. package/lib/cloudflare/ai-gateway.js.map +1 -1
  114. package/lib/cloudflare/api-gateway-operation.d.ts +1 -2
  115. package/lib/cloudflare/api-gateway-operation.d.ts.map +1 -1
  116. package/lib/cloudflare/api-gateway-operation.js +2 -2
  117. package/lib/cloudflare/api-gateway-operation.js.map +1 -1
  118. package/lib/cloudflare/api-schema.d.ts +1 -2
  119. package/lib/cloudflare/api-schema.d.ts.map +1 -1
  120. package/lib/cloudflare/api-schema.js +2 -2
  121. package/lib/cloudflare/api-schema.js.map +1 -1
  122. package/lib/cloudflare/api-shield.d.ts +1 -2
  123. package/lib/cloudflare/api-shield.d.ts.map +1 -1
  124. package/lib/cloudflare/api-shield.js +2 -2
  125. package/lib/cloudflare/api-shield.js.map +1 -1
  126. package/lib/cloudflare/api.d.ts +18 -10
  127. package/lib/cloudflare/api.d.ts.map +1 -1
  128. package/lib/cloudflare/api.js +93 -38
  129. package/lib/cloudflare/api.js.map +1 -1
  130. package/lib/cloudflare/assets.d.ts +21 -43
  131. package/lib/cloudflare/assets.d.ts.map +1 -1
  132. package/lib/cloudflare/assets.js +78 -70
  133. package/lib/cloudflare/assets.js.map +1 -1
  134. package/lib/cloudflare/auth.d.ts +91 -17
  135. package/lib/cloudflare/auth.d.ts.map +1 -1
  136. package/lib/cloudflare/auth.js +141 -62
  137. package/lib/cloudflare/auth.js.map +1 -1
  138. package/lib/cloudflare/bindings.d.ts +17 -5
  139. package/lib/cloudflare/bindings.d.ts.map +1 -1
  140. package/lib/cloudflare/bindings.js +3 -1
  141. package/lib/cloudflare/bindings.js.map +1 -1
  142. package/lib/cloudflare/bound.d.ts +4 -3
  143. package/lib/cloudflare/bound.d.ts.map +1 -1
  144. package/lib/cloudflare/bucket.d.ts +60 -8
  145. package/lib/cloudflare/bucket.d.ts.map +1 -1
  146. package/lib/cloudflare/bucket.js +161 -18
  147. package/lib/cloudflare/bucket.js.map +1 -1
  148. package/lib/cloudflare/bundle/internal-worker-bundle.d.ts +1 -1
  149. package/lib/cloudflare/bundle/internal-worker-bundle.d.ts.map +1 -1
  150. package/lib/cloudflare/bundle/internal-worker-bundle.js.map +1 -1
  151. package/lib/cloudflare/bundle/plugin-wasm.js +4 -2
  152. package/lib/cloudflare/bundle/plugin-wasm.js.map +1 -1
  153. package/lib/cloudflare/certificate-pack.d.ts +1 -2
  154. package/lib/cloudflare/certificate-pack.d.ts.map +1 -1
  155. package/lib/cloudflare/certificate-pack.js +4 -4
  156. package/lib/cloudflare/certificate-pack.js.map +1 -1
  157. package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
  158. package/lib/cloudflare/compatibility-date.gen.js +1 -1
  159. package/lib/cloudflare/container.d.ts +1 -2
  160. package/lib/cloudflare/container.d.ts.map +1 -1
  161. package/lib/cloudflare/container.js +6 -6
  162. package/lib/cloudflare/container.js.map +1 -1
  163. package/lib/cloudflare/custom-domain.d.ts +1 -2
  164. package/lib/cloudflare/custom-domain.d.ts.map +1 -1
  165. package/lib/cloudflare/custom-domain.js +2 -2
  166. package/lib/cloudflare/custom-domain.js.map +1 -1
  167. package/lib/cloudflare/d1-database.d.ts +2 -3
  168. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  169. package/lib/cloudflare/d1-database.js +5 -5
  170. package/lib/cloudflare/d1-database.js.map +1 -1
  171. package/lib/cloudflare/dispatch-namespace.d.ts +2 -3
  172. package/lib/cloudflare/dispatch-namespace.d.ts.map +1 -1
  173. package/lib/cloudflare/dispatch-namespace.js +3 -3
  174. package/lib/cloudflare/dispatch-namespace.js.map +1 -1
  175. package/lib/cloudflare/dns-records.d.ts +1 -2
  176. package/lib/cloudflare/dns-records.d.ts.map +1 -1
  177. package/lib/cloudflare/dns-records.js +4 -4
  178. package/lib/cloudflare/dns-records.js.map +1 -1
  179. package/lib/cloudflare/email-address.d.ts +1 -2
  180. package/lib/cloudflare/email-address.d.ts.map +1 -1
  181. package/lib/cloudflare/email-address.js +6 -6
  182. package/lib/cloudflare/email-address.js.map +1 -1
  183. package/lib/cloudflare/email-catch-all.d.ts +1 -2
  184. package/lib/cloudflare/email-catch-all.d.ts.map +1 -1
  185. package/lib/cloudflare/email-catch-all.js +4 -4
  186. package/lib/cloudflare/email-catch-all.js.map +1 -1
  187. package/lib/cloudflare/email-routing.d.ts +1 -2
  188. package/lib/cloudflare/email-routing.d.ts.map +1 -1
  189. package/lib/cloudflare/email-routing.js +4 -4
  190. package/lib/cloudflare/email-routing.js.map +1 -1
  191. package/lib/cloudflare/email-rule.d.ts +1 -2
  192. package/lib/cloudflare/email-rule.d.ts.map +1 -1
  193. package/lib/cloudflare/email-rule.js +4 -4
  194. package/lib/cloudflare/email-rule.js.map +1 -1
  195. package/lib/cloudflare/hyperdrive-ref.d.ts +23 -0
  196. package/lib/cloudflare/hyperdrive-ref.d.ts.map +1 -0
  197. package/lib/cloudflare/hyperdrive-ref.js +52 -0
  198. package/lib/cloudflare/hyperdrive-ref.js.map +1 -0
  199. package/lib/cloudflare/hyperdrive.d.ts +1 -2
  200. package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
  201. package/lib/cloudflare/hyperdrive.js +4 -4
  202. package/lib/cloudflare/hyperdrive.js.map +1 -1
  203. package/lib/cloudflare/index.d.ts +2 -0
  204. package/lib/cloudflare/index.d.ts.map +1 -1
  205. package/lib/cloudflare/index.js +2 -0
  206. package/lib/cloudflare/index.js.map +1 -1
  207. package/lib/cloudflare/kv-namespace.d.ts +2 -3
  208. package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
  209. package/lib/cloudflare/kv-namespace.js +5 -5
  210. package/lib/cloudflare/kv-namespace.js.map +1 -1
  211. package/lib/cloudflare/miniflare/build-worker-options.d.ts +2 -1
  212. package/lib/cloudflare/miniflare/build-worker-options.d.ts.map +1 -1
  213. package/lib/cloudflare/miniflare/build-worker-options.js +11 -6
  214. package/lib/cloudflare/miniflare/build-worker-options.js.map +1 -1
  215. package/lib/cloudflare/miniflare/delete.js +1 -1
  216. package/lib/cloudflare/miniflare/delete.js.map +1 -1
  217. package/lib/cloudflare/miniflare/miniflare-controller.d.ts +3 -1
  218. package/lib/cloudflare/miniflare/miniflare-controller.d.ts.map +1 -1
  219. package/lib/cloudflare/miniflare/miniflare-controller.js +24 -9
  220. package/lib/cloudflare/miniflare/miniflare-controller.js.map +1 -1
  221. package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts +24 -13
  222. package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts.map +1 -1
  223. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js +90 -79
  224. package/lib/cloudflare/miniflare/miniflare-worker-proxy.js.map +1 -1
  225. package/lib/cloudflare/miniflare/remote-binding-proxy.d.ts.map +1 -1
  226. package/lib/cloudflare/miniflare/remote-binding-proxy.js +15 -4
  227. package/lib/cloudflare/miniflare/remote-binding-proxy.js.map +1 -1
  228. package/lib/cloudflare/miniflare/tunnel.d.ts +18 -0
  229. package/lib/cloudflare/miniflare/tunnel.d.ts.map +1 -0
  230. package/lib/cloudflare/miniflare/tunnel.js +79 -0
  231. package/lib/cloudflare/miniflare/tunnel.js.map +1 -0
  232. package/lib/cloudflare/next.d.ts.map +1 -1
  233. package/lib/cloudflare/next.js +3 -0
  234. package/lib/cloudflare/next.js.map +1 -1
  235. package/lib/cloudflare/permission-groups.d.ts +1 -2
  236. package/lib/cloudflare/permission-groups.d.ts.map +1 -1
  237. package/lib/cloudflare/permission-groups.js +1 -1
  238. package/lib/cloudflare/permission-groups.js.map +1 -1
  239. package/lib/cloudflare/pipeline.d.ts +2 -3
  240. package/lib/cloudflare/pipeline.d.ts.map +1 -1
  241. package/lib/cloudflare/pipeline.js +5 -5
  242. package/lib/cloudflare/pipeline.js.map +1 -1
  243. package/lib/cloudflare/queue-consumer.d.ts +1 -2
  244. package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
  245. package/lib/cloudflare/queue-consumer.js +4 -4
  246. package/lib/cloudflare/queue-consumer.js.map +1 -1
  247. package/lib/cloudflare/queue.d.ts +1 -2
  248. package/lib/cloudflare/queue.d.ts.map +1 -1
  249. package/lib/cloudflare/queue.js +4 -4
  250. package/lib/cloudflare/queue.js.map +1 -1
  251. package/lib/cloudflare/quick-tunnel.d.ts +1 -1
  252. package/lib/cloudflare/react-router/plugin.d.ts.map +1 -1
  253. package/lib/cloudflare/react-router/plugin.js +13 -0
  254. package/lib/cloudflare/react-router/plugin.js.map +1 -1
  255. package/lib/cloudflare/redirect-rule.d.ts +1 -2
  256. package/lib/cloudflare/redirect-rule.d.ts.map +1 -1
  257. package/lib/cloudflare/redirect-rule.js +4 -4
  258. package/lib/cloudflare/redirect-rule.js.map +1 -1
  259. package/lib/cloudflare/route.d.ts +1 -2
  260. package/lib/cloudflare/route.d.ts.map +1 -1
  261. package/lib/cloudflare/route.js +4 -4
  262. package/lib/cloudflare/route.js.map +1 -1
  263. package/lib/cloudflare/ruleset.d.ts +1 -2
  264. package/lib/cloudflare/ruleset.d.ts.map +1 -1
  265. package/lib/cloudflare/ruleset.js +2 -2
  266. package/lib/cloudflare/ruleset.js.map +1 -1
  267. package/lib/cloudflare/secret-ref.d.ts +38 -0
  268. package/lib/cloudflare/secret-ref.d.ts.map +1 -0
  269. package/lib/cloudflare/secret-ref.js +38 -0
  270. package/lib/cloudflare/secret-ref.js.map +1 -0
  271. package/lib/cloudflare/secret.d.ts +2 -3
  272. package/lib/cloudflare/secret.d.ts.map +1 -1
  273. package/lib/cloudflare/secret.js +3 -3
  274. package/lib/cloudflare/secret.js.map +1 -1
  275. package/lib/cloudflare/secrets-store.d.ts +2 -3
  276. package/lib/cloudflare/secrets-store.d.ts.map +1 -1
  277. package/lib/cloudflare/secrets-store.js +3 -3
  278. package/lib/cloudflare/secrets-store.js.map +1 -1
  279. package/lib/cloudflare/tunnel.d.ts +2 -3
  280. package/lib/cloudflare/tunnel.d.ts.map +1 -1
  281. package/lib/cloudflare/tunnel.js +3 -3
  282. package/lib/cloudflare/tunnel.js.map +1 -1
  283. package/lib/cloudflare/user.d.ts +3 -2
  284. package/lib/cloudflare/user.d.ts.map +1 -1
  285. package/lib/cloudflare/user.js +7 -5
  286. package/lib/cloudflare/user.js.map +1 -1
  287. package/lib/cloudflare/vectorize-index.d.ts +2 -3
  288. package/lib/cloudflare/vectorize-index.d.ts.map +1 -1
  289. package/lib/cloudflare/vectorize-index.js +6 -6
  290. package/lib/cloudflare/vectorize-index.js.map +1 -1
  291. package/lib/cloudflare/vectorize-metadata-index.d.ts +2 -3
  292. package/lib/cloudflare/vectorize-metadata-index.d.ts.map +1 -1
  293. package/lib/cloudflare/vectorize-metadata-index.js +4 -4
  294. package/lib/cloudflare/vectorize-metadata-index.js.map +1 -1
  295. package/lib/cloudflare/website.js +1 -1
  296. package/lib/cloudflare/website.js.map +1 -1
  297. package/lib/cloudflare/worker-assets.d.ts +1 -29
  298. package/lib/cloudflare/worker-assets.d.ts.map +1 -1
  299. package/lib/cloudflare/worker-assets.js +9 -42
  300. package/lib/cloudflare/worker-assets.js.map +1 -1
  301. package/lib/cloudflare/worker-metadata.d.ts +1 -1
  302. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  303. package/lib/cloudflare/worker-metadata.js +7 -9
  304. package/lib/cloudflare/worker-metadata.js.map +1 -1
  305. package/lib/cloudflare/worker-stub.d.ts +2 -3
  306. package/lib/cloudflare/worker-stub.d.ts.map +1 -1
  307. package/lib/cloudflare/worker-stub.js +3 -3
  308. package/lib/cloudflare/worker-stub.js.map +1 -1
  309. package/lib/cloudflare/worker-subdomain.d.ts +4 -3
  310. package/lib/cloudflare/worker-subdomain.d.ts.map +1 -1
  311. package/lib/cloudflare/worker-subdomain.js +5 -5
  312. package/lib/cloudflare/worker-subdomain.js.map +1 -1
  313. package/lib/cloudflare/worker.d.ts +19 -5
  314. package/lib/cloudflare/worker.d.ts.map +1 -1
  315. package/lib/cloudflare/worker.js +18 -5
  316. package/lib/cloudflare/worker.js.map +1 -1
  317. package/lib/cloudflare/wrangler.json.d.ts +2 -1
  318. package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
  319. package/lib/cloudflare/wrangler.json.js +4 -6
  320. package/lib/cloudflare/wrangler.json.js.map +1 -1
  321. package/lib/cloudflare/zone.d.ts +1 -2
  322. package/lib/cloudflare/zone.d.ts.map +1 -1
  323. package/lib/cloudflare/zone.js +2 -2
  324. package/lib/cloudflare/zone.js.map +1 -1
  325. package/lib/context.d.ts +8 -8
  326. package/lib/context.d.ts.map +1 -1
  327. package/lib/context.js.map +1 -1
  328. package/lib/destroy.d.ts +1 -1
  329. package/lib/destroy.d.ts.map +1 -1
  330. package/lib/destroy.js.map +1 -1
  331. package/lib/dns/import-dns.d.ts +1 -2
  332. package/lib/dns/import-dns.d.ts.map +1 -1
  333. package/lib/dns/import-dns.js +2 -2
  334. package/lib/dns/import-dns.js.map +1 -1
  335. package/lib/docker/container.d.ts +1 -2
  336. package/lib/docker/container.d.ts.map +1 -1
  337. package/lib/docker/container.js +2 -3
  338. package/lib/docker/container.js.map +1 -1
  339. package/lib/docker/image.d.ts +1 -2
  340. package/lib/docker/image.d.ts.map +1 -1
  341. package/lib/docker/image.js +9 -9
  342. package/lib/docker/image.js.map +1 -1
  343. package/lib/docker/network.d.ts +1 -2
  344. package/lib/docker/network.d.ts.map +1 -1
  345. package/lib/docker/network.js +2 -3
  346. package/lib/docker/network.js.map +1 -1
  347. package/lib/docker/remote-image.d.ts +1 -2
  348. package/lib/docker/remote-image.d.ts.map +1 -1
  349. package/lib/docker/remote-image.js +2 -3
  350. package/lib/docker/remote-image.js.map +1 -1
  351. package/lib/docker/volume.d.ts +1 -2
  352. package/lib/docker/volume.d.ts.map +1 -1
  353. package/lib/docker/volume.js +2 -3
  354. package/lib/docker/volume.js.map +1 -1
  355. package/lib/esbuild/bundle.d.ts +1 -2
  356. package/lib/esbuild/bundle.d.ts.map +1 -1
  357. package/lib/esbuild/bundle.js +4 -4
  358. package/lib/esbuild/bundle.js.map +1 -1
  359. package/lib/fs/copy-file.d.ts +1 -2
  360. package/lib/fs/copy-file.d.ts.map +1 -1
  361. package/lib/fs/copy-file.js +2 -2
  362. package/lib/fs/copy-file.js.map +1 -1
  363. package/lib/fs/file.d.ts +1 -2
  364. package/lib/fs/file.d.ts.map +1 -1
  365. package/lib/fs/file.js +2 -2
  366. package/lib/fs/file.js.map +1 -1
  367. package/lib/fs/folder.d.ts +1 -2
  368. package/lib/fs/folder.d.ts.map +1 -1
  369. package/lib/fs/folder.js +2 -2
  370. package/lib/fs/folder.js.map +1 -1
  371. package/lib/github/comment.d.ts +1 -2
  372. package/lib/github/comment.d.ts.map +1 -1
  373. package/lib/github/comment.js +4 -4
  374. package/lib/github/comment.js.map +1 -1
  375. package/lib/github/repository-environment.d.ts +1 -2
  376. package/lib/github/repository-environment.d.ts.map +1 -1
  377. package/lib/github/repository-environment.js +2 -2
  378. package/lib/github/repository-environment.js.map +1 -1
  379. package/lib/github/repository-webhook.d.ts +1 -2
  380. package/lib/github/repository-webhook.d.ts.map +1 -1
  381. package/lib/github/repository-webhook.js +2 -2
  382. package/lib/github/repository-webhook.js.map +1 -1
  383. package/lib/github/secret.d.ts +1 -2
  384. package/lib/github/secret.d.ts.map +1 -1
  385. package/lib/github/secret.js +2 -2
  386. package/lib/github/secret.js.map +1 -1
  387. package/lib/llms.cloudflare.txt +1 -1
  388. package/lib/neon/api/client.gen.d.ts +13 -0
  389. package/lib/neon/api/client.gen.d.ts.map +1 -0
  390. package/lib/neon/api/client.gen.js +7 -0
  391. package/lib/neon/api/client.gen.js.map +1 -0
  392. package/lib/neon/api/sdk.gen.d.ts +880 -0
  393. package/lib/neon/api/sdk.gen.d.ts.map +1 -0
  394. package/lib/neon/api/sdk.gen.js +1527 -0
  395. package/lib/neon/api/sdk.gen.js.map +1 -0
  396. package/lib/neon/api/types.gen.d.ts +7250 -0
  397. package/lib/neon/api/types.gen.d.ts.map +1 -0
  398. package/lib/neon/api/types.gen.js +2 -0
  399. package/lib/neon/api/types.gen.js.map +1 -0
  400. package/lib/neon/api.d.ts +14 -49
  401. package/lib/neon/api.d.ts.map +1 -1
  402. package/lib/neon/api.js +36 -114
  403. package/lib/neon/api.js.map +1 -1
  404. package/lib/neon/branch.d.ts +141 -0
  405. package/lib/neon/branch.d.ts.map +1 -0
  406. package/lib/neon/branch.js +112 -0
  407. package/lib/neon/branch.js.map +1 -0
  408. package/lib/neon/index.d.ts +1 -1
  409. package/lib/neon/index.d.ts.map +1 -1
  410. package/lib/neon/index.js +1 -1
  411. package/lib/neon/index.js.map +1 -1
  412. package/lib/neon/project.d.ts +32 -242
  413. package/lib/neon/project.d.ts.map +1 -1
  414. package/lib/neon/project.js +90 -269
  415. package/lib/neon/project.js.map +1 -1
  416. package/lib/neon/utils.d.ts +49 -0
  417. package/lib/neon/utils.d.ts.map +1 -0
  418. package/lib/neon/utils.js +44 -0
  419. package/lib/neon/utils.js.map +1 -0
  420. package/lib/os/exec.d.ts +1 -2
  421. package/lib/os/exec.d.ts.map +1 -1
  422. package/lib/os/exec.js +2 -2
  423. package/lib/os/exec.js.map +1 -1
  424. package/lib/planetscale/api/client.gen.d.ts +12 -1749
  425. package/lib/planetscale/api/client.gen.d.ts.map +1 -1
  426. package/lib/planetscale/api/client.gen.js +6 -2400
  427. package/lib/planetscale/api/client.gen.js.map +1 -1
  428. package/lib/planetscale/api/sdk.gen.d.ts +1582 -0
  429. package/lib/planetscale/api/sdk.gen.d.ts.map +1 -0
  430. package/lib/planetscale/api/sdk.gen.js +2219 -0
  431. package/lib/planetscale/api/sdk.gen.js.map +1 -0
  432. package/lib/planetscale/api/types.gen.d.ts +594 -449
  433. package/lib/planetscale/api/types.gen.d.ts.map +1 -1
  434. package/lib/planetscale/api.d.ts +43 -0
  435. package/lib/planetscale/api.d.ts.map +1 -0
  436. package/lib/planetscale/api.js +53 -0
  437. package/lib/planetscale/api.js.map +1 -0
  438. package/lib/planetscale/branch.d.ts +2 -3
  439. package/lib/planetscale/branch.d.ts.map +1 -1
  440. package/lib/planetscale/branch.js +17 -15
  441. package/lib/planetscale/branch.js.map +1 -1
  442. package/lib/planetscale/database.d.ts +2 -3
  443. package/lib/planetscale/database.d.ts.map +1 -1
  444. package/lib/planetscale/database.js +34 -34
  445. package/lib/planetscale/database.js.map +1 -1
  446. package/lib/planetscale/index.d.ts +1 -1
  447. package/lib/planetscale/index.d.ts.map +1 -1
  448. package/lib/planetscale/index.js +1 -1
  449. package/lib/planetscale/index.js.map +1 -1
  450. package/lib/planetscale/password.d.ts +2 -3
  451. package/lib/planetscale/password.d.ts.map +1 -1
  452. package/lib/planetscale/password.js +11 -11
  453. package/lib/planetscale/password.js.map +1 -1
  454. package/lib/planetscale/role.d.ts +2 -3
  455. package/lib/planetscale/role.d.ts.map +1 -1
  456. package/lib/planetscale/role.js +18 -18
  457. package/lib/planetscale/role.js.map +1 -1
  458. package/lib/planetscale/utils.d.ts +1 -1
  459. package/lib/planetscale/utils.d.ts.map +1 -1
  460. package/lib/planetscale/utils.js +17 -33
  461. package/lib/planetscale/utils.js.map +1 -1
  462. package/lib/random/random-string.d.ts +1 -2
  463. package/lib/random/random-string.d.ts.map +1 -1
  464. package/lib/random/random-string.js +3 -3
  465. package/lib/random/random-string.js.map +1 -1
  466. package/lib/resource.d.ts +4 -1
  467. package/lib/resource.d.ts.map +1 -1
  468. package/lib/resource.js.map +1 -1
  469. package/lib/scope.d.ts +10 -1
  470. package/lib/scope.d.ts.map +1 -1
  471. package/lib/scope.js +3 -1
  472. package/lib/scope.js.map +1 -1
  473. package/lib/sentry/client-key.d.ts +1 -2
  474. package/lib/sentry/client-key.d.ts.map +1 -1
  475. package/lib/sentry/client-key.js +2 -2
  476. package/lib/sentry/client-key.js.map +1 -1
  477. package/lib/sentry/project.d.ts +1 -2
  478. package/lib/sentry/project.d.ts.map +1 -1
  479. package/lib/sentry/project.js +2 -2
  480. package/lib/sentry/project.js.map +1 -1
  481. package/lib/sentry/team.d.ts +1 -2
  482. package/lib/sentry/team.d.ts.map +1 -1
  483. package/lib/sentry/team.js +2 -2
  484. package/lib/sentry/team.js.map +1 -1
  485. package/lib/state/r2-rest-state-store.d.ts +1 -0
  486. package/lib/state/r2-rest-state-store.d.ts.map +1 -1
  487. package/lib/state/r2-rest-state-store.js +15 -34
  488. package/lib/state/r2-rest-state-store.js.map +1 -1
  489. package/lib/stripe/card.d.ts +1 -2
  490. package/lib/stripe/card.d.ts.map +1 -1
  491. package/lib/stripe/card.js +2 -2
  492. package/lib/stripe/card.js.map +1 -1
  493. package/lib/stripe/coupon.d.ts +1 -2
  494. package/lib/stripe/coupon.d.ts.map +1 -1
  495. package/lib/stripe/coupon.js +2 -2
  496. package/lib/stripe/coupon.js.map +1 -1
  497. package/lib/stripe/customer.d.ts +1 -2
  498. package/lib/stripe/customer.d.ts.map +1 -1
  499. package/lib/stripe/customer.js +2 -2
  500. package/lib/stripe/customer.js.map +1 -1
  501. package/lib/stripe/entitlements-feature.d.ts +1 -2
  502. package/lib/stripe/entitlements-feature.d.ts.map +1 -1
  503. package/lib/stripe/entitlements-feature.js +2 -2
  504. package/lib/stripe/entitlements-feature.js.map +1 -1
  505. package/lib/stripe/file.d.ts +1 -2
  506. package/lib/stripe/file.d.ts.map +1 -1
  507. package/lib/stripe/file.js +2 -2
  508. package/lib/stripe/file.js.map +1 -1
  509. package/lib/stripe/meter.d.ts +1 -2
  510. package/lib/stripe/meter.d.ts.map +1 -1
  511. package/lib/stripe/meter.js +1 -1
  512. package/lib/stripe/meter.js.map +1 -1
  513. package/lib/stripe/portal-configuration.d.ts +1 -2
  514. package/lib/stripe/portal-configuration.d.ts.map +1 -1
  515. package/lib/stripe/portal-configuration.js +2 -2
  516. package/lib/stripe/portal-configuration.js.map +1 -1
  517. package/lib/stripe/price.d.ts +1 -2
  518. package/lib/stripe/price.d.ts.map +1 -1
  519. package/lib/stripe/price.js +2 -2
  520. package/lib/stripe/price.js.map +1 -1
  521. package/lib/stripe/product-feature.d.ts +1 -2
  522. package/lib/stripe/product-feature.d.ts.map +1 -1
  523. package/lib/stripe/product-feature.js +2 -2
  524. package/lib/stripe/product-feature.js.map +1 -1
  525. package/lib/stripe/product.d.ts +1 -2
  526. package/lib/stripe/product.d.ts.map +1 -1
  527. package/lib/stripe/product.js +2 -2
  528. package/lib/stripe/product.js.map +1 -1
  529. package/lib/stripe/promotion-code.d.ts +1 -2
  530. package/lib/stripe/promotion-code.d.ts.map +1 -1
  531. package/lib/stripe/promotion-code.js +2 -2
  532. package/lib/stripe/promotion-code.js.map +1 -1
  533. package/lib/stripe/shipping-rate.d.ts +1 -2
  534. package/lib/stripe/shipping-rate.d.ts.map +1 -1
  535. package/lib/stripe/shipping-rate.js +2 -2
  536. package/lib/stripe/shipping-rate.js.map +1 -1
  537. package/lib/stripe/tax-rate.d.ts +1 -2
  538. package/lib/stripe/tax-rate.d.ts.map +1 -1
  539. package/lib/stripe/tax-rate.js +2 -2
  540. package/lib/stripe/tax-rate.js.map +1 -1
  541. package/lib/stripe/webhook.d.ts +16 -3
  542. package/lib/stripe/webhook.d.ts.map +1 -1
  543. package/lib/stripe/webhook.js +2 -2
  544. package/lib/stripe/webhook.js.map +1 -1
  545. package/lib/test/bun.d.ts.map +1 -1
  546. package/lib/test/bun.js +1 -0
  547. package/lib/test/bun.js.map +1 -1
  548. package/lib/test/options.d.ts +5 -0
  549. package/lib/test/options.d.ts.map +1 -1
  550. package/lib/test/vitest.d.ts.map +1 -1
  551. package/lib/test/vitest.js +1 -0
  552. package/lib/test/vitest.js.map +1 -1
  553. package/lib/upstash/redis.d.ts +1 -2
  554. package/lib/upstash/redis.d.ts.map +1 -1
  555. package/lib/upstash/redis.js.map +1 -1
  556. package/lib/util/api/client/client.gen.d.ts +3 -0
  557. package/lib/util/api/client/client.gen.d.ts.map +1 -0
  558. package/lib/util/api/client/client.gen.js +205 -0
  559. package/lib/util/api/client/client.gen.js.map +1 -0
  560. package/lib/util/api/client/index.d.ts +8 -0
  561. package/lib/util/api/client/index.d.ts.map +1 -0
  562. package/lib/util/api/client/index.js +6 -0
  563. package/lib/util/api/client/index.js.map +1 -0
  564. package/lib/util/api/client/types.gen.d.ts +125 -0
  565. package/lib/util/api/client/types.gen.d.ts.map +1 -0
  566. package/lib/util/api/client/types.gen.js +2 -0
  567. package/lib/util/api/client/types.gen.js.map +1 -0
  568. package/lib/util/api/client/utils.gen.d.ts +34 -0
  569. package/lib/util/api/client/utils.gen.d.ts.map +1 -0
  570. package/lib/util/api/client/utils.gen.js +231 -0
  571. package/lib/util/api/client/utils.gen.js.map +1 -0
  572. package/lib/util/api/core/auth.gen.d.ts +19 -0
  573. package/lib/util/api/core/auth.gen.d.ts.map +1 -0
  574. package/lib/util/api/core/auth.gen.js +15 -0
  575. package/lib/util/api/core/auth.gen.js.map +1 -0
  576. package/lib/util/api/core/bodySerializer.gen.d.ts +18 -0
  577. package/lib/util/api/core/bodySerializer.gen.d.ts.map +1 -0
  578. package/lib/util/api/core/bodySerializer.gen.js +58 -0
  579. package/lib/util/api/core/bodySerializer.gen.js.map +1 -0
  580. package/lib/util/api/core/params.gen.d.ts +34 -0
  581. package/lib/util/api/core/params.gen.d.ts.map +1 -0
  582. package/lib/util/api/core/params.gen.js +89 -0
  583. package/lib/util/api/core/params.gen.js.map +1 -0
  584. package/lib/util/api/core/pathSerializer.gen.d.ts +34 -0
  585. package/lib/util/api/core/pathSerializer.gen.d.ts.map +1 -0
  586. package/lib/util/api/core/pathSerializer.gen.js +115 -0
  587. package/lib/util/api/core/pathSerializer.gen.js.map +1 -0
  588. package/lib/util/api/core/serverSentEvents.gen.d.ts +72 -0
  589. package/lib/util/api/core/serverSentEvents.gen.d.ts.map +1 -0
  590. package/lib/util/api/core/serverSentEvents.gen.js +136 -0
  591. package/lib/util/api/core/serverSentEvents.gen.js.map +1 -0
  592. package/lib/util/api/core/types.gen.d.ts +79 -0
  593. package/lib/util/api/core/types.gen.d.ts.map +1 -0
  594. package/lib/util/api/core/types.gen.js +2 -0
  595. package/lib/util/api/core/types.gen.js.map +1 -0
  596. package/lib/util/api/core/utils.gen.d.ts +20 -0
  597. package/lib/util/api/core/utils.gen.d.ts.map +1 -0
  598. package/lib/util/api/core/utils.gen.js +88 -0
  599. package/lib/util/api/core/utils.gen.js.map +1 -0
  600. package/lib/util/http.d.ts +7 -2
  601. package/lib/util/http.d.ts.map +1 -1
  602. package/lib/util/http.js +29 -11
  603. package/lib/util/http.js.map +1 -1
  604. package/lib/util/idempotent-spawn.d.ts.map +1 -1
  605. package/lib/util/idempotent-spawn.js +5 -8
  606. package/lib/util/idempotent-spawn.js.map +1 -1
  607. package/lib/util/lock.d.ts +20 -0
  608. package/lib/util/lock.d.ts.map +1 -0
  609. package/lib/util/lock.js +45 -0
  610. package/lib/util/lock.js.map +1 -0
  611. package/lib/util/memoize.d.ts +6 -0
  612. package/lib/util/memoize.d.ts.map +1 -1
  613. package/lib/util/memoize.js +23 -0
  614. package/lib/util/memoize.js.map +1 -1
  615. package/lib/util/oauth-client.d.ts +71 -0
  616. package/lib/util/oauth-client.d.ts.map +1 -0
  617. package/lib/util/oauth-client.js +188 -0
  618. package/lib/util/oauth-client.js.map +1 -0
  619. package/lib/util/poll.d.ts +33 -0
  620. package/lib/util/poll.d.ts.map +1 -0
  621. package/lib/util/poll.js +19 -0
  622. package/lib/util/poll.js.map +1 -0
  623. package/lib/vercel/project-domain.d.ts +1 -2
  624. package/lib/vercel/project-domain.d.ts.map +1 -1
  625. package/lib/vercel/project-domain.js.map +1 -1
  626. package/lib/vercel/project.d.ts +1 -2
  627. package/lib/vercel/project.d.ts.map +1 -1
  628. package/lib/vercel/project.js +2 -2
  629. package/lib/vercel/project.js.map +1 -1
  630. package/package.json +5 -1
  631. package/src/alchemy.ts +7 -0
  632. package/src/apply.ts +32 -29
  633. package/src/auth.ts +253 -0
  634. package/src/aws/bucket.ts +3 -3
  635. package/src/aws/control/resource.ts +4 -6
  636. package/src/aws/ec2/internet-gateway-attachment.ts +5 -6
  637. package/src/aws/ec2/internet-gateway.ts +3 -5
  638. package/src/aws/ec2/nat-gateway.ts +3 -5
  639. package/src/aws/ec2/route-table-association.ts +3 -5
  640. package/src/aws/ec2/route-table.ts +3 -5
  641. package/src/aws/ec2/route.ts +3 -3
  642. package/src/aws/ec2/security-group-rule.ts +3 -5
  643. package/src/aws/ec2/security-group.ts +3 -5
  644. package/src/aws/ec2/subnet.ts +3 -3
  645. package/src/aws/ec2/vpc.ts +3 -3
  646. package/src/aws/function.ts +3 -3
  647. package/src/aws/oidc/oidc-provider.ts +3 -5
  648. package/src/aws/policy-attachment.ts +2 -4
  649. package/src/aws/policy.ts +5 -5
  650. package/src/aws/queue.ts +5 -5
  651. package/src/aws/role.ts +3 -3
  652. package/src/aws/ses.ts +3 -3
  653. package/src/aws/ssm-parameter.ts +3 -3
  654. package/src/aws/table.ts +3 -3
  655. package/src/cloudflare/account-api-token.ts +3 -4
  656. package/src/cloudflare/ai-gateway.ts +3 -5
  657. package/src/cloudflare/api-gateway-operation.ts +3 -4
  658. package/src/cloudflare/api-schema.ts +25 -26
  659. package/src/cloudflare/api-shield.ts +3 -4
  660. package/src/cloudflare/api.ts +122 -57
  661. package/src/cloudflare/assets.ts +95 -136
  662. package/src/cloudflare/auth.ts +160 -95
  663. package/src/cloudflare/bindings.ts +21 -4
  664. package/src/cloudflare/bound.ts +50 -52
  665. package/src/cloudflare/bucket.ts +321 -58
  666. package/src/cloudflare/bundle/internal-worker-bundle.ts +2 -1
  667. package/src/cloudflare/bundle/plugin-wasm.ts +5 -5
  668. package/src/cloudflare/certificate-pack.ts +5 -6
  669. package/src/cloudflare/compatibility-date.gen.ts +1 -1
  670. package/src/cloudflare/container.ts +7 -8
  671. package/src/cloudflare/custom-domain.ts +3 -5
  672. package/src/cloudflare/d1-database.ts +33 -34
  673. package/src/cloudflare/dispatch-namespace.ts +5 -6
  674. package/src/cloudflare/dns-records.ts +5 -5
  675. package/src/cloudflare/email-address.ts +7 -7
  676. package/src/cloudflare/email-catch-all.ts +6 -6
  677. package/src/cloudflare/email-routing.ts +5 -5
  678. package/src/cloudflare/email-rule.ts +5 -5
  679. package/src/cloudflare/hyperdrive-ref.ts +98 -0
  680. package/src/cloudflare/hyperdrive.ts +35 -36
  681. package/src/cloudflare/index.ts +2 -0
  682. package/src/cloudflare/kv-namespace.ts +31 -32
  683. package/src/cloudflare/miniflare/build-worker-options.ts +21 -12
  684. package/src/cloudflare/miniflare/delete.ts +1 -1
  685. package/src/cloudflare/miniflare/miniflare-controller.ts +27 -12
  686. package/src/cloudflare/miniflare/miniflare-worker-proxy.ts +117 -102
  687. package/src/cloudflare/miniflare/remote-binding-proxy.ts +16 -4
  688. package/src/cloudflare/miniflare/tunnel.ts +116 -0
  689. package/src/cloudflare/next.ts +3 -0
  690. package/src/cloudflare/permission-groups.ts +4 -6
  691. package/src/cloudflare/pipeline.ts +29 -30
  692. package/src/cloudflare/queue-consumer.ts +5 -7
  693. package/src/cloudflare/queue.ts +42 -43
  694. package/src/cloudflare/react-router/plugin.ts +20 -0
  695. package/src/cloudflare/redirect-rule.ts +5 -5
  696. package/src/cloudflare/route.ts +5 -5
  697. package/src/cloudflare/ruleset.ts +3 -4
  698. package/src/cloudflare/secret-ref.ts +56 -0
  699. package/src/cloudflare/secret.ts +35 -36
  700. package/src/cloudflare/secrets-store.ts +5 -8
  701. package/src/cloudflare/tunnel.ts +5 -7
  702. package/src/cloudflare/user.ts +12 -9
  703. package/src/cloudflare/vectorize-index.ts +8 -12
  704. package/src/cloudflare/vectorize-metadata-index.ts +6 -8
  705. package/src/cloudflare/website.ts +1 -1
  706. package/src/cloudflare/worker-assets.ts +10 -56
  707. package/src/cloudflare/worker-metadata.ts +14 -12
  708. package/src/cloudflare/worker-stub.ts +5 -5
  709. package/src/cloudflare/worker-subdomain.ts +6 -7
  710. package/src/cloudflare/worker.ts +123 -92
  711. package/src/cloudflare/wrangler.json.ts +13 -11
  712. package/src/cloudflare/zone.ts +3 -3
  713. package/src/context.ts +9 -7
  714. package/src/destroy.ts +2 -2
  715. package/src/dns/import-dns.ts +3 -5
  716. package/src/docker/container.ts +3 -6
  717. package/src/docker/image.ts +13 -13
  718. package/src/docker/network.ts +3 -4
  719. package/src/docker/remote-image.ts +3 -6
  720. package/src/docker/volume.ts +3 -4
  721. package/src/esbuild/bundle.ts +10 -8
  722. package/src/fs/copy-file.ts +3 -3
  723. package/src/fs/file.ts +3 -3
  724. package/src/fs/folder.ts +3 -3
  725. package/src/github/comment.ts +5 -7
  726. package/src/github/repository-environment.ts +3 -5
  727. package/src/github/repository-webhook.ts +3 -5
  728. package/src/github/secret.ts +3 -5
  729. package/src/llms.cloudflare.txt +1 -1
  730. package/src/neon/api/client.gen.ts +28 -0
  731. package/src/neon/api/sdk.gen.ts +2596 -0
  732. package/src/neon/api/types.gen.ts +8287 -0
  733. package/src/neon/api.ts +51 -147
  734. package/src/neon/branch.ts +278 -0
  735. package/src/neon/index.ts +1 -1
  736. package/src/neon/project.ts +136 -721
  737. package/src/neon/utils.ts +105 -0
  738. package/src/os/exec.ts +3 -3
  739. package/src/planetscale/api/client.gen.ts +28 -2882
  740. package/src/planetscale/api/sdk.gen.ts +3336 -0
  741. package/src/planetscale/api/types.gen.ts +778 -450
  742. package/src/planetscale/api.ts +101 -0
  743. package/src/planetscale/branch.ts +20 -19
  744. package/src/planetscale/database.ts +69 -70
  745. package/src/planetscale/index.ts +1 -1
  746. package/src/planetscale/password.ts +18 -22
  747. package/src/planetscale/role.ts +21 -21
  748. package/src/planetscale/utils.ts +20 -74
  749. package/src/random/random-string.ts +4 -4
  750. package/src/resource.ts +6 -2
  751. package/src/scope.ts +12 -1
  752. package/src/sentry/client-key.ts +3 -5
  753. package/src/sentry/project.ts +3 -5
  754. package/src/sentry/team.ts +3 -3
  755. package/src/state/r2-rest-state-store.ts +15 -57
  756. package/src/stripe/card.ts +3 -3
  757. package/src/stripe/coupon.ts +3 -3
  758. package/src/stripe/customer.ts +3 -3
  759. package/src/stripe/entitlements-feature.ts +3 -5
  760. package/src/stripe/file.ts +3 -3
  761. package/src/stripe/meter.ts +3 -3
  762. package/src/stripe/portal-configuration.ts +3 -5
  763. package/src/stripe/price.ts +3 -3
  764. package/src/stripe/product-feature.ts +3 -5
  765. package/src/stripe/product.ts +3 -3
  766. package/src/stripe/promotion-code.ts +3 -5
  767. package/src/stripe/shipping-rate.ts +3 -5
  768. package/src/stripe/tax-rate.ts +3 -3
  769. package/src/stripe/webhook.ts +3 -5
  770. package/src/test/bun.ts +1 -0
  771. package/src/test/options.ts +6 -0
  772. package/src/test/vitest.ts +1 -0
  773. package/src/upstash/redis.ts +1 -3
  774. package/src/util/api/client/client.gen.ts +268 -0
  775. package/src/util/api/client/index.ts +25 -0
  776. package/src/util/api/client/types.gen.ts +268 -0
  777. package/src/util/api/client/utils.gen.ts +331 -0
  778. package/src/util/api/core/auth.gen.ts +42 -0
  779. package/src/util/api/core/bodySerializer.gen.ts +92 -0
  780. package/src/util/api/core/params.gen.ts +153 -0
  781. package/src/util/api/core/pathSerializer.gen.ts +181 -0
  782. package/src/util/api/core/serverSentEvents.gen.ts +264 -0
  783. package/src/util/api/core/types.gen.ts +118 -0
  784. package/src/util/api/core/utils.gen.ts +143 -0
  785. package/src/util/http.ts +38 -11
  786. package/src/util/idempotent-spawn.ts +5 -6
  787. package/src/util/lock.ts +48 -0
  788. package/src/util/memoize.ts +26 -0
  789. package/src/util/oauth-client.ts +238 -0
  790. package/src/util/poll.ts +55 -0
  791. package/src/vercel/project-domain.ts +1 -3
  792. package/src/vercel/project.ts +3 -3
  793. package/templates/rwsdk/.cursor/rules/alchemy_cloudflare.mdc +1 -1
  794. package/templates/rwsdk/package.json +3 -3
  795. package/workers/cloudflare-state-store.js +8 -5619
  796. package/workers/dofs-state-store.js +2 -802
  797. package/workers/remote-binding-proxy.js +3 -39
  798. package/workers/remote-binding-proxy.ts +126 -35
  799. package/workers/tunnel-proxy.js +43 -0
  800. package/workers/tunnel-proxy.ts +121 -0
  801. package/lib/cloudflare/asset-manifest.d.ts +0 -15
  802. package/lib/cloudflare/asset-manifest.d.ts.map +0 -1
  803. package/lib/cloudflare/asset-manifest.js +0 -1
  804. package/lib/cloudflare/asset-manifest.js.map +0 -1
  805. package/lib/cloudflare/oauth.d.ts +0 -22
  806. package/lib/cloudflare/oauth.d.ts.map +0 -1
  807. package/lib/cloudflare/oauth.js +0 -214
  808. package/lib/cloudflare/oauth.js.map +0 -1
  809. package/lib/neon/api-error.d.ts +0 -31
  810. package/lib/neon/api-error.d.ts.map +0 -1
  811. package/lib/neon/api-error.js +0 -73
  812. package/lib/neon/api-error.js.map +0 -1
  813. package/lib/planetscale/api/index.d.ts +0 -3
  814. package/lib/planetscale/api/index.d.ts.map +0 -1
  815. package/lib/planetscale/api/index.js +0 -4
  816. package/lib/planetscale/api/index.js.map +0 -1
  817. package/lib/util/neverthrow.d.ts +0 -16
  818. package/lib/util/neverthrow.d.ts.map +0 -1
  819. package/lib/util/neverthrow.js +0 -46
  820. package/lib/util/neverthrow.js.map +0 -1
  821. package/src/cloudflare/asset-manifest.ts +0 -16
  822. package/src/cloudflare/oauth.ts +0 -301
  823. package/src/neon/api-error.ts +0 -81
  824. package/src/planetscale/api/index.ts +0 -4
  825. package/src/util/neverthrow.ts +0 -64
@@ -1,10 +1,14 @@
1
- import { alchemy } from "../alchemy.ts";
2
1
  import type { Context } from "../context.ts";
3
2
  import { Resource } from "../resource.ts";
4
- import type { Secret } from "../secret.ts";
5
- import { logger } from "../util/logger.ts";
6
- import { handleApiError } from "./api-error.ts";
7
3
  import { createNeonApi, type NeonApiOptions } from "./api.ts";
4
+ import type * as neon from "./api/types.gen.ts";
5
+ import {
6
+ formatConnectionUri,
7
+ formatRole,
8
+ waitForOperations,
9
+ type NeonConnectionUri,
10
+ type NeonRole,
11
+ } from "./utils.ts";
8
12
 
9
13
  /**
10
14
  * A Neon region where projects can be provisioned
@@ -22,6 +26,8 @@ export type NeonRegion =
22
26
  | "azure-westus3"
23
27
  | "azure-gwc";
24
28
 
29
+ export type NeonPgVersion = 14 | 15 | 16 | 17 | 18;
30
+
25
31
  /**
26
32
  * Properties for creating or updating a Neon project
27
33
  */
@@ -43,13 +49,7 @@ export interface NeonProjectProps extends NeonApiOptions {
43
49
  * PostgreSQL version to use
44
50
  * @default 16
45
51
  */
46
- pg_version?: 14 | 15 | 16 | 17;
47
-
48
- /**
49
- * Whether to create a default branch and endpoint
50
- * @default true
51
- */
52
- default_endpoint?: boolean;
52
+ pg_version?: NeonPgVersion;
53
53
 
54
54
  /**
55
55
  * Default branch name
@@ -58,409 +58,76 @@ export interface NeonProjectProps extends NeonApiOptions {
58
58
  default_branch_name?: string;
59
59
 
60
60
  /**
61
- * Existing project ID to update
62
- * Used internally during update operations
63
- * @internal
64
- */
65
- existing_project_id?: string;
66
- }
67
-
68
- /**
69
- * A Neon database
70
- */
71
- export interface NeonDatabase {
72
- /**
73
- * Database ID
74
- */
75
- id: number;
76
-
77
- /**
78
- * ID of the branch this database belongs to
79
- */
80
- branch_id: string;
81
-
82
- /**
83
- * Database name
84
- */
85
- name: string;
86
-
87
- /**
88
- * Name of the database owner role
89
- */
90
- owner_name: string;
91
-
92
- /**
93
- * Time at which the database was created
94
- */
95
- created_at: string;
96
-
97
- /**
98
- * Time at which the database was last updated
99
- */
100
- updated_at: string;
101
- }
102
-
103
- /**
104
- * A Neon database role
105
- */
106
- export interface NeonRole {
107
- /**
108
- * ID of the branch this role belongs to
109
- */
110
- branch_id: string;
111
-
112
- /**
113
- * Role name
61
+ * Settings for the project
114
62
  */
115
- name: string;
63
+ settings?: neon.ProjectSettingsData;
116
64
 
117
65
  /**
118
- * Role password (only included during creation)
66
+ * Default endpoint settings for the project
119
67
  */
120
- password?: string;
68
+ default_endpoint_settings?: neon.DefaultEndpointSettings;
121
69
 
122
70
  /**
123
- * Whether this role is protected from deletion
71
+ * History retention seconds for the project
72
+ * @default 86400
124
73
  */
125
- protected: boolean;
126
-
127
- /**
128
- * Time at which the role was created
129
- */
130
- created_at: string;
131
-
132
- /**
133
- * Time at which the role was last updated
134
- */
135
- updated_at: string;
74
+ history_retention_seconds?: number;
136
75
  }
137
76
 
138
77
  /**
139
- * A Neon branch
78
+ * Output returned after Neon project creation/update
79
+ * IMPORTANT: The interface name MUST match the exported resource name
140
80
  */
141
- export interface NeonBranch {
81
+ export interface NeonProject {
142
82
  /**
143
- * Branch ID
83
+ * The ID of the project
144
84
  */
145
85
  id: string;
146
86
 
147
87
  /**
148
- * ID of the project this branch belongs to
149
- */
150
- project_id: string;
151
-
152
- /**
153
- * Branch name
88
+ * Name of the Project.
154
89
  */
155
90
  name: string;
156
91
 
157
92
  /**
158
- * Current state of the branch
159
- */
160
- current_state: string;
161
-
162
- /**
163
- * Pending state of the branch
164
- */
165
- pending_state: string;
166
-
167
- /**
168
- * Time at which the branch was created
169
- */
170
- created_at: string;
171
-
172
- /**
173
- * Time at which the branch was last updated
174
- */
175
- updated_at: string;
176
- }
177
-
178
- /**
179
- * A Neon compute endpoint
180
- */
181
- export interface NeonEndpoint {
182
- /**
183
- * Endpoint ID
184
- */
185
- id: string;
186
-
187
- /**
188
- * Host for connecting to this endpoint
189
- */
190
- host: string;
191
-
192
- /**
193
- * ID of the project this endpoint belongs to
194
- */
195
- project_id: string;
196
-
197
- /**
198
- * ID of the branch this endpoint belongs to
199
- */
200
- branch_id: string;
201
-
202
- /**
203
- * Endpoint type (read_write, read_only)
204
- */
205
- type: string;
206
-
207
- /**
208
- * Current state of the endpoint
209
- */
210
- current_state: string;
211
-
212
- /**
213
- * Pending state of the endpoint
214
- */
215
- pending_state: string;
216
-
217
- /**
218
- * Region ID where this endpoint is provisioned
219
- */
220
- region_id: string;
221
-
222
- /**
223
- * Minimum compute units for autoscaling
224
- */
225
- autoscaling_limit_min_cu: number;
226
-
227
- /**
228
- * Maximum compute units for autoscaling
229
- */
230
- autoscaling_limit_max_cu: number;
231
-
232
- /**
233
- * Whether connection pooler is enabled
234
- */
235
- pooler_enabled: boolean;
236
-
237
- /**
238
- * Connection pooler mode
239
- */
240
- pooler_mode: string;
241
-
242
- /**
243
- * Whether this endpoint is disabled
244
- */
245
- disabled: boolean;
246
-
247
- /**
248
- * Whether passwordless access is enabled
249
- */
250
- passwordless_access: boolean;
251
-
252
- /**
253
- * Time at which the endpoint was created
93
+ * Time at which the project was created
254
94
  */
255
95
  created_at: string;
256
96
 
257
97
  /**
258
- * Time at which the endpoint was last updated
98
+ * Time at which the project was last updated
259
99
  */
260
100
  updated_at: string;
261
101
 
262
102
  /**
263
- * Proxy host for this endpoint
103
+ * Hostname for proxy access
264
104
  */
265
105
  proxy_host: string;
266
106
 
267
107
  /**
268
- * Endpoint settings
108
+ * Region where the project is provisioned
269
109
  */
270
- settings: {
271
- /**
272
- * PostgreSQL settings
273
- */
274
- pg_settings: Record<string, any>;
275
- };
276
- }
277
-
278
- /**
279
- * A Neon connection URI
280
- */
281
- export interface NeonConnectionUri {
282
- /**
283
- * Connection URI string
284
- */
285
- connection_uri: Secret;
286
-
287
- /**
288
- * Connection parameters
289
- */
290
- connection_parameters: {
291
- database: string;
292
- host: string;
293
- port: number;
294
- user: string;
295
- password: Secret;
296
- };
297
- }
298
-
299
- /**
300
- * A Neon operation
301
- */
302
- export interface NeonOperation {
303
- /**
304
- * Operation ID
305
- */
306
- id: string;
110
+ region_id: NeonRegion;
307
111
 
308
112
  /**
309
- * ID of the project this operation belongs to
113
+ * Settings for the project
310
114
  */
311
- project_id: string;
115
+ settings: neon.ProjectSettingsData | undefined;
312
116
 
313
117
  /**
314
- * ID of the branch this operation affects, if applicable
118
+ * Default endpoint settings for the project
315
119
  */
316
- branch_id?: string;
120
+ default_endpoint_settings: neon.DefaultEndpointSettings | undefined;
317
121
 
318
122
  /**
319
- * ID of the endpoint this operation affects, if applicable
123
+ * History retention seconds for the project
320
124
  */
321
- endpoint_id?: string;
125
+ history_retention_seconds: number;
322
126
 
323
127
  /**
324
- * Action being performed
128
+ * PostgreSQL version used by the project
325
129
  */
326
- action: string;
327
-
328
- /**
329
- * Current status of the operation
330
- */
331
- status: string;
332
-
333
- /**
334
- * Number of failures encountered
335
- */
336
- failures_count: number;
337
-
338
- /**
339
- * Time at which the operation was created
340
- */
341
- created_at: string;
342
-
343
- /**
344
- * Time at which the operation was last updated
345
- */
346
- updated_at: string;
347
- }
348
-
349
- /**
350
- * API response structure for Neon projects
351
- */
352
- interface NeonApiResponse {
353
- project: {
354
- id: string;
355
- name: string;
356
- region_id: string;
357
- pg_version: number;
358
- created_at: string;
359
- updated_at: string;
360
- proxy_host?: string;
361
- [key: string]: any;
362
- };
363
- connection_uris?: Array<{
364
- connection_uri: string;
365
- connection_parameters: {
366
- database: string;
367
- host: string;
368
- port: number;
369
- user: string;
370
- password: string;
371
- };
372
- }>;
373
- roles?: Array<{
374
- branch_id: string;
375
- name: string;
376
- password?: string;
377
- protected: boolean;
378
- created_at: string;
379
- updated_at: string;
380
- }>;
381
- databases?: Array<{
382
- id: number;
383
- branch_id: string;
384
- name: string;
385
- owner_name: string;
386
- created_at: string;
387
- updated_at: string;
388
- }>;
389
- operations?: Array<{
390
- id: string;
391
- project_id: string;
392
- branch_id?: string;
393
- endpoint_id?: string;
394
- action: string;
395
- status: string;
396
- failures_count: number;
397
- created_at: string;
398
- updated_at: string;
399
- }>;
400
- branch?: {
401
- id: string;
402
- project_id: string;
403
- name: string;
404
- current_state: string;
405
- pending_state: string;
406
- created_at: string;
407
- updated_at: string;
408
- };
409
- endpoints?: Array<{
410
- id: string;
411
- host: string;
412
- project_id: string;
413
- branch_id: string;
414
- type: string;
415
- current_state: string;
416
- pending_state: string;
417
- region_id: string;
418
- autoscaling_limit_min_cu: number;
419
- autoscaling_limit_max_cu: number;
420
- pooler_enabled: boolean;
421
- pooler_mode: string;
422
- disabled: boolean;
423
- passwordless_access: boolean;
424
- created_at: string;
425
- updated_at: string;
426
- proxy_host: string;
427
- settings: {
428
- pg_settings: Record<string, any>;
429
- };
430
- }>;
431
- }
432
-
433
- /**
434
- * Output returned after Neon project creation/update
435
- * IMPORTANT: The interface name MUST match the exported resource name
436
- */
437
- export interface NeonProject
438
- extends Resource<"neon::Project">,
439
- Omit<NeonProjectProps, "apiKey" | "existing_project_id"> {
440
- /**
441
- * The ID of the project
442
- */
443
- id: string;
444
-
445
- /**
446
- * Name of the Project.
447
- */
448
- name: string;
449
-
450
- /**
451
- * Time at which the project was created
452
- */
453
- created_at: string;
454
-
455
- /**
456
- * Time at which the project was last updated
457
- */
458
- updated_at: string;
459
-
460
- /**
461
- * Hostname for proxy access
462
- */
463
- proxy_host?: string;
130
+ pg_version: NeonPgVersion;
464
131
 
465
132
  /**
466
133
  * Connection URIs for the databases
@@ -475,17 +142,17 @@ export interface NeonProject
475
142
  /**
476
143
  * Databases created with the project
477
144
  */
478
- databases?: [NeonDatabase, ...NeonDatabase[]];
145
+ databases: [neon.Database, ...neon.Database[]];
479
146
 
480
147
  /**
481
148
  * Default branch information
482
149
  */
483
- branch?: NeonBranch;
150
+ branch: neon.Branch;
484
151
 
485
152
  /**
486
153
  * Compute endpoints for the project
487
154
  */
488
- endpoints: [NeonEndpoint, ...NeonEndpoint[]];
155
+ endpoints: [neon.Endpoint, ...neon.Endpoint[]];
489
156
  }
490
157
 
491
158
  /**
@@ -519,367 +186,115 @@ export const NeonProject = Resource(
519
186
  this: Context<NeonProject>,
520
187
  id: string,
521
188
  props: NeonProjectProps,
522
- ): Promise<NeonProject> {
189
+ ) {
523
190
  const api = createNeonApi(props);
524
- const projectId = props.existing_project_id || this.output?.id;
525
- const projectName =
191
+ const name =
526
192
  props.name ?? this.output?.name ?? this.scope.createPhysicalName(id);
527
193
 
528
- if (this.phase === "update" && this.output.name !== projectName) {
529
- this.replace();
530
- }
194
+ switch (this.phase) {
195
+ case "create": {
196
+ const { data } = await api.createProject({
197
+ body: {
198
+ project: {
199
+ name,
200
+ region_id: props.region_id,
201
+ pg_version: props.pg_version,
202
+ default_endpoint_settings: props.default_endpoint_settings,
203
+ branch: {
204
+ name: props.default_branch_name,
205
+ },
206
+ settings: props.settings,
207
+ history_retention_seconds: props.history_retention_seconds,
208
+ },
209
+ },
210
+ });
531
211
 
532
- if (this.phase === "delete") {
533
- try {
534
- // Check if the project exists before attempting to delete
535
- if (projectId) {
536
- const deleteResponse = await api.delete(`/projects/${projectId}`);
537
- if (!deleteResponse.ok && deleteResponse.status !== 404) {
538
- await handleApiError(deleteResponse, "delete", "project", id);
539
- }
540
- }
541
- } catch (error) {
542
- logger.error(`Error deleting Neon project ${id}:`, error);
543
- throw error;
212
+ // Branch and endpoints have fields that are updated after operations are complete.
213
+ await waitForOperations(api, data.operations);
214
+ const [branch, endpoints] = await Promise.all([
215
+ api
216
+ .getProjectBranch({
217
+ path: {
218
+ project_id: data.project.id,
219
+ branch_id: data.branch.id,
220
+ },
221
+ })
222
+ .then((res) => res.data.branch),
223
+ api
224
+ .listProjectEndpoints({
225
+ path: {
226
+ project_id: data.project.id,
227
+ },
228
+ })
229
+ .then((res) => res.data.endpoints),
230
+ ]);
231
+
232
+ return this({
233
+ id: data.project.id,
234
+ name: data.project.name,
235
+ created_at: data.project.created_at,
236
+ updated_at: data.project.updated_at,
237
+ proxy_host: data.project.proxy_host,
238
+ region_id: data.project.region_id as NeonRegion,
239
+ pg_version: data.project.pg_version as NeonPgVersion,
240
+ settings: data.project.settings,
241
+ default_endpoint_settings: data.project.default_endpoint_settings,
242
+ history_retention_seconds: data.project.history_retention_seconds,
243
+ connection_uris: data.connection_uris.map(formatConnectionUri) as [
244
+ NeonConnectionUri,
245
+ ...NeonConnectionUri[],
246
+ ],
247
+ roles: data.roles.map(formatRole) as [NeonRole, ...NeonRole[]],
248
+ databases: data.databases as [neon.Database, ...neon.Database[]],
249
+ branch,
250
+ endpoints: endpoints as [neon.Endpoint, ...neon.Endpoint[]],
251
+ });
544
252
  }
545
- return this.destroy();
546
- }
547
-
548
- let response: NeonApiResponse;
549
-
550
- try {
551
- if (this.phase === "update" && projectId) {
552
- // Update existing project
553
- // Neon only allows updating the project name
554
- const projectResponse = await api.patch(`/projects/${projectId}`, {
555
- project: {
556
- name: projectName,
253
+ case "update": {
254
+ const { data } = await api.updateProject({
255
+ path: {
256
+ project_id: this.output.id,
257
+ },
258
+ body: {
259
+ project: {
260
+ name,
261
+ settings: props.settings,
262
+ default_endpoint_settings: props.default_endpoint_settings,
263
+ history_retention_seconds: props.history_retention_seconds,
264
+ },
557
265
  },
558
266
  });
559
-
560
- if (!projectResponse.ok) {
561
- await handleApiError(projectResponse, "update", "project", id);
562
- }
563
-
564
- const initialData = await projectResponse.json();
565
-
566
- // Reify project properties to get complete data
567
- response = await getProject(
568
- api,
569
- projectId,
570
- initialData as Partial<NeonApiResponse>,
571
- );
572
- } else {
573
- // Check if a project with this ID already exists
574
- if (projectId) {
575
- const getResponse = await api.get(`/projects/${projectId}`);
576
- if (getResponse.ok) {
577
- // Project exists, update it
578
- const projectResponse = await api.patch(`/projects/${projectId}`, {
579
- project: {
580
- name: projectName,
267
+ return this({
268
+ ...this.output,
269
+ name: data.project.name,
270
+ updated_at: data.project.updated_at,
271
+ proxy_host: data.project.proxy_host,
272
+ region_id: data.project.region_id as NeonRegion,
273
+ pg_version: data.project.pg_version as NeonPgVersion,
274
+ settings: data.project.settings,
275
+ default_endpoint_settings: data.project.default_endpoint_settings,
276
+ history_retention_seconds: data.project.history_retention_seconds,
277
+ });
278
+ }
279
+ case "delete": {
280
+ if (this.output?.id) {
281
+ const response = await api.deleteProject({
282
+ path: {
283
+ project_id: this.output.id,
284
+ },
285
+ throwOnError: false,
286
+ });
287
+ if (response.error && response.response.status !== 404) {
288
+ throw new Error(
289
+ `Failed to delete project: ${response.error.message}`,
290
+ {
291
+ cause: response.error,
581
292
  },
582
- });
583
-
584
- if (!projectResponse.ok) {
585
- await handleApiError(projectResponse, "update", "project", id);
586
- }
587
-
588
- const initialData = await projectResponse.json();
589
- // Reify project properties to get complete data
590
- response = await getProject(
591
- api,
592
- projectId,
593
- initialData as Partial<NeonApiResponse>,
594
293
  );
595
- } else if (getResponse.status !== 404) {
596
- // Unexpected error during GET check
597
- await handleApiError(getResponse, "get", "project", id);
598
- throw new Error("Failed to check if project exists");
599
- } else {
600
- // Project doesn't exist, create new
601
- response = await createNewProject(api, projectName, props);
602
294
  }
603
- } else {
604
- // No output ID, create new project
605
- response = await createNewProject(api, projectName, props);
606
295
  }
296
+ return this.destroy();
607
297
  }
608
-
609
- // Wait for any pending operations to complete
610
- if (response.operations && response.operations.length > 0) {
611
- await waitForOperations(api, response.operations);
612
- }
613
-
614
- // Get the latest project state after operations complete
615
- if (response.project?.id) {
616
- // Reify project properties to get complete data
617
- response = await getProject(api, response.project.id, response);
618
- }
619
-
620
- return this({
621
- id: response.project.id,
622
- name: response.project.name,
623
- region_id: response.project.region_id as NeonRegion,
624
- pg_version: response.project.pg_version as 14 | 15 | 16 | 17,
625
- created_at: response.project.created_at,
626
- updated_at: response.project.updated_at,
627
- proxy_host: response.project.proxy_host,
628
- // Pass through the provided props except apiKey (which is sensitive)
629
- default_endpoint: props.default_endpoint,
630
- default_branch_name: props.default_branch_name,
631
- baseUrl: props.baseUrl,
632
- // Add all available data
633
- // @ts-expect-error - api ensures they're non-empty
634
- connection_uris: response.connection_uris,
635
- // @ts-expect-error
636
- roles: response.roles,
637
- // @ts-expect-error
638
- databases: response.databases,
639
- branch: response.branch,
640
- // @ts-expect-error
641
- endpoints: response.endpoints,
642
- });
643
- } catch (error) {
644
- logger.error(`Error ${this.phase} Neon project '${id}':`, error);
645
- throw error;
646
298
  }
647
299
  },
648
300
  );
649
-
650
- /**
651
- * Helper function to create a new Neon project
652
- */
653
- async function createNewProject(
654
- api: any,
655
- projectName: string,
656
- props: NeonProjectProps,
657
- ): Promise<NeonApiResponse> {
658
- const defaultEndpoint = props.default_endpoint ?? true;
659
- const projectResponse = await api.post("/projects", {
660
- project: {
661
- name: projectName,
662
- region_id: props.region_id || "aws-us-east-1",
663
- pg_version: props.pg_version || 16,
664
- default_endpoint: defaultEndpoint,
665
- branch: defaultEndpoint
666
- ? { name: props.default_branch_name || "main" }
667
- : undefined,
668
- },
669
- });
670
-
671
- if (!projectResponse.ok) {
672
- await handleApiError(projectResponse, "create", "project");
673
- }
674
-
675
- return (await projectResponse.json()) as NeonApiResponse;
676
- }
677
-
678
- /**
679
- * Helper function to get complete project details by fetching all related data
680
- *
681
- * @param api The Neon API client
682
- * @param projectId The project ID
683
- * @param initialData Initial project data (optional)
684
- * @returns Complete project data with all related resources
685
- */
686
- async function getProject(
687
- api: any,
688
- projectId: string,
689
- initialData: Partial<NeonApiResponse> = {},
690
- ): Promise<NeonApiResponse> {
691
- // Get the latest project details
692
- const updatedData = await getProjectDetails(api, projectId);
693
-
694
- // Start with a copy of the initial data
695
- const responseData = { ...initialData };
696
-
697
- // Check if we have a branch ID from the initial data
698
- const branchId = initialData.branch?.id;
699
-
700
- if (branchId) {
701
- // Get the branch details
702
- const branchData = await getBranchDetails(api, projectId, branchId);
703
-
704
- // Update with the latest branch data
705
- responseData.branch = branchData.branch;
706
-
707
- // Also fetch the latest endpoint details for this branch
708
- const endpointData = await getEndpointDetails(api, projectId, branchId);
709
-
710
- // Update with the latest endpoint data if available
711
- if (endpointData.endpoints && endpointData.endpoints.length > 0) {
712
- responseData.endpoints = endpointData.endpoints;
713
- }
714
- }
715
-
716
- // Preserve all data from the original response
717
- // Only update properties that might have changed during operations
718
- return {
719
- ...responseData,
720
- connection_uris: (
721
- updatedData.connection_uris || responseData.connection_uris
722
- )?.map((uri) => ({
723
- connection_uri: alchemy.secret(uri.connection_uri),
724
- connection_parameters: {
725
- database: uri.connection_parameters.database,
726
- host: uri.connection_parameters.host,
727
- port: uri.connection_parameters.port ?? 5432,
728
- user: uri.connection_parameters.user ?? "neondb_owner",
729
- password: alchemy.secret(uri.connection_parameters.password),
730
- },
731
- })),
732
- project: updatedData.project,
733
- branch: updatedData.branch || responseData.branch,
734
- endpoints: updatedData.endpoints || responseData.endpoints,
735
- } as NeonApiResponse;
736
- }
737
-
738
- /**
739
- * Wait for operations to complete
740
- *
741
- * @param api The Neon API client
742
- * @param operations Operations to wait for
743
- * @throws Error if an operation fails or times out
744
- * @returns Promise that resolves when all operations complete
745
- */
746
- async function waitForOperations(
747
- api: any,
748
- operations: Array<{
749
- id: string;
750
- project_id: string;
751
- status: string;
752
- action: string;
753
- }>,
754
- ): Promise<void> {
755
- const pendingOperations = operations.filter(
756
- (op) => op.status !== "finished" && op.status !== "failed",
757
- );
758
-
759
- if (pendingOperations.length === 0) {
760
- return;
761
- }
762
-
763
- // Maximum wait time in milliseconds (5 minutes)
764
- const maxWaitTime = 5 * 60 * 1000;
765
- // Initial delay between retries in milliseconds
766
- const initialRetryDelay = 500;
767
- // Maximum delay between retries
768
- const maxRetryDelay = 10000;
769
- // Backoff factor for exponential backoff
770
- const backoffFactor = 1.5;
771
-
772
- for (const operation of pendingOperations) {
773
- let totalWaitTime = 0;
774
- let retryDelay = initialRetryDelay;
775
- let operationStatus = operation.status;
776
-
777
- while (
778
- operationStatus !== "finished" &&
779
- operationStatus !== "failed" &&
780
- totalWaitTime < maxWaitTime
781
- ) {
782
- // Wait before checking again with exponential backoff
783
- await new Promise((resolve) => setTimeout(resolve, retryDelay));
784
- totalWaitTime += retryDelay;
785
-
786
- // Increase delay for next retry with exponential backoff, up to max
787
- retryDelay = Math.min(retryDelay * backoffFactor, maxRetryDelay);
788
-
789
- // Check operation status
790
- const operationResponse = await api.get(
791
- `/projects/${operation.project_id}/operations/${operation.id}`,
792
- );
793
-
794
- if (operationResponse.ok) {
795
- const operationData = await operationResponse.json();
796
- operationStatus = operationData.operation?.status;
797
- } else {
798
- throw new Error(
799
- `Failed to check operation ${operation.id} status: HTTP ${operationResponse.status}`,
800
- );
801
- }
802
- }
803
-
804
- if (operationStatus === "failed") {
805
- throw new Error(`Operation ${operation.id} (${operation.action}) failed`);
806
- }
807
- if (totalWaitTime >= maxWaitTime) {
808
- throw new Error(
809
- `Timeout waiting for operation ${operation.id} (${operation.action}) to complete`,
810
- );
811
- }
812
- }
813
-
814
- // Explicitly return when all operations are complete
815
- return;
816
- }
817
-
818
- /**
819
- * Get the latest project details
820
- *
821
- * @param api The Neon API client
822
- * @param projectId The project ID
823
- * @returns Project details including branch and endpoints
824
- * @throws Error if project details cannot be retrieved
825
- */
826
- async function getProjectDetails(
827
- api: any,
828
- projectId: string,
829
- ): Promise<NeonApiResponse> {
830
- const response = await api.get(`/projects/${projectId}`);
831
-
832
- if (!response.ok) {
833
- throw new Error(`Failed to get project details: HTTP ${response.status}`);
834
- }
835
-
836
- return (await response.json()) as NeonApiResponse;
837
- }
838
-
839
- /**
840
- * Get the latest branch details
841
- *
842
- * @param api The Neon API client
843
- * @param projectId The project ID
844
- * @param branchId The branch ID
845
- * @returns Branch details
846
- * @throws Error if branch details cannot be retrieved
847
- */
848
- async function getBranchDetails(
849
- api: any,
850
- projectId: string,
851
- branchId: string,
852
- ): Promise<{ branch: NeonBranch }> {
853
- const response = await api.get(`/projects/${projectId}/branches/${branchId}`);
854
-
855
- if (!response.ok) {
856
- throw new Error(`Failed to get branch details: HTTP ${response.status}`);
857
- }
858
-
859
- return (await response.json()) as { branch: NeonBranch };
860
- }
861
-
862
- /**
863
- * Get the latest endpoint details for a branch
864
- *
865
- * @param api The Neon API client
866
- * @param projectId The project ID
867
- * @param branchId The branch ID
868
- * @returns Endpoint details for the branch
869
- * @throws Error if endpoint details cannot be retrieved
870
- */
871
- async function getEndpointDetails(
872
- api: any,
873
- projectId: string,
874
- branchId: string,
875
- ): Promise<{ endpoints: NeonEndpoint[] }> {
876
- const response = await api.get(
877
- `/projects/${projectId}/branches/${branchId}/endpoints`,
878
- );
879
-
880
- if (!response.ok) {
881
- throw new Error(`Failed to get endpoint details: HTTP ${response.status}`);
882
- }
883
-
884
- return (await response.json()) as { endpoints: NeonEndpoint[] };
885
- }