alchemy 2.0.0-beta.65 → 2.0.0-beta.67
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/exec.js +578 -224
- package/bin/exec.js.map +1 -1
- package/lib/AWS/ApiGateway/common.d.ts.map +1 -1
- package/lib/AWS/ApiGateway/common.js +8 -1
- package/lib/AWS/ApiGateway/common.js.map +1 -1
- package/lib/AWS/Bedrock/LanguageModel.d.ts +208 -0
- package/lib/AWS/Bedrock/LanguageModel.d.ts.map +1 -0
- package/lib/AWS/Bedrock/LanguageModel.js +508 -0
- package/lib/AWS/Bedrock/LanguageModel.js.map +1 -0
- package/lib/AWS/Bedrock/LanguageModelHttp.d.ts +10 -0
- package/lib/AWS/Bedrock/LanguageModelHttp.d.ts.map +1 -0
- package/lib/AWS/Bedrock/LanguageModelHttp.js +26 -0
- package/lib/AWS/Bedrock/LanguageModelHttp.js.map +1 -0
- package/lib/AWS/Bedrock/index.d.ts +2 -0
- package/lib/AWS/Bedrock/index.d.ts.map +1 -1
- package/lib/AWS/Bedrock/index.js +2 -0
- package/lib/AWS/Bedrock/index.js.map +1 -1
- package/lib/AWS/CloudFront/Distribution.d.ts +24 -0
- package/lib/AWS/CloudFront/Distribution.d.ts.map +1 -1
- package/lib/AWS/CloudFront/Distribution.js +89 -4
- package/lib/AWS/CloudFront/Distribution.js.map +1 -1
- package/lib/AWS/CostExplorer/AnomalyMonitor.d.ts +1 -1
- package/lib/AWS/CostExplorer/AnomalyMonitor.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/AnomalySubscription.d.ts +1 -1
- package/lib/AWS/CostExplorer/AnomalySubscription.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/BindingHttp.d.ts +3 -3
- package/lib/AWS/CostExplorer/BindingHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/CostCategory.d.ts +1 -1
- package/lib/AWS/CostExplorer/CostCategory.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetAnomaliesHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetAnomaliesHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetApproximateUsageRecordsHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetApproximateUsageRecordsHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetCommitmentPurchaseAnalysisHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetCommitmentPurchaseAnalysisHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetCostAndUsageComparisonsHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetCostAndUsageComparisonsHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetCostAndUsageHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetCostAndUsageHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetCostAndUsageWithResourcesHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetCostAndUsageWithResourcesHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetCostCategoriesHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetCostCategoriesHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetCostComparisonDriversHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetCostComparisonDriversHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetCostForecastHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetCostForecastHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetDimensionValuesHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetDimensionValuesHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetReservationCoverageHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetReservationCoverageHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetReservationPurchaseRecommendationHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetReservationPurchaseRecommendationHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetReservationUtilizationHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetReservationUtilizationHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetRightsizingRecommendationHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetRightsizingRecommendationHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlanPurchaseRecommendationDetailsHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlanPurchaseRecommendationDetailsHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlansCoverageHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlansCoverageHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlansPurchaseRecommendationHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlansPurchaseRecommendationHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlansUtilizationDetailsHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlansUtilizationDetailsHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlansUtilizationHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetSavingsPlansUtilizationHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetTagsHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetTagsHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/GetUsageForecastHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/GetUsageForecastHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/ListCommitmentPurchaseAnalysesHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/ListCommitmentPurchaseAnalysesHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/ListCostAllocationTagBackfillHistoryHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/ListCostAllocationTagBackfillHistoryHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/ListCostAllocationTagsHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/ListCostAllocationTagsHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/ListCostCategoryResourceAssociationsHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/ListCostCategoryResourceAssociationsHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/ListSavingsPlansPurchaseRecommendationGenerationHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/ListSavingsPlansPurchaseRecommendationGenerationHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/ProvideAnomalyFeedbackHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/ProvideAnomalyFeedbackHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/StartCommitmentPurchaseAnalysisHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/StartCommitmentPurchaseAnalysisHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/StartCostAllocationTagBackfillHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/StartCostAllocationTagBackfillHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/StartSavingsPlansPurchaseRecommendationGenerationHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/StartSavingsPlansPurchaseRecommendationGenerationHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/UpdateCostAllocationTagsStatusHttp.d.ts +1 -1
- package/lib/AWS/CostExplorer/UpdateCostAllocationTagsStatusHttp.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/common.d.ts +5 -3
- package/lib/AWS/CostExplorer/common.d.ts.map +1 -1
- package/lib/AWS/CostExplorer/common.js +16 -1
- package/lib/AWS/CostExplorer/common.js.map +1 -1
- package/lib/AWS/DataSync/Task.d.ts.map +1 -1
- package/lib/AWS/DataSync/Task.js +16 -2
- package/lib/AWS/DataSync/Task.js.map +1 -1
- package/lib/AWS/EC2/Vpc.d.ts.map +1 -1
- package/lib/AWS/EC2/Vpc.js +15 -2
- package/lib/AWS/EC2/Vpc.js.map +1 -1
- package/lib/AWS/EC2/hosted.d.ts.map +1 -1
- package/lib/AWS/EC2/hosted.js +10 -2
- package/lib/AWS/EC2/hosted.js.map +1 -1
- package/lib/AWS/ECR/Image.d.ts +132 -13
- package/lib/AWS/ECR/Image.d.ts.map +1 -1
- package/lib/AWS/ECR/ImageSource.d.ts.map +1 -1
- package/lib/AWS/ECR/ImageSource.js +10 -2
- package/lib/AWS/ECR/ImageSource.js.map +1 -1
- package/lib/AWS/ECR/Repository.d.ts +2 -0
- package/lib/AWS/ECR/Repository.d.ts.map +1 -1
- package/lib/AWS/ECR/Repository.js +28 -3
- package/lib/AWS/ECR/Repository.js.map +1 -1
- package/lib/AWS/ECS/Service.d.ts +27 -1
- package/lib/AWS/ECS/Service.d.ts.map +1 -1
- package/lib/AWS/ECS/Service.js +184 -22
- package/lib/AWS/ECS/Service.js.map +1 -1
- package/lib/AWS/ECS/Task.d.ts +32 -8
- package/lib/AWS/ECS/Task.d.ts.map +1 -1
- package/lib/AWS/ECS/Task.js +62 -29
- package/lib/AWS/ECS/Task.js.map +1 -1
- package/lib/AWS/EKS/Deployment.d.ts.map +1 -1
- package/lib/AWS/EKS/Deployment.js +10 -2
- package/lib/AWS/EKS/Deployment.js.map +1 -1
- package/lib/AWS/EKS/Job.d.ts.map +1 -1
- package/lib/AWS/EKS/Job.js +10 -2
- package/lib/AWS/EKS/Job.js.map +1 -1
- package/lib/AWS/Lambda/Function.d.ts +15 -0
- package/lib/AWS/Lambda/Function.d.ts.map +1 -1
- package/lib/AWS/Lambda/Function.js +67 -29
- package/lib/AWS/Lambda/Function.js.map +1 -1
- package/lib/AWS/Lambda/HttpServer.d.ts.map +1 -1
- package/lib/AWS/Lambda/HttpServer.js +7 -1
- package/lib/AWS/Lambda/HttpServer.js.map +1 -1
- package/lib/AWS/Lambda/LayerVersion.d.ts +176 -0
- package/lib/AWS/Lambda/LayerVersion.d.ts.map +1 -0
- package/lib/AWS/Lambda/LayerVersion.js +288 -0
- package/lib/AWS/Lambda/LayerVersion.js.map +1 -0
- package/lib/AWS/Lambda/MicrovmBundle.d.ts.map +1 -1
- package/lib/AWS/Lambda/MicrovmBundle.js +10 -2
- package/lib/AWS/Lambda/MicrovmBundle.js.map +1 -1
- package/lib/AWS/Lambda/index.d.ts +1 -0
- package/lib/AWS/Lambda/index.d.ts.map +1 -1
- package/lib/AWS/Lambda/index.js +1 -0
- package/lib/AWS/Lambda/index.js.map +1 -1
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +6 -1
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/AWS/SES/ActiveReceiptRuleSet.d.ts +40 -0
- package/lib/AWS/SES/ActiveReceiptRuleSet.d.ts.map +1 -0
- package/lib/AWS/SES/ActiveReceiptRuleSet.js +58 -0
- package/lib/AWS/SES/ActiveReceiptRuleSet.js.map +1 -0
- package/lib/AWS/SES/ReceiptFilter.d.ts +67 -0
- package/lib/AWS/SES/ReceiptFilter.d.ts.map +1 -0
- package/lib/AWS/SES/ReceiptFilter.js +92 -0
- package/lib/AWS/SES/ReceiptFilter.js.map +1 -0
- package/lib/AWS/SES/ReceiptRule.d.ts +133 -0
- package/lib/AWS/SES/ReceiptRule.d.ts.map +1 -0
- package/lib/AWS/SES/ReceiptRule.js +178 -0
- package/lib/AWS/SES/ReceiptRule.js.map +1 -0
- package/lib/AWS/SES/ReceiptRuleSet.d.ts +55 -0
- package/lib/AWS/SES/ReceiptRuleSet.d.ts.map +1 -0
- package/lib/AWS/SES/ReceiptRuleSet.js +112 -0
- package/lib/AWS/SES/ReceiptRuleSet.js.map +1 -0
- package/lib/AWS/SES/SendBounce.d.ts +37 -0
- package/lib/AWS/SES/SendBounce.d.ts.map +1 -0
- package/lib/AWS/SES/SendBounce.js +3 -0
- package/lib/AWS/SES/SendBounce.js.map +1 -0
- package/lib/AWS/SES/SendBounceHttp.d.ts +4 -0
- package/lib/AWS/SES/SendBounceHttp.d.ts.map +1 -0
- package/lib/AWS/SES/SendBounceHttp.js +10 -0
- package/lib/AWS/SES/SendBounceHttp.js.map +1 -0
- package/lib/AWS/SES/index.d.ts +6 -0
- package/lib/AWS/SES/index.d.ts.map +1 -1
- package/lib/AWS/SES/index.js +6 -0
- package/lib/AWS/SES/index.js.map +1 -1
- package/lib/AWS/StateStore/State.d.ts +11 -0
- package/lib/AWS/StateStore/State.d.ts.map +1 -1
- package/lib/AWS/StateStore/State.js +117 -38
- package/lib/AWS/StateStore/State.js.map +1 -1
- package/lib/Apply.d.ts +37 -1
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +270 -194
- package/lib/Apply.js.map +1 -1
- package/lib/Axiom/Telemetry.d.ts +66 -0
- package/lib/Axiom/Telemetry.d.ts.map +1 -0
- package/lib/Axiom/Telemetry.js +69 -0
- package/lib/Axiom/Telemetry.js.map +1 -0
- package/lib/Axiom/index.d.ts +1 -0
- package/lib/Axiom/index.d.ts.map +1 -1
- package/lib/Axiom/index.js +1 -0
- package/lib/Axiom/index.js.map +1 -1
- package/lib/Bundle/Bundle.d.ts +1 -1
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +14 -6
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Bundle/BundleAnalyzerPlugin.d.ts +1 -1
- package/lib/Bundle/BundleAnalyzerPlugin.d.ts.map +1 -1
- package/lib/Bundle/BundleAnalyzerPlugin.js +10 -5
- package/lib/Bundle/BundleAnalyzerPlugin.js.map +1 -1
- package/lib/Bundle/PurePlugin.d.ts +1 -1
- package/lib/Bundle/PurePlugin.d.ts.map +1 -1
- package/lib/Bundle/PurePlugin.js +15 -7
- package/lib/Bundle/PurePlugin.js.map +1 -1
- package/lib/Cli/checkVersion.d.ts +11 -5
- package/lib/Cli/checkVersion.d.ts.map +1 -1
- package/lib/Cli/checkVersion.js +73 -12
- package/lib/Cli/checkVersion.js.map +1 -1
- package/lib/Cli/commands/_shared.d.ts.map +1 -1
- package/lib/Cli/commands/_shared.js +2 -1
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/cloudflare.d.ts +1 -1
- package/lib/Cli/commands/deploy.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.js +3 -11
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cli/commands/logs.d.ts.map +1 -1
- package/lib/Cli/commands/logs.js +3 -1
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/tail.d.ts.map +1 -1
- package/lib/Cli/commands/tail.js +3 -1
- package/lib/Cli/commands/tail.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +5 -4
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cloudflare/AI/Search.d.ts +4 -15
- package/lib/Cloudflare/AI/Search.d.ts.map +1 -1
- package/lib/Cloudflare/AI/Search.js +4 -6
- package/lib/Cloudflare/AI/Search.js.map +1 -1
- package/lib/Cloudflare/AI/SearchInstance.d.ts +7 -26
- package/lib/Cloudflare/AI/SearchInstance.d.ts.map +1 -1
- package/lib/Cloudflare/AI/SearchInstance.js +7 -26
- package/lib/Cloudflare/AI/SearchInstance.js.map +1 -1
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts +3 -0
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts.map +1 -1
- package/lib/Cloudflare/ApiToken/AccountApiToken.js +3 -0
- package/lib/Cloudflare/ApiToken/AccountApiToken.js.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.d.ts +2 -1
- package/lib/Cloudflare/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js +8 -3
- package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
- package/lib/Cloudflare/Auth/OAuthClient.d.ts +5 -0
- package/lib/Cloudflare/Auth/OAuthClient.d.ts.map +1 -1
- package/lib/Cloudflare/Auth/OAuthClient.js +50 -4
- package/lib/Cloudflare/Auth/OAuthClient.js.map +1 -1
- package/lib/Cloudflare/Containers/Container.d.ts +81 -3
- package/lib/Cloudflare/Containers/Container.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/Container.js +70 -0
- package/lib/Cloudflare/Containers/Container.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerApplication.d.ts +22 -1
- package/lib/Cloudflare/Containers/ContainerApplication.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerApplication.js +4 -1
- package/lib/Cloudflare/Containers/ContainerApplication.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.js +10 -2
- package/lib/Cloudflare/Containers/ContainerBundle.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerProvider.js +43 -0
- package/lib/Cloudflare/Containers/ContainerProvider.js.map +1 -1
- package/lib/Cloudflare/Credentials.d.ts +21 -1
- package/lib/Cloudflare/Credentials.d.ts.map +1 -1
- package/lib/Cloudflare/Credentials.js +52 -9
- package/lib/Cloudflare/Credentials.js.map +1 -1
- package/lib/Cloudflare/D1/ApplyMigrations.d.ts +30 -5
- package/lib/Cloudflare/D1/ApplyMigrations.d.ts.map +1 -1
- package/lib/Cloudflare/D1/ApplyMigrations.js +36 -26
- package/lib/Cloudflare/D1/ApplyMigrations.js.map +1 -1
- package/lib/Cloudflare/D1/Database.d.ts +18 -1
- package/lib/Cloudflare/D1/Database.d.ts.map +1 -1
- package/lib/Cloudflare/D1/Database.js +134 -2
- package/lib/Cloudflare/D1/Database.js.map +1 -1
- package/lib/Cloudflare/D1/LocalD1Gateway.d.ts +39 -0
- package/lib/Cloudflare/D1/LocalD1Gateway.d.ts.map +1 -0
- package/lib/Cloudflare/D1/LocalD1Gateway.js +100 -0
- package/lib/Cloudflare/D1/LocalD1Gateway.js.map +1 -0
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts +31 -0
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts.map +1 -1
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js +13 -6
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js.map +1 -1
- package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts.map +1 -1
- package/lib/Cloudflare/D1/QueryDatabaseLocal.js +21 -2
- package/lib/Cloudflare/D1/QueryDatabaseLocal.js.map +1 -1
- package/lib/Cloudflare/DNS/Record.d.ts +3 -1
- package/lib/Cloudflare/DNS/Record.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/Record.js +23 -4
- package/lib/Cloudflare/DNS/Record.js.map +1 -1
- package/lib/Cloudflare/Email/Address.d.ts.map +1 -1
- package/lib/Cloudflare/Email/Address.js +15 -1
- package/lib/Cloudflare/Email/Address.js.map +1 -1
- package/lib/Cloudflare/Email/SendBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Email/SendBinding.js +1 -0
- package/lib/Cloudflare/Email/SendBinding.js.map +1 -1
- package/lib/Cloudflare/Email/SendEmail.d.ts +12 -0
- package/lib/Cloudflare/Email/SendEmail.d.ts.map +1 -1
- package/lib/Cloudflare/Email/SendEmail.js +1 -0
- package/lib/Cloudflare/Email/SendEmail.js.map +1 -1
- package/lib/Cloudflare/Flagship/App.d.ts.map +1 -1
- package/lib/Cloudflare/Flagship/App.js +8 -3
- package/lib/Cloudflare/Flagship/App.js.map +1 -1
- package/lib/Cloudflare/KV/LocalKVGateway.d.ts +15 -0
- package/lib/Cloudflare/KV/LocalKVGateway.d.ts.map +1 -0
- package/lib/Cloudflare/KV/LocalKVGateway.js +64 -0
- package/lib/Cloudflare/KV/LocalKVGateway.js.map +1 -0
- package/lib/Cloudflare/KV/Namespace.d.ts +9 -1
- package/lib/Cloudflare/KV/Namespace.d.ts.map +1 -1
- package/lib/Cloudflare/KV/Namespace.js +45 -1
- package/lib/Cloudflare/KV/Namespace.js.map +1 -1
- package/lib/Cloudflare/KV/NamespaceLocal.d.ts +16 -5
- package/lib/Cloudflare/KV/NamespaceLocal.d.ts.map +1 -1
- package/lib/Cloudflare/KV/NamespaceLocal.js +21 -4
- package/lib/Cloudflare/KV/NamespaceLocal.js.map +1 -1
- package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts.map +1 -1
- package/lib/Cloudflare/KV/ReadNamespaceLocal.js +5 -1
- package/lib/Cloudflare/KV/ReadNamespaceLocal.js.map +1 -1
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts.map +1 -1
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js +5 -1
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js.map +1 -1
- package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts.map +1 -1
- package/lib/Cloudflare/KV/WriteNamespaceLocal.js +5 -1
- package/lib/Cloudflare/KV/WriteNamespaceLocal.js.map +1 -1
- package/lib/Cloudflare/LocalGateway.d.ts +25 -0
- package/lib/Cloudflare/LocalGateway.d.ts.map +1 -0
- package/lib/Cloudflare/LocalGateway.js +70 -0
- package/lib/Cloudflare/LocalGateway.js.map +1 -0
- package/lib/Cloudflare/LocalRuntime.d.ts +14 -1
- package/lib/Cloudflare/LocalRuntime.d.ts.map +1 -1
- package/lib/Cloudflare/LocalRuntime.js +16 -1
- package/lib/Cloudflare/LocalRuntime.js.map +1 -1
- package/lib/Cloudflare/Logs.d.ts.map +1 -1
- package/lib/Cloudflare/Logs.js +18 -6
- package/lib/Cloudflare/Logs.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts +1 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +6 -2
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/Queues/Consumer.d.ts +16 -3
- package/lib/Cloudflare/Queues/Consumer.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/Consumer.js +51 -3
- package/lib/Cloudflare/Queues/Consumer.js.map +1 -1
- package/lib/Cloudflare/Queues/Queue.d.ts +4 -3
- package/lib/Cloudflare/Queues/Queue.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/Queue.js +7 -17
- package/lib/Cloudflare/Queues/Queue.js.map +1 -1
- package/lib/Cloudflare/Queues/QueueBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/QueueBinding.js +19 -0
- package/lib/Cloudflare/Queues/QueueBinding.js.map +1 -1
- package/lib/Cloudflare/Queues/QueueShim.d.ts +55 -0
- package/lib/Cloudflare/Queues/QueueShim.d.ts.map +1 -0
- package/lib/Cloudflare/Queues/QueueShim.js +177 -0
- package/lib/Cloudflare/Queues/QueueShim.js.map +1 -0
- package/lib/Cloudflare/R2/Bucket.d.ts +14 -1
- package/lib/Cloudflare/R2/Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/Bucket.js +53 -1
- package/lib/Cloudflare/R2/Bucket.js.map +1 -1
- package/lib/Cloudflare/R2/BucketBinding.d.ts +10 -0
- package/lib/Cloudflare/R2/BucketBinding.d.ts.map +1 -1
- package/lib/Cloudflare/R2/BucketBinding.js +14 -3
- package/lib/Cloudflare/R2/BucketBinding.js.map +1 -1
- package/lib/Cloudflare/R2/BucketLocal.d.ts +13 -6
- package/lib/Cloudflare/R2/BucketLocal.d.ts.map +1 -1
- package/lib/Cloudflare/R2/BucketLocal.js +19 -6
- package/lib/Cloudflare/R2/BucketLocal.js.map +1 -1
- package/lib/Cloudflare/R2/LocalR2Gateway.d.ts +15 -0
- package/lib/Cloudflare/R2/LocalR2Gateway.d.ts.map +1 -0
- package/lib/Cloudflare/R2/LocalR2Gateway.js +65 -0
- package/lib/Cloudflare/R2/LocalR2Gateway.js.map +1 -0
- package/lib/Cloudflare/R2/ReadBucketLocal.d.ts.map +1 -1
- package/lib/Cloudflare/R2/ReadBucketLocal.js +5 -1
- package/lib/Cloudflare/R2/ReadBucketLocal.js.map +1 -1
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts.map +1 -1
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.js +5 -1
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.js.map +1 -1
- package/lib/Cloudflare/R2/WriteBucketLocal.d.ts.map +1 -1
- package/lib/Cloudflare/R2/WriteBucketLocal.js +5 -1
- package/lib/Cloudflare/R2/WriteBucketLocal.js.map +1 -1
- package/lib/Cloudflare/Ruleset/AccountEntrypoint.d.ts.map +1 -1
- package/lib/Cloudflare/Ruleset/AccountEntrypoint.js +5 -1
- package/lib/Cloudflare/Ruleset/AccountEntrypoint.js.map +1 -1
- package/lib/Cloudflare/Ruleset/Ruleset.d.ts.map +1 -1
- package/lib/Cloudflare/Ruleset/Ruleset.js +19 -6
- package/lib/Cloudflare/Ruleset/Ruleset.js.map +1 -1
- package/lib/Cloudflare/Rum/Site.js +10 -2
- package/lib/Cloudflare/Rum/Site.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +31 -2
- package/lib/Cloudflare/StateStore/Api.js +1 -1
- package/lib/Cloudflare/StateStore/Api.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/Tunnel.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/Tunnel.js +20 -1
- package/lib/Cloudflare/Tunnel/Tunnel.js.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.d.ts +34 -7
- package/lib/Cloudflare/Website/StaticSite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.js +108 -24
- package/lib/Cloudflare/Website/StaticSite.js.map +1 -1
- package/lib/Cloudflare/Website/Vite.d.ts +33 -19
- package/lib/Cloudflare/Website/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Vite.js +33 -19
- package/lib/Cloudflare/Website/Vite.js.map +1 -1
- package/lib/Cloudflare/Workers/Compatibility.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Compatibility.js +26 -7
- package/lib/Cloudflare/Workers/Compatibility.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObject.d.ts +22 -0
- package/lib/Cloudflare/Workers/DurableObject.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObject.js +22 -0
- package/lib/Cloudflare/Workers/DurableObject.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.js +20 -5
- package/lib/Cloudflare/Workers/DurableObjectBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts +4 -2
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +7 -3
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +483 -298
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +612 -13
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +222 -1
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts +13 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +171 -21
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts +130 -28
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.d.ts +6 -2
- package/lib/Cloudflare/Workers/WorkerBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.js +18 -2
- package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js +4 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts +186 -11
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.js +1765 -236
- package/lib/Cloudflare/Workers/WorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workflows/WorkflowBridge.d.ts +7 -1
- package/lib/Cloudflare/Workflows/WorkflowBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workflows/WorkflowBridge.js +14 -4
- package/lib/Cloudflare/Workflows/WorkflowBridge.js.map +1 -1
- package/lib/Command/Build.d.ts +2 -2
- package/lib/Command/Build.d.ts.map +1 -1
- package/lib/Command/Build.js +4 -7
- package/lib/Command/Build.js.map +1 -1
- package/lib/Command/Command.d.ts +34 -4
- package/lib/Command/Command.d.ts.map +1 -1
- package/lib/Command/Command.js +125 -30
- package/lib/Command/Command.js.map +1 -1
- package/lib/Command/Dev.d.ts +2 -2
- package/lib/Command/Dev.d.ts.map +1 -1
- package/lib/Command/Dev.js +51 -73
- package/lib/Command/Dev.js.map +1 -1
- package/lib/Command/Exec.d.ts +11 -2
- package/lib/Command/Exec.d.ts.map +1 -1
- package/lib/Command/Exec.js +9 -0
- package/lib/Command/Exec.js.map +1 -1
- package/lib/Command/Memo.d.ts +9 -1
- package/lib/Command/Memo.d.ts.map +1 -1
- package/lib/Command/Memo.js +14 -2
- package/lib/Command/Memo.js.map +1 -1
- package/lib/Command/Providers.d.ts +1 -1
- package/lib/Command/Providers.d.ts.map +1 -1
- package/lib/Command/Redaction.d.ts +10 -0
- package/lib/Command/Redaction.d.ts.map +1 -0
- package/lib/Command/Redaction.js +119 -0
- package/lib/Command/Redaction.js.map +1 -0
- package/lib/Deploy.d.ts +2 -1
- package/lib/Deploy.d.ts.map +1 -1
- package/lib/Destroy.d.ts +2 -1
- package/lib/Destroy.d.ts.map +1 -1
- package/lib/Destroy.js +1 -9
- package/lib/Destroy.js.map +1 -1
- package/lib/Docker/Container.d.ts +15 -1
- package/lib/Docker/Container.d.ts.map +1 -1
- package/lib/Docker/Container.js +34 -11
- package/lib/Docker/Container.js.map +1 -1
- package/lib/Docker/Context.d.ts +84 -0
- package/lib/Docker/Context.d.ts.map +1 -0
- package/lib/Docker/Context.js +145 -0
- package/lib/Docker/Context.js.map +1 -0
- package/lib/Docker/Docker.d.ts +190 -14
- package/lib/Docker/Docker.d.ts.map +1 -1
- package/lib/Docker/Docker.js +149 -28
- package/lib/Docker/Docker.js.map +1 -1
- package/lib/Docker/Image.d.ts +12 -0
- package/lib/Docker/Image.d.ts.map +1 -1
- package/lib/Docker/Image.js +24 -7
- package/lib/Docker/Image.js.map +1 -1
- package/lib/Docker/Network.d.ts +7 -0
- package/lib/Docker/Network.d.ts.map +1 -1
- package/lib/Docker/Network.js +16 -7
- package/lib/Docker/Network.js.map +1 -1
- package/lib/Docker/Providers.d.ts +1 -1
- package/lib/Docker/Providers.d.ts.map +1 -1
- package/lib/Docker/Providers.js +13 -1
- package/lib/Docker/Providers.js.map +1 -1
- package/lib/Docker/RemoteImage.d.ts +12 -0
- package/lib/Docker/RemoteImage.d.ts.map +1 -1
- package/lib/Docker/RemoteImage.js +22 -8
- package/lib/Docker/RemoteImage.js.map +1 -1
- package/lib/Docker/Service.d.ts +445 -0
- package/lib/Docker/Service.d.ts.map +1 -0
- package/lib/Docker/Service.js +578 -0
- package/lib/Docker/Service.js.map +1 -0
- package/lib/Docker/ServiceImage.d.ts +78 -0
- package/lib/Docker/ServiceImage.d.ts.map +1 -0
- package/lib/Docker/ServiceImage.js +232 -0
- package/lib/Docker/ServiceImage.js.map +1 -0
- package/lib/Docker/Swarm.d.ts +117 -0
- package/lib/Docker/Swarm.d.ts.map +1 -0
- package/lib/Docker/Swarm.js +149 -0
- package/lib/Docker/Swarm.js.map +1 -0
- package/lib/Docker/Volume.d.ts +11 -0
- package/lib/Docker/Volume.d.ts.map +1 -1
- package/lib/Docker/Volume.js +21 -6
- package/lib/Docker/Volume.js.map +1 -1
- package/lib/Docker/index.d.ts +3 -0
- package/lib/Docker/index.d.ts.map +1 -1
- package/lib/Docker/index.js +3 -0
- package/lib/Docker/index.js.map +1 -1
- package/lib/Http.d.ts +8 -1
- package/lib/Http.d.ts.map +1 -1
- package/lib/Http.js +7 -2
- package/lib/Http.js.map +1 -1
- package/lib/Local/LocalProvider.d.ts +182 -0
- package/lib/Local/LocalProvider.d.ts.map +1 -0
- package/lib/Local/LocalProvider.js +226 -0
- package/lib/Local/LocalProvider.js.map +1 -0
- package/lib/Local/ProviderLayer.d.ts +43 -2
- package/lib/Local/ProviderLayer.d.ts.map +1 -1
- package/lib/Local/ProviderLayer.js +80 -2
- package/lib/Local/ProviderLayer.js.map +1 -1
- package/lib/Local/RpcProvider.d.ts +7 -0
- package/lib/Local/RpcProvider.d.ts.map +1 -1
- package/lib/Local/RpcProvider.js +8 -3
- package/lib/Local/RpcProvider.js.map +1 -1
- package/lib/Local/RpcProviderProxy.d.ts.map +1 -1
- package/lib/Local/RpcProviderProxy.js +3 -0
- package/lib/Local/RpcProviderProxy.js.map +1 -1
- package/lib/Local/RpcServer.d.ts +8 -1
- package/lib/Local/RpcServer.d.ts.map +1 -1
- package/lib/Local/RpcServer.js +4 -1
- package/lib/Local/RpcServer.js.map +1 -1
- package/lib/Plan.d.ts +34 -0
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +127 -40
- package/lib/Plan.js.map +1 -1
- package/lib/Planetscale/AuthProvider.d.ts.map +1 -1
- package/lib/Planetscale/AuthProvider.js +6 -2
- package/lib/Planetscale/AuthProvider.js.map +1 -1
- package/lib/Planetscale/Branch.d.ts.map +1 -1
- package/lib/Planetscale/Branch.js +36 -6
- package/lib/Planetscale/Branch.js.map +1 -1
- package/lib/Planetscale/MySQL/MySQLDatabase.d.ts.map +1 -1
- package/lib/Planetscale/MySQL/MySQLDatabase.js +31 -6
- package/lib/Planetscale/MySQL/MySQLDatabase.js.map +1 -1
- package/lib/Planetscale/OAuthClient.d.ts +7 -1
- package/lib/Planetscale/OAuthClient.d.ts.map +1 -1
- package/lib/Planetscale/OAuthClient.js +51 -4
- package/lib/Planetscale/OAuthClient.js.map +1 -1
- package/lib/Planetscale/Postgres/PostgresDatabase.d.ts.map +1 -1
- package/lib/Planetscale/Postgres/PostgresDatabase.js +30 -5
- package/lib/Planetscale/Postgres/PostgresDatabase.js.map +1 -1
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +25 -14
- package/lib/Platform.js.map +1 -1
- package/lib/Prisma/App.d.ts +93 -0
- package/lib/Prisma/App.d.ts.map +1 -0
- package/lib/Prisma/App.js +251 -0
- package/lib/Prisma/App.js.map +1 -0
- package/lib/Prisma/AuthProvider.d.ts +28 -0
- package/lib/Prisma/AuthProvider.d.ts.map +1 -0
- package/lib/Prisma/AuthProvider.js +131 -0
- package/lib/Prisma/AuthProvider.js.map +1 -0
- package/lib/Prisma/Branch.d.ts +96 -0
- package/lib/Prisma/Branch.d.ts.map +1 -0
- package/lib/Prisma/Branch.js +236 -0
- package/lib/Prisma/Branch.js.map +1 -0
- package/lib/Prisma/Client.d.ts +178 -0
- package/lib/Prisma/Client.d.ts.map +1 -0
- package/lib/Prisma/Client.js +562 -0
- package/lib/Prisma/Client.js.map +1 -0
- package/lib/Prisma/Compute.d.ts +585 -0
- package/lib/Prisma/Compute.d.ts.map +1 -0
- package/lib/Prisma/Compute.js +1545 -0
- package/lib/Prisma/Compute.js.map +1 -0
- package/lib/Prisma/ComputeArchive.d.ts +63 -0
- package/lib/Prisma/ComputeArchive.d.ts.map +1 -0
- package/lib/Prisma/ComputeArchive.js +227 -0
- package/lib/Prisma/ComputeArchive.js.map +1 -0
- package/lib/Prisma/ComputeBuild.d.ts +106 -0
- package/lib/Prisma/ComputeBuild.d.ts.map +1 -0
- package/lib/Prisma/ComputeBuild.js +987 -0
- package/lib/Prisma/ComputeBuild.js.map +1 -0
- package/lib/Prisma/ComputeLifecycle.d.ts +84 -0
- package/lib/Prisma/ComputeLifecycle.d.ts.map +1 -0
- package/lib/Prisma/ComputeLifecycle.js +186 -0
- package/lib/Prisma/ComputeLifecycle.js.map +1 -0
- package/lib/Prisma/Connect.d.ts +122 -0
- package/lib/Prisma/Connect.d.ts.map +1 -0
- package/lib/Prisma/Connect.js +187 -0
- package/lib/Prisma/Connect.js.map +1 -0
- package/lib/Prisma/Connection.d.ts +219 -0
- package/lib/Prisma/Connection.d.ts.map +1 -0
- package/lib/Prisma/Connection.js +360 -0
- package/lib/Prisma/Connection.js.map +1 -0
- package/lib/Prisma/CustomDomain.d.ts +91 -0
- package/lib/Prisma/CustomDomain.d.ts.map +1 -0
- package/lib/Prisma/CustomDomain.js +184 -0
- package/lib/Prisma/CustomDomain.js.map +1 -0
- package/lib/Prisma/Database.d.ts +222 -0
- package/lib/Prisma/Database.d.ts.map +1 -0
- package/lib/Prisma/Database.js +418 -0
- package/lib/Prisma/Database.js.map +1 -0
- package/lib/Prisma/Deployment.d.ts +141 -0
- package/lib/Prisma/Deployment.d.ts.map +1 -0
- package/lib/Prisma/Deployment.js +353 -0
- package/lib/Prisma/Deployment.js.map +1 -0
- package/lib/Prisma/EnvironmentVariable.d.ts +105 -0
- package/lib/Prisma/EnvironmentVariable.d.ts.map +1 -0
- package/lib/Prisma/EnvironmentVariable.js +229 -0
- package/lib/Prisma/EnvironmentVariable.js.map +1 -0
- package/lib/Prisma/Internal/AppIdentity.d.ts +10 -0
- package/lib/Prisma/Internal/AppIdentity.d.ts.map +1 -0
- package/lib/Prisma/Internal/AppIdentity.js +6 -0
- package/lib/Prisma/Internal/AppIdentity.js.map +1 -0
- package/lib/Prisma/Internal/AppPromotion.d.ts +19 -0
- package/lib/Prisma/Internal/AppPromotion.d.ts.map +1 -0
- package/lib/Prisma/Internal/AppPromotion.js +107 -0
- package/lib/Prisma/Internal/AppPromotion.js.map +1 -0
- package/lib/Prisma/Internal/ArchivePlatform.d.ts +42 -0
- package/lib/Prisma/Internal/ArchivePlatform.d.ts.map +1 -0
- package/lib/Prisma/Internal/ArchivePlatform.js +214 -0
- package/lib/Prisma/Internal/ArchivePlatform.js.map +1 -0
- package/lib/Prisma/Internal/ArtifactFile.d.ts +58 -0
- package/lib/Prisma/Internal/ArtifactFile.d.ts.map +1 -0
- package/lib/Prisma/Internal/ArtifactFile.js +134 -0
- package/lib/Prisma/Internal/ArtifactFile.js.map +1 -0
- package/lib/Prisma/Internal/ArtifactUpload.d.ts +5 -0
- package/lib/Prisma/Internal/ArtifactUpload.d.ts.map +1 -0
- package/lib/Prisma/Internal/ArtifactUpload.js +51 -0
- package/lib/Prisma/Internal/ArtifactUpload.js.map +1 -0
- package/lib/Prisma/Internal/BundlePaths.d.ts +4 -0
- package/lib/Prisma/Internal/BundlePaths.d.ts.map +1 -0
- package/lib/Prisma/Internal/BundlePaths.js +16 -0
- package/lib/Prisma/Internal/BundlePaths.js.map +1 -0
- package/lib/Prisma/Internal/CleanupFailure.d.ts +8 -0
- package/lib/Prisma/Internal/CleanupFailure.d.ts.map +1 -0
- package/lib/Prisma/Internal/CleanupFailure.js +8 -0
- package/lib/Prisma/Internal/CleanupFailure.js.map +1 -0
- package/lib/Prisma/Internal/DatabaseSecrets.d.ts +35 -0
- package/lib/Prisma/Internal/DatabaseSecrets.d.ts.map +1 -0
- package/lib/Prisma/Internal/DatabaseSecrets.js +85 -0
- package/lib/Prisma/Internal/DatabaseSecrets.js.map +1 -0
- package/lib/Prisma/Internal/DeploymentActions.d.ts +5 -0
- package/lib/Prisma/Internal/DeploymentActions.d.ts.map +1 -0
- package/lib/Prisma/Internal/DeploymentActions.js +16 -0
- package/lib/Prisma/Internal/DeploymentActions.js.map +1 -0
- package/lib/Prisma/Internal/DeploymentIdentity.d.ts +8 -0
- package/lib/Prisma/Internal/DeploymentIdentity.d.ts.map +1 -0
- package/lib/Prisma/Internal/DeploymentIdentity.js +12 -0
- package/lib/Prisma/Internal/DeploymentIdentity.js.map +1 -0
- package/lib/Prisma/Internal/DeploymentObserve.d.ts +3 -0
- package/lib/Prisma/Internal/DeploymentObserve.d.ts.map +1 -0
- package/lib/Prisma/Internal/DeploymentObserve.js +2 -0
- package/lib/Prisma/Internal/DeploymentObserve.js.map +1 -0
- package/lib/Prisma/Internal/EnvName.d.ts +7 -0
- package/lib/Prisma/Internal/EnvName.d.ts.map +1 -0
- package/lib/Prisma/Internal/EnvName.js +23 -0
- package/lib/Prisma/Internal/EnvName.js.map +1 -0
- package/lib/Prisma/Internal/HttpClient.d.ts +21 -0
- package/lib/Prisma/Internal/HttpClient.d.ts.map +1 -0
- package/lib/Prisma/Internal/HttpClient.js +23 -0
- package/lib/Prisma/Internal/HttpClient.js.map +1 -0
- package/lib/Prisma/Operations.d.ts +143 -0
- package/lib/Prisma/Operations.d.ts.map +1 -0
- package/lib/Prisma/Operations.js +75 -0
- package/lib/Prisma/Operations.js.map +1 -0
- package/lib/Prisma/Postgres.d.ts +25 -0
- package/lib/Prisma/Postgres.d.ts.map +1 -0
- package/lib/Prisma/Postgres.js +24 -0
- package/lib/Prisma/Postgres.js.map +1 -0
- package/lib/Prisma/PostgresOrigin.d.ts +31 -0
- package/lib/Prisma/PostgresOrigin.d.ts.map +1 -0
- package/lib/Prisma/PostgresOrigin.js +30 -0
- package/lib/Prisma/PostgresOrigin.js.map +1 -0
- package/lib/Prisma/PrismaDevDatabase.d.ts +25 -0
- package/lib/Prisma/PrismaDevDatabase.d.ts.map +1 -0
- package/lib/Prisma/PrismaDevDatabase.js +280 -0
- package/lib/Prisma/PrismaDevDatabase.js.map +1 -0
- package/lib/Prisma/PrismaEnvironment.d.ts +14 -0
- package/lib/Prisma/PrismaEnvironment.d.ts.map +1 -0
- package/lib/Prisma/PrismaEnvironment.js +50 -0
- package/lib/Prisma/PrismaEnvironment.js.map +1 -0
- package/lib/Prisma/PrismaLogs.d.ts +42 -0
- package/lib/Prisma/PrismaLogs.d.ts.map +1 -0
- package/lib/Prisma/PrismaLogs.js +318 -0
- package/lib/Prisma/PrismaLogs.js.map +1 -0
- package/lib/Prisma/Project.d.ts +123 -0
- package/lib/Prisma/Project.d.ts.map +1 -0
- package/lib/Prisma/Project.js +366 -0
- package/lib/Prisma/Project.js.map +1 -0
- package/lib/Prisma/Providers.d.ts +63 -0
- package/lib/Prisma/Providers.d.ts.map +1 -0
- package/lib/Prisma/Providers.js +306 -0
- package/lib/Prisma/Providers.js.map +1 -0
- package/lib/Prisma/Refs.d.ts +19 -0
- package/lib/Prisma/Refs.d.ts.map +1 -0
- package/lib/Prisma/Refs.js +25 -0
- package/lib/Prisma/Refs.js.map +1 -0
- package/lib/Prisma/SourceRepository.d.ts +127 -0
- package/lib/Prisma/SourceRepository.d.ts.map +1 -0
- package/lib/Prisma/SourceRepository.js +239 -0
- package/lib/Prisma/SourceRepository.js.map +1 -0
- package/lib/Prisma/Types.d.ts +539 -0
- package/lib/Prisma/Types.d.ts.map +1 -0
- package/lib/Prisma/Types.js +13 -0
- package/lib/Prisma/Types.js.map +1 -0
- package/lib/Prisma/index.d.ts +25 -0
- package/lib/Prisma/index.d.ts.map +1 -0
- package/lib/Prisma/index.js +24 -0
- package/lib/Prisma/index.js.map +1 -0
- package/lib/Provider.d.ts +57 -5
- package/lib/Provider.d.ts.map +1 -1
- package/lib/Provider.js +54 -30
- package/lib/Provider.js.map +1 -1
- package/lib/ProviderMode.d.ts +93 -0
- package/lib/ProviderMode.d.ts.map +1 -0
- package/lib/ProviderMode.js +77 -0
- package/lib/ProviderMode.js.map +1 -0
- package/lib/Resource.d.ts +8 -0
- package/lib/Resource.d.ts.map +1 -1
- package/lib/Resource.js +31 -0
- package/lib/Resource.js.map +1 -1
- package/lib/RuntimeContext.d.ts +7 -0
- package/lib/RuntimeContext.d.ts.map +1 -1
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Server/Process.d.ts +8 -0
- package/lib/Server/Process.d.ts.map +1 -1
- package/lib/Server/Process.js +29 -0
- package/lib/Server/Process.js.map +1 -1
- package/lib/State/InMemoryState.d.ts.map +1 -1
- package/lib/State/InMemoryState.js +2 -0
- package/lib/State/InMemoryState.js.map +1 -1
- package/lib/State/ResourceState.d.ts +18 -0
- package/lib/State/ResourceState.d.ts.map +1 -1
- package/lib/Sync.d.ts.map +1 -1
- package/lib/Sync.js +8 -2
- package/lib/Sync.js.map +1 -1
- package/lib/Telemetry.d.ts +150 -0
- package/lib/Telemetry.d.ts.map +1 -0
- package/lib/Telemetry.js +512 -0
- package/lib/Telemetry.js.map +1 -0
- package/lib/Test/Alchemy.d.ts.map +1 -1
- package/lib/Test/Alchemy.js +3 -1
- package/lib/Test/Alchemy.js.map +1 -1
- package/lib/Test/Core.d.ts +2 -2
- package/lib/Test/Core.d.ts.map +1 -1
- package/lib/Test/Core.js +1 -8
- package/lib/Test/Core.js.map +1 -1
- package/lib/Util/Clank.d.ts +11 -6
- package/lib/Util/Clank.d.ts.map +1 -1
- package/lib/Util/Clank.js +22 -9
- package/lib/Util/Clank.js.map +1 -1
- package/lib/Util/zip.d.ts +11 -0
- package/lib/Util/zip.d.ts.map +1 -1
- package/lib/Util/zip.js +30 -0
- package/lib/Util/zip.js.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/package.json +46 -13
- package/src/AWS/ApiGateway/common.ts +9 -0
- package/src/AWS/Bedrock/LanguageModel.ts +883 -0
- package/src/AWS/Bedrock/LanguageModelHttp.ts +36 -0
- package/src/AWS/Bedrock/index.ts +2 -0
- package/src/AWS/CloudFront/Distribution.ts +116 -6
- package/src/AWS/CostExplorer/common.ts +23 -2
- package/src/AWS/DataSync/Task.ts +30 -15
- package/src/AWS/EC2/Vpc.ts +35 -21
- package/src/AWS/EC2/hosted.ts +10 -2
- package/src/AWS/ECR/ImageSource.ts +10 -2
- package/src/AWS/ECR/Repository.ts +39 -4
- package/src/AWS/ECS/Service.ts +322 -22
- package/src/AWS/ECS/Task.ts +82 -32
- package/src/AWS/EKS/Deployment.ts +10 -2
- package/src/AWS/EKS/Job.ts +10 -2
- package/src/AWS/Lambda/Function.ts +101 -43
- package/src/AWS/Lambda/HttpServer.ts +7 -1
- package/src/AWS/Lambda/LayerVersion.ts +490 -0
- package/src/AWS/Lambda/MicrovmBundle.ts +10 -2
- package/src/AWS/Lambda/index.ts +1 -0
- package/src/AWS/Providers.ts +10 -0
- package/src/AWS/SES/ActiveReceiptRuleSet.ts +88 -0
- package/src/AWS/SES/ReceiptFilter.ts +169 -0
- package/src/AWS/SES/ReceiptRule.ts +300 -0
- package/src/AWS/SES/ReceiptRuleSet.ts +164 -0
- package/src/AWS/SES/SendBounce.ts +44 -0
- package/src/AWS/SES/SendBounceHttp.ts +13 -0
- package/src/AWS/SES/index.ts +6 -0
- package/src/AWS/StateStore/State.ts +159 -42
- package/src/Apply.ts +199 -83
- package/src/Axiom/Telemetry.ts +119 -0
- package/src/Axiom/index.ts +1 -0
- package/src/Bundle/Bundle.ts +17 -7
- package/src/Bundle/BundleAnalyzerPlugin.ts +9 -4
- package/src/Bundle/PurePlugin.ts +19 -9
- package/src/Cli/checkVersion.ts +102 -16
- package/src/Cli/commands/_shared.ts +2 -0
- package/src/Cli/commands/deploy.ts +3 -14
- package/src/Cli/commands/logs.ts +6 -1
- package/src/Cli/commands/tail.ts +6 -1
- package/src/Cli/main.ts +5 -4
- package/src/Cloudflare/AI/Search.ts +4 -18
- package/src/Cloudflare/AI/SearchInstance.ts +7 -26
- package/src/Cloudflare/ApiToken/AccountApiToken.ts +3 -0
- package/src/Cloudflare/Auth/AuthProvider.ts +17 -3
- package/src/Cloudflare/Auth/OAuthClient.ts +58 -2
- package/src/Cloudflare/Containers/Container.ts +92 -3
- package/src/Cloudflare/Containers/ContainerApplication.ts +31 -5
- package/src/Cloudflare/Containers/ContainerBundle.ts +10 -2
- package/src/Cloudflare/Containers/ContainerProvider.ts +62 -0
- package/src/Cloudflare/Credentials.ts +69 -9
- package/src/Cloudflare/D1/ApplyMigrations.ts +72 -77
- package/src/Cloudflare/D1/Database.ts +169 -2
- package/src/Cloudflare/D1/LocalD1Gateway.ts +150 -0
- package/src/Cloudflare/D1/QueryDatabaseHttpClient.ts +49 -11
- package/src/Cloudflare/D1/QueryDatabaseLocal.ts +44 -2
- package/src/Cloudflare/DNS/Record.ts +30 -4
- package/src/Cloudflare/Email/Address.ts +18 -1
- package/src/Cloudflare/Email/SendBinding.ts +1 -0
- package/src/Cloudflare/Email/SendEmail.ts +13 -0
- package/src/Cloudflare/Flagship/App.ts +18 -6
- package/src/Cloudflare/KV/LocalKVGateway.ts +86 -0
- package/src/Cloudflare/KV/Namespace.ts +47 -1
- package/src/Cloudflare/KV/NamespaceLocal.ts +29 -6
- package/src/Cloudflare/KV/ReadNamespaceLocal.ts +5 -1
- package/src/Cloudflare/KV/ReadWriteNamespaceLocal.ts +5 -1
- package/src/Cloudflare/KV/WriteNamespaceLocal.ts +5 -1
- package/src/Cloudflare/LocalGateway.ts +86 -0
- package/src/Cloudflare/LocalRuntime.ts +21 -1
- package/src/Cloudflare/Logs.ts +58 -28
- package/src/Cloudflare/Providers.ts +4 -2
- package/src/Cloudflare/Queues/Consumer.ts +70 -2
- package/src/Cloudflare/Queues/Queue.ts +7 -16
- package/src/Cloudflare/Queues/QueueBinding.ts +21 -0
- package/src/Cloudflare/Queues/QueueShim.ts +193 -0
- package/src/Cloudflare/R2/Bucket.ts +55 -1
- package/src/Cloudflare/R2/BucketBinding.ts +17 -3
- package/src/Cloudflare/R2/BucketLocal.ts +25 -8
- package/src/Cloudflare/R2/LocalR2Gateway.ts +84 -0
- package/src/Cloudflare/R2/ReadBucketLocal.ts +7 -1
- package/src/Cloudflare/R2/ReadWriteBucketLocal.ts +7 -1
- package/src/Cloudflare/R2/WriteBucketLocal.ts +7 -1
- package/src/Cloudflare/Ruleset/AccountEntrypoint.ts +5 -1
- package/src/Cloudflare/Ruleset/Ruleset.ts +20 -6
- package/src/Cloudflare/Rum/Site.ts +11 -4
- package/src/Cloudflare/StateStore/Api.ts +1 -1
- package/src/Cloudflare/Tunnel/Tunnel.ts +23 -1
- package/src/Cloudflare/Website/StaticSite.ts +117 -28
- package/src/Cloudflare/Website/Vite.ts +33 -19
- package/src/Cloudflare/Workers/Compatibility.ts +27 -7
- package/src/Cloudflare/Workers/DurableObject.ts +22 -0
- package/src/Cloudflare/Workers/DurableObjectBridge.ts +29 -10
- package/src/Cloudflare/Workers/InferEnv.ts +74 -59
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +619 -401
- package/src/Cloudflare/Workers/Worker.ts +676 -28
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +209 -25
- package/src/Cloudflare/Workers/WorkerBinding.ts +67 -3
- package/src/Cloudflare/Workers/WorkerBridge.ts +26 -4
- package/src/Cloudflare/Workers/WorkerBundle.ts +6 -1
- package/src/Cloudflare/Workers/WorkerProvider.ts +2269 -277
- package/src/Cloudflare/Workflows/WorkflowBridge.ts +31 -13
- package/src/Command/Build.ts +8 -8
- package/src/Command/Command.ts +217 -42
- package/src/Command/Dev.ts +79 -107
- package/src/Command/Exec.ts +11 -2
- package/src/Command/Memo.ts +27 -3
- package/src/Command/Redaction.ts +181 -0
- package/src/Destroy.ts +1 -10
- package/src/Docker/Container.ts +55 -15
- package/src/Docker/Context.ts +236 -0
- package/src/Docker/Docker.ts +393 -43
- package/src/Docker/Image.ts +28 -7
- package/src/Docker/Network.ts +38 -14
- package/src/Docker/Providers.ts +16 -1
- package/src/Docker/RemoteImage.ts +23 -7
- package/src/Docker/Service.ts +1119 -0
- package/src/Docker/ServiceImage.ts +331 -0
- package/src/Docker/Swarm.ts +226 -0
- package/src/Docker/Volume.ts +25 -6
- package/src/Docker/index.ts +3 -0
- package/src/Http.ts +15 -2
- package/src/Local/LocalProvider.ts +518 -0
- package/src/Local/ProviderLayer.ts +113 -11
- package/src/Local/RpcProvider.ts +10 -5
- package/src/Local/RpcProviderProxy.ts +4 -1
- package/src/Local/RpcServer.ts +20 -2
- package/src/Plan.ts +182 -54
- package/src/Planetscale/AuthProvider.ts +15 -2
- package/src/Planetscale/Branch.ts +39 -6
- package/src/Planetscale/MySQL/MySQLDatabase.ts +34 -6
- package/src/Planetscale/OAuthClient.ts +59 -3
- package/src/Planetscale/Postgres/PostgresDatabase.ts +33 -5
- package/src/Platform.ts +29 -17
- package/src/Prisma/App.ts +433 -0
- package/src/Prisma/AuthProvider.ts +260 -0
- package/src/Prisma/Branch.ts +417 -0
- package/src/Prisma/Client.ts +1337 -0
- package/src/Prisma/Compute.ts +2878 -0
- package/src/Prisma/ComputeArchive.ts +432 -0
- package/src/Prisma/ComputeBuild.ts +1652 -0
- package/src/Prisma/ComputeLifecycle.ts +391 -0
- package/src/Prisma/Connect.ts +433 -0
- package/src/Prisma/Connection.ts +643 -0
- package/src/Prisma/CustomDomain.ts +373 -0
- package/src/Prisma/Database.ts +850 -0
- package/src/Prisma/Deployment.ts +661 -0
- package/src/Prisma/EnvironmentVariable.ts +417 -0
- package/src/Prisma/Internal/AppIdentity.ts +19 -0
- package/src/Prisma/Internal/AppPromotion.ts +172 -0
- package/src/Prisma/Internal/ArchivePlatform.ts +320 -0
- package/src/Prisma/Internal/ArtifactFile.ts +242 -0
- package/src/Prisma/Internal/ArtifactUpload.ts +86 -0
- package/src/Prisma/Internal/BundlePaths.ts +28 -0
- package/src/Prisma/Internal/CleanupFailure.ts +17 -0
- package/src/Prisma/Internal/DatabaseSecrets.ts +175 -0
- package/src/Prisma/Internal/DeploymentActions.ts +59 -0
- package/src/Prisma/Internal/DeploymentIdentity.ts +25 -0
- package/src/Prisma/Internal/DeploymentObserve.ts +6 -0
- package/src/Prisma/Internal/EnvName.ts +24 -0
- package/src/Prisma/Internal/HttpClient.ts +30 -0
- package/src/Prisma/Operations.ts +259 -0
- package/src/Prisma/Postgres.ts +25 -0
- package/src/Prisma/PostgresOrigin.ts +52 -0
- package/src/Prisma/PrismaDevDatabase.ts +395 -0
- package/src/Prisma/PrismaEnvironment.ts +89 -0
- package/src/Prisma/PrismaLogs.ts +434 -0
- package/src/Prisma/Project.ts +687 -0
- package/src/Prisma/Providers.ts +471 -0
- package/src/Prisma/Refs.ts +69 -0
- package/src/Prisma/SourceRepository.ts +455 -0
- package/src/Prisma/Types.ts +611 -0
- package/src/Prisma/index.ts +24 -0
- package/src/Provider.ts +155 -39
- package/src/ProviderMode.ts +123 -0
- package/src/Resource.ts +46 -0
- package/src/RuntimeContext.ts +7 -0
- package/src/Server/Process.ts +33 -0
- package/src/State/InMemoryState.ts +2 -0
- package/src/State/ResourceState.ts +18 -0
- package/src/Sync.ts +14 -2
- package/src/Telemetry.ts +736 -0
- package/src/Test/Alchemy.ts +3 -1
- package/src/Test/Core.ts +1 -8
- package/src/Util/Clank.ts +37 -11
- package/src/Util/zip.ts +39 -0
- package/src/index.ts +3 -0
|
@@ -0,0 +1,1119 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Equal from "effect/Equal";
|
|
3
|
+
import * as Redacted from "effect/Redacted";
|
|
4
|
+
import * as Schedule from "effect/Schedule";
|
|
5
|
+
import type * as rolldown from "rolldown";
|
|
6
|
+
import { Unowned } from "../AdoptPolicy.ts";
|
|
7
|
+
import { deepEqual, isResolved } from "../Diff.ts";
|
|
8
|
+
import { Platform, type Main, type PlatformProps } from "../Platform.ts";
|
|
9
|
+
import * as Provider from "../Provider.ts";
|
|
10
|
+
import type { Resource } from "../Resource.ts";
|
|
11
|
+
import {
|
|
12
|
+
createContainerRuntimeContext,
|
|
13
|
+
type HostRuntimeContext,
|
|
14
|
+
type ServerHost,
|
|
15
|
+
} from "../Server/Process.ts";
|
|
16
|
+
import { Stack } from "../Stack.ts";
|
|
17
|
+
import { createInternalTags, hasAlchemyTags } from "../Tags.ts";
|
|
18
|
+
import {
|
|
19
|
+
Docker,
|
|
20
|
+
dockerEngineContextName,
|
|
21
|
+
dockerPhysicalName,
|
|
22
|
+
} from "./Docker.ts";
|
|
23
|
+
import type { Providers } from "./Providers.ts";
|
|
24
|
+
import { makeServiceImage } from "./ServiceImage.ts";
|
|
25
|
+
|
|
26
|
+
export interface ServicePropsBase extends PlatformProps {
|
|
27
|
+
/**
|
|
28
|
+
* Service name.
|
|
29
|
+
*
|
|
30
|
+
* @default Generated from stack, stage, logical id, and instance id.
|
|
31
|
+
*/
|
|
32
|
+
name?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The engine the service is deployed to: a Docker context name, a
|
|
35
|
+
* `Docker.Context` resource, or a `Docker.Swarm` — passing the swarm also
|
|
36
|
+
* orders the service after the swarm is initialized.
|
|
37
|
+
*/
|
|
38
|
+
context?: Docker.EngineRef;
|
|
39
|
+
/** Entrypoint command passed after the image. */
|
|
40
|
+
command?: string[];
|
|
41
|
+
/** Additional args appended after `command`. */
|
|
42
|
+
args?: string[];
|
|
43
|
+
/** Environment variables. Use Redacted for secrets. */
|
|
44
|
+
environment?: Record<string, string | Redacted.Redacted<string>>;
|
|
45
|
+
/**
|
|
46
|
+
* Environment variables injected by the platform (bound `Config` values and
|
|
47
|
+
* future bindings). Merged after `environment`; usually not set directly.
|
|
48
|
+
*/
|
|
49
|
+
env?: Record<string, any>;
|
|
50
|
+
/** Overlay networks attached to this service. */
|
|
51
|
+
networks?: Array<string | Service.NetworkAttachment>;
|
|
52
|
+
/** Published port mappings. */
|
|
53
|
+
ports?: Service.PortMapping[];
|
|
54
|
+
/**
|
|
55
|
+
* Service discovery endpoint mode.
|
|
56
|
+
*
|
|
57
|
+
* @default "vip"
|
|
58
|
+
*/
|
|
59
|
+
endpointMode?: "vip" | "dnsrr";
|
|
60
|
+
/**
|
|
61
|
+
* Desired number of service replicas.
|
|
62
|
+
*
|
|
63
|
+
* @default 1
|
|
64
|
+
*/
|
|
65
|
+
replicas?: number;
|
|
66
|
+
/** Placement controls for task scheduling. */
|
|
67
|
+
placement?: Service.Placement;
|
|
68
|
+
/** Deprecated alias for `placement.constraints`. */
|
|
69
|
+
constraints?: string[];
|
|
70
|
+
/** Rolling update strategy for service updates. */
|
|
71
|
+
updateConfig?: Service.RolloutConfig;
|
|
72
|
+
/** Rollback strategy applied when updates fail. */
|
|
73
|
+
rollbackConfig?: Service.RolloutConfig;
|
|
74
|
+
/** Task restart behavior. */
|
|
75
|
+
restartPolicy?: Service.RestartPolicy;
|
|
76
|
+
/** Container healthcheck for service tasks. */
|
|
77
|
+
healthcheck?: Service.Healthcheck;
|
|
78
|
+
/** Grace period before force-killing a task during shutdown, e.g. `"30s"`. */
|
|
79
|
+
stopGracePeriod?: string;
|
|
80
|
+
/** Volume or bind mounts. */
|
|
81
|
+
volumes?: Service.VolumeMapping[];
|
|
82
|
+
/** Swarm secrets mounted into task containers. */
|
|
83
|
+
secrets?: Service.SecretRef[];
|
|
84
|
+
/** Swarm configs mounted into task containers. */
|
|
85
|
+
configs?: Service.ConfigRef[];
|
|
86
|
+
/**
|
|
87
|
+
* Mount task root filesystem read-only.
|
|
88
|
+
*
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
readOnlyRootFs?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Service labels. Alchemy's internal ownership labels are added
|
|
94
|
+
* automatically.
|
|
95
|
+
*/
|
|
96
|
+
labels?: Record<string, string>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Run a pre-built image: a registry reference or a Docker image resource
|
|
101
|
+
* (`Docker.Image` / `Docker.RemoteImage`).
|
|
102
|
+
*/
|
|
103
|
+
export interface ImageServiceProps extends ServicePropsBase {
|
|
104
|
+
/** Docker image reference or Docker image resource. */
|
|
105
|
+
image: Service.Image;
|
|
106
|
+
main?: undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Bundle an inline Effect program (`main`) into a generated image built
|
|
111
|
+
* against the service's Docker context. The optional `image` is the
|
|
112
|
+
* environment base (`FROM`) and must be able to run the bun runtime.
|
|
113
|
+
*/
|
|
114
|
+
export interface BundledServiceProps extends ServicePropsBase {
|
|
115
|
+
/**
|
|
116
|
+
* Module entrypoint for the bundled program. This should typically be
|
|
117
|
+
* `import.meta.url` (or `import.meta.filename`) from an inline Effect
|
|
118
|
+
* program.
|
|
119
|
+
*/
|
|
120
|
+
main: string;
|
|
121
|
+
/**
|
|
122
|
+
* Environment image used as the generated Dockerfile's `FROM`. Must be
|
|
123
|
+
* able to run the bun runtime.
|
|
124
|
+
*
|
|
125
|
+
* @default "oven/bun:1"
|
|
126
|
+
*/
|
|
127
|
+
image?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Container port the bundled HTTP server listens on. Baked into the image
|
|
130
|
+
* as `ENV PORT` + `EXPOSE`; publish it to the swarm ingress with `ports`.
|
|
131
|
+
*/
|
|
132
|
+
port?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Named export to load from `main`.
|
|
135
|
+
*
|
|
136
|
+
* @default "default"
|
|
137
|
+
*/
|
|
138
|
+
handler?: string;
|
|
139
|
+
/** Bundler configuration for the entrypoint. */
|
|
140
|
+
build?: {
|
|
141
|
+
input?: Partial<rolldown.InputOptions>;
|
|
142
|
+
output?: Partial<rolldown.OutputOptions>;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Service props — the image comes from exactly one of two sources, flat on
|
|
148
|
+
* the props: `image` (a pre-built reference) or `main` (a bundled Effect
|
|
149
|
+
* program).
|
|
150
|
+
*/
|
|
151
|
+
export type ServiceProps = ImageServiceProps | BundledServiceProps;
|
|
152
|
+
|
|
153
|
+
export declare namespace Service {
|
|
154
|
+
type Image = string | { imageRef: string };
|
|
155
|
+
|
|
156
|
+
interface PortMapping {
|
|
157
|
+
/** Published port on the swarm node. Omit to let Swarm assign one dynamically. */
|
|
158
|
+
external?: number;
|
|
159
|
+
/** Container port receiving traffic. */
|
|
160
|
+
internal: number;
|
|
161
|
+
/**
|
|
162
|
+
* Protocol used for the mapping.
|
|
163
|
+
*
|
|
164
|
+
* @default "tcp"
|
|
165
|
+
*/
|
|
166
|
+
protocol?: "tcp" | "udp";
|
|
167
|
+
/**
|
|
168
|
+
* Publish through the swarm routing mesh (`ingress`) or directly on each
|
|
169
|
+
* node (`host`).
|
|
170
|
+
*
|
|
171
|
+
* @default "ingress"
|
|
172
|
+
*/
|
|
173
|
+
mode?: "ingress" | "host";
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface VolumeMapping {
|
|
177
|
+
/** Host path or named volume source. */
|
|
178
|
+
hostPath: string;
|
|
179
|
+
/** Container path. */
|
|
180
|
+
containerPath: string;
|
|
181
|
+
/**
|
|
182
|
+
* Mount read-only.
|
|
183
|
+
*
|
|
184
|
+
* @default false
|
|
185
|
+
*/
|
|
186
|
+
readOnly?: boolean;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
interface NetworkAttachment {
|
|
190
|
+
/** Network name. */
|
|
191
|
+
name: string;
|
|
192
|
+
/** Network aliases for the service's tasks. */
|
|
193
|
+
aliases?: string[];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface Placement {
|
|
197
|
+
/** Placement constraints, e.g. `"node.role==worker"`. */
|
|
198
|
+
constraints?: string[];
|
|
199
|
+
/** Placement preferences, e.g. `"spread=node.labels.zone"`. */
|
|
200
|
+
preferences?: string[];
|
|
201
|
+
/** Maximum number of replicas per swarm node. */
|
|
202
|
+
maxReplicasPerNode?: number;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
interface RolloutConfig {
|
|
206
|
+
/** Number of tasks updated simultaneously. */
|
|
207
|
+
parallelism?: number;
|
|
208
|
+
/** Delay between task updates, e.g. `"10s"`. */
|
|
209
|
+
delay?: string;
|
|
210
|
+
/** Duration to monitor each updated task for failure, e.g. `"30s"`. */
|
|
211
|
+
monitor?: string;
|
|
212
|
+
/** Action on update failure. */
|
|
213
|
+
failureAction?: "pause" | "continue" | "rollback";
|
|
214
|
+
/** Failure ratio tolerated during an update. */
|
|
215
|
+
maxFailureRatio?: number;
|
|
216
|
+
/** Operation order during updates. */
|
|
217
|
+
order?: "stop-first" | "start-first";
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
interface RestartPolicy {
|
|
221
|
+
/** Condition under which tasks restart. */
|
|
222
|
+
condition?: "none" | "on-failure" | "any";
|
|
223
|
+
/** Delay between restart attempts, e.g. `"5s"`. */
|
|
224
|
+
delay?: string;
|
|
225
|
+
/** Maximum restart attempts before giving up. */
|
|
226
|
+
maxAttempts?: number;
|
|
227
|
+
/** Window used to evaluate the restart policy, e.g. `"120s"`. */
|
|
228
|
+
window?: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface Healthcheck {
|
|
232
|
+
/** Command to run for health checks. */
|
|
233
|
+
cmd: string[] | string;
|
|
234
|
+
/** Time between checks, e.g. `"30s"`. */
|
|
235
|
+
interval?: string;
|
|
236
|
+
/** Maximum time a check may run, e.g. `"5s"`. */
|
|
237
|
+
timeout?: string;
|
|
238
|
+
/** Consecutive failures before unhealthy. */
|
|
239
|
+
retries?: number;
|
|
240
|
+
/** Startup grace period, e.g. `"30s"`. */
|
|
241
|
+
startPeriod?: string;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
interface SecretRef {
|
|
245
|
+
/** Swarm secret name. */
|
|
246
|
+
source: string;
|
|
247
|
+
/** Target file name in `/run/secrets/`. Defaults to `source`. */
|
|
248
|
+
target?: string;
|
|
249
|
+
/** File owner uid. */
|
|
250
|
+
uid?: string;
|
|
251
|
+
/** File owner gid. */
|
|
252
|
+
gid?: string;
|
|
253
|
+
/** File mode, e.g. `0o400`. */
|
|
254
|
+
mode?: number | string;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
interface ConfigRef {
|
|
258
|
+
/** Swarm config name. */
|
|
259
|
+
source: string;
|
|
260
|
+
/** Target path in the container. Defaults to `/<source>`. */
|
|
261
|
+
target?: string;
|
|
262
|
+
/** File owner uid. */
|
|
263
|
+
uid?: string;
|
|
264
|
+
/** File owner gid. */
|
|
265
|
+
gid?: string;
|
|
266
|
+
/** File mode, e.g. `0o444`. */
|
|
267
|
+
mode?: number | string;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface Service extends Resource<
|
|
272
|
+
"Docker.Service",
|
|
273
|
+
ServiceProps,
|
|
274
|
+
{
|
|
275
|
+
/** Swarm service id. */
|
|
276
|
+
id: string;
|
|
277
|
+
/** Swarm service name. */
|
|
278
|
+
name: string;
|
|
279
|
+
/** Docker context the service is deployed to. */
|
|
280
|
+
context?: string;
|
|
281
|
+
/** Image reference the service runs. */
|
|
282
|
+
image: string;
|
|
283
|
+
/** Desired number of replicas. */
|
|
284
|
+
replicas: number;
|
|
285
|
+
/** Network ids the service's tasks attach to. */
|
|
286
|
+
networks: string[];
|
|
287
|
+
/** Published port mappings reported by Swarm. */
|
|
288
|
+
ports: Service.PortMapping[];
|
|
289
|
+
/** Service labels reported by Swarm. */
|
|
290
|
+
labels: Record<string, string>;
|
|
291
|
+
/** Service discovery endpoint mode. */
|
|
292
|
+
endpointMode: "vip" | "dnsrr";
|
|
293
|
+
/** Creation timestamp in milliseconds since epoch. */
|
|
294
|
+
createdAt: number;
|
|
295
|
+
/** Last update timestamp in milliseconds since epoch. */
|
|
296
|
+
updatedAt: number;
|
|
297
|
+
/** Content hash of the bundled program's image (`main` form only). */
|
|
298
|
+
code?: {
|
|
299
|
+
/** Content hash of the bundled program's image. */
|
|
300
|
+
hash: string;
|
|
301
|
+
};
|
|
302
|
+
},
|
|
303
|
+
never,
|
|
304
|
+
Providers
|
|
305
|
+
> {}
|
|
306
|
+
|
|
307
|
+
/** Services available to an effectful `Service` impl at init time. */
|
|
308
|
+
export type ServiceServices = ServerHost;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* The impl shape for an effectful `Service`: a long-running server returning
|
|
312
|
+
* `{ fetch }` (plus optional RPC methods).
|
|
313
|
+
*/
|
|
314
|
+
export type ServiceShape = Main<ServiceServices>;
|
|
315
|
+
|
|
316
|
+
export interface ServiceRuntimeContext extends HostRuntimeContext {
|
|
317
|
+
readonly Type: "Docker.Service";
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* A Docker Swarm service: N replicas of a container kept alive by the swarm,
|
|
322
|
+
* deployed through the active (or a named) Docker context.
|
|
323
|
+
*
|
|
324
|
+
* The target engine must be a swarm manager — `Service` wraps
|
|
325
|
+
* `docker service`, swarm mode's orchestration API. Declare the swarm with
|
|
326
|
+
* `Docker.Swarm` and pass it as `context` so the service deploys after the
|
|
327
|
+
* swarm exists; for a plain single container on a non-swarm daemon use
|
|
328
|
+
* `Docker.Container` instead.
|
|
329
|
+
*
|
|
330
|
+
* The service's image comes from one of two sources:
|
|
331
|
+
*
|
|
332
|
+
* - `image` — run a pre-built reference (a registry ref, or a `Docker.Image`
|
|
333
|
+
* / `Docker.RemoteImage` resource).
|
|
334
|
+
* - `main` — bundle an inline Effect program into a generated bun image,
|
|
335
|
+
* built directly against the service's Docker context. The impl returns
|
|
336
|
+
* `{ fetch }` and may register background loops via `ServerHost.run` —
|
|
337
|
+
* the same effectful platform shape as `AWS.ECS.Service`.
|
|
338
|
+
*
|
|
339
|
+
* The bundled image is content-addressed and only rebuilt when the program
|
|
340
|
+
* (or its generated Dockerfile) changes. It is built on the target engine's
|
|
341
|
+
* local store — single-node swarms run it as-is; multi-node swarms need the
|
|
342
|
+
* image on a registry every node can reach (build with `Docker.Image` +
|
|
343
|
+
* `registry` and pass the pushed ref as `image` instead).
|
|
344
|
+
*
|
|
345
|
+
* Only replicated services are supported. Configuration changes replace the
|
|
346
|
+
* service (delete-then-create); swarm tasks are stateless, so replacement is
|
|
347
|
+
* cheap and avoids partially-applied `service update` drift.
|
|
348
|
+
* @resource
|
|
349
|
+
* @section Creating Services
|
|
350
|
+
* @example Replicated Nginx
|
|
351
|
+
* ```typescript
|
|
352
|
+
* const swarm = yield* Docker.Swarm("swarm");
|
|
353
|
+
* const web = yield* Docker.Service("web", {
|
|
354
|
+
* context: swarm,
|
|
355
|
+
* image: "nginx:alpine",
|
|
356
|
+
* replicas: 3,
|
|
357
|
+
* ports: [{ external: 8080, internal: 80 }],
|
|
358
|
+
* });
|
|
359
|
+
* ```
|
|
360
|
+
*
|
|
361
|
+
* @example Run a Built Image
|
|
362
|
+
* ```typescript
|
|
363
|
+
* const image = yield* Docker.Image("app-image", {
|
|
364
|
+
* build: { context: "./app" },
|
|
365
|
+
* });
|
|
366
|
+
* const app = yield* Docker.Service("app", {
|
|
367
|
+
* context: swarm,
|
|
368
|
+
* image,
|
|
369
|
+
* replicas: 2,
|
|
370
|
+
* });
|
|
371
|
+
* ```
|
|
372
|
+
*
|
|
373
|
+
* @section Effectful Services
|
|
374
|
+
* @example Inline Effect Server
|
|
375
|
+
* ```typescript
|
|
376
|
+
* const swarm = yield* Docker.Swarm("swarm");
|
|
377
|
+
* const api = yield* Docker.Service(
|
|
378
|
+
* "Api",
|
|
379
|
+
* {
|
|
380
|
+
* context: swarm,
|
|
381
|
+
* main: import.meta.url,
|
|
382
|
+
* port: 3000,
|
|
383
|
+
* ports: [{ external: 8080, internal: 3000 }],
|
|
384
|
+
* replicas: 2,
|
|
385
|
+
* },
|
|
386
|
+
* Effect.gen(function* () {
|
|
387
|
+
* return {
|
|
388
|
+
* fetch: Effect.gen(function* () {
|
|
389
|
+
* return yield* HttpServerResponse.json({ ok: true });
|
|
390
|
+
* }),
|
|
391
|
+
* };
|
|
392
|
+
* }),
|
|
393
|
+
* );
|
|
394
|
+
* ```
|
|
395
|
+
*
|
|
396
|
+
* @example Background Loops with ServerHost
|
|
397
|
+
* ```typescript
|
|
398
|
+
* // Class props may be an Effect, so the service can yield the swarm it
|
|
399
|
+
* // deploys into (declared once at module level).
|
|
400
|
+
* const Swarm = Docker.Swarm("swarm");
|
|
401
|
+
*
|
|
402
|
+
* export default class Worker extends Docker.Service<Worker>()(
|
|
403
|
+
* "Worker",
|
|
404
|
+
* Effect.gen(function* () {
|
|
405
|
+
* const swarm = yield* Swarm;
|
|
406
|
+
* return { context: swarm, main: import.meta.url, port: 3000 };
|
|
407
|
+
* }),
|
|
408
|
+
* Effect.gen(function* () {
|
|
409
|
+
* const host = yield* ServerHost;
|
|
410
|
+
* yield* host.run(
|
|
411
|
+
* pollQueue.pipe(Effect.repeat(Schedule.spaced("5 seconds")), Effect.asVoid),
|
|
412
|
+
* );
|
|
413
|
+
* return {
|
|
414
|
+
* fetch: Effect.succeed(HttpServerResponse.text("ok")),
|
|
415
|
+
* };
|
|
416
|
+
* }),
|
|
417
|
+
* ) {}
|
|
418
|
+
* ```
|
|
419
|
+
*
|
|
420
|
+
* @section Docker Contexts
|
|
421
|
+
* @example Deploy to a Remote Swarm over SSH
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const vps = yield* Docker.Context("vps", {
|
|
424
|
+
* docker: "host=ssh://deploy@example.com",
|
|
425
|
+
* });
|
|
426
|
+
* const swarm = yield* Docker.Swarm("swarm", {
|
|
427
|
+
* context: vps,
|
|
428
|
+
* advertiseAddr: "10.0.0.1",
|
|
429
|
+
* });
|
|
430
|
+
* const app = yield* Docker.Service("app", {
|
|
431
|
+
* context: swarm,
|
|
432
|
+
* image: "nginx:alpine",
|
|
433
|
+
* replicas: 3,
|
|
434
|
+
* });
|
|
435
|
+
* ```
|
|
436
|
+
*
|
|
437
|
+
* @section Networks & Volumes
|
|
438
|
+
* @example Overlay Network with Aliases
|
|
439
|
+
* ```typescript
|
|
440
|
+
* const network = yield* Docker.Network("app-net", {
|
|
441
|
+
* context: swarm,
|
|
442
|
+
* driver: "overlay",
|
|
443
|
+
* });
|
|
444
|
+
* const db = yield* Docker.Service("db", {
|
|
445
|
+
* context: swarm,
|
|
446
|
+
* image: "postgres:18-alpine",
|
|
447
|
+
* networks: [{ name: network.name, aliases: ["postgres"] }],
|
|
448
|
+
* volumes: [{ hostPath: "pg-data", containerPath: "/var/lib/postgresql/data" }],
|
|
449
|
+
* });
|
|
450
|
+
* ```
|
|
451
|
+
*
|
|
452
|
+
* @section Rollouts & Placement
|
|
453
|
+
* @example Rolling Update with Rollback
|
|
454
|
+
* ```typescript
|
|
455
|
+
* const app = yield* Docker.Service("app", {
|
|
456
|
+
* image: "ghcr.io/acme/app:latest",
|
|
457
|
+
* replicas: 4,
|
|
458
|
+
* updateConfig: {
|
|
459
|
+
* parallelism: 1,
|
|
460
|
+
* delay: "10s",
|
|
461
|
+
* failureAction: "rollback",
|
|
462
|
+
* order: "start-first",
|
|
463
|
+
* },
|
|
464
|
+
* placement: {
|
|
465
|
+
* constraints: ["node.role==worker"],
|
|
466
|
+
* maxReplicasPerNode: 2,
|
|
467
|
+
* },
|
|
468
|
+
* });
|
|
469
|
+
* ```
|
|
470
|
+
*
|
|
471
|
+
* @section Secrets & Configs
|
|
472
|
+
* @example Mount Swarm Secrets
|
|
473
|
+
* ```typescript
|
|
474
|
+
* const app = yield* Docker.Service("app", {
|
|
475
|
+
* image: "ghcr.io/acme/app:latest",
|
|
476
|
+
* secrets: [{ source: "db-password", target: "db_password", mode: 0o400 }],
|
|
477
|
+
* configs: [{ source: "app-config", target: "/etc/app/config.yaml" }],
|
|
478
|
+
* });
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
export const Service: Platform<
|
|
482
|
+
Service,
|
|
483
|
+
ServiceServices,
|
|
484
|
+
ServiceShape,
|
|
485
|
+
ServiceRuntimeContext
|
|
486
|
+
> = Platform("Docker.Service", {
|
|
487
|
+
createRuntimeContext: createContainerRuntimeContext("Docker.Service") as (
|
|
488
|
+
id: string,
|
|
489
|
+
) => ServiceRuntimeContext,
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
/** True when the props declare a bundled `main` program. */
|
|
493
|
+
const isBundledService = (props: ServiceProps): props is BundledServiceProps =>
|
|
494
|
+
typeof (props as BundledServiceProps).main === "string";
|
|
495
|
+
|
|
496
|
+
type ServiceInspect = {
|
|
497
|
+
ID: string;
|
|
498
|
+
CreatedAt?: string;
|
|
499
|
+
UpdatedAt?: string;
|
|
500
|
+
Spec: {
|
|
501
|
+
Name: string;
|
|
502
|
+
Labels?: Record<string, string> | null;
|
|
503
|
+
TaskTemplate?: {
|
|
504
|
+
ContainerSpec?: {
|
|
505
|
+
Image?: string;
|
|
506
|
+
};
|
|
507
|
+
Networks?: Array<{ Target?: string }>;
|
|
508
|
+
Placement?: {
|
|
509
|
+
Constraints?: string[];
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
Mode?: {
|
|
513
|
+
Replicated?: {
|
|
514
|
+
Replicas?: number;
|
|
515
|
+
};
|
|
516
|
+
Global?: Record<string, never>;
|
|
517
|
+
};
|
|
518
|
+
EndpointSpec?: {
|
|
519
|
+
Mode?: "vip" | "dnsrr";
|
|
520
|
+
Ports?: Array<{
|
|
521
|
+
PublishedPort?: number;
|
|
522
|
+
TargetPort?: number;
|
|
523
|
+
Protocol?: "tcp" | "udp";
|
|
524
|
+
PublishMode?: "ingress" | "host";
|
|
525
|
+
}>;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
export const ServiceProvider = () =>
|
|
531
|
+
Provider.effect(
|
|
532
|
+
Service,
|
|
533
|
+
Effect.gen(function* () {
|
|
534
|
+
const docker = yield* Docker;
|
|
535
|
+
const stack = yield* Stack;
|
|
536
|
+
const serviceImage = yield* makeServiceImage;
|
|
537
|
+
|
|
538
|
+
// The bundled program's bootstrap reads these to rebuild the Stack at
|
|
539
|
+
// container runtime (same contract as the ECS bootstrap).
|
|
540
|
+
const alchemyEnv = {
|
|
541
|
+
ALCHEMY_STACK_NAME: stack.name,
|
|
542
|
+
ALCHEMY_STAGE: stack.stage,
|
|
543
|
+
ALCHEMY_PHASE: "runtime",
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
const inspect = (id: string, context?: string) =>
|
|
547
|
+
docker.service.inspect(id, context).pipe(
|
|
548
|
+
Effect.map((result) => normalizeServiceInspect(result)),
|
|
549
|
+
Effect.catchReason(
|
|
550
|
+
"PlatformError",
|
|
551
|
+
"NotFound",
|
|
552
|
+
() => Effect.undefined,
|
|
553
|
+
),
|
|
554
|
+
);
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Resolve the image the service should run: build the bundled `main`
|
|
558
|
+
* program (content-addressed, skipped when already present in the
|
|
559
|
+
* target engine) or normalize the pre-built reference.
|
|
560
|
+
*/
|
|
561
|
+
const resolveImage = Effect.fn(function* (
|
|
562
|
+
id: string,
|
|
563
|
+
props: ServiceProps,
|
|
564
|
+
name: string,
|
|
565
|
+
context: string | undefined,
|
|
566
|
+
session: { note: (message: string) => Effect.Effect<void> },
|
|
567
|
+
) {
|
|
568
|
+
if (isBundledService(props)) {
|
|
569
|
+
return yield* serviceImage.resolve({
|
|
570
|
+
id,
|
|
571
|
+
source: props,
|
|
572
|
+
name,
|
|
573
|
+
context,
|
|
574
|
+
isExternal: props.isExternal,
|
|
575
|
+
session,
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
return {
|
|
579
|
+
imageRef: normalizeImageRef(props.image),
|
|
580
|
+
codeHash: undefined,
|
|
581
|
+
};
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
return Service.Provider.of({
|
|
585
|
+
list: () => Effect.succeed([]),
|
|
586
|
+
read: Effect.fn(function* ({ id, instanceId, olds, output }) {
|
|
587
|
+
const name = yield* servicePhysicalName(id, olds, instanceId);
|
|
588
|
+
const context = dockerEngineContextName(olds?.context);
|
|
589
|
+
const live = yield* inspect(name, context);
|
|
590
|
+
if (!live) return undefined;
|
|
591
|
+
ensureReplicatedMode(live);
|
|
592
|
+
const attrs = toServiceAttributes(live, context, output?.code);
|
|
593
|
+
if (output) return attrs;
|
|
594
|
+
const owned = yield* hasAlchemyTags(
|
|
595
|
+
id,
|
|
596
|
+
live.Spec.Labels ?? undefined,
|
|
597
|
+
);
|
|
598
|
+
return owned ? attrs : Unowned(attrs);
|
|
599
|
+
}),
|
|
600
|
+
diff: Effect.fn(function* ({ id, instanceId, news, olds, output }) {
|
|
601
|
+
if (!isResolved(news)) return undefined;
|
|
602
|
+
|
|
603
|
+
const oldDesired = yield* normalizeDesired(id, olds, instanceId);
|
|
604
|
+
const newDesired = yield* normalizeDesired(id, news, instanceId);
|
|
605
|
+
|
|
606
|
+
if (!Equal.equals(oldDesired, newDesired)) {
|
|
607
|
+
return { action: "replace" as const, deleteFirst: true };
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// Bundled program: the image identity is the content hash — a code
|
|
611
|
+
// or bootstrap change replaces the service with the new image.
|
|
612
|
+
if (isBundledService(news)) {
|
|
613
|
+
const hash = yield* serviceImage.hash({
|
|
614
|
+
source: news,
|
|
615
|
+
isExternal: news.isExternal,
|
|
616
|
+
});
|
|
617
|
+
if (hash !== output?.code?.hash) {
|
|
618
|
+
return { action: "replace" as const, deleteFirst: true };
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
return { action: "noop" as const };
|
|
623
|
+
}),
|
|
624
|
+
reconcile: Effect.fn(function* ({
|
|
625
|
+
id,
|
|
626
|
+
instanceId,
|
|
627
|
+
news,
|
|
628
|
+
olds,
|
|
629
|
+
output,
|
|
630
|
+
session,
|
|
631
|
+
}) {
|
|
632
|
+
const desired = yield* normalizeDesired(id, news, instanceId);
|
|
633
|
+
const resolved = yield* resolveImage(
|
|
634
|
+
id,
|
|
635
|
+
news,
|
|
636
|
+
desired.name,
|
|
637
|
+
desired.context,
|
|
638
|
+
session,
|
|
639
|
+
);
|
|
640
|
+
const image = resolved.imageRef;
|
|
641
|
+
const code = resolved.codeHash
|
|
642
|
+
? { hash: resolved.codeHash }
|
|
643
|
+
: undefined;
|
|
644
|
+
const environment = isBundledService(news)
|
|
645
|
+
? { ...alchemyEnv, ...desired.environment }
|
|
646
|
+
: desired.environment;
|
|
647
|
+
|
|
648
|
+
if (output && olds) {
|
|
649
|
+
const oldDesired = yield* normalizeDesired(id, olds, instanceId);
|
|
650
|
+
if (
|
|
651
|
+
deepEqual(oldDesired, desired) &&
|
|
652
|
+
(resolved.codeHash === undefined ||
|
|
653
|
+
resolved.codeHash === output.code?.hash)
|
|
654
|
+
) {
|
|
655
|
+
const current = yield* inspect(output.id, desired.context);
|
|
656
|
+
if (current) {
|
|
657
|
+
ensureReplicatedMode(current);
|
|
658
|
+
return toServiceAttributes(current, desired.context, code);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (output) {
|
|
664
|
+
const current = yield* inspect(output.id, desired.context);
|
|
665
|
+
if (current) {
|
|
666
|
+
ensureReplicatedMode(current);
|
|
667
|
+
const internalTags = yield* createInternalTags(id);
|
|
668
|
+
const allDesiredLabels = { ...internalTags, ...desired.labels };
|
|
669
|
+
const currentLabels = current.Spec.Labels ?? {};
|
|
670
|
+
const labelsToRemove = Object.keys(currentLabels).filter(
|
|
671
|
+
(k) => !(k in allDesiredLabels),
|
|
672
|
+
);
|
|
673
|
+
yield* docker.service.update({
|
|
674
|
+
context: desired.context,
|
|
675
|
+
id: output.id,
|
|
676
|
+
image,
|
|
677
|
+
replicas: desired.replicas,
|
|
678
|
+
"endpoint-mode": desired.endpointMode,
|
|
679
|
+
"constraint-add": desired.constraints,
|
|
680
|
+
"replicas-max-per-node": desired.maxReplicasPerNode,
|
|
681
|
+
"placement-pref": desired.preferences,
|
|
682
|
+
"update-parallelism": desired.updateConfig?.parallelism,
|
|
683
|
+
"update-delay": desired.updateConfig?.delay,
|
|
684
|
+
"update-monitor": desired.updateConfig?.monitor,
|
|
685
|
+
"update-failure-action": desired.updateConfig?.failureAction,
|
|
686
|
+
"update-max-failure-ratio":
|
|
687
|
+
desired.updateConfig?.maxFailureRatio,
|
|
688
|
+
"update-order": desired.updateConfig?.order,
|
|
689
|
+
"rollback-parallelism": desired.rollbackConfig?.parallelism,
|
|
690
|
+
"rollback-delay": desired.rollbackConfig?.delay,
|
|
691
|
+
"rollback-monitor": desired.rollbackConfig?.monitor,
|
|
692
|
+
"rollback-failure-action":
|
|
693
|
+
desired.rollbackConfig?.failureAction,
|
|
694
|
+
"rollback-max-failure-ratio":
|
|
695
|
+
desired.rollbackConfig?.maxFailureRatio,
|
|
696
|
+
"rollback-order": desired.rollbackConfig?.order,
|
|
697
|
+
"restart-condition": desired.restartPolicy?.condition,
|
|
698
|
+
"restart-delay": desired.restartPolicy?.delay,
|
|
699
|
+
"restart-max-attempts": desired.restartPolicy?.maxAttempts,
|
|
700
|
+
"restart-window": desired.restartPolicy?.window,
|
|
701
|
+
"health-cmd": desired.healthcheck
|
|
702
|
+
? Array.isArray(desired.healthcheck.cmd)
|
|
703
|
+
? desired.healthcheck.cmd.join(" ")
|
|
704
|
+
: desired.healthcheck.cmd
|
|
705
|
+
: undefined,
|
|
706
|
+
"health-interval": desired.healthcheck?.interval,
|
|
707
|
+
"health-timeout": desired.healthcheck?.timeout,
|
|
708
|
+
"health-retries": desired.healthcheck?.retries,
|
|
709
|
+
"health-start-period": desired.healthcheck?.startPeriod,
|
|
710
|
+
"stop-grace-period": desired.stopGracePeriod,
|
|
711
|
+
"mount-add": desired.volumes.map(formatMount),
|
|
712
|
+
"secret-add": desired.secrets.map(formatRef),
|
|
713
|
+
"config-add": desired.configs.map(formatRef),
|
|
714
|
+
"read-only": desired.readOnlyRootFs || undefined,
|
|
715
|
+
"publish-add": desired.ports.map(formatPublish),
|
|
716
|
+
"label-add": allDesiredLabels,
|
|
717
|
+
"label-rm": labelsToRemove,
|
|
718
|
+
"env-add": environment,
|
|
719
|
+
args:
|
|
720
|
+
desired.command.length > 0
|
|
721
|
+
? desired.command.concat(desired.args).join(" ")
|
|
722
|
+
: undefined,
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
return toServiceAttributes(
|
|
726
|
+
yield* inspectOrDie(inspect, output.id, desired.context),
|
|
727
|
+
desired.context,
|
|
728
|
+
code,
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
const existingByName = yield* inspect(desired.name, desired.context);
|
|
734
|
+
if (existingByName) {
|
|
735
|
+
ensureReplicatedMode(existingByName);
|
|
736
|
+
return toServiceAttributes(existingByName, desired.context, code);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
const internalTags = yield* createInternalTags(id);
|
|
740
|
+
const allDesiredLabels = { ...internalTags, ...desired.labels };
|
|
741
|
+
yield* docker.service.create({
|
|
742
|
+
context: desired.context,
|
|
743
|
+
name: desired.name,
|
|
744
|
+
image,
|
|
745
|
+
replicas: desired.replicas,
|
|
746
|
+
"endpoint-mode": desired.endpointMode,
|
|
747
|
+
network: desired.networks.map((n) =>
|
|
748
|
+
[
|
|
749
|
+
`name=${n.name}`,
|
|
750
|
+
...(n.aliases ?? []).map((a) => `alias=${a}`),
|
|
751
|
+
].join(","),
|
|
752
|
+
),
|
|
753
|
+
constraint: desired.constraints,
|
|
754
|
+
"replicas-max-per-node": desired.maxReplicasPerNode,
|
|
755
|
+
"placement-pref": desired.preferences,
|
|
756
|
+
"update-parallelism": desired.updateConfig?.parallelism,
|
|
757
|
+
"update-delay": desired.updateConfig?.delay,
|
|
758
|
+
"update-monitor": desired.updateConfig?.monitor,
|
|
759
|
+
"update-failure-action": desired.updateConfig?.failureAction,
|
|
760
|
+
"update-max-failure-ratio": desired.updateConfig?.maxFailureRatio,
|
|
761
|
+
"update-order": desired.updateConfig?.order,
|
|
762
|
+
"rollback-parallelism": desired.rollbackConfig?.parallelism,
|
|
763
|
+
"rollback-delay": desired.rollbackConfig?.delay,
|
|
764
|
+
"rollback-monitor": desired.rollbackConfig?.monitor,
|
|
765
|
+
"rollback-failure-action": desired.rollbackConfig?.failureAction,
|
|
766
|
+
"rollback-max-failure-ratio":
|
|
767
|
+
desired.rollbackConfig?.maxFailureRatio,
|
|
768
|
+
"rollback-order": desired.rollbackConfig?.order,
|
|
769
|
+
"restart-condition": desired.restartPolicy?.condition,
|
|
770
|
+
"restart-delay": desired.restartPolicy?.delay,
|
|
771
|
+
"restart-max-attempts": desired.restartPolicy?.maxAttempts,
|
|
772
|
+
"restart-window": desired.restartPolicy?.window,
|
|
773
|
+
"health-cmd": desired.healthcheck
|
|
774
|
+
? Array.isArray(desired.healthcheck.cmd)
|
|
775
|
+
? desired.healthcheck.cmd.join(" ")
|
|
776
|
+
: desired.healthcheck.cmd
|
|
777
|
+
: undefined,
|
|
778
|
+
"health-interval": desired.healthcheck?.interval,
|
|
779
|
+
"health-timeout": desired.healthcheck?.timeout,
|
|
780
|
+
"health-retries": desired.healthcheck?.retries,
|
|
781
|
+
"health-start-period": desired.healthcheck?.startPeriod,
|
|
782
|
+
"stop-grace-period": desired.stopGracePeriod,
|
|
783
|
+
mount: desired.volumes.map(formatMount),
|
|
784
|
+
secret: desired.secrets.map(formatRef),
|
|
785
|
+
config: desired.configs.map(formatRef),
|
|
786
|
+
"read-only": desired.readOnlyRootFs || undefined,
|
|
787
|
+
publish: desired.ports.map(formatPublish),
|
|
788
|
+
label: allDesiredLabels,
|
|
789
|
+
env: environment,
|
|
790
|
+
command: desired.command,
|
|
791
|
+
args: desired.args,
|
|
792
|
+
});
|
|
793
|
+
return toServiceAttributes(
|
|
794
|
+
yield* inspectOrDie(inspect, desired.name, desired.context),
|
|
795
|
+
desired.context,
|
|
796
|
+
code,
|
|
797
|
+
);
|
|
798
|
+
}),
|
|
799
|
+
delete: Effect.fn(({ output }) =>
|
|
800
|
+
docker
|
|
801
|
+
.run([
|
|
802
|
+
...(output.context ? ["--context", output.context] : []),
|
|
803
|
+
"service",
|
|
804
|
+
"scale",
|
|
805
|
+
"--detach=false",
|
|
806
|
+
`${output.id}=0`,
|
|
807
|
+
])
|
|
808
|
+
.pipe(
|
|
809
|
+
Effect.flatMap(() =>
|
|
810
|
+
docker.service.remove(output.id, output.context),
|
|
811
|
+
),
|
|
812
|
+
Effect.flatMap(() =>
|
|
813
|
+
waitForServiceContainersReleased(
|
|
814
|
+
docker,
|
|
815
|
+
output.id,
|
|
816
|
+
output.context,
|
|
817
|
+
),
|
|
818
|
+
),
|
|
819
|
+
Effect.catchReason(
|
|
820
|
+
"PlatformError",
|
|
821
|
+
"NotFound",
|
|
822
|
+
() => Effect.void,
|
|
823
|
+
),
|
|
824
|
+
// Best-effort: drop the content-addressed image built for a
|
|
825
|
+
// bundled program so replaced/destroyed services don't strand
|
|
826
|
+
// local image tags.
|
|
827
|
+
Effect.andThen(
|
|
828
|
+
output.code
|
|
829
|
+
? docker.image
|
|
830
|
+
.remove(output.image, true, output.context)
|
|
831
|
+
.pipe(Effect.catchCause(() => Effect.void))
|
|
832
|
+
: Effect.void,
|
|
833
|
+
),
|
|
834
|
+
),
|
|
835
|
+
),
|
|
836
|
+
});
|
|
837
|
+
}),
|
|
838
|
+
);
|
|
839
|
+
|
|
840
|
+
/** Swarm rejects service names longer than 63 characters. */
|
|
841
|
+
const servicePhysicalName = (
|
|
842
|
+
id: string,
|
|
843
|
+
props: { name?: string } | undefined,
|
|
844
|
+
instanceId: string,
|
|
845
|
+
) => dockerPhysicalName(id, props, instanceId, 63);
|
|
846
|
+
|
|
847
|
+
const normalizeDesired = (
|
|
848
|
+
id: string,
|
|
849
|
+
props: ServiceProps,
|
|
850
|
+
instanceId: string,
|
|
851
|
+
) =>
|
|
852
|
+
servicePhysicalName(id, props, instanceId).pipe(
|
|
853
|
+
Effect.map((name) => ({
|
|
854
|
+
name,
|
|
855
|
+
context: dockerEngineContextName(props.context),
|
|
856
|
+
// The bundled form's image identity is its content hash (compared
|
|
857
|
+
// separately in diff) — the `image` prop is only the environment base
|
|
858
|
+
// there, and it participates in the hash.
|
|
859
|
+
image: isBundledService(props)
|
|
860
|
+
? undefined
|
|
861
|
+
: normalizeImageRef(props.image),
|
|
862
|
+
command: props.command ?? [],
|
|
863
|
+
args: props.args ?? [],
|
|
864
|
+
environment: {
|
|
865
|
+
...normalizeEnvironment(props.environment),
|
|
866
|
+
...normalizeBoundEnv(props.env),
|
|
867
|
+
},
|
|
868
|
+
networks: normalizeNetworks(props.networks),
|
|
869
|
+
ports: normalizePorts(props.ports),
|
|
870
|
+
endpointMode: props.endpointMode ?? "vip",
|
|
871
|
+
replicas: normalizeReplicas(props.replicas),
|
|
872
|
+
constraints: [
|
|
873
|
+
...(props.constraints ?? []),
|
|
874
|
+
...(props.placement?.constraints ?? []),
|
|
875
|
+
],
|
|
876
|
+
maxReplicasPerNode: props.placement?.maxReplicasPerNode,
|
|
877
|
+
preferences: props.placement?.preferences ?? [],
|
|
878
|
+
updateConfig: props.updateConfig,
|
|
879
|
+
rollbackConfig: props.rollbackConfig,
|
|
880
|
+
restartPolicy: props.restartPolicy,
|
|
881
|
+
healthcheck: props.healthcheck,
|
|
882
|
+
stopGracePeriod: props.stopGracePeriod,
|
|
883
|
+
volumes: props.volumes ?? [],
|
|
884
|
+
secrets: props.secrets ?? [],
|
|
885
|
+
configs: props.configs ?? [],
|
|
886
|
+
readOnlyRootFs: props.readOnlyRootFs ?? false,
|
|
887
|
+
labels: props.labels ?? {},
|
|
888
|
+
})),
|
|
889
|
+
);
|
|
890
|
+
|
|
891
|
+
const normalizeImageRef = (image: Service.Image): string =>
|
|
892
|
+
typeof image === "string" ? image : image.imageRef;
|
|
893
|
+
|
|
894
|
+
const normalizeEnvironment = (
|
|
895
|
+
environment: Record<string, string | Redacted.Redacted<string>> | undefined,
|
|
896
|
+
) =>
|
|
897
|
+
Object.fromEntries(
|
|
898
|
+
Object.entries(environment ?? {}).map(([key, value]) => [
|
|
899
|
+
key,
|
|
900
|
+
Redacted.isRedacted(value) ? Redacted.value(value) : value,
|
|
901
|
+
]),
|
|
902
|
+
);
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Platform-injected env (`props.env`) after Output resolution: values are
|
|
906
|
+
* usually marker-packed strings, but tolerate Redacted and structured values.
|
|
907
|
+
*/
|
|
908
|
+
const normalizeBoundEnv = (
|
|
909
|
+
env: Record<string, any> | undefined,
|
|
910
|
+
): Record<string, string> =>
|
|
911
|
+
Object.fromEntries(
|
|
912
|
+
Object.entries(env ?? {}).map(([key, value]) => [
|
|
913
|
+
key,
|
|
914
|
+
typeof value === "string"
|
|
915
|
+
? value
|
|
916
|
+
: Redacted.isRedacted(value)
|
|
917
|
+
? Redacted.value(value as Redacted.Redacted<string>)
|
|
918
|
+
: JSON.stringify(value),
|
|
919
|
+
]),
|
|
920
|
+
);
|
|
921
|
+
|
|
922
|
+
const normalizePorts = (
|
|
923
|
+
ports: Service.PortMapping[] | undefined,
|
|
924
|
+
): Service.PortMapping[] =>
|
|
925
|
+
(ports ?? []).map((port) => ({
|
|
926
|
+
external: port.external,
|
|
927
|
+
internal: port.internal,
|
|
928
|
+
protocol: port.protocol ?? "tcp",
|
|
929
|
+
mode: port.mode ?? "ingress",
|
|
930
|
+
}));
|
|
931
|
+
|
|
932
|
+
const normalizeReplicas = (replicas: number | undefined): number => {
|
|
933
|
+
const value = replicas ?? 1;
|
|
934
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
935
|
+
throw new Error("Service.replicas must be an integer >= 0");
|
|
936
|
+
}
|
|
937
|
+
return value;
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
const normalizeNetworks = (
|
|
941
|
+
networks: Array<string | Service.NetworkAttachment> | undefined,
|
|
942
|
+
): Service.NetworkAttachment[] =>
|
|
943
|
+
(networks ?? []).map((network) =>
|
|
944
|
+
typeof network === "string"
|
|
945
|
+
? { name: network }
|
|
946
|
+
: { name: network.name, aliases: network.aliases },
|
|
947
|
+
);
|
|
948
|
+
|
|
949
|
+
const formatMount = (volume: Service.VolumeMapping): string =>
|
|
950
|
+
[
|
|
951
|
+
`type=${/^(\/|\.\/|\.\.\/|~)/.test(volume.hostPath) ? "bind" : "volume"}`,
|
|
952
|
+
`source=${volume.hostPath}`,
|
|
953
|
+
`target=${volume.containerPath}`,
|
|
954
|
+
...(volume.readOnly ? ["readonly=true"] : []),
|
|
955
|
+
].join(",");
|
|
956
|
+
|
|
957
|
+
const formatRef = (ref: Service.SecretRef | Service.ConfigRef): string =>
|
|
958
|
+
Object.entries(ref)
|
|
959
|
+
.filter(([, value]) => value !== undefined)
|
|
960
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
961
|
+
.join(",");
|
|
962
|
+
|
|
963
|
+
const formatPublish = (port: Service.PortMapping): string =>
|
|
964
|
+
[
|
|
965
|
+
...(port.external !== undefined ? [`published=${port.external}`] : []),
|
|
966
|
+
`target=${port.internal}`,
|
|
967
|
+
`protocol=${port.protocol ?? "tcp"}`,
|
|
968
|
+
`mode=${port.mode ?? "ingress"}`,
|
|
969
|
+
].join(",");
|
|
970
|
+
|
|
971
|
+
const toServiceAttributes = (
|
|
972
|
+
service: ServiceInspect,
|
|
973
|
+
context?: string,
|
|
974
|
+
code?: { hash: string },
|
|
975
|
+
): Service["Attributes"] => {
|
|
976
|
+
return {
|
|
977
|
+
id: service.ID,
|
|
978
|
+
name: service.Spec.Name,
|
|
979
|
+
context,
|
|
980
|
+
image: service.Spec.TaskTemplate?.ContainerSpec?.Image ?? "",
|
|
981
|
+
replicas: service.Spec.Mode?.Replicated?.Replicas ?? 1,
|
|
982
|
+
networks: (service.Spec.TaskTemplate?.Networks ?? []).flatMap((n) =>
|
|
983
|
+
n.Target ? [n.Target] : [],
|
|
984
|
+
),
|
|
985
|
+
ports: (service.Spec.EndpointSpec?.Ports ?? []).flatMap((port) => {
|
|
986
|
+
if (port.PublishedPort === undefined || port.TargetPort === undefined) {
|
|
987
|
+
return [];
|
|
988
|
+
}
|
|
989
|
+
return [
|
|
990
|
+
{
|
|
991
|
+
external: port.PublishedPort,
|
|
992
|
+
internal: port.TargetPort,
|
|
993
|
+
protocol: port.Protocol ?? "tcp",
|
|
994
|
+
mode: port.PublishMode ?? "ingress",
|
|
995
|
+
},
|
|
996
|
+
];
|
|
997
|
+
}),
|
|
998
|
+
labels: service.Spec.Labels ?? {},
|
|
999
|
+
endpointMode: service.Spec.EndpointSpec?.Mode ?? "vip",
|
|
1000
|
+
createdAt: Date.parse(service.CreatedAt ?? "") || Date.now(),
|
|
1001
|
+
updatedAt: Date.parse(service.UpdatedAt ?? "") || Date.now(),
|
|
1002
|
+
code,
|
|
1003
|
+
};
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
const ensureReplicatedMode = (service: ServiceInspect): void => {
|
|
1007
|
+
if (service.Spec.Mode?.Global !== undefined) {
|
|
1008
|
+
throw new Error(
|
|
1009
|
+
`Docker.Service only supports replicated services. Service "${service.Spec.Name}" is global.`,
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
const parseInspectArray = <T>(json: string): T => {
|
|
1015
|
+
const parsed = JSON.parse(json) as T[];
|
|
1016
|
+
if (parsed.length === 0) {
|
|
1017
|
+
throw new Error("docker inspect returned no objects");
|
|
1018
|
+
}
|
|
1019
|
+
return parsed[0]!;
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
const normalizeServiceInspect = (value: unknown): ServiceInspect => {
|
|
1023
|
+
if (typeof value === "object" && value !== null && "stdout" in value) {
|
|
1024
|
+
const stdout = (value as { stdout?: unknown }).stdout;
|
|
1025
|
+
if (typeof stdout === "string") {
|
|
1026
|
+
return parseInspectArray<ServiceInspect>(stdout);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
return value as ServiceInspect;
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
const inspectOrDie = <T>(
|
|
1033
|
+
inspect: (
|
|
1034
|
+
nameOrId: string,
|
|
1035
|
+
context?: string,
|
|
1036
|
+
) => Effect.Effect<T | undefined, any>,
|
|
1037
|
+
nameOrId: string,
|
|
1038
|
+
context?: string,
|
|
1039
|
+
) =>
|
|
1040
|
+
inspect(nameOrId, context).pipe(
|
|
1041
|
+
Effect.flatMap((value) =>
|
|
1042
|
+
value
|
|
1043
|
+
? Effect.succeed(value)
|
|
1044
|
+
: Effect.die(`Expected ${nameOrId} to exist after create`),
|
|
1045
|
+
),
|
|
1046
|
+
);
|
|
1047
|
+
|
|
1048
|
+
const waitForServiceContainersReleased = (
|
|
1049
|
+
docker: Docker["Service"],
|
|
1050
|
+
serviceId: string,
|
|
1051
|
+
context?: string,
|
|
1052
|
+
): Effect.Effect<void, any, any> => {
|
|
1053
|
+
const maxAttempts = 10;
|
|
1054
|
+
const noContainers = Symbol.for("Docker.Service.NoContainers");
|
|
1055
|
+
|
|
1056
|
+
const poll = listServiceContainerIds(docker, serviceId, context).pipe(
|
|
1057
|
+
Effect.flatMap((containerIds) =>
|
|
1058
|
+
containerIds.length === 0
|
|
1059
|
+
? Effect.fail(noContainers)
|
|
1060
|
+
: Effect.succeed(containerIds),
|
|
1061
|
+
),
|
|
1062
|
+
);
|
|
1063
|
+
|
|
1064
|
+
return poll.pipe(
|
|
1065
|
+
Effect.repeat(
|
|
1066
|
+
Schedule.spaced("1 second").pipe(
|
|
1067
|
+
Schedule.upTo({ times: maxAttempts - 1 }),
|
|
1068
|
+
),
|
|
1069
|
+
),
|
|
1070
|
+
Effect.catchIf(
|
|
1071
|
+
(error): error is typeof noContainers => error === noContainers,
|
|
1072
|
+
() => Effect.void,
|
|
1073
|
+
),
|
|
1074
|
+
Effect.andThen(listServiceContainerIds(docker, serviceId, context)),
|
|
1075
|
+
Effect.flatMap((containerIds) =>
|
|
1076
|
+
containerIds.length === 0
|
|
1077
|
+
? Effect.void
|
|
1078
|
+
: // Best effort cleanup for lingering task containers that keep volumes attached.
|
|
1079
|
+
Effect.forEach(
|
|
1080
|
+
containerIds,
|
|
1081
|
+
(containerId) =>
|
|
1082
|
+
docker
|
|
1083
|
+
.run([
|
|
1084
|
+
...(context ? ["--context", context] : []),
|
|
1085
|
+
"container",
|
|
1086
|
+
"rm",
|
|
1087
|
+
"-f",
|
|
1088
|
+
containerId,
|
|
1089
|
+
])
|
|
1090
|
+
.pipe(Effect.catchCause(() => Effect.void)),
|
|
1091
|
+
{ concurrency: "unbounded" },
|
|
1092
|
+
).pipe(Effect.as(undefined)),
|
|
1093
|
+
),
|
|
1094
|
+
);
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
const listServiceContainerIds = (
|
|
1098
|
+
docker: Docker["Service"],
|
|
1099
|
+
serviceId: string,
|
|
1100
|
+
context?: string,
|
|
1101
|
+
): Effect.Effect<string[], any, any> =>
|
|
1102
|
+
docker
|
|
1103
|
+
.run([
|
|
1104
|
+
...(context ? ["--context", context] : []),
|
|
1105
|
+
"ps",
|
|
1106
|
+
"-a",
|
|
1107
|
+
"--filter",
|
|
1108
|
+
`label=com.docker.swarm.service.id=${serviceId}`,
|
|
1109
|
+
"--format",
|
|
1110
|
+
"{{.ID}}",
|
|
1111
|
+
])
|
|
1112
|
+
.pipe(
|
|
1113
|
+
Effect.map((result) =>
|
|
1114
|
+
result.stdout
|
|
1115
|
+
.split("\n")
|
|
1116
|
+
.map((line) => line.trim())
|
|
1117
|
+
.filter((line) => line.length > 0),
|
|
1118
|
+
),
|
|
1119
|
+
);
|