alchemy-effect 0.5.0 → 0.6.2
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-effect.js +7155 -17689
- package/bin/alchemy-effect.js.map +1 -1
- package/bin/alchemy-effect.sh +14 -0
- package/bin/alchemy-effect.ts +644 -130
- package/bin/process-manager.ts +10 -0
- package/lib/cli/index.d.ts +207 -378
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +4134 -985
- package/lib/cli/index.js.map +1 -1
- package/package.json +165 -103
- package/src/AWS/ACM/Certificate.ts +502 -0
- package/src/AWS/ACM/index.ts +1 -0
- package/src/AWS/AGENTS.md +505 -0
- package/src/AWS/Account.ts +56 -0
- package/src/AWS/Assets.ts +182 -0
- package/src/AWS/AutoScaling/AutoScalingGroup.ts +440 -0
- package/src/AWS/AutoScaling/LaunchTemplate.ts +535 -0
- package/src/AWS/AutoScaling/ScalingPolicy.ts +232 -0
- package/src/AWS/AutoScaling/index.ts +3 -0
- package/src/AWS/Bootstrap.ts +281 -0
- package/src/AWS/CloudFront/Distribution.ts +952 -0
- package/src/AWS/CloudFront/Function.ts +374 -0
- package/src/AWS/CloudFront/Invalidation.ts +202 -0
- package/src/AWS/CloudFront/KeyValueStore.ts +216 -0
- package/src/AWS/CloudFront/KvEntries.ts +250 -0
- package/src/AWS/CloudFront/KvRoutesUpdate.ts +301 -0
- package/src/AWS/CloudFront/ManagedPolicies.ts +20 -0
- package/src/AWS/CloudFront/OriginAccessControl.ts +266 -0
- package/src/AWS/CloudFront/common.ts +55 -0
- package/src/AWS/CloudFront/index.ts +15 -0
- package/src/AWS/CloudWatch/Alarm.ts +198 -0
- package/src/AWS/CloudWatch/AlarmMuteRule.ts +183 -0
- package/src/AWS/CloudWatch/AnomalyDetector.ts +242 -0
- package/src/AWS/CloudWatch/CompositeAlarm.ts +198 -0
- package/src/AWS/CloudWatch/Dashboard.ts +262 -0
- package/src/AWS/CloudWatch/DescribeAlarmContributors.ts +79 -0
- package/src/AWS/CloudWatch/DescribeAlarmHistory.ts +66 -0
- package/src/AWS/CloudWatch/DescribeAlarms.ts +94 -0
- package/src/AWS/CloudWatch/DescribeAlarmsForMetric.ts +66 -0
- package/src/AWS/CloudWatch/DescribeAnomalyDetectors.ts +68 -0
- package/src/AWS/CloudWatch/DescribeInsightRules.ts +66 -0
- package/src/AWS/CloudWatch/DisableAlarmActions.ts +74 -0
- package/src/AWS/CloudWatch/DisableInsightRules.ts +74 -0
- package/src/AWS/CloudWatch/EnableAlarmActions.ts +74 -0
- package/src/AWS/CloudWatch/GetAlarmMuteRule.ts +75 -0
- package/src/AWS/CloudWatch/GetDashboard.ts +75 -0
- package/src/AWS/CloudWatch/GetInsightRuleReport.ts +76 -0
- package/src/AWS/CloudWatch/GetMetricData.ts +62 -0
- package/src/AWS/CloudWatch/GetMetricStatistics.ts +64 -0
- package/src/AWS/CloudWatch/GetMetricStream.ts +75 -0
- package/src/AWS/CloudWatch/GetMetricWidgetImage.ts +66 -0
- package/src/AWS/CloudWatch/InsightRule.ts +277 -0
- package/src/AWS/CloudWatch/ListAlarmMuteRules.ts +64 -0
- package/src/AWS/CloudWatch/ListDashboards.ts +62 -0
- package/src/AWS/CloudWatch/ListManagedInsightRules.ts +68 -0
- package/src/AWS/CloudWatch/ListMetricStreams.ts +64 -0
- package/src/AWS/CloudWatch/ListMetrics.ts +62 -0
- package/src/AWS/CloudWatch/ListTagsForResource.ts +79 -0
- package/src/AWS/CloudWatch/MetricStream.ts +262 -0
- package/src/AWS/CloudWatch/PutMetricData.ts +62 -0
- package/src/AWS/CloudWatch/SetAlarmState.ts +73 -0
- package/src/AWS/CloudWatch/alarmStateChanges.ts +24 -0
- package/src/AWS/CloudWatch/binding-common.ts +42 -0
- package/src/AWS/CloudWatch/common.ts +168 -0
- package/src/AWS/CloudWatch/index.ts +32 -0
- package/src/AWS/Context.ts +30 -0
- package/src/AWS/Credentials.ts +52 -0
- package/src/AWS/DynamoDB/AttributeValue.ts +250 -0
- package/src/AWS/DynamoDB/BatchExecuteStatement.ts +113 -0
- package/src/AWS/DynamoDB/BatchGetItem.ts +138 -0
- package/src/AWS/DynamoDB/BatchWriteItem.ts +144 -0
- package/src/AWS/DynamoDB/DeleteItem.ts +67 -0
- package/src/AWS/DynamoDB/DescribeTable.ts +69 -0
- package/src/AWS/DynamoDB/DescribeTimeToLive.ts +72 -0
- package/src/AWS/DynamoDB/ExecuteStatement.ts +91 -0
- package/src/AWS/DynamoDB/ExecuteTransaction.ts +77 -0
- package/src/AWS/DynamoDB/GetItem.ts +85 -0
- package/src/AWS/DynamoDB/ListTables.ts +56 -0
- package/src/AWS/DynamoDB/ListTagsOfResource.ts +72 -0
- package/src/AWS/DynamoDB/ProjectionExpression.ts +159 -0
- package/src/AWS/DynamoDB/PutItem.ts +67 -0
- package/src/AWS/DynamoDB/Query.ts +68 -0
- package/src/AWS/DynamoDB/RestoreTableToPointInTime.ts +94 -0
- package/src/AWS/DynamoDB/Scan.ts +68 -0
- package/src/AWS/DynamoDB/Stream.ts +94 -0
- package/src/AWS/DynamoDB/Table.ts +1175 -0
- package/src/AWS/DynamoDB/TransactGetItems.ts +154 -0
- package/src/AWS/DynamoDB/TransactWriteItems.ts +216 -0
- package/src/AWS/DynamoDB/UpdateItem.ts +67 -0
- package/src/AWS/DynamoDB/UpdateTimeToLive.ts +71 -0
- package/src/AWS/DynamoDB/index.ts +24 -0
- package/src/AWS/EC2/EIP.ts +285 -0
- package/src/AWS/EC2/EgressOnlyInternetGateway.ts +248 -0
- package/src/AWS/EC2/Image.ts +108 -0
- package/src/AWS/EC2/Instance.ts +877 -0
- package/src/AWS/EC2/InternetGateway.ts +382 -0
- package/src/AWS/EC2/NatGateway.ts +474 -0
- package/src/AWS/EC2/Network.ts +459 -0
- package/src/AWS/EC2/NetworkAcl.ts +247 -0
- package/src/AWS/EC2/NetworkAclAssociation.ts +206 -0
- package/src/AWS/EC2/NetworkAclEntry.ts +300 -0
- package/src/AWS/EC2/Route.ts +323 -0
- package/src/AWS/EC2/RouteTable.ts +448 -0
- package/src/AWS/EC2/RouteTableAssociation.ts +274 -0
- package/src/AWS/EC2/SecurityGroup.ts +552 -0
- package/src/AWS/EC2/SecurityGroupRule.ts +395 -0
- package/src/AWS/EC2/Subnet.ts +583 -0
- package/src/AWS/EC2/Vpc.ts +455 -0
- package/src/AWS/EC2/VpcEndpoint.ts +657 -0
- package/src/AWS/EC2/hosted.ts +891 -0
- package/src/AWS/EC2/index.ts +18 -0
- package/src/AWS/ECR/Repository.ts +254 -0
- package/src/AWS/ECR/index.ts +1 -0
- package/src/AWS/ECS/Cluster.ts +257 -0
- package/src/AWS/ECS/DescribeTasks.ts +67 -0
- package/src/AWS/ECS/ListTasks.ts +67 -0
- package/src/AWS/ECS/RunTask.ts +82 -0
- package/src/AWS/ECS/Schedule.ts +115 -0
- package/src/AWS/ECS/Service.ts +572 -0
- package/src/AWS/ECS/StopTask.ts +64 -0
- package/src/AWS/ECS/Task.ts +981 -0
- package/src/AWS/ECS/index.ts +28 -0
- package/src/AWS/EKS/AccessEntry.ts +382 -0
- package/src/AWS/EKS/Addon.ts +385 -0
- package/src/AWS/EKS/AutoCluster.ts +288 -0
- package/src/AWS/EKS/Cluster.ts +655 -0
- package/src/AWS/EKS/LoadBalancedWorkload.ts +76 -0
- package/src/AWS/EKS/PodIdentityAssociation.ts +354 -0
- package/src/AWS/EKS/PodIdentityServiceAccount.ts +156 -0
- package/src/AWS/EKS/PodIdentityWorkload.ts +185 -0
- package/src/AWS/EKS/Workload.ts +145 -0
- package/src/AWS/EKS/index.ts +9 -0
- package/src/AWS/ELBv2/Listener.ts +139 -0
- package/src/AWS/ELBv2/LoadBalancer.ts +227 -0
- package/src/AWS/ELBv2/TargetGroup.ts +209 -0
- package/src/AWS/ELBv2/index.ts +3 -0
- package/src/AWS/Endpoint.ts +16 -0
- package/src/AWS/EventBridge/DescribeEventBus.ts +71 -0
- package/src/AWS/EventBridge/DescribeRule.ts +73 -0
- package/src/AWS/EventBridge/EventBus.ts +273 -0
- package/src/AWS/EventBridge/EventSource.ts +146 -0
- package/src/AWS/EventBridge/ListEventBuses.ts +60 -0
- package/src/AWS/EventBridge/ListRules.ts +87 -0
- package/src/AWS/EventBridge/ListTargetsByRule.ts +76 -0
- package/src/AWS/EventBridge/Permission.ts +151 -0
- package/src/AWS/EventBridge/PutEvents.ts +91 -0
- package/src/AWS/EventBridge/Rule.ts +620 -0
- package/src/AWS/EventBridge/TestEventPattern.ts +60 -0
- package/src/AWS/EventBridge/ToEcsTask.ts +118 -0
- package/src/AWS/EventBridge/ToLambda.ts +87 -0
- package/src/AWS/EventBridge/ToQueue.ts +97 -0
- package/src/AWS/EventBridge/index.ts +14 -0
- package/src/AWS/IAM/AccessKey.ts +142 -0
- package/src/AWS/IAM/AccountAlias.ts +96 -0
- package/src/AWS/IAM/AccountPasswordPolicy.ts +64 -0
- package/src/AWS/IAM/Group.ts +357 -0
- package/src/AWS/IAM/GroupMembership.ts +142 -0
- package/src/AWS/IAM/InstanceProfile.ts +285 -0
- package/src/AWS/IAM/LoginProfile.ts +137 -0
- package/src/AWS/IAM/OpenIDConnectProvider.ts +192 -0
- package/src/AWS/IAM/Policy.ts +387 -0
- package/src/AWS/IAM/Role.ts +500 -0
- package/src/AWS/IAM/SAMLProvider.ts +165 -0
- package/src/AWS/IAM/SSHPublicKey.ts +148 -0
- package/src/AWS/IAM/ServerCertificate.ts +261 -0
- package/src/AWS/IAM/ServiceSpecificCredential.ts +172 -0
- package/src/AWS/IAM/SigningCertificate.ts +137 -0
- package/src/AWS/IAM/User.ts +436 -0
- package/src/AWS/IAM/VirtualMFADevice.ts +259 -0
- package/src/AWS/IAM/common.ts +89 -0
- package/src/AWS/IAM/index.ts +40 -0
- package/src/AWS/IdentityCenter/AccountAssignment.ts +290 -0
- package/src/AWS/IdentityCenter/Group.ts +211 -0
- package/src/AWS/IdentityCenter/Instance.ts +190 -0
- package/src/AWS/IdentityCenter/PermissionSet.ts +235 -0
- package/src/AWS/IdentityCenter/common.ts +117 -0
- package/src/AWS/IdentityCenter/index.ts +4 -0
- package/src/AWS/Kinesis/DescribeAccountSettings.ts +63 -0
- package/src/AWS/Kinesis/DescribeLimits.ts +59 -0
- package/src/AWS/Kinesis/DescribeStream.ts +69 -0
- package/src/AWS/Kinesis/DescribeStreamConsumer.ts +72 -0
- package/src/AWS/Kinesis/DescribeStreamSummary.ts +72 -0
- package/src/AWS/Kinesis/GetRecords.ts +59 -0
- package/src/AWS/Kinesis/GetResourcePolicy.ts +72 -0
- package/src/AWS/Kinesis/GetShardIterator.ts +71 -0
- package/src/AWS/Kinesis/ListShards.ts +66 -0
- package/src/AWS/Kinesis/ListStreamConsumers.ts +72 -0
- package/src/AWS/Kinesis/ListStreams.ts +56 -0
- package/src/AWS/Kinesis/ListTagsForResource.ts +78 -0
- package/src/AWS/Kinesis/PutRecord.ts +67 -0
- package/src/AWS/Kinesis/PutRecords.ts +67 -0
- package/src/AWS/Kinesis/Stream.ts +731 -0
- package/src/AWS/Kinesis/StreamConsumer.ts +325 -0
- package/src/AWS/Kinesis/StreamEventSource.ts +106 -0
- package/src/AWS/Kinesis/StreamSink.ts +68 -0
- package/src/AWS/Kinesis/SubscribeToShard.ts +71 -0
- package/src/AWS/Kinesis/index.ts +19 -0
- package/src/AWS/Lambda/BucketEventSource.ts +146 -0
- package/src/AWS/Lambda/EventBridgeEventSource.ts +183 -0
- package/src/AWS/Lambda/EventSourceMapping.ts +438 -0
- package/src/AWS/Lambda/Function.ts +1185 -0
- package/src/AWS/Lambda/HttpServer.ts +125 -0
- package/src/AWS/Lambda/InvokeFunction.ts +67 -0
- package/src/AWS/Lambda/Permission.ts +217 -0
- package/src/AWS/Lambda/QueueEventSource.ts +96 -0
- package/src/AWS/Lambda/StreamEventSource.ts +123 -0
- package/src/AWS/Lambda/TableEventSource.ts +156 -0
- package/src/AWS/Lambda/TopicEventSource.ts +105 -0
- package/src/AWS/Lambda/index.ts +13 -0
- package/src/AWS/Logs/LogGroup.ts +209 -0
- package/src/AWS/Logs/index.ts +1 -0
- package/src/AWS/Organizations/Account.ts +328 -0
- package/src/AWS/Organizations/DelegatedAdministrator.ts +158 -0
- package/src/AWS/Organizations/Organization.ts +179 -0
- package/src/AWS/Organizations/OrganizationResourcePolicy.ts +108 -0
- package/src/AWS/Organizations/OrganizationalUnit.ts +268 -0
- package/src/AWS/Organizations/Policy.ts +241 -0
- package/src/AWS/Organizations/PolicyAttachment.ts +130 -0
- package/src/AWS/Organizations/Root.ts +151 -0
- package/src/AWS/Organizations/RootPolicyType.ts +130 -0
- package/src/AWS/Organizations/TenantRoot.ts +506 -0
- package/src/AWS/Organizations/TrustedServiceAccess.ts +107 -0
- package/src/AWS/Organizations/common.ts +130 -0
- package/src/AWS/Organizations/index.ts +11 -0
- package/src/AWS/Profile.ts +5 -0
- package/src/AWS/Providers.ts +324 -0
- package/src/AWS/RDS/Aurora.ts +499 -0
- package/src/AWS/RDS/Connect.ts +127 -0
- package/src/AWS/RDS/DBCluster.ts +361 -0
- package/src/AWS/RDS/DBClusterEndpoint.ts +226 -0
- package/src/AWS/RDS/DBClusterParameterGroup.ts +195 -0
- package/src/AWS/RDS/DBInstance.ts +274 -0
- package/src/AWS/RDS/DBParameterGroup.ts +190 -0
- package/src/AWS/RDS/DBProxy.ts +257 -0
- package/src/AWS/RDS/DBProxyEndpoint.ts +255 -0
- package/src/AWS/RDS/DBProxyTargetGroup.ts +243 -0
- package/src/AWS/RDS/DBSubnetGroup.ts +208 -0
- package/src/AWS/RDS/index.ts +11 -0
- package/src/AWS/RDSData/BatchExecuteStatement.ts +103 -0
- package/src/AWS/RDSData/BeginTransaction.ts +97 -0
- package/src/AWS/RDSData/CommitTransaction.ts +102 -0
- package/src/AWS/RDSData/ExecuteSql.ts +98 -0
- package/src/AWS/RDSData/ExecuteStatement.ts +99 -0
- package/src/AWS/RDSData/RollbackTransaction.ts +105 -0
- package/src/AWS/RDSData/index.ts +6 -0
- package/src/AWS/Region.ts +77 -0
- package/src/AWS/Route53/Record.ts +342 -0
- package/src/AWS/Route53/index.ts +1 -0
- package/src/AWS/S3/AbortMultipartUpload.ts +73 -0
- package/src/AWS/S3/Bucket.ts +550 -0
- package/src/AWS/S3/BucketEventSource.ts +26 -0
- package/src/AWS/S3/BucketNotifications.ts +77 -0
- package/src/AWS/S3/CompleteMultipartUpload.ts +73 -0
- package/src/AWS/S3/CopyObject.ts +68 -0
- package/src/AWS/S3/CreateMultipartUpload.ts +73 -0
- package/src/AWS/S3/DeleteObject.ts +67 -0
- package/src/AWS/S3/GetObject.ts +74 -0
- package/src/AWS/S3/HeadObject.ts +67 -0
- package/src/AWS/S3/ListObjectsV2.ts +67 -0
- package/src/AWS/S3/PutObject.ts +83 -0
- package/src/AWS/S3/S3Event.ts +43 -0
- package/src/AWS/S3/UploadPart.ts +67 -0
- package/src/AWS/S3/index.ts +14 -0
- package/src/AWS/SNS/AddPermission.ts +66 -0
- package/src/AWS/SNS/ConfirmSubscription.ts +72 -0
- package/src/AWS/SNS/GetDataProtectionPolicy.ts +72 -0
- package/src/AWS/SNS/GetSubscriptionAttributes.ts +72 -0
- package/src/AWS/SNS/GetTopicAttributes.ts +70 -0
- package/src/AWS/SNS/ListSubscriptions.ts +60 -0
- package/src/AWS/SNS/ListSubscriptionsByTopic.ts +72 -0
- package/src/AWS/SNS/ListTagsForResource.ts +72 -0
- package/src/AWS/SNS/ListTopics.ts +56 -0
- package/src/AWS/SNS/Publish.ts +66 -0
- package/src/AWS/SNS/PublishBatch.ts +66 -0
- package/src/AWS/SNS/PutDataProtectionPolicy.ts +72 -0
- package/src/AWS/SNS/RemovePermission.ts +66 -0
- package/src/AWS/SNS/SetSubscriptionAttributes.ts +72 -0
- package/src/AWS/SNS/SetTopicAttributes.ts +70 -0
- package/src/AWS/SNS/Subscription.ts +305 -0
- package/src/AWS/SNS/TagResource.ts +66 -0
- package/src/AWS/SNS/Topic.ts +363 -0
- package/src/AWS/SNS/TopicEventSource.ts +42 -0
- package/src/AWS/SNS/TopicSink.ts +61 -0
- package/src/AWS/SNS/UntagResource.ts +66 -0
- package/src/AWS/SNS/index.ts +21 -0
- package/src/AWS/SQS/DeleteMessage.ts +67 -0
- package/src/AWS/SQS/DeleteMessageBatch.ts +72 -0
- package/src/AWS/SQS/Queue.ts +210 -0
- package/src/AWS/SQS/QueueEventSource.ts +57 -0
- package/src/AWS/SQS/QueueSink.ts +62 -0
- package/src/AWS/SQS/ReceiveMessage.ts +68 -0
- package/src/AWS/SQS/SendMessage.ts +69 -0
- package/src/AWS/SQS/SendMessageBatch.ts +67 -0
- package/src/AWS/SQS/index.ts +8 -0
- package/src/AWS/Scheduler/Schedule.ts +296 -0
- package/src/AWS/Scheduler/ScheduleGroup.ts +186 -0
- package/src/AWS/Scheduler/builders.ts +229 -0
- package/src/AWS/Scheduler/index.ts +3 -0
- package/src/AWS/SecretsManager/DescribeSecret.ts +66 -0
- package/src/AWS/SecretsManager/GetRandomPassword.ts +65 -0
- package/src/AWS/SecretsManager/GetSecretValue.ts +78 -0
- package/src/AWS/SecretsManager/ListSecrets.ts +62 -0
- package/src/AWS/SecretsManager/PutSecretValue.ts +78 -0
- package/src/AWS/SecretsManager/Secret.ts +318 -0
- package/src/AWS/SecretsManager/index.ts +6 -0
- package/src/AWS/StageConfig.ts +44 -0
- package/src/AWS/Website/AssetDeployment.ts +348 -0
- package/src/AWS/Website/Router.ts +384 -0
- package/src/AWS/Website/SsrSite.ts +393 -0
- package/src/AWS/Website/StaticSite.ts +611 -0
- package/src/AWS/Website/cfcode.ts +180 -0
- package/src/AWS/Website/index.ts +5 -0
- package/src/AWS/Website/shared.ts +223 -0
- package/src/AWS/index.ts +37 -0
- package/src/AdoptPolicy.ts +25 -0
- package/src/Agent/Agent.ts +26 -0
- package/src/Agent/Aspect.ts +173 -0
- package/src/Agent/AspectGraph.ts +98 -0
- package/src/Agent/ContextPlugin.ts +18 -0
- package/src/Agent/Plugin.ts +29 -0
- package/src/Agent/chat/channel.ts +26 -0
- package/src/Agent/chat/event.ts +43 -0
- package/src/Agent/chat/message.ts +35 -0
- package/src/Agent/chat/service.ts +133 -0
- package/src/Agent/chat/thread.ts +17 -0
- package/src/Agent/coding/bash.ts +198 -0
- package/src/Agent/coding/edit.ts +152 -0
- package/src/Agent/coding/glob.ts +97 -0
- package/src/Agent/coding/grep.ts +144 -0
- package/src/Agent/coding/index.ts +7 -0
- package/src/Agent/coding/read.ts +119 -0
- package/src/Agent/coding/readlints.ts +78 -0
- package/src/Agent/coding/write.ts +79 -0
- package/src/Agent/fs/file.ts +22 -0
- package/src/Agent/fs/folder.ts +16 -0
- package/src/Agent/index.ts +9 -0
- package/src/Agent/llm/error.ts +330 -0
- package/src/Agent/llm/index.ts +4 -0
- package/src/Agent/llm/llm.ts +131 -0
- package/src/Agent/llm/stream-collectors.ts +58 -0
- package/src/Agent/llm/stream-text-part.ts +7 -0
- package/src/Agent/lsp/client.ts +293 -0
- package/src/Agent/lsp/diagnostics.ts +64 -0
- package/src/Agent/lsp/jsonrpc.ts +317 -0
- package/src/Agent/lsp/manager.ts +213 -0
- package/src/Agent/lsp/servers.ts +37 -0
- package/src/Agent/process/driver.ts +168 -0
- package/src/Agent/process/issue-service.ts +48 -0
- package/src/Agent/process/issue-tools.ts +33 -0
- package/src/Agent/process/issue.ts +22 -0
- package/src/Agent/process/organization.ts +16 -0
- package/src/Agent/process/process.ts +16 -0
- package/src/Agent/process/reply.ts +21 -0
- package/src/Agent/process/task.ts +34 -0
- package/src/Agent/tool/index.ts +3 -0
- package/src/Agent/tool/parameter.ts +35 -0
- package/src/Agent/tool/result.ts +51 -0
- package/src/Agent/tool/tool.ts +74 -0
- package/src/Agent/util/command-validator.ts +98 -0
- package/src/Agent/util/exec.ts +18 -0
- package/src/Agent/util/parser.ts +39 -0
- package/src/Agent/util/replace.ts +559 -0
- package/src/Agent/util/ripgrep.ts +256 -0
- package/src/Apply.ts +1074 -0
- package/src/Binding.ts +193 -0
- package/src/Build/Command.ts +322 -0
- package/src/Build/index.ts +1 -0
- package/src/Bundle/Bundle.ts +215 -0
- package/src/Bundle/Docker.ts +213 -0
- package/src/Bundle/TempRoot.ts +104 -0
- package/src/Bundle/index.ts +3 -0
- package/src/Cli/Cli.ts +23 -0
- package/src/Cli/Event.ts +32 -0
- package/src/Cli/InkCLI.tsx +60 -0
- package/src/Cli/NamespaceTree.ts +199 -0
- package/src/Cli/Reporter.ts +8 -0
- package/src/Cli/components/ApprovePlan.tsx +44 -0
- package/src/Cli/components/Plan.tsx +148 -0
- package/src/Cli/components/PlanProgress.tsx +325 -0
- package/src/Cli/index.ts +2 -0
- package/src/Cloudflare/Account.ts +38 -0
- package/src/Cloudflare/Container.ts +1345 -0
- package/src/Cloudflare/KV/Delete.ts +38 -0
- package/src/Cloudflare/KV/Get.ts +40 -0
- package/src/Cloudflare/KV/GetWithMetadata.ts +54 -0
- package/src/Cloudflare/KV/List.ts +45 -0
- package/src/Cloudflare/KV/Namespace.ts +150 -0
- package/src/Cloudflare/KV/NamespaceBinding.ts +25 -0
- package/src/Cloudflare/KV/Put.ts +59 -0
- package/src/Cloudflare/KV/index.ts +6 -0
- package/src/Cloudflare/Logs.ts +139 -0
- package/src/Cloudflare/Providers.ts +75 -0
- package/src/Cloudflare/R2/Bucket.ts +173 -0
- package/src/Cloudflare/R2/BucketBinding.ts +31 -0
- package/src/Cloudflare/R2/CreateMultipartUpload.ts +59 -0
- package/src/Cloudflare/R2/DeleteObject.ts +41 -0
- package/src/Cloudflare/R2/GetObject.ts +47 -0
- package/src/Cloudflare/R2/HeadObject.ts +41 -0
- package/src/Cloudflare/R2/ListObjects.ts +45 -0
- package/src/Cloudflare/R2/MultipartUploadClient.ts +40 -0
- package/src/Cloudflare/R2/PutObject.ts +55 -0
- package/src/Cloudflare/R2/ResumeMultipartUpload.ts +48 -0
- package/src/Cloudflare/R2/UploadValue.ts +10 -0
- package/src/Cloudflare/R2/index.ts +9 -0
- package/src/Cloudflare/StageConfig.ts +8 -0
- package/src/Cloudflare/Website/StaticSite.ts +35 -0
- package/src/Cloudflare/Website/TanstackStart.ts +14 -0
- package/src/Cloudflare/Website/index.ts +2 -0
- package/src/Cloudflare/Workers/Assets.ts +286 -0
- package/src/Cloudflare/Workers/ConfigProvider.ts +9 -0
- package/src/Cloudflare/Workers/DurableObject.ts +558 -0
- package/src/Cloudflare/Workers/DynamicWorker.ts +144 -0
- package/src/Cloudflare/Workers/Fetch.ts +142 -0
- package/src/Cloudflare/Workers/Fetcher.ts +280 -0
- package/src/Cloudflare/Workers/HttpServer.ts +159 -0
- package/src/Cloudflare/Workers/Rpc.ts +472 -0
- package/src/Cloudflare/Workers/WebSocket.ts +44 -0
- package/src/Cloudflare/Workers/Worker.ts +1222 -0
- package/src/Cloudflare/Workers/Workflow.ts +400 -0
- package/src/Cloudflare/Workers/cloudflare_workers.ts +25 -0
- package/src/Cloudflare/Workers/index.ts +10 -0
- package/src/Cloudflare/index.ts +7 -0
- package/src/Cloudflare/stream.ts +20 -0
- package/src/Config.ts +31 -0
- package/src/Construct.ts +75 -0
- package/src/Daemon/Client.ts +112 -0
- package/src/Daemon/Config.ts +28 -0
- package/src/Daemon/Errors.ts +32 -0
- package/src/Daemon/Lock.ts +162 -0
- package/src/Daemon/ProcessRegistry.ts +284 -0
- package/src/Daemon/RpcSchema.ts +43 -0
- package/src/Daemon/RpcServer.ts +231 -0
- package/src/Daemon/index.ts +25 -0
- package/src/Destroy.ts +15 -0
- package/src/Diff.ts +142 -0
- package/src/ExecutionContext.ts +30 -0
- package/src/FQN.ts +94 -0
- package/src/Http.ts +105 -0
- package/src/Input.ts +91 -0
- package/src/InstanceId.ts +19 -0
- package/src/Kubernetes/ConfigMap.ts +59 -0
- package/src/Kubernetes/Deployment.ts +123 -0
- package/src/Kubernetes/Job.ts +82 -0
- package/src/Kubernetes/Namespace.ts +49 -0
- package/src/Kubernetes/Object.ts +99 -0
- package/src/Kubernetes/Service.ts +78 -0
- package/src/Kubernetes/ServiceAccount.ts +49 -0
- package/src/Kubernetes/client.ts +298 -0
- package/src/Kubernetes/common.ts +23 -0
- package/src/Kubernetes/index.ts +11 -0
- package/src/Kubernetes/types.ts +177 -0
- package/src/Namespace.ts +64 -0
- package/src/Observability.ts +0 -0
- package/src/Output.ts +584 -0
- package/src/Phase.ts +5 -0
- package/src/PhysicalName.ts +62 -0
- package/src/Plan.ts +899 -0
- package/src/Platform.ts +398 -0
- package/src/Provider.ts +156 -0
- package/src/Ref.ts +46 -0
- package/src/RemovalPolicy.ts +51 -0
- package/src/Resource.ts +387 -0
- package/src/SQLite/BunSQLite.ts +132 -0
- package/src/SQLite/SQLite.ts +19 -0
- package/src/SQLite/SQLiteConnection.ts +55 -0
- package/src/SQLite/SQLiteError.ts +904 -0
- package/src/SQLite/SQLiteStatement.ts +24 -0
- package/src/SQLite/index.ts +6 -0
- package/src/SQLite/libSQL.ts +194 -0
- package/src/Schema.ts +333 -0
- package/src/Self.ts +10 -0
- package/src/Server/Process.ts +30 -0
- package/src/Server/S3BucketEventSource.ts +100 -0
- package/src/Server/SQSQueueEventSource.ts +77 -0
- package/src/Server/index.ts +3 -0
- package/src/Serverless/Function.ts +18 -0
- package/src/Serverless/index.ts +1 -0
- package/src/Spawn.ts +23 -0
- package/src/Stack.ts +84 -0
- package/src/Stage.ts +3 -0
- package/src/State/InMemoryState.ts +86 -0
- package/src/State/LocalState.ts +120 -0
- package/src/State/ResourceState.ts +121 -0
- package/src/State/State.ts +72 -0
- package/src/State/index.ts +4 -0
- package/src/Tags.ts +104 -0
- package/src/Test/TestCli.ts +21 -0
- package/src/Test/TestState.ts +37 -0
- package/src/Test/Vitest.ts +503 -0
- package/src/Test/index.ts +3 -0
- package/src/Trait.ts +105 -0
- package/src/Util/base32.ts +44 -0
- package/src/Util/camel.ts +23 -0
- package/src/Util/class.ts +7 -0
- package/src/Util/effect.ts +57 -0
- package/src/Util/index.ts +15 -0
- package/src/Util/instance.ts +9 -0
- package/src/Util/pointer.ts +5 -0
- package/src/Util/schema-to-type.ts +456 -0
- package/src/Util/service.ts +16 -0
- package/src/Util/sha256.ts +27 -0
- package/src/Util/stable.ts +41 -0
- package/src/Util/todo.ts +4 -0
- package/src/Util/types.ts +25 -0
- package/src/Util/unknown.ts +19 -0
- package/src/Util/zip.ts +27 -0
- package/src/index.ts +29 -26
- package/README.md +0 -179
- package/lib/$.d.ts +0 -5
- package/lib/$.d.ts.map +0 -1
- package/lib/$.js +0 -9
- package/lib/$.js.map +0 -1
- package/lib/app.d.ts +0 -15
- package/lib/app.d.ts.map +0 -1
- package/lib/app.js +0 -7
- package/lib/app.js.map +0 -1
- package/lib/apply.d.ts +0 -18
- package/lib/apply.d.ts.map +0 -1
- package/lib/apply.js +0 -567
- package/lib/apply.js.map +0 -1
- package/lib/assert-never.d.ts +0 -12
- package/lib/assert-never.d.ts.map +0 -1
- package/lib/assert-never.js +0 -11
- package/lib/assert-never.js.map +0 -1
- package/lib/aws/account.d.ts +0 -27
- package/lib/aws/account.d.ts.map +0 -1
- package/lib/aws/account.js +0 -33
- package/lib/aws/account.js.map +0 -1
- package/lib/aws/arn.d.ts +0 -2
- package/lib/aws/arn.d.ts.map +0 -1
- package/lib/aws/arn.js +0 -1
- package/lib/aws/arn.js.map +0 -1
- package/lib/aws/assets.d.ts +0 -8
- package/lib/aws/assets.d.ts.map +0 -1
- package/lib/aws/assets.js +0 -4
- package/lib/aws/assets.js.map +0 -1
- package/lib/aws/bundle.d.ts +0 -4
- package/lib/aws/bundle.d.ts.map +0 -1
- package/lib/aws/bundle.js +0 -4
- package/lib/aws/bundle.js.map +0 -1
- package/lib/aws/client.d.ts +0 -8
- package/lib/aws/client.d.ts.map +0 -1
- package/lib/aws/client.js +0 -27
- package/lib/aws/client.js.map +0 -1
- package/lib/aws/config.d.ts +0 -15
- package/lib/aws/config.d.ts.map +0 -1
- package/lib/aws/config.js +0 -1
- package/lib/aws/config.js.map +0 -1
- package/lib/aws/credentials.d.ts +0 -156
- package/lib/aws/credentials.d.ts.map +0 -1
- package/lib/aws/credentials.js +0 -196
- package/lib/aws/credentials.js.map +0 -1
- package/lib/aws/dynamodb/attribute-value.d.ts +0 -20
- package/lib/aws/dynamodb/attribute-value.d.ts.map +0 -1
- package/lib/aws/dynamodb/attribute-value.js +0 -217
- package/lib/aws/dynamodb/attribute-value.js.map +0 -1
- package/lib/aws/dynamodb/client.d.ts +0 -12
- package/lib/aws/dynamodb/client.d.ts.map +0 -1
- package/lib/aws/dynamodb/client.js +0 -11
- package/lib/aws/dynamodb/client.js.map +0 -1
- package/lib/aws/dynamodb/expr.d.ts +0 -41
- package/lib/aws/dynamodb/expr.d.ts.map +0 -1
- package/lib/aws/dynamodb/expr.js +0 -1
- package/lib/aws/dynamodb/expr.js.map +0 -1
- package/lib/aws/dynamodb/index.d.ts +0 -10
- package/lib/aws/dynamodb/index.d.ts.map +0 -1
- package/lib/aws/dynamodb/index.js +0 -9
- package/lib/aws/dynamodb/index.js.map +0 -1
- package/lib/aws/dynamodb/projection.d.ts +0 -25
- package/lib/aws/dynamodb/projection.d.ts.map +0 -1
- package/lib/aws/dynamodb/projection.js +0 -1
- package/lib/aws/dynamodb/projection.js.map +0 -1
- package/lib/aws/dynamodb/secondary-index.d.ts +0 -26
- package/lib/aws/dynamodb/secondary-index.d.ts.map +0 -1
- package/lib/aws/dynamodb/secondary-index.js +0 -4
- package/lib/aws/dynamodb/secondary-index.js.map +0 -1
- package/lib/aws/dynamodb/table.d.ts +0 -59
- package/lib/aws/dynamodb/table.d.ts.map +0 -1
- package/lib/aws/dynamodb/table.get-item.d.ts +0 -57
- package/lib/aws/dynamodb/table.get-item.d.ts.map +0 -1
- package/lib/aws/dynamodb/table.get-item.js +0 -77
- package/lib/aws/dynamodb/table.get-item.js.map +0 -1
- package/lib/aws/dynamodb/table.js +0 -4
- package/lib/aws/dynamodb/table.js.map +0 -1
- package/lib/aws/dynamodb/table.provider.d.ts +0 -7
- package/lib/aws/dynamodb/table.provider.d.ts.map +0 -1
- package/lib/aws/dynamodb/table.provider.js +0 -196
- package/lib/aws/dynamodb/table.provider.js.map +0 -1
- package/lib/aws/ec2/client.d.ts +0 -12
- package/lib/aws/ec2/client.d.ts.map +0 -1
- package/lib/aws/ec2/client.js +0 -11
- package/lib/aws/ec2/client.js.map +0 -1
- package/lib/aws/ec2/index.d.ts +0 -15
- package/lib/aws/ec2/index.d.ts.map +0 -1
- package/lib/aws/ec2/index.js +0 -15
- package/lib/aws/ec2/index.js.map +0 -1
- package/lib/aws/ec2/internet-gateway.d.ts +0 -65
- package/lib/aws/ec2/internet-gateway.d.ts.map +0 -1
- package/lib/aws/ec2/internet-gateway.js +0 -4
- package/lib/aws/ec2/internet-gateway.js.map +0 -1
- package/lib/aws/ec2/internet-gateway.provider.d.ts +0 -6
- package/lib/aws/ec2/internet-gateway.provider.d.ts.map +0 -1
- package/lib/aws/ec2/internet-gateway.provider.js +0 -193
- package/lib/aws/ec2/internet-gateway.provider.js.map +0 -1
- package/lib/aws/ec2/route-table-association.d.ts +0 -63
- package/lib/aws/ec2/route-table-association.d.ts.map +0 -1
- package/lib/aws/ec2/route-table-association.js +0 -4
- package/lib/aws/ec2/route-table-association.js.map +0 -1
- package/lib/aws/ec2/route-table-association.provider.d.ts +0 -4
- package/lib/aws/ec2/route-table-association.provider.d.ts.map +0 -1
- package/lib/aws/ec2/route-table-association.provider.js +0 -121
- package/lib/aws/ec2/route-table-association.provider.js.map +0 -1
- package/lib/aws/ec2/route-table.d.ts +0 -159
- package/lib/aws/ec2/route-table.d.ts.map +0 -1
- package/lib/aws/ec2/route-table.js +0 -4
- package/lib/aws/ec2/route-table.js.map +0 -1
- package/lib/aws/ec2/route-table.provider.d.ts +0 -6
- package/lib/aws/ec2/route-table.provider.d.ts.map +0 -1
- package/lib/aws/ec2/route-table.provider.js +0 -213
- package/lib/aws/ec2/route-table.provider.js.map +0 -1
- package/lib/aws/ec2/route.d.ts +0 -155
- package/lib/aws/ec2/route.d.ts.map +0 -1
- package/lib/aws/ec2/route.js +0 -3
- package/lib/aws/ec2/route.js.map +0 -1
- package/lib/aws/ec2/route.provider.d.ts +0 -4
- package/lib/aws/ec2/route.provider.d.ts.map +0 -1
- package/lib/aws/ec2/route.provider.js +0 -166
- package/lib/aws/ec2/route.provider.js.map +0 -1
- package/lib/aws/ec2/subnet.d.ts +0 -175
- package/lib/aws/ec2/subnet.d.ts.map +0 -1
- package/lib/aws/ec2/subnet.js +0 -4
- package/lib/aws/ec2/subnet.js.map +0 -1
- package/lib/aws/ec2/subnet.provider.d.ts +0 -4
- package/lib/aws/ec2/subnet.provider.d.ts.map +0 -1
- package/lib/aws/ec2/subnet.provider.js +0 -250
- package/lib/aws/ec2/subnet.provider.js.map +0 -1
- package/lib/aws/ec2/vpc.d.ts +0 -136
- package/lib/aws/ec2/vpc.d.ts.map +0 -1
- package/lib/aws/ec2/vpc.js +0 -4
- package/lib/aws/ec2/vpc.js.map +0 -1
- package/lib/aws/ec2/vpc.provider.d.ts +0 -6
- package/lib/aws/ec2/vpc.provider.d.ts.map +0 -1
- package/lib/aws/ec2/vpc.provider.js +0 -205
- package/lib/aws/ec2/vpc.provider.js.map +0 -1
- package/lib/aws/iam.d.ts +0 -23
- package/lib/aws/iam.d.ts.map +0 -1
- package/lib/aws/iam.js +0 -7
- package/lib/aws/iam.js.map +0 -1
- package/lib/aws/index.d.ts +0 -28
- package/lib/aws/index.d.ts.map +0 -1
- package/lib/aws/index.js +0 -21
- package/lib/aws/index.js.map +0 -1
- package/lib/aws/lambda/client.d.ts +0 -8
- package/lib/aws/lambda/client.d.ts.map +0 -1
- package/lib/aws/lambda/client.js +0 -7
- package/lib/aws/lambda/client.js.map +0 -1
- package/lib/aws/lambda/consume.d.ts +0 -16
- package/lib/aws/lambda/consume.d.ts.map +0 -1
- package/lib/aws/lambda/consume.js +0 -30
- package/lib/aws/lambda/consume.js.map +0 -1
- package/lib/aws/lambda/function.d.ts +0 -41
- package/lib/aws/lambda/function.d.ts.map +0 -1
- package/lib/aws/lambda/function.handler.d.ts +0 -7
- package/lib/aws/lambda/function.handler.d.ts.map +0 -1
- package/lib/aws/lambda/function.handler.js +0 -8
- package/lib/aws/lambda/function.handler.js.map +0 -1
- package/lib/aws/lambda/function.invoke.d.ts +0 -12
- package/lib/aws/lambda/function.invoke.d.ts.map +0 -1
- package/lib/aws/lambda/function.invoke.js +0 -33
- package/lib/aws/lambda/function.invoke.js.map +0 -1
- package/lib/aws/lambda/function.js +0 -3
- package/lib/aws/lambda/function.js.map +0 -1
- package/lib/aws/lambda/function.provider.d.ts +0 -10
- package/lib/aws/lambda/function.provider.d.ts.map +0 -1
- package/lib/aws/lambda/function.provider.js +0 -464
- package/lib/aws/lambda/function.provider.js.map +0 -1
- package/lib/aws/lambda/index.d.ts +0 -9
- package/lib/aws/lambda/index.d.ts.map +0 -1
- package/lib/aws/lambda/index.js +0 -10
- package/lib/aws/lambda/index.js.map +0 -1
- package/lib/aws/lambda/serve.d.ts +0 -12
- package/lib/aws/lambda/serve.d.ts.map +0 -1
- package/lib/aws/lambda/serve.js +0 -7
- package/lib/aws/lambda/serve.js.map +0 -1
- package/lib/aws/parse-ini.d.ts +0 -4
- package/lib/aws/parse-ini.d.ts.map +0 -1
- package/lib/aws/parse-ini.js +0 -67
- package/lib/aws/parse-ini.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/region.d.ts +0 -31
- package/lib/aws/region.d.ts.map +0 -1
- package/lib/aws/region.js +0 -46
- package/lib/aws/region.js.map +0 -1
- package/lib/aws/s3.d.ts +0 -8
- package/lib/aws/s3.d.ts.map +0 -1
- package/lib/aws/s3.js +0 -7
- package/lib/aws/s3.js.map +0 -1
- package/lib/aws/sqs/client.d.ts +0 -12
- package/lib/aws/sqs/client.d.ts.map +0 -1
- package/lib/aws/sqs/client.js +0 -11
- package/lib/aws/sqs/client.js.map +0 -1
- package/lib/aws/sqs/index.d.ts +0 -8
- package/lib/aws/sqs/index.d.ts.map +0 -1
- package/lib/aws/sqs/index.js +0 -8
- package/lib/aws/sqs/index.js.map +0 -1
- package/lib/aws/sqs/queue.consume.d.ts +0 -12
- package/lib/aws/sqs/queue.consume.d.ts.map +0 -1
- package/lib/aws/sqs/queue.consume.js +0 -2
- package/lib/aws/sqs/queue.consume.js.map +0 -1
- package/lib/aws/sqs/queue.d.ts +0 -81
- package/lib/aws/sqs/queue.d.ts.map +0 -1
- package/lib/aws/sqs/queue.event-source.d.ts +0 -22
- package/lib/aws/sqs/queue.event-source.d.ts.map +0 -1
- package/lib/aws/sqs/queue.event-source.js +0 -130
- package/lib/aws/sqs/queue.event-source.js.map +0 -1
- package/lib/aws/sqs/queue.js +0 -3
- package/lib/aws/sqs/queue.js.map +0 -1
- package/lib/aws/sqs/queue.provider.d.ts +0 -6
- package/lib/aws/sqs/queue.provider.d.ts.map +0 -1
- package/lib/aws/sqs/queue.provider.js +0 -87
- package/lib/aws/sqs/queue.provider.js.map +0 -1
- package/lib/aws/sqs/queue.send-message.d.ts +0 -13
- package/lib/aws/sqs/queue.send-message.d.ts.map +0 -1
- package/lib/aws/sqs/queue.send-message.js +0 -34
- package/lib/aws/sqs/queue.send-message.js.map +0 -1
- package/lib/aws/sts.d.ts +0 -8
- package/lib/aws/sts.d.ts.map +0 -1
- package/lib/aws/sts.js +0 -7
- package/lib/aws/sts.js.map +0 -1
- package/lib/aws/zip.d.ts +0 -3
- package/lib/aws/zip.d.ts.map +0 -1
- package/lib/aws/zip.js +0 -12
- package/lib/aws/zip.js.map +0 -1
- package/lib/binding.d.ts +0 -106
- package/lib/binding.d.ts.map +0 -1
- package/lib/binding.js +0 -27
- package/lib/binding.js.map +0 -1
- package/lib/capability.d.ts +0 -49
- package/lib/capability.d.ts.map +0 -1
- package/lib/capability.js +0 -1
- package/lib/capability.js.map +0 -1
- package/lib/cli/components/ApprovePlan.d.ts +0 -8
- package/lib/cli/components/ApprovePlan.d.ts.map +0 -1
- package/lib/cli/components/ApprovePlan.js +0 -30
- package/lib/cli/components/ApprovePlan.js.map +0 -1
- package/lib/cli/components/Plan.d.ts +0 -7
- package/lib/cli/components/Plan.d.ts.map +0 -1
- package/lib/cli/components/Plan.js +0 -100
- package/lib/cli/components/Plan.js.map +0 -1
- package/lib/cli/components/PlanProgress.d.ts +0 -13
- package/lib/cli/components/PlanProgress.d.ts.map +0 -1
- package/lib/cli/components/PlanProgress.js +0 -176
- package/lib/cli/components/PlanProgress.js.map +0 -1
- package/lib/cli/ink-service.d.ts +0 -4
- package/lib/cli/ink-service.d.ts.map +0 -1
- package/lib/cli/ink-service.js +0 -43
- package/lib/cli/ink-service.js.map +0 -1
- package/lib/cli/service.d.ts +0 -21
- package/lib/cli/service.d.ts.map +0 -1
- package/lib/cli/service.js +0 -5
- package/lib/cli/service.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/api.d.ts +0 -36
- package/lib/cloudflare/api.d.ts.map +0 -1
- package/lib/cloudflare/api.js +0 -100
- package/lib/cloudflare/api.js.map +0 -1
- package/lib/cloudflare/config.d.ts +0 -9
- package/lib/cloudflare/config.d.ts.map +0 -1
- package/lib/cloudflare/config.js +0 -1
- package/lib/cloudflare/config.js.map +0 -1
- package/lib/cloudflare/context.d.ts +0 -27
- package/lib/cloudflare/context.d.ts.map +0 -1
- package/lib/cloudflare/context.js +0 -24
- package/lib/cloudflare/context.js.map +0 -1
- package/lib/cloudflare/index.d.ts +0 -8
- package/lib/cloudflare/index.d.ts.map +0 -1
- package/lib/cloudflare/index.js +0 -8
- package/lib/cloudflare/index.js.map +0 -1
- package/lib/cloudflare/kv/index.d.ts +0 -4
- package/lib/cloudflare/kv/index.d.ts.map +0 -1
- package/lib/cloudflare/kv/index.js +0 -4
- package/lib/cloudflare/kv/index.js.map +0 -1
- package/lib/cloudflare/kv/namespace.binding.d.ts +0 -10
- package/lib/cloudflare/kv/namespace.binding.d.ts.map +0 -1
- package/lib/cloudflare/kv/namespace.binding.js +0 -15
- package/lib/cloudflare/kv/namespace.binding.js.map +0 -1
- package/lib/cloudflare/kv/namespace.client.d.ts +0 -11
- package/lib/cloudflare/kv/namespace.client.d.ts.map +0 -1
- package/lib/cloudflare/kv/namespace.client.js +0 -31
- package/lib/cloudflare/kv/namespace.client.js.map +0 -1
- package/lib/cloudflare/kv/namespace.d.ts +0 -24
- package/lib/cloudflare/kv/namespace.d.ts.map +0 -1
- package/lib/cloudflare/kv/namespace.js +0 -3
- package/lib/cloudflare/kv/namespace.js.map +0 -1
- package/lib/cloudflare/kv/namespace.provider.d.ts +0 -6
- package/lib/cloudflare/kv/namespace.provider.d.ts.map +0 -1
- package/lib/cloudflare/kv/namespace.provider.js +0 -87
- package/lib/cloudflare/kv/namespace.provider.js.map +0 -1
- package/lib/cloudflare/live.d.ts +0 -11
- package/lib/cloudflare/live.d.ts.map +0 -1
- package/lib/cloudflare/live.js +0 -15
- package/lib/cloudflare/live.js.map +0 -1
- package/lib/cloudflare/r2/bucket.binding.d.ts +0 -10
- package/lib/cloudflare/r2/bucket.binding.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.binding.js +0 -18
- package/lib/cloudflare/r2/bucket.binding.js.map +0 -1
- package/lib/cloudflare/r2/bucket.client.d.ts +0 -8
- package/lib/cloudflare/r2/bucket.client.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.client.js +0 -9
- package/lib/cloudflare/r2/bucket.client.js.map +0 -1
- package/lib/cloudflare/r2/bucket.d.ts +0 -33
- package/lib/cloudflare/r2/bucket.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.del.d.ts +0 -4
- package/lib/cloudflare/r2/bucket.del.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.del.js +0 -7
- package/lib/cloudflare/r2/bucket.del.js.map +0 -1
- package/lib/cloudflare/r2/bucket.get.d.ts +0 -5
- package/lib/cloudflare/r2/bucket.get.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.get.js +0 -7
- package/lib/cloudflare/r2/bucket.get.js.map +0 -1
- package/lib/cloudflare/r2/bucket.head.d.ts +0 -4
- package/lib/cloudflare/r2/bucket.head.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.head.js +0 -7
- package/lib/cloudflare/r2/bucket.head.js.map +0 -1
- package/lib/cloudflare/r2/bucket.js +0 -3
- package/lib/cloudflare/r2/bucket.js.map +0 -1
- package/lib/cloudflare/r2/bucket.list.d.ts +0 -5
- package/lib/cloudflare/r2/bucket.list.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.list.js +0 -7
- package/lib/cloudflare/r2/bucket.list.js.map +0 -1
- package/lib/cloudflare/r2/bucket.multipart.d.ts +0 -19
- package/lib/cloudflare/r2/bucket.multipart.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.multipart.js +0 -25
- package/lib/cloudflare/r2/bucket.multipart.js.map +0 -1
- package/lib/cloudflare/r2/bucket.provider.d.ts +0 -5
- package/lib/cloudflare/r2/bucket.provider.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.provider.js +0 -78
- package/lib/cloudflare/r2/bucket.provider.js.map +0 -1
- package/lib/cloudflare/r2/bucket.put.d.ts +0 -6
- package/lib/cloudflare/r2/bucket.put.d.ts.map +0 -1
- package/lib/cloudflare/r2/bucket.put.js +0 -8
- package/lib/cloudflare/r2/bucket.put.js.map +0 -1
- package/lib/cloudflare/r2/index.d.ts +0 -10
- package/lib/cloudflare/r2/index.d.ts.map +0 -1
- package/lib/cloudflare/r2/index.js +0 -10
- package/lib/cloudflare/r2/index.js.map +0 -1
- package/lib/cloudflare/stream.d.ts +0 -10
- package/lib/cloudflare/stream.d.ts.map +0 -1
- package/lib/cloudflare/stream.js +0 -16
- package/lib/cloudflare/stream.js.map +0 -1
- package/lib/cloudflare/worker/assets.fetch.d.ts +0 -9
- package/lib/cloudflare/worker/assets.fetch.d.ts.map +0 -1
- package/lib/cloudflare/worker/assets.fetch.js +0 -12
- package/lib/cloudflare/worker/assets.fetch.js.map +0 -1
- package/lib/cloudflare/worker/assets.provider.d.ts +0 -66
- package/lib/cloudflare/worker/assets.provider.d.ts.map +0 -1
- package/lib/cloudflare/worker/assets.provider.js +0 -145
- package/lib/cloudflare/worker/assets.provider.js.map +0 -1
- package/lib/cloudflare/worker/index.d.ts +0 -5
- package/lib/cloudflare/worker/index.d.ts.map +0 -1
- package/lib/cloudflare/worker/index.js +0 -5
- package/lib/cloudflare/worker/index.js.map +0 -1
- package/lib/cloudflare/worker/worker.d.ts +0 -66
- package/lib/cloudflare/worker/worker.d.ts.map +0 -1
- package/lib/cloudflare/worker/worker.handler.d.ts +0 -11
- package/lib/cloudflare/worker/worker.handler.d.ts.map +0 -1
- package/lib/cloudflare/worker/worker.handler.js +0 -15
- package/lib/cloudflare/worker/worker.handler.js.map +0 -1
- package/lib/cloudflare/worker/worker.js +0 -4
- package/lib/cloudflare/worker/worker.js.map +0 -1
- package/lib/cloudflare/worker/worker.provider.d.ts +0 -10
- package/lib/cloudflare/worker/worker.provider.d.ts.map +0 -1
- package/lib/cloudflare/worker/worker.provider.js +0 -225
- package/lib/cloudflare/worker/worker.provider.js.map +0 -1
- package/lib/cloudflare/worker/worker.serve.d.ts +0 -39
- package/lib/cloudflare/worker/worker.serve.d.ts.map +0 -1
- package/lib/cloudflare/worker/worker.serve.js +0 -4
- package/lib/cloudflare/worker/worker.serve.js.map +0 -1
- package/lib/data.d.ts +0 -3
- package/lib/data.d.ts.map +0 -1
- package/lib/data.js +0 -8
- package/lib/data.js.map +0 -1
- package/lib/destroy.d.ts +0 -2
- package/lib/destroy.d.ts.map +0 -1
- package/lib/destroy.js +0 -3
- package/lib/destroy.js.map +0 -1
- package/lib/diff.d.ts +0 -18
- package/lib/diff.d.ts.map +0 -1
- package/lib/diff.js +0 -22
- package/lib/diff.js.map +0 -1
- package/lib/dot-alchemy.d.ts +0 -10
- package/lib/dot-alchemy.d.ts.map +0 -1
- package/lib/dot-alchemy.js +0 -15
- package/lib/dot-alchemy.js.map +0 -1
- package/lib/env.d.ts +0 -9
- package/lib/env.d.ts.map +0 -1
- package/lib/env.js +0 -19
- package/lib/env.js.map +0 -1
- package/lib/esbuild.d.ts +0 -28
- package/lib/esbuild.d.ts.map +0 -1
- package/lib/esbuild.js +0 -63
- package/lib/esbuild.js.map +0 -1
- package/lib/event.d.ts +0 -16
- package/lib/event.d.ts.map +0 -1
- package/lib/event.js +0 -1
- package/lib/event.js.map +0 -1
- package/lib/exports.d.ts +0 -9
- package/lib/exports.d.ts.map +0 -1
- package/lib/exports.js +0 -13
- package/lib/exports.js.map +0 -1
- package/lib/index.d.ts +0 -27
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -27
- package/lib/index.js.map +0 -1
- package/lib/input.d.ts +0 -32
- package/lib/input.d.ts.map +0 -1
- package/lib/input.js +0 -1
- package/lib/input.js.map +0 -1
- package/lib/instance-id.d.ts +0 -12
- package/lib/instance-id.d.ts.map +0 -1
- package/lib/instance-id.js +0 -16
- package/lib/instance-id.js.map +0 -1
- package/lib/output.d.ts +0 -145
- package/lib/output.d.ts.map +0 -1
- package/lib/output.js +0 -283
- package/lib/output.js.map +0 -1
- package/lib/phase.d.ts +0 -2
- package/lib/phase.d.ts.map +0 -1
- package/lib/phase.js +0 -1
- package/lib/phase.js.map +0 -1
- package/lib/physical-name.d.ts +0 -28
- package/lib/physical-name.d.ts.map +0 -1
- package/lib/physical-name.js +0 -55
- package/lib/physical-name.js.map +0 -1
- package/lib/plan.d.ts +0 -135
- package/lib/plan.d.ts.map +0 -1
- package/lib/plan.js +0 -686
- package/lib/plan.js.map +0 -1
- package/lib/policy.d.ts +0 -54
- package/lib/policy.d.ts.map +0 -1
- package/lib/policy.js +0 -24
- package/lib/policy.js.map +0 -1
- package/lib/provider.d.ts +0 -71
- package/lib/provider.d.ts.map +0 -1
- package/lib/provider.js +0 -11
- package/lib/provider.js.map +0 -1
- package/lib/ref.d.ts +0 -14
- package/lib/ref.d.ts.map +0 -1
- package/lib/ref.js +0 -21
- package/lib/ref.js.map +0 -1
- package/lib/reporter.d.ts +0 -8
- package/lib/reporter.d.ts.map +0 -1
- package/lib/reporter.js +0 -4
- package/lib/reporter.js.map +0 -1
- package/lib/resource.d.ts +0 -36
- package/lib/resource.d.ts.map +0 -1
- package/lib/resource.js +0 -26
- package/lib/resource.js.map +0 -1
- package/lib/runtime.d.ts +0 -40
- package/lib/runtime.d.ts.map +0 -1
- package/lib/runtime.js +0 -54
- package/lib/runtime.js.map +0 -1
- package/lib/schema.d.ts +0 -37
- package/lib/schema.d.ts.map +0 -1
- package/lib/schema.js +0 -61
- package/lib/schema.js.map +0 -1
- package/lib/service.d.ts +0 -36
- package/lib/service.d.ts.map +0 -1
- package/lib/service.js +0 -4
- package/lib/service.js.map +0 -1
- package/lib/sha256.d.ts +0 -5
- package/lib/sha256.d.ts.map +0 -1
- package/lib/sha256.js +0 -16
- package/lib/sha256.js.map +0 -1
- package/lib/stack.d.ts +0 -60
- package/lib/stack.d.ts.map +0 -1
- package/lib/stack.js +0 -11
- package/lib/stack.js.map +0 -1
- package/lib/stage.d.ts +0 -39
- package/lib/stage.d.ts.map +0 -1
- package/lib/stage.js +0 -32
- package/lib/stage.js.map +0 -1
- package/lib/state.d.ts +0 -157
- package/lib/state.d.ts.map +0 -1
- package/lib/state.js +0 -71
- package/lib/state.js.map +0 -1
- package/lib/tags.d.ts +0 -32
- package/lib/tags.d.ts.map +0 -1
- package/lib/tags.js +0 -49
- package/lib/tags.js.map +0 -1
- package/lib/test.d.ts +0 -35
- package/lib/test.d.ts.map +0 -1
- package/lib/test.js +0 -68
- package/lib/test.js.map +0 -1
- package/lib/todo.d.ts +0 -3
- package/lib/todo.d.ts.map +0 -1
- package/lib/todo.js +0 -3
- package/lib/todo.js.map +0 -1
- package/lib/tsconfig.test.tsbuildinfo +0 -1
- package/lib/type.d.ts +0 -6
- package/lib/type.d.ts.map +0 -1
- package/lib/type.js +0 -3
- package/lib/type.js.map +0 -1
- package/lib/unknown.d.ts +0 -4
- package/lib/unknown.d.ts.map +0 -1
- package/lib/unknown.js +0 -4
- package/lib/unknown.js.map +0 -1
- package/lib/user.d.ts +0 -3
- package/lib/user.d.ts.map +0 -1
- package/lib/user.js +0 -3
- package/lib/user.js.map +0 -1
- package/lib/util.d.ts +0 -6
- package/lib/util.d.ts.map +0 -1
- package/lib/util.js +0 -9
- package/lib/util.js.map +0 -1
- package/src/$.ts +0 -17
- package/src/app.ts +0 -15
- package/src/apply.ts +0 -858
- package/src/aws/account.ts +0 -57
- package/src/aws/assets.ts +0 -8
- package/src/aws/bundle.ts +0 -5
- package/src/aws/client.ts +0 -46
- package/src/aws/config.ts +0 -16
- package/src/aws/credentials.ts +0 -444
- package/src/aws/dynamodb/attribute-value.ts +0 -240
- package/src/aws/dynamodb/client.ts +0 -20
- package/src/aws/dynamodb/index.ts +0 -12
- package/src/aws/dynamodb/projection.ts +0 -159
- package/src/aws/dynamodb/secondary-index.ts +0 -45
- package/src/aws/dynamodb/table.get-item.ts +0 -173
- package/src/aws/dynamodb/table.provider.ts +0 -288
- package/src/aws/dynamodb/table.ts +0 -101
- package/src/aws/ec2/client.ts +0 -20
- package/src/aws/ec2/index.ts +0 -15
- package/src/aws/ec2/internet-gateway.provider.ts +0 -316
- package/src/aws/ec2/internet-gateway.ts +0 -79
- package/src/aws/ec2/route-table-association.provider.ts +0 -214
- package/src/aws/ec2/route-table-association.ts +0 -82
- package/src/aws/ec2/route-table.provider.ts +0 -306
- package/src/aws/ec2/route-table.ts +0 -175
- package/src/aws/ec2/route.provider.ts +0 -213
- package/src/aws/ec2/route.ts +0 -192
- package/src/aws/ec2/subnet.provider.ts +0 -358
- package/src/aws/ec2/subnet.ts +0 -213
- package/src/aws/ec2/vpc.provider.ts +0 -294
- package/src/aws/ec2/vpc.ts +0 -165
- package/src/aws/iam.ts +0 -30
- package/src/aws/index.ts +0 -63
- package/src/aws/lambda/client.ts +0 -14
- package/src/aws/lambda/consume.ts +0 -64
- package/src/aws/lambda/function.handler.ts +0 -30
- package/src/aws/lambda/function.invoke.ts +0 -44
- package/src/aws/lambda/function.provider.ts +0 -675
- package/src/aws/lambda/function.ts +0 -48
- package/src/aws/lambda/index.ts +0 -11
- package/src/aws/lambda/serve.ts +0 -29
- package/src/aws/parse-ini.ts +0 -80
- package/src/aws/profile.ts +0 -3
- package/src/aws/region.ts +0 -76
- package/src/aws/s3.ts +0 -10
- package/src/aws/sqs/client.ts +0 -20
- package/src/aws/sqs/index.ts +0 -8
- package/src/aws/sqs/queue.consume.ts +0 -13
- package/src/aws/sqs/queue.event-source.ts +0 -227
- package/src/aws/sqs/queue.provider.ts +0 -108
- package/src/aws/sqs/queue.send-message.ts +0 -48
- package/src/aws/sqs/queue.ts +0 -91
- package/src/aws/sts.ts +0 -13
- package/src/aws/zip.ts +0 -17
- package/src/binding.ts +0 -240
- package/src/capability.ts +0 -63
- package/src/cli/components/ApprovePlan.tsx +0 -44
- package/src/cli/components/Plan.tsx +0 -155
- package/src/cli/components/PlanProgress.tsx +0 -224
- package/src/cli/index.ts +0 -2
- package/src/cli/ink-service.tsx +0 -61
- package/src/cli/service.ts +0 -23
- package/src/cloudflare/account.ts +0 -37
- package/src/cloudflare/api.ts +0 -156
- package/src/cloudflare/config.ts +0 -7
- package/src/cloudflare/context.ts +0 -49
- package/src/cloudflare/index.ts +0 -8
- package/src/cloudflare/kv/index.ts +0 -3
- package/src/cloudflare/kv/namespace.binding.ts +0 -27
- package/src/cloudflare/kv/namespace.client.ts +0 -70
- package/src/cloudflare/kv/namespace.provider.ts +0 -105
- package/src/cloudflare/kv/namespace.ts +0 -30
- package/src/cloudflare/live.ts +0 -32
- package/src/cloudflare/r2/bucket.binding.ts +0 -29
- package/src/cloudflare/r2/bucket.client.ts +0 -22
- package/src/cloudflare/r2/bucket.del.ts +0 -11
- package/src/cloudflare/r2/bucket.get.ts +0 -13
- package/src/cloudflare/r2/bucket.head.ts +0 -11
- package/src/cloudflare/r2/bucket.list.ts +0 -12
- package/src/cloudflare/r2/bucket.multipart.ts +0 -55
- package/src/cloudflare/r2/bucket.provider.ts +0 -94
- package/src/cloudflare/r2/bucket.put.ts +0 -17
- package/src/cloudflare/r2/bucket.ts +0 -44
- package/src/cloudflare/r2/index.ts +0 -9
- package/src/cloudflare/stream.ts +0 -21
- package/src/cloudflare/worker/assets.fetch.ts +0 -29
- package/src/cloudflare/worker/assets.provider.ts +0 -249
- package/src/cloudflare/worker/index.ts +0 -4
- package/src/cloudflare/worker/worker.handler.ts +0 -39
- package/src/cloudflare/worker/worker.provider.ts +0 -279
- package/src/cloudflare/worker/worker.serve.ts +0 -22
- package/src/cloudflare/worker/worker.ts +0 -77
- package/src/destroy.ts +0 -3
- package/src/diff.ts +0 -48
- package/src/dot-alchemy.ts +0 -18
- package/src/env.ts +0 -39
- package/src/esbuild.ts +0 -98
- package/src/event.ts +0 -33
- package/src/exports.ts +0 -21
- package/src/input.ts +0 -81
- package/src/instance-id.ts +0 -20
- package/src/output.ts +0 -542
- package/src/phase.ts +0 -1
- package/src/physical-name.ts +0 -84
- package/src/plan.ts +0 -1123
- package/src/policy.ts +0 -128
- package/src/provider.ts +0 -112
- package/src/ref.ts +0 -48
- package/src/reporter.ts +0 -8
- package/src/resource.ts +0 -140
- package/src/runtime.ts +0 -152
- package/src/schema.ts +0 -102
- package/src/service.ts +0 -59
- package/src/sha256.ts +0 -23
- package/src/stack.ts +0 -116
- package/src/stage.ts +0 -85
- package/src/state.ts +0 -390
- package/src/tags.ts +0 -69
- package/src/test.ts +0 -172
- package/src/todo.ts +0 -4
- package/src/unknown.ts +0 -6
- package/src/user.ts +0 -4
- package/src/util.ts +0 -21
- /package/src/{aws/arn.ts → AWS/Arn.ts} +0 -0
- /package/src/{aws/dynamodb/expr.ts → AWS/DynamoDB/Expr.ts} +0 -0
- /package/src/{assert-never.ts → Util/assert-never.ts} +0 -0
- /package/src/{data.ts → Util/data.ts} +0 -0
- /package/src/{type.ts → Util/type.ts} +0 -0
package/src/plan.ts
DELETED
|
@@ -1,1123 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import * as Data from "effect/Data";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Layer from "effect/Layer";
|
|
5
|
-
import { omit } from "effect/Struct";
|
|
6
|
-
import { App } from "./app.ts";
|
|
7
|
-
import type {
|
|
8
|
-
AnyBinding,
|
|
9
|
-
BindingDiffProps,
|
|
10
|
-
BindingService,
|
|
11
|
-
} from "./binding.ts";
|
|
12
|
-
import type { Capability } from "./capability.ts";
|
|
13
|
-
import type { Diff, NoopDiff, UpdateDiff } from "./diff.ts";
|
|
14
|
-
import * as Output from "./output.ts";
|
|
15
|
-
import type { Instance } from "./policy.ts";
|
|
16
|
-
import type { Provider } from "./provider.ts";
|
|
17
|
-
import { type ProviderService, getProviderByType } from "./provider.ts";
|
|
18
|
-
import type { AnyResource, Resource, ResourceTags } from "./resource.ts";
|
|
19
|
-
import { isService, type IService, type Service } from "./service.ts";
|
|
20
|
-
import {
|
|
21
|
-
type CreatedResourceState,
|
|
22
|
-
type CreatingResourceState,
|
|
23
|
-
type ReplacedResourceState,
|
|
24
|
-
type ReplacingResourceState,
|
|
25
|
-
type UpdatedResourceState,
|
|
26
|
-
type UpdatingReourceState,
|
|
27
|
-
State,
|
|
28
|
-
StateStoreError,
|
|
29
|
-
type ResourceState,
|
|
30
|
-
} from "./state.ts";
|
|
31
|
-
import { asEffect } from "./util.ts";
|
|
32
|
-
import { InstanceId } from "./instance-id.ts";
|
|
33
|
-
|
|
34
|
-
export type PlanError = never;
|
|
35
|
-
|
|
36
|
-
export const isBindNode = (node: any): node is BindNode => {
|
|
37
|
-
return (
|
|
38
|
-
node &&
|
|
39
|
-
typeof node === "object" &&
|
|
40
|
-
(node.action === "attach" ||
|
|
41
|
-
node.action === "detach" ||
|
|
42
|
-
node.action === "noop")
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* A node in the plan that represents a binding operation acting on a resource.
|
|
48
|
-
*/
|
|
49
|
-
export type BindNode<B extends AnyBinding = AnyBinding> =
|
|
50
|
-
| Attach<B>
|
|
51
|
-
| Reattach<B>
|
|
52
|
-
| Detach<B>
|
|
53
|
-
| NoopBind<B>;
|
|
54
|
-
|
|
55
|
-
export type Attach<B extends AnyBinding = AnyBinding> = {
|
|
56
|
-
action: "attach";
|
|
57
|
-
binding: B;
|
|
58
|
-
olds: BindNode | undefined;
|
|
59
|
-
attr: B["attr"] | undefined;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type Reattach<B extends AnyBinding = AnyBinding> = {
|
|
63
|
-
action: "reattach";
|
|
64
|
-
binding: B;
|
|
65
|
-
olds: BindNode;
|
|
66
|
-
attr: B["attr"];
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type Detach<B extends AnyBinding = AnyBinding> = {
|
|
70
|
-
action: "detach";
|
|
71
|
-
binding: B;
|
|
72
|
-
attr: B["attr"] | undefined;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type NoopBind<B extends AnyBinding = AnyBinding> = {
|
|
76
|
-
action: "noop";
|
|
77
|
-
binding: B;
|
|
78
|
-
attr: B["attr"];
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const isCRUD = (node: any): node is CRUD => {
|
|
82
|
-
return (
|
|
83
|
-
node &&
|
|
84
|
-
typeof node === "object" &&
|
|
85
|
-
(node.action === "create" ||
|
|
86
|
-
node.action === "update" ||
|
|
87
|
-
node.action === "replace" ||
|
|
88
|
-
node.action === "noop")
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* A node in the plan that represents a resource CRUD operation.
|
|
94
|
-
*/
|
|
95
|
-
export type CRUD<R extends Resource = AnyResource> =
|
|
96
|
-
| Create<R>
|
|
97
|
-
| Update<R>
|
|
98
|
-
| Delete<R>
|
|
99
|
-
| Replace<R>
|
|
100
|
-
| NoopUpdate<R>;
|
|
101
|
-
|
|
102
|
-
export type Apply<R extends Resource = AnyResource> =
|
|
103
|
-
| Create<R>
|
|
104
|
-
| Update<R>
|
|
105
|
-
| Replace<R>
|
|
106
|
-
| NoopUpdate<R>;
|
|
107
|
-
|
|
108
|
-
export interface BaseNode<R extends Resource = AnyResource> {
|
|
109
|
-
resource: R;
|
|
110
|
-
provider: ProviderService<R>;
|
|
111
|
-
bindings: BindNode[];
|
|
112
|
-
downstream: string[];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface Create<R extends Resource = AnyResource> extends BaseNode<R> {
|
|
116
|
-
action: "create";
|
|
117
|
-
props: any;
|
|
118
|
-
state: CreatingResourceState | undefined;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface Update<R extends Resource = AnyResource> extends BaseNode<R> {
|
|
122
|
-
action: "update";
|
|
123
|
-
props: any;
|
|
124
|
-
state:
|
|
125
|
-
| CreatedResourceState
|
|
126
|
-
| UpdatedResourceState
|
|
127
|
-
| UpdatingReourceState
|
|
128
|
-
// the props can change after creating the replacement resource,
|
|
129
|
-
// so Apply needs to handle updates and then continue with cleaning up the replaced graph
|
|
130
|
-
| ReplacedResourceState;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export interface Delete<R extends Resource = AnyResource> extends BaseNode<R> {
|
|
134
|
-
action: "delete";
|
|
135
|
-
// a resource can be deleted no matter what state it's in
|
|
136
|
-
state: ResourceState;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export interface NoopUpdate<R extends Resource = AnyResource>
|
|
140
|
-
extends BaseNode<R> {
|
|
141
|
-
action: "noop";
|
|
142
|
-
state: CreatedResourceState | UpdatedResourceState;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface Replace<R extends Resource = AnyResource> extends BaseNode<R> {
|
|
146
|
-
action: "replace";
|
|
147
|
-
props: any;
|
|
148
|
-
deleteFirst: boolean;
|
|
149
|
-
state:
|
|
150
|
-
| CreatingResourceState
|
|
151
|
-
| CreatedResourceState
|
|
152
|
-
| UpdatingReourceState
|
|
153
|
-
| UpdatedResourceState
|
|
154
|
-
| ReplacingResourceState
|
|
155
|
-
| ReplacedResourceState;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export type ResourceGraph<Resources extends Service | Resource> = ToGraph<
|
|
159
|
-
TraverseResources<Resources>
|
|
160
|
-
>;
|
|
161
|
-
|
|
162
|
-
export type TraverseResources<Resources extends Service | Resource> =
|
|
163
|
-
| Resources
|
|
164
|
-
| BoundResources<Resources>
|
|
165
|
-
| TransitiveResources<Resources>;
|
|
166
|
-
|
|
167
|
-
type ToGraph<Resources extends Service | Resource> = {
|
|
168
|
-
[ID in Resources["id"]]: Apply<Extract<Resources, { id: ID }>>;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export type BoundResources<Resources extends Service | Resource> = NeverUnknown<
|
|
172
|
-
Extract<
|
|
173
|
-
Resources,
|
|
174
|
-
IService
|
|
175
|
-
>["props"]["bindings"]["capabilities"][number]["resource"]
|
|
176
|
-
>;
|
|
177
|
-
|
|
178
|
-
// finds transitive dependencies at most two levels deep
|
|
179
|
-
// TODO(sam): figure out an efficient way to do arbitrary depth
|
|
180
|
-
export type TransitiveResources<
|
|
181
|
-
Resources extends Service | Resource,
|
|
182
|
-
Found extends Service | Resource = never,
|
|
183
|
-
> = Extract<
|
|
184
|
-
| Found
|
|
185
|
-
| {
|
|
186
|
-
[prop in keyof Resources["props"]]: IsAny<
|
|
187
|
-
Resources["props"][prop]
|
|
188
|
-
> extends true
|
|
189
|
-
? Found
|
|
190
|
-
: Resources["props"][prop] extends { kind: "alchemy/Policy" }
|
|
191
|
-
? Found
|
|
192
|
-
: Resources["props"][prop] extends Output.Output<any, infer Src, any>
|
|
193
|
-
? Src extends Found
|
|
194
|
-
? Found
|
|
195
|
-
: TransitiveResources<Src, Src | Found>
|
|
196
|
-
: {
|
|
197
|
-
[p in keyof Resources["props"][prop]]: IsAny<
|
|
198
|
-
Resources["props"][prop][p]
|
|
199
|
-
> extends true
|
|
200
|
-
? Found
|
|
201
|
-
: Resources["props"][prop][p] extends Output.Output<
|
|
202
|
-
any,
|
|
203
|
-
infer Src,
|
|
204
|
-
any
|
|
205
|
-
>
|
|
206
|
-
? Src extends Found
|
|
207
|
-
? Found
|
|
208
|
-
: TransitiveResources<Src, Src | Found>
|
|
209
|
-
: Found;
|
|
210
|
-
}[keyof Resources["props"][prop]];
|
|
211
|
-
}[keyof Resources["props"]],
|
|
212
|
-
Service | Resource
|
|
213
|
-
>;
|
|
214
|
-
|
|
215
|
-
export type Providers<Resources extends Service | Resource> =
|
|
216
|
-
| ResourceProviders<Resources>
|
|
217
|
-
| BindingTags<Resources>;
|
|
218
|
-
|
|
219
|
-
export type ResourceProviders<Res extends Service | Resource> = Res extends any
|
|
220
|
-
? Provider<Extract<Res["base"], Service | Resource>>
|
|
221
|
-
: never;
|
|
222
|
-
|
|
223
|
-
export type BindingTags<Resources extends Service | Resource> = NeverUnknown<
|
|
224
|
-
Extract<Resources, Service>["props"]["bindings"]["tags"][number]
|
|
225
|
-
>;
|
|
226
|
-
|
|
227
|
-
type NeverUnknown<T> = unknown extends T ? never : T;
|
|
228
|
-
|
|
229
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
230
|
-
|
|
231
|
-
export type DerivePlan<Resources extends Service | Resource> = {
|
|
232
|
-
resources: {
|
|
233
|
-
[ID in keyof ResourceGraph<Resources>]: ResourceGraph<Resources>[ID];
|
|
234
|
-
};
|
|
235
|
-
deletions: {
|
|
236
|
-
[ID in string]: Delete<AnyResource>;
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
export type IPlan = {
|
|
241
|
-
resources: {
|
|
242
|
-
[id in string]: Apply<any>;
|
|
243
|
-
};
|
|
244
|
-
deletions: {
|
|
245
|
-
[id in string]?: Delete<Resource>;
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
export type Plan<Resources extends Service | Resource> = Effect.Effect<
|
|
250
|
-
DerivePlan<Resources>,
|
|
251
|
-
| CannotReplacePartiallyReplacedResource
|
|
252
|
-
| DeleteResourceHasDownstreamDependencies,
|
|
253
|
-
Providers<Resources> | State
|
|
254
|
-
>;
|
|
255
|
-
|
|
256
|
-
export const plan = <const Resources extends (Service | Resource)[]>(
|
|
257
|
-
..._resources: Resources
|
|
258
|
-
): Plan<Instance<Resources[number]>> =>
|
|
259
|
-
Effect.gen(function* () {
|
|
260
|
-
const state = yield* State;
|
|
261
|
-
|
|
262
|
-
const findResources = (
|
|
263
|
-
resource: Service | Resource,
|
|
264
|
-
visited: Set<string>,
|
|
265
|
-
): (Service | Resource)[] => {
|
|
266
|
-
if (visited.has(resource.id)) {
|
|
267
|
-
return [];
|
|
268
|
-
}
|
|
269
|
-
visited.add(resource.id);
|
|
270
|
-
const upstream = Object.values(Output.upstreamAny(resource.props)) as (
|
|
271
|
-
| Service
|
|
272
|
-
| Resource
|
|
273
|
-
)[];
|
|
274
|
-
return [
|
|
275
|
-
resource,
|
|
276
|
-
...upstream,
|
|
277
|
-
...upstream.flatMap((r) => findResources(r, visited)),
|
|
278
|
-
];
|
|
279
|
-
};
|
|
280
|
-
const resources = _resources
|
|
281
|
-
.flatMap((r) => findResources(r, new Set()))
|
|
282
|
-
.filter((r, i, arr) => arr.findIndex((r2) => r2.id === r.id) === i);
|
|
283
|
-
|
|
284
|
-
// TODO(sam): rename terminology to Stack
|
|
285
|
-
const app = yield* App;
|
|
286
|
-
|
|
287
|
-
const resourceIds = yield* state.list({
|
|
288
|
-
stack: app.name,
|
|
289
|
-
stage: app.stage,
|
|
290
|
-
});
|
|
291
|
-
const oldResources = yield* Effect.all(
|
|
292
|
-
resourceIds.map((id) =>
|
|
293
|
-
state.get({ stack: app.name, stage: app.stage, resourceId: id }),
|
|
294
|
-
),
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
type ResolveEffect<T> = Effect.Effect<T, ResolveErr, ResolveReq>;
|
|
298
|
-
type ResolveErr = StateStoreError;
|
|
299
|
-
type ResolveReq =
|
|
300
|
-
| Context.TagClass<
|
|
301
|
-
Provider<Resource<string, string, any, any>>,
|
|
302
|
-
string,
|
|
303
|
-
ProviderService<Resource<string, string, any, any>>
|
|
304
|
-
>
|
|
305
|
-
| State;
|
|
306
|
-
|
|
307
|
-
const resolvedResources: Record<
|
|
308
|
-
string,
|
|
309
|
-
ResolveEffect<
|
|
310
|
-
| {
|
|
311
|
-
[attr in string]: any;
|
|
312
|
-
}
|
|
313
|
-
| undefined
|
|
314
|
-
>
|
|
315
|
-
> = {};
|
|
316
|
-
|
|
317
|
-
const resolveResource = (
|
|
318
|
-
resourceExpr: Output.ResourceExpr<any, any, any>,
|
|
319
|
-
) =>
|
|
320
|
-
Effect.gen(function* () {
|
|
321
|
-
return yield* (resolvedResources[resourceExpr.src.id] ??=
|
|
322
|
-
yield* Effect.cached(
|
|
323
|
-
Effect.gen(function* () {
|
|
324
|
-
const resource = resourceExpr.src as Resource & {
|
|
325
|
-
provider: ResourceTags<Resource<string, string, any, any>>;
|
|
326
|
-
};
|
|
327
|
-
const provider = yield* resource.provider.tag;
|
|
328
|
-
const props = yield* resolveInput(resource.props);
|
|
329
|
-
const oldState = yield* state.get({
|
|
330
|
-
stack: app.name,
|
|
331
|
-
stage: app.stage,
|
|
332
|
-
resourceId: resource.id,
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
if (!oldState || oldState.status === "creating") {
|
|
336
|
-
return resourceExpr;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
const oldProps =
|
|
340
|
-
oldState.status === "created" ||
|
|
341
|
-
oldState.status === "updated" ||
|
|
342
|
-
oldState.status === "replaced"
|
|
343
|
-
? // if we're in a stable state, then just use the props
|
|
344
|
-
oldState.props
|
|
345
|
-
: // if we failed to update or replace, compare with the last known stable props
|
|
346
|
-
oldState.status === "updating" ||
|
|
347
|
-
oldState.status === "replacing"
|
|
348
|
-
? oldState.old.props
|
|
349
|
-
: // TODO(sam): it kinda doesn't make sense to diff with a "deleting" state
|
|
350
|
-
oldState.props;
|
|
351
|
-
|
|
352
|
-
const diff = yield* provider.diff
|
|
353
|
-
? provider
|
|
354
|
-
.diff({
|
|
355
|
-
id: resource.id,
|
|
356
|
-
olds: oldProps,
|
|
357
|
-
instanceId: oldState.instanceId,
|
|
358
|
-
news: props,
|
|
359
|
-
output: oldState.attr,
|
|
360
|
-
})
|
|
361
|
-
.pipe(
|
|
362
|
-
Effect.provide(
|
|
363
|
-
Layer.succeed(InstanceId, oldState.instanceId),
|
|
364
|
-
),
|
|
365
|
-
)
|
|
366
|
-
: Effect.succeed(undefined);
|
|
367
|
-
|
|
368
|
-
const stables: string[] = [
|
|
369
|
-
...(provider.stables ?? []),
|
|
370
|
-
...(diff?.stables ?? []),
|
|
371
|
-
];
|
|
372
|
-
|
|
373
|
-
const withStables = (output: any) =>
|
|
374
|
-
stables.length > 0
|
|
375
|
-
? new Output.ResourceExpr(
|
|
376
|
-
resourceExpr.src,
|
|
377
|
-
Object.fromEntries(
|
|
378
|
-
stables.map((stable) => [stable, output?.[stable]]),
|
|
379
|
-
),
|
|
380
|
-
)
|
|
381
|
-
: // if there are no stable properties, treat every property as changed
|
|
382
|
-
resourceExpr;
|
|
383
|
-
|
|
384
|
-
if (diff == null) {
|
|
385
|
-
if (arePropsChanged(oldProps, props)) {
|
|
386
|
-
// the props have changed but the provider did not provide any hints as to what is stable
|
|
387
|
-
// so we must assume everything has changed
|
|
388
|
-
return withStables(oldState?.attr);
|
|
389
|
-
}
|
|
390
|
-
} else if (diff.action === "update") {
|
|
391
|
-
return withStables(oldState?.attr);
|
|
392
|
-
} else if (diff.action === "replace") {
|
|
393
|
-
return resourceExpr;
|
|
394
|
-
}
|
|
395
|
-
if (
|
|
396
|
-
oldState.status === "created" ||
|
|
397
|
-
oldState.status === "updated" ||
|
|
398
|
-
oldState.status === "replaced"
|
|
399
|
-
) {
|
|
400
|
-
// we can safely return the attributes if we know they have stabilized
|
|
401
|
-
return oldState?.attr;
|
|
402
|
-
} else {
|
|
403
|
-
// we must assume the resource doesn't exist if it hasn't stabilized
|
|
404
|
-
return resourceExpr;
|
|
405
|
-
}
|
|
406
|
-
}),
|
|
407
|
-
));
|
|
408
|
-
});
|
|
409
|
-
|
|
410
|
-
const resolveInput = (input: any): ResolveEffect<any> =>
|
|
411
|
-
Effect.gen(function* () {
|
|
412
|
-
if (!input) {
|
|
413
|
-
return input;
|
|
414
|
-
} else if (Output.isExpr(input)) {
|
|
415
|
-
return yield* resolveOutput(input);
|
|
416
|
-
} else if (Array.isArray(input)) {
|
|
417
|
-
return yield* Effect.all(input.map(resolveInput));
|
|
418
|
-
} else if (typeof input === "object") {
|
|
419
|
-
return Object.fromEntries(
|
|
420
|
-
yield* Effect.all(
|
|
421
|
-
Object.entries(input).map(([key, value]) =>
|
|
422
|
-
resolveInput(value).pipe(Effect.map((value) => [key, value])),
|
|
423
|
-
),
|
|
424
|
-
),
|
|
425
|
-
);
|
|
426
|
-
}
|
|
427
|
-
return input;
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
const resolveOutput = (expr: Output.Expr<any>): ResolveEffect<any> =>
|
|
431
|
-
Effect.gen(function* () {
|
|
432
|
-
if (Output.isResourceExpr(expr)) {
|
|
433
|
-
return yield* resolveResource(expr);
|
|
434
|
-
} else if (Output.isPropExpr(expr)) {
|
|
435
|
-
const upstream = yield* resolveOutput(expr.expr);
|
|
436
|
-
return upstream?.[expr.identifier];
|
|
437
|
-
} else if (Output.isApplyExpr(expr)) {
|
|
438
|
-
const upstream = yield* resolveOutput(expr.expr);
|
|
439
|
-
return Output.hasOutputs(upstream) ? expr : expr.f(upstream);
|
|
440
|
-
} else if (Output.isEffectExpr(expr)) {
|
|
441
|
-
const upstream = yield* resolveOutput(expr.expr);
|
|
442
|
-
return Output.hasOutputs(upstream) ? expr : yield* expr.f(upstream);
|
|
443
|
-
} else if (Output.isAllExpr(expr)) {
|
|
444
|
-
return yield* Effect.all(expr.outs.map(resolveOutput));
|
|
445
|
-
}
|
|
446
|
-
return yield* Effect.die(new Error("Not implemented yet"));
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
// map of resource ID -> its downstream dependencies (resources that depend on it)
|
|
450
|
-
const oldDownstreamDependencies: {
|
|
451
|
-
[resourceId: string]: string[];
|
|
452
|
-
} = Object.fromEntries(
|
|
453
|
-
oldResources
|
|
454
|
-
.filter((resource) => !!resource)
|
|
455
|
-
.map((resource) => [resource.logicalId, resource.downstream]),
|
|
456
|
-
);
|
|
457
|
-
|
|
458
|
-
const newUpstreamDependencies: {
|
|
459
|
-
[resourceId: string]: string[];
|
|
460
|
-
} = Object.fromEntries(
|
|
461
|
-
resources.map((resource) => [
|
|
462
|
-
resource.id,
|
|
463
|
-
[
|
|
464
|
-
...Object.values(Output.upstreamAny(resource.props)).map((r) => r.id),
|
|
465
|
-
...(isService(resource)
|
|
466
|
-
? resource.props.bindings.capabilities.map((cap) => cap.resource.id)
|
|
467
|
-
: []),
|
|
468
|
-
],
|
|
469
|
-
]),
|
|
470
|
-
);
|
|
471
|
-
|
|
472
|
-
const newDownstreamDependencies: {
|
|
473
|
-
[resourceId: string]: string[];
|
|
474
|
-
} = Object.fromEntries(
|
|
475
|
-
resources.map((resource) => [
|
|
476
|
-
resource.id,
|
|
477
|
-
Object.entries(newUpstreamDependencies)
|
|
478
|
-
.filter(([_, downstream]) => downstream.includes(resource.id))
|
|
479
|
-
.map(([id]) => id),
|
|
480
|
-
]),
|
|
481
|
-
);
|
|
482
|
-
|
|
483
|
-
const resourceGraph = Object.fromEntries(
|
|
484
|
-
(yield* Effect.all(
|
|
485
|
-
resources
|
|
486
|
-
.flatMap((resource) => [
|
|
487
|
-
...(isService(resource)
|
|
488
|
-
? resource.props.bindings.capabilities.map(
|
|
489
|
-
(cap: Capability) => cap.resource as Resource,
|
|
490
|
-
)
|
|
491
|
-
: []),
|
|
492
|
-
...Object.values(Output.upstreamAny(resource.props)),
|
|
493
|
-
resource,
|
|
494
|
-
])
|
|
495
|
-
.filter(
|
|
496
|
-
(node, i, arr) => arr.findIndex((n) => n.id === node.id) === i,
|
|
497
|
-
)
|
|
498
|
-
.map(
|
|
499
|
-
Effect.fn(function* (node) {
|
|
500
|
-
const id = node.id;
|
|
501
|
-
const resource = node as Resource & {
|
|
502
|
-
provider: ResourceTags<Resource<string, string, any, any>>;
|
|
503
|
-
};
|
|
504
|
-
const news = yield* resolveInput(resource.props);
|
|
505
|
-
|
|
506
|
-
const oldState = yield* state.get({
|
|
507
|
-
stack: app.name,
|
|
508
|
-
stage: app.stage,
|
|
509
|
-
resourceId: id,
|
|
510
|
-
});
|
|
511
|
-
const provider = yield* resource.provider.tag;
|
|
512
|
-
|
|
513
|
-
const downstream = newDownstreamDependencies[id] ?? [];
|
|
514
|
-
|
|
515
|
-
const bindings = isService(node)
|
|
516
|
-
? yield* diffBindings({
|
|
517
|
-
oldState,
|
|
518
|
-
bindings: (
|
|
519
|
-
node.props.bindings as unknown as {
|
|
520
|
-
bindings: AnyBinding[];
|
|
521
|
-
}
|
|
522
|
-
).bindings,
|
|
523
|
-
target: {
|
|
524
|
-
id: node.id,
|
|
525
|
-
props: node.props,
|
|
526
|
-
// TODO(sam): pick the right ones based on old status
|
|
527
|
-
oldAttr: oldState?.attr,
|
|
528
|
-
oldProps: oldState?.props,
|
|
529
|
-
},
|
|
530
|
-
})
|
|
531
|
-
: []; // TODO(sam): return undefined instead of empty array
|
|
532
|
-
|
|
533
|
-
const Node = <T extends Apply>(
|
|
534
|
-
node: Omit<
|
|
535
|
-
T,
|
|
536
|
-
"provider" | "resource" | "bindings" | "downstream"
|
|
537
|
-
>,
|
|
538
|
-
) =>
|
|
539
|
-
({
|
|
540
|
-
...node,
|
|
541
|
-
provider,
|
|
542
|
-
resource,
|
|
543
|
-
bindings,
|
|
544
|
-
downstream,
|
|
545
|
-
}) as any as T;
|
|
546
|
-
|
|
547
|
-
// handle empty and intermediate (non-final) states:
|
|
548
|
-
if (oldState === undefined) {
|
|
549
|
-
return Node<Create<Resource>>({
|
|
550
|
-
action: "create",
|
|
551
|
-
props: news,
|
|
552
|
-
state: oldState,
|
|
553
|
-
});
|
|
554
|
-
} else if (
|
|
555
|
-
oldState.status === "creating" &&
|
|
556
|
-
oldState.attr === undefined
|
|
557
|
-
) {
|
|
558
|
-
if (provider.read) {
|
|
559
|
-
const attr = yield* provider.read({
|
|
560
|
-
id,
|
|
561
|
-
instanceId: oldState.instanceId,
|
|
562
|
-
olds: oldState.props,
|
|
563
|
-
output: oldState.attr,
|
|
564
|
-
bindings,
|
|
565
|
-
});
|
|
566
|
-
if (attr) {
|
|
567
|
-
return Node<Create<Resource>>({
|
|
568
|
-
action: "create",
|
|
569
|
-
props: news,
|
|
570
|
-
state: { ...oldState, attr },
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
// TODO(sam): is this correct for all possible states a resource can be in?
|
|
577
|
-
const oldProps = oldState.props;
|
|
578
|
-
|
|
579
|
-
const diff = yield* asEffect(
|
|
580
|
-
provider.diff
|
|
581
|
-
? provider
|
|
582
|
-
.diff({
|
|
583
|
-
id,
|
|
584
|
-
olds: oldProps,
|
|
585
|
-
instanceId: oldState.instanceId,
|
|
586
|
-
output: oldState.attr,
|
|
587
|
-
news,
|
|
588
|
-
})
|
|
589
|
-
.pipe(
|
|
590
|
-
Effect.provide(
|
|
591
|
-
Layer.succeed(InstanceId, oldState.instanceId),
|
|
592
|
-
),
|
|
593
|
-
)
|
|
594
|
-
: undefined,
|
|
595
|
-
).pipe(
|
|
596
|
-
Effect.map(
|
|
597
|
-
(diff) =>
|
|
598
|
-
diff ??
|
|
599
|
-
({
|
|
600
|
-
action: arePropsChanged(oldProps, news)
|
|
601
|
-
? "update"
|
|
602
|
-
: "noop",
|
|
603
|
-
} as UpdateDiff | NoopDiff),
|
|
604
|
-
),
|
|
605
|
-
);
|
|
606
|
-
|
|
607
|
-
if (oldState.status === "creating") {
|
|
608
|
-
if (diff.action === "noop") {
|
|
609
|
-
// we're in the creating state and props are un-changed
|
|
610
|
-
// let's just continue where we left off
|
|
611
|
-
return Node<Create<Resource>>({
|
|
612
|
-
action: "create",
|
|
613
|
-
props: news,
|
|
614
|
-
state: oldState,
|
|
615
|
-
});
|
|
616
|
-
} else if (diff.action === "update") {
|
|
617
|
-
// props have changed in a way that is updatable
|
|
618
|
-
// again, just continue with the create
|
|
619
|
-
// TODO(sam): should we maybe try an update instead?
|
|
620
|
-
return Node<Create<Resource>>({
|
|
621
|
-
action: "create",
|
|
622
|
-
props: news,
|
|
623
|
-
state: oldState,
|
|
624
|
-
});
|
|
625
|
-
} else {
|
|
626
|
-
// props have changed in an incompatible way
|
|
627
|
-
// because it's possible that an un-updatable resource has already been created
|
|
628
|
-
// we must use a replace step to create a new one and delete the potential old one
|
|
629
|
-
return Node<Replace<Resource>>({
|
|
630
|
-
action: "replace",
|
|
631
|
-
props: news,
|
|
632
|
-
deleteFirst: diff.deleteFirst ?? false,
|
|
633
|
-
state: oldState,
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
} else if (oldState.status === "updating") {
|
|
637
|
-
// we started to update a resource but did not complete
|
|
638
|
-
if (diff.action === "update" || diff.action === "noop") {
|
|
639
|
-
return Node<Update<Resource>>({
|
|
640
|
-
action: "update",
|
|
641
|
-
props: news,
|
|
642
|
-
state: oldState,
|
|
643
|
-
});
|
|
644
|
-
} else {
|
|
645
|
-
// we started to update a resource but now believe we should replace it
|
|
646
|
-
return Node<Replace<Resource>>({
|
|
647
|
-
action: "replace",
|
|
648
|
-
deleteFirst: diff.deleteFirst ?? false,
|
|
649
|
-
props: news,
|
|
650
|
-
// TODO(sam): can Apply handle replacements when the oldState is UpdatingResourceState?
|
|
651
|
-
// -> or is there we do a provider.read to try and reconcile back to UpdatedResourceState?
|
|
652
|
-
state: oldState,
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
} else if (oldState.status === "replacing") {
|
|
656
|
-
// resource replacement started, but the replacement may or may not have been created
|
|
657
|
-
if (diff.action === "noop") {
|
|
658
|
-
// this is the stable case - noop means just continue with the replacement
|
|
659
|
-
return Node<Replace<Resource>>({
|
|
660
|
-
action: "replace",
|
|
661
|
-
deleteFirst: oldState.deleteFirst,
|
|
662
|
-
props: news,
|
|
663
|
-
state: oldState,
|
|
664
|
-
});
|
|
665
|
-
} else if (diff.action === "update") {
|
|
666
|
-
// potential problem here - the props have changed since we tried to replace,
|
|
667
|
-
// but not enough to trigger another replacement. the resource provider should
|
|
668
|
-
// be designed as idempotent to converge to the right state when creating the new resource
|
|
669
|
-
// the newly generated instanceId is intended to assist with this
|
|
670
|
-
return Node<Replace<Resource>>({
|
|
671
|
-
action: "replace",
|
|
672
|
-
deleteFirst: oldState.deleteFirst,
|
|
673
|
-
props: news,
|
|
674
|
-
state: oldState,
|
|
675
|
-
});
|
|
676
|
-
} else {
|
|
677
|
-
// ah shit, so we tried to replace the resource and then crashed
|
|
678
|
-
// now the props have changed again in such a way that the (maybe, maybe not)
|
|
679
|
-
// created resource should also be replaced
|
|
680
|
-
|
|
681
|
-
// TODO(sam): what should we do?
|
|
682
|
-
// 1. trigger a deletion of the potentially created resource
|
|
683
|
-
// 2. expect the resource provider to handle it idempotently?
|
|
684
|
-
// -> i don't think this case is fair to put on the resource provider
|
|
685
|
-
// because if the resource was created, it's in a state that can't be updated
|
|
686
|
-
return yield* Effect.fail(
|
|
687
|
-
new CannotReplacePartiallyReplacedResource(id),
|
|
688
|
-
);
|
|
689
|
-
}
|
|
690
|
-
} else if (oldState.status === "replaced") {
|
|
691
|
-
// replacement has been created but we're not done cleaning up the old state
|
|
692
|
-
if (diff.action === "noop") {
|
|
693
|
-
// this is the stable case - noop means just continue cleaning up the replacement
|
|
694
|
-
return Node<Replace<Resource>>({
|
|
695
|
-
action: "replace",
|
|
696
|
-
deleteFirst: oldState.deleteFirst,
|
|
697
|
-
props: news,
|
|
698
|
-
state: oldState,
|
|
699
|
-
});
|
|
700
|
-
} else if (diff.action === "update") {
|
|
701
|
-
// the replacement has been created but now also needs to be updated
|
|
702
|
-
// the resource provider should:
|
|
703
|
-
// 1. Update the newly created replacement resource
|
|
704
|
-
// 2. Then proceed as normal to delete the replaced resources (after all downstream references are updated)
|
|
705
|
-
return Node<Update<Resource>>({
|
|
706
|
-
action: "update",
|
|
707
|
-
props: news,
|
|
708
|
-
state: oldState,
|
|
709
|
-
});
|
|
710
|
-
} else {
|
|
711
|
-
// the replacement has been created but now it needs to be replaced
|
|
712
|
-
// this is the worst-case scenario because downstream resources
|
|
713
|
-
// could have been been updated to point to the replaced resources
|
|
714
|
-
return yield* Effect.fail(
|
|
715
|
-
new CannotReplacePartiallyReplacedResource(id),
|
|
716
|
-
);
|
|
717
|
-
}
|
|
718
|
-
} else if (oldState.status === "deleting") {
|
|
719
|
-
if (diff.action === "noop" || diff.action === "update") {
|
|
720
|
-
// we're in a partially deleted state, it is unclear whether it was or was not deleted
|
|
721
|
-
// it should be safe to re-create it with the same instanceId?
|
|
722
|
-
return Node<Create<Resource>>({
|
|
723
|
-
action: "create",
|
|
724
|
-
props: news,
|
|
725
|
-
state: {
|
|
726
|
-
...oldState,
|
|
727
|
-
status: "creating",
|
|
728
|
-
props: news,
|
|
729
|
-
},
|
|
730
|
-
});
|
|
731
|
-
} else {
|
|
732
|
-
return yield* Effect.fail(
|
|
733
|
-
new CannotReplacePartiallyReplacedResource(id),
|
|
734
|
-
);
|
|
735
|
-
}
|
|
736
|
-
} else if (diff.action === "update") {
|
|
737
|
-
return Node<Update<Resource>>({
|
|
738
|
-
action: "update",
|
|
739
|
-
props: news,
|
|
740
|
-
state: oldState,
|
|
741
|
-
});
|
|
742
|
-
} else if (diff.action === "replace") {
|
|
743
|
-
return Node<Replace<Resource>>({
|
|
744
|
-
action: "replace",
|
|
745
|
-
props: news,
|
|
746
|
-
state: oldState,
|
|
747
|
-
deleteFirst: diff?.deleteFirst ?? false,
|
|
748
|
-
});
|
|
749
|
-
} else {
|
|
750
|
-
return Node<NoopUpdate<Resource>>({
|
|
751
|
-
action: "noop",
|
|
752
|
-
state: oldState,
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
}),
|
|
756
|
-
),
|
|
757
|
-
)).map((update) => [update.resource.id, update]),
|
|
758
|
-
) as IPlan["resources"];
|
|
759
|
-
|
|
760
|
-
const deletions = Object.fromEntries(
|
|
761
|
-
(yield* Effect.all(
|
|
762
|
-
(yield* state.list({ stack: app.name, stage: app.stage })).map(
|
|
763
|
-
Effect.fn(function* (id) {
|
|
764
|
-
if (id in resourceGraph) {
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
const oldState = yield* state.get({
|
|
768
|
-
stack: app.name,
|
|
769
|
-
stage: app.stage,
|
|
770
|
-
resourceId: id,
|
|
771
|
-
});
|
|
772
|
-
let attr: any = oldState?.attr;
|
|
773
|
-
if (oldState) {
|
|
774
|
-
const provider = yield* getProviderByType(oldState.resourceType);
|
|
775
|
-
if (oldState.attr === undefined) {
|
|
776
|
-
if (provider.read) {
|
|
777
|
-
attr = yield* provider
|
|
778
|
-
.read({
|
|
779
|
-
id,
|
|
780
|
-
instanceId: oldState.instanceId,
|
|
781
|
-
olds: oldState.props as any,
|
|
782
|
-
output: oldState.attr as any,
|
|
783
|
-
bindings: oldState.bindings ?? [],
|
|
784
|
-
})
|
|
785
|
-
.pipe(
|
|
786
|
-
Effect.provide(
|
|
787
|
-
Layer.succeed(InstanceId, oldState.instanceId),
|
|
788
|
-
),
|
|
789
|
-
);
|
|
790
|
-
}
|
|
791
|
-
if (attr === undefined) {
|
|
792
|
-
// skip deletion if we have no record of any attributes
|
|
793
|
-
// TODO(sam): should we open up provider.delete to accept undefined and let it try and generate a physical name and delete?
|
|
794
|
-
return undefined;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
return [
|
|
798
|
-
id,
|
|
799
|
-
{
|
|
800
|
-
action: "delete",
|
|
801
|
-
state: { ...oldState, attr },
|
|
802
|
-
// // TODO(sam): Support Detach Bindings
|
|
803
|
-
bindings: [],
|
|
804
|
-
provider,
|
|
805
|
-
resource: {
|
|
806
|
-
id: id,
|
|
807
|
-
type: oldState.resourceType,
|
|
808
|
-
attr,
|
|
809
|
-
props: oldState.props,
|
|
810
|
-
} as Resource,
|
|
811
|
-
// TODO(sam): is it enough to just pass through oldState?
|
|
812
|
-
downstream: oldDownstreamDependencies[id] ?? [],
|
|
813
|
-
} satisfies Delete<Resource>,
|
|
814
|
-
] as const;
|
|
815
|
-
}
|
|
816
|
-
}),
|
|
817
|
-
),
|
|
818
|
-
)).filter((v) => !!v),
|
|
819
|
-
);
|
|
820
|
-
|
|
821
|
-
for (const [resourceId, deletion] of Object.entries(deletions)) {
|
|
822
|
-
const dependencies = deletion.state.downstream.filter(
|
|
823
|
-
(d) => d in resourceGraph,
|
|
824
|
-
);
|
|
825
|
-
if (dependencies.length > 0) {
|
|
826
|
-
return yield* Effect.fail(
|
|
827
|
-
new DeleteResourceHasDownstreamDependencies({
|
|
828
|
-
message: `Resource ${resourceId} has downstream dependencies`,
|
|
829
|
-
resourceId,
|
|
830
|
-
dependencies,
|
|
831
|
-
}),
|
|
832
|
-
);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
return {
|
|
837
|
-
resources: resourceGraph,
|
|
838
|
-
deletions,
|
|
839
|
-
} satisfies IPlan as IPlan;
|
|
840
|
-
}) as any;
|
|
841
|
-
|
|
842
|
-
export class CannotReplacePartiallyReplacedResource extends Data.TaggedError(
|
|
843
|
-
"CannotReplacePartiallyReplacedResource",
|
|
844
|
-
)<{
|
|
845
|
-
message: string;
|
|
846
|
-
logicalId: string;
|
|
847
|
-
}> {
|
|
848
|
-
constructor(logicalId: string) {
|
|
849
|
-
super({
|
|
850
|
-
message:
|
|
851
|
-
`Resource '${logicalId}' did not finish being replaced in a previous deployment ` +
|
|
852
|
-
`and is expected to be replaced again in this deployment. ` +
|
|
853
|
-
`You should revert its properties and try again after a successful deployment.`,
|
|
854
|
-
logicalId,
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
export class DeleteResourceHasDownstreamDependencies extends Data.TaggedError(
|
|
860
|
-
"DeleteResourceHasDownstreamDependencies",
|
|
861
|
-
)<{
|
|
862
|
-
message: string;
|
|
863
|
-
resourceId: string;
|
|
864
|
-
dependencies: string[];
|
|
865
|
-
}> {}
|
|
866
|
-
|
|
867
|
-
const arePropsChanged = <R extends Resource>(
|
|
868
|
-
oldProps: R["props"] | undefined,
|
|
869
|
-
newProps: R["props"],
|
|
870
|
-
) => {
|
|
871
|
-
return (
|
|
872
|
-
Output.hasOutputs(newProps) ||
|
|
873
|
-
JSON.stringify(omit((oldProps ?? {}) as any, "bindings")) !==
|
|
874
|
-
JSON.stringify(omit((newProps ?? {}) as any, "bindings"))
|
|
875
|
-
);
|
|
876
|
-
};
|
|
877
|
-
|
|
878
|
-
const diffBindings = Effect.fn(function* ({
|
|
879
|
-
oldState,
|
|
880
|
-
bindings,
|
|
881
|
-
target,
|
|
882
|
-
}: {
|
|
883
|
-
oldState: ResourceState | undefined;
|
|
884
|
-
bindings: AnyBinding[];
|
|
885
|
-
target: BindingDiffProps["target"];
|
|
886
|
-
}) {
|
|
887
|
-
// const actions: BindNode[] = [];
|
|
888
|
-
const oldBindings = oldState?.bindings;
|
|
889
|
-
// const oldSids = new Set(
|
|
890
|
-
// oldBindings?.map(({ binding }) => binding.capability.sid),
|
|
891
|
-
// );
|
|
892
|
-
|
|
893
|
-
const diffBinding: (
|
|
894
|
-
binding: AnyBinding,
|
|
895
|
-
) => Effect.Effect<BindNode, StateStoreError, State> = Effect.fn(
|
|
896
|
-
function* (binding) {
|
|
897
|
-
const cap = binding.capability;
|
|
898
|
-
const sid = cap.sid ?? `${cap.action}:${cap.resource.ID}`;
|
|
899
|
-
// Find potential oldBinding for this sid
|
|
900
|
-
const oldBinding = oldBindings?.find(
|
|
901
|
-
({ binding }) => binding.capability.sid === sid,
|
|
902
|
-
);
|
|
903
|
-
if (!oldBinding) {
|
|
904
|
-
return {
|
|
905
|
-
action: "attach",
|
|
906
|
-
binding,
|
|
907
|
-
attr: undefined,
|
|
908
|
-
olds: undefined,
|
|
909
|
-
} satisfies Attach<AnyBinding>;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
const diff = yield* isBindingDiff({
|
|
913
|
-
target,
|
|
914
|
-
oldBinding,
|
|
915
|
-
newBinding: binding,
|
|
916
|
-
});
|
|
917
|
-
// if (diff === false) {
|
|
918
|
-
// } else if (diff === true) {
|
|
919
|
-
// return {
|
|
920
|
-
// action: "attach",
|
|
921
|
-
// binding,
|
|
922
|
-
// olds: oldBinding,
|
|
923
|
-
// } satisfies Attach<AnyBinding>;
|
|
924
|
-
// }
|
|
925
|
-
if (diff.action === "replace") {
|
|
926
|
-
return yield* Effect.die(
|
|
927
|
-
new Error("Replace binding not yet supported"),
|
|
928
|
-
);
|
|
929
|
-
// TODO(sam): implement support for replacing bindings
|
|
930
|
-
// return {
|
|
931
|
-
// action: "replace",
|
|
932
|
-
// binding,
|
|
933
|
-
// olds: oldBinding,
|
|
934
|
-
// };
|
|
935
|
-
} else if (diff?.action === "update") {
|
|
936
|
-
return {
|
|
937
|
-
action: "reattach",
|
|
938
|
-
binding,
|
|
939
|
-
olds: oldBinding,
|
|
940
|
-
attr: oldBinding.attr,
|
|
941
|
-
} satisfies Reattach<AnyBinding>;
|
|
942
|
-
}
|
|
943
|
-
return {
|
|
944
|
-
action: "noop",
|
|
945
|
-
binding,
|
|
946
|
-
attr: oldBinding.attr,
|
|
947
|
-
} satisfies NoopBind<AnyBinding>;
|
|
948
|
-
},
|
|
949
|
-
);
|
|
950
|
-
|
|
951
|
-
return (yield* Effect.all(bindings.map(diffBinding))).filter(
|
|
952
|
-
(action): action is BindNode => action !== null,
|
|
953
|
-
);
|
|
954
|
-
});
|
|
955
|
-
|
|
956
|
-
const isBindingDiff = Effect.fn(function* ({
|
|
957
|
-
target,
|
|
958
|
-
oldBinding: { binding: oldBinding },
|
|
959
|
-
newBinding,
|
|
960
|
-
}: {
|
|
961
|
-
// TODO(sam): support binding to other Resources
|
|
962
|
-
target: BindingDiffProps["target"];
|
|
963
|
-
oldBinding: BindNode;
|
|
964
|
-
newBinding: AnyBinding;
|
|
965
|
-
}) {
|
|
966
|
-
const oldCap = oldBinding.capability;
|
|
967
|
-
const newCap = newBinding.capability;
|
|
968
|
-
if (
|
|
969
|
-
// if the binding provider has changed
|
|
970
|
-
oldBinding.tag !== newBinding.tag ||
|
|
971
|
-
// if it points to a totally different resource, we should replace
|
|
972
|
-
oldCap?.resource?.id !== newCap?.resource?.id ||
|
|
973
|
-
// if it is a different action
|
|
974
|
-
oldCap.action !== newCap.action
|
|
975
|
-
) {
|
|
976
|
-
// then we must replace (we need to detach and attach with different bindings or to different resources)
|
|
977
|
-
return {
|
|
978
|
-
action: "replace",
|
|
979
|
-
} satisfies Diff;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
const binding = newBinding as AnyBinding & {
|
|
983
|
-
// smuggled property (because it interacts poorly with inference)
|
|
984
|
-
Tag: Context.Tag<never, BindingService>;
|
|
985
|
-
};
|
|
986
|
-
const provider = yield* binding.Tag;
|
|
987
|
-
if (provider.diff) {
|
|
988
|
-
const state = yield* State;
|
|
989
|
-
const oldState = yield* state.get(oldCap.resource.id);
|
|
990
|
-
if (oldState) {
|
|
991
|
-
const diff = yield* provider
|
|
992
|
-
.diff({
|
|
993
|
-
source: {
|
|
994
|
-
id: oldCap.resource.id,
|
|
995
|
-
props: newCap.resource.props,
|
|
996
|
-
oldProps: oldState?.props,
|
|
997
|
-
oldAttr: oldState?.attr,
|
|
998
|
-
},
|
|
999
|
-
props: newBinding.props,
|
|
1000
|
-
attr: oldBinding.attr,
|
|
1001
|
-
target,
|
|
1002
|
-
})
|
|
1003
|
-
.pipe(Effect.provide(Layer.succeed(InstanceId, oldState.instanceId)));
|
|
1004
|
-
|
|
1005
|
-
if (diff?.action === "update" || diff?.action === "replace") {
|
|
1006
|
-
return diff;
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
return {
|
|
1011
|
-
action:
|
|
1012
|
-
oldBinding.capability.action !== newBinding.capability.action ||
|
|
1013
|
-
oldBinding.capability?.resource?.id !==
|
|
1014
|
-
newBinding.capability?.resource?.id
|
|
1015
|
-
? "update"
|
|
1016
|
-
: "noop",
|
|
1017
|
-
} as const;
|
|
1018
|
-
});
|
|
1019
|
-
// TODO(sam): compare props
|
|
1020
|
-
// oldBinding.props !== newBinding.props;
|
|
1021
|
-
|
|
1022
|
-
/**
|
|
1023
|
-
* Print a plan in a human-readable format that shows the graph topology.
|
|
1024
|
-
*/
|
|
1025
|
-
export const printPlan = (plan: IPlan): string => {
|
|
1026
|
-
const lines: string[] = [];
|
|
1027
|
-
const allNodes = { ...plan.resources, ...plan.deletions };
|
|
1028
|
-
|
|
1029
|
-
// Build reverse mapping: upstream -> downstream
|
|
1030
|
-
const upstreamMap: Record<string, string[]> = {};
|
|
1031
|
-
for (const [id] of Object.entries(allNodes)) {
|
|
1032
|
-
upstreamMap[id] = [];
|
|
1033
|
-
}
|
|
1034
|
-
for (const [id, node] of Object.entries(allNodes)) {
|
|
1035
|
-
if (!node) continue;
|
|
1036
|
-
for (const downstreamId of node.state?.downstream ?? []) {
|
|
1037
|
-
if (upstreamMap[downstreamId]) {
|
|
1038
|
-
upstreamMap[downstreamId].push(id);
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
// Action symbols
|
|
1044
|
-
const actionSymbol = (action: string) => {
|
|
1045
|
-
switch (action) {
|
|
1046
|
-
case "create":
|
|
1047
|
-
return "+";
|
|
1048
|
-
case "update":
|
|
1049
|
-
return "~";
|
|
1050
|
-
case "delete":
|
|
1051
|
-
return "-";
|
|
1052
|
-
case "replace":
|
|
1053
|
-
return "±";
|
|
1054
|
-
case "noop":
|
|
1055
|
-
return "=";
|
|
1056
|
-
default:
|
|
1057
|
-
return "?";
|
|
1058
|
-
}
|
|
1059
|
-
};
|
|
1060
|
-
|
|
1061
|
-
// Print header
|
|
1062
|
-
lines.push(
|
|
1063
|
-
"╔════════════════════════════════════════════════════════════════╗",
|
|
1064
|
-
);
|
|
1065
|
-
lines.push(
|
|
1066
|
-
"║ PLAN ║",
|
|
1067
|
-
);
|
|
1068
|
-
lines.push(
|
|
1069
|
-
"╠════════════════════════════════════════════════════════════════╣",
|
|
1070
|
-
);
|
|
1071
|
-
lines.push(
|
|
1072
|
-
"║ Legend: + create, ~ update, - delete, ± replace, = noop ║",
|
|
1073
|
-
);
|
|
1074
|
-
lines.push(
|
|
1075
|
-
"╚════════════════════════════════════════════════════════════════╝",
|
|
1076
|
-
);
|
|
1077
|
-
lines.push("");
|
|
1078
|
-
|
|
1079
|
-
// Print resources section
|
|
1080
|
-
lines.push(
|
|
1081
|
-
"┌─ Resources ────────────────────────────────────────────────────┐",
|
|
1082
|
-
);
|
|
1083
|
-
const resourceIds = Object.keys(plan.resources).sort();
|
|
1084
|
-
for (const id of resourceIds) {
|
|
1085
|
-
const node = plan.resources[id];
|
|
1086
|
-
const symbol = actionSymbol(node.action);
|
|
1087
|
-
const type = node.resource?.type ?? "unknown";
|
|
1088
|
-
const downstream = node.state?.downstream?.length
|
|
1089
|
-
? ` → [${node.state?.downstream.join(", ")}]`
|
|
1090
|
-
: "";
|
|
1091
|
-
lines.push(`│ [${symbol}] ${id} (${type})${downstream}`);
|
|
1092
|
-
}
|
|
1093
|
-
if (resourceIds.length === 0) {
|
|
1094
|
-
lines.push("│ (none)");
|
|
1095
|
-
}
|
|
1096
|
-
lines.push(
|
|
1097
|
-
"└────────────────────────────────────────────────────────────────┘",
|
|
1098
|
-
);
|
|
1099
|
-
lines.push("");
|
|
1100
|
-
|
|
1101
|
-
// Print deletions section
|
|
1102
|
-
lines.push(
|
|
1103
|
-
"┌─ Deletions ────────────────────────────────────────────────────┐",
|
|
1104
|
-
);
|
|
1105
|
-
const deletionIds = Object.keys(plan.deletions).sort();
|
|
1106
|
-
for (const id of deletionIds) {
|
|
1107
|
-
const node = plan.deletions[id]!;
|
|
1108
|
-
const type = node.resource?.type ?? "unknown";
|
|
1109
|
-
const downstream = node.state.downstream?.length
|
|
1110
|
-
? ` → [${node.state.downstream.join(", ")}]`
|
|
1111
|
-
: "";
|
|
1112
|
-
lines.push(`│ [-] ${id} (${type})${downstream}`);
|
|
1113
|
-
}
|
|
1114
|
-
if (deletionIds.length === 0) {
|
|
1115
|
-
lines.push("│ (none)");
|
|
1116
|
-
}
|
|
1117
|
-
lines.push(
|
|
1118
|
-
"└────────────────────────────────────────────────────────────────┘",
|
|
1119
|
-
);
|
|
1120
|
-
lines.push("");
|
|
1121
|
-
|
|
1122
|
-
return lines.join("\n");
|
|
1123
|
-
};
|