alchemy 0.25.0 → 0.26.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 (499) hide show
  1. package/README.md +7 -0
  2. package/lib/ai/astro-file.d.ts.map +1 -1
  3. package/lib/ai/astro-file.js +2 -1
  4. package/lib/ai/astro-file.js.map +1 -1
  5. package/lib/ai/client.d.ts.map +1 -1
  6. package/lib/ai/client.js +3 -2
  7. package/lib/ai/client.js.map +1 -1
  8. package/lib/alchemy.d.ts +7 -0
  9. package/lib/alchemy.d.ts.map +1 -1
  10. package/lib/alchemy.js +19 -3
  11. package/lib/alchemy.js.map +1 -1
  12. package/lib/apply.d.ts.map +1 -1
  13. package/lib/apply.js +63 -5
  14. package/lib/apply.js.map +1 -1
  15. package/lib/aws/control/client.js +4 -3
  16. package/lib/aws/control/client.js.map +1 -1
  17. package/lib/aws/control/properties.d.ts +6 -0
  18. package/lib/aws/control/properties.d.ts.map +1 -1
  19. package/lib/aws/control/properties.js +48 -0
  20. package/lib/aws/control/properties.js.map +1 -1
  21. package/lib/aws/control/resource.d.ts.map +1 -1
  22. package/lib/aws/control/resource.js +3 -2
  23. package/lib/aws/control/resource.js.map +1 -1
  24. package/lib/aws/control/types.d.ts +3969 -4862
  25. package/lib/aws/control/types.d.ts.map +1 -1
  26. package/lib/aws/control/types.js.map +1 -1
  27. package/lib/aws/function.d.ts.map +1 -1
  28. package/lib/aws/function.js +9 -8
  29. package/lib/aws/function.js.map +1 -1
  30. package/lib/aws/oidc/oidc-provider.d.ts.map +1 -1
  31. package/lib/aws/oidc/oidc-provider.js +3 -2
  32. package/lib/aws/oidc/oidc-provider.js.map +1 -1
  33. package/lib/aws/queue.d.ts.map +1 -1
  34. package/lib/aws/queue.js +3 -2
  35. package/lib/aws/queue.js.map +1 -1
  36. package/lib/aws/role.d.ts.map +1 -1
  37. package/lib/aws/role.js +3 -1
  38. package/lib/aws/role.js.map +1 -1
  39. package/lib/aws/ssm-parameter.d.ts.map +1 -1
  40. package/lib/aws/ssm-parameter.js +2 -1
  41. package/lib/aws/ssm-parameter.js.map +1 -1
  42. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  43. package/lib/cloudflare/account-api-token.js +3 -2
  44. package/lib/cloudflare/account-api-token.js.map +1 -1
  45. package/lib/cloudflare/ai-gateway.d.ts.map +1 -1
  46. package/lib/cloudflare/ai-gateway.js +4 -3
  47. package/lib/cloudflare/ai-gateway.js.map +1 -1
  48. package/lib/cloudflare/api-error.d.ts +0 -9
  49. package/lib/cloudflare/api-error.d.ts.map +1 -1
  50. package/lib/cloudflare/api-error.js +24 -0
  51. package/lib/cloudflare/api-error.js.map +1 -1
  52. package/lib/cloudflare/api.d.ts.map +1 -1
  53. package/lib/cloudflare/api.js +5 -4
  54. package/lib/cloudflare/api.js.map +1 -1
  55. package/lib/cloudflare/assets.d.ts.map +1 -1
  56. package/lib/cloudflare/assets.js +26 -6
  57. package/lib/cloudflare/assets.js.map +1 -1
  58. package/lib/cloudflare/astro.d.ts +63 -0
  59. package/lib/cloudflare/astro.d.ts.map +1 -0
  60. package/lib/cloudflare/astro.js +133 -0
  61. package/lib/cloudflare/astro.js.map +1 -0
  62. package/lib/cloudflare/auth.d.ts.map +1 -1
  63. package/lib/cloudflare/auth.js +3 -2
  64. package/lib/cloudflare/auth.js.map +1 -1
  65. package/lib/cloudflare/bindings.d.ts +24 -2
  66. package/lib/cloudflare/bindings.d.ts.map +1 -1
  67. package/lib/cloudflare/bindings.js.map +1 -1
  68. package/lib/cloudflare/bound.d.ts +10 -1
  69. package/lib/cloudflare/bound.d.ts.map +1 -1
  70. package/lib/cloudflare/bucket.d.ts.map +1 -1
  71. package/lib/cloudflare/bucket.js +12 -8
  72. package/lib/cloudflare/bucket.js.map +1 -1
  73. package/lib/cloudflare/bundle/bundle-worker.d.ts.map +1 -1
  74. package/lib/cloudflare/bundle/bundle-worker.js +2 -1
  75. package/lib/cloudflare/bundle/bundle-worker.js.map +1 -1
  76. package/lib/cloudflare/bundle/nodejs-compat-mode.d.ts.map +1 -1
  77. package/lib/cloudflare/bundle/nodejs-compat-mode.js +2 -1
  78. package/lib/cloudflare/bundle/nodejs-compat-mode.js.map +1 -1
  79. package/lib/cloudflare/custom-domain.d.ts.map +1 -1
  80. package/lib/cloudflare/custom-domain.js +10 -9
  81. package/lib/cloudflare/custom-domain.js.map +1 -1
  82. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  83. package/lib/cloudflare/d1-database.js +11 -10
  84. package/lib/cloudflare/d1-database.js.map +1 -1
  85. package/lib/cloudflare/d1-export.d.ts.map +1 -1
  86. package/lib/cloudflare/d1-export.js +2 -1
  87. package/lib/cloudflare/d1-export.js.map +1 -1
  88. package/lib/cloudflare/d1-import.d.ts.map +1 -1
  89. package/lib/cloudflare/d1-import.js +2 -1
  90. package/lib/cloudflare/d1-import.js.map +1 -1
  91. package/lib/cloudflare/d1-migrations.d.ts.map +1 -1
  92. package/lib/cloudflare/d1-migrations.js +2 -1
  93. package/lib/cloudflare/d1-migrations.js.map +1 -1
  94. package/lib/cloudflare/dispatch-namespace.d.ts +94 -0
  95. package/lib/cloudflare/dispatch-namespace.d.ts.map +1 -0
  96. package/lib/cloudflare/dispatch-namespace.js +143 -0
  97. package/lib/cloudflare/dispatch-namespace.js.map +1 -0
  98. package/lib/cloudflare/dns-records.d.ts.map +1 -1
  99. package/lib/cloudflare/dns-records.js +5 -4
  100. package/lib/cloudflare/dns-records.js.map +1 -1
  101. package/lib/cloudflare/do-state-store/worker.d.ts.map +1 -1
  102. package/lib/cloudflare/do-state-store/worker.js +4 -0
  103. package/lib/cloudflare/do-state-store/worker.js.map +1 -1
  104. package/lib/cloudflare/email-address.d.ts +79 -0
  105. package/lib/cloudflare/email-address.d.ts.map +1 -0
  106. package/lib/cloudflare/email-address.js +112 -0
  107. package/lib/cloudflare/email-address.js.map +1 -0
  108. package/lib/cloudflare/email-catch-all.d.ts +123 -0
  109. package/lib/cloudflare/email-catch-all.d.ts.map +1 -0
  110. package/lib/cloudflare/email-catch-all.js +124 -0
  111. package/lib/cloudflare/email-catch-all.js.map +1 -0
  112. package/lib/cloudflare/email-routing.d.ts +89 -0
  113. package/lib/cloudflare/email-routing.d.ts.map +1 -0
  114. package/lib/cloudflare/email-routing.js +120 -0
  115. package/lib/cloudflare/email-routing.js.map +1 -0
  116. package/lib/cloudflare/email-rule.d.ts +196 -0
  117. package/lib/cloudflare/email-rule.d.ts.map +1 -0
  118. package/lib/cloudflare/email-rule.js +153 -0
  119. package/lib/cloudflare/email-rule.js.map +1 -0
  120. package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
  121. package/lib/cloudflare/hyperdrive.js +5 -4
  122. package/lib/cloudflare/hyperdrive.js.map +1 -1
  123. package/lib/cloudflare/images.d.ts +60 -0
  124. package/lib/cloudflare/images.d.ts.map +1 -0
  125. package/lib/cloudflare/images.js +60 -0
  126. package/lib/cloudflare/images.js.map +1 -0
  127. package/lib/cloudflare/index.d.ts +10 -0
  128. package/lib/cloudflare/index.d.ts.map +1 -1
  129. package/lib/cloudflare/index.js +10 -0
  130. package/lib/cloudflare/index.js.map +1 -1
  131. package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
  132. package/lib/cloudflare/kv-namespace.js +2 -1
  133. package/lib/cloudflare/kv-namespace.js.map +1 -1
  134. package/lib/cloudflare/pipeline.d.ts +7 -0
  135. package/lib/cloudflare/pipeline.d.ts.map +1 -1
  136. package/lib/cloudflare/pipeline.js +28 -2
  137. package/lib/cloudflare/pipeline.js.map +1 -1
  138. package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
  139. package/lib/cloudflare/queue-consumer.js +2 -1
  140. package/lib/cloudflare/queue-consumer.js.map +1 -1
  141. package/lib/cloudflare/queue.d.ts.map +1 -1
  142. package/lib/cloudflare/queue.js +0 -8
  143. package/lib/cloudflare/queue.js.map +1 -1
  144. package/lib/cloudflare/route.d.ts +26 -1
  145. package/lib/cloudflare/route.d.ts.map +1 -1
  146. package/lib/cloudflare/route.js +84 -16
  147. package/lib/cloudflare/route.js.map +1 -1
  148. package/lib/cloudflare/secret.d.ts +137 -0
  149. package/lib/cloudflare/secret.d.ts.map +1 -0
  150. package/lib/cloudflare/secret.js +122 -0
  151. package/lib/cloudflare/secret.js.map +1 -0
  152. package/lib/cloudflare/secrets-store.d.ts +145 -0
  153. package/lib/cloudflare/secrets-store.d.ts.map +1 -0
  154. package/lib/cloudflare/secrets-store.js +213 -0
  155. package/lib/cloudflare/secrets-store.js.map +1 -0
  156. package/lib/cloudflare/sveltekit.d.ts +49 -0
  157. package/lib/cloudflare/sveltekit.d.ts.map +1 -0
  158. package/lib/cloudflare/sveltekit.js +56 -0
  159. package/lib/cloudflare/sveltekit.js.map +1 -0
  160. package/lib/cloudflare/user.d.ts.map +1 -1
  161. package/lib/cloudflare/user.js +2 -1
  162. package/lib/cloudflare/user.js.map +1 -1
  163. package/lib/cloudflare/vectorize-index.d.ts.map +1 -1
  164. package/lib/cloudflare/vectorize-index.js +6 -5
  165. package/lib/cloudflare/vectorize-index.js.map +1 -1
  166. package/lib/cloudflare/vectorize-metadata-index.d.ts.map +1 -1
  167. package/lib/cloudflare/vectorize-metadata-index.js +2 -1
  168. package/lib/cloudflare/vectorize-metadata-index.js.map +1 -1
  169. package/lib/cloudflare/website.d.ts.map +1 -1
  170. package/lib/cloudflare/website.js +7 -2
  171. package/lib/cloudflare/website.js.map +1 -1
  172. package/lib/cloudflare/worker-assets.d.ts +18 -0
  173. package/lib/cloudflare/worker-assets.d.ts.map +1 -1
  174. package/lib/cloudflare/worker-assets.js +61 -67
  175. package/lib/cloudflare/worker-assets.js.map +1 -1
  176. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  177. package/lib/cloudflare/worker-metadata.js +23 -1
  178. package/lib/cloudflare/worker-metadata.js.map +1 -1
  179. package/lib/cloudflare/worker.d.ts +43 -2
  180. package/lib/cloudflare/worker.d.ts.map +1 -1
  181. package/lib/cloudflare/worker.js +50 -11
  182. package/lib/cloudflare/worker.js.map +1 -1
  183. package/lib/cloudflare/wrangler.json.d.ts +21 -0
  184. package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
  185. package/lib/cloudflare/wrangler.json.js +33 -0
  186. package/lib/cloudflare/wrangler.json.js.map +1 -1
  187. package/lib/cloudflare/zone.d.ts.map +1 -1
  188. package/lib/cloudflare/zone.js +4 -3
  189. package/lib/cloudflare/zone.js.map +1 -1
  190. package/lib/destroy.d.ts.map +1 -1
  191. package/lib/destroy.js +30 -13
  192. package/lib/destroy.js.map +1 -1
  193. package/lib/dns/godaddy.d.ts.map +1 -1
  194. package/lib/dns/godaddy.js +3 -2
  195. package/lib/dns/godaddy.js.map +1 -1
  196. package/lib/dns/import-dns.d.ts.map +1 -1
  197. package/lib/dns/import-dns.js +2 -1
  198. package/lib/dns/import-dns.js.map +1 -1
  199. package/lib/esbuild/bundle.d.ts +1 -1
  200. package/lib/esbuild/bundle.d.ts.map +1 -1
  201. package/lib/esbuild/bundle.js +2 -1
  202. package/lib/esbuild/bundle.js.map +1 -1
  203. package/lib/fs/copy-file.d.ts.map +1 -1
  204. package/lib/fs/copy-file.js +2 -1
  205. package/lib/fs/copy-file.js.map +1 -1
  206. package/lib/fs/file.d.ts.map +1 -1
  207. package/lib/fs/file.js +2 -1
  208. package/lib/fs/file.js.map +1 -1
  209. package/lib/github/client.d.ts.map +1 -1
  210. package/lib/github/client.js +11 -10
  211. package/lib/github/client.js.map +1 -1
  212. package/lib/github/repository-environment.d.ts.map +1 -1
  213. package/lib/github/repository-environment.js +5 -4
  214. package/lib/github/repository-environment.js.map +1 -1
  215. package/lib/github/secret.d.ts.map +1 -1
  216. package/lib/github/secret.js +7 -6
  217. package/lib/github/secret.js.map +1 -1
  218. package/lib/index.d.ts +2 -1
  219. package/lib/index.d.ts.map +1 -1
  220. package/lib/index.js +1 -0
  221. package/lib/index.js.map +1 -1
  222. package/lib/neon/project.d.ts.map +1 -1
  223. package/lib/neon/project.js +3 -2
  224. package/lib/neon/project.js.map +1 -1
  225. package/lib/planetscale/api.d.ts +53 -0
  226. package/lib/planetscale/api.d.ts.map +1 -0
  227. package/lib/planetscale/api.js +84 -0
  228. package/lib/planetscale/api.js.map +1 -0
  229. package/lib/planetscale/branch.d.ts +129 -0
  230. package/lib/planetscale/branch.d.ts.map +1 -0
  231. package/lib/planetscale/branch.js +161 -0
  232. package/lib/planetscale/branch.js.map +1 -0
  233. package/lib/planetscale/database.d.ts +143 -0
  234. package/lib/planetscale/database.d.ts.map +1 -0
  235. package/lib/planetscale/database.js +184 -0
  236. package/lib/planetscale/database.js.map +1 -0
  237. package/lib/planetscale/index.d.ts +5 -0
  238. package/lib/planetscale/index.d.ts.map +1 -0
  239. package/lib/planetscale/index.js +5 -0
  240. package/lib/planetscale/index.js.map +1 -0
  241. package/lib/planetscale/utils.d.ts +15 -0
  242. package/lib/planetscale/utils.d.ts.map +1 -0
  243. package/lib/planetscale/utils.js +95 -0
  244. package/lib/planetscale/utils.js.map +1 -0
  245. package/lib/resource.js +7 -1
  246. package/lib/resource.js.map +1 -1
  247. package/lib/runtime/plugin.d.ts.map +1 -1
  248. package/lib/runtime/plugin.js +2 -1
  249. package/lib/runtime/plugin.js.map +1 -1
  250. package/lib/scope.d.ts +13 -2
  251. package/lib/scope.d.ts.map +1 -1
  252. package/lib/scope.js +53 -10
  253. package/lib/scope.js.map +1 -1
  254. package/lib/sentry/client-key.d.ts.map +1 -1
  255. package/lib/sentry/client-key.js +5 -4
  256. package/lib/sentry/client-key.js.map +1 -1
  257. package/lib/sentry/project.d.ts.map +1 -1
  258. package/lib/sentry/project.js +5 -4
  259. package/lib/sentry/project.js.map +1 -1
  260. package/lib/sentry/team.d.ts.map +1 -1
  261. package/lib/sentry/team.js +5 -4
  262. package/lib/sentry/team.js.map +1 -1
  263. package/lib/stripe/card.d.ts.map +1 -1
  264. package/lib/stripe/card.js +2 -1
  265. package/lib/stripe/card.js.map +1 -1
  266. package/lib/stripe/client.d.ts.map +1 -1
  267. package/lib/stripe/client.js +3 -2
  268. package/lib/stripe/client.js.map +1 -1
  269. package/lib/stripe/coupon.d.ts.map +1 -1
  270. package/lib/stripe/coupon.js +2 -1
  271. package/lib/stripe/coupon.js.map +1 -1
  272. package/lib/stripe/customer.d.ts.map +1 -1
  273. package/lib/stripe/customer.js +2 -1
  274. package/lib/stripe/customer.js.map +1 -1
  275. package/lib/stripe/entitlements-feature.d.ts.map +1 -1
  276. package/lib/stripe/entitlements-feature.js +2 -1
  277. package/lib/stripe/entitlements-feature.js.map +1 -1
  278. package/lib/stripe/file.d.ts.map +1 -1
  279. package/lib/stripe/file.js +2 -1
  280. package/lib/stripe/file.js.map +1 -1
  281. package/lib/stripe/meter.d.ts.map +1 -1
  282. package/lib/stripe/meter.js +4 -2
  283. package/lib/stripe/meter.js.map +1 -1
  284. package/lib/stripe/portal-configuration.d.ts.map +1 -1
  285. package/lib/stripe/portal-configuration.js +2 -1
  286. package/lib/stripe/portal-configuration.js.map +1 -1
  287. package/lib/stripe/price.d.ts.map +1 -1
  288. package/lib/stripe/price.js +2 -1
  289. package/lib/stripe/price.js.map +1 -1
  290. package/lib/stripe/product-feature.d.ts.map +1 -1
  291. package/lib/stripe/product-feature.js +2 -1
  292. package/lib/stripe/product-feature.js.map +1 -1
  293. package/lib/stripe/product.d.ts.map +1 -1
  294. package/lib/stripe/product.js +2 -1
  295. package/lib/stripe/product.js.map +1 -1
  296. package/lib/stripe/promotion-code.d.ts.map +1 -1
  297. package/lib/stripe/promotion-code.js +2 -1
  298. package/lib/stripe/promotion-code.js.map +1 -1
  299. package/lib/stripe/shipping-rate.d.ts.map +1 -1
  300. package/lib/stripe/shipping-rate.js +2 -1
  301. package/lib/stripe/shipping-rate.js.map +1 -1
  302. package/lib/stripe/tax-rate.d.ts.map +1 -1
  303. package/lib/stripe/tax-rate.js +2 -1
  304. package/lib/stripe/tax-rate.js.map +1 -1
  305. package/lib/stripe/webhook.d.ts.map +1 -1
  306. package/lib/stripe/webhook.js +3 -2
  307. package/lib/stripe/webhook.js.map +1 -1
  308. package/lib/test/bun.d.ts.map +1 -1
  309. package/lib/test/bun.js +6 -1
  310. package/lib/test/bun.js.map +1 -1
  311. package/lib/test/prune.js +7 -1
  312. package/lib/test/prune.js.map +1 -1
  313. package/lib/test/vitest.d.ts.map +1 -1
  314. package/lib/test/vitest.js +10 -3
  315. package/lib/test/vitest.js.map +1 -1
  316. package/lib/upstash/redis.d.ts.map +1 -1
  317. package/lib/upstash/redis.js +2 -1
  318. package/lib/upstash/redis.js.map +1 -1
  319. package/lib/util/async-queue.d.ts +35 -0
  320. package/lib/util/async-queue.d.ts.map +1 -0
  321. package/lib/util/async-queue.js +87 -0
  322. package/lib/util/async-queue.js.map +1 -0
  323. package/lib/util/cli.d.ts +37 -0
  324. package/lib/util/cli.d.ts.map +1 -0
  325. package/lib/util/cli.js +90 -0
  326. package/lib/util/cli.js.map +1 -0
  327. package/lib/util/ignore-matcher.d.ts +94 -0
  328. package/lib/util/ignore-matcher.d.ts.map +1 -0
  329. package/lib/util/ignore-matcher.js +616 -0
  330. package/lib/util/ignore-matcher.js.map +1 -0
  331. package/lib/util/logger.d.ts +3 -0
  332. package/lib/util/logger.d.ts.map +1 -0
  333. package/lib/util/logger.js +15 -0
  334. package/lib/util/logger.js.map +1 -0
  335. package/lib/util/retry.d.ts.map +1 -1
  336. package/lib/util/retry.js +0 -1
  337. package/lib/util/retry.js.map +1 -1
  338. package/lib/util/safe-fetch.d.ts.map +1 -1
  339. package/lib/util/safe-fetch.js +2 -1
  340. package/lib/util/safe-fetch.js.map +1 -1
  341. package/lib/util/telemetry/client.d.ts +32 -0
  342. package/lib/util/telemetry/client.d.ts.map +1 -0
  343. package/lib/util/telemetry/client.js +94 -0
  344. package/lib/util/telemetry/client.js.map +1 -0
  345. package/lib/util/telemetry/constants.d.ts +4 -0
  346. package/lib/util/telemetry/constants.d.ts.map +1 -0
  347. package/lib/util/telemetry/constants.js +8 -0
  348. package/lib/util/telemetry/constants.js.map +1 -0
  349. package/lib/util/telemetry/context.d.ts +15 -0
  350. package/lib/util/telemetry/context.d.ts.map +1 -0
  351. package/lib/util/telemetry/context.js +128 -0
  352. package/lib/util/telemetry/context.js.map +1 -0
  353. package/lib/util/telemetry/index.d.ts +3 -0
  354. package/lib/util/telemetry/index.d.ts.map +1 -0
  355. package/lib/util/telemetry/index.js +3 -0
  356. package/lib/util/telemetry/index.js.map +1 -0
  357. package/lib/util/telemetry/types.d.ts +59 -0
  358. package/lib/util/telemetry/types.d.ts.map +1 -0
  359. package/lib/util/telemetry/types.js +1 -0
  360. package/lib/util/telemetry/types.js.map +1 -0
  361. package/lib/util/xdg-paths.d.ts +9 -0
  362. package/lib/util/xdg-paths.d.ts.map +1 -0
  363. package/lib/util/xdg-paths.js +41 -0
  364. package/lib/util/xdg-paths.js.map +1 -0
  365. package/lib/vercel/project.d.ts.map +1 -1
  366. package/lib/vercel/project.js +2 -1
  367. package/lib/vercel/project.js.map +1 -1
  368. package/lib/web/astro.d.ts.map +1 -1
  369. package/lib/web/astro.js +2 -1
  370. package/lib/web/astro.js.map +1 -1
  371. package/lib/web/shadcn.d.ts.map +1 -1
  372. package/lib/web/shadcn.js +2 -1
  373. package/lib/web/shadcn.js.map +1 -1
  374. package/lib/web/vite.d.ts.map +1 -1
  375. package/lib/web/vite.js +3 -2
  376. package/lib/web/vite.js.map +1 -1
  377. package/lib/web/vitepress/dependencies.d.ts.map +1 -1
  378. package/lib/web/vitepress/dependencies.js +2 -1
  379. package/lib/web/vitepress/dependencies.js.map +1 -1
  380. package/lib/web/vitepress/vitepress.d.ts.map +1 -1
  381. package/lib/web/vitepress/vitepress.js +2 -1
  382. package/lib/web/vitepress/vitepress.js.map +1 -1
  383. package/package.json +6 -4
  384. package/src/ai/astro-file.ts +2 -1
  385. package/src/ai/client.ts +3 -2
  386. package/src/alchemy.ts +28 -3
  387. package/src/apply.ts +66 -5
  388. package/src/aws/control/client.ts +4 -4
  389. package/src/aws/control/properties.ts +48 -0
  390. package/src/aws/control/resource.ts +3 -2
  391. package/src/aws/control/types.ts +3988 -6301
  392. package/src/aws/function.ts +9 -8
  393. package/src/aws/oidc/oidc-provider.ts +3 -2
  394. package/src/aws/queue.ts +3 -2
  395. package/src/aws/role.ts +3 -1
  396. package/src/aws/ssm-parameter.ts +2 -1
  397. package/src/cloudflare/account-api-token.ts +3 -2
  398. package/src/cloudflare/ai-gateway.ts +4 -3
  399. package/src/cloudflare/api-error.ts +36 -0
  400. package/src/cloudflare/api.ts +9 -4
  401. package/src/cloudflare/assets.ts +30 -6
  402. package/src/cloudflare/astro.ts +176 -0
  403. package/src/cloudflare/auth.ts +3 -2
  404. package/src/cloudflare/bindings.ts +29 -0
  405. package/src/cloudflare/bound.ts +38 -21
  406. package/src/cloudflare/bucket.ts +15 -8
  407. package/src/cloudflare/bundle/bundle-worker.ts +2 -1
  408. package/src/cloudflare/bundle/nodejs-compat-mode.ts +2 -1
  409. package/src/cloudflare/custom-domain.ts +10 -9
  410. package/src/cloudflare/d1-database.ts +11 -10
  411. package/src/cloudflare/d1-export.ts +2 -1
  412. package/src/cloudflare/d1-import.ts +2 -1
  413. package/src/cloudflare/d1-migrations.ts +2 -1
  414. package/src/cloudflare/dispatch-namespace.ts +281 -0
  415. package/src/cloudflare/dns-records.ts +5 -4
  416. package/src/cloudflare/do-state-store/worker.ts +4 -0
  417. package/src/cloudflare/email-address.ts +203 -0
  418. package/src/cloudflare/email-catch-all.ts +248 -0
  419. package/src/cloudflare/email-routing.ts +230 -0
  420. package/src/cloudflare/email-rule.ts +322 -0
  421. package/src/cloudflare/hyperdrive.ts +5 -4
  422. package/src/cloudflare/images.ts +59 -0
  423. package/src/cloudflare/index.ts +10 -0
  424. package/src/cloudflare/kv-namespace.ts +2 -1
  425. package/src/cloudflare/pipeline.ts +38 -2
  426. package/src/cloudflare/queue-consumer.ts +2 -1
  427. package/src/cloudflare/queue.ts +0 -12
  428. package/src/cloudflare/route.ts +118 -18
  429. package/src/cloudflare/secret.ts +253 -0
  430. package/src/cloudflare/secrets-store.ts +420 -0
  431. package/src/cloudflare/sveltekit.ts +72 -0
  432. package/src/cloudflare/user.ts +2 -1
  433. package/src/cloudflare/vectorize-index.ts +6 -5
  434. package/src/cloudflare/vectorize-metadata-index.ts +2 -1
  435. package/src/cloudflare/website.ts +76 -66
  436. package/src/cloudflare/worker-assets.ts +95 -89
  437. package/src/cloudflare/worker-metadata.ts +20 -1
  438. package/src/cloudflare/worker.ts +116 -18
  439. package/src/cloudflare/wrangler.json.ts +63 -0
  440. package/src/cloudflare/zone.ts +4 -3
  441. package/src/destroy.ts +35 -17
  442. package/src/dns/godaddy.ts +3 -2
  443. package/src/dns/import-dns.ts +2 -1
  444. package/src/esbuild/bundle.ts +2 -1
  445. package/src/fs/copy-file.ts +2 -1
  446. package/src/fs/file.ts +3 -1
  447. package/src/github/client.ts +11 -10
  448. package/src/github/repository-environment.ts +5 -4
  449. package/src/github/secret.ts +7 -6
  450. package/src/index.ts +2 -1
  451. package/src/neon/project.ts +3 -2
  452. package/src/planetscale/api.ts +115 -0
  453. package/src/planetscale/branch.ts +352 -0
  454. package/src/planetscale/database.ts +394 -0
  455. package/src/planetscale/index.ts +4 -0
  456. package/src/planetscale/utils.ts +189 -0
  457. package/src/resource.ts +7 -1
  458. package/src/runtime/plugin.ts +2 -1
  459. package/src/scope.ts +64 -13
  460. package/src/sentry/client-key.ts +5 -4
  461. package/src/sentry/project.ts +5 -4
  462. package/src/sentry/team.ts +5 -4
  463. package/src/stripe/card.ts +2 -1
  464. package/src/stripe/client.ts +3 -2
  465. package/src/stripe/coupon.ts +2 -1
  466. package/src/stripe/customer.ts +2 -1
  467. package/src/stripe/entitlements-feature.ts +2 -1
  468. package/src/stripe/file.ts +2 -1
  469. package/src/stripe/meter.ts +4 -2
  470. package/src/stripe/portal-configuration.ts +2 -1
  471. package/src/stripe/price.ts +2 -1
  472. package/src/stripe/product-feature.ts +2 -1
  473. package/src/stripe/product.ts +2 -1
  474. package/src/stripe/promotion-code.ts +2 -1
  475. package/src/stripe/shipping-rate.ts +2 -1
  476. package/src/stripe/tax-rate.ts +2 -1
  477. package/src/stripe/webhook.ts +3 -2
  478. package/src/test/bun.ts +6 -1
  479. package/src/test/prune.ts +7 -1
  480. package/src/test/vitest.ts +14 -3
  481. package/src/upstash/redis.ts +2 -1
  482. package/src/util/async-queue.ts +97 -0
  483. package/src/util/cli.tsx +221 -0
  484. package/src/util/ignore-matcher.ts +873 -0
  485. package/src/util/logger.ts +17 -0
  486. package/src/util/retry.ts +0 -1
  487. package/src/util/safe-fetch.ts +2 -1
  488. package/src/util/telemetry/client.ts +127 -0
  489. package/src/util/telemetry/constants.ts +13 -0
  490. package/src/util/telemetry/context.ts +154 -0
  491. package/src/util/telemetry/index.ts +2 -0
  492. package/src/util/telemetry/types.ts +83 -0
  493. package/src/util/xdg-paths.ts +48 -0
  494. package/src/vercel/project.ts +2 -1
  495. package/src/web/astro.ts +2 -1
  496. package/src/web/shadcn.ts +2 -1
  497. package/src/web/vite.ts +3 -2
  498. package/src/web/vitepress/dependencies.ts +2 -1
  499. package/src/web/vitepress/vitepress.ts +2 -1
