alchemy 2.0.0-beta.43 → 2.0.0-beta.45
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 +18 -5
- package/bin/exec.js +381 -240
- package/bin/exec.js.map +1 -1
- package/lib/AWS/Lambda/Function.d.ts +17 -0
- package/lib/AWS/Lambda/Function.d.ts.map +1 -1
- package/lib/AWS/Lambda/Function.js +61 -16
- package/lib/AWS/Lambda/Function.js.map +1 -1
- package/lib/AWS/Providers.d.ts +2 -1
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +3 -1
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/Apply.js +17 -1
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +24 -6
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +3 -3
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/Auth/Lock.js +2 -2
- package/lib/Auth/Lock.js.map +1 -1
- package/lib/Bundle/Bundle.d.ts +11 -0
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +19 -12
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Bundle/BundleAnalyzerPlugin.d.ts +25 -0
- package/lib/Bundle/BundleAnalyzerPlugin.d.ts.map +1 -0
- package/lib/Bundle/BundleAnalyzerPlugin.js +16 -0
- package/lib/Bundle/BundleAnalyzerPlugin.js.map +1 -0
- package/lib/Bundle/RawPlugin.d.ts +36 -0
- package/lib/Bundle/RawPlugin.d.ts.map +1 -0
- package/lib/Bundle/RawPlugin.js +80 -0
- package/lib/Bundle/RawPlugin.js.map +1 -0
- package/lib/Bundle/index.d.ts +2 -0
- package/lib/Bundle/index.d.ts.map +1 -1
- package/lib/Bundle/index.js +2 -0
- package/lib/Bundle/index.js.map +1 -1
- package/lib/Cli/commands/_shared.d.ts +13 -1
- package/lib/Cli/commands/_shared.d.ts.map +1 -1
- package/lib/Cli/commands/_shared.js +33 -2
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/dev.d.ts +3 -2
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +19 -2
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cli/commands/login.d.ts.map +1 -1
- package/lib/Cli/commands/login.js +19 -5
- package/lib/Cli/commands/login.js.map +1 -1
- package/lib/Cli/commands/profile.d.ts.map +1 -1
- package/lib/Cli/commands/profile.js +7 -27
- package/lib/Cli/commands/profile.js.map +1 -1
- package/lib/Cli/exec.d.ts.map +1 -1
- package/lib/Cli/exec.js +2 -1
- package/lib/Cli/exec.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +0 -2
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts +0 -2
- package/lib/Cloudflare/AiGateway/AiGateway.d.ts.map +1 -1
- package/lib/Cloudflare/AiGateway/AiGateway.js +2 -4
- package/lib/Cloudflare/AiGateway/AiGateway.js.map +1 -1
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.d.ts +116 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.d.ts.map +1 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.js +92 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRendering.js.map +1 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.d.ts +55 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.d.ts.map +1 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.js +55 -0
- package/lib/Cloudflare/BrowserRendering/BrowserRenderingBinding.js.map +1 -0
- package/lib/Cloudflare/BrowserRendering/index.d.ts +3 -0
- package/lib/Cloudflare/BrowserRendering/index.d.ts.map +1 -0
- package/lib/Cloudflare/BrowserRendering/index.js +3 -0
- package/lib/Cloudflare/BrowserRendering/index.js.map +1 -0
- package/lib/Cloudflare/Container/Container.d.ts +3 -3
- package/lib/Cloudflare/Container/Container.js +3 -3
- package/lib/Cloudflare/Container/StartContainer.d.ts.map +1 -1
- package/lib/Cloudflare/Container/StartContainer.js.map +1 -1
- package/lib/Cloudflare/D1/D1Database.d.ts +1 -0
- package/lib/Cloudflare/D1/D1Database.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Database.js +2 -1
- package/lib/Cloudflare/D1/D1Database.js.map +1 -1
- package/lib/Cloudflare/D1/D1DatabaseBinding.js +1 -1
- package/lib/Cloudflare/D1/D1DatabaseBinding.js.map +1 -1
- package/lib/Cloudflare/Fetcher.d.ts.map +1 -1
- package/lib/Cloudflare/Fetcher.js +0 -2
- package/lib/Cloudflare/Fetcher.js.map +1 -1
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.d.ts +1 -0
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.d.ts.map +1 -1
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.js +3 -0
- package/lib/Cloudflare/Hyperdrive/Hyperdrive.js.map +1 -1
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.d.ts +3 -2
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.js +32 -33
- package/lib/Cloudflare/Hyperdrive/HyperdriveBinding.js.map +1 -1
- package/lib/Cloudflare/KV/KVNamespace.d.ts +1 -0
- package/lib/Cloudflare/KV/KVNamespace.d.ts.map +1 -1
- package/lib/Cloudflare/KV/KVNamespace.js +2 -0
- package/lib/Cloudflare/KV/KVNamespace.js.map +1 -1
- package/lib/Cloudflare/Local.d.ts +2 -0
- package/lib/Cloudflare/Local.d.ts.map +1 -0
- package/lib/Cloudflare/Local.js +9 -0
- package/lib/Cloudflare/Local.js.map +1 -0
- package/lib/Cloudflare/Providers.d.ts +2 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +23 -17
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/Queue/Queue.d.ts +1 -0
- package/lib/Cloudflare/Queue/Queue.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/Queue.js +1 -0
- package/lib/Cloudflare/Queue/Queue.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts +2 -1
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.js +11 -3
- package/lib/Cloudflare/Queue/QueueConsumer.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts +30 -4
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/QueueEventSource.js +22 -1
- package/lib/Cloudflare/Queue/QueueEventSource.js.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts +1 -0
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +18 -0
- package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.js +13 -34
- package/lib/Cloudflare/SecretsStore/Secret.js.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts +3 -2
- package/lib/Cloudflare/SecretsStore/SecretBinding.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretBinding.js +3 -2
- package/lib/Cloudflare/SecretsStore/SecretBinding.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +5 -13
- package/lib/Cloudflare/StateStore/Api.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Api.js +14 -8
- package/lib/Cloudflare/StateStore/Api.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/State.js +45 -9
- package/lib/Cloudflare/StateStore/State.js.map +1 -1
- package/lib/Cloudflare/StateStore/Store.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Store.js +5 -2
- package/lib/Cloudflare/StateStore/Store.js.map +1 -1
- package/lib/Cloudflare/VpcService/VpcService.d.ts +2 -2
- package/lib/Cloudflare/VpcService/VpcService.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.d.ts +5 -5
- package/lib/Cloudflare/Website/StaticSite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.js +3 -0
- package/lib/Cloudflare/Website/StaticSite.js.map +1 -1
- package/lib/Cloudflare/Website/Vite.d.ts +5 -5
- package/lib/Cloudflare/Website/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Vite.js.map +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Assets.js +1 -1
- package/lib/Cloudflare/Workers/Assets.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectBridge.js +4 -3
- package/lib/Cloudflare/Workers/DurableObjectBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectNamespace.d.ts +183 -6
- package/lib/Cloudflare/Workers/DurableObjectNamespace.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObjectNamespace.js +279 -76
- package/lib/Cloudflare/Workers/DurableObjectNamespace.js.map +1 -1
- package/lib/Cloudflare/Workers/HttpServer.d.ts +6 -4
- package/lib/Cloudflare/Workers/HttpServer.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/HttpServer.js +20 -15
- package/lib/Cloudflare/Workers/HttpServer.js.map +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts +3 -2
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +19 -3
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +458 -21
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/Rpc.d.ts +16 -0
- package/lib/Cloudflare/Workers/Rpc.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Rpc.js +22 -0
- package/lib/Cloudflare/Workers/Rpc.js.map +1 -1
- package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.d.ts +285 -0
- package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.js +288 -0
- package/lib/Cloudflare/Workers/RpcDurableObjectNamespace.js.map +1 -0
- package/lib/Cloudflare/Workers/RpcWorker.d.ts +305 -0
- package/lib/Cloudflare/Workers/RpcWorker.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/RpcWorker.js +350 -0
- package/lib/Cloudflare/Workers/RpcWorker.js.map +1 -0
- package/lib/Cloudflare/Workers/Vite.d.ts +1 -1
- package/lib/Cloudflare/Workers/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Vite.js +2 -1
- package/lib/Cloudflare/Workers/Vite.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +69 -37
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +171 -51
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +158 -97
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts +11 -23
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.js +3 -0
- package/lib/Cloudflare/Workers/WorkerBinding.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBridge.js +8 -7
- package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts +1 -2
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js +7 -7
- package/lib/Cloudflare/Workers/WorkerBundle.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js +9 -10
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.d.ts +5 -3
- package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.js +19 -1
- package/lib/Cloudflare/Workers/Workflow.js.map +1 -1
- package/lib/Cloudflare/Workers/index.d.ts +2 -0
- package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/index.js +2 -0
- package/lib/Cloudflare/Workers/index.js.map +1 -1
- package/lib/Cloudflare/Zaraz/ZarazConfig.d.ts +184 -0
- package/lib/Cloudflare/Zaraz/ZarazConfig.d.ts.map +1 -0
- package/lib/Cloudflare/Zaraz/ZarazConfig.js +216 -0
- package/lib/Cloudflare/Zaraz/ZarazConfig.js.map +1 -0
- package/lib/Cloudflare/Zaraz/ZarazEventTypes.d.ts +188 -0
- package/lib/Cloudflare/Zaraz/ZarazEventTypes.d.ts.map +1 -0
- package/lib/Cloudflare/Zaraz/ZarazEventTypes.js +4 -0
- package/lib/Cloudflare/Zaraz/ZarazEventTypes.js.map +1 -0
- package/lib/Cloudflare/Zaraz/index.d.ts +3 -0
- package/lib/Cloudflare/Zaraz/index.d.ts.map +1 -0
- package/lib/Cloudflare/Zaraz/index.js +2 -0
- package/lib/Cloudflare/Zaraz/index.js.map +1 -0
- 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/Dependencies.d.ts +10 -0
- package/lib/Dependencies.d.ts.map +1 -0
- package/lib/Dependencies.js +1 -0
- package/lib/Dependencies.js.map +1 -0
- package/lib/Deploy.d.ts +2 -1
- package/lib/Deploy.d.ts.map +1 -1
- package/lib/Deploy.js +2 -2
- package/lib/Deploy.js.map +1 -1
- package/lib/Diff.d.ts +11 -0
- package/lib/Diff.d.ts.map +1 -1
- package/lib/Diff.js +11 -0
- package/lib/Diff.js.map +1 -1
- package/lib/Input.d.ts +2 -1
- package/lib/Input.d.ts.map +1 -1
- package/lib/KeyPair.d.ts +77 -0
- package/lib/KeyPair.d.ts.map +1 -0
- package/lib/KeyPair.js +102 -0
- package/lib/KeyPair.js.map +1 -0
- package/lib/Local/RpcProvider.d.ts +56 -0
- package/lib/Local/RpcProvider.d.ts.map +1 -0
- package/lib/Local/RpcProvider.js +83 -0
- package/lib/Local/RpcProvider.js.map +1 -0
- package/lib/Local/RpcProviderProxy.d.ts +19 -0
- package/lib/Local/RpcProviderProxy.d.ts.map +1 -0
- package/lib/Local/RpcProviderProxy.js +48 -0
- package/lib/Local/RpcProviderProxy.js.map +1 -0
- package/lib/Local/RpcSerialization.d.ts +34 -0
- package/lib/Local/RpcSerialization.d.ts.map +1 -0
- package/lib/Local/RpcSerialization.js +120 -0
- package/lib/Local/RpcSerialization.js.map +1 -0
- package/lib/Local/RpcServer.d.ts +63 -0
- package/lib/Local/RpcServer.d.ts.map +1 -0
- package/lib/Local/RpcServer.js +72 -0
- package/lib/Local/RpcServer.js.map +1 -0
- package/lib/Local/RpcServerBun.d.ts +3 -0
- package/lib/Local/RpcServerBun.d.ts.map +1 -0
- package/lib/Local/RpcServerBun.js +47 -0
- package/lib/Local/RpcServerBun.js.map +1 -0
- package/lib/Local/RpcServerEnvironment.d.ts +20 -0
- package/lib/Local/RpcServerEnvironment.d.ts.map +1 -0
- package/lib/Local/RpcServerEnvironment.js +22 -0
- package/lib/Local/RpcServerEnvironment.js.map +1 -0
- package/lib/Local/RpcServerNode.d.ts +3 -0
- package/lib/Local/RpcServerNode.d.ts.map +1 -0
- package/lib/Local/RpcServerNode.js +43 -0
- package/lib/Local/RpcServerNode.js.map +1 -0
- package/lib/Local/RpcServerSession.d.ts +27 -0
- package/lib/Local/RpcServerSession.d.ts.map +1 -0
- package/lib/Local/RpcServerSession.js +68 -0
- package/lib/Local/RpcServerSession.js.map +1 -0
- package/lib/Local/RpcSpawner.d.ts +21 -0
- package/lib/Local/RpcSpawner.d.ts.map +1 -0
- package/lib/Local/RpcSpawner.js +132 -0
- package/lib/Local/RpcSpawner.js.map +1 -0
- package/lib/Neon/Project.d.ts.map +1 -1
- package/lib/Neon/Project.js +14 -3
- package/lib/Neon/Project.js.map +1 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +9 -2
- package/lib/Output.js.map +1 -1
- package/lib/Phase.d.ts +2 -1
- package/lib/Phase.d.ts.map +1 -1
- package/lib/Phase.js +6 -1
- package/lib/Phase.js.map +1 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +14 -3
- package/lib/Plan.js.map +1 -1
- package/lib/Platform.d.ts +8 -6
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +33 -3
- package/lib/Platform.js.map +1 -1
- package/lib/Random.d.ts.map +1 -1
- package/lib/Random.js +9 -14
- package/lib/Random.js.map +1 -1
- package/lib/RuntimeContext.d.ts +21 -1
- package/lib/RuntimeContext.d.ts.map +1 -1
- package/lib/RuntimeContext.js +12 -0
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Stack.d.ts +3 -3
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js.map +1 -1
- package/lib/State/HttpStateApi.d.ts +2 -2
- package/lib/State/StateEncoding.d.ts +8 -0
- package/lib/State/StateEncoding.d.ts.map +1 -1
- package/lib/State/StateEncoding.js +55 -5
- package/lib/State/StateEncoding.js.map +1 -1
- package/lib/Test/Bun.d.ts.map +1 -1
- package/lib/Test/Bun.js +0 -2
- package/lib/Test/Bun.js.map +1 -1
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +0 -2
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/Util/Duration.d.ts +14 -0
- package/lib/Util/Duration.d.ts.map +1 -0
- package/lib/Util/Duration.js +18 -0
- package/lib/Util/Duration.js.map +1 -0
- package/lib/Util/PlatformServices.d.ts +7 -0
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +22 -11
- package/lib/Util/PlatformServices.js.map +1 -1
- package/lib/Util/camel.d.ts.map +1 -1
- package/lib/Util/camel.js +2 -3
- package/lib/Util/camel.js.map +1 -1
- package/lib/Util/data.d.ts +5 -0
- package/lib/Util/data.d.ts.map +1 -1
- package/lib/Util/data.js +29 -0
- package/lib/Util/data.js.map +1 -1
- package/lib/Util/index.d.ts +0 -6
- package/lib/Util/index.d.ts.map +1 -1
- package/lib/Util/index.js +0 -6
- package/lib/Util/index.js.map +1 -1
- package/lib/Util/stable.d.ts.map +1 -1
- package/lib/Util/stable.js +3 -6
- package/lib/Util/stable.js.map +1 -1
- package/lib/Util/types.d.ts +3 -1
- package/lib/Util/types.d.ts.map +1 -1
- package/lib/Util/types.js +5 -1
- package/lib/Util/types.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +22 -23
- package/src/AWS/Lambda/Function.ts +87 -34
- package/src/AWS/Providers.ts +3 -0
- package/src/Apply.ts +18 -1
- package/src/Auth/AuthProvider.ts +25 -5
- package/src/Auth/Credentials.ts +8 -7
- package/src/Auth/Lock.ts +2 -2
- package/src/Bundle/Bundle.ts +35 -13
- package/src/Bundle/BundleAnalyzerPlugin.ts +33 -0
- package/src/Bundle/RawPlugin.ts +82 -0
- package/src/Bundle/index.ts +2 -0
- package/src/Cli/commands/_shared.ts +47 -4
- package/src/Cli/commands/dev.ts +63 -37
- package/src/Cli/commands/login.ts +20 -4
- package/src/Cli/commands/profile.ts +24 -34
- package/src/Cli/exec.ts +12 -7
- package/src/Cli/main.ts +0 -3
- package/src/Cloudflare/AiGateway/AiGateway.ts +2 -6
- package/src/Cloudflare/BrowserRendering/BrowserRendering.ts +132 -0
- package/src/Cloudflare/BrowserRendering/BrowserRenderingBinding.ts +137 -0
- package/src/Cloudflare/BrowserRendering/index.ts +11 -0
- package/src/Cloudflare/Container/Container.ts +3 -3
- package/src/Cloudflare/Container/StartContainer.ts +1 -2
- package/src/Cloudflare/D1/D1Database.ts +4 -1
- package/src/Cloudflare/D1/D1DatabaseBinding.ts +1 -1
- package/src/Cloudflare/Fetcher.ts +0 -2
- package/src/Cloudflare/Hyperdrive/Hyperdrive.ts +5 -0
- package/src/Cloudflare/Hyperdrive/HyperdriveBinding.ts +41 -43
- package/src/Cloudflare/KV/KVNamespace.ts +4 -0
- package/src/Cloudflare/Local.ts +23 -0
- package/src/Cloudflare/Providers.ts +28 -16
- package/src/Cloudflare/Queue/Queue.ts +3 -0
- package/src/Cloudflare/Queue/QueueConsumer.ts +23 -8
- package/src/Cloudflare/Queue/QueueEventSource.ts +33 -5
- package/src/Cloudflare/R2/R2Bucket.ts +26 -0
- package/src/Cloudflare/SecretsStore/Secret.ts +14 -41
- package/src/Cloudflare/SecretsStore/SecretBinding.ts +11 -11
- package/src/Cloudflare/StateStore/Api.ts +15 -15
- package/src/Cloudflare/StateStore/State.ts +68 -6
- package/src/Cloudflare/StateStore/Store.ts +5 -2
- package/src/Cloudflare/VpcService/VpcService.ts +2 -2
- package/src/Cloudflare/Website/StaticSite.ts +8 -10
- package/src/Cloudflare/Website/Vite.ts +4 -7
- package/src/Cloudflare/Workers/Assets.ts +1 -1
- package/src/Cloudflare/Workers/DurableObjectBridge.ts +7 -5
- package/src/Cloudflare/Workers/DurableObjectNamespace.ts +380 -121
- package/src/Cloudflare/Workers/HttpServer.ts +31 -25
- package/src/Cloudflare/Workers/InferEnv.ts +15 -8
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +609 -22
- package/src/Cloudflare/Workers/Rpc.ts +50 -0
- package/src/Cloudflare/Workers/RpcDurableObjectNamespace.ts +502 -0
- package/src/Cloudflare/Workers/RpcWorker.ts +562 -0
- package/src/Cloudflare/Workers/Vite.ts +2 -0
- package/src/Cloudflare/Workers/Worker.ts +280 -110
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +158 -103
- package/src/Cloudflare/Workers/WorkerBinding.ts +10 -0
- package/src/Cloudflare/Workers/WorkerBridge.ts +10 -9
- package/src/Cloudflare/Workers/WorkerBundle.ts +8 -9
- package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +8 -15
- package/src/Cloudflare/Workers/Workflow.ts +22 -3
- package/src/Cloudflare/Workers/index.ts +2 -0
- package/src/Cloudflare/Zaraz/ZarazConfig.ts +403 -0
- package/src/Cloudflare/Zaraz/ZarazEventTypes.ts +257 -0
- package/src/Cloudflare/Zaraz/index.ts +25 -0
- package/src/Cloudflare/index.ts +2 -0
- package/src/Dependencies.ts +10 -0
- package/src/Deploy.ts +3 -1
- package/src/Diff.ts +13 -0
- package/src/Input.ts +2 -0
- package/src/KeyPair.ts +146 -0
- package/src/Local/RpcProvider.ts +146 -0
- package/src/Local/RpcProviderProxy.ts +86 -0
- package/src/Local/RpcSerialization.ts +225 -0
- package/src/Local/RpcServer.ts +138 -0
- package/src/Local/RpcServerBun.ts +59 -0
- package/src/Local/RpcServerEnvironment.ts +55 -0
- package/src/Local/RpcServerNode.ts +58 -0
- package/src/Local/RpcServerSession.ts +87 -0
- package/src/Local/RpcSpawner.ts +196 -0
- package/src/Neon/Project.ts +16 -3
- package/src/Output.ts +8 -2
- package/src/Phase.ts +8 -0
- package/src/Plan.ts +16 -3
- package/src/Platform.ts +74 -27
- package/src/Random.ts +22 -27
- package/src/RuntimeContext.ts +23 -1
- package/src/Stack.ts +3 -3
- package/src/State/StateEncoding.ts +58 -7
- package/src/Test/Bun.ts +0 -3
- package/src/Test/Vitest.ts +0 -3
- package/src/Util/Duration.ts +21 -0
- package/src/Util/PlatformServices.ts +41 -27
- package/src/Util/camel.ts +3 -5
- package/src/Util/data.ts +38 -0
- package/src/Util/index.ts +0 -6
- package/src/Util/stable.ts +4 -10
- package/src/Util/types.ts +9 -2
- package/src/index.ts +2 -3
- package/lib/Cloudflare/Local/Sidecar.d.ts +0 -63
- package/lib/Cloudflare/Local/Sidecar.d.ts.map +0 -1
- package/lib/Cloudflare/Local/Sidecar.js +0 -50
- package/lib/Cloudflare/Local/Sidecar.js.map +0 -1
- package/lib/Cloudflare/Local/SidecarHandlers.d.ts +0 -8
- package/lib/Cloudflare/Local/SidecarHandlers.d.ts.map +0 -1
- package/lib/Cloudflare/Local/SidecarHandlers.js +0 -381
- package/lib/Cloudflare/Local/SidecarHandlers.js.map +0 -1
- package/lib/Cloudflare/Local/SidecarServer.d.ts +0 -2
- package/lib/Cloudflare/Local/SidecarServer.d.ts.map +0 -1
- package/lib/Cloudflare/Local/SidecarServer.js +0 -34
- package/lib/Cloudflare/Local/SidecarServer.js.map +0 -1
- package/lib/Secret.d.ts +0 -50
- package/lib/Secret.d.ts.map +0 -1
- package/lib/Secret.js +0 -23
- package/lib/Secret.js.map +0 -1
- package/lib/Sidecar/Lock.d.ts +0 -23
- package/lib/Sidecar/Lock.d.ts.map +0 -1
- package/lib/Sidecar/Lock.js +0 -39
- package/lib/Sidecar/Lock.js.map +0 -1
- package/lib/Sidecar/RpcClient.d.ts +0 -15
- package/lib/Sidecar/RpcClient.d.ts.map +0 -1
- package/lib/Sidecar/RpcClient.js +0 -78
- package/lib/Sidecar/RpcClient.js.map +0 -1
- package/lib/Sidecar/RpcHandler.d.ts +0 -51
- package/lib/Sidecar/RpcHandler.d.ts.map +0 -1
- package/lib/Sidecar/RpcHandler.js +0 -87
- package/lib/Sidecar/RpcHandler.js.map +0 -1
- package/lib/Sidecar/RpcPaths.d.ts +0 -19
- package/lib/Sidecar/RpcPaths.d.ts.map +0 -1
- package/lib/Sidecar/RpcPaths.js +0 -31
- package/lib/Sidecar/RpcPaths.js.map +0 -1
- package/lib/Sidecar/RpcServer.d.ts +0 -30
- package/lib/Sidecar/RpcServer.d.ts.map +0 -1
- package/lib/Sidecar/RpcServer.js +0 -105
- package/lib/Sidecar/RpcServer.js.map +0 -1
- package/lib/Sidecar/RpcServerBun.d.ts +0 -4
- package/lib/Sidecar/RpcServerBun.d.ts.map +0 -1
- package/lib/Sidecar/RpcServerBun.js +0 -28
- package/lib/Sidecar/RpcServerBun.js.map +0 -1
- package/lib/Sidecar/RpcServerNode.d.ts +0 -4
- package/lib/Sidecar/RpcServerNode.d.ts.map +0 -1
- package/lib/Sidecar/RpcServerNode.js +0 -39
- package/lib/Sidecar/RpcServerNode.js.map +0 -1
- package/lib/Sidecar/RpcServices.d.ts +0 -6
- package/lib/Sidecar/RpcServices.d.ts.map +0 -1
- package/lib/Sidecar/RpcServices.js +0 -29
- package/lib/Sidecar/RpcServices.js.map +0 -1
- package/lib/Trait.d.ts +0 -43
- package/lib/Trait.d.ts.map +0 -1
- package/lib/Trait.js +0 -17
- package/lib/Trait.js.map +0 -1
- package/lib/Util/LocalhostDns.d.ts +0 -23
- package/lib/Util/LocalhostDns.d.ts.map +0 -1
- package/lib/Util/LocalhostDns.js +0 -46
- package/lib/Util/LocalhostDns.js.map +0 -1
- package/lib/Util/assert-never.d.ts +0 -12
- package/lib/Util/assert-never.d.ts.map +0 -1
- package/lib/Util/assert-never.js +0 -11
- package/lib/Util/assert-never.js.map +0 -1
- package/lib/Util/class.d.ts +0 -3
- package/lib/Util/class.d.ts.map +0 -1
- package/lib/Util/class.js +0 -1
- package/lib/Util/class.js.map +0 -1
- package/lib/Util/ignore.d.ts +0 -40
- package/lib/Util/ignore.d.ts.map +0 -1
- package/lib/Util/ignore.js +0 -591
- package/lib/Util/ignore.js.map +0 -1
- package/lib/Util/instance.d.ts +0 -4
- package/lib/Util/instance.d.ts.map +0 -1
- package/lib/Util/instance.js +0 -1
- package/lib/Util/instance.js.map +0 -1
- package/lib/Util/pointer.d.ts +0 -5
- package/lib/Util/pointer.d.ts.map +0 -1
- package/lib/Util/pointer.js +0 -1
- package/lib/Util/pointer.js.map +0 -1
- package/lib/Util/schema-to-type.d.ts +0 -42
- package/lib/Util/schema-to-type.d.ts.map +0 -1
- package/lib/Util/schema-to-type.js +0 -364
- package/lib/Util/schema-to-type.js.map +0 -1
- package/lib/Util/todo.d.ts +0 -3
- package/lib/Util/todo.d.ts.map +0 -1
- package/lib/Util/todo.js +0 -3
- package/lib/Util/todo.js.map +0 -1
- package/lib/Variable.d.ts +0 -29
- package/lib/Variable.d.ts.map +0 -1
- package/lib/Variable.js +0 -9
- package/lib/Variable.js.map +0 -1
- package/src/Cloudflare/Local/Sidecar.ts +0 -81
- package/src/Cloudflare/Local/SidecarHandlers.ts +0 -491
- package/src/Cloudflare/Local/SidecarServer.ts +0 -70
- package/src/Secret.ts +0 -87
- package/src/Sidecar/Lock.ts +0 -66
- package/src/Sidecar/RpcClient.ts +0 -142
- package/src/Sidecar/RpcHandler.ts +0 -205
- package/src/Sidecar/RpcPaths.ts +0 -39
- package/src/Sidecar/RpcServer.ts +0 -153
- package/src/Sidecar/RpcServerBun.ts +0 -41
- package/src/Sidecar/RpcServerNode.ts +0 -51
- package/src/Sidecar/RpcServices.ts +0 -48
- package/src/Trait.ts +0 -105
- package/src/Util/LocalhostDns.ts +0 -52
- package/src/Util/assert-never.ts +0 -18
- package/src/Util/class.ts +0 -7
- package/src/Util/ignore.ts +0 -815
- package/src/Util/instance.ts +0 -9
- package/src/Util/pointer.ts +0 -5
- package/src/Util/schema-to-type.ts +0 -456
- package/src/Util/todo.ts +0 -4
- package/src/Variable.ts +0 -44
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
import type { PutScriptRequest } from "@distilled.cloud/cloudflare/workers";
|
|
2
|
+
import * as Config from "effect/Config";
|
|
1
3
|
import * as Effect from "effect/Effect";
|
|
2
4
|
import * as Redacted from "effect/Redacted";
|
|
3
5
|
import type { InputProps } from "../../Input.ts";
|
|
4
6
|
import * as Output from "../../Output.ts";
|
|
5
7
|
import type { ResourceBinding } from "../../Resource.ts";
|
|
6
8
|
import { isYieldableEffectLike } from "../../Util/effect.ts";
|
|
9
|
+
import { asEffect } from "../../Util/types.ts";
|
|
10
|
+
import { isAiGateway } from "../AiGateway/AiGateway.ts";
|
|
7
11
|
import { isAnalyticsEngineDataset } from "../AnalyticsEngine/AnalyticsEngineDataset.ts";
|
|
8
12
|
import { isArtifacts } from "../Artifacts/Artifacts.ts";
|
|
13
|
+
import { isBrowserRendering } from "../BrowserRendering/BrowserRendering.ts";
|
|
14
|
+
import { isD1Database } from "../D1/D1Database.ts";
|
|
9
15
|
import { isSendEmail } from "../Email/SendEmail.ts";
|
|
16
|
+
import { isHyperdrive } from "../Hyperdrive/Hyperdrive.ts";
|
|
17
|
+
import { getHyperdriveDevOrigin } from "../Hyperdrive/HyperdriveBinding.ts";
|
|
10
18
|
import { isImages } from "../Images/Images.ts";
|
|
19
|
+
import { isKVNamespace } from "../KV/KVNamespace.ts";
|
|
20
|
+
import { isQueue } from "../Queue/Queue.ts";
|
|
21
|
+
import { isR2Bucket } from "../R2/R2Bucket.ts";
|
|
11
22
|
import { isAssets } from "./Assets.ts";
|
|
12
23
|
import { isDurableObjectNamespaceLike } from "./DurableObjectNamespace.ts";
|
|
13
24
|
import type { WorkerBindingProps } from "./Worker.ts";
|
|
@@ -18,10 +29,10 @@ export const bindWorkerAsyncBindings = Effect.fnUntraced(function* (
|
|
|
18
29
|
resource: Worker,
|
|
19
30
|
props: InputProps<WorkerProps<WorkerBindingProps>>,
|
|
20
31
|
) {
|
|
21
|
-
if (props.
|
|
22
|
-
for (const bindingName in props.
|
|
32
|
+
if (props.env) {
|
|
33
|
+
for (const bindingName in props.env) {
|
|
23
34
|
// @ts-expect-error
|
|
24
|
-
const bindingEff = props.
|
|
35
|
+
const bindingEff = props.env?.[bindingName] as
|
|
25
36
|
| WorkerBindingResource
|
|
26
37
|
| Effect.Effect<WorkerBindingResource>;
|
|
27
38
|
// Bindings can be passed as a plain resource value, an Effect that
|
|
@@ -32,110 +43,14 @@ export const bindWorkerAsyncBindings = Effect.fnUntraced(function* (
|
|
|
32
43
|
: bindingEff;
|
|
33
44
|
|
|
34
45
|
const bindingMeta: InputProps<WorkerBinding> | undefined =
|
|
35
|
-
|
|
36
|
-
? {
|
|
37
|
-
type: "plain_text",
|
|
38
|
-
name: bindingName,
|
|
39
|
-
value: binding,
|
|
40
|
-
}
|
|
41
|
-
: Redacted.isRedacted(binding)
|
|
42
|
-
? {
|
|
43
|
-
type: "secret_text",
|
|
44
|
-
name: bindingName,
|
|
45
|
-
value: Redacted.value(binding),
|
|
46
|
-
}
|
|
47
|
-
: isAssets(binding)
|
|
48
|
-
? {
|
|
49
|
-
type: "assets",
|
|
50
|
-
name: bindingName,
|
|
51
|
-
}
|
|
52
|
-
: isArtifacts(binding)
|
|
53
|
-
? ({
|
|
54
|
-
type: "artifacts",
|
|
55
|
-
name: bindingName,
|
|
56
|
-
namespace: binding.namespace,
|
|
57
|
-
} as any)
|
|
58
|
-
: isImages(binding)
|
|
59
|
-
? {
|
|
60
|
-
type: "images",
|
|
61
|
-
name: bindingName,
|
|
62
|
-
}
|
|
63
|
-
: isAnalyticsEngineDataset(binding)
|
|
64
|
-
? {
|
|
65
|
-
type: "analytics_engine",
|
|
66
|
-
name: bindingName,
|
|
67
|
-
dataset: binding.dataset,
|
|
68
|
-
}
|
|
69
|
-
: isSendEmail(binding)
|
|
70
|
-
? {
|
|
71
|
-
type: "send_email",
|
|
72
|
-
name: bindingName,
|
|
73
|
-
destinationAddress: binding.destinationAddress,
|
|
74
|
-
allowedDestinationAddresses:
|
|
75
|
-
binding.allowedDestinationAddresses,
|
|
76
|
-
allowedSenderAddresses:
|
|
77
|
-
binding.allowedSenderAddresses,
|
|
78
|
-
}
|
|
79
|
-
: isDurableObjectNamespaceLike(binding)
|
|
80
|
-
? {
|
|
81
|
-
type: "durable_object_namespace",
|
|
82
|
-
name: bindingName,
|
|
83
|
-
className: binding.className ?? binding.name,
|
|
84
|
-
}
|
|
85
|
-
: binding.Type === "Cloudflare.D1Database"
|
|
86
|
-
? {
|
|
87
|
-
type: "d1",
|
|
88
|
-
id: binding.databaseId,
|
|
89
|
-
name: bindingName,
|
|
90
|
-
}
|
|
91
|
-
: binding.Type === "Cloudflare.R2Bucket"
|
|
92
|
-
? {
|
|
93
|
-
type: "r2_bucket",
|
|
94
|
-
name: bindingName,
|
|
95
|
-
bucketName: binding.bucketName,
|
|
96
|
-
jurisdiction: binding.jurisdiction.pipe(
|
|
97
|
-
Output.map((jurisdiction) =>
|
|
98
|
-
jurisdiction === "default"
|
|
99
|
-
? undefined
|
|
100
|
-
: jurisdiction,
|
|
101
|
-
),
|
|
102
|
-
),
|
|
103
|
-
}
|
|
104
|
-
: binding.Type === "Cloudflare.KVNamespace"
|
|
105
|
-
? {
|
|
106
|
-
type: "kv_namespace",
|
|
107
|
-
name: bindingName,
|
|
108
|
-
namespaceId: binding.namespaceId,
|
|
109
|
-
}
|
|
110
|
-
: binding.Type === "Cloudflare.Queue"
|
|
111
|
-
? {
|
|
112
|
-
type: "queue",
|
|
113
|
-
name: bindingName,
|
|
114
|
-
queueName: binding.queueName,
|
|
115
|
-
}
|
|
116
|
-
: binding.Type === "Cloudflare.AiGateway"
|
|
117
|
-
? {
|
|
118
|
-
type: "ai",
|
|
119
|
-
name: bindingName,
|
|
120
|
-
}
|
|
121
|
-
: binding.Type === "Cloudflare.Hyperdrive"
|
|
122
|
-
? {
|
|
123
|
-
type: "hyperdrive",
|
|
124
|
-
name: bindingName,
|
|
125
|
-
id: binding.hyperdriveId,
|
|
126
|
-
}
|
|
127
|
-
: isWorker(binding)
|
|
128
|
-
? {
|
|
129
|
-
type: "service",
|
|
130
|
-
name: bindingName,
|
|
131
|
-
service: binding.workerName,
|
|
132
|
-
}
|
|
133
|
-
: // TODO(sam): handle others
|
|
134
|
-
undefined;
|
|
46
|
+
yield* asEffect(toBinding(bindingName, binding));
|
|
135
47
|
|
|
136
48
|
if (bindingMeta) {
|
|
137
49
|
yield* resource.bind`${bindingName}`({
|
|
138
50
|
bindings: [bindingMeta],
|
|
51
|
+
hyperdrives: isHyperdrive(binding)
|
|
52
|
+
? getHyperdriveDevOrigin(binding)
|
|
53
|
+
: undefined,
|
|
139
54
|
});
|
|
140
55
|
} else {
|
|
141
56
|
return yield* Effect.die(`Unknown binding type: ${bindingName}`);
|
|
@@ -144,6 +59,146 @@ export const bindWorkerAsyncBindings = Effect.fnUntraced(function* (
|
|
|
144
59
|
}
|
|
145
60
|
});
|
|
146
61
|
|
|
62
|
+
type BindingSpec = InputProps<
|
|
63
|
+
Exclude<PutScriptRequest["metadata"]["bindings"], undefined>[number]
|
|
64
|
+
>;
|
|
65
|
+
|
|
66
|
+
const toBinding = (
|
|
67
|
+
bindingName: string,
|
|
68
|
+
binding: WorkerBindingResource,
|
|
69
|
+
): BindingSpec | Effect.Effect<BindingSpec> | undefined => {
|
|
70
|
+
// narrowing to Config<unknown> doesn't work for us, we need any
|
|
71
|
+
const isConfig: (a: any) => a is Config.Config<any> = Config.isConfig;
|
|
72
|
+
// narrowing to Redacted<unknown> doesn't work for us, we need any
|
|
73
|
+
const isRedacted: (a: any) => a is Redacted.Redacted<any> =
|
|
74
|
+
Redacted.isRedacted;
|
|
75
|
+
|
|
76
|
+
if (typeof binding === "string") {
|
|
77
|
+
return {
|
|
78
|
+
type: "plain_text",
|
|
79
|
+
name: bindingName,
|
|
80
|
+
text: binding,
|
|
81
|
+
};
|
|
82
|
+
} else if (isRedacted(binding)) {
|
|
83
|
+
const val = Redacted.value(binding);
|
|
84
|
+
if (typeof val === "string") {
|
|
85
|
+
return {
|
|
86
|
+
type: "secret_text",
|
|
87
|
+
name: bindingName,
|
|
88
|
+
text: val,
|
|
89
|
+
};
|
|
90
|
+
} else {
|
|
91
|
+
return {
|
|
92
|
+
type: "secret_text",
|
|
93
|
+
name: bindingName,
|
|
94
|
+
text: JSON.stringify(val),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
} else if (isConfig(binding)) {
|
|
98
|
+
return binding.pipe(
|
|
99
|
+
Effect.flatMap((json) => {
|
|
100
|
+
const b = toBinding(bindingName, json)!;
|
|
101
|
+
return Effect.isEffect(b) ? b : Effect.succeed(b);
|
|
102
|
+
}),
|
|
103
|
+
Effect.orDie,
|
|
104
|
+
);
|
|
105
|
+
} else if (isAssets(binding)) {
|
|
106
|
+
return {
|
|
107
|
+
type: "assets",
|
|
108
|
+
name: bindingName,
|
|
109
|
+
};
|
|
110
|
+
} else if (isArtifacts(binding)) {
|
|
111
|
+
return {
|
|
112
|
+
type: "artifacts",
|
|
113
|
+
name: bindingName,
|
|
114
|
+
namespace: binding.namespace,
|
|
115
|
+
};
|
|
116
|
+
} else if (isImages(binding)) {
|
|
117
|
+
return {
|
|
118
|
+
type: "images",
|
|
119
|
+
name: bindingName,
|
|
120
|
+
};
|
|
121
|
+
} else if (isBrowserRendering(binding)) {
|
|
122
|
+
return {
|
|
123
|
+
type: "browser",
|
|
124
|
+
name: bindingName,
|
|
125
|
+
};
|
|
126
|
+
} else if (isAnalyticsEngineDataset(binding)) {
|
|
127
|
+
return {
|
|
128
|
+
type: "analytics_engine",
|
|
129
|
+
name: bindingName,
|
|
130
|
+
dataset: binding.dataset,
|
|
131
|
+
};
|
|
132
|
+
} else if (isSendEmail(binding)) {
|
|
133
|
+
return {
|
|
134
|
+
type: "send_email",
|
|
135
|
+
name: bindingName,
|
|
136
|
+
destinationAddress: binding.destinationAddress,
|
|
137
|
+
allowedDestinationAddresses: binding.allowedDestinationAddresses,
|
|
138
|
+
allowedSenderAddresses: binding.allowedSenderAddresses,
|
|
139
|
+
};
|
|
140
|
+
} else if (isDurableObjectNamespaceLike(binding)) {
|
|
141
|
+
return {
|
|
142
|
+
type: "durable_object_namespace",
|
|
143
|
+
name: bindingName,
|
|
144
|
+
className: binding.className ?? binding.name,
|
|
145
|
+
scriptName: binding.scriptName,
|
|
146
|
+
};
|
|
147
|
+
} else if (isD1Database(binding)) {
|
|
148
|
+
return {
|
|
149
|
+
type: "d1",
|
|
150
|
+
databaseId: binding.databaseId,
|
|
151
|
+
name: bindingName,
|
|
152
|
+
};
|
|
153
|
+
} else if (isR2Bucket(binding)) {
|
|
154
|
+
return {
|
|
155
|
+
type: "r2_bucket",
|
|
156
|
+
name: bindingName,
|
|
157
|
+
bucketName: binding.bucketName,
|
|
158
|
+
jurisdiction: binding.jurisdiction.pipe(
|
|
159
|
+
Output.map((jurisdiction) =>
|
|
160
|
+
jurisdiction === "default" ? undefined : jurisdiction,
|
|
161
|
+
),
|
|
162
|
+
),
|
|
163
|
+
};
|
|
164
|
+
} else if (isKVNamespace(binding)) {
|
|
165
|
+
return {
|
|
166
|
+
type: "kv_namespace",
|
|
167
|
+
name: bindingName,
|
|
168
|
+
namespaceId: binding.namespaceId,
|
|
169
|
+
};
|
|
170
|
+
} else if (isQueue(binding)) {
|
|
171
|
+
return {
|
|
172
|
+
type: "queue",
|
|
173
|
+
name: bindingName,
|
|
174
|
+
queueName: binding.queueName,
|
|
175
|
+
};
|
|
176
|
+
} else if (isAiGateway(binding)) {
|
|
177
|
+
return {
|
|
178
|
+
type: "ai",
|
|
179
|
+
name: bindingName,
|
|
180
|
+
};
|
|
181
|
+
} else if (isHyperdrive(binding)) {
|
|
182
|
+
return {
|
|
183
|
+
type: "hyperdrive",
|
|
184
|
+
name: bindingName,
|
|
185
|
+
id: binding.hyperdriveId,
|
|
186
|
+
};
|
|
187
|
+
} else if (isWorker(binding)) {
|
|
188
|
+
return {
|
|
189
|
+
type: "service",
|
|
190
|
+
name: bindingName,
|
|
191
|
+
service: binding.workerName,
|
|
192
|
+
};
|
|
193
|
+
} else {
|
|
194
|
+
return {
|
|
195
|
+
type: "json",
|
|
196
|
+
name: bindingName,
|
|
197
|
+
json: binding,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
147
202
|
export const getCronBindings = (
|
|
148
203
|
bindings: ReadonlyArray<ResourceBinding<Worker["Binding"]>>,
|
|
149
204
|
) => Array.from(new Set(bindings.flatMap((b) => b.data.crons ?? [])));
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type * as workers from "@distilled.cloud/cloudflare/workers";
|
|
2
|
+
import * as Config from "effect/Config";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
import type { Json } from "effect/Schema";
|
|
3
6
|
import * as Binding from "../../Binding.ts";
|
|
4
7
|
import type { Rpc } from "../../Rpc.ts";
|
|
5
8
|
import { isYieldableEffectLike } from "../../Util/effect.ts";
|
|
6
9
|
import type { AiGateway } from "../AiGateway/AiGateway.ts";
|
|
7
10
|
import { AnalyticsEngineDataset } from "../AnalyticsEngine/AnalyticsEngineDataset.ts";
|
|
8
11
|
import { Artifacts } from "../Artifacts/Artifacts.ts";
|
|
12
|
+
import { BrowserRendering } from "../BrowserRendering/BrowserRendering.ts";
|
|
9
13
|
import type { D1Database } from "../D1/D1Database.ts";
|
|
10
14
|
import { SendEmail } from "../Email/SendEmail.ts";
|
|
11
15
|
import { Hyperdrive } from "../Hyperdrive/Hyperdrive.ts";
|
|
@@ -29,6 +33,11 @@ export type WorkerSettingsBinding = Exclude<
|
|
|
29
33
|
>[number];
|
|
30
34
|
|
|
31
35
|
export type WorkerBindingResource =
|
|
36
|
+
// Config values
|
|
37
|
+
| Json
|
|
38
|
+
| Redacted.Redacted<Json>
|
|
39
|
+
| Config.Config<Json>
|
|
40
|
+
// CF resources
|
|
32
41
|
| Assets
|
|
33
42
|
| R2Bucket
|
|
34
43
|
| D1Database
|
|
@@ -38,6 +47,7 @@ export type WorkerBindingResource =
|
|
|
38
47
|
| AnalyticsEngineDataset
|
|
39
48
|
| SendEmail
|
|
40
49
|
| Artifacts
|
|
50
|
+
| BrowserRendering
|
|
41
51
|
| Images
|
|
42
52
|
| Hyperdrive
|
|
43
53
|
| Worker
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type * as cf from "@cloudflare/workers-types";
|
|
2
|
-
import
|
|
2
|
+
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
3
3
|
import type { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
|
4
|
-
import { Stream } from "effect";
|
|
5
4
|
import * as Cause from "effect/Cause";
|
|
6
5
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
7
6
|
import * as Context from "effect/Context";
|
|
@@ -12,11 +11,14 @@ import * as Layer from "effect/Layer";
|
|
|
12
11
|
import * as Logger from "effect/Logger";
|
|
13
12
|
import { MinimumLogLevel } from "effect/References";
|
|
14
13
|
import * as Scope from "effect/Scope";
|
|
15
|
-
import
|
|
14
|
+
import * as Stream from "effect/Stream";
|
|
15
|
+
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
16
16
|
import { ExecutionContext } from "../../ExecutionContext.ts";
|
|
17
17
|
import { makeEntrypointLayer } from "../../Runtime.ts";
|
|
18
18
|
import { Self } from "../../Self.ts";
|
|
19
19
|
import { Stack } from "../../Stack.ts";
|
|
20
|
+
import cloudflare_workers from "./cloudflare_workers.ts";
|
|
21
|
+
import { isScopeEjected } from "./HttpServer.ts";
|
|
20
22
|
import {
|
|
21
23
|
ErrorTag,
|
|
22
24
|
type RpcErrorEnvelope,
|
|
@@ -31,7 +33,6 @@ import {
|
|
|
31
33
|
WorkerExecutionContext,
|
|
32
34
|
} from "./Worker.ts";
|
|
33
35
|
import type { WorkerRuntimeContext } from "./WorkerRuntimeContext.ts";
|
|
34
|
-
import cloudflare_workers from "./cloudflare_workers.ts";
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* Makes the WorkerEntrypoint class and bridges to Effect fetch and RPC calls.
|
|
@@ -88,9 +89,11 @@ export const makeWorkerBridge = (
|
|
|
88
89
|
Effect.runPromiseExit,
|
|
89
90
|
)
|
|
90
91
|
.finally(() =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
isScopeEjected(scope)
|
|
93
|
+
? undefined
|
|
94
|
+
: Scope.close(scope, Exit.void).pipe(Effect.runPromise, (promise) =>
|
|
95
|
+
ctx.waitUntil(promise),
|
|
96
|
+
),
|
|
94
97
|
);
|
|
95
98
|
};
|
|
96
99
|
class WorkerBridge extends Base {
|
|
@@ -138,7 +141,6 @@ export const makeWorkerBridge = (
|
|
|
138
141
|
),
|
|
139
142
|
);
|
|
140
143
|
}
|
|
141
|
-
console.log("dispatcher", dispatcher.toString());
|
|
142
144
|
return Effect.succeed([
|
|
143
145
|
dispatcher(...args) as Effect.Effect<any>,
|
|
144
146
|
Context.empty(),
|
|
@@ -272,7 +274,6 @@ export const makeRpcProxy = (
|
|
|
272
274
|
),
|
|
273
275
|
);
|
|
274
276
|
}
|
|
275
|
-
console.log("dispatcher", dispatcher.toString());
|
|
276
277
|
return dispatcher(...args) as Effect.Effect<any>;
|
|
277
278
|
}),
|
|
278
279
|
processEvent,
|
|
@@ -5,15 +5,14 @@ import { flow } from "effect/Function";
|
|
|
5
5
|
import type * as Path from "effect/Path";
|
|
6
6
|
import * as Stream from "effect/Stream";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
|
+
import path from "pathe";
|
|
8
9
|
import type * as rolldown from "rolldown";
|
|
9
|
-
import Sonda from "sonda/rolldown";
|
|
10
10
|
import * as Bundle from "../../Bundle/Bundle.ts";
|
|
11
11
|
import { findCwdForBundle } from "../../Bundle/TempRoot.ts";
|
|
12
12
|
import {
|
|
13
13
|
isDurableObjectExport,
|
|
14
14
|
type DurableObjectExport,
|
|
15
15
|
} from "./DurableObjectNamespace.ts";
|
|
16
|
-
import type { WorkerProps } from "./Worker.ts";
|
|
17
16
|
import { isWorkflowExport, type WorkflowExport } from "./Workflow.ts";
|
|
18
17
|
|
|
19
18
|
export interface WorkerBundleOptions {
|
|
@@ -32,7 +31,7 @@ export interface WorkerBundleOptions {
|
|
|
32
31
|
exports: Record<string, DurableObjectExport | WorkflowExport>;
|
|
33
32
|
};
|
|
34
33
|
stack: { name: string; stage: string };
|
|
35
|
-
|
|
34
|
+
extraOptions: Bundle.BundleExtraOptions | undefined;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
export const WorkerBundle = Effect.gen(function* () {
|
|
@@ -74,11 +73,12 @@ export const WorkerBundle = Effect.gen(function* () {
|
|
|
74
73
|
),
|
|
75
74
|
]
|
|
76
75
|
: undefined,
|
|
77
|
-
...(options.userOptions?.metafile ? [Sonda({ open: false })] : []),
|
|
78
76
|
],
|
|
79
77
|
checks: {
|
|
80
78
|
// Suppress unresolved import warnings for unrelated AWS packages
|
|
81
79
|
unresolvedImport: false,
|
|
80
|
+
// Suppress warning caused by static import of `@effect/platform-node/NodeServices` in `WorkerBridge.ts`
|
|
81
|
+
ineffectiveDynamicImport: false,
|
|
82
82
|
},
|
|
83
83
|
};
|
|
84
84
|
const outputOptions: rolldown.OutputOptions = {
|
|
@@ -88,10 +88,7 @@ export const WorkerBundle = Effect.gen(function* () {
|
|
|
88
88
|
keepNames: true,
|
|
89
89
|
dir: `.alchemy/bundles/${options.id}`,
|
|
90
90
|
};
|
|
91
|
-
|
|
92
|
-
pure: options.userOptions?.pure,
|
|
93
|
-
};
|
|
94
|
-
return { inputOptions, outputOptions, extraOptions };
|
|
91
|
+
return { inputOptions, outputOptions, extraOptions: options.extraOptions };
|
|
95
92
|
});
|
|
96
93
|
|
|
97
94
|
const sanitizeMain = (main: string) =>
|
|
@@ -102,7 +99,9 @@ export const WorkerBundle = Effect.gen(function* () {
|
|
|
102
99
|
return main;
|
|
103
100
|
}
|
|
104
101
|
}).pipe(
|
|
105
|
-
Effect.flatMap((
|
|
102
|
+
Effect.flatMap((p) => fs.realPath(p)),
|
|
103
|
+
//* fix windows paths
|
|
104
|
+
Effect.map((p) => path.resolve(p)),
|
|
106
105
|
Effect.mapError(
|
|
107
106
|
(cause) =>
|
|
108
107
|
new Bundle.BundleError({
|
|
@@ -33,17 +33,12 @@ export const makeWorkerRuntimeContext = (id: string): WorkerRuntimeContext => {
|
|
|
33
33
|
get: (key: string) =>
|
|
34
34
|
Effect.serviceOption(WorkerEnvironment).pipe(
|
|
35
35
|
Effect.map(Option.getOrUndefined),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
? Effect.succeed(env[key])
|
|
39
|
-
: Effect.die("WorkerEnvironment not found"),
|
|
40
|
-
),
|
|
41
|
-
Effect.flatMap((value) =>
|
|
42
|
-
value
|
|
43
|
-
? Effect.succeed(value)
|
|
44
|
-
: Effect.die(`Environment variable '${key}' not found`),
|
|
45
|
-
),
|
|
36
|
+
// Key is already canonical (see RuntimeContext.sanitizeKey).
|
|
37
|
+
Effect.map((env) => env?.[key]),
|
|
46
38
|
Effect.map((json) => {
|
|
39
|
+
if (json === undefined) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
47
42
|
try {
|
|
48
43
|
const value = JSON.parse(json);
|
|
49
44
|
// The `set` path serializes Redacted values as
|
|
@@ -53,10 +48,9 @@ export const makeWorkerRuntimeContext = (id: string): WorkerRuntimeContext => {
|
|
|
53
48
|
// and rebuild the Redacted wrapper. Plain values pass
|
|
54
49
|
// through unchanged.
|
|
55
50
|
if (
|
|
56
|
-
value !== null &&
|
|
57
51
|
typeof value === "object" &&
|
|
58
|
-
|
|
59
|
-
"value" in
|
|
52
|
+
value?._tag === "Redacted" &&
|
|
53
|
+
"value" in value
|
|
60
54
|
) {
|
|
61
55
|
return Redacted.make((value as { value: unknown }).value);
|
|
62
56
|
}
|
|
@@ -66,9 +60,8 @@ export const makeWorkerRuntimeContext = (id: string): WorkerRuntimeContext => {
|
|
|
66
60
|
}
|
|
67
61
|
}),
|
|
68
62
|
) as any,
|
|
69
|
-
set: (
|
|
63
|
+
set: (key: string, output: Output.Output) =>
|
|
70
64
|
Effect.sync(() => {
|
|
71
|
-
const key = id.replaceAll(/[^a-zA-Z0-9]/g, "_");
|
|
72
65
|
// Preserve `Redacted`-ness across the Output → env → Cloudflare
|
|
73
66
|
// binding boundary so the put-worker loop can deploy secrets via
|
|
74
67
|
// `secret_text` instead of leaking them as `plain_text`. The JSON
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as workflows from "@distilled.cloud/cloudflare/workflows";
|
|
2
|
+
import type { ConfigError } from "effect/Config";
|
|
2
3
|
import * as Context from "effect/Context";
|
|
3
4
|
import * as Effect from "effect/Effect";
|
|
5
|
+
import { AlchemyContext } from "../../AlchemyContext.ts";
|
|
4
6
|
import { ALCHEMY_PHASE } from "../../Phase.ts";
|
|
5
7
|
import type { PlatformServices } from "../../Platform.ts";
|
|
6
8
|
import * as Provider from "../../Provider.ts";
|
|
@@ -173,7 +175,7 @@ export interface WorkflowClass extends Effect.Effect<
|
|
|
173
175
|
<_Self>(): {
|
|
174
176
|
<Input = unknown, Result = unknown, InitReq = never>(
|
|
175
177
|
name: string,
|
|
176
|
-
impl: Effect.Effect<WorkflowImpl<Input, Result>,
|
|
178
|
+
impl: Effect.Effect<WorkflowImpl<Input, Result>, ConfigError, InitReq>,
|
|
177
179
|
): Effect.Effect<
|
|
178
180
|
WorkflowHandle<Input, Result>,
|
|
179
181
|
never,
|
|
@@ -184,7 +186,7 @@ export interface WorkflowClass extends Effect.Effect<
|
|
|
184
186
|
};
|
|
185
187
|
<Input = unknown, Result = unknown, InitReq = never>(
|
|
186
188
|
name: string,
|
|
187
|
-
impl: Effect.Effect<WorkflowImpl<Input, Result>,
|
|
189
|
+
impl: Effect.Effect<WorkflowImpl<Input, Result>, ConfigError, InitReq>,
|
|
188
190
|
): Effect.Effect<
|
|
189
191
|
WorkflowHandle<Input, Result>,
|
|
190
192
|
never,
|
|
@@ -477,17 +479,34 @@ export const WorkflowProvider = () =>
|
|
|
477
479
|
Provider.effect(
|
|
478
480
|
WorkflowResource,
|
|
479
481
|
Effect.gen(function* () {
|
|
482
|
+
const ctx = yield* AlchemyContext;
|
|
480
483
|
const { accountId } = yield* CloudflareEnvironment;
|
|
481
484
|
const putWorkflow = yield* workflows.putWorkflow;
|
|
482
485
|
const deleteWorkflow = yield* workflows.deleteWorkflow;
|
|
483
486
|
|
|
484
487
|
return WorkflowResource.Provider.of({
|
|
485
|
-
|
|
488
|
+
// The `workflowId` is no longer marked as stable because if you start in dev mode, the ID will change on first deploy.
|
|
489
|
+
stables: ["accountId"],
|
|
490
|
+
diff: Effect.fnUntraced(function* ({ output }) {
|
|
491
|
+
// If the workflowId starts with "dev:", and we're not in dev mode, trigger an update so the workflow is created.
|
|
492
|
+
if (output?.workflowId.startsWith("dev:") && !ctx.dev) {
|
|
493
|
+
return { action: "update" };
|
|
494
|
+
}
|
|
495
|
+
}),
|
|
486
496
|
reconcile: Effect.fnUntraced(function* ({ news, output }) {
|
|
487
497
|
const acct = output?.accountId ?? accountId;
|
|
488
498
|
yield* Effect.logInfo(
|
|
489
499
|
`Cloudflare Workflow reconcile: ${news.workflowName}`,
|
|
490
500
|
);
|
|
501
|
+
if (ctx.dev) {
|
|
502
|
+
return {
|
|
503
|
+
workflowId: output?.workflowId ?? `dev:${crypto.randomUUID()}`,
|
|
504
|
+
accountId,
|
|
505
|
+
workflowName: news.workflowName,
|
|
506
|
+
className: news.className,
|
|
507
|
+
scriptName: news.scriptName,
|
|
508
|
+
};
|
|
509
|
+
}
|
|
491
510
|
// Cloudflare's `putWorkflow` is a true PUT-as-upsert: identical
|
|
492
511
|
// payloads converge to the same state and a missing workflow is
|
|
493
512
|
// created on the spot. There is no separate observe step needed
|
|
@@ -12,6 +12,8 @@ export * from "./InferEnv.ts";
|
|
|
12
12
|
export * from "./LocalWorkerProvider.ts";
|
|
13
13
|
export * from "./Request.ts";
|
|
14
14
|
export * from "./Rpc.ts";
|
|
15
|
+
export * from "./RpcDurableObjectNamespace.ts";
|
|
16
|
+
export * from "./RpcWorker.ts";
|
|
15
17
|
export * from "./ScheduledEvents.ts";
|
|
16
18
|
export * from "./WebSocket.ts";
|
|
17
19
|
export * from "./Worker.ts";
|