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.
- package/README.md +7 -0
- package/lib/ai/astro-file.d.ts.map +1 -1
- package/lib/ai/astro-file.js +2 -1
- package/lib/ai/astro-file.js.map +1 -1
- package/lib/ai/client.d.ts.map +1 -1
- package/lib/ai/client.js +3 -2
- package/lib/ai/client.js.map +1 -1
- package/lib/alchemy.d.ts +7 -0
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +19 -3
- package/lib/alchemy.js.map +1 -1
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +63 -5
- package/lib/apply.js.map +1 -1
- package/lib/aws/control/client.js +4 -3
- package/lib/aws/control/client.js.map +1 -1
- package/lib/aws/control/properties.d.ts +6 -0
- package/lib/aws/control/properties.d.ts.map +1 -1
- package/lib/aws/control/properties.js +48 -0
- package/lib/aws/control/properties.js.map +1 -1
- package/lib/aws/control/resource.d.ts.map +1 -1
- package/lib/aws/control/resource.js +3 -2
- package/lib/aws/control/resource.js.map +1 -1
- package/lib/aws/control/types.d.ts +3969 -4862
- package/lib/aws/control/types.d.ts.map +1 -1
- package/lib/aws/control/types.js.map +1 -1
- package/lib/aws/function.d.ts.map +1 -1
- package/lib/aws/function.js +9 -8
- package/lib/aws/function.js.map +1 -1
- package/lib/aws/oidc/oidc-provider.d.ts.map +1 -1
- package/lib/aws/oidc/oidc-provider.js +3 -2
- package/lib/aws/oidc/oidc-provider.js.map +1 -1
- package/lib/aws/queue.d.ts.map +1 -1
- package/lib/aws/queue.js +3 -2
- package/lib/aws/queue.js.map +1 -1
- package/lib/aws/role.d.ts.map +1 -1
- package/lib/aws/role.js +3 -1
- package/lib/aws/role.js.map +1 -1
- package/lib/aws/ssm-parameter.d.ts.map +1 -1
- package/lib/aws/ssm-parameter.js +2 -1
- package/lib/aws/ssm-parameter.js.map +1 -1
- package/lib/cloudflare/account-api-token.d.ts.map +1 -1
- package/lib/cloudflare/account-api-token.js +3 -2
- package/lib/cloudflare/account-api-token.js.map +1 -1
- package/lib/cloudflare/ai-gateway.d.ts.map +1 -1
- package/lib/cloudflare/ai-gateway.js +4 -3
- package/lib/cloudflare/ai-gateway.js.map +1 -1
- package/lib/cloudflare/api-error.d.ts +0 -9
- package/lib/cloudflare/api-error.d.ts.map +1 -1
- package/lib/cloudflare/api-error.js +24 -0
- package/lib/cloudflare/api-error.js.map +1 -1
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +5 -4
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/assets.d.ts.map +1 -1
- package/lib/cloudflare/assets.js +26 -6
- package/lib/cloudflare/assets.js.map +1 -1
- package/lib/cloudflare/astro.d.ts +63 -0
- package/lib/cloudflare/astro.d.ts.map +1 -0
- package/lib/cloudflare/astro.js +133 -0
- package/lib/cloudflare/astro.js.map +1 -0
- package/lib/cloudflare/auth.d.ts.map +1 -1
- package/lib/cloudflare/auth.js +3 -2
- package/lib/cloudflare/auth.js.map +1 -1
- package/lib/cloudflare/bindings.d.ts +24 -2
- package/lib/cloudflare/bindings.d.ts.map +1 -1
- package/lib/cloudflare/bindings.js.map +1 -1
- package/lib/cloudflare/bound.d.ts +10 -1
- package/lib/cloudflare/bound.d.ts.map +1 -1
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +12 -8
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/bundle/bundle-worker.d.ts.map +1 -1
- package/lib/cloudflare/bundle/bundle-worker.js +2 -1
- package/lib/cloudflare/bundle/bundle-worker.js.map +1 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.d.ts.map +1 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.js +2 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.js.map +1 -1
- package/lib/cloudflare/custom-domain.d.ts.map +1 -1
- package/lib/cloudflare/custom-domain.js +10 -9
- package/lib/cloudflare/custom-domain.js.map +1 -1
- package/lib/cloudflare/d1-database.d.ts.map +1 -1
- package/lib/cloudflare/d1-database.js +11 -10
- package/lib/cloudflare/d1-database.js.map +1 -1
- package/lib/cloudflare/d1-export.d.ts.map +1 -1
- package/lib/cloudflare/d1-export.js +2 -1
- package/lib/cloudflare/d1-export.js.map +1 -1
- package/lib/cloudflare/d1-import.d.ts.map +1 -1
- package/lib/cloudflare/d1-import.js +2 -1
- package/lib/cloudflare/d1-import.js.map +1 -1
- package/lib/cloudflare/d1-migrations.d.ts.map +1 -1
- package/lib/cloudflare/d1-migrations.js +2 -1
- package/lib/cloudflare/d1-migrations.js.map +1 -1
- package/lib/cloudflare/dispatch-namespace.d.ts +94 -0
- package/lib/cloudflare/dispatch-namespace.d.ts.map +1 -0
- package/lib/cloudflare/dispatch-namespace.js +143 -0
- package/lib/cloudflare/dispatch-namespace.js.map +1 -0
- package/lib/cloudflare/dns-records.d.ts.map +1 -1
- package/lib/cloudflare/dns-records.js +5 -4
- package/lib/cloudflare/dns-records.js.map +1 -1
- package/lib/cloudflare/do-state-store/worker.d.ts.map +1 -1
- package/lib/cloudflare/do-state-store/worker.js +4 -0
- package/lib/cloudflare/do-state-store/worker.js.map +1 -1
- package/lib/cloudflare/email-address.d.ts +79 -0
- package/lib/cloudflare/email-address.d.ts.map +1 -0
- package/lib/cloudflare/email-address.js +112 -0
- package/lib/cloudflare/email-address.js.map +1 -0
- package/lib/cloudflare/email-catch-all.d.ts +123 -0
- package/lib/cloudflare/email-catch-all.d.ts.map +1 -0
- package/lib/cloudflare/email-catch-all.js +124 -0
- package/lib/cloudflare/email-catch-all.js.map +1 -0
- package/lib/cloudflare/email-routing.d.ts +89 -0
- package/lib/cloudflare/email-routing.d.ts.map +1 -0
- package/lib/cloudflare/email-routing.js +120 -0
- package/lib/cloudflare/email-routing.js.map +1 -0
- package/lib/cloudflare/email-rule.d.ts +196 -0
- package/lib/cloudflare/email-rule.d.ts.map +1 -0
- package/lib/cloudflare/email-rule.js +153 -0
- package/lib/cloudflare/email-rule.js.map +1 -0
- package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
- package/lib/cloudflare/hyperdrive.js +5 -4
- package/lib/cloudflare/hyperdrive.js.map +1 -1
- package/lib/cloudflare/images.d.ts +60 -0
- package/lib/cloudflare/images.d.ts.map +1 -0
- package/lib/cloudflare/images.js +60 -0
- package/lib/cloudflare/images.js.map +1 -0
- package/lib/cloudflare/index.d.ts +10 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +10 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv-namespace.js +2 -1
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/pipeline.d.ts +7 -0
- package/lib/cloudflare/pipeline.d.ts.map +1 -1
- package/lib/cloudflare/pipeline.js +28 -2
- package/lib/cloudflare/pipeline.js.map +1 -1
- package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
- package/lib/cloudflare/queue-consumer.js +2 -1
- package/lib/cloudflare/queue-consumer.js.map +1 -1
- package/lib/cloudflare/queue.d.ts.map +1 -1
- package/lib/cloudflare/queue.js +0 -8
- package/lib/cloudflare/queue.js.map +1 -1
- package/lib/cloudflare/route.d.ts +26 -1
- package/lib/cloudflare/route.d.ts.map +1 -1
- package/lib/cloudflare/route.js +84 -16
- package/lib/cloudflare/route.js.map +1 -1
- package/lib/cloudflare/secret.d.ts +137 -0
- package/lib/cloudflare/secret.d.ts.map +1 -0
- package/lib/cloudflare/secret.js +122 -0
- package/lib/cloudflare/secret.js.map +1 -0
- package/lib/cloudflare/secrets-store.d.ts +145 -0
- package/lib/cloudflare/secrets-store.d.ts.map +1 -0
- package/lib/cloudflare/secrets-store.js +213 -0
- package/lib/cloudflare/secrets-store.js.map +1 -0
- package/lib/cloudflare/sveltekit.d.ts +49 -0
- package/lib/cloudflare/sveltekit.d.ts.map +1 -0
- package/lib/cloudflare/sveltekit.js +56 -0
- package/lib/cloudflare/sveltekit.js.map +1 -0
- package/lib/cloudflare/user.d.ts.map +1 -1
- package/lib/cloudflare/user.js +2 -1
- package/lib/cloudflare/user.js.map +1 -1
- package/lib/cloudflare/vectorize-index.d.ts.map +1 -1
- package/lib/cloudflare/vectorize-index.js +6 -5
- package/lib/cloudflare/vectorize-index.js.map +1 -1
- package/lib/cloudflare/vectorize-metadata-index.d.ts.map +1 -1
- package/lib/cloudflare/vectorize-metadata-index.js +2 -1
- package/lib/cloudflare/vectorize-metadata-index.js.map +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +7 -2
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts +18 -0
- package/lib/cloudflare/worker-assets.d.ts.map +1 -1
- package/lib/cloudflare/worker-assets.js +61 -67
- package/lib/cloudflare/worker-assets.js.map +1 -1
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
- package/lib/cloudflare/worker-metadata.js +23 -1
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +43 -2
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +50 -11
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +21 -0
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +33 -0
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/cloudflare/zone.d.ts.map +1 -1
- package/lib/cloudflare/zone.js +4 -3
- package/lib/cloudflare/zone.js.map +1 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +30 -13
- package/lib/destroy.js.map +1 -1
- package/lib/dns/godaddy.d.ts.map +1 -1
- package/lib/dns/godaddy.js +3 -2
- package/lib/dns/godaddy.js.map +1 -1
- package/lib/dns/import-dns.d.ts.map +1 -1
- package/lib/dns/import-dns.js +2 -1
- package/lib/dns/import-dns.js.map +1 -1
- package/lib/esbuild/bundle.d.ts +1 -1
- package/lib/esbuild/bundle.d.ts.map +1 -1
- package/lib/esbuild/bundle.js +2 -1
- package/lib/esbuild/bundle.js.map +1 -1
- package/lib/fs/copy-file.d.ts.map +1 -1
- package/lib/fs/copy-file.js +2 -1
- package/lib/fs/copy-file.js.map +1 -1
- package/lib/fs/file.d.ts.map +1 -1
- package/lib/fs/file.js +2 -1
- package/lib/fs/file.js.map +1 -1
- package/lib/github/client.d.ts.map +1 -1
- package/lib/github/client.js +11 -10
- package/lib/github/client.js.map +1 -1
- package/lib/github/repository-environment.d.ts.map +1 -1
- package/lib/github/repository-environment.js +5 -4
- package/lib/github/repository-environment.js.map +1 -1
- package/lib/github/secret.d.ts.map +1 -1
- package/lib/github/secret.js +7 -6
- package/lib/github/secret.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/neon/project.d.ts.map +1 -1
- package/lib/neon/project.js +3 -2
- package/lib/neon/project.js.map +1 -1
- package/lib/planetscale/api.d.ts +53 -0
- package/lib/planetscale/api.d.ts.map +1 -0
- package/lib/planetscale/api.js +84 -0
- package/lib/planetscale/api.js.map +1 -0
- package/lib/planetscale/branch.d.ts +129 -0
- package/lib/planetscale/branch.d.ts.map +1 -0
- package/lib/planetscale/branch.js +161 -0
- package/lib/planetscale/branch.js.map +1 -0
- package/lib/planetscale/database.d.ts +143 -0
- package/lib/planetscale/database.d.ts.map +1 -0
- package/lib/planetscale/database.js +184 -0
- package/lib/planetscale/database.js.map +1 -0
- package/lib/planetscale/index.d.ts +5 -0
- package/lib/planetscale/index.d.ts.map +1 -0
- package/lib/planetscale/index.js +5 -0
- package/lib/planetscale/index.js.map +1 -0
- package/lib/planetscale/utils.d.ts +15 -0
- package/lib/planetscale/utils.d.ts.map +1 -0
- package/lib/planetscale/utils.js +95 -0
- package/lib/planetscale/utils.js.map +1 -0
- package/lib/resource.js +7 -1
- package/lib/resource.js.map +1 -1
- package/lib/runtime/plugin.d.ts.map +1 -1
- package/lib/runtime/plugin.js +2 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/scope.d.ts +13 -2
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +53 -10
- package/lib/scope.js.map +1 -1
- package/lib/sentry/client-key.d.ts.map +1 -1
- package/lib/sentry/client-key.js +5 -4
- package/lib/sentry/client-key.js.map +1 -1
- package/lib/sentry/project.d.ts.map +1 -1
- package/lib/sentry/project.js +5 -4
- package/lib/sentry/project.js.map +1 -1
- package/lib/sentry/team.d.ts.map +1 -1
- package/lib/sentry/team.js +5 -4
- package/lib/sentry/team.js.map +1 -1
- package/lib/stripe/card.d.ts.map +1 -1
- package/lib/stripe/card.js +2 -1
- package/lib/stripe/card.js.map +1 -1
- package/lib/stripe/client.d.ts.map +1 -1
- package/lib/stripe/client.js +3 -2
- package/lib/stripe/client.js.map +1 -1
- package/lib/stripe/coupon.d.ts.map +1 -1
- package/lib/stripe/coupon.js +2 -1
- package/lib/stripe/coupon.js.map +1 -1
- package/lib/stripe/customer.d.ts.map +1 -1
- package/lib/stripe/customer.js +2 -1
- package/lib/stripe/customer.js.map +1 -1
- package/lib/stripe/entitlements-feature.d.ts.map +1 -1
- package/lib/stripe/entitlements-feature.js +2 -1
- package/lib/stripe/entitlements-feature.js.map +1 -1
- package/lib/stripe/file.d.ts.map +1 -1
- package/lib/stripe/file.js +2 -1
- package/lib/stripe/file.js.map +1 -1
- package/lib/stripe/meter.d.ts.map +1 -1
- package/lib/stripe/meter.js +4 -2
- package/lib/stripe/meter.js.map +1 -1
- package/lib/stripe/portal-configuration.d.ts.map +1 -1
- package/lib/stripe/portal-configuration.js +2 -1
- package/lib/stripe/portal-configuration.js.map +1 -1
- package/lib/stripe/price.d.ts.map +1 -1
- package/lib/stripe/price.js +2 -1
- package/lib/stripe/price.js.map +1 -1
- package/lib/stripe/product-feature.d.ts.map +1 -1
- package/lib/stripe/product-feature.js +2 -1
- package/lib/stripe/product-feature.js.map +1 -1
- package/lib/stripe/product.d.ts.map +1 -1
- package/lib/stripe/product.js +2 -1
- package/lib/stripe/product.js.map +1 -1
- package/lib/stripe/promotion-code.d.ts.map +1 -1
- package/lib/stripe/promotion-code.js +2 -1
- package/lib/stripe/promotion-code.js.map +1 -1
- package/lib/stripe/shipping-rate.d.ts.map +1 -1
- package/lib/stripe/shipping-rate.js +2 -1
- package/lib/stripe/shipping-rate.js.map +1 -1
- package/lib/stripe/tax-rate.d.ts.map +1 -1
- package/lib/stripe/tax-rate.js +2 -1
- package/lib/stripe/tax-rate.js.map +1 -1
- package/lib/stripe/webhook.d.ts.map +1 -1
- package/lib/stripe/webhook.js +3 -2
- package/lib/stripe/webhook.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js +6 -1
- package/lib/test/bun.js.map +1 -1
- package/lib/test/prune.js +7 -1
- package/lib/test/prune.js.map +1 -1
- package/lib/test/vitest.d.ts.map +1 -1
- package/lib/test/vitest.js +10 -3
- package/lib/test/vitest.js.map +1 -1
- package/lib/upstash/redis.d.ts.map +1 -1
- package/lib/upstash/redis.js +2 -1
- package/lib/upstash/redis.js.map +1 -1
- package/lib/util/async-queue.d.ts +35 -0
- package/lib/util/async-queue.d.ts.map +1 -0
- package/lib/util/async-queue.js +87 -0
- package/lib/util/async-queue.js.map +1 -0
- package/lib/util/cli.d.ts +37 -0
- package/lib/util/cli.d.ts.map +1 -0
- package/lib/util/cli.js +90 -0
- package/lib/util/cli.js.map +1 -0
- package/lib/util/ignore-matcher.d.ts +94 -0
- package/lib/util/ignore-matcher.d.ts.map +1 -0
- package/lib/util/ignore-matcher.js +616 -0
- package/lib/util/ignore-matcher.js.map +1 -0
- package/lib/util/logger.d.ts +3 -0
- package/lib/util/logger.d.ts.map +1 -0
- package/lib/util/logger.js +15 -0
- package/lib/util/logger.js.map +1 -0
- package/lib/util/retry.d.ts.map +1 -1
- package/lib/util/retry.js +0 -1
- package/lib/util/retry.js.map +1 -1
- package/lib/util/safe-fetch.d.ts.map +1 -1
- package/lib/util/safe-fetch.js +2 -1
- package/lib/util/safe-fetch.js.map +1 -1
- package/lib/util/telemetry/client.d.ts +32 -0
- package/lib/util/telemetry/client.d.ts.map +1 -0
- package/lib/util/telemetry/client.js +94 -0
- package/lib/util/telemetry/client.js.map +1 -0
- package/lib/util/telemetry/constants.d.ts +4 -0
- package/lib/util/telemetry/constants.d.ts.map +1 -0
- package/lib/util/telemetry/constants.js +8 -0
- package/lib/util/telemetry/constants.js.map +1 -0
- package/lib/util/telemetry/context.d.ts +15 -0
- package/lib/util/telemetry/context.d.ts.map +1 -0
- package/lib/util/telemetry/context.js +128 -0
- package/lib/util/telemetry/context.js.map +1 -0
- package/lib/util/telemetry/index.d.ts +3 -0
- package/lib/util/telemetry/index.d.ts.map +1 -0
- package/lib/util/telemetry/index.js +3 -0
- package/lib/util/telemetry/index.js.map +1 -0
- package/lib/util/telemetry/types.d.ts +59 -0
- package/lib/util/telemetry/types.d.ts.map +1 -0
- package/lib/util/telemetry/types.js +1 -0
- package/lib/util/telemetry/types.js.map +1 -0
- package/lib/util/xdg-paths.d.ts +9 -0
- package/lib/util/xdg-paths.d.ts.map +1 -0
- package/lib/util/xdg-paths.js +41 -0
- package/lib/util/xdg-paths.js.map +1 -0
- package/lib/vercel/project.d.ts.map +1 -1
- package/lib/vercel/project.js +2 -1
- package/lib/vercel/project.js.map +1 -1
- package/lib/web/astro.d.ts.map +1 -1
- package/lib/web/astro.js +2 -1
- package/lib/web/astro.js.map +1 -1
- package/lib/web/shadcn.d.ts.map +1 -1
- package/lib/web/shadcn.js +2 -1
- package/lib/web/shadcn.js.map +1 -1
- package/lib/web/vite.d.ts.map +1 -1
- package/lib/web/vite.js +3 -2
- package/lib/web/vite.js.map +1 -1
- package/lib/web/vitepress/dependencies.d.ts.map +1 -1
- package/lib/web/vitepress/dependencies.js +2 -1
- package/lib/web/vitepress/dependencies.js.map +1 -1
- package/lib/web/vitepress/vitepress.d.ts.map +1 -1
- package/lib/web/vitepress/vitepress.js +2 -1
- package/lib/web/vitepress/vitepress.js.map +1 -1
- package/package.json +6 -4
- package/src/ai/astro-file.ts +2 -1
- package/src/ai/client.ts +3 -2
- package/src/alchemy.ts +28 -3
- package/src/apply.ts +66 -5
- package/src/aws/control/client.ts +4 -4
- package/src/aws/control/properties.ts +48 -0
- package/src/aws/control/resource.ts +3 -2
- package/src/aws/control/types.ts +3988 -6301
- package/src/aws/function.ts +9 -8
- package/src/aws/oidc/oidc-provider.ts +3 -2
- package/src/aws/queue.ts +3 -2
- package/src/aws/role.ts +3 -1
- package/src/aws/ssm-parameter.ts +2 -1
- package/src/cloudflare/account-api-token.ts +3 -2
- package/src/cloudflare/ai-gateway.ts +4 -3
- package/src/cloudflare/api-error.ts +36 -0
- package/src/cloudflare/api.ts +9 -4
- package/src/cloudflare/assets.ts +30 -6
- package/src/cloudflare/astro.ts +176 -0
- package/src/cloudflare/auth.ts +3 -2
- package/src/cloudflare/bindings.ts +29 -0
- package/src/cloudflare/bound.ts +38 -21
- package/src/cloudflare/bucket.ts +15 -8
- package/src/cloudflare/bundle/bundle-worker.ts +2 -1
- package/src/cloudflare/bundle/nodejs-compat-mode.ts +2 -1
- package/src/cloudflare/custom-domain.ts +10 -9
- package/src/cloudflare/d1-database.ts +11 -10
- package/src/cloudflare/d1-export.ts +2 -1
- package/src/cloudflare/d1-import.ts +2 -1
- package/src/cloudflare/d1-migrations.ts +2 -1
- package/src/cloudflare/dispatch-namespace.ts +281 -0
- package/src/cloudflare/dns-records.ts +5 -4
- package/src/cloudflare/do-state-store/worker.ts +4 -0
- package/src/cloudflare/email-address.ts +203 -0
- package/src/cloudflare/email-catch-all.ts +248 -0
- package/src/cloudflare/email-routing.ts +230 -0
- package/src/cloudflare/email-rule.ts +322 -0
- package/src/cloudflare/hyperdrive.ts +5 -4
- package/src/cloudflare/images.ts +59 -0
- package/src/cloudflare/index.ts +10 -0
- package/src/cloudflare/kv-namespace.ts +2 -1
- package/src/cloudflare/pipeline.ts +38 -2
- package/src/cloudflare/queue-consumer.ts +2 -1
- package/src/cloudflare/queue.ts +0 -12
- package/src/cloudflare/route.ts +118 -18
- package/src/cloudflare/secret.ts +253 -0
- package/src/cloudflare/secrets-store.ts +420 -0
- package/src/cloudflare/sveltekit.ts +72 -0
- package/src/cloudflare/user.ts +2 -1
- package/src/cloudflare/vectorize-index.ts +6 -5
- package/src/cloudflare/vectorize-metadata-index.ts +2 -1
- package/src/cloudflare/website.ts +76 -66
- package/src/cloudflare/worker-assets.ts +95 -89
- package/src/cloudflare/worker-metadata.ts +20 -1
- package/src/cloudflare/worker.ts +116 -18
- package/src/cloudflare/wrangler.json.ts +63 -0
- package/src/cloudflare/zone.ts +4 -3
- package/src/destroy.ts +35 -17
- package/src/dns/godaddy.ts +3 -2
- package/src/dns/import-dns.ts +2 -1
- package/src/esbuild/bundle.ts +2 -1
- package/src/fs/copy-file.ts +2 -1
- package/src/fs/file.ts +3 -1
- package/src/github/client.ts +11 -10
- package/src/github/repository-environment.ts +5 -4
- package/src/github/secret.ts +7 -6
- package/src/index.ts +2 -1
- package/src/neon/project.ts +3 -2
- package/src/planetscale/api.ts +115 -0
- package/src/planetscale/branch.ts +352 -0
- package/src/planetscale/database.ts +394 -0
- package/src/planetscale/index.ts +4 -0
- package/src/planetscale/utils.ts +189 -0
- package/src/resource.ts +7 -1
- package/src/runtime/plugin.ts +2 -1
- package/src/scope.ts +64 -13
- package/src/sentry/client-key.ts +5 -4
- package/src/sentry/project.ts +5 -4
- package/src/sentry/team.ts +5 -4
- package/src/stripe/card.ts +2 -1
- package/src/stripe/client.ts +3 -2
- package/src/stripe/coupon.ts +2 -1
- package/src/stripe/customer.ts +2 -1
- package/src/stripe/entitlements-feature.ts +2 -1
- package/src/stripe/file.ts +2 -1
- package/src/stripe/meter.ts +4 -2
- package/src/stripe/portal-configuration.ts +2 -1
- package/src/stripe/price.ts +2 -1
- package/src/stripe/product-feature.ts +2 -1
- package/src/stripe/product.ts +2 -1
- package/src/stripe/promotion-code.ts +2 -1
- package/src/stripe/shipping-rate.ts +2 -1
- package/src/stripe/tax-rate.ts +2 -1
- package/src/stripe/webhook.ts +3 -2
- package/src/test/bun.ts +6 -1
- package/src/test/prune.ts +7 -1
- package/src/test/vitest.ts +14 -3
- package/src/upstash/redis.ts +2 -1
- package/src/util/async-queue.ts +97 -0
- package/src/util/cli.tsx +221 -0
- package/src/util/ignore-matcher.ts +873 -0
- package/src/util/logger.ts +17 -0
- package/src/util/retry.ts +0 -1
- package/src/util/safe-fetch.ts +2 -1
- package/src/util/telemetry/client.ts +127 -0
- package/src/util/telemetry/constants.ts +13 -0
- package/src/util/telemetry/context.ts +154 -0
- package/src/util/telemetry/index.ts +2 -0
- package/src/util/telemetry/types.ts +83 -0
- package/src/util/xdg-paths.ts +48 -0
- package/src/vercel/project.ts +2 -1
- package/src/web/astro.ts +2 -1
- package/src/web/shadcn.ts +2 -1
- package/src/web/vite.ts +3 -2
- package/src/web/vitepress/dependencies.ts +2 -1
- package/src/web/vitepress/vitepress.ts +2 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { Resource } from "../resource.ts";
|
|
3
|
+
import { handleApiError } from "./api-error.ts";
|
|
4
|
+
import { type CloudflareApiOptions, createCloudflareApi } from "./api.ts";
|
|
5
|
+
import type { CloudflareResponse } from "./response.ts";
|
|
6
|
+
import type { Zone } from "./zone.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Cloudflare Email Routing response format
|
|
10
|
+
*/
|
|
11
|
+
interface CloudflareEmailRouting {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
name: string;
|
|
14
|
+
created: string;
|
|
15
|
+
modified: string;
|
|
16
|
+
tag: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Properties for configuring email routing on a zone
|
|
21
|
+
*/
|
|
22
|
+
export interface EmailRoutingProps extends CloudflareApiOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Zone ID or Zone resource where email routing will be configured
|
|
25
|
+
*/
|
|
26
|
+
zone: string | Zone;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Whether email routing should be enabled
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Skip the DNS setup wizard when enabling email routing
|
|
37
|
+
*
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
skipWizard?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Email routing configuration for a Cloudflare zone
|
|
45
|
+
*/
|
|
46
|
+
export interface EmailRouting extends Resource<"cloudflare::EmailRouting"> {
|
|
47
|
+
/**
|
|
48
|
+
* Zone ID where email routing is configured
|
|
49
|
+
*/
|
|
50
|
+
zoneId: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Whether email routing is enabled
|
|
54
|
+
*/
|
|
55
|
+
enabled: boolean;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Zone name
|
|
59
|
+
*/
|
|
60
|
+
name: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* When email routing was created
|
|
64
|
+
*/
|
|
65
|
+
created: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* When email routing was last modified
|
|
69
|
+
*/
|
|
70
|
+
modified: string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Zone tag
|
|
74
|
+
*/
|
|
75
|
+
tag: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Configures email routing for a Cloudflare zone, allowing emails sent to the zone's domain
|
|
80
|
+
* to be routed according to defined rules.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ## Enable email routing for a zone
|
|
84
|
+
*
|
|
85
|
+
* Enable email routing for your domain to start receiving and routing emails.
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* const emailRouting = await EmailRouting("example.com-routing", {
|
|
89
|
+
* zone: "example.com",
|
|
90
|
+
* enabled: true
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ## Use with existing Zone resource
|
|
96
|
+
*
|
|
97
|
+
* Configure email routing using an existing Zone resource reference.
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* const zone = await Zone("my-zone", {
|
|
101
|
+
* name: "example.com"
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* const emailRouting = await EmailRouting("example.com-routing", {
|
|
105
|
+
* zone: zone,
|
|
106
|
+
* enabled: true,
|
|
107
|
+
* skipWizard: true
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export const EmailRouting = Resource(
|
|
112
|
+
"cloudflare::EmailRouting",
|
|
113
|
+
async function (
|
|
114
|
+
this: Context<EmailRouting>,
|
|
115
|
+
_id: string,
|
|
116
|
+
props: EmailRoutingProps,
|
|
117
|
+
): Promise<EmailRouting> {
|
|
118
|
+
const api = await createCloudflareApi(props);
|
|
119
|
+
const zoneId = typeof props.zone === "string" ? props.zone : props.zone.id;
|
|
120
|
+
|
|
121
|
+
if (this.phase === "delete") {
|
|
122
|
+
// Disable email routing DNS
|
|
123
|
+
const response = await api.delete(`/zones/${zoneId}/email/routing/dns`);
|
|
124
|
+
if (!response.ok && response.status !== 404) {
|
|
125
|
+
await handleApiError(response, "disabling", "email routing DNS");
|
|
126
|
+
}
|
|
127
|
+
return this.destroy();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (this.phase === "update" && this.output) {
|
|
131
|
+
// Check if we need to update the enabled state
|
|
132
|
+
const currentEnabled = this.output.enabled;
|
|
133
|
+
const desiredEnabled = props.enabled ?? true;
|
|
134
|
+
|
|
135
|
+
if (currentEnabled !== desiredEnabled) {
|
|
136
|
+
if (desiredEnabled) {
|
|
137
|
+
// Enable email routing DNS
|
|
138
|
+
const enablePayload = {
|
|
139
|
+
enabled: true,
|
|
140
|
+
...(props.skipWizard && { skip_wizard: props.skipWizard }),
|
|
141
|
+
};
|
|
142
|
+
const response = await api.post(
|
|
143
|
+
`/zones/${zoneId}/email/routing/dns`,
|
|
144
|
+
enablePayload,
|
|
145
|
+
);
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
await handleApiError(response, "enabling", "email routing DNS");
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
// Disable email routing DNS
|
|
151
|
+
const response = await api.delete(
|
|
152
|
+
`/zones/${zoneId}/email/routing/dns`,
|
|
153
|
+
);
|
|
154
|
+
if (!response.ok) {
|
|
155
|
+
await handleApiError(response, "disabling", "email routing DNS");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Get current state
|
|
161
|
+
const getResponse = await api.get(`/zones/${zoneId}/email/routing/dns`);
|
|
162
|
+
if (!getResponse.ok) {
|
|
163
|
+
if (getResponse.status === 404) {
|
|
164
|
+
throw new Error("Email routing DNS is not configured for this zone");
|
|
165
|
+
}
|
|
166
|
+
await handleApiError(
|
|
167
|
+
getResponse,
|
|
168
|
+
"getting",
|
|
169
|
+
"email routing DNS settings",
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const result =
|
|
174
|
+
(await getResponse.json()) as CloudflareResponse<CloudflareEmailRouting>;
|
|
175
|
+
|
|
176
|
+
return this({
|
|
177
|
+
zoneId,
|
|
178
|
+
enabled: result.result.enabled,
|
|
179
|
+
name: result.result.name,
|
|
180
|
+
created: result.result.created,
|
|
181
|
+
modified: result.result.modified,
|
|
182
|
+
tag: result.result.tag,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Create/Enable email routing
|
|
187
|
+
const enabled = props.enabled ?? true;
|
|
188
|
+
|
|
189
|
+
if (enabled) {
|
|
190
|
+
const enablePayload = {
|
|
191
|
+
enabled: true,
|
|
192
|
+
...(props.skipWizard && { skip_wizard: props.skipWizard }),
|
|
193
|
+
};
|
|
194
|
+
const response = await api.post(
|
|
195
|
+
`/zones/${zoneId}/email/routing/dns`,
|
|
196
|
+
enablePayload,
|
|
197
|
+
);
|
|
198
|
+
if (!response.ok) {
|
|
199
|
+
await handleApiError(response, "enabling", "email routing DNS");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Get the current state
|
|
204
|
+
const getResponse = await api.get(`/zones/${zoneId}/email/routing/dns`);
|
|
205
|
+
if (!getResponse.ok) {
|
|
206
|
+
if (getResponse.status === 404) {
|
|
207
|
+
throw new Error(
|
|
208
|
+
"Email routing DNS is not configured. Set enabled: true to configure it.",
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
await handleApiError(
|
|
212
|
+
getResponse,
|
|
213
|
+
"getting",
|
|
214
|
+
"email routing DNS settings",
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const result =
|
|
219
|
+
(await getResponse.json()) as CloudflareResponse<CloudflareEmailRouting>;
|
|
220
|
+
|
|
221
|
+
return this({
|
|
222
|
+
zoneId,
|
|
223
|
+
enabled: result.result.enabled,
|
|
224
|
+
name: result.result.name,
|
|
225
|
+
created: result.result.created,
|
|
226
|
+
modified: result.result.modified,
|
|
227
|
+
tag: result.result.tag,
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
);
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { Resource } from "../resource.ts";
|
|
3
|
+
import { handleApiError } from "./api-error.ts";
|
|
4
|
+
import { type CloudflareApiOptions, createCloudflareApi } from "./api.ts";
|
|
5
|
+
import type { CloudflareResponse } from "./response.ts";
|
|
6
|
+
import type { Zone } from "./zone.ts";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Email routing matcher - defines what emails to match
|
|
10
|
+
*/
|
|
11
|
+
export interface EmailMatcher {
|
|
12
|
+
/**
|
|
13
|
+
* Type of matcher
|
|
14
|
+
* - "literal": Exact string match
|
|
15
|
+
* - "all": Matches all emails
|
|
16
|
+
*/
|
|
17
|
+
type: "literal" | "all";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Field to match against (required for literal matchers)
|
|
21
|
+
*/
|
|
22
|
+
field?: "to" | "from" | "subject";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Value to match (required for literal matchers)
|
|
26
|
+
*/
|
|
27
|
+
value?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Email routing action - defines what to do with matched emails
|
|
32
|
+
*/
|
|
33
|
+
export interface EmailAction {
|
|
34
|
+
/**
|
|
35
|
+
* Type of action to take
|
|
36
|
+
* - "forward": Forward email to destination addresses
|
|
37
|
+
* - "worker": Process email with a Cloudflare Worker
|
|
38
|
+
* - "drop": Drop/reject the email
|
|
39
|
+
*/
|
|
40
|
+
type: "forward" | "worker" | "drop";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Action configuration
|
|
44
|
+
* - For "forward": Array of destination email addresses
|
|
45
|
+
* - For "worker": Worker script name
|
|
46
|
+
* - For "drop": Not used
|
|
47
|
+
*/
|
|
48
|
+
value?: string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Cloudflare Email Rule response format
|
|
53
|
+
*/
|
|
54
|
+
interface CloudflareEmailRule {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
priority: number;
|
|
59
|
+
matchers: EmailMatcher[];
|
|
60
|
+
actions: EmailAction[];
|
|
61
|
+
tag: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Properties for creating an email routing rule
|
|
66
|
+
*/
|
|
67
|
+
export interface EmailRuleProps extends CloudflareApiOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Zone ID or Zone resource where the rule will be created
|
|
70
|
+
*/
|
|
71
|
+
zone: string | Zone;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Name for the email routing rule
|
|
75
|
+
*/
|
|
76
|
+
name?: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Whether the rule is enabled
|
|
80
|
+
*
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
enabled?: boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Rule priority - lower numbers have higher priority
|
|
87
|
+
* Rules are evaluated in priority order
|
|
88
|
+
*
|
|
89
|
+
* @default 0
|
|
90
|
+
*/
|
|
91
|
+
priority?: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Array of matchers that define which emails this rule applies to
|
|
95
|
+
*/
|
|
96
|
+
matchers: EmailMatcher[];
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Array of actions to take when emails match this rule
|
|
100
|
+
*/
|
|
101
|
+
actions: EmailAction[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* An email routing rule for a Cloudflare zone
|
|
106
|
+
*/
|
|
107
|
+
export interface EmailRule extends Resource<"cloudflare::EmailRule"> {
|
|
108
|
+
/**
|
|
109
|
+
* Zone ID where the rule is created
|
|
110
|
+
*/
|
|
111
|
+
zoneId: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Rule ID
|
|
115
|
+
*/
|
|
116
|
+
ruleId: string;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Rule name
|
|
120
|
+
*/
|
|
121
|
+
name: string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Whether the rule is enabled
|
|
125
|
+
*/
|
|
126
|
+
enabled: boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Rule priority
|
|
130
|
+
*/
|
|
131
|
+
priority: number;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Matchers for this rule
|
|
135
|
+
*/
|
|
136
|
+
matchers: EmailMatcher[];
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Actions for this rule
|
|
140
|
+
*/
|
|
141
|
+
actions: EmailAction[];
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Rule tag
|
|
145
|
+
*/
|
|
146
|
+
tag: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Creates email routing rules that define how emails sent to your domain are processed.
|
|
151
|
+
* Rules are evaluated in priority order (lower number = higher priority).
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ## Forward emails to a specific address
|
|
155
|
+
*
|
|
156
|
+
* Forward all emails sent to info@example.com to a destination address.
|
|
157
|
+
*
|
|
158
|
+
* ```ts
|
|
159
|
+
* const infoRule = await EmailRule("info-forwarding", {
|
|
160
|
+
* zone: "example.com",
|
|
161
|
+
* name: "Forward info emails",
|
|
162
|
+
* matchers: [
|
|
163
|
+
* {
|
|
164
|
+
* type: "literal",
|
|
165
|
+
* field: "to",
|
|
166
|
+
* value: "info@example.com"
|
|
167
|
+
* }
|
|
168
|
+
* ],
|
|
169
|
+
* actions: [
|
|
170
|
+
* {
|
|
171
|
+
* type: "forward",
|
|
172
|
+
* value: ["admin@company.com"]
|
|
173
|
+
* }
|
|
174
|
+
* ]
|
|
175
|
+
* });
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ## Process emails with a Worker
|
|
180
|
+
*
|
|
181
|
+
* Route emails to a Cloudflare Worker for custom processing.
|
|
182
|
+
*
|
|
183
|
+
* ```ts
|
|
184
|
+
* const workerRule = await EmailRule("worker-processing", {
|
|
185
|
+
* zone: "example.com",
|
|
186
|
+
* name: "Process with Worker",
|
|
187
|
+
* priority: 1,
|
|
188
|
+
* matchers: [
|
|
189
|
+
* {
|
|
190
|
+
* type: "literal",
|
|
191
|
+
* field: "to",
|
|
192
|
+
* value: "webhook@example.com"
|
|
193
|
+
* }
|
|
194
|
+
* ],
|
|
195
|
+
* actions: [
|
|
196
|
+
* {
|
|
197
|
+
* type: "worker",
|
|
198
|
+
* value: ["email-processor"]
|
|
199
|
+
* }
|
|
200
|
+
* ]
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ## Multiple matchers and actions
|
|
206
|
+
*
|
|
207
|
+
* Create a rule with multiple conditions and actions.
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* const complexRule = await EmailRule("support-routing", {
|
|
211
|
+
* zone: "example.com",
|
|
212
|
+
* name: "Support email routing",
|
|
213
|
+
* priority: 2,
|
|
214
|
+
* matchers: [
|
|
215
|
+
* {
|
|
216
|
+
* type: "literal",
|
|
217
|
+
* field: "to",
|
|
218
|
+
* value: "support@example.com"
|
|
219
|
+
* }
|
|
220
|
+
* ],
|
|
221
|
+
* actions: [
|
|
222
|
+
* {
|
|
223
|
+
* type: "forward",
|
|
224
|
+
* value: ["support@company.com", "backup@company.com"]
|
|
225
|
+
* }
|
|
226
|
+
* ]
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
export const EmailRule = Resource(
|
|
231
|
+
"cloudflare::EmailRule",
|
|
232
|
+
async function (
|
|
233
|
+
this: Context<EmailRule>,
|
|
234
|
+
_id: string,
|
|
235
|
+
props: EmailRuleProps,
|
|
236
|
+
): Promise<EmailRule> {
|
|
237
|
+
const api = await createCloudflareApi(props);
|
|
238
|
+
const zoneId = typeof props.zone === "string" ? props.zone : props.zone.id;
|
|
239
|
+
|
|
240
|
+
if (this.phase === "delete") {
|
|
241
|
+
if (this.output?.ruleId) {
|
|
242
|
+
const response = await api.delete(
|
|
243
|
+
`/zones/${zoneId}/email/routing/rules/${this.output.ruleId}`,
|
|
244
|
+
);
|
|
245
|
+
if (!response.ok && response.status !== 404) {
|
|
246
|
+
await handleApiError(response, "delete", "email rule");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return this.destroy();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (this.phase === "update" && this.output) {
|
|
253
|
+
// Update the existing rule
|
|
254
|
+
const updatePayload = {
|
|
255
|
+
name: props.name || this.output.name,
|
|
256
|
+
enabled: props.enabled ?? true,
|
|
257
|
+
priority: props.priority ?? 0,
|
|
258
|
+
matchers: props.matchers,
|
|
259
|
+
actions: props.actions,
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const response = await api.put(
|
|
263
|
+
`/zones/${zoneId}/email/routing/rules/${this.output.ruleId}`,
|
|
264
|
+
updatePayload,
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
if (!response.ok) {
|
|
268
|
+
if (response.status === 404) {
|
|
269
|
+
// Rule was deleted externally, create a new one
|
|
270
|
+
} else {
|
|
271
|
+
await handleApiError(response, "update", "email rule");
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
const result =
|
|
275
|
+
(await response.json()) as CloudflareResponse<CloudflareEmailRule>;
|
|
276
|
+
|
|
277
|
+
return this({
|
|
278
|
+
zoneId,
|
|
279
|
+
ruleId: result.result.id,
|
|
280
|
+
name: result.result.name,
|
|
281
|
+
enabled: result.result.enabled,
|
|
282
|
+
priority: result.result.priority,
|
|
283
|
+
matchers: result.result.matchers,
|
|
284
|
+
actions: result.result.actions,
|
|
285
|
+
tag: result.result.tag,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Create new rule
|
|
291
|
+
const createPayload = {
|
|
292
|
+
name: props.name || "Email routing rule",
|
|
293
|
+
enabled: props.enabled ?? true,
|
|
294
|
+
priority: props.priority ?? 0,
|
|
295
|
+
matchers: props.matchers,
|
|
296
|
+
actions: props.actions,
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const createResponse = await api.post(
|
|
300
|
+
`/zones/${zoneId}/email/routing/rules`,
|
|
301
|
+
createPayload,
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
if (!createResponse.ok) {
|
|
305
|
+
await handleApiError(createResponse, "create", "email rule");
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const result =
|
|
309
|
+
(await createResponse.json()) as CloudflareResponse<CloudflareEmailRule>;
|
|
310
|
+
|
|
311
|
+
return this({
|
|
312
|
+
zoneId,
|
|
313
|
+
ruleId: result.result.id,
|
|
314
|
+
name: result.result.name,
|
|
315
|
+
enabled: result.result.enabled,
|
|
316
|
+
priority: result.result.priority,
|
|
317
|
+
matchers: result.result.matchers,
|
|
318
|
+
actions: result.result.actions,
|
|
319
|
+
tag: result.result.tag,
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
);
|
|
@@ -2,6 +2,7 @@ import type { Context } from "../context.ts";
|
|
|
2
2
|
import { Resource } from "../resource.ts";
|
|
3
3
|
import { tryGetBinding } from "../runtime/bind.ts";
|
|
4
4
|
import type { Secret } from "../secret.ts";
|
|
5
|
+
import { logger } from "../util/logger.ts";
|
|
5
6
|
import { handleApiError } from "./api-error.ts";
|
|
6
7
|
import { createCloudflareApi, type CloudflareApiOptions } from "./api.ts";
|
|
7
8
|
import type { Bound } from "./bound.ts";
|
|
@@ -276,7 +277,7 @@ const HyperdriveResource = Resource(
|
|
|
276
277
|
|
|
277
278
|
if (this.phase === "delete") {
|
|
278
279
|
if (!hyperdriveId) {
|
|
279
|
-
|
|
280
|
+
logger.warn(`No hyperdriveId found for ${id}, skipping delete`);
|
|
280
281
|
return this.destroy();
|
|
281
282
|
}
|
|
282
283
|
|
|
@@ -287,7 +288,7 @@ const HyperdriveResource = Resource(
|
|
|
287
288
|
await handleApiError(deleteResponse, "delete", "hyperdrive", id);
|
|
288
289
|
}
|
|
289
290
|
} catch (error) {
|
|
290
|
-
|
|
291
|
+
logger.error(`Error deleting Hyperdrive ${id}:`, error);
|
|
291
292
|
throw error;
|
|
292
293
|
}
|
|
293
294
|
return this.destroy();
|
|
@@ -311,7 +312,7 @@ const HyperdriveResource = Resource(
|
|
|
311
312
|
const getResponse = await api.get(configPath);
|
|
312
313
|
if (getResponse.status === 200) {
|
|
313
314
|
// Hyperdrive exists, update it
|
|
314
|
-
|
|
315
|
+
logger.log(
|
|
315
316
|
`Hyperdrive '${id}' already exists. Updating existing resource.`,
|
|
316
317
|
);
|
|
317
318
|
response = await api.put(configPath, requestBody);
|
|
@@ -344,7 +345,7 @@ const HyperdriveResource = Resource(
|
|
|
344
345
|
const data: { result: Record<string, any> } = await response!.json();
|
|
345
346
|
apiResource = data.result;
|
|
346
347
|
} catch (error) {
|
|
347
|
-
|
|
348
|
+
logger.error(`Error ${this.phase} Hyperdrive '${id}':`, error);
|
|
348
349
|
throw error;
|
|
349
350
|
}
|
|
350
351
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare Images binding for image transformation and manipulation.
|
|
3
|
+
*
|
|
4
|
+
* Provides access to Cloudflare Images API for transforming, drawing, and outputting images
|
|
5
|
+
* within Workers. The binding requires no configuration - just the binding name.
|
|
6
|
+
*
|
|
7
|
+
* **Requirements:**
|
|
8
|
+
* - Cloudflare Images enabled for your account
|
|
9
|
+
* - For deployed Workers: image transforms must be enabled for the zone
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Create an Images binding and bind to a Worker:
|
|
13
|
+
* import { Worker, Images } from "alchemy/cloudflare";
|
|
14
|
+
*
|
|
15
|
+
* const images = new Images();
|
|
16
|
+
*
|
|
17
|
+
* const worker = await Worker("image-processor", {
|
|
18
|
+
* name: "image-processor",
|
|
19
|
+
* entrypoint: "./src/worker.ts",
|
|
20
|
+
* bindings: {
|
|
21
|
+
* IMAGES: images
|
|
22
|
+
* }
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Runtime usage - Basic image transformation:
|
|
27
|
+
* export default {
|
|
28
|
+
* async fetch(request: Request, env: any): Promise<Response> {
|
|
29
|
+
* const imageData = await request.arrayBuffer();
|
|
30
|
+
*
|
|
31
|
+
* const response = await env.IMAGES
|
|
32
|
+
* .input(imageData)
|
|
33
|
+
* .transform({ width: 800, height: 600, format: "webp" })
|
|
34
|
+
* .output();
|
|
35
|
+
*
|
|
36
|
+
* return response.response();
|
|
37
|
+
* }
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // Runtime usage - Advanced transformations with overlays:
|
|
42
|
+
* const watermark: ReadableStream = await fetchWatermark();
|
|
43
|
+
* const image: ReadableStream = await fetchMainImage();
|
|
44
|
+
*
|
|
45
|
+
* const response = await env.IMAGES
|
|
46
|
+
* .input(image)
|
|
47
|
+
* .draw(
|
|
48
|
+
* env.IMAGES.input(watermark).transform({ width: 32, height: 32 }),
|
|
49
|
+
* { bottom: 32, right: 32 }
|
|
50
|
+
* )
|
|
51
|
+
* .output({ format: "image/avif" });
|
|
52
|
+
*
|
|
53
|
+
* return response.response();
|
|
54
|
+
*
|
|
55
|
+
* @see https://developers.cloudflare.com/images/transform-images/bindings/
|
|
56
|
+
*/
|
|
57
|
+
export class Images {
|
|
58
|
+
public readonly type = "images";
|
|
59
|
+
}
|
package/src/cloudflare/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./analytics-engine.ts";
|
|
|
6
6
|
export * from "./api-error.ts";
|
|
7
7
|
export * from "./api.ts";
|
|
8
8
|
export * from "./assets.ts";
|
|
9
|
+
export * from "./astro.ts";
|
|
9
10
|
export * from "./bindings.ts";
|
|
10
11
|
export * from "./bound.ts";
|
|
11
12
|
export * from "./browser-rendering.ts";
|
|
@@ -17,10 +18,16 @@ export * from "./d1-clone.ts";
|
|
|
17
18
|
export * from "./d1-database.ts";
|
|
18
19
|
export * from "./d1-export.ts";
|
|
19
20
|
export * from "./d1-import.ts";
|
|
21
|
+
export * from "./dispatch-namespace.ts";
|
|
20
22
|
export * from "./dns-records.ts";
|
|
21
23
|
export * from "./do-state-store/index.ts";
|
|
22
24
|
export * from "./durable-object-namespace.ts";
|
|
25
|
+
export * from "./email-address.ts";
|
|
26
|
+
export * from "./email-catch-all.ts";
|
|
27
|
+
export * from "./email-routing.ts";
|
|
28
|
+
export * from "./email-rule.ts";
|
|
23
29
|
export * from "./hyperdrive.ts";
|
|
30
|
+
export * from "./images.ts";
|
|
24
31
|
export * from "./kv-namespace.ts";
|
|
25
32
|
export * from "./nuxt.ts";
|
|
26
33
|
export * from "./permission-groups.ts";
|
|
@@ -31,6 +38,9 @@ export * from "./r2-rest-state-store.ts";
|
|
|
31
38
|
export * from "./react-router.ts";
|
|
32
39
|
export * from "./redwood.ts";
|
|
33
40
|
export * from "./route.ts";
|
|
41
|
+
export * from "./secret.ts";
|
|
42
|
+
export * from "./secrets-store.ts";
|
|
43
|
+
export * from "./sveltekit.ts";
|
|
34
44
|
export * from "./tanstack-start.ts";
|
|
35
45
|
export * from "./vectorize-index.ts";
|
|
36
46
|
export * from "./vectorize-metadata-index.ts";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from "../context.ts";
|
|
2
2
|
import { Resource, ResourceKind } from "../resource.ts";
|
|
3
3
|
import { bind } from "../runtime/bind.ts";
|
|
4
|
+
import { logger } from "../util/logger.ts";
|
|
4
5
|
import { withExponentialBackoff } from "../util/retry.ts";
|
|
5
6
|
import { handleApiError } from "./api-error.ts";
|
|
6
7
|
import {
|
|
@@ -223,7 +224,7 @@ const _KVNamespace = Resource(
|
|
|
223
224
|
error instanceof Error &&
|
|
224
225
|
error.message.includes("already exists")
|
|
225
226
|
) {
|
|
226
|
-
|
|
227
|
+
logger.log(`Namespace '${title}' already exists, adopting it`);
|
|
227
228
|
// Find the existing namespace by title
|
|
228
229
|
const existingNamespace = await findKVNamespaceByTitle(api, title);
|
|
229
230
|
|