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,6 +2,7 @@ import type * as cf from "@cloudflare/workers-types";
|
|
|
2
2
|
import cloudflareVite from "@distilled.cloud/cloudflare-vite-plugin";
|
|
3
3
|
import * as workers from "@distilled.cloud/cloudflare/workers";
|
|
4
4
|
import * as zones from "@distilled.cloud/cloudflare/zones";
|
|
5
|
+
import * as Cause from "effect/Cause";
|
|
5
6
|
import * as Context from "effect/Context";
|
|
6
7
|
import * as Data from "effect/Data";
|
|
7
8
|
import * as Effect from "effect/Effect";
|
|
@@ -12,6 +13,7 @@ import * as Path from "effect/Path";
|
|
|
12
13
|
import * as Redacted from "effect/Redacted";
|
|
13
14
|
import * as Schedule from "effect/Schedule";
|
|
14
15
|
import * as Scope from "effect/Scope";
|
|
16
|
+
import * as Stream from "effect/Stream";
|
|
15
17
|
import { createRequire } from "node:module";
|
|
16
18
|
import path from "node:path";
|
|
17
19
|
import { pathToFileURL } from "node:url";
|
|
@@ -37,14 +39,18 @@ import * as Provider from "../../Provider.ts";
|
|
|
37
39
|
import { Resource, type ResourceBinding } from "../../Resource.ts";
|
|
38
40
|
import * as Serverless from "../../Serverless/index.ts";
|
|
39
41
|
import { Stack } from "../../Stack.ts";
|
|
42
|
+
import { isYieldableEffectLike } from "../../Util/effect.ts";
|
|
40
43
|
import type { AiGateway } from "../AiGateway/AiGateway.ts";
|
|
44
|
+
import {
|
|
45
|
+
isAnalyticsEngineDataset,
|
|
46
|
+
type AnalyticsEngineDataset,
|
|
47
|
+
} from "../AnalyticsEngine/AnalyticsEngineDataset.ts";
|
|
41
48
|
import {
|
|
42
49
|
isArtifacts as isArtifactsBinding,
|
|
43
50
|
type Artifacts as ArtifactsBinding,
|
|
44
51
|
} from "../Artifacts/Artifacts.ts";
|
|
45
52
|
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
46
53
|
import { D1Database } from "../D1/D1Database.ts";
|
|
47
|
-
import { fromCloudflareFetcher } from "../Fetcher.ts";
|
|
48
54
|
import type {
|
|
49
55
|
Hyperdrive,
|
|
50
56
|
HyperdriveDevOrigin,
|
|
@@ -76,7 +82,14 @@ import {
|
|
|
76
82
|
import { workersHttpHandler } from "./HttpServer.ts";
|
|
77
83
|
import { LocalWorkerProvider } from "./LocalWorkerProvider.ts";
|
|
78
84
|
import { Request } from "./Request.ts";
|
|
79
|
-
import {
|
|
85
|
+
import {
|
|
86
|
+
encodeRpcError,
|
|
87
|
+
ErrorTag,
|
|
88
|
+
makeRpcStub,
|
|
89
|
+
toRpcStream,
|
|
90
|
+
type RpcErrorEnvelope,
|
|
91
|
+
type RpcStreamEnvelope,
|
|
92
|
+
} from "./Rpc.ts";
|
|
80
93
|
import { WorkerBundle } from "./WorkerBundle.ts";
|
|
81
94
|
import { createWorkerName } from "./WorkerName.ts";
|
|
82
95
|
|
|
@@ -187,9 +200,11 @@ export type WorkerBindingResource =
|
|
|
187
200
|
| KVNamespace
|
|
188
201
|
| CloudflareQueue
|
|
189
202
|
| AiGateway
|
|
203
|
+
| AnalyticsEngineDataset
|
|
190
204
|
| ArtifactsBinding
|
|
191
205
|
| ImagesBinding
|
|
192
206
|
| Hyperdrive
|
|
207
|
+
| Worker
|
|
193
208
|
| DurableObjectNamespaceLike<any>;
|
|
194
209
|
|
|
195
210
|
export type WorkerBindings = {
|
|
@@ -280,6 +295,12 @@ export interface WorkerProps<
|
|
|
280
295
|
>;
|
|
281
296
|
exports?: string[];
|
|
282
297
|
bindings?: Bindings;
|
|
298
|
+
/**
|
|
299
|
+
* Cron expressions that trigger the Worker's scheduled handler.
|
|
300
|
+
*
|
|
301
|
+
* Pass an empty array to remove all Cron Triggers.
|
|
302
|
+
*/
|
|
303
|
+
crons?: string[];
|
|
283
304
|
/**
|
|
284
305
|
* One or more custom hostnames (e.g. `"app.example.com"`) to bind to this
|
|
285
306
|
* Worker. The Cloudflare Zone is inferred from the hostname — the zone must
|
|
@@ -318,6 +339,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
|
|
|
318
339
|
durableObjectNamespaces: Record<string, string>;
|
|
319
340
|
accountId: string;
|
|
320
341
|
domains: { hostname: string; id: string; zoneId: string }[];
|
|
342
|
+
crons: string[];
|
|
321
343
|
hash?: {
|
|
322
344
|
assets: string | undefined;
|
|
323
345
|
bundle: string | undefined;
|
|
@@ -327,6 +349,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
|
|
|
327
349
|
{
|
|
328
350
|
bindings?: WorkerBinding[];
|
|
329
351
|
containers?: { className: string }[];
|
|
352
|
+
crons?: string[];
|
|
330
353
|
hyperdrives?: Record<string, Required<HyperdriveDevOrigin>>;
|
|
331
354
|
},
|
|
332
355
|
Providers
|
|
@@ -725,8 +748,11 @@ export const Worker: Platform<
|
|
|
725
748
|
const bindingEff = props.bindings?.[bindingName] as
|
|
726
749
|
| WorkerBindingResource
|
|
727
750
|
| Effect.Effect<WorkerBindingResource>;
|
|
728
|
-
|
|
729
|
-
|
|
751
|
+
// Bindings can be passed as a plain resource value, an Effect that
|
|
752
|
+
// yields a resource, or an effect-class (e.g. a `Cloudflare.Worker`
|
|
753
|
+
// class). Resolve the yieldable forms before deriving binding metadata.
|
|
754
|
+
const binding = isYieldableEffectLike(bindingEff)
|
|
755
|
+
? ((yield* bindingEff as Effect.Effect<unknown>) as WorkerBindingResource)
|
|
730
756
|
: bindingEff;
|
|
731
757
|
|
|
732
758
|
const bindingMeta: InputProps<WorkerBinding> | undefined = isAssets(
|
|
@@ -747,56 +773,68 @@ export const Worker: Platform<
|
|
|
747
773
|
type: "images",
|
|
748
774
|
name: bindingName,
|
|
749
775
|
}
|
|
750
|
-
:
|
|
776
|
+
: isAnalyticsEngineDataset(binding)
|
|
751
777
|
? {
|
|
752
|
-
type: "
|
|
778
|
+
type: "analytics_engine",
|
|
753
779
|
name: bindingName,
|
|
754
|
-
|
|
780
|
+
dataset: binding.dataset,
|
|
755
781
|
}
|
|
756
|
-
: binding
|
|
782
|
+
: isDurableObjectNamespaceLike(binding)
|
|
757
783
|
? {
|
|
758
|
-
type: "
|
|
759
|
-
id: binding.databaseId,
|
|
784
|
+
type: "durable_object_namespace",
|
|
760
785
|
name: bindingName,
|
|
786
|
+
className: binding.className ?? binding.name,
|
|
761
787
|
}
|
|
762
|
-
: binding.Type === "Cloudflare.
|
|
788
|
+
: binding.Type === "Cloudflare.D1Database"
|
|
763
789
|
? {
|
|
764
|
-
type: "
|
|
790
|
+
type: "d1",
|
|
791
|
+
id: binding.databaseId,
|
|
765
792
|
name: bindingName,
|
|
766
|
-
bucketName: binding.bucketName,
|
|
767
|
-
jurisdiction: binding.jurisdiction.pipe(
|
|
768
|
-
Output.map((jurisdiction) =>
|
|
769
|
-
jurisdiction === "default"
|
|
770
|
-
? undefined
|
|
771
|
-
: jurisdiction,
|
|
772
|
-
),
|
|
773
|
-
),
|
|
774
793
|
}
|
|
775
|
-
: binding.Type === "Cloudflare.
|
|
794
|
+
: binding.Type === "Cloudflare.R2Bucket"
|
|
776
795
|
? {
|
|
777
|
-
type: "
|
|
796
|
+
type: "r2_bucket",
|
|
778
797
|
name: bindingName,
|
|
779
|
-
|
|
798
|
+
bucketName: binding.bucketName,
|
|
799
|
+
jurisdiction: binding.jurisdiction.pipe(
|
|
800
|
+
Output.map((jurisdiction) =>
|
|
801
|
+
jurisdiction === "default"
|
|
802
|
+
? undefined
|
|
803
|
+
: jurisdiction,
|
|
804
|
+
),
|
|
805
|
+
),
|
|
780
806
|
}
|
|
781
|
-
: binding.Type === "Cloudflare.
|
|
807
|
+
: binding.Type === "Cloudflare.KVNamespace"
|
|
782
808
|
? {
|
|
783
|
-
type: "
|
|
809
|
+
type: "kv_namespace",
|
|
784
810
|
name: bindingName,
|
|
785
|
-
|
|
811
|
+
namespaceId: binding.namespaceId,
|
|
786
812
|
}
|
|
787
|
-
: binding.Type === "Cloudflare.
|
|
813
|
+
: binding.Type === "Cloudflare.Queue"
|
|
788
814
|
? {
|
|
789
|
-
type: "
|
|
815
|
+
type: "queue",
|
|
790
816
|
name: bindingName,
|
|
817
|
+
queueName: binding.queueName,
|
|
791
818
|
}
|
|
792
|
-
: binding.Type === "Cloudflare.
|
|
819
|
+
: binding.Type === "Cloudflare.AiGateway"
|
|
793
820
|
? {
|
|
794
|
-
type: "
|
|
821
|
+
type: "ai",
|
|
795
822
|
name: bindingName,
|
|
796
|
-
id: binding.hyperdriveId,
|
|
797
823
|
}
|
|
798
|
-
:
|
|
799
|
-
|
|
824
|
+
: binding.Type === "Cloudflare.Hyperdrive"
|
|
825
|
+
? {
|
|
826
|
+
type: "hyperdrive",
|
|
827
|
+
name: bindingName,
|
|
828
|
+
id: binding.hyperdriveId,
|
|
829
|
+
}
|
|
830
|
+
: isWorker(binding)
|
|
831
|
+
? {
|
|
832
|
+
type: "service",
|
|
833
|
+
name: bindingName,
|
|
834
|
+
service: binding.workerName,
|
|
835
|
+
}
|
|
836
|
+
: // TODO(sam): handle others
|
|
837
|
+
undefined;
|
|
800
838
|
|
|
801
839
|
if (bindingMeta) {
|
|
802
840
|
yield* resource.bind`${bindingName}`({
|
|
@@ -812,6 +850,7 @@ export const Worker: Platform<
|
|
|
812
850
|
const listeners: Effect.Effect<Serverless.FunctionListener>[] = [];
|
|
813
851
|
const exports: Record<string, any> = {};
|
|
814
852
|
const env: Record<string, any> = {};
|
|
853
|
+
let userShape: Record<string, unknown> | undefined;
|
|
815
854
|
|
|
816
855
|
const ctx = {
|
|
817
856
|
Type: WorkerTypeId,
|
|
@@ -878,7 +917,14 @@ export const Worker: Platform<
|
|
|
878
917
|
}),
|
|
879
918
|
serve: <Req = never>(
|
|
880
919
|
handler: HttpEffect<Req> | Effect.Effect<HttpEffect<Req>>,
|
|
881
|
-
|
|
920
|
+
options?: { shape?: Record<string, unknown> },
|
|
921
|
+
) => {
|
|
922
|
+
// Capture the user's full default-export shape so `exports` can
|
|
923
|
+
// expose any non-handler methods on it as RPC methods on the
|
|
924
|
+
// deployed `WorkerEntrypoint` subclass — see `__rpc__` below.
|
|
925
|
+
if (options?.shape) userShape = options.shape;
|
|
926
|
+
return ctx.listen(workersHttpHandler(handler));
|
|
927
|
+
},
|
|
882
928
|
listen: ((
|
|
883
929
|
handler:
|
|
884
930
|
| Serverless.FunctionListener
|
|
@@ -898,6 +944,35 @@ export const Worker: Platform<
|
|
|
898
944
|
concurrency: "unbounded",
|
|
899
945
|
});
|
|
900
946
|
const services = yield* Effect.context();
|
|
947
|
+
|
|
948
|
+
// Provide the per-request runtime layer (services + `WorkerExecutionContext`
|
|
949
|
+
// + a fresh `ExecutionContext`/`Scope`) to a user effect, then run it.
|
|
950
|
+
// This is the bridge between Cloudflare's request-time callback and
|
|
951
|
+
// the user's Effect-native handler. Used by both the standard
|
|
952
|
+
// `handle()` dispatch (fetch/scheduled/…) and the per-RPC dispatchers
|
|
953
|
+
// below — keeping them on a single layer-provision path.
|
|
954
|
+
const runUserEffect = <A, E>(
|
|
955
|
+
eff: Effect.Effect<A, E>,
|
|
956
|
+
context: cf.ExecutionContext,
|
|
957
|
+
): Promise<Exit.Exit<A, E>> => {
|
|
958
|
+
const scope = Scope.makeUnsafe();
|
|
959
|
+
return eff
|
|
960
|
+
.pipe(
|
|
961
|
+
Effect.provideContext(services),
|
|
962
|
+
Scope.provide(scope),
|
|
963
|
+
Effect.provide(Layer.succeed(WorkerExecutionContext, context)),
|
|
964
|
+
Effect.provide(
|
|
965
|
+
Layer.succeed(ExecutionContext, { scope, cache: {} }),
|
|
966
|
+
),
|
|
967
|
+
Effect.runPromiseExit,
|
|
968
|
+
)
|
|
969
|
+
.finally(() =>
|
|
970
|
+
context.waitUntil(
|
|
971
|
+
Effect.runPromise(Scope.close(scope, Exit.void)),
|
|
972
|
+
),
|
|
973
|
+
);
|
|
974
|
+
};
|
|
975
|
+
|
|
901
976
|
const handle =
|
|
902
977
|
(type: WorkerEvent["type"]) =>
|
|
903
978
|
(request: any, env: unknown, context: cf.ExecutionContext) => {
|
|
@@ -911,36 +986,76 @@ export const Worker: Platform<
|
|
|
911
986
|
for (const handler of handlers) {
|
|
912
987
|
const eff = handler(event);
|
|
913
988
|
if (Effect.isEffect(eff)) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
),
|
|
922
|
-
Effect.provide(
|
|
923
|
-
Layer.succeed(ExecutionContext, {
|
|
924
|
-
scope,
|
|
925
|
-
cache: {},
|
|
926
|
-
}),
|
|
927
|
-
),
|
|
928
|
-
Effect.runPromise,
|
|
929
|
-
)
|
|
930
|
-
.finally(() =>
|
|
931
|
-
context.waitUntil(
|
|
932
|
-
Effect.runPromise(Scope.close(scope, Exit.void)),
|
|
933
|
-
),
|
|
934
|
-
);
|
|
989
|
+
return runUserEffect(
|
|
990
|
+
eff as Effect.Effect<unknown, unknown>,
|
|
991
|
+
context,
|
|
992
|
+
).then((exit) => {
|
|
993
|
+
if (exit._tag === "Success") return exit.value;
|
|
994
|
+
throw Cause.squash(exit.cause);
|
|
995
|
+
});
|
|
935
996
|
}
|
|
936
997
|
}
|
|
937
998
|
return Promise.reject(new Error("No event handler found"));
|
|
938
999
|
};
|
|
1000
|
+
|
|
1001
|
+
// RPC method dispatchers — one per non-handler method on the user's
|
|
1002
|
+
// shape. Each dispatcher is invoked by the WorkerEntrypoint bridge
|
|
1003
|
+
// as `dispatcher(args, ctx)`: `args` are the user-facing call args,
|
|
1004
|
+
// `ctx` is the `this.ctx` that Cloudflare hands the bridge per RPC
|
|
1005
|
+
// request. The dispatcher runs the user effect with the same runtime
|
|
1006
|
+
// layer the fetch path uses, then envelope-encodes the result so
|
|
1007
|
+
// `Effect.fail` round-trips as `RpcErrorEnvelope` and `Stream` as
|
|
1008
|
+
// `RpcStreamEnvelope` (consumers wrap the binding with
|
|
1009
|
+
// `toPromiseApi`/`bindWorker` to decode).
|
|
1010
|
+
const exportedHandlerSet = new Set<string>(ExportedHandlerMethods);
|
|
1011
|
+
const rpcDispatchers: Record<
|
|
1012
|
+
string,
|
|
1013
|
+
(args: unknown[], ctx: cf.ExecutionContext) => Promise<unknown>
|
|
1014
|
+
> = {};
|
|
1015
|
+
if (userShape) {
|
|
1016
|
+
for (const [name, value] of Object.entries(userShape)) {
|
|
1017
|
+
if (exportedHandlerSet.has(name)) continue;
|
|
1018
|
+
if (typeof value !== "function") continue;
|
|
1019
|
+
rpcDispatchers[name] = async (
|
|
1020
|
+
args: unknown[],
|
|
1021
|
+
context: cf.ExecutionContext,
|
|
1022
|
+
) => {
|
|
1023
|
+
const result = (value as (...a: unknown[]) => unknown)(...args);
|
|
1024
|
+
if (!Effect.isEffect(result)) return result;
|
|
1025
|
+
const exit = await runUserEffect(
|
|
1026
|
+
result as Effect.Effect<unknown, unknown>,
|
|
1027
|
+
context,
|
|
1028
|
+
);
|
|
1029
|
+
if (exit._tag === "Success") {
|
|
1030
|
+
if (Stream.isStream(exit.value)) {
|
|
1031
|
+
return await Effect.runPromise(
|
|
1032
|
+
toRpcStream(exit.value) as Effect.Effect<RpcStreamEnvelope>,
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
return exit.value;
|
|
1036
|
+
}
|
|
1037
|
+
const failReason = exit.cause.reasons.find(Cause.isFailReason);
|
|
1038
|
+
if (failReason) {
|
|
1039
|
+
return {
|
|
1040
|
+
_tag: ErrorTag,
|
|
1041
|
+
error: encodeRpcError(failReason.error),
|
|
1042
|
+
} satisfies RpcErrorEnvelope;
|
|
1043
|
+
}
|
|
1044
|
+
const dieReason = exit.cause.reasons.find(Cause.isDieReason);
|
|
1045
|
+
throw (
|
|
1046
|
+
dieReason?.defect ??
|
|
1047
|
+
new Error("RPC method failed with an unexpected cause")
|
|
1048
|
+
);
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
939
1053
|
return {
|
|
940
1054
|
...exports,
|
|
941
1055
|
default: Object.fromEntries(
|
|
942
1056
|
ExportedHandlerMethods.map((method) => [method, handle(method)]),
|
|
943
1057
|
),
|
|
1058
|
+
__rpc__: rpcDispatchers,
|
|
944
1059
|
};
|
|
945
1060
|
}),
|
|
946
1061
|
};
|
|
@@ -953,7 +1068,10 @@ export const bindWorker = Effect.fnUntraced(function* <Shape, Req = never>(
|
|
|
953
1068
|
| (Worker & Rpc<Shape>)
|
|
954
1069
|
| Effect.Effect<Worker & Rpc<Shape>, never, Req>,
|
|
955
1070
|
) {
|
|
956
|
-
|
|
1071
|
+
// Worker classes and regular Effects are both yieldable here.
|
|
1072
|
+
const worker = isYieldableEffectLike(workerEff)
|
|
1073
|
+
? yield* workerEff as Effect.Effect<Worker & Rpc<Shape>, never, Req>
|
|
1074
|
+
: workerEff;
|
|
957
1075
|
const self = yield* Worker;
|
|
958
1076
|
yield* self.bind`${worker}`({
|
|
959
1077
|
bindings: [
|
|
@@ -965,13 +1083,14 @@ export const bindWorker = Effect.fnUntraced(function* <Shape, Req = never>(
|
|
|
965
1083
|
],
|
|
966
1084
|
});
|
|
967
1085
|
|
|
968
|
-
|
|
969
|
-
|
|
1086
|
+
// `bindWorker` runs at *init* phase (both at plantime and at runtime
|
|
1087
|
+
// cold-start). `WorkerEnvironment` only exists at exec phase on the
|
|
1088
|
+
// deployed worker, so we hand `makeRpcStub` an `Effect<stub>` that
|
|
1089
|
+
// resolves the binding lazily on each method call.
|
|
1090
|
+
const stubEff = WorkerEnvironment.pipe(
|
|
1091
|
+
Effect.map((env) => (env as Record<string, unknown>)[worker.LogicalId]),
|
|
970
1092
|
);
|
|
971
|
-
|
|
972
|
-
const fetcher = workerBinding.pipe(Effect.map(fromCloudflareFetcher));
|
|
973
|
-
// TODO(sam): update makeRpcStub to support lazily evaluating the Effect<Fetcher>
|
|
974
|
-
return makeRpcStub<Shape>(fetcher);
|
|
1093
|
+
return makeRpcStub<Shape>(stubEff);
|
|
975
1094
|
});
|
|
976
1095
|
|
|
977
1096
|
export class BindWorkerPolicy extends Binding.Policy<
|
|
@@ -1039,6 +1158,12 @@ function getDurableObjectBindings(
|
|
|
1039
1158
|
);
|
|
1040
1159
|
}
|
|
1041
1160
|
|
|
1161
|
+
export function getCronBindings(
|
|
1162
|
+
bindings: ReadonlyArray<ResourceBinding<Worker["Binding"]>>,
|
|
1163
|
+
) {
|
|
1164
|
+
return Array.from(new Set(bindings.flatMap((b) => b.data.crons ?? [])));
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1042
1167
|
function getDurableObjectTagMap(tags: ReadonlyArray<string>) {
|
|
1043
1168
|
return Object.fromEntries(
|
|
1044
1169
|
tags.flatMap((tag) => {
|
|
@@ -1089,9 +1214,11 @@ export const LiveWorkerProvider = () =>
|
|
|
1089
1214
|
const createScriptSubdomain = yield* workers.createScriptSubdomain;
|
|
1090
1215
|
const deleteScript = yield* workers.deleteScript;
|
|
1091
1216
|
const getScriptSubdomain = yield* workers.getScriptSubdomain;
|
|
1217
|
+
const getScriptSchedule = yield* workers.getScriptSchedule;
|
|
1092
1218
|
const getScriptSettings = yield* workers.getScriptScriptAndVersionSetting;
|
|
1093
1219
|
const getSubdomain = yield* workers.getSubdomain;
|
|
1094
1220
|
const putScript = yield* workers.putScript;
|
|
1221
|
+
const putScriptSchedule = yield* workers.putScriptSchedule;
|
|
1095
1222
|
const putDomain = yield* workers.putDomain;
|
|
1096
1223
|
const listDomains = yield* workers.listDomains;
|
|
1097
1224
|
const deleteDomain = yield* workers.deleteDomain;
|
|
@@ -1139,6 +1266,60 @@ export const LiveWorkerProvider = () =>
|
|
|
1139
1266
|
),
|
|
1140
1267
|
);
|
|
1141
1268
|
|
|
1269
|
+
const normalizeCrons = (crons: string[] | undefined): string[] =>
|
|
1270
|
+
Array.from(new Set(crons ?? []));
|
|
1271
|
+
|
|
1272
|
+
const getWorkerCrons = (scriptName: string) =>
|
|
1273
|
+
getScriptSchedule({
|
|
1274
|
+
accountId,
|
|
1275
|
+
scriptName,
|
|
1276
|
+
}).pipe(
|
|
1277
|
+
Effect.map((response) =>
|
|
1278
|
+
normalizeCrons(response.schedules.map((schedule) => schedule.cron)),
|
|
1279
|
+
),
|
|
1280
|
+
Effect.catchTag("WorkerNotFound", () => Effect.succeed([])),
|
|
1281
|
+
);
|
|
1282
|
+
|
|
1283
|
+
const reconcileCrons = (
|
|
1284
|
+
scriptName: string,
|
|
1285
|
+
desired: string[],
|
|
1286
|
+
previous: string[],
|
|
1287
|
+
session: ScopedPlanStatusSession,
|
|
1288
|
+
) =>
|
|
1289
|
+
Effect.gen(function* () {
|
|
1290
|
+
const live = yield* getWorkerCrons(scriptName);
|
|
1291
|
+
const desiredSorted = [...desired].sort();
|
|
1292
|
+
const liveSorted = [...live].sort();
|
|
1293
|
+
const changed =
|
|
1294
|
+
desiredSorted.length !== liveSorted.length ||
|
|
1295
|
+
desiredSorted.some((cron, index) => cron !== liveSorted[index]);
|
|
1296
|
+
|
|
1297
|
+
if (!changed) return live;
|
|
1298
|
+
|
|
1299
|
+
if (desired.length > 0 || previous.length > 0 || live.length > 0) {
|
|
1300
|
+
yield* session.note(
|
|
1301
|
+
`Reconciling Cron Triggers (${desired.length}) ...`,
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
const result = yield* putScriptSchedule({
|
|
1306
|
+
accountId,
|
|
1307
|
+
scriptName,
|
|
1308
|
+
body: desired.map((cron) => ({ cron })),
|
|
1309
|
+
}).pipe(
|
|
1310
|
+
Effect.retry({
|
|
1311
|
+
while: (error: { _tag?: string }) =>
|
|
1312
|
+
error?._tag === "WorkerNotFound",
|
|
1313
|
+
schedule: Schedule.exponential(200).pipe(
|
|
1314
|
+
Schedule.both(Schedule.recurs(15)),
|
|
1315
|
+
),
|
|
1316
|
+
}),
|
|
1317
|
+
);
|
|
1318
|
+
return normalizeCrons(
|
|
1319
|
+
result.schedules.map((schedule) => schedule.cron),
|
|
1320
|
+
);
|
|
1321
|
+
});
|
|
1322
|
+
|
|
1142
1323
|
/**
|
|
1143
1324
|
* Infer the Cloudflare Zone ID for a given hostname by listing the
|
|
1144
1325
|
* account's zones and matching the hostname against each zone's name —
|
|
@@ -1958,6 +2139,12 @@ export const LiveWorkerProvider = () =>
|
|
|
1958
2139
|
desiredDomains,
|
|
1959
2140
|
previousDomains,
|
|
1960
2141
|
);
|
|
2142
|
+
const crons = yield* reconcileCrons(
|
|
2143
|
+
name,
|
|
2144
|
+
normalizeCrons([...getCronBindings(bindings), ...(news.crons ?? [])]),
|
|
2145
|
+
output?.crons ?? [],
|
|
2146
|
+
session,
|
|
2147
|
+
);
|
|
1961
2148
|
return {
|
|
1962
2149
|
workerId: worker.id ?? name,
|
|
1963
2150
|
workerName: name,
|
|
@@ -1970,6 +2157,7 @@ export const LiveWorkerProvider = () =>
|
|
|
1970
2157
|
durableObjectNamespaces,
|
|
1971
2158
|
accountId,
|
|
1972
2159
|
domains,
|
|
2160
|
+
crons,
|
|
1973
2161
|
hash,
|
|
1974
2162
|
} satisfies Worker["Attributes"];
|
|
1975
2163
|
});
|
|
@@ -2025,7 +2213,13 @@ export const LiveWorkerProvider = () =>
|
|
|
2025
2213
|
|
|
2026
2214
|
return Worker.Provider.of({
|
|
2027
2215
|
stables: ["workerId", "workerName"],
|
|
2028
|
-
diff: Effect.fnUntraced(function* ({
|
|
2216
|
+
diff: Effect.fnUntraced(function* ({
|
|
2217
|
+
id,
|
|
2218
|
+
news,
|
|
2219
|
+
olds,
|
|
2220
|
+
output,
|
|
2221
|
+
newBindings,
|
|
2222
|
+
}) {
|
|
2029
2223
|
if (!isResolved(news)) return undefined;
|
|
2030
2224
|
if ((output?.accountId ?? accountId) !== accountId) {
|
|
2031
2225
|
return { action: "replace" };
|
|
@@ -2047,7 +2241,23 @@ export const LiveWorkerProvider = () =>
|
|
|
2047
2241
|
const domainsChanged =
|
|
2048
2242
|
newDomains.length !== oldDomains.length ||
|
|
2049
2243
|
newDomains.some((d, i) => d !== oldDomains[i]);
|
|
2050
|
-
|
|
2244
|
+
const newCrons = normalizeCrons([
|
|
2245
|
+
...(Array.isArray(newBindings)
|
|
2246
|
+
? getCronBindings(
|
|
2247
|
+
newBindings as ResourceBinding<Worker["Binding"]>[],
|
|
2248
|
+
)
|
|
2249
|
+
: []),
|
|
2250
|
+
...(news.crons ?? []),
|
|
2251
|
+
]).sort();
|
|
2252
|
+
const oldCrons = [...(output?.crons ?? [])].sort();
|
|
2253
|
+
const cronsChanged =
|
|
2254
|
+
newCrons.length !== oldCrons.length ||
|
|
2255
|
+
newCrons.some((cron, index) => cron !== oldCrons[index]);
|
|
2256
|
+
if (
|
|
2257
|
+
domainsChanged ||
|
|
2258
|
+
cronsChanged ||
|
|
2259
|
+
(yield* hasChanged(id, news, output))
|
|
2260
|
+
) {
|
|
2051
2261
|
return {
|
|
2052
2262
|
action: "update",
|
|
2053
2263
|
stables:
|
|
@@ -2152,7 +2362,23 @@ export const LiveWorkerProvider = () =>
|
|
|
2152
2362
|
type: "application/javascript+module",
|
|
2153
2363
|
}),
|
|
2154
2364
|
],
|
|
2155
|
-
})
|
|
2365
|
+
}).pipe(
|
|
2366
|
+
// Cloudflare's PUT /workers/scripts/{name} intermittently
|
|
2367
|
+
// returns code 10002 / "An unknown error has occurred" on the
|
|
2368
|
+
// first put for a fresh worker name. Surfaced as the shared
|
|
2369
|
+
// `InternalServerError` upstream (alchemy-run/distilled#290).
|
|
2370
|
+
// Also match `UnknownCloudflareError` for older
|
|
2371
|
+
// @distilled.cloud/cloudflare versions that haven't picked
|
|
2372
|
+
// up the patch yet.
|
|
2373
|
+
Effect.retry({
|
|
2374
|
+
while: (e: any) =>
|
|
2375
|
+
e._tag === "InternalServerError" ||
|
|
2376
|
+
e._tag === "UnknownCloudflareError",
|
|
2377
|
+
schedule: Schedule.exponential(1000).pipe(
|
|
2378
|
+
Schedule.both(Schedule.recurs(5)),
|
|
2379
|
+
),
|
|
2380
|
+
}),
|
|
2381
|
+
);
|
|
2156
2382
|
if (doClasses.length > 0) {
|
|
2157
2383
|
({ durableObjectNamespaces } =
|
|
2158
2384
|
yield* getWorkerSettingsWithDurableObjects(name, doClasses));
|
|
@@ -2173,6 +2399,7 @@ export const LiveWorkerProvider = () =>
|
|
|
2173
2399
|
durableObjectNamespaces,
|
|
2174
2400
|
accountId,
|
|
2175
2401
|
domains: [],
|
|
2402
|
+
crons: [],
|
|
2176
2403
|
} satisfies Worker["Attributes"];
|
|
2177
2404
|
}),
|
|
2178
2405
|
read: Effect.fnUntraced(
|
|
@@ -2204,6 +2431,7 @@ export const LiveWorkerProvider = () =>
|
|
|
2204
2431
|
service: workerName,
|
|
2205
2432
|
}).pipe(Effect.map((r) => r.result ?? [])),
|
|
2206
2433
|
]);
|
|
2434
|
+
const crons = yield* getWorkerCrons(workerName);
|
|
2207
2435
|
yield* Effect.logInfo(
|
|
2208
2436
|
`Cloudflare Worker read: found ${workerName}`,
|
|
2209
2437
|
);
|
|
@@ -2224,6 +2452,7 @@ export const LiveWorkerProvider = () =>
|
|
|
2224
2452
|
? [{ id: d.id, hostname: d.hostname, zoneId: d.zoneId }]
|
|
2225
2453
|
: [],
|
|
2226
2454
|
),
|
|
2455
|
+
crons,
|
|
2227
2456
|
} satisfies Worker["Attributes"];
|
|
2228
2457
|
|
|
2229
2458
|
// Centralized ownership decision: the engine routes `read`'s
|
|
@@ -158,19 +158,17 @@ import * as Logger from "effect/Logger";
|
|
|
158
158
|
import * as Context from "effect/Context";
|
|
159
159
|
import * as Stream from "effect/Stream";
|
|
160
160
|
|
|
161
|
-
import { env, DurableObject${hasWfClasses ? ", WorkflowEntrypoint" : ""} } from "cloudflare:workers";
|
|
161
|
+
import { env, DurableObject, WorkerEntrypoint${hasWfClasses ? ", WorkflowEntrypoint" : ""} } from "cloudflare:workers";
|
|
162
162
|
import { MinimumLogLevel } from "effect/References";
|
|
163
163
|
import { NodeServices } from "@effect/platform-node";
|
|
164
164
|
import { Stack } from "alchemy/Stack";
|
|
165
|
-
import { WorkerEnvironment, makeDurableObjectBridge${hasWfClasses ? ", makeWorkflowBridge" : ""}, ExportedHandlerMethods } from "alchemy/Cloudflare";
|
|
165
|
+
import { WorkerEnvironment, makeDurableObjectBridge, makeWorkerBridge${hasWfClasses ? ", makeWorkflowBridge" : ""}, ExportedHandlerMethods } from "alchemy/Cloudflare";
|
|
166
|
+
import { makeEntrypointLayer } from "alchemy/Runtime";
|
|
166
167
|
|
|
167
|
-
import
|
|
168
|
+
import entrypoint from "${importPath}";
|
|
168
169
|
|
|
169
170
|
const tag = Context.Service("${Self.key}")
|
|
170
|
-
const layer =
|
|
171
|
-
typeof entry?.build === "function"
|
|
172
|
-
? entry
|
|
173
|
-
: Layer.effect(tag, typeof entry?.asEffect === "function" ? entry.asEffect() : entry);
|
|
171
|
+
const layer = makeEntrypointLayer(tag, entrypoint);
|
|
174
172
|
|
|
175
173
|
const platform = Layer.mergeAll(
|
|
176
174
|
NodeServices.layer,
|
|
@@ -189,7 +187,7 @@ const stack = Layer.succeed(
|
|
|
189
187
|
}
|
|
190
188
|
);
|
|
191
189
|
|
|
192
|
-
const exportsEffect = tag.
|
|
190
|
+
const exportsEffect = tag.pipe(
|
|
193
191
|
Effect.flatMap(func => func.RuntimeContext.exports),
|
|
194
192
|
Effect.provide(
|
|
195
193
|
layer.pipe(
|
|
@@ -223,10 +221,20 @@ let exportsPromise;
|
|
|
223
221
|
// we cache it synchronously (??=) to guarnatee only one initialization ever happens
|
|
224
222
|
const getExports = () => (exportsPromise ??= Effect.runPromise(exportsEffect))
|
|
225
223
|
const getExport = (name) => getExports().then(exports => exports[name]?.make)
|
|
226
|
-
const
|
|
224
|
+
const getDefault = () => getExports().then(exports => exports.default)
|
|
225
|
+
const getRpc = () => getExports().then(exports => exports.__rpc__ ?? {})
|
|
227
226
|
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
// Bridge the user's default-export shape onto a real \`WorkerEntrypoint\`
|
|
228
|
+
// subclass so Cloudflare service bindings can dispatch both the standard
|
|
229
|
+
// handler methods (fetch, scheduled, …) and any user-defined RPC methods.
|
|
230
|
+
// RPC method results are wire-encoded by \`runtimeContext.exports\`;
|
|
231
|
+
// consumers unwrap them with \`Cloudflare.toPromiseApi(env.X)\` (Promise
|
|
232
|
+
// API) or \`bindWorker(WorkerClass)\` (Effect API).
|
|
233
|
+
export default makeWorkerBridge(
|
|
234
|
+
WorkerEntrypoint,
|
|
235
|
+
ExportedHandlerMethods,
|
|
236
|
+
getDefault,
|
|
237
|
+
getRpc,
|
|
230
238
|
);
|
|
231
239
|
|
|
232
240
|
// export class proxy stubs for Durable Objects and Workflows
|