alchemy 0.16.9 → 0.17.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 (429) hide show
  1. package/lib/ai/astro-file.d.ts +1 -1
  2. package/lib/ai/astro-file.d.ts.map +1 -1
  3. package/lib/ai/astro-file.js +1 -1
  4. package/lib/ai/astro-file.js.map +1 -1
  5. package/lib/ai/client.js +2 -2
  6. package/lib/ai/client.js.map +1 -1
  7. package/lib/ai/css-file.d.ts +1 -1
  8. package/lib/ai/css-file.d.ts.map +1 -1
  9. package/lib/ai/css-file.js +1 -1
  10. package/lib/ai/css-file.js.map +1 -1
  11. package/lib/ai/data.d.ts +1 -1
  12. package/lib/ai/data.d.ts.map +1 -1
  13. package/lib/ai/data.js +1 -1
  14. package/lib/ai/data.js.map +1 -1
  15. package/lib/ai/html-file.d.ts +1 -1
  16. package/lib/ai/html-file.d.ts.map +1 -1
  17. package/lib/ai/html-file.js +1 -1
  18. package/lib/ai/html-file.js.map +1 -1
  19. package/lib/ai/json-file.d.ts +1 -1
  20. package/lib/ai/json-file.d.ts.map +1 -1
  21. package/lib/ai/json-file.js +1 -1
  22. package/lib/ai/json-file.js.map +1 -1
  23. package/lib/ai/typescript-file.d.ts +1 -1
  24. package/lib/ai/typescript-file.d.ts.map +1 -1
  25. package/lib/ai/typescript-file.js +1 -1
  26. package/lib/ai/typescript-file.js.map +1 -1
  27. package/lib/ai/vue-file.d.ts +1 -1
  28. package/lib/ai/vue-file.d.ts.map +1 -1
  29. package/lib/ai/vue-file.js +1 -1
  30. package/lib/ai/vue-file.js.map +1 -1
  31. package/lib/ai/yaml-file.d.ts +1 -1
  32. package/lib/ai/yaml-file.d.ts.map +1 -1
  33. package/lib/ai/yaml-file.js +2 -2
  34. package/lib/ai/yaml-file.js.map +1 -1
  35. package/lib/alchemy.d.ts +4 -0
  36. package/lib/alchemy.d.ts.map +1 -1
  37. package/lib/alchemy.js +14 -4
  38. package/lib/alchemy.js.map +1 -1
  39. package/lib/apply.d.ts +2 -0
  40. package/lib/apply.d.ts.map +1 -1
  41. package/lib/apply.js +17 -2
  42. package/lib/apply.js.map +1 -1
  43. package/lib/aws/bucket.d.ts +1 -1
  44. package/lib/aws/bucket.d.ts.map +1 -1
  45. package/lib/aws/bucket.js +1 -1
  46. package/lib/aws/bucket.js.map +1 -1
  47. package/lib/aws/function.d.ts +1 -1
  48. package/lib/aws/function.d.ts.map +1 -1
  49. package/lib/aws/function.js +2 -2
  50. package/lib/aws/function.js.map +1 -1
  51. package/lib/aws/oidc/oidc-provider.d.ts +1 -1
  52. package/lib/aws/oidc/oidc-provider.d.ts.map +1 -1
  53. package/lib/aws/oidc/oidc-provider.js +1 -1
  54. package/lib/aws/oidc/oidc-provider.js.map +1 -1
  55. package/lib/aws/policy-attachment.d.ts +1 -1
  56. package/lib/aws/policy-attachment.d.ts.map +1 -1
  57. package/lib/aws/policy-attachment.js +1 -1
  58. package/lib/aws/policy-attachment.js.map +1 -1
  59. package/lib/aws/policy.d.ts +1 -1
  60. package/lib/aws/policy.d.ts.map +1 -1
  61. package/lib/aws/policy.js +1 -1
  62. package/lib/aws/policy.js.map +1 -1
  63. package/lib/aws/queue.d.ts +1 -1
  64. package/lib/aws/queue.d.ts.map +1 -1
  65. package/lib/aws/queue.js +20 -25
  66. package/lib/aws/queue.js.map +1 -1
  67. package/lib/aws/role.d.ts +1 -1
  68. package/lib/aws/role.d.ts.map +1 -1
  69. package/lib/aws/role.js +1 -1
  70. package/lib/aws/role.js.map +1 -1
  71. package/lib/aws/ses.d.ts +1 -1
  72. package/lib/aws/ses.d.ts.map +1 -1
  73. package/lib/aws/ses.js +1 -1
  74. package/lib/aws/ses.js.map +1 -1
  75. package/lib/aws/table.d.ts +1 -1
  76. package/lib/aws/table.d.ts.map +1 -1
  77. package/lib/aws/table.js +1 -1
  78. package/lib/aws/table.js.map +1 -1
  79. package/lib/cloudflare/account-api-token.d.ts +1 -1
  80. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  81. package/lib/cloudflare/account-api-token.js +1 -1
  82. package/lib/cloudflare/account-api-token.js.map +1 -1
  83. package/lib/cloudflare/ai-gateway.d.ts +4 -3
  84. package/lib/cloudflare/ai-gateway.d.ts.map +1 -1
  85. package/lib/cloudflare/ai-gateway.js +13 -1
  86. package/lib/cloudflare/ai-gateway.js.map +1 -1
  87. package/lib/cloudflare/analytics-engine.d.ts +21 -0
  88. package/lib/cloudflare/analytics-engine.d.ts.map +1 -0
  89. package/lib/cloudflare/analytics-engine.js +17 -0
  90. package/lib/cloudflare/analytics-engine.js.map +1 -0
  91. package/lib/cloudflare/api-error.js +1 -1
  92. package/lib/cloudflare/api-error.js.map +1 -1
  93. package/lib/cloudflare/assets.js +2 -2
  94. package/lib/cloudflare/assets.js.map +1 -1
  95. package/lib/cloudflare/auth.js +1 -1
  96. package/lib/cloudflare/auth.js.map +1 -1
  97. package/lib/cloudflare/bindings.d.ts +18 -11
  98. package/lib/cloudflare/bindings.d.ts.map +1 -1
  99. package/lib/cloudflare/bindings.js +6 -0
  100. package/lib/cloudflare/bindings.js.map +1 -1
  101. package/lib/cloudflare/bound.d.ts +12 -10
  102. package/lib/cloudflare/bound.d.ts.map +1 -1
  103. package/lib/cloudflare/bucket.d.ts +6 -4
  104. package/lib/cloudflare/bucket.d.ts.map +1 -1
  105. package/lib/cloudflare/bucket.js +22 -2
  106. package/lib/cloudflare/bucket.js.map +1 -1
  107. package/lib/cloudflare/bundle/bundle-worker.d.ts +1 -0
  108. package/lib/cloudflare/bundle/bundle-worker.d.ts.map +1 -1
  109. package/lib/cloudflare/bundle/bundle-worker.js +4 -2
  110. package/lib/cloudflare/bundle/bundle-worker.js.map +1 -1
  111. package/lib/cloudflare/bundle/nodejs-compat-mode.d.ts +1 -1
  112. package/lib/cloudflare/bundle/nodejs-compat-mode.d.ts.map +1 -1
  113. package/lib/cloudflare/bundle/nodejs-compat-mode.js +2 -2
  114. package/lib/cloudflare/bundle/nodejs-compat-mode.js.map +1 -1
  115. package/lib/cloudflare/bundle/nodejs-compat.js +1 -1
  116. package/lib/cloudflare/bundle/nodejs-compat.js.map +1 -1
  117. package/lib/cloudflare/custom-domain.js +1 -1
  118. package/lib/cloudflare/custom-domain.js.map +1 -1
  119. package/lib/cloudflare/d1-database.d.ts +4 -62
  120. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  121. package/lib/cloudflare/d1-database.js +27 -11
  122. package/lib/cloudflare/d1-database.js.map +1 -1
  123. package/lib/cloudflare/dns-records.d.ts +1 -1
  124. package/lib/cloudflare/dns-records.d.ts.map +1 -1
  125. package/lib/cloudflare/dns-records.js +2 -2
  126. package/lib/cloudflare/dns-records.js.map +1 -1
  127. package/lib/cloudflare/event-source.d.ts +3 -3
  128. package/lib/cloudflare/event-source.d.ts.map +1 -1
  129. package/lib/cloudflare/hyperdrive.d.ts +4 -3
  130. package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
  131. package/lib/cloudflare/hyperdrive.js +9 -1
  132. package/lib/cloudflare/hyperdrive.js.map +1 -1
  133. package/lib/cloudflare/kv-namespace.d.ts +9 -5
  134. package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
  135. package/lib/cloudflare/kv-namespace.js +26 -6
  136. package/lib/cloudflare/kv-namespace.js.map +1 -1
  137. package/lib/cloudflare/permission-groups.d.ts +1 -1
  138. package/lib/cloudflare/permission-groups.d.ts.map +1 -1
  139. package/lib/cloudflare/permission-groups.js +1 -1
  140. package/lib/cloudflare/permission-groups.js.map +1 -1
  141. package/lib/cloudflare/pipeline.d.ts +5 -3
  142. package/lib/cloudflare/pipeline.d.ts.map +1 -1
  143. package/lib/cloudflare/pipeline.js +16 -2
  144. package/lib/cloudflare/pipeline.js.map +1 -1
  145. package/lib/cloudflare/queue-consumer.d.ts +3 -3
  146. package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
  147. package/lib/cloudflare/queue-consumer.js +1 -1
  148. package/lib/cloudflare/queue-consumer.js.map +1 -1
  149. package/lib/cloudflare/queue.d.ts +34 -22
  150. package/lib/cloudflare/queue.d.ts.map +1 -1
  151. package/lib/cloudflare/queue.js +66 -4
  152. package/lib/cloudflare/queue.js.map +1 -1
  153. package/lib/cloudflare/route.d.ts +1 -1
  154. package/lib/cloudflare/route.d.ts.map +1 -1
  155. package/lib/cloudflare/route.js +1 -1
  156. package/lib/cloudflare/route.js.map +1 -1
  157. package/lib/cloudflare/types.js +1 -1
  158. package/lib/cloudflare/types.js.map +1 -1
  159. package/lib/cloudflare/vectorize-index.d.ts +6 -4
  160. package/lib/cloudflare/vectorize-index.d.ts.map +1 -1
  161. package/lib/cloudflare/vectorize-index.js +20 -3
  162. package/lib/cloudflare/vectorize-index.js.map +1 -1
  163. package/lib/cloudflare/vectorize-metadata-index.d.ts +4 -3
  164. package/lib/cloudflare/vectorize-metadata-index.d.ts.map +1 -1
  165. package/lib/cloudflare/vectorize-metadata-index.js +5 -2
  166. package/lib/cloudflare/vectorize-metadata-index.js.map +1 -1
  167. package/lib/cloudflare/website.d.ts.map +1 -1
  168. package/lib/cloudflare/website.js +3 -0
  169. package/lib/cloudflare/website.js.map +1 -1
  170. package/lib/cloudflare/worker-assets.d.ts +32 -0
  171. package/lib/cloudflare/worker-assets.d.ts.map +1 -0
  172. package/lib/cloudflare/worker-assets.js +143 -0
  173. package/lib/cloudflare/worker-assets.js.map +1 -0
  174. package/lib/cloudflare/worker-metadata.d.ts +31 -0
  175. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  176. package/lib/cloudflare/worker-metadata.js +248 -0
  177. package/lib/cloudflare/worker-metadata.js.map +1 -1
  178. package/lib/cloudflare/worker-stub.d.ts +40 -0
  179. package/lib/cloudflare/worker-stub.d.ts.map +1 -0
  180. package/lib/cloudflare/worker-stub.js +86 -0
  181. package/lib/cloudflare/worker-stub.js.map +1 -0
  182. package/lib/cloudflare/worker.d.ts +57 -28
  183. package/lib/cloudflare/worker.d.ts.map +1 -1
  184. package/lib/cloudflare/worker.js +203 -472
  185. package/lib/cloudflare/worker.js.map +1 -1
  186. package/lib/cloudflare/wrangler.json.d.ts +29 -1
  187. package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
  188. package/lib/cloudflare/wrangler.json.js +50 -2
  189. package/lib/cloudflare/wrangler.json.js.map +1 -1
  190. package/lib/cloudflare/zone.d.ts +1 -1
  191. package/lib/cloudflare/zone.d.ts.map +1 -1
  192. package/lib/cloudflare/zone.js +1 -1
  193. package/lib/cloudflare/zone.js.map +1 -1
  194. package/lib/destroy.d.ts +1 -4
  195. package/lib/destroy.d.ts.map +1 -1
  196. package/lib/destroy.js +10 -21
  197. package/lib/destroy.js.map +1 -1
  198. package/lib/dns/import-dns.d.ts +1 -1
  199. package/lib/dns/import-dns.d.ts.map +1 -1
  200. package/lib/dns/import-dns.js +1 -1
  201. package/lib/dns/import-dns.js.map +1 -1
  202. package/lib/encrypt.d.ts.map +1 -1
  203. package/lib/encrypt.js +2 -1
  204. package/lib/encrypt.js.map +1 -1
  205. package/lib/env.js +14 -8
  206. package/lib/env.js.map +1 -1
  207. package/lib/esbuild/bundle.d.ts +2 -2
  208. package/lib/esbuild/bundle.d.ts.map +1 -1
  209. package/lib/esbuild/bundle.js +3 -3
  210. package/lib/esbuild/bundle.js.map +1 -1
  211. package/lib/fs/copy-file.d.ts +1 -1
  212. package/lib/fs/copy-file.d.ts.map +1 -1
  213. package/lib/fs/copy-file.js +1 -1
  214. package/lib/fs/copy-file.js.map +1 -1
  215. package/lib/github/client.js +1 -1
  216. package/lib/github/client.js.map +1 -1
  217. package/lib/github/repository-environment.d.ts +1 -1
  218. package/lib/github/repository-environment.d.ts.map +1 -1
  219. package/lib/github/repository-environment.js +2 -2
  220. package/lib/github/repository-environment.js.map +1 -1
  221. package/lib/github/secret.d.ts +1 -1
  222. package/lib/github/secret.d.ts.map +1 -1
  223. package/lib/github/secret.js +1 -1
  224. package/lib/github/secret.js.map +1 -1
  225. package/lib/internal/docs/providers.d.ts +1 -1
  226. package/lib/internal/docs/providers.d.ts.map +1 -1
  227. package/lib/internal/docs/providers.js +3 -1
  228. package/lib/internal/docs/providers.js.map +1 -1
  229. package/lib/neon/api-error.js +2 -2
  230. package/lib/neon/api-error.js.map +1 -1
  231. package/lib/os/exec.js +1 -1
  232. package/lib/os/exec.js.map +1 -1
  233. package/lib/resource.d.ts +13 -11
  234. package/lib/resource.d.ts.map +1 -1
  235. package/lib/resource.js +10 -5
  236. package/lib/resource.js.map +1 -1
  237. package/lib/runtime/bind.d.ts +25 -0
  238. package/lib/runtime/bind.d.ts.map +1 -0
  239. package/lib/runtime/bind.js +76 -0
  240. package/lib/runtime/bind.js.map +1 -0
  241. package/lib/runtime/global.d.ts +8 -0
  242. package/lib/runtime/global.d.ts.map +1 -0
  243. package/lib/runtime/global.js +3 -0
  244. package/lib/runtime/global.js.map +1 -0
  245. package/lib/runtime/plugin.d.ts +35 -0
  246. package/lib/runtime/plugin.d.ts.map +1 -0
  247. package/lib/runtime/plugin.js +133 -0
  248. package/lib/runtime/plugin.js.map +1 -0
  249. package/lib/runtime/shims.d.ts +6 -0
  250. package/lib/runtime/shims.d.ts.map +1 -0
  251. package/lib/runtime/shims.js +27 -0
  252. package/lib/runtime/shims.js.map +1 -0
  253. package/lib/runtime/state.d.ts +5 -0
  254. package/lib/runtime/state.d.ts.map +1 -0
  255. package/lib/runtime/state.js +4 -0
  256. package/lib/runtime/state.js.map +1 -0
  257. package/lib/scope.d.ts +16 -2
  258. package/lib/scope.d.ts.map +1 -1
  259. package/lib/scope.js +56 -9
  260. package/lib/scope.js.map +1 -1
  261. package/lib/secret.d.ts +7 -2
  262. package/lib/secret.d.ts.map +1 -1
  263. package/lib/secret.js +19 -4
  264. package/lib/secret.js.map +1 -1
  265. package/lib/sentry/client-key.d.ts +1 -1
  266. package/lib/sentry/client-key.d.ts.map +1 -1
  267. package/lib/sentry/client-key.js +1 -1
  268. package/lib/sentry/client-key.js.map +1 -1
  269. package/lib/sentry/project.d.ts +1 -1
  270. package/lib/sentry/project.d.ts.map +1 -1
  271. package/lib/sentry/project.js +1 -1
  272. package/lib/sentry/project.js.map +1 -1
  273. package/lib/sentry/team.d.ts +1 -1
  274. package/lib/sentry/team.d.ts.map +1 -1
  275. package/lib/sentry/team.js +1 -1
  276. package/lib/sentry/team.js.map +1 -1
  277. package/lib/serde.d.ts +26 -1
  278. package/lib/serde.d.ts.map +1 -1
  279. package/lib/serde.js +53 -8
  280. package/lib/serde.js.map +1 -1
  281. package/lib/stripe/meter.d.ts +1 -1
  282. package/lib/stripe/meter.d.ts.map +1 -1
  283. package/lib/stripe/meter.js +1 -1
  284. package/lib/stripe/meter.js.map +1 -1
  285. package/lib/stripe/price.d.ts +1 -1
  286. package/lib/stripe/price.d.ts.map +1 -1
  287. package/lib/stripe/price.js +1 -1
  288. package/lib/stripe/price.js.map +1 -1
  289. package/lib/stripe/product.d.ts +1 -1
  290. package/lib/stripe/product.d.ts.map +1 -1
  291. package/lib/stripe/product.js +1 -1
  292. package/lib/stripe/product.js.map +1 -1
  293. package/lib/stripe/webhook.d.ts +1 -1
  294. package/lib/stripe/webhook.d.ts.map +1 -1
  295. package/lib/stripe/webhook.js +1 -1
  296. package/lib/stripe/webhook.js.map +1 -1
  297. package/lib/test/bun.js +1 -1
  298. package/lib/test/bun.js.map +1 -1
  299. package/lib/test/prune.js +1 -1
  300. package/lib/test/prune.js.map +1 -1
  301. package/lib/upstash/redis.d.ts +1 -1
  302. package/lib/upstash/redis.d.ts.map +1 -1
  303. package/lib/upstash/redis.js +1 -1
  304. package/lib/upstash/redis.js.map +1 -1
  305. package/lib/util/assert-never.d.ts +2 -0
  306. package/lib/util/assert-never.d.ts.map +1 -0
  307. package/lib/util/assert-never.js +4 -0
  308. package/lib/util/assert-never.js.map +1 -0
  309. package/lib/util/content-type.d.ts +1 -1
  310. package/lib/util/content-type.d.ts.map +1 -1
  311. package/lib/util/content-type.js +1 -2
  312. package/lib/util/content-type.js.map +1 -1
  313. package/lib/util/retry.d.ts.map +1 -1
  314. package/lib/util/retry.js +1 -0
  315. package/lib/util/retry.js.map +1 -1
  316. package/lib/vercel/project-domain.d.ts +1 -1
  317. package/lib/vercel/project-domain.d.ts.map +1 -1
  318. package/lib/vercel/project-domain.js +1 -1
  319. package/lib/vercel/project-domain.js.map +1 -1
  320. package/lib/vercel/project.js +1 -1
  321. package/lib/vercel/project.js.map +1 -1
  322. package/lib/web/shadcn-component.d.ts +1 -1
  323. package/lib/web/shadcn-component.d.ts.map +1 -1
  324. package/lib/web/shadcn-component.js +1 -1
  325. package/lib/web/shadcn-component.js.map +1 -1
  326. package/lib/web/shadcn.d.ts +1 -1
  327. package/lib/web/shadcn.d.ts.map +1 -1
  328. package/lib/web/shadcn.js +1 -1
  329. package/lib/web/shadcn.js.map +1 -1
  330. package/lib/web/vitepress/dependencies.d.ts +1 -1
  331. package/lib/web/vitepress/dependencies.d.ts.map +1 -1
  332. package/lib/web/vitepress/dependencies.js +1 -1
  333. package/lib/web/vitepress/dependencies.js.map +1 -1
  334. package/lib/web/vitepress/vitepress.js +1 -1
  335. package/lib/web/vitepress/vitepress.js.map +1 -1
  336. package/package.json +2 -1
  337. package/src/ai/astro-file.ts +1 -1
  338. package/src/ai/client.ts +2 -2
  339. package/src/ai/css-file.ts +1 -1
  340. package/src/ai/data.ts +1 -1
  341. package/src/ai/html-file.ts +1 -1
  342. package/src/ai/json-file.ts +1 -1
  343. package/src/ai/typescript-file.ts +1 -1
  344. package/src/ai/vue-file.ts +1 -1
  345. package/src/ai/yaml-file.ts +2 -2
  346. package/src/alchemy.ts +18 -4
  347. package/src/apply.ts +27 -2
  348. package/src/aws/bucket.ts +1 -1
  349. package/src/aws/function.ts +2 -2
  350. package/src/aws/oidc/oidc-provider.ts +1 -1
  351. package/src/aws/policy-attachment.ts +1 -1
  352. package/src/aws/policy.ts +1 -1
  353. package/src/aws/queue.ts +28 -29
  354. package/src/aws/role.ts +1 -1
  355. package/src/aws/ses.ts +1 -1
  356. package/src/aws/table.ts +1 -1
  357. package/src/cloudflare/account-api-token.ts +1 -1
  358. package/src/cloudflare/ai-gateway.ts +23 -4
  359. package/src/cloudflare/analytics-engine.ts +26 -0
  360. package/src/cloudflare/api-error.ts +1 -1
  361. package/src/cloudflare/assets.ts +2 -2
  362. package/src/cloudflare/auth.ts +1 -1
  363. package/src/cloudflare/bindings.ts +35 -18
  364. package/src/cloudflare/bound.ts +27 -23
  365. package/src/cloudflare/bucket.ts +52 -24
  366. package/src/cloudflare/bundle/bundle-worker.ts +5 -2
  367. package/src/cloudflare/bundle/nodejs-compat-mode.ts +3 -3
  368. package/src/cloudflare/bundle/nodejs-compat.ts +1 -1
  369. package/src/cloudflare/custom-domain.ts +1 -1
  370. package/src/cloudflare/d1-database.ts +40 -19
  371. package/src/cloudflare/dns-records.ts +2 -2
  372. package/src/cloudflare/event-source.ts +3 -3
  373. package/src/cloudflare/hyperdrive.ts +19 -4
  374. package/src/cloudflare/kv-namespace.ts +46 -15
  375. package/src/cloudflare/permission-groups.ts +1 -1
  376. package/src/cloudflare/pipeline.ts +29 -6
  377. package/src/cloudflare/queue-consumer.ts +3 -3
  378. package/src/cloudflare/queue.ts +124 -23
  379. package/src/cloudflare/route.ts +1 -1
  380. package/src/cloudflare/types.ts +1 -1
  381. package/src/cloudflare/vectorize-index.ts +36 -8
  382. package/src/cloudflare/vectorize-metadata-index.ts +10 -4
  383. package/src/cloudflare/website.ts +3 -0
  384. package/src/cloudflare/worker-assets.ts +237 -0
  385. package/src/cloudflare/worker-metadata.ts +287 -0
  386. package/src/cloudflare/worker-stub.ts +153 -0
  387. package/src/cloudflare/worker.ts +386 -586
  388. package/src/cloudflare/wrangler.json.ts +75 -2
  389. package/src/cloudflare/zone.ts +1 -1
  390. package/src/destroy.ts +12 -23
  391. package/src/dns/import-dns.ts +1 -1
  392. package/src/encrypt.ts +2 -2
  393. package/src/env.ts +15 -8
  394. package/src/esbuild/bundle.ts +4 -3
  395. package/src/fs/copy-file.ts +1 -1
  396. package/src/github/client.ts +1 -1
  397. package/src/github/repository-environment.ts +2 -2
  398. package/src/github/secret.ts +1 -1
  399. package/src/internal/docs/providers.ts +1 -1
  400. package/src/neon/api-error.ts +2 -2
  401. package/src/os/exec.ts +1 -1
  402. package/src/resource.ts +22 -31
  403. package/src/runtime/bind.ts +95 -0
  404. package/src/runtime/global.ts +10 -0
  405. package/src/runtime/plugin.ts +162 -0
  406. package/src/runtime/shims.js +34 -0
  407. package/src/runtime/state.ts +9 -0
  408. package/src/scope.ts +72 -11
  409. package/src/secret.ts +29 -4
  410. package/src/sentry/client-key.ts +1 -1
  411. package/src/sentry/project.ts +1 -1
  412. package/src/sentry/team.ts +1 -1
  413. package/src/serde.ts +126 -10
  414. package/src/stripe/meter.ts +1 -1
  415. package/src/stripe/price.ts +1 -1
  416. package/src/stripe/product.ts +1 -1
  417. package/src/stripe/webhook.ts +1 -1
  418. package/src/test/bun.ts +1 -1
  419. package/src/test/prune.ts +1 -1
  420. package/src/upstash/redis.ts +1 -1
  421. package/src/util/assert-never.ts +3 -0
  422. package/src/util/content-type.ts +2 -3
  423. package/src/util/retry.ts +1 -0
  424. package/src/vercel/project-domain.ts +1 -1
  425. package/src/vercel/project.ts +1 -1
  426. package/src/web/shadcn-component.ts +1 -1
  427. package/src/web/shadcn.ts +1 -1
  428. package/src/web/vitepress/dependencies.ts +1 -1
  429. package/src/web/vitepress/vitepress.ts +1 -1
