alchemy 0.24.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/lib/ai/astro-file.d.ts.map +1 -1
- package/lib/ai/astro-file.js +2 -1
- package/lib/ai/astro-file.js.map +1 -1
- package/lib/ai/client.d.ts.map +1 -1
- package/lib/ai/client.js +3 -2
- package/lib/ai/client.js.map +1 -1
- package/lib/alchemy.d.ts +7 -0
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +19 -3
- package/lib/alchemy.js.map +1 -1
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +63 -5
- package/lib/apply.js.map +1 -1
- package/lib/aws/control/client.js +5 -4
- package/lib/aws/control/client.js.map +1 -1
- package/lib/aws/control/properties.d.ts +6 -0
- package/lib/aws/control/properties.d.ts.map +1 -1
- package/lib/aws/control/properties.js +48 -0
- package/lib/aws/control/properties.js.map +1 -1
- package/lib/aws/control/resource.d.ts.map +1 -1
- package/lib/aws/control/resource.js +5 -3
- package/lib/aws/control/resource.js.map +1 -1
- package/lib/aws/control/types.d.ts +3969 -4862
- package/lib/aws/control/types.d.ts.map +1 -1
- package/lib/aws/control/types.js.map +1 -1
- package/lib/aws/function.d.ts.map +1 -1
- package/lib/aws/function.js +9 -8
- package/lib/aws/function.js.map +1 -1
- package/lib/aws/oidc/oidc-provider.d.ts.map +1 -1
- package/lib/aws/oidc/oidc-provider.js +3 -2
- package/lib/aws/oidc/oidc-provider.js.map +1 -1
- package/lib/aws/queue.d.ts.map +1 -1
- package/lib/aws/queue.js +3 -2
- package/lib/aws/queue.js.map +1 -1
- package/lib/aws/role.d.ts.map +1 -1
- package/lib/aws/role.js +3 -1
- package/lib/aws/role.js.map +1 -1
- package/lib/aws/ssm-parameter.d.ts.map +1 -1
- package/lib/aws/ssm-parameter.js +2 -1
- package/lib/aws/ssm-parameter.js.map +1 -1
- package/lib/cloudflare/account-api-token.d.ts.map +1 -1
- package/lib/cloudflare/account-api-token.js +3 -2
- package/lib/cloudflare/account-api-token.js.map +1 -1
- package/lib/cloudflare/ai-gateway.d.ts.map +1 -1
- package/lib/cloudflare/ai-gateway.js +4 -3
- package/lib/cloudflare/ai-gateway.js.map +1 -1
- package/lib/cloudflare/ai.d.ts +21 -0
- package/lib/cloudflare/ai.d.ts.map +1 -1
- package/lib/cloudflare/ai.js +21 -0
- package/lib/cloudflare/ai.js.map +1 -1
- package/lib/cloudflare/api-error.d.ts +0 -9
- package/lib/cloudflare/api-error.d.ts.map +1 -1
- package/lib/cloudflare/api-error.js +24 -0
- package/lib/cloudflare/api-error.js.map +1 -1
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +5 -4
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/assets.d.ts.map +1 -1
- package/lib/cloudflare/assets.js +26 -6
- package/lib/cloudflare/assets.js.map +1 -1
- package/lib/cloudflare/astro.d.ts +63 -0
- package/lib/cloudflare/astro.d.ts.map +1 -0
- package/lib/cloudflare/astro.js +133 -0
- package/lib/cloudflare/astro.js.map +1 -0
- package/lib/cloudflare/auth.d.ts.map +1 -1
- package/lib/cloudflare/auth.js +3 -2
- package/lib/cloudflare/auth.js.map +1 -1
- package/lib/cloudflare/bindings.d.ts +23 -2
- package/lib/cloudflare/bindings.d.ts.map +1 -1
- package/lib/cloudflare/bindings.js.map +1 -1
- package/lib/cloudflare/bound.d.ts +7 -1
- package/lib/cloudflare/bound.d.ts.map +1 -1
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +12 -8
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/bundle/bundle-worker.d.ts.map +1 -1
- package/lib/cloudflare/bundle/bundle-worker.js +2 -1
- package/lib/cloudflare/bundle/bundle-worker.js.map +1 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.d.ts.map +1 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.js +2 -1
- package/lib/cloudflare/bundle/nodejs-compat-mode.js.map +1 -1
- package/lib/cloudflare/custom-domain.d.ts.map +1 -1
- package/lib/cloudflare/custom-domain.js +10 -9
- package/lib/cloudflare/custom-domain.js.map +1 -1
- package/lib/cloudflare/d1-database.d.ts.map +1 -1
- package/lib/cloudflare/d1-database.js +11 -10
- package/lib/cloudflare/d1-database.js.map +1 -1
- package/lib/cloudflare/d1-export.d.ts.map +1 -1
- package/lib/cloudflare/d1-export.js +2 -1
- package/lib/cloudflare/d1-export.js.map +1 -1
- package/lib/cloudflare/d1-import.d.ts.map +1 -1
- package/lib/cloudflare/d1-import.js +2 -1
- package/lib/cloudflare/d1-import.js.map +1 -1
- package/lib/cloudflare/d1-migrations.d.ts.map +1 -1
- package/lib/cloudflare/d1-migrations.js +2 -1
- package/lib/cloudflare/d1-migrations.js.map +1 -1
- package/lib/cloudflare/dns-records.d.ts.map +1 -1
- package/lib/cloudflare/dns-records.js +5 -4
- package/lib/cloudflare/dns-records.js.map +1 -1
- package/lib/cloudflare/do-state-store/worker.d.ts.map +1 -1
- package/lib/cloudflare/do-state-store/worker.js +4 -0
- package/lib/cloudflare/do-state-store/worker.js.map +1 -1
- package/lib/cloudflare/email-address.d.ts +79 -0
- package/lib/cloudflare/email-address.d.ts.map +1 -0
- package/lib/cloudflare/email-address.js +112 -0
- package/lib/cloudflare/email-address.js.map +1 -0
- package/lib/cloudflare/email-catch-all.d.ts +123 -0
- package/lib/cloudflare/email-catch-all.d.ts.map +1 -0
- package/lib/cloudflare/email-catch-all.js +124 -0
- package/lib/cloudflare/email-catch-all.js.map +1 -0
- package/lib/cloudflare/email-routing.d.ts +89 -0
- package/lib/cloudflare/email-routing.d.ts.map +1 -0
- package/lib/cloudflare/email-routing.js +120 -0
- package/lib/cloudflare/email-routing.js.map +1 -0
- package/lib/cloudflare/email-rule.d.ts +196 -0
- package/lib/cloudflare/email-rule.d.ts.map +1 -0
- package/lib/cloudflare/email-rule.js +153 -0
- package/lib/cloudflare/email-rule.js.map +1 -0
- package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
- package/lib/cloudflare/hyperdrive.js +5 -4
- package/lib/cloudflare/hyperdrive.js.map +1 -1
- package/lib/cloudflare/images.d.ts +60 -0
- package/lib/cloudflare/images.d.ts.map +1 -0
- package/lib/cloudflare/images.js +60 -0
- package/lib/cloudflare/images.js.map +1 -0
- package/lib/cloudflare/index.d.ts +9 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +9 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv-namespace.js +2 -1
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/pipeline.d.ts +7 -0
- package/lib/cloudflare/pipeline.d.ts.map +1 -1
- package/lib/cloudflare/pipeline.js +28 -2
- package/lib/cloudflare/pipeline.js.map +1 -1
- package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
- package/lib/cloudflare/queue-consumer.js +2 -1
- package/lib/cloudflare/queue-consumer.js.map +1 -1
- package/lib/cloudflare/queue.d.ts.map +1 -1
- package/lib/cloudflare/queue.js +0 -8
- package/lib/cloudflare/queue.js.map +1 -1
- package/lib/cloudflare/route.d.ts +26 -1
- package/lib/cloudflare/route.d.ts.map +1 -1
- package/lib/cloudflare/route.js +84 -16
- package/lib/cloudflare/route.js.map +1 -1
- package/lib/cloudflare/secret.d.ts +137 -0
- package/lib/cloudflare/secret.d.ts.map +1 -0
- package/lib/cloudflare/secret.js +122 -0
- package/lib/cloudflare/secret.js.map +1 -0
- package/lib/cloudflare/secrets-store.d.ts +145 -0
- package/lib/cloudflare/secrets-store.d.ts.map +1 -0
- package/lib/cloudflare/secrets-store.js +213 -0
- package/lib/cloudflare/secrets-store.js.map +1 -0
- package/lib/cloudflare/sveltekit.d.ts +49 -0
- package/lib/cloudflare/sveltekit.d.ts.map +1 -0
- package/lib/cloudflare/sveltekit.js +56 -0
- package/lib/cloudflare/sveltekit.js.map +1 -0
- package/lib/cloudflare/user.d.ts.map +1 -1
- package/lib/cloudflare/user.js +2 -1
- package/lib/cloudflare/user.js.map +1 -1
- package/lib/cloudflare/vectorize-index.d.ts.map +1 -1
- package/lib/cloudflare/vectorize-index.js +6 -5
- package/lib/cloudflare/vectorize-index.js.map +1 -1
- package/lib/cloudflare/vectorize-metadata-index.d.ts.map +1 -1
- package/lib/cloudflare/vectorize-metadata-index.js +2 -1
- package/lib/cloudflare/vectorize-metadata-index.js.map +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +7 -2
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts +18 -0
- package/lib/cloudflare/worker-assets.d.ts.map +1 -1
- package/lib/cloudflare/worker-assets.js +61 -57
- package/lib/cloudflare/worker-assets.js.map +1 -1
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
- package/lib/cloudflare/worker-metadata.js +16 -1
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +31 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +34 -8
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +14 -0
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +23 -0
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/cloudflare/zone.d.ts +30 -2
- package/lib/cloudflare/zone.d.ts.map +1 -1
- package/lib/cloudflare/zone.js +57 -3
- package/lib/cloudflare/zone.js.map +1 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +30 -13
- package/lib/destroy.js.map +1 -1
- package/lib/dns/godaddy.d.ts.map +1 -1
- package/lib/dns/godaddy.js +3 -2
- package/lib/dns/godaddy.js.map +1 -1
- package/lib/dns/import-dns.d.ts.map +1 -1
- package/lib/dns/import-dns.js +2 -1
- package/lib/dns/import-dns.js.map +1 -1
- package/lib/esbuild/bundle.d.ts +1 -1
- package/lib/esbuild/bundle.d.ts.map +1 -1
- package/lib/esbuild/bundle.js +2 -1
- package/lib/esbuild/bundle.js.map +1 -1
- package/lib/fs/copy-file.d.ts.map +1 -1
- package/lib/fs/copy-file.js +2 -1
- package/lib/fs/copy-file.js.map +1 -1
- package/lib/fs/file.d.ts.map +1 -1
- package/lib/fs/file.js +2 -1
- package/lib/fs/file.js.map +1 -1
- package/lib/github/client.d.ts.map +1 -1
- package/lib/github/client.js +11 -10
- package/lib/github/client.js.map +1 -1
- package/lib/github/repository-environment.d.ts.map +1 -1
- package/lib/github/repository-environment.js +5 -4
- package/lib/github/repository-environment.js.map +1 -1
- package/lib/github/secret.d.ts.map +1 -1
- package/lib/github/secret.js +7 -6
- package/lib/github/secret.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/neon/project.d.ts.map +1 -1
- package/lib/neon/project.js +3 -2
- package/lib/neon/project.js.map +1 -1
- package/lib/planetscale/api.d.ts +53 -0
- package/lib/planetscale/api.d.ts.map +1 -0
- package/lib/planetscale/api.js +84 -0
- package/lib/planetscale/api.js.map +1 -0
- package/lib/planetscale/branch.d.ts +129 -0
- package/lib/planetscale/branch.d.ts.map +1 -0
- package/lib/planetscale/branch.js +161 -0
- package/lib/planetscale/branch.js.map +1 -0
- package/lib/planetscale/database.d.ts +143 -0
- package/lib/planetscale/database.d.ts.map +1 -0
- package/lib/planetscale/database.js +184 -0
- package/lib/planetscale/database.js.map +1 -0
- package/lib/planetscale/index.d.ts +5 -0
- package/lib/planetscale/index.d.ts.map +1 -0
- package/lib/planetscale/index.js +5 -0
- package/lib/planetscale/index.js.map +1 -0
- package/lib/planetscale/utils.d.ts +15 -0
- package/lib/planetscale/utils.d.ts.map +1 -0
- package/lib/planetscale/utils.js +95 -0
- package/lib/planetscale/utils.js.map +1 -0
- package/lib/resource.js +7 -1
- package/lib/resource.js.map +1 -1
- package/lib/runtime/plugin.d.ts.map +1 -1
- package/lib/runtime/plugin.js +2 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/scope.d.ts +13 -2
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +53 -10
- package/lib/scope.js.map +1 -1
- package/lib/sentry/client-key.d.ts.map +1 -1
- package/lib/sentry/client-key.js +5 -4
- package/lib/sentry/client-key.js.map +1 -1
- package/lib/sentry/project.d.ts.map +1 -1
- package/lib/sentry/project.js +5 -4
- package/lib/sentry/project.js.map +1 -1
- package/lib/sentry/team.d.ts.map +1 -1
- package/lib/sentry/team.js +5 -4
- package/lib/sentry/team.js.map +1 -1
- package/lib/stripe/card.d.ts.map +1 -1
- package/lib/stripe/card.js +2 -1
- package/lib/stripe/card.js.map +1 -1
- package/lib/stripe/client.d.ts.map +1 -1
- package/lib/stripe/client.js +3 -2
- package/lib/stripe/client.js.map +1 -1
- package/lib/stripe/coupon.d.ts.map +1 -1
- package/lib/stripe/coupon.js +2 -1
- package/lib/stripe/coupon.js.map +1 -1
- package/lib/stripe/customer.d.ts.map +1 -1
- package/lib/stripe/customer.js +2 -1
- package/lib/stripe/customer.js.map +1 -1
- package/lib/stripe/entitlements-feature.d.ts.map +1 -1
- package/lib/stripe/entitlements-feature.js +2 -1
- package/lib/stripe/entitlements-feature.js.map +1 -1
- package/lib/stripe/file.d.ts.map +1 -1
- package/lib/stripe/file.js +2 -1
- package/lib/stripe/file.js.map +1 -1
- package/lib/stripe/meter.d.ts.map +1 -1
- package/lib/stripe/meter.js +4 -2
- package/lib/stripe/meter.js.map +1 -1
- package/lib/stripe/portal-configuration.d.ts.map +1 -1
- package/lib/stripe/portal-configuration.js +2 -1
- package/lib/stripe/portal-configuration.js.map +1 -1
- package/lib/stripe/price.d.ts.map +1 -1
- package/lib/stripe/price.js +2 -1
- package/lib/stripe/price.js.map +1 -1
- package/lib/stripe/product-feature.d.ts.map +1 -1
- package/lib/stripe/product-feature.js +2 -1
- package/lib/stripe/product-feature.js.map +1 -1
- package/lib/stripe/product.d.ts.map +1 -1
- package/lib/stripe/product.js +2 -1
- package/lib/stripe/product.js.map +1 -1
- package/lib/stripe/promotion-code.d.ts.map +1 -1
- package/lib/stripe/promotion-code.js +2 -1
- package/lib/stripe/promotion-code.js.map +1 -1
- package/lib/stripe/shipping-rate.d.ts.map +1 -1
- package/lib/stripe/shipping-rate.js +2 -1
- package/lib/stripe/shipping-rate.js.map +1 -1
- package/lib/stripe/tax-rate.d.ts.map +1 -1
- package/lib/stripe/tax-rate.js +2 -1
- package/lib/stripe/tax-rate.js.map +1 -1
- package/lib/stripe/webhook.d.ts.map +1 -1
- package/lib/stripe/webhook.js +3 -2
- package/lib/stripe/webhook.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js +6 -1
- package/lib/test/bun.js.map +1 -1
- package/lib/test/prune.js +7 -1
- package/lib/test/prune.js.map +1 -1
- package/lib/test/vitest.d.ts.map +1 -1
- package/lib/test/vitest.js +2 -0
- package/lib/test/vitest.js.map +1 -1
- package/lib/upstash/redis.d.ts.map +1 -1
- package/lib/upstash/redis.js +2 -1
- package/lib/upstash/redis.js.map +1 -1
- package/lib/util/async-queue.d.ts +35 -0
- package/lib/util/async-queue.d.ts.map +1 -0
- package/lib/util/async-queue.js +87 -0
- package/lib/util/async-queue.js.map +1 -0
- package/lib/util/cli.d.ts +37 -0
- package/lib/util/cli.d.ts.map +1 -0
- package/lib/util/cli.js +90 -0
- package/lib/util/cli.js.map +1 -0
- package/lib/util/ignore-matcher.d.ts +94 -0
- package/lib/util/ignore-matcher.d.ts.map +1 -0
- package/lib/util/ignore-matcher.js +616 -0
- package/lib/util/ignore-matcher.js.map +1 -0
- package/lib/util/logger.d.ts +3 -0
- package/lib/util/logger.d.ts.map +1 -0
- package/lib/util/logger.js +15 -0
- package/lib/util/logger.js.map +1 -0
- package/lib/util/retry.d.ts.map +1 -1
- package/lib/util/retry.js +0 -1
- package/lib/util/retry.js.map +1 -1
- package/lib/util/safe-fetch.d.ts.map +1 -1
- package/lib/util/safe-fetch.js +2 -1
- package/lib/util/safe-fetch.js.map +1 -1
- package/lib/util/telemetry/client.d.ts +32 -0
- package/lib/util/telemetry/client.d.ts.map +1 -0
- package/lib/util/telemetry/client.js +94 -0
- package/lib/util/telemetry/client.js.map +1 -0
- package/lib/util/telemetry/constants.d.ts +4 -0
- package/lib/util/telemetry/constants.d.ts.map +1 -0
- package/lib/util/telemetry/constants.js +8 -0
- package/lib/util/telemetry/constants.js.map +1 -0
- package/lib/util/telemetry/context.d.ts +15 -0
- package/lib/util/telemetry/context.d.ts.map +1 -0
- package/lib/util/telemetry/context.js +128 -0
- package/lib/util/telemetry/context.js.map +1 -0
- package/lib/util/telemetry/index.d.ts +3 -0
- package/lib/util/telemetry/index.d.ts.map +1 -0
- package/lib/util/telemetry/index.js +3 -0
- package/lib/util/telemetry/index.js.map +1 -0
- package/lib/util/telemetry/types.d.ts +59 -0
- package/lib/util/telemetry/types.d.ts.map +1 -0
- package/lib/util/telemetry/types.js +1 -0
- package/lib/util/telemetry/types.js.map +1 -0
- package/lib/util/xdg-paths.d.ts +9 -0
- package/lib/util/xdg-paths.d.ts.map +1 -0
- package/lib/util/xdg-paths.js +41 -0
- package/lib/util/xdg-paths.js.map +1 -0
- package/lib/vercel/project.d.ts.map +1 -1
- package/lib/vercel/project.js +2 -1
- package/lib/vercel/project.js.map +1 -1
- package/lib/web/astro.d.ts.map +1 -1
- package/lib/web/astro.js +2 -1
- package/lib/web/astro.js.map +1 -1
- package/lib/web/shadcn.d.ts.map +1 -1
- package/lib/web/shadcn.js +2 -1
- package/lib/web/shadcn.js.map +1 -1
- package/lib/web/vite.d.ts.map +1 -1
- package/lib/web/vite.js +3 -2
- package/lib/web/vite.js.map +1 -1
- package/lib/web/vitepress/dependencies.d.ts.map +1 -1
- package/lib/web/vitepress/dependencies.js +2 -1
- package/lib/web/vitepress/dependencies.js.map +1 -1
- package/lib/web/vitepress/vitepress.d.ts.map +1 -1
- package/lib/web/vitepress/vitepress.js +2 -1
- package/lib/web/vitepress/vitepress.js.map +1 -1
- package/package.json +7 -5
- package/src/ai/astro-file.ts +2 -1
- package/src/ai/client.ts +3 -2
- package/src/alchemy.ts +28 -3
- package/src/apply.ts +66 -5
- package/src/aws/control/client.ts +5 -5
- package/src/aws/control/properties.ts +48 -0
- package/src/aws/control/resource.ts +5 -3
- package/src/aws/control/types.ts +3988 -6301
- package/src/aws/function.ts +9 -8
- package/src/aws/oidc/oidc-provider.ts +3 -2
- package/src/aws/queue.ts +3 -2
- package/src/aws/role.ts +3 -1
- package/src/aws/ssm-parameter.ts +2 -1
- package/src/cloudflare/account-api-token.ts +3 -2
- package/src/cloudflare/ai-gateway.ts +4 -3
- package/src/cloudflare/ai.ts +21 -0
- package/src/cloudflare/api-error.ts +36 -0
- package/src/cloudflare/api.ts +9 -4
- package/src/cloudflare/assets.ts +30 -6
- package/src/cloudflare/astro.ts +176 -0
- package/src/cloudflare/auth.ts +3 -2
- package/src/cloudflare/bindings.ts +27 -0
- package/src/cloudflare/bound.ts +31 -17
- package/src/cloudflare/bucket.ts +15 -8
- package/src/cloudflare/bundle/bundle-worker.ts +2 -1
- package/src/cloudflare/bundle/nodejs-compat-mode.ts +2 -1
- package/src/cloudflare/custom-domain.ts +10 -9
- package/src/cloudflare/d1-database.ts +11 -10
- package/src/cloudflare/d1-export.ts +2 -1
- package/src/cloudflare/d1-import.ts +2 -1
- package/src/cloudflare/d1-migrations.ts +2 -1
- package/src/cloudflare/dns-records.ts +5 -4
- package/src/cloudflare/do-state-store/worker.ts +4 -0
- package/src/cloudflare/email-address.ts +203 -0
- package/src/cloudflare/email-catch-all.ts +248 -0
- package/src/cloudflare/email-routing.ts +230 -0
- package/src/cloudflare/email-rule.ts +322 -0
- package/src/cloudflare/hyperdrive.ts +5 -4
- package/src/cloudflare/images.ts +59 -0
- package/src/cloudflare/index.ts +9 -0
- package/src/cloudflare/kv-namespace.ts +2 -1
- package/src/cloudflare/pipeline.ts +38 -2
- package/src/cloudflare/queue-consumer.ts +2 -1
- package/src/cloudflare/queue.ts +0 -12
- package/src/cloudflare/route.ts +118 -18
- package/src/cloudflare/secret.ts +253 -0
- package/src/cloudflare/secrets-store.ts +420 -0
- package/src/cloudflare/sveltekit.ts +72 -0
- package/src/cloudflare/user.ts +2 -1
- package/src/cloudflare/vectorize-index.ts +6 -5
- package/src/cloudflare/vectorize-metadata-index.ts +2 -1
- package/src/cloudflare/website.ts +76 -66
- package/src/cloudflare/worker-assets.ts +95 -77
- package/src/cloudflare/worker-metadata.ts +14 -1
- package/src/cloudflare/worker.ts +76 -9
- package/src/cloudflare/wrangler.json.ts +42 -0
- package/src/cloudflare/zone.ts +79 -5
- package/src/destroy.ts +35 -17
- package/src/dns/godaddy.ts +3 -2
- package/src/dns/import-dns.ts +2 -1
- package/src/esbuild/bundle.ts +2 -1
- package/src/fs/copy-file.ts +2 -1
- package/src/fs/file.ts +3 -1
- package/src/github/client.ts +11 -10
- package/src/github/repository-environment.ts +5 -4
- package/src/github/secret.ts +7 -6
- package/src/index.ts +2 -1
- package/src/neon/project.ts +3 -2
- package/src/planetscale/api.ts +115 -0
- package/src/planetscale/branch.ts +352 -0
- package/src/planetscale/database.ts +394 -0
- package/src/planetscale/index.ts +4 -0
- package/src/planetscale/utils.ts +189 -0
- package/src/resource.ts +7 -1
- package/src/runtime/plugin.ts +2 -1
- package/src/scope.ts +64 -13
- package/src/sentry/client-key.ts +5 -4
- package/src/sentry/project.ts +5 -4
- package/src/sentry/team.ts +5 -4
- package/src/stripe/card.ts +2 -1
- package/src/stripe/client.ts +3 -2
- package/src/stripe/coupon.ts +2 -1
- package/src/stripe/customer.ts +2 -1
- package/src/stripe/entitlements-feature.ts +2 -1
- package/src/stripe/file.ts +2 -1
- package/src/stripe/meter.ts +4 -2
- package/src/stripe/portal-configuration.ts +2 -1
- package/src/stripe/price.ts +2 -1
- package/src/stripe/product-feature.ts +2 -1
- package/src/stripe/product.ts +2 -1
- package/src/stripe/promotion-code.ts +2 -1
- package/src/stripe/shipping-rate.ts +2 -1
- package/src/stripe/tax-rate.ts +2 -1
- package/src/stripe/webhook.ts +3 -2
- package/src/test/bun.ts +6 -1
- package/src/test/prune.ts +7 -1
- package/src/test/vitest.ts +2 -0
- package/src/upstash/redis.ts +2 -1
- package/src/util/async-queue.ts +97 -0
- package/src/util/cli.tsx +221 -0
- package/src/util/ignore-matcher.ts +873 -0
- package/src/util/logger.ts +17 -0
- package/src/util/retry.ts +0 -1
- package/src/util/safe-fetch.ts +2 -1
- package/src/util/telemetry/client.ts +127 -0
- package/src/util/telemetry/constants.ts +13 -0
- package/src/util/telemetry/context.ts +154 -0
- package/src/util/telemetry/index.ts +2 -0
- package/src/util/telemetry/types.ts +83 -0
- package/src/util/xdg-paths.ts +48 -0
- package/src/vercel/project.ts +2 -1
- package/src/web/astro.ts +2 -1
- package/src/web/shadcn.ts +2 -1
- package/src/web/vite.ts +3 -2
- package/src/web/vitepress/dependencies.ts +2 -1
- package/src/web/vitepress/vitepress.ts +2 -1
package/src/cloudflare/route.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 { CloudflareApiError, handleApiError } from "./api-error.ts";
|
|
4
5
|
import {
|
|
5
6
|
createCloudflareApi,
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
type CloudflareApiOptions,
|
|
8
9
|
} from "./api.ts";
|
|
9
10
|
import type { Worker } from "./worker.ts";
|
|
11
|
+
import { getZoneByDomain } from "./zone.ts";
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Properties for creating or updating a Route
|
|
@@ -26,8 +28,18 @@ export interface RouteProps extends CloudflareApiOptions {
|
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* Zone ID for the route
|
|
31
|
+
* If not provided, will be automatically inferred from the route pattern using Cloudflare's zones API.
|
|
32
|
+
* The system will attempt to find a zone that matches the domain in the route pattern.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Explicit zone ID:
|
|
36
|
+
* { pattern: "api.example.com/*", zoneId: "abc123def456" }
|
|
37
|
+
*
|
|
38
|
+
* // Automatic inference (recommended):
|
|
39
|
+
* { pattern: "api.example.com/*" } // Zone ID automatically inferred from "example.com"
|
|
40
|
+
* { pattern: "*.example.com/api/*" } // Zone ID inferred from "example.com"
|
|
29
41
|
*/
|
|
30
|
-
zoneId
|
|
42
|
+
zoneId?: string;
|
|
31
43
|
|
|
32
44
|
/**
|
|
33
45
|
* Whether to adopt an existing route with the same pattern if it exists
|
|
@@ -95,6 +107,21 @@ export interface Route extends Resource<"cloudflare::Route">, RouteProps {
|
|
|
95
107
|
* zoneId: "your-zone-id"
|
|
96
108
|
* });
|
|
97
109
|
*
|
|
110
|
+
* @example
|
|
111
|
+
* // Create a route with automatic zone ID inference
|
|
112
|
+
* // The zone ID will be automatically determined from the domain in the pattern
|
|
113
|
+
* const autoRoute = await Route("auto-route", {
|
|
114
|
+
* pattern: "api.example.com/*", // Zone ID inferred from example.com
|
|
115
|
+
* script: "my-worker"
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* // Works with wildcard patterns too
|
|
120
|
+
* const wildcardRoute = await Route("wildcard-route", {
|
|
121
|
+
* pattern: "*.example.com/api/*", // Zone ID inferred from example.com
|
|
122
|
+
* script: "api-worker"
|
|
123
|
+
* });
|
|
124
|
+
*
|
|
98
125
|
* @see https://developers.cloudflare.com/workers/configuration/routes/
|
|
99
126
|
*/
|
|
100
127
|
export const Route = Resource(
|
|
@@ -110,25 +137,44 @@ export const Route = Resource(
|
|
|
110
137
|
const scriptName =
|
|
111
138
|
typeof props.script === "string" ? props.script : props.script.name;
|
|
112
139
|
|
|
113
|
-
// Get zone ID from props
|
|
114
|
-
const { zoneId } = props;
|
|
115
|
-
|
|
116
140
|
if (this.phase === "delete") {
|
|
117
|
-
|
|
141
|
+
logger.log("Deleting Route:", props.pattern);
|
|
118
142
|
|
|
119
|
-
// Only delete if we have
|
|
120
|
-
|
|
121
|
-
|
|
143
|
+
// Only delete if we have complete output data (both ID and zoneId)
|
|
144
|
+
// If creation failed, we won't have proper output, so just skip deletion
|
|
145
|
+
if (this.output?.id && this.output?.zoneId) {
|
|
146
|
+
await deleteRoute(api, this.output.zoneId, this.output.id);
|
|
122
147
|
}
|
|
123
148
|
|
|
124
149
|
// Return void (a deleted route has no content)
|
|
125
150
|
return this.destroy();
|
|
126
151
|
}
|
|
127
152
|
|
|
153
|
+
// Get or infer zone ID (only needed for create/update phases)
|
|
154
|
+
let zoneId = props.zoneId;
|
|
155
|
+
if (!zoneId) {
|
|
156
|
+
const inferredZoneId = await inferZoneIdFromPattern(props.pattern, {
|
|
157
|
+
accountId: props.accountId,
|
|
158
|
+
apiKey: props.apiKey,
|
|
159
|
+
apiToken: props.apiToken,
|
|
160
|
+
baseUrl: props.baseUrl,
|
|
161
|
+
email: props.email,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (!inferredZoneId) {
|
|
165
|
+
throw new Error(
|
|
166
|
+
`Could not infer zone ID for route pattern "${props.pattern}". ` +
|
|
167
|
+
"Please ensure the domain is managed by Cloudflare or specify an explicit zoneId.",
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
zoneId = inferredZoneId;
|
|
172
|
+
}
|
|
173
|
+
|
|
128
174
|
let routeData: CloudflareRouteResponse;
|
|
129
175
|
|
|
130
176
|
if (this.phase === "update" && this.output?.id) {
|
|
131
|
-
|
|
177
|
+
logger.log("Updating Route:", props.pattern);
|
|
132
178
|
|
|
133
179
|
// Update existing route
|
|
134
180
|
routeData = await updateRoute(
|
|
@@ -139,7 +185,7 @@ export const Route = Resource(
|
|
|
139
185
|
scriptName,
|
|
140
186
|
);
|
|
141
187
|
} else {
|
|
142
|
-
|
|
188
|
+
logger.log("Creating Route:", props.pattern);
|
|
143
189
|
|
|
144
190
|
try {
|
|
145
191
|
// Create new route
|
|
@@ -151,7 +197,7 @@ export const Route = Resource(
|
|
|
151
197
|
error instanceof CloudflareApiError &&
|
|
152
198
|
error.status === 409
|
|
153
199
|
) {
|
|
154
|
-
|
|
200
|
+
logger.log(
|
|
155
201
|
`Route with pattern '${props.pattern}' already exists, adopting it`,
|
|
156
202
|
);
|
|
157
203
|
// Find the existing route by pattern
|
|
@@ -167,13 +213,14 @@ export const Route = Resource(
|
|
|
167
213
|
);
|
|
168
214
|
}
|
|
169
215
|
|
|
170
|
-
//
|
|
171
|
-
routeData =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
216
|
+
// Update the existing route to point to our script
|
|
217
|
+
routeData = await updateRoute(
|
|
218
|
+
api,
|
|
219
|
+
zoneId,
|
|
220
|
+
existingRoute.id,
|
|
221
|
+
props.pattern,
|
|
222
|
+
scriptName,
|
|
223
|
+
);
|
|
177
224
|
} else {
|
|
178
225
|
// Re-throw the error if adopt is false or it's not a 409 error
|
|
179
226
|
throw error;
|
|
@@ -350,3 +397,56 @@ async function findRouteByPattern(
|
|
|
350
397
|
const match = data.result.find((route) => route.pattern === pattern);
|
|
351
398
|
return match || null;
|
|
352
399
|
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Extract domain from a route pattern, similar to wrangler's logic
|
|
403
|
+
* @param pattern The route pattern (e.g., "api.example.com/*", "*.example.com/api/*")
|
|
404
|
+
* @returns The domain part of the pattern
|
|
405
|
+
*/
|
|
406
|
+
function extractDomainFromPattern(pattern: string): string {
|
|
407
|
+
// Remove protocol if present
|
|
408
|
+
let domain = pattern.replace(/^https?:\/\//, "");
|
|
409
|
+
|
|
410
|
+
// Remove path part (everything after the first '/')
|
|
411
|
+
domain = domain.split("/")[0];
|
|
412
|
+
|
|
413
|
+
// Remove port if present
|
|
414
|
+
domain = domain.split(":")[0];
|
|
415
|
+
|
|
416
|
+
return domain;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Infer zone ID from a route pattern using Cloudflare API
|
|
421
|
+
* This implements similar logic to wrangler's zone inference
|
|
422
|
+
* @param pattern The route pattern
|
|
423
|
+
* @param apiOptions API options for Cloudflare API calls
|
|
424
|
+
* @returns Promise resolving to zone ID or null if not found
|
|
425
|
+
*/
|
|
426
|
+
async function inferZoneIdFromPattern(
|
|
427
|
+
pattern: string,
|
|
428
|
+
apiOptions: Partial<CloudflareApiOptions>,
|
|
429
|
+
): Promise<string | null> {
|
|
430
|
+
const domain = extractDomainFromPattern(pattern);
|
|
431
|
+
|
|
432
|
+
// Handle wildcard domains by removing the wildcard part
|
|
433
|
+
const cleanDomain = domain.replace(/^\*\./, "");
|
|
434
|
+
|
|
435
|
+
// Try to find zone for the exact domain first
|
|
436
|
+
let zone = await getZoneByDomain(cleanDomain, apiOptions);
|
|
437
|
+
if (zone) {
|
|
438
|
+
return zone.id;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// If not found, try parent domains (similar to wrangler's logic)
|
|
442
|
+
const domainParts = cleanDomain.split(".");
|
|
443
|
+
for (let i = 1; i < domainParts.length - 1; i++) {
|
|
444
|
+
const parentDomain = domainParts.slice(i).join(".");
|
|
445
|
+
zone = await getZoneByDomain(parentDomain, apiOptions);
|
|
446
|
+
if (zone) {
|
|
447
|
+
return zone.id;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { Context } from "../context.ts";
|
|
2
|
+
import { Resource, ResourceKind } from "../resource.ts";
|
|
3
|
+
import {
|
|
4
|
+
secret as alchemySecret,
|
|
5
|
+
type Secret as AlchemySecret,
|
|
6
|
+
} from "../secret.ts";
|
|
7
|
+
import { handleApiError } from "./api-error.ts";
|
|
8
|
+
import {
|
|
9
|
+
createCloudflareApi,
|
|
10
|
+
type CloudflareApi,
|
|
11
|
+
type CloudflareApiOptions,
|
|
12
|
+
} from "./api.ts";
|
|
13
|
+
import type { SecretsStore } from "./secrets-store.ts";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Properties for creating or updating a Secret in a Secrets Store (internal interface)
|
|
17
|
+
*/
|
|
18
|
+
interface _SecretProps extends CloudflareApiOptions {
|
|
19
|
+
/**
|
|
20
|
+
* The secrets store to add this secret to
|
|
21
|
+
*/
|
|
22
|
+
store: SecretsStore<any>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The secret value to store (must be an AlchemySecret for security)
|
|
26
|
+
*/
|
|
27
|
+
value: AlchemySecret;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Whether to delete the secret.
|
|
31
|
+
* If set to false, the secret will remain but the resource will be removed from state
|
|
32
|
+
*
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
delete?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Properties for creating or updating a Secret in a Secrets Store (public interface)
|
|
40
|
+
*/
|
|
41
|
+
export interface SecretProps extends CloudflareApiOptions {
|
|
42
|
+
/**
|
|
43
|
+
* The secrets store to add this secret to
|
|
44
|
+
*/
|
|
45
|
+
store: SecretsStore<any>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The secret value to store
|
|
49
|
+
* Can be a string or an existing Secret instance
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const secret = await Secret("api-key", {
|
|
54
|
+
* store: mySecretsStore,
|
|
55
|
+
* value: alchemy.secret(process.env.API_KEY)
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
value: string | AlchemySecret;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Whether to delete the secret.
|
|
63
|
+
* If set to false, the secret will remain but the resource will be removed from state
|
|
64
|
+
*
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
delete?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function isSecret(resource: Resource): resource is Secret {
|
|
71
|
+
return resource[ResourceKind] === "cloudflare::Secret";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface Secret
|
|
75
|
+
extends Resource<"cloudflare::Secret">,
|
|
76
|
+
Omit<_SecretProps, "delete"> {
|
|
77
|
+
/**
|
|
78
|
+
* The name of the secret
|
|
79
|
+
*/
|
|
80
|
+
name: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The unique identifier of the secrets store this secret belongs to
|
|
84
|
+
*/
|
|
85
|
+
storeId: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The secret value (as an alchemy Secret instance)
|
|
89
|
+
*/
|
|
90
|
+
value: AlchemySecret;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Timestamp when the secret was created
|
|
94
|
+
*/
|
|
95
|
+
createdAt: number;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Timestamp when the secret was last modified
|
|
99
|
+
*/
|
|
100
|
+
modifiedAt: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A Cloudflare Secret represents an individual secret stored in a Secrets Store.
|
|
105
|
+
*
|
|
106
|
+
* Use this resource to add individual secrets to an existing Secrets Store,
|
|
107
|
+
* providing fine-grained control over secret management.
|
|
108
|
+
*
|
|
109
|
+
* @see https://developers.cloudflare.com/api/resources/secrets_store/subresources/stores/subresources/secrets/
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* // Create a secrets store first
|
|
113
|
+
* const store = await SecretsStore("my-store", {
|
|
114
|
+
* name: "production-secrets"
|
|
115
|
+
* });
|
|
116
|
+
*
|
|
117
|
+
* // Add individual secrets to the store
|
|
118
|
+
* const apiKey = await Secret("api-key", {
|
|
119
|
+
* store: store,
|
|
120
|
+
* value: alchemy.secret(process.env.API_KEY)
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* const dbUrl = await Secret("database-url", {
|
|
124
|
+
* store: store,
|
|
125
|
+
* value: process.env.DATABASE_URL
|
|
126
|
+
* });
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* // Use in a Worker binding
|
|
130
|
+
* const worker = await Worker("my-worker", {
|
|
131
|
+
* bindings: {
|
|
132
|
+
* SECRETS: store
|
|
133
|
+
* },
|
|
134
|
+
* code: `
|
|
135
|
+
* export default {
|
|
136
|
+
* async fetch(request, env) {
|
|
137
|
+
* const apiKey = await env.SECRETS.get("api-key");
|
|
138
|
+
* const dbUrl = await env.SECRETS.get("database-url");
|
|
139
|
+
* return new Response(\`API: \${apiKey ? "set" : "unset"}\`);
|
|
140
|
+
* }
|
|
141
|
+
* }
|
|
142
|
+
* `
|
|
143
|
+
* });
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* // When removing from Alchemy state, keep the secret in Cloudflare
|
|
147
|
+
* const preservedSecret = await Secret("preserve-secret", {
|
|
148
|
+
* store: myStore,
|
|
149
|
+
* value: "preserved-value",
|
|
150
|
+
* delete: false
|
|
151
|
+
* });
|
|
152
|
+
*/
|
|
153
|
+
export async function Secret(
|
|
154
|
+
name: string,
|
|
155
|
+
props: SecretProps,
|
|
156
|
+
): Promise<Secret> {
|
|
157
|
+
// Convert string value to AlchemySecret if needed to prevent plain text serialization
|
|
158
|
+
const secretValue =
|
|
159
|
+
typeof props.value === "string" ? alchemySecret(props.value) : props.value;
|
|
160
|
+
|
|
161
|
+
// Call the internal resource with secure props
|
|
162
|
+
return _Secret(name, {
|
|
163
|
+
...props,
|
|
164
|
+
value: secretValue,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const _Secret = Resource(
|
|
169
|
+
"cloudflare::Secret",
|
|
170
|
+
async function (
|
|
171
|
+
this: Context<Secret>,
|
|
172
|
+
name: string,
|
|
173
|
+
props: _SecretProps,
|
|
174
|
+
): Promise<Secret> {
|
|
175
|
+
const api = await createCloudflareApi(props);
|
|
176
|
+
|
|
177
|
+
if (this.phase === "delete") {
|
|
178
|
+
if (props.delete !== false) {
|
|
179
|
+
await deleteSecret(api, props.store.id, name);
|
|
180
|
+
}
|
|
181
|
+
return this.destroy();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const createdAt =
|
|
185
|
+
this.phase === "update"
|
|
186
|
+
? this.output?.createdAt || Date.now()
|
|
187
|
+
: Date.now();
|
|
188
|
+
|
|
189
|
+
// Insert or update the secret
|
|
190
|
+
await insertSecret(api, props.store.id, name, props.value);
|
|
191
|
+
|
|
192
|
+
return this({
|
|
193
|
+
name,
|
|
194
|
+
storeId: props.store.id,
|
|
195
|
+
store: props.store,
|
|
196
|
+
value: props.value,
|
|
197
|
+
createdAt,
|
|
198
|
+
modifiedAt: Date.now(),
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Insert or update a secret in a secrets store
|
|
205
|
+
*/
|
|
206
|
+
export async function insertSecret(
|
|
207
|
+
api: CloudflareApi,
|
|
208
|
+
storeId: string,
|
|
209
|
+
secretName: string,
|
|
210
|
+
secretValue: AlchemySecret,
|
|
211
|
+
): Promise<void> {
|
|
212
|
+
const response = await api.post(
|
|
213
|
+
`/accounts/${api.accountId}/secrets_store/stores/${storeId}/secrets`,
|
|
214
|
+
[
|
|
215
|
+
{
|
|
216
|
+
name: secretName,
|
|
217
|
+
value: secretValue.unencrypted,
|
|
218
|
+
scopes: [],
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
if (!response.ok) {
|
|
224
|
+
const errorData: any = await response.json().catch(() => ({
|
|
225
|
+
errors: [{ message: response.statusText }],
|
|
226
|
+
}));
|
|
227
|
+
const errorMessage = errorData.errors?.[0]?.message || response.statusText;
|
|
228
|
+
throw new Error(`Error creating secret '${secretName}': ${errorMessage}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Delete a secret from a secrets store
|
|
234
|
+
*/
|
|
235
|
+
export async function deleteSecret(
|
|
236
|
+
api: CloudflareApi,
|
|
237
|
+
storeId: string,
|
|
238
|
+
secretName: string,
|
|
239
|
+
): Promise<void> {
|
|
240
|
+
const response = await api.delete(
|
|
241
|
+
`/accounts/${api.accountId}/secrets_store/stores/${storeId}/secrets`,
|
|
242
|
+
{
|
|
243
|
+
body: JSON.stringify([secretName]),
|
|
244
|
+
headers: {
|
|
245
|
+
"Content-Type": "application/json",
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
if (!response.ok && response.status !== 404) {
|
|
251
|
+
await handleApiError(response, "delete", "secret", secretName);
|
|
252
|
+
}
|
|
253
|
+
}
|