alchemy 2.0.0-beta.44 → 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/exec.js +67 -8
- 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/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.map +1 -1
- package/lib/Cli/commands/dev.js +10 -1
- 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/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.js +1 -1
- package/lib/Cloudflare/Local.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts +2 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +21 -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 -2
- 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 +4 -7
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +111 -66
- 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 -24
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +168 -47
- 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 +5 -2
- package/lib/Cloudflare/Workers/WorkerBridge.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js +4 -1
- 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/index.d.ts +1 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +1 -0
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/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 +3 -1
- package/lib/Local/RpcProvider.d.ts.map +1 -1
- package/lib/Local/RpcProvider.js +28 -2
- package/lib/Local/RpcProvider.js.map +1 -1
- package/lib/Local/RpcServerEnvironment.js +1 -1
- package/lib/Local/RpcServerEnvironment.js.map +1 -1
- 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/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/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 +20 -19
- 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/Cli/commands/_shared.ts +47 -4
- package/src/Cli/commands/dev.ts +13 -1
- package/src/Cli/commands/login.ts +20 -4
- package/src/Cli/commands/profile.ts +24 -34
- 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 +1 -1
- package/src/Cloudflare/Providers.ts +25 -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 -4
- 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 +139 -78
- 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 +274 -93
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +158 -103
- package/src/Cloudflare/Workers/WorkerBinding.ts +10 -0
- package/src/Cloudflare/Workers/WorkerBridge.ts +7 -4
- package/src/Cloudflare/Workers/WorkerBundle.ts +4 -1
- 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/index.ts +1 -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 +45 -1
- package/src/Local/RpcServerEnvironment.ts +1 -1
- 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/index.ts +0 -6
- package/src/Util/types.ts +9 -2
- package/src/index.ts +2 -3
- 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/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/Secret.ts +0 -87
- 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/Util/instance.ts
DELETED
package/src/Util/pointer.ts
DELETED
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts an Effect Schema to TypeScript type definitions.
|
|
3
|
-
*
|
|
4
|
-
* This module recursively discovers all named types (like S.Class with identifiers)
|
|
5
|
-
* and generates interface definitions for each.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import * as Predicate from "effect/Predicate";
|
|
11
|
-
import type * as Schema from "effect/Schema";
|
|
12
|
-
import * as AST from "effect/SchemaAST";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The result of generating TypeScript type definitions.
|
|
16
|
-
*/
|
|
17
|
-
export interface TypeDefinitionResult {
|
|
18
|
-
/**
|
|
19
|
-
* The type expressions for each input schema.
|
|
20
|
-
* Each expression is either an identifier (for named types) or an inline type.
|
|
21
|
-
*/
|
|
22
|
-
readonly exprs: string[];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* All type definitions as a single string.
|
|
26
|
-
* Contains all recursively discovered named types, separated by newlines.
|
|
27
|
-
* Types are deduplicated - if multiple schemas reference the same type,
|
|
28
|
-
* it will only appear once.
|
|
29
|
-
*/
|
|
30
|
-
readonly types: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Generates TypeScript type definitions from one or more schemas.
|
|
35
|
-
*
|
|
36
|
-
* All schemas share a single type environment, so types referenced by
|
|
37
|
-
* multiple schemas are only generated once (deduplication).
|
|
38
|
-
*/
|
|
39
|
-
export const schemaToType = <Schemas extends Schema.Schema<any>[]>(
|
|
40
|
-
...schemas: Schemas
|
|
41
|
-
): TypeDefinitionResult => {
|
|
42
|
-
const typesMap: Record<string, string> = {};
|
|
43
|
-
const processing = new Set<string>();
|
|
44
|
-
|
|
45
|
-
const exprs = schemas.map((schema) =>
|
|
46
|
-
go(schema.ast, { types: typesMap, processing }, "handle-identifier"),
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const types = Object.values(typesMap).join("\n\n");
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
exprs,
|
|
53
|
-
types,
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
interface GoOptions {
|
|
58
|
-
readonly types: Record<string, string>;
|
|
59
|
-
readonly processing: Set<string>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Converts an AST node to a TypeScript type reference or inline type.
|
|
64
|
-
* Returns the identifier/type expression and collects named types.
|
|
65
|
-
*/
|
|
66
|
-
export const fromAST = (
|
|
67
|
-
ast: AST.AST,
|
|
68
|
-
options?: { types?: string[] },
|
|
69
|
-
): string => {
|
|
70
|
-
const typesMap: Record<string, string> = {};
|
|
71
|
-
const processing = new Set<string>();
|
|
72
|
-
const result = go(ast, { types: typesMap, processing }, "handle-identifier");
|
|
73
|
-
|
|
74
|
-
if (options?.types) {
|
|
75
|
-
for (const def of Object.values(typesMap)) {
|
|
76
|
-
options.types.push(def);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return result;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
function getDescription(ast: AST.AST): string | undefined {
|
|
84
|
-
const desc = AST.resolveDescription(ast);
|
|
85
|
-
if (desc === undefined) return undefined;
|
|
86
|
-
|
|
87
|
-
if (AST.isString(ast) && desc === "a string") return undefined;
|
|
88
|
-
if (AST.isNumber(ast) && desc === "a number") return undefined;
|
|
89
|
-
if (AST.isBoolean(ast) && desc === "a boolean") return undefined;
|
|
90
|
-
if (AST.isBigInt(ast) && desc === "a bigint") return undefined;
|
|
91
|
-
if (AST.isSymbol(ast) && desc === "a symbol") return undefined;
|
|
92
|
-
if (
|
|
93
|
-
AST.isObjectKeyword(ast) &&
|
|
94
|
-
desc === "an object in the TypeScript meaning, i.e. the `object` type"
|
|
95
|
-
)
|
|
96
|
-
return undefined;
|
|
97
|
-
|
|
98
|
-
return desc;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Gets the identifier for a named type.
|
|
103
|
-
*
|
|
104
|
-
* Returns an identifier for:
|
|
105
|
-
* - S.Class types (Declarations with typeParameters and encoding)
|
|
106
|
-
* - Any schema with an explicit identifier annotation
|
|
107
|
-
* - Suspended types with identifiers
|
|
108
|
-
*
|
|
109
|
-
* Does NOT return identifier for simple transformations like NumberFromString.
|
|
110
|
-
*/
|
|
111
|
-
function getIdentifier(ast: AST.AST): string | undefined {
|
|
112
|
-
if (AST.isDeclaration(ast)) {
|
|
113
|
-
return AST.resolveIdentifier(ast);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (AST.isSuspend(ast)) {
|
|
117
|
-
const id = AST.resolveIdentifier(ast);
|
|
118
|
-
if (id !== undefined) return id;
|
|
119
|
-
const resolved = ast.thunk();
|
|
120
|
-
return getIdentifier(resolved);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// For schemas with encoding chains (transforms like NumberFromString),
|
|
124
|
-
// don't treat as named types - just use the decoded type
|
|
125
|
-
if (ast.encoding) {
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return AST.resolveIdentifier(ast);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function formatComment(
|
|
133
|
-
description: string | undefined,
|
|
134
|
-
indent: string,
|
|
135
|
-
): string {
|
|
136
|
-
if (!description) return "";
|
|
137
|
-
const lines = description.split("\n");
|
|
138
|
-
if (lines.length === 1) {
|
|
139
|
-
return `${indent}/** ${description} */\n`;
|
|
140
|
-
}
|
|
141
|
-
return `${indent}/**\n${lines.map((line) => `${indent} * ${line}`).join("\n")}\n${indent} */\n`;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function escapePropertyName(name: PropertyKey): string {
|
|
145
|
-
if (typeof name === "symbol") {
|
|
146
|
-
return `[${String(name)}]`;
|
|
147
|
-
}
|
|
148
|
-
const str = String(name);
|
|
149
|
-
if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str)) {
|
|
150
|
-
return str;
|
|
151
|
-
}
|
|
152
|
-
return JSON.stringify(str);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Gets the type body for a named type (S.Class, etc).
|
|
157
|
-
* Navigates through Declarations to find the actual structure.
|
|
158
|
-
*/
|
|
159
|
-
function getTypeBody(ast: AST.AST, options: GoOptions): string {
|
|
160
|
-
if (AST.isSuspend(ast)) {
|
|
161
|
-
return getTypeBody(ast.thunk(), options);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (AST.isDeclaration(ast)) {
|
|
165
|
-
if (ast.typeParameters.length > 0) {
|
|
166
|
-
return go(ast.typeParameters[0], options, "ignore-identifier");
|
|
167
|
-
}
|
|
168
|
-
return "unknown";
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return go(ast, options, "ignore-identifier");
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function go(
|
|
175
|
-
ast: AST.AST,
|
|
176
|
-
options: GoOptions,
|
|
177
|
-
identifierHandling: "handle-identifier" | "ignore-identifier",
|
|
178
|
-
): string {
|
|
179
|
-
// Handle identifier references first
|
|
180
|
-
if (identifierHandling === "handle-identifier") {
|
|
181
|
-
const id = getIdentifier(ast);
|
|
182
|
-
if (id !== undefined) {
|
|
183
|
-
if (options.processing.has(id)) {
|
|
184
|
-
return id;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (!(id in options.types)) {
|
|
188
|
-
options.processing.add(id);
|
|
189
|
-
|
|
190
|
-
const typeBody = getTypeBody(ast, options);
|
|
191
|
-
|
|
192
|
-
if (typeBody.startsWith("{")) {
|
|
193
|
-
options.types[id] = `interface ${id} ${typeBody}`;
|
|
194
|
-
} else {
|
|
195
|
-
options.types[id] = `type ${id} = ${typeBody};`;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
options.processing.delete(id);
|
|
199
|
-
}
|
|
200
|
-
return id;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// For Declarations without identifier (or when ignoring), get the body from typeParameters
|
|
205
|
-
if (AST.isDeclaration(ast) && identifierHandling === "ignore-identifier") {
|
|
206
|
-
if (ast.typeParameters.length > 0) {
|
|
207
|
-
return go(ast.typeParameters[0], options, identifierHandling);
|
|
208
|
-
}
|
|
209
|
-
return "unknown";
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// Handle encoding chains (transformations): use the decoded type
|
|
213
|
-
if (ast.encoding) {
|
|
214
|
-
return go(AST.toType(ast), options, identifierHandling);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
switch (ast._tag) {
|
|
218
|
-
case "Declaration": {
|
|
219
|
-
if (ast.typeParameters.length > 0) {
|
|
220
|
-
const id = getIdentifier(ast);
|
|
221
|
-
if (id) {
|
|
222
|
-
const params = ast.typeParameters
|
|
223
|
-
.map((p) => go(p, options, "handle-identifier"))
|
|
224
|
-
.join(", ");
|
|
225
|
-
return `${id}<${params}>`;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return "unknown";
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
case "Literal": {
|
|
232
|
-
const literal = ast.literal;
|
|
233
|
-
if (Predicate.isString(literal)) {
|
|
234
|
-
return JSON.stringify(literal);
|
|
235
|
-
}
|
|
236
|
-
if (Predicate.isNumber(literal)) {
|
|
237
|
-
return String(literal);
|
|
238
|
-
}
|
|
239
|
-
if (Predicate.isBoolean(literal)) {
|
|
240
|
-
return String(literal);
|
|
241
|
-
}
|
|
242
|
-
if (Predicate.isBigInt(literal)) {
|
|
243
|
-
return `${String(literal)}n`;
|
|
244
|
-
}
|
|
245
|
-
return "unknown";
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
case "Null":
|
|
249
|
-
return "null";
|
|
250
|
-
|
|
251
|
-
case "UniqueSymbol":
|
|
252
|
-
return `typeof ${String(ast.symbol)}`;
|
|
253
|
-
|
|
254
|
-
case "Undefined":
|
|
255
|
-
return "undefined";
|
|
256
|
-
|
|
257
|
-
case "Void":
|
|
258
|
-
return "void";
|
|
259
|
-
|
|
260
|
-
case "Never":
|
|
261
|
-
return "never";
|
|
262
|
-
|
|
263
|
-
case "Unknown":
|
|
264
|
-
return "unknown";
|
|
265
|
-
|
|
266
|
-
case "Any":
|
|
267
|
-
return "any";
|
|
268
|
-
|
|
269
|
-
case "String":
|
|
270
|
-
return "string";
|
|
271
|
-
|
|
272
|
-
case "Number":
|
|
273
|
-
return "number";
|
|
274
|
-
|
|
275
|
-
case "Boolean":
|
|
276
|
-
return "boolean";
|
|
277
|
-
|
|
278
|
-
case "BigInt":
|
|
279
|
-
return "bigint";
|
|
280
|
-
|
|
281
|
-
case "Symbol":
|
|
282
|
-
return "symbol";
|
|
283
|
-
|
|
284
|
-
case "ObjectKeyword":
|
|
285
|
-
return "object";
|
|
286
|
-
|
|
287
|
-
case "Enum": {
|
|
288
|
-
const values = ast.enums.map(([_, value]) =>
|
|
289
|
-
typeof value === "string" ? JSON.stringify(value) : String(value),
|
|
290
|
-
);
|
|
291
|
-
return values.join(" | ");
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
case "TemplateLiteral": {
|
|
295
|
-
return formatTemplateLiteral(ast, options);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
case "Arrays": {
|
|
299
|
-
return formatArrays(ast, options);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
case "Objects": {
|
|
303
|
-
return formatObjects(ast, options);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
case "Union": {
|
|
307
|
-
const members = ast.types.map((t) => go(t, options, "handle-identifier"));
|
|
308
|
-
const unique = [...new Set(members)];
|
|
309
|
-
if (unique.length === 1) {
|
|
310
|
-
return unique[0];
|
|
311
|
-
}
|
|
312
|
-
return unique.join(" | ");
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
case "Suspend": {
|
|
316
|
-
const id = getIdentifier(ast);
|
|
317
|
-
if (id !== undefined) {
|
|
318
|
-
if (options.processing.has(id)) {
|
|
319
|
-
return id;
|
|
320
|
-
}
|
|
321
|
-
if (!(id in options.types)) {
|
|
322
|
-
options.processing.add(id);
|
|
323
|
-
const typeBody = getTypeBody(ast, options);
|
|
324
|
-
if (typeBody.startsWith("{")) {
|
|
325
|
-
options.types[id] = `interface ${id} ${typeBody}`;
|
|
326
|
-
} else {
|
|
327
|
-
options.types[id] = `type ${id} = ${typeBody};`;
|
|
328
|
-
}
|
|
329
|
-
options.processing.delete(id);
|
|
330
|
-
}
|
|
331
|
-
return id;
|
|
332
|
-
}
|
|
333
|
-
const resolved = ast.thunk();
|
|
334
|
-
return go(resolved, options, identifierHandling);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
function formatTemplateLiteral(
|
|
340
|
-
ast: AST.TemplateLiteral,
|
|
341
|
-
options: GoOptions,
|
|
342
|
-
): string {
|
|
343
|
-
let result = "`";
|
|
344
|
-
for (const part of ast.parts) {
|
|
345
|
-
if (AST.isLiteral(part) && typeof part.literal === "string") {
|
|
346
|
-
result += part.literal;
|
|
347
|
-
} else {
|
|
348
|
-
const spanType = formatTemplateLiteralSpan(part, options);
|
|
349
|
-
result += "${" + spanType + "}";
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
result += "`";
|
|
353
|
-
return result;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function formatTemplateLiteralSpan(type: AST.AST, options: GoOptions): string {
|
|
357
|
-
switch (type._tag) {
|
|
358
|
-
case "String":
|
|
359
|
-
return "string";
|
|
360
|
-
case "Number":
|
|
361
|
-
return "number";
|
|
362
|
-
case "Literal":
|
|
363
|
-
return typeof type.literal === "string"
|
|
364
|
-
? JSON.stringify(type.literal)
|
|
365
|
-
: String(type.literal);
|
|
366
|
-
case "TemplateLiteral":
|
|
367
|
-
return formatTemplateLiteral(type, options);
|
|
368
|
-
case "Union":
|
|
369
|
-
return type.types
|
|
370
|
-
.map((t) => formatTemplateLiteralSpan(t, options))
|
|
371
|
-
.join(" | ");
|
|
372
|
-
default:
|
|
373
|
-
return go(type, options, "handle-identifier");
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
function formatArrays(ast: AST.Arrays, options: GoOptions): string {
|
|
378
|
-
const elements: string[] = [];
|
|
379
|
-
|
|
380
|
-
for (const element of ast.elements) {
|
|
381
|
-
const isOpt = AST.isOptional(element);
|
|
382
|
-
let typeStr: string;
|
|
383
|
-
if (isOpt && AST.isUnion(element)) {
|
|
384
|
-
const nonUndefined = element.types.filter((t) => !AST.isUndefined(t));
|
|
385
|
-
if (nonUndefined.length === 1) {
|
|
386
|
-
typeStr = go(nonUndefined[0], options, "handle-identifier");
|
|
387
|
-
} else if (nonUndefined.length > 1) {
|
|
388
|
-
typeStr = nonUndefined
|
|
389
|
-
.map((t) => go(t, options, "handle-identifier"))
|
|
390
|
-
.join(" | ");
|
|
391
|
-
} else {
|
|
392
|
-
typeStr = go(element, options, "handle-identifier");
|
|
393
|
-
}
|
|
394
|
-
} else {
|
|
395
|
-
typeStr = go(element, options, "handle-identifier");
|
|
396
|
-
}
|
|
397
|
-
const description = getDescription(element);
|
|
398
|
-
const comment = description ? `/* ${description} */ ` : "";
|
|
399
|
-
if (isOpt) {
|
|
400
|
-
elements.push(`${comment}${typeStr}?`);
|
|
401
|
-
} else {
|
|
402
|
-
elements.push(`${comment}${typeStr}`);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
if (ast.rest.length > 0) {
|
|
407
|
-
const restType = go(ast.rest[0], options, "handle-identifier");
|
|
408
|
-
if (ast.elements.length === 0 && ast.rest.length === 1) {
|
|
409
|
-
if (!ast.isMutable) {
|
|
410
|
-
return `readonly ${restType}[]`;
|
|
411
|
-
}
|
|
412
|
-
return `${restType}[]`;
|
|
413
|
-
}
|
|
414
|
-
elements.push(`...${restType}[]`);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
const prefix = !ast.isMutable ? "readonly " : "";
|
|
418
|
-
return `${prefix}[${elements.join(", ")}]`;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function formatObjects(ast: AST.Objects, options: GoOptions): string {
|
|
422
|
-
if (ast.propertySignatures.length === 0 && ast.indexSignatures.length === 0) {
|
|
423
|
-
return "{}";
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
const lines: string[] = [];
|
|
427
|
-
|
|
428
|
-
for (const ps of ast.propertySignatures) {
|
|
429
|
-
if (typeof ps.name !== "string" && typeof ps.name !== "number") {
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
const propName = escapePropertyName(ps.name);
|
|
434
|
-
const typeStr = go(ps.type, options, "handle-identifier");
|
|
435
|
-
const description = getDescription(ps.type);
|
|
436
|
-
const comment = formatComment(description, " ");
|
|
437
|
-
const isMutable = ps.type.context?.isMutable ?? false;
|
|
438
|
-
const readonly = isMutable ? "" : "readonly ";
|
|
439
|
-
const optional = AST.isOptional(ps.type) ? "?" : "";
|
|
440
|
-
|
|
441
|
-
lines.push(`${comment} ${readonly}${propName}${optional}: ${typeStr};`);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
for (const is of ast.indexSignatures) {
|
|
445
|
-
const paramType = go(is.parameter, options, "handle-identifier");
|
|
446
|
-
const valueType = go(is.type, options, "handle-identifier");
|
|
447
|
-
const readonly = "readonly ";
|
|
448
|
-
lines.push(` ${readonly}[key: ${paramType}]: ${valueType};`);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
if (lines.length === 0) {
|
|
452
|
-
return "{}";
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
return `{\n${lines.join("\n")}\n}`;
|
|
456
|
-
}
|
package/src/Util/todo.ts
DELETED
package/src/Variable.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as Config from "effect/Config";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as Output from "./Output.ts";
|
|
4
|
-
import { toOutput } from "./Secret.ts";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The shapes a {@link variable} can be derived from.
|
|
8
|
-
*/
|
|
9
|
-
export type VariableInput<T, R = never> =
|
|
10
|
-
| T
|
|
11
|
-
| Effect.Effect<T, any, R>
|
|
12
|
-
| Config.Config<T>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Bind a non-secret value into the active {@link RuntimeContext} (e.g. a
|
|
16
|
-
* Cloudflare Worker's `env`) under the given `name`. Counterpart to
|
|
17
|
-
* {@link Secret} for plain (non-redacted) values — the resource provider
|
|
18
|
-
* deploys it as `plain_text` / `json` rather than `secret_text`.
|
|
19
|
-
*
|
|
20
|
-
* The result is an `Output<T>` — `yield*`-ing it returns an `Accessor<T>`
|
|
21
|
-
* that resolves the value at runtime.
|
|
22
|
-
*
|
|
23
|
-
* @example One-arg shortcut — reads `Config.string("DATABASE_URL")`
|
|
24
|
-
* ```ts
|
|
25
|
-
* const url = yield* Alchemy.Variable("DATABASE_URL");
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @example From a literal
|
|
29
|
-
* ```ts
|
|
30
|
-
* const port = yield* Alchemy.Variable("PORT", 3000);
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export function Variable(name: string): Output.Output<string, never>;
|
|
34
|
-
export function Variable<T, R = never>(
|
|
35
|
-
name: string,
|
|
36
|
-
value: VariableInput<T, R>,
|
|
37
|
-
): Output.Output<T, R>;
|
|
38
|
-
export function Variable<T = string, R = never>(
|
|
39
|
-
name: string,
|
|
40
|
-
value?: VariableInput<T, R>,
|
|
41
|
-
): Output.Output<T, R> {
|
|
42
|
-
const source: any = value ?? Config.string(name);
|
|
43
|
-
return Output.named(toOutput<T, R>(source), name);
|
|
44
|
-
}
|