alchemy 0.25.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/lib/ai/astro-file.d.ts.map +1 -1
- package/lib/ai/astro-file.js +2 -1
- package/lib/ai/astro-file.js.map +1 -1
- package/lib/ai/client.d.ts.map +1 -1
- package/lib/ai/client.js +3 -2
- package/lib/ai/client.js.map +1 -1
- package/lib/alchemy.d.ts +7 -0
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +19 -3
- package/lib/alchemy.js.map +1 -1
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +63 -5
- package/lib/apply.js.map +1 -1
- package/lib/aws/control/client.js +4 -3
- package/lib/aws/control/client.js.map +1 -1
- package/lib/aws/control/properties.d.ts +6 -0
- package/lib/aws/control/properties.d.ts.map +1 -1
- package/lib/aws/control/properties.js +48 -0
- package/lib/aws/control/properties.js.map +1 -1
- package/lib/aws/control/resource.d.ts.map +1 -1
- package/lib/aws/control/resource.js +3 -2
- package/lib/aws/control/resource.js.map +1 -1
- package/lib/aws/control/types.d.ts +3969 -4862
- package/lib/aws/control/types.d.ts.map +1 -1
- package/lib/aws/control/types.js.map +1 -1
- package/lib/aws/function.d.ts.map +1 -1
- package/lib/aws/function.js +9 -8
- package/lib/aws/function.js.map +1 -1
- package/lib/aws/oidc/oidc-provider.d.ts.map +1 -1
- package/lib/aws/oidc/oidc-provider.js +3 -2
- package/lib/aws/oidc/oidc-provider.js.map +1 -1
- package/lib/aws/queue.d.ts.map +1 -1
- package/lib/aws/queue.js +3 -2
- package/lib/aws/queue.js.map +1 -1
- package/lib/aws/role.d.ts.map +1 -1
- package/lib/aws/role.js +3 -1
- package/lib/aws/role.js.map +1 -1
- package/lib/aws/ssm-parameter.d.ts.map +1 -1
- package/lib/aws/ssm-parameter.js +2 -1
- package/lib/aws/ssm-parameter.js.map +1 -1
- package/lib/cloudflare/account-api-token.d.ts.map +1 -1
- package/lib/cloudflare/account-api-token.js +3 -2
- package/lib/cloudflare/account-api-token.js.map +1 -1
- package/lib/cloudflare/ai-gateway.d.ts.map +1 -1
- package/lib/cloudflare/ai-gateway.js +4 -3
- package/lib/cloudflare/ai-gateway.js.map +1 -1
- package/lib/cloudflare/api-error.d.ts +0 -9
- package/lib/cloudflare/api-error.d.ts.map +1 -1
- package/lib/cloudflare/api-error.js +24 -0
- package/lib/cloudflare/api-error.js.map +1 -1
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +5 -4
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/assets.d.ts.map +1 -1
- package/lib/cloudflare/assets.js +26 -6
- package/lib/cloudflare/assets.js.map +1 -1
- package/lib/cloudflare/astro.d.ts +63 -0
- package/lib/cloudflare/astro.d.ts.map +1 -0
- package/lib/cloudflare/astro.js +133 -0
- package/lib/cloudflare/astro.js.map +1 -0
- package/lib/cloudflare/auth.d.ts.map +1 -1
- package/lib/cloudflare/auth.js +3 -2
- package/lib/cloudflare/auth.js.map +1 -1
- package/lib/cloudflare/bindings.d.ts +24 -2
- package/lib/cloudflare/bindings.d.ts.map +1 -1
- package/lib/cloudflare/bindings.js.map +1 -1
- package/lib/cloudflare/bound.d.ts +10 -1
- package/lib/cloudflare/bound.d.ts.map +1 -1
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +12 -8
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/bundle/bundle-worker.d.ts.map +1 -1
- package/lib/cloudflare/bundle/bundle-worker.js +2 -1
- package/lib/cloudflare/bundle/bundle-worker.js.map +1 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.d.ts.map +1 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.js +2 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.js.map +1 -1
- package/lib/cloudflare/custom-domain.d.ts.map +1 -1
- package/lib/cloudflare/custom-domain.js +10 -9
- package/lib/cloudflare/custom-domain.js.map +1 -1
- package/lib/cloudflare/d1-database.d.ts.map +1 -1
- package/lib/cloudflare/d1-database.js +11 -10
- package/lib/cloudflare/d1-database.js.map +1 -1
- package/lib/cloudflare/d1-export.d.ts.map +1 -1
- package/lib/cloudflare/d1-export.js +2 -1
- package/lib/cloudflare/d1-export.js.map +1 -1
- package/lib/cloudflare/d1-import.d.ts.map +1 -1
- package/lib/cloudflare/d1-import.js +2 -1
- package/lib/cloudflare/d1-import.js.map +1 -1
- package/lib/cloudflare/d1-migrations.d.ts.map +1 -1
- package/lib/cloudflare/d1-migrations.js +2 -1
- package/lib/cloudflare/d1-migrations.js.map +1 -1
- package/lib/cloudflare/dispatch-namespace.d.ts +94 -0
- package/lib/cloudflare/dispatch-namespace.d.ts.map +1 -0
- package/lib/cloudflare/dispatch-namespace.js +143 -0
- package/lib/cloudflare/dispatch-namespace.js.map +1 -0
- package/lib/cloudflare/dns-records.d.ts.map +1 -1
- package/lib/cloudflare/dns-records.js +5 -4
- package/lib/cloudflare/dns-records.js.map +1 -1
- package/lib/cloudflare/do-state-store/worker.d.ts.map +1 -1
- package/lib/cloudflare/do-state-store/worker.js +4 -0
- package/lib/cloudflare/do-state-store/worker.js.map +1 -1
- package/lib/cloudflare/email-address.d.ts +79 -0
- package/lib/cloudflare/email-address.d.ts.map +1 -0
- package/lib/cloudflare/email-address.js +112 -0
- package/lib/cloudflare/email-address.js.map +1 -0
- package/lib/cloudflare/email-catch-all.d.ts +123 -0
- package/lib/cloudflare/email-catch-all.d.ts.map +1 -0
- package/lib/cloudflare/email-catch-all.js +124 -0
- package/lib/cloudflare/email-catch-all.js.map +1 -0
- package/lib/cloudflare/email-routing.d.ts +89 -0
- package/lib/cloudflare/email-routing.d.ts.map +1 -0
- package/lib/cloudflare/email-routing.js +120 -0
- package/lib/cloudflare/email-routing.js.map +1 -0
- package/lib/cloudflare/email-rule.d.ts +196 -0
- package/lib/cloudflare/email-rule.d.ts.map +1 -0
- package/lib/cloudflare/email-rule.js +153 -0
- package/lib/cloudflare/email-rule.js.map +1 -0
- package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
- package/lib/cloudflare/hyperdrive.js +5 -4
- package/lib/cloudflare/hyperdrive.js.map +1 -1
- package/lib/cloudflare/images.d.ts +60 -0
- package/lib/cloudflare/images.d.ts.map +1 -0
- package/lib/cloudflare/images.js +60 -0
- package/lib/cloudflare/images.js.map +1 -0
- package/lib/cloudflare/index.d.ts +10 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +10 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv-namespace.js +2 -1
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/pipeline.d.ts +7 -0
- package/lib/cloudflare/pipeline.d.ts.map +1 -1
- package/lib/cloudflare/pipeline.js +28 -2
- package/lib/cloudflare/pipeline.js.map +1 -1
- package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
- package/lib/cloudflare/queue-consumer.js +2 -1
- package/lib/cloudflare/queue-consumer.js.map +1 -1
- package/lib/cloudflare/queue.d.ts.map +1 -1
- package/lib/cloudflare/queue.js +0 -8
- package/lib/cloudflare/queue.js.map +1 -1
- package/lib/cloudflare/route.d.ts +26 -1
- package/lib/cloudflare/route.d.ts.map +1 -1
- package/lib/cloudflare/route.js +84 -16
- package/lib/cloudflare/route.js.map +1 -1
- package/lib/cloudflare/secret.d.ts +137 -0
- package/lib/cloudflare/secret.d.ts.map +1 -0
- package/lib/cloudflare/secret.js +122 -0
- package/lib/cloudflare/secret.js.map +1 -0
- package/lib/cloudflare/secrets-store.d.ts +145 -0
- package/lib/cloudflare/secrets-store.d.ts.map +1 -0
- package/lib/cloudflare/secrets-store.js +213 -0
- package/lib/cloudflare/secrets-store.js.map +1 -0
- package/lib/cloudflare/sveltekit.d.ts +49 -0
- package/lib/cloudflare/sveltekit.d.ts.map +1 -0
- package/lib/cloudflare/sveltekit.js +56 -0
- package/lib/cloudflare/sveltekit.js.map +1 -0
- package/lib/cloudflare/user.d.ts.map +1 -1
- package/lib/cloudflare/user.js +2 -1
- package/lib/cloudflare/user.js.map +1 -1
- package/lib/cloudflare/vectorize-index.d.ts.map +1 -1
- package/lib/cloudflare/vectorize-index.js +6 -5
- package/lib/cloudflare/vectorize-index.js.map +1 -1
- package/lib/cloudflare/vectorize-metadata-index.d.ts.map +1 -1
- package/lib/cloudflare/vectorize-metadata-index.js +2 -1
- package/lib/cloudflare/vectorize-metadata-index.js.map +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +7 -2
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts +18 -0
- package/lib/cloudflare/worker-assets.d.ts.map +1 -1
- package/lib/cloudflare/worker-assets.js +61 -67
- package/lib/cloudflare/worker-assets.js.map +1 -1
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
- package/lib/cloudflare/worker-metadata.js +23 -1
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +43 -2
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +50 -11
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +21 -0
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +33 -0
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/cloudflare/zone.d.ts.map +1 -1
- package/lib/cloudflare/zone.js +4 -3
- package/lib/cloudflare/zone.js.map +1 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +30 -13
- package/lib/destroy.js.map +1 -1
- package/lib/dns/godaddy.d.ts.map +1 -1
- package/lib/dns/godaddy.js +3 -2
- package/lib/dns/godaddy.js.map +1 -1
- package/lib/dns/import-dns.d.ts.map +1 -1
- package/lib/dns/import-dns.js +2 -1
- package/lib/dns/import-dns.js.map +1 -1
- package/lib/esbuild/bundle.d.ts +1 -1
- package/lib/esbuild/bundle.d.ts.map +1 -1
- package/lib/esbuild/bundle.js +2 -1
- package/lib/esbuild/bundle.js.map +1 -1
- package/lib/fs/copy-file.d.ts.map +1 -1
- package/lib/fs/copy-file.js +2 -1
- package/lib/fs/copy-file.js.map +1 -1
- package/lib/fs/file.d.ts.map +1 -1
- package/lib/fs/file.js +2 -1
- package/lib/fs/file.js.map +1 -1
- package/lib/github/client.d.ts.map +1 -1
- package/lib/github/client.js +11 -10
- package/lib/github/client.js.map +1 -1
- package/lib/github/repository-environment.d.ts.map +1 -1
- package/lib/github/repository-environment.js +5 -4
- package/lib/github/repository-environment.js.map +1 -1
- package/lib/github/secret.d.ts.map +1 -1
- package/lib/github/secret.js +7 -6
- package/lib/github/secret.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/neon/project.d.ts.map +1 -1
- package/lib/neon/project.js +3 -2
- package/lib/neon/project.js.map +1 -1
- package/lib/planetscale/api.d.ts +53 -0
- package/lib/planetscale/api.d.ts.map +1 -0
- package/lib/planetscale/api.js +84 -0
- package/lib/planetscale/api.js.map +1 -0
- package/lib/planetscale/branch.d.ts +129 -0
- package/lib/planetscale/branch.d.ts.map +1 -0
- package/lib/planetscale/branch.js +161 -0
- package/lib/planetscale/branch.js.map +1 -0
- package/lib/planetscale/database.d.ts +143 -0
- package/lib/planetscale/database.d.ts.map +1 -0
- package/lib/planetscale/database.js +184 -0
- package/lib/planetscale/database.js.map +1 -0
- package/lib/planetscale/index.d.ts +5 -0
- package/lib/planetscale/index.d.ts.map +1 -0
- package/lib/planetscale/index.js +5 -0
- package/lib/planetscale/index.js.map +1 -0
- package/lib/planetscale/utils.d.ts +15 -0
- package/lib/planetscale/utils.d.ts.map +1 -0
- package/lib/planetscale/utils.js +95 -0
- package/lib/planetscale/utils.js.map +1 -0
- package/lib/resource.js +7 -1
- package/lib/resource.js.map +1 -1
- package/lib/runtime/plugin.d.ts.map +1 -1
- package/lib/runtime/plugin.js +2 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/scope.d.ts +13 -2
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +53 -10
- package/lib/scope.js.map +1 -1
- package/lib/sentry/client-key.d.ts.map +1 -1
- package/lib/sentry/client-key.js +5 -4
- package/lib/sentry/client-key.js.map +1 -1
- package/lib/sentry/project.d.ts.map +1 -1
- package/lib/sentry/project.js +5 -4
- package/lib/sentry/project.js.map +1 -1
- package/lib/sentry/team.d.ts.map +1 -1
- package/lib/sentry/team.js +5 -4
- package/lib/sentry/team.js.map +1 -1
- package/lib/stripe/card.d.ts.map +1 -1
- package/lib/stripe/card.js +2 -1
- package/lib/stripe/card.js.map +1 -1
- package/lib/stripe/client.d.ts.map +1 -1
- package/lib/stripe/client.js +3 -2
- package/lib/stripe/client.js.map +1 -1
- package/lib/stripe/coupon.d.ts.map +1 -1
- package/lib/stripe/coupon.js +2 -1
- package/lib/stripe/coupon.js.map +1 -1
- package/lib/stripe/customer.d.ts.map +1 -1
- package/lib/stripe/customer.js +2 -1
- package/lib/stripe/customer.js.map +1 -1
- package/lib/stripe/entitlements-feature.d.ts.map +1 -1
- package/lib/stripe/entitlements-feature.js +2 -1
- package/lib/stripe/entitlements-feature.js.map +1 -1
- package/lib/stripe/file.d.ts.map +1 -1
- package/lib/stripe/file.js +2 -1
- package/lib/stripe/file.js.map +1 -1
- package/lib/stripe/meter.d.ts.map +1 -1
- package/lib/stripe/meter.js +4 -2
- package/lib/stripe/meter.js.map +1 -1
- package/lib/stripe/portal-configuration.d.ts.map +1 -1
- package/lib/stripe/portal-configuration.js +2 -1
- package/lib/stripe/portal-configuration.js.map +1 -1
- package/lib/stripe/price.d.ts.map +1 -1
- package/lib/stripe/price.js +2 -1
- package/lib/stripe/price.js.map +1 -1
- package/lib/stripe/product-feature.d.ts.map +1 -1
- package/lib/stripe/product-feature.js +2 -1
- package/lib/stripe/product-feature.js.map +1 -1
- package/lib/stripe/product.d.ts.map +1 -1
- package/lib/stripe/product.js +2 -1
- package/lib/stripe/product.js.map +1 -1
- package/lib/stripe/promotion-code.d.ts.map +1 -1
- package/lib/stripe/promotion-code.js +2 -1
- package/lib/stripe/promotion-code.js.map +1 -1
- package/lib/stripe/shipping-rate.d.ts.map +1 -1
- package/lib/stripe/shipping-rate.js +2 -1
- package/lib/stripe/shipping-rate.js.map +1 -1
- package/lib/stripe/tax-rate.d.ts.map +1 -1
- package/lib/stripe/tax-rate.js +2 -1
- package/lib/stripe/tax-rate.js.map +1 -1
- package/lib/stripe/webhook.d.ts.map +1 -1
- package/lib/stripe/webhook.js +3 -2
- package/lib/stripe/webhook.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js +6 -1
- package/lib/test/bun.js.map +1 -1
- package/lib/test/prune.js +7 -1
- package/lib/test/prune.js.map +1 -1
- package/lib/test/vitest.d.ts.map +1 -1
- package/lib/test/vitest.js +10 -3
- package/lib/test/vitest.js.map +1 -1
- package/lib/upstash/redis.d.ts.map +1 -1
- package/lib/upstash/redis.js +2 -1
- package/lib/upstash/redis.js.map +1 -1
- package/lib/util/async-queue.d.ts +35 -0
- package/lib/util/async-queue.d.ts.map +1 -0
- package/lib/util/async-queue.js +87 -0
- package/lib/util/async-queue.js.map +1 -0
- package/lib/util/cli.d.ts +37 -0
- package/lib/util/cli.d.ts.map +1 -0
- package/lib/util/cli.js +90 -0
- package/lib/util/cli.js.map +1 -0
- package/lib/util/ignore-matcher.d.ts +94 -0
- package/lib/util/ignore-matcher.d.ts.map +1 -0
- package/lib/util/ignore-matcher.js +616 -0
- package/lib/util/ignore-matcher.js.map +1 -0
- package/lib/util/logger.d.ts +3 -0
- package/lib/util/logger.d.ts.map +1 -0
- package/lib/util/logger.js +15 -0
- package/lib/util/logger.js.map +1 -0
- package/lib/util/retry.d.ts.map +1 -1
- package/lib/util/retry.js +0 -1
- package/lib/util/retry.js.map +1 -1
- package/lib/util/safe-fetch.d.ts.map +1 -1
- package/lib/util/safe-fetch.js +2 -1
- package/lib/util/safe-fetch.js.map +1 -1
- package/lib/util/telemetry/client.d.ts +32 -0
- package/lib/util/telemetry/client.d.ts.map +1 -0
- package/lib/util/telemetry/client.js +94 -0
- package/lib/util/telemetry/client.js.map +1 -0
- package/lib/util/telemetry/constants.d.ts +4 -0
- package/lib/util/telemetry/constants.d.ts.map +1 -0
- package/lib/util/telemetry/constants.js +8 -0
- package/lib/util/telemetry/constants.js.map +1 -0
- package/lib/util/telemetry/context.d.ts +15 -0
- package/lib/util/telemetry/context.d.ts.map +1 -0
- package/lib/util/telemetry/context.js +128 -0
- package/lib/util/telemetry/context.js.map +1 -0
- package/lib/util/telemetry/index.d.ts +3 -0
- package/lib/util/telemetry/index.d.ts.map +1 -0
- package/lib/util/telemetry/index.js +3 -0
- package/lib/util/telemetry/index.js.map +1 -0
- package/lib/util/telemetry/types.d.ts +59 -0
- package/lib/util/telemetry/types.d.ts.map +1 -0
- package/lib/util/telemetry/types.js +1 -0
- package/lib/util/telemetry/types.js.map +1 -0
- package/lib/util/xdg-paths.d.ts +9 -0
- package/lib/util/xdg-paths.d.ts.map +1 -0
- package/lib/util/xdg-paths.js +41 -0
- package/lib/util/xdg-paths.js.map +1 -0
- package/lib/vercel/project.d.ts.map +1 -1
- package/lib/vercel/project.js +2 -1
- package/lib/vercel/project.js.map +1 -1
- package/lib/web/astro.d.ts.map +1 -1
- package/lib/web/astro.js +2 -1
- package/lib/web/astro.js.map +1 -1
- package/lib/web/shadcn.d.ts.map +1 -1
- package/lib/web/shadcn.js +2 -1
- package/lib/web/shadcn.js.map +1 -1
- package/lib/web/vite.d.ts.map +1 -1
- package/lib/web/vite.js +3 -2
- package/lib/web/vite.js.map +1 -1
- package/lib/web/vitepress/dependencies.d.ts.map +1 -1
- package/lib/web/vitepress/dependencies.js +2 -1
- package/lib/web/vitepress/dependencies.js.map +1 -1
- package/lib/web/vitepress/vitepress.d.ts.map +1 -1
- package/lib/web/vitepress/vitepress.js +2 -1
- package/lib/web/vitepress/vitepress.js.map +1 -1
- package/package.json +6 -4
- package/src/ai/astro-file.ts +2 -1
- package/src/ai/client.ts +3 -2
- package/src/alchemy.ts +28 -3
- package/src/apply.ts +66 -5
- package/src/aws/control/client.ts +4 -4
- package/src/aws/control/properties.ts +48 -0
- package/src/aws/control/resource.ts +3 -2
- package/src/aws/control/types.ts +3988 -6301
- package/src/aws/function.ts +9 -8
- package/src/aws/oidc/oidc-provider.ts +3 -2
- package/src/aws/queue.ts +3 -2
- package/src/aws/role.ts +3 -1
- package/src/aws/ssm-parameter.ts +2 -1
- package/src/cloudflare/account-api-token.ts +3 -2
- package/src/cloudflare/ai-gateway.ts +4 -3
- package/src/cloudflare/api-error.ts +36 -0
- package/src/cloudflare/api.ts +9 -4
- package/src/cloudflare/assets.ts +30 -6
- package/src/cloudflare/astro.ts +176 -0
- package/src/cloudflare/auth.ts +3 -2
- package/src/cloudflare/bindings.ts +29 -0
- package/src/cloudflare/bound.ts +38 -21
- package/src/cloudflare/bucket.ts +15 -8
- package/src/cloudflare/bundle/bundle-worker.ts +2 -1
- package/src/cloudflare/bundle/nodejs-compat-mode.ts +2 -1
- package/src/cloudflare/custom-domain.ts +10 -9
- package/src/cloudflare/d1-database.ts +11 -10
- package/src/cloudflare/d1-export.ts +2 -1
- package/src/cloudflare/d1-import.ts +2 -1
- package/src/cloudflare/d1-migrations.ts +2 -1
- package/src/cloudflare/dispatch-namespace.ts +281 -0
- package/src/cloudflare/dns-records.ts +5 -4
- package/src/cloudflare/do-state-store/worker.ts +4 -0
- package/src/cloudflare/email-address.ts +203 -0
- package/src/cloudflare/email-catch-all.ts +248 -0
- package/src/cloudflare/email-routing.ts +230 -0
- package/src/cloudflare/email-rule.ts +322 -0
- package/src/cloudflare/hyperdrive.ts +5 -4
- package/src/cloudflare/images.ts +59 -0
- package/src/cloudflare/index.ts +10 -0
- package/src/cloudflare/kv-namespace.ts +2 -1
- package/src/cloudflare/pipeline.ts +38 -2
- package/src/cloudflare/queue-consumer.ts +2 -1
- package/src/cloudflare/queue.ts +0 -12
- package/src/cloudflare/route.ts +118 -18
- package/src/cloudflare/secret.ts +253 -0
- package/src/cloudflare/secrets-store.ts +420 -0
- package/src/cloudflare/sveltekit.ts +72 -0
- package/src/cloudflare/user.ts +2 -1
- package/src/cloudflare/vectorize-index.ts +6 -5
- package/src/cloudflare/vectorize-metadata-index.ts +2 -1
- package/src/cloudflare/website.ts +76 -66
- package/src/cloudflare/worker-assets.ts +95 -89
- package/src/cloudflare/worker-metadata.ts +20 -1
- package/src/cloudflare/worker.ts +116 -18
- package/src/cloudflare/wrangler.json.ts +63 -0
- package/src/cloudflare/zone.ts +4 -3
- package/src/destroy.ts +35 -17
- package/src/dns/godaddy.ts +3 -2
- package/src/dns/import-dns.ts +2 -1
- package/src/esbuild/bundle.ts +2 -1
- package/src/fs/copy-file.ts +2 -1
- package/src/fs/file.ts +3 -1
- package/src/github/client.ts +11 -10
- package/src/github/repository-environment.ts +5 -4
- package/src/github/secret.ts +7 -6
- package/src/index.ts +2 -1
- package/src/neon/project.ts +3 -2
- package/src/planetscale/api.ts +115 -0
- package/src/planetscale/branch.ts +352 -0
- package/src/planetscale/database.ts +394 -0
- package/src/planetscale/index.ts +4 -0
- package/src/planetscale/utils.ts +189 -0
- package/src/resource.ts +7 -1
- package/src/runtime/plugin.ts +2 -1
- package/src/scope.ts +64 -13
- package/src/sentry/client-key.ts +5 -4
- package/src/sentry/project.ts +5 -4
- package/src/sentry/team.ts +5 -4
- package/src/stripe/card.ts +2 -1
- package/src/stripe/client.ts +3 -2
- package/src/stripe/coupon.ts +2 -1
- package/src/stripe/customer.ts +2 -1
- package/src/stripe/entitlements-feature.ts +2 -1
- package/src/stripe/file.ts +2 -1
- package/src/stripe/meter.ts +4 -2
- package/src/stripe/portal-configuration.ts +2 -1
- package/src/stripe/price.ts +2 -1
- package/src/stripe/product-feature.ts +2 -1
- package/src/stripe/product.ts +2 -1
- package/src/stripe/promotion-code.ts +2 -1
- package/src/stripe/shipping-rate.ts +2 -1
- package/src/stripe/tax-rate.ts +2 -1
- package/src/stripe/webhook.ts +3 -2
- package/src/test/bun.ts +6 -1
- package/src/test/prune.ts +7 -1
- package/src/test/vitest.ts +14 -3
- package/src/upstash/redis.ts +2 -1
- package/src/util/async-queue.ts +97 -0
- package/src/util/cli.tsx +221 -0
- package/src/util/ignore-matcher.ts +873 -0
- package/src/util/logger.ts +17 -0
- package/src/util/retry.ts +0 -1
- package/src/util/safe-fetch.ts +2 -1
- package/src/util/telemetry/client.ts +127 -0
- package/src/util/telemetry/constants.ts +13 -0
- package/src/util/telemetry/context.ts +154 -0
- package/src/util/telemetry/index.ts +2 -0
- package/src/util/telemetry/types.ts +83 -0
- package/src/util/xdg-paths.ts +48 -0
- package/src/vercel/project.ts +2 -1
- package/src/web/astro.ts +2 -1
- package/src/web/shadcn.ts +2 -1
- package/src/web/vite.ts +3 -2
- package/src/web/vitepress/dependencies.ts +2 -1
- package/src/web/vitepress/vitepress.ts +2 -1
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";
|
|
@@ -33,6 +34,7 @@ import {
|
|
|
33
34
|
bundleWorkerScript,
|
|
34
35
|
} from "./bundle/bundle-worker.ts";
|
|
35
36
|
import { isD1Database } from "./d1-database.ts";
|
|
37
|
+
import type { DispatchNamespaceResource } from "./dispatch-namespace.ts";
|
|
36
38
|
import {
|
|
37
39
|
DurableObjectNamespace,
|
|
38
40
|
isDurableObjectNamespace,
|
|
@@ -50,6 +52,7 @@ import {
|
|
|
50
52
|
listQueueConsumersForWorker,
|
|
51
53
|
} from "./queue-consumer.ts";
|
|
52
54
|
import { type QueueResource, isQueue } from "./queue.ts";
|
|
55
|
+
import { Route } from "./route.ts";
|
|
53
56
|
import { isVectorizeIndex } from "./vectorize-index.ts";
|
|
54
57
|
import { type AssetUploadResult, uploadAssets } from "./worker-assets.ts";
|
|
55
58
|
import {
|
|
@@ -216,12 +219,45 @@ export interface BaseWorkerProps<
|
|
|
216
219
|
*/
|
|
217
220
|
eventSources?: EventSource[];
|
|
218
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Routes to create for this worker.
|
|
224
|
+
*
|
|
225
|
+
* Each route maps a URL pattern to this worker script.
|
|
226
|
+
*/
|
|
227
|
+
routes?: Array<{
|
|
228
|
+
/**
|
|
229
|
+
* URL pattern for the route
|
|
230
|
+
* @example "sub.example.com/*"
|
|
231
|
+
*/
|
|
232
|
+
pattern: string;
|
|
233
|
+
/**
|
|
234
|
+
* Zone ID for the route. If not provided, will be automatically inferred from the route pattern.
|
|
235
|
+
*/
|
|
236
|
+
zoneId?: string;
|
|
237
|
+
/**
|
|
238
|
+
* Whether this is a custom domain route
|
|
239
|
+
*/
|
|
240
|
+
customDomain?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Whether to adopt an existing route with the same pattern if it exists
|
|
243
|
+
* @default false
|
|
244
|
+
*/
|
|
245
|
+
adopt?: boolean;
|
|
246
|
+
}>;
|
|
247
|
+
|
|
219
248
|
/**
|
|
220
249
|
* The RPC class to use for the worker.
|
|
221
250
|
*
|
|
222
251
|
* This is only used when using the rpc property.
|
|
223
252
|
*/
|
|
224
253
|
rpc?: (new (...args: any[]) => RPC) | type<RPC>;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Deploy this worker to a dispatch namespace
|
|
257
|
+
*
|
|
258
|
+
* This allows workers to be routed to via dispatch namespace routing rules
|
|
259
|
+
*/
|
|
260
|
+
dispatchNamespace?: string | DispatchNamespaceResource;
|
|
225
261
|
}
|
|
226
262
|
|
|
227
263
|
export interface InlineWorkerProps<
|
|
@@ -322,7 +358,7 @@ export type Worker<
|
|
|
322
358
|
B extends Bindings | undefined = Bindings | undefined,
|
|
323
359
|
RPC extends Rpc.WorkerEntrypointBranded = Rpc.WorkerEntrypointBranded,
|
|
324
360
|
> = Resource<"cloudflare::Worker"> &
|
|
325
|
-
Omit<WorkerProps<B>, "url" | "script"> &
|
|
361
|
+
Omit<WorkerProps<B>, "url" | "script" | "routes"> &
|
|
326
362
|
globalThis.Service & {
|
|
327
363
|
/** @internal phantom property */
|
|
328
364
|
__rpc__?: RPC;
|
|
@@ -367,6 +403,11 @@ export type Worker<
|
|
|
367
403
|
*/
|
|
368
404
|
assets?: AssetsConfig;
|
|
369
405
|
|
|
406
|
+
/**
|
|
407
|
+
* The routes that were created for this worker
|
|
408
|
+
*/
|
|
409
|
+
routes?: Route[];
|
|
410
|
+
|
|
370
411
|
// phantom property (for typeof myWorker.Env)
|
|
371
412
|
Env: B extends Bindings
|
|
372
413
|
? {
|
|
@@ -383,6 +424,11 @@ export type Worker<
|
|
|
383
424
|
* The compatibility flags for the worker
|
|
384
425
|
*/
|
|
385
426
|
compatibilityFlags: string[];
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* The dispatch namespace this worker is deployed to
|
|
430
|
+
*/
|
|
431
|
+
dispatchNamespace?: string | DispatchNamespaceResource;
|
|
386
432
|
};
|
|
387
433
|
|
|
388
434
|
/**
|
|
@@ -633,10 +679,9 @@ export function Worker<const B extends Bindings>(
|
|
|
633
679
|
return _Worker(id, {
|
|
634
680
|
...(props as any),
|
|
635
681
|
url: true,
|
|
636
|
-
compatibilityFlags:
|
|
637
|
-
"nodejs_compat",
|
|
638
|
-
|
|
639
|
-
],
|
|
682
|
+
compatibilityFlags: Array.from(
|
|
683
|
+
new Set(["nodejs_compat", ...(props.compatibilityFlags ?? [])]),
|
|
684
|
+
),
|
|
640
685
|
entrypoint: meta!.filename,
|
|
641
686
|
name: workerName,
|
|
642
687
|
// adopt because the stub guarnatees that the worker exists
|
|
@@ -652,9 +697,10 @@ export function Worker<const B extends Bindings>(
|
|
|
652
697
|
"esbuild",
|
|
653
698
|
// TODO(sam): this is for fetch, why is it a package?
|
|
654
699
|
"undici",
|
|
655
|
-
// TODO(sam): no idea where this came from, feels dangerous to externalize it
|
|
656
|
-
"ws",
|
|
657
700
|
"miniflare",
|
|
701
|
+
"@iarna/toml",
|
|
702
|
+
"cli-*",
|
|
703
|
+
"react*",
|
|
658
704
|
],
|
|
659
705
|
banner: {
|
|
660
706
|
js: "var __ALCHEMY_RUNTIME__ = true;",
|
|
@@ -720,7 +766,7 @@ export function Worker<const B extends Bindings>(
|
|
|
720
766
|
const incoming = request.url.startsWith("/")
|
|
721
767
|
? new URL(`${worker.url}${request.url}`)
|
|
722
768
|
: new URL(request.url);
|
|
723
|
-
|
|
769
|
+
logger.log(incoming);
|
|
724
770
|
const proxyURL = new URL(
|
|
725
771
|
`${incoming.pathname}${incoming.search}${incoming.hash}`,
|
|
726
772
|
origin,
|
|
@@ -851,7 +897,20 @@ export const _Worker = Resource(
|
|
|
851
897
|
assetUploadResult,
|
|
852
898
|
);
|
|
853
899
|
|
|
854
|
-
|
|
900
|
+
// Get dispatch namespace if specified
|
|
901
|
+
const dispatchNamespace = props.dispatchNamespace
|
|
902
|
+
? typeof props.dispatchNamespace === "string"
|
|
903
|
+
? props.dispatchNamespace
|
|
904
|
+
: props.dispatchNamespace.namespace
|
|
905
|
+
: undefined;
|
|
906
|
+
|
|
907
|
+
await putWorker(
|
|
908
|
+
api,
|
|
909
|
+
workerName,
|
|
910
|
+
scriptBundle,
|
|
911
|
+
scriptMetadata,
|
|
912
|
+
dispatchNamespace,
|
|
913
|
+
);
|
|
855
914
|
|
|
856
915
|
for (const workflow of workflowsBindings) {
|
|
857
916
|
if (
|
|
@@ -935,6 +994,8 @@ export const _Worker = Resource(
|
|
|
935
994
|
// we are writing a stub worker (to remove binding/event source dependencies)
|
|
936
995
|
// queue consumers will no longer exist by this point
|
|
937
996
|
eventSources: undefined,
|
|
997
|
+
// stub worker doesn't need dispatch namespace
|
|
998
|
+
dispatchNamespace: undefined,
|
|
938
999
|
});
|
|
939
1000
|
|
|
940
1001
|
await withExponentialBackoff(
|
|
@@ -969,6 +1030,38 @@ export const _Worker = Resource(
|
|
|
969
1030
|
|
|
970
1031
|
const { scriptMetadata, workerUrl, now } = await uploadWorkerScript(props);
|
|
971
1032
|
|
|
1033
|
+
// Create routes if provided and capture their outputs
|
|
1034
|
+
let createdRoutes: Route[] = [];
|
|
1035
|
+
if (props.routes && props.routes.length > 0) {
|
|
1036
|
+
// Validate for duplicate patterns
|
|
1037
|
+
const patterns = props.routes.map((route) => route.pattern);
|
|
1038
|
+
const duplicates = patterns.filter(
|
|
1039
|
+
(pattern, index) => patterns.indexOf(pattern) !== index,
|
|
1040
|
+
);
|
|
1041
|
+
if (duplicates.length > 0) {
|
|
1042
|
+
throw new Error(
|
|
1043
|
+
`Duplicate route patterns found: ${duplicates.join(", ")}`,
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
// Create Route resources for each route and capture their outputs
|
|
1048
|
+
createdRoutes = await Promise.all(
|
|
1049
|
+
props.routes.map(async (routeConfig) => {
|
|
1050
|
+
return await Route(routeConfig.pattern, {
|
|
1051
|
+
pattern: routeConfig.pattern,
|
|
1052
|
+
script: workerName,
|
|
1053
|
+
zoneId: routeConfig.zoneId, // Route resource will handle inference if not provided
|
|
1054
|
+
adopt: routeConfig.adopt ?? false,
|
|
1055
|
+
accountId: props.accountId,
|
|
1056
|
+
apiKey: props.apiKey,
|
|
1057
|
+
apiToken: props.apiToken,
|
|
1058
|
+
baseUrl: props.baseUrl,
|
|
1059
|
+
email: props.email,
|
|
1060
|
+
});
|
|
1061
|
+
}),
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
972
1065
|
function exportBindings() {
|
|
973
1066
|
return Object.fromEntries(
|
|
974
1067
|
Object.entries(props.bindings ?? ({} as B)).map(
|
|
@@ -1014,6 +1107,10 @@ export const _Worker = Resource(
|
|
|
1014
1107
|
assets: props.assets,
|
|
1015
1108
|
// Include cron triggers in the output
|
|
1016
1109
|
crons: props.crons,
|
|
1110
|
+
// Include the created routes in the output
|
|
1111
|
+
routes: createdRoutes.length > 0 ? createdRoutes : undefined,
|
|
1112
|
+
// Include the dispatch namespace in the output
|
|
1113
|
+
dispatchNamespace: props.dispatchNamespace,
|
|
1017
1114
|
// phantom property
|
|
1018
1115
|
Env: undefined!,
|
|
1019
1116
|
} as unknown as Worker<B>);
|
|
@@ -1048,7 +1145,7 @@ export async function deleteWorker<B extends Bindings>(
|
|
|
1048
1145
|
},
|
|
1049
1146
|
);
|
|
1050
1147
|
} catch (error) {
|
|
1051
|
-
|
|
1148
|
+
logger.warn("Failed to disable worker URL during deletion:", error);
|
|
1052
1149
|
}
|
|
1053
1150
|
}
|
|
1054
1151
|
|
|
@@ -1061,6 +1158,7 @@ export async function putWorker(
|
|
|
1061
1158
|
workerName: string,
|
|
1062
1159
|
scriptBundle: string | NoBundleResult,
|
|
1063
1160
|
scriptMetadata: WorkerMetadata,
|
|
1161
|
+
dispatchNamespace?: string,
|
|
1064
1162
|
) {
|
|
1065
1163
|
return withExponentialBackoff(
|
|
1066
1164
|
async () => {
|
|
@@ -1103,15 +1201,15 @@ export async function putWorker(
|
|
|
1103
1201
|
);
|
|
1104
1202
|
|
|
1105
1203
|
// Upload worker script with bindings
|
|
1106
|
-
const
|
|
1107
|
-
`/accounts/${api.accountId}/workers/scripts/${workerName}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1204
|
+
const endpoint = dispatchNamespace
|
|
1205
|
+
? `/accounts/${api.accountId}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${workerName}`
|
|
1206
|
+
: `/accounts/${api.accountId}/workers/scripts/${workerName}`;
|
|
1207
|
+
|
|
1208
|
+
const uploadResponse = await api.put(endpoint, formData, {
|
|
1209
|
+
headers: {
|
|
1210
|
+
"Content-Type": "multipart/form-data",
|
|
1113
1211
|
},
|
|
1114
|
-
);
|
|
1212
|
+
});
|
|
1115
1213
|
|
|
1116
1214
|
// Check if the upload was successful
|
|
1117
1215
|
if (!uploadResponse.ok) {
|
|
@@ -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,12 +348,29 @@ 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
|
*/
|
|
347
363
|
version_metadata?: {
|
|
348
364
|
binding: string;
|
|
349
365
|
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Dispatch namespace bindings
|
|
369
|
+
*/
|
|
370
|
+
dispatch_namespaces?: {
|
|
371
|
+
binding: string;
|
|
372
|
+
namespace: string;
|
|
373
|
+
}[];
|
|
350
374
|
}
|
|
351
375
|
|
|
352
376
|
/**
|
|
@@ -408,6 +432,15 @@ function processBindings(
|
|
|
408
432
|
localConnectionString: string;
|
|
409
433
|
}[] = [];
|
|
410
434
|
const pipelines: { binding: string; pipeline: string }[] = [];
|
|
435
|
+
const secretsStoreSecrets: {
|
|
436
|
+
binding: string;
|
|
437
|
+
store_id: string;
|
|
438
|
+
secret_name: string;
|
|
439
|
+
}[] = [];
|
|
440
|
+
const dispatchNamespaces: {
|
|
441
|
+
binding: string;
|
|
442
|
+
namespace: string;
|
|
443
|
+
}[] = [];
|
|
411
444
|
|
|
412
445
|
for (const eventSource of eventSources ?? []) {
|
|
413
446
|
if (isQueueEventSource(eventSource)) {
|
|
@@ -523,6 +556,13 @@ function processBindings(
|
|
|
523
556
|
spec.ai = {
|
|
524
557
|
binding: bindingName,
|
|
525
558
|
};
|
|
559
|
+
} else if (binding.type === "images") {
|
|
560
|
+
if (spec.images) {
|
|
561
|
+
throw new Error(`Images already bound to ${spec.images.binding}`);
|
|
562
|
+
}
|
|
563
|
+
spec.images = {
|
|
564
|
+
binding: bindingName,
|
|
565
|
+
};
|
|
526
566
|
} else if (binding.type === "analytics_engine") {
|
|
527
567
|
analyticsEngineDatasets.push({
|
|
528
568
|
binding: bindingName,
|
|
@@ -556,6 +596,21 @@ function processBindings(
|
|
|
556
596
|
});
|
|
557
597
|
} else if (binding.type === "json") {
|
|
558
598
|
// TODO(sam): anything to do here? not sure wrangler.json supports this
|
|
599
|
+
} else if (binding.type === "secrets_store") {
|
|
600
|
+
if (binding.secrets) {
|
|
601
|
+
for (const [secretName, _secret] of Object.entries(binding.secrets)) {
|
|
602
|
+
secretsStoreSecrets.push({
|
|
603
|
+
binding: bindingName,
|
|
604
|
+
store_id: binding.id,
|
|
605
|
+
secret_name: secretName,
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
} else if (binding.type === "dispatch_namespace") {
|
|
610
|
+
dispatchNamespaces.push({
|
|
611
|
+
binding: bindingName,
|
|
612
|
+
namespace: binding.namespaceName,
|
|
613
|
+
});
|
|
559
614
|
} else {
|
|
560
615
|
// biome-ignore lint/correctness/noVoidTypeReturn: it returns never
|
|
561
616
|
return assertNever(binding);
|
|
@@ -618,4 +673,12 @@ function processBindings(
|
|
|
618
673
|
if (pipelines.length > 0) {
|
|
619
674
|
spec.pipelines = pipelines;
|
|
620
675
|
}
|
|
676
|
+
|
|
677
|
+
if (secretsStoreSecrets.length > 0) {
|
|
678
|
+
spec.secrets_store_secrets = secretsStoreSecrets;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
if (dispatchNamespaces.length > 0) {
|
|
682
|
+
spec.dispatch_namespaces = dispatchNamespaces;
|
|
683
|
+
}
|
|
621
684
|
}
|
package/src/cloudflare/zone.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context } from "../context.ts";
|
|
2
2
|
import { Resource } from "../resource.ts";
|
|
3
|
+
import { logger } from "../util/logger.ts";
|
|
3
4
|
import { handleApiError } from "./api-error.ts";
|
|
4
5
|
import { createCloudflareApi, type CloudflareApiOptions } from "./api.ts";
|
|
5
6
|
import type {
|
|
@@ -329,7 +330,7 @@ export const Zone = Resource(
|
|
|
329
330
|
);
|
|
330
331
|
}
|
|
331
332
|
} else {
|
|
332
|
-
|
|
333
|
+
logger.warn(`Zone '${props.name}' not found, skipping delete`);
|
|
333
334
|
}
|
|
334
335
|
return this.destroy();
|
|
335
336
|
}
|
|
@@ -387,7 +388,7 @@ export const Zone = Resource(
|
|
|
387
388
|
if (!response.ok) {
|
|
388
389
|
if (response.status === 400 && body.includes("already exists")) {
|
|
389
390
|
// Zone already exists, fetch it instead
|
|
390
|
-
|
|
391
|
+
logger.warn(
|
|
391
392
|
`Zone '${props.name}' already exists during Zone create, adopting it...`,
|
|
392
393
|
);
|
|
393
394
|
const getResponse = await api.get(`/zones?name=${props.name}`);
|
|
@@ -488,7 +489,7 @@ async function updateZoneSettings(
|
|
|
488
489
|
if (!response.ok) {
|
|
489
490
|
const data = await response.text();
|
|
490
491
|
if (response.status === 400 && data.includes("already enabled")) {
|
|
491
|
-
|
|
492
|
+
logger.warn(`Warning: Setting '${key}' already enabled`);
|
|
492
493
|
return;
|
|
493
494
|
}
|
|
494
495
|
throw new Error(
|
package/src/destroy.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
ResourceSeq,
|
|
11
11
|
} from "./resource.ts";
|
|
12
12
|
import { Scope } from "./scope.ts";
|
|
13
|
+
import { formatFQN } from "./util/cli.tsx";
|
|
14
|
+
import { logger } from "./util/logger.ts";
|
|
13
15
|
|
|
14
16
|
export class DestroyedSignal extends Error {}
|
|
15
17
|
|
|
@@ -37,18 +39,21 @@ export async function destroy<Type extends string>(
|
|
|
37
39
|
...(args[1] ?? {}),
|
|
38
40
|
} satisfies DestroyOptions;
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
await scope.run(async () => {
|
|
43
|
+
// destroy all active resources
|
|
44
|
+
await destroyAll(Array.from(scope.resources.values()), options);
|
|
45
|
+
|
|
46
|
+
// then detect orphans and destroy them
|
|
47
|
+
const orphans = await scope.state.all();
|
|
48
|
+
await destroyAll(
|
|
49
|
+
Object.values(orphans).map((orphan) => ({
|
|
50
|
+
...orphan.output,
|
|
51
|
+
Scope: scope,
|
|
52
|
+
})),
|
|
53
|
+
options,
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
52
57
|
// finally, destroy the scope container
|
|
53
58
|
await scope.deinit();
|
|
54
59
|
return;
|
|
@@ -65,7 +70,7 @@ export async function destroy<Type extends string>(
|
|
|
65
70
|
parent: instance[ResourceScope],
|
|
66
71
|
scopeName: instance[ResourceID],
|
|
67
72
|
});
|
|
68
|
-
|
|
73
|
+
logger.log("Destroying scope", scope.chain.join("/"));
|
|
69
74
|
return await destroy(scope, options);
|
|
70
75
|
}
|
|
71
76
|
|
|
@@ -78,13 +83,19 @@ export async function destroy<Type extends string>(
|
|
|
78
83
|
|
|
79
84
|
const scope = instance[ResourceScope];
|
|
80
85
|
if (!scope) {
|
|
81
|
-
|
|
86
|
+
logger.warn(`Resource "${instance[ResourceFQN]}" has no scope`);
|
|
82
87
|
}
|
|
83
88
|
const quiet = options?.quiet ?? scope.quiet;
|
|
84
89
|
|
|
85
90
|
try {
|
|
86
91
|
if (!quiet) {
|
|
87
|
-
|
|
92
|
+
logger.task(instance[ResourceFQN], {
|
|
93
|
+
prefix: "DELETING",
|
|
94
|
+
prefixColor: "magenta",
|
|
95
|
+
resource: formatFQN(instance[ResourceFQN]),
|
|
96
|
+
message: "Deleting Resource...",
|
|
97
|
+
});
|
|
98
|
+
logger.log(`Delete: "${instance[ResourceFQN]}"`);
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
const state = await scope.state.get(instance[ResourceID]);
|
|
@@ -140,10 +151,17 @@ export async function destroy<Type extends string>(
|
|
|
140
151
|
await scope.delete(instance[ResourceID]);
|
|
141
152
|
|
|
142
153
|
if (!quiet) {
|
|
143
|
-
|
|
154
|
+
logger.task(instance[ResourceFQN], {
|
|
155
|
+
prefix: "DELETED",
|
|
156
|
+
prefixColor: "greenBright",
|
|
157
|
+
resource: formatFQN(instance[ResourceFQN]),
|
|
158
|
+
message: "Deleted Resource",
|
|
159
|
+
status: "success",
|
|
160
|
+
});
|
|
161
|
+
logger.log(`Deleted: "${instance[ResourceFQN]}"`);
|
|
144
162
|
}
|
|
145
163
|
} catch (error) {
|
|
146
|
-
|
|
164
|
+
logger.error(error);
|
|
147
165
|
throw error;
|
|
148
166
|
}
|
|
149
167
|
}
|
package/src/dns/godaddy.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logger } from "../util/logger.ts";
|
|
1
2
|
import { safeFetch } from "../util/safe-fetch.ts";
|
|
2
3
|
|
|
3
4
|
export type UpdateNameserversOptions = {
|
|
@@ -23,9 +24,9 @@ export async function updateNameservers(options: UpdateNameserversOptions) {
|
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
if (response.ok) {
|
|
26
|
-
|
|
27
|
+
logger.log(`✅ Nameservers updated for ${options.domain}`);
|
|
27
28
|
} else {
|
|
28
29
|
const error = await response.json();
|
|
29
|
-
|
|
30
|
+
logger.error("❌ Failed to update nameservers:", error);
|
|
30
31
|
}
|
|
31
32
|
}
|
package/src/dns/import-dns.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context } from "../context.ts";
|
|
2
2
|
import { Resource } from "../resource.ts";
|
|
3
|
+
import { logger } from "../util/logger.ts";
|
|
3
4
|
import { DEFAULT_RECORD_TYPES, type DnsRecordType } from "./record.ts";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -195,7 +196,7 @@ export const ImportDnsRecords = Resource(
|
|
|
195
196
|
allRecords.push(...compatRecords);
|
|
196
197
|
}
|
|
197
198
|
} catch (error) {
|
|
198
|
-
|
|
199
|
+
logger.warn(
|
|
199
200
|
`Failed to fetch ${type} records for ${props.domain}:`,
|
|
200
201
|
error,
|
|
201
202
|
);
|
package/src/esbuild/bundle.ts
CHANGED
|
@@ -4,6 +4,7 @@ import fs from "node:fs/promises";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import type { Context } from "../context.ts";
|
|
6
6
|
import { Resource } from "../resource.ts";
|
|
7
|
+
import { logger } from "../util/logger.ts";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Properties for creating or updating an esbuild bundle
|
|
@@ -199,7 +200,7 @@ export async function bundle(props: BundleProps) {
|
|
|
199
200
|
metafile: true,
|
|
200
201
|
};
|
|
201
202
|
if (process.env.DEBUG) {
|
|
202
|
-
|
|
203
|
+
logger.log(options);
|
|
203
204
|
}
|
|
204
205
|
const esbuild = await import("esbuild");
|
|
205
206
|
return await esbuild.build(options);
|
package/src/fs/copy-file.ts
CHANGED
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import type { Context } from "../context.ts";
|
|
3
3
|
import { Resource } from "../resource.ts";
|
|
4
4
|
import { ignore } from "../util/ignore.ts";
|
|
5
|
+
import { logger } from "../util/logger.ts";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Properties for creating a CopyFile resource
|
|
@@ -107,7 +108,7 @@ export const CopyFile = Resource(
|
|
|
107
108
|
createdAt: Date.now(),
|
|
108
109
|
});
|
|
109
110
|
} catch (error) {
|
|
110
|
-
|
|
111
|
+
logger.error("Error copying file:", error);
|
|
111
112
|
throw error;
|
|
112
113
|
}
|
|
113
114
|
},
|
package/src/fs/file.ts
CHANGED
|
@@ -3,6 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import type { Context } from "../context.ts";
|
|
4
4
|
import { Resource } from "../resource.ts";
|
|
5
5
|
import { ignore } from "../util/ignore.ts";
|
|
6
|
+
import { logger } from "../util/logger.ts";
|
|
6
7
|
|
|
7
8
|
import { alchemy } from "../alchemy.ts";
|
|
8
9
|
import type { FileCollection } from "./file-collection.ts";
|
|
@@ -176,7 +177,7 @@ export const File = Resource(
|
|
|
176
177
|
this.output.path !== filePath
|
|
177
178
|
) {
|
|
178
179
|
// If path has changed, delete the old file
|
|
179
|
-
|
|
180
|
+
logger.log(
|
|
180
181
|
`File: Path changed from ${this.output.path} to ${filePath}, removing old file`,
|
|
181
182
|
);
|
|
182
183
|
await ignore("ENOENT", async () => fs.promises.unlink(this.output.path));
|
|
@@ -186,6 +187,7 @@ export const File = Resource(
|
|
|
186
187
|
await fs.promises.mkdir(path.dirname(filePath), {
|
|
187
188
|
recursive: true,
|
|
188
189
|
});
|
|
190
|
+
|
|
189
191
|
await fs.promises.writeFile(filePath, props.content);
|
|
190
192
|
|
|
191
193
|
return this({
|
package/src/github/client.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Octokit } from "@octokit/rest";
|
|
2
2
|
import { exec } from "node:child_process";
|
|
3
3
|
import { promisify } from "node:util";
|
|
4
|
+
import { logger } from "../util/logger.ts";
|
|
4
5
|
|
|
5
6
|
// Convert exec to promise-based
|
|
6
7
|
const execAsync = promisify(exec);
|
|
@@ -77,36 +78,36 @@ export async function verifyGitHubAuth(
|
|
|
77
78
|
});
|
|
78
79
|
} catch (error: any) {
|
|
79
80
|
if (error.status === 401) {
|
|
80
|
-
|
|
81
|
+
logger.error(
|
|
81
82
|
"\n⚠️ GitHub authentication failed. Please try one of the following:",
|
|
82
83
|
);
|
|
83
|
-
|
|
84
|
+
logger.error(
|
|
84
85
|
"1. Run 'gh auth login' to authenticate with the GitHub CLI",
|
|
85
86
|
);
|
|
86
|
-
|
|
87
|
+
logger.error(
|
|
87
88
|
"2. Set the GITHUB_TOKEN environment variable with a personal access token",
|
|
88
89
|
);
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
logger.error("3. Pass a token directly to the constructor");
|
|
91
|
+
logger.error(
|
|
91
92
|
"\nTo create a token, visit: https://github.com/settings/tokens",
|
|
92
93
|
);
|
|
93
|
-
|
|
94
|
+
logger.error(
|
|
94
95
|
"Required scopes: 'repo' for private repos or 'public_repo' for public repos\n",
|
|
95
96
|
);
|
|
96
97
|
throw new Error("GitHub authentication failed");
|
|
97
98
|
}
|
|
98
99
|
if (error.status === 403) {
|
|
99
|
-
|
|
100
|
+
logger.error(
|
|
100
101
|
"\n⚠️ Insufficient permissions. You need admin access to the repository.",
|
|
101
102
|
);
|
|
102
|
-
|
|
103
|
+
logger.error(
|
|
103
104
|
"Make sure your token has the 'repo' scope for private repos or 'public_repo' for public repos\n",
|
|
104
105
|
);
|
|
105
106
|
throw new Error("Insufficient GitHub permissions");
|
|
106
107
|
}
|
|
107
108
|
if (error.status === 404) {
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
logger.error(`\n⚠️ Repository not found: ${owner}/${repo}`);
|
|
110
|
+
logger.error(
|
|
110
111
|
"Make sure the repository exists and you have access to it\n",
|
|
111
112
|
);
|
|
112
113
|
throw new Error("GitHub repository not found");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context } from "../context.ts";
|
|
2
2
|
import { Resource } from "../resource.ts";
|
|
3
|
+
import { logger } from "../util/logger.ts";
|
|
3
4
|
import { createGitHubClient, verifyGitHubAuth } from "./client.ts";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -198,7 +199,7 @@ export const RepositoryEnvironment = Resource(
|
|
|
198
199
|
} catch (error: any) {
|
|
199
200
|
// Ignore 404 errors (environment already deleted)
|
|
200
201
|
if (error.status === 404) {
|
|
201
|
-
|
|
202
|
+
logger.log("Environment doesn't exist, ignoring");
|
|
202
203
|
} else {
|
|
203
204
|
throw error;
|
|
204
205
|
}
|
|
@@ -447,14 +448,14 @@ export const RepositoryEnvironment = Resource(
|
|
|
447
448
|
error.status === 403 &&
|
|
448
449
|
error.message?.includes("Must have admin rights")
|
|
449
450
|
) {
|
|
450
|
-
|
|
451
|
+
logger.error(
|
|
451
452
|
"\n⚠️ Error creating/updating GitHub environment: You must have admin rights to the repository.",
|
|
452
453
|
);
|
|
453
|
-
|
|
454
|
+
logger.error(
|
|
454
455
|
"Make sure your GitHub token has the required permissions (repo scope for private repos).\n",
|
|
455
456
|
);
|
|
456
457
|
} else {
|
|
457
|
-
|
|
458
|
+
logger.error(
|
|
458
459
|
"Error creating/updating GitHub environment:",
|
|
459
460
|
error.message,
|
|
460
461
|
);
|