@@ -10,6 +10,7 @@ import { Secret, secret } from "../secret.ts";
10
10
  import { serializeScope } from "../serde.ts";
11
11
  import type { type } from "../type.ts";
12
12
  import { getContentType } from "../util/content-type.ts";
13
+ import { logger } from "../util/logger.ts";
13
14
  import { withExponentialBackoff } from "../util/retry.ts";
14
15
  import { slugify } from "../util/slugify.ts";
15
16
  import { CloudflareApiError, handleApiError } from "./api-error.ts";
@@ -33,6 +34,7 @@ import {
33
34
  bundleWorkerScript,
34
35
  } from "./bundle/bundle-worker.ts";
35
36
  import { isD1Database } from "./d1-database.ts";
37
+ import type { DispatchNamespaceResource } from "./dispatch-namespace.ts";
36
38
  import {
37
39
  DurableObjectNamespace,
38
40
  isDurableObjectNamespace,
@@ -50,6 +52,7 @@ import {
50
52
  listQueueConsumersForWorker,
51
53
  } from "./queue-consumer.ts";
52
54
  import { type QueueResource, isQueue } from "./queue.ts";
55
+ import { Route } from "./route.ts";
53
56
  import { isVectorizeIndex } from "./vectorize-index.ts";
54
57
  import { type AssetUploadResult, uploadAssets } from "./worker-assets.ts";
55
58
  import {
@@ -216,12 +219,45 @@ export interface BaseWorkerProps<
216
219
  */
217
220
  eventSources?: EventSource[];
218
221
 
222
+ /**
223
+ * Routes to create for this worker.
224
+ *
225
+ * Each route maps a URL pattern to this worker script.
226
+ */
227
+ routes?: Array<{
228
+ /**
229
+ * URL pattern for the route
230
+ * @example "sub.example.com/*"
231
+ */
232
+ pattern: string;
233
+ /**
234
+ * Zone ID for the route. If not provided, will be automatically inferred from the route pattern.
235
+ */
236
+ zoneId?: string;
237
+ /**
238
+ * Whether this is a custom domain route
239
+ */
240
+ customDomain?: boolean;
241
+ /**
242
+ * Whether to adopt an existing route with the same pattern if it exists
243
+ * @default false
244
+ */
245
+ adopt?: boolean;
246
+ }>;
247
+
219
248
  /**
220
249
  * The RPC class to use for the worker.
221
250
  *
222
251
  * This is only used when using the rpc property.
223
252
  */
224
253
  rpc?: (new (...args: any[]) => RPC) | type<RPC>;
254
+
255
+ /**
256
+ * Deploy this worker to a dispatch namespace
257
+ *
258
+ * This allows workers to be routed to via dispatch namespace routing rules
259
+ */
260
+ dispatchNamespace?: string | DispatchNamespaceResource;
225
261
  }
226
262
 
227
263
  export interface InlineWorkerProps<
@@ -322,7 +358,7 @@ export type Worker<
322
358
  B extends Bindings | undefined = Bindings | undefined,
323
359
  RPC extends Rpc.WorkerEntrypointBranded = Rpc.WorkerEntrypointBranded,
324
360
  > = Resource<"cloudflare::Worker"> &
325
- Omit<WorkerProps<B>, "url" | "script"> &
361
+ Omit<WorkerProps<B>, "url" | "script" | "routes"> &
326
362
  globalThis.Service & {
327
363
  /** @internal phantom property */
328
364
  __rpc__?: RPC;
@@ -367,6 +403,11 @@ export type Worker<
367
403
  */
368
404
  assets?: AssetsConfig;
369
405
 
406
+ /**
407
+ * The routes that were created for this worker
408
+ */
409
+ routes?: Route[];
410
+
370
411
  // phantom property (for typeof myWorker.Env)
371
412
  Env: B extends Bindings
372
413
  ? {
@@ -383,6 +424,11 @@ export type Worker<
383
424
  * The compatibility flags for the worker
384
425
  */
385
426
  compatibilityFlags: string[];
427
+
428
+ /**
429
+ * The dispatch namespace this worker is deployed to
430
+ */
431
+ dispatchNamespace?: string | DispatchNamespaceResource;
386
432
  };
387
433
 
388
434
  /**
@@ -633,10 +679,9 @@ export function Worker<const B extends Bindings>(
633
679
  return _Worker(id, {
634
680
  ...(props as any),
635
681
  url: true,
636
- compatibilityFlags: [
637
- "nodejs_compat",
638
- ...(props.compatibilityFlags ?? []),
639
- ],
682
+ compatibilityFlags: Array.from(
683
+ new Set(["nodejs_compat", ...(props.compatibilityFlags ?? [])]),
684
+ ),
640
685
  entrypoint: meta!.filename,
641
686
  name: workerName,
642
687
  // adopt because the stub guarnatees that the worker exists
@@ -652,9 +697,10 @@ export function Worker<const B extends Bindings>(
652
697
  "esbuild",
653
698
  // TODO(sam): this is for fetch, why is it a package?
654
699
  "undici",
655
- // TODO(sam): no idea where this came from, feels dangerous to externalize it
656
- "ws",
657
700
  "miniflare",
701
+ "@iarna/toml",
702
+ "cli-*",
703
+ "react*",
658
704
  ],
659
705
  banner: {
660
706
  js: "var __ALCHEMY_RUNTIME__ = true;",
@@ -720,7 +766,7 @@ export function Worker<const B extends Bindings>(
720
766
  const incoming = request.url.startsWith("/")
721
767
  ? new URL(`${worker.url}${request.url}`)
722
768
  : new URL(request.url);
723
- console.log(incoming);
769
+ logger.log(incoming);
724
770
  const proxyURL = new URL(
725
771
  `${incoming.pathname}${incoming.search}${incoming.hash}`,
726
772
  origin,
@@ -851,7 +897,20 @@ export const _Worker = Resource(
851
897
  assetUploadResult,
852
898
  );
853
899
 
854
- await putWorker(api, workerName, scriptBundle, scriptMetadata);
900
+ // Get dispatch namespace if specified
901
+ const dispatchNamespace = props.dispatchNamespace
902
+ ? typeof props.dispatchNamespace === "string"
903
+ ? props.dispatchNamespace
904
+ : props.dispatchNamespace.namespace
905
+ : undefined;
906
+
907
+ await putWorker(
908
+ api,
909
+ workerName,
910
+ scriptBundle,
911
+ scriptMetadata,
912
+ dispatchNamespace,
913
+ );
855
914
 
856
915
  for (const workflow of workflowsBindings) {
857
916
  if (
@@ -935,6 +994,8 @@ export const _Worker = Resource(
935
994
  // we are writing a stub worker (to remove binding/event source dependencies)
936
995
  // queue consumers will no longer exist by this point
937
996
  eventSources: undefined,
997
+ // stub worker doesn't need dispatch namespace
998
+ dispatchNamespace: undefined,
938
999
  });
939
1000
 
940
1001
  await withExponentialBackoff(
@@ -969,6 +1030,38 @@ export const _Worker = Resource(
969
1030
 
970
1031
  const { scriptMetadata, workerUrl, now } = await uploadWorkerScript(props);
971
1032
 
1033
+ // Create routes if provided and capture their outputs
1034
+ let createdRoutes: Route[] = [];
1035
+ if (props.routes && props.routes.length > 0) {
1036
+ // Validate for duplicate patterns
1037
+ const patterns = props.routes.map((route) => route.pattern);
1038
+ const duplicates = patterns.filter(
1039
+ (pattern, index) => patterns.indexOf(pattern) !== index,
1040
+ );
1041
+ if (duplicates.length > 0) {
1042
+ throw new Error(
1043
+ `Duplicate route patterns found: ${duplicates.join(", ")}`,
1044
+ );
1045
+ }
1046
+
1047
+ // Create Route resources for each route and capture their outputs
1048
+ createdRoutes = await Promise.all(
1049
+ props.routes.map(async (routeConfig) => {
1050
+ return await Route(routeConfig.pattern, {
1051
+ pattern: routeConfig.pattern,
1052
+ script: workerName,
1053
+ zoneId: routeConfig.zoneId, // Route resource will handle inference if not provided
1054
+ adopt: routeConfig.adopt ?? false,
1055
+ accountId: props.accountId,
1056
+ apiKey: props.apiKey,
1057
+ apiToken: props.apiToken,
1058
+ baseUrl: props.baseUrl,
1059
+ email: props.email,
1060
+ });
1061
+ }),
1062
+ );
1063
+ }
1064
+
972
1065
  function exportBindings() {
973
1066
  return Object.fromEntries(
974
1067
  Object.entries(props.bindings ?? ({} as B)).map(
@@ -1014,6 +1107,10 @@ export const _Worker = Resource(
1014
1107
  assets: props.assets,
1015
1108
  // Include cron triggers in the output
1016
1109
  crons: props.crons,
1110
+ // Include the created routes in the output
1111
+ routes: createdRoutes.length > 0 ? createdRoutes : undefined,
1112
+ // Include the dispatch namespace in the output
1113
+ dispatchNamespace: props.dispatchNamespace,
1017
1114
  // phantom property
1018
1115
  Env: undefined!,
1019
1116
  } as unknown as Worker<B>);
@@ -1048,7 +1145,7 @@ export async function deleteWorker<B extends Bindings>(
1048
1145
  },
1049
1146
  );
1050
1147
  } catch (error) {
1051
- console.warn("Failed to disable worker URL during deletion:", error);
1148
+ logger.warn("Failed to disable worker URL during deletion:", error);
1052
1149
  }
1053
1150
  }
1054
1151
 
@@ -1061,6 +1158,7 @@ export async function putWorker(
1061
1158
  workerName: string,
1062
1159
  scriptBundle: string | NoBundleResult,
1063
1160
  scriptMetadata: WorkerMetadata,
1161
+ dispatchNamespace?: string,
1064
1162
  ) {
1065
1163
  return withExponentialBackoff(
1066
1164
  async () => {
@@ -1103,15 +1201,15 @@ export async function putWorker(
1103
1201
  );
1104
1202
 
1105
1203
  // Upload worker script with bindings
1106
- const uploadResponse = await api.put(
1107
- `/accounts/${api.accountId}/workers/scripts/${workerName}`,
1108
- formData,
1109
- {
1110
- headers: {
1111
- "Content-Type": "multipart/form-data",
1112
- },
1204
+ const endpoint = dispatchNamespace
1205
+ ? `/accounts/${api.accountId}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${workerName}`
1206
+ : `/accounts/${api.accountId}/workers/scripts/${workerName}`;
1207
+
1208
+ const uploadResponse = await api.put(endpoint, formData, {
1209
+ headers: {
1210
+ "Content-Type": "multipart/form-data",
1113
1211
  },
1114
- );
1212
+ });
1115
1213
 
1116
1214
  // Check if the upload was successful
1117
1215
  if (!uploadResponse.ok) {
@@ -197,6 +197,13 @@ export interface WranglerJsonSpec {
197
197
  binding: string;
198
198
  };
199
199
 
200
+ /**
201
+ * Images bindings
202
+ */
203
+ images?: {
204
+ binding: string;
205
+ };
206
+
200
207
  /**
201
208
  * KV Namespace bindings
202
209
  */
@@ -341,12 +348,29 @@ export interface WranglerJsonSpec {
341
348
  */
342
349
  pipelines?: { binding: string; pipeline: string }[];
343
350
 
351
+ /**
352
+ * Secrets Store bindings
353
+ */
354
+ secrets_store_secrets?: {
355
+ binding: string;
356
+ store_id: string;
357
+ secret_name: string;
358
+ }[];
359
+
344
360
  /**
345
361
  * Version metadata bindings
346
362
  */
347
363
  version_metadata?: {
348
364
  binding: string;
349
365
  };
366
+
367
+ /**
368
+ * Dispatch namespace bindings
369
+ */
370
+ dispatch_namespaces?: {
371
+ binding: string;
372
+ namespace: string;
373
+ }[];
350
374
  }
351
375
 
352
376
  /**
@@ -408,6 +432,15 @@ function processBindings(
408
432
  localConnectionString: string;
409
433
  }[] = [];
410
434
  const pipelines: { binding: string; pipeline: string }[] = [];
435
+ const secretsStoreSecrets: {
436
+ binding: string;
437
+ store_id: string;
438
+ secret_name: string;
439
+ }[] = [];
440
+ const dispatchNamespaces: {
441
+ binding: string;
442
+ namespace: string;
443
+ }[] = [];
411
444
 
412
445
  for (const eventSource of eventSources ?? []) {
413
446
  if (isQueueEventSource(eventSource)) {
@@ -523,6 +556,13 @@ function processBindings(
523
556
  spec.ai = {
524
557
  binding: bindingName,
525
558
  };
559
+ } else if (binding.type === "images") {
560
+ if (spec.images) {
561
+ throw new Error(`Images already bound to ${spec.images.binding}`);
562
+ }
563
+ spec.images = {
564
+ binding: bindingName,
565
+ };
526
566
  } else if (binding.type === "analytics_engine") {
527
567
  analyticsEngineDatasets.push({
528
568
  binding: bindingName,
@@ -556,6 +596,21 @@ function processBindings(
556
596
  });
557
597
  } else if (binding.type === "json") {
558
598
  // TODO(sam): anything to do here? not sure wrangler.json supports this
599
+ } else if (binding.type === "secrets_store") {
600
+ if (binding.secrets) {
601
+ for (const [secretName, _secret] of Object.entries(binding.secrets)) {
602
+ secretsStoreSecrets.push({
603
+ binding: bindingName,
604
+ store_id: binding.id,
605
+ secret_name: secretName,
606
+ });
607
+ }
608
+ }
609
+ } else if (binding.type === "dispatch_namespace") {
610
+ dispatchNamespaces.push({
611
+ binding: bindingName,
612
+ namespace: binding.namespaceName,
613
+ });
559
614
  } else {
560
615
  // biome-ignore lint/correctness/noVoidTypeReturn: it returns never
561
616
  return assertNever(binding);
@@ -618,4 +673,12 @@ function processBindings(
618
673
  if (pipelines.length > 0) {
619
674
  spec.pipelines = pipelines;
620
675
  }
676
+
677
+ if (secretsStoreSecrets.length > 0) {
678
+ spec.secrets_store_secrets = secretsStoreSecrets;
679
+ }
680
+
681
+ if (dispatchNamespaces.length > 0) {
682
+ spec.dispatch_namespaces = dispatchNamespaces;
683
+ }
621
684
  }
@@ -1,5 +1,6 @@
1
1
  import type { Context } from "../context.ts";
2
2
  import { Resource } from "../resource.ts";
3
+ import { logger } from "../util/logger.ts";
3
4
  import { handleApiError } from "./api-error.ts";
4
5
  import { createCloudflareApi, type CloudflareApiOptions } from "./api.ts";
5
6
  import type {
@@ -329,7 +330,7 @@ export const Zone = Resource(
329
330
  );
330
331
  }
331
332
  } else {
332
- console.warn(`Zone '${props.name}' not found, skipping delete`);
333
+ logger.warn(`Zone '${props.name}' not found, skipping delete`);
333
334
  }
334
335
  return this.destroy();
335
336
  }
@@ -387,7 +388,7 @@ export const Zone = Resource(
387
388
  if (!response.ok) {
388
389
  if (response.status === 400 && body.includes("already exists")) {
389
390
  // Zone already exists, fetch it instead
390
- console.warn(
391
+ logger.warn(
391
392
  `Zone '${props.name}' already exists during Zone create, adopting it...`,
392
393
  );
393
394
  const getResponse = await api.get(`/zones?name=${props.name}`);
@@ -488,7 +489,7 @@ async function updateZoneSettings(
488
489
  if (!response.ok) {
489
490
  const data = await response.text();
490
491
  if (response.status === 400 && data.includes("already enabled")) {
491
- console.warn(`Warning: Setting '${key}' already enabled`);
492
+ logger.warn(`Warning: Setting '${key}' already enabled`);
492
493
  return;
493
494
  }
494
495
  throw new Error(
package/src/destroy.ts CHANGED
@@ -10,6 +10,8 @@ import {
10
10
  ResourceSeq,
11
11
  } from "./resource.ts";
12
12
  import { Scope } from "./scope.ts";
13
+ import { formatFQN } from "./util/cli.tsx";
14
+ import { logger } from "./util/logger.ts";
13
15
 
14
16
  export class DestroyedSignal extends Error {}
15
17
 
@@ -37,18 +39,21 @@ export async function destroy<Type extends string>(
37
39
  ...(args[1] ?? {}),
38
40
  } satisfies DestroyOptions;
39
41
 
40
- // destroy all active resources
41
- await destroyAll(Array.from(scope.resources.values()), options);
42
-
43
- // then detect orphans and destroy them
44
- const orphans = await scope.state.all();
45
- await destroyAll(
46
- Object.values(orphans).map((orphan) => ({
47
- ...orphan.output,
48
- Scope: scope,
49
- })),
50
- options,
51
- );
42
+ await scope.run(async () => {
43
+ // destroy all active resources
44
+ await destroyAll(Array.from(scope.resources.values()), options);
45
+
46
+ // then detect orphans and destroy them
47
+ const orphans = await scope.state.all();
48
+ await destroyAll(
49
+ Object.values(orphans).map((orphan) => ({
50
+ ...orphan.output,
51
+ Scope: scope,
52
+ })),
53
+ options,
54
+ );
55
+ });
56
+
52
57
  // finally, destroy the scope container
53
58
  await scope.deinit();
54
59
  return;
@@ -65,7 +70,7 @@ export async function destroy<Type extends string>(
65
70
  parent: instance[ResourceScope],
66
71
  scopeName: instance[ResourceID],
67
72
  });
68
- console.log("Destroying scope", scope.chain.join("/"));
73
+ logger.log("Destroying scope", scope.chain.join("/"));
69
74
  return await destroy(scope, options);
70
75
  }
71
76
 
@@ -78,13 +83,19 @@ export async function destroy<Type extends string>(
78
83
 
79
84
  const scope = instance[ResourceScope];
80
85
  if (!scope) {
81
- console.warn(`Resource "${instance[ResourceFQN]}" has no scope`);
86
+ logger.warn(`Resource "${instance[ResourceFQN]}" has no scope`);
82
87
  }
83
88
  const quiet = options?.quiet ?? scope.quiet;
84
89
 
85
90
  try {
86
91
  if (!quiet) {
87
- console.log(`Delete: "${instance[ResourceFQN]}"`);
92
+ logger.task(instance[ResourceFQN], {
93
+ prefix: "DELETING",
94
+ prefixColor: "magenta",
95
+ resource: formatFQN(instance[ResourceFQN]),
96
+ message: "Deleting Resource...",
97
+ });
98
+ logger.log(`Delete: "${instance[ResourceFQN]}"`);
88
99
  }
89
100
 
90
101
  const state = await scope.state.get(instance[ResourceID]);
@@ -140,10 +151,17 @@ export async function destroy<Type extends string>(
140
151
  await scope.delete(instance[ResourceID]);
141
152
 
142
153
  if (!quiet) {
143
- console.log(`Deleted: "${instance[ResourceFQN]}"`);
154
+ logger.task(instance[ResourceFQN], {
155
+ prefix: "DELETED",
156
+ prefixColor: "greenBright",
157
+ resource: formatFQN(instance[ResourceFQN]),
158
+ message: "Deleted Resource",
159
+ status: "success",
160
+ });
161
+ logger.log(`Deleted: "${instance[ResourceFQN]}"`);
144
162
  }
145
163
  } catch (error) {
146
- console.error(error);
164
+ logger.error(error);
147
165
  throw error;
148
166
  }
149
167
  }
@@ -1,3 +1,4 @@
1
+ import { logger } from "../util/logger.ts";
1
2
  import { safeFetch } from "../util/safe-fetch.ts";
2
3
 
3
4
  export type UpdateNameserversOptions = {
@@ -23,9 +24,9 @@ export async function updateNameservers(options: UpdateNameserversOptions) {
23
24
  });
24
25
 
25
26
  if (response.ok) {
26
- console.log(`✅ Nameservers updated for ${options.domain}`);
27
+ logger.log(`✅ Nameservers updated for ${options.domain}`);
27
28
  } else {
28
29
  const error = await response.json();
29
- console.error("❌ Failed to update nameservers:", error);
30
+ logger.error("❌ Failed to update nameservers:", error);
30
31
  }
31
32
  }
@@ -1,5 +1,6 @@
1
1
  import type { Context } from "../context.ts";
2
2
  import { Resource } from "../resource.ts";
3
+ import { logger } from "../util/logger.ts";
3
4
  import { DEFAULT_RECORD_TYPES, type DnsRecordType } from "./record.ts";
4
5
 
5
6
  /**
@@ -195,7 +196,7 @@ export const ImportDnsRecords = Resource(
195
196
  allRecords.push(...compatRecords);
196
197
  }
197
198
  } catch (error) {
198
- console.warn(
199
+ logger.warn(
199
200
  `Failed to fetch ${type} records for ${props.domain}:`,
200
201
  error,
201
202
  );
@@ -4,6 +4,7 @@ import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import type { Context } from "../context.ts";
6
6
  import { Resource } from "../resource.ts";
7
+ import { logger } from "../util/logger.ts";
7
8
 
8
9
  /**
9
10
  * Properties for creating or updating an esbuild bundle
@@ -199,7 +200,7 @@ export async function bundle(props: BundleProps) {
199
200
  metafile: true,
200
201
  };
201
202
  if (process.env.DEBUG) {
202
- console.log(options);
203
+ logger.log(options);
203
204
  }
204
205
  const esbuild = await import("esbuild");
205
206
  return await esbuild.build(options);
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import type { Context } from "../context.ts";
3
3
  import { Resource } from "../resource.ts";
4
4
  import { ignore } from "../util/ignore.ts";
5
+ import { logger } from "../util/logger.ts";
5
6
 
6
7
  /**
7
8
  * Properties for creating a CopyFile resource
@@ -107,7 +108,7 @@ export const CopyFile = Resource(
107
108
  createdAt: Date.now(),
108
109
  });
109
110
  } catch (error) {
110
- console.error(`Error copying file from ${src} to ${dest}:`, error);
111
+ logger.error("Error copying file:", error);
111
112
  throw error;
112
113
  }
113
114
  },
package/src/fs/file.ts CHANGED
@@ -3,6 +3,7 @@ import path from "node:path";
3
3
  import type { Context } from "../context.ts";
4
4
  import { Resource } from "../resource.ts";
5
5
  import { ignore } from "../util/ignore.ts";
6
+ import { logger } from "../util/logger.ts";
6
7
 
7
8
  import { alchemy } from "../alchemy.ts";
8
9
  import type { FileCollection } from "./file-collection.ts";
@@ -176,7 +177,7 @@ export const File = Resource(
176
177
  this.output.path !== filePath
177
178
  ) {
178
179
  // If path has changed, delete the old file
179
- console.log(
180
+ logger.log(
180
181
  `File: Path changed from ${this.output.path} to ${filePath}, removing old file`,
181
182
  );
182
183
  await ignore("ENOENT", async () => fs.promises.unlink(this.output.path));
@@ -186,6 +187,7 @@ export const File = Resource(
186
187
  await fs.promises.mkdir(path.dirname(filePath), {
187
188
  recursive: true,
188
189
  });
190
+
189
191
  await fs.promises.writeFile(filePath, props.content);
190
192
 
191
193
  return this({
@@ -1,6 +1,7 @@
1
1
  import { Octokit } from "@octokit/rest";
2
2
  import { exec } from "node:child_process";
3
3
  import { promisify } from "node:util";
4
+ import { logger } from "../util/logger.ts";
4
5
 
5
6
  // Convert exec to promise-based
6
7
  const execAsync = promisify(exec);
@@ -77,36 +78,36 @@ export async function verifyGitHubAuth(
77
78
  });
78
79
  } catch (error: any) {
79
80
  if (error.status === 401) {
80
- console.error(
81
+ logger.error(
81
82
  "\n⚠️ GitHub authentication failed. Please try one of the following:",
82
83
  );
83
- console.error(
84
+ logger.error(
84
85
  "1. Run 'gh auth login' to authenticate with the GitHub CLI",
85
86
  );
86
- console.error(
87
+ logger.error(
87
88
  "2. Set the GITHUB_TOKEN environment variable with a personal access token",
88
89
  );
89
- console.error("3. Pass a token directly to the constructor");
90
- console.error(
90
+ logger.error("3. Pass a token directly to the constructor");
91
+ logger.error(
91
92
  "\nTo create a token, visit: https://github.com/settings/tokens",
92
93
  );
93
- console.error(
94
+ logger.error(
94
95
  "Required scopes: 'repo' for private repos or 'public_repo' for public repos\n",
95
96
  );
96
97
  throw new Error("GitHub authentication failed");
97
98
  }
98
99
  if (error.status === 403) {
99
- console.error(
100
+ logger.error(
100
101
  "\n⚠️ Insufficient permissions. You need admin access to the repository.",
101
102
  );
102
- console.error(
103
+ logger.error(
103
104
  "Make sure your token has the 'repo' scope for private repos or 'public_repo' for public repos\n",
104
105
  );
105
106
  throw new Error("Insufficient GitHub permissions");
106
107
  }
107
108
  if (error.status === 404) {
108
- console.error(`\n⚠️ Repository not found: ${owner}/${repo}`);
109
- console.error(
109
+ logger.error(`\n⚠️ Repository not found: ${owner}/${repo}`);
110
+ logger.error(
110
111
  "Make sure the repository exists and you have access to it\n",
111
112
  );
112
113
  throw new Error("GitHub repository not found");
@@ -1,5 +1,6 @@
1
1
  import type { Context } from "../context.ts";
2
2
  import { Resource } from "../resource.ts";
3
+ import { logger } from "../util/logger.ts";
3
4
  import { createGitHubClient, verifyGitHubAuth } from "./client.ts";
4
5
 
5
6
  /**
@@ -198,7 +199,7 @@ export const RepositoryEnvironment = Resource(
198
199
  } catch (error: any) {
199
200
  // Ignore 404 errors (environment already deleted)
200
201
  if (error.status === 404) {
201
- console.log("Environment doesn't exist, ignoring");
202
+ logger.log("Environment doesn't exist, ignoring");
202
203
  } else {
203
204
  throw error;
204
205
  }
@@ -447,14 +448,14 @@ export const RepositoryEnvironment = Resource(
447
448
  error.status === 403 &&
448
449
  error.message?.includes("Must have admin rights")
449
450
  ) {
450
- console.error(
451
+ logger.error(
451
452
  "\n⚠️ Error creating/updating GitHub environment: You must have admin rights to the repository.",
452
453
  );
453
- console.error(
454
+ logger.error(
454
455
  "Make sure your GitHub token has the required permissions (repo scope for private repos).\n",
455
456
  );
456
457
  } else {
457
- console.error(
458
+ logger.error(
458
459
  "Error creating/updating GitHub environment:",
459
460
  error.message,
460
461
  );