alchemy 2.0.0-beta.42 → 2.0.0-beta.44
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/cli.js +18 -5
- package/bin/exec.js +317 -242
- 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/Auth/Lock.js +2 -2
- package/lib/Auth/Lock.js.map +1 -1
- package/lib/Binding.d.ts +1 -1
- package/lib/Binding.d.ts.map +1 -1
- package/lib/Bundle/Bundle.d.ts +11 -0
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +19 -12
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Bundle/BundleAnalyzerPlugin.d.ts +25 -0
- package/lib/Bundle/BundleAnalyzerPlugin.d.ts.map +1 -0
- package/lib/Bundle/BundleAnalyzerPlugin.js +16 -0
- package/lib/Bundle/BundleAnalyzerPlugin.js.map +1 -0
- 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/Bundle/RawPlugin.d.ts +36 -0
- package/lib/Bundle/RawPlugin.d.ts.map +1 -0
- package/lib/Bundle/RawPlugin.js +80 -0
- package/lib/Bundle/RawPlugin.js.map +1 -0
- package/lib/Bundle/index.d.ts +2 -0
- package/lib/Bundle/index.d.ts.map +1 -1
- package/lib/Bundle/index.js +2 -0
- package/lib/Bundle/index.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/Cli/commands/dev.d.ts +3 -2
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +9 -1
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cli/exec.d.ts.map +1 -1
- package/lib/Cli/exec.js +2 -1
- package/lib/Cli/exec.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/Local.d.ts +2 -0
- package/lib/Cloudflare/Local.d.ts.map +1 -0
- package/lib/Cloudflare/Local.js +9 -0
- package/lib/Cloudflare/Local.js.map +1 -0
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +3 -1
- package/lib/Cloudflare/Providers.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/DurableObjectBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.js +0 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.js.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/LocalWorkerProvider.d.ts +22 -3
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +413 -21
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.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 +9 -22
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +3 -4
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.js +3 -5
- package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts +1 -2
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js +3 -6
- package/lib/Cloudflare/Workers/WorkerBundle.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/Cloudflare/Zaraz/ZarazConfig.d.ts +184 -0
- package/lib/Cloudflare/Zaraz/ZarazConfig.d.ts.map +1 -0
- package/lib/Cloudflare/Zaraz/ZarazConfig.js +216 -0
- package/lib/Cloudflare/Zaraz/ZarazConfig.js.map +1 -0
- package/lib/Cloudflare/Zaraz/ZarazEventTypes.d.ts +188 -0
- package/lib/Cloudflare/Zaraz/ZarazEventTypes.d.ts.map +1 -0
- package/lib/Cloudflare/Zaraz/ZarazEventTypes.js +4 -0
- package/lib/Cloudflare/Zaraz/ZarazEventTypes.js.map +1 -0
- package/lib/Cloudflare/Zaraz/index.d.ts +3 -0
- package/lib/Cloudflare/Zaraz/index.d.ts.map +1 -0
- package/lib/Cloudflare/Zaraz/index.js +2 -0
- package/lib/Cloudflare/Zaraz/index.js.map +1 -0
- package/lib/Cloudflare/index.d.ts +1 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +1 -0
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Local/RpcProvider.d.ts +54 -0
- package/lib/Local/RpcProvider.d.ts.map +1 -0
- package/lib/Local/RpcProvider.js +57 -0
- package/lib/Local/RpcProvider.js.map +1 -0
- package/lib/Local/RpcProviderProxy.d.ts +19 -0
- package/lib/Local/RpcProviderProxy.d.ts.map +1 -0
- package/lib/Local/RpcProviderProxy.js +48 -0
- package/lib/Local/RpcProviderProxy.js.map +1 -0
- package/lib/Local/RpcSerialization.d.ts +34 -0
- package/lib/Local/RpcSerialization.d.ts.map +1 -0
- package/lib/Local/RpcSerialization.js +120 -0
- package/lib/Local/RpcSerialization.js.map +1 -0
- package/lib/Local/RpcServer.d.ts +63 -0
- package/lib/Local/RpcServer.d.ts.map +1 -0
- package/lib/Local/RpcServer.js +72 -0
- package/lib/Local/RpcServer.js.map +1 -0
- package/lib/Local/RpcServerBun.d.ts +3 -0
- package/lib/Local/RpcServerBun.d.ts.map +1 -0
- package/lib/Local/RpcServerBun.js +47 -0
- package/lib/Local/RpcServerBun.js.map +1 -0
- package/lib/Local/RpcServerEnvironment.d.ts +20 -0
- package/lib/Local/RpcServerEnvironment.d.ts.map +1 -0
- package/lib/Local/RpcServerEnvironment.js +22 -0
- package/lib/Local/RpcServerEnvironment.js.map +1 -0
- package/lib/Local/RpcServerNode.d.ts +3 -0
- package/lib/Local/RpcServerNode.d.ts.map +1 -0
- package/lib/Local/RpcServerNode.js +43 -0
- package/lib/Local/RpcServerNode.js.map +1 -0
- package/lib/Local/RpcServerSession.d.ts +27 -0
- package/lib/Local/RpcServerSession.d.ts.map +1 -0
- package/lib/Local/RpcServerSession.js +68 -0
- package/lib/Local/RpcServerSession.js.map +1 -0
- package/lib/Local/RpcSpawner.d.ts +21 -0
- package/lib/Local/RpcSpawner.d.ts.map +1 -0
- package/lib/Local/RpcSpawner.js +132 -0
- package/lib/Local/RpcSpawner.js.map +1 -0
- 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/Util/PlatformServices.d.ts +7 -0
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +22 -11
- package/lib/Util/PlatformServices.js.map +1 -1
- package/lib/Util/camel.d.ts.map +1 -1
- package/lib/Util/camel.js +2 -3
- package/lib/Util/camel.js.map +1 -1
- package/lib/Util/data.d.ts +5 -0
- package/lib/Util/data.d.ts.map +1 -1
- package/lib/Util/data.js +29 -0
- package/lib/Util/data.js.map +1 -1
- package/lib/Util/stable.d.ts.map +1 -1
- package/lib/Util/stable.js +3 -6
- package/lib/Util/stable.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +25 -13
- package/src/Auth/Lock.ts +2 -2
- package/src/Binding.ts +1 -1
- package/src/Bundle/Bundle.ts +35 -13
- package/src/Bundle/BundleAnalyzerPlugin.ts +33 -0
- package/src/Bundle/Docker.ts +12 -15
- package/src/Bundle/RawPlugin.ts +82 -0
- package/src/Bundle/index.ts +2 -0
- package/src/Cli/commands/deploy.ts +1 -0
- package/src/Cli/commands/dev.ts +51 -37
- package/src/Cli/exec.ts +12 -7
- 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/Local.ts +23 -0
- package/src/Cloudflare/Providers.ts +3 -0
- 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/DurableObjectBridge.ts +0 -1
- package/src/Cloudflare/Workers/DurableObjectNamespace.ts +6 -6
- package/src/Cloudflare/Workers/DynamicWorkerLoader.ts +4 -5
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +547 -21
- package/src/Cloudflare/Workers/RpcAsync.ts +55 -0
- package/src/Cloudflare/Workers/Worker.ts +18 -25
- package/src/Cloudflare/Workers/WorkerBridge.ts +3 -5
- package/src/Cloudflare/Workers/WorkerBundle.ts +4 -8
- package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +2 -0
- package/src/Cloudflare/Workers/Workflow.ts +10 -11
- package/src/Cloudflare/Zaraz/ZarazConfig.ts +403 -0
- package/src/Cloudflare/Zaraz/ZarazEventTypes.ts +257 -0
- package/src/Cloudflare/Zaraz/index.ts +25 -0
- package/src/Cloudflare/index.ts +1 -0
- package/src/Local/RpcProvider.ts +102 -0
- package/src/Local/RpcProviderProxy.ts +86 -0
- package/src/Local/RpcSerialization.ts +225 -0
- package/src/Local/RpcServer.ts +138 -0
- package/src/Local/RpcServerBun.ts +59 -0
- package/src/Local/RpcServerEnvironment.ts +55 -0
- package/src/Local/RpcServerNode.ts +58 -0
- package/src/Local/RpcServerSession.ts +87 -0
- package/src/Local/RpcSpawner.ts +196 -0
- 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/src/Util/PlatformServices.ts +41 -27
- package/src/Util/camel.ts +3 -5
- package/src/Util/data.ts +38 -0
- package/src/Util/stable.ts +4 -10
- 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/Cloudflare/Local/Sidecar.d.ts +0 -63
- package/lib/Cloudflare/Local/Sidecar.d.ts.map +0 -1
- package/lib/Cloudflare/Local/Sidecar.js +0 -50
- package/lib/Cloudflare/Local/Sidecar.js.map +0 -1
- package/lib/Cloudflare/Local/SidecarHandlers.d.ts +0 -8
- package/lib/Cloudflare/Local/SidecarHandlers.d.ts.map +0 -1
- package/lib/Cloudflare/Local/SidecarHandlers.js +0 -381
- package/lib/Cloudflare/Local/SidecarHandlers.js.map +0 -1
- package/lib/Cloudflare/Local/SidecarServer.d.ts +0 -2
- package/lib/Cloudflare/Local/SidecarServer.d.ts.map +0 -1
- package/lib/Cloudflare/Local/SidecarServer.js +0 -34
- package/lib/Cloudflare/Local/SidecarServer.js.map +0 -1
- package/lib/Neon/SqlFile.d.ts.map +0 -1
- package/lib/Neon/SqlFile.js.map +0 -1
- package/lib/Sidecar/Lock.d.ts +0 -23
- package/lib/Sidecar/Lock.d.ts.map +0 -1
- package/lib/Sidecar/Lock.js +0 -39
- package/lib/Sidecar/Lock.js.map +0 -1
- package/lib/Sidecar/RpcClient.d.ts +0 -15
- package/lib/Sidecar/RpcClient.d.ts.map +0 -1
- package/lib/Sidecar/RpcClient.js +0 -78
- package/lib/Sidecar/RpcClient.js.map +0 -1
- package/lib/Sidecar/RpcHandler.d.ts +0 -51
- package/lib/Sidecar/RpcHandler.d.ts.map +0 -1
- package/lib/Sidecar/RpcHandler.js +0 -87
- package/lib/Sidecar/RpcHandler.js.map +0 -1
- package/lib/Sidecar/RpcPaths.d.ts +0 -19
- package/lib/Sidecar/RpcPaths.d.ts.map +0 -1
- package/lib/Sidecar/RpcPaths.js +0 -31
- package/lib/Sidecar/RpcPaths.js.map +0 -1
- package/lib/Sidecar/RpcServer.d.ts +0 -30
- package/lib/Sidecar/RpcServer.d.ts.map +0 -1
- package/lib/Sidecar/RpcServer.js +0 -105
- package/lib/Sidecar/RpcServer.js.map +0 -1
- package/lib/Sidecar/RpcServerBun.d.ts +0 -4
- package/lib/Sidecar/RpcServerBun.d.ts.map +0 -1
- package/lib/Sidecar/RpcServerBun.js +0 -28
- package/lib/Sidecar/RpcServerBun.js.map +0 -1
- package/lib/Sidecar/RpcServerNode.d.ts +0 -4
- package/lib/Sidecar/RpcServerNode.d.ts.map +0 -1
- package/lib/Sidecar/RpcServerNode.js +0 -39
- package/lib/Sidecar/RpcServerNode.js.map +0 -1
- package/lib/Sidecar/RpcServices.d.ts +0 -6
- package/lib/Sidecar/RpcServices.d.ts.map +0 -1
- package/lib/Sidecar/RpcServices.js +0 -29
- package/lib/Sidecar/RpcServices.js.map +0 -1
- package/src/Cloudflare/D1/D1SqlFile.ts +0 -55
- package/src/Cloudflare/Local/Sidecar.ts +0 -81
- package/src/Cloudflare/Local/SidecarHandlers.ts +0 -491
- package/src/Cloudflare/Local/SidecarServer.ts +0 -70
- package/src/Sidecar/Lock.ts +0 -66
- package/src/Sidecar/RpcClient.ts +0 -142
- package/src/Sidecar/RpcHandler.ts +0 -205
- package/src/Sidecar/RpcPaths.ts +0 -39
- package/src/Sidecar/RpcServer.ts +0 -153
- package/src/Sidecar/RpcServerBun.ts +0 -41
- package/src/Sidecar/RpcServerNode.ts +0 -51
- package/src/Sidecar/RpcServices.ts +0 -48
|
@@ -0,0 +1,270 @@
|
|
|
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 * as Redacted from "effect/Redacted";
|
|
5
|
+
import { isResolved } from "../../Diff.ts";
|
|
6
|
+
import * as Provider from "../../Provider.ts";
|
|
7
|
+
import { Resource } from "../../Resource.ts";
|
|
8
|
+
import type { Providers } from "../Providers.ts";
|
|
9
|
+
import { PlanetscaleConflict, waitForBranchReady } from "../Util.ts";
|
|
10
|
+
import type { PostgresBranch } from "./PostgresBranch.ts";
|
|
11
|
+
import type { PostgresDatabase } from "./PostgresDatabase.ts";
|
|
12
|
+
import type { InheritedRole } from "./PostgresRole.ts";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Properties for creating or updating the default PlanetScale PostgreSQL
|
|
16
|
+
* role for a branch.
|
|
17
|
+
*
|
|
18
|
+
* Default roles are only meant for PostgreSQL databases. For MySQL,
|
|
19
|
+
* use {@link MySQLPassword} instead.
|
|
20
|
+
*/
|
|
21
|
+
export interface PostgresDefaultRoleProps {
|
|
22
|
+
/**
|
|
23
|
+
* PostgreSQL database — string name or {@link PostgresDatabase} resource.
|
|
24
|
+
*/
|
|
25
|
+
database: string | PostgresDatabase;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Branch — string name or {@link PostgresBranch} resource.
|
|
29
|
+
* @default "main"
|
|
30
|
+
*/
|
|
31
|
+
branch?: string | PostgresBranch;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Whether to force-reset the default role if it already exists.
|
|
35
|
+
* Adopting an existing default role is not supported because the
|
|
36
|
+
* password is only returned at create time.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
forceReset?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Output attributes of a deployed PlanetScale default role.
|
|
44
|
+
*/
|
|
45
|
+
export interface PostgresDefaultRoleAttributes {
|
|
46
|
+
/** Unique identifier for the role (stable). */
|
|
47
|
+
id: string;
|
|
48
|
+
/** The Postgres role name. */
|
|
49
|
+
name: string;
|
|
50
|
+
/** ISO 8601 timestamp at which the role expires. */
|
|
51
|
+
expiresAt: string | null;
|
|
52
|
+
/** Hostname for the database connection. */
|
|
53
|
+
host: string;
|
|
54
|
+
/** Username for database authentication. */
|
|
55
|
+
username: string;
|
|
56
|
+
/** Password for database authentication (Redacted). */
|
|
57
|
+
password: Redacted.Redacted<string>;
|
|
58
|
+
/** TTL in seconds (if set). */
|
|
59
|
+
ttl: number | null;
|
|
60
|
+
/** The database name. */
|
|
61
|
+
databaseName: string;
|
|
62
|
+
/** Direct connection URL for the database (Redacted). */
|
|
63
|
+
connectionUrl: Redacted.Redacted<string>;
|
|
64
|
+
/** Pooled connection URL via PSBouncer (Redacted). */
|
|
65
|
+
connectionUrlPooled: Redacted.Redacted<string>;
|
|
66
|
+
/** Inherited roles. */
|
|
67
|
+
inheritedRoles: InheritedRole[];
|
|
68
|
+
/** Resolved organization slug. */
|
|
69
|
+
organization: string;
|
|
70
|
+
/** Resolved database name (for delete). */
|
|
71
|
+
database: string;
|
|
72
|
+
/** Resolved branch name. */
|
|
73
|
+
branch: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The default PlanetScale PostgreSQL role for a database branch.
|
|
78
|
+
*
|
|
79
|
+
* @section Creating a Default Role
|
|
80
|
+
* @example Default role on the main branch
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const db = yield* Planetscale.PostgresDatabase("MyDb", {
|
|
83
|
+
* clusterSize: "PS_10",
|
|
84
|
+
* });
|
|
85
|
+
* const defaultRole = yield* Planetscale.PostgresDefaultRole("MainRole", {
|
|
86
|
+
* database: db,
|
|
87
|
+
* forceReset: true,
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export type PostgresDefaultRole = Resource<
|
|
92
|
+
"Planetscale.PostgresDefaultRole",
|
|
93
|
+
PostgresDefaultRoleProps,
|
|
94
|
+
PostgresDefaultRoleAttributes,
|
|
95
|
+
never,
|
|
96
|
+
Providers
|
|
97
|
+
>;
|
|
98
|
+
|
|
99
|
+
export const PostgresDefaultRole = Resource<PostgresDefaultRole>(
|
|
100
|
+
"Planetscale.PostgresDefaultRole",
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// Structural shapes for runtime-resolved Resource references — see
|
|
104
|
+
// notes in Password.ts.
|
|
105
|
+
type DatabaseRef = string | { name: string; organization?: string };
|
|
106
|
+
type BranchRef = string | { name: string };
|
|
107
|
+
|
|
108
|
+
const resolveDatabaseName = (database: string | PostgresDatabase): string => {
|
|
109
|
+
const ref = database as unknown as DatabaseRef;
|
|
110
|
+
return typeof ref === "string" ? ref : ref.name;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const resolveDatabaseOrg = (
|
|
114
|
+
database: string | PostgresDatabase,
|
|
115
|
+
): string | undefined => {
|
|
116
|
+
const ref = database as unknown as DatabaseRef;
|
|
117
|
+
return typeof ref === "string" ? undefined : ref.organization;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const resolveBranchName = (
|
|
121
|
+
branch: string | PostgresBranch | undefined,
|
|
122
|
+
): string => {
|
|
123
|
+
const ref = branch as unknown as BranchRef | undefined;
|
|
124
|
+
return !ref ? "main" : typeof ref === "string" ? ref : ref.name;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const PostgresDefaultRoleProvider = () =>
|
|
128
|
+
Provider.effect(
|
|
129
|
+
PostgresDefaultRole,
|
|
130
|
+
Effect.gen(function* () {
|
|
131
|
+
const getDefault = yield* ops.getDefaultRole;
|
|
132
|
+
const resetDefault = yield* ops.resetDefaultRole;
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
stables: ["id"],
|
|
136
|
+
|
|
137
|
+
diff: Effect.fn(function* ({ news, olds = {} }) {
|
|
138
|
+
if (!isResolved(news)) return undefined;
|
|
139
|
+
|
|
140
|
+
const newDb = resolveDatabaseName(news.database);
|
|
141
|
+
const oldDb = olds.database
|
|
142
|
+
? resolveDatabaseName(olds.database)
|
|
143
|
+
: undefined;
|
|
144
|
+
if (oldDb && newDb !== oldDb) {
|
|
145
|
+
return { action: "replace" } as const;
|
|
146
|
+
}
|
|
147
|
+
const newBranch = resolveBranchName(news.branch);
|
|
148
|
+
const oldBranch = resolveBranchName(olds.branch);
|
|
149
|
+
if (newBranch !== oldBranch) {
|
|
150
|
+
return { action: "replace" } as const;
|
|
151
|
+
}
|
|
152
|
+
return undefined;
|
|
153
|
+
}),
|
|
154
|
+
|
|
155
|
+
read: Effect.fn(function* ({ output }) {
|
|
156
|
+
// Adoption (no cached output) is impossible without destroying
|
|
157
|
+
// existing credentials. The engine routes adoption through
|
|
158
|
+
// `read`, but here we always defer to reconcile so the
|
|
159
|
+
// `forceReset` props flag remains the user-facing switch for
|
|
160
|
+
// takeover. Returning undefined makes the engine treat the
|
|
161
|
+
// resource as greenfield; reconcile then observes live state
|
|
162
|
+
// and either fails (no forceReset) or resets (forceReset).
|
|
163
|
+
if (!output) return undefined;
|
|
164
|
+
|
|
165
|
+
// Refresh — verify the default role still exists and re-emit
|
|
166
|
+
// the persisted output (with plaintext intact). If gone,
|
|
167
|
+
// return undefined so the engine routes through reconcile,
|
|
168
|
+
// which will recreate via reset.
|
|
169
|
+
return yield* getDefault({
|
|
170
|
+
organization: output.organization,
|
|
171
|
+
database: output.database,
|
|
172
|
+
branch: output.branch,
|
|
173
|
+
}).pipe(
|
|
174
|
+
Effect.map(() => output),
|
|
175
|
+
Effect.catchTag("NotFound", () => Effect.succeed(undefined)),
|
|
176
|
+
);
|
|
177
|
+
}),
|
|
178
|
+
|
|
179
|
+
reconcile: Effect.fn(function* ({ news, output }) {
|
|
180
|
+
const { organization: envOrg } = yield* Credentials;
|
|
181
|
+
const organization = resolveDatabaseOrg(news.database) ?? envOrg;
|
|
182
|
+
const databaseName = resolveDatabaseName(news.database);
|
|
183
|
+
const branchName = resolveBranchName(news.branch);
|
|
184
|
+
|
|
185
|
+
// 1. Observe — the default role is the singleton for this
|
|
186
|
+
// (database, branch); we key on those rather than an id.
|
|
187
|
+
// Observation runs unconditionally so the adoption guard
|
|
188
|
+
// below fires on greenfield deploys against branches that
|
|
189
|
+
// already have a default role (otherwise we would silently
|
|
190
|
+
// `resetDefault` and destroy their credentials).
|
|
191
|
+
const observed = yield* getDefault({
|
|
192
|
+
organization,
|
|
193
|
+
database: databaseName,
|
|
194
|
+
branch: branchName,
|
|
195
|
+
}).pipe(Effect.catchTag("NotFound", () => Effect.succeed(undefined)));
|
|
196
|
+
|
|
197
|
+
// 2. Sync (no-op) — we own the role and it still exists in the
|
|
198
|
+
// cloud. Default roles have nothing mutable in place: their
|
|
199
|
+
// plaintext password isn't retrievable, so we re-emit the
|
|
200
|
+
// persisted attributes unchanged. diff() forces a replace
|
|
201
|
+
// when database/branch change.
|
|
202
|
+
if (output && observed) {
|
|
203
|
+
return output;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// 3. Adoption guard — observed exists but we have no prior
|
|
207
|
+
// output (greenfield against a pre-existing default role).
|
|
208
|
+
// Taking over requires a reset (which destroys the existing
|
|
209
|
+
// password), so gate on an explicit forceReset opt-in.
|
|
210
|
+
if (observed && !news.forceReset) {
|
|
211
|
+
return yield* Effect.fail(
|
|
212
|
+
new PlanetscaleConflict({
|
|
213
|
+
message: `Default role already exists for database "${databaseName}" branch "${branchName}". Use forceReset: true to reset.`,
|
|
214
|
+
}),
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// 4. Ensure — (re)create the default role. This branch runs
|
|
219
|
+
// for greenfield (no output, no observed), drift recovery
|
|
220
|
+
// (output cached but cloud state gone), and authorised
|
|
221
|
+
// adoption (observed present + forceReset).
|
|
222
|
+
yield* waitForBranchReady(organization, databaseName, branchName);
|
|
223
|
+
const data = yield* resetDefault({
|
|
224
|
+
organization,
|
|
225
|
+
database: databaseName,
|
|
226
|
+
branch: branchName,
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
if (!data.password) {
|
|
230
|
+
return yield* Effect.die(
|
|
231
|
+
`Planetscale did not return a password for Default Role.`,
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const password = Redacted.isRedacted(data.password)
|
|
236
|
+
? Redacted.value(data.password)
|
|
237
|
+
: data.password;
|
|
238
|
+
|
|
239
|
+
const connectionUrl = `postgresql://${data.username}:${password}@${data.access_host_url}:5432/${data.database_name}?sslmode=verify-full`;
|
|
240
|
+
const connectionUrlPooled = `postgresql://${data.username}:${password}@${data.access_host_url}:6432/${data.database_name}?sslmode=verify-full`;
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
id: data.id,
|
|
244
|
+
name: data.name,
|
|
245
|
+
expiresAt: data.expires_at,
|
|
246
|
+
host: data.access_host_url,
|
|
247
|
+
username: data.username,
|
|
248
|
+
password: Redacted.make(password),
|
|
249
|
+
ttl: data.ttl,
|
|
250
|
+
databaseName: data.database_name,
|
|
251
|
+
connectionUrl: Redacted.make(connectionUrl),
|
|
252
|
+
connectionUrlPooled: Redacted.make(connectionUrlPooled),
|
|
253
|
+
inheritedRoles: data.inherited_roles as InheritedRole[],
|
|
254
|
+
organization,
|
|
255
|
+
database: databaseName,
|
|
256
|
+
branch: branchName,
|
|
257
|
+
} satisfies PostgresDefaultRoleAttributes;
|
|
258
|
+
}),
|
|
259
|
+
|
|
260
|
+
delete: Effect.fn(function* ({ output }) {
|
|
261
|
+
// No delete endpoint — reset to invalidate existing credentials.
|
|
262
|
+
yield* resetDefault({
|
|
263
|
+
organization: output.organization,
|
|
264
|
+
database: output.database,
|
|
265
|
+
branch: output.branch,
|
|
266
|
+
}).pipe(Effect.catchTag("NotFound", () => Effect.void));
|
|
267
|
+
}),
|
|
268
|
+
};
|
|
269
|
+
}),
|
|
270
|
+
);
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import * as ops from "@distilled.cloud/planetscale/Operations";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
import * as Schedule from "effect/Schedule";
|
|
6
|
+
import { Client } from "pg";
|
|
7
|
+
import { listSqlFiles, readSqlFile, type SqlFile } from "../../Sql/SqlFile.ts";
|
|
8
|
+
|
|
9
|
+
const MIGRATION_ROLE_TTL_SECONDS = 600;
|
|
10
|
+
|
|
11
|
+
export class PostgresMigrationError extends Data.TaggedError(
|
|
12
|
+
"Planetscale::PostgresMigrationError",
|
|
13
|
+
)<{
|
|
14
|
+
message: string;
|
|
15
|
+
cause?: unknown;
|
|
16
|
+
}> {}
|
|
17
|
+
|
|
18
|
+
export interface PostgresMigrationTarget {
|
|
19
|
+
organization: string;
|
|
20
|
+
database: string;
|
|
21
|
+
branch: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const runPostgresMigrations = (
|
|
25
|
+
target: PostgresMigrationTarget,
|
|
26
|
+
migrationsDir: string,
|
|
27
|
+
migrationsTable: string,
|
|
28
|
+
) =>
|
|
29
|
+
Effect.gen(function* () {
|
|
30
|
+
const files = yield* listSqlFiles(migrationsDir);
|
|
31
|
+
if (files.length > 0) {
|
|
32
|
+
yield* applyPostgresMigrations({
|
|
33
|
+
target,
|
|
34
|
+
migrationsTable,
|
|
35
|
+
migrationsFiles: files,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const hashes: Record<string, string> = {};
|
|
39
|
+
for (const file of files) hashes[file.id] = file.hash;
|
|
40
|
+
return hashes;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const runPostgresImports = (
|
|
44
|
+
target: PostgresMigrationTarget,
|
|
45
|
+
importFiles: ReadonlyArray<string>,
|
|
46
|
+
rootDir: string,
|
|
47
|
+
previous: Record<string, string>,
|
|
48
|
+
) =>
|
|
49
|
+
Effect.gen(function* () {
|
|
50
|
+
const hashes: Record<string, string> = { ...previous };
|
|
51
|
+
for (const filePath of importFiles) {
|
|
52
|
+
const file = yield* readSqlFile(rootDir, filePath);
|
|
53
|
+
if (previous[filePath] === file.hash) {
|
|
54
|
+
hashes[filePath] = file.hash;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
yield* runPostgresSql(target, file.sql);
|
|
58
|
+
hashes[filePath] = file.hash;
|
|
59
|
+
}
|
|
60
|
+
const tracked = new Set(importFiles);
|
|
61
|
+
for (const key of Object.keys(hashes)) {
|
|
62
|
+
if (!tracked.has(key)) delete hashes[key];
|
|
63
|
+
}
|
|
64
|
+
return hashes;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
interface ApplyMigrationsOptions {
|
|
68
|
+
target: PostgresMigrationTarget;
|
|
69
|
+
migrationsTable: string;
|
|
70
|
+
migrationsFiles: ReadonlyArray<SqlFile>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const applyPostgresMigrations = (options: ApplyMigrationsOptions) =>
|
|
74
|
+
withPostgresClient(options.target, (client) =>
|
|
75
|
+
Effect.gen(function* () {
|
|
76
|
+
const table = quotePgIdentifier(options.migrationsTable);
|
|
77
|
+
yield* pgExec(
|
|
78
|
+
client,
|
|
79
|
+
`CREATE TABLE IF NOT EXISTS ${table} (
|
|
80
|
+
id TEXT PRIMARY KEY,
|
|
81
|
+
name TEXT NOT NULL,
|
|
82
|
+
applied_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
83
|
+
);`,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const applied = yield* pgRows<{ name: string }>(
|
|
87
|
+
client,
|
|
88
|
+
`SELECT name FROM ${table};`,
|
|
89
|
+
).pipe(Effect.map((rows) => new Set(rows.map((row) => row.name))));
|
|
90
|
+
let nextSeq = yield* getNextPgSeq(client, table);
|
|
91
|
+
|
|
92
|
+
for (const file of options.migrationsFiles) {
|
|
93
|
+
if (applied.has(file.id)) continue;
|
|
94
|
+
const migrationId = nextSeq.toString().padStart(5, "0");
|
|
95
|
+
nextSeq += 1;
|
|
96
|
+
yield* Effect.gen(function* () {
|
|
97
|
+
yield* pgExec(client, "BEGIN");
|
|
98
|
+
yield* pgExec(client, file.sql);
|
|
99
|
+
yield* pgExec(
|
|
100
|
+
client,
|
|
101
|
+
`INSERT INTO ${table} (id, name) VALUES ($1, $2);`,
|
|
102
|
+
[migrationId, file.id],
|
|
103
|
+
);
|
|
104
|
+
yield* pgExec(client, "COMMIT");
|
|
105
|
+
}).pipe(
|
|
106
|
+
Effect.catch((error) =>
|
|
107
|
+
pgExec(client, "ROLLBACK").pipe(
|
|
108
|
+
Effect.catch(() => Effect.void),
|
|
109
|
+
Effect.andThen(Effect.fail(error)),
|
|
110
|
+
),
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const runPostgresSql = (target: PostgresMigrationTarget, sql: string) =>
|
|
118
|
+
withPostgresClient(target, (client) => pgExec(client, sql));
|
|
119
|
+
|
|
120
|
+
const getNextPgSeq = (client: Client, table: string) =>
|
|
121
|
+
pgRows<{ id: string }>(client, `SELECT id FROM ${table};`).pipe(
|
|
122
|
+
Effect.map((rows) => {
|
|
123
|
+
let max = 0;
|
|
124
|
+
for (const { id } of rows) {
|
|
125
|
+
if (/^\d+$/.test(id)) {
|
|
126
|
+
max = Math.max(max, Number.parseInt(id, 10));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return max + 1;
|
|
130
|
+
}),
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const withPostgresClient = <A, E, R>(
|
|
134
|
+
target: PostgresMigrationTarget,
|
|
135
|
+
use: (client: Client) => Effect.Effect<A, E, R>,
|
|
136
|
+
) =>
|
|
137
|
+
withTemporaryPostgresRole(target, (role) =>
|
|
138
|
+
Effect.acquireUseRelease(
|
|
139
|
+
Effect.gen(function* () {
|
|
140
|
+
const client = yield* Effect.sync(
|
|
141
|
+
() =>
|
|
142
|
+
new Client({
|
|
143
|
+
connectionString: stripPgSslQueryParams(
|
|
144
|
+
Redacted.value(role.connectionUrl),
|
|
145
|
+
),
|
|
146
|
+
ssl: { rejectUnauthorized: true },
|
|
147
|
+
}),
|
|
148
|
+
);
|
|
149
|
+
yield* Effect.tryPromise({
|
|
150
|
+
try: () => client.connect(),
|
|
151
|
+
catch: toMigrationError,
|
|
152
|
+
});
|
|
153
|
+
return client;
|
|
154
|
+
}),
|
|
155
|
+
use,
|
|
156
|
+
(client) =>
|
|
157
|
+
Effect.tryPromise({
|
|
158
|
+
try: () => client.end(),
|
|
159
|
+
catch: toMigrationError,
|
|
160
|
+
}).pipe(Effect.catch(() => Effect.void)),
|
|
161
|
+
),
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const withTemporaryPostgresRole = <A, E, R>(
|
|
165
|
+
target: PostgresMigrationTarget,
|
|
166
|
+
use: (role: {
|
|
167
|
+
id: string;
|
|
168
|
+
connectionUrl: Redacted.Redacted<string>;
|
|
169
|
+
}) => Effect.Effect<A, E, R>,
|
|
170
|
+
) =>
|
|
171
|
+
Effect.acquireUseRelease(
|
|
172
|
+
Effect.gen(function* () {
|
|
173
|
+
const created = yield* ops.createRole({
|
|
174
|
+
organization: target.organization,
|
|
175
|
+
database: target.database,
|
|
176
|
+
branch: target.branch,
|
|
177
|
+
ttl: MIGRATION_ROLE_TTL_SECONDS,
|
|
178
|
+
inherited_roles: ["postgres"],
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const password = created.password!;
|
|
182
|
+
const value = Redacted.value(password);
|
|
183
|
+
const connectionUrl = yield* Effect.sync(
|
|
184
|
+
() =>
|
|
185
|
+
`postgresql://${encodeURIComponent(created.username)}:${encodeURIComponent(value)}@${created.access_host_url}:5432/${created.database_name}?sslmode=verify-full`,
|
|
186
|
+
);
|
|
187
|
+
return {
|
|
188
|
+
id: created.id,
|
|
189
|
+
connectionUrl: Redacted.make(connectionUrl),
|
|
190
|
+
};
|
|
191
|
+
}),
|
|
192
|
+
use,
|
|
193
|
+
(role) =>
|
|
194
|
+
ops
|
|
195
|
+
.deleteRole({
|
|
196
|
+
organization: target.organization,
|
|
197
|
+
database: target.database,
|
|
198
|
+
branch: target.branch,
|
|
199
|
+
id: role.id,
|
|
200
|
+
successor: "postgres",
|
|
201
|
+
})
|
|
202
|
+
.pipe(
|
|
203
|
+
// Already-deleted roles are a success: nothing to clean up.
|
|
204
|
+
Effect.catchTag("NotFound", () => Effect.void),
|
|
205
|
+
Effect.retry({
|
|
206
|
+
schedule: Schedule.exponential("500 millis").pipe(
|
|
207
|
+
Schedule.both(Schedule.recurs(5)),
|
|
208
|
+
),
|
|
209
|
+
}),
|
|
210
|
+
// Migrations succeeded; don't fail the parent over a release-step
|
|
211
|
+
// hiccup. The role's TTL bounds the orphan window; log loudly so
|
|
212
|
+
// an operator can clean it up manually if needed.
|
|
213
|
+
Effect.catch((cause: unknown) =>
|
|
214
|
+
Effect.logWarning(
|
|
215
|
+
`Failed to delete temporary Planetscale migration role after retries. ` +
|
|
216
|
+
`It will expire via TTL (~${MIGRATION_ROLE_TTL_SECONDS}s). ` +
|
|
217
|
+
`organization=${target.organization} database=${target.database} ` +
|
|
218
|
+
`branch=${target.branch} id=${role.id}`,
|
|
219
|
+
cause,
|
|
220
|
+
),
|
|
221
|
+
),
|
|
222
|
+
),
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
const pgExec = (client: Client, sql: string, values?: ReadonlyArray<unknown>) =>
|
|
226
|
+
Effect.tryPromise({
|
|
227
|
+
try: () =>
|
|
228
|
+
client.query(sql, values as Array<unknown>).then(() => undefined),
|
|
229
|
+
catch: toMigrationError,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const pgRows = <A>(client: Client, sql: string) =>
|
|
233
|
+
Effect.tryPromise({
|
|
234
|
+
try: () => client.query(sql).then((result) => result.rows as A[]),
|
|
235
|
+
catch: toMigrationError,
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
const toMigrationError = (cause: unknown) =>
|
|
239
|
+
new PostgresMigrationError({
|
|
240
|
+
message: cause instanceof Error ? cause.message : String(cause),
|
|
241
|
+
cause,
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const quotePgIdentifier = (identifier: string) =>
|
|
245
|
+
`"${identifier.replaceAll('"', '""')}"`;
|
|
246
|
+
|
|
247
|
+
const stripPgSslQueryParams = (uri: string): string => {
|
|
248
|
+
try {
|
|
249
|
+
const url = new URL(uri);
|
|
250
|
+
url.searchParams.delete("sslmode");
|
|
251
|
+
url.searchParams.delete("channel_binding");
|
|
252
|
+
return url.toString();
|
|
253
|
+
} catch {
|
|
254
|
+
return uri;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Redacted from "effect/Redacted";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape `Cloudflare.Hyperdrive` and other Postgres consumers accept as an
|
|
5
|
+
* origin. Materialized on `Planetscale.PostgresRole` so callers can wire role
|
|
6
|
+
* credentials into Hyperdrive directly.
|
|
7
|
+
*/
|
|
8
|
+
export type PostgresOrigin = {
|
|
9
|
+
scheme: "postgres" | "postgresql";
|
|
10
|
+
host: string;
|
|
11
|
+
port: number;
|
|
12
|
+
database: string;
|
|
13
|
+
user: string;
|
|
14
|
+
password: Redacted.Redacted<string>;
|
|
15
|
+
};
|