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
package/src/Plan.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Data from "effect/Data";
|
|
2
|
+
import * as Duration from "effect/Duration";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
4
|
import * as Option from "effect/Option";
|
|
4
5
|
import * as Redacted from "effect/Redacted";
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
makeScopedArtifacts,
|
|
19
20
|
} from "./Artifacts.ts";
|
|
20
21
|
import {
|
|
22
|
+
dedupeBindings,
|
|
21
23
|
diffBindings,
|
|
22
24
|
havePropsChanged,
|
|
23
25
|
isResolved,
|
|
@@ -309,7 +311,11 @@ export const make = <A>(
|
|
|
309
311
|
: oldState.props;
|
|
310
312
|
|
|
311
313
|
const oldBindings = oldState.bindings ?? [];
|
|
312
|
-
|
|
314
|
+
// Collapse duplicate bindings by sid so the binding set handed to
|
|
315
|
+
// `diff` matches what `reconcile` receives (see `dedupeBindings`).
|
|
316
|
+
const newBindings = dedupeBindings(
|
|
317
|
+
stack.bindings[resource.FQN] ?? [],
|
|
318
|
+
);
|
|
313
319
|
|
|
314
320
|
const diff = yield* provider.diff
|
|
315
321
|
? provider
|
|
@@ -375,6 +381,11 @@ export const make = <A>(
|
|
|
375
381
|
return yield* resolveOutput(input);
|
|
376
382
|
} else if (Redacted.isRedacted(input)) {
|
|
377
383
|
return input;
|
|
384
|
+
} else if (Duration.isDuration(input)) {
|
|
385
|
+
// Duration is an opaque value; walking its internal `.value`
|
|
386
|
+
// would destroy the prototype and produce a plain `{ value: ... }`
|
|
387
|
+
// object that downstream consumers can't interpret.
|
|
388
|
+
return input;
|
|
378
389
|
} else if (Array.isArray(input)) {
|
|
379
390
|
return yield* Effect.all(input.map(resolveInput), {
|
|
380
391
|
concurrency: "unbounded",
|
|
@@ -627,8 +638,10 @@ export const make = <A>(
|
|
|
627
638
|
const news = yield* resolveInput(resource.Props);
|
|
628
639
|
const downstream = newDownstreamDependencies[fqn] ?? [];
|
|
629
640
|
|
|
630
|
-
|
|
631
|
-
|
|
641
|
+
// Collapse duplicate bindings by sid so the binding set handed to
|
|
642
|
+
// `diff` matches what `reconcile` receives (see `dedupeBindings`).
|
|
643
|
+
const newBindings: ResourceBinding[] = dedupeBindings(
|
|
644
|
+
yield* resolveInput(stack.bindings[fqn] ?? []),
|
|
632
645
|
);
|
|
633
646
|
const persisted = yield* state.get({
|
|
634
647
|
stack: stackName,
|
package/src/Platform.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as ConfigError from "effect/Config";
|
|
2
|
+
import * as ConfigProvider from "effect/ConfigProvider";
|
|
1
3
|
import * as Context from "effect/Context";
|
|
2
4
|
import * as Effect from "effect/Effect";
|
|
3
5
|
import { pipe } from "effect/Function";
|
|
@@ -7,14 +9,21 @@ import type { Scope } from "effect/Scope";
|
|
|
7
9
|
import type { HttpClient } from "effect/unstable/http/HttpClient";
|
|
8
10
|
import { SingleShotGen } from "effect/Utils";
|
|
9
11
|
import type { PolicyLike } from "./Binding.ts";
|
|
12
|
+
import type { Dependencies } from "./Dependencies.ts";
|
|
10
13
|
import type { ExecutionContext } from "./ExecutionContext.ts";
|
|
11
14
|
import type { HttpEffect } from "./Http.ts";
|
|
12
15
|
import type { InputProps } from "./Input.ts";
|
|
16
|
+
import * as Output from "./Output.ts";
|
|
13
17
|
import { ALCHEMY_PHASE } from "./Phase.ts";
|
|
14
18
|
import type { Provider, ProviderCollectionLike } from "./Provider.ts";
|
|
15
19
|
import { Resource, type ResourceLike } from "./Resource.ts";
|
|
16
20
|
import type { Rpc } from "./Rpc.ts";
|
|
17
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
CurrentRuntimeContext,
|
|
23
|
+
RuntimeContext,
|
|
24
|
+
sanitizeKey,
|
|
25
|
+
type BaseRuntimeContext,
|
|
26
|
+
} from "./RuntimeContext.ts";
|
|
18
27
|
import { Self } from "./Self.ts";
|
|
19
28
|
import type { Stack, StackServices } from "./Stack.ts";
|
|
20
29
|
import type { Stage } from "./Stage.ts";
|
|
@@ -65,19 +74,19 @@ export interface Platform<
|
|
|
65
74
|
Type: Resource["Type"];
|
|
66
75
|
Provider: Provider<Resource>;
|
|
67
76
|
|
|
68
|
-
<Self, Shape>(): {
|
|
77
|
+
<Self, Shape, Deps = never>(): {
|
|
69
78
|
<PropsReq = never>(
|
|
70
79
|
id: string,
|
|
71
80
|
props:
|
|
72
81
|
| InputProps<Resource["Props"]>
|
|
73
82
|
| Effect.Effect<InputProps<Resource["Props"]>, never, PropsReq>,
|
|
74
83
|
): Effect.Effect<
|
|
75
|
-
Resource & Rpc<Self>,
|
|
84
|
+
Resource & Rpc<Self> & Dependencies<Deps>,
|
|
76
85
|
never,
|
|
77
|
-
|
|
86
|
+
Resource["Providers"] | PropsReq
|
|
78
87
|
> & {
|
|
79
88
|
make<InitReq = never>(
|
|
80
|
-
impl: Effect.Effect<Shape,
|
|
89
|
+
impl: Effect.Effect<Shape, ConfigError.ConfigError, InitReq>,
|
|
81
90
|
): Layer.Layer<
|
|
82
91
|
Self,
|
|
83
92
|
never,
|
|
@@ -98,7 +107,7 @@ export interface Platform<
|
|
|
98
107
|
props:
|
|
99
108
|
| InputProps<Resource["Props"]>
|
|
100
109
|
| Effect.Effect<Resource["Props"], never, PropsReq>,
|
|
101
|
-
impl: Effect.Effect<Shape,
|
|
110
|
+
impl: Effect.Effect<Shape, ConfigError.ConfigError, InitReq>,
|
|
102
111
|
): Effect.Effect<
|
|
103
112
|
Resource & Rpc<Self>,
|
|
104
113
|
never,
|
|
@@ -119,7 +128,7 @@ export interface Platform<
|
|
|
119
128
|
Resource["Providers"] | PropsReq
|
|
120
129
|
> & {
|
|
121
130
|
make<InitReq extends Services | PlatformServices = never>(
|
|
122
|
-
impl: Effect.Effect<Shape,
|
|
131
|
+
impl: Effect.Effect<Shape, ConfigError.ConfigError, InitReq>,
|
|
123
132
|
): Layer.Layer<
|
|
124
133
|
Self,
|
|
125
134
|
never,
|
|
@@ -158,7 +167,7 @@ export interface Platform<
|
|
|
158
167
|
props:
|
|
159
168
|
| InputProps<Resource["Props"]>
|
|
160
169
|
| Effect.Effect<InputProps<Resource["Props"]>, never, PropsReq>,
|
|
161
|
-
impl: Effect.Effect<Shape,
|
|
170
|
+
impl: Effect.Effect<Shape, ConfigError.ConfigError, InitReq>,
|
|
162
171
|
): Effect.Effect<
|
|
163
172
|
Resource & Rpc<Shape>,
|
|
164
173
|
never,
|
|
@@ -343,28 +352,66 @@ export const Platform = <
|
|
|
343
352
|
}) ?? Effect.die("No serve handler"))
|
|
344
353
|
: Effect.void,
|
|
345
354
|
),
|
|
355
|
+
|
|
346
356
|
Effect.provide(
|
|
347
|
-
Layer.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
357
|
+
Layer.effect(
|
|
358
|
+
ConfigProvider.ConfigProvider,
|
|
359
|
+
Effect.gen(function* () {
|
|
360
|
+
// a Config Provider that we use to intercept config lookups and bind them to the RuntimeContext
|
|
361
|
+
const configProvider =
|
|
362
|
+
yield* ConfigProvider.ConfigProvider;
|
|
363
|
+
const phase = yield* ALCHEMY_PHASE;
|
|
364
|
+
|
|
365
|
+
return ConfigProvider.make(
|
|
366
|
+
Effect.fnUntraced(function* (path) {
|
|
367
|
+
const ctx = yield* CurrentRuntimeContext;
|
|
368
|
+
// `set`/`get` store keys verbatim, so canonicalize the
|
|
369
|
+
// logical config path here (the caller's job) before
|
|
370
|
+
// handing it to the RuntimeContext.
|
|
371
|
+
const key = sanitizeKey(
|
|
372
|
+
path.map((p) => p.toString()).join("_"),
|
|
373
|
+
);
|
|
374
|
+
const node = yield* configProvider.get(path);
|
|
375
|
+
if (phase === "plan" && node) {
|
|
376
|
+
// bind it to the RuntimeContext if running in plan phase
|
|
377
|
+
const output = Output.literal(node.value);
|
|
378
|
+
yield* ctx?.set(key, output) ?? Effect.void;
|
|
379
|
+
return node;
|
|
380
|
+
} else if (phase === "runtime" && ctx) {
|
|
381
|
+
// retrieve from the RuntimeContext if running in runtime phase
|
|
382
|
+
const value = yield* ctx.get<string>(key);
|
|
383
|
+
if (value) {
|
|
384
|
+
return ConfigProvider.makeValue(value as string);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// fallback to the config provider otherwise
|
|
388
|
+
return node;
|
|
389
|
+
}),
|
|
390
|
+
);
|
|
391
|
+
}),
|
|
392
|
+
).pipe(
|
|
393
|
+
Layer.provideMerge(
|
|
394
|
+
Layer.mergeAll(
|
|
395
|
+
Layer.succeed(Platform.Platform, runtimeContext),
|
|
396
|
+
Layer.succeed(PlatformContext, runtimeContext),
|
|
397
|
+
Layer.succeed(RuntimeContext, runtimeContext),
|
|
398
|
+
Layer.succeed(resource.Self, instance),
|
|
399
|
+
Layer.succeed(Platform.Self, instance),
|
|
400
|
+
Layer.succeed(Self, instance),
|
|
401
|
+
runtimeContext.planServices
|
|
402
|
+
? Layer.unwrap(
|
|
403
|
+
ALCHEMY_PHASE.pipe(
|
|
404
|
+
Effect.map((phase) =>
|
|
405
|
+
phase === "plan"
|
|
406
|
+
? runtimeContext.planServices!
|
|
407
|
+
: Layer.empty,
|
|
408
|
+
),
|
|
362
409
|
),
|
|
363
|
-
)
|
|
364
|
-
|
|
365
|
-
|
|
410
|
+
)
|
|
411
|
+
: Layer.empty,
|
|
412
|
+
),
|
|
366
413
|
),
|
|
367
|
-
Layer.succeedContext(outerServices),
|
|
414
|
+
Layer.provideMerge(Layer.succeedContext(outerServices)),
|
|
368
415
|
),
|
|
369
416
|
),
|
|
370
417
|
);
|
package/src/Random.ts
CHANGED
|
@@ -32,34 +32,29 @@ export const Random = Resource<Random>("Alchemy.Random");
|
|
|
32
32
|
|
|
33
33
|
export const RandomProvider = () =>
|
|
34
34
|
Provider.succeed(Random, {
|
|
35
|
-
reconcile:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
reconcile: ({ news = {}, output }) =>
|
|
36
|
+
Effect.sync(() => {
|
|
37
|
+
// Observe — there is no remote state. The cached `output.text` is
|
|
38
|
+
// the authoritative current value; once minted it is preserved
|
|
39
|
+
// across reconciles to keep the secret stable.
|
|
40
|
+
if (output?.text) {
|
|
41
|
+
return output;
|
|
42
|
+
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const text = yield* Effect.sync(() => {
|
|
44
|
+
// Ensure — no observed value: mint a fresh random secret and
|
|
45
|
+
// return it. The next reconcile will see this in `output` and
|
|
46
|
+
// short-circuit above.
|
|
47
|
+
const byteLength = news.bytes ?? 32;
|
|
48
48
|
const bytes = new Uint8Array(byteLength);
|
|
49
49
|
crypto.getRandomValues(bytes);
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return undefined;
|
|
61
|
-
}),
|
|
62
|
-
read: Effect.fn(function* ({ output }) {
|
|
63
|
-
return output;
|
|
64
|
-
}),
|
|
50
|
+
return {
|
|
51
|
+
text: Redacted.make(
|
|
52
|
+
Array.from(bytes)
|
|
53
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
54
|
+
.join(""),
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
}),
|
|
58
|
+
delete: () => Effect.void,
|
|
59
|
+
read: ({ output }) => Effect.succeed(output),
|
|
65
60
|
});
|
package/src/RuntimeContext.ts
CHANGED
|
@@ -9,7 +9,15 @@ export interface BaseRuntimeContext {
|
|
|
9
9
|
Type: string;
|
|
10
10
|
id: string;
|
|
11
11
|
env: Record<string, any>;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Read a value by its (already-canonical) key. The key is used verbatim;
|
|
14
|
+
* callers must {@link sanitizeKey} first. See {@link sanitizeKey}.
|
|
15
|
+
*/
|
|
16
|
+
get<T>(key: string): Effect.Effect<T | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Store an output under the given (already-canonical) key, returning the key.
|
|
19
|
+
* The key is used verbatim; callers must {@link sanitizeKey} first.
|
|
20
|
+
*/
|
|
13
21
|
set(id: string, output: Output): Effect.Effect<string>;
|
|
14
22
|
exports?: Effect.Effect<Record<string, any>>;
|
|
15
23
|
serve?<Req = never>(
|
|
@@ -21,6 +29,20 @@ export interface BaseRuntimeContext {
|
|
|
21
29
|
planServices?: Layer.Layer<any>;
|
|
22
30
|
}
|
|
23
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Canonicalize a logical key into a key that is safe to use as the name of an
|
|
34
|
+
* environment variable / binding (`[a-zA-Z][a-zA-Z0-9_]*`).
|
|
35
|
+
*
|
|
36
|
+
* `RuntimeContext.set`/`get` are dumb key/value stores: they read and write the
|
|
37
|
+
* key **verbatim**. It is the *caller's* responsibility to hand them a
|
|
38
|
+
* canonical key, since the caller is the one that knows the logical key may
|
|
39
|
+
* contain `.`/`-` (e.g. a dotted config name from `Platform`, or an
|
|
40
|
+
* `Output.toString()` like `"QueueSinkQueue.queueUrl"`). Callers run the key
|
|
41
|
+
* through this before calling `set`/`get` so both sides agree.
|
|
42
|
+
*/
|
|
43
|
+
export const sanitizeKey = (key: string): string =>
|
|
44
|
+
key.replaceAll(/[^a-zA-Z0-9]/g, "_");
|
|
45
|
+
|
|
24
46
|
/**
|
|
25
47
|
* Context of the runtime environment.
|
|
26
48
|
*
|
package/src/Stack.ts
CHANGED
|
@@ -10,6 +10,7 @@ import * as Scope from "effect/Scope";
|
|
|
10
10
|
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
11
11
|
import type { HttpClient } from "effect/unstable/http/HttpClient";
|
|
12
12
|
import type { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
13
|
+
import type { ActionLike } from "./Action.ts";
|
|
13
14
|
import { AlchemyContext, AlchemyContextLive } from "./AlchemyContext.ts";
|
|
14
15
|
import { provideFreshArtifactStore } from "./Artifacts.ts";
|
|
15
16
|
import { AuthProviders } from "./Auth/AuthProvider.ts";
|
|
@@ -20,7 +21,6 @@ import type { Input, InputProps } from "./Input.ts";
|
|
|
20
21
|
import * as Output from "./Output.ts";
|
|
21
22
|
import type { ResourceBinding, ResourceLike } from "./Resource.ts";
|
|
22
23
|
import { Stage } from "./Stage.ts";
|
|
23
|
-
import type { ActionLike } from "./Action.ts";
|
|
24
24
|
import type { State } from "./State/State.ts";
|
|
25
25
|
import { loadConfigProvider } from "./Util/ConfigProvider.ts";
|
|
26
26
|
import { effectClass, taggedFunction } from "./Util/effect.ts";
|
|
@@ -291,8 +291,8 @@ const alchemy = (overrides?: { dev?: boolean }) =>
|
|
|
291
291
|
: AlchemyContextLive,
|
|
292
292
|
);
|
|
293
293
|
|
|
294
|
-
export const evalStack = <A, B, Err, Req>(
|
|
295
|
-
effect: StackEffect<CompiledStack<A>, Stage | AlchemyContext>,
|
|
294
|
+
export const evalStack = <A, B, StackErr, Err, Req>(
|
|
295
|
+
effect: StackEffect<CompiledStack<A>, StackErr, Stage | AlchemyContext>,
|
|
296
296
|
fn: (stack: CompiledStack<A>) => Effect.Effect<B, Err, Req>,
|
|
297
297
|
options: {
|
|
298
298
|
stage: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Duration from "effect/Duration";
|
|
1
2
|
import * as Redacted from "effect/Redacted";
|
|
2
3
|
import { isResource } from "../Resource.ts";
|
|
3
4
|
|
|
@@ -8,6 +9,40 @@ import { isResource } from "../Resource.ts";
|
|
|
8
9
|
*/
|
|
9
10
|
export const REDACTED_MARKER = "__redacted__";
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* JSON marker used to tag a `Duration` value when writing state.
|
|
14
|
+
* The reviver recognises objects with exactly this key and rebuilds
|
|
15
|
+
* a real `Duration` instance on read so that downstream code can call
|
|
16
|
+
* `Duration.toSeconds`, `Duration.toMillis`, etc. without first
|
|
17
|
+
* decoding `Duration.toJSON`'s `{_id,_tag,...}` shape.
|
|
18
|
+
*/
|
|
19
|
+
export const DURATION_MARKER = "__duration__";
|
|
20
|
+
|
|
21
|
+
const decodeDuration = (encoded: unknown): Duration.Duration | undefined => {
|
|
22
|
+
if (encoded === null || typeof encoded !== "object") return undefined;
|
|
23
|
+
const json = encoded as {
|
|
24
|
+
_tag?: "Millis" | "Nanos" | "Infinity" | "NegativeInfinity";
|
|
25
|
+
millis?: number;
|
|
26
|
+
nanos?: string;
|
|
27
|
+
};
|
|
28
|
+
switch (json._tag) {
|
|
29
|
+
case "Millis":
|
|
30
|
+
return json.millis !== undefined
|
|
31
|
+
? Duration.millis(json.millis)
|
|
32
|
+
: undefined;
|
|
33
|
+
case "Nanos":
|
|
34
|
+
return json.nanos !== undefined
|
|
35
|
+
? Duration.nanos(BigInt(json.nanos))
|
|
36
|
+
: undefined;
|
|
37
|
+
case "Infinity":
|
|
38
|
+
return Duration.infinity;
|
|
39
|
+
case "NegativeInfinity":
|
|
40
|
+
return Duration.zero; // Effect treats negatives as zero clamp
|
|
41
|
+
default:
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
11
46
|
/**
|
|
12
47
|
* Recursively encode a state value for JSON serialisation.
|
|
13
48
|
*
|
|
@@ -32,6 +67,16 @@ export const encodeState = (value: unknown): unknown => {
|
|
|
32
67
|
[REDACTED_MARKER]: encodeState(Redacted.value(value)),
|
|
33
68
|
};
|
|
34
69
|
}
|
|
70
|
+
if (Duration.isDuration(value)) {
|
|
71
|
+
// `JSON.stringify(Duration.seconds(N))` already invokes Duration.toJSON,
|
|
72
|
+
// but encodeState is also called for code paths that don't go through
|
|
73
|
+
// `JSON.stringify` (e.g. the HTTP state-store). Tag with our marker so
|
|
74
|
+
// the reviver can unambiguously rebuild a real Duration instance —
|
|
75
|
+
// Duration.toJSON's `{_id,_tag,...}` shape is NOT a valid Duration.Input.
|
|
76
|
+
return {
|
|
77
|
+
[DURATION_MARKER]: value.toJSON(),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
35
80
|
if (isResource(value)) {
|
|
36
81
|
return {
|
|
37
82
|
id: value.LogicalId,
|
|
@@ -56,13 +101,15 @@ export const encodeState = (value: unknown): unknown => {
|
|
|
56
101
|
* through {@link encodeState}. Intended for use with `JSON.parse`.
|
|
57
102
|
*/
|
|
58
103
|
export const reviveState = (_key: string, value: unknown): unknown => {
|
|
59
|
-
if (
|
|
60
|
-
value
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
104
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
105
|
+
const obj = value as Record<string, unknown>;
|
|
106
|
+
if (REDACTED_MARKER in obj) {
|
|
107
|
+
return Redacted.make(obj[REDACTED_MARKER]);
|
|
108
|
+
}
|
|
109
|
+
if (DURATION_MARKER in obj) {
|
|
110
|
+
const decoded = decodeDuration(obj[DURATION_MARKER]);
|
|
111
|
+
if (decoded !== undefined) return decoded;
|
|
112
|
+
}
|
|
66
113
|
}
|
|
67
114
|
return value;
|
|
68
115
|
};
|
|
@@ -82,6 +129,10 @@ export const reviveStateRecursive = (value: unknown): unknown => {
|
|
|
82
129
|
if (keys.length === 1 && keys[0] === REDACTED_MARKER) {
|
|
83
130
|
return Redacted.make(reviveStateRecursive(obj[REDACTED_MARKER]));
|
|
84
131
|
}
|
|
132
|
+
if (keys.length === 1 && keys[0] === DURATION_MARKER) {
|
|
133
|
+
const decoded = decodeDuration(obj[DURATION_MARKER]);
|
|
134
|
+
if (decoded !== undefined) return decoded;
|
|
135
|
+
}
|
|
85
136
|
const result: Record<string, unknown> = {};
|
|
86
137
|
for (const [k, v] of Object.entries(obj)) {
|
|
87
138
|
result[k] = reviveStateRecursive(v);
|
package/src/Test/Bun.ts
CHANGED
|
@@ -7,11 +7,8 @@ import type { HookOptions } from "node:test";
|
|
|
7
7
|
import type { AlchemyContext } from "../AlchemyContext.ts";
|
|
8
8
|
import type { CompiledStack } from "../Stack.ts";
|
|
9
9
|
import type { Stage } from "../Stage.ts";
|
|
10
|
-
import { installLocalhostDns } from "../Util/LocalhostDns.ts";
|
|
11
10
|
import * as Core from "./Core.ts";
|
|
12
11
|
|
|
13
|
-
installLocalhostDns();
|
|
14
|
-
|
|
15
12
|
export type MakeOptions<ROut = any> = Core.MakeOptions<ROut>;
|
|
16
13
|
export type ScratchStack = Core.ScratchStack;
|
|
17
14
|
export type TestEffect<A, R = never> = Core.TestEffect<A, R>;
|
package/src/Test/Vitest.ts
CHANGED
|
@@ -12,11 +12,8 @@ import {
|
|
|
12
12
|
import type { AlchemyContext } from "../AlchemyContext.ts";
|
|
13
13
|
import type { CompiledStack } from "../Stack.ts";
|
|
14
14
|
import type { Stage } from "../Stage.ts";
|
|
15
|
-
import { installLocalhostDns } from "../Util/LocalhostDns.ts";
|
|
16
15
|
import * as Core from "./Core.ts";
|
|
17
16
|
|
|
18
|
-
installLocalhostDns();
|
|
19
|
-
|
|
20
17
|
export type MakeOptions<ROut = any> = Core.MakeOptions<ROut>;
|
|
21
18
|
export type ScratchStack = Core.ScratchStack;
|
|
22
19
|
export type TestEffect<A, R = never> = Core.TestEffect<A, R>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as Duration from "effect/Duration";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Convert a {@link Duration.Input} to whole, non-negative
|
|
5
|
+
* milliseconds. Returns `undefined` when `input` is `undefined`,
|
|
6
|
+
* so call sites can map through optional duration fields without
|
|
7
|
+
* a branch.
|
|
8
|
+
*/
|
|
9
|
+
export const toMillis = (input: Duration.Input | undefined) =>
|
|
10
|
+
input === undefined
|
|
11
|
+
? undefined
|
|
12
|
+
: Math.max(0, Math.ceil(Duration.toMillis(input)));
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Convert a {@link Duration.Input} to whole, non-negative seconds.
|
|
16
|
+
* Returns `undefined` when `input` is `undefined`.
|
|
17
|
+
*/
|
|
18
|
+
export const toSeconds = (input: Duration.Input | undefined) =>
|
|
19
|
+
input === undefined
|
|
20
|
+
? undefined
|
|
21
|
+
: Math.max(0, Math.ceil(Duration.toSeconds(input)));
|
|
@@ -12,6 +12,23 @@ import type { WebSocketConstructor } from "effect/unstable/socket/Socket";
|
|
|
12
12
|
|
|
13
13
|
const isBun = typeof Bun !== "undefined";
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a layer with different implementations for Bun and Node.
|
|
17
|
+
*/
|
|
18
|
+
export const platformLayer = <A, E, R>(constructors: {
|
|
19
|
+
bun: () => Promise<Layer.Layer<A, E, R>>;
|
|
20
|
+
node: () => Promise<Layer.Layer<A, E, R>>;
|
|
21
|
+
}) =>
|
|
22
|
+
Layer.unwrap(
|
|
23
|
+
Effect.promise(async () => {
|
|
24
|
+
if (isBun) {
|
|
25
|
+
return await constructors.bun();
|
|
26
|
+
} else {
|
|
27
|
+
return await constructors.node();
|
|
28
|
+
}
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
|
|
15
32
|
export type PlatformServices =
|
|
16
33
|
| ChildProcessSpawner
|
|
17
34
|
| FileSystem
|
|
@@ -21,29 +38,25 @@ export type PlatformServices =
|
|
|
21
38
|
// WebSocketConstructor is not included in NodeServices/BunServices, but required for Workers tail
|
|
22
39
|
| WebSocketConstructor;
|
|
23
40
|
|
|
24
|
-
export const PlatformServices: Layer.Layer<PlatformServices> =
|
|
25
|
-
async () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
NodeServices.layer,
|
|
42
|
-
NodeSocket.layerWebSocketConstructor,
|
|
43
|
-
);
|
|
44
|
-
}
|
|
41
|
+
export const PlatformServices: Layer.Layer<PlatformServices> = platformLayer({
|
|
42
|
+
bun: async () => {
|
|
43
|
+
const [BunServices, BunSocket] = await Promise.all([
|
|
44
|
+
import("@effect/platform-bun/BunServices"),
|
|
45
|
+
import("@effect/platform-bun/BunSocket"),
|
|
46
|
+
]);
|
|
47
|
+
return Layer.merge(BunServices.layer, BunSocket.layerWebSocketConstructor);
|
|
48
|
+
},
|
|
49
|
+
node: async () => {
|
|
50
|
+
const [NodeServices, NodeSocket] = await Promise.all([
|
|
51
|
+
import("@effect/platform-node/NodeServices"),
|
|
52
|
+
import("@effect/platform-node/NodeSocket"),
|
|
53
|
+
]);
|
|
54
|
+
return Layer.merge(
|
|
55
|
+
NodeServices.layer,
|
|
56
|
+
NodeSocket.layerWebSocketConstructor,
|
|
57
|
+
);
|
|
45
58
|
},
|
|
46
|
-
)
|
|
59
|
+
});
|
|
47
60
|
|
|
48
61
|
export const runMain = <E, A>(
|
|
49
62
|
effect: Effect.Effect<A, E>,
|
|
@@ -67,15 +80,16 @@ export const httpServer = (
|
|
|
67
80
|
port: number = 0,
|
|
68
81
|
host: string = "127.0.0.1",
|
|
69
82
|
): Layer.Layer<HttpServer, ServeError> =>
|
|
70
|
-
|
|
71
|
-
|
|
83
|
+
platformLayer({
|
|
84
|
+
bun: async () => {
|
|
72
85
|
const BunHttpServer = await import("@effect/platform-bun/BunHttpServer");
|
|
73
86
|
return BunHttpServer.layer({ hostname: host, port });
|
|
74
|
-
}
|
|
87
|
+
},
|
|
88
|
+
node: async () => {
|
|
75
89
|
const [NodeHttpServer, Http] = await Promise.all([
|
|
76
90
|
import("@effect/platform-node/NodeHttpServer"),
|
|
77
91
|
import("node:http"),
|
|
78
92
|
]);
|
|
79
93
|
return NodeHttpServer.layerServer(Http.createServer, { host, port });
|
|
80
|
-
}
|
|
81
|
-
})
|
|
94
|
+
},
|
|
95
|
+
});
|
package/src/Util/camel.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isPlainObject } from "./data.ts";
|
|
2
|
+
|
|
1
3
|
export const camelCaseKey = (key: string) =>
|
|
2
4
|
key
|
|
3
5
|
.replace(/^_+/, "")
|
|
@@ -7,11 +9,7 @@ export const toCamelCase = <T>(value: unknown): T => {
|
|
|
7
9
|
if (Array.isArray(value)) {
|
|
8
10
|
return value.map((item) => toCamelCase(item)) as T;
|
|
9
11
|
}
|
|
10
|
-
if (
|
|
11
|
-
value &&
|
|
12
|
-
typeof value === "object" &&
|
|
13
|
-
Object.getPrototypeOf(value) === Object.prototype
|
|
14
|
-
) {
|
|
12
|
+
if (isPlainObject(value)) {
|
|
15
13
|
return Object.fromEntries(
|
|
16
14
|
Object.entries(value).map(([key, nested]) => [
|
|
17
15
|
camelCaseKey(key),
|
package/src/Util/data.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import * as Predicate from "effect/Predicate";
|
|
2
|
+
import * as EffectRecord from "effect/Record";
|
|
3
|
+
import * as Redacted from "effect/Redacted";
|
|
4
|
+
|
|
1
5
|
export type Primitive =
|
|
2
6
|
| never
|
|
3
7
|
| undefined
|
|
@@ -16,3 +20,37 @@ export const isPrimitive = (value: any): value is Primitive =>
|
|
|
16
20
|
typeof value === "string" ||
|
|
17
21
|
typeof value === "symbol" ||
|
|
18
22
|
typeof value === "bigint";
|
|
23
|
+
|
|
24
|
+
export const isPlainObject = (
|
|
25
|
+
value: unknown,
|
|
26
|
+
): value is Record<string, unknown> => {
|
|
27
|
+
if (!Predicate.isObject(value)) return false;
|
|
28
|
+
return Object.getPrototypeOf(value) === Object.prototype;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const stripFields = <T>(value: T, empty: null | undefined): T => {
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
return value.map((item) => stripFields(item, empty)) as T;
|
|
34
|
+
}
|
|
35
|
+
if (!isPlainObject(value)) return value;
|
|
36
|
+
return EffectRecord.map(
|
|
37
|
+
EffectRecord.filter(value, (entry) => entry !== empty),
|
|
38
|
+
(entry) => stripFields(entry, empty),
|
|
39
|
+
) as T;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const stripNullFields = <T>(value: T): T => stripFields(value, null);
|
|
43
|
+
|
|
44
|
+
export const stripUndefinedFields = <T>(value: T): T =>
|
|
45
|
+
stripFields(value, undefined);
|
|
46
|
+
|
|
47
|
+
export const unwrapRedacted = <T>(value: T): T => {
|
|
48
|
+
if (Redacted.isRedacted(value)) {
|
|
49
|
+
return Redacted.value(value) as T;
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(value)) {
|
|
52
|
+
return value.map(unwrapRedacted) as T;
|
|
53
|
+
}
|
|
54
|
+
if (!isPlainObject(value)) return value;
|
|
55
|
+
return EffectRecord.map(value, unwrapRedacted) as T;
|
|
56
|
+
};
|
package/src/Util/index.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
export * from "./assert-never.ts";
|
|
2
1
|
export * from "./base32.ts";
|
|
3
2
|
export * from "./camel.ts";
|
|
4
|
-
export * from "./class.ts";
|
|
5
3
|
export * from "./data.ts";
|
|
6
4
|
export * from "./dedent.ts";
|
|
7
|
-
export * from "./instance.ts";
|
|
8
|
-
export * from "./pointer.ts";
|
|
9
|
-
export * from "./schema-to-type.ts";
|
|
10
5
|
export * from "./service.ts";
|
|
11
6
|
export * from "./sha256.ts";
|
|
12
7
|
export * from "./stable.ts";
|
|
13
|
-
export * from "./todo.ts";
|
|
14
8
|
export * from "./type.ts";
|
|
15
9
|
export * from "./types.ts";
|
|
16
10
|
export * from "./unknown.ts";
|