@@ -1,5 +1,6 @@
1
1
  import type { Context } from "../context.js";
2
- import { Resource } from "../resource.js";
2
+ import { Resource, ResourceKind } from "../resource.js";
3
+ import { bind, type Bound } from "../runtime/bind.js";
3
4
  import { CloudflareApiError, handleApiError } from "./api-error.js";
4
5
  import {
5
6
  createCloudflareApi,
@@ -93,10 +94,16 @@ export interface D1DatabaseProps extends CloudflareApiOptions {
93
94
  migrationsDir?: string;
94
95
  }
95
96
 
97
+ export function isD1Database(
98
+ resource: Resource,
99
+ ): resource is D1DatabaseResource {
100
+ return resource[ResourceKind] === "cloudflare::D1Database";
101
+ }
102
+
96
103
  /**
97
104
  * Output returned after D1 Database creation/update
98
105
  */
99
- export type D1Database = Resource<"cloudflare::D1Database"> &
106
+ export type D1DatabaseResource = Resource<"cloudflare::D1Database"> &
100
107
  D1DatabaseProps & {
101
108
  type: "d1";
102
109
  /**
@@ -135,6 +142,34 @@ export type D1Database = Resource<"cloudflare::D1Database"> &
135
142
  };
136
143
  };
137
144
 
145
+ export type D1Database = D1DatabaseResource & Bound<D1DatabaseResource>;
146
+
147
+ export async function D1Database(
148
+ id: string,
149
+ props: Omit<D1DatabaseProps, "migrationsFiles">,
150
+ ): Promise<D1Database> {
151
+ const migrationsFiles = props.migrationsDir
152
+ ? await listMigrationsFiles(props.migrationsDir)
153
+ : [];
154
+
155
+ const db = await D1DatabaseResource(id, {
156
+ ...props,
157
+ migrationsFiles,
158
+ });
159
+ const binding = await bind(db);
160
+ return {
161
+ ...db,
162
+ batch: binding.batch,
163
+ exec: binding.exec,
164
+ prepare: binding.prepare,
165
+ withSession: binding.withSession,
166
+ /**
167
+ * @deprecated
168
+ */
169
+ dump: binding.dump,
170
+ };
171
+ }
172
+
138
173
  /**
139
174
  * Creates and manages Cloudflare D1 Databases.
140
175
  *
@@ -194,27 +229,13 @@ export type D1Database = Resource<"cloudflare::D1Database"> &
194
229
  *
195
230
  * @see https://developers.cloudflare.com/d1/
196
231
  */
