alchemy 2.0.0-beta.62 → 2.0.0-beta.63
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/README.md +12 -12
- package/bin/exec.js +1959 -70
- package/bin/exec.js.map +1 -1
- package/lib/AWS/AuthProvider.js +1 -1
- package/lib/AWS/AuthProvider.js.map +1 -1
- package/lib/AWS/EC2/hosted.d.ts.map +1 -1
- package/lib/AWS/EC2/hosted.js +2 -1
- package/lib/AWS/EC2/hosted.js.map +1 -1
- package/lib/AWS/ECS/Task.d.ts.map +1 -1
- package/lib/AWS/ECS/Task.js +2 -1
- package/lib/AWS/ECS/Task.js.map +1 -1
- package/lib/AWS/Lambda/Function.d.ts.map +1 -1
- package/lib/AWS/Lambda/Function.js +13 -40
- package/lib/AWS/Lambda/Function.js.map +1 -1
- package/lib/AWS/Lambda/MicrovmRuntimeContext.d.ts.map +1 -1
- package/lib/AWS/Lambda/MicrovmRuntimeContext.js +9 -21
- package/lib/AWS/Lambda/MicrovmRuntimeContext.js.map +1 -1
- package/lib/Action.d.ts +8 -0
- package/lib/Action.d.ts.map +1 -1
- package/lib/Action.js +16 -5
- package/lib/Action.js.map +1 -1
- package/lib/ActionRuntimeContext.d.ts +14 -0
- package/lib/ActionRuntimeContext.d.ts.map +1 -0
- package/lib/ActionRuntimeContext.js +56 -0
- package/lib/ActionRuntimeContext.js.map +1 -0
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +40 -6
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts +3 -3
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +1 -1
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/Lock.d.ts.map +1 -1
- package/lib/Auth/Lock.js +5 -2
- package/lib/Auth/Lock.js.map +1 -1
- package/lib/Bundle/PurePlugin.d.ts.map +1 -1
- package/lib/Bundle/PurePlugin.js +26 -1
- package/lib/Bundle/PurePlugin.js.map +1 -1
- package/lib/Bundle/Vite.d.ts +2 -0
- package/lib/Bundle/Vite.d.ts.map +1 -1
- package/lib/Bundle/Vite.js +24 -1
- package/lib/Bundle/Vite.js.map +1 -1
- package/lib/Cli/LoggingCli.d.ts.map +1 -1
- package/lib/Cli/LoggingCli.js +7 -4
- package/lib/Cli/LoggingCli.js.map +1 -1
- package/lib/Cli/commands/_shared.d.ts +19 -0
- package/lib/Cli/commands/_shared.d.ts.map +1 -1
- package/lib/Cli/commands/_shared.js +22 -0
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/login.d.ts +7 -3
- package/lib/Cli/commands/login.d.ts.map +1 -1
- package/lib/Cli/commands/login.js +70 -12
- 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 -20
- package/lib/Cli/commands/profile.js.map +1 -1
- package/lib/Cloudflare/AI/LanguageModel.js +21 -4
- package/lib/Cloudflare/AI/LanguageModel.js.map +1 -1
- package/lib/Cloudflare/AI/QuerySearchLocal.d.ts +37 -0
- package/lib/Cloudflare/AI/QuerySearchLocal.d.ts.map +1 -0
- package/lib/Cloudflare/AI/QuerySearchLocal.js +53 -0
- package/lib/Cloudflare/AI/QuerySearchLocal.js.map +1 -0
- package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.d.ts +35 -0
- package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.js +47 -0
- package/lib/Cloudflare/AI/QuerySearchNamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/AI/SearchHttpClient.d.ts +34 -0
- package/lib/Cloudflare/AI/SearchHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/AI/SearchHttpClient.js +262 -0
- package/lib/Cloudflare/AI/SearchHttpClient.js.map +1 -0
- package/lib/Cloudflare/AI/index.d.ts +2 -0
- package/lib/Cloudflare/AI/index.d.ts.map +1 -1
- package/lib/Cloudflare/AI/index.js +2 -0
- package/lib/Cloudflare/AI/index.js.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.js +11 -1
- package/lib/Cloudflare/Containers/ContainerBundle.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerPlatform.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerPlatform.js +12 -33
- package/lib/Cloudflare/Containers/ContainerPlatform.js.map +1 -1
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts +24 -0
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js +106 -0
- package/lib/Cloudflare/D1/QueryDatabaseHttpClient.js.map +1 -0
- package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts +38 -0
- package/lib/Cloudflare/D1/QueryDatabaseLocal.d.ts.map +1 -0
- package/lib/Cloudflare/D1/QueryDatabaseLocal.js +54 -0
- package/lib/Cloudflare/D1/QueryDatabaseLocal.js.map +1 -0
- package/lib/Cloudflare/D1/index.d.ts +1 -0
- package/lib/Cloudflare/D1/index.d.ts.map +1 -1
- package/lib/Cloudflare/D1/index.js +1 -0
- package/lib/Cloudflare/D1/index.js.map +1 -1
- package/lib/Cloudflare/DNS/DnsHttp.d.ts +16 -1
- package/lib/Cloudflare/DNS/DnsHttp.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/DnsHttp.js +6 -1
- package/lib/Cloudflare/DNS/DnsHttp.js.map +1 -1
- package/lib/Cloudflare/DNS/DnsLocal.d.ts +22 -0
- package/lib/Cloudflare/DNS/DnsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/DNS/DnsLocal.js +31 -0
- package/lib/Cloudflare/DNS/DnsLocal.js.map +1 -0
- package/lib/Cloudflare/DNS/ReadDnsHttp.d.ts +3 -3
- package/lib/Cloudflare/DNS/ReadDnsHttp.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/ReadDnsHttp.js +3 -4
- package/lib/Cloudflare/DNS/ReadDnsHttp.js.map +1 -1
- package/lib/Cloudflare/DNS/ReadDnsLocal.d.ts +32 -0
- package/lib/Cloudflare/DNS/ReadDnsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/DNS/ReadDnsLocal.js +35 -0
- package/lib/Cloudflare/DNS/ReadDnsLocal.js.map +1 -0
- package/lib/Cloudflare/DNS/ReadWriteDnsHttp.d.ts +3 -3
- package/lib/Cloudflare/DNS/ReadWriteDnsHttp.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/ReadWriteDnsHttp.js +4 -4
- package/lib/Cloudflare/DNS/ReadWriteDnsHttp.js.map +1 -1
- package/lib/Cloudflare/DNS/ReadWriteDnsLocal.d.ts +40 -0
- package/lib/Cloudflare/DNS/ReadWriteDnsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/DNS/ReadWriteDnsLocal.js +43 -0
- package/lib/Cloudflare/DNS/ReadWriteDnsLocal.js.map +1 -0
- package/lib/Cloudflare/DNS/WriteDnsHttp.d.ts +3 -3
- package/lib/Cloudflare/DNS/WriteDnsHttp.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/WriteDnsHttp.js +3 -4
- package/lib/Cloudflare/DNS/WriteDnsHttp.js.map +1 -1
- package/lib/Cloudflare/DNS/WriteDnsLocal.d.ts +38 -0
- package/lib/Cloudflare/DNS/WriteDnsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/DNS/WriteDnsLocal.js +41 -0
- package/lib/Cloudflare/DNS/WriteDnsLocal.js.map +1 -0
- package/lib/Cloudflare/DNS/index.d.ts +3 -0
- package/lib/Cloudflare/DNS/index.d.ts.map +1 -1
- package/lib/Cloudflare/DNS/index.js +3 -0
- package/lib/Cloudflare/DNS/index.js.map +1 -1
- package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.d.ts +27 -0
- package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.js +86 -0
- package/lib/Cloudflare/Flagship/ReadFlagsHttpClient.js.map +1 -0
- package/lib/Cloudflare/Flagship/ReadFlagsLocal.d.ts +41 -0
- package/lib/Cloudflare/Flagship/ReadFlagsLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Flagship/ReadFlagsLocal.js +57 -0
- package/lib/Cloudflare/Flagship/ReadFlagsLocal.js.map +1 -0
- package/lib/Cloudflare/Flagship/index.d.ts +1 -0
- package/lib/Cloudflare/Flagship/index.d.ts.map +1 -1
- package/lib/Cloudflare/Flagship/index.js +1 -0
- package/lib/Cloudflare/Flagship/index.js.map +1 -1
- package/lib/Cloudflare/KV/NamespaceHttp.d.ts +16 -1
- package/lib/Cloudflare/KV/NamespaceHttp.d.ts.map +1 -1
- package/lib/Cloudflare/KV/NamespaceHttp.js +8 -2
- package/lib/Cloudflare/KV/NamespaceHttp.js.map +1 -1
- package/lib/Cloudflare/KV/NamespaceLocal.d.ts +22 -0
- package/lib/Cloudflare/KV/NamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/KV/NamespaceLocal.js +32 -0
- package/lib/Cloudflare/KV/NamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/KV/ReadNamespaceHttp.d.ts +2 -2
- package/lib/Cloudflare/KV/ReadNamespaceHttp.d.ts.map +1 -1
- package/lib/Cloudflare/KV/ReadNamespaceHttp.js +5 -6
- package/lib/Cloudflare/KV/ReadNamespaceHttp.js.map +1 -1
- package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts +27 -0
- package/lib/Cloudflare/KV/ReadNamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/KV/ReadNamespaceLocal.js +30 -0
- package/lib/Cloudflare/KV/ReadNamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.d.ts +3 -3
- package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.d.ts.map +1 -1
- package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.js +6 -6
- package/lib/Cloudflare/KV/ReadWriteNamespaceHttp.js.map +1 -1
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts +34 -0
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js +37 -0
- package/lib/Cloudflare/KV/ReadWriteNamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/KV/WriteNamespaceHttp.d.ts +2 -2
- package/lib/Cloudflare/KV/WriteNamespaceHttp.d.ts.map +1 -1
- package/lib/Cloudflare/KV/WriteNamespaceHttp.js +5 -6
- package/lib/Cloudflare/KV/WriteNamespaceHttp.js.map +1 -1
- package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts +27 -0
- package/lib/Cloudflare/KV/WriteNamespaceLocal.d.ts.map +1 -0
- package/lib/Cloudflare/KV/WriteNamespaceLocal.js +30 -0
- package/lib/Cloudflare/KV/WriteNamespaceLocal.js.map +1 -0
- package/lib/Cloudflare/KV/index.d.ts +3 -0
- package/lib/Cloudflare/KV/index.d.ts.map +1 -1
- package/lib/Cloudflare/KV/index.js +3 -0
- package/lib/Cloudflare/KV/index.js.map +1 -1
- package/lib/Cloudflare/Queues/QueueHttp.d.ts +20 -1
- package/lib/Cloudflare/Queues/QueueHttp.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/QueueHttp.js +2 -2
- package/lib/Cloudflare/Queues/QueueHttp.js.map +1 -1
- package/lib/Cloudflare/Queues/WriteQueueHttp.d.ts +9 -3
- package/lib/Cloudflare/Queues/WriteQueueHttp.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/WriteQueueHttp.js +11 -6
- package/lib/Cloudflare/Queues/WriteQueueHttp.js.map +1 -1
- package/lib/Cloudflare/Queues/WriteQueueLocal.d.ts +36 -0
- package/lib/Cloudflare/Queues/WriteQueueLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Queues/WriteQueueLocal.js +51 -0
- package/lib/Cloudflare/Queues/WriteQueueLocal.js.map +1 -0
- package/lib/Cloudflare/Queues/index.d.ts +1 -0
- package/lib/Cloudflare/Queues/index.d.ts.map +1 -1
- package/lib/Cloudflare/Queues/index.js +1 -0
- package/lib/Cloudflare/Queues/index.js.map +1 -1
- package/lib/Cloudflare/R2/BucketHttp.d.ts +15 -1
- package/lib/Cloudflare/R2/BucketHttp.d.ts.map +1 -1
- package/lib/Cloudflare/R2/BucketHttp.js +3 -3
- package/lib/Cloudflare/R2/BucketHttp.js.map +1 -1
- package/lib/Cloudflare/R2/BucketLocal.d.ts +21 -0
- package/lib/Cloudflare/R2/BucketLocal.d.ts.map +1 -0
- package/lib/Cloudflare/R2/BucketLocal.js +32 -0
- package/lib/Cloudflare/R2/BucketLocal.js.map +1 -0
- package/lib/Cloudflare/R2/ReadBucketHttp.d.ts +2 -2
- package/lib/Cloudflare/R2/ReadBucketHttp.d.ts.map +1 -1
- package/lib/Cloudflare/R2/ReadBucketHttp.js +4 -4
- package/lib/Cloudflare/R2/ReadBucketHttp.js.map +1 -1
- package/lib/Cloudflare/R2/ReadBucketLocal.d.ts +27 -0
- package/lib/Cloudflare/R2/ReadBucketLocal.d.ts.map +1 -0
- package/lib/Cloudflare/R2/ReadBucketLocal.js +30 -0
- package/lib/Cloudflare/R2/ReadBucketLocal.js.map +1 -0
- package/lib/Cloudflare/R2/ReadWriteBucketHttp.d.ts +2 -2
- package/lib/Cloudflare/R2/ReadWriteBucketHttp.d.ts.map +1 -1
- package/lib/Cloudflare/R2/ReadWriteBucketHttp.js +5 -4
- package/lib/Cloudflare/R2/ReadWriteBucketHttp.js.map +1 -1
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts +30 -0
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.d.ts.map +1 -0
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.js +33 -0
- package/lib/Cloudflare/R2/ReadWriteBucketLocal.js.map +1 -0
- package/lib/Cloudflare/R2/WriteBucketHttp.d.ts +2 -2
- package/lib/Cloudflare/R2/WriteBucketHttp.d.ts.map +1 -1
- package/lib/Cloudflare/R2/WriteBucketHttp.js +4 -4
- package/lib/Cloudflare/R2/WriteBucketHttp.js.map +1 -1
- package/lib/Cloudflare/R2/WriteBucketLocal.d.ts +27 -0
- package/lib/Cloudflare/R2/WriteBucketLocal.d.ts.map +1 -0
- package/lib/Cloudflare/R2/WriteBucketLocal.js +30 -0
- package/lib/Cloudflare/R2/WriteBucketLocal.js.map +1 -0
- package/lib/Cloudflare/R2/index.d.ts +3 -0
- package/lib/Cloudflare/R2/index.d.ts.map +1 -1
- package/lib/Cloudflare/R2/index.js +3 -0
- package/lib/Cloudflare/R2/index.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +2 -0
- package/lib/Cloudflare/Tunnel/ReadTunnel.d.ts +3 -3
- package/lib/Cloudflare/Tunnel/ReadTunnel.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/ReadTunnel.js +7 -8
- package/lib/Cloudflare/Tunnel/ReadTunnel.js.map +1 -1
- package/lib/Cloudflare/Tunnel/ReadTunnelLocal.d.ts +29 -0
- package/lib/Cloudflare/Tunnel/ReadTunnelLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/ReadTunnelLocal.js +30 -0
- package/lib/Cloudflare/Tunnel/ReadTunnelLocal.js.map +1 -0
- package/lib/Cloudflare/Tunnel/ReadWriteTunnel.d.ts +3 -3
- package/lib/Cloudflare/Tunnel/ReadWriteTunnel.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/ReadWriteTunnel.js +4 -4
- package/lib/Cloudflare/Tunnel/ReadWriteTunnel.js.map +1 -1
- package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.d.ts +35 -0
- package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.js +36 -0
- package/lib/Cloudflare/Tunnel/ReadWriteTunnelLocal.js.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts +17 -1
- package/lib/Cloudflare/Tunnel/TunnelBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/TunnelBinding.js +7 -1
- package/lib/Cloudflare/Tunnel/TunnelBinding.js.map +1 -1
- package/lib/Cloudflare/Tunnel/TunnelLocalBinding.d.ts +19 -0
- package/lib/Cloudflare/Tunnel/TunnelLocalBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/TunnelLocalBinding.js +29 -0
- package/lib/Cloudflare/Tunnel/TunnelLocalBinding.js.map +1 -0
- package/lib/Cloudflare/Tunnel/WarpConnector.d.ts +3 -3
- package/lib/Cloudflare/Tunnel/WarpConnector.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/WarpConnector.js +7 -4
- package/lib/Cloudflare/Tunnel/WarpConnector.js.map +1 -1
- package/lib/Cloudflare/Tunnel/WriteTunnel.d.ts +3 -3
- package/lib/Cloudflare/Tunnel/WriteTunnel.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/WriteTunnel.js +7 -8
- package/lib/Cloudflare/Tunnel/WriteTunnel.js.map +1 -1
- package/lib/Cloudflare/Tunnel/WriteTunnelLocal.d.ts +29 -0
- package/lib/Cloudflare/Tunnel/WriteTunnelLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Tunnel/WriteTunnelLocal.js +30 -0
- package/lib/Cloudflare/Tunnel/WriteTunnelLocal.js.map +1 -0
- package/lib/Cloudflare/Tunnel/index.d.ts +3 -0
- package/lib/Cloudflare/Tunnel/index.d.ts.map +1 -1
- package/lib/Cloudflare/Tunnel/index.js +3 -0
- package/lib/Cloudflare/Tunnel/index.js.map +1 -1
- package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.d.ts +30 -0
- package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.js +100 -0
- package/lib/Cloudflare/Vectorize/SearchIndexHttpClient.js.map +1 -0
- package/lib/Cloudflare/Vectorize/SearchIndexLocal.d.ts +42 -0
- package/lib/Cloudflare/Vectorize/SearchIndexLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Vectorize/SearchIndexLocal.js +58 -0
- package/lib/Cloudflare/Vectorize/SearchIndexLocal.js.map +1 -0
- package/lib/Cloudflare/Vectorize/index.d.ts +1 -0
- package/lib/Cloudflare/Vectorize/index.d.ts.map +1 -1
- package/lib/Cloudflare/Vectorize/index.js +1 -0
- package/lib/Cloudflare/Vectorize/index.js.map +1 -1
- package/lib/Cloudflare/Workers/BrowserHttpClient.d.ts +32 -0
- package/lib/Cloudflare/Workers/BrowserHttpClient.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/BrowserHttpClient.js +100 -0
- package/lib/Cloudflare/Workers/BrowserHttpClient.js.map +1 -0
- package/lib/Cloudflare/Workers/BrowserLocal.d.ts +37 -0
- package/lib/Cloudflare/Workers/BrowserLocal.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/BrowserLocal.js +53 -0
- package/lib/Cloudflare/Workers/BrowserLocal.js.map +1 -0
- package/lib/Cloudflare/Workers/ConfigProvider.d.ts +8 -0
- package/lib/Cloudflare/Workers/ConfigProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/ConfigProvider.js +10 -1
- package/lib/Cloudflare/Workers/ConfigProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/DurableObject.d.ts +137 -3
- package/lib/Cloudflare/Workers/DurableObject.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/DurableObject.js +141 -6
- package/lib/Cloudflare/Workers/DurableObject.js.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts +2 -185
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Vite.js +81 -2
- package/lib/Cloudflare/Workers/Vite.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +15 -1
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +2 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts +22 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
- 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 +7 -2
- package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts +81 -0
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.js +450 -61
- package/lib/Cloudflare/Workers/WorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js +11 -37
- package/lib/Cloudflare/Workers/WorkerRuntimeContext.js.map +1 -1
- package/lib/Cloudflare/Workers/index.d.ts +1 -0
- package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/index.js +1 -0
- package/lib/Cloudflare/Workers/index.js.map +1 -1
- package/lib/Diff.d.ts +16 -0
- package/lib/Diff.d.ts.map +1 -1
- package/lib/Diff.js +33 -0
- package/lib/Diff.js.map +1 -1
- package/lib/GitHub/Secrets.d.ts +1 -1
- package/lib/GitHub/Secrets.js +1 -1
- package/lib/GitHub/Variables.d.ts +1 -1
- package/lib/GitHub/Variables.js +1 -1
- package/lib/Local/RpcSerialization.d.ts.map +1 -1
- package/lib/Local/RpcSerialization.js +6 -2
- package/lib/Local/RpcSerialization.js.map +1 -1
- package/lib/Local/RpcSpawner.d.ts.map +1 -1
- package/lib/Local/RpcSpawner.js +14 -8
- package/lib/Local/RpcSpawner.js.map +1 -1
- package/lib/Neon/AuthProvider.js +1 -1
- package/lib/Neon/AuthProvider.js.map +1 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +11 -4
- package/lib/Plan.js.map +1 -1
- package/lib/Planetscale/Database.d.ts +2 -1
- package/lib/Planetscale/Database.d.ts.map +1 -1
- package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts +41 -3
- package/lib/Planetscale/MySQL/MySQLClusterSize.d.ts.map +1 -1
- package/lib/Planetscale/MySQL/MySQLClusterSize.js +88 -11
- package/lib/Planetscale/MySQL/MySQLClusterSize.js.map +1 -1
- package/lib/Planetscale/MySQL/MySQLDatabase.d.ts +14 -0
- package/lib/Planetscale/MySQL/MySQLDatabase.d.ts.map +1 -1
- package/lib/Planetscale/MySQL/MySQLDatabase.js +24 -11
- package/lib/Planetscale/MySQL/MySQLDatabase.js.map +1 -1
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +11 -1
- package/lib/Platform.js.map +1 -1
- package/lib/Runtime.d.ts +23 -0
- package/lib/Runtime.d.ts.map +1 -1
- package/lib/Runtime.js +83 -0
- package/lib/Runtime.js.map +1 -1
- package/lib/RuntimeContext.d.ts +46 -0
- package/lib/RuntimeContext.d.ts.map +1 -1
- package/lib/RuntimeContext.js +60 -0
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Server/Process.d.ts +1 -1
- package/lib/Server/Process.d.ts.map +1 -1
- package/lib/Server/Process.js +8 -8
- package/lib/Server/Process.js.map +1 -1
- package/lib/Stack.js +1 -1
- package/lib/Stack.js.map +1 -1
- package/lib/State/HttpStateApi.d.ts +10 -10
- package/lib/Test/Alchemy.d.ts +74 -0
- package/lib/Test/Alchemy.d.ts.map +1 -0
- package/lib/Test/Alchemy.js +143 -0
- package/lib/Test/Alchemy.js.map +1 -0
- package/lib/Util/cached-function.d.ts +1 -1
- package/lib/Util/cached-function.d.ts.map +1 -1
- package/lib/Util/cached-function.js +2 -2
- package/lib/Util/cached-function.js.map +1 -1
- package/lib/Util/proxy-chain.js +3 -0
- package/lib/Util/proxy-chain.js.map +1 -1
- package/package.json +10 -10
- package/src/AWS/AuthProvider.ts +1 -1
- package/src/AWS/EC2/hosted.ts +2 -1
- package/src/AWS/ECS/Task.ts +2 -1
- package/src/AWS/Lambda/Function.ts +13 -47
- package/src/AWS/Lambda/MicrovmRuntimeContext.ts +11 -38
- package/src/Action.ts +39 -6
- package/src/ActionRuntimeContext.ts +68 -0
- package/src/Apply.ts +46 -8
- package/src/Auth/AuthProvider.ts +1 -1
- package/src/Auth/Lock.ts +5 -2
- package/src/Bundle/PurePlugin.ts +34 -1
- package/src/Bundle/Vite.ts +51 -1
- package/src/Cli/LoggingCli.ts +7 -4
- package/src/Cli/commands/_shared.ts +52 -0
- package/src/Cli/commands/login.ts +90 -14
- package/src/Cli/commands/profile.ts +7 -41
- package/src/Cloudflare/AI/LanguageModel.ts +25 -5
- package/src/Cloudflare/AI/QuerySearchLocal.ts +66 -0
- package/src/Cloudflare/AI/QuerySearchNamespaceLocal.ts +60 -0
- package/src/Cloudflare/AI/SearchHttpClient.ts +423 -0
- package/src/Cloudflare/AI/index.ts +2 -0
- package/src/Cloudflare/Auth/AuthProvider.ts +1 -1
- package/src/Cloudflare/Containers/ContainerBundle.ts +11 -1
- package/src/Cloudflare/Containers/ContainerPlatform.ts +14 -52
- package/src/Cloudflare/D1/QueryDatabaseHttpClient.ts +176 -0
- package/src/Cloudflare/D1/QueryDatabaseLocal.ts +66 -0
- package/src/Cloudflare/D1/index.ts +1 -0
- package/src/Cloudflare/DNS/DnsHttp.ts +24 -2
- package/src/Cloudflare/DNS/DnsLocal.ts +41 -0
- package/src/Cloudflare/DNS/ReadDnsHttp.ts +4 -5
- package/src/Cloudflare/DNS/ReadDnsLocal.ts +38 -0
- package/src/Cloudflare/DNS/ReadWriteDnsHttp.ts +5 -5
- package/src/Cloudflare/DNS/ReadWriteDnsLocal.ts +46 -0
- package/src/Cloudflare/DNS/WriteDnsHttp.ts +4 -5
- package/src/Cloudflare/DNS/WriteDnsLocal.ts +44 -0
- package/src/Cloudflare/DNS/index.ts +3 -0
- package/src/Cloudflare/Flagship/ReadFlagsHttpClient.ts +183 -0
- package/src/Cloudflare/Flagship/ReadFlagsLocal.ts +69 -0
- package/src/Cloudflare/Flagship/index.ts +1 -0
- package/src/Cloudflare/KV/NamespaceHttp.ts +25 -2
- package/src/Cloudflare/KV/NamespaceLocal.ts +42 -0
- package/src/Cloudflare/KV/ReadNamespaceHttp.ts +7 -6
- package/src/Cloudflare/KV/ReadNamespaceLocal.ts +35 -0
- package/src/Cloudflare/KV/ReadWriteNamespaceHttp.ts +11 -6
- package/src/Cloudflare/KV/ReadWriteNamespaceLocal.ts +42 -0
- package/src/Cloudflare/KV/WriteNamespaceHttp.ts +7 -6
- package/src/Cloudflare/KV/WriteNamespaceLocal.ts +35 -0
- package/src/Cloudflare/KV/index.ts +3 -0
- package/src/Cloudflare/Queues/QueueHttp.ts +24 -2
- package/src/Cloudflare/Queues/WriteQueueHttp.ts +16 -7
- package/src/Cloudflare/Queues/WriteQueueLocal.ts +64 -0
- package/src/Cloudflare/Queues/index.ts +1 -0
- package/src/Cloudflare/R2/BucketHttp.ts +20 -3
- package/src/Cloudflare/R2/BucketLocal.ts +47 -0
- package/src/Cloudflare/R2/ReadBucketHttp.ts +10 -5
- package/src/Cloudflare/R2/ReadBucketLocal.ts +33 -0
- package/src/Cloudflare/R2/ReadWriteBucketHttp.ts +11 -5
- package/src/Cloudflare/R2/ReadWriteBucketLocal.ts +36 -0
- package/src/Cloudflare/R2/WriteBucketHttp.ts +10 -5
- package/src/Cloudflare/R2/WriteBucketLocal.ts +33 -0
- package/src/Cloudflare/R2/index.ts +3 -0
- package/src/Cloudflare/Tunnel/ReadTunnel.ts +8 -9
- package/src/Cloudflare/Tunnel/ReadTunnelLocal.ts +33 -0
- package/src/Cloudflare/Tunnel/ReadWriteTunnel.ts +5 -5
- package/src/Cloudflare/Tunnel/ReadWriteTunnelLocal.ts +39 -0
- package/src/Cloudflare/Tunnel/TunnelBinding.ts +26 -2
- package/src/Cloudflare/Tunnel/TunnelLocalBinding.ts +38 -0
- package/src/Cloudflare/Tunnel/WarpConnector.ts +8 -5
- package/src/Cloudflare/Tunnel/WriteTunnel.ts +8 -9
- package/src/Cloudflare/Tunnel/WriteTunnelLocal.ts +33 -0
- package/src/Cloudflare/Tunnel/index.ts +3 -0
- package/src/Cloudflare/Vectorize/SearchIndexHttpClient.ts +183 -0
- package/src/Cloudflare/Vectorize/SearchIndexLocal.ts +70 -0
- package/src/Cloudflare/Vectorize/index.ts +1 -0
- package/src/Cloudflare/Workers/BrowserHttpClient.ts +201 -0
- package/src/Cloudflare/Workers/BrowserLocal.ts +65 -0
- package/src/Cloudflare/Workers/ConfigProvider.ts +15 -1
- package/src/Cloudflare/Workers/DurableObject.ts +227 -6
- package/src/Cloudflare/Workers/Vite.ts +93 -11
- package/src/Cloudflare/Workers/Worker.ts +19 -1
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +6 -5
- package/src/Cloudflare/Workers/WorkerBinding.ts +20 -1
- package/src/Cloudflare/Workers/WorkerBridge.ts +12 -2
- package/src/Cloudflare/Workers/WorkerProvider.ts +664 -117
- package/src/Cloudflare/Workers/WorkerRuntimeContext.ts +14 -45
- package/src/Cloudflare/Workers/index.ts +1 -0
- package/src/Diff.ts +33 -0
- package/src/GitHub/Secrets.ts +1 -1
- package/src/GitHub/Variables.ts +1 -1
- package/src/Local/RpcSerialization.ts +6 -2
- package/src/Local/RpcSpawner.ts +21 -8
- package/src/Neon/AuthProvider.ts +1 -1
- package/src/Plan.ts +17 -4
- package/src/Planetscale/Database.ts +2 -1
- package/src/Planetscale/MySQL/MySQLClusterSize.ts +120 -21
- package/src/Planetscale/MySQL/MySQLDatabase.ts +84 -44
- package/src/Platform.ts +12 -3
- package/src/Runtime.ts +92 -0
- package/src/RuntimeContext.ts +79 -0
- package/src/Server/Process.ts +11 -18
- package/src/Stack.ts +1 -1
- package/src/Test/Alchemy.ts +282 -0
- package/src/Util/cached-function.ts +5 -5
- package/src/Util/proxy-chain.ts +3 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type * as runtime from "@cloudflare/workers-types";
|
|
2
|
+
import * as d1 from "@distilled.cloud/cloudflare/d1";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
5
|
+
import type { Credentials } from "../Credentials.ts";
|
|
6
|
+
import {
|
|
7
|
+
type QueryDatabaseClient,
|
|
8
|
+
PreparedStatement,
|
|
9
|
+
} from "./QueryDatabase.ts";
|
|
10
|
+
|
|
11
|
+
// Shared HTTP scaffolding for the D1 `QueryDatabase` binding. NOT re-exported
|
|
12
|
+
// from `index.ts` — only the contract and the impl layers are public. A future
|
|
13
|
+
// token-scoped `QueryDatabaseHttp` layer reuses this builder with an auth
|
|
14
|
+
// minted from an `AccountApiToken`; `QueryDatabaseLocal` builds the auth from
|
|
15
|
+
// the ambient current-credentials context.
|
|
16
|
+
//
|
|
17
|
+
// PreparedStatement (shared with QueryDatabaseBinding) drives a
|
|
18
|
+
// `runtime.D1Database` whose executors return Promises. The shim below
|
|
19
|
+
// implements the slice PreparedStatement uses (prepare/exec/batch + stmt
|
|
20
|
+
// bind/all/first/run/raw) by running `d1.queryDatabase` over HTTP.
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Injectable auth shared by the Local (current-credentials) impl and a future
|
|
24
|
+
* Http (scoped-token) impl. `authorize` discharges the
|
|
25
|
+
* `Credentials | HttpClient` requirement of a distilled op; `accountId` is the
|
|
26
|
+
* Cloudflare account the ops run against.
|
|
27
|
+
*/
|
|
28
|
+
export interface D1Auth {
|
|
29
|
+
authorize: <A, E>(
|
|
30
|
+
eff: Effect.Effect<A, E, Credentials | HttpClient.HttpClient>,
|
|
31
|
+
) => Effect.Effect<A, E>;
|
|
32
|
+
accountId: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Build a {@link QueryDatabaseClient} over the D1 HTTP query API.
|
|
37
|
+
*
|
|
38
|
+
* `databaseId` is an Effect so the resolution stays deferred to each call —
|
|
39
|
+
* inside an Action it resolves through the apply-time RuntimeContext. The
|
|
40
|
+
* credentials are provided ONLY around the distilled op (via `auth.authorize`),
|
|
41
|
+
* never around the id accessor, matching the KV / Vectorize Local variants.
|
|
42
|
+
*/
|
|
43
|
+
export const makeHttpQueryDatabaseClient = (
|
|
44
|
+
auth: D1Auth,
|
|
45
|
+
databaseId: Effect.Effect<string>,
|
|
46
|
+
): QueryDatabaseClient => {
|
|
47
|
+
const rawEff = Effect.map(databaseId, (id) => makeHttpD1Database(auth, id));
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
raw: rawEff,
|
|
51
|
+
prepare: (query: string) => new PreparedStatement(query, [], rawEff),
|
|
52
|
+
exec: (query: string) =>
|
|
53
|
+
Effect.flatMap(rawEff, (raw) => Effect.promise(() => raw.exec(query))),
|
|
54
|
+
batch: <T = unknown>(statements: PreparedStatement[]) =>
|
|
55
|
+
Effect.flatMap(rawEff, (raw) =>
|
|
56
|
+
Effect.promise(() =>
|
|
57
|
+
raw.batch<T>(statements.map((s) => s._build(raw))),
|
|
58
|
+
),
|
|
59
|
+
),
|
|
60
|
+
} satisfies QueryDatabaseClient;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const runQuery = (
|
|
64
|
+
auth: D1Auth,
|
|
65
|
+
databaseId: string,
|
|
66
|
+
body:
|
|
67
|
+
| { sql: string; params?: unknown[] }
|
|
68
|
+
| { batch: { sql: string; params?: unknown[] }[] },
|
|
69
|
+
): Promise<d1.QueryDatabaseResponse> =>
|
|
70
|
+
auth
|
|
71
|
+
.authorize(
|
|
72
|
+
d1.queryDatabase({
|
|
73
|
+
accountId: auth.accountId,
|
|
74
|
+
databaseId,
|
|
75
|
+
...(body as any),
|
|
76
|
+
}),
|
|
77
|
+
)
|
|
78
|
+
.pipe(Effect.runPromise);
|
|
79
|
+
|
|
80
|
+
const toResult = <T>(
|
|
81
|
+
r: d1.QueryDatabaseResponse["result"][number] | undefined,
|
|
82
|
+
): runtime.D1Result<T> =>
|
|
83
|
+
({
|
|
84
|
+
results: (r?.results ?? []) as T[],
|
|
85
|
+
success: r?.success ?? true,
|
|
86
|
+
meta: (r?.meta ?? {}) as any,
|
|
87
|
+
}) as runtime.D1Result<T>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Normalize a bound value the way the native D1 binding does before it reaches
|
|
91
|
+
* SQLite. Over the raw HTTP query API, unlike the Worker binding, values are
|
|
92
|
+
* bound verbatim — a JS `true` would arrive as the string `"true"`. Match the
|
|
93
|
+
* native semantics: booleans become integers (1/0) and binary becomes a byte
|
|
94
|
+
* array (BLOB). `null`, numbers, and strings pass through unchanged.
|
|
95
|
+
*/
|
|
96
|
+
const normalizeBind = (value: unknown): unknown => {
|
|
97
|
+
if (typeof value === "boolean") return value ? 1 : 0;
|
|
98
|
+
if (value instanceof ArrayBuffer) {
|
|
99
|
+
return Array.from(new Uint8Array(value));
|
|
100
|
+
}
|
|
101
|
+
if (ArrayBuffer.isView(value)) {
|
|
102
|
+
return Array.from(
|
|
103
|
+
new Uint8Array(value.buffer, value.byteOffset, value.byteLength),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
return value;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const makeHttpD1Database = (
|
|
110
|
+
auth: D1Auth,
|
|
111
|
+
databaseId: string,
|
|
112
|
+
): runtime.D1Database => {
|
|
113
|
+
const makeStatement = (
|
|
114
|
+
query: string,
|
|
115
|
+
binds: ReadonlyArray<unknown>,
|
|
116
|
+
): runtime.D1PreparedStatement => {
|
|
117
|
+
const exec = async () => {
|
|
118
|
+
const res = await runQuery(auth, databaseId, {
|
|
119
|
+
sql: query,
|
|
120
|
+
params: binds.length ? binds.map(normalizeBind) : undefined,
|
|
121
|
+
});
|
|
122
|
+
return res.result[0];
|
|
123
|
+
};
|
|
124
|
+
return {
|
|
125
|
+
bind: (...values: unknown[]) => makeStatement(query, values),
|
|
126
|
+
first: (async (column?: string) => {
|
|
127
|
+
const first = (await exec())?.results?.[0] as
|
|
128
|
+
| Record<string, unknown>
|
|
129
|
+
| undefined;
|
|
130
|
+
if (first == null) return null;
|
|
131
|
+
return column !== undefined ? (first[column] ?? null) : first;
|
|
132
|
+
}) as runtime.D1PreparedStatement["first"],
|
|
133
|
+
all: (async () =>
|
|
134
|
+
toResult(await exec())) as runtime.D1PreparedStatement["all"],
|
|
135
|
+
run: (async () =>
|
|
136
|
+
toResult(await exec())) as runtime.D1PreparedStatement["run"],
|
|
137
|
+
raw: (async (options?: { columnNames?: boolean }) => {
|
|
138
|
+
const rows = ((await exec())?.results ?? []) as Record<
|
|
139
|
+
string,
|
|
140
|
+
unknown
|
|
141
|
+
>[];
|
|
142
|
+
const arrays = rows.map((row) => Object.values(row));
|
|
143
|
+
if (options?.columnNames && rows[0]) {
|
|
144
|
+
return [Object.keys(rows[0]), ...arrays];
|
|
145
|
+
}
|
|
146
|
+
return arrays;
|
|
147
|
+
}) as runtime.D1PreparedStatement["raw"],
|
|
148
|
+
// Carry query + params so `batch` can reconstruct the request.
|
|
149
|
+
__query: query,
|
|
150
|
+
__params: binds,
|
|
151
|
+
} as unknown as runtime.D1PreparedStatement;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
prepare: (query: string) => makeStatement(query, []),
|
|
156
|
+
exec: async (query: string) => {
|
|
157
|
+
const res = await runQuery(auth, databaseId, { sql: query });
|
|
158
|
+
const meta = res.result[res.result.length - 1]?.meta;
|
|
159
|
+
return {
|
|
160
|
+
count: res.result.length,
|
|
161
|
+
duration: meta?.duration ?? 0,
|
|
162
|
+
} as runtime.D1ExecResult;
|
|
163
|
+
},
|
|
164
|
+
batch: async <T = unknown>(statements: runtime.D1PreparedStatement[]) => {
|
|
165
|
+
const res = await runQuery(auth, databaseId, {
|
|
166
|
+
batch: statements.map((s) => ({
|
|
167
|
+
sql: (s as any).__query as string,
|
|
168
|
+
params: ((s as any).__params as unknown[]).length
|
|
169
|
+
? ((s as any).__params as unknown[]).map(normalizeBind)
|
|
170
|
+
: undefined,
|
|
171
|
+
})),
|
|
172
|
+
});
|
|
173
|
+
return res.result.map((r) => toResult<T>(r));
|
|
174
|
+
},
|
|
175
|
+
} as unknown as runtime.D1Database;
|
|
176
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
4
|
+
import { CloudflareEnvironment } from "../CloudflareEnvironment.ts";
|
|
5
|
+
import type { Credentials } from "../Credentials.ts";
|
|
6
|
+
import type { Database } from "./Database.ts";
|
|
7
|
+
import { QueryDatabase } from "./QueryDatabase.ts";
|
|
8
|
+
import {
|
|
9
|
+
type D1Auth,
|
|
10
|
+
makeHttpQueryDatabaseClient,
|
|
11
|
+
} from "./QueryDatabaseHttpClient.ts";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Local implementation of the {@link QueryDatabase} binding — queries D1 over
|
|
15
|
+
* the Cloudflare HTTP API using the **current credentials** instead of a native
|
|
16
|
+
* Worker binding (`QueryDatabaseBinding`) or a scoped API token.
|
|
17
|
+
*
|
|
18
|
+
* Provide it on an {@link Action} (or any deploy-time Effect) so you can talk to
|
|
19
|
+
* a D1 database with the same `prepare`/`exec`/`batch` client you'd use inside a
|
|
20
|
+
* Worker:
|
|
21
|
+
*
|
|
22
|
+
* @example Seeding a database from an Action
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const Seed = Alchemy.Action(
|
|
25
|
+
* "Seed",
|
|
26
|
+
* Effect.gen(function* () {
|
|
27
|
+
* const db = yield* Cloudflare.D1.QueryDatabase(database);
|
|
28
|
+
* return Effect.fn(function* () {
|
|
29
|
+
* yield* db.exec("CREATE TABLE IF NOT EXISTS users (id TEXT, name TEXT)");
|
|
30
|
+
* yield* db
|
|
31
|
+
* .prepare("INSERT INTO users (id, name) VALUES (?, ?)")
|
|
32
|
+
* .bind("1", "Ada")
|
|
33
|
+
* .run();
|
|
34
|
+
* });
|
|
35
|
+
* }).pipe(Effect.provide(Cloudflare.D1.QueryDatabaseLocal)),
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* The database id is resolved at apply time through the ambient
|
|
40
|
+
* {@link RuntimeContext} (in an Action, that's the resolve context the engine
|
|
41
|
+
* provides around the body), so `QueryDatabase(database)` works even though the
|
|
42
|
+
* database is created in the same deploy.
|
|
43
|
+
*/
|
|
44
|
+
export const QueryDatabaseLocal = Layer.effect(
|
|
45
|
+
QueryDatabase,
|
|
46
|
+
Effect.gen(function* () {
|
|
47
|
+
// Account + credentials are ambient during stack-eval (the stack's
|
|
48
|
+
// providers layer). Capture the full context so the HTTP query ops run
|
|
49
|
+
// with the current credentials — no `host.bind`, no minted token.
|
|
50
|
+
const { accountId } = yield* yield* CloudflareEnvironment;
|
|
51
|
+
const context = yield* Effect.context<
|
|
52
|
+
Credentials | HttpClient.HttpClient
|
|
53
|
+
>();
|
|
54
|
+
const auth: D1Auth = {
|
|
55
|
+
authorize: (eff) => eff.pipe(Effect.provideContext(context)),
|
|
56
|
+
accountId,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return Effect.fn(function* (database: Database) {
|
|
60
|
+
// Deferred accessor — resolves the databaseId against the tracker at
|
|
61
|
+
// apply time. No `host.bind`: the local variant registers no binding.
|
|
62
|
+
const databaseId = yield* database.databaseId;
|
|
63
|
+
return makeHttpQueryDatabaseClient(auth, databaseId);
|
|
64
|
+
});
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import type * as Redacted from "effect/Redacted";
|
|
3
|
+
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
4
|
+
import type { RuntimeContext } from "../../RuntimeContext.ts";
|
|
3
5
|
import * as Output from "../../Output.ts";
|
|
4
6
|
import { Self } from "../../Self.ts";
|
|
5
7
|
import { AccountApiToken } from "../ApiToken/AccountApiToken.ts";
|
|
6
8
|
import type { PermissionGroupRef } from "../ApiToken/Common.ts";
|
|
9
|
+
import type { Credentials } from "../Credentials.ts";
|
|
10
|
+
import { authorizeWith } from "../HttpClientUtils.ts";
|
|
7
11
|
import type { Zone } from "../Zone/Zone.ts";
|
|
8
12
|
|
|
9
13
|
/**
|
|
@@ -21,7 +25,7 @@ import type { Zone } from "../Zone/Zone.ts";
|
|
|
21
25
|
*/
|
|
22
26
|
export const makeHttpDnsBinding = <Client>(options: {
|
|
23
27
|
permissionGroups: PermissionGroupRef[];
|
|
24
|
-
makeClient: (
|
|
28
|
+
makeClient: (auth: DnsAuth, zoneId: Effect.Effect<string>) => Client;
|
|
25
29
|
}) =>
|
|
26
30
|
Effect.gen(function* () {
|
|
27
31
|
const Token = yield* AccountApiToken;
|
|
@@ -52,10 +56,28 @@ export const makeHttpDnsBinding = <Client>(options: {
|
|
|
52
56
|
value: yield* token.value,
|
|
53
57
|
} satisfies Token;
|
|
54
58
|
const zoneId = yield* zone.zoneId;
|
|
55
|
-
return options.makeClient(bound, zoneId);
|
|
59
|
+
return options.makeClient(makeDnsAuth(bound), zoneId);
|
|
56
60
|
});
|
|
57
61
|
});
|
|
58
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Injectable auth for the DNS HTTP client builders. Both the scoped-token
|
|
65
|
+
* (`*Http`) and current-credentials (`*Local`) variants supply an `authorize`
|
|
66
|
+
* that provides `Credentials` + `HttpClient` to a raw SDK op, so the client
|
|
67
|
+
* builders are agnostic to how creds are obtained. DNS record ops are
|
|
68
|
+
* zone-scoped (the `zoneId` is passed alongside), so no `accountId` is needed.
|
|
69
|
+
*/
|
|
70
|
+
export interface DnsAuth {
|
|
71
|
+
authorize: <A, E>(
|
|
72
|
+
eff: Effect.Effect<A, E, Credentials | HttpClient.HttpClient>,
|
|
73
|
+
) => Effect.Effect<A, E, RuntimeContext>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Build a scoped-token {@link DnsAuth} from a bound {@link Token}. */
|
|
77
|
+
export const makeDnsAuth = (token: Token): DnsAuth => ({
|
|
78
|
+
authorize: authorizeWith(token),
|
|
79
|
+
});
|
|
80
|
+
|
|
59
81
|
/**
|
|
60
82
|
* Runtime accessor for a DNS binding's token, obtained by binding the
|
|
61
83
|
* {@link AccountApiToken}'s `value` output in the Worker's Init phase. Reads the
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
3
|
+
import type { Credentials } from "../Credentials.ts";
|
|
4
|
+
import type { Zone } from "../Zone/Zone.ts";
|
|
5
|
+
import type { DnsAuth } from "./DnsHttp.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Shared scaffolding for the `*Local` DNS services.
|
|
9
|
+
*
|
|
10
|
+
* Instead of minting a scoped {@link AccountApiToken} (the `*Http` path), it
|
|
11
|
+
* captures the ambient current-credentials context available during stack-eval
|
|
12
|
+
* and builds a {@link DnsAuth} that provides those credentials directly to the
|
|
13
|
+
* DNS HTTP ops. It then delegates to the same client builders the `*Http`
|
|
14
|
+
* variant uses. DNS is a zone-management capability with no native Worker
|
|
15
|
+
* binding, so there is no `*Binding` counterpart.
|
|
16
|
+
*
|
|
17
|
+
* NOT exported from `index.ts` — this is internal scaffolding shared by the
|
|
18
|
+
* three access-level Local layers.
|
|
19
|
+
*/
|
|
20
|
+
export const makeLocalDnsBinding = <Client>(options: {
|
|
21
|
+
makeClient: (auth: DnsAuth, zoneId: Effect.Effect<string>) => Client;
|
|
22
|
+
}) =>
|
|
23
|
+
Effect.gen(function* () {
|
|
24
|
+
// Credentials are ambient during stack-eval (the stack's providers layer).
|
|
25
|
+
// Capture the full context so DNS HTTP ops can run with the current
|
|
26
|
+
// credentials — no `host.bind`, no minted token. DNS record ops are
|
|
27
|
+
// zone-scoped, so no accountId is needed.
|
|
28
|
+
const context = yield* Effect.context<
|
|
29
|
+
Credentials | HttpClient.HttpClient
|
|
30
|
+
>();
|
|
31
|
+
|
|
32
|
+
return Effect.fn(function* (zone: Zone) {
|
|
33
|
+
// Deferred accessor — resolves the zoneId against the tracker at apply
|
|
34
|
+
// time (in an Action, that's the engine's resolve context).
|
|
35
|
+
const zoneId = yield* zone.zoneId;
|
|
36
|
+
const auth: DnsAuth = {
|
|
37
|
+
authorize: (eff) => eff.pipe(Effect.provideContext(context)),
|
|
38
|
+
};
|
|
39
|
+
return options.makeClient(auth, zoneId);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as dns from "@distilled.cloud/cloudflare/dns";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
|
-
import {
|
|
5
|
-
import { makeHttpDnsBinding, type Token } from "./DnsHttp.ts";
|
|
4
|
+
import { type DnsAuth, makeHttpDnsBinding } from "./DnsHttp.ts";
|
|
6
5
|
import { ReadDns, type ReadDnsClient } from "./ReadDns.ts";
|
|
7
6
|
|
|
8
7
|
/** Runtime layer for {@link ReadDns}. */
|
|
@@ -16,12 +15,12 @@ export const ReadDnsHttp = Layer.effect(
|
|
|
16
15
|
),
|
|
17
16
|
);
|
|
18
17
|
|
|
19
|
-
/** Build the read-only client over
|
|
18
|
+
/** Build the read-only client over an injectable auth and zone id. */
|
|
20
19
|
export const dnsReadClient = (
|
|
21
|
-
|
|
20
|
+
auth: DnsAuth,
|
|
22
21
|
zoneId: Effect.Effect<string>,
|
|
23
22
|
): ReadDnsClient => {
|
|
24
|
-
const authorize =
|
|
23
|
+
const authorize = auth.authorize;
|
|
25
24
|
return {
|
|
26
25
|
getDnsRecord: Effect.fn("Cloudflare.DNS.getDnsRecord")(
|
|
27
26
|
function* (dnsRecordId) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { makeLocalDnsBinding } from "./DnsLocal.ts";
|
|
4
|
+
import { ReadDns } from "./ReadDns.ts";
|
|
5
|
+
import { dnsReadClient } from "./ReadDnsHttp.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Local implementation of the {@link ReadDns} binding — reads Cloudflare DNS
|
|
9
|
+
* records over the HTTP API using the **current credentials** instead of a
|
|
10
|
+
* scoped API token ({@link ReadDnsHttp}). DNS is a zone-management capability
|
|
11
|
+
* with no native Worker binding.
|
|
12
|
+
*
|
|
13
|
+
* Provide it on an {@link Action} (or any deploy-time Effect) so you can read a
|
|
14
|
+
* zone's DNS records with the same `getDnsRecord`/`listDnsRecords` client you'd
|
|
15
|
+
* use inside a Worker:
|
|
16
|
+
*
|
|
17
|
+
* @example Reading records from an Action
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const Check = Alchemy.Action(
|
|
20
|
+
* "Check",
|
|
21
|
+
* Effect.gen(function* () {
|
|
22
|
+
* const dns = yield* Cloudflare.DNS.ReadDns(zone);
|
|
23
|
+
* return Effect.fn(function* () {
|
|
24
|
+
* return yield* dns.listDnsRecords({ type: "TXT" });
|
|
25
|
+
* });
|
|
26
|
+
* }).pipe(Effect.provide(Cloudflare.DNS.ReadDnsLocal)),
|
|
27
|
+
* );
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* The zone id is resolved at apply time through the ambient
|
|
31
|
+
* {@link RuntimeContext} (in an Action, that's the resolve context the engine
|
|
32
|
+
* provides around the body), so `ReadDns(zone)` works even though the zone may
|
|
33
|
+
* be created/adopted in the same deploy.
|
|
34
|
+
*/
|
|
35
|
+
export const ReadDnsLocal = Layer.effect(
|
|
36
|
+
ReadDns,
|
|
37
|
+
Effect.suspend(() => makeLocalDnsBinding({ makeClient: dnsReadClient })),
|
|
38
|
+
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
-
import {
|
|
3
|
+
import { type DnsAuth, makeHttpDnsBinding } from "./DnsHttp.ts";
|
|
4
4
|
import { dnsReadClient } from "./ReadDnsHttp.ts";
|
|
5
5
|
import { ReadWriteDns, type ReadWriteDnsClient } from "./ReadWriteDns.ts";
|
|
6
6
|
import { dnsWriteClient } from "./WriteDnsHttp.ts";
|
|
@@ -16,11 +16,11 @@ export const ReadWriteDnsHttp = Layer.effect(
|
|
|
16
16
|
),
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
/** Build the combined read + write client over
|
|
19
|
+
/** Build the combined read + write client over an injectable auth and zone id. */
|
|
20
20
|
export const dnsReadWriteClient = (
|
|
21
|
-
|
|
21
|
+
auth: DnsAuth,
|
|
22
22
|
zoneId: Effect.Effect<string>,
|
|
23
23
|
): ReadWriteDnsClient => ({
|
|
24
|
-
...dnsReadClient(
|
|
25
|
-
...dnsWriteClient(
|
|
24
|
+
...dnsReadClient(auth, zoneId),
|
|
25
|
+
...dnsWriteClient(auth, zoneId),
|
|
26
26
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { makeLocalDnsBinding } from "./DnsLocal.ts";
|
|
4
|
+
import { ReadWriteDns } from "./ReadWriteDns.ts";
|
|
5
|
+
import { dnsReadWriteClient } from "./ReadWriteDnsHttp.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Local implementation of the {@link ReadWriteDns} binding — performs the full
|
|
9
|
+
* Cloudflare DNS record CRUD surface over the HTTP API using the **current
|
|
10
|
+
* credentials** instead of a scoped API token ({@link ReadWriteDnsHttp}). DNS
|
|
11
|
+
* is a zone-management capability with no native Worker binding.
|
|
12
|
+
*
|
|
13
|
+
* Provide it on an {@link Action} (or any deploy-time Effect) so you can manage
|
|
14
|
+
* a zone's DNS records with the same read + write client you'd use inside a
|
|
15
|
+
* Worker:
|
|
16
|
+
*
|
|
17
|
+
* @example Seeding and reading records from an Action
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const Seed = Alchemy.Action(
|
|
20
|
+
* "Seed",
|
|
21
|
+
* Effect.gen(function* () {
|
|
22
|
+
* const dns = yield* Cloudflare.DNS.ReadWriteDns(zone);
|
|
23
|
+
* return Effect.fn(function* () {
|
|
24
|
+
* const created = yield* dns.createDnsRecord({
|
|
25
|
+
* type: "TXT",
|
|
26
|
+
* name: "_seed.example.com",
|
|
27
|
+
* content: '"hello"',
|
|
28
|
+
* ttl: 60,
|
|
29
|
+
* });
|
|
30
|
+
* const record = yield* dns.getDnsRecord(created.id);
|
|
31
|
+
* yield* dns.deleteDnsRecord(created.id);
|
|
32
|
+
* return record;
|
|
33
|
+
* });
|
|
34
|
+
* }).pipe(Effect.provide(Cloudflare.DNS.ReadWriteDnsLocal)),
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* The zone id is resolved at apply time through the ambient
|
|
39
|
+
* {@link RuntimeContext} (in an Action, that's the resolve context the engine
|
|
40
|
+
* provides around the body), so `ReadWriteDns(zone)` works even though the zone
|
|
41
|
+
* may be created/adopted in the same deploy.
|
|
42
|
+
*/
|
|
43
|
+
export const ReadWriteDnsLocal = Layer.effect(
|
|
44
|
+
ReadWriteDns,
|
|
45
|
+
Effect.suspend(() => makeLocalDnsBinding({ makeClient: dnsReadWriteClient })),
|
|
46
|
+
);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as dns from "@distilled.cloud/cloudflare/dns";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
|
-
import {
|
|
5
|
-
import { makeHttpDnsBinding, type Token } from "./DnsHttp.ts";
|
|
4
|
+
import { type DnsAuth, makeHttpDnsBinding } from "./DnsHttp.ts";
|
|
6
5
|
import { WriteDns, type WriteDnsClient } from "./WriteDns.ts";
|
|
7
6
|
|
|
8
7
|
/** Runtime layer for {@link WriteDns}. */
|
|
@@ -16,12 +15,12 @@ export const WriteDnsHttp = Layer.effect(
|
|
|
16
15
|
),
|
|
17
16
|
);
|
|
18
17
|
|
|
19
|
-
/** Build the write client over
|
|
18
|
+
/** Build the write client over an injectable auth and zone id. */
|
|
20
19
|
export const dnsWriteClient = (
|
|
21
|
-
|
|
20
|
+
auth: DnsAuth,
|
|
22
21
|
zoneId: Effect.Effect<string>,
|
|
23
22
|
): WriteDnsClient => {
|
|
24
|
-
const authorize =
|
|
23
|
+
const authorize = auth.authorize;
|
|
25
24
|
return {
|
|
26
25
|
createDnsRecord: Effect.fn("Cloudflare.DNS.createDnsRecord")(
|
|
27
26
|
function* (request) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import { makeLocalDnsBinding } from "./DnsLocal.ts";
|
|
4
|
+
import { WriteDns } from "./WriteDns.ts";
|
|
5
|
+
import { dnsWriteClient } from "./WriteDnsHttp.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Local implementation of the {@link WriteDns} binding — creates, updates, and
|
|
9
|
+
* deletes Cloudflare DNS records over the HTTP API using the **current
|
|
10
|
+
* credentials** instead of a scoped API token ({@link WriteDnsHttp}). DNS is a
|
|
11
|
+
* zone-management capability with no native Worker binding.
|
|
12
|
+
*
|
|
13
|
+
* Provide it on an {@link Action} (or any deploy-time Effect) so you can mutate
|
|
14
|
+
* a zone's DNS records with the same
|
|
15
|
+
* `createDnsRecord`/`updateDnsRecord`/`deleteDnsRecord`/`batchDnsRecords`
|
|
16
|
+
* client you'd use inside a Worker:
|
|
17
|
+
*
|
|
18
|
+
* @example Creating a record from an Action
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const Seed = Alchemy.Action(
|
|
21
|
+
* "Seed",
|
|
22
|
+
* Effect.gen(function* () {
|
|
23
|
+
* const dns = yield* Cloudflare.DNS.WriteDns(zone);
|
|
24
|
+
* return Effect.fn(function* () {
|
|
25
|
+
* return yield* dns.createDnsRecord({
|
|
26
|
+
* type: "TXT",
|
|
27
|
+
* name: "_seed.example.com",
|
|
28
|
+
* content: '"hello"',
|
|
29
|
+
* ttl: 60,
|
|
30
|
+
* });
|
|
31
|
+
* });
|
|
32
|
+
* }).pipe(Effect.provide(Cloudflare.DNS.WriteDnsLocal)),
|
|
33
|
+
* );
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* The zone id is resolved at apply time through the ambient
|
|
37
|
+
* {@link RuntimeContext} (in an Action, that's the resolve context the engine
|
|
38
|
+
* provides around the body), so `WriteDns(zone)` works even though the zone may
|
|
39
|
+
* be created/adopted in the same deploy.
|
|
40
|
+
*/
|
|
41
|
+
export const WriteDnsLocal = Layer.effect(
|
|
42
|
+
WriteDns,
|
|
43
|
+
Effect.suspend(() => makeLocalDnsBinding({ makeClient: dnsWriteClient })),
|
|
44
|
+
);
|
|
@@ -4,12 +4,15 @@ export * from "./Dnssec.ts";
|
|
|
4
4
|
export * from "./Firewall.ts";
|
|
5
5
|
export * from "./ReadDns.ts";
|
|
6
6
|
export * from "./ReadDnsHttp.ts";
|
|
7
|
+
export * from "./ReadDnsLocal.ts";
|
|
7
8
|
export * from "./ReadWriteDns.ts";
|
|
8
9
|
export * from "./ReadWriteDnsHttp.ts";
|
|
10
|
+
export * from "./ReadWriteDnsLocal.ts";
|
|
9
11
|
export * from "./Record.ts";
|
|
10
12
|
export * from "./View.ts";
|
|
11
13
|
export * from "./WriteDns.ts";
|
|
12
14
|
export * from "./WriteDnsHttp.ts";
|
|
15
|
+
export * from "./WriteDnsLocal.ts";
|
|
13
16
|
export * from "./ZoneSettings.ts";
|
|
14
17
|
export * from "./ZoneTransferAcl.ts";
|
|
15
18
|
export * from "./ZoneTransferIncoming.ts";
|