alchemy 2.0.0-beta.10 → 2.0.0-beta.13
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 +1122 -450
- package/bin/alchemy.js.map +1 -1
- package/bin/alchemy.sh +15 -0
- package/bin/alchemy.ts +22 -727
- package/bin/commands/_shared.ts +237 -0
- package/bin/commands/bootstrap.ts +117 -0
- package/bin/commands/deploy.ts +144 -0
- package/bin/commands/login.ts +93 -0
- package/bin/commands/logs.ts +157 -0
- package/bin/commands/tail.ts +138 -0
- package/lib/AWS/AuthProvider.d.ts +7 -71
- package/lib/AWS/AuthProvider.d.ts.map +1 -1
- package/lib/AWS/AuthProvider.js +27 -22
- package/lib/AWS/AuthProvider.js.map +1 -1
- package/lib/AWS/AutoScaling/LaunchTemplate.d.ts +3 -3
- package/lib/AWS/AutoScaling/LaunchTemplate.d.ts.map +1 -1
- package/lib/AWS/AutoScaling/LaunchTemplate.js +2 -2
- package/lib/AWS/AutoScaling/LaunchTemplate.js.map +1 -1
- package/lib/AWS/Bootstrap.d.ts +2 -1
- package/lib/AWS/Bootstrap.d.ts.map +1 -1
- package/lib/AWS/Bootstrap.js +27 -29
- package/lib/AWS/Bootstrap.js.map +1 -1
- package/lib/AWS/CloudWatch/Alarm.d.ts +2 -2
- package/lib/AWS/CloudWatch/Alarm.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/Alarm.js +2 -2
- package/lib/AWS/CloudWatch/Alarm.js.map +1 -1
- package/lib/AWS/CloudWatch/AlarmMuteRule.d.ts +2 -2
- package/lib/AWS/CloudWatch/AlarmMuteRule.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/AlarmMuteRule.js +2 -2
- package/lib/AWS/CloudWatch/AlarmMuteRule.js.map +1 -1
- package/lib/AWS/CloudWatch/CompositeAlarm.d.ts +2 -2
- package/lib/AWS/CloudWatch/CompositeAlarm.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/CompositeAlarm.js +2 -2
- package/lib/AWS/CloudWatch/CompositeAlarm.js.map +1 -1
- package/lib/AWS/CloudWatch/Dashboard.d.ts +2 -2
- package/lib/AWS/CloudWatch/Dashboard.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/Dashboard.js +2 -2
- package/lib/AWS/CloudWatch/Dashboard.js.map +1 -1
- package/lib/AWS/CloudWatch/InsightRule.d.ts +2 -2
- package/lib/AWS/CloudWatch/InsightRule.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/InsightRule.js +2 -2
- package/lib/AWS/CloudWatch/InsightRule.js.map +1 -1
- package/lib/AWS/CloudWatch/MetricStream.d.ts +2 -2
- package/lib/AWS/CloudWatch/MetricStream.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/MetricStream.js +2 -2
- package/lib/AWS/CloudWatch/MetricStream.js.map +1 -1
- package/lib/AWS/Credentials.d.ts +5 -10
- package/lib/AWS/Credentials.d.ts.map +1 -1
- package/lib/AWS/Credentials.js +6 -30
- package/lib/AWS/Credentials.js.map +1 -1
- package/lib/AWS/DynamoDB/Table.d.ts +1 -1
- package/lib/AWS/DynamoDB/Table.d.ts.map +1 -1
- package/lib/AWS/EC2/EIP.d.ts +3 -3
- package/lib/AWS/EC2/EIP.d.ts.map +1 -1
- package/lib/AWS/EC2/EIP.js +2 -2
- package/lib/AWS/EC2/EIP.js.map +1 -1
- package/lib/AWS/EC2/EgressOnlyInternetGateway.d.ts +3 -3
- package/lib/AWS/EC2/EgressOnlyInternetGateway.d.ts.map +1 -1
- package/lib/AWS/EC2/EgressOnlyInternetGateway.js +2 -2
- package/lib/AWS/EC2/EgressOnlyInternetGateway.js.map +1 -1
- package/lib/AWS/EC2/Instance.d.ts +3 -3
- package/lib/AWS/EC2/Instance.d.ts.map +1 -1
- package/lib/AWS/EC2/Instance.js +2 -2
- package/lib/AWS/EC2/Instance.js.map +1 -1
- package/lib/AWS/EC2/InternetGateway.d.ts +3 -3
- package/lib/AWS/EC2/InternetGateway.d.ts.map +1 -1
- package/lib/AWS/EC2/InternetGateway.js +2 -2
- package/lib/AWS/EC2/InternetGateway.js.map +1 -1
- package/lib/AWS/EC2/NatGateway.d.ts +3 -3
- package/lib/AWS/EC2/NatGateway.d.ts.map +1 -1
- package/lib/AWS/EC2/NatGateway.js +2 -2
- package/lib/AWS/EC2/NatGateway.js.map +1 -1
- package/lib/AWS/EC2/Network.d.ts +1 -1
- package/lib/AWS/EC2/NetworkAcl.d.ts +3 -3
- package/lib/AWS/EC2/NetworkAcl.d.ts.map +1 -1
- package/lib/AWS/EC2/NetworkAcl.js +2 -2
- package/lib/AWS/EC2/NetworkAcl.js.map +1 -1
- package/lib/AWS/EC2/RouteTable.d.ts +3 -3
- package/lib/AWS/EC2/RouteTable.d.ts.map +1 -1
- package/lib/AWS/EC2/RouteTable.js +2 -2
- package/lib/AWS/EC2/RouteTable.js.map +1 -1
- package/lib/AWS/EC2/SecurityGroup.d.ts +3 -3
- package/lib/AWS/EC2/SecurityGroup.d.ts.map +1 -1
- package/lib/AWS/EC2/SecurityGroup.js +2 -2
- package/lib/AWS/EC2/SecurityGroup.js.map +1 -1
- package/lib/AWS/EC2/Subnet.d.ts +1 -1
- package/lib/AWS/EC2/Subnet.d.ts.map +1 -1
- package/lib/AWS/EC2/Vpc.d.ts +3 -3
- 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/EC2/VpcEndpoint.d.ts +3 -3
- package/lib/AWS/EC2/VpcEndpoint.d.ts.map +1 -1
- package/lib/AWS/EC2/VpcEndpoint.js +2 -2
- package/lib/AWS/EC2/VpcEndpoint.js.map +1 -1
- package/lib/AWS/ECR/Repository.d.ts +1 -1
- package/lib/AWS/ECR/Repository.d.ts.map +1 -1
- package/lib/AWS/ECR/Repository.js +0 -1
- package/lib/AWS/ECR/Repository.js.map +1 -1
- package/lib/AWS/ECS/Cluster.d.ts +2 -2
- package/lib/AWS/ECS/Cluster.d.ts.map +1 -1
- package/lib/AWS/ECS/Cluster.js +2 -2
- package/lib/AWS/ECS/Cluster.js.map +1 -1
- package/lib/AWS/ECS/Service.d.ts +1 -1
- package/lib/AWS/ECS/Service.d.ts.map +1 -1
- package/lib/AWS/ECS/Task.d.ts +2 -2
- package/lib/AWS/ECS/Task.d.ts.map +1 -1
- package/lib/AWS/ECS/Task.js +2 -2
- package/lib/AWS/ECS/Task.js.map +1 -1
- package/lib/AWS/EKS/Cluster.d.ts +1 -1
- package/lib/AWS/EKS/Cluster.d.ts.map +1 -1
- package/lib/AWS/ELBv2/Listener.d.ts +1 -1
- package/lib/AWS/ELBv2/Listener.d.ts.map +1 -1
- package/lib/AWS/ELBv2/LoadBalancer.d.ts +1 -1
- package/lib/AWS/ELBv2/LoadBalancer.d.ts.map +1 -1
- package/lib/AWS/ELBv2/TargetGroup.d.ts +1 -1
- package/lib/AWS/ELBv2/TargetGroup.d.ts.map +1 -1
- package/lib/AWS/Endpoint.d.ts +7 -2
- package/lib/AWS/Endpoint.d.ts.map +1 -1
- package/lib/AWS/Endpoint.js +7 -2
- package/lib/AWS/Endpoint.js.map +1 -1
- package/lib/AWS/Environment.d.ts +68 -0
- package/lib/AWS/Environment.d.ts.map +1 -0
- package/lib/AWS/Environment.js +53 -0
- package/lib/AWS/Environment.js.map +1 -0
- package/lib/AWS/EventBridge/EventBus.d.ts +2 -2
- package/lib/AWS/EventBridge/EventBus.d.ts.map +1 -1
- package/lib/AWS/EventBridge/EventBus.js +2 -2
- package/lib/AWS/EventBridge/EventBus.js.map +1 -1
- package/lib/AWS/EventBridge/ListRules.d.ts +2 -2
- package/lib/AWS/EventBridge/ListRules.d.ts.map +1 -1
- package/lib/AWS/EventBridge/ListRules.js +2 -2
- package/lib/AWS/EventBridge/ListRules.js.map +1 -1
- package/lib/AWS/EventBridge/PutEvents.d.ts +2 -2
- package/lib/AWS/EventBridge/PutEvents.d.ts.map +1 -1
- package/lib/AWS/EventBridge/PutEvents.js +2 -2
- package/lib/AWS/EventBridge/PutEvents.js.map +1 -1
- package/lib/AWS/EventBridge/Rule.d.ts +2 -2
- package/lib/AWS/EventBridge/Rule.d.ts.map +1 -1
- package/lib/AWS/EventBridge/Rule.js +2 -2
- package/lib/AWS/EventBridge/Rule.js.map +1 -1
- package/lib/AWS/IAM/OpenIDConnectProvider.d.ts +2 -2
- package/lib/AWS/IAM/OpenIDConnectProvider.d.ts.map +1 -1
- package/lib/AWS/IAM/OpenIDConnectProvider.js +2 -2
- package/lib/AWS/IAM/OpenIDConnectProvider.js.map +1 -1
- package/lib/AWS/IAM/Policy.d.ts +3 -3
- package/lib/AWS/IAM/Policy.d.ts.map +1 -1
- package/lib/AWS/IAM/Policy.js +2 -2
- package/lib/AWS/IAM/Policy.js.map +1 -1
- package/lib/AWS/IAM/Role.d.ts +3 -3
- package/lib/AWS/IAM/Role.d.ts.map +1 -1
- package/lib/AWS/IAM/Role.js +3 -3
- package/lib/AWS/IAM/Role.js.map +1 -1
- package/lib/AWS/Kinesis/Stream.d.ts +2 -2
- package/lib/AWS/Kinesis/Stream.d.ts.map +1 -1
- package/lib/AWS/Kinesis/Stream.js +2 -2
- package/lib/AWS/Kinesis/Stream.js.map +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/EventSourceMapping.d.ts +2 -2
- package/lib/AWS/Lambda/EventSourceMapping.d.ts.map +1 -1
- package/lib/AWS/Lambda/EventSourceMapping.js +2 -2
- package/lib/AWS/Lambda/EventSourceMapping.js.map +1 -1
- package/lib/AWS/Lambda/Function.d.ts +2 -2
- package/lib/AWS/Lambda/Function.d.ts.map +1 -1
- package/lib/AWS/Lambda/Function.js +2 -2
- package/lib/AWS/Lambda/Function.js.map +1 -1
- package/lib/AWS/Lambda/Permission.d.ts +1 -1
- package/lib/AWS/Lambda/Permission.js +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts.map +1 -1
- package/lib/AWS/Logs/LogGroup.d.ts +3 -3
- package/lib/AWS/Logs/LogGroup.d.ts.map +1 -1
- package/lib/AWS/Logs/LogGroup.js +2 -2
- package/lib/AWS/Logs/LogGroup.js.map +1 -1
- package/lib/AWS/Providers.d.ts +1 -2
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +3 -3
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/AWS/Region.d.ts +6 -22
- package/lib/AWS/Region.d.ts.map +1 -1
- package/lib/AWS/Region.js +6 -39
- package/lib/AWS/Region.js.map +1 -1
- package/lib/AWS/S3/Bucket.d.ts +2 -2
- package/lib/AWS/S3/Bucket.d.ts.map +1 -1
- package/lib/AWS/S3/Bucket.js +2 -2
- package/lib/AWS/S3/Bucket.js.map +1 -1
- package/lib/AWS/SNS/Topic.d.ts +1 -1
- package/lib/AWS/SNS/Topic.d.ts.map +1 -1
- package/lib/AWS/SQS/Queue.d.ts +3 -3
- package/lib/AWS/SQS/Queue.d.ts.map +1 -1
- package/lib/AWS/SQS/Queue.js +2 -2
- package/lib/AWS/SQS/Queue.js.map +1 -1
- package/lib/AWS/index.d.ts +1 -3
- package/lib/AWS/index.d.ts.map +1 -1
- package/lib/AWS/index.js +1 -3
- package/lib/AWS/index.js.map +1 -1
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +2 -2
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts +51 -7
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +37 -0
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/Profile.d.ts +71 -10
- package/lib/Auth/Profile.d.ts.map +1 -1
- package/lib/Auth/Profile.js +47 -30
- package/lib/Auth/Profile.js.map +1 -1
- package/lib/Auth/index.d.ts +1 -1
- package/lib/Auth/index.d.ts.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.d.ts +14 -31
- package/lib/Cloudflare/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js +59 -38
- package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
- package/lib/Cloudflare/CloudflareEnvironment.d.ts +11 -0
- package/lib/Cloudflare/CloudflareEnvironment.d.ts.map +1 -0
- package/lib/Cloudflare/CloudflareEnvironment.js +26 -0
- package/lib/Cloudflare/CloudflareEnvironment.js.map +1 -0
- package/lib/Cloudflare/Container/ContainerApplication.d.ts +70 -42
- package/lib/Cloudflare/Container/ContainerApplication.d.ts.map +1 -1
- package/lib/Cloudflare/Container/ContainerApplication.js +49 -24
- package/lib/Cloudflare/Container/ContainerApplication.js.map +1 -1
- package/lib/Cloudflare/Credentials.d.ts +11 -0
- package/lib/Cloudflare/Credentials.d.ts.map +1 -0
- package/lib/Cloudflare/Credentials.js +34 -0
- package/lib/Cloudflare/Credentials.js.map +1 -0
- package/lib/Cloudflare/D1/D1Database.d.ts +2 -2
- package/lib/Cloudflare/D1/D1Database.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Database.js +2 -2
- package/lib/Cloudflare/D1/D1Database.js.map +1 -1
- package/lib/Cloudflare/KV/KVNamespace.d.ts +2 -2
- package/lib/Cloudflare/KV/KVNamespace.d.ts.map +1 -1
- package/lib/Cloudflare/KV/KVNamespace.js +2 -2
- package/lib/Cloudflare/KV/KVNamespace.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts +2 -3
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +12 -4
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/Queue/Queue.d.ts +52 -0
- package/lib/Cloudflare/Queue/Queue.d.ts.map +1 -0
- package/lib/Cloudflare/Queue/Queue.js +136 -0
- package/lib/Cloudflare/Queue/Queue.js.map +1 -0
- package/lib/Cloudflare/Queue/QueueBinding.d.ts +35 -0
- package/lib/Cloudflare/Queue/QueueBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Queue/QueueBinding.js +51 -0
- package/lib/Cloudflare/Queue/QueueBinding.js.map +1 -0
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts +86 -0
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts.map +1 -0
- package/lib/Cloudflare/Queue/QueueConsumer.js +138 -0
- package/lib/Cloudflare/Queue/QueueConsumer.js.map +1 -0
- package/lib/Cloudflare/Queue/index.d.ts +4 -0
- package/lib/Cloudflare/Queue/index.d.ts.map +1 -0
- package/lib/Cloudflare/Queue/index.js +4 -0
- package/lib/Cloudflare/Queue/index.js.map +1 -0
- package/lib/Cloudflare/R2/R2Bucket.d.ts +2 -2
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +2 -2
- package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.d.ts +74 -0
- package/lib/Cloudflare/SecretsStore/Secret.d.ts.map +1 -0
- package/lib/Cloudflare/SecretsStore/Secret.js +161 -0
- package/lib/Cloudflare/SecretsStore/Secret.js.map +1 -0
- package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts +42 -0
- package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts.map +1 -0
- package/lib/Cloudflare/SecretsStore/SecretBinding.js +49 -0
- package/lib/Cloudflare/SecretsStore/SecretBinding.js.map +1 -0
- package/lib/Cloudflare/SecretsStore/SecretsStore.d.ts +37 -0
- package/lib/Cloudflare/SecretsStore/SecretsStore.d.ts.map +1 -0
- package/lib/Cloudflare/SecretsStore/SecretsStore.js +88 -0
- package/lib/Cloudflare/SecretsStore/SecretsStore.js.map +1 -0
- package/lib/Cloudflare/SecretsStore/index.d.ts +4 -0
- package/lib/Cloudflare/SecretsStore/index.d.ts.map +1 -0
- package/lib/Cloudflare/SecretsStore/index.js +4 -0
- package/lib/Cloudflare/SecretsStore/index.js.map +1 -0
- package/lib/Cloudflare/Workers/InferEnv.d.ts +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +5 -3
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +61 -7
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.d.ts +10 -4
- package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.js +3 -3
- package/lib/Cloudflare/Workers/Workflow.js.map +1 -1
- package/lib/Cloudflare/index.d.ts +3 -1
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +3 -1
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Stack.d.ts +3 -2
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +10 -7
- package/lib/Stack.js.map +1 -1
- package/lib/State/LocalState.d.ts.map +1 -1
- package/lib/State/LocalState.js +40 -12
- package/lib/State/LocalState.js.map +1 -1
- package/lib/Test/Bun.d.ts.map +1 -1
- package/lib/Test/Bun.js +3 -2
- package/lib/Test/Bun.js.map +1 -1
- package/lib/Test/Vitest.d.ts +3 -1
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +19 -16
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/Util/PlatformServices.d.ts +14 -3
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +21 -3
- package/lib/Util/PlatformServices.js.map +1 -1
- package/package.json +5 -5
- package/src/AWS/AuthProvider.ts +67 -67
- package/src/AWS/AutoScaling/LaunchTemplate.ts +3 -3
- package/src/AWS/Bootstrap.ts +32 -37
- package/src/AWS/CloudWatch/Alarm.ts +2 -2
- package/src/AWS/CloudWatch/AlarmMuteRule.ts +2 -2
- package/src/AWS/CloudWatch/CompositeAlarm.ts +2 -2
- package/src/AWS/CloudWatch/Dashboard.ts +2 -2
- package/src/AWS/CloudWatch/InsightRule.ts +2 -2
- package/src/AWS/CloudWatch/MetricStream.ts +2 -2
- package/src/AWS/Credentials.ts +9 -44
- package/src/AWS/DynamoDB/Table.ts +1 -1
- package/src/AWS/EC2/EIP.ts +3 -3
- package/src/AWS/EC2/EgressOnlyInternetGateway.ts +3 -3
- package/src/AWS/EC2/Instance.ts +3 -3
- package/src/AWS/EC2/InternetGateway.ts +3 -3
- package/src/AWS/EC2/NatGateway.ts +3 -3
- package/src/AWS/EC2/NetworkAcl.ts +3 -3
- package/src/AWS/EC2/RouteTable.ts +3 -3
- package/src/AWS/EC2/SecurityGroup.ts +3 -3
- package/src/AWS/EC2/Subnet.ts +1 -1
- package/src/AWS/EC2/Vpc.ts +3 -3
- package/src/AWS/EC2/VpcEndpoint.ts +3 -3
- package/src/AWS/ECR/Repository.ts +1 -1
- package/src/AWS/ECS/Cluster.ts +2 -2
- package/src/AWS/ECS/Service.ts +1 -1
- package/src/AWS/ECS/Task.ts +2 -2
- package/src/AWS/EKS/Cluster.ts +1 -1
- package/src/AWS/ELBv2/Listener.ts +1 -1
- package/src/AWS/ELBv2/LoadBalancer.ts +1 -1
- package/src/AWS/ELBv2/TargetGroup.ts +1 -1
- package/src/AWS/Endpoint.ts +12 -8
- package/src/AWS/Environment.ts +123 -0
- package/src/AWS/EventBridge/EventBus.ts +2 -2
- package/src/AWS/EventBridge/ListRules.ts +2 -2
- package/src/AWS/EventBridge/PutEvents.ts +2 -2
- package/src/AWS/EventBridge/Rule.ts +2 -2
- package/src/AWS/IAM/OpenIDConnectProvider.ts +2 -2
- package/src/AWS/IAM/Policy.ts +3 -3
- package/src/AWS/IAM/Role.ts +4 -4
- package/src/AWS/Kinesis/Stream.ts +2 -2
- package/src/AWS/Lambda/EventSourceMapping.ts +2 -2
- package/src/AWS/Lambda/Function.ts +2 -2
- package/src/AWS/Lambda/Permission.ts +1 -1
- package/src/AWS/Logs/LogGroup.ts +3 -3
- package/src/AWS/Providers.ts +7 -7
- package/src/AWS/Region.ts +9 -66
- package/src/AWS/S3/Bucket.ts +2 -2
- package/src/AWS/SNS/Topic.ts +1 -1
- package/src/AWS/SQS/Queue.ts +3 -3
- package/src/AWS/index.ts +1 -3
- package/src/Apply.ts +55 -57
- package/src/Auth/AuthProvider.ts +188 -8
- package/src/Auth/Profile.ts +117 -54
- package/src/Auth/index.ts +1 -1
- package/src/Cloudflare/Auth/AuthProvider.ts +127 -98
- package/src/Cloudflare/CloudflareEnvironment.ts +49 -0
- package/src/Cloudflare/Container/ContainerApplication.ts +172 -94
- package/src/Cloudflare/Credentials.ts +75 -0
- package/src/Cloudflare/D1/D1Database.ts +2 -2
- package/src/Cloudflare/KV/KVNamespace.ts +2 -2
- package/src/Cloudflare/Providers.ts +20 -10
- package/src/Cloudflare/Queue/Queue.ts +174 -0
- package/src/Cloudflare/Queue/QueueBinding.ts +110 -0
- package/src/Cloudflare/Queue/QueueConsumer.ts +219 -0
- package/src/Cloudflare/Queue/index.ts +3 -0
- package/src/Cloudflare/R2/R2Bucket.ts +2 -2
- package/src/Cloudflare/SecretsStore/Secret.ts +229 -0
- package/src/Cloudflare/SecretsStore/SecretBinding.ts +107 -0
- package/src/Cloudflare/SecretsStore/SecretsStore.ts +106 -0
- package/src/Cloudflare/SecretsStore/index.ts +3 -0
- package/src/Cloudflare/Workers/InferEnv.ts +5 -3
- package/src/Cloudflare/Workers/Worker.ts +63 -7
- package/src/Cloudflare/Workers/Workflow.ts +19 -9
- package/src/Cloudflare/index.ts +3 -1
- package/src/Stack.ts +40 -29
- package/src/State/LocalState.ts +43 -16
- package/src/Test/Bun.ts +3 -0
- package/src/Test/Vitest.ts +31 -23
- package/src/Util/PlatformServices.ts +54 -13
- package/bin/process-manager.ts +0 -10
- package/lib/AWS/Account.d.ts +0 -26
- package/lib/AWS/Account.d.ts.map +0 -1
- package/lib/AWS/Account.js +0 -32
- package/lib/AWS/Account.js.map +0 -1
- package/lib/AWS/Profile.d.ts +0 -6
- package/lib/AWS/Profile.d.ts.map +0 -1
- package/lib/AWS/Profile.js +0 -4
- package/lib/AWS/Profile.js.map +0 -1
- package/lib/AWS/StageConfig.d.ts +0 -25
- package/lib/AWS/StageConfig.d.ts.map +0 -1
- package/lib/AWS/StageConfig.js +0 -23
- package/lib/AWS/StageConfig.js.map +0 -1
- package/lib/Cloudflare/Account.d.ts +0 -10
- package/lib/Cloudflare/Account.d.ts.map +0 -1
- package/lib/Cloudflare/Account.js +0 -24
- package/lib/Cloudflare/Account.js.map +0 -1
- package/lib/Cloudflare/StageConfig.d.ts +0 -8
- package/lib/Cloudflare/StageConfig.d.ts.map +0 -1
- package/lib/Cloudflare/StageConfig.js +0 -4
- package/lib/Cloudflare/StageConfig.js.map +0 -1
- package/src/AWS/Account.ts +0 -56
- package/src/AWS/Profile.ts +0 -5
- package/src/AWS/StageConfig.ts +0 -44
- package/src/Cloudflare/Account.ts +0 -38
- package/src/Cloudflare/StageConfig.ts +0 -8
|
@@ -31,58 +31,60 @@ import * as Server from "../../Server/index.ts";
|
|
|
31
31
|
import { Stack } from "../../Stack.ts";
|
|
32
32
|
import { sha256Object } from "../../Util/sha256.ts";
|
|
33
33
|
import { normalizeNulls } from "../../Util/stable.ts";
|
|
34
|
-
import {
|
|
34
|
+
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
35
35
|
import { CloudflareLogs, type TelemetryFilter } from "../Logs.ts";
|
|
36
36
|
import type { Providers } from "../Providers.ts";
|
|
37
37
|
import { Container, ContainerTypeId } from "./Container.ts";
|
|
38
38
|
|
|
39
39
|
export { Credentials } from "@distilled.cloud/cloudflare/Credentials";
|
|
40
40
|
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
41
|
+
export namespace ContainerApplication {
|
|
42
|
+
export type InstanceType = NonNullable<
|
|
43
|
+
Containers.CreateContainerApplicationRequest["configuration"]["instanceType"]
|
|
44
|
+
>;
|
|
45
|
+
export type SchedulingPolicy = NonNullable<
|
|
46
|
+
Containers.CreateContainerApplicationRequest["schedulingPolicy"]
|
|
47
|
+
>;
|
|
48
|
+
export type Observability = NonNullable<
|
|
49
|
+
Containers.CreateContainerApplicationRequest["configuration"]["observability"]
|
|
50
|
+
>;
|
|
51
|
+
export type Secret = NonNullable<
|
|
52
|
+
Containers.CreateContainerApplicationRequest["configuration"]["secrets"]
|
|
53
|
+
>[number];
|
|
54
|
+
export type Disk = NonNullable<
|
|
55
|
+
Containers.CreateContainerApplicationRequest["configuration"]["disk"]
|
|
56
|
+
>;
|
|
57
|
+
export type EnvironmentVariable = NonNullable<
|
|
58
|
+
Containers.CreateContainerApplicationRequest["configuration"]["environmentVariables"]
|
|
59
|
+
>[number];
|
|
60
|
+
export type Label = NonNullable<
|
|
61
|
+
Containers.CreateContainerApplicationRequest["configuration"]["labels"]
|
|
62
|
+
>[number];
|
|
63
|
+
export type Network = NonNullable<
|
|
64
|
+
Containers.CreateContainerApplicationRequest["configuration"]["network"]
|
|
65
|
+
>;
|
|
66
|
+
export type Dns = NonNullable<
|
|
67
|
+
Containers.CreateContainerApplicationRequest["configuration"]["dns"]
|
|
68
|
+
>;
|
|
69
|
+
export type Port = NonNullable<
|
|
70
|
+
Containers.CreateContainerApplicationRequest["configuration"]["ports"]
|
|
71
|
+
>[number];
|
|
72
|
+
export type Check = NonNullable<
|
|
73
|
+
Containers.CreateContainerApplicationRequest["configuration"]["checks"]
|
|
74
|
+
>[number];
|
|
75
|
+
export type Constraints = {
|
|
76
|
+
tier?: number;
|
|
77
|
+
};
|
|
78
|
+
export type Affinities = {
|
|
79
|
+
colocation?: "datacenter";
|
|
80
|
+
};
|
|
81
|
+
export type Configuration =
|
|
82
|
+
Containers.CreateContainerApplicationRequest["configuration"];
|
|
83
|
+
export interface Rollout {
|
|
84
|
+
strategy?: "rolling" | "immediate";
|
|
85
|
+
kind?: "full_auto";
|
|
86
|
+
stepPercentage?: number;
|
|
87
|
+
}
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
export interface ContainerApplicationProps extends PlatformProps {
|
|
@@ -102,6 +104,32 @@ export interface ContainerApplicationProps extends PlatformProps {
|
|
|
102
104
|
* @default "bun"
|
|
103
105
|
*/
|
|
104
106
|
runtime?: "bun" | "node";
|
|
107
|
+
/**
|
|
108
|
+
* Module specifiers that Rolldown should mark as external when bundling
|
|
109
|
+
* the container entrypoint. The matching packages are installed inside the
|
|
110
|
+
* image via the runtime's package manager (`bun add` for `runtime: "bun"`,
|
|
111
|
+
* `npm install` for `runtime: "node"`) before the entrypoint runs.
|
|
112
|
+
*
|
|
113
|
+
* Use this for native dependencies that must not be bundled (e.g. `sharp`,
|
|
114
|
+
* `impit`) or for packages that intentionally ship in the base image.
|
|
115
|
+
*
|
|
116
|
+
* Install inside the image is controlled by {@link autoInstallExternals}
|
|
117
|
+
* (default `true`); set it to `false` if your custom `dockerfile` already
|
|
118
|
+
* installs these packages and you want to avoid the redundant step.
|
|
119
|
+
*/
|
|
120
|
+
external?: string[];
|
|
121
|
+
/**
|
|
122
|
+
* Whether to auto-install the packages listed in {@link external} inside
|
|
123
|
+
* the container image (via `bun add` or `npm install`) before running the
|
|
124
|
+
* entrypoint.
|
|
125
|
+
*
|
|
126
|
+
* @default true
|
|
127
|
+
*
|
|
128
|
+
* Set to `false` when your custom `dockerfile` already installs these
|
|
129
|
+
* packages (for example, via a base image that pre-installs `sharp`), to
|
|
130
|
+
* avoid the redundant install step.
|
|
131
|
+
*/
|
|
132
|
+
autoInstallExternals?: boolean;
|
|
105
133
|
/**
|
|
106
134
|
* Human-readable application name. If omitted, Alchemy derives a deterministic
|
|
107
135
|
* physical name from the stack, stage, and logical ID.
|
|
@@ -127,16 +155,16 @@ export interface ContainerApplicationProps extends PlatformProps {
|
|
|
127
155
|
* Scheduling policy used by Cloudflare's containers control plane.
|
|
128
156
|
* @default "default"
|
|
129
157
|
*/
|
|
130
|
-
schedulingPolicy?: SchedulingPolicy;
|
|
158
|
+
schedulingPolicy?: ContainerApplication.SchedulingPolicy;
|
|
131
159
|
/**
|
|
132
160
|
* Instance type for each deployment.
|
|
133
161
|
* @default "dev"
|
|
134
162
|
*/
|
|
135
|
-
instanceType?: InstanceType;
|
|
163
|
+
instanceType?: ContainerApplication.InstanceType;
|
|
136
164
|
/**
|
|
137
165
|
* Observability settings for the deployment.
|
|
138
166
|
*/
|
|
139
|
-
observability?: Observability;
|
|
167
|
+
observability?: ContainerApplication.Observability;
|
|
140
168
|
/**
|
|
141
169
|
* SSH public keys to install into the deployment.
|
|
142
170
|
*/
|
|
@@ -144,7 +172,7 @@ export interface ContainerApplicationProps extends PlatformProps {
|
|
|
144
172
|
/**
|
|
145
173
|
* Secrets exposed to the container runtime as environment variables.
|
|
146
174
|
*/
|
|
147
|
-
secrets?: Secret[];
|
|
175
|
+
secrets?: ContainerApplication.Secret[];
|
|
148
176
|
/**
|
|
149
177
|
* CPU allocation override for each deployment.
|
|
150
178
|
*/
|
|
@@ -156,19 +184,19 @@ export interface ContainerApplicationProps extends PlatformProps {
|
|
|
156
184
|
/**
|
|
157
185
|
* Disk allocation override for each deployment.
|
|
158
186
|
*/
|
|
159
|
-
disk?: Disk;
|
|
187
|
+
disk?: ContainerApplication.Disk;
|
|
160
188
|
/**
|
|
161
189
|
* Plain environment variables passed to the container runtime.
|
|
162
190
|
*/
|
|
163
|
-
environmentVariables?: EnvironmentVariable[];
|
|
191
|
+
environmentVariables?: ContainerApplication.EnvironmentVariable[];
|
|
164
192
|
/**
|
|
165
193
|
* Labels attached to the deployment.
|
|
166
194
|
*/
|
|
167
|
-
labels?: Label[];
|
|
195
|
+
labels?: ContainerApplication.Label[];
|
|
168
196
|
/**
|
|
169
197
|
* Network configuration for the deployment.
|
|
170
198
|
*/
|
|
171
|
-
network?: Network;
|
|
199
|
+
network?: ContainerApplication.Network;
|
|
172
200
|
/**
|
|
173
201
|
* Command override for the container image.
|
|
174
202
|
*/
|
|
@@ -180,27 +208,27 @@ export interface ContainerApplicationProps extends PlatformProps {
|
|
|
180
208
|
/**
|
|
181
209
|
* DNS configuration for the deployment.
|
|
182
210
|
*/
|
|
183
|
-
dns?: Dns;
|
|
211
|
+
dns?: ContainerApplication.Dns;
|
|
184
212
|
/**
|
|
185
213
|
* Exposed ports for the deployment.
|
|
186
214
|
*/
|
|
187
|
-
ports?: Port[];
|
|
215
|
+
ports?: ContainerApplication.Port[];
|
|
188
216
|
/**
|
|
189
217
|
* Health and readiness checks for the deployment.
|
|
190
218
|
*/
|
|
191
|
-
checks?: Check[];
|
|
219
|
+
checks?: ContainerApplication.Check[];
|
|
192
220
|
/**
|
|
193
221
|
* Resource constraints for the application.
|
|
194
222
|
*/
|
|
195
|
-
constraints?: Constraints;
|
|
223
|
+
constraints?: ContainerApplication.Constraints;
|
|
196
224
|
/**
|
|
197
225
|
* Affinity hints for scheduling.
|
|
198
226
|
*/
|
|
199
|
-
affinities?: Affinities;
|
|
227
|
+
affinities?: ContainerApplication.Affinities;
|
|
200
228
|
/**
|
|
201
229
|
* Progressive rollout settings applied after updates.
|
|
202
230
|
*/
|
|
203
|
-
rollout?: Rollout;
|
|
231
|
+
rollout?: ContainerApplication.Rollout;
|
|
204
232
|
/**
|
|
205
233
|
* Container registry host to use for generated Dockerfile builds.
|
|
206
234
|
* @default "registry.cloudflare.com"
|
|
@@ -233,12 +261,12 @@ export interface ContainerApplication<Shape = unknown> extends Resource<
|
|
|
233
261
|
applicationId: string;
|
|
234
262
|
applicationName: string;
|
|
235
263
|
accountId: string;
|
|
236
|
-
schedulingPolicy: SchedulingPolicy;
|
|
264
|
+
schedulingPolicy: ContainerApplication.SchedulingPolicy;
|
|
237
265
|
instances: number;
|
|
238
266
|
maxInstances: number;
|
|
239
|
-
constraints: Constraints | undefined;
|
|
240
|
-
affinities: Affinities | undefined;
|
|
241
|
-
configuration: Configuration;
|
|
267
|
+
constraints: ContainerApplication.Constraints | undefined;
|
|
268
|
+
affinities: ContainerApplication.Affinities | undefined;
|
|
269
|
+
configuration: ContainerApplication.Configuration;
|
|
242
270
|
durableObjects:
|
|
243
271
|
| {
|
|
244
272
|
namespaceId: string;
|
|
@@ -327,7 +355,7 @@ export const ContainerProvider = () =>
|
|
|
327
355
|
Container,
|
|
328
356
|
Effect.gen(function* () {
|
|
329
357
|
const stack = yield* Stack;
|
|
330
|
-
const accountId = yield*
|
|
358
|
+
const { accountId } = yield* CloudflareEnvironment;
|
|
331
359
|
const adoptPolicy = yield* Effect.serviceOption(AdoptPolicy).pipe(
|
|
332
360
|
Effect.map(Option.getOrElse(() => false)),
|
|
333
361
|
);
|
|
@@ -397,7 +425,7 @@ export const ContainerProvider = () =>
|
|
|
397
425
|
dns: props.dns,
|
|
398
426
|
ports: props.ports,
|
|
399
427
|
checks: props.checks,
|
|
400
|
-
}) as Configuration;
|
|
428
|
+
}) as ContainerApplication.Configuration;
|
|
401
429
|
|
|
402
430
|
const computeImageHash = Effect.fnUntraced(function* (
|
|
403
431
|
id: string,
|
|
@@ -410,15 +438,21 @@ export const ContainerProvider = () =>
|
|
|
410
438
|
);
|
|
411
439
|
}
|
|
412
440
|
const runtime = props.runtime ?? "bun";
|
|
413
|
-
const {
|
|
441
|
+
const { files, hash: bundleHash } = yield* bundleProgram({
|
|
414
442
|
id,
|
|
415
443
|
main,
|
|
416
444
|
runtime,
|
|
417
445
|
handler: props.handler,
|
|
418
446
|
isExternal: props.isExternal,
|
|
447
|
+
external: props.external,
|
|
419
448
|
});
|
|
420
449
|
|
|
421
|
-
const finalDockerfile = buildFinalDockerfile(
|
|
450
|
+
const finalDockerfile = buildFinalDockerfile(
|
|
451
|
+
props.dockerfile,
|
|
452
|
+
runtime,
|
|
453
|
+
props.external,
|
|
454
|
+
props.autoInstallExternals,
|
|
455
|
+
);
|
|
422
456
|
const imageHash = (yield* sha256Object({
|
|
423
457
|
bundleHash,
|
|
424
458
|
dockerfile: finalDockerfile,
|
|
@@ -429,7 +463,7 @@ export const ContainerProvider = () =>
|
|
|
429
463
|
const repositoryName = name.toLowerCase();
|
|
430
464
|
const imageRef = `${registryId}/${accountId}/${repositoryName}:${imageHash}`;
|
|
431
465
|
|
|
432
|
-
return {
|
|
466
|
+
return { files, imageRef, imageHash };
|
|
433
467
|
});
|
|
434
468
|
|
|
435
469
|
const bundleProgram = Effect.fnUntraced(function* ({
|
|
@@ -437,12 +471,14 @@ export const ContainerProvider = () =>
|
|
|
437
471
|
runtime,
|
|
438
472
|
handler = "default",
|
|
439
473
|
isExternal = false,
|
|
474
|
+
external = [],
|
|
440
475
|
}: {
|
|
441
476
|
id: string;
|
|
442
477
|
main: string;
|
|
443
478
|
runtime: "bun" | "node";
|
|
444
479
|
handler: string | undefined;
|
|
445
480
|
isExternal?: boolean;
|
|
481
|
+
external?: string[];
|
|
446
482
|
}) {
|
|
447
483
|
const realMain = yield* fs.realPath(main);
|
|
448
484
|
const cwd = yield* findCwdForBundle(realMain);
|
|
@@ -459,6 +495,7 @@ export const ContainerProvider = () =>
|
|
|
459
495
|
"cloudflare:workers",
|
|
460
496
|
"cloudflare:workflows",
|
|
461
497
|
...(runtime === "bun" ? ["bun", "bun:*"] : []),
|
|
498
|
+
...external,
|
|
462
499
|
],
|
|
463
500
|
platform: "node",
|
|
464
501
|
plugins,
|
|
@@ -549,28 +586,49 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
549
586
|
),
|
|
550
587
|
);
|
|
551
588
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
589
|
+
// Rolldown can emit multiple chunk files (entry + shared chunks).
|
|
590
|
+
// Return every file so downstream code can materialize all of them
|
|
591
|
+
// into the Docker build context — dropping any of them produces a
|
|
592
|
+
// `Cannot find module './chunk-XXX.js'` runtime crash inside the
|
|
593
|
+
// container (with zero stdout, because it crashes before any user
|
|
594
|
+
// code runs).
|
|
595
|
+
const files = bundleOutput.files.map((f) => ({
|
|
596
|
+
path: f.path,
|
|
597
|
+
content:
|
|
598
|
+
typeof f.content === "string"
|
|
599
|
+
? new TextEncoder().encode(f.content)
|
|
600
|
+
: f.content,
|
|
601
|
+
}));
|
|
602
|
+
|
|
603
|
+
return { files, hash: bundleOutput.hash };
|
|
559
604
|
});
|
|
560
605
|
|
|
561
606
|
const buildFinalDockerfile = (
|
|
562
607
|
userDockerfile: string | undefined,
|
|
563
608
|
runtime: "bun" | "node",
|
|
609
|
+
external: string[] = [],
|
|
610
|
+
autoInstallExternals = true,
|
|
564
611
|
): string => {
|
|
565
612
|
const base =
|
|
566
613
|
userDockerfile?.trim() ??
|
|
567
614
|
(runtime === "bun" ? "FROM oven/bun:1" : "FROM node:22-slim");
|
|
568
615
|
const runtimeBin = runtime === "bun" ? "bun" : "node";
|
|
616
|
+
const installCmd = runtime === "bun" ? "bun add" : "npm install";
|
|
617
|
+
const installStep =
|
|
618
|
+
autoInstallExternals && external.length > 0
|
|
619
|
+
? `RUN ${installCmd} ${external.join(" ")}`
|
|
620
|
+
: "";
|
|
569
621
|
return [
|
|
570
622
|
base,
|
|
571
623
|
"",
|
|
572
624
|
"WORKDIR /app",
|
|
625
|
+
...(installStep ? [installStep, ""] : []),
|
|
573
626
|
"COPY index.mjs /app/index.mjs",
|
|
627
|
+
// Copy any additional rolldown chunks (`chunk-XXX.js`,
|
|
628
|
+
// `BunServices-YYY.js`, …). The glob matches zero or more files;
|
|
629
|
+
// non-trivial bundles always emit at least one chunk, minimal
|
|
630
|
+
// bundles emit none and the COPY no-ops.
|
|
631
|
+
"COPY *.js /app/",
|
|
574
632
|
`ENTRYPOINT ["${runtimeBin}", "/app/index.mjs"]`,
|
|
575
633
|
"",
|
|
576
634
|
].join("\n");
|
|
@@ -579,7 +637,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
579
637
|
const buildAndPushImage = Effect.fnUntraced(function* (
|
|
580
638
|
id: string,
|
|
581
639
|
props: ContainerApplicationProps,
|
|
582
|
-
|
|
640
|
+
files: ReadonlyArray<{ path: string; content: Uint8Array }>,
|
|
583
641
|
imageRef: string,
|
|
584
642
|
session?: { note: (message: string) => Effect.Effect<void> },
|
|
585
643
|
) {
|
|
@@ -597,11 +655,24 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
597
655
|
dotAlchemy,
|
|
598
656
|
`${id}-container`,
|
|
599
657
|
);
|
|
600
|
-
const finalDockerfile = buildFinalDockerfile(
|
|
658
|
+
const finalDockerfile = buildFinalDockerfile(
|
|
659
|
+
props.dockerfile,
|
|
660
|
+
runtime,
|
|
661
|
+
props.external,
|
|
662
|
+
props.autoInstallExternals,
|
|
663
|
+
);
|
|
601
664
|
yield* materializeDockerfile(finalDockerfile, contextDir);
|
|
602
|
-
yield* writeContextFiles(
|
|
603
|
-
|
|
604
|
-
|
|
665
|
+
yield* writeContextFiles(
|
|
666
|
+
contextDir,
|
|
667
|
+
files.map((f, i) => ({
|
|
668
|
+
// Keep the entry rename to `index.mjs` so the Dockerfile
|
|
669
|
+
// ENTRYPOINT (`ENTRYPOINT ["bun", "/app/index.mjs"]`) stays
|
|
670
|
+
// valid; preserve rolldown-assigned fileNames for every other
|
|
671
|
+
// chunk so intra-bundle relative imports resolve at runtime.
|
|
672
|
+
path: i === 0 ? "index.mjs" : f.path,
|
|
673
|
+
content: f.content,
|
|
674
|
+
})),
|
|
675
|
+
);
|
|
605
676
|
yield* dockerBuild({
|
|
606
677
|
tag: imageRef,
|
|
607
678
|
context: contextDir,
|
|
@@ -644,8 +715,8 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
644
715
|
rollout,
|
|
645
716
|
}: {
|
|
646
717
|
applicationId: string;
|
|
647
|
-
configuration: Configuration;
|
|
648
|
-
rollout: Rollout | undefined;
|
|
718
|
+
configuration: ContainerApplication.Configuration;
|
|
719
|
+
rollout: ContainerApplication.Rollout | undefined;
|
|
649
720
|
}) {
|
|
650
721
|
const strategy = rollout?.strategy ?? "immediate";
|
|
651
722
|
const stepPercentage =
|
|
@@ -680,7 +751,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
680
751
|
id: string;
|
|
681
752
|
news: ContainerApplicationProps;
|
|
682
753
|
name: string;
|
|
683
|
-
configuration: Configuration;
|
|
754
|
+
configuration: ContainerApplication.Configuration;
|
|
684
755
|
durableObjects:
|
|
685
756
|
| {
|
|
686
757
|
namespaceId: string;
|
|
@@ -821,11 +892,14 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
821
892
|
yield* Effect.logInfo(
|
|
822
893
|
`Cloudflare Container update: preparing ${existing.applicationName}`,
|
|
823
894
|
);
|
|
824
|
-
const {
|
|
895
|
+
const { files, imageRef, imageHash } = yield* computeImageHash(
|
|
896
|
+
id,
|
|
897
|
+
news,
|
|
898
|
+
);
|
|
825
899
|
const configuration = desiredConfiguration(news, imageRef);
|
|
826
900
|
|
|
827
901
|
if (imageHash !== existing.hash?.image) {
|
|
828
|
-
yield* buildAndPushImage(id, news,
|
|
902
|
+
yield* buildAndPushImage(id, news, files, imageRef, session);
|
|
829
903
|
}
|
|
830
904
|
|
|
831
905
|
yield* session.note(
|
|
@@ -927,12 +1001,12 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
927
1001
|
`Cloudflare Container precreate: starting ${name}`,
|
|
928
1002
|
);
|
|
929
1003
|
|
|
930
|
-
const {
|
|
1004
|
+
const { files, imageRef, imageHash } = yield* computeImageHash(
|
|
931
1005
|
id,
|
|
932
1006
|
news,
|
|
933
1007
|
);
|
|
934
1008
|
const configuration = desiredConfiguration(news, imageRef);
|
|
935
|
-
yield* buildAndPushImage(id, news,
|
|
1009
|
+
yield* buildAndPushImage(id, news, files, imageRef, session);
|
|
936
1010
|
|
|
937
1011
|
// Precreate intentionally omits the Durable Object attachment so the
|
|
938
1012
|
// worker can bind to this application id and break the circular
|
|
@@ -967,7 +1041,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
967
1041
|
`Cloudflare Container create: starting ${name}${adoptPolicy ? " with adopt" : ""}`,
|
|
968
1042
|
);
|
|
969
1043
|
const durableObjects = yield* getDurableObjects(bindings);
|
|
970
|
-
const {
|
|
1044
|
+
const { files, imageRef, imageHash } = yield* computeImageHash(
|
|
971
1045
|
id,
|
|
972
1046
|
news,
|
|
973
1047
|
);
|
|
@@ -1019,7 +1093,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
1019
1093
|
),
|
|
1020
1094
|
);
|
|
1021
1095
|
if (imageHash !== output.hash?.image) {
|
|
1022
|
-
yield* buildAndPushImage(id, news,
|
|
1096
|
+
yield* buildAndPushImage(id, news, files, imageRef, session);
|
|
1023
1097
|
}
|
|
1024
1098
|
const result = yield* createApplication({
|
|
1025
1099
|
id,
|
|
@@ -1044,7 +1118,7 @@ await Effect.runPromise(serverEffect).catch((err) => {
|
|
|
1044
1118
|
});
|
|
1045
1119
|
}
|
|
1046
1120
|
|
|
1047
|
-
yield* buildAndPushImage(id, news,
|
|
1121
|
+
yield* buildAndPushImage(id, news, files, imageRef, session);
|
|
1048
1122
|
|
|
1049
1123
|
const result = yield* createApplication({
|
|
1050
1124
|
id,
|
|
@@ -1169,10 +1243,14 @@ const toAttributes = (
|
|
|
1169
1243
|
instances: application.instances,
|
|
1170
1244
|
maxInstances: application.maxInstances,
|
|
1171
1245
|
constraints: normalizeNulls(
|
|
1172
|
-
application.constraints as Constraints | undefined,
|
|
1246
|
+
application.constraints as ContainerApplication.Constraints | undefined,
|
|
1247
|
+
),
|
|
1248
|
+
affinities: normalizeNulls(
|
|
1249
|
+
application.affinities as ContainerApplication.Affinities | undefined,
|
|
1250
|
+
),
|
|
1251
|
+
configuration: normalizeNulls(
|
|
1252
|
+
application.configuration as ContainerApplication.Configuration,
|
|
1173
1253
|
),
|
|
1174
|
-
affinities: normalizeNulls(application.affinities as Affinities | undefined),
|
|
1175
|
-
configuration: normalizeNulls(application.configuration as Configuration),
|
|
1176
1254
|
durableObjects: normalizeNulls(application.durableObjects) as
|
|
1177
1255
|
| { namespaceId: string }
|
|
1178
1256
|
| undefined,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apiKeyCredentials,
|
|
3
|
+
apiTokenCredentials,
|
|
4
|
+
Credentials,
|
|
5
|
+
oauthCredentials,
|
|
6
|
+
} from "@distilled.cloud/cloudflare/Credentials";
|
|
7
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
8
|
+
import * as Config from "effect/Config";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Layer from "effect/Layer";
|
|
11
|
+
import * as Match from "effect/Match";
|
|
12
|
+
import * as Redacted from "effect/Redacted";
|
|
13
|
+
import { getAuthProvider } from "../Auth/AuthProvider.ts";
|
|
14
|
+
import { ALCHEMY_PROFILE, loadOrConfigure } from "../Auth/Profile.ts";
|
|
15
|
+
import {
|
|
16
|
+
CLOUDFLARE_AUTH_PROVIDER_NAME,
|
|
17
|
+
type CloudflareAuthConfig,
|
|
18
|
+
type CloudflareResolvedCredentials,
|
|
19
|
+
} from "./Auth/AuthProvider.ts";
|
|
20
|
+
|
|
21
|
+
export { Credentials, fromEnv } from "@distilled.cloud/cloudflare/Credentials";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Build a `Credentials` layer that resolves Cloudflare credentials via the
|
|
25
|
+
* Alchemy AuthProvider using the configured profile (defaults to "default",
|
|
26
|
+
* overridable with the `ALCHEMY_PROFILE` env/config value).
|
|
27
|
+
*/
|
|
28
|
+
export const fromAuthProvider = () =>
|
|
29
|
+
Layer.effect(
|
|
30
|
+
Credentials,
|
|
31
|
+
Effect.gen(function* () {
|
|
32
|
+
const auth = yield* getAuthProvider<
|
|
33
|
+
CloudflareAuthConfig,
|
|
34
|
+
CloudflareResolvedCredentials
|
|
35
|
+
>(CLOUDFLARE_AUTH_PROVIDER_NAME);
|
|
36
|
+
const profileName = yield* ALCHEMY_PROFILE;
|
|
37
|
+
const ci = yield* Config.boolean("CI").pipe(Config.withDefault(false));
|
|
38
|
+
const ctx = yield* Effect.context<never>();
|
|
39
|
+
|
|
40
|
+
return loadOrConfigure(auth, profileName, { ci }).pipe(
|
|
41
|
+
Effect.flatMap((config) =>
|
|
42
|
+
auth.read(profileName, config as CloudflareAuthConfig),
|
|
43
|
+
),
|
|
44
|
+
Effect.map((creds) =>
|
|
45
|
+
Match.value(creds).pipe(
|
|
46
|
+
Match.when({ type: "apiToken" }, (c) =>
|
|
47
|
+
apiTokenCredentials({
|
|
48
|
+
apiToken: Redacted.value(c.apiToken),
|
|
49
|
+
}),
|
|
50
|
+
),
|
|
51
|
+
Match.when({ type: "apiKey" }, (c) =>
|
|
52
|
+
apiKeyCredentials({
|
|
53
|
+
apiKey: Redacted.value(c.apiKey),
|
|
54
|
+
email: Redacted.value(c.email),
|
|
55
|
+
}),
|
|
56
|
+
),
|
|
57
|
+
Match.when({ type: "oauth" }, (c) =>
|
|
58
|
+
oauthCredentials({
|
|
59
|
+
accessToken: Redacted.value(c.accessToken),
|
|
60
|
+
expiresAt: c.expires,
|
|
61
|
+
}),
|
|
62
|
+
),
|
|
63
|
+
Match.exhaustive,
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
Effect.mapError(
|
|
67
|
+
(e) =>
|
|
68
|
+
new ConfigError({
|
|
69
|
+
message: `Failed to resolve Cloudflare credentials for profile '${profileName}': ${(e as { message?: string }).message ?? String(e)}`,
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
Effect.provide(ctx),
|
|
73
|
+
);
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
@@ -5,7 +5,7 @@ import { isResolved } from "../../Diff.ts";
|
|
|
5
5
|
import { createPhysicalName } from "../../PhysicalName.ts";
|
|
6
6
|
import * as Provider from "../../Provider.ts";
|
|
7
7
|
import { Resource } from "../../Resource.ts";
|
|
8
|
-
import {
|
|
8
|
+
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
9
9
|
import type { Providers } from "../Providers.ts";
|
|
10
10
|
|
|
11
11
|
export type Jurisdiction = "default" | "eu" | "fedramp";
|
|
@@ -95,7 +95,7 @@ export const DatabaseProvider = () =>
|
|
|
95
95
|
Provider.effect(
|
|
96
96
|
D1Database,
|
|
97
97
|
Effect.gen(function* () {
|
|
98
|
-
const accountId = yield*
|
|
98
|
+
const { accountId } = yield* CloudflareEnvironment;
|
|
99
99
|
const createDb = yield* d1.createDatabase;
|
|
100
100
|
const getDb = yield* d1.getDatabase;
|
|
101
101
|
const patchDb = yield* d1.patchDatabase;
|
|
@@ -4,7 +4,7 @@ import { isResolved } from "../../Diff.ts";
|
|
|
4
4
|
import { createPhysicalName } from "../../PhysicalName.ts";
|
|
5
5
|
import * as Provider from "../../Provider.ts";
|
|
6
6
|
import { Resource } from "../../Resource.ts";
|
|
7
|
-
import {
|
|
7
|
+
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
8
8
|
import type { Providers } from "../Providers.ts";
|
|
9
9
|
import { KVNamespaceBinding } from "./KVNamespaceBinding.ts";
|
|
10
10
|
|
|
@@ -63,7 +63,7 @@ export const KVNamespaceProvider = () =>
|
|
|
63
63
|
Provider.effect(
|
|
64
64
|
KVNamespace,
|
|
65
65
|
Effect.gen(function* () {
|
|
66
|
-
const accountId = yield*
|
|
66
|
+
const { accountId } = yield* CloudflareEnvironment;
|
|
67
67
|
const createNamespace = yield* kv.createNamespace;
|
|
68
68
|
const updateNamespace = yield* kv.updateNamespace;
|
|
69
69
|
const deleteNamespace = yield* kv.deleteNamespace;
|