alchemy 2.0.0-beta.34 → 2.0.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +8 -7
- package/bin/exec.js +253 -52
- package/bin/exec.js.map +1 -1
- package/lib/AWS/AuthProvider.d.ts +7 -6
- package/lib/AWS/AuthProvider.d.ts.map +1 -1
- package/lib/AWS/AuthProvider.js +143 -134
- package/lib/AWS/AuthProvider.js.map +1 -1
- package/lib/AWS/Bootstrap.d.ts +2 -2
- package/lib/AWS/Bootstrap.d.ts.map +1 -1
- package/lib/AWS/EC2/hosted.d.ts +1 -1
- package/lib/AWS/Environment.d.ts +25 -3
- package/lib/AWS/Environment.d.ts.map +1 -1
- package/lib/AWS/Environment.js +47 -3
- package/lib/AWS/Environment.js.map +1 -1
- package/lib/AWS/IAM/OpenIDConnectProvider.d.ts +14 -6
- package/lib/AWS/IAM/OpenIDConnectProvider.d.ts.map +1 -1
- package/lib/AWS/IAM/OpenIDConnectProvider.js +6 -3
- package/lib/AWS/IAM/OpenIDConnectProvider.js.map +1 -1
- package/lib/AWS/IAM/Policy.d.ts +1 -1
- package/lib/AWS/IAM/Policy.d.ts.map +1 -1
- package/lib/AWS/IAM/Policy.js.map +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts.map +1 -1
- package/lib/AWS/Providers.d.ts +1 -1
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +2 -1
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/Auth/Credentials.d.ts +21 -6
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +30 -31
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/Auth/Profile.d.ts +31 -34
- package/lib/Auth/Profile.d.ts.map +1 -1
- package/lib/Auth/Profile.js +46 -31
- package/lib/Auth/Profile.js.map +1 -1
- package/lib/Axiom/AuthProvider.d.ts +2 -1
- package/lib/Axiom/AuthProvider.d.ts.map +1 -1
- package/lib/Axiom/AuthProvider.js +149 -143
- package/lib/Axiom/AuthProvider.js.map +1 -1
- package/lib/Axiom/Credentials.d.ts +2 -1
- package/lib/Axiom/Credentials.d.ts.map +1 -1
- package/lib/Axiom/Credentials.js +4 -4
- package/lib/Axiom/Credentials.js.map +1 -1
- package/lib/Axiom/Providers.d.ts +1 -1
- package/lib/Axiom/Providers.d.ts.map +1 -1
- package/lib/Axiom/Providers.js +3 -1
- package/lib/Axiom/Providers.js.map +1 -1
- package/lib/Cli/LoggingCli.d.ts.map +1 -1
- package/lib/Cli/LoggingCli.js +105 -7
- package/lib/Cli/LoggingCli.js.map +1 -1
- package/lib/Cli/checkVersion.d.ts +13 -0
- package/lib/Cli/checkVersion.d.ts.map +1 -0
- package/lib/Cli/checkVersion.js +47 -0
- package/lib/Cli/checkVersion.js.map +1 -0
- package/lib/Cli/commands/_shared.d.ts +2 -2
- package/lib/Cli/commands/_shared.d.ts.map +1 -1
- package/lib/Cli/commands/_shared.js +3 -3
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/aws.d.ts +6 -0
- package/lib/Cli/commands/aws.d.ts.map +1 -0
- package/lib/Cli/commands/aws.js +63 -0
- package/lib/Cli/commands/aws.js.map +1 -0
- package/lib/Cli/commands/cloudflare.d.ts +17 -0
- package/lib/Cli/commands/cloudflare.d.ts.map +1 -0
- package/lib/Cli/commands/cloudflare.js +111 -0
- package/lib/Cli/commands/cloudflare.js.map +1 -0
- package/lib/Cli/commands/deploy.d.ts +6 -5
- package/lib/Cli/commands/deploy.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.js +10 -10
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +16 -16
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cli/commands/login.d.ts +2 -1
- package/lib/Cli/commands/login.d.ts.map +1 -1
- package/lib/Cli/commands/login.js +9 -8
- package/lib/Cli/commands/login.js.map +1 -1
- package/lib/Cli/commands/logs.d.ts +1 -1
- package/lib/Cli/commands/logs.d.ts.map +1 -1
- package/lib/Cli/commands/logs.js +7 -7
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/profile.d.ts +3 -1
- package/lib/Cli/commands/profile.d.ts.map +1 -1
- package/lib/Cli/commands/profile.js +14 -11
- package/lib/Cli/commands/profile.js.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/state.js +8 -8
- package/lib/Cli/commands/state.js.map +1 -1
- package/lib/Cli/commands/tail.d.ts +1 -1
- package/lib/Cli/commands/tail.d.ts.map +1 -1
- package/lib/Cli/commands/tail.js +7 -7
- package/lib/Cli/commands/tail.js.map +1 -1
- package/lib/Cli/exec.d.ts.map +1 -1
- package/lib/Cli/exec.js +5 -3
- package/lib/Cli/exec.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +19 -5
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cli/selectCli.d.ts +12 -0
- package/lib/Cli/selectCli.d.ts.map +1 -0
- package/lib/Cli/selectCli.js +32 -0
- package/lib/Cli/selectCli.js.map +1 -0
- package/lib/Cloudflare/Auth/AuthProvider.d.ts +2 -1
- package/lib/Cloudflare/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js +235 -214
- package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
- package/lib/Cloudflare/CloudflareEnvironment.d.ts +2 -1
- package/lib/Cloudflare/CloudflareEnvironment.d.ts.map +1 -1
- package/lib/Cloudflare/CloudflareEnvironment.js +3 -2
- package/lib/Cloudflare/CloudflareEnvironment.js.map +1 -1
- package/lib/Cloudflare/Credentials.d.ts +2 -1
- package/lib/Cloudflare/Credentials.d.ts.map +1 -1
- package/lib/Cloudflare/Credentials.js +4 -4
- package/lib/Cloudflare/Credentials.js.map +1 -1
- package/lib/Cloudflare/D1/D1Clone.d.ts +2 -1
- package/lib/Cloudflare/D1/D1Clone.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Database.d.ts +2 -1
- package/lib/Cloudflare/D1/D1Database.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Import.d.ts +3 -1
- package/lib/Cloudflare/D1/D1Import.d.ts.map +1 -1
- package/lib/Cloudflare/Images/Images.d.ts +103 -0
- package/lib/Cloudflare/Images/Images.d.ts.map +1 -0
- package/lib/Cloudflare/Images/Images.js +82 -0
- package/lib/Cloudflare/Images/Images.js.map +1 -0
- package/lib/Cloudflare/Images/ImagesBinding.d.ts +73 -0
- package/lib/Cloudflare/Images/ImagesBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Images/ImagesBinding.js +83 -0
- package/lib/Cloudflare/Images/ImagesBinding.js.map +1 -0
- package/lib/Cloudflare/Images/index.d.ts +3 -0
- package/lib/Cloudflare/Images/index.d.ts.map +1 -0
- package/lib/Cloudflare/Images/index.js +3 -0
- package/lib/Cloudflare/Images/index.js.map +1 -0
- package/lib/Cloudflare/Local/Sidecar.d.ts +11 -4
- package/lib/Cloudflare/Local/Sidecar.d.ts.map +1 -1
- package/lib/Cloudflare/Local/Sidecar.js +8 -6
- package/lib/Cloudflare/Local/Sidecar.js.map +1 -1
- package/lib/Cloudflare/Local/SidecarHandlers.d.ts.map +1 -1
- package/lib/Cloudflare/Local/SidecarHandlers.js +1 -5
- package/lib/Cloudflare/Local/SidecarHandlers.js.map +1 -1
- package/lib/Cloudflare/Local/SidecarServer.js +5 -2
- package/lib/Cloudflare/Local/SidecarServer.js.map +1 -1
- package/lib/Cloudflare/Logs.d.ts +5 -0
- package/lib/Cloudflare/Logs.d.ts.map +1 -1
- package/lib/Cloudflare/Logs.js +70 -1
- package/lib/Cloudflare/Logs.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts +1 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +6 -1
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/Queue/Queue.d.ts +1 -1
- package/lib/Cloudflare/Queue/Queue.js +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts +6 -2
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.js +194 -53
- package/lib/Cloudflare/Queue/QueueConsumer.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts +106 -0
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts.map +1 -0
- package/lib/Cloudflare/Queue/QueueEventSource.js +145 -0
- package/lib/Cloudflare/Queue/QueueEventSource.js.map +1 -0
- package/lib/Cloudflare/Queue/index.d.ts +1 -0
- package/lib/Cloudflare/Queue/index.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/index.js +1 -0
- package/lib/Cloudflare/Queue/index.js.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts +229 -0
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +309 -2
- package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts +4 -3
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/State.js +16 -8
- package/lib/Cloudflare/StateStore/State.js.map +1 -1
- package/lib/Cloudflare/VpcService/VpcServiceRef.d.ts +1 -1
- package/lib/Cloudflare/VpcService/VpcServiceRef.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.js +10 -1
- package/lib/Cloudflare/Website/StaticSite.js.map +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts +1 -1
- 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 +11 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +14 -12
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +96 -165
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts +2 -0
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js +21 -7
- package/lib/Cloudflare/Workers/WorkerBundle.js.map +1 -1
- package/lib/Cloudflare/Zone.d.ts +14 -0
- package/lib/Cloudflare/Zone.d.ts.map +1 -0
- package/lib/Cloudflare/Zone.js +44 -0
- package/lib/Cloudflare/Zone.js.map +1 -0
- package/lib/Cloudflare/index.d.ts +1 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +1 -0
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Drizzle/Schema.d.ts.map +1 -1
- package/lib/Drizzle/Schema.js +20 -5
- package/lib/Drizzle/Schema.js.map +1 -1
- package/lib/GitHub/AuthProvider.d.ts +3 -1
- package/lib/GitHub/AuthProvider.d.ts.map +1 -1
- package/lib/GitHub/AuthProvider.js +114 -108
- package/lib/GitHub/AuthProvider.js.map +1 -1
- package/lib/GitHub/Credentials.d.ts +2 -1
- package/lib/GitHub/Credentials.d.ts.map +1 -1
- package/lib/GitHub/Credentials.js +4 -4
- package/lib/GitHub/Credentials.js.map +1 -1
- package/lib/GitHub/Providers.d.ts +1 -1
- package/lib/GitHub/Providers.d.ts.map +1 -1
- package/lib/GitHub/Providers.js +3 -1
- package/lib/GitHub/Providers.js.map +1 -1
- package/lib/GitHub/Secrets.d.ts.map +1 -1
- package/lib/GitHub/Secrets.js +14 -1
- package/lib/GitHub/Secrets.js.map +1 -1
- package/lib/GitHub/Variables.d.ts +40 -0
- package/lib/GitHub/Variables.d.ts.map +1 -0
- package/lib/GitHub/Variables.js +28 -0
- package/lib/GitHub/Variables.js.map +1 -0
- package/lib/GitHub/index.d.ts +1 -0
- package/lib/GitHub/index.d.ts.map +1 -1
- package/lib/GitHub/index.js +1 -0
- package/lib/GitHub/index.js.map +1 -1
- package/lib/Neon/AuthProvider.d.ts +3 -1
- package/lib/Neon/AuthProvider.d.ts.map +1 -1
- package/lib/Neon/AuthProvider.js +87 -80
- package/lib/Neon/AuthProvider.js.map +1 -1
- package/lib/Neon/Credentials.d.ts +2 -1
- package/lib/Neon/Credentials.d.ts.map +1 -1
- package/lib/Neon/Credentials.js +4 -4
- package/lib/Neon/Credentials.js.map +1 -1
- package/lib/Neon/NeonEnvironment.d.ts +2 -1
- package/lib/Neon/NeonEnvironment.d.ts.map +1 -1
- package/lib/Neon/NeonEnvironment.js +3 -2
- package/lib/Neon/NeonEnvironment.js.map +1 -1
- package/lib/Neon/Project.d.ts +16 -0
- package/lib/Neon/Project.d.ts.map +1 -1
- package/lib/Neon/Project.js +25 -0
- package/lib/Neon/Project.js.map +1 -1
- package/lib/Neon/Providers.d.ts +1 -1
- package/lib/Neon/Providers.d.ts.map +1 -1
- package/lib/Neon/Providers.js +3 -1
- package/lib/Neon/Providers.js.map +1 -1
- package/lib/Neon/api.d.ts +1 -0
- package/lib/Neon/api.d.ts.map +1 -1
- package/lib/Neon/api.js +1 -0
- package/lib/Neon/api.js.map +1 -1
- package/lib/Sidecar/RpcClient.d.ts.map +1 -1
- package/lib/Sidecar/RpcClient.js +8 -5
- package/lib/Sidecar/RpcClient.js.map +1 -1
- package/lib/Sidecar/RpcPaths.d.ts +5 -0
- package/lib/Sidecar/RpcPaths.d.ts.map +1 -1
- package/lib/Sidecar/RpcPaths.js +10 -1
- package/lib/Sidecar/RpcPaths.js.map +1 -1
- package/lib/Sidecar/RpcServer.d.ts +24 -4
- package/lib/Sidecar/RpcServer.d.ts.map +1 -1
- package/lib/Sidecar/RpcServer.js +70 -15
- package/lib/Sidecar/RpcServer.js.map +1 -1
- package/lib/Sidecar/RpcServerBun.d.ts +4 -0
- package/lib/Sidecar/RpcServerBun.d.ts.map +1 -0
- package/lib/Sidecar/RpcServerBun.js +28 -0
- package/lib/Sidecar/RpcServerBun.js.map +1 -0
- package/lib/Sidecar/RpcServerNode.d.ts +4 -0
- package/lib/Sidecar/RpcServerNode.d.ts.map +1 -0
- package/lib/Sidecar/RpcServerNode.js +39 -0
- package/lib/Sidecar/RpcServerNode.js.map +1 -0
- package/lib/Sidecar/RpcServices.d.ts +6 -0
- package/lib/Sidecar/RpcServices.d.ts.map +1 -0
- package/lib/Sidecar/RpcServices.js +29 -0
- package/lib/Sidecar/RpcServices.js.map +1 -0
- package/lib/Stack.d.ts +5 -3
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +3 -1
- package/lib/Stack.js.map +1 -1
- package/lib/Test/Core.d.ts.map +1 -1
- package/lib/Test/Core.js +5 -4
- package/lib/Test/Core.js.map +1 -1
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +2 -0
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/Util/LocalhostDns.d.ts +19 -0
- package/lib/Util/LocalhostDns.d.ts.map +1 -0
- package/lib/Util/LocalhostDns.js +55 -0
- package/lib/Util/LocalhostDns.js.map +1 -0
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +3 -1
- package/lib/Util/PlatformServices.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +16 -12
- package/src/AWS/AuthProvider.ts +269 -259
- package/src/AWS/Environment.ts +57 -3
- package/src/AWS/IAM/OpenIDConnectProvider.ts +19 -8
- package/src/AWS/IAM/Policy.ts +1 -1
- package/src/AWS/Providers.ts +2 -0
- package/src/Auth/Credentials.ts +82 -46
- package/src/Auth/Profile.ts +123 -69
- package/src/Axiom/AuthProvider.ts +263 -255
- package/src/Axiom/Credentials.ts +3 -4
- package/src/Axiom/Providers.ts +4 -0
- package/src/Cli/LoggingCli.ts +127 -11
- package/src/Cli/checkVersion.ts +57 -0
- package/src/Cli/commands/_shared.ts +4 -4
- package/src/Cli/commands/aws.ts +127 -0
- package/src/Cli/commands/cloudflare.ts +222 -0
- package/src/Cli/commands/deploy.ts +11 -10
- package/src/Cli/commands/dev.ts +28 -33
- package/src/Cli/commands/login.ts +9 -12
- package/src/Cli/commands/logs.ts +8 -8
- package/src/Cli/commands/profile.ts +14 -16
- package/src/Cli/commands/state.ts +8 -8
- package/src/Cli/commands/tail.ts +8 -8
- package/src/Cli/exec.ts +7 -3
- package/src/Cli/main.ts +23 -5
- package/src/Cli/selectCli.ts +33 -0
- package/src/Cloudflare/Auth/AuthProvider.ts +445 -430
- package/src/Cloudflare/CloudflareEnvironment.ts +3 -2
- package/src/Cloudflare/Credentials.ts +3 -4
- package/src/Cloudflare/Images/Images.ts +121 -0
- package/src/Cloudflare/Images/ImagesBinding.ts +192 -0
- package/src/Cloudflare/Images/index.ts +2 -0
- package/src/Cloudflare/Local/Sidecar.ts +13 -10
- package/src/Cloudflare/Local/SidecarHandlers.ts +8 -13
- package/src/Cloudflare/Local/SidecarServer.ts +6 -1
- package/src/Cloudflare/Logs.ts +115 -1
- package/src/Cloudflare/Providers.ts +9 -0
- package/src/Cloudflare/Queue/Queue.ts +1 -1
- package/src/Cloudflare/Queue/QueueConsumer.ts +262 -60
- package/src/Cloudflare/Queue/QueueEventSource.ts +234 -0
- package/src/Cloudflare/Queue/index.ts +1 -0
- package/src/Cloudflare/R2/R2Bucket.ts +570 -2
- package/src/Cloudflare/StateStore/State.ts +25 -16
- package/src/Cloudflare/Website/StaticSite.ts +11 -1
- package/src/Cloudflare/Workers/InferEnv.ts +7 -3
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +9 -1
- package/src/Cloudflare/Workers/Worker.ts +130 -231
- package/src/Cloudflare/Workers/WorkerBundle.ts +38 -12
- package/src/Cloudflare/Zone.ts +88 -0
- package/src/Cloudflare/index.ts +1 -0
- package/src/Drizzle/Schema.ts +21 -5
- package/src/GitHub/AuthProvider.ts +221 -217
- package/src/GitHub/Credentials.ts +3 -4
- package/src/GitHub/Providers.ts +4 -0
- package/src/GitHub/Secrets.ts +25 -1
- package/src/GitHub/Variables.ts +54 -0
- package/src/GitHub/index.ts +1 -0
- package/src/Neon/AuthProvider.ts +160 -154
- package/src/Neon/Credentials.ts +3 -4
- package/src/Neon/NeonEnvironment.ts +3 -2
- package/src/Neon/Project.ts +42 -0
- package/src/Neon/Providers.ts +4 -0
- package/src/Neon/api.ts +2 -0
- package/src/Sidecar/RpcClient.ts +8 -7
- package/src/Sidecar/RpcPaths.ts +11 -1
- package/src/Sidecar/RpcServer.ts +97 -24
- package/src/Sidecar/RpcServerBun.ts +41 -0
- package/src/Sidecar/RpcServerNode.ts +51 -0
- package/src/Sidecar/RpcServices.ts +48 -0
- package/src/Stack.ts +8 -0
- package/src/Test/Core.ts +10 -4
- package/src/Test/Vitest.ts +3 -0
- package/src/Util/LocalhostDns.ts +58 -0
- package/src/Util/PlatformServices.ts +3 -1
- package/lib/Cli/commands/bootstrap.d.ts +0 -20
- package/lib/Cli/commands/bootstrap.d.ts.map +0 -1
- package/lib/Cli/commands/bootstrap.js +0 -107
- package/lib/Cli/commands/bootstrap.js.map +0 -1
- package/lib/Sidecar/RpcTransport.d.ts +0 -22
- package/lib/Sidecar/RpcTransport.d.ts.map +0 -1
- package/lib/Sidecar/RpcTransport.js +0 -81
- package/lib/Sidecar/RpcTransport.js.map +0 -1
- package/lib/Test/TestCli.d.ts +0 -19
- package/lib/Test/TestCli.d.ts.map +0 -1
- package/lib/Test/TestCli.js +0 -175
- package/lib/Test/TestCli.js.map +0 -1
- package/src/Cli/commands/bootstrap.ts +0 -216
- package/src/Sidecar/RpcTransport.ts +0 -85
- package/src/Test/TestCli.ts +0 -221
|
@@ -1,50 +1,38 @@
|
|
|
1
1
|
import type * as cf from "@cloudflare/workers-types";
|
|
2
|
-
import cloudflareRolldown from "@distilled.cloud/cloudflare-rolldown-plugin";
|
|
3
2
|
import cloudflareVite from "@distilled.cloud/cloudflare-vite-plugin";
|
|
4
3
|
import * as workers from "@distilled.cloud/cloudflare/workers";
|
|
5
4
|
import * as zones from "@distilled.cloud/cloudflare/zones";
|
|
6
|
-
import type * as Cause from "effect/Cause";
|
|
7
5
|
import * as Context from "effect/Context";
|
|
8
6
|
import * as Data from "effect/Data";
|
|
9
7
|
import * as Effect from "effect/Effect";
|
|
10
8
|
import * as Exit from "effect/Exit";
|
|
11
|
-
import * as FileSystem from "effect/FileSystem";
|
|
12
9
|
import * as Layer from "effect/Layer";
|
|
13
10
|
import * as Option from "effect/Option";
|
|
14
11
|
import * as Path from "effect/Path";
|
|
15
|
-
import * as Queue from "effect/Queue";
|
|
16
12
|
import * as Redacted from "effect/Redacted";
|
|
17
13
|
import * as Schedule from "effect/Schedule";
|
|
18
14
|
import * as Scope from "effect/Scope";
|
|
19
|
-
import * as Stream from "effect/Stream";
|
|
20
|
-
import * as Socket from "effect/unstable/socket/Socket";
|
|
21
15
|
import { createRequire } from "node:module";
|
|
22
16
|
import path from "node:path";
|
|
23
17
|
import { pathToFileURL } from "node:url";
|
|
24
|
-
import type * as rolldown from "rolldown";
|
|
25
|
-
import Sonda from "sonda/rolldown";
|
|
26
18
|
import type * as vite from "vite";
|
|
27
19
|
import { Unowned } from "../../AdoptPolicy.ts";
|
|
28
20
|
import { AlchemyContext } from "../../AlchemyContext.ts";
|
|
29
|
-
import * as Artifacts from "../../Artifacts.ts";
|
|
30
21
|
import * as Binding from "../../Binding.ts";
|
|
31
22
|
import { hashDirectory, type MemoOptions } from "../../Build/Memo.ts";
|
|
32
23
|
import * as Bundle from "../../Bundle/Bundle.ts";
|
|
33
|
-
import { findCwdForBundle } from "../../Bundle/TempRoot.ts";
|
|
34
24
|
import type { ScopedPlanStatusSession } from "../../Cli/Cli.ts";
|
|
35
25
|
import { isResolved } from "../../Diff.ts";
|
|
36
26
|
import { ExecutionContext } from "../../ExecutionContext.ts";
|
|
37
27
|
import type { HttpEffect } from "../../Http.ts";
|
|
38
28
|
import type { InputProps } from "../../Input.ts";
|
|
39
29
|
import * as Output from "../../Output.ts";
|
|
40
|
-
import { createPhysicalName } from "../../PhysicalName.ts";
|
|
41
30
|
import {
|
|
42
31
|
Platform,
|
|
43
32
|
type Main,
|
|
44
33
|
type PlatformProps,
|
|
45
34
|
type Rpc,
|
|
46
35
|
} from "../../Platform.ts";
|
|
47
|
-
import type { LogLine } from "../../Provider.ts";
|
|
48
36
|
import * as Provider from "../../Provider.ts";
|
|
49
37
|
import { Resource, type ResourceBinding } from "../../Resource.ts";
|
|
50
38
|
import * as Serverless from "../../Serverless/index.ts";
|
|
@@ -57,7 +45,14 @@ import {
|
|
|
57
45
|
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
58
46
|
import { D1Database } from "../D1/D1Database.ts";
|
|
59
47
|
import { fromCloudflareFetcher } from "../Fetcher.ts";
|
|
60
|
-
import type {
|
|
48
|
+
import type {
|
|
49
|
+
Hyperdrive,
|
|
50
|
+
HyperdriveDevOrigin,
|
|
51
|
+
} from "../Hyperdrive/Hyperdrive.ts";
|
|
52
|
+
import {
|
|
53
|
+
isImages as isImagesBinding,
|
|
54
|
+
type Images as ImagesBinding,
|
|
55
|
+
} from "../Images/Images.ts";
|
|
61
56
|
import type { KVNamespace } from "../KV/KVNamespace.ts";
|
|
62
57
|
import { SidecarLive } from "../Local/Sidecar.ts";
|
|
63
58
|
import { CloudflareLogs } from "../Logs.ts";
|
|
@@ -72,6 +67,7 @@ import {
|
|
|
72
67
|
type AssetsConfig,
|
|
73
68
|
type AssetsProps,
|
|
74
69
|
} from "./Assets.ts";
|
|
70
|
+
import { getCompatibility } from "./Compatibility.ts";
|
|
75
71
|
import {
|
|
76
72
|
isDurableObjectExport,
|
|
77
73
|
isDurableObjectNamespaceLike,
|
|
@@ -81,7 +77,8 @@ import { workersHttpHandler } from "./HttpServer.ts";
|
|
|
81
77
|
import { LocalWorkerProvider } from "./LocalWorkerProvider.ts";
|
|
82
78
|
import { Request } from "./Request.ts";
|
|
83
79
|
import { makeRpcStub } from "./Rpc.ts";
|
|
84
|
-
import {
|
|
80
|
+
import { WorkerBundle } from "./WorkerBundle.ts";
|
|
81
|
+
import { createWorkerName } from "./WorkerName.ts";
|
|
85
82
|
|
|
86
83
|
const WorkerTypeId = "Cloudflare.Worker";
|
|
87
84
|
type WorkerTypeId = typeof WorkerTypeId;
|
|
@@ -191,6 +188,8 @@ export type WorkerBindingResource =
|
|
|
191
188
|
| CloudflareQueue
|
|
192
189
|
| AiGateway
|
|
193
190
|
| ArtifactsBinding
|
|
191
|
+
| ImagesBinding
|
|
192
|
+
| Hyperdrive
|
|
194
193
|
| DurableObjectNamespaceLike<any>;
|
|
195
194
|
|
|
196
195
|
export type WorkerBindings = {
|
|
@@ -269,7 +268,16 @@ export interface WorkerProps<
|
|
|
269
268
|
};
|
|
270
269
|
limits?: WorkerLimits;
|
|
271
270
|
placement?: WorkerPlacement;
|
|
272
|
-
env?: Record<
|
|
271
|
+
env?: Record<
|
|
272
|
+
string,
|
|
273
|
+
| string
|
|
274
|
+
| number
|
|
275
|
+
| boolean
|
|
276
|
+
| null
|
|
277
|
+
| readonly unknown[]
|
|
278
|
+
| { readonly [key: string]: unknown }
|
|
279
|
+
| Redacted.Redacted<string>
|
|
280
|
+
>;
|
|
273
281
|
exports?: string[];
|
|
274
282
|
bindings?: Bindings;
|
|
275
283
|
/**
|
|
@@ -411,7 +419,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
|
|
|
411
419
|
* ```typescript
|
|
412
420
|
* export default class MyWorker extends Cloudflare.Worker<MyWorker>()(
|
|
413
421
|
* "MyWorker",
|
|
414
|
-
* { main: import.meta.
|
|
422
|
+
* { main: import.meta.filename },
|
|
415
423
|
* Effect.gen(function* () {
|
|
416
424
|
* // init: bind resources
|
|
417
425
|
* const kv = yield* Cloudflare.KVNamespace.bind(MyKV);
|
|
@@ -446,7 +454,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
|
|
|
446
454
|
* // src/WorkerB.ts
|
|
447
455
|
* export default class WorkerB extends Cloudflare.Worker<WorkerB>()(
|
|
448
456
|
* "WorkerB",
|
|
449
|
-
* { main: import.meta.
|
|
457
|
+
* { main: import.meta.filename },
|
|
450
458
|
* ) {}
|
|
451
459
|
*
|
|
452
460
|
* export default WorkerB.make(
|
|
@@ -473,7 +481,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
|
|
|
473
481
|
*
|
|
474
482
|
* export default class WorkerA extends Cloudflare.Worker<WorkerA>()(
|
|
475
483
|
* "WorkerA",
|
|
476
|
-
* { main: import.meta.
|
|
484
|
+
* { main: import.meta.filename },
|
|
477
485
|
* Effect.gen(function* () {
|
|
478
486
|
* const b = yield* Cloudflare.Worker.bind(WorkerB);
|
|
479
487
|
* return {
|
|
@@ -492,7 +500,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
|
|
|
492
500
|
* @example Enabling Node.js compatibility
|
|
493
501
|
* ```typescript
|
|
494
502
|
* {
|
|
495
|
-
* main: import.meta.
|
|
503
|
+
* main: import.meta.filename,
|
|
496
504
|
* compatibility: {
|
|
497
505
|
* flags: ["nodejs_compat"],
|
|
498
506
|
* date: "2026-03-17",
|
|
@@ -503,7 +511,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
|
|
|
503
511
|
* @example Serving static assets
|
|
504
512
|
* ```typescript
|
|
505
513
|
* {
|
|
506
|
-
* main: import.meta.
|
|
514
|
+
* main: import.meta.filename,
|
|
507
515
|
* assets: "./public",
|
|
508
516
|
* }
|
|
509
517
|
* ```
|
|
@@ -521,7 +529,7 @@ export type Worker<Bindings extends WorkerBindings = any> = Resource<
|
|
|
521
529
|
* @example Enabling logs and traces
|
|
522
530
|
* ```typescript
|
|
523
531
|
* {
|
|
524
|
-
* main: import.meta.
|
|
532
|
+
* main: import.meta.filename,
|
|
525
533
|
* observability: {
|
|
526
534
|
* enabled: true,
|
|
527
535
|
* headSamplingRate: 1,
|
|
@@ -734,48 +742,61 @@ export const Worker: Platform<
|
|
|
734
742
|
name: bindingName,
|
|
735
743
|
namespace: binding.namespace,
|
|
736
744
|
} as any)
|
|
737
|
-
:
|
|
745
|
+
: isImagesBinding(binding)
|
|
738
746
|
? {
|
|
739
|
-
type: "
|
|
747
|
+
type: "images",
|
|
740
748
|
name: bindingName,
|
|
741
|
-
className: binding.className ?? binding.name,
|
|
742
749
|
}
|
|
743
|
-
: binding
|
|
750
|
+
: isDurableObjectNamespaceLike(binding)
|
|
744
751
|
? {
|
|
745
|
-
type: "
|
|
746
|
-
id: binding.databaseId,
|
|
752
|
+
type: "durable_object_namespace",
|
|
747
753
|
name: bindingName,
|
|
754
|
+
className: binding.className ?? binding.name,
|
|
748
755
|
}
|
|
749
|
-
: binding.Type === "Cloudflare.
|
|
756
|
+
: binding.Type === "Cloudflare.D1Database"
|
|
750
757
|
? {
|
|
751
|
-
type: "
|
|
758
|
+
type: "d1",
|
|
759
|
+
id: binding.databaseId,
|
|
752
760
|
name: bindingName,
|
|
753
|
-
bucketName: binding.bucketName,
|
|
754
|
-
jurisdiction: binding.jurisdiction.pipe(
|
|
755
|
-
Output.map((jurisdiction) =>
|
|
756
|
-
jurisdiction === "default" ? undefined : jurisdiction,
|
|
757
|
-
),
|
|
758
|
-
),
|
|
759
761
|
}
|
|
760
|
-
: binding.Type === "Cloudflare.
|
|
762
|
+
: binding.Type === "Cloudflare.R2Bucket"
|
|
761
763
|
? {
|
|
762
|
-
type: "
|
|
764
|
+
type: "r2_bucket",
|
|
763
765
|
name: bindingName,
|
|
764
|
-
|
|
766
|
+
bucketName: binding.bucketName,
|
|
767
|
+
jurisdiction: binding.jurisdiction.pipe(
|
|
768
|
+
Output.map((jurisdiction) =>
|
|
769
|
+
jurisdiction === "default"
|
|
770
|
+
? undefined
|
|
771
|
+
: jurisdiction,
|
|
772
|
+
),
|
|
773
|
+
),
|
|
765
774
|
}
|
|
766
|
-
: binding.Type === "Cloudflare.
|
|
775
|
+
: binding.Type === "Cloudflare.KVNamespace"
|
|
767
776
|
? {
|
|
768
|
-
type: "
|
|
777
|
+
type: "kv_namespace",
|
|
769
778
|
name: bindingName,
|
|
770
|
-
|
|
779
|
+
namespaceId: binding.namespaceId,
|
|
771
780
|
}
|
|
772
|
-
: binding.Type === "Cloudflare.
|
|
781
|
+
: binding.Type === "Cloudflare.Queue"
|
|
773
782
|
? {
|
|
774
|
-
type: "
|
|
783
|
+
type: "queue",
|
|
775
784
|
name: bindingName,
|
|
785
|
+
queueName: binding.queueName,
|
|
776
786
|
}
|
|
777
|
-
:
|
|
778
|
-
|
|
787
|
+
: binding.Type === "Cloudflare.AiGateway"
|
|
788
|
+
? {
|
|
789
|
+
type: "ai",
|
|
790
|
+
name: bindingName,
|
|
791
|
+
}
|
|
792
|
+
: binding.Type === "Cloudflare.Hyperdrive"
|
|
793
|
+
? {
|
|
794
|
+
type: "hyperdrive",
|
|
795
|
+
name: bindingName,
|
|
796
|
+
id: binding.hyperdriveId,
|
|
797
|
+
}
|
|
798
|
+
: // TODO(sam): handle others
|
|
799
|
+
undefined;
|
|
779
800
|
|
|
780
801
|
if (bindingMeta) {
|
|
781
802
|
yield* resource.bind`${bindingName}`({
|
|
@@ -1059,17 +1080,14 @@ export const LiveWorkerProvider = () =>
|
|
|
1059
1080
|
Provider.effect(
|
|
1060
1081
|
Worker,
|
|
1061
1082
|
Effect.gen(function* () {
|
|
1062
|
-
const fs = yield* FileSystem.FileSystem;
|
|
1063
1083
|
const path = yield* Path.Path;
|
|
1064
1084
|
|
|
1065
1085
|
const { accountId } = yield* CloudflareEnvironment;
|
|
1066
|
-
const
|
|
1086
|
+
const bundler = yield* WorkerBundle;
|
|
1067
1087
|
const stack = yield* Stack;
|
|
1068
1088
|
|
|
1069
1089
|
const createScriptSubdomain = yield* workers.createScriptSubdomain;
|
|
1070
|
-
const createScriptTail = yield* workers.createScriptTail;
|
|
1071
1090
|
const deleteScript = yield* workers.deleteScript;
|
|
1072
|
-
const deleteScriptTail = yield* workers.deleteScriptTail;
|
|
1073
1091
|
const getScriptSubdomain = yield* workers.getScriptSubdomain;
|
|
1074
1092
|
const getScriptSettings = yield* workers.getScriptScriptAndVersionSetting;
|
|
1075
1093
|
const getSubdomain = yield* workers.getSubdomain;
|
|
@@ -1079,12 +1097,6 @@ export const LiveWorkerProvider = () =>
|
|
|
1079
1097
|
const deleteDomain = yield* workers.deleteDomain;
|
|
1080
1098
|
const listZones = yield* zones.listZones;
|
|
1081
1099
|
const telemetry = yield* CloudflareLogs;
|
|
1082
|
-
// TODO(sam): figure out why the later one from workerd breaks
|
|
1083
|
-
const defaultCompatibilityDate = "2026-03-17";
|
|
1084
|
-
// const defaultCompatibilityDate = yield* Effect.promise(() =>
|
|
1085
|
-
// // @ts-expect-error no types for workerd
|
|
1086
|
-
// import("workerd").then((m) => m.compatibilityDate as string),
|
|
1087
|
-
// );
|
|
1088
1100
|
|
|
1089
1101
|
const getAccountSubdomain = (accountId: string) =>
|
|
1090
1102
|
getSubdomain({
|
|
@@ -1105,14 +1117,6 @@ export const LiveWorkerProvider = () =>
|
|
|
1105
1117
|
previewsEnabled: enabled ? true : undefined,
|
|
1106
1118
|
});
|
|
1107
1119
|
|
|
1108
|
-
const createWorkerName = (id: string, name: string | undefined) =>
|
|
1109
|
-
name
|
|
1110
|
-
? Effect.succeed(name)
|
|
1111
|
-
: createPhysicalName({
|
|
1112
|
-
id,
|
|
1113
|
-
maxLength: 54,
|
|
1114
|
-
}).pipe(Effect.map((name) => name.toLowerCase()));
|
|
1115
|
-
|
|
1116
1120
|
// Convert non-ASCII hostnames (emoji, IDN, etc.) to punycode so the
|
|
1117
1121
|
// Cloudflare API receives the form it stores domains in. `new URL(...)`
|
|
1118
1122
|
// does IDNA via WHATWG URL parsing — `📦.alchemy.run` → `xn--5z8h.alchemy.run`.
|
|
@@ -1262,12 +1266,24 @@ export const LiveWorkerProvider = () =>
|
|
|
1262
1266
|
}
|
|
1263
1267
|
|
|
1264
1268
|
const zoneId = yield* inferZoneIdForHostname(hostname, zoneCache);
|
|
1269
|
+
// Same eventual-consistency window as `setWorkerSubdomain`:
|
|
1270
|
+
// PUT /accounts/.../workers/domains right after `putScript`
|
|
1271
|
+
// can return `WorkerNotFound` until Cloudflare's script
|
|
1272
|
+
// registry has propagated. Retry on that specific tag.
|
|
1265
1273
|
const res = yield* putDomain({
|
|
1266
1274
|
accountId,
|
|
1267
1275
|
hostname,
|
|
1268
1276
|
service: scriptName,
|
|
1269
1277
|
zoneId,
|
|
1270
|
-
})
|
|
1278
|
+
}).pipe(
|
|
1279
|
+
Effect.retry({
|
|
1280
|
+
while: (error: { _tag?: string }) =>
|
|
1281
|
+
error?._tag === "WorkerNotFound",
|
|
1282
|
+
schedule: Schedule.exponential(200).pipe(
|
|
1283
|
+
Schedule.both(Schedule.recurs(15)),
|
|
1284
|
+
),
|
|
1285
|
+
}),
|
|
1286
|
+
);
|
|
1271
1287
|
return {
|
|
1272
1288
|
hostname,
|
|
1273
1289
|
id: res.id ?? "",
|
|
@@ -1383,67 +1399,27 @@ export const LiveWorkerProvider = () =>
|
|
|
1383
1399
|
);
|
|
1384
1400
|
});
|
|
1385
1401
|
|
|
1386
|
-
const getCompatibility = (props: WorkerProps) => ({
|
|
1387
|
-
compatibilityDate:
|
|
1388
|
-
props.compatibility?.date ?? defaultCompatibilityDate,
|
|
1389
|
-
compatibilityFlags: props.compatibility?.flags
|
|
1390
|
-
? [
|
|
1391
|
-
...props.compatibility.flags,
|
|
1392
|
-
...(props.isExternal ? [] : ["nodejs_compat"]),
|
|
1393
|
-
].filter((value, index, self) => self.indexOf(value) === index)
|
|
1394
|
-
: props.isExternal
|
|
1395
|
-
? []
|
|
1396
|
-
: ["nodejs_compat"],
|
|
1397
|
-
});
|
|
1398
|
-
|
|
1399
1402
|
const prepareBundle = (id: string, props: WorkerProps) =>
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
cloudflareRolldown({ compatibilityDate, compatibilityFlags }),
|
|
1412
|
-
plugins,
|
|
1413
|
-
...(props.build?.metafile ? [Sonda({ open: false })] : []),
|
|
1414
|
-
],
|
|
1415
|
-
checks: {
|
|
1416
|
-
// Suppress unresolved import warnings for unrelated AWS packages
|
|
1417
|
-
unresolvedImport: false,
|
|
1418
|
-
},
|
|
1419
|
-
},
|
|
1420
|
-
{
|
|
1421
|
-
format: "esm",
|
|
1422
|
-
sourcemap: "hidden",
|
|
1423
|
-
minify: true,
|
|
1424
|
-
keepNames: true,
|
|
1425
|
-
dir: `.alchemy/bundles/${id}`,
|
|
1403
|
+
bundler.build({
|
|
1404
|
+
id,
|
|
1405
|
+
main: props.main,
|
|
1406
|
+
compatibility: getCompatibility(props),
|
|
1407
|
+
entry: props.isExternal
|
|
1408
|
+
? {
|
|
1409
|
+
kind: "external",
|
|
1410
|
+
}
|
|
1411
|
+
: {
|
|
1412
|
+
kind: "effect",
|
|
1413
|
+
exports: (props.exports ?? {}) as any,
|
|
1426
1414
|
},
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
if (props.isExternal) {
|
|
1431
|
-
const bundle = yield* buildBundle();
|
|
1432
|
-
return bundle;
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
const script = makeEffectVirtualEntry((props.exports ?? {}) as any, {
|
|
1436
|
-
name: stack.name,
|
|
1437
|
-
stage: stack.stage,
|
|
1438
|
-
});
|
|
1439
|
-
return yield* buildBundle(virtualEntryPlugin(script));
|
|
1440
|
-
}).pipe(Artifacts.cached("build"));
|
|
1415
|
+
stack: { name: stack.name, stage: stack.stage },
|
|
1416
|
+
userOptions: props.build,
|
|
1417
|
+
});
|
|
1441
1418
|
|
|
1442
1419
|
const viteBuild = Effect.fnUntraced(function* (props: WorkerProps) {
|
|
1443
1420
|
let assetsDirectory: string | undefined;
|
|
1444
1421
|
let serverBundle: vite.Rolldown.OutputBundle | undefined;
|
|
1445
|
-
const
|
|
1446
|
-
getCompatibility(props);
|
|
1422
|
+
const compatibility = getCompatibility(props);
|
|
1447
1423
|
|
|
1448
1424
|
yield* Effect.promise(async () => {
|
|
1449
1425
|
const vite = await loadVite(props.vite?.rootDir);
|
|
@@ -1462,13 +1438,10 @@ export const LiveWorkerProvider = () =>
|
|
|
1462
1438
|
},
|
|
1463
1439
|
},
|
|
1464
1440
|
},
|
|
1465
|
-
builder: {
|
|
1466
|
-
sharedConfigBuild: true,
|
|
1467
|
-
},
|
|
1468
1441
|
plugins: [
|
|
1469
1442
|
cloudflareVite({
|
|
1470
|
-
compatibilityDate,
|
|
1471
|
-
compatibilityFlags,
|
|
1443
|
+
compatibilityDate: compatibility.date,
|
|
1444
|
+
compatibilityFlags: compatibility.flags,
|
|
1472
1445
|
}),
|
|
1473
1446
|
{
|
|
1474
1447
|
name: "output:ssr",
|
|
@@ -1698,18 +1671,24 @@ export const LiveWorkerProvider = () =>
|
|
|
1698
1671
|
// Add environment variables as metadata bindings
|
|
1699
1672
|
if (news.env) {
|
|
1700
1673
|
for (const [key, value] of Object.entries(news.env)) {
|
|
1701
|
-
if (value
|
|
1674
|
+
if (value === undefined) continue;
|
|
1702
1675
|
if (Redacted.isRedacted(value)) {
|
|
1703
1676
|
metadataBindings.push({
|
|
1704
1677
|
type: "secret_text",
|
|
1705
1678
|
name: key,
|
|
1706
1679
|
text: Redacted.value(value),
|
|
1707
1680
|
});
|
|
1708
|
-
} else {
|
|
1681
|
+
} else if (typeof value === "string") {
|
|
1709
1682
|
metadataBindings.push({
|
|
1710
1683
|
type: "plain_text",
|
|
1711
1684
|
name: key,
|
|
1712
|
-
text:
|
|
1685
|
+
text: value,
|
|
1686
|
+
});
|
|
1687
|
+
} else {
|
|
1688
|
+
metadataBindings.push({
|
|
1689
|
+
type: "json",
|
|
1690
|
+
name: key,
|
|
1691
|
+
json: value,
|
|
1713
1692
|
});
|
|
1714
1693
|
}
|
|
1715
1694
|
}
|
|
@@ -1862,11 +1841,13 @@ export const LiveWorkerProvider = () =>
|
|
|
1862
1841
|
}),
|
|
1863
1842
|
);
|
|
1864
1843
|
|
|
1865
|
-
const
|
|
1844
|
+
const compatibility = getCompatibility(news);
|
|
1845
|
+
const metadata: workers.PutScriptRequest["metadata"] = {
|
|
1866
1846
|
assets: metadataAssets,
|
|
1867
1847
|
bindings: metadataBindings,
|
|
1868
1848
|
bodyPart: undefined,
|
|
1869
|
-
|
|
1849
|
+
compatibilityDate: compatibility.date,
|
|
1850
|
+
compatibilityFlags: compatibility.flags,
|
|
1870
1851
|
containers:
|
|
1871
1852
|
metadataContainers.length > 0 ? metadataContainers : undefined,
|
|
1872
1853
|
keepAssets,
|
|
@@ -1949,7 +1930,21 @@ export const LiveWorkerProvider = () =>
|
|
|
1949
1930
|
yield* session.note(
|
|
1950
1931
|
`${desiredSubdomainEnabled ? "Enabling" : "Disabling"} workers.dev subdomain...`,
|
|
1951
1932
|
);
|
|
1952
|
-
|
|
1933
|
+
// Cloudflare's script registry is eventually consistent — for the
|
|
1934
|
+
// first few hundred ms after `putScript` returns, POST /subdomain
|
|
1935
|
+
// can still get back `WorkerNotFound` (a generic "unknown error"
|
|
1936
|
+
// body). Bigger uploads race harder. Retry the subdomain toggle on
|
|
1937
|
+
// that specific tag with a short exponential backoff; same pattern
|
|
1938
|
+
// we use elsewhere in this provider for DO-namespace propagation.
|
|
1939
|
+
yield* setWorkerSubdomain(name, desiredSubdomainEnabled).pipe(
|
|
1940
|
+
Effect.retry({
|
|
1941
|
+
while: (error: { _tag?: string }) =>
|
|
1942
|
+
error?._tag === "WorkerNotFound",
|
|
1943
|
+
schedule: Schedule.exponential(200).pipe(
|
|
1944
|
+
Schedule.both(Schedule.recurs(15)),
|
|
1945
|
+
),
|
|
1946
|
+
}),
|
|
1947
|
+
);
|
|
1953
1948
|
}
|
|
1954
1949
|
const desiredDomains = normalizeDomains(news.domain);
|
|
1955
1950
|
const previousDomains = output?.domains ?? [];
|
|
@@ -2328,80 +2323,11 @@ export const LiveWorkerProvider = () =>
|
|
|
2328
2323
|
scriptName: output.workerName,
|
|
2329
2324
|
}).pipe(Effect.catchTag("WorkerNotFound", () => Effect.void));
|
|
2330
2325
|
}),
|
|
2331
|
-
tail: ({ output }) =>
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
body: { filters: [] },
|
|
2337
|
-
});
|
|
2338
|
-
|
|
2339
|
-
const socket = yield* Socket.makeWebSocket(url, {
|
|
2340
|
-
protocols: ["trace-v1"],
|
|
2341
|
-
});
|
|
2342
|
-
|
|
2343
|
-
const queue = yield* Queue.make<LogLine, Cause.Done>();
|
|
2344
|
-
|
|
2345
|
-
yield* socket
|
|
2346
|
-
.runRaw((raw) => {
|
|
2347
|
-
const text =
|
|
2348
|
-
typeof raw === "string" ? raw : new TextDecoder().decode(raw);
|
|
2349
|
-
const data: TailEventMessage = JSON.parse(text);
|
|
2350
|
-
const eventTs = new Date(data.eventTimestamp ?? Date.now());
|
|
2351
|
-
|
|
2352
|
-
if (data.event && "request" in data.event) {
|
|
2353
|
-
const reqEvent = data.event;
|
|
2354
|
-
const pathname = (() => {
|
|
2355
|
-
try {
|
|
2356
|
-
return new URL(reqEvent.request.url).pathname;
|
|
2357
|
-
} catch {
|
|
2358
|
-
return reqEvent.request.url;
|
|
2359
|
-
}
|
|
2360
|
-
})();
|
|
2361
|
-
const status = reqEvent.response?.status ?? 500;
|
|
2362
|
-
Queue.offerUnsafe(queue, {
|
|
2363
|
-
timestamp: eventTs,
|
|
2364
|
-
message: `${reqEvent.request.method} ${pathname} > ${status} (cpu: ${Math.round(data.cpuTime)}ms, wall: ${Math.round(data.wallTime)}ms)`,
|
|
2365
|
-
});
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
for (const log of data.logs) {
|
|
2369
|
-
const msg = log.message.join(" ");
|
|
2370
|
-
Queue.offerUnsafe(queue, {
|
|
2371
|
-
timestamp: new Date(log.timestamp),
|
|
2372
|
-
message: log.level === "log" ? msg : `${log.level}: ${msg}`,
|
|
2373
|
-
});
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
|
-
for (const exception of data.exceptions) {
|
|
2377
|
-
Queue.offerUnsafe(queue, {
|
|
2378
|
-
timestamp: new Date(exception.timestamp),
|
|
2379
|
-
message: `${exception.name} ${exception.message}\n${exception.stack}`,
|
|
2380
|
-
});
|
|
2381
|
-
}
|
|
2382
|
-
})
|
|
2383
|
-
.pipe(
|
|
2384
|
-
Effect.ensuring(
|
|
2385
|
-
Effect.all([
|
|
2386
|
-
deleteScriptTail({
|
|
2387
|
-
scriptName: output.workerName,
|
|
2388
|
-
id: tailId,
|
|
2389
|
-
accountId: output.accountId,
|
|
2390
|
-
}).pipe(Effect.ignore),
|
|
2391
|
-
Queue.end(queue),
|
|
2392
|
-
]),
|
|
2393
|
-
),
|
|
2394
|
-
Effect.ignore,
|
|
2395
|
-
Effect.forkChild(),
|
|
2396
|
-
);
|
|
2397
|
-
|
|
2398
|
-
return Stream.fromQueue(queue);
|
|
2399
|
-
});
|
|
2400
|
-
|
|
2401
|
-
return Stream.unwrap(runTailSession).pipe(
|
|
2402
|
-
Stream.repeat(Schedule.spaced("1 second")),
|
|
2403
|
-
);
|
|
2404
|
-
},
|
|
2326
|
+
tail: ({ output }) =>
|
|
2327
|
+
telemetry.tailScript({
|
|
2328
|
+
accountId: output.accountId,
|
|
2329
|
+
scriptName: output.workerName,
|
|
2330
|
+
}),
|
|
2405
2331
|
logs: ({ output, options }) =>
|
|
2406
2332
|
telemetry.queryLogs({
|
|
2407
2333
|
accountId: output.accountId,
|
|
@@ -2419,33 +2345,6 @@ export const LiveWorkerProvider = () =>
|
|
|
2419
2345
|
}),
|
|
2420
2346
|
);
|
|
2421
2347
|
|
|
2422
|
-
interface TailEventMessage {
|
|
2423
|
-
eventTimestamp?: number;
|
|
2424
|
-
wallTime: number;
|
|
2425
|
-
cpuTime: number;
|
|
2426
|
-
truncated: boolean;
|
|
2427
|
-
outcome: string;
|
|
2428
|
-
scriptName: string;
|
|
2429
|
-
exceptions: {
|
|
2430
|
-
name: string;
|
|
2431
|
-
message: string;
|
|
2432
|
-
stack: string;
|
|
2433
|
-
timestamp: string;
|
|
2434
|
-
}[];
|
|
2435
|
-
logs: {
|
|
2436
|
-
message: string[];
|
|
2437
|
-
level: string;
|
|
2438
|
-
timestamp: string;
|
|
2439
|
-
}[];
|
|
2440
|
-
event:
|
|
2441
|
-
| {
|
|
2442
|
-
request: { method: string; url: string };
|
|
2443
|
-
response?: { status: number };
|
|
2444
|
-
}
|
|
2445
|
-
| null
|
|
2446
|
-
| undefined;
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
2348
|
const contentTypeFromExtension = (extension: string) => {
|
|
2450
2349
|
switch (extension) {
|
|
2451
2350
|
case ".wasm":
|