alchemy 2.0.0-beta.36 → 2.0.0-beta.38
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 +646 -104
- package/bin/exec.js.map +1 -1
- package/lib/AWS/AutoScaling/LaunchTemplate.d.ts +1 -1
- package/lib/AWS/CloudWatch/common.d.ts +1 -1
- package/lib/AWS/Credentials.d.ts.map +1 -1
- package/lib/AWS/Credentials.js +1 -2
- package/lib/AWS/Credentials.js.map +1 -1
- package/lib/AWS/DynamoDB/Stream.d.ts.map +1 -1
- package/lib/AWS/DynamoDB/Stream.js +1 -1
- package/lib/AWS/DynamoDB/Stream.js.map +1 -1
- package/lib/AWS/EC2/Instance.d.ts +1 -1
- package/lib/AWS/EC2/hosted.d.ts +1 -1
- package/lib/AWS/EC2/hosted.d.ts.map +1 -1
- package/lib/AWS/EC2/hosted.js +3 -5
- package/lib/AWS/EC2/hosted.js.map +1 -1
- package/lib/AWS/ECS/Task.d.ts +1 -1
- package/lib/AWS/ECS/Task.d.ts.map +1 -1
- package/lib/AWS/ECS/Task.js +3 -5
- package/lib/AWS/ECS/Task.js.map +1 -1
- package/lib/AWS/Endpoint.d.ts.map +1 -1
- package/lib/AWS/Endpoint.js +1 -2
- package/lib/AWS/Endpoint.js.map +1 -1
- package/lib/AWS/Environment.d.ts +2 -2
- package/lib/AWS/EventBridge/EventSource.d.ts.map +1 -1
- package/lib/AWS/EventBridge/EventSource.js +1 -1
- package/lib/AWS/EventBridge/EventSource.js.map +1 -1
- package/lib/AWS/Kinesis/StreamEventSource.d.ts.map +1 -1
- package/lib/AWS/Kinesis/StreamEventSource.js +1 -1
- package/lib/AWS/Kinesis/StreamEventSource.js.map +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/Function.d.ts +1 -1
- package/lib/AWS/Lambda/Function.d.ts.map +1 -1
- package/lib/AWS/Lambda/Function.js +29 -13
- package/lib/AWS/Lambda/Function.js.map +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts +1 -1
- package/lib/AWS/Organizations/common.d.ts +1 -1
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +21 -3
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/AWS/Region.d.ts +1 -1
- package/lib/AWS/Region.d.ts.map +1 -1
- package/lib/AWS/Region.js +2 -3
- package/lib/AWS/Region.js.map +1 -1
- package/lib/AWS/S3/Bucket.d.ts.map +1 -1
- package/lib/AWS/S3/Bucket.js +5 -2
- package/lib/AWS/S3/Bucket.js.map +1 -1
- package/lib/AWS/S3/BucketNotifications.d.ts.map +1 -1
- package/lib/AWS/S3/BucketNotifications.js +1 -1
- package/lib/AWS/S3/BucketNotifications.js.map +1 -1
- package/lib/AWS/SNS/TopicEventSource.d.ts.map +1 -1
- package/lib/AWS/SNS/TopicEventSource.js +1 -1
- package/lib/AWS/SNS/TopicEventSource.js.map +1 -1
- package/lib/AWS/SQS/Queue.d.ts.map +1 -1
- package/lib/AWS/SQS/Queue.js +23 -5
- package/lib/AWS/SQS/Queue.js.map +1 -1
- package/lib/Action.d.ts +77 -0
- package/lib/Action.d.ts.map +1 -0
- package/lib/Action.js +89 -0
- package/lib/Action.js.map +1 -0
- package/lib/AlchemyContext.d.ts +1 -1
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +228 -4
- package/lib/Apply.js.map +1 -1
- package/lib/Artifacts.d.ts +1 -1
- package/lib/Artifacts.d.ts.map +1 -1
- package/lib/Artifacts.js +1 -1
- package/lib/Artifacts.js.map +1 -1
- package/lib/Auth/AuthProvider.js +1 -1
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/Env.d.ts.map +1 -1
- package/lib/Auth/Env.js +4 -12
- package/lib/Auth/Env.js.map +1 -1
- package/lib/Binding.d.ts.map +1 -1
- package/lib/Binding.js +5 -5
- package/lib/Binding.js.map +1 -1
- package/lib/Build/Command.d.ts +1 -1
- package/lib/Build/Memo.d.ts +1 -1
- package/lib/Bundle/Docker.d.ts +3 -3
- package/lib/Bundle/Docker.js +1 -1
- package/lib/Bundle/Docker.js.map +1 -1
- package/lib/Bundle/TempRoot.d.ts +3 -3
- package/lib/Cli/Event.d.ts +1 -1
- package/lib/Cli/Event.d.ts.map +1 -1
- package/lib/Cli/NamespaceTree.d.ts +11 -5
- package/lib/Cli/NamespaceTree.d.ts.map +1 -1
- package/lib/Cli/NamespaceTree.js +28 -1
- package/lib/Cli/NamespaceTree.js.map +1 -1
- package/lib/Cli/commands/_shared.d.ts +1 -1
- package/lib/Cli/commands/_shared.js +2 -2
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/aws.d.ts +1 -1
- package/lib/Cli/commands/cloudflare.d.ts +2 -2
- package/lib/Cli/commands/cloudflare.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.d.ts +9 -9
- package/lib/Cli/commands/deploy.js +1 -1
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cli/commands/login.d.ts +1 -1
- package/lib/Cli/commands/logs.d.ts +1 -1
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/profile.d.ts +1 -3
- package/lib/Cli/commands/profile.d.ts.map +1 -1
- package/lib/Cli/commands/state.d.ts +1 -1
- package/lib/Cli/commands/state.d.ts.map +1 -1
- package/lib/Cli/commands/tail.d.ts +1 -1
- package/lib/Cli/commands/tail.js.map +1 -1
- package/lib/Cli/tui/components/Plan.d.ts.map +1 -1
- package/lib/Cli/tui/components/Plan.js +27 -13
- package/lib/Cli/tui/components/Plan.js.map +1 -1
- package/lib/Cli/tui/components/PlanProgress.d.ts +8 -1
- package/lib/Cli/tui/components/PlanProgress.d.ts.map +1 -1
- package/lib/Cli/tui/components/PlanProgress.js +95 -16
- package/lib/Cli/tui/components/PlanProgress.js.map +1 -1
- package/lib/Cloudflare/Access.js +0 -1
- package/lib/Cloudflare/Access.js.map +1 -1
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.d.ts +54 -0
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.d.ts.map +1 -0
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.js +17 -0
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.js.map +1 -0
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.d.ts +37 -0
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.d.ts.map +1 -0
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.js +45 -0
- package/lib/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.js.map +1 -0
- package/lib/Cloudflare/AnalyticsEngine/index.d.ts +3 -0
- package/lib/Cloudflare/AnalyticsEngine/index.d.ts.map +1 -0
- package/lib/Cloudflare/AnalyticsEngine/index.js +3 -0
- package/lib/Cloudflare/AnalyticsEngine/index.js.map +1 -0
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.js +1 -1
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.js.map +1 -1
- package/lib/Cloudflare/CloudflareEnvironment.d.ts +1 -1
- package/lib/Cloudflare/Container/Container.js +0 -1
- package/lib/Cloudflare/Container/Container.js.map +1 -1
- package/lib/Cloudflare/Container/ContainerApplication.d.ts +1 -1
- package/lib/Cloudflare/Container/ContainerApplication.d.ts.map +1 -1
- package/lib/Cloudflare/Container/ContainerApplication.js +4 -6
- package/lib/Cloudflare/Container/ContainerApplication.js.map +1 -1
- package/lib/Cloudflare/Container/ContainerBinding.js +2 -2
- package/lib/Cloudflare/Container/ContainerBinding.js.map +1 -1
- package/lib/Cloudflare/D1/D1Connection.d.ts +47 -3
- package/lib/Cloudflare/D1/D1Connection.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Connection.js +62 -5
- package/lib/Cloudflare/D1/D1Connection.js.map +1 -1
- package/lib/Cloudflare/D1/D1Database.d.ts +1 -1
- package/lib/Cloudflare/D1/D1SqlFile.d.ts +2 -2
- package/lib/Cloudflare/Email/EmailAddress.d.ts +45 -0
- package/lib/Cloudflare/Email/EmailAddress.d.ts.map +1 -0
- package/lib/Cloudflare/Email/EmailAddress.js +99 -0
- package/lib/Cloudflare/Email/EmailAddress.js.map +1 -0
- package/lib/Cloudflare/Email/EmailRouting.d.ts +42 -0
- package/lib/Cloudflare/Email/EmailRouting.d.ts.map +1 -0
- package/lib/Cloudflare/Email/EmailRouting.js +89 -0
- package/lib/Cloudflare/Email/EmailRouting.js.map +1 -0
- package/lib/Cloudflare/Email/EmailRule.d.ts +80 -0
- package/lib/Cloudflare/Email/EmailRule.d.ts.map +1 -0
- package/lib/Cloudflare/Email/EmailRule.js +110 -0
- package/lib/Cloudflare/Email/EmailRule.js.map +1 -0
- package/lib/Cloudflare/Email/SendEmail.d.ts +74 -0
- package/lib/Cloudflare/Email/SendEmail.d.ts.map +1 -0
- package/lib/Cloudflare/Email/SendEmail.js +19 -0
- package/lib/Cloudflare/Email/SendEmail.js.map +1 -0
- package/lib/Cloudflare/Email/SendEmailBinding.d.ts +64 -0
- package/lib/Cloudflare/Email/SendEmailBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Email/SendEmailBinding.js +54 -0
- package/lib/Cloudflare/Email/SendEmailBinding.js.map +1 -0
- package/lib/Cloudflare/Email/index.d.ts +6 -0
- package/lib/Cloudflare/Email/index.d.ts.map +1 -0
- package/lib/Cloudflare/Email/index.js +6 -0
- package/lib/Cloudflare/Email/index.js.map +1 -0
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.d.ts +1 -1
- package/lib/Cloudflare/Images/ImagesBinding.js +1 -1
- package/lib/Cloudflare/Images/ImagesBinding.js.map +1 -1
- package/lib/Cloudflare/KV/KVNamespaceBinding.js +1 -1
- package/lib/Cloudflare/KV/KVNamespaceBinding.js.map +1 -1
- package/lib/Cloudflare/Local/Sidecar.d.ts +1 -1
- package/lib/Cloudflare/Local/SidecarHandlers.d.ts +1 -1
- package/lib/Cloudflare/Local/SidecarHandlers.js +9 -1
- package/lib/Cloudflare/Local/SidecarHandlers.js.map +1 -1
- package/lib/Cloudflare/Local/SidecarServer.js +1 -1
- package/lib/Cloudflare/Local/SidecarServer.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +9 -1
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueBinding.js +1 -1
- package/lib/Cloudflare/Queue/QueueBinding.js.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +16 -0
- package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
- package/lib/Cloudflare/R2/R2BucketBinding.js +1 -1
- package/lib/Cloudflare/R2/R2BucketBinding.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretBinding.js +1 -1
- package/lib/Cloudflare/SecretsStore/SecretBinding.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +7 -2
- package/lib/Cloudflare/StateStore/Api.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Api.js +23 -1
- package/lib/Cloudflare/StateStore/Api.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts +2 -2
- package/lib/Cloudflare/StateStore/Store.d.ts +16 -1
- package/lib/Cloudflare/StateStore/Store.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Store.js +22 -5
- package/lib/Cloudflare/StateStore/Store.js.map +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts +2 -2
- package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Assets.js +5 -4
- package/lib/Cloudflare/Workers/Assets.js.map +1 -1
- package/lib/Cloudflare/Workers/CronEventSource.d.ts +35 -0
- package/lib/Cloudflare/Workers/CronEventSource.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/CronEventSource.js +55 -0
- package/lib/Cloudflare/Workers/CronEventSource.js.map +1 -0
- package/lib/Cloudflare/Workers/InferEnv.d.ts +37 -2
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +2 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/Rpc.d.ts +76 -3
- package/lib/Cloudflare/Workers/Rpc.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Rpc.js +197 -13
- package/lib/Cloudflare/Workers/Rpc.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +24 -4
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +187 -45
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js +19 -11
- package/lib/Cloudflare/Workers/WorkerBundle.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerName.d.ts +1 -1
- package/lib/Cloudflare/Workers/Workflow.d.ts +50 -47
- package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.js +43 -37
- package/lib/Cloudflare/Workers/Workflow.js.map +1 -1
- package/lib/Cloudflare/Workers/index.d.ts +1 -0
- package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/index.js +1 -0
- package/lib/Cloudflare/Workers/index.js.map +1 -1
- package/lib/Cloudflare/index.d.ts +2 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +2 -0
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Construct.d.ts +3 -3
- package/lib/Construct.d.ts.map +1 -1
- package/lib/Construct.js.map +1 -1
- package/lib/Deploy.d.ts +5 -2
- package/lib/Deploy.d.ts.map +1 -1
- package/lib/Deploy.js +2 -2
- package/lib/Deploy.js.map +1 -1
- package/lib/Destroy.d.ts +5 -2
- package/lib/Destroy.d.ts.map +1 -1
- package/lib/Destroy.js +3 -2
- package/lib/Destroy.js.map +1 -1
- package/lib/Drizzle/Providers.d.ts +1 -1
- package/lib/Drizzle/Schema.d.ts +1 -1
- package/lib/GitHub/Providers.d.ts +1 -1
- package/lib/Http.d.ts +1 -1
- package/lib/Http.d.ts.map +1 -1
- package/lib/Http.js +1 -1
- package/lib/Http.js.map +1 -1
- package/lib/Namespace.d.ts.map +1 -1
- package/lib/Namespace.js +3 -4
- package/lib/Namespace.js.map +1 -1
- package/lib/Neon/Branch.d.ts +2 -2
- package/lib/Neon/Branch.d.ts.map +1 -1
- package/lib/Neon/Branch.js +59 -27
- package/lib/Neon/Branch.js.map +1 -1
- package/lib/Neon/Credentials.d.ts +2 -2
- package/lib/Neon/Credentials.d.ts.map +1 -1
- package/lib/Neon/Credentials.js +2 -2
- package/lib/Neon/Credentials.js.map +1 -1
- package/lib/Neon/NeonEnvironment.d.ts +1 -1
- package/lib/Neon/Project.d.ts +25 -1
- package/lib/Neon/Project.d.ts.map +1 -1
- package/lib/Neon/Project.js +121 -42
- package/lib/Neon/Project.js.map +1 -1
- package/lib/Neon/Providers.d.ts +1 -1
- package/lib/Neon/SqlFile.d.ts +2 -2
- package/lib/Output.d.ts +47 -8
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +106 -7
- package/lib/Output.js.map +1 -1
- package/lib/PhysicalName.d.ts +1 -1
- package/lib/Plan.d.ts +36 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +284 -37
- package/lib/Plan.js.map +1 -1
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +22 -9
- package/lib/Platform.js.map +1 -1
- package/lib/Provider.d.ts +1 -1
- package/lib/Provider.d.ts.map +1 -1
- package/lib/Provider.js +1 -1
- package/lib/Provider.js.map +1 -1
- package/lib/Random.d.ts +1 -1
- package/lib/Random.d.ts.map +1 -1
- package/lib/Random.js +1 -1
- package/lib/Random.js.map +1 -1
- package/lib/Ref.d.ts +4 -1
- package/lib/Ref.d.ts.map +1 -1
- package/lib/Ref.js +1 -1
- package/lib/Ref.js.map +1 -1
- package/lib/Resource.d.ts +8 -0
- package/lib/Resource.d.ts.map +1 -1
- package/lib/Resource.js +12 -25
- package/lib/Resource.js.map +1 -1
- package/lib/Runtime.d.ts +24 -0
- package/lib/Runtime.d.ts.map +1 -0
- package/lib/Runtime.js +31 -0
- package/lib/Runtime.js.map +1 -0
- package/lib/RuntimeContext.d.ts +3 -1
- package/lib/RuntimeContext.d.ts.map +1 -1
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Secret.d.ts +50 -0
- package/lib/Secret.d.ts.map +1 -0
- package/lib/Secret.js +23 -0
- package/lib/Secret.js.map +1 -0
- package/lib/Serverless/Function.d.ts +9 -1
- package/lib/Serverless/Function.d.ts.map +1 -1
- package/lib/Sidecar/RpcClient.d.ts +1 -1
- package/lib/Sidecar/RpcPaths.d.ts +1 -1
- package/lib/Sidecar/RpcServer.d.ts +1 -1
- package/lib/Sidecar/RpcServices.d.ts +1 -1
- package/lib/Stack.d.ts +20 -6
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +35 -23
- package/lib/Stack.js.map +1 -1
- package/lib/State/ActionState.d.ts +48 -0
- package/lib/State/ActionState.d.ts.map +1 -0
- package/lib/State/ActionState.js +1 -0
- package/lib/State/ActionState.js.map +1 -0
- package/lib/State/HttpStateApi.d.ts +15 -1
- package/lib/State/HttpStateApi.d.ts.map +1 -1
- package/lib/State/HttpStateApi.js +11 -0
- package/lib/State/HttpStateApi.js.map +1 -1
- package/lib/State/HttpStateStore.d.ts.map +1 -1
- package/lib/State/HttpStateStore.js +12 -1
- package/lib/State/HttpStateStore.js.map +1 -1
- package/lib/State/InMemoryState.d.ts +2 -2
- package/lib/State/InMemoryState.d.ts.map +1 -1
- package/lib/State/InMemoryState.js +12 -6
- package/lib/State/InMemoryState.js.map +1 -1
- package/lib/State/LocalState.d.ts +2 -2
- package/lib/State/LocalState.d.ts.map +1 -1
- package/lib/State/LocalState.js +11 -2
- package/lib/State/LocalState.js.map +1 -1
- package/lib/State/ResourceState.d.ts +5 -0
- package/lib/State/ResourceState.d.ts.map +1 -1
- package/lib/State/State.d.ts +31 -2
- package/lib/State/State.d.ts.map +1 -1
- package/lib/State/State.js +2 -0
- package/lib/State/State.js.map +1 -1
- package/lib/State/index.d.ts +1 -0
- package/lib/State/index.d.ts.map +1 -1
- package/lib/State/index.js +1 -0
- package/lib/State/index.js.map +1 -1
- package/lib/Test/Bun.d.ts.map +1 -1
- package/lib/Test/Bun.js +30 -7
- package/lib/Test/Bun.js.map +1 -1
- package/lib/Test/Core.d.ts +19 -4
- package/lib/Test/Core.d.ts.map +1 -1
- package/lib/Test/Core.js +33 -12
- package/lib/Test/Core.js.map +1 -1
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +24 -5
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/Util/FileLogger.d.ts +1 -1
- package/lib/Util/LocalhostDns.d.ts +14 -10
- package/lib/Util/LocalhostDns.d.ts.map +1 -1
- package/lib/Util/LocalhostDns.js +27 -36
- package/lib/Util/LocalhostDns.js.map +1 -1
- package/lib/Util/effect.d.ts +7 -0
- package/lib/Util/effect.d.ts.map +1 -1
- package/lib/Util/effect.js +10 -4
- package/lib/Util/effect.js.map +1 -1
- package/lib/Util/exec.d.ts.map +1 -0
- package/lib/Util/exec.js.map +1 -0
- package/lib/Util/hash.d.ts +8 -0
- package/lib/Util/hash.d.ts.map +1 -0
- package/lib/Util/hash.js +11 -0
- package/lib/Util/hash.js.map +1 -0
- package/lib/Util/ignore.d.ts +40 -0
- package/lib/Util/ignore.d.ts.map +1 -0
- package/lib/Util/ignore.js +591 -0
- package/lib/Util/ignore.js.map +1 -0
- package/lib/Variable.d.ts +29 -0
- package/lib/Variable.d.ts.map +1 -0
- package/lib/Variable.js +9 -0
- package/lib/Variable.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +22 -29
- package/src/AWS/Credentials.ts +1 -2
- package/src/AWS/DynamoDB/Stream.ts +1 -4
- package/src/AWS/EC2/hosted.ts +14 -16
- package/src/AWS/ECS/Task.ts +14 -16
- package/src/AWS/Endpoint.ts +2 -5
- package/src/AWS/EventBridge/EventSource.ts +1 -4
- package/src/AWS/Kinesis/StreamEventSource.ts +1 -4
- package/src/AWS/Lambda/Function.ts +47 -23
- package/src/AWS/Providers.ts +22 -3
- package/src/AWS/Region.ts +2 -3
- package/src/AWS/S3/Bucket.ts +7 -2
- package/src/AWS/S3/BucketNotifications.ts +1 -4
- package/src/AWS/SNS/TopicEventSource.ts +1 -4
- package/src/AWS/SQS/Queue.ts +40 -6
- package/src/Action.ts +280 -0
- package/src/Apply.ts +359 -24
- package/src/Artifacts.ts +2 -4
- package/src/Auth/AuthProvider.ts +1 -1
- package/src/Auth/Env.ts +12 -20
- package/src/Binding.ts +5 -9
- package/src/Bundle/Docker.ts +1 -1
- package/src/Cli/Event.ts +4 -0
- package/src/Cli/NamespaceTree.ts +52 -5
- package/src/Cli/commands/_shared.ts +2 -2
- package/src/Cli/commands/deploy.ts +1 -1
- package/src/Cli/commands/logs.ts +4 -4
- package/src/Cli/commands/tail.ts +4 -4
- package/src/Cli/tui/components/Plan.tsx +65 -17
- package/src/Cli/tui/components/PlanProgress.tsx +142 -32
- package/src/Cloudflare/Access.ts +1 -1
- package/src/Cloudflare/AnalyticsEngine/AnalyticsEngineDataset.ts +82 -0
- package/src/Cloudflare/AnalyticsEngine/AnalyticsEngineDatasetBinding.ts +106 -0
- package/src/Cloudflare/AnalyticsEngine/index.ts +2 -0
- package/src/Cloudflare/Artifacts/ArtifactsBinding.ts +1 -1
- package/src/Cloudflare/Container/Container.ts +1 -1
- package/src/Cloudflare/Container/ContainerApplication.ts +4 -6
- package/src/Cloudflare/Container/ContainerBinding.ts +2 -2
- package/src/Cloudflare/D1/D1Connection.ts +95 -12
- package/src/Cloudflare/Email/EmailAddress.ts +155 -0
- package/src/Cloudflare/Email/EmailRouting.ts +138 -0
- package/src/Cloudflare/Email/EmailRule.ts +210 -0
- package/src/Cloudflare/Email/SendEmail.ts +95 -0
- package/src/Cloudflare/Email/SendEmailBinding.ts +124 -0
- package/src/Cloudflare/Email/index.ts +5 -0
- package/src/Cloudflare/Images/ImagesBinding.ts +1 -1
- package/src/Cloudflare/KV/KVNamespaceBinding.ts +1 -1
- package/src/Cloudflare/Local/SidecarHandlers.ts +9 -1
- package/src/Cloudflare/Local/SidecarServer.ts +1 -1
- package/src/Cloudflare/Providers.ts +14 -0
- package/src/Cloudflare/Queue/QueueBinding.ts +1 -1
- package/src/Cloudflare/R2/R2Bucket.ts +31 -0
- package/src/Cloudflare/R2/R2BucketBinding.ts +1 -1
- package/src/Cloudflare/SecretsStore/SecretBinding.ts +1 -1
- package/src/Cloudflare/StateStore/Api.ts +34 -1
- package/src/Cloudflare/StateStore/Store.ts +40 -10
- package/src/Cloudflare/Workers/Assets.ts +5 -6
- package/src/Cloudflare/Workers/CronEventSource.ts +89 -0
- package/src/Cloudflare/Workers/InferEnv.ts +94 -20
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +9 -1
- package/src/Cloudflare/Workers/Rpc.ts +227 -18
- package/src/Cloudflare/Workers/Worker.ts +294 -65
- package/src/Cloudflare/Workers/WorkerBundle.ts +19 -11
- package/src/Cloudflare/Workers/Workflow.ts +76 -72
- package/src/Cloudflare/Workers/index.ts +1 -0
- package/src/Cloudflare/index.ts +2 -0
- package/src/Construct.ts +3 -7
- package/src/Deploy.ts +5 -1
- package/src/Destroy.ts +6 -1
- package/src/Http.ts +1 -1
- package/src/Namespace.ts +4 -4
- package/src/Neon/Branch.ts +93 -59
- package/src/Neon/Credentials.ts +2 -2
- package/src/Neon/Project.ts +193 -64
- package/src/Output.ts +129 -18
- package/src/Plan.ts +375 -36
- package/src/Platform.ts +26 -11
- package/src/Provider.ts +8 -3
- package/src/Random.ts +1 -1
- package/src/Ref.ts +10 -5
- package/src/Resource.ts +24 -25
- package/src/Runtime.ts +38 -0
- package/src/RuntimeContext.ts +1 -0
- package/src/Secret.ts +87 -0
- package/src/Serverless/Function.ts +10 -1
- package/src/Stack.ts +62 -35
- package/src/State/ActionState.ts +51 -0
- package/src/State/HttpStateApi.ts +21 -0
- package/src/State/HttpStateStore.ts +27 -2
- package/src/State/InMemoryState.ts +31 -10
- package/src/State/LocalState.ts +28 -4
- package/src/State/ResourceState.ts +5 -0
- package/src/State/State.ts +38 -2
- package/src/State/index.ts +1 -0
- package/src/Test/Bun.ts +43 -7
- package/src/Test/Core.ts +33 -11
- package/src/Test/Vitest.ts +33 -4
- package/src/Util/LocalhostDns.ts +30 -36
- package/src/Util/effect.ts +29 -4
- package/src/Util/hash.ts +14 -0
- package/src/Util/ignore.ts +815 -0
- package/src/Variable.ts +44 -0
- package/src/index.ts +9 -0
- package/lib/Agent/Agent.d.ts +0 -9
- package/lib/Agent/Agent.d.ts.map +0 -1
- package/lib/Agent/Agent.js +0 -10
- package/lib/Agent/Agent.js.map +0 -1
- package/lib/Agent/Aspect.d.ts +0 -51
- package/lib/Agent/Aspect.d.ts.map +0 -1
- package/lib/Agent/Aspect.js +0 -45
- package/lib/Agent/Aspect.js.map +0 -1
- package/lib/Agent/AspectGraph.d.ts +0 -45
- package/lib/Agent/AspectGraph.d.ts.map +0 -1
- package/lib/Agent/AspectGraph.js +0 -39
- package/lib/Agent/AspectGraph.js.map +0 -1
- package/lib/Agent/ContextPlugin.d.ts +0 -8
- package/lib/Agent/ContextPlugin.d.ts.map +0 -1
- package/lib/Agent/ContextPlugin.js +0 -3
- package/lib/Agent/ContextPlugin.js.map +0 -1
- package/lib/Agent/Plugin.d.ts +0 -18
- package/lib/Agent/Plugin.d.ts.map +0 -1
- package/lib/Agent/Plugin.js +0 -8
- package/lib/Agent/Plugin.js.map +0 -1
- package/lib/Agent/chat/channel.d.ts +0 -9
- package/lib/Agent/chat/channel.d.ts.map +0 -1
- package/lib/Agent/chat/channel.js +0 -10
- package/lib/Agent/chat/channel.js.map +0 -1
- package/lib/Agent/chat/event.d.ts +0 -32
- package/lib/Agent/chat/event.d.ts.map +0 -1
- package/lib/Agent/chat/event.js +0 -32
- package/lib/Agent/chat/event.js.map +0 -1
- package/lib/Agent/chat/message.d.ts +0 -22
- package/lib/Agent/chat/message.d.ts.map +0 -1
- package/lib/Agent/chat/message.js +0 -31
- package/lib/Agent/chat/message.js.map +0 -1
- package/lib/Agent/chat/service.d.ts +0 -102
- package/lib/Agent/chat/service.d.ts.map +0 -1
- package/lib/Agent/chat/service.js +0 -79
- package/lib/Agent/chat/service.js.map +0 -1
- package/lib/Agent/chat/thread.d.ts +0 -13
- package/lib/Agent/chat/thread.d.ts.map +0 -1
- package/lib/Agent/chat/thread.js +0 -16
- package/lib/Agent/chat/thread.js.map +0 -1
- package/lib/Agent/coding/bash.d.ts +0 -36
- package/lib/Agent/coding/bash.d.ts.map +0 -1
- package/lib/Agent/coding/bash.js +0 -170
- package/lib/Agent/coding/bash.js.map +0 -1
- package/lib/Agent/coding/edit.d.ts +0 -31
- package/lib/Agent/coding/edit.d.ts.map +0 -1
- package/lib/Agent/coding/edit.js +0 -90
- package/lib/Agent/coding/edit.js.map +0 -1
- package/lib/Agent/coding/glob.d.ts +0 -23
- package/lib/Agent/coding/glob.d.ts.map +0 -1
- package/lib/Agent/coding/glob.js +0 -78
- package/lib/Agent/coding/glob.js.map +0 -1
- package/lib/Agent/coding/grep.d.ts +0 -26
- package/lib/Agent/coding/grep.d.ts.map +0 -1
- package/lib/Agent/coding/grep.js +0 -105
- package/lib/Agent/coding/grep.js.map +0 -1
- package/lib/Agent/coding/index.d.ts +0 -8
- package/lib/Agent/coding/index.d.ts.map +0 -1
- package/lib/Agent/coding/index.js +0 -8
- package/lib/Agent/coding/index.js.map +0 -1
- package/lib/Agent/coding/read.d.ts +0 -27
- package/lib/Agent/coding/read.d.ts.map +0 -1
- package/lib/Agent/coding/read.js +0 -89
- package/lib/Agent/coding/read.js.map +0 -1
- package/lib/Agent/coding/readlints.d.ts +0 -19
- package/lib/Agent/coding/readlints.d.ts.map +0 -1
- package/lib/Agent/coding/readlints.js +0 -53
- package/lib/Agent/coding/readlints.js.map +0 -1
- package/lib/Agent/coding/write.d.ts +0 -22
- package/lib/Agent/coding/write.d.ts.map +0 -1
- package/lib/Agent/coding/write.js +0 -53
- package/lib/Agent/coding/write.js.map +0 -1
- package/lib/Agent/fs/file.d.ts +0 -12
- package/lib/Agent/fs/file.d.ts.map +0 -1
- package/lib/Agent/fs/file.js +0 -8
- package/lib/Agent/fs/file.js.map +0 -1
- package/lib/Agent/fs/folder.d.ts +0 -5
- package/lib/Agent/fs/folder.d.ts.map +0 -1
- package/lib/Agent/fs/folder.js +0 -3
- package/lib/Agent/fs/folder.js.map +0 -1
- package/lib/Agent/index.d.ts +0 -9
- package/lib/Agent/index.d.ts.map +0 -1
- package/lib/Agent/index.js +0 -9
- package/lib/Agent/index.js.map +0 -1
- package/lib/Agent/llm/error.d.ts +0 -208
- package/lib/Agent/llm/error.d.ts.map +0 -1
- package/lib/Agent/llm/error.js +0 -209
- package/lib/Agent/llm/error.js.map +0 -1
- package/lib/Agent/llm/index.d.ts +0 -5
- package/lib/Agent/llm/index.d.ts.map +0 -1
- package/lib/Agent/llm/index.js +0 -5
- package/lib/Agent/llm/index.js.map +0 -1
- package/lib/Agent/llm/llm.d.ts +0 -32
- package/lib/Agent/llm/llm.d.ts.map +0 -1
- package/lib/Agent/llm/llm.js +0 -74
- package/lib/Agent/llm/llm.js.map +0 -1
- package/lib/Agent/llm/stream-collectors.d.ts +0 -46
- package/lib/Agent/llm/stream-collectors.d.ts.map +0 -1
- package/lib/Agent/llm/stream-collectors.js +0 -33
- package/lib/Agent/llm/stream-collectors.js.map +0 -1
- package/lib/Agent/llm/stream-text-part.d.ts +0 -5
- package/lib/Agent/llm/stream-text-part.d.ts.map +0 -1
- package/lib/Agent/llm/stream-text-part.js +0 -4
- package/lib/Agent/llm/stream-text-part.js.map +0 -1
- package/lib/Agent/lsp/client.d.ts +0 -122
- package/lib/Agent/lsp/client.d.ts.map +0 -1
- package/lib/Agent/lsp/client.js +0 -180
- package/lib/Agent/lsp/client.js.map +0 -1
- package/lib/Agent/lsp/diagnostics.d.ts +0 -16
- package/lib/Agent/lsp/diagnostics.d.ts.map +0 -1
- package/lib/Agent/lsp/diagnostics.js +0 -48
- package/lib/Agent/lsp/diagnostics.js.map +0 -1
- package/lib/Agent/lsp/jsonrpc.d.ts +0 -90
- package/lib/Agent/lsp/jsonrpc.d.ts.map +0 -1
- package/lib/Agent/lsp/jsonrpc.js +0 -178
- package/lib/Agent/lsp/jsonrpc.js.map +0 -1
- package/lib/Agent/lsp/manager.d.ts +0 -38
- package/lib/Agent/lsp/manager.d.ts.map +0 -1
- package/lib/Agent/lsp/manager.js +0 -98
- package/lib/Agent/lsp/manager.js.map +0 -1
- package/lib/Agent/lsp/servers.d.ts +0 -28
- package/lib/Agent/lsp/servers.d.ts.map +0 -1
- package/lib/Agent/lsp/servers.js +0 -21
- package/lib/Agent/lsp/servers.js.map +0 -1
- package/lib/Agent/process/driver.d.ts +0 -10
- package/lib/Agent/process/driver.d.ts.map +0 -1
- package/lib/Agent/process/driver.js +0 -153
- package/lib/Agent/process/driver.js.map +0 -1
- package/lib/Agent/process/issue-service.d.ts +0 -44
- package/lib/Agent/process/issue-service.d.ts.map +0 -1
- package/lib/Agent/process/issue-service.js +0 -28
- package/lib/Agent/process/issue-service.js.map +0 -1
- package/lib/Agent/process/issue-tools.d.ts +0 -28
- package/lib/Agent/process/issue-tools.d.ts.map +0 -1
- package/lib/Agent/process/issue-tools.js +0 -28
- package/lib/Agent/process/issue-tools.js.map +0 -1
- package/lib/Agent/process/issue.d.ts +0 -16
- package/lib/Agent/process/issue.d.ts.map +0 -1
- package/lib/Agent/process/issue.js +0 -17
- package/lib/Agent/process/issue.js.map +0 -1
- package/lib/Agent/process/organization.d.ts +0 -4
- package/lib/Agent/process/organization.d.ts.map +0 -1
- package/lib/Agent/process/organization.js +0 -3
- package/lib/Agent/process/organization.js.map +0 -1
- package/lib/Agent/process/process.d.ts +0 -5
- package/lib/Agent/process/process.d.ts.map +0 -1
- package/lib/Agent/process/process.js +0 -3
- package/lib/Agent/process/process.js.map +0 -1
- package/lib/Agent/process/reply.d.ts +0 -16
- package/lib/Agent/process/reply.d.ts.map +0 -1
- package/lib/Agent/process/reply.js +0 -18
- package/lib/Agent/process/reply.js.map +0 -1
- package/lib/Agent/process/task.d.ts +0 -25
- package/lib/Agent/process/task.d.ts.map +0 -1
- package/lib/Agent/process/task.js +0 -26
- package/lib/Agent/process/task.js.map +0 -1
- package/lib/Agent/tool/index.d.ts +0 -4
- package/lib/Agent/tool/index.d.ts.map +0 -1
- package/lib/Agent/tool/index.js +0 -4
- package/lib/Agent/tool/index.js.map +0 -1
- package/lib/Agent/tool/parameter.d.ts +0 -12
- package/lib/Agent/tool/parameter.d.ts.map +0 -1
- package/lib/Agent/tool/parameter.js +0 -6
- package/lib/Agent/tool/parameter.js.map +0 -1
- package/lib/Agent/tool/result.d.ts +0 -17
- package/lib/Agent/tool/result.d.ts.map +0 -1
- package/lib/Agent/tool/result.js +0 -6
- package/lib/Agent/tool/result.js.map +0 -1
- package/lib/Agent/tool/tool.d.ts +0 -32
- package/lib/Agent/tool/tool.d.ts.map +0 -1
- package/lib/Agent/tool/tool.js +0 -16
- package/lib/Agent/tool/tool.js.map +0 -1
- package/lib/Agent/util/command-validator.d.ts +0 -12
- package/lib/Agent/util/command-validator.d.ts.map +0 -1
- package/lib/Agent/util/command-validator.js +0 -74
- package/lib/Agent/util/command-validator.js.map +0 -1
- package/lib/Agent/util/exec.d.ts.map +0 -1
- package/lib/Agent/util/exec.js.map +0 -1
- package/lib/Agent/util/parser.d.ts +0 -5
- package/lib/Agent/util/parser.d.ts.map +0 -1
- package/lib/Agent/util/parser.js +0 -41
- package/lib/Agent/util/parser.js.map +0 -1
- package/lib/Agent/util/replace.d.ts +0 -38
- package/lib/Agent/util/replace.d.ts.map +0 -1
- package/lib/Agent/util/replace.js +0 -458
- package/lib/Agent/util/replace.js.map +0 -1
- package/lib/Agent/util/ripgrep.d.ts +0 -109
- package/lib/Agent/util/ripgrep.d.ts.map +0 -1
- package/lib/Agent/util/ripgrep.js +0 -221
- package/lib/Agent/util/ripgrep.js.map +0 -1
- package/lib/Neon/api.d.ts +0 -258
- package/lib/Neon/api.d.ts.map +0 -1
- package/lib/Neon/api.js +0 -215
- package/lib/Neon/api.js.map +0 -1
- package/src/Agent/Agent.ts +0 -26
- package/src/Agent/Aspect.ts +0 -173
- package/src/Agent/AspectGraph.ts +0 -98
- package/src/Agent/ContextPlugin.ts +0 -18
- package/src/Agent/Plugin.ts +0 -29
- package/src/Agent/chat/channel.ts +0 -26
- package/src/Agent/chat/event.ts +0 -43
- package/src/Agent/chat/message.ts +0 -35
- package/src/Agent/chat/service.ts +0 -133
- package/src/Agent/chat/thread.ts +0 -17
- package/src/Agent/coding/bash.ts +0 -197
- package/src/Agent/coding/edit.ts +0 -152
- package/src/Agent/coding/glob.ts +0 -96
- package/src/Agent/coding/grep.ts +0 -143
- package/src/Agent/coding/index.ts +0 -7
- package/src/Agent/coding/read.ts +0 -119
- package/src/Agent/coding/readlints.ts +0 -78
- package/src/Agent/coding/write.ts +0 -79
- package/src/Agent/fs/file.ts +0 -22
- package/src/Agent/fs/folder.ts +0 -16
- package/src/Agent/index.ts +0 -9
- package/src/Agent/llm/error.ts +0 -330
- package/src/Agent/llm/index.ts +0 -4
- package/src/Agent/llm/llm.ts +0 -131
- package/src/Agent/llm/stream-collectors.ts +0 -58
- package/src/Agent/llm/stream-text-part.ts +0 -7
- package/src/Agent/lsp/client.ts +0 -293
- package/src/Agent/lsp/diagnostics.ts +0 -64
- package/src/Agent/lsp/jsonrpc.ts +0 -317
- package/src/Agent/lsp/manager.ts +0 -213
- package/src/Agent/lsp/servers.ts +0 -37
- package/src/Agent/process/driver.ts +0 -168
- package/src/Agent/process/issue-service.ts +0 -48
- package/src/Agent/process/issue-tools.ts +0 -33
- package/src/Agent/process/issue.ts +0 -22
- package/src/Agent/process/organization.ts +0 -16
- package/src/Agent/process/process.ts +0 -16
- package/src/Agent/process/reply.ts +0 -21
- package/src/Agent/process/task.ts +0 -34
- package/src/Agent/tool/index.ts +0 -3
- package/src/Agent/tool/parameter.ts +0 -35
- package/src/Agent/tool/result.ts +0 -51
- package/src/Agent/tool/tool.ts +0 -74
- package/src/Agent/util/command-validator.ts +0 -98
- package/src/Agent/util/parser.ts +0 -39
- package/src/Agent/util/replace.ts +0 -559
- package/src/Agent/util/ripgrep.ts +0 -256
- package/src/Neon/api.ts +0 -579
- /package/lib/{Agent/util → Util}/exec.d.ts +0 -0
- /package/lib/{Agent/util → Util}/exec.js +0 -0
- /package/src/{Agent/util → Util}/exec.ts +0 -0
package/src/Neon/Credentials.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Credentials } from "@distilled.cloud/neon/Credentials";
|
|
2
1
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
2
|
+
import { Credentials } from "@distilled.cloud/neon";
|
|
3
3
|
import * as Config from "effect/Config";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as Layer from "effect/Layer";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type NeonResolvedCredentials,
|
|
12
12
|
} from "./AuthProvider.ts";
|
|
13
13
|
|
|
14
|
-
export { Credentials } from "@distilled.cloud/neon
|
|
14
|
+
export { Credentials } from "@distilled.cloud/neon";
|
|
15
15
|
|
|
16
16
|
const DEFAULT_BASE_URL = "https://console.neon.tech/api/v2";
|
|
17
17
|
|
package/src/Neon/Project.ts
CHANGED
|
@@ -1,15 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CreateProjectOutput,
|
|
3
|
+
deleteProject,
|
|
4
|
+
getConnectionURI,
|
|
5
|
+
getProject,
|
|
6
|
+
getProjectOperation,
|
|
7
|
+
listProjectBranchDatabases,
|
|
8
|
+
listProjectBranches,
|
|
9
|
+
type ListProjectsOutput,
|
|
10
|
+
listProjects,
|
|
11
|
+
createProject as sdkCreateProject,
|
|
12
|
+
updateProject,
|
|
13
|
+
} from "@distilled.cloud/neon";
|
|
14
|
+
import * as Data from "effect/Data";
|
|
15
|
+
import * as Duration from "effect/Duration";
|
|
1
16
|
import * as Effect from "effect/Effect";
|
|
2
17
|
import * as Redacted from "effect/Redacted";
|
|
18
|
+
import * as Schedule from "effect/Schedule";
|
|
3
19
|
import { isResolved } from "../Diff.ts";
|
|
4
20
|
import { createPhysicalName } from "../PhysicalName.ts";
|
|
5
21
|
import * as Provider from "../Provider.ts";
|
|
6
22
|
import { Resource } from "../Resource.ts";
|
|
7
|
-
import * as api from "./api.ts";
|
|
8
23
|
import { applyMigrations, runSql } from "./Migrations.ts";
|
|
9
24
|
import { parsePostgresOrigin, type PostgresOrigin } from "./PostgresOrigin.ts";
|
|
10
25
|
import type { Providers } from "./Providers.ts";
|
|
11
26
|
import { listSqlFiles, readSqlFile } from "./SqlFile.ts";
|
|
12
27
|
|
|
28
|
+
type NeonOperationStatus =
|
|
29
|
+
| "scheduling"
|
|
30
|
+
| "running"
|
|
31
|
+
| "finished"
|
|
32
|
+
| "failed"
|
|
33
|
+
| "error"
|
|
34
|
+
| "cancelling"
|
|
35
|
+
| "cancelled"
|
|
36
|
+
| "skipped";
|
|
37
|
+
|
|
38
|
+
export class OperationFailed extends Data.TaggedError("OperationFailed")<{
|
|
39
|
+
operationId: string;
|
|
40
|
+
action: string;
|
|
41
|
+
status: NeonOperationStatus;
|
|
42
|
+
error?: string;
|
|
43
|
+
}> {}
|
|
44
|
+
|
|
45
|
+
class OperationPending extends Data.TaggedError("OperationPending")<{
|
|
46
|
+
operationId: string;
|
|
47
|
+
}> {}
|
|
48
|
+
|
|
49
|
+
const isOperationComplete = (status: NeonOperationStatus): boolean =>
|
|
50
|
+
status === "finished" ||
|
|
51
|
+
status === "failed" ||
|
|
52
|
+
status === "error" ||
|
|
53
|
+
status === "cancelled" ||
|
|
54
|
+
status === "skipped";
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Wait for the given operations to reach a terminal state. Polls every
|
|
58
|
+
* 500ms with exponential backoff up to ~30s per operation.
|
|
59
|
+
*/
|
|
60
|
+
export const waitForOperations = (
|
|
61
|
+
operations: ReadonlyArray<{
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly project_id: string;
|
|
64
|
+
readonly action: string;
|
|
65
|
+
readonly status: NeonOperationStatus;
|
|
66
|
+
readonly error?: string;
|
|
67
|
+
}>,
|
|
68
|
+
) =>
|
|
69
|
+
Effect.gen(function* () {
|
|
70
|
+
for (const op of operations) {
|
|
71
|
+
if (isOperationComplete(op.status)) {
|
|
72
|
+
if (op.status === "failed" || op.status === "error") {
|
|
73
|
+
return yield* new OperationFailed({
|
|
74
|
+
operationId: op.id,
|
|
75
|
+
action: op.action,
|
|
76
|
+
status: op.status,
|
|
77
|
+
error: op.error,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
yield* getProjectOperation({
|
|
83
|
+
project_id: op.project_id,
|
|
84
|
+
operation_id: op.id,
|
|
85
|
+
}).pipe(
|
|
86
|
+
Effect.flatMap(
|
|
87
|
+
({
|
|
88
|
+
operation,
|
|
89
|
+
}): Effect.Effect<void, OperationFailed | OperationPending> => {
|
|
90
|
+
const status = operation.status as NeonOperationStatus;
|
|
91
|
+
if (status === "failed" || status === "error") {
|
|
92
|
+
return Effect.fail(
|
|
93
|
+
new OperationFailed({
|
|
94
|
+
operationId: operation.id,
|
|
95
|
+
action: operation.action,
|
|
96
|
+
status,
|
|
97
|
+
error: operation.error,
|
|
98
|
+
}),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if (!isOperationComplete(status)) {
|
|
102
|
+
return Effect.fail(new OperationPending({ operationId: op.id }));
|
|
103
|
+
}
|
|
104
|
+
return Effect.void;
|
|
105
|
+
},
|
|
106
|
+
),
|
|
107
|
+
Effect.retry({
|
|
108
|
+
while: (e: unknown) => {
|
|
109
|
+
const tag = (e as { _tag?: string })._tag;
|
|
110
|
+
return (
|
|
111
|
+
tag === "OperationPending" ||
|
|
112
|
+
tag === "TooManyRequests" ||
|
|
113
|
+
tag === "ServiceUnavailable" ||
|
|
114
|
+
tag === "InternalServerError" ||
|
|
115
|
+
tag === "BadGateway" ||
|
|
116
|
+
tag === "GatewayTimeout"
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
schedule: Schedule.both(
|
|
120
|
+
Schedule.exponential(Duration.millis(500), 1.5),
|
|
121
|
+
Schedule.recurs(60),
|
|
122
|
+
),
|
|
123
|
+
}),
|
|
124
|
+
Effect.catchTag("OperationPending", () => Effect.void),
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const findProjectByName = (name: string) =>
|
|
130
|
+
Effect.gen(function* () {
|
|
131
|
+
const matches: ListProjectsOutput["projects"][number][] = [];
|
|
132
|
+
let cursor: string | undefined;
|
|
133
|
+
do {
|
|
134
|
+
const page = yield* listProjects({
|
|
135
|
+
search: name,
|
|
136
|
+
...(cursor !== undefined ? { cursor } : {}),
|
|
137
|
+
});
|
|
138
|
+
for (const p of page.projects) {
|
|
139
|
+
if (p.name === name) matches.push(p);
|
|
140
|
+
}
|
|
141
|
+
cursor = page.pagination?.cursor;
|
|
142
|
+
} while (cursor);
|
|
143
|
+
return matches;
|
|
144
|
+
});
|
|
145
|
+
|
|
13
146
|
export type NeonRegion =
|
|
14
147
|
| "aws-us-east-1"
|
|
15
148
|
| "aws-us-east-2"
|
|
@@ -184,22 +317,12 @@ export type Project = Resource<
|
|
|
184
317
|
*/
|
|
185
318
|
export const Project = Resource<Project>("Neon.Project");
|
|
186
319
|
|
|
187
|
-
const getRoleName = (creation:
|
|
320
|
+
const getRoleName = (creation: CreateProjectOutput) =>
|
|
188
321
|
creation.roles.find((r) => !r.protected)?.name ?? creation.roles[0]?.name;
|
|
189
322
|
|
|
190
|
-
const getDatabaseName = (creation:
|
|
323
|
+
const getDatabaseName = (creation: CreateProjectOutput) =>
|
|
191
324
|
creation.databases[0]?.name ?? "neondb";
|
|
192
325
|
|
|
193
|
-
const buildConnectionUri = (
|
|
194
|
-
uri: string,
|
|
195
|
-
pooledHost: string,
|
|
196
|
-
): { uri: string; pooled: string } => {
|
|
197
|
-
const url = new URL(uri);
|
|
198
|
-
const pooledUrl = new URL(uri);
|
|
199
|
-
pooledUrl.host = pooledHost;
|
|
200
|
-
return { uri: url.toString(), pooled: pooledUrl.toString() };
|
|
201
|
-
};
|
|
202
|
-
|
|
203
326
|
const resolveConnection = (
|
|
204
327
|
projectId: string,
|
|
205
328
|
branchId: string,
|
|
@@ -207,13 +330,15 @@ const resolveConnection = (
|
|
|
207
330
|
roleName: string,
|
|
208
331
|
) =>
|
|
209
332
|
Effect.gen(function* () {
|
|
210
|
-
const direct = yield*
|
|
333
|
+
const direct = yield* getConnectionURI({
|
|
334
|
+
project_id: projectId,
|
|
211
335
|
branch_id: branchId,
|
|
212
336
|
database_name: databaseName,
|
|
213
337
|
role_name: roleName,
|
|
214
338
|
pooled: false,
|
|
215
339
|
});
|
|
216
|
-
const pooled = yield*
|
|
340
|
+
const pooled = yield* getConnectionURI({
|
|
341
|
+
project_id: projectId,
|
|
217
342
|
branch_id: branchId,
|
|
218
343
|
database_name: databaseName,
|
|
219
344
|
role_name: roleName,
|
|
@@ -286,7 +411,7 @@ export const ProjectProvider = () =>
|
|
|
286
411
|
}),
|
|
287
412
|
read: Effect.fn(function* ({ id, output, olds }) {
|
|
288
413
|
if (output?.projectId) {
|
|
289
|
-
return yield*
|
|
414
|
+
return yield* getProject({ project_id: output.projectId }).pipe(
|
|
290
415
|
Effect.map(({ project }) => ({
|
|
291
416
|
...output,
|
|
292
417
|
projectName: project.name,
|
|
@@ -294,25 +419,24 @@ export const ProjectProvider = () =>
|
|
|
294
419
|
enableLogicalReplication:
|
|
295
420
|
project.settings?.enable_logical_replication === true,
|
|
296
421
|
})),
|
|
297
|
-
Effect.catchTag("
|
|
298
|
-
Effect.succeed(undefined),
|
|
299
|
-
),
|
|
422
|
+
Effect.catchTag("NotFound", () => Effect.succeed(undefined)),
|
|
300
423
|
);
|
|
301
424
|
}
|
|
302
425
|
const name = yield* createProjectName(id, olds?.name);
|
|
303
|
-
const matches = yield*
|
|
426
|
+
const matches = yield* findProjectByName(name);
|
|
304
427
|
const match = matches[0];
|
|
305
428
|
if (!match) return undefined;
|
|
306
|
-
const branches = yield*
|
|
429
|
+
const branches = yield* listProjectBranches({
|
|
430
|
+
project_id: match.id,
|
|
307
431
|
search: olds?.defaultBranchName ?? "main",
|
|
308
432
|
});
|
|
309
433
|
const defaultBranch =
|
|
310
434
|
branches.branches.find((b) => b.default) ?? branches.branches[0];
|
|
311
435
|
if (!defaultBranch) return undefined;
|
|
312
|
-
const databases = yield*
|
|
313
|
-
match.id,
|
|
314
|
-
defaultBranch.id,
|
|
315
|
-
);
|
|
436
|
+
const databases = yield* listProjectBranchDatabases({
|
|
437
|
+
project_id: match.id,
|
|
438
|
+
branch_id: defaultBranch.id,
|
|
439
|
+
});
|
|
316
440
|
const db = databases.databases[0];
|
|
317
441
|
if (!db) return undefined;
|
|
318
442
|
const conn = yield* resolveConnection(
|
|
@@ -333,7 +457,7 @@ export const ProjectProvider = () =>
|
|
|
333
457
|
connectionUri: conn.uri,
|
|
334
458
|
pooledConnectionUri: conn.pooled,
|
|
335
459
|
origin: parsePostgresOrigin(conn.uri),
|
|
336
|
-
historyRetentionSeconds: match.history_retention_seconds,
|
|
460
|
+
historyRetentionSeconds: match.history_retention_seconds ?? 86400,
|
|
337
461
|
enableLogicalReplication:
|
|
338
462
|
match.settings?.enable_logical_replication === true,
|
|
339
463
|
migrationsDir: olds?.migrationsDir,
|
|
@@ -347,8 +471,9 @@ export const ProjectProvider = () =>
|
|
|
347
471
|
// (and let `read` upstream decide adoption); otherwise update
|
|
348
472
|
// the mutable scalar fields on the existing project.
|
|
349
473
|
const projectInfo = output
|
|
350
|
-
? yield*
|
|
351
|
-
|
|
474
|
+
? yield* updateProject({
|
|
475
|
+
project_id: output.projectId,
|
|
476
|
+
project: {
|
|
352
477
|
name: news.name,
|
|
353
478
|
history_retention_seconds: news.historyRetentionSeconds,
|
|
354
479
|
settings:
|
|
@@ -359,45 +484,47 @@ export const ProjectProvider = () =>
|
|
|
359
484
|
news.enableLogicalReplication ?? false,
|
|
360
485
|
}
|
|
361
486
|
: undefined,
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
487
|
+
},
|
|
488
|
+
}).pipe(
|
|
489
|
+
Effect.map((r) => ({
|
|
490
|
+
projectId: output.projectId,
|
|
491
|
+
projectName: r.project.name,
|
|
492
|
+
region: output.region,
|
|
493
|
+
pgVersion: output.pgVersion,
|
|
494
|
+
defaultBranchId: output.defaultBranchId,
|
|
495
|
+
defaultBranchName: output.defaultBranchName,
|
|
496
|
+
databaseName: output.databaseName,
|
|
497
|
+
roleName: output.roleName,
|
|
498
|
+
connectionUri: output.connectionUri,
|
|
499
|
+
pooledConnectionUri: output.pooledConnectionUri,
|
|
500
|
+
origin: output.origin,
|
|
501
|
+
historyRetentionSeconds:
|
|
502
|
+
r.project.history_retention_seconds ??
|
|
503
|
+
output.historyRetentionSeconds,
|
|
504
|
+
enableLogicalReplication:
|
|
505
|
+
r.project.settings?.enable_logical_replication === true,
|
|
506
|
+
})),
|
|
507
|
+
)
|
|
383
508
|
: yield* Effect.gen(function* () {
|
|
384
509
|
const name = yield* createProjectName(id, news.name);
|
|
385
|
-
const created = yield*
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
510
|
+
const created = yield* sdkCreateProject({
|
|
511
|
+
project: {
|
|
512
|
+
name,
|
|
513
|
+
region_id: news.region,
|
|
514
|
+
pg_version: news.pgVersion,
|
|
515
|
+
branch: {
|
|
516
|
+
name: news.defaultBranchName,
|
|
517
|
+
role_name: news.roleName,
|
|
518
|
+
database_name: news.databaseName,
|
|
519
|
+
},
|
|
520
|
+
history_retention_seconds: news.historyRetentionSeconds,
|
|
521
|
+
org_id: news.orgId,
|
|
522
|
+
settings: news.enableLogicalReplication
|
|
523
|
+
? { enable_logical_replication: true }
|
|
524
|
+
: undefined,
|
|
393
525
|
},
|
|
394
|
-
history_retention_seconds: news.historyRetentionSeconds,
|
|
395
|
-
org_id: news.orgId,
|
|
396
|
-
settings: news.enableLogicalReplication
|
|
397
|
-
? { enable_logical_replication: true }
|
|
398
|
-
: undefined,
|
|
399
526
|
});
|
|
400
|
-
yield*
|
|
527
|
+
yield* waitForOperations(created.operations);
|
|
401
528
|
|
|
402
529
|
const branchId = created.branch.id;
|
|
403
530
|
const databaseName = getDatabaseName(created);
|
|
@@ -458,7 +585,9 @@ export const ProjectProvider = () =>
|
|
|
458
585
|
};
|
|
459
586
|
}),
|
|
460
587
|
delete: Effect.fn(function* ({ output }) {
|
|
461
|
-
yield*
|
|
588
|
+
yield* deleteProject({ project_id: output.projectId }).pipe(
|
|
589
|
+
Effect.catchTag("NotFound", () => Effect.void),
|
|
590
|
+
);
|
|
462
591
|
}),
|
|
463
592
|
};
|
|
464
593
|
}),
|
package/src/Output.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as Data from "effect/Data";
|
|
2
|
-
import type { Yieldable } from "effect/Effect";
|
|
3
2
|
import * as Effect from "effect/Effect";
|
|
4
3
|
import { pipe } from "effect/Function";
|
|
5
4
|
import type { Pipeable } from "effect/Pipeable";
|
|
6
5
|
import * as Redacted from "effect/Redacted";
|
|
7
6
|
import { SingleShotGen } from "effect/Utils";
|
|
8
|
-
import { getRefMetadata, isRef,
|
|
7
|
+
import { getRefMetadata, isRef, type Ref } from "./Ref.ts";
|
|
9
8
|
import { isResource, type Resource, type ResourceLike } from "./Resource.ts";
|
|
10
9
|
import { RuntimeContext } from "./RuntimeContext.ts";
|
|
11
10
|
import { Stack } from "./Stack.ts";
|
|
@@ -48,7 +47,7 @@ export interface Output<A = any, Req = any> extends Pipeable {
|
|
|
48
47
|
readonly req: Req;
|
|
49
48
|
/** @internal phantom */
|
|
50
49
|
[Symbol.iterator](): Iterator<
|
|
51
|
-
|
|
50
|
+
Effect.Effect<void, never, Req>,
|
|
52
51
|
Accessor<A>,
|
|
53
52
|
void
|
|
54
53
|
>;
|
|
@@ -82,9 +81,11 @@ export type Expr<A = any, Req = any> =
|
|
|
82
81
|
| ApplyExpr<any, A, Req>
|
|
83
82
|
| EffectExpr<any, A, Req>
|
|
84
83
|
| LiteralExpr<A>
|
|
84
|
+
| NamedExpr<A, Req>
|
|
85
85
|
| PropExpr<A, keyof A, Req>
|
|
86
86
|
| ResourceExpr<A, Req>
|
|
87
|
-
| RefExpr<A
|
|
87
|
+
| RefExpr<A>
|
|
88
|
+
| StackRefExpr<A>;
|
|
88
89
|
|
|
89
90
|
export abstract class BaseExpr<A = any, Req = any> implements Output<A, Req> {
|
|
90
91
|
declare readonly kind: any;
|
|
@@ -98,12 +99,12 @@ export abstract class BaseExpr<A = any, Req = any> implements Output<A, Req> {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
[Symbol.iterator](): Iterator<
|
|
101
|
-
|
|
102
|
+
Effect.Effect<void, never, Req>,
|
|
102
103
|
Accessor<A>,
|
|
103
104
|
void
|
|
104
105
|
> {
|
|
105
106
|
// @ts-expect-error - TODO(sam): fix this (works at runtime, but maybe indicates a bad assumption)
|
|
106
|
-
return new SingleShotGen(this);
|
|
107
|
+
return new SingleShotGen(this.asEffect());
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
asEffect(): any {
|
|
@@ -111,7 +112,7 @@ export abstract class BaseExpr<A = any, Req = any> implements Output<A, Req> {
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
public bind(id: string): any {
|
|
114
|
-
return RuntimeContext.
|
|
115
|
+
return RuntimeContext.pipe(
|
|
115
116
|
Effect.flatMap((ctx) =>
|
|
116
117
|
Effect.map(ctx.set(id, this), (key) => ctx.get<A>(key)),
|
|
117
118
|
),
|
|
@@ -255,6 +256,36 @@ export class EffectExpr<A, B, Req = never, Req2 = never> extends BaseExpr<
|
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
|
|
259
|
+
export const isNamedExpr = <A = any, Req = any>(
|
|
260
|
+
node: any,
|
|
261
|
+
): node is NamedExpr<A, Req> => node?.kind === "NamedExpr";
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Wraps another `Expr` and overrides its `toString()` / inspect output.
|
|
265
|
+
*
|
|
266
|
+
* `BaseExpr` derives the binding id from `this.toString()`, so
|
|
267
|
+
* wrapping an expression in `NamedExpr` makes that derived id stable and
|
|
268
|
+
* caller-controlled (e.g. an env var name like `"API_KEY"`).
|
|
269
|
+
*/
|
|
270
|
+
export class NamedExpr<A, Req = never> extends BaseExpr<A, Req> {
|
|
271
|
+
readonly kind = "NamedExpr";
|
|
272
|
+
constructor(
|
|
273
|
+
public readonly expr: Expr<A, Req>,
|
|
274
|
+
public readonly bindingName: string,
|
|
275
|
+
) {
|
|
276
|
+
super();
|
|
277
|
+
return proxy(this);
|
|
278
|
+
}
|
|
279
|
+
[inspect](): string {
|
|
280
|
+
return this.bindingName;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export const named = <A, Req>(
|
|
285
|
+
expr: Output<A, Req>,
|
|
286
|
+
name: string,
|
|
287
|
+
): Output<A, Req> => new NamedExpr(expr as Expr<A, Req>, name) as any;
|
|
288
|
+
|
|
258
289
|
export const all = <Outs extends (Output | Expr)[]>(...outs: Outs) =>
|
|
259
290
|
new AllExpr(outs as any) as unknown as All<Outs>;
|
|
260
291
|
|
|
@@ -309,6 +340,48 @@ export class RefExpr<A> extends BaseExpr<A, never> {
|
|
|
309
340
|
}
|
|
310
341
|
}
|
|
311
342
|
|
|
343
|
+
export const isStackRefExpr = <A = any>(node: any): node is StackRefExpr<A> =>
|
|
344
|
+
node?.kind === "StackRefExpr";
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* A reference to the persisted output of a Stack at `(stack, stage)`.
|
|
348
|
+
*
|
|
349
|
+
* Resolved at evaluation time by reading `state.getOutput({ stack,
|
|
350
|
+
* stage })`. Distinct from {@link RefExpr}, which references a
|
|
351
|
+
* single resource's attributes within a stack/stage. `stage` may be
|
|
352
|
+
* `undefined`, in which case it falls back to the current stage.
|
|
353
|
+
*/
|
|
354
|
+
export class StackRefExpr<A> extends BaseExpr<A, never> {
|
|
355
|
+
readonly kind = "StackRefExpr";
|
|
356
|
+
constructor(
|
|
357
|
+
public readonly stack: string,
|
|
358
|
+
public readonly stage: string | undefined,
|
|
359
|
+
) {
|
|
360
|
+
super();
|
|
361
|
+
return proxy(this);
|
|
362
|
+
}
|
|
363
|
+
[inspect](): string {
|
|
364
|
+
return `stackRef(${this.stack}${
|
|
365
|
+
this.stage ? `, { stage: ${this.stage} }` : ""
|
|
366
|
+
})`;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Build an `Output<A>` referencing the persisted output of another
|
|
372
|
+
* Stack. The returned Effect resolves to a lazy `Output<A>` whose
|
|
373
|
+
* value is read from the state store at plan/apply time.
|
|
374
|
+
*
|
|
375
|
+
* Returns `Effect<Output<A>>` (not `Output<A>` directly) so that
|
|
376
|
+
* `yield* Output.stackRef(...)` reads ergonomically inside an Effect
|
|
377
|
+
* generator and lines up with `Resource.ref` and `Stack.stage.<name>`.
|
|
378
|
+
*/
|
|
379
|
+
export const stackRef = <A>(
|
|
380
|
+
stack: string,
|
|
381
|
+
options: { stage?: string } = {},
|
|
382
|
+
): Effect.Effect<Output<A, never>> =>
|
|
383
|
+
Effect.succeed(new StackRefExpr<A>(stack, options.stage) as any);
|
|
384
|
+
|
|
312
385
|
export const filter = <Outs extends any[]>(...outs: Outs) =>
|
|
313
386
|
outs.filter(isOutput) as unknown as Filter<Outs>;
|
|
314
387
|
|
|
@@ -353,7 +426,32 @@ function proxy(self: any): any {
|
|
|
353
426
|
prop === ExprSymbol || prop === inspect ? true : prop in self,
|
|
354
427
|
get: (target, prop) =>
|
|
355
428
|
prop === Symbol.toPrimitive
|
|
356
|
-
? (hint: string) =>
|
|
429
|
+
? (hint: string) => {
|
|
430
|
+
// Any JS-level coercion of an unresolved Output produces a
|
|
431
|
+
// placeholder that *looks* like a real value but isn't:
|
|
432
|
+
//
|
|
433
|
+
// - `string` / `default` hints (`${output}`, `output + ""`,
|
|
434
|
+
// `==` against a primitive) previously fell through to
|
|
435
|
+
// `self.toString()` and returned the inspect form
|
|
436
|
+
// (e.g. "tunnel.tunnelId"). The bogus string flowed
|
|
437
|
+
// into resource props and into the cloud — only
|
|
438
|
+
// surfacing as an opaque downstream error (see PR
|
|
439
|
+
// description for a real Cloudflare DNS landing).
|
|
440
|
+
//
|
|
441
|
+
// - `number` hint (`+output`, `output * 2`,
|
|
442
|
+
// `Math.max(0, output)`) previously returned NaN, which
|
|
443
|
+
// propagates silently through arithmetic and lands as
|
|
444
|
+
// "the API rejected a NaN field" much later.
|
|
445
|
+
//
|
|
446
|
+
// All three hints fail loud at the coercion site with a
|
|
447
|
+
// pointer to the right composition API.
|
|
448
|
+
throw new Error(
|
|
449
|
+
`Cannot coerce Output<${self[inspect]()}> to a ` +
|
|
450
|
+
`${hint === "number" ? "number" : "string"} via JS coercion. ` +
|
|
451
|
+
`Use Output.interpolate\`...\` or Output.map(output, fn) ` +
|
|
452
|
+
`to compose Outputs — the value isn't known until deploy time.`,
|
|
453
|
+
);
|
|
454
|
+
}
|
|
357
455
|
: prop === ExprSymbol
|
|
358
456
|
? self
|
|
359
457
|
: prop === inspect
|
|
@@ -445,6 +543,8 @@ export const evaluate: <A, Req = never>(
|
|
|
445
543
|
);
|
|
446
544
|
} else if (isPropExpr(expr)) {
|
|
447
545
|
return (yield* evaluate(expr.expr, upstream))?.[expr.identifier];
|
|
546
|
+
} else if (isNamedExpr(expr)) {
|
|
547
|
+
return yield* evaluate(expr.expr, upstream);
|
|
448
548
|
} else if (isRefExpr(expr)) {
|
|
449
549
|
const state = yield* State.State;
|
|
450
550
|
const stack = expr.stack ?? (yield* Stack).name;
|
|
@@ -464,7 +564,26 @@ export const evaluate: <A, Req = never>(
|
|
|
464
564
|
}),
|
|
465
565
|
);
|
|
466
566
|
}
|
|
467
|
-
|
|
567
|
+
// RefExpr targets persisted resources; tasks aren't cross-stack
|
|
568
|
+
// referenceable. Return the resource's output attrs, otherwise the
|
|
569
|
+
// task's output value, otherwise undefined.
|
|
570
|
+
return (resource as any).attr ?? (resource as any).output;
|
|
571
|
+
} else if (isStackRefExpr(expr)) {
|
|
572
|
+
const state = yield* State.State;
|
|
573
|
+
const stack = expr.stack;
|
|
574
|
+
const stage = expr.stage ?? (yield* Stage);
|
|
575
|
+
const output = yield* state.getOutput({ stack, stage });
|
|
576
|
+
if (output == null) {
|
|
577
|
+
return yield* Effect.fail(
|
|
578
|
+
new InvalidReferenceError({
|
|
579
|
+
message: `Reference to stack '${stack}' at stage '${stage}' not found. Have you deployed stage '${stage}' of '${stack}'?`,
|
|
580
|
+
stack,
|
|
581
|
+
stage,
|
|
582
|
+
resourceId: stack,
|
|
583
|
+
}),
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
return output;
|
|
468
587
|
}
|
|
469
588
|
}
|
|
470
589
|
if (Array.isArray(expr)) {
|
|
@@ -483,14 +602,6 @@ export const evaluate: <A, Req = never>(
|
|
|
483
602
|
return expr;
|
|
484
603
|
}) as Effect.Effect<any>;
|
|
485
604
|
|
|
486
|
-
export const ref = <R extends ResourceLike>(
|
|
487
|
-
resourceId: R["LogicalId"],
|
|
488
|
-
options?: {
|
|
489
|
-
stage?: string;
|
|
490
|
-
stack?: string;
|
|
491
|
-
},
|
|
492
|
-
) => of(stageRef({ id: resourceId, ...options }));
|
|
493
|
-
|
|
494
605
|
export const hasOutputs = (value: any): value is Output<any, any> =>
|
|
495
606
|
Object.keys(upstreamAny(value)).length > 0;
|
|
496
607
|
|
|
@@ -531,7 +642,7 @@ export const upstream = <E extends Output<any, any>>(expr: E): any => {
|
|
|
531
642
|
return upstream(expr.expr);
|
|
532
643
|
} else if (isAllExpr(expr)) {
|
|
533
644
|
return Object.assign({}, ...expr.outs.map((out) => upstream(out)));
|
|
534
|
-
} else if (isEffectExpr(expr) || isApplyExpr(expr)) {
|
|
645
|
+
} else if (isEffectExpr(expr) || isApplyExpr(expr) || isNamedExpr(expr)) {
|
|
535
646
|
return upstream(expr.expr);
|
|
536
647
|
} else if (Array.isArray(expr)) {
|
|
537
648
|
return expr.map(upstream).reduce(toObject, {});
|