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
package/src/aws/function.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type { Context } from "../context.ts";
|
|
|
19
19
|
import type { Bundle } from "../esbuild/bundle.ts";
|
|
20
20
|
import { Resource } from "../resource.ts";
|
|
21
21
|
import { ignore } from "../util/ignore.ts";
|
|
22
|
+
import { logger } from "../util/logger.ts";
|
|
22
23
|
import { retry } from "./retry.ts";
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -325,7 +326,7 @@ export const Function = Resource(
|
|
|
325
326
|
);
|
|
326
327
|
} catch (error: any) {
|
|
327
328
|
if (error.name !== "ResourceNotFoundException") {
|
|
328
|
-
|
|
329
|
+
logger.warn("Failed to delete function URL:", error);
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
332
|
}
|
|
@@ -446,7 +447,7 @@ export const Function = Resource(
|
|
|
446
447
|
);
|
|
447
448
|
} catch (permError: any) {
|
|
448
449
|
if (!permError.message?.includes("already exists")) {
|
|
449
|
-
|
|
450
|
+
logger.warn("Error adding URL permission:", permError);
|
|
450
451
|
}
|
|
451
452
|
}
|
|
452
453
|
}
|
|
@@ -489,7 +490,7 @@ export const Function = Resource(
|
|
|
489
490
|
);
|
|
490
491
|
} catch (permError: any) {
|
|
491
492
|
if (!permError.message?.includes("already exists")) {
|
|
492
|
-
|
|
493
|
+
logger.warn("Error adding URL permission:", permError);
|
|
493
494
|
}
|
|
494
495
|
}
|
|
495
496
|
}
|
|
@@ -534,7 +535,7 @@ export const Function = Resource(
|
|
|
534
535
|
);
|
|
535
536
|
} catch (permError: any) {
|
|
536
537
|
if (!permError.message?.includes("already exists")) {
|
|
537
|
-
|
|
538
|
+
logger.warn("Error adding URL permission:", permError);
|
|
538
539
|
}
|
|
539
540
|
}
|
|
540
541
|
}
|
|
@@ -555,7 +556,7 @@ export const Function = Resource(
|
|
|
555
556
|
functionUrl = undefined;
|
|
556
557
|
} catch (error: any) {
|
|
557
558
|
if (error.name !== "ResourceNotFoundException") {
|
|
558
|
-
|
|
559
|
+
logger.warn("Failed to delete function URL:", error);
|
|
559
560
|
}
|
|
560
561
|
}
|
|
561
562
|
}
|
|
@@ -673,12 +674,12 @@ export const Function = Resource(
|
|
|
673
674
|
);
|
|
674
675
|
} catch (permError: any) {
|
|
675
676
|
if (!permError.message?.includes("already exists")) {
|
|
676
|
-
|
|
677
|
+
logger.warn("Error adding URL permission:", permError);
|
|
677
678
|
}
|
|
678
679
|
}
|
|
679
680
|
}
|
|
680
681
|
} catch (error) {
|
|
681
|
-
|
|
682
|
+
logger.warn("Failed to create function URL:", error);
|
|
682
683
|
}
|
|
683
684
|
}
|
|
684
685
|
} else {
|
|
@@ -717,7 +718,7 @@ export const Function = Resource(
|
|
|
717
718
|
functionUrl = urlConfig.FunctionUrl;
|
|
718
719
|
} catch (error: any) {
|
|
719
720
|
if (error.name !== "ResourceNotFoundException") {
|
|
720
|
-
|
|
721
|
+
logger.warn("Failed to get function URL:", error);
|
|
721
722
|
}
|
|
722
723
|
}
|
|
723
724
|
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "@aws-sdk/client-iam";
|
|
10
10
|
import type { Context } from "../../context.ts";
|
|
11
11
|
import { Resource } from "../../resource.ts";
|
|
12
|
+
import { logger } from "../../util/logger.ts";
|
|
12
13
|
import { AccountId } from "../account-id.ts";
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -173,7 +174,7 @@ export const OIDCProvider = Resource(
|
|
|
173
174
|
}
|
|
174
175
|
} catch (error) {
|
|
175
176
|
// Log but don't throw on cleanup errors
|
|
176
|
-
|
|
177
|
+
logger.error("Error during cleanup:", error);
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
return this.destroy();
|
|
@@ -285,7 +286,7 @@ export const OIDCProvider = Resource(
|
|
|
285
286
|
createdAt: Date.now(),
|
|
286
287
|
});
|
|
287
288
|
} catch (error) {
|
|
288
|
-
|
|
289
|
+
logger.error("Error configuring OIDC provider:", error);
|
|
289
290
|
throw error;
|
|
290
291
|
}
|
|
291
292
|
},
|
package/src/aws/queue.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "@aws-sdk/client-sqs";
|
|
10
10
|
import type { Context } from "../context.ts";
|
|
11
11
|
import { Resource } from "../resource.ts";
|
|
12
|
+
import { logger } from "../util/logger.ts";
|
|
12
13
|
import { retry } from "./retry.ts";
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -193,7 +194,7 @@ export const Queue = Resource(
|
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
} catch (error: any) {
|
|
196
|
-
|
|
197
|
+
logger.log(error.message);
|
|
197
198
|
if (!isQueueDoesNotExist(error)) {
|
|
198
199
|
throw error;
|
|
199
200
|
}
|
|
@@ -274,7 +275,7 @@ export const Queue = Resource(
|
|
|
274
275
|
});
|
|
275
276
|
} catch (error: any) {
|
|
276
277
|
if (isQueueDeletedRecently(error)) {
|
|
277
|
-
|
|
278
|
+
logger.log(
|
|
278
279
|
`Queue "${queueName}" was recently deleted and can't be re-created. Waiting and retrying...`,
|
|
279
280
|
);
|
|
280
281
|
// Queue was recently deleted, wait and retry
|
package/src/aws/role.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import type { Context } from "../context.ts";
|
|
19
19
|
import { Resource } from "../resource.ts";
|
|
20
20
|
import { ignore } from "../util/ignore.ts";
|
|
21
|
+
import { logger } from "../util/logger.ts";
|
|
21
22
|
import type { PolicyDocument } from "./policy.ts";
|
|
22
23
|
import { retry } from "./retry.ts";
|
|
23
24
|
|
|
@@ -289,7 +290,7 @@ export const Role = Resource(
|
|
|
289
290
|
// If we get any other error besides NoSuchEntityException, log it but don't fail
|
|
290
291
|
// This ensures the resource is still marked as destroyed
|
|
291
292
|
if (error.name !== NoSuchEntityException.name) {
|
|
292
|
-
|
|
293
|
+
logger.error(`Error deleting role ${props.roleName}:`, error);
|
|
293
294
|
}
|
|
294
295
|
}
|
|
295
296
|
|
|
@@ -359,6 +360,7 @@ export const Role = Resource(
|
|
|
359
360
|
throw error;
|
|
360
361
|
}
|
|
361
362
|
} else if (error.name !== NoSuchEntityException.name) {
|
|
363
|
+
logger.error("Error creating/updating role:", error);
|
|
362
364
|
throw error;
|
|
363
365
|
}
|
|
364
366
|
}
|
package/src/aws/ssm-parameter.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { Context } from "../context.ts";
|
|
|
12
12
|
import { Resource } from "../resource.ts";
|
|
13
13
|
import { type Secret, isSecret } from "../secret.ts";
|
|
14
14
|
import { ignore } from "../util/ignore.ts";
|
|
15
|
+
import { logger } from "../util/logger.ts";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Base properties shared by all SSM Parameter types
|
|
@@ -308,7 +309,7 @@ export const SSMParameter = Resource(
|
|
|
308
309
|
type: (parameter.Parameter.Type as any) ?? parameterType,
|
|
309
310
|
} as SSMParameter);
|
|
310
311
|
} catch (error: any) {
|
|
311
|
-
|
|
312
|
+
logger.error(`Error creating/updating parameter ${props.name}:`, error);
|
|
312
313
|
throw error;
|
|
313
314
|
}
|
|
314
315
|
},
|
|
@@ -2,6 +2,7 @@ import { alchemy } from "../alchemy.ts";
|
|
|
2
2
|
import type { Context } from "../context.ts";
|
|
3
3
|
import { Resource } from "../resource.ts";
|
|
4
4
|
import type { Secret } from "../secret.ts";
|
|
5
|
+
import { logger } from "../util/logger.ts";
|
|
5
6
|
import { sha256 } from "../util/sha256.ts";
|
|
6
7
|
import { createCloudflareApi, type CloudflareApiOptions } from "./api.ts";
|
|
7
8
|
import {
|
|
@@ -269,10 +270,10 @@ export const AccountApiToken = Resource(
|
|
|
269
270
|
const errorData: any = await deleteResponse.json().catch(() => ({
|
|
270
271
|
errors: [{ message: deleteResponse.statusText }],
|
|
271
272
|
}));
|
|
272
|
-
|
|
273
|
+
logger.error(`Error deleting token '${props.name}':`, errorData);
|
|
273
274
|
}
|
|
274
275
|
} catch (error) {
|
|
275
|
-
|
|
276
|
+
logger.error(`Error deleting token '${props.name}':`, error);
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
279
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from "../context.ts";
|
|
2
2
|
import { Resource } from "../resource.ts";
|
|
3
3
|
import { bind } from "../runtime/bind.ts";
|
|
4
|
+
import { logger } from "../util/logger.ts";
|
|
4
5
|
import { handleApiError } from "./api-error.ts";
|
|
5
6
|
import { createCloudflareApi, type CloudflareApiOptions } from "./api.ts";
|
|
6
7
|
import type { Bound } from "./bound.ts";
|
|
@@ -187,7 +188,7 @@ const AiGatewayResource = Resource(
|
|
|
187
188
|
await handleApiError(deleteResponse, "delete", "ai gateway", id);
|
|
188
189
|
}
|
|
189
190
|
} catch (error) {
|
|
190
|
-
|
|
191
|
+
logger.error(`Error deleting AI Gateway ${id}:`, error);
|
|
191
192
|
throw error;
|
|
192
193
|
}
|
|
193
194
|
return this.destroy();
|
|
@@ -217,7 +218,7 @@ const AiGatewayResource = Resource(
|
|
|
217
218
|
const getResponse = await api.get(gatewayPath);
|
|
218
219
|
if (getResponse.status === 200) {
|
|
219
220
|
// Gateway exists, treat as update (PUT)
|
|
220
|
-
|
|
221
|
+
logger.log(
|
|
221
222
|
`AI Gateway '${id}' already exists. Updating existing resource.`,
|
|
222
223
|
);
|
|
223
224
|
const requestBody = mapPropsToApi(id, mergedProps, false);
|
|
@@ -240,7 +241,7 @@ const AiGatewayResource = Resource(
|
|
|
240
241
|
const data: { result: Record<string, any> } = await response!.json();
|
|
241
242
|
apiResource = data.result;
|
|
242
243
|
} catch (error) {
|
|
243
|
-
|
|
244
|
+
logger.error(`Error ${this.phase} AI Gateway '${id}':`, error);
|
|
244
245
|
throw error; // Re-throw the error to fail the deployment
|
|
245
246
|
}
|
|
246
247
|
|
package/src/cloudflare/ai.ts
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Cloudflare Workers AI binding for running machine learning models.
|
|
3
|
+
*
|
|
4
|
+
* The AI binding provides access to Cloudflare's Workers AI platform, allowing you to run
|
|
5
|
+
* inference on various AI models including text generation, image classification, embeddings,
|
|
6
|
+
* and more directly from your Workers.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { Worker, Ai } from "alchemy/cloudflare";
|
|
11
|
+
*
|
|
12
|
+
* const ai = new Ai();
|
|
13
|
+
*
|
|
14
|
+
* await Worker("my-worker", {
|
|
15
|
+
* name: "my-worker",
|
|
16
|
+
* entrypoint: "./src/worker.ts",
|
|
17
|
+
* bindings: {
|
|
18
|
+
* AI: ai
|
|
19
|
+
* }
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
2
23
|
* @see https://developers.cloudflare.com/workers-ai/
|
|
3
24
|
*/
|
|
4
25
|
export class Ai<Models extends AiModelListType = AiModelListType> {
|
|
@@ -42,12 +42,36 @@ export class CloudflareApiError extends Error {
|
|
|
42
42
|
* @param resourceName The name/identifier of the specific resource
|
|
43
43
|
* @returns Never returns - always throws an error
|
|
44
44
|
*/
|
|
45
|
+
/**
|
|
46
|
+
* Helper function to detect OAuth token authentication limitations
|
|
47
|
+
* Does not consume the response - uses the provided parsed JSON data
|
|
48
|
+
*
|
|
49
|
+
* @param json The parsed JSON response data
|
|
50
|
+
* @param action The action being performed (e.g., "creating", "deleting")
|
|
51
|
+
* @param resourceType The type of resource being acted upon (e.g., "email routing")
|
|
52
|
+
* @returns true if it's an OAuth error, false otherwise
|
|
53
|
+
*/
|
|
54
|
+
function isOAuthError(
|
|
55
|
+
json: any,
|
|
56
|
+
_action: string,
|
|
57
|
+
_resourceType: string,
|
|
58
|
+
): boolean {
|
|
59
|
+
const errors: { message: string; code?: number }[] = json?.errors || [];
|
|
60
|
+
return errors.some(
|
|
61
|
+
(error) =>
|
|
62
|
+
error.message?.includes("oauth_token authentication scheme") ||
|
|
63
|
+
error.message?.includes("POST method not allowed") ||
|
|
64
|
+
error.code === 10000,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
45
68
|
export async function handleApiError(
|
|
46
69
|
response: Response,
|
|
47
70
|
action: string,
|
|
48
71
|
resourceType: string,
|
|
49
72
|
resourceName?: string,
|
|
50
73
|
): Promise<never> {
|
|
74
|
+
// Read response body once and parse it
|
|
51
75
|
const text = await response.text();
|
|
52
76
|
let json: any;
|
|
53
77
|
try {
|
|
@@ -55,6 +79,18 @@ export async function handleApiError(
|
|
|
55
79
|
} catch {
|
|
56
80
|
json = { errors: [{ message: text }] };
|
|
57
81
|
}
|
|
82
|
+
|
|
83
|
+
// Check for OAuth-specific errors first
|
|
84
|
+
if (isOAuthError(json, action, resourceType)) {
|
|
85
|
+
throw new Error(
|
|
86
|
+
`${resourceType} ${action} requires API token authentication. ` +
|
|
87
|
+
`OAuth tokens from 'wrangler login' don't support this operation. ` +
|
|
88
|
+
"Please set CLOUDFLARE_API_TOKEN environment variable or pass apiToken option. " +
|
|
89
|
+
"You can create an API token at https://dash.cloudflare.com/profile/api-tokens",
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Handle general API errors
|
|
58
94
|
const errors: { message: string }[] = json?.errors || [
|
|
59
95
|
{ message: response.statusText },
|
|
60
96
|
];
|
package/src/cloudflare/api.ts
CHANGED
|
@@ -176,7 +176,7 @@ export class CloudflareApi {
|
|
|
176
176
|
headers,
|
|
177
177
|
});
|
|
178
178
|
if (response.status.toString().startsWith("5")) {
|
|
179
|
-
throw new InternalError(
|
|
179
|
+
throw new InternalError(response.statusText);
|
|
180
180
|
}
|
|
181
181
|
if (response.status === 403 && !forbidden) {
|
|
182
182
|
// we occasionally get 403s from Cloudflare tha tare actually transient
|
|
@@ -185,7 +185,10 @@ export class CloudflareApi {
|
|
|
185
185
|
throw new ForbiddenError();
|
|
186
186
|
}
|
|
187
187
|
if (response.status === 429) {
|
|
188
|
-
|
|
188
|
+
const data: any = await response.json();
|
|
189
|
+
throw new TooManyRequestsError(
|
|
190
|
+
data.errors[0].message ?? response.statusText,
|
|
191
|
+
);
|
|
189
192
|
}
|
|
190
193
|
return response;
|
|
191
194
|
},
|
|
@@ -267,8 +270,10 @@ export class CloudflareApi {
|
|
|
267
270
|
class InternalError extends Error {}
|
|
268
271
|
|
|
269
272
|
class TooManyRequestsError extends Error {
|
|
270
|
-
constructor() {
|
|
271
|
-
super(
|
|
273
|
+
constructor(message: string) {
|
|
274
|
+
super(
|
|
275
|
+
`Cloudflare Rate Limit Exceeded at ${new Date().toISOString()}: ${message}`,
|
|
276
|
+
);
|
|
272
277
|
}
|
|
273
278
|
}
|
|
274
279
|
|
package/src/cloudflare/assets.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as path from "node:path";
|
|
|
3
3
|
import type { Context } from "../context.ts";
|
|
4
4
|
import { Resource } from "../resource.ts";
|
|
5
5
|
import { getContentType } from "../util/content-type.ts";
|
|
6
|
+
import ignore from "../util/ignore-matcher.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Properties for creating or updating Assets
|
|
@@ -111,7 +112,8 @@ export const Assets = Resource(
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
// Recursively get all files in the assets directory
|
|
114
|
-
const
|
|
115
|
+
const ignoreMatcher = await createIgnoreMatcher(props.path);
|
|
116
|
+
const filesList = await getFilesRecursively(props.path, ignoreMatcher);
|
|
115
117
|
|
|
116
118
|
// Create asset file objects
|
|
117
119
|
const files: AssetFile[] = filesList.map((filePath) => {
|
|
@@ -140,19 +142,41 @@ export const Assets = Resource(
|
|
|
140
142
|
},
|
|
141
143
|
);
|
|
142
144
|
|
|
145
|
+
async function createIgnoreMatcher(
|
|
146
|
+
dir: string,
|
|
147
|
+
): Promise<{ ignores: (path: string) => boolean }> {
|
|
148
|
+
const ignoreMatcher = ignore().add(".assetsignore");
|
|
149
|
+
const ignorePath = path.join(dir, ".assetsignore");
|
|
150
|
+
try {
|
|
151
|
+
const content = await fs.readFile(ignorePath, "utf-8");
|
|
152
|
+
ignoreMatcher.add(content.split("\n"));
|
|
153
|
+
} catch {
|
|
154
|
+
// ignore
|
|
155
|
+
}
|
|
156
|
+
return ignoreMatcher;
|
|
157
|
+
}
|
|
158
|
+
|
|
143
159
|
// Helper functions for file operations
|
|
144
|
-
async function getFilesRecursively(
|
|
160
|
+
async function getFilesRecursively(
|
|
161
|
+
dir: string,
|
|
162
|
+
ignoreMatcher: { ignores: (path: string) => boolean },
|
|
163
|
+
): Promise<string[]> {
|
|
145
164
|
const files = await fs.readdir(dir, { withFileTypes: true });
|
|
165
|
+
const result: string[] = [];
|
|
146
166
|
|
|
147
|
-
|
|
167
|
+
await Promise.all(
|
|
148
168
|
files.map(async (file) => {
|
|
149
169
|
const path = `${dir}/${file.name}`;
|
|
170
|
+
if (ignoreMatcher.ignores(file.name)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
150
173
|
if (file.isDirectory()) {
|
|
151
|
-
|
|
174
|
+
result.push(...(await getFilesRecursively(path, ignoreMatcher)));
|
|
175
|
+
} else {
|
|
176
|
+
result.push(path);
|
|
152
177
|
}
|
|
153
|
-
return path;
|
|
154
178
|
}),
|
|
155
179
|
);
|
|
156
180
|
|
|
157
|
-
return
|
|
181
|
+
return result;
|
|
158
182
|
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { alchemy } from "../alchemy.ts";
|
|
4
|
+
import { Exec } from "../os/exec.ts";
|
|
5
|
+
import { Scope } from "../scope.ts";
|
|
6
|
+
import { Assets } from "./assets.ts";
|
|
7
|
+
import type { Bindings } from "./bindings.ts";
|
|
8
|
+
import type { Website, WebsiteProps } from "./website.ts";
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_COMPATIBILITY_DATE,
|
|
11
|
+
Worker,
|
|
12
|
+
type WorkerProps,
|
|
13
|
+
} from "./worker.ts";
|
|
14
|
+
import { WranglerJson } from "./wrangler.json.ts";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Properties for creating an Astro resource.
|
|
18
|
+
* Extends WebsiteProps, allowing customization of the underlying Website.
|
|
19
|
+
*/
|
|
20
|
+
export interface AstroProps<B extends Bindings> extends WebsiteProps<B> {}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Represents the output of an Astro resource deployment.
|
|
24
|
+
* It resolves to the underlying Cloudflare Worker type, ensuring type safety.
|
|
25
|
+
* Prevents overriding the internal ASSETS binding.
|
|
26
|
+
*/
|
|
27
|
+
export type Astro<B extends Bindings> = B extends { ASSETS: any }
|
|
28
|
+
? never
|
|
29
|
+
: Worker<B & { ASSETS: Assets }>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates and deploys an Astro application using the Cloudflare adapter.
|
|
33
|
+
*
|
|
34
|
+
* This resource simplifies deploying Astro applications by providing sensible
|
|
35
|
+
* defaults for the build command, main entrypoint, and assets directory
|
|
36
|
+
* based on the `@astrojs/cloudflare` adapter output.
|
|
37
|
+
*
|
|
38
|
+
* It wraps the underlying `Website` resource.
|
|
39
|
+
*
|
|
40
|
+
* @param id A unique identifier for the resource.
|
|
41
|
+
* @param props Configuration options for the Astro deployment, overriding defaults.
|
|
42
|
+
* @returns A promise that resolves to the deployed Cloudflare Worker details.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ## Deploy a basic Astro site with default settings
|
|
46
|
+
*
|
|
47
|
+
* Deploy an Astro application with minimal configuration using default build settings.
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { Astro } from "alchemy/cloudflare";
|
|
51
|
+
*
|
|
52
|
+
* const astroSite = await Astro("my-astro-app");
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ## Deploy with custom bindings and build command
|
|
57
|
+
*
|
|
58
|
+
* Deploy an Astro application with custom Cloudflare bindings and build configuration.
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { Astro, D1Database } from "alchemy/cloudflare";
|
|
62
|
+
*
|
|
63
|
+
* const db = await D1Database("my-db");
|
|
64
|
+
* const astroSiteWithDb = await Astro("my-astro-app-with-db", {
|
|
65
|
+
* command: "npm run build", // Specify a custom build command
|
|
66
|
+
* bindings: {
|
|
67
|
+
* DB: db, // Add custom bindings
|
|
68
|
+
* },
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export async function Astro<B extends Bindings>(
|
|
73
|
+
id: string,
|
|
74
|
+
props?: Partial<AstroProps<B>>,
|
|
75
|
+
): Promise<Astro<B>> {
|
|
76
|
+
if (props?.bindings?.ASSETS) {
|
|
77
|
+
throw new Error("ASSETS binding is reserved for internal use");
|
|
78
|
+
}
|
|
79
|
+
const wrangler = props?.wrangler ?? true;
|
|
80
|
+
const main = props?.main ?? path.join("dist", "_worker.js/index.js");
|
|
81
|
+
const assetsDir =
|
|
82
|
+
typeof props?.assets === "string"
|
|
83
|
+
? props?.assets
|
|
84
|
+
: (props?.assets?.dist ?? "dist");
|
|
85
|
+
|
|
86
|
+
return alchemy.run(
|
|
87
|
+
id,
|
|
88
|
+
{
|
|
89
|
+
parent: Scope.current,
|
|
90
|
+
},
|
|
91
|
+
async () => {
|
|
92
|
+
const cwd = path.resolve(props?.cwd || process.cwd());
|
|
93
|
+
const fileName =
|
|
94
|
+
typeof wrangler === "boolean"
|
|
95
|
+
? "wrangler.jsonc"
|
|
96
|
+
: typeof wrangler === "string"
|
|
97
|
+
? wrangler
|
|
98
|
+
: (wrangler?.path ?? "wrangler.jsonc");
|
|
99
|
+
const wranglerPath =
|
|
100
|
+
fileName && path.relative(cwd, path.join(cwd, fileName));
|
|
101
|
+
const wranglerMain =
|
|
102
|
+
typeof wrangler === "object"
|
|
103
|
+
? (wrangler.main ?? props?.main)
|
|
104
|
+
: props?.main;
|
|
105
|
+
|
|
106
|
+
const workerName = props?.name ?? id;
|
|
107
|
+
|
|
108
|
+
const workerProps = {
|
|
109
|
+
...props,
|
|
110
|
+
compatibilityDate:
|
|
111
|
+
props?.compatibilityDate ?? DEFAULT_COMPATIBILITY_DATE,
|
|
112
|
+
compatibilityFlags: [
|
|
113
|
+
"nodejs_compat",
|
|
114
|
+
...(props?.compatibilityFlags ?? []),
|
|
115
|
+
],
|
|
116
|
+
name: workerName,
|
|
117
|
+
entrypoint: main,
|
|
118
|
+
assets: {
|
|
119
|
+
html_handling: "auto-trailing-slash",
|
|
120
|
+
not_found_handling: "single-page-application",
|
|
121
|
+
run_worker_first: false,
|
|
122
|
+
...(typeof props?.assets === "string" ? {} : props?.assets),
|
|
123
|
+
},
|
|
124
|
+
script: props?.main
|
|
125
|
+
? undefined
|
|
126
|
+
: `
|
|
127
|
+
export default {
|
|
128
|
+
async fetch(request, env) {
|
|
129
|
+
return new Response("Not Found", { status: 404 });
|
|
130
|
+
},
|
|
131
|
+
};`,
|
|
132
|
+
url: true,
|
|
133
|
+
adopt: true,
|
|
134
|
+
} as WorkerProps<any> & { name: string };
|
|
135
|
+
|
|
136
|
+
if (wrangler) {
|
|
137
|
+
await WranglerJson("wrangler.jsonc", {
|
|
138
|
+
path: wranglerPath,
|
|
139
|
+
worker: workerProps,
|
|
140
|
+
main: wranglerMain,
|
|
141
|
+
// hard-code the assets directory because we haven't yet included the assets binding
|
|
142
|
+
assets: {
|
|
143
|
+
binding: "ASSETS",
|
|
144
|
+
directory: assetsDir,
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (props?.command) {
|
|
150
|
+
await Exec("build", {
|
|
151
|
+
cwd,
|
|
152
|
+
command: props?.command,
|
|
153
|
+
env: props?.env,
|
|
154
|
+
memoize: props?.memoize,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
await writeFile(
|
|
159
|
+
path.join(cwd, assetsDir, ".assetsignore"),
|
|
160
|
+
["_worker.js", "_routes.json"].join("\n"),
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
return (await Worker("worker", {
|
|
164
|
+
...workerProps,
|
|
165
|
+
bindings: {
|
|
166
|
+
...workerProps.bindings,
|
|
167
|
+
// we don't include the Assets binding until after build to make sure the asset manifest is correct
|
|
168
|
+
// we generate the wrangler.json using all the bind
|
|
169
|
+
ASSETS: await Assets("assets", {
|
|
170
|
+
path: assetsDir,
|
|
171
|
+
}),
|
|
172
|
+
},
|
|
173
|
+
} as WorkerProps<any> & { name: string })) as Website<B>;
|
|
174
|
+
},
|
|
175
|
+
);
|
|
176
|
+
}
|
package/src/cloudflare/auth.ts
CHANGED
|
@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import type { Secret } from "../secret.ts";
|
|
5
|
+
import { createXdgAppPaths } from "../util/xdg-paths.ts";
|
|
5
6
|
/**
|
|
6
7
|
* Authentication options for Cloudflare API
|
|
7
8
|
*/
|
|
@@ -195,9 +196,9 @@ async function findWranglerConfig(): Promise<string> {
|
|
|
195
196
|
`${environment === "production" ? "default.toml" : `${environment}.toml`}`,
|
|
196
197
|
);
|
|
197
198
|
|
|
198
|
-
const xdgAppPaths = (
|
|
199
|
+
const xdgAppPaths = createXdgAppPaths(".wrangler");
|
|
199
200
|
//TODO: We should implement a custom path --global-config and/or the WRANGLER_HOME type environment variable
|
|
200
|
-
const configDir = xdgAppPaths
|
|
201
|
+
const configDir = xdgAppPaths.config(); // New XDG compliant config path
|
|
201
202
|
const legacyConfigDir = path.join(os.homedir(), ".wrangler"); // Legacy config in user's home directory
|
|
202
203
|
|
|
203
204
|
// Check for the .wrangler directory in root if it is not there then use the XDG compliant path.
|
|
@@ -17,11 +17,13 @@ import type { HyperdriveResource } from "./hyperdrive.ts";
|
|
|
17
17
|
import type { KVNamespaceResource } from "./kv-namespace.ts";
|
|
18
18
|
import type { PipelineResource } from "./pipeline.ts";
|
|
19
19
|
import type { QueueResource } from "./queue.ts";
|
|
20
|
+
import type { SecretsStore } from "./secrets-store.ts";
|
|
20
21
|
import type { VectorizeIndexResource } from "./vectorize-index.ts";
|
|
21
22
|
import type { VersionMetadata } from "./version-metadata.ts";
|
|
22
23
|
import type { WorkerStub } from "./worker-stub.ts";
|
|
23
24
|
import type { Worker, WorkerRef } from "./worker.ts";
|
|
24
25
|
import type { Workflow } from "./workflow.ts";
|
|
26
|
+
import type { Images } from "./images.ts";
|
|
25
27
|
|
|
26
28
|
export type Bindings = {
|
|
27
29
|
[bindingName: string]: Binding;
|
|
@@ -44,10 +46,12 @@ export type Binding =
|
|
|
44
46
|
| AnalyticsEngineDataset
|
|
45
47
|
| DurableObjectNamespace<Rpc.DurableObjectBranded | undefined>
|
|
46
48
|
| HyperdriveResource
|
|
49
|
+
| Images
|
|
47
50
|
| KVNamespaceResource
|
|
48
51
|
| PipelineResource
|
|
49
52
|
| QueueResource
|
|
50
53
|
| R2BucketResource
|
|
54
|
+
| SecretsStore<any>
|
|
51
55
|
| {
|
|
52
56
|
type: "kv_namespace";
|
|
53
57
|
id: string;
|
|
@@ -91,6 +95,7 @@ export type WorkerBindingSpec =
|
|
|
91
95
|
| WorkerBindingDispatchNamespace
|
|
92
96
|
| WorkerBindingDurableObjectNamespace
|
|
93
97
|
| WorkerBindingHyperdrive
|
|
98
|
+
| WorkerBindingImages
|
|
94
99
|
| WorkerBindingJson
|
|
95
100
|
| WorkerBindingKVNamespace
|
|
96
101
|
| WorkerBindingMTLSCertificate
|
|
@@ -99,6 +104,7 @@ export type WorkerBindingSpec =
|
|
|
99
104
|
| WorkerBindingQueue
|
|
100
105
|
| WorkerBindingR2Bucket
|
|
101
106
|
| WorkerBindingSecretText
|
|
107
|
+
| WorkerBindingSecretsStore
|
|
102
108
|
| WorkerBindingService
|
|
103
109
|
| WorkerBindingStaticContent
|
|
104
110
|
| WorkerBindingTailConsumer
|
|
@@ -294,6 +300,17 @@ export interface WorkerBindingSecretText {
|
|
|
294
300
|
text: string;
|
|
295
301
|
}
|
|
296
302
|
|
|
303
|
+
export interface WorkerBindingSecretsStore {
|
|
304
|
+
/** The name of the binding */
|
|
305
|
+
name: string;
|
|
306
|
+
/** Type identifier for Secrets Store binding */
|
|
307
|
+
type: "secrets_store";
|
|
308
|
+
/** Store ID */
|
|
309
|
+
store_id: string;
|
|
310
|
+
/** Secret name */
|
|
311
|
+
secret_name: string;
|
|
312
|
+
}
|
|
313
|
+
|
|
297
314
|
/**
|
|
298
315
|
* Service binding type
|
|
299
316
|
*/
|
|
@@ -384,6 +401,16 @@ export interface WorkerBindingWorkflow {
|
|
|
384
401
|
script_name?: string;
|
|
385
402
|
}
|
|
386
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Images binding type
|
|
406
|
+
*/
|
|
407
|
+
export interface WorkerBindingImages {
|
|
408
|
+
/** The name of the binding */
|
|
409
|
+
name: string;
|
|
410
|
+
/** Type identifier for Images binding */
|
|
411
|
+
type: "images";
|
|
412
|
+
}
|
|
413
|
+
|
|
387
414
|
/**
|
|
388
415
|
* Pipeline binding type
|
|
389
416
|
*/
|