alchemy 0.67.0 → 0.69.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/bin/alchemy.js +25580 -26264
- package/bin/alchemy.ts +6 -2
- package/bin/commands/configure.ts +194 -0
- package/bin/commands/login.ts +99 -55
- package/bin/commands/logout.ts +66 -0
- package/bin/trpc.ts +27 -2
- package/lib/apply.d.ts +2 -2
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +18 -15
- package/lib/apply.js.map +1 -1
- package/lib/auth.d.ts +72 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +163 -0
- package/lib/auth.js.map +1 -0
- package/lib/aws/bucket.d.ts +12 -3
- package/lib/aws/bucket.d.ts.map +1 -1
- package/lib/aws/bucket.js +2 -2
- package/lib/aws/bucket.js.map +1 -1
- package/lib/aws/control/properties.d.ts +64 -0
- package/lib/aws/control/properties.d.ts.map +1 -1
- package/lib/aws/control/properties.js +554 -39
- package/lib/aws/control/properties.js.map +1 -1
- package/lib/aws/control/resource.d.ts +34 -3
- package/lib/aws/control/resource.d.ts.map +1 -1
- package/lib/aws/control/resource.js +36 -3
- package/lib/aws/control/resource.js.map +1 -1
- package/lib/aws/control/types.d.ts +5451 -1587
- package/lib/aws/control/types.d.ts.map +1 -1
- package/lib/aws/control/types.js.map +1 -1
- package/lib/aws/control/update-types.d.ts +12913 -0
- package/lib/aws/control/update-types.d.ts.map +1 -0
- package/lib/aws/control/update-types.js +12916 -0
- package/lib/aws/control/update-types.js.map +1 -0
- package/lib/aws/ec2/internet-gateway-attachment.d.ts +1 -2
- package/lib/aws/ec2/internet-gateway-attachment.d.ts.map +1 -1
- package/lib/aws/ec2/internet-gateway-attachment.js +4 -4
- package/lib/aws/ec2/internet-gateway-attachment.js.map +1 -1
- package/lib/aws/ec2/internet-gateway.d.ts +1 -2
- package/lib/aws/ec2/internet-gateway.d.ts.map +1 -1
- package/lib/aws/ec2/internet-gateway.js +2 -2
- package/lib/aws/ec2/internet-gateway.js.map +1 -1
- package/lib/aws/ec2/nat-gateway.d.ts +1 -2
- package/lib/aws/ec2/nat-gateway.d.ts.map +1 -1
- package/lib/aws/ec2/nat-gateway.js +2 -2
- package/lib/aws/ec2/nat-gateway.js.map +1 -1
- package/lib/aws/ec2/route-table-association.d.ts +1 -2
- package/lib/aws/ec2/route-table-association.d.ts.map +1 -1
- package/lib/aws/ec2/route-table-association.js +2 -2
- package/lib/aws/ec2/route-table-association.js.map +1 -1
- package/lib/aws/ec2/route-table.d.ts +1 -2
- package/lib/aws/ec2/route-table.d.ts.map +1 -1
- package/lib/aws/ec2/route-table.js +2 -2
- package/lib/aws/ec2/route-table.js.map +1 -1
- package/lib/aws/ec2/route.d.ts +1 -2
- package/lib/aws/ec2/route.d.ts.map +1 -1
- package/lib/aws/ec2/route.js +2 -2
- package/lib/aws/ec2/route.js.map +1 -1
- package/lib/aws/ec2/security-group-rule.d.ts +1 -2
- package/lib/aws/ec2/security-group-rule.d.ts.map +1 -1
- package/lib/aws/ec2/security-group-rule.js +2 -2
- package/lib/aws/ec2/security-group-rule.js.map +1 -1
- package/lib/aws/ec2/security-group.d.ts +1 -2
- package/lib/aws/ec2/security-group.d.ts.map +1 -1
- package/lib/aws/ec2/security-group.js +2 -2
- package/lib/aws/ec2/security-group.js.map +1 -1
- package/lib/aws/ec2/subnet.d.ts +1 -2
- package/lib/aws/ec2/subnet.d.ts.map +1 -1
- package/lib/aws/ec2/subnet.js +2 -2
- package/lib/aws/ec2/subnet.js.map +1 -1
- package/lib/aws/ec2/vpc.d.ts +1 -2
- package/lib/aws/ec2/vpc.d.ts.map +1 -1
- package/lib/aws/ec2/vpc.js +2 -2
- package/lib/aws/ec2/vpc.js.map +1 -1
- package/lib/aws/function.d.ts +116 -3
- package/lib/aws/function.d.ts.map +1 -1
- package/lib/aws/function.js +2 -2
- package/lib/aws/function.js.map +1 -1
- package/lib/aws/oidc/github-oidc-provider.d.ts +13 -2
- package/lib/aws/oidc/github-oidc-provider.d.ts.map +1 -1
- package/lib/aws/oidc/oidc-provider.d.ts +48 -3
- package/lib/aws/oidc/oidc-provider.d.ts.map +1 -1
- package/lib/aws/oidc/oidc-provider.js +2 -2
- package/lib/aws/oidc/oidc-provider.js.map +1 -1
- package/lib/aws/policy-attachment.d.ts +2 -3
- package/lib/aws/policy-attachment.d.ts.map +1 -1
- package/lib/aws/policy-attachment.js +1 -1
- package/lib/aws/policy-attachment.js.map +1 -1
- package/lib/aws/policy.d.ts +1 -2
- package/lib/aws/policy.d.ts.map +1 -1
- package/lib/aws/policy.js +4 -4
- package/lib/aws/policy.js.map +1 -1
- package/lib/aws/queue.d.ts +1 -2
- package/lib/aws/queue.d.ts.map +1 -1
- package/lib/aws/queue.js +4 -4
- package/lib/aws/queue.js.map +1 -1
- package/lib/aws/role.d.ts +1 -2
- package/lib/aws/role.d.ts.map +1 -1
- package/lib/aws/role.js +2 -2
- package/lib/aws/role.js.map +1 -1
- package/lib/aws/ses.d.ts +1 -2
- package/lib/aws/ses.d.ts.map +1 -1
- package/lib/aws/ses.js +2 -2
- package/lib/aws/ses.js.map +1 -1
- package/lib/aws/ssm-parameter.d.ts +1 -2
- package/lib/aws/ssm-parameter.d.ts.map +1 -1
- package/lib/aws/ssm-parameter.js +2 -2
- package/lib/aws/ssm-parameter.js.map +1 -1
- package/lib/aws/table.d.ts +1 -2
- package/lib/aws/table.d.ts.map +1 -1
- package/lib/aws/table.js +2 -2
- package/lib/aws/table.js.map +1 -1
- package/lib/cloudflare/account-api-token.d.ts +1 -2
- package/lib/cloudflare/account-api-token.d.ts.map +1 -1
- package/lib/cloudflare/account-api-token.js +2 -2
- package/lib/cloudflare/account-api-token.js.map +1 -1
- package/lib/cloudflare/ai-gateway.d.ts +1 -2
- package/lib/cloudflare/ai-gateway.d.ts.map +1 -1
- package/lib/cloudflare/ai-gateway.js +2 -2
- package/lib/cloudflare/ai-gateway.js.map +1 -1
- package/lib/cloudflare/api-gateway-operation.d.ts +1 -2
- package/lib/cloudflare/api-gateway-operation.d.ts.map +1 -1
- package/lib/cloudflare/api-gateway-operation.js +2 -2
- package/lib/cloudflare/api-gateway-operation.js.map +1 -1
- package/lib/cloudflare/api-schema.d.ts +1 -2
- package/lib/cloudflare/api-schema.d.ts.map +1 -1
- package/lib/cloudflare/api-schema.js +2 -2
- package/lib/cloudflare/api-schema.js.map +1 -1
- package/lib/cloudflare/api-shield.d.ts +1 -2
- package/lib/cloudflare/api-shield.d.ts.map +1 -1
- package/lib/cloudflare/api-shield.js +2 -2
- package/lib/cloudflare/api-shield.js.map +1 -1
- package/lib/cloudflare/api.d.ts +18 -10
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +92 -38
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/assets.d.ts +21 -43
- package/lib/cloudflare/assets.d.ts.map +1 -1
- package/lib/cloudflare/assets.js +78 -70
- package/lib/cloudflare/assets.js.map +1 -1
- package/lib/cloudflare/astro/astro.d.ts.map +1 -1
- package/lib/cloudflare/astro/astro.js +3 -3
- package/lib/cloudflare/astro/astro.js.map +1 -1
- package/lib/cloudflare/auth.d.ts +91 -17
- package/lib/cloudflare/auth.d.ts.map +1 -1
- package/lib/cloudflare/auth.js +141 -62
- package/lib/cloudflare/auth.js.map +1 -1
- package/lib/cloudflare/bound.d.ts +1 -1
- package/lib/cloudflare/bound.d.ts.map +1 -1
- package/lib/cloudflare/bucket-object.d.ts +81 -0
- package/lib/cloudflare/bucket-object.d.ts.map +1 -0
- package/lib/cloudflare/bucket-object.js +67 -0
- package/lib/cloudflare/bucket-object.js.map +1 -0
- package/lib/cloudflare/bucket.d.ts +87 -8
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +246 -19
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/bundle/plugin-wasm.js +4 -2
- package/lib/cloudflare/bundle/plugin-wasm.js.map +1 -1
- package/lib/cloudflare/certificate-pack.d.ts +1 -2
- package/lib/cloudflare/certificate-pack.d.ts.map +1 -1
- package/lib/cloudflare/certificate-pack.js +4 -4
- package/lib/cloudflare/certificate-pack.js.map +1 -1
- package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
- package/lib/cloudflare/compatibility-date.gen.js +1 -1
- package/lib/cloudflare/container.d.ts +1 -2
- package/lib/cloudflare/container.d.ts.map +1 -1
- package/lib/cloudflare/container.js +7 -7
- package/lib/cloudflare/container.js.map +1 -1
- package/lib/cloudflare/custom-domain.d.ts +1 -2
- package/lib/cloudflare/custom-domain.d.ts.map +1 -1
- package/lib/cloudflare/custom-domain.js +2 -2
- package/lib/cloudflare/custom-domain.js.map +1 -1
- package/lib/cloudflare/d1-database.d.ts +2 -3
- package/lib/cloudflare/d1-database.d.ts.map +1 -1
- package/lib/cloudflare/d1-database.js +5 -5
- package/lib/cloudflare/d1-database.js.map +1 -1
- package/lib/cloudflare/dispatch-namespace.d.ts +2 -3
- package/lib/cloudflare/dispatch-namespace.d.ts.map +1 -1
- package/lib/cloudflare/dispatch-namespace.js +3 -3
- package/lib/cloudflare/dispatch-namespace.js.map +1 -1
- package/lib/cloudflare/dns-records.d.ts +1 -2
- package/lib/cloudflare/dns-records.d.ts.map +1 -1
- package/lib/cloudflare/dns-records.js +4 -4
- package/lib/cloudflare/dns-records.js.map +1 -1
- package/lib/cloudflare/email-address.d.ts +1 -2
- package/lib/cloudflare/email-address.d.ts.map +1 -1
- package/lib/cloudflare/email-address.js +6 -6
- package/lib/cloudflare/email-address.js.map +1 -1
- package/lib/cloudflare/email-catch-all.d.ts +1 -2
- package/lib/cloudflare/email-catch-all.d.ts.map +1 -1
- package/lib/cloudflare/email-catch-all.js +4 -4
- package/lib/cloudflare/email-catch-all.js.map +1 -1
- package/lib/cloudflare/email-routing.d.ts +1 -2
- package/lib/cloudflare/email-routing.d.ts.map +1 -1
- package/lib/cloudflare/email-routing.js +4 -4
- package/lib/cloudflare/email-routing.js.map +1 -1
- package/lib/cloudflare/email-rule.d.ts +1 -2
- package/lib/cloudflare/email-rule.d.ts.map +1 -1
- package/lib/cloudflare/email-rule.js +4 -4
- package/lib/cloudflare/email-rule.js.map +1 -1
- package/lib/cloudflare/hyperdrive.d.ts +1 -2
- package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
- package/lib/cloudflare/hyperdrive.js +4 -4
- package/lib/cloudflare/hyperdrive.js.map +1 -1
- package/lib/cloudflare/index.d.ts +1 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +1 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts +2 -3
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv-namespace.js +5 -5
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/miniflare/delete.js +1 -1
- package/lib/cloudflare/miniflare/delete.js.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-worker-proxy.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-worker-proxy.js +2 -7
- package/lib/cloudflare/miniflare/miniflare-worker-proxy.js.map +1 -1
- package/lib/cloudflare/miniflare/remote-binding-proxy.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/remote-binding-proxy.js +15 -4
- package/lib/cloudflare/miniflare/remote-binding-proxy.js.map +1 -1
- package/lib/cloudflare/next.js.map +1 -1
- package/lib/cloudflare/nuxt/nuxt.d.ts.map +1 -1
- package/lib/cloudflare/nuxt/nuxt.js +3 -3
- package/lib/cloudflare/nuxt/nuxt.js.map +1 -1
- package/lib/cloudflare/permission-groups.d.ts +1 -2
- package/lib/cloudflare/permission-groups.d.ts.map +1 -1
- package/lib/cloudflare/permission-groups.js +1 -1
- package/lib/cloudflare/permission-groups.js.map +1 -1
- package/lib/cloudflare/pipeline.d.ts +2 -3
- package/lib/cloudflare/pipeline.d.ts.map +1 -1
- package/lib/cloudflare/pipeline.js +5 -5
- package/lib/cloudflare/pipeline.js.map +1 -1
- package/lib/cloudflare/queue-consumer.d.ts +1 -2
- package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
- package/lib/cloudflare/queue-consumer.js +4 -4
- package/lib/cloudflare/queue-consumer.js.map +1 -1
- package/lib/cloudflare/queue.d.ts +1 -2
- package/lib/cloudflare/queue.d.ts.map +1 -1
- package/lib/cloudflare/queue.js +4 -4
- package/lib/cloudflare/queue.js.map +1 -1
- package/lib/cloudflare/react-router/plugin.d.ts.map +1 -1
- package/lib/cloudflare/react-router/plugin.js +13 -0
- package/lib/cloudflare/react-router/plugin.js.map +1 -1
- package/lib/cloudflare/redirect-rule.d.ts +1 -2
- package/lib/cloudflare/redirect-rule.d.ts.map +1 -1
- package/lib/cloudflare/redirect-rule.js +4 -4
- package/lib/cloudflare/redirect-rule.js.map +1 -1
- package/lib/cloudflare/route.d.ts +1 -2
- package/lib/cloudflare/route.d.ts.map +1 -1
- package/lib/cloudflare/route.js +4 -4
- package/lib/cloudflare/route.js.map +1 -1
- package/lib/cloudflare/ruleset.d.ts +1 -2
- package/lib/cloudflare/ruleset.d.ts.map +1 -1
- package/lib/cloudflare/ruleset.js +2 -2
- package/lib/cloudflare/ruleset.js.map +1 -1
- package/lib/cloudflare/secret.d.ts +2 -3
- package/lib/cloudflare/secret.d.ts.map +1 -1
- package/lib/cloudflare/secret.js +3 -3
- package/lib/cloudflare/secret.js.map +1 -1
- package/lib/cloudflare/secrets-store.d.ts +2 -3
- package/lib/cloudflare/secrets-store.d.ts.map +1 -1
- package/lib/cloudflare/secrets-store.js +3 -3
- package/lib/cloudflare/secrets-store.js.map +1 -1
- package/lib/cloudflare/tunnel.d.ts +2 -3
- package/lib/cloudflare/tunnel.d.ts.map +1 -1
- package/lib/cloudflare/tunnel.js +3 -3
- package/lib/cloudflare/tunnel.js.map +1 -1
- package/lib/cloudflare/user.d.ts +3 -2
- package/lib/cloudflare/user.d.ts.map +1 -1
- package/lib/cloudflare/user.js +7 -5
- package/lib/cloudflare/user.js.map +1 -1
- package/lib/cloudflare/vectorize-index.d.ts +2 -3
- package/lib/cloudflare/vectorize-index.d.ts.map +1 -1
- package/lib/cloudflare/vectorize-index.js +6 -6
- package/lib/cloudflare/vectorize-index.js.map +1 -1
- package/lib/cloudflare/vectorize-metadata-index.d.ts +2 -3
- package/lib/cloudflare/vectorize-metadata-index.d.ts.map +1 -1
- package/lib/cloudflare/vectorize-metadata-index.js +4 -4
- package/lib/cloudflare/vectorize-metadata-index.js.map +1 -1
- package/lib/cloudflare/vite/vite.d.ts.map +1 -1
- package/lib/cloudflare/vite/vite.js +3 -3
- package/lib/cloudflare/vite/vite.js.map +1 -1
- package/lib/cloudflare/website.d.ts +7 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +20 -2
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts +1 -29
- package/lib/cloudflare/worker-assets.d.ts.map +1 -1
- package/lib/cloudflare/worker-assets.js +9 -42
- package/lib/cloudflare/worker-assets.js.map +1 -1
- package/lib/cloudflare/worker-stub.d.ts +2 -3
- package/lib/cloudflare/worker-stub.d.ts.map +1 -1
- package/lib/cloudflare/worker-stub.js +3 -3
- package/lib/cloudflare/worker-stub.js.map +1 -1
- package/lib/cloudflare/worker-subdomain.d.ts +4 -3
- package/lib/cloudflare/worker-subdomain.d.ts.map +1 -1
- package/lib/cloudflare/worker-subdomain.js +5 -5
- package/lib/cloudflare/worker-subdomain.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +3 -4
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +6 -5
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +27 -8
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +3 -1
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/cloudflare/zone.d.ts +1 -2
- package/lib/cloudflare/zone.d.ts.map +1 -1
- package/lib/cloudflare/zone.js +2 -2
- package/lib/cloudflare/zone.js.map +1 -1
- package/lib/context.d.ts +8 -8
- package/lib/context.d.ts.map +1 -1
- package/lib/context.js.map +1 -1
- package/lib/destroy.d.ts +1 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js.map +1 -1
- package/lib/dns/import-dns.d.ts +1 -2
- package/lib/dns/import-dns.d.ts.map +1 -1
- package/lib/dns/import-dns.js +2 -2
- package/lib/dns/import-dns.js.map +1 -1
- package/lib/docker/container.d.ts +1 -2
- package/lib/docker/container.d.ts.map +1 -1
- package/lib/docker/container.js +2 -3
- package/lib/docker/container.js.map +1 -1
- package/lib/docker/image.d.ts +1 -2
- package/lib/docker/image.d.ts.map +1 -1
- package/lib/docker/image.js +9 -9
- package/lib/docker/image.js.map +1 -1
- package/lib/docker/network.d.ts +1 -2
- package/lib/docker/network.d.ts.map +1 -1
- package/lib/docker/network.js +2 -3
- package/lib/docker/network.js.map +1 -1
- package/lib/docker/remote-image.d.ts +1 -2
- package/lib/docker/remote-image.d.ts.map +1 -1
- package/lib/docker/remote-image.js +2 -3
- package/lib/docker/remote-image.js.map +1 -1
- package/lib/docker/volume.d.ts +1 -2
- package/lib/docker/volume.d.ts.map +1 -1
- package/lib/docker/volume.js +2 -3
- package/lib/docker/volume.js.map +1 -1
- package/lib/esbuild/bundle.d.ts +1 -2
- package/lib/esbuild/bundle.d.ts.map +1 -1
- package/lib/esbuild/bundle.js +4 -4
- package/lib/esbuild/bundle.js.map +1 -1
- package/lib/fs/copy-file.d.ts +1 -2
- package/lib/fs/copy-file.d.ts.map +1 -1
- package/lib/fs/copy-file.js +2 -2
- package/lib/fs/copy-file.js.map +1 -1
- package/lib/fs/file.d.ts +1 -2
- package/lib/fs/file.d.ts.map +1 -1
- package/lib/fs/file.js +2 -2
- package/lib/fs/file.js.map +1 -1
- package/lib/fs/folder.d.ts +1 -2
- package/lib/fs/folder.d.ts.map +1 -1
- package/lib/fs/folder.js +2 -2
- package/lib/fs/folder.js.map +1 -1
- package/lib/github/comment.d.ts +1 -2
- package/lib/github/comment.d.ts.map +1 -1
- package/lib/github/comment.js +4 -4
- package/lib/github/comment.js.map +1 -1
- package/lib/github/repository-environment.d.ts +1 -2
- package/lib/github/repository-environment.d.ts.map +1 -1
- package/lib/github/repository-environment.js +2 -2
- package/lib/github/repository-environment.js.map +1 -1
- package/lib/github/repository-webhook.d.ts +1 -2
- package/lib/github/repository-webhook.d.ts.map +1 -1
- package/lib/github/repository-webhook.js +2 -2
- package/lib/github/repository-webhook.js.map +1 -1
- package/lib/github/secret.d.ts +1 -2
- package/lib/github/secret.d.ts.map +1 -1
- package/lib/github/secret.js +2 -2
- package/lib/github/secret.js.map +1 -1
- package/lib/llms.cloudflare.txt +2 -2
- package/lib/neon/api/client.gen.d.ts +13 -0
- package/lib/neon/api/client.gen.d.ts.map +1 -0
- package/lib/neon/api/client.gen.js +7 -0
- package/lib/neon/api/client.gen.js.map +1 -0
- package/lib/neon/api/sdk.gen.d.ts +880 -0
- package/lib/neon/api/sdk.gen.d.ts.map +1 -0
- package/lib/neon/api/sdk.gen.js +1527 -0
- package/lib/neon/api/sdk.gen.js.map +1 -0
- package/lib/neon/api/types.gen.d.ts +7250 -0
- package/lib/neon/api/types.gen.d.ts.map +1 -0
- package/lib/neon/api/types.gen.js +2 -0
- package/lib/neon/api/types.gen.js.map +1 -0
- package/lib/neon/api.d.ts +14 -49
- package/lib/neon/api.d.ts.map +1 -1
- package/lib/neon/api.js +36 -114
- package/lib/neon/api.js.map +1 -1
- package/lib/neon/branch.d.ts +157 -0
- package/lib/neon/branch.d.ts.map +1 -0
- package/lib/neon/branch.js +112 -0
- package/lib/neon/branch.js.map +1 -0
- package/lib/neon/index.d.ts +1 -1
- package/lib/neon/index.d.ts.map +1 -1
- package/lib/neon/index.js +1 -1
- package/lib/neon/index.js.map +1 -1
- package/lib/neon/project.d.ts +49 -243
- package/lib/neon/project.d.ts.map +1 -1
- package/lib/neon/project.js +90 -269
- package/lib/neon/project.js.map +1 -1
- package/lib/neon/utils.d.ts +49 -0
- package/lib/neon/utils.d.ts.map +1 -0
- package/lib/neon/utils.js +44 -0
- package/lib/neon/utils.js.map +1 -0
- package/lib/os/exec.d.ts +1 -2
- package/lib/os/exec.d.ts.map +1 -1
- package/lib/os/exec.js +2 -2
- package/lib/os/exec.js.map +1 -1
- package/lib/planetscale/api/client.gen.d.ts +12 -1749
- package/lib/planetscale/api/client.gen.d.ts.map +1 -1
- package/lib/planetscale/api/client.gen.js +6 -2400
- package/lib/planetscale/api/client.gen.js.map +1 -1
- package/lib/planetscale/api/sdk.gen.d.ts +1582 -0
- package/lib/planetscale/api/sdk.gen.d.ts.map +1 -0
- package/lib/planetscale/api/sdk.gen.js +2219 -0
- package/lib/planetscale/api/sdk.gen.js.map +1 -0
- package/lib/planetscale/api/types.gen.d.ts +594 -449
- package/lib/planetscale/api/types.gen.d.ts.map +1 -1
- package/lib/planetscale/api.d.ts +43 -0
- package/lib/planetscale/api.d.ts.map +1 -0
- package/lib/planetscale/api.js +53 -0
- package/lib/planetscale/api.js.map +1 -0
- package/lib/planetscale/branch.d.ts +2 -3
- package/lib/planetscale/branch.d.ts.map +1 -1
- package/lib/planetscale/branch.js +17 -15
- package/lib/planetscale/branch.js.map +1 -1
- package/lib/planetscale/database.d.ts +2 -3
- package/lib/planetscale/database.d.ts.map +1 -1
- package/lib/planetscale/database.js +34 -34
- package/lib/planetscale/database.js.map +1 -1
- package/lib/planetscale/index.d.ts +1 -1
- package/lib/planetscale/index.d.ts.map +1 -1
- package/lib/planetscale/index.js +1 -1
- package/lib/planetscale/index.js.map +1 -1
- package/lib/planetscale/password.d.ts +2 -3
- package/lib/planetscale/password.d.ts.map +1 -1
- package/lib/planetscale/password.js +11 -11
- package/lib/planetscale/password.js.map +1 -1
- package/lib/planetscale/role.d.ts +2 -3
- package/lib/planetscale/role.d.ts.map +1 -1
- package/lib/planetscale/role.js +18 -18
- package/lib/planetscale/role.js.map +1 -1
- package/lib/planetscale/utils.d.ts +1 -1
- package/lib/planetscale/utils.d.ts.map +1 -1
- package/lib/planetscale/utils.js +17 -33
- package/lib/planetscale/utils.js.map +1 -1
- package/lib/random/random-string.d.ts +1 -2
- package/lib/random/random-string.d.ts.map +1 -1
- package/lib/random/random-string.js +3 -3
- package/lib/random/random-string.js.map +1 -1
- package/lib/resource.d.ts +4 -1
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js.map +1 -1
- package/lib/sentry/client-key.d.ts +1 -2
- package/lib/sentry/client-key.d.ts.map +1 -1
- package/lib/sentry/client-key.js +2 -2
- package/lib/sentry/client-key.js.map +1 -1
- package/lib/sentry/project.d.ts +1 -2
- package/lib/sentry/project.d.ts.map +1 -1
- package/lib/sentry/project.js +2 -2
- package/lib/sentry/project.js.map +1 -1
- package/lib/sentry/team.d.ts +1 -2
- package/lib/sentry/team.d.ts.map +1 -1
- package/lib/sentry/team.js +2 -2
- package/lib/sentry/team.js.map +1 -1
- package/lib/serde.d.ts +3 -0
- package/lib/serde.d.ts.map +1 -1
- package/lib/serde.js +40 -0
- package/lib/serde.js.map +1 -1
- package/lib/state/r2-rest-state-store.d.ts +1 -0
- package/lib/state/r2-rest-state-store.d.ts.map +1 -1
- package/lib/state/r2-rest-state-store.js +15 -34
- package/lib/state/r2-rest-state-store.js.map +1 -1
- package/lib/stripe/card.d.ts +1 -2
- package/lib/stripe/card.d.ts.map +1 -1
- package/lib/stripe/card.js +2 -2
- package/lib/stripe/card.js.map +1 -1
- package/lib/stripe/coupon.d.ts +1 -2
- package/lib/stripe/coupon.d.ts.map +1 -1
- package/lib/stripe/coupon.js +2 -2
- package/lib/stripe/coupon.js.map +1 -1
- package/lib/stripe/customer.d.ts +1 -2
- package/lib/stripe/customer.d.ts.map +1 -1
- package/lib/stripe/customer.js +2 -2
- package/lib/stripe/customer.js.map +1 -1
- package/lib/stripe/entitlements-feature.d.ts +1 -2
- package/lib/stripe/entitlements-feature.d.ts.map +1 -1
- package/lib/stripe/entitlements-feature.js +2 -2
- package/lib/stripe/entitlements-feature.js.map +1 -1
- package/lib/stripe/file.d.ts +1 -2
- package/lib/stripe/file.d.ts.map +1 -1
- package/lib/stripe/file.js +2 -2
- package/lib/stripe/file.js.map +1 -1
- package/lib/stripe/meter.d.ts +1 -2
- package/lib/stripe/meter.d.ts.map +1 -1
- package/lib/stripe/meter.js +1 -1
- package/lib/stripe/meter.js.map +1 -1
- package/lib/stripe/portal-configuration.d.ts +1 -2
- package/lib/stripe/portal-configuration.d.ts.map +1 -1
- package/lib/stripe/portal-configuration.js +2 -2
- package/lib/stripe/portal-configuration.js.map +1 -1
- package/lib/stripe/price.d.ts +1 -2
- package/lib/stripe/price.d.ts.map +1 -1
- package/lib/stripe/price.js +2 -2
- package/lib/stripe/price.js.map +1 -1
- package/lib/stripe/product-feature.d.ts +1 -2
- package/lib/stripe/product-feature.d.ts.map +1 -1
- package/lib/stripe/product-feature.js +2 -2
- package/lib/stripe/product-feature.js.map +1 -1
- package/lib/stripe/product.d.ts +1 -2
- package/lib/stripe/product.d.ts.map +1 -1
- package/lib/stripe/product.js +2 -2
- package/lib/stripe/product.js.map +1 -1
- package/lib/stripe/promotion-code.d.ts +1 -2
- package/lib/stripe/promotion-code.d.ts.map +1 -1
- package/lib/stripe/promotion-code.js +2 -2
- package/lib/stripe/promotion-code.js.map +1 -1
- package/lib/stripe/shipping-rate.d.ts +1 -2
- package/lib/stripe/shipping-rate.d.ts.map +1 -1
- package/lib/stripe/shipping-rate.js +2 -2
- package/lib/stripe/shipping-rate.js.map +1 -1
- package/lib/stripe/tax-rate.d.ts +1 -2
- package/lib/stripe/tax-rate.d.ts.map +1 -1
- package/lib/stripe/tax-rate.js +2 -2
- package/lib/stripe/tax-rate.js.map +1 -1
- package/lib/stripe/webhook.d.ts +16 -3
- package/lib/stripe/webhook.d.ts.map +1 -1
- package/lib/stripe/webhook.js +2 -2
- package/lib/stripe/webhook.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js +1 -0
- package/lib/test/bun.js.map +1 -1
- package/lib/test/options.d.ts +5 -0
- package/lib/test/options.d.ts.map +1 -1
- package/lib/test/vitest.d.ts.map +1 -1
- package/lib/test/vitest.js +1 -0
- package/lib/test/vitest.js.map +1 -1
- package/lib/upstash/redis.d.ts +1 -2
- package/lib/upstash/redis.d.ts.map +1 -1
- package/lib/upstash/redis.js.map +1 -1
- package/lib/util/api/client/client.gen.d.ts +3 -0
- package/lib/util/api/client/client.gen.d.ts.map +1 -0
- package/lib/util/api/client/client.gen.js +205 -0
- package/lib/util/api/client/client.gen.js.map +1 -0
- package/lib/util/api/client/index.d.ts +8 -0
- package/lib/util/api/client/index.d.ts.map +1 -0
- package/lib/util/api/client/index.js +6 -0
- package/lib/util/api/client/index.js.map +1 -0
- package/lib/util/api/client/types.gen.d.ts +125 -0
- package/lib/util/api/client/types.gen.d.ts.map +1 -0
- package/lib/util/api/client/types.gen.js +2 -0
- package/lib/util/api/client/types.gen.js.map +1 -0
- package/lib/util/api/client/utils.gen.d.ts +34 -0
- package/lib/util/api/client/utils.gen.d.ts.map +1 -0
- package/lib/util/api/client/utils.gen.js +231 -0
- package/lib/util/api/client/utils.gen.js.map +1 -0
- package/lib/util/api/core/auth.gen.d.ts +19 -0
- package/lib/util/api/core/auth.gen.d.ts.map +1 -0
- package/lib/util/api/core/auth.gen.js +15 -0
- package/lib/util/api/core/auth.gen.js.map +1 -0
- package/lib/util/api/core/bodySerializer.gen.d.ts +18 -0
- package/lib/util/api/core/bodySerializer.gen.d.ts.map +1 -0
- package/lib/util/api/core/bodySerializer.gen.js +58 -0
- package/lib/util/api/core/bodySerializer.gen.js.map +1 -0
- package/lib/util/api/core/params.gen.d.ts +34 -0
- package/lib/util/api/core/params.gen.d.ts.map +1 -0
- package/lib/util/api/core/params.gen.js +89 -0
- package/lib/util/api/core/params.gen.js.map +1 -0
- package/lib/util/api/core/pathSerializer.gen.d.ts +34 -0
- package/lib/util/api/core/pathSerializer.gen.d.ts.map +1 -0
- package/lib/util/api/core/pathSerializer.gen.js +115 -0
- package/lib/util/api/core/pathSerializer.gen.js.map +1 -0
- package/lib/util/api/core/serverSentEvents.gen.d.ts +72 -0
- package/lib/util/api/core/serverSentEvents.gen.d.ts.map +1 -0
- package/lib/util/api/core/serverSentEvents.gen.js +136 -0
- package/lib/util/api/core/serverSentEvents.gen.js.map +1 -0
- package/lib/util/api/core/types.gen.d.ts +79 -0
- package/lib/util/api/core/types.gen.d.ts.map +1 -0
- package/lib/util/api/core/types.gen.js +2 -0
- package/lib/util/api/core/types.gen.js.map +1 -0
- package/lib/util/api/core/utils.gen.d.ts +20 -0
- package/lib/util/api/core/utils.gen.d.ts.map +1 -0
- package/lib/util/api/core/utils.gen.js +88 -0
- package/lib/util/api/core/utils.gen.js.map +1 -0
- package/lib/util/http.d.ts +7 -2
- package/lib/util/http.d.ts.map +1 -1
- package/lib/util/http.js +29 -11
- package/lib/util/http.js.map +1 -1
- package/lib/util/lock.d.ts +20 -0
- package/lib/util/lock.d.ts.map +1 -0
- package/lib/util/lock.js +45 -0
- package/lib/util/lock.js.map +1 -0
- package/lib/util/memoize.d.ts +6 -0
- package/lib/util/memoize.d.ts.map +1 -1
- package/lib/util/memoize.js +23 -0
- package/lib/util/memoize.js.map +1 -1
- package/lib/util/oauth-client.d.ts +71 -0
- package/lib/util/oauth-client.d.ts.map +1 -0
- package/lib/util/oauth-client.js +188 -0
- package/lib/util/oauth-client.js.map +1 -0
- package/lib/util/poll.d.ts +33 -0
- package/lib/util/poll.d.ts.map +1 -0
- package/lib/util/poll.js +19 -0
- package/lib/util/poll.js.map +1 -0
- package/lib/vercel/project-domain.d.ts +1 -2
- package/lib/vercel/project-domain.d.ts.map +1 -1
- package/lib/vercel/project-domain.js.map +1 -1
- package/lib/vercel/project.d.ts +1 -2
- package/lib/vercel/project.d.ts.map +1 -1
- package/lib/vercel/project.js +2 -2
- package/lib/vercel/project.js.map +1 -1
- package/package.json +5 -1
- package/src/apply.ts +32 -29
- package/src/auth.ts +253 -0
- package/src/aws/bucket.ts +3 -3
- package/src/aws/control/properties.ts +554 -39
- package/src/aws/control/resource.ts +62 -6
- package/src/aws/control/types.ts +85281 -84914
- package/src/aws/control/update-types.ts +12917 -0
- package/src/aws/ec2/internet-gateway-attachment.ts +5 -6
- package/src/aws/ec2/internet-gateway.ts +3 -5
- package/src/aws/ec2/nat-gateway.ts +3 -5
- package/src/aws/ec2/route-table-association.ts +3 -5
- package/src/aws/ec2/route-table.ts +3 -5
- package/src/aws/ec2/route.ts +3 -3
- package/src/aws/ec2/security-group-rule.ts +3 -5
- package/src/aws/ec2/security-group.ts +3 -5
- package/src/aws/ec2/subnet.ts +3 -3
- package/src/aws/ec2/vpc.ts +3 -3
- package/src/aws/function.ts +3 -3
- package/src/aws/oidc/oidc-provider.ts +3 -5
- package/src/aws/policy-attachment.ts +2 -4
- package/src/aws/policy.ts +5 -5
- package/src/aws/queue.ts +5 -5
- package/src/aws/role.ts +3 -3
- package/src/aws/ses.ts +3 -3
- package/src/aws/ssm-parameter.ts +3 -3
- package/src/aws/table.ts +3 -3
- package/src/cloudflare/account-api-token.ts +3 -4
- package/src/cloudflare/ai-gateway.ts +3 -5
- package/src/cloudflare/api-gateway-operation.ts +3 -4
- package/src/cloudflare/api-schema.ts +25 -26
- package/src/cloudflare/api-shield.ts +3 -4
- package/src/cloudflare/api.ts +121 -57
- package/src/cloudflare/assets.ts +95 -136
- package/src/cloudflare/astro/astro.ts +8 -3
- package/src/cloudflare/auth.ts +160 -95
- package/src/cloudflare/bound.ts +1 -1
- package/src/cloudflare/bucket-object.ts +117 -0
- package/src/cloudflare/bucket.ts +452 -55
- package/src/cloudflare/bundle/plugin-wasm.ts +5 -5
- package/src/cloudflare/certificate-pack.ts +5 -6
- package/src/cloudflare/compatibility-date.gen.ts +1 -1
- package/src/cloudflare/container.ts +9 -11
- package/src/cloudflare/custom-domain.ts +3 -5
- package/src/cloudflare/d1-database.ts +33 -34
- package/src/cloudflare/dispatch-namespace.ts +5 -6
- package/src/cloudflare/dns-records.ts +5 -5
- package/src/cloudflare/email-address.ts +7 -7
- package/src/cloudflare/email-catch-all.ts +6 -6
- package/src/cloudflare/email-routing.ts +5 -5
- package/src/cloudflare/email-rule.ts +5 -5
- package/src/cloudflare/hyperdrive.ts +35 -36
- package/src/cloudflare/index.ts +1 -0
- package/src/cloudflare/kv-namespace.ts +31 -32
- package/src/cloudflare/miniflare/delete.ts +1 -1
- package/src/cloudflare/miniflare/miniflare-worker-proxy.ts +2 -7
- package/src/cloudflare/miniflare/remote-binding-proxy.ts +16 -4
- package/src/cloudflare/next.ts +2 -2
- package/src/cloudflare/nuxt/nuxt.ts +8 -3
- package/src/cloudflare/permission-groups.ts +4 -6
- package/src/cloudflare/pipeline.ts +29 -30
- package/src/cloudflare/queue-consumer.ts +5 -7
- package/src/cloudflare/queue.ts +42 -43
- package/src/cloudflare/react-router/plugin.ts +20 -0
- package/src/cloudflare/redirect-rule.ts +5 -5
- package/src/cloudflare/route.ts +5 -5
- package/src/cloudflare/ruleset.ts +3 -4
- package/src/cloudflare/secret.ts +35 -36
- package/src/cloudflare/secrets-store.ts +5 -8
- package/src/cloudflare/tunnel.ts +5 -7
- package/src/cloudflare/user.ts +12 -9
- package/src/cloudflare/vectorize-index.ts +8 -12
- package/src/cloudflare/vectorize-metadata-index.ts +6 -8
- package/src/cloudflare/vite/vite.ts +8 -3
- package/src/cloudflare/website.ts +29 -3
- package/src/cloudflare/worker-assets.ts +10 -56
- package/src/cloudflare/worker-stub.ts +5 -5
- package/src/cloudflare/worker-subdomain.ts +6 -7
- package/src/cloudflare/worker.ts +91 -91
- package/src/cloudflare/wrangler.json.ts +32 -17
- package/src/cloudflare/zone.ts +3 -3
- package/src/context.ts +9 -7
- package/src/destroy.ts +2 -2
- package/src/dns/import-dns.ts +3 -5
- package/src/docker/container.ts +3 -6
- package/src/docker/image.ts +13 -13
- package/src/docker/network.ts +3 -4
- package/src/docker/remote-image.ts +3 -6
- package/src/docker/volume.ts +3 -4
- package/src/esbuild/bundle.ts +10 -8
- package/src/fs/copy-file.ts +3 -3
- package/src/fs/file.ts +3 -3
- package/src/fs/folder.ts +3 -3
- package/src/github/comment.ts +5 -7
- package/src/github/repository-environment.ts +3 -5
- package/src/github/repository-webhook.ts +3 -5
- package/src/github/secret.ts +3 -5
- package/src/llms.cloudflare.txt +2 -2
- package/src/neon/api/client.gen.ts +28 -0
- package/src/neon/api/sdk.gen.ts +2596 -0
- package/src/neon/api/types.gen.ts +8287 -0
- package/src/neon/api.ts +51 -147
- package/src/neon/branch.ts +279 -0
- package/src/neon/index.ts +1 -1
- package/src/neon/project.ts +136 -721
- package/src/neon/utils.ts +105 -0
- package/src/os/exec.ts +3 -3
- package/src/planetscale/api/client.gen.ts +28 -2882
- package/src/planetscale/api/sdk.gen.ts +3336 -0
- package/src/planetscale/api/types.gen.ts +778 -450
- package/src/planetscale/api.ts +101 -0
- package/src/planetscale/branch.ts +20 -19
- package/src/planetscale/database.ts +69 -70
- package/src/planetscale/index.ts +1 -1
- package/src/planetscale/password.ts +18 -22
- package/src/planetscale/role.ts +21 -21
- package/src/planetscale/utils.ts +20 -74
- package/src/random/random-string.ts +4 -4
- package/src/resource.ts +6 -2
- package/src/sentry/client-key.ts +3 -5
- package/src/sentry/project.ts +3 -5
- package/src/sentry/team.ts +3 -3
- package/src/serde.ts +50 -0
- package/src/state/r2-rest-state-store.ts +15 -57
- package/src/stripe/card.ts +3 -3
- package/src/stripe/coupon.ts +3 -3
- package/src/stripe/customer.ts +3 -3
- package/src/stripe/entitlements-feature.ts +3 -5
- package/src/stripe/file.ts +3 -3
- package/src/stripe/meter.ts +3 -3
- package/src/stripe/portal-configuration.ts +3 -5
- package/src/stripe/price.ts +3 -3
- package/src/stripe/product-feature.ts +3 -5
- package/src/stripe/product.ts +3 -3
- package/src/stripe/promotion-code.ts +3 -5
- package/src/stripe/shipping-rate.ts +3 -5
- package/src/stripe/tax-rate.ts +3 -3
- package/src/stripe/webhook.ts +3 -5
- package/src/test/bun.ts +2 -1
- package/src/test/options.ts +6 -0
- package/src/test/vitest.ts +1 -0
- package/src/upstash/redis.ts +1 -3
- package/src/util/api/client/client.gen.ts +268 -0
- package/src/util/api/client/index.ts +25 -0
- package/src/util/api/client/types.gen.ts +268 -0
- package/src/util/api/client/utils.gen.ts +331 -0
- package/src/util/api/core/auth.gen.ts +42 -0
- package/src/util/api/core/bodySerializer.gen.ts +92 -0
- package/src/util/api/core/params.gen.ts +153 -0
- package/src/util/api/core/pathSerializer.gen.ts +181 -0
- package/src/util/api/core/serverSentEvents.gen.ts +264 -0
- package/src/util/api/core/types.gen.ts +118 -0
- package/src/util/api/core/utils.gen.ts +143 -0
- package/src/util/http.ts +38 -11
- package/src/util/lock.ts +48 -0
- package/src/util/memoize.ts +26 -0
- package/src/util/oauth-client.ts +238 -0
- package/src/util/poll.ts +55 -0
- package/src/vercel/project-domain.ts +1 -3
- package/src/vercel/project.ts +3 -3
- package/templates/rwsdk/.cursor/rules/alchemy_cloudflare.mdc +2 -2
- package/workers/cloudflare-state-store.js +8 -5619
- package/workers/dofs-state-store.js +2 -802
- package/workers/remote-binding-proxy.js +3 -39
- package/workers/remote-binding-proxy.ts +126 -35
- package/workers/tunnel-proxy.js +6 -73
- package/lib/cloudflare/asset-manifest.d.ts +0 -15
- package/lib/cloudflare/asset-manifest.d.ts.map +0 -1
- package/lib/cloudflare/asset-manifest.js +0 -1
- package/lib/cloudflare/asset-manifest.js.map +0 -1
- package/lib/cloudflare/oauth.d.ts +0 -22
- package/lib/cloudflare/oauth.d.ts.map +0 -1
- package/lib/cloudflare/oauth.js +0 -214
- package/lib/cloudflare/oauth.js.map +0 -1
- package/lib/neon/api-error.d.ts +0 -31
- package/lib/neon/api-error.d.ts.map +0 -1
- package/lib/neon/api-error.js +0 -73
- package/lib/neon/api-error.js.map +0 -1
- package/lib/planetscale/api/index.d.ts +0 -3
- package/lib/planetscale/api/index.d.ts.map +0 -1
- package/lib/planetscale/api/index.js +0 -4
- package/lib/planetscale/api/index.js.map +0 -1
- package/lib/util/neverthrow.d.ts +0 -16
- package/lib/util/neverthrow.d.ts.map +0 -1
- package/lib/util/neverthrow.js +0 -46
- package/lib/util/neverthrow.js.map +0 -1
- package/src/cloudflare/asset-manifest.ts +0 -16
- package/src/cloudflare/oauth.ts +0 -301
- package/src/neon/api-error.ts +0 -81
- package/src/planetscale/api/index.ts +0 -4
- package/src/util/neverthrow.ts +0 -64
package/src/neon/project.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { alchemy } from "../alchemy.ts";
|
|
2
1
|
import type { Context } from "../context.ts";
|
|
3
2
|
import { Resource } from "../resource.ts";
|
|
4
|
-
import type { Secret } from "../secret.ts";
|
|
5
|
-
import { logger } from "../util/logger.ts";
|
|
6
|
-
import { handleApiError } from "./api-error.ts";
|
|
7
3
|
import { createNeonApi, type NeonApiOptions } from "./api.ts";
|
|
4
|
+
import type * as neon from "./api/types.gen.ts";
|
|
5
|
+
import {
|
|
6
|
+
formatConnectionUri,
|
|
7
|
+
formatRole,
|
|
8
|
+
waitForOperations,
|
|
9
|
+
type NeonConnectionUri,
|
|
10
|
+
type NeonRole,
|
|
11
|
+
} from "./utils.ts";
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* A Neon region where projects can be provisioned
|
|
@@ -22,6 +26,8 @@ export type NeonRegion =
|
|
|
22
26
|
| "azure-westus3"
|
|
23
27
|
| "azure-gwc";
|
|
24
28
|
|
|
29
|
+
export type NeonPgVersion = 14 | 15 | 16 | 17 | 18;
|
|
30
|
+
|
|
25
31
|
/**
|
|
26
32
|
* Properties for creating or updating a Neon project
|
|
27
33
|
*/
|
|
@@ -43,13 +49,7 @@ export interface NeonProjectProps extends NeonApiOptions {
|
|
|
43
49
|
* PostgreSQL version to use
|
|
44
50
|
* @default 16
|
|
45
51
|
*/
|
|
46
|
-
pg_version?:
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Whether to create a default branch and endpoint
|
|
50
|
-
* @default true
|
|
51
|
-
*/
|
|
52
|
-
default_endpoint?: boolean;
|
|
52
|
+
pg_version?: NeonPgVersion;
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Default branch name
|
|
@@ -58,409 +58,76 @@ export interface NeonProjectProps extends NeonApiOptions {
|
|
|
58
58
|
default_branch_name?: string;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
* Used internally during update operations
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
existing_project_id?: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* A Neon database
|
|
70
|
-
*/
|
|
71
|
-
export interface NeonDatabase {
|
|
72
|
-
/**
|
|
73
|
-
* Database ID
|
|
74
|
-
*/
|
|
75
|
-
id: number;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* ID of the branch this database belongs to
|
|
79
|
-
*/
|
|
80
|
-
branch_id: string;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Database name
|
|
84
|
-
*/
|
|
85
|
-
name: string;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Name of the database owner role
|
|
89
|
-
*/
|
|
90
|
-
owner_name: string;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Time at which the database was created
|
|
94
|
-
*/
|
|
95
|
-
created_at: string;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Time at which the database was last updated
|
|
99
|
-
*/
|
|
100
|
-
updated_at: string;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* A Neon database role
|
|
105
|
-
*/
|
|
106
|
-
export interface NeonRole {
|
|
107
|
-
/**
|
|
108
|
-
* ID of the branch this role belongs to
|
|
109
|
-
*/
|
|
110
|
-
branch_id: string;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Role name
|
|
61
|
+
* Settings for the project
|
|
114
62
|
*/
|
|
115
|
-
|
|
63
|
+
settings?: neon.ProjectSettingsData;
|
|
116
64
|
|
|
117
65
|
/**
|
|
118
|
-
*
|
|
66
|
+
* Default endpoint settings for the project
|
|
119
67
|
*/
|
|
120
|
-
|
|
68
|
+
default_endpoint_settings?: neon.DefaultEndpointSettings;
|
|
121
69
|
|
|
122
70
|
/**
|
|
123
|
-
*
|
|
71
|
+
* History retention seconds for the project
|
|
72
|
+
* @default 86400
|
|
124
73
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Time at which the role was created
|
|
129
|
-
*/
|
|
130
|
-
created_at: string;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Time at which the role was last updated
|
|
134
|
-
*/
|
|
135
|
-
updated_at: string;
|
|
74
|
+
history_retention_seconds?: number;
|
|
136
75
|
}
|
|
137
76
|
|
|
138
77
|
/**
|
|
139
|
-
*
|
|
78
|
+
* Output returned after Neon project creation/update
|
|
79
|
+
* IMPORTANT: The interface name MUST match the exported resource name
|
|
140
80
|
*/
|
|
141
|
-
export interface
|
|
81
|
+
export interface NeonProject {
|
|
142
82
|
/**
|
|
143
|
-
*
|
|
83
|
+
* The ID of the project
|
|
144
84
|
*/
|
|
145
85
|
id: string;
|
|
146
86
|
|
|
147
87
|
/**
|
|
148
|
-
*
|
|
149
|
-
*/
|
|
150
|
-
project_id: string;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Branch name
|
|
88
|
+
* Name of the Project.
|
|
154
89
|
*/
|
|
155
90
|
name: string;
|
|
156
91
|
|
|
157
92
|
/**
|
|
158
|
-
*
|
|
159
|
-
*/
|
|
160
|
-
current_state: string;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Pending state of the branch
|
|
164
|
-
*/
|
|
165
|
-
pending_state: string;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Time at which the branch was created
|
|
169
|
-
*/
|
|
170
|
-
created_at: string;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Time at which the branch was last updated
|
|
174
|
-
*/
|
|
175
|
-
updated_at: string;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* A Neon compute endpoint
|
|
180
|
-
*/
|
|
181
|
-
export interface NeonEndpoint {
|
|
182
|
-
/**
|
|
183
|
-
* Endpoint ID
|
|
184
|
-
*/
|
|
185
|
-
id: string;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Host for connecting to this endpoint
|
|
189
|
-
*/
|
|
190
|
-
host: string;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* ID of the project this endpoint belongs to
|
|
194
|
-
*/
|
|
195
|
-
project_id: string;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* ID of the branch this endpoint belongs to
|
|
199
|
-
*/
|
|
200
|
-
branch_id: string;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Endpoint type (read_write, read_only)
|
|
204
|
-
*/
|
|
205
|
-
type: string;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Current state of the endpoint
|
|
209
|
-
*/
|
|
210
|
-
current_state: string;
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Pending state of the endpoint
|
|
214
|
-
*/
|
|
215
|
-
pending_state: string;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Region ID where this endpoint is provisioned
|
|
219
|
-
*/
|
|
220
|
-
region_id: string;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Minimum compute units for autoscaling
|
|
224
|
-
*/
|
|
225
|
-
autoscaling_limit_min_cu: number;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Maximum compute units for autoscaling
|
|
229
|
-
*/
|
|
230
|
-
autoscaling_limit_max_cu: number;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Whether connection pooler is enabled
|
|
234
|
-
*/
|
|
235
|
-
pooler_enabled: boolean;
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Connection pooler mode
|
|
239
|
-
*/
|
|
240
|
-
pooler_mode: string;
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Whether this endpoint is disabled
|
|
244
|
-
*/
|
|
245
|
-
disabled: boolean;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Whether passwordless access is enabled
|
|
249
|
-
*/
|
|
250
|
-
passwordless_access: boolean;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Time at which the endpoint was created
|
|
93
|
+
* Time at which the project was created
|
|
254
94
|
*/
|
|
255
95
|
created_at: string;
|
|
256
96
|
|
|
257
97
|
/**
|
|
258
|
-
* Time at which the
|
|
98
|
+
* Time at which the project was last updated
|
|
259
99
|
*/
|
|
260
100
|
updated_at: string;
|
|
261
101
|
|
|
262
102
|
/**
|
|
263
|
-
*
|
|
103
|
+
* Hostname for proxy access
|
|
264
104
|
*/
|
|
265
105
|
proxy_host: string;
|
|
266
106
|
|
|
267
107
|
/**
|
|
268
|
-
*
|
|
269
|
-
*/
|
|
270
|
-
settings: {
|
|
271
|
-
/**
|
|
272
|
-
* PostgreSQL settings
|
|
273
|
-
*/
|
|
274
|
-
pg_settings: Record<string, any>;
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* A Neon connection URI
|
|
280
|
-
*/
|
|
281
|
-
export interface NeonConnectionUri {
|
|
282
|
-
/**
|
|
283
|
-
* Connection URI string
|
|
284
|
-
*/
|
|
285
|
-
connection_uri: Secret;
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Connection parameters
|
|
108
|
+
* Region where the project is provisioned
|
|
289
109
|
*/
|
|
290
|
-
|
|
291
|
-
database: string;
|
|
292
|
-
host: string;
|
|
293
|
-
port: number;
|
|
294
|
-
user: string;
|
|
295
|
-
password: Secret;
|
|
296
|
-
};
|
|
297
|
-
}
|
|
110
|
+
region_id: NeonRegion;
|
|
298
111
|
|
|
299
|
-
/**
|
|
300
|
-
* A Neon operation
|
|
301
|
-
*/
|
|
302
|
-
export interface NeonOperation {
|
|
303
112
|
/**
|
|
304
|
-
*
|
|
113
|
+
* Settings for the project
|
|
305
114
|
*/
|
|
306
|
-
|
|
115
|
+
settings: neon.ProjectSettingsData | undefined;
|
|
307
116
|
|
|
308
117
|
/**
|
|
309
|
-
*
|
|
118
|
+
* Default endpoint settings for the project
|
|
310
119
|
*/
|
|
311
|
-
|
|
120
|
+
default_endpoint_settings: neon.DefaultEndpointSettings | undefined;
|
|
312
121
|
|
|
313
122
|
/**
|
|
314
|
-
*
|
|
123
|
+
* History retention seconds for the project
|
|
315
124
|
*/
|
|
316
|
-
|
|
125
|
+
history_retention_seconds: number;
|
|
317
126
|
|
|
318
127
|
/**
|
|
319
|
-
*
|
|
128
|
+
* PostgreSQL version used by the project
|
|
320
129
|
*/
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Action being performed
|
|
325
|
-
*/
|
|
326
|
-
action: string;
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Current status of the operation
|
|
330
|
-
*/
|
|
331
|
-
status: string;
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Number of failures encountered
|
|
335
|
-
*/
|
|
336
|
-
failures_count: number;
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Time at which the operation was created
|
|
340
|
-
*/
|
|
341
|
-
created_at: string;
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Time at which the operation was last updated
|
|
345
|
-
*/
|
|
346
|
-
updated_at: string;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* API response structure for Neon projects
|
|
351
|
-
*/
|
|
352
|
-
interface NeonApiResponse {
|
|
353
|
-
project: {
|
|
354
|
-
id: string;
|
|
355
|
-
name: string;
|
|
356
|
-
region_id: string;
|
|
357
|
-
pg_version: number;
|
|
358
|
-
created_at: string;
|
|
359
|
-
updated_at: string;
|
|
360
|
-
proxy_host?: string;
|
|
361
|
-
[key: string]: any;
|
|
362
|
-
};
|
|
363
|
-
connection_uris?: Array<{
|
|
364
|
-
connection_uri: string;
|
|
365
|
-
connection_parameters: {
|
|
366
|
-
database: string;
|
|
367
|
-
host: string;
|
|
368
|
-
port: number;
|
|
369
|
-
user: string;
|
|
370
|
-
password: string;
|
|
371
|
-
};
|
|
372
|
-
}>;
|
|
373
|
-
roles?: Array<{
|
|
374
|
-
branch_id: string;
|
|
375
|
-
name: string;
|
|
376
|
-
password?: string;
|
|
377
|
-
protected: boolean;
|
|
378
|
-
created_at: string;
|
|
379
|
-
updated_at: string;
|
|
380
|
-
}>;
|
|
381
|
-
databases?: Array<{
|
|
382
|
-
id: number;
|
|
383
|
-
branch_id: string;
|
|
384
|
-
name: string;
|
|
385
|
-
owner_name: string;
|
|
386
|
-
created_at: string;
|
|
387
|
-
updated_at: string;
|
|
388
|
-
}>;
|
|
389
|
-
operations?: Array<{
|
|
390
|
-
id: string;
|
|
391
|
-
project_id: string;
|
|
392
|
-
branch_id?: string;
|
|
393
|
-
endpoint_id?: string;
|
|
394
|
-
action: string;
|
|
395
|
-
status: string;
|
|
396
|
-
failures_count: number;
|
|
397
|
-
created_at: string;
|
|
398
|
-
updated_at: string;
|
|
399
|
-
}>;
|
|
400
|
-
branch?: {
|
|
401
|
-
id: string;
|
|
402
|
-
project_id: string;
|
|
403
|
-
name: string;
|
|
404
|
-
current_state: string;
|
|
405
|
-
pending_state: string;
|
|
406
|
-
created_at: string;
|
|
407
|
-
updated_at: string;
|
|
408
|
-
};
|
|
409
|
-
endpoints?: Array<{
|
|
410
|
-
id: string;
|
|
411
|
-
host: string;
|
|
412
|
-
project_id: string;
|
|
413
|
-
branch_id: string;
|
|
414
|
-
type: string;
|
|
415
|
-
current_state: string;
|
|
416
|
-
pending_state: string;
|
|
417
|
-
region_id: string;
|
|
418
|
-
autoscaling_limit_min_cu: number;
|
|
419
|
-
autoscaling_limit_max_cu: number;
|
|
420
|
-
pooler_enabled: boolean;
|
|
421
|
-
pooler_mode: string;
|
|
422
|
-
disabled: boolean;
|
|
423
|
-
passwordless_access: boolean;
|
|
424
|
-
created_at: string;
|
|
425
|
-
updated_at: string;
|
|
426
|
-
proxy_host: string;
|
|
427
|
-
settings: {
|
|
428
|
-
pg_settings: Record<string, any>;
|
|
429
|
-
};
|
|
430
|
-
}>;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Output returned after Neon project creation/update
|
|
435
|
-
* IMPORTANT: The interface name MUST match the exported resource name
|
|
436
|
-
*/
|
|
437
|
-
export interface NeonProject
|
|
438
|
-
extends Resource<"neon::Project">,
|
|
439
|
-
Omit<NeonProjectProps, "apiKey" | "existing_project_id"> {
|
|
440
|
-
/**
|
|
441
|
-
* The ID of the project
|
|
442
|
-
*/
|
|
443
|
-
id: string;
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Name of the Project.
|
|
447
|
-
*/
|
|
448
|
-
name: string;
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* Time at which the project was created
|
|
452
|
-
*/
|
|
453
|
-
created_at: string;
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* Time at which the project was last updated
|
|
457
|
-
*/
|
|
458
|
-
updated_at: string;
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Hostname for proxy access
|
|
462
|
-
*/
|
|
463
|
-
proxy_host?: string;
|
|
130
|
+
pg_version: NeonPgVersion;
|
|
464
131
|
|
|
465
132
|
/**
|
|
466
133
|
* Connection URIs for the databases
|
|
@@ -475,17 +142,17 @@ export interface NeonProject
|
|
|
475
142
|
/**
|
|
476
143
|
* Databases created with the project
|
|
477
144
|
*/
|
|
478
|
-
databases
|
|
145
|
+
databases: [neon.Database, ...neon.Database[]];
|
|
479
146
|
|
|
480
147
|
/**
|
|
481
148
|
* Default branch information
|
|
482
149
|
*/
|
|
483
|
-
branch
|
|
150
|
+
branch: neon.Branch;
|
|
484
151
|
|
|
485
152
|
/**
|
|
486
153
|
* Compute endpoints for the project
|
|
487
154
|
*/
|
|
488
|
-
endpoints: [
|
|
155
|
+
endpoints: [neon.Endpoint, ...neon.Endpoint[]];
|
|
489
156
|
}
|
|
490
157
|
|
|
491
158
|
/**
|
|
@@ -519,367 +186,115 @@ export const NeonProject = Resource(
|
|
|
519
186
|
this: Context<NeonProject>,
|
|
520
187
|
id: string,
|
|
521
188
|
props: NeonProjectProps,
|
|
522
|
-
)
|
|
189
|
+
) {
|
|
523
190
|
const api = createNeonApi(props);
|
|
524
|
-
const
|
|
525
|
-
const projectName =
|
|
191
|
+
const name =
|
|
526
192
|
props.name ?? this.output?.name ?? this.scope.createPhysicalName(id);
|
|
527
193
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
194
|
+
switch (this.phase) {
|
|
195
|
+
case "create": {
|
|
196
|
+
const { data } = await api.createProject({
|
|
197
|
+
body: {
|
|
198
|
+
project: {
|
|
199
|
+
name,
|
|
200
|
+
region_id: props.region_id,
|
|
201
|
+
pg_version: props.pg_version,
|
|
202
|
+
default_endpoint_settings: props.default_endpoint_settings,
|
|
203
|
+
branch: {
|
|
204
|
+
name: props.default_branch_name,
|
|
205
|
+
},
|
|
206
|
+
settings: props.settings,
|
|
207
|
+
history_retention_seconds: props.history_retention_seconds,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
});
|
|
531
211
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
212
|
+
// Branch and endpoints have fields that are updated after operations are complete.
|
|
213
|
+
await waitForOperations(api, data.operations);
|
|
214
|
+
const [branch, endpoints] = await Promise.all([
|
|
215
|
+
api
|
|
216
|
+
.getProjectBranch({
|
|
217
|
+
path: {
|
|
218
|
+
project_id: data.project.id,
|
|
219
|
+
branch_id: data.branch.id,
|
|
220
|
+
},
|
|
221
|
+
})
|
|
222
|
+
.then((res) => res.data.branch),
|
|
223
|
+
api
|
|
224
|
+
.listProjectEndpoints({
|
|
225
|
+
path: {
|
|
226
|
+
project_id: data.project.id,
|
|
227
|
+
},
|
|
228
|
+
})
|
|
229
|
+
.then((res) => res.data.endpoints),
|
|
230
|
+
]);
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
id: data.project.id,
|
|
234
|
+
name: data.project.name,
|
|
235
|
+
created_at: data.project.created_at,
|
|
236
|
+
updated_at: data.project.updated_at,
|
|
237
|
+
proxy_host: data.project.proxy_host,
|
|
238
|
+
region_id: data.project.region_id as NeonRegion,
|
|
239
|
+
pg_version: data.project.pg_version as NeonPgVersion,
|
|
240
|
+
settings: data.project.settings,
|
|
241
|
+
default_endpoint_settings: data.project.default_endpoint_settings,
|
|
242
|
+
history_retention_seconds: data.project.history_retention_seconds,
|
|
243
|
+
connection_uris: data.connection_uris.map(formatConnectionUri) as [
|
|
244
|
+
NeonConnectionUri,
|
|
245
|
+
...NeonConnectionUri[],
|
|
246
|
+
],
|
|
247
|
+
roles: data.roles.map(formatRole) as [NeonRole, ...NeonRole[]],
|
|
248
|
+
databases: data.databases as [neon.Database, ...neon.Database[]],
|
|
249
|
+
branch,
|
|
250
|
+
endpoints: endpoints as [neon.Endpoint, ...neon.Endpoint[]],
|
|
251
|
+
};
|
|
544
252
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
253
|
+
case "update": {
|
|
254
|
+
const { data } = await api.updateProject({
|
|
255
|
+
path: {
|
|
256
|
+
project_id: this.output.id,
|
|
257
|
+
},
|
|
258
|
+
body: {
|
|
259
|
+
project: {
|
|
260
|
+
name,
|
|
261
|
+
settings: props.settings,
|
|
262
|
+
default_endpoint_settings: props.default_endpoint_settings,
|
|
263
|
+
history_retention_seconds: props.history_retention_seconds,
|
|
264
|
+
},
|
|
557
265
|
},
|
|
558
266
|
});
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
267
|
+
return {
|
|
268
|
+
...this.output,
|
|
269
|
+
name: data.project.name,
|
|
270
|
+
updated_at: data.project.updated_at,
|
|
271
|
+
proxy_host: data.project.proxy_host,
|
|
272
|
+
region_id: data.project.region_id as NeonRegion,
|
|
273
|
+
pg_version: data.project.pg_version as NeonPgVersion,
|
|
274
|
+
settings: data.project.settings,
|
|
275
|
+
default_endpoint_settings: data.project.default_endpoint_settings,
|
|
276
|
+
history_retention_seconds: data.project.history_retention_seconds,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
case "delete": {
|
|
280
|
+
if (this.output?.id) {
|
|
281
|
+
const response = await api.deleteProject({
|
|
282
|
+
path: {
|
|
283
|
+
project_id: this.output.id,
|
|
284
|
+
},
|
|
285
|
+
throwOnError: false,
|
|
286
|
+
});
|
|
287
|
+
if (response.error && response.response.status !== 404) {
|
|
288
|
+
throw new Error(
|
|
289
|
+
`Failed to delete project: ${response.error.message}`,
|
|
290
|
+
{
|
|
291
|
+
cause: response.error,
|
|
581
292
|
},
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
if (!projectResponse.ok) {
|
|
585
|
-
await handleApiError(projectResponse, "update", "project", id);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
const initialData = await projectResponse.json();
|
|
589
|
-
// Reify project properties to get complete data
|
|
590
|
-
response = await getProject(
|
|
591
|
-
api,
|
|
592
|
-
projectId,
|
|
593
|
-
initialData as Partial<NeonApiResponse>,
|
|
594
293
|
);
|
|
595
|
-
} else if (getResponse.status !== 404) {
|
|
596
|
-
// Unexpected error during GET check
|
|
597
|
-
await handleApiError(getResponse, "get", "project", id);
|
|
598
|
-
throw new Error("Failed to check if project exists");
|
|
599
|
-
} else {
|
|
600
|
-
// Project doesn't exist, create new
|
|
601
|
-
response = await createNewProject(api, projectName, props);
|
|
602
294
|
}
|
|
603
|
-
} else {
|
|
604
|
-
// No output ID, create new project
|
|
605
|
-
response = await createNewProject(api, projectName, props);
|
|
606
295
|
}
|
|
296
|
+
return this.destroy();
|
|
607
297
|
}
|
|
608
|
-
|
|
609
|
-
// Wait for any pending operations to complete
|
|
610
|
-
if (response.operations && response.operations.length > 0) {
|
|
611
|
-
await waitForOperations(api, response.operations);
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
// Get the latest project state after operations complete
|
|
615
|
-
if (response.project?.id) {
|
|
616
|
-
// Reify project properties to get complete data
|
|
617
|
-
response = await getProject(api, response.project.id, response);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
return this({
|
|
621
|
-
id: response.project.id,
|
|
622
|
-
name: response.project.name,
|
|
623
|
-
region_id: response.project.region_id as NeonRegion,
|
|
624
|
-
pg_version: response.project.pg_version as 14 | 15 | 16 | 17,
|
|
625
|
-
created_at: response.project.created_at,
|
|
626
|
-
updated_at: response.project.updated_at,
|
|
627
|
-
proxy_host: response.project.proxy_host,
|
|
628
|
-
// Pass through the provided props except apiKey (which is sensitive)
|
|
629
|
-
default_endpoint: props.default_endpoint,
|
|
630
|
-
default_branch_name: props.default_branch_name,
|
|
631
|
-
baseUrl: props.baseUrl,
|
|
632
|
-
// Add all available data
|
|
633
|
-
// @ts-expect-error - api ensures they're non-empty
|
|
634
|
-
connection_uris: response.connection_uris,
|
|
635
|
-
// @ts-expect-error
|
|
636
|
-
roles: response.roles,
|
|
637
|
-
// @ts-expect-error
|
|
638
|
-
databases: response.databases,
|
|
639
|
-
branch: response.branch,
|
|
640
|
-
// @ts-expect-error
|
|
641
|
-
endpoints: response.endpoints,
|
|
642
|
-
});
|
|
643
|
-
} catch (error) {
|
|
644
|
-
logger.error(`Error ${this.phase} Neon project '${id}':`, error);
|
|
645
|
-
throw error;
|
|
646
298
|
}
|
|
647
299
|
},
|
|
648
300
|
);
|
|
649
|
-
|
|
650
|
-
/**
|
|
651
|
-
* Helper function to create a new Neon project
|
|
652
|
-
*/
|
|
653
|
-
async function createNewProject(
|
|
654
|
-
api: any,
|
|
655
|
-
projectName: string,
|
|
656
|
-
props: NeonProjectProps,
|
|
657
|
-
): Promise<NeonApiResponse> {
|
|
658
|
-
const defaultEndpoint = props.default_endpoint ?? true;
|
|
659
|
-
const projectResponse = await api.post("/projects", {
|
|
660
|
-
project: {
|
|
661
|
-
name: projectName,
|
|
662
|
-
region_id: props.region_id || "aws-us-east-1",
|
|
663
|
-
pg_version: props.pg_version || 16,
|
|
664
|
-
default_endpoint: defaultEndpoint,
|
|
665
|
-
branch: defaultEndpoint
|
|
666
|
-
? { name: props.default_branch_name || "main" }
|
|
667
|
-
: undefined,
|
|
668
|
-
},
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
if (!projectResponse.ok) {
|
|
672
|
-
await handleApiError(projectResponse, "create", "project");
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
return (await projectResponse.json()) as NeonApiResponse;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* Helper function to get complete project details by fetching all related data
|
|
680
|
-
*
|
|
681
|
-
* @param api The Neon API client
|
|
682
|
-
* @param projectId The project ID
|
|
683
|
-
* @param initialData Initial project data (optional)
|
|
684
|
-
* @returns Complete project data with all related resources
|
|
685
|
-
*/
|
|
686
|
-
async function getProject(
|
|
687
|
-
api: any,
|
|
688
|
-
projectId: string,
|
|
689
|
-
initialData: Partial<NeonApiResponse> = {},
|
|
690
|
-
): Promise<NeonApiResponse> {
|
|
691
|
-
// Get the latest project details
|
|
692
|
-
const updatedData = await getProjectDetails(api, projectId);
|
|
693
|
-
|
|
694
|
-
// Start with a copy of the initial data
|
|
695
|
-
const responseData = { ...initialData };
|
|
696
|
-
|
|
697
|
-
// Check if we have a branch ID from the initial data
|
|
698
|
-
const branchId = initialData.branch?.id;
|
|
699
|
-
|
|
700
|
-
if (branchId) {
|
|
701
|
-
// Get the branch details
|
|
702
|
-
const branchData = await getBranchDetails(api, projectId, branchId);
|
|
703
|
-
|
|
704
|
-
// Update with the latest branch data
|
|
705
|
-
responseData.branch = branchData.branch;
|
|
706
|
-
|
|
707
|
-
// Also fetch the latest endpoint details for this branch
|
|
708
|
-
const endpointData = await getEndpointDetails(api, projectId, branchId);
|
|
709
|
-
|
|
710
|
-
// Update with the latest endpoint data if available
|
|
711
|
-
if (endpointData.endpoints && endpointData.endpoints.length > 0) {
|
|
712
|
-
responseData.endpoints = endpointData.endpoints;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
// Preserve all data from the original response
|
|
717
|
-
// Only update properties that might have changed during operations
|
|
718
|
-
return {
|
|
719
|
-
...responseData,
|
|
720
|
-
connection_uris: (
|
|
721
|
-
updatedData.connection_uris || responseData.connection_uris
|
|
722
|
-
)?.map((uri) => ({
|
|
723
|
-
connection_uri: alchemy.secret(uri.connection_uri),
|
|
724
|
-
connection_parameters: {
|
|
725
|
-
database: uri.connection_parameters.database,
|
|
726
|
-
host: uri.connection_parameters.host,
|
|
727
|
-
port: uri.connection_parameters.port ?? 5432,
|
|
728
|
-
user: uri.connection_parameters.user ?? "neondb_owner",
|
|
729
|
-
password: alchemy.secret(uri.connection_parameters.password),
|
|
730
|
-
},
|
|
731
|
-
})),
|
|
732
|
-
project: updatedData.project,
|
|
733
|
-
branch: updatedData.branch || responseData.branch,
|
|
734
|
-
endpoints: updatedData.endpoints || responseData.endpoints,
|
|
735
|
-
} as NeonApiResponse;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Wait for operations to complete
|
|
740
|
-
*
|
|
741
|
-
* @param api The Neon API client
|
|
742
|
-
* @param operations Operations to wait for
|
|
743
|
-
* @throws Error if an operation fails or times out
|
|
744
|
-
* @returns Promise that resolves when all operations complete
|
|
745
|
-
*/
|
|
746
|
-
async function waitForOperations(
|
|
747
|
-
api: any,
|
|
748
|
-
operations: Array<{
|
|
749
|
-
id: string;
|
|
750
|
-
project_id: string;
|
|
751
|
-
status: string;
|
|
752
|
-
action: string;
|
|
753
|
-
}>,
|
|
754
|
-
): Promise<void> {
|
|
755
|
-
const pendingOperations = operations.filter(
|
|
756
|
-
(op) => op.status !== "finished" && op.status !== "failed",
|
|
757
|
-
);
|
|
758
|
-
|
|
759
|
-
if (pendingOperations.length === 0) {
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
// Maximum wait time in milliseconds (5 minutes)
|
|
764
|
-
const maxWaitTime = 5 * 60 * 1000;
|
|
765
|
-
// Initial delay between retries in milliseconds
|
|
766
|
-
const initialRetryDelay = 500;
|
|
767
|
-
// Maximum delay between retries
|
|
768
|
-
const maxRetryDelay = 10000;
|
|
769
|
-
// Backoff factor for exponential backoff
|
|
770
|
-
const backoffFactor = 1.5;
|
|
771
|
-
|
|
772
|
-
for (const operation of pendingOperations) {
|
|
773
|
-
let totalWaitTime = 0;
|
|
774
|
-
let retryDelay = initialRetryDelay;
|
|
775
|
-
let operationStatus = operation.status;
|
|
776
|
-
|
|
777
|
-
while (
|
|
778
|
-
operationStatus !== "finished" &&
|
|
779
|
-
operationStatus !== "failed" &&
|
|
780
|
-
totalWaitTime < maxWaitTime
|
|
781
|
-
) {
|
|
782
|
-
// Wait before checking again with exponential backoff
|
|
783
|
-
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
784
|
-
totalWaitTime += retryDelay;
|
|
785
|
-
|
|
786
|
-
// Increase delay for next retry with exponential backoff, up to max
|
|
787
|
-
retryDelay = Math.min(retryDelay * backoffFactor, maxRetryDelay);
|
|
788
|
-
|
|
789
|
-
// Check operation status
|
|
790
|
-
const operationResponse = await api.get(
|
|
791
|
-
`/projects/${operation.project_id}/operations/${operation.id}`,
|
|
792
|
-
);
|
|
793
|
-
|
|
794
|
-
if (operationResponse.ok) {
|
|
795
|
-
const operationData = await operationResponse.json();
|
|
796
|
-
operationStatus = operationData.operation?.status;
|
|
797
|
-
} else {
|
|
798
|
-
throw new Error(
|
|
799
|
-
`Failed to check operation ${operation.id} status: HTTP ${operationResponse.status}`,
|
|
800
|
-
);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
if (operationStatus === "failed") {
|
|
805
|
-
throw new Error(`Operation ${operation.id} (${operation.action}) failed`);
|
|
806
|
-
}
|
|
807
|
-
if (totalWaitTime >= maxWaitTime) {
|
|
808
|
-
throw new Error(
|
|
809
|
-
`Timeout waiting for operation ${operation.id} (${operation.action}) to complete`,
|
|
810
|
-
);
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
// Explicitly return when all operations are complete
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* Get the latest project details
|
|
820
|
-
*
|
|
821
|
-
* @param api The Neon API client
|
|
822
|
-
* @param projectId The project ID
|
|
823
|
-
* @returns Project details including branch and endpoints
|
|
824
|
-
* @throws Error if project details cannot be retrieved
|
|
825
|
-
*/
|
|
826
|
-
async function getProjectDetails(
|
|
827
|
-
api: any,
|
|
828
|
-
projectId: string,
|
|
829
|
-
): Promise<NeonApiResponse> {
|
|
830
|
-
const response = await api.get(`/projects/${projectId}`);
|
|
831
|
-
|
|
832
|
-
if (!response.ok) {
|
|
833
|
-
throw new Error(`Failed to get project details: HTTP ${response.status}`);
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
return (await response.json()) as NeonApiResponse;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Get the latest branch details
|
|
841
|
-
*
|
|
842
|
-
* @param api The Neon API client
|
|
843
|
-
* @param projectId The project ID
|
|
844
|
-
* @param branchId The branch ID
|
|
845
|
-
* @returns Branch details
|
|
846
|
-
* @throws Error if branch details cannot be retrieved
|
|
847
|
-
*/
|
|
848
|
-
async function getBranchDetails(
|
|
849
|
-
api: any,
|
|
850
|
-
projectId: string,
|
|
851
|
-
branchId: string,
|
|
852
|
-
): Promise<{ branch: NeonBranch }> {
|
|
853
|
-
const response = await api.get(`/projects/${projectId}/branches/${branchId}`);
|
|
854
|
-
|
|
855
|
-
if (!response.ok) {
|
|
856
|
-
throw new Error(`Failed to get branch details: HTTP ${response.status}`);
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
return (await response.json()) as { branch: NeonBranch };
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
/**
|
|
863
|
-
* Get the latest endpoint details for a branch
|
|
864
|
-
*
|
|
865
|
-
* @param api The Neon API client
|
|
866
|
-
* @param projectId The project ID
|
|
867
|
-
* @param branchId The branch ID
|
|
868
|
-
* @returns Endpoint details for the branch
|
|
869
|
-
* @throws Error if endpoint details cannot be retrieved
|
|
870
|
-
*/
|
|
871
|
-
async function getEndpointDetails(
|
|
872
|
-
api: any,
|
|
873
|
-
projectId: string,
|
|
874
|
-
branchId: string,
|
|
875
|
-
): Promise<{ endpoints: NeonEndpoint[] }> {
|
|
876
|
-
const response = await api.get(
|
|
877
|
-
`/projects/${projectId}/branches/${branchId}/endpoints`,
|
|
878
|
-
);
|
|
879
|
-
|
|
880
|
-
if (!response.ok) {
|
|
881
|
-
throw new Error(`Failed to get endpoint details: HTTP ${response.status}`);
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
return (await response.json()) as { endpoints: NeonEndpoint[] };
|
|
885
|
-
}
|