197
- export async function D1Database(
198
- id: string,
199
- props: Omit<D1DatabaseProps, "migrationsFiles">,
200
- ) {
201
- const migrationsFiles = props.migrationsDir
202
- ? await listMigrationsFiles(props.migrationsDir)
203
- : [];
204
-
205
- return D1DatabaseResource(id, {
206
- ...props,
207
- migrationsFiles,
208
- });
209
- }
210
-
211
- export const D1DatabaseResource = Resource(
232
+ const D1DatabaseResource = Resource(
212
233
  "cloudflare::D1Database",
213
234
  async function (
214
- this: Context<D1Database>,
235
+ this: Context<D1DatabaseResource>,
215
236
  id: string,
216
237
  props: D1DatabaseProps = {},
217
- ): Promise<D1Database> {
238
+ ): Promise<D1DatabaseResource> {
218
239
  const api = await createCloudflareApi(props);
219
240
  const databaseName = props.name ?? id;
220
241
 
@@ -127,7 +127,7 @@ export const DnsRecords = Resource(
127
127
  "cloudflare::DnsRecords",
128
128
  async function (
129
129
  this: Context<DnsRecords>,
130
- id: string,
130
+ _id: string,
131
131
  props: DnsRecordsProps,
132
132
  ): Promise<DnsRecords> {
133
133
  // Create Cloudflare API client
@@ -307,7 +307,7 @@ async function createOrUpdateRecord(
307
307
  zoneId,
308
308
  );
309
309
  }
310
- } catch (err) {
310
+ } catch (_err) {
311
311
  // Fall through to the original error
312
312
  }
313
313
  }
@@ -1,10 +1,10 @@
1
1
  import type { QueueConsumerSettings } from "./queue-consumer.js";
2
- import type { Queue } from "./queue.js";
2
+ import type { QueueResource } from "./queue.js";
3
3
 
4
4
  /**
5
5
  * Base interface for event sources that can be bound to a Worker
6
6
  */
7
- export type EventSource = QueueEventSource | Queue;
7
+ export type EventSource = QueueEventSource | QueueResource;
8
8
 
9
9
  /**
10
10
  * Configuration for a Queue as an event source for a Worker
@@ -13,7 +13,7 @@ export interface QueueEventSource {
13
13
  /**
14
14
  * The queue to consume messages from
15
15
  */
16
- readonly queue: Queue;
16
+ readonly queue: QueueResource;
17
17
 
18
18
  /**
19
19
  * Optional settings for configuring how the Worker consumes the queue
@@ -1,8 +1,10 @@
1
1
  import type { Context } from "../context.js";
2
2
  import { Resource } from "../resource.js";
3
+ import { tryGetBinding } from "../runtime/bind.js";
3
4
  import type { Secret } from "../secret.js";
4
5
  import { handleApiError } from "./api-error.js";
5
6
  import { createCloudflareApi, type CloudflareApiOptions } from "./api.js";
7
+ import type { Bound } from "./bound.js";
6
8
 
7
9
  /**
8
10
  * Origin configuration for a PostgreSQL database connection
@@ -153,7 +155,7 @@ export interface HyperdriveProps extends CloudflareApiOptions {
153
155
  * Output returned after Cloudflare Hyperdrive creation/update.
154
156
  * IMPORTANT: The interface name MUST match the exported resource name.
155
157
  */
156
- export interface Hyperdrive
158
+ export interface HyperdriveResource
157
159
  extends Resource<"cloudflare::Hyperdrive">,
158
160
  Omit<HyperdriveProps, "origin"> {
159
161
  /**
@@ -178,6 +180,8 @@ export interface Hyperdrive
178
180
  type: "hyperdrive";
179
181
  }
180
182
 
183
+ export type Hyperdrive = HyperdriveResource & Bound<HyperdriveResource>;
184
+
181
185
  /**
182
186
  * Represents a Cloudflare Hyperdrive configuration.
183
187
  *
@@ -242,13 +246,24 @@ export interface Hyperdrive
242
246
  * }
243
247
  * });
244
248
  */
245
- export const Hyperdrive = Resource(
249
+ export async function Hyperdrive(
250
+ name: string,
251
+ props: HyperdriveProps,
252
+ ): Promise<Hyperdrive> {
253
+ const resource = await HyperdriveResource(name, props);
254
+ return {
255
+ ...resource,
256
+ ...tryGetBinding(resource),
257
+ } as Hyperdrive;
258
+ }
259
+
260
+ const HyperdriveResource = Resource(
246
261
  "cloudflare::Hyperdrive",
247
262
  async function (
248
- this: Context<Hyperdrive>,
263
+ this: Context<HyperdriveResource>,
249
264
  id: string,
250
265
  props: HyperdriveProps,
251
- ): Promise<Hyperdrive> {
266
+ ): Promise<HyperdriveResource> {
252
267
  const api = await createCloudflareApi(props);
253
268
  const configsPath = `/accounts/${api.accountId}/hyperdrive/configs`;
254
269
 
@@ -1,5 +1,6 @@
1
1
  import type { Context } from "../context.js";
2
- import { Resource } from "../resource.js";
2
+ import { Resource, ResourceKind } from "../resource.js";
3
+ import { bind } from "../runtime/bind.js";
3
4
  import { withExponentialBackoff } from "../util/retry.js";
4
5
  import { handleApiError } from "./api-error.js";
5
6
  import {
@@ -7,6 +8,7 @@ import {
7
8
  type CloudflareApi,
8
9
  type CloudflareApiOptions,
9
10
  } from "./api.js";
11
+ import type { Bound } from "./bound.js";
10
12
 
11
13
  /**
12
14
  * Properties for creating or updating a KV Namespace
@@ -15,7 +17,7 @@ export interface KVNamespaceProps extends CloudflareApiOptions {
15
17
  /**
16
18
  * Title of the namespace
17
19
  */
18
- title: string;
20
+ title?: string;
19
21
 
20
22
  /**
21
23
  * KV pairs to store in the namespace
@@ -70,12 +72,18 @@ export interface KVPair {
70
72
  metadata?: any;
71
73
  }
72
74
 
75
+ export function isKVNamespace(
76
+ resource: Resource,
77
+ ): resource is KVNamespaceResource {
78
+ return resource[ResourceKind] === "cloudflare::KVNamespace";
79
+ }
80
+
73
81
  /**
74
82
  * Output returned after KV Namespace creation/update
75
83
  */
76
- export interface KVNamespace
84
+ export interface KVNamespaceResource
77
85
  extends Resource<"cloudflare::KVNamespace">,
78
- KVNamespaceProps {
86
+ Omit<KVNamespaceProps, "delete"> {
79
87
  type: "kv_namespace";
80
88
  /**
81
89
  * The ID of the namespace
@@ -93,6 +101,8 @@ export interface KVNamespace
93
101
  modifiedAt: number;
94
102
  }
95
103
 
104
+ export type KVNamespace = KVNamespaceResource & Bound<KVNamespaceResource>;
105
+
96
106
  /**
97
107
  * A Cloudflare KV Namespace is a key-value store that can be used to store data for your application.
98
108
  *
@@ -147,16 +157,35 @@ export interface KVNamespace
147
157
  * delete: false
148
158
  * });
149
159
  */
150
- export const KVNamespace = Resource(
160
+
161
+ export async function KVNamespace(
162
+ name: string,
163
+ props: KVNamespaceProps = {},
164
+ ): Promise<KVNamespace> {
165
+ const kv = await _KVNamespace(name, props);
166
+ const binding = await bind(kv);
167
+ return {
168
+ ...kv,
169
+ delete: binding.delete,
170
+ get: binding.get,
171
+ getWithMetadata: binding.getWithMetadata,
172
+ list: binding.list,
173
+ put: binding.put,
174
+ };
175
+ }
176
+
177
+ const _KVNamespace = Resource(
151
178
  "cloudflare::KVNamespace",
152
179
  async function (
153
- this: Context<KVNamespace>,
180
+ this: Context<KVNamespaceResource>,
154
181
  id: string,
155
182
  props: KVNamespaceProps,
156
- ) {
183
+ ): Promise<KVNamespaceResource> {
157
184
  // Create Cloudflare API client with automatic account discovery
158
185
  const api = await createCloudflareApi(props);
159
186
 
187
+ const title = props.title ?? id;
188
+
160
189
  if (this.phase === "delete") {
161
190
  // For delete operations, we need to check if the namespace ID exists in the output
162
191
  const namespaceId = this.output?.namespaceId;
@@ -181,7 +210,10 @@ export const KVNamespace = Resource(
181
210
  } else {
182
211
  try {
183
212
  // Try to create the KV namespace
184
- const { id } = await createKVNamespace(api, props);
213
+ const { id } = await createKVNamespace(api, {
214
+ ...props,
215
+ title,
216
+ });
185
217
  createdAt = Date.now();
186
218
  namespaceId = id;
187
219
  } catch (error) {
@@ -191,16 +223,13 @@ export const KVNamespace = Resource(
191
223
  error instanceof Error &&
192
224
  error.message.includes("already exists")
193
225
  ) {
194
- console.log(`Namespace '${props.title}' already exists, adopting it`);
226
+ console.log(`Namespace '${title}' already exists, adopting it`);
195
227
  // Find the existing namespace by title
196
- const existingNamespace = await findKVNamespaceByTitle(
197
- api,
198
- props.title,
199
- );
228
+ const existingNamespace = await findKVNamespaceByTitle(api, title);
200
229
 
201
230
  if (!existingNamespace) {
202
231
  throw new Error(
203
- `Failed to find existing namespace '${props.title}' for adoption`,
232
+ `Failed to find existing namespace '${title}' for adoption`,
204
233
  );
205
234
  }
206
235
 
@@ -229,7 +258,9 @@ export const KVNamespace = Resource(
229
258
 
230
259
  export async function createKVNamespace(
231
260
  api: CloudflareApi,
232
- props: KVNamespaceProps,
261
+ props: KVNamespaceProps & {
262
+ title: string;
263
+ },
233
264
  ): Promise<{ id: string }> {
234
265
  const createResponse = await api.post(
235
266
  `/accounts/${api.accountId}/storage/kv/namespaces`,
@@ -110,7 +110,7 @@ export const PermissionGroups = Resource(
110
110
  "cloudflare::PermissionGroups",
111
111
  async function (
112
112
  this: Context<PermissionGroups>,
113
- id: string,
113
+ _id: string,
114
114
  options: CloudflareApiOptions = {},
115
115
  ): Promise<PermissionGroups> {
116
116
  // Only create and update phases are supported
@@ -1,12 +1,14 @@
1
1
  import type { Context } from "../context.js";
2
- import { Resource } from "../resource.js";
2
+ import { Resource, ResourceKind } from "../resource.js";
3
+ import { bind } from "../runtime/bind.js";
3
4
  import type { Secret } from "../secret.js";
4
5
  import { CloudflareApiError, handleApiError } from "./api-error.js";
5
6
  import {
6
- type CloudflareApi,
7
7
  createCloudflareApi,
8
+ type CloudflareApi,
8
9
  type CloudflareApiOptions,
9
10
  } from "./api.js";
11
+ import type { Bound } from "./bound.js";
10
12
 
11
13
  /**
12
14
  * Settings for compression of pipeline output
@@ -221,7 +223,7 @@ export interface PipelineRecord {
221
223
  /**
222
224
  * Output returned after Pipeline creation/update
223
225
  */
224
- export interface Pipeline<T extends PipelineRecord = PipelineRecord>
226
+ export interface PipelineResource<_T extends PipelineRecord = PipelineRecord>
225
227
  extends Resource<"cloudflare::Pipeline">,
226
228
  PipelineProps {
227
229
  /**
@@ -250,6 +252,13 @@ export interface Pipeline<T extends PipelineRecord = PipelineRecord>
250
252
  version: number;
251
253
  }
252
254
 
255
+ export function isPipeline(resource: Resource): resource is PipelineResource {
256
+ return resource[ResourceKind] === "cloudflare::Pipeline";
257
+ }
258
+
259
+ export type Pipeline<T extends PipelineRecord = PipelineRecord> =
260
+ PipelineResource<T> & Bound<PipelineResource<T>>;
261
+
253
262
  /**
254
263
  * Creates and manages Cloudflare Pipelines.
255
264
  *
@@ -316,10 +325,24 @@ export interface Pipeline<T extends PipelineRecord = PipelineRecord>
316
325
  *
317
326
  * @see https://developers.cloudflare.com/pipelines/
318
327
  */
319
- export const Pipeline = Resource("cloudflare::Pipeline", async function <
328
+ export async function Pipeline<T extends PipelineRecord = PipelineRecord>(
329
+ name: string,
330
+ props: PipelineProps,
331
+ ): Promise<Pipeline<T>> {
332
+ const pipeline = await PipelineResource(name, props);
333
+ const binding = await bind(pipeline, {
334
+ bindThis: false,
335
+ });
336
+ return {
337
+ ...pipeline,
338
+ send: binding.send,
339
+ };
340
+ }
341
+
342
+ const PipelineResource = Resource("cloudflare::Pipeline", async function <
320
343
  T extends PipelineRecord = PipelineRecord,
321
- >(this: Context<Pipeline<T>>, id: string, props: PipelineProps): Promise<
322
- Pipeline<T>
344
+ >(this: Context<PipelineResource<T>>, id: string, props: PipelineProps): Promise<
345
+ PipelineResource<T>
323
346
  > {
324
347
  const api = await createCloudflareApi(props);
325
348
  const pipelineName = props.name ?? id;
@@ -6,7 +6,7 @@ import {
6
6
  type CloudflareApi,
7
7
  type CloudflareApiOptions,
8
8
  } from "./api.js";
9
- import type { Queue } from "./queue.js";
9
+ import type { QueueResource } from "./queue.js";
10
10
 
11
11
  /**
12
12
  * Settings for configuring a Queue Consumer
@@ -51,7 +51,7 @@ export interface QueueConsumerProps extends CloudflareApiOptions {
51
51
  * The queue to consume
52
52
  * Either queue or queueId must be provided
53
53
  */
54
- queue?: Queue;
54
+ queue?: QueueResource;
55
55
 
56
56
  /**
57
57
  * The queue ID to consume (alternative to providing a queue)
@@ -138,7 +138,7 @@ export const QueueConsumer = Resource(
138
138
  "cloudflare::QueueConsumer",
139
139
  async function (
140
140
  this: Context<QueueConsumer>,
141
- id: string,
141
+ _id: string,
142
142
  props: QueueConsumerProps,
143
143
  ): Promise<QueueConsumer> {
144
144
  const api = await createCloudflareApi(props);
@@ -1,11 +1,13 @@
1
1
  import type { Context } from "../context.js";
2
2
  import { Resource, ResourceKind } from "../resource.js";
3
+ import { bind } from "../runtime/bind.js";
3
4
  import { CloudflareApiError, handleApiError } from "./api-error.js";
4
5
  import {
5
6
  createCloudflareApi,
6
7
  type CloudflareApi,
7
8
  type CloudflareApiOptions,
8
9
  } from "./api.js";
10
+ import type { Bound } from "./bound.js";
9
11
 
10
12
  /**
11
13
  * Settings for a Cloudflare Queue
@@ -56,6 +58,14 @@ export interface QueueProps extends CloudflareApiOptions {
56
58
  * @default true
57
59
  */
58
60
  delete?: boolean;
61
+
62
+ /**
63
+ * Whether to adopt an existing queue with the same name if it exists
64
+ * If true, during creation, if a queue with the same name exists, it will be adopted instead of creating a new one
65
+ *
66
+ * @default false
67
+ */
68
+ adopt?: boolean;
59
69
  }
60
70
 
61
71
  export function isQueue(eventSource: any): eventSource is Queue {
@@ -68,7 +78,7 @@ export function isQueue(eventSource: any): eventSource is Queue {
68
78
  /**
69
79
  * Output returned after Cloudflare Queue creation/update
70
80
  */
71
- export interface Queue<Body = unknown>
81
+ export interface QueueResource<Body = unknown>
72
82
  extends Resource<"cloudflare::Queue">,
73
83
  QueueProps {
74
84
  /**
@@ -104,22 +114,8 @@ export interface Queue<Body = unknown>
104
114
  Batch: MessageBatch<Body>;
105
115
  }
106
116
 
107
- interface CloudflareQueueResponse {
108
- result: {
109
- queue_id?: string;
110
- queue_name: string;
111
- created_on?: string;
112
- modified_on?: string;
113
- settings?: {
114
- delivery_delay?: number;
115
- delivery_paused?: boolean;
116
- message_retention_period?: number;
117
- };
118
- };
119
- success: boolean;
120
- errors: Array<{ code: number; message: string }>;
121
- messages: string[];
122
- }
117
+ export type Queue<Body = unknown> = QueueResource<Body> &
118
+ Bound<QueueResource<Body>>;
123
119
 
124
120
  /**
125
121
  * Creates and manages Cloudflare Queues.
@@ -154,10 +150,23 @@ interface CloudflareQueueResponse {
154
150
  *
155
151
  * @see https://developers.cloudflare.com/queues/
156
152
  */
157
- export const Queue = Resource("cloudflare::Queue", async function <
153
+ export async function Queue<Body = unknown>(
154
+ name: string,
155
+ props: QueueProps = {},
156
+ ): Promise<Queue<Body>> {
157
+ const queue = await QueueResource<Body>(name, props);
158
+ const binding = await bind(queue);
159
+ return {
160
+ ...queue,
161
+ send: binding.send,
162
+ sendBatch: binding.sendBatch,
163
+ } as Queue<Body>;
164
+ }
165
+
166
+ const QueueResource = Resource("cloudflare::Queue", async function <
158
167
  T = unknown,
159
- >(this: Context<Queue<T>>, id: string, props: QueueProps = {}): Promise<
160
- Queue<T>
168
+ >(this: Context<QueueResource<T>>, id: string, props: QueueProps = {}): Promise<
169
+ QueueResource<T>
161
170
  > {
162
171
  const api = await createCloudflareApi(props);
163
172
  const queueName = props.name ?? id;
@@ -166,6 +175,9 @@ export const Queue = Resource("cloudflare::Queue", async function <
166
175
  console.log("Deleting Cloudflare Queue:", queueName);
167
176
  if (props.delete !== false) {
168
177
  // Delete Queue
178
+ if (!this.output?.id) {
179
+ console.log(this.output);
180
+ }
169
181
  await deleteQueue(api, this.output?.id);
170
182
  }
171
183
 
@@ -176,16 +188,35 @@ export const Queue = Resource("cloudflare::Queue", async function <
176
188
 
177
189
  if (this.phase === "create") {
178
190
  console.log("Creating Cloudflare Queue:", queueName);
179
- queueData = await createQueue(api, queueName, props);
191
+ try {
192
+ queueData = await createQueue(api, queueName, props);
193
+ } catch (error) {
194
+ if (error instanceof CloudflareApiError && error.status === 409) {
195
+ if (!props.adopt) {
196
+ throw error;
197
+ }
198
+ // Queue already exists, try to find it by name
199
+ const existingQueue = await findQueueByName(api, queueName);
200
+ if (!existingQueue) {
201
+ throw new Error(
202
+ `Queue with name ${queueName} not found despite 409 conflict`,
203
+ );
204
+ }
205
+ queueData = existingQueue;
206
+ queueData = await updateQueue(api, queueData.result.queue_id!, props);
207
+ } else {
208
+ throw error;
209
+ }
210
+ }
180
211
  } else {
181
212
  // Update operation
182
213
  if (this.output?.id) {
183
214
  console.log("Updating Cloudflare Queue:", queueName);
184
215
 
185
216
  // Check if name is being changed, which is not allowed
186
- if (props.name !== this.output.name) {
217
+ if (queueName !== this.output.name) {
187
218
  throw new Error(
188
- "Cannot update Queue name after creation. Queue name is immutable.",
219
+ `Cannot update Queue name after creation. Queue name is immutable. Before: ${this.output.name}, After: ${queueName}`,
189
220
  );
190
221
  }
191
222
 
@@ -222,6 +253,23 @@ export const Queue = Resource("cloudflare::Queue", async function <
222
253
  });
223
254
  });
224
255
 
256
+ interface CloudflareQueueResponse {
257
+ result: {
258
+ queue_id?: string;
259
+ queue_name: string;
260
+ created_on?: string;
261
+ modified_on?: string;
262
+ settings?: {
263
+ delivery_delay?: number;
264
+ delivery_paused?: boolean;
265
+ message_retention_period?: number;
266
+ };
267
+ };
268
+ success: boolean;
269
+ errors: Array<{ code: number; message: string }>;
270
+ messages: string[];
271
+ }
272
+
225
273
  /**
226
274
  * Create a new Cloudflare Queue
227
275
  */
@@ -391,3 +439,56 @@ export async function listQueues(
391
439
  id: queue.queue_id,
392
440
  }));
393
441
  }
442
+
443
+ /**
444
+ * Find a Cloudflare Queue by name
445
+ */
446
+ export async function findQueueByName(
447
+ api: CloudflareApi,
448
+ queueName: string,
449
+ ): Promise<CloudflareQueueResponse | null> {
450
+ const response = await api.get(`/accounts/${api.accountId}/queues`);
451
+
452
+ if (!response.ok) {
453
+ return await handleApiError(response, "listing", "Queues", "");
454
+ }
455
+
456
+ const data = (await response.json()) as {
457
+ success: boolean;
458
+ errors?: Array<{ code: number; message: string }>;
459
+ result?: Array<{
460
+ queue_name: string;
461
+ queue_id: string;
462
+ created_on?: string;
463
+ modified_on?: string;
464
+ settings?: {
465
+ delivery_delay?: number;
466
+ delivery_paused?: boolean;
467
+ message_retention_period?: number;
468
+ };
469
+ }>;
470
+ };
471
+
472
+ if (!data.success) {
473
+ const errorMessage = data.errors?.[0]?.message || "Unknown error";
474
+ throw new Error(`Failed to list queues: ${errorMessage}`);
475
+ }
476
+
477
+ const queue = data.result?.find((q) => q.queue_name === queueName);
478
+ if (!queue) {
479
+ return null;
480
+ }
481
+
482
+ return {
483
+ result: {
484
+ queue_id: queue.queue_id,
485
+ queue_name: queue.queue_name,
486
+ created_on: queue.created_on,
487
+ modified_on: queue.modified_on,
488
+ settings: queue.settings,
489
+ },
490
+ success: true,
491
+ errors: [],
492
+ messages: [],
493
+ };
494
+ }
@@ -93,7 +93,7 @@ export const Route = Resource(
93
93
  "cloudflare::Route",
94
94
  async function (
95
95
  this: Context<Route>,
96
- id: string,
96
+ _id: string,
97
97
  props: RouteProps,
98
98
  ): Promise<Route> {
99
99
  const api = await createCloudflareApi(props);
@@ -64,7 +64,7 @@ export async function extractCloudflareError(
64
64
  return data.errors.map((e) => `Error ${e.code}: ${e.message}`).join(", ");
65
65
  }
66
66
  return `HTTP ${response.status}: ${response.statusText}`;
67
- } catch (e) {
67
+ } catch {
68
68
  return `HTTP ${response.status}: ${response.statusText}`;
69
69
  }
70
70
  }