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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { alchemy } from "../alchemy.ts";
|
|
3
3
|
import { Exec } from "../os/exec.ts";
|
|
4
|
+
import { Scope } from "../scope.ts";
|
|
4
5
|
import { Assets } from "./assets.ts";
|
|
5
6
|
import type { Bindings } from "./bindings.ts";
|
|
6
7
|
import {
|
|
@@ -101,81 +102,90 @@ export async function Website<B extends Bindings>(
|
|
|
101
102
|
}
|
|
102
103
|
const wrangler = props.wrangler ?? true;
|
|
103
104
|
|
|
104
|
-
return alchemy.run(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
return alchemy.run(
|
|
106
|
+
id,
|
|
107
|
+
{
|
|
108
|
+
parent: Scope.current,
|
|
109
|
+
},
|
|
110
|
+
async () => {
|
|
111
|
+
const cwd = path.resolve(props.cwd || process.cwd());
|
|
112
|
+
const fileName =
|
|
113
|
+
typeof wrangler === "boolean"
|
|
114
|
+
? "wrangler.jsonc"
|
|
115
|
+
: typeof wrangler === "string"
|
|
116
|
+
? wrangler
|
|
117
|
+
: (wrangler?.path ?? "wrangler.jsonc");
|
|
118
|
+
const wranglerPath =
|
|
119
|
+
fileName && path.relative(cwd, path.join(cwd, fileName));
|
|
120
|
+
const wranglerMain =
|
|
121
|
+
typeof wrangler === "object"
|
|
122
|
+
? (wrangler.main ?? props.main)
|
|
123
|
+
: props.main;
|
|
116
124
|
|
|
117
|
-
|
|
125
|
+
const workerName = props.name ?? id;
|
|
118
126
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
const assetDir =
|
|
128
|
+
typeof props.assets === "string"
|
|
129
|
+
? props.assets
|
|
130
|
+
: (props.assets?.dist ?? "dist");
|
|
123
131
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
const workerProps = {
|
|
133
|
+
...props,
|
|
134
|
+
compatibilityDate:
|
|
135
|
+
props.compatibilityDate ?? DEFAULT_COMPATIBILITY_DATE,
|
|
136
|
+
name: workerName,
|
|
137
|
+
entrypoint: props.main,
|
|
138
|
+
assets: {
|
|
139
|
+
html_handling: "auto-trailing-slash",
|
|
140
|
+
not_found_handling: "single-page-application",
|
|
141
|
+
run_worker_first: false,
|
|
142
|
+
...(typeof props.assets === "string" ? {} : props.assets),
|
|
143
|
+
},
|
|
144
|
+
script: props.main
|
|
145
|
+
? undefined
|
|
146
|
+
: `
|
|
138
147
|
export default {
|
|
139
148
|
async fetch(request, env) {
|
|
140
149
|
return new Response("Not Found", { status: 404 });
|
|
141
150
|
},
|
|
142
151
|
};`,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
152
|
+
url: true,
|
|
153
|
+
adopt: true,
|
|
154
|
+
} as WorkerProps<any> & { name: string };
|
|
146
155
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
if (wrangler) {
|
|
157
|
+
await WranglerJson("wrangler.jsonc", {
|
|
158
|
+
path: wranglerPath,
|
|
159
|
+
worker: workerProps,
|
|
160
|
+
main: wranglerMain,
|
|
161
|
+
// hard-code the assets directory because we haven't yet included the assets binding
|
|
162
|
+
assets: {
|
|
163
|
+
binding: "ASSETS",
|
|
164
|
+
directory: assetDir,
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
159
168
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
if (props.command) {
|
|
170
|
+
await Exec("build", {
|
|
171
|
+
cwd,
|
|
172
|
+
command: props.command,
|
|
173
|
+
env: props.env,
|
|
174
|
+
memoize: props.memoize,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
168
177
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
return (await Worker("worker", {
|
|
179
|
+
...workerProps,
|
|
180
|
+
bindings: {
|
|
181
|
+
...workerProps.bindings,
|
|
182
|
+
// we don't include the Assets binding until after build to make sure the asset manifest is correct
|
|
183
|
+
// we generate the wrangler.json using all the bind
|
|
184
|
+
ASSETS: await Assets("assets", {
|
|
185
|
+
path: assetDir,
|
|
186
|
+
}),
|
|
187
|
+
},
|
|
188
|
+
} as WorkerProps<any> & { name: string })) as Website<B>;
|
|
189
|
+
},
|
|
190
|
+
);
|
|
181
191
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { AsyncQueue } from "../util/async-queue.ts";
|
|
4
5
|
import { getContentType } from "../util/content-type.ts";
|
|
5
6
|
import type { CloudflareApi } from "./api.ts";
|
|
6
7
|
import type { Assets } from "./assets.ts";
|
|
@@ -63,22 +64,12 @@ export async function uploadAssets(
|
|
|
63
64
|
// Process the assets configuration once at the beginning
|
|
64
65
|
const processedConfig = createAssetConfig(assetConfig);
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
const fileMetadata: Record<string, FileMetadata> = {};
|
|
68
|
-
|
|
69
|
-
// Process each file in the assets
|
|
70
|
-
for (const file of assets.files) {
|
|
71
|
-
const { hash, size } = await calculateFileMetadata(file.filePath);
|
|
72
|
-
// Use the relative path as the key, ensuring it starts with a slash
|
|
73
|
-
const key = file.path.startsWith("/") ? file.path : `/${file.path}`;
|
|
74
|
-
fileMetadata[key] = { hash, size };
|
|
75
|
-
}
|
|
67
|
+
const { manifest, filePathsByHash } = await prepareAssetManifest(assets);
|
|
76
68
|
|
|
77
69
|
// Start the upload session
|
|
78
|
-
const uploadSessionUrl = `/accounts/${api.accountId}/workers/scripts/${workerName}/assets-upload-session`;
|
|
79
70
|
const uploadSessionResponse = await api.post(
|
|
80
|
-
|
|
81
|
-
JSON.stringify({ manifest
|
|
71
|
+
`/accounts/${api.accountId}/workers/scripts/${workerName}/assets-upload-session`,
|
|
72
|
+
JSON.stringify({ manifest }),
|
|
82
73
|
{
|
|
83
74
|
headers: { "Content-Type": "application/json" },
|
|
84
75
|
},
|
|
@@ -86,7 +77,7 @@ export async function uploadAssets(
|
|
|
86
77
|
|
|
87
78
|
if (!uploadSessionResponse.ok) {
|
|
88
79
|
throw new Error(
|
|
89
|
-
`Failed to start assets upload session: ${uploadSessionResponse.status} ${uploadSessionResponse.statusText}`,
|
|
80
|
+
`Failed to start assets upload session: ${uploadSessionResponse.status} ${uploadSessionResponse.statusText} - ${await uploadSessionResponse.text()}`,
|
|
90
81
|
);
|
|
91
82
|
}
|
|
92
83
|
|
|
@@ -105,69 +96,22 @@ export async function uploadAssets(
|
|
|
105
96
|
let completionToken = sessionData.result.jwt;
|
|
106
97
|
const buckets = sessionData.result.buckets;
|
|
107
98
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// Read the file content
|
|
125
|
-
const fileContent = await fs.readFile(file.filePath);
|
|
126
|
-
|
|
127
|
-
// Convert to base64 as required by the API when using base64=true
|
|
128
|
-
const base64Content = fileContent.toString("base64");
|
|
129
|
-
|
|
130
|
-
// Add the file to the form with the hash as the key and set the correct content type
|
|
131
|
-
const blob = new Blob([base64Content], {
|
|
132
|
-
// if you set application/octet-stream, you get weird `-1` errors with a message to contact support
|
|
133
|
-
type: getContentType(file.filePath) ?? "application/null",
|
|
134
|
-
});
|
|
135
|
-
formData.append(fileHash, blob, fileHash);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Upload this batch of files
|
|
139
|
-
const uploadResponse = await api.post(
|
|
140
|
-
`/accounts/${api.accountId}/workers/assets/upload?base64=true`,
|
|
141
|
-
formData,
|
|
142
|
-
{
|
|
143
|
-
headers: {
|
|
144
|
-
Authorization: `Bearer ${completionToken}`,
|
|
145
|
-
"Content-Type": "multipart/form-data",
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
if (!uploadResponse.ok) {
|
|
151
|
-
throw new Error(
|
|
152
|
-
`Failed to upload asset files: ${uploadResponse.status} ${uploadResponse.statusText}`,
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const uploadData = (await uploadResponse.json()) as UploadResponse;
|
|
157
|
-
if (!uploadData.success) {
|
|
158
|
-
const error = uploadData.errors[0];
|
|
159
|
-
const message = error.message;
|
|
160
|
-
const code = error.code;
|
|
161
|
-
throw new Error(
|
|
162
|
-
`Failed to upload asset files: ${message} (Code: ${code})`,
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Update the completion token for the next batch
|
|
167
|
-
if (uploadData.result.jwt) {
|
|
168
|
-
completionToken = uploadData.result.jwt;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
99
|
+
const queue = new AsyncQueue(3);
|
|
100
|
+
await Promise.all(
|
|
101
|
+
buckets.map((bucket) =>
|
|
102
|
+
queue.add(async () => {
|
|
103
|
+
const jwt = await uploadBucket(
|
|
104
|
+
api,
|
|
105
|
+
sessionData.result.jwt,
|
|
106
|
+
bucket,
|
|
107
|
+
filePathsByHash,
|
|
108
|
+
);
|
|
109
|
+
if (jwt) {
|
|
110
|
+
completionToken = jwt;
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
),
|
|
114
|
+
);
|
|
171
115
|
|
|
172
116
|
// Return the final completion token with asset configuration
|
|
173
117
|
return {
|
|
@@ -213,6 +157,74 @@ export function createAssetConfig(config?: AssetsConfig): AssetsConfig {
|
|
|
213
157
|
return assetConfig;
|
|
214
158
|
}
|
|
215
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Prepares the asset manifest for the assets upload session
|
|
162
|
+
*
|
|
163
|
+
* @param assets Assets resource containing files to upload
|
|
164
|
+
* @returns Asset manifest and file paths by hash
|
|
165
|
+
*/
|
|
166
|
+
export async function prepareAssetManifest(assets: Assets) {
|
|
167
|
+
const manifest: Record<string, FileMetadata> = {};
|
|
168
|
+
const filePathsByHash = new Map<string, string>();
|
|
169
|
+
await Promise.all(
|
|
170
|
+
assets.files.map(async (file) => {
|
|
171
|
+
const { hash, size } = await calculateFileMetadata(file.filePath);
|
|
172
|
+
const key = file.path.startsWith("/") ? file.path : `/${file.path}`;
|
|
173
|
+
manifest[key] = { hash, size };
|
|
174
|
+
filePathsByHash.set(hash, file.filePath);
|
|
175
|
+
}),
|
|
176
|
+
);
|
|
177
|
+
return { manifest, filePathsByHash };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function uploadBucket(
|
|
181
|
+
api: CloudflareApi,
|
|
182
|
+
jwt: string,
|
|
183
|
+
bucket: string[],
|
|
184
|
+
files: Map<string, string>,
|
|
185
|
+
) {
|
|
186
|
+
const formData = new FormData();
|
|
187
|
+
await Promise.all(
|
|
188
|
+
bucket.map(async (fileHash) => {
|
|
189
|
+
const filePath = files.get(fileHash);
|
|
190
|
+
if (!filePath) {
|
|
191
|
+
throw new Error(`Could not find file with hash ${fileHash}`);
|
|
192
|
+
}
|
|
193
|
+
const fileContent = await fs.readFile(filePath);
|
|
194
|
+
const blob = new Blob([fileContent.toString("base64")], {
|
|
195
|
+
type: getContentType(filePath) ?? "application/null",
|
|
196
|
+
});
|
|
197
|
+
formData.append(fileHash, blob, fileHash);
|
|
198
|
+
}),
|
|
199
|
+
);
|
|
200
|
+
const uploadResponse = await api.post(
|
|
201
|
+
`/accounts/${api.accountId}/workers/assets/upload?base64=true`,
|
|
202
|
+
formData,
|
|
203
|
+
{
|
|
204
|
+
headers: {
|
|
205
|
+
Authorization: `Bearer ${jwt}`,
|
|
206
|
+
"Content-Type": "multipart/form-data",
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
if (!uploadResponse.ok) {
|
|
212
|
+
throw new Error(
|
|
213
|
+
`Failed to upload asset files: ${uploadResponse.status} ${uploadResponse.statusText}`,
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const uploadData = (await uploadResponse.json()) as UploadResponse;
|
|
218
|
+
if (!uploadData.success) {
|
|
219
|
+
const error = uploadData.errors[0];
|
|
220
|
+
const message = error.message;
|
|
221
|
+
const code = error.code;
|
|
222
|
+
throw new Error(`Failed to upload asset files: ${message} (Code: ${code})`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return uploadData.result.jwt;
|
|
226
|
+
}
|
|
227
|
+
|
|
216
228
|
/**
|
|
217
229
|
* Calculate the SHA-256 hash and size of a file
|
|
218
230
|
*
|
|
@@ -230,6 +242,12 @@ export async function calculateFileMetadata(
|
|
|
230
242
|
const extension = path.extname(filePath).substring(1);
|
|
231
243
|
hash.update(extension);
|
|
232
244
|
|
|
245
|
+
if (contents.length > 26214400) {
|
|
246
|
+
throw new Error(
|
|
247
|
+
`File "${filePath}" is too large to upload as an asset to Cloudflare (the file is ${(contents.length / 1024 / 1024).toFixed(2)} MB; the maximum size is 25MB).`,
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
233
251
|
return {
|
|
234
252
|
hash: hash.digest("hex").slice(0, 32),
|
|
235
253
|
size: contents.length,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import type { Context } from "../context.ts";
|
|
3
|
+
import { logger } from "../util/logger.ts";
|
|
3
4
|
import { slugify } from "../util/slugify.ts";
|
|
4
5
|
import {
|
|
5
6
|
Self,
|
|
@@ -386,6 +387,13 @@ export async function prepareWorkerMetadata<B extends Bindings>(
|
|
|
386
387
|
name: bindingName,
|
|
387
388
|
bucket_name: binding.name,
|
|
388
389
|
});
|
|
390
|
+
} else if (binding.type === "secrets_store") {
|
|
391
|
+
meta.bindings.push({
|
|
392
|
+
type: "secrets_store",
|
|
393
|
+
name: bindingName,
|
|
394
|
+
store_id: binding.id,
|
|
395
|
+
secret_name: bindingName,
|
|
396
|
+
});
|
|
389
397
|
} else if (binding.type === "assets") {
|
|
390
398
|
meta.bindings.push({
|
|
391
399
|
type: "assets",
|
|
@@ -460,6 +468,11 @@ export async function prepareWorkerMetadata<B extends Bindings>(
|
|
|
460
468
|
name: bindingName,
|
|
461
469
|
dataset: binding.dataset,
|
|
462
470
|
});
|
|
471
|
+
} else if (binding.type === "images") {
|
|
472
|
+
meta.bindings.push({
|
|
473
|
+
type: "images",
|
|
474
|
+
name: bindingName,
|
|
475
|
+
});
|
|
463
476
|
} else if (binding.type === "version_metadata") {
|
|
464
477
|
meta.bindings.push({
|
|
465
478
|
type: "version_metadata",
|
|
@@ -544,7 +557,7 @@ export async function prepareWorkerMetadata<B extends Bindings>(
|
|
|
544
557
|
meta.body_part = scriptName;
|
|
545
558
|
}
|
|
546
559
|
if (process.env.DEBUG) {
|
|
547
|
-
|
|
560
|
+
logger.log(meta);
|
|
548
561
|
}
|
|
549
562
|
return meta;
|
|
550
563
|
}
|
package/src/cloudflare/worker.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { Secret, secret } from "../secret.ts";
|
|
|
10
10
|
import { serializeScope } from "../serde.ts";
|
|
11
11
|
import type { type } from "../type.ts";
|
|
12
12
|
import { getContentType } from "../util/content-type.ts";
|
|
13
|
+
import { logger } from "../util/logger.ts";
|
|
13
14
|
import { withExponentialBackoff } from "../util/retry.ts";
|
|
14
15
|
import { slugify } from "../util/slugify.ts";
|
|
15
16
|
import { CloudflareApiError, handleApiError } from "./api-error.ts";
|
|
@@ -50,6 +51,7 @@ import {
|
|
|
50
51
|
listQueueConsumersForWorker,
|
|
51
52
|
} from "./queue-consumer.ts";
|
|
52
53
|
import { type QueueResource, isQueue } from "./queue.ts";
|
|
54
|
+
import { Route } from "./route.ts";
|
|
53
55
|
import { isVectorizeIndex } from "./vectorize-index.ts";
|
|
54
56
|
import { type AssetUploadResult, uploadAssets } from "./worker-assets.ts";
|
|
55
57
|
import {
|
|
@@ -216,6 +218,32 @@ export interface BaseWorkerProps<
|
|
|
216
218
|
*/
|
|
217
219
|
eventSources?: EventSource[];
|
|
218
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Routes to create for this worker.
|
|
223
|
+
*
|
|
224
|
+
* Each route maps a URL pattern to this worker script.
|
|
225
|
+
*/
|
|
226
|
+
routes?: Array<{
|
|
227
|
+
/**
|
|
228
|
+
* URL pattern for the route
|
|
229
|
+
* @example "sub.example.com/*"
|
|
230
|
+
*/
|
|
231
|
+
pattern: string;
|
|
232
|
+
/**
|
|
233
|
+
* Zone ID for the route. If not provided, will be automatically inferred from the route pattern.
|
|
234
|
+
*/
|
|
235
|
+
zoneId?: string;
|
|
236
|
+
/**
|
|
237
|
+
* Whether this is a custom domain route
|
|
238
|
+
*/
|
|
239
|
+
customDomain?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Whether to adopt an existing route with the same pattern if it exists
|
|
242
|
+
* @default false
|
|
243
|
+
*/
|
|
244
|
+
adopt?: boolean;
|
|
245
|
+
}>;
|
|
246
|
+
|
|
219
247
|
/**
|
|
220
248
|
* The RPC class to use for the worker.
|
|
221
249
|
*
|
|
@@ -322,7 +350,7 @@ export type Worker<
|
|
|
322
350
|
B extends Bindings | undefined = Bindings | undefined,
|
|
323
351
|
RPC extends Rpc.WorkerEntrypointBranded = Rpc.WorkerEntrypointBranded,
|
|
324
352
|
> = Resource<"cloudflare::Worker"> &
|
|
325
|
-
Omit<WorkerProps<B>, "url" | "script"> &
|
|
353
|
+
Omit<WorkerProps<B>, "url" | "script" | "routes"> &
|
|
326
354
|
globalThis.Service & {
|
|
327
355
|
/** @internal phantom property */
|
|
328
356
|
__rpc__?: RPC;
|
|
@@ -367,6 +395,11 @@ export type Worker<
|
|
|
367
395
|
*/
|
|
368
396
|
assets?: AssetsConfig;
|
|
369
397
|
|
|
398
|
+
/**
|
|
399
|
+
* The routes that were created for this worker
|
|
400
|
+
*/
|
|
401
|
+
routes?: Route[];
|
|
402
|
+
|
|
370
403
|
// phantom property (for typeof myWorker.Env)
|
|
371
404
|
Env: B extends Bindings
|
|
372
405
|
? {
|
|
@@ -633,10 +666,9 @@ export function Worker<const B extends Bindings>(
|
|
|
633
666
|
return _Worker(id, {
|
|
634
667
|
...(props as any),
|
|
635
668
|
url: true,
|
|
636
|
-
compatibilityFlags:
|
|
637
|
-
"nodejs_compat",
|
|
638
|
-
|
|
639
|
-
],
|
|
669
|
+
compatibilityFlags: Array.from(
|
|
670
|
+
new Set(["nodejs_compat", ...(props.compatibilityFlags ?? [])]),
|
|
671
|
+
),
|
|
640
672
|
entrypoint: meta!.filename,
|
|
641
673
|
name: workerName,
|
|
642
674
|
// adopt because the stub guarnatees that the worker exists
|
|
@@ -652,9 +684,10 @@ export function Worker<const B extends Bindings>(
|
|
|
652
684
|
"esbuild",
|
|
653
685
|
// TODO(sam): this is for fetch, why is it a package?
|
|
654
686
|
"undici",
|
|
655
|
-
// TODO(sam): no idea where this came from, feels dangerous to externalize it
|
|
656
|
-
"ws",
|
|
657
687
|
"miniflare",
|
|
688
|
+
"@iarna/toml",
|
|
689
|
+
"cli-*",
|
|
690
|
+
"react*",
|
|
658
691
|
],
|
|
659
692
|
banner: {
|
|
660
693
|
js: "var __ALCHEMY_RUNTIME__ = true;",
|
|
@@ -720,7 +753,7 @@ export function Worker<const B extends Bindings>(
|
|
|
720
753
|
const incoming = request.url.startsWith("/")
|
|
721
754
|
? new URL(`${worker.url}${request.url}`)
|
|
722
755
|
: new URL(request.url);
|
|
723
|
-
|
|
756
|
+
logger.log(incoming);
|
|
724
757
|
const proxyURL = new URL(
|
|
725
758
|
`${incoming.pathname}${incoming.search}${incoming.hash}`,
|
|
726
759
|
origin,
|
|
@@ -969,6 +1002,38 @@ export const _Worker = Resource(
|
|
|
969
1002
|
|
|
970
1003
|
const { scriptMetadata, workerUrl, now } = await uploadWorkerScript(props);
|
|
971
1004
|
|
|
1005
|
+
// Create routes if provided and capture their outputs
|
|
1006
|
+
let createdRoutes: Route[] = [];
|
|
1007
|
+
if (props.routes && props.routes.length > 0) {
|
|
1008
|
+
// Validate for duplicate patterns
|
|
1009
|
+
const patterns = props.routes.map((route) => route.pattern);
|
|
1010
|
+
const duplicates = patterns.filter(
|
|
1011
|
+
(pattern, index) => patterns.indexOf(pattern) !== index,
|
|
1012
|
+
);
|
|
1013
|
+
if (duplicates.length > 0) {
|
|
1014
|
+
throw new Error(
|
|
1015
|
+
`Duplicate route patterns found: ${duplicates.join(", ")}`,
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// Create Route resources for each route and capture their outputs
|
|
1020
|
+
createdRoutes = await Promise.all(
|
|
1021
|
+
props.routes.map(async (routeConfig) => {
|
|
1022
|
+
return await Route(routeConfig.pattern, {
|
|
1023
|
+
pattern: routeConfig.pattern,
|
|
1024
|
+
script: workerName,
|
|
1025
|
+
zoneId: routeConfig.zoneId, // Route resource will handle inference if not provided
|
|
1026
|
+
adopt: routeConfig.adopt ?? false,
|
|
1027
|
+
accountId: props.accountId,
|
|
1028
|
+
apiKey: props.apiKey,
|
|
1029
|
+
apiToken: props.apiToken,
|
|
1030
|
+
baseUrl: props.baseUrl,
|
|
1031
|
+
email: props.email,
|
|
1032
|
+
});
|
|
1033
|
+
}),
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
972
1037
|
function exportBindings() {
|
|
973
1038
|
return Object.fromEntries(
|
|
974
1039
|
Object.entries(props.bindings ?? ({} as B)).map(
|
|
@@ -1014,6 +1079,8 @@ export const _Worker = Resource(
|
|
|
1014
1079
|
assets: props.assets,
|
|
1015
1080
|
// Include cron triggers in the output
|
|
1016
1081
|
crons: props.crons,
|
|
1082
|
+
// Include the created routes in the output
|
|
1083
|
+
routes: createdRoutes.length > 0 ? createdRoutes : undefined,
|
|
1017
1084
|
// phantom property
|
|
1018
1085
|
Env: undefined!,
|
|
1019
1086
|
} as unknown as Worker<B>);
|
|
@@ -1048,7 +1115,7 @@ export async function deleteWorker<B extends Bindings>(
|
|
|
1048
1115
|
},
|
|
1049
1116
|
);
|
|
1050
1117
|
} catch (error) {
|
|
1051
|
-
|
|
1118
|
+
logger.warn("Failed to disable worker URL during deletion:", error);
|
|
1052
1119
|
}
|
|
1053
1120
|
}
|
|
1054
1121
|
|
|
@@ -197,6 +197,13 @@ export interface WranglerJsonSpec {
|
|
|
197
197
|
binding: string;
|
|
198
198
|
};
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Images bindings
|
|
202
|
+
*/
|
|
203
|
+
images?: {
|
|
204
|
+
binding: string;
|
|
205
|
+
};
|
|
206
|
+
|
|
200
207
|
/**
|
|
201
208
|
* KV Namespace bindings
|
|
202
209
|
*/
|
|
@@ -341,6 +348,15 @@ export interface WranglerJsonSpec {
|
|
|
341
348
|
*/
|
|
342
349
|
pipelines?: { binding: string; pipeline: string }[];
|
|
343
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Secrets Store bindings
|
|
353
|
+
*/
|
|
354
|
+
secrets_store_secrets?: {
|
|
355
|
+
binding: string;
|
|
356
|
+
store_id: string;
|
|
357
|
+
secret_name: string;
|
|
358
|
+
}[];
|
|
359
|
+
|
|
344
360
|
/**
|
|
345
361
|
* Version metadata bindings
|
|
346
362
|
*/
|
|
@@ -408,6 +424,11 @@ function processBindings(
|
|
|
408
424
|
localConnectionString: string;
|
|
409
425
|
}[] = [];
|
|
410
426
|
const pipelines: { binding: string; pipeline: string }[] = [];
|
|
427
|
+
const secretsStoreSecrets: {
|
|
428
|
+
binding: string;
|
|
429
|
+
store_id: string;
|
|
430
|
+
secret_name: string;
|
|
431
|
+
}[] = [];
|
|
411
432
|
|
|
412
433
|
for (const eventSource of eventSources ?? []) {
|
|
413
434
|
if (isQueueEventSource(eventSource)) {
|
|
@@ -523,6 +544,13 @@ function processBindings(
|
|
|
523
544
|
spec.ai = {
|
|
524
545
|
binding: bindingName,
|
|
525
546
|
};
|
|
547
|
+
} else if (binding.type === "images") {
|
|
548
|
+
if (spec.images) {
|
|
549
|
+
throw new Error(`Images already bound to ${spec.images.binding}`);
|
|
550
|
+
}
|
|
551
|
+
spec.images = {
|
|
552
|
+
binding: bindingName,
|
|
553
|
+
};
|
|
526
554
|
} else if (binding.type === "analytics_engine") {
|
|
527
555
|
analyticsEngineDatasets.push({
|
|
528
556
|
binding: bindingName,
|
|
@@ -556,6 +584,16 @@ function processBindings(
|
|
|
556
584
|
});
|
|
557
585
|
} else if (binding.type === "json") {
|
|
558
586
|
// TODO(sam): anything to do here? not sure wrangler.json supports this
|
|
587
|
+
} else if (binding.type === "secrets_store") {
|
|
588
|
+
if (binding.secrets) {
|
|
589
|
+
for (const [secretName, _secret] of Object.entries(binding.secrets)) {
|
|
590
|
+
secretsStoreSecrets.push({
|
|
591
|
+
binding: bindingName,
|
|
592
|
+
store_id: binding.id,
|
|
593
|
+
secret_name: secretName,
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
}
|
|
559
597
|
} else {
|
|
560
598
|
// biome-ignore lint/correctness/noVoidTypeReturn: it returns never
|
|
561
599
|
return assertNever(binding);
|
|
@@ -618,4 +656,8 @@ function processBindings(
|
|
|
618
656
|
if (pipelines.length > 0) {
|
|
619
657
|
spec.pipelines = pipelines;
|
|
620
658
|
}
|
|
659
|
+
|
|
660
|
+
if (secretsStoreSecrets.length > 0) {
|
|
661
|
+
spec.secrets_store_secrets = secretsStoreSecrets;
|
|
662
|
+
}
|
|
621
663
|
}
|