alchemy 0.24.1 → 0.26.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.
- 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 +5 -4
- 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 +5 -3
- 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/ai.d.ts +21 -0
- package/lib/cloudflare/ai.d.ts.map +1 -1
- package/lib/cloudflare/ai.js +21 -0
- package/lib/cloudflare/ai.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 +23 -2
- package/lib/cloudflare/bindings.d.ts.map +1 -1
- package/lib/cloudflare/bindings.js.map +1 -1
- package/lib/cloudflare/bound.d.ts +7 -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/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 +9 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +9 -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 -57
- 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 +16 -1
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +31 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +34 -8
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +14 -0
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +23 -0
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/cloudflare/zone.d.ts +30 -2
- package/lib/cloudflare/zone.d.ts.map +1 -1
- package/lib/cloudflare/zone.js +57 -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 +2 -0
- 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 +7 -5
- 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 +5 -5
- package/src/aws/control/properties.ts +48 -0
- package/src/aws/control/resource.ts +5 -3
- 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/ai.ts +21 -0
- 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 +27 -0
- package/src/cloudflare/bound.ts +31 -17
- 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/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 +9 -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 -77
- package/src/cloudflare/worker-metadata.ts +14 -1
- package/src/cloudflare/worker.ts +76 -9
- package/src/cloudflare/wrangler.json.ts +42 -0
- package/src/cloudflare/zone.ts +79 -5
- 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 +2 -0
- 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,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";
|
|
@@ -20,7 +21,12 @@ export * from "./d1-import.ts";
|
|
|
20
21
|
export * from "./dns-records.ts";
|
|
21
22
|
export * from "./do-state-store/index.ts";
|
|
22
23
|
export * from "./durable-object-namespace.ts";
|
|
24
|
+
export * from "./email-address.ts";
|
|
25
|
+
export * from "./email-catch-all.ts";
|
|
26
|
+
export * from "./email-routing.ts";
|
|
27
|
+
export * from "./email-rule.ts";
|
|
23
28
|
export * from "./hyperdrive.ts";
|
|
29
|
+
export * from "./images.ts";
|
|
24
30
|
export * from "./kv-namespace.ts";
|
|
25
31
|
export * from "./nuxt.ts";
|
|
26
32
|
export * from "./permission-groups.ts";
|
|
@@ -31,6 +37,9 @@ export * from "./r2-rest-state-store.ts";
|
|
|
31
37
|
export * from "./react-router.ts";
|
|
32
38
|
export * from "./redwood.ts";
|
|
33
39
|
export * from "./route.ts";
|
|
40
|
+
export * from "./secret.ts";
|
|
41
|
+
export * from "./secrets-store.ts";
|
|
42
|
+
export * from "./sveltekit.ts";
|
|
34
43
|
export * from "./tanstack-start.ts";
|
|
35
44
|
export * from "./vectorize-index.ts";
|
|
36
45
|
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
|
|
|
@@ -2,6 +2,7 @@ import type { Context } from "../context.ts";
|
|
|
2
2
|
import { Resource, ResourceKind } from "../resource.ts";
|
|
3
3
|
import { bind } from "../runtime/bind.ts";
|
|
4
4
|
import type { Secret } from "../secret.ts";
|
|
5
|
+
import { logger } from "../util/logger.ts";
|
|
5
6
|
import { CloudflareApiError, handleApiError } from "./api-error.ts";
|
|
6
7
|
import {
|
|
7
8
|
createCloudflareApi,
|
|
@@ -211,6 +212,14 @@ export interface PipelineProps extends CloudflareApiOptions {
|
|
|
211
212
|
* @default true
|
|
212
213
|
*/
|
|
213
214
|
delete?: boolean;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Whether to adopt an existing pipeline instead of creating a new one.
|
|
218
|
+
* If set to true, the resource will attempt to adopt an existing pipeline with the same name
|
|
219
|
+
*
|
|
220
|
+
* @default false
|
|
221
|
+
*/
|
|
222
|
+
adopt?: boolean;
|
|
214
223
|
}
|
|
215
224
|
|
|
216
225
|
/**
|
|
@@ -359,7 +368,34 @@ const PipelineResource = Resource("cloudflare::Pipeline", async function <
|
|
|
359
368
|
let pipelineData: CloudflarePipelineResponse;
|
|
360
369
|
|
|
361
370
|
if (this.phase === "create") {
|
|
362
|
-
|
|
371
|
+
console.log(props);
|
|
372
|
+
// Check if we should adopt an existing pipeline
|
|
373
|
+
try {
|
|
374
|
+
// Try to create pipeline first
|
|
375
|
+
console.log("Creating new Cloudflare Pipeline:", pipelineName);
|
|
376
|
+
pipelineData = await createPipeline(api, pipelineName, props);
|
|
377
|
+
} catch (error) {
|
|
378
|
+
// If creation fails with 409 (conflict), adopt existing pipeline
|
|
379
|
+
if (
|
|
380
|
+
error instanceof CloudflareApiError &&
|
|
381
|
+
(error.status === 409 ||
|
|
382
|
+
(error.status === 400 &&
|
|
383
|
+
error.message.includes("Pipeline with this name already exists")))
|
|
384
|
+
) {
|
|
385
|
+
if (props.adopt) {
|
|
386
|
+
console.log(
|
|
387
|
+
"Pipeline already exists, adopting existing Cloudflare Pipeline:",
|
|
388
|
+
pipelineName,
|
|
389
|
+
);
|
|
390
|
+
pipelineData = await getPipeline(api, pipelineName);
|
|
391
|
+
} else {
|
|
392
|
+
throw error;
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
// For any other error, rethrow
|
|
396
|
+
throw error;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
363
399
|
} else {
|
|
364
400
|
// Update operation
|
|
365
401
|
if (this.output?.id) {
|
|
@@ -374,7 +410,7 @@ const PipelineResource = Resource("cloudflare::Pipeline", async function <
|
|
|
374
410
|
pipelineData = await updatePipeline(api, pipelineName, props);
|
|
375
411
|
} else {
|
|
376
412
|
// If no ID exists, fall back to creating a new pipeline
|
|
377
|
-
|
|
413
|
+
logger.log(
|
|
378
414
|
"No existing Pipeline ID found, creating new Cloudflare Pipeline:",
|
|
379
415
|
pipelineName,
|
|
380
416
|
);
|
|
@@ -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 { CloudflareApiError, handleApiError } from "./api-error.ts";
|
|
4
5
|
import {
|
|
5
6
|
createCloudflareApi,
|
|
@@ -157,7 +158,7 @@ export const QueueConsumer = Resource(
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
if (this.phase === "delete") {
|
|
160
|
-
|
|
161
|
+
logger.log(`Deleting Queue Consumer for queue ${queueId}`);
|
|
161
162
|
if (props.delete !== false && this.output?.id) {
|
|
162
163
|
// Delete the consumer
|
|
163
164
|
await deleteQueueConsumer(api, queueId, this.output.id);
|
package/src/cloudflare/queue.ts
CHANGED
|
@@ -200,12 +200,8 @@ const QueueResource = Resource("cloudflare::Queue", async function <
|
|
|
200
200
|
const queueName = props.name ?? id;
|
|
201
201
|
|
|
202
202
|
if (this.phase === "delete") {
|
|
203
|
-
console.log("Deleting Cloudflare Queue:", queueName);
|
|
204
203
|
if (props.delete !== false) {
|
|
205
204
|
// Delete Queue
|
|
206
|
-
if (!this.output?.id) {
|
|
207
|
-
console.log(this.output);
|
|
208
|
-
}
|
|
209
205
|
await deleteQueue(api, this.output?.id);
|
|
210
206
|
}
|
|
211
207
|
|
|
@@ -215,7 +211,6 @@ const QueueResource = Resource("cloudflare::Queue", async function <
|
|
|
215
211
|
let queueData: CloudflareQueueResponse;
|
|
216
212
|
|
|
217
213
|
if (this.phase === "create") {
|
|
218
|
-
console.log("Creating Cloudflare Queue:", queueName);
|
|
219
214
|
try {
|
|
220
215
|
queueData = await createQueue(api, queueName, props);
|
|
221
216
|
} catch (error) {
|
|
@@ -239,8 +234,6 @@ const QueueResource = Resource("cloudflare::Queue", async function <
|
|
|
239
234
|
} else {
|
|
240
235
|
// Update operation
|
|
241
236
|
if (this.output?.id) {
|
|
242
|
-
console.log("Updating Cloudflare Queue:", queueName);
|
|
243
|
-
|
|
244
237
|
// Check if name is being changed, which is not allowed
|
|
245
238
|
if (queueName !== this.output.name) {
|
|
246
239
|
throw new Error(
|
|
@@ -252,10 +245,6 @@ const QueueResource = Resource("cloudflare::Queue", async function <
|
|
|
252
245
|
queueData = await updateQueue(api, this.output.id, props);
|
|
253
246
|
} else {
|
|
254
247
|
// If no ID exists, fall back to creating a new queue
|
|
255
|
-
console.log(
|
|
256
|
-
"No existing Queue ID found, creating new Cloudflare Queue:",
|
|
257
|
-
queueName,
|
|
258
|
-
);
|
|
259
248
|
queueData = await createQueue(api, queueName, props);
|
|
260
249
|
}
|
|
261
250
|
}
|
|
@@ -368,7 +357,6 @@ export async function deleteQueue(
|
|
|
368
357
|
queueId?: string,
|
|
369
358
|
): Promise<void> {
|
|
370
359
|
if (!queueId) {
|
|
371
|
-
console.log("No Queue ID provided, skipping delete");
|
|
372
360
|
return;
|
|
373
361
|
}
|
|
374
362
|
|