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
|
@@ -2,7 +2,7 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
3
|
import { recordStateStoreInit } from "../Telemetry/Metrics.ts";
|
|
4
4
|
import type { ResourceState } from "./ResourceState.ts";
|
|
5
|
-
import { State } from "./State.ts";
|
|
5
|
+
import { State, type PersistedState } from "./State.ts";
|
|
6
6
|
|
|
7
7
|
type StackId = string;
|
|
8
8
|
type StageId = string;
|
|
@@ -13,14 +13,18 @@ export const inMemoryState = (
|
|
|
13
13
|
StackId,
|
|
14
14
|
Record<StageId, Record<Fqn, ResourceState>>
|
|
15
15
|
> = {},
|
|
16
|
+
initialOutputs: Record<StackId, Record<StageId, unknown>> = {},
|
|
16
17
|
) =>
|
|
17
18
|
Layer.effect(
|
|
18
19
|
State,
|
|
19
|
-
Effect.succeed(InMemoryService(initialState)).pipe(
|
|
20
|
+
Effect.succeed(InMemoryService(initialState, initialOutputs)).pipe(
|
|
21
|
+
recordStateStoreInit,
|
|
22
|
+
),
|
|
20
23
|
);
|
|
21
24
|
|
|
22
25
|
export const InMemoryService = (
|
|
23
26
|
state: Record<StackId, Record<StageId, Record<Fqn, ResourceState>>> = {},
|
|
27
|
+
outputs: Record<StackId, Record<StageId, unknown>> = {},
|
|
24
28
|
) =>
|
|
25
29
|
State.of({
|
|
26
30
|
id: "inmemory",
|
|
@@ -50,7 +54,7 @@ export const InMemoryService = (
|
|
|
50
54
|
(s) => s.status === "replaced",
|
|
51
55
|
),
|
|
52
56
|
),
|
|
53
|
-
set: <V extends
|
|
57
|
+
set: <V extends PersistedState>({
|
|
54
58
|
stack,
|
|
55
59
|
stage,
|
|
56
60
|
fqn,
|
|
@@ -60,12 +64,13 @@ export const InMemoryService = (
|
|
|
60
64
|
stage: string;
|
|
61
65
|
fqn: string;
|
|
62
66
|
value: V;
|
|
63
|
-
}) =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
}) =>
|
|
68
|
+
Effect.sync(() => {
|
|
69
|
+
const stackState = (state[stack] ??= {});
|
|
70
|
+
const stageState = (stackState[stage] ??= {});
|
|
71
|
+
stageState[fqn] = value as ResourceState;
|
|
72
|
+
return value;
|
|
73
|
+
}),
|
|
69
74
|
delete: ({
|
|
70
75
|
stack,
|
|
71
76
|
stage,
|
|
@@ -74,7 +79,7 @@ export const InMemoryService = (
|
|
|
74
79
|
stack: string;
|
|
75
80
|
stage: string;
|
|
76
81
|
fqn: string;
|
|
77
|
-
}) => Effect.
|
|
82
|
+
}) => Effect.sync(() => delete state[stack]?.[stage]?.[fqn]),
|
|
78
83
|
deleteStack: ({ stack, stage }: { stack: string; stage?: string }) =>
|
|
79
84
|
Effect.sync(() => {
|
|
80
85
|
if (stage === undefined) {
|
|
@@ -87,4 +92,20 @@ export const InMemoryService = (
|
|
|
87
92
|
Effect.succeed(
|
|
88
93
|
Array.from(Object.keys(state[stack]?.[stage] ?? {}) ?? []),
|
|
89
94
|
),
|
|
95
|
+
getOutput: ({ stack, stage }: { stack: string; stage: string }) =>
|
|
96
|
+
Effect.succeed(outputs[stack]?.[stage]),
|
|
97
|
+
setOutput: ({
|
|
98
|
+
stack,
|
|
99
|
+
stage,
|
|
100
|
+
value,
|
|
101
|
+
}: {
|
|
102
|
+
stack: string;
|
|
103
|
+
stage: string;
|
|
104
|
+
value: unknown;
|
|
105
|
+
}) =>
|
|
106
|
+
Effect.sync(() => {
|
|
107
|
+
const stackOutputs = (outputs[stack] ??= {});
|
|
108
|
+
stackOutputs[stage] = value;
|
|
109
|
+
return value;
|
|
110
|
+
}),
|
|
90
111
|
});
|
package/src/State/LocalState.ts
CHANGED
|
@@ -46,6 +46,9 @@ export const makeLocalState = () =>
|
|
|
46
46
|
fqn: string;
|
|
47
47
|
}) => path.join(stateDir, stack, stage, `${encodeFqn(fqn)}.json`);
|
|
48
48
|
|
|
49
|
+
const outputFile = ({ stack, stage }: { stack: string; stage: string }) =>
|
|
50
|
+
path.join(stateDir, stack, stage, `__stack_output__.json`);
|
|
51
|
+
|
|
49
52
|
const created = new Set<string>();
|
|
50
53
|
|
|
51
54
|
const ensure = (dir: string) =>
|
|
@@ -107,11 +110,32 @@ export const makeLocalState = () =>
|
|
|
107
110
|
list: (request) =>
|
|
108
111
|
fs.readDirectory(stageDir(request)).pipe(
|
|
109
112
|
recover,
|
|
110
|
-
Effect.map(
|
|
111
|
-
(files)
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
Effect.map((files) =>
|
|
114
|
+
(files ?? [])
|
|
115
|
+
// Filter the bookkeeping file before decoding — `decodeFqn`
|
|
116
|
+
// replaces `__` with `/`, which would turn the literal name
|
|
117
|
+
// `__stack_output__` into `/stack_output/` and slip past the
|
|
118
|
+
// filter, leaving the engine to look up a non-existent
|
|
119
|
+
// resource.
|
|
120
|
+
.filter((file) => file !== "__stack_output__.json")
|
|
121
|
+
.map((file) => decodeFqn(file.replace(/\.json$/, ""))),
|
|
122
|
+
),
|
|
123
|
+
),
|
|
124
|
+
getOutput: (request) =>
|
|
125
|
+
fs.readFile(outputFile(request)).pipe(
|
|
126
|
+
Effect.map((file) => JSON.parse(file.toString(), reviveState)),
|
|
127
|
+
recover,
|
|
128
|
+
),
|
|
129
|
+
setOutput: (request) =>
|
|
130
|
+
ensure(stageDir(request)).pipe(
|
|
131
|
+
Effect.flatMap(() =>
|
|
132
|
+
fs.writeFileString(
|
|
133
|
+
outputFile(request),
|
|
134
|
+
JSON.stringify(encodeState(request.value as any), null, 2),
|
|
135
|
+
),
|
|
114
136
|
),
|
|
137
|
+
recover,
|
|
138
|
+
Effect.map(() => request.value),
|
|
115
139
|
),
|
|
116
140
|
};
|
|
117
141
|
return state;
|
|
@@ -27,6 +27,11 @@ export type ReplacementOldResourceState =
|
|
|
27
27
|
| ReplacementResourceState;
|
|
28
28
|
|
|
29
29
|
interface BaseResourceState {
|
|
30
|
+
/**
|
|
31
|
+
* Discriminator vs {@link ActionState}. Optional for back-compat: legacy
|
|
32
|
+
* persisted rows have no `kind` field and are implicitly resources.
|
|
33
|
+
*/
|
|
34
|
+
readonly kind?: "resource";
|
|
30
35
|
/** Type of the Resource (e.g. AWS.Lambda.Function) */
|
|
31
36
|
resourceType: string;
|
|
32
37
|
/** Namespace of the Resource */
|
package/src/State/State.ts
CHANGED
|
@@ -2,6 +2,21 @@ import * as Context from "effect/Context";
|
|
|
2
2
|
import * as Data from "effect/Data";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import type { ReplacedResourceState, ResourceState } from "./ResourceState.ts";
|
|
5
|
+
import type { ActionState } from "./ActionState.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Anything persistable under an FQN. Resources are discriminated by status
|
|
9
|
+
* strings ("creating", "created", …) and Tasks by `kind: "action"`.
|
|
10
|
+
*/
|
|
11
|
+
export type PersistedState = ResourceState | ActionState;
|
|
12
|
+
|
|
13
|
+
export const isActionState = (
|
|
14
|
+
s: PersistedState | undefined,
|
|
15
|
+
): s is ActionState => !!s && (s as any).kind === "action";
|
|
16
|
+
|
|
17
|
+
export const isResourceState = (
|
|
18
|
+
s: PersistedState | undefined,
|
|
19
|
+
): s is ResourceState => !!s && (s as any).kind !== "task";
|
|
5
20
|
|
|
6
21
|
export class StateStoreError extends Data.TaggedError("StateStoreError")<{
|
|
7
22
|
message: string;
|
|
@@ -41,7 +56,7 @@ export interface StateService {
|
|
|
41
56
|
stack: string;
|
|
42
57
|
stage: string;
|
|
43
58
|
fqn: string;
|
|
44
|
-
}): Effect.Effect<
|
|
59
|
+
}): Effect.Effect<PersistedState | undefined, StateStoreError, never>;
|
|
45
60
|
/**
|
|
46
61
|
* List top-level resources that are still in replacement cleanup.
|
|
47
62
|
*
|
|
@@ -59,7 +74,7 @@ export interface StateService {
|
|
|
59
74
|
/**
|
|
60
75
|
* Set a resource by its FQN (namespace-qualified key).
|
|
61
76
|
*/
|
|
62
|
-
set<V extends
|
|
77
|
+
set<V extends PersistedState>(request: {
|
|
63
78
|
stack: string;
|
|
64
79
|
stage: string;
|
|
65
80
|
fqn: string;
|
|
@@ -87,4 +102,25 @@ export interface StateService {
|
|
|
87
102
|
stack: string;
|
|
88
103
|
stage: string;
|
|
89
104
|
}): Effect.Effect<readonly string[], StateStoreError, never>;
|
|
105
|
+
/**
|
|
106
|
+
* Read the persisted stack output for `(stack, stage)`. Returns
|
|
107
|
+
* `undefined` when the stack has not been deployed (or has been
|
|
108
|
+
* destroyed) at this stage.
|
|
109
|
+
*
|
|
110
|
+
* Stack outputs are written by `apply` once the deploy succeeds and
|
|
111
|
+
* read by cross-stack references (`yield* OtherStack` /
|
|
112
|
+
* `OtherStack.stage.<name>` / `Output.stackRef(...)`).
|
|
113
|
+
*/
|
|
114
|
+
getOutput(request: {
|
|
115
|
+
stack: string;
|
|
116
|
+
stage: string;
|
|
117
|
+
}): Effect.Effect<unknown, StateStoreError, never>;
|
|
118
|
+
/**
|
|
119
|
+
* Persist the resolved stack output for `(stack, stage)`.
|
|
120
|
+
*/
|
|
121
|
+
setOutput(request: {
|
|
122
|
+
stack: string;
|
|
123
|
+
stage: string;
|
|
124
|
+
value: unknown;
|
|
125
|
+
}): Effect.Effect<unknown, StateStoreError, never>;
|
|
90
126
|
}
|
package/src/State/index.ts
CHANGED
package/src/Test/Bun.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import bun from "bun:test";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Exit from "effect/Exit";
|
|
4
|
+
import * as Scope from "effect/Scope";
|
|
3
5
|
import type { HookOptions } from "node:test";
|
|
4
6
|
|
|
5
7
|
import type { AlchemyContext } from "../AlchemyContext.ts";
|
|
6
8
|
import type { CompiledStack } from "../Stack.ts";
|
|
7
9
|
import type { Stage } from "../Stage.ts";
|
|
10
|
+
import { installLocalhostDns } from "../Util/LocalhostDns.ts";
|
|
8
11
|
import * as Core from "./Core.ts";
|
|
9
12
|
|
|
13
|
+
installLocalhostDns();
|
|
14
|
+
|
|
10
15
|
export type MakeOptions<ROut = any> = Core.MakeOptions<ROut>;
|
|
11
16
|
export type ScratchStack = Core.ScratchStack;
|
|
12
17
|
export type TestEffect<A, R = never> = Core.TestEffect<A, R>;
|
|
@@ -106,7 +111,15 @@ const DEFAULT_HOOK_TIMEOUT: HookOptions = { timeout: 120_000 };
|
|
|
106
111
|
* ```
|
|
107
112
|
*/
|
|
108
113
|
export const make = <ROut = any>(options: MakeOptions<ROut>): TestApi => {
|
|
109
|
-
|
|
114
|
+
// Single scope shared across `beforeAll`, every `test`, and `afterAll`.
|
|
115
|
+
// Scoped resources in dev mode (the Cloudflare sidecar process and its
|
|
116
|
+
// workerd children) must outlive a single `Effect.runPromise` boundary,
|
|
117
|
+
// otherwise the proxy is killed the moment `beforeAll(deploy(Stack))`
|
|
118
|
+
// resolves and every later `HttpClient.get(workerUrl)` hits a dead port.
|
|
119
|
+
// The scope is closed by `destroy(...)` (or never — the next test run
|
|
120
|
+
// reclaims any leaked sidecar via the lock file).
|
|
121
|
+
const sharedScope = Scope.makeUnsafe("sequential");
|
|
122
|
+
const runEff = <A>(eff: TestEffect<A>) => Core.run(eff, options, sharedScope);
|
|
110
123
|
|
|
111
124
|
const test = ((name, eff, opts) => {
|
|
112
125
|
bun.test(name, () => runEff(eff), opts);
|
|
@@ -130,10 +143,11 @@ export const make = <ROut = any>(options: MakeOptions<ROut>): TestApi => {
|
|
|
130
143
|
fn: (stack: ScratchStack) => Effect.Effect<void, any, any>,
|
|
131
144
|
) => {
|
|
132
145
|
const scratch = Core.scratchStack(options, name);
|
|
133
|
-
return Core.run(
|
|
134
|
-
|
|
135
|
-
state: scratch.state,
|
|
136
|
-
|
|
146
|
+
return Core.run(
|
|
147
|
+
Core.withProviders(fn(scratch), options, scratch.name),
|
|
148
|
+
{ ...options, state: scratch.state },
|
|
149
|
+
sharedScope,
|
|
150
|
+
);
|
|
137
151
|
};
|
|
138
152
|
|
|
139
153
|
const provider = ((name, fn, opts) => {
|
|
@@ -175,13 +189,35 @@ export const make = <ROut = any>(options: MakeOptions<ROut>): TestApi => {
|
|
|
175
189
|
bun.afterEach(() => runEff(eff), hookOptions);
|
|
176
190
|
};
|
|
177
191
|
|
|
192
|
+
// `destroy(Stack)` needs the dev sidecar alive so it can call `sidecar.stop`
|
|
193
|
+
// for each worker. We close the shared scope only AFTER destroy completes.
|
|
194
|
+
// `Scope.close` on an already-closed scope is a no-op, so it's safe for both
|
|
195
|
+
// the destroy wrapper AND the fallback cleanup hook below to call it.
|
|
196
|
+
const closeScope = Effect.suspend(() =>
|
|
197
|
+
Scope.close(sharedScope, Exit.void),
|
|
198
|
+
).pipe(Effect.ignore);
|
|
199
|
+
|
|
200
|
+
// Fallback cleanup: if the user never calls `destroy(Stack)` (e.g.
|
|
201
|
+
// `NO_DESTROY=1`), nothing else closes the shared scope and the sidecar
|
|
202
|
+
// child process leaks past the test process. Register an `afterAll` that
|
|
203
|
+
// closes it. We defer registration to a microtask so it runs AFTER any
|
|
204
|
+
// user-registered `afterAll` (including `destroy(Stack)`); bun runs
|
|
205
|
+
// afterAll hooks in registration order.
|
|
206
|
+
queueMicrotask(() => {
|
|
207
|
+
bun.afterAll(() => Effect.runPromise(closeScope), DEFAULT_HOOK_TIMEOUT);
|
|
208
|
+
});
|
|
209
|
+
|
|
178
210
|
return {
|
|
179
211
|
test,
|
|
180
212
|
beforeAll,
|
|
181
213
|
beforeEach,
|
|
182
214
|
afterAll,
|
|
183
215
|
afterEach,
|
|
184
|
-
deploy: (stack, callOpts) =>
|
|
185
|
-
|
|
216
|
+
deploy: (stack, callOpts) =>
|
|
217
|
+
Core.deploy(options, stack, { ...callOpts, scope: sharedScope }),
|
|
218
|
+
destroy: (stack, callOpts) =>
|
|
219
|
+
Core.destroy(options, stack, { ...callOpts, scope: sharedScope }).pipe(
|
|
220
|
+
Effect.ensuring(closeScope),
|
|
221
|
+
),
|
|
186
222
|
};
|
|
187
223
|
};
|
package/src/Test/Core.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ConfigProvider } from "effect/ConfigProvider";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Option from "effect/Option";
|
|
5
|
+
import * as Scope from "effect/Scope";
|
|
5
6
|
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
6
7
|
|
|
7
8
|
import { AdoptPolicy } from "../AdoptPolicy.ts";
|
|
@@ -66,9 +67,7 @@ export const resolveDev = (options: { dev?: boolean }): boolean => {
|
|
|
66
67
|
const overrideAlchemyContext = (overrides: { dev: boolean }) =>
|
|
67
68
|
Layer.effect(
|
|
68
69
|
AlchemyContext,
|
|
69
|
-
AlchemyContext.
|
|
70
|
-
Effect.map((ctx) => ({ ...ctx, ...overrides })),
|
|
71
|
-
),
|
|
70
|
+
AlchemyContext.pipe(Effect.map((ctx) => ({ ...ctx, ...overrides }))),
|
|
72
71
|
);
|
|
73
72
|
|
|
74
73
|
export type TestEffect<A, Req = never> = StackEffect<A, any, Req>;
|
|
@@ -90,14 +89,22 @@ const alchemyLayer = Layer.mergeAll(LoggingCli, AlchemyContextLive);
|
|
|
90
89
|
* registry that the user's `providers` layer populates, the platform layers,
|
|
91
90
|
* and the configured state store. Adapters wrap this into runner-specific
|
|
92
91
|
* thunks (`bun.test` -> `runPromise`, `it.live` -> as-is).
|
|
92
|
+
*
|
|
93
|
+
* When `scope` is provided, scoped resources (like the Cloudflare dev
|
|
94
|
+
* sidecar) survive past this effect and are tied to the lifetime of the
|
|
95
|
+
* provided scope instead. The runner is responsible for closing it.
|
|
96
|
+
*
|
|
97
|
+
* When `scope` is omitted, the effect runs with `Effect.scoped` and any
|
|
98
|
+
* scoped resources are torn down as soon as it resolves.
|
|
93
99
|
*/
|
|
94
100
|
export const toEffect = <A>(
|
|
95
101
|
effect: TestEffect<A>,
|
|
96
102
|
options: MakeOptions,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
103
|
+
scope?: Scope.Scope,
|
|
104
|
+
): Effect.Effect<A, any, never> => {
|
|
105
|
+
const base = Effect.gen(function* () {
|
|
106
|
+
const cfg = yield* loadConfigProvider(Option.none());
|
|
107
|
+
const configProvider = withProfileOverride(cfg, options.profile);
|
|
101
108
|
return yield* effect.pipe(
|
|
102
109
|
provideFreshArtifactStore,
|
|
103
110
|
Effect.provide(Layer.succeed(ConfigProvider, configProvider)),
|
|
@@ -112,14 +119,19 @@ export const toEffect = <A>(
|
|
|
112
119
|
Effect.provide(options.state ?? State.localState()),
|
|
113
120
|
Effect.provideService(AuthProviders, {}),
|
|
114
121
|
Effect.provide(Layer.provideMerge(alchemyLayer, platformLayer)),
|
|
115
|
-
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
scope === undefined ? Effect.scoped(base) : Scope.provide(base, scope)
|
|
116
126
|
) as Effect.Effect<A, any, never>;
|
|
127
|
+
};
|
|
117
128
|
|
|
118
129
|
/** Promise wrapper around {@link toEffect} for `bun.test`-style runners. */
|
|
119
130
|
export const run = <A>(
|
|
120
131
|
effect: TestEffect<A>,
|
|
121
132
|
options: MakeOptions,
|
|
122
|
-
|
|
133
|
+
scope?: Scope.Scope,
|
|
134
|
+
): Promise<A> => Effect.runPromise(toEffect(effect, options, scope));
|
|
123
135
|
|
|
124
136
|
/**
|
|
125
137
|
* Wrap an effect so it runs with `options.providers` + a placeholder Stack +
|
|
@@ -139,6 +151,7 @@ export const withProviders = <A, E, R, ROut>(
|
|
|
139
151
|
stage: options.stage ?? "test",
|
|
140
152
|
resources: {},
|
|
141
153
|
bindings: {},
|
|
154
|
+
actions: {},
|
|
142
155
|
}),
|
|
143
156
|
),
|
|
144
157
|
Effect.provide(Layer.succeed(Stage, options.stage ?? "test")),
|
|
@@ -148,27 +161,34 @@ export const withProviders = <A, E, R, ROut>(
|
|
|
148
161
|
* Curried `deploy` for the test factory: bakes in the configured stage and
|
|
149
162
|
* adds the telemetry layer the CLI uses, so `beforeAll(deploy(Stack))` works
|
|
150
163
|
* the same way as `alchemy deploy`.
|
|
164
|
+
*
|
|
165
|
+
* `scope`, when supplied, is forwarded down so the dev sidecar (and other
|
|
166
|
+
* scoped resources) lives until the caller closes it instead of dying as
|
|
167
|
+
* soon as `deploy` resolves. The test harness uses this to keep workerd
|
|
168
|
+
* alive across `beforeAll` → tests → `afterAll`.
|
|
151
169
|
*/
|
|
152
170
|
export const deploy = <A>(
|
|
153
171
|
options: MakeOptions,
|
|
154
172
|
stack: TestEffect<CompiledStack<A>, Stage | AlchemyContext>,
|
|
155
|
-
callOptions?: { stage?: string },
|
|
173
|
+
callOptions?: { stage?: string; scope?: Scope.Scope },
|
|
156
174
|
) =>
|
|
157
175
|
_deploy({
|
|
158
176
|
stack: stack as Effect.Effect<CompiledStack<A>, never, any>,
|
|
159
177
|
stage: callOptions?.stage ?? options.stage ?? "test",
|
|
160
178
|
dev: resolveDev(options),
|
|
179
|
+
scope: callOptions?.scope,
|
|
161
180
|
}).pipe(Effect.provide(TelemetryLive));
|
|
162
181
|
|
|
163
182
|
export const destroy = (
|
|
164
183
|
options: MakeOptions,
|
|
165
184
|
stack: TestEffect<CompiledStack, Stage | AlchemyContext>,
|
|
166
|
-
callOptions?: { stage?: string },
|
|
185
|
+
callOptions?: { stage?: string; scope?: Scope.Scope },
|
|
167
186
|
) =>
|
|
168
187
|
_destroy({
|
|
169
188
|
stack: stack as Effect.Effect<CompiledStack, never, any>,
|
|
170
189
|
stage: callOptions?.stage ?? options.stage ?? "test",
|
|
171
190
|
dev: resolveDev(options),
|
|
191
|
+
scope: callOptions?.scope,
|
|
172
192
|
}).pipe(Effect.provide(TelemetryLive));
|
|
173
193
|
|
|
174
194
|
/**
|
|
@@ -241,6 +261,7 @@ export const scratchStack = <ROut>(
|
|
|
241
261
|
stage,
|
|
242
262
|
resources: {},
|
|
243
263
|
bindings: {},
|
|
264
|
+
actions: {},
|
|
244
265
|
output: {},
|
|
245
266
|
}).pipe(
|
|
246
267
|
Effect.flatMap(apply),
|
|
@@ -253,6 +274,7 @@ export const scratchStack = <ROut>(
|
|
|
253
274
|
stage,
|
|
254
275
|
resources: {},
|
|
255
276
|
bindings: {},
|
|
277
|
+
actions: {},
|
|
256
278
|
}),
|
|
257
279
|
),
|
|
258
280
|
Effect.provide(Layer.succeed(Stage, stage)),
|
package/src/Test/Vitest.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { it } from "@effect/vitest";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Exit from "effect/Exit";
|
|
4
|
+
import * as Scope from "effect/Scope";
|
|
3
5
|
import {
|
|
4
6
|
afterAll as vitestAfterAll,
|
|
5
7
|
afterEach as vitestAfterEach,
|
|
@@ -98,8 +100,13 @@ const DEFAULT_TIMEOUT = 120_000;
|
|
|
98
100
|
* Effect-aware tests stay first-class.
|
|
99
101
|
*/
|
|
100
102
|
export const make = <ROut = any>(options: MakeOptions<ROut>): TestApi => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
// See `Test/Bun.ts` for the rationale: the dev sidecar must outlive a
|
|
104
|
+
// single `runPromise` boundary, so all hooks share one scope that's only
|
|
105
|
+
// closed after `destroy(...)` runs.
|
|
106
|
+
const sharedScope = Scope.makeUnsafe("sequential");
|
|
107
|
+
const wrap = <A>(eff: TestEffect<A>) =>
|
|
108
|
+
Core.toEffect(eff, options, sharedScope);
|
|
109
|
+
const runEff = <A>(eff: TestEffect<A>) => Core.run(eff, options, sharedScope);
|
|
103
110
|
|
|
104
111
|
const test = ((name, eff, opts) => {
|
|
105
112
|
it.live(name, () => wrap(eff), timeoutOf(opts));
|
|
@@ -130,6 +137,7 @@ export const make = <ROut = any>(options: MakeOptions<ROut>): TestApi => {
|
|
|
130
137
|
return Core.toEffect(
|
|
131
138
|
Core.withProviders(fn(scratch), options, scratch.name),
|
|
132
139
|
{ ...options, state: scratch.state },
|
|
140
|
+
sharedScope,
|
|
133
141
|
);
|
|
134
142
|
};
|
|
135
143
|
|
|
@@ -182,13 +190,34 @@ export const make = <ROut = any>(options: MakeOptions<ROut>): TestApi => {
|
|
|
182
190
|
vitestAfterEach(() => runEff(eff), timeoutOf(hookOptions));
|
|
183
191
|
};
|
|
184
192
|
|
|
193
|
+
// `destroy(Stack)` needs the dev sidecar alive so it can call `sidecar.stop`.
|
|
194
|
+
// `Scope.close` on an already-closed scope is a no-op, so the destroy
|
|
195
|
+
// wrapper AND the fallback cleanup hook below can both call it safely.
|
|
196
|
+
const closeScope = Effect.suspend(() =>
|
|
197
|
+
Scope.close(sharedScope, Exit.void),
|
|
198
|
+
).pipe(Effect.ignore);
|
|
199
|
+
|
|
200
|
+
// Fallback cleanup: if the user never calls `destroy(Stack)` (e.g.
|
|
201
|
+
// `NO_DESTROY=1`), nothing else closes the shared scope and the sidecar
|
|
202
|
+
// child process leaks past the test process. Register an `afterAll` that
|
|
203
|
+
// closes it. We defer registration to a microtask so it runs AFTER any
|
|
204
|
+
// user-registered `afterAll` (including `destroy(Stack)`); vitest runs
|
|
205
|
+
// afterAll hooks in registration order.
|
|
206
|
+
queueMicrotask(() => {
|
|
207
|
+
vitestAfterAll(() => Effect.runPromise(closeScope), DEFAULT_TIMEOUT);
|
|
208
|
+
});
|
|
209
|
+
|
|
185
210
|
return {
|
|
186
211
|
test,
|
|
187
212
|
beforeAll,
|
|
188
213
|
beforeEach,
|
|
189
214
|
afterAll,
|
|
190
215
|
afterEach,
|
|
191
|
-
deploy: (stack, callOpts) =>
|
|
192
|
-
|
|
216
|
+
deploy: (stack, callOpts) =>
|
|
217
|
+
Core.deploy(options, stack, { ...callOpts, scope: sharedScope }),
|
|
218
|
+
destroy: (stack, callOpts) =>
|
|
219
|
+
Core.destroy(options, stack, { ...callOpts, scope: sharedScope }).pipe(
|
|
220
|
+
Effect.ensuring(closeScope),
|
|
221
|
+
),
|
|
193
222
|
};
|
|
194
223
|
};
|
package/src/Util/LocalhostDns.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Process-level DNS shim that makes `*.localhost` resolve to 127.0.0.1
|
|
2
|
+
* Process-level DNS shim that makes `*.localhost` resolve to 127.0.0.1
|
|
3
|
+
* for any HTTP client that goes through undici (Node's global `fetch`,
|
|
4
|
+
* undici-based clients, etc.).
|
|
3
5
|
*
|
|
4
6
|
* Background: macOS's `getaddrinfo` does not honor RFC 6761 for arbitrary
|
|
5
|
-
* `*.localhost` names
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `*.localhost` names — only the bare `localhost` is mapped to loopback.
|
|
8
|
+
* The Cloudflare local proxy returns URLs like
|
|
9
|
+
* `http://my-worker.localhost:1337` and dispatches by the URL hostname,
|
|
10
|
+
* so we cannot rewrite the URL client-side to `127.0.0.1` (and `Host` is
|
|
11
|
+
* a forbidden fetch header). The fix is to make the host resolvable at
|
|
12
|
+
* the network layer.
|
|
10
13
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* On Bun, `globalThis.fetch` is the native (Zig) implementation and does
|
|
15
|
+
* not consult undici's global dispatcher; Bun resolves `*.localhost`
|
|
16
|
+
* itself on Darwin/Linux, so this shim is effectively a no-op there for
|
|
17
|
+
* the global `fetch` and only matters if user code reaches for `undici`
|
|
18
|
+
* directly.
|
|
15
19
|
*
|
|
16
20
|
* Calling `installLocalhostDns()` is idempotent.
|
|
17
21
|
*/
|
|
18
22
|
|
|
19
|
-
import
|
|
23
|
+
import * as dns from "node:dns";
|
|
24
|
+
import * as undici from "undici";
|
|
20
25
|
|
|
21
26
|
let installed = false;
|
|
22
27
|
|
|
@@ -28,31 +33,20 @@ const isLocalhost = (hostname: string): boolean =>
|
|
|
28
33
|
export const installLocalhostDns = (): void => {
|
|
29
34
|
if (installed) return;
|
|
30
35
|
installed = true;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const dns: typeof import("node:dns") = require("node:dns");
|
|
40
|
-
undici.setGlobalDispatcher(
|
|
41
|
-
new undici.Agent({
|
|
42
|
-
connect: {
|
|
43
|
-
lookup: (hostname, options, cb: any) => {
|
|
44
|
-
if (isLocalhost(hostname)) {
|
|
45
|
-
if (options && (options as { all?: boolean }).all) {
|
|
46
|
-
return cb(null, [{ address: "127.0.0.1", family: 4 }]);
|
|
47
|
-
}
|
|
48
|
-
return cb(null, "127.0.0.1", 4);
|
|
36
|
+
|
|
37
|
+
undici.setGlobalDispatcher(
|
|
38
|
+
new undici.Agent({
|
|
39
|
+
connect: {
|
|
40
|
+
lookup: (hostname, options, cb) => {
|
|
41
|
+
if (isLocalhost(hostname)) {
|
|
42
|
+
if (options && (options as { all?: boolean }).all) {
|
|
43
|
+
return cb(null, [{ address: "127.0.0.1", family: 4 }]);
|
|
49
44
|
}
|
|
50
|
-
return
|
|
51
|
-
}
|
|
45
|
+
return cb(null, "127.0.0.1", 4);
|
|
46
|
+
}
|
|
47
|
+
return dns.lookup(hostname, options, cb);
|
|
52
48
|
},
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
// undici not available; nothing to do.
|
|
57
|
-
}
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
58
52
|
};
|
package/src/Util/effect.ts
CHANGED
|
@@ -27,10 +27,10 @@ export const effectClass: {
|
|
|
27
27
|
return impl;
|
|
28
28
|
}
|
|
29
29
|
static [Symbol.iterator]() {
|
|
30
|
-
return new SingleShotGen(this);
|
|
30
|
+
return new SingleShotGen(this.asEffect());
|
|
31
31
|
}
|
|
32
32
|
static pipe(...fns: any) {
|
|
33
|
-
return pipeArguments(this
|
|
33
|
+
return pipeArguments(this, fns);
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
impl,
|
|
@@ -44,9 +44,9 @@ export const taggedFunction = <
|
|
|
44
44
|
fn: Fn,
|
|
45
45
|
): Tag & Fn => {
|
|
46
46
|
const overrides = {
|
|
47
|
-
asEffect: () => tag
|
|
47
|
+
asEffect: () => tag,
|
|
48
48
|
[Symbol.iterator]: () => tag[Symbol.iterator](),
|
|
49
|
-
pipe: (...fns: any[]) => pipeArguments(tag
|
|
49
|
+
pipe: (...fns: any[]) => pipeArguments(tag, fns as any),
|
|
50
50
|
toString: () => `${tag.toString()}.${fn.name}`,
|
|
51
51
|
};
|
|
52
52
|
|
|
@@ -64,6 +64,31 @@ export const taggedFunction = <
|
|
|
64
64
|
}) as Tag & Fn;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
export const isYieldableEffect = (
|
|
68
|
+
value: unknown,
|
|
69
|
+
): value is Effect.Effect<unknown, unknown, unknown> =>
|
|
70
|
+
Effect.isEffect(value) &&
|
|
71
|
+
typeof (value as { [Symbol.iterator]?: unknown })[Symbol.iterator] ===
|
|
72
|
+
"function";
|
|
73
|
+
|
|
74
|
+
export type YieldableEffectLike<A = unknown, E = unknown, R = unknown> =
|
|
75
|
+
| Effect.Effect<A, E, R>
|
|
76
|
+
| {
|
|
77
|
+
asEffect: () => Effect.Effect<A, E, R>;
|
|
78
|
+
[Symbol.iterator]: () => Iterator<unknown>;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const isEffectClassLike = (
|
|
82
|
+
value: unknown,
|
|
83
|
+
): value is YieldableEffectLike =>
|
|
84
|
+
typeof value === "function" &&
|
|
85
|
+
typeof (value as { asEffect?: unknown }).asEffect === "function";
|
|
86
|
+
|
|
87
|
+
export const isYieldableEffectLike = (
|
|
88
|
+
value: unknown,
|
|
89
|
+
): value is YieldableEffectLike =>
|
|
90
|
+
isYieldableEffect(value) || isEffectClassLike(value);
|
|
91
|
+
|
|
67
92
|
export type UnwrapEffect<T> =
|
|
68
93
|
T extends Effect.Effect<infer A, any, any> ? A : T;
|
|
69
94
|
|
package/src/Util/hash.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Stable hash of a resolved Task input. Wrapped in `Effect.sync` so the
|
|
6
|
+
* call participates in the Effect runtime (tracing/interruption) per the
|
|
7
|
+
* Effect-platform conventions.
|
|
8
|
+
*/
|
|
9
|
+
export const hashInput = (input: unknown): Effect.Effect<string> =>
|
|
10
|
+
Effect.sync(() =>
|
|
11
|
+
createHash("sha256")
|
|
12
|
+
.update(JSON.stringify(input ?? null))
|
|
13
|
+
.digest("hex"),
|
|
14
|
+
);
|