alchemy 2.0.0-beta.41 → 2.0.0-beta.43
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 +2 -9
- package/bin/exec.js.map +1 -1
- package/lib/AWS/CloudWatch/DescribeAlarmContributors.d.ts +1 -1
- package/lib/AWS/CloudWatch/DescribeAlarmContributors.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/DescribeAlarmHistory.d.ts +1 -1
- package/lib/AWS/CloudWatch/DescribeAlarmHistory.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/DescribeAlarms.d.ts +1 -1
- package/lib/AWS/CloudWatch/DescribeAlarms.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/DescribeAlarmsForMetric.d.ts +1 -1
- package/lib/AWS/CloudWatch/DescribeAlarmsForMetric.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/DescribeAnomalyDetectors.d.ts +1 -1
- package/lib/AWS/CloudWatch/DescribeAnomalyDetectors.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/DescribeInsightRules.d.ts +1 -1
- package/lib/AWS/CloudWatch/DescribeInsightRules.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/DisableAlarmActions.d.ts +1 -1
- package/lib/AWS/CloudWatch/DisableAlarmActions.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/DisableInsightRules.d.ts +1 -1
- package/lib/AWS/CloudWatch/DisableInsightRules.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/EnableAlarmActions.d.ts +1 -1
- package/lib/AWS/CloudWatch/EnableAlarmActions.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/GetAlarmMuteRule.d.ts +1 -1
- package/lib/AWS/CloudWatch/GetAlarmMuteRule.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/GetDashboard.d.ts +1 -1
- package/lib/AWS/CloudWatch/GetDashboard.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/GetInsightRuleReport.d.ts +1 -1
- package/lib/AWS/CloudWatch/GetInsightRuleReport.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/GetMetricData.d.ts +1 -1
- package/lib/AWS/CloudWatch/GetMetricData.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/GetMetricStatistics.d.ts +1 -1
- package/lib/AWS/CloudWatch/GetMetricStatistics.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/GetMetricStream.d.ts +1 -1
- package/lib/AWS/CloudWatch/GetMetricStream.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/GetMetricWidgetImage.d.ts +1 -1
- package/lib/AWS/CloudWatch/GetMetricWidgetImage.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/ListAlarmMuteRules.d.ts +1 -1
- package/lib/AWS/CloudWatch/ListAlarmMuteRules.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/ListDashboards.d.ts +1 -1
- package/lib/AWS/CloudWatch/ListDashboards.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/ListManagedInsightRules.d.ts +1 -1
- package/lib/AWS/CloudWatch/ListManagedInsightRules.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/ListMetricStreams.d.ts +1 -1
- package/lib/AWS/CloudWatch/ListMetricStreams.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/ListMetrics.d.ts +1 -1
- package/lib/AWS/CloudWatch/ListMetrics.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/ListTagsForResource.d.ts +1 -1
- package/lib/AWS/CloudWatch/ListTagsForResource.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/PutMetricData.d.ts +1 -1
- package/lib/AWS/CloudWatch/PutMetricData.d.ts.map +1 -1
- package/lib/AWS/CloudWatch/SetAlarmState.d.ts +1 -1
- package/lib/AWS/CloudWatch/SetAlarmState.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/BatchExecuteStatement.d.ts +1 -1
- package/lib/AWS/DynamoDB/BatchExecuteStatement.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/BatchGetItem.d.ts +1 -1
- package/lib/AWS/DynamoDB/BatchGetItem.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/BatchWriteItem.d.ts +1 -1
- package/lib/AWS/DynamoDB/BatchWriteItem.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/DeleteItem.d.ts +1 -1
- package/lib/AWS/DynamoDB/DeleteItem.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/DescribeTable.d.ts +1 -1
- package/lib/AWS/DynamoDB/DescribeTable.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/DescribeTimeToLive.d.ts +1 -1
- package/lib/AWS/DynamoDB/DescribeTimeToLive.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/ExecuteStatement.d.ts +1 -1
- package/lib/AWS/DynamoDB/ExecuteStatement.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/ExecuteTransaction.d.ts +1 -1
- package/lib/AWS/DynamoDB/ExecuteTransaction.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/GetItem.d.ts +1 -1
- package/lib/AWS/DynamoDB/GetItem.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/ListTables.d.ts +1 -1
- package/lib/AWS/DynamoDB/ListTables.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/ListTagsOfResource.d.ts +1 -1
- package/lib/AWS/DynamoDB/ListTagsOfResource.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/PutItem.d.ts +1 -1
- package/lib/AWS/DynamoDB/PutItem.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/Query.d.ts +1 -1
- package/lib/AWS/DynamoDB/Query.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/RestoreTableToPointInTime.d.ts +1 -1
- package/lib/AWS/DynamoDB/RestoreTableToPointInTime.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/Scan.d.ts +1 -1
- package/lib/AWS/DynamoDB/Scan.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/TransactGetItems.d.ts +1 -1
- package/lib/AWS/DynamoDB/TransactGetItems.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/TransactWriteItems.d.ts +1 -1
- package/lib/AWS/DynamoDB/TransactWriteItems.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/UpdateItem.d.ts +1 -1
- package/lib/AWS/DynamoDB/UpdateItem.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/UpdateTimeToLive.d.ts +1 -1
- package/lib/AWS/DynamoDB/UpdateTimeToLive.d.ts.map +1 -1
- package/lib/AWS/ECS/DescribeTasks.d.ts +1 -1
- package/lib/AWS/ECS/DescribeTasks.d.ts.map +1 -1
- package/lib/AWS/ECS/ListTasks.d.ts +1 -1
- package/lib/AWS/ECS/ListTasks.d.ts.map +1 -1
- package/lib/AWS/ECS/RunTask.d.ts +1 -1
- package/lib/AWS/ECS/RunTask.d.ts.map +1 -1
- package/lib/AWS/ECS/StopTask.d.ts +1 -1
- package/lib/AWS/ECS/StopTask.d.ts.map +1 -1
- package/lib/AWS/EventBridge/DescribeEventBus.d.ts +1 -1
- package/lib/AWS/EventBridge/DescribeEventBus.d.ts.map +1 -1
- package/lib/AWS/EventBridge/DescribeRule.d.ts +1 -1
- package/lib/AWS/EventBridge/DescribeRule.d.ts.map +1 -1
- package/lib/AWS/EventBridge/EventSource.d.ts +2 -2
- package/lib/AWS/EventBridge/ListEventBuses.d.ts +1 -1
- package/lib/AWS/EventBridge/ListEventBuses.d.ts.map +1 -1
- package/lib/AWS/EventBridge/ListRules.d.ts +1 -1
- package/lib/AWS/EventBridge/ListRules.d.ts.map +1 -1
- package/lib/AWS/EventBridge/ListTargetsByRule.d.ts +1 -1
- package/lib/AWS/EventBridge/ListTargetsByRule.d.ts.map +1 -1
- package/lib/AWS/EventBridge/PutEvents.d.ts +1 -1
- package/lib/AWS/EventBridge/PutEvents.d.ts.map +1 -1
- package/lib/AWS/EventBridge/TestEventPattern.d.ts +1 -1
- package/lib/AWS/EventBridge/TestEventPattern.d.ts.map +1 -1
- package/lib/AWS/EventBridge/ToLambda.d.ts +1 -1
- package/lib/AWS/EventBridge/ToLambda.d.ts.map +1 -1
- package/lib/AWS/EventBridge/ToQueue.d.ts +1 -1
- package/lib/AWS/EventBridge/ToQueue.d.ts.map +1 -1
- package/lib/AWS/Kinesis/DescribeAccountSettings.d.ts +1 -1
- package/lib/AWS/Kinesis/DescribeAccountSettings.d.ts.map +1 -1
- package/lib/AWS/Kinesis/DescribeLimits.d.ts +1 -1
- package/lib/AWS/Kinesis/DescribeLimits.d.ts.map +1 -1
- package/lib/AWS/Kinesis/DescribeStream.d.ts +1 -1
- package/lib/AWS/Kinesis/DescribeStream.d.ts.map +1 -1
- package/lib/AWS/Kinesis/DescribeStreamConsumer.d.ts +1 -1
- package/lib/AWS/Kinesis/DescribeStreamConsumer.d.ts.map +1 -1
- package/lib/AWS/Kinesis/DescribeStreamSummary.d.ts +1 -1
- package/lib/AWS/Kinesis/DescribeStreamSummary.d.ts.map +1 -1
- package/lib/AWS/Kinesis/GetRecords.d.ts +1 -1
- package/lib/AWS/Kinesis/GetRecords.d.ts.map +1 -1
- package/lib/AWS/Kinesis/GetResourcePolicy.d.ts +1 -1
- package/lib/AWS/Kinesis/GetResourcePolicy.d.ts.map +1 -1
- package/lib/AWS/Kinesis/GetShardIterator.d.ts +1 -1
- package/lib/AWS/Kinesis/GetShardIterator.d.ts.map +1 -1
- package/lib/AWS/Kinesis/ListShards.d.ts +1 -1
- package/lib/AWS/Kinesis/ListShards.d.ts.map +1 -1
- package/lib/AWS/Kinesis/ListStreamConsumers.d.ts +1 -1
- package/lib/AWS/Kinesis/ListStreamConsumers.d.ts.map +1 -1
- package/lib/AWS/Kinesis/ListStreams.d.ts +1 -1
- package/lib/AWS/Kinesis/ListStreams.d.ts.map +1 -1
- package/lib/AWS/Kinesis/ListTagsForResource.d.ts +1 -1
- package/lib/AWS/Kinesis/ListTagsForResource.d.ts.map +1 -1
- package/lib/AWS/Kinesis/PutRecord.d.ts +1 -1
- package/lib/AWS/Kinesis/PutRecord.d.ts.map +1 -1
- package/lib/AWS/Kinesis/PutRecords.d.ts +1 -1
- package/lib/AWS/Kinesis/PutRecords.d.ts.map +1 -1
- package/lib/AWS/Kinesis/StreamSink.d.ts +1 -1
- package/lib/AWS/Kinesis/StreamSink.d.ts.map +1 -1
- package/lib/AWS/Kinesis/SubscribeToShard.d.ts +1 -1
- package/lib/AWS/Kinesis/SubscribeToShard.d.ts.map +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts +2 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts +2 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/InvokeFunction.d.ts +1 -1
- package/lib/AWS/Lambda/InvokeFunction.d.ts.map +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts +2 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts +2 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts +2 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts +2 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts.map +1 -1
- package/lib/AWS/RDS/Connect.d.ts +1 -1
- package/lib/AWS/RDS/Connect.d.ts.map +1 -1
- package/lib/AWS/RDSData/BatchExecuteStatement.d.ts +1 -1
- package/lib/AWS/RDSData/BatchExecuteStatement.d.ts.map +1 -1
- package/lib/AWS/RDSData/BeginTransaction.d.ts +1 -1
- package/lib/AWS/RDSData/BeginTransaction.d.ts.map +1 -1
- package/lib/AWS/RDSData/CommitTransaction.d.ts +1 -1
- package/lib/AWS/RDSData/CommitTransaction.d.ts.map +1 -1
- package/lib/AWS/RDSData/ExecuteSql.d.ts +1 -1
- package/lib/AWS/RDSData/ExecuteSql.d.ts.map +1 -1
- package/lib/AWS/RDSData/ExecuteStatement.d.ts +1 -1
- package/lib/AWS/RDSData/ExecuteStatement.d.ts.map +1 -1
- package/lib/AWS/RDSData/RollbackTransaction.d.ts +1 -1
- package/lib/AWS/RDSData/RollbackTransaction.d.ts.map +1 -1
- package/lib/AWS/S3/AbortMultipartUpload.d.ts +1 -1
- package/lib/AWS/S3/AbortMultipartUpload.d.ts.map +1 -1
- package/lib/AWS/S3/CompleteMultipartUpload.d.ts +1 -1
- package/lib/AWS/S3/CompleteMultipartUpload.d.ts.map +1 -1
- package/lib/AWS/S3/CopyObject.d.ts +1 -1
- package/lib/AWS/S3/CopyObject.d.ts.map +1 -1
- package/lib/AWS/S3/CreateMultipartUpload.d.ts +1 -1
- package/lib/AWS/S3/CreateMultipartUpload.d.ts.map +1 -1
- package/lib/AWS/S3/DeleteObject.d.ts +1 -1
- package/lib/AWS/S3/DeleteObject.d.ts.map +1 -1
- package/lib/AWS/S3/GetObject.d.ts +1 -1
- package/lib/AWS/S3/GetObject.d.ts.map +1 -1
- package/lib/AWS/S3/HeadObject.d.ts +1 -1
- package/lib/AWS/S3/HeadObject.d.ts.map +1 -1
- package/lib/AWS/S3/ListObjectsV2.d.ts +1 -1
- package/lib/AWS/S3/ListObjectsV2.d.ts.map +1 -1
- package/lib/AWS/S3/PutObject.d.ts +1 -1
- package/lib/AWS/S3/PutObject.d.ts.map +1 -1
- package/lib/AWS/S3/UploadPart.d.ts +1 -1
- package/lib/AWS/S3/UploadPart.d.ts.map +1 -1
- package/lib/AWS/SNS/AddPermission.d.ts +1 -1
- package/lib/AWS/SNS/AddPermission.d.ts.map +1 -1
- package/lib/AWS/SNS/ConfirmSubscription.d.ts +1 -1
- package/lib/AWS/SNS/ConfirmSubscription.d.ts.map +1 -1
- package/lib/AWS/SNS/GetDataProtectionPolicy.d.ts +1 -1
- package/lib/AWS/SNS/GetDataProtectionPolicy.d.ts.map +1 -1
- package/lib/AWS/SNS/GetSubscriptionAttributes.d.ts +1 -1
- package/lib/AWS/SNS/GetSubscriptionAttributes.d.ts.map +1 -1
- package/lib/AWS/SNS/GetTopicAttributes.d.ts +1 -1
- package/lib/AWS/SNS/GetTopicAttributes.d.ts.map +1 -1
- package/lib/AWS/SNS/ListSubscriptions.d.ts +1 -1
- package/lib/AWS/SNS/ListSubscriptions.d.ts.map +1 -1
- package/lib/AWS/SNS/ListSubscriptionsByTopic.d.ts +1 -1
- package/lib/AWS/SNS/ListSubscriptionsByTopic.d.ts.map +1 -1
- package/lib/AWS/SNS/ListTagsForResource.d.ts +1 -1
- package/lib/AWS/SNS/ListTagsForResource.d.ts.map +1 -1
- package/lib/AWS/SNS/ListTopics.d.ts +1 -1
- package/lib/AWS/SNS/ListTopics.d.ts.map +1 -1
- package/lib/AWS/SNS/Publish.d.ts +1 -1
- package/lib/AWS/SNS/Publish.d.ts.map +1 -1
- package/lib/AWS/SNS/PublishBatch.d.ts +1 -1
- package/lib/AWS/SNS/PublishBatch.d.ts.map +1 -1
- package/lib/AWS/SNS/PutDataProtectionPolicy.d.ts +1 -1
- package/lib/AWS/SNS/PutDataProtectionPolicy.d.ts.map +1 -1
- package/lib/AWS/SNS/RemovePermission.d.ts +1 -1
- package/lib/AWS/SNS/RemovePermission.d.ts.map +1 -1
- package/lib/AWS/SNS/SetSubscriptionAttributes.d.ts +1 -1
- package/lib/AWS/SNS/SetSubscriptionAttributes.d.ts.map +1 -1
- package/lib/AWS/SNS/SetTopicAttributes.d.ts +1 -1
- package/lib/AWS/SNS/SetTopicAttributes.d.ts.map +1 -1
- package/lib/AWS/SNS/TagResource.d.ts +1 -1
- package/lib/AWS/SNS/TagResource.d.ts.map +1 -1
- package/lib/AWS/SNS/TopicSink.d.ts +1 -1
- package/lib/AWS/SNS/TopicSink.d.ts.map +1 -1
- package/lib/AWS/SNS/UntagResource.d.ts +1 -1
- package/lib/AWS/SNS/UntagResource.d.ts.map +1 -1
- package/lib/AWS/SQS/DeleteMessage.d.ts +1 -1
- package/lib/AWS/SQS/DeleteMessage.d.ts.map +1 -1
- package/lib/AWS/SQS/DeleteMessageBatch.d.ts +1 -1
- package/lib/AWS/SQS/DeleteMessageBatch.d.ts.map +1 -1
- package/lib/AWS/SQS/QueueSink.d.ts +1 -1
- package/lib/AWS/SQS/QueueSink.d.ts.map +1 -1
- package/lib/AWS/SQS/ReceiveMessage.d.ts +1 -1
- package/lib/AWS/SQS/ReceiveMessage.d.ts.map +1 -1
- package/lib/AWS/SQS/SendMessage.d.ts +1 -1
- package/lib/AWS/SQS/SendMessage.d.ts.map +1 -1
- package/lib/AWS/SQS/SendMessageBatch.d.ts +1 -1
- package/lib/AWS/SQS/SendMessageBatch.d.ts.map +1 -1
- package/lib/AWS/SecretsManager/DescribeSecret.d.ts +1 -1
- package/lib/AWS/SecretsManager/DescribeSecret.d.ts.map +1 -1
- package/lib/AWS/SecretsManager/GetRandomPassword.d.ts +1 -1
- package/lib/AWS/SecretsManager/GetRandomPassword.d.ts.map +1 -1
- package/lib/AWS/SecretsManager/GetSecretValue.d.ts +1 -1
- package/lib/AWS/SecretsManager/GetSecretValue.d.ts.map +1 -1
- package/lib/AWS/SecretsManager/ListSecrets.d.ts +1 -1
- package/lib/AWS/SecretsManager/ListSecrets.d.ts.map +1 -1
- package/lib/AWS/SecretsManager/PutSecretValue.d.ts +1 -1
- package/lib/AWS/SecretsManager/PutSecretValue.d.ts.map +1 -1
- package/lib/Binding.d.ts +1 -1
- package/lib/Binding.d.ts.map +1 -1
- package/lib/Bundle/Docker.d.ts.map +1 -1
- package/lib/Bundle/Docker.js +12 -13
- package/lib/Bundle/Docker.js.map +1 -1
- package/lib/Cli/commands/deploy.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.js +1 -0
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.d.ts +8 -7
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.d.ts.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.js +2 -6
- package/lib/Cloudflare/AiGateway/AiGatewayBinding.js.map +1 -1
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.d.ts +4 -3
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.d.ts.map +1 -1
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.js +2 -1
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.js.map +1 -1
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.d.ts +8 -7
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.js +2 -2
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.js.map +1 -1
- package/lib/Cloudflare/D1/D1Connection.d.ts +12 -10
- package/lib/Cloudflare/D1/D1Connection.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Connection.js +2 -2
- package/lib/Cloudflare/D1/D1Connection.js.map +1 -1
- package/lib/Cloudflare/D1/D1Database.js +1 -1
- package/lib/Cloudflare/D1/D1Database.js.map +1 -1
- package/lib/Cloudflare/D1/D1Migrations.d.ts +2 -2
- package/lib/Cloudflare/D1/D1Migrations.d.ts.map +1 -1
- package/lib/Cloudflare/Email/SendEmailBinding.d.ts +5 -4
- package/lib/Cloudflare/Email/SendEmailBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Email/SendEmailBinding.js +2 -1
- package/lib/Cloudflare/Email/SendEmailBinding.js.map +1 -1
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.d.ts +10 -8
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.js +2 -2
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.js.map +1 -1
- package/lib/Cloudflare/Images/ImagesBinding.d.ts +5 -4
- package/lib/Cloudflare/Images/ImagesBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Images/ImagesBinding.js +4 -2
- package/lib/Cloudflare/Images/ImagesBinding.js.map +1 -1
- package/lib/Cloudflare/KV/KVNamespaceBinding.d.ts +33 -32
- package/lib/Cloudflare/KV/KVNamespaceBinding.d.ts.map +1 -1
- package/lib/Cloudflare/KV/KVNamespaceBinding.js +5 -2
- package/lib/Cloudflare/KV/KVNamespaceBinding.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueBinding.d.ts +5 -4
- package/lib/Cloudflare/Queue/QueueBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/QueueBinding.js +2 -2
- package/lib/Cloudflare/Queue/QueueBinding.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts +1 -2
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2BucketBinding.d.ts +13 -12
- package/lib/Cloudflare/R2/R2BucketBinding.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2BucketBinding.js +2 -2
- package/lib/Cloudflare/R2/R2BucketBinding.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts +5 -4
- package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretBinding.js +2 -2
- package/lib/Cloudflare/SecretsStore/SecretBinding.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +1 -1
- package/lib/Cloudflare/Workers/CronEventSource.d.ts +1 -2
- package/lib/Cloudflare/Workers/CronEventSource.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectNamespace.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectNamespace.js +6 -3
- package/lib/Cloudflare/Workers/DurableObjectNamespace.js.map +1 -1
- package/lib/Cloudflare/Workers/DynamicWorkerLoader.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DynamicWorkerLoader.js +3 -3
- package/lib/Cloudflare/Workers/DynamicWorkerLoader.js.map +1 -1
- package/lib/Cloudflare/Workers/Fetch.d.ts +1 -1
- package/lib/Cloudflare/Workers/Fetch.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/RpcAsync.d.ts +55 -0
- package/lib/Cloudflare/Workers/RpcAsync.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/RpcAsync.js +55 -0
- package/lib/Cloudflare/Workers/RpcAsync.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +3 -3
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +9 -2
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js +2 -0
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.d.ts +4 -4
- package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.js +6 -3
- package/lib/Cloudflare/Workers/Workflow.js.map +1 -1
- package/lib/Neon/Branch.js +1 -1
- package/lib/Neon/Branch.js.map +1 -1
- package/lib/Neon/Migrations.d.ts +1 -1
- package/lib/Neon/Migrations.d.ts.map +1 -1
- package/lib/Neon/Project.d.ts.map +1 -1
- package/lib/Neon/Project.js +1 -15
- package/lib/Neon/Project.js.map +1 -1
- package/lib/Phase.d.ts +2 -2
- package/lib/Phase.d.ts.map +1 -1
- package/lib/Phase.js +2 -1
- package/lib/Phase.js.map +1 -1
- package/lib/Planetscale/AuthProvider.d.ts +59 -0
- package/lib/Planetscale/AuthProvider.d.ts.map +1 -0
- package/lib/Planetscale/AuthProvider.js +131 -0
- package/lib/Planetscale/AuthProvider.js.map +1 -0
- package/lib/Planetscale/Branch.d.ts +113 -0
- package/lib/Planetscale/Branch.d.ts.map +1 -0
- package/lib/Planetscale/Branch.js +287 -0
- package/lib/Planetscale/Branch.js.map +1 -0
- package/lib/Planetscale/Credentials.d.ts +35 -0
- package/lib/Planetscale/Credentials.d.ts.map +1 -0
- package/lib/Planetscale/Credentials.js +56 -0
- package/lib/Planetscale/Credentials.js.map +1 -0
- package/lib/Planetscale/Database.d.ts +117 -0
- package/lib/Planetscale/Database.d.ts.map +1 -0
- package/lib/Planetscale/Database.js +1 -0
- package/lib/Planetscale/Database.js.map +1 -0
- package/lib/Planetscale/MySQL/MySQLBranch.d.ts +86 -0
- package/lib/Planetscale/MySQL/MySQLBranch.d.ts.map +1 -0
- package/lib/Planetscale/MySQL/MySQLBranch.js +14 -0
- package/lib/Planetscale/MySQL/MySQLBranch.js.map +1 -0
- package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts +23 -0
- package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts.map +1 -0
- package/lib/Planetscale/MySQL/MySQLClusterSize.js +44 -0
- package/lib/Planetscale/MySQL/MySQLClusterSize.js.map +1 -0
- package/lib/Planetscale/MySQL/MySQLDatabase.d.ts +119 -0
- package/lib/Planetscale/MySQL/MySQLDatabase.d.ts.map +1 -0
- package/lib/Planetscale/MySQL/MySQLDatabase.js +237 -0
- package/lib/Planetscale/MySQL/MySQLDatabase.js.map +1 -0
- package/lib/Planetscale/MySQL/MySQLMigrations.d.ts +18 -0
- package/lib/Planetscale/MySQL/MySQLMigrations.d.ts.map +1 -0
- package/lib/Planetscale/MySQL/MySQLMigrations.js +157 -0
- package/lib/Planetscale/MySQL/MySQLMigrations.js.map +1 -0
- package/lib/Planetscale/MySQL/MySQLOrigin.d.ts +15 -0
- package/lib/Planetscale/MySQL/MySQLOrigin.d.ts.map +1 -0
- package/lib/Planetscale/MySQL/MySQLOrigin.js +2 -0
- package/lib/Planetscale/MySQL/MySQLOrigin.js.map +1 -0
- package/lib/Planetscale/MySQL/MySQLPassword.d.ts +115 -0
- package/lib/Planetscale/MySQL/MySQLPassword.d.ts.map +1 -0
- package/lib/Planetscale/MySQL/MySQLPassword.js +197 -0
- package/lib/Planetscale/MySQL/MySQLPassword.js.map +1 -0
- package/lib/Planetscale/MySQL/index.d.ts +6 -0
- package/lib/Planetscale/MySQL/index.d.ts.map +1 -0
- package/lib/Planetscale/MySQL/index.js +6 -0
- package/lib/Planetscale/MySQL/index.js.map +1 -0
- package/lib/Planetscale/Postgres/PostgresBranch.d.ts +67 -0
- package/lib/Planetscale/Postgres/PostgresBranch.d.ts.map +1 -0
- package/lib/Planetscale/Postgres/PostgresBranch.js +14 -0
- package/lib/Planetscale/Postgres/PostgresBranch.js.map +1 -0
- package/lib/Planetscale/Postgres/PostgresClusterSize.d.ts +44 -0
- package/lib/Planetscale/Postgres/PostgresClusterSize.d.ts.map +1 -0
- package/lib/Planetscale/Postgres/PostgresClusterSize.js +72 -0
- package/lib/Planetscale/Postgres/PostgresClusterSize.js.map +1 -0
- package/lib/Planetscale/Postgres/PostgresDatabase.d.ts +73 -0
- package/lib/Planetscale/Postgres/PostgresDatabase.d.ts.map +1 -0
- package/lib/Planetscale/Postgres/PostgresDatabase.js +241 -0
- package/lib/Planetscale/Postgres/PostgresDatabase.js.map +1 -0
- package/lib/Planetscale/Postgres/PostgresDefaultRole.d.ts +85 -0
- package/lib/Planetscale/Postgres/PostgresDefaultRole.d.ts.map +1 -0
- package/lib/Planetscale/Postgres/PostgresDefaultRole.js +142 -0
- package/lib/Planetscale/Postgres/PostgresDefaultRole.js.map +1 -0
- package/lib/Planetscale/Postgres/PostgresMigrations.d.ts +18 -0
- package/lib/Planetscale/Postgres/PostgresMigrations.d.ts.map +1 -0
- package/lib/Planetscale/Postgres/PostgresMigrations.js +148 -0
- package/lib/Planetscale/Postgres/PostgresMigrations.js.map +1 -0
- package/lib/Planetscale/Postgres/PostgresOrigin.d.ts +15 -0
- package/lib/Planetscale/Postgres/PostgresOrigin.d.ts.map +1 -0
- package/lib/Planetscale/Postgres/PostgresOrigin.js +2 -0
- package/lib/Planetscale/Postgres/PostgresOrigin.js.map +1 -0
- package/lib/Planetscale/Postgres/PostgresRole.d.ts +121 -0
- package/lib/Planetscale/Postgres/PostgresRole.d.ts.map +1 -0
- package/lib/Planetscale/Postgres/PostgresRole.js +228 -0
- package/lib/Planetscale/Postgres/PostgresRole.js.map +1 -0
- package/lib/Planetscale/Postgres/index.d.ts +7 -0
- package/lib/Planetscale/Postgres/index.d.ts.map +1 -0
- package/lib/Planetscale/Postgres/index.js +7 -0
- package/lib/Planetscale/Postgres/index.js.map +1 -0
- package/lib/Planetscale/Providers.d.ts +25 -0
- package/lib/Planetscale/Providers.d.ts.map +1 -0
- package/lib/Planetscale/Providers.js +40 -0
- package/lib/Planetscale/Providers.js.map +1 -0
- package/lib/Planetscale/Util.d.ts +182 -0
- package/lib/Planetscale/Util.d.ts.map +1 -0
- package/lib/Planetscale/Util.js +98 -0
- package/lib/Planetscale/Util.js.map +1 -0
- package/lib/Planetscale/index.d.ts +9 -0
- package/lib/Planetscale/index.d.ts.map +1 -0
- package/lib/Planetscale/index.js +9 -0
- package/lib/Planetscale/index.js.map +1 -0
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +7 -2
- package/lib/Platform.js.map +1 -1
- package/lib/RuntimeContext.d.ts +7 -3
- package/lib/RuntimeContext.d.ts.map +1 -1
- package/lib/RuntimeContext.js +3 -2
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Server/S3BucketEventSource.d.ts +1 -1
- package/lib/Server/S3BucketEventSource.d.ts.map +1 -1
- package/lib/{Neon → Sql}/SqlFile.d.ts +2 -0
- package/lib/Sql/SqlFile.d.ts.map +1 -0
- package/lib/{Neon → Sql}/SqlFile.js +14 -0
- package/lib/Sql/SqlFile.js.map +1 -0
- package/lib/Sql/index.d.ts +2 -0
- package/lib/Sql/index.d.ts.map +1 -0
- package/lib/Sql/index.js +2 -0
- package/lib/Sql/index.js.map +1 -0
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +20 -6
- package/src/Binding.ts +1 -1
- package/src/Bundle/Docker.ts +12 -15
- package/src/Cli/commands/deploy.ts +1 -0
- package/src/Cloudflare/AiGateway/AiGatewayBinding.ts +11 -16
- package/src/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.ts +7 -9
- package/src/Cloudflare/Artifacts/ArtifactsBinding.ts +11 -22
- package/src/Cloudflare/D1/D1Connection.ts +31 -18
- package/src/Cloudflare/D1/D1Database.ts +1 -1
- package/src/Cloudflare/D1/D1Migrations.ts +2 -2
- package/src/Cloudflare/Email/SendEmailBinding.ts +7 -5
- package/src/Cloudflare/Hyperdrive/HyperdriveBinding.ts +16 -12
- package/src/Cloudflare/Images/ImagesBinding.ts +8 -8
- package/src/Cloudflare/KV/KVNamespaceBinding.ts +38 -38
- package/src/Cloudflare/Queue/QueueBinding.ts +7 -6
- package/src/Cloudflare/R2/R2BucketBinding.ts +16 -19
- package/src/Cloudflare/SecretsStore/SecretBinding.ts +11 -13
- package/src/Cloudflare/Workers/DurableObjectNamespace.ts +6 -6
- package/src/Cloudflare/Workers/DynamicWorkerLoader.ts +4 -5
- package/src/Cloudflare/Workers/RpcAsync.ts +55 -0
- package/src/Cloudflare/Workers/Worker.ts +17 -5
- package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +2 -0
- package/src/Cloudflare/Workers/Workflow.ts +10 -11
- package/src/Neon/Branch.ts +1 -1
- package/src/Neon/Migrations.ts +1 -1
- package/src/Neon/Project.ts +6 -20
- package/src/Phase.ts +2 -0
- package/src/Planetscale/AuthProvider.ts +285 -0
- package/src/Planetscale/Branch.ts +508 -0
- package/src/Planetscale/Credentials.ts +96 -0
- package/src/Planetscale/Database.ts +129 -0
- package/src/Planetscale/MySQL/MySQLBranch.ts +112 -0
- package/src/Planetscale/MySQL/MySQLClusterSize.ts +102 -0
- package/src/Planetscale/MySQL/MySQLDatabase.ts +446 -0
- package/src/Planetscale/MySQL/MySQLMigrations.ts +271 -0
- package/src/Planetscale/MySQL/MySQLOrigin.ts +15 -0
- package/src/Planetscale/MySQL/MySQLPassword.ts +387 -0
- package/src/Planetscale/MySQL/index.ts +5 -0
- package/src/Planetscale/Postgres/PostgresBranch.ts +97 -0
- package/src/Planetscale/Postgres/PostgresClusterSize.ts +125 -0
- package/src/Planetscale/Postgres/PostgresDatabase.ts +404 -0
- package/src/Planetscale/Postgres/PostgresDefaultRole.ts +270 -0
- package/src/Planetscale/Postgres/PostgresMigrations.ts +256 -0
- package/src/Planetscale/Postgres/PostgresOrigin.ts +15 -0
- package/src/Planetscale/Postgres/PostgresRole.ts +469 -0
- package/src/Planetscale/Postgres/index.ts +6 -0
- package/src/Planetscale/Providers.ts +80 -0
- package/src/Planetscale/Util.ts +160 -0
- package/src/Planetscale/index.ts +18 -0
- package/src/Platform.ts +13 -1
- package/src/RuntimeContext.ts +7 -8
- package/src/{Neon → Sql}/SqlFile.ts +22 -0
- package/src/Sql/index.ts +1 -0
- package/lib/Cloudflare/D1/D1SqlFile.d.ts +0 -20
- package/lib/Cloudflare/D1/D1SqlFile.d.ts.map +0 -1
- package/lib/Cloudflare/D1/D1SqlFile.js +0 -46
- package/lib/Cloudflare/D1/D1SqlFile.js.map +0 -1
- package/lib/Neon/SqlFile.d.ts.map +0 -1
- package/lib/Neon/SqlFile.js.map +0 -1
- package/src/Cloudflare/D1/D1SqlFile.ts +0 -55
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { Credentials } from "@distilled.cloud/planetscale/Credentials";
|
|
2
|
+
import * as ops from "@distilled.cloud/planetscale/Operations";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { Unowned } from "../AdoptPolicy.ts";
|
|
5
|
+
import { isResolved } from "../Diff.ts";
|
|
6
|
+
import { createPhysicalName } from "../PhysicalName.ts";
|
|
7
|
+
import * as Provider from "../Provider.ts";
|
|
8
|
+
import type { ResourceClass, ResourceLike } from "../Resource.ts";
|
|
9
|
+
import { hashImports, hashMigrations } from "../Sql/SqlFile.ts";
|
|
10
|
+
import { ensureMySQLProductionBranchClusterSize } from "./MySQL/MySQLClusterSize.ts";
|
|
11
|
+
import {
|
|
12
|
+
ensurePostgresProductionBranchClusterSize,
|
|
13
|
+
toPostgresClusterSku,
|
|
14
|
+
} from "./Postgres/PostgresClusterSize.ts";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_MIGRATIONS_TABLE,
|
|
17
|
+
PlanetscaleConflict,
|
|
18
|
+
isKnownError,
|
|
19
|
+
recordsEqual,
|
|
20
|
+
waitForBranchReady,
|
|
21
|
+
} from "./Util.ts";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Props shared between {@link MySQLBranch} and {@link PostgresBranch}. The
|
|
25
|
+
* `database` and `parentBranch` fields are typed by each engine's resource.
|
|
26
|
+
*/
|
|
27
|
+
export interface BaseBranchProps {
|
|
28
|
+
/**
|
|
29
|
+
* Branch name. If omitted, a name is generated from the stack/stage/id.
|
|
30
|
+
*/
|
|
31
|
+
name?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* If provided, restores the backup's schema and data to the new branch.
|
|
35
|
+
* Ignored if the branch already exists.
|
|
36
|
+
*/
|
|
37
|
+
backupId?: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* If provided, restores the last successful backup's schema and data.
|
|
41
|
+
* Ignored if the branch already exists.
|
|
42
|
+
*/
|
|
43
|
+
seedData?: "last_successful_backup";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether safe migrations are enabled on the branch.
|
|
47
|
+
*/
|
|
48
|
+
safeMigrations?: boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Region in which to create the branch. Defaults to the database's
|
|
52
|
+
* region. The actual region is validated on adopt/update.
|
|
53
|
+
*/
|
|
54
|
+
region?: { slug: string };
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Directory containing `.sql` migration files. Files are sorted by numeric
|
|
58
|
+
* prefix (for example `0001_init.sql`) and applied in order against this
|
|
59
|
+
* branch.
|
|
60
|
+
*/
|
|
61
|
+
migrationsDir?: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Name of the table used to track applied migrations.
|
|
65
|
+
* @default "__alchemy_migrations"
|
|
66
|
+
*/
|
|
67
|
+
migrationsTable?: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Paths to additional `.sql` files to apply after migrations. Each file is
|
|
71
|
+
* hashed; only files whose contents change are re-applied on later deploys.
|
|
72
|
+
*/
|
|
73
|
+
importFiles?: string[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Attributes shared between {@link MySQLBranch} and {@link PostgresBranch}.
|
|
78
|
+
*/
|
|
79
|
+
export interface BaseBranchAttributes {
|
|
80
|
+
/** The branch name. */
|
|
81
|
+
name: string;
|
|
82
|
+
/** The PlanetScale organization slug. */
|
|
83
|
+
organization: string;
|
|
84
|
+
/** The database name. */
|
|
85
|
+
database: string;
|
|
86
|
+
/** The parent branch name. */
|
|
87
|
+
parentBranch: string;
|
|
88
|
+
/** Whether this is a production branch. */
|
|
89
|
+
production: boolean;
|
|
90
|
+
/** Time at which the branch was created (ISO 8601). */
|
|
91
|
+
createdAt: string;
|
|
92
|
+
/** Time at which the branch was last updated (ISO 8601). */
|
|
93
|
+
updatedAt: string;
|
|
94
|
+
/** HTML URL for accessing the branch in the dashboard. */
|
|
95
|
+
htmlUrl: string;
|
|
96
|
+
/** The region of the branch as reported by PlanetScale. */
|
|
97
|
+
region: { slug: string };
|
|
98
|
+
/** Directory containing migration files, if configured. */
|
|
99
|
+
migrationsDir: string | undefined;
|
|
100
|
+
/** Table used to track applied migrations, if configured. */
|
|
101
|
+
migrationsTable: string | undefined;
|
|
102
|
+
/** Content hashes for the last applied migration files. */
|
|
103
|
+
migrationsHashes: Record<string, string>;
|
|
104
|
+
/** Content hashes for the last applied import files. */
|
|
105
|
+
importHashes: Record<string, string>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Runtime-resolved Database/Branch references. `news.database` can be a
|
|
109
|
+
// plain string OR (after resolution) the Database resource's attributes —
|
|
110
|
+
// which contain plain values for `name` / `organization`. The static
|
|
111
|
+
// Database type has those fields as `Output<...>`, so we cast through a
|
|
112
|
+
// structural shape here.
|
|
113
|
+
type DatabaseRef = string | { name: string; organization?: string };
|
|
114
|
+
type BranchRef = string | { name: string };
|
|
115
|
+
|
|
116
|
+
const resolveDatabase = (
|
|
117
|
+
database: unknown,
|
|
118
|
+
): { name: string; organization?: string } => {
|
|
119
|
+
const ref = database as DatabaseRef | undefined;
|
|
120
|
+
if (!ref) return { name: "" };
|
|
121
|
+
return typeof ref === "string"
|
|
122
|
+
? { name: ref }
|
|
123
|
+
: { name: ref.name, organization: ref.organization };
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const resolveParent = (parent: unknown): string => {
|
|
127
|
+
const ref = parent as BranchRef | undefined;
|
|
128
|
+
return !ref ? "main" : typeof ref === "string" ? ref : ref.name;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const createBranchName = (id: string, name: string | undefined) =>
|
|
132
|
+
Effect.gen(function* () {
|
|
133
|
+
return (
|
|
134
|
+
name ??
|
|
135
|
+
(yield* createPhysicalName({ id, lowercase: true, maxLength: 63 }))
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Shape of the engine-specific migration runners used by
|
|
141
|
+
* {@link makeBranchProvider}. MySQL and Postgres each supply their own
|
|
142
|
+
* implementations in their respective `*Migrations.ts` modules.
|
|
143
|
+
*/
|
|
144
|
+
export interface BranchMigrationRunners {
|
|
145
|
+
runMigrations: (
|
|
146
|
+
target: { organization: string; database: string; branch: string },
|
|
147
|
+
migrationsDir: string,
|
|
148
|
+
migrationsTable: string,
|
|
149
|
+
) => Effect.Effect<Record<string, string>, any, any>;
|
|
150
|
+
runImports: (
|
|
151
|
+
target: { organization: string; database: string; branch: string },
|
|
152
|
+
importFiles: string[],
|
|
153
|
+
rootDir: string,
|
|
154
|
+
previousHashes: Record<string, string>,
|
|
155
|
+
) => Effect.Effect<Record<string, string>, any, any>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Build a branch provider for a specific PlanetScale engine. The
|
|
160
|
+
* caller supplies the typed `Resource` token and the engine's migration
|
|
161
|
+
* runners; everything else (observe / ensure / sync / delete) is shared.
|
|
162
|
+
*/
|
|
163
|
+
export const makeBranchProvider = <R extends ResourceLike>(opts: {
|
|
164
|
+
resource: ResourceClass<R>;
|
|
165
|
+
expectedKind: "mysql" | "postgresql";
|
|
166
|
+
engineLabel: string;
|
|
167
|
+
runners: BranchMigrationRunners;
|
|
168
|
+
}) =>
|
|
169
|
+
Provider.effect(
|
|
170
|
+
opts.resource,
|
|
171
|
+
Effect.gen(function* () {
|
|
172
|
+
const rootDir = yield* Effect.sync(() => process.cwd());
|
|
173
|
+
const createBranch = yield* ops.createBranch;
|
|
174
|
+
const getBranch = yield* ops.getBranch;
|
|
175
|
+
const updateBranch = yield* ops.updateBranch;
|
|
176
|
+
const deleteBranch = yield* ops.deleteBranch;
|
|
177
|
+
const promoteBranch = yield* ops.promoteBranch;
|
|
178
|
+
const demoteBranch = yield* ops.demoteBranch;
|
|
179
|
+
const enableSafe = yield* ops.enableSafeMigrations;
|
|
180
|
+
const disableSafe = yield* ops.disableSafeMigrations;
|
|
181
|
+
const { runMigrations, runImports } = opts.runners;
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
stables: ["organization", "database"],
|
|
185
|
+
|
|
186
|
+
diff: Effect.fn(function* ({ news, olds, output }: any) {
|
|
187
|
+
if (!isResolved(news)) return undefined;
|
|
188
|
+
|
|
189
|
+
const newDb = resolveDatabase(news.database).name;
|
|
190
|
+
const oldDbRef = output?.database ?? olds.database;
|
|
191
|
+
if (oldDbRef) {
|
|
192
|
+
const oldDb = resolveDatabase(oldDbRef).name;
|
|
193
|
+
if (newDb !== oldDb) {
|
|
194
|
+
return { action: "replace" } as const;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const newParent = resolveParent(news.parentBranch);
|
|
199
|
+
const oldParent =
|
|
200
|
+
output?.parentBranch ?? resolveParent(olds.parentBranch);
|
|
201
|
+
if (newParent !== oldParent) {
|
|
202
|
+
return { action: "replace" } as const;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (
|
|
206
|
+
news.region?.slug &&
|
|
207
|
+
output?.region?.slug &&
|
|
208
|
+
news.region.slug !== output.region.slug
|
|
209
|
+
) {
|
|
210
|
+
return { action: "replace" } as const;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (news.migrationsDir) {
|
|
214
|
+
const newHashes = yield* hashMigrations(news.migrationsDir);
|
|
215
|
+
if (!recordsEqual(newHashes, output?.migrationsHashes ?? {})) {
|
|
216
|
+
return { action: "update" } as const;
|
|
217
|
+
}
|
|
218
|
+
if (
|
|
219
|
+
(news.migrationsTable ?? DEFAULT_MIGRATIONS_TABLE) !==
|
|
220
|
+
(output?.migrationsTable ?? DEFAULT_MIGRATIONS_TABLE)
|
|
221
|
+
) {
|
|
222
|
+
return { action: "update" } as const;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (news.importFiles?.length) {
|
|
226
|
+
const newHashes = yield* hashImports(news.importFiles, rootDir);
|
|
227
|
+
if (!recordsEqual(newHashes, output?.importHashes ?? {})) {
|
|
228
|
+
return { action: "update" } as const;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return undefined;
|
|
233
|
+
}),
|
|
234
|
+
|
|
235
|
+
read: Effect.fn(function* ({ id, olds, output }: any) {
|
|
236
|
+
// If we have neither a cached output nor a usable `olds.database`
|
|
237
|
+
// there's no way to identify which branch to refresh — most often
|
|
238
|
+
// this is destroy of a partially-created resource whose props
|
|
239
|
+
// never got fully persisted. Return `undefined` so the engine
|
|
240
|
+
// treats it as already-gone and drops the state entry.
|
|
241
|
+
if (!output && !olds?.database) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
const dbInfo = output
|
|
245
|
+
? { name: output.database, organization: output.organization }
|
|
246
|
+
: resolveDatabase(olds.database);
|
|
247
|
+
const { organization: envOrg } = yield* Credentials;
|
|
248
|
+
const organization =
|
|
249
|
+
output?.organization ?? dbInfo.organization ?? envOrg;
|
|
250
|
+
const databaseName = output?.database ?? dbInfo.name;
|
|
251
|
+
const branchName =
|
|
252
|
+
output?.name ?? (yield* createBranchName(id, olds.name));
|
|
253
|
+
|
|
254
|
+
return yield* getBranch({
|
|
255
|
+
organization,
|
|
256
|
+
database: databaseName,
|
|
257
|
+
branch: branchName,
|
|
258
|
+
}).pipe(
|
|
259
|
+
Effect.map((data) => {
|
|
260
|
+
const attrs = {
|
|
261
|
+
name: data.name,
|
|
262
|
+
organization,
|
|
263
|
+
database: databaseName,
|
|
264
|
+
parentBranch: data.parent_branch ?? "main",
|
|
265
|
+
production: data.production,
|
|
266
|
+
createdAt: data.created_at,
|
|
267
|
+
updatedAt: data.updated_at,
|
|
268
|
+
htmlUrl: data.html_url,
|
|
269
|
+
region: { slug: data.region.slug },
|
|
270
|
+
migrationsDir: output?.migrationsDir ?? olds?.migrationsDir,
|
|
271
|
+
migrationsTable:
|
|
272
|
+
output?.migrationsTable ?? olds?.migrationsTable,
|
|
273
|
+
migrationsHashes: output?.migrationsHashes ?? {},
|
|
274
|
+
importHashes: output?.importHashes ?? {},
|
|
275
|
+
} satisfies BaseBranchAttributes;
|
|
276
|
+
|
|
277
|
+
return output ? attrs : Unowned(attrs);
|
|
278
|
+
}),
|
|
279
|
+
Effect.catchTag("NotFound", () => Effect.succeed(undefined)),
|
|
280
|
+
);
|
|
281
|
+
}),
|
|
282
|
+
|
|
283
|
+
reconcile: Effect.fn(function* ({ id, news, output, session }: any) {
|
|
284
|
+
const { organization: envOrg } = yield* Credentials;
|
|
285
|
+
const dbInfo = resolveDatabase(news.database);
|
|
286
|
+
const organization =
|
|
287
|
+
output?.organization ?? dbInfo.organization ?? envOrg;
|
|
288
|
+
const databaseName = output?.database ?? dbInfo.name;
|
|
289
|
+
const desiredBranchName = yield* createBranchName(id, news.name);
|
|
290
|
+
const observedBranchName = output?.name ?? desiredBranchName;
|
|
291
|
+
const parentBranchName = resolveParent(news.parentBranch);
|
|
292
|
+
|
|
293
|
+
// If parentBranch is a plain string (an unmanaged branch reference),
|
|
294
|
+
// wait for it to be ready before we touch the child branch. When it
|
|
295
|
+
// is a Branch resource, Alchemy's resource graph already guarantees
|
|
296
|
+
// readiness before this resource's inputs are resolved.
|
|
297
|
+
if (news.parentBranch && typeof news.parentBranch === "string") {
|
|
298
|
+
yield* waitForBranchReady(
|
|
299
|
+
organization,
|
|
300
|
+
databaseName,
|
|
301
|
+
parentBranchName,
|
|
302
|
+
session,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Observe — fetch the live branch state.
|
|
307
|
+
let current = yield* getBranch({
|
|
308
|
+
organization,
|
|
309
|
+
database: databaseName,
|
|
310
|
+
branch: observedBranchName,
|
|
311
|
+
}).pipe(Effect.catchTag("NotFound", () => Effect.succeed(undefined)));
|
|
312
|
+
|
|
313
|
+
// Ensure — if missing, create. The parent must be ready before
|
|
314
|
+
// the child can fork from it. PostgreSQL short cluster sizes need
|
|
315
|
+
// to be expanded against the parent's region so the API call lands
|
|
316
|
+
// with a valid sku.
|
|
317
|
+
if (!current) {
|
|
318
|
+
const parent = yield* waitForBranchReady(
|
|
319
|
+
organization,
|
|
320
|
+
databaseName,
|
|
321
|
+
parentBranchName,
|
|
322
|
+
session,
|
|
323
|
+
);
|
|
324
|
+
const parentClusterSize = news.clusterSize
|
|
325
|
+
? parent.kind === "postgresql"
|
|
326
|
+
? toPostgresClusterSku({
|
|
327
|
+
size: news.clusterSize,
|
|
328
|
+
region: parent.region.slug,
|
|
329
|
+
})
|
|
330
|
+
: news.clusterSize
|
|
331
|
+
: undefined;
|
|
332
|
+
yield* session.note("Creating branch...");
|
|
333
|
+
current = yield* createBranch({
|
|
334
|
+
organization,
|
|
335
|
+
database: databaseName,
|
|
336
|
+
name: desiredBranchName,
|
|
337
|
+
parent_branch: parentBranchName,
|
|
338
|
+
backup_id: news.backupId,
|
|
339
|
+
seed_data: news.seedData,
|
|
340
|
+
region: news.region?.slug,
|
|
341
|
+
cluster_size: parentClusterSize,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (current.kind !== opts.expectedKind) {
|
|
346
|
+
return yield* Effect.fail(
|
|
347
|
+
new PlanetscaleConflict({
|
|
348
|
+
message:
|
|
349
|
+
`Planetscale branch "${current.name}" (database "${databaseName}") has kind ` +
|
|
350
|
+
`"${current.kind}" but this resource is a ${opts.engineLabel}. ` +
|
|
351
|
+
`Use the matching ${current.kind === "mysql" ? "MySQLBranch" : "PostgresBranch"} ` +
|
|
352
|
+
`resource instead.`,
|
|
353
|
+
}),
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
yield* waitForBranchReady(
|
|
358
|
+
organization,
|
|
359
|
+
databaseName,
|
|
360
|
+
current.name,
|
|
361
|
+
session,
|
|
362
|
+
);
|
|
363
|
+
|
|
364
|
+
// Sync name — branch names are mutable. Continue subsequent syncs
|
|
365
|
+
// under the name returned by the API.
|
|
366
|
+
if (current.name !== desiredBranchName) {
|
|
367
|
+
current = yield* updateBranch({
|
|
368
|
+
organization,
|
|
369
|
+
database: databaseName,
|
|
370
|
+
branch: current.name,
|
|
371
|
+
new_name: desiredBranchName,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const branchName = current.name;
|
|
376
|
+
|
|
377
|
+
// Sync production status before branch settings that depend on it.
|
|
378
|
+
// PlanetScale only supports explicit branch promotion/demotion for MySQL.
|
|
379
|
+
if (opts.expectedKind === "mysql") {
|
|
380
|
+
const desiredProduction = news.isProduction ?? false;
|
|
381
|
+
if (current.production !== desiredProduction) {
|
|
382
|
+
current = desiredProduction
|
|
383
|
+
? yield* promoteBranch({
|
|
384
|
+
organization,
|
|
385
|
+
database: databaseName,
|
|
386
|
+
branch: branchName,
|
|
387
|
+
})
|
|
388
|
+
: yield* demoteBranch({
|
|
389
|
+
organization,
|
|
390
|
+
database: databaseName,
|
|
391
|
+
branch: branchName,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Sync safeMigrations — observed via `current.safe_migrations`,
|
|
397
|
+
// skip the API call entirely on no-op.
|
|
398
|
+
if (
|
|
399
|
+
news.safeMigrations !== undefined &&
|
|
400
|
+
current.safe_migrations !== news.safeMigrations
|
|
401
|
+
) {
|
|
402
|
+
if (news.safeMigrations) {
|
|
403
|
+
yield* enableSafe({
|
|
404
|
+
organization,
|
|
405
|
+
database: databaseName,
|
|
406
|
+
branch: branchName,
|
|
407
|
+
});
|
|
408
|
+
} else {
|
|
409
|
+
yield* disableSafe({
|
|
410
|
+
organization,
|
|
411
|
+
database: databaseName,
|
|
412
|
+
branch: branchName,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// Sync clusterSize — only meaningful on production branches.
|
|
418
|
+
if (news.clusterSize) {
|
|
419
|
+
if (current.kind === "postgresql") {
|
|
420
|
+
yield* ensurePostgresProductionBranchClusterSize(
|
|
421
|
+
organization,
|
|
422
|
+
databaseName,
|
|
423
|
+
branchName,
|
|
424
|
+
news.clusterSize,
|
|
425
|
+
);
|
|
426
|
+
} else {
|
|
427
|
+
yield* ensureMySQLProductionBranchClusterSize(
|
|
428
|
+
organization,
|
|
429
|
+
databaseName,
|
|
430
|
+
branchName,
|
|
431
|
+
news.clusterSize,
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Re-read so the returned attributes reflect any mutation.
|
|
437
|
+
const updated = yield* getBranch({
|
|
438
|
+
organization,
|
|
439
|
+
database: databaseName,
|
|
440
|
+
branch: branchName,
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
const migrationTarget = {
|
|
444
|
+
organization,
|
|
445
|
+
database: databaseName,
|
|
446
|
+
branch: updated.name,
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
const migrationsTable =
|
|
450
|
+
news.migrationsTable ??
|
|
451
|
+
output?.migrationsTable ??
|
|
452
|
+
DEFAULT_MIGRATIONS_TABLE;
|
|
453
|
+
const migrationsHashes = news.migrationsDir
|
|
454
|
+
? yield* runMigrations(
|
|
455
|
+
migrationTarget,
|
|
456
|
+
news.migrationsDir,
|
|
457
|
+
migrationsTable,
|
|
458
|
+
)
|
|
459
|
+
: (output?.migrationsHashes ?? {});
|
|
460
|
+
const importHashes = news.importFiles?.length
|
|
461
|
+
? yield* runImports(
|
|
462
|
+
migrationTarget,
|
|
463
|
+
news.importFiles,
|
|
464
|
+
rootDir,
|
|
465
|
+
output?.importHashes ?? {},
|
|
466
|
+
)
|
|
467
|
+
: {};
|
|
468
|
+
|
|
469
|
+
return {
|
|
470
|
+
name: updated.name,
|
|
471
|
+
organization,
|
|
472
|
+
database: databaseName,
|
|
473
|
+
parentBranch: updated.parent_branch ?? parentBranchName,
|
|
474
|
+
production: updated.production,
|
|
475
|
+
createdAt: updated.created_at,
|
|
476
|
+
updatedAt: updated.updated_at,
|
|
477
|
+
htmlUrl: updated.html_url,
|
|
478
|
+
region: { slug: updated.region.slug },
|
|
479
|
+
migrationsDir: news.migrationsDir,
|
|
480
|
+
migrationsTable: news.migrationsDir ? migrationsTable : undefined,
|
|
481
|
+
migrationsHashes,
|
|
482
|
+
importHashes,
|
|
483
|
+
} satisfies BaseBranchAttributes;
|
|
484
|
+
}),
|
|
485
|
+
|
|
486
|
+
delete: Effect.fn(function* ({ output }: any) {
|
|
487
|
+
// If `read` returned undefined (e.g. destroy of a partially-
|
|
488
|
+
// created branch whose props never finished persisting), there
|
|
489
|
+
// is nothing addressable to delete. Drop the state entry.
|
|
490
|
+
if (!output) return;
|
|
491
|
+
yield* deleteBranch({
|
|
492
|
+
organization: output.organization,
|
|
493
|
+
database: output.database,
|
|
494
|
+
branch: output.name,
|
|
495
|
+
}).pipe(
|
|
496
|
+
Effect.catchTag("NotFound", () => Effect.void),
|
|
497
|
+
Effect.catchIf(
|
|
498
|
+
isKnownError(
|
|
499
|
+
"UnprocessableEntity",
|
|
500
|
+
"The default branch cannot be deleted.",
|
|
501
|
+
),
|
|
502
|
+
() => Effect.void,
|
|
503
|
+
),
|
|
504
|
+
);
|
|
505
|
+
}),
|
|
506
|
+
} as any;
|
|
507
|
+
}),
|
|
508
|
+
);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Credentials,
|
|
3
|
+
DEFAULT_API_BASE_URL,
|
|
4
|
+
} from "@distilled.cloud/planetscale/Credentials";
|
|
5
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
6
|
+
import * as Config from "effect/Config";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Layer from "effect/Layer";
|
|
9
|
+
import * as Redacted from "effect/Redacted";
|
|
10
|
+
import { getAuthProvider } from "../Auth/AuthProvider.ts";
|
|
11
|
+
import { ALCHEMY_PROFILE, Profile } from "../Auth/Profile.ts";
|
|
12
|
+
import {
|
|
13
|
+
PLANETSCALE_AUTH_PROVIDER_NAME,
|
|
14
|
+
type PlanetscaleAuthConfig,
|
|
15
|
+
type PlanetscaleResolvedCredentials,
|
|
16
|
+
} from "./AuthProvider.ts";
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
Credentials,
|
|
20
|
+
CredentialsFromEnv,
|
|
21
|
+
DEFAULT_API_BASE_URL,
|
|
22
|
+
} from "@distilled.cloud/planetscale/Credentials";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Build a PlanetScale `Credentials` Layer from an explicit token. Useful for
|
|
26
|
+
* tests or when the caller already has credentials in hand.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* Effect.provide(
|
|
31
|
+
* Planetscale.fromToken({
|
|
32
|
+
* tokenId: "abcd1234",
|
|
33
|
+
* token: "api-token-secret",
|
|
34
|
+
* organization: "my-org",
|
|
35
|
+
* }),
|
|
36
|
+
* )
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export const fromToken = (input: {
|
|
40
|
+
tokenId: string | Redacted.Redacted<string>;
|
|
41
|
+
token: string | Redacted.Redacted<string>;
|
|
42
|
+
organization: string;
|
|
43
|
+
apiBaseUrl?: string;
|
|
44
|
+
}) =>
|
|
45
|
+
Layer.succeed(Credentials, {
|
|
46
|
+
tokenId:
|
|
47
|
+
typeof input.token === "string"
|
|
48
|
+
? Redacted.make(input.token)
|
|
49
|
+
: input.token,
|
|
50
|
+
token:
|
|
51
|
+
typeof input.token === "string"
|
|
52
|
+
? Redacted.make(input.token)
|
|
53
|
+
: input.token,
|
|
54
|
+
organization: input.organization,
|
|
55
|
+
apiBaseUrl: input.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Build a PlanetScale `Credentials` Layer that resolves credentials via the
|
|
60
|
+
* Alchemy AuthProvider using the configured profile (defaults to "default",
|
|
61
|
+
* overridable with the `ALCHEMY_PROFILE` env/config value).
|
|
62
|
+
*/
|
|
63
|
+
export const fromAuthProvider = () =>
|
|
64
|
+
Layer.effect(
|
|
65
|
+
Credentials,
|
|
66
|
+
Effect.gen(function* () {
|
|
67
|
+
const profile = yield* Profile;
|
|
68
|
+
const auth = yield* getAuthProvider<
|
|
69
|
+
PlanetscaleAuthConfig,
|
|
70
|
+
PlanetscaleResolvedCredentials
|
|
71
|
+
>(PLANETSCALE_AUTH_PROVIDER_NAME);
|
|
72
|
+
const profileName = yield* ALCHEMY_PROFILE;
|
|
73
|
+
const ci = yield* Config.boolean("CI").pipe(Config.withDefault(false));
|
|
74
|
+
const apiBaseUrl = yield* Config.string("PLANETSCALE_API_BASE_URL").pipe(
|
|
75
|
+
Config.withDefault(DEFAULT_API_BASE_URL),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return yield* profile.loadOrConfigure(auth, profileName, { ci }).pipe(
|
|
79
|
+
Effect.flatMap((config) =>
|
|
80
|
+
auth.read(profileName, config as PlanetscaleAuthConfig),
|
|
81
|
+
),
|
|
82
|
+
Effect.map((creds) => ({
|
|
83
|
+
tokenId: creds.tokenId,
|
|
84
|
+
token: creds.token,
|
|
85
|
+
organization: creds.organization,
|
|
86
|
+
apiBaseUrl,
|
|
87
|
+
})),
|
|
88
|
+
Effect.mapError(
|
|
89
|
+
(e) =>
|
|
90
|
+
new ConfigError({
|
|
91
|
+
message: `Failed to resolve Planetscale credentials for profile '${profileName}': ${(e as { message?: string }).message ?? String(e)}`,
|
|
92
|
+
}),
|
|
93
|
+
),
|
|
94
|
+
);
|
|
95
|
+
}),
|
|
96
|
+
);
|