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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Binding from "../../Binding.ts";
|
|
5
|
+
import type { ResourceLike } from "../../Resource.ts";
|
|
6
|
+
import { isWorker, WorkerEnvironment } from "../Workers/Worker.ts";
|
|
7
|
+
import type { AnalyticsEngineDataset as AnalyticsEngineDatasetLike } from "./AnalyticsEngineDataset.ts";
|
|
8
|
+
|
|
9
|
+
export interface AnalyticsEngineDataPoint {
|
|
10
|
+
indexes?: string[];
|
|
11
|
+
blobs?: string[];
|
|
12
|
+
doubles?: number[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface RuntimeAnalyticsEngineDataset {
|
|
16
|
+
writeDataPoint(dataPoint: AnalyticsEngineDataPoint): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class AnalyticsEngineDatasetError extends Data.TaggedError(
|
|
20
|
+
"AnalyticsEngineDatasetError",
|
|
21
|
+
)<{
|
|
22
|
+
message: string;
|
|
23
|
+
cause: Error;
|
|
24
|
+
}> {}
|
|
25
|
+
|
|
26
|
+
export interface AnalyticsEngineDatasetClient {
|
|
27
|
+
raw: Effect.Effect<RuntimeAnalyticsEngineDataset, never, WorkerEnvironment>;
|
|
28
|
+
writeDataPoint(
|
|
29
|
+
dataPoint: AnalyticsEngineDataPoint,
|
|
30
|
+
): Effect.Effect<void, AnalyticsEngineDatasetError, WorkerEnvironment>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class AnalyticsEngineDatasetBinding extends Binding.Service<
|
|
34
|
+
AnalyticsEngineDatasetBinding,
|
|
35
|
+
(
|
|
36
|
+
dataset: AnalyticsEngineDatasetLike,
|
|
37
|
+
) => Effect.Effect<AnalyticsEngineDatasetClient>
|
|
38
|
+
>()("Cloudflare.AnalyticsEngineDataset.Binding") {}
|
|
39
|
+
|
|
40
|
+
export const AnalyticsEngineDatasetBindingLive = Layer.effect(
|
|
41
|
+
AnalyticsEngineDatasetBinding,
|
|
42
|
+
Effect.gen(function* () {
|
|
43
|
+
const bind = yield* AnalyticsEngineDatasetBindingPolicy;
|
|
44
|
+
|
|
45
|
+
return Effect.fnUntraced(function* (dataset: AnalyticsEngineDatasetLike) {
|
|
46
|
+
yield* bind(dataset);
|
|
47
|
+
|
|
48
|
+
const raw = WorkerEnvironment.pipe(
|
|
49
|
+
Effect.map(
|
|
50
|
+
(env) =>
|
|
51
|
+
(env as Record<string, RuntimeAnalyticsEngineDataset>)[
|
|
52
|
+
dataset.name
|
|
53
|
+
]!,
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
raw,
|
|
59
|
+
writeDataPoint: (dataPoint) =>
|
|
60
|
+
raw.pipe(
|
|
61
|
+
Effect.flatMap((raw) =>
|
|
62
|
+
Effect.try({
|
|
63
|
+
try: () => raw.writeDataPoint(dataPoint),
|
|
64
|
+
catch: (error: any) =>
|
|
65
|
+
new AnalyticsEngineDatasetError({
|
|
66
|
+
message: error?.message ?? "Unknown error",
|
|
67
|
+
cause: error,
|
|
68
|
+
}),
|
|
69
|
+
}),
|
|
70
|
+
),
|
|
71
|
+
),
|
|
72
|
+
} satisfies AnalyticsEngineDatasetClient;
|
|
73
|
+
});
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
export class AnalyticsEngineDatasetBindingPolicy extends Binding.Policy<
|
|
78
|
+
AnalyticsEngineDatasetBindingPolicy,
|
|
79
|
+
(dataset: AnalyticsEngineDatasetLike) => Effect.Effect<void>
|
|
80
|
+
>()("Cloudflare.AnalyticsEngineDataset.Binding") {}
|
|
81
|
+
|
|
82
|
+
export const AnalyticsEngineDatasetBindingPolicyLive =
|
|
83
|
+
AnalyticsEngineDatasetBindingPolicy.layer.succeed(
|
|
84
|
+
Effect.fnUntraced(function* (
|
|
85
|
+
host: ResourceLike,
|
|
86
|
+
dataset: AnalyticsEngineDatasetLike,
|
|
87
|
+
) {
|
|
88
|
+
if (isWorker(host)) {
|
|
89
|
+
yield* host.bind(dataset.name, {
|
|
90
|
+
bindings: [
|
|
91
|
+
{
|
|
92
|
+
type: "analytics_engine",
|
|
93
|
+
name: dataset.name,
|
|
94
|
+
dataset: dataset.dataset,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
return yield* Effect.die(
|
|
100
|
+
new Error(
|
|
101
|
+
`AnalyticsEngineDatasetBinding does not support runtime '${host.Type}'`,
|
|
102
|
+
),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
);
|
|
@@ -106,7 +106,7 @@ export const ArtifactsBindingLive = Layer.effect(
|
|
|
106
106
|
|
|
107
107
|
return Effect.fn(function* (artifacts: ArtifactsLike) {
|
|
108
108
|
yield* Policy(artifacts);
|
|
109
|
-
const env = WorkerEnvironment
|
|
109
|
+
const env = WorkerEnvironment;
|
|
110
110
|
const raw = env.pipe(
|
|
111
111
|
Effect.map(
|
|
112
112
|
(env) => (env as Record<string, Artifacts>)[artifacts.name]!,
|
|
@@ -532,6 +532,7 @@ const HttpServer = NodeHttpServer;
|
|
|
532
532
|
`
|
|
533
533
|
}
|
|
534
534
|
import { Stack } from "alchemy/Stack";
|
|
535
|
+
import { makeEntrypointLayer } from "alchemy/Runtime";
|
|
535
536
|
import * as Effect from "effect/Effect";
|
|
536
537
|
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
537
538
|
import * as Layer from "effect/Layer";
|
|
@@ -539,13 +540,10 @@ import * as Logger from "effect/Logger";
|
|
|
539
540
|
import * as Context from "effect/Context";
|
|
540
541
|
import { MinimumLogLevel } from "effect/References";
|
|
541
542
|
|
|
542
|
-
import ${handler === "default" ? "
|
|
543
|
+
import ${handler === "default" ? "entrypoint" : `{ ${handler} as entrypoint }`} from "${importPath}";
|
|
543
544
|
|
|
544
545
|
const tag = Context.Service("${Self.key}")
|
|
545
|
-
const layer =
|
|
546
|
-
typeof entry?.build === "function"
|
|
547
|
-
? entry
|
|
548
|
-
: Layer.effect(tag, typeof entry?.asEffect === "function" ? entry.asEffect() : entry);
|
|
546
|
+
const layer = makeEntrypointLayer(tag, entrypoint);
|
|
549
547
|
|
|
550
548
|
const platform = Layer.mergeAll(
|
|
551
549
|
${runtime === "bun" ? "BunServices.layer" : "NodeServices.layer"},
|
|
@@ -561,7 +559,7 @@ const stack = Layer.succeed(Stack, {
|
|
|
561
559
|
resources: {}
|
|
562
560
|
});
|
|
563
561
|
|
|
564
|
-
const serverEffect = tag.
|
|
562
|
+
const serverEffect = tag.pipe(
|
|
565
563
|
Effect.flatMap(func => func.RuntimeContext.exports),
|
|
566
564
|
Effect.flatMap(exports => exports.default),
|
|
567
565
|
Effect.provide(
|
|
@@ -16,11 +16,11 @@ export const bindContainer = Effect.fnUntraced(function* <Shape, Req = never>(
|
|
|
16
16
|
| (ContainerApplication & Rpc<Shape>)
|
|
17
17
|
| Effect.Effect<ContainerApplication & Rpc<Shape>, never, Req>,
|
|
18
18
|
) {
|
|
19
|
-
const namespace = yield* DurableObjectNamespace
|
|
19
|
+
const namespace = yield* DurableObjectNamespace;
|
|
20
20
|
|
|
21
21
|
const container =
|
|
22
22
|
"asEffect" in containerEff
|
|
23
|
-
? yield*
|
|
23
|
+
? yield* containerEff as any as Effect.Effect<
|
|
24
24
|
ContainerApplication & Rpc<Shape>
|
|
25
25
|
>
|
|
26
26
|
: Effect.isEffect(containerEff)
|
|
@@ -7,6 +7,86 @@ import { WorkerEnvironment } from "../Workers/Worker.ts";
|
|
|
7
7
|
import type { D1Database } from "./D1Database.ts";
|
|
8
8
|
import { DatabaseBinding } from "./D1DatabaseBinding.ts";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Effect-native wrapper around a Cloudflare D1 prepared statement.
|
|
12
|
+
*
|
|
13
|
+
* Construction (`prepare`) and binding (`bind`) are synchronous —
|
|
14
|
+
* they're plan builders and don't touch D1. Only the executors
|
|
15
|
+
* (`all`, `first`, `run`, `raw`) round-trip to the database, and
|
|
16
|
+
* those return Effects so they participate in the Effect runtime.
|
|
17
|
+
*/
|
|
18
|
+
export class D1PreparedStatement {
|
|
19
|
+
/** @internal */
|
|
20
|
+
constructor(
|
|
21
|
+
private readonly query: string,
|
|
22
|
+
private readonly binds: ReadonlyArray<unknown>,
|
|
23
|
+
private readonly rawEff: Effect.Effect<runtime.D1Database>,
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Return a new prepared statement bound to `values`. Subsequent
|
|
28
|
+
* calls replace the previous binding, matching the underlying
|
|
29
|
+
* Cloudflare runtime semantics.
|
|
30
|
+
*/
|
|
31
|
+
bind(...values: unknown[]): D1PreparedStatement {
|
|
32
|
+
return new D1PreparedStatement(this.query, values, this.rawEff);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Run the query and return all matching rows. */
|
|
36
|
+
all<T = unknown>(): Effect.Effect<runtime.D1Result<T>> {
|
|
37
|
+
return this.withRuntime((stmt) => stmt.all<T>());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Run the query and return the first row, or `null` if no rows. */
|
|
41
|
+
first<T = unknown>(): Effect.Effect<T | null>;
|
|
42
|
+
first<T = unknown>(column: string): Effect.Effect<T | null>;
|
|
43
|
+
first<T = unknown>(column?: string): Effect.Effect<T | null> {
|
|
44
|
+
return this.withRuntime((stmt) =>
|
|
45
|
+
column !== undefined ? stmt.first<T>(column) : stmt.first<T>(),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Run the query as a mutation; returns row metadata. */
|
|
50
|
+
run<T = unknown>(): Effect.Effect<runtime.D1Result<T>> {
|
|
51
|
+
return this.withRuntime((stmt) => stmt.run<T>());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Run the query and return rows as flat arrays. */
|
|
55
|
+
raw<T = unknown[]>(): Effect.Effect<T[]>;
|
|
56
|
+
raw<T = unknown[]>(options: {
|
|
57
|
+
columnNames: true;
|
|
58
|
+
}): Effect.Effect<[string[], ...T[]]>;
|
|
59
|
+
raw<T = unknown[]>(options?: {
|
|
60
|
+
columnNames: true;
|
|
61
|
+
}): Effect.Effect<T[] | [string[], ...T[]]> {
|
|
62
|
+
return this.withRuntime((stmt) =>
|
|
63
|
+
options
|
|
64
|
+
? stmt.raw<T>(options)
|
|
65
|
+
: (stmt.raw<T>() as Promise<T[] | [string[], ...T[]]>),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Materialize the underlying Cloudflare prepared statement against
|
|
71
|
+
* a concrete D1 binding. Used by `D1ConnectionClient.batch` to
|
|
72
|
+
* collect statements for a single transactional call.
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
_build(raw: runtime.D1Database): runtime.D1PreparedStatement {
|
|
77
|
+
const stmt = raw.prepare(this.query);
|
|
78
|
+
return this.binds.length > 0 ? stmt.bind(...this.binds) : stmt;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private withRuntime<A>(
|
|
82
|
+
fn: (stmt: runtime.D1PreparedStatement) => Promise<A>,
|
|
83
|
+
): Effect.Effect<A> {
|
|
84
|
+
return Effect.flatMap(this.rawEff, (raw) =>
|
|
85
|
+
Effect.promise(() => fn(this._build(raw))),
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
10
90
|
export interface D1ConnectionClient {
|
|
11
91
|
/**
|
|
12
92
|
* An Effect that resolves to the raw underlying Cloudflare D1Database binding.
|
|
@@ -14,9 +94,11 @@ export interface D1ConnectionClient {
|
|
|
14
94
|
*/
|
|
15
95
|
raw: Effect.Effect<runtime.D1Database>;
|
|
16
96
|
/**
|
|
17
|
-
* Prepare a SQL
|
|
97
|
+
* Prepare a SQL statement. Returns synchronously — the network
|
|
98
|
+
* round-trip happens when you yield one of the statement's
|
|
99
|
+
* executors (`all`, `first`, `run`, `raw`).
|
|
18
100
|
*/
|
|
19
|
-
prepare: (query: string) =>
|
|
101
|
+
prepare: (query: string) => D1PreparedStatement;
|
|
20
102
|
/**
|
|
21
103
|
* Execute raw SQL without prepared statements.
|
|
22
104
|
*/
|
|
@@ -26,7 +108,7 @@ export interface D1ConnectionClient {
|
|
|
26
108
|
* Statements execute sequentially and are rolled back on failure.
|
|
27
109
|
*/
|
|
28
110
|
batch: <T = unknown>(
|
|
29
|
-
statements:
|
|
111
|
+
statements: D1PreparedStatement[],
|
|
30
112
|
) => Effect.Effect<runtime.D1Result<T>[]>;
|
|
31
113
|
}
|
|
32
114
|
|
|
@@ -42,22 +124,23 @@ export const D1ConnectionLive = Layer.effect(
|
|
|
42
124
|
|
|
43
125
|
return Effect.fn(function* (database: D1Database) {
|
|
44
126
|
yield* Policy(database);
|
|
45
|
-
const
|
|
127
|
+
const rawEff = yield* Effect.serviceOption(WorkerEnvironment).pipe(
|
|
46
128
|
Effect.map(Option.getOrUndefined),
|
|
47
129
|
Effect.map((env) => env?.[database.LogicalId]! as runtime.D1Database),
|
|
48
130
|
Effect.cached,
|
|
49
131
|
);
|
|
50
132
|
|
|
51
133
|
return {
|
|
52
|
-
raw:
|
|
53
|
-
prepare: (query: string) =>
|
|
54
|
-
d1.pipe(Effect.map((d1) => d1.prepare(query))),
|
|
134
|
+
raw: rawEff,
|
|
135
|
+
prepare: (query: string) => new D1PreparedStatement(query, [], rawEff),
|
|
55
136
|
exec: (query: string) =>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
137
|
+
Effect.flatMap(rawEff, (raw) =>
|
|
138
|
+
Effect.promise(() => raw.exec(query)),
|
|
139
|
+
),
|
|
140
|
+
batch: <T = unknown>(statements: D1PreparedStatement[]) =>
|
|
141
|
+
Effect.flatMap(rawEff, (raw) =>
|
|
142
|
+
Effect.promise(() =>
|
|
143
|
+
raw.batch<T>(statements.map((s) => s._build(raw))),
|
|
61
144
|
),
|
|
62
145
|
),
|
|
63
146
|
} satisfies D1ConnectionClient;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as emailRouting from "@distilled.cloud/cloudflare/email-routing";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { isResolved } from "../../Diff.ts";
|
|
4
|
+
import * as Provider from "../../Provider.ts";
|
|
5
|
+
import { Resource } from "../../Resource.ts";
|
|
6
|
+
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
7
|
+
import type { Providers } from "../Providers.ts";
|
|
8
|
+
|
|
9
|
+
export type EmailAddressProps = {
|
|
10
|
+
/**
|
|
11
|
+
* The email address to register as a verified destination on the
|
|
12
|
+
* account. Cloudflare sends a verification email to this address; the
|
|
13
|
+
* recipient must click the link before the address can receive routed
|
|
14
|
+
* mail or be used as a verified sender.
|
|
15
|
+
*
|
|
16
|
+
* Changing this property triggers a replacement.
|
|
17
|
+
*/
|
|
18
|
+
email: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type EmailAddress = Resource<
|
|
22
|
+
"Cloudflare.EmailAddress",
|
|
23
|
+
EmailAddressProps,
|
|
24
|
+
{
|
|
25
|
+
addressId: string;
|
|
26
|
+
email: string;
|
|
27
|
+
accountId: string;
|
|
28
|
+
verified: boolean;
|
|
29
|
+
verifiedAt: string | undefined;
|
|
30
|
+
created: string | undefined;
|
|
31
|
+
modified: string | undefined;
|
|
32
|
+
},
|
|
33
|
+
never,
|
|
34
|
+
Providers
|
|
35
|
+
>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A verified destination email address on the account.
|
|
39
|
+
*
|
|
40
|
+
* Destination addresses are account-scoped (not zone-scoped). They are used
|
|
41
|
+
* as forwarding targets in `EmailRule` actions and can also serve as the
|
|
42
|
+
* `destinationAddress` on a `send_email` Worker binding.
|
|
43
|
+
*
|
|
44
|
+
* @section Registering an Address
|
|
45
|
+
* @example Register a destination address
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const ops = yield* Cloudflare.EmailAddress("Ops", {
|
|
48
|
+
* email: "ops@example.com",
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* Cloudflare sends a verification email when the address is first created.
|
|
53
|
+
* The address must be verified before it can receive routed mail.
|
|
54
|
+
*/
|
|
55
|
+
export const EmailAddress = Resource<EmailAddress>("Cloudflare.EmailAddress");
|
|
56
|
+
|
|
57
|
+
const toAttrs = (
|
|
58
|
+
accountId: string,
|
|
59
|
+
result: {
|
|
60
|
+
id?: string | null;
|
|
61
|
+
email?: string | null;
|
|
62
|
+
verified?: string | null;
|
|
63
|
+
created?: string | null;
|
|
64
|
+
modified?: string | null;
|
|
65
|
+
},
|
|
66
|
+
) => ({
|
|
67
|
+
addressId: result.id ?? "",
|
|
68
|
+
email: result.email ?? "",
|
|
69
|
+
accountId,
|
|
70
|
+
verified: Boolean(result.verified),
|
|
71
|
+
verifiedAt: result.verified ?? undefined,
|
|
72
|
+
created: result.created ?? undefined,
|
|
73
|
+
modified: result.modified ?? undefined,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const EmailAddressProvider = () =>
|
|
77
|
+
Provider.effect(
|
|
78
|
+
EmailAddress,
|
|
79
|
+
Effect.gen(function* () {
|
|
80
|
+
const { accountId } = yield* CloudflareEnvironment;
|
|
81
|
+
const create = yield* emailRouting.createAddress;
|
|
82
|
+
const get = yield* emailRouting.getAddress;
|
|
83
|
+
const del = yield* emailRouting.deleteAddress;
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
stables: ["addressId", "accountId", "email"],
|
|
87
|
+
diff: Effect.fn(function* ({ news, output }) {
|
|
88
|
+
if (!output) return undefined;
|
|
89
|
+
if (output.accountId !== accountId) {
|
|
90
|
+
return { action: "replace" } as const;
|
|
91
|
+
}
|
|
92
|
+
if (!isResolved(news)) return undefined;
|
|
93
|
+
if (news.email !== output.email) {
|
|
94
|
+
return { action: "replace" } as const;
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
}),
|
|
98
|
+
read: Effect.fn(function* ({ output, olds }) {
|
|
99
|
+
const identifier =
|
|
100
|
+
output?.addressId ??
|
|
101
|
+
(olds?.email ? encodeURIComponent(olds.email) : undefined);
|
|
102
|
+
if (!identifier) return undefined;
|
|
103
|
+
const acct = output?.accountId ?? accountId;
|
|
104
|
+
return yield* get({
|
|
105
|
+
accountId: acct,
|
|
106
|
+
destinationAddressIdentifier: identifier,
|
|
107
|
+
}).pipe(
|
|
108
|
+
Effect.map((r) => toAttrs(acct, r)),
|
|
109
|
+
Effect.catch(() => Effect.succeed(undefined)),
|
|
110
|
+
);
|
|
111
|
+
}),
|
|
112
|
+
reconcile: Effect.fn(function* ({ news, output }) {
|
|
113
|
+
const acct = output?.accountId ?? accountId;
|
|
114
|
+
const email = news.email;
|
|
115
|
+
|
|
116
|
+
// Observe — by addressId if known, else by email lookup.
|
|
117
|
+
let observed: ReturnType<typeof toAttrs> | undefined =
|
|
118
|
+
output?.addressId
|
|
119
|
+
? yield* get({
|
|
120
|
+
accountId: acct,
|
|
121
|
+
destinationAddressIdentifier: output.addressId,
|
|
122
|
+
}).pipe(
|
|
123
|
+
Effect.map((r) => toAttrs(acct, r)),
|
|
124
|
+
Effect.catch(() => Effect.succeed(undefined)),
|
|
125
|
+
)
|
|
126
|
+
: undefined;
|
|
127
|
+
|
|
128
|
+
if (!observed) {
|
|
129
|
+
observed = yield* get({
|
|
130
|
+
accountId: acct,
|
|
131
|
+
destinationAddressIdentifier: encodeURIComponent(email),
|
|
132
|
+
}).pipe(
|
|
133
|
+
Effect.map((r) => toAttrs(acct, r)),
|
|
134
|
+
Effect.catch(() => Effect.succeed(undefined)),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Ensure — register the address if it doesn't already exist.
|
|
139
|
+
if (!observed) {
|
|
140
|
+
const created = yield* create({ accountId: acct, email });
|
|
141
|
+
observed = toAttrs(acct, created);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return observed;
|
|
145
|
+
}),
|
|
146
|
+
delete: Effect.fn(function* ({ output }) {
|
|
147
|
+
if (!output?.addressId) return;
|
|
148
|
+
yield* del({
|
|
149
|
+
accountId: output.accountId,
|
|
150
|
+
destinationAddressIdentifier: output.addressId,
|
|
151
|
+
}).pipe(Effect.catch(() => Effect.void));
|
|
152
|
+
}),
|
|
153
|
+
};
|
|
154
|
+
}),
|
|
155
|
+
);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as emailRouting from "@distilled.cloud/cloudflare/email-routing";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { isResolved } from "../../Diff.ts";
|
|
4
|
+
import * as Provider from "../../Provider.ts";
|
|
5
|
+
import { Resource } from "../../Resource.ts";
|
|
6
|
+
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
7
|
+
import type { Providers } from "../Providers.ts";
|
|
8
|
+
import { resolveZoneId, type ZoneReference } from "../Zone.ts";
|
|
9
|
+
|
|
10
|
+
export type EmailRoutingStatus =
|
|
11
|
+
| "ready"
|
|
12
|
+
| "unconfigured"
|
|
13
|
+
| "misconfigured"
|
|
14
|
+
| "misconfigured/locked"
|
|
15
|
+
| "unlocked";
|
|
16
|
+
|
|
17
|
+
export type EmailRoutingProps = {
|
|
18
|
+
/**
|
|
19
|
+
* Zone to enable email routing on. Accepts a zone id, a zone name
|
|
20
|
+
* (`example.com`), or a `{ zoneId, name? }` object.
|
|
21
|
+
*/
|
|
22
|
+
zone: ZoneReference;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to enable Email Routing on the zone.
|
|
25
|
+
*
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type EmailRouting = Resource<
|
|
32
|
+
"Cloudflare.EmailRouting",
|
|
33
|
+
EmailRoutingProps,
|
|
34
|
+
{
|
|
35
|
+
routingId: string;
|
|
36
|
+
zoneId: string;
|
|
37
|
+
name: string;
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
status: EmailRoutingStatus | undefined;
|
|
40
|
+
},
|
|
41
|
+
never,
|
|
42
|
+
Providers
|
|
43
|
+
>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Enables Cloudflare Email Routing on a zone. This is the prerequisite for
|
|
47
|
+
* receiving mail at any address on the domain and for sending email from a
|
|
48
|
+
* Worker via `send_email` bindings.
|
|
49
|
+
*
|
|
50
|
+
* @section Enabling Email Routing
|
|
51
|
+
* @example Enable on a zone you own
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const routing = yield* Cloudflare.EmailRouting("Routing", {
|
|
54
|
+
* zone: "example.com",
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export const EmailRouting = Resource<EmailRouting>("Cloudflare.EmailRouting");
|
|
59
|
+
|
|
60
|
+
export const EmailRoutingProvider = () =>
|
|
61
|
+
Provider.effect(
|
|
62
|
+
EmailRouting,
|
|
63
|
+
Effect.gen(function* () {
|
|
64
|
+
const { accountId } = yield* CloudflareEnvironment;
|
|
65
|
+
const enable = yield* emailRouting.enableEmailRouting;
|
|
66
|
+
const disable = yield* emailRouting.disableEmailRouting;
|
|
67
|
+
const get = yield* emailRouting.getEmailRouting;
|
|
68
|
+
|
|
69
|
+
const resolve = (zone: ZoneReference) =>
|
|
70
|
+
resolveZoneId({
|
|
71
|
+
accountId,
|
|
72
|
+
zone,
|
|
73
|
+
hostname: typeof zone === "string" ? zone : (zone.name ?? ""),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
stables: ["zoneId", "routingId"],
|
|
78
|
+
diff: Effect.fn(function* ({ news, output }) {
|
|
79
|
+
if (!output) return undefined;
|
|
80
|
+
if (!isResolved(news)) return undefined;
|
|
81
|
+
const zoneId = yield* resolve(news.zone);
|
|
82
|
+
if (zoneId !== output.zoneId) {
|
|
83
|
+
return { action: "replace" } as const;
|
|
84
|
+
}
|
|
85
|
+
if ((news.enabled ?? true) !== output.enabled) {
|
|
86
|
+
return { action: "update" } as const;
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}),
|
|
90
|
+
read: Effect.fn(function* ({ output }) {
|
|
91
|
+
if (!output?.zoneId) return undefined;
|
|
92
|
+
const result = yield* get({ zoneId: output.zoneId });
|
|
93
|
+
return {
|
|
94
|
+
routingId: result.id,
|
|
95
|
+
zoneId: output.zoneId,
|
|
96
|
+
name: result.name,
|
|
97
|
+
enabled: result.enabled,
|
|
98
|
+
status: (result.status ?? undefined) as
|
|
99
|
+
| EmailRoutingStatus
|
|
100
|
+
| undefined,
|
|
101
|
+
};
|
|
102
|
+
}),
|
|
103
|
+
reconcile: Effect.fn(function* ({ news, output }) {
|
|
104
|
+
const zoneId = output?.zoneId ?? (yield* resolve(news.zone));
|
|
105
|
+
const desired = news.enabled ?? true;
|
|
106
|
+
|
|
107
|
+
if (desired) {
|
|
108
|
+
const result = yield* enable({ zoneId, body: {} });
|
|
109
|
+
return {
|
|
110
|
+
routingId: result.id,
|
|
111
|
+
zoneId,
|
|
112
|
+
name: result.name,
|
|
113
|
+
enabled: result.enabled,
|
|
114
|
+
status: (result.status ?? undefined) as
|
|
115
|
+
| EmailRoutingStatus
|
|
116
|
+
| undefined,
|
|
117
|
+
};
|
|
118
|
+
} else {
|
|
119
|
+
const result = yield* disable({ zoneId, body: {} });
|
|
120
|
+
return {
|
|
121
|
+
routingId: result.id,
|
|
122
|
+
zoneId,
|
|
123
|
+
name: result.name,
|
|
124
|
+
enabled: result.enabled,
|
|
125
|
+
status: (result.status ?? undefined) as
|
|
126
|
+
| EmailRoutingStatus
|
|
127
|
+
| undefined,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
delete: Effect.fn(function* ({ output }) {
|
|
132
|
+
yield* disable({ zoneId: output.zoneId, body: {} }).pipe(
|
|
133
|
+
Effect.catch(() => Effect.void),
|
|
134
|
+
);
|
|
135
|
+
}),
|
|
136
|
+
};
|
|
137
|
+
}),
|
|
138
|
+
);
|