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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.45",
|
|
4
4
|
"homepage": "https://alchemy.run",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Sam Goodwin <sam@alchemy.run>",
|
|
@@ -291,16 +291,16 @@
|
|
|
291
291
|
"@alchemy.run/node-utils": "0.0.4",
|
|
292
292
|
"@aws-sdk/credential-providers": "^3.0.0",
|
|
293
293
|
"@clack/prompts": "^0.11.0",
|
|
294
|
-
"@distilled.cloud/aws": "^0.
|
|
295
|
-
"@distilled.cloud/axiom": "^0.
|
|
296
|
-
"@distilled.cloud/cloudflare": "^0.
|
|
297
|
-
"@distilled.cloud/cloudflare-rolldown-plugin": "0.
|
|
298
|
-
"@distilled.cloud/cloudflare-runtime": "0.
|
|
299
|
-
"@distilled.cloud/cloudflare-vite-plugin": "0.
|
|
300
|
-
"@distilled.cloud/core": "^0.
|
|
301
|
-
"@distilled.cloud/neon": "^0.
|
|
302
|
-
"@distilled.cloud/planetscale": "^0.
|
|
303
|
-
"@effect/vitest": ">=4.0.0-beta.
|
|
294
|
+
"@distilled.cloud/aws": "^0.22.1",
|
|
295
|
+
"@distilled.cloud/axiom": "^0.22.1",
|
|
296
|
+
"@distilled.cloud/cloudflare": "^0.22.1",
|
|
297
|
+
"@distilled.cloud/cloudflare-rolldown-plugin": "0.10.1",
|
|
298
|
+
"@distilled.cloud/cloudflare-runtime": "0.10.1",
|
|
299
|
+
"@distilled.cloud/cloudflare-vite-plugin": "0.10.1",
|
|
300
|
+
"@distilled.cloud/core": "^0.22.1",
|
|
301
|
+
"@distilled.cloud/neon": "^0.22.1",
|
|
302
|
+
"@distilled.cloud/planetscale": "^0.22.1",
|
|
303
|
+
"@effect/vitest": ">=4.0.0-beta.74 || >=4.0.0",
|
|
304
304
|
"@libsql/client": "^0.17.0",
|
|
305
305
|
"@octokit/rest": "^22.0.1",
|
|
306
306
|
"@smithy/node-config-provider": "^4.0.0",
|
|
@@ -327,9 +327,10 @@
|
|
|
327
327
|
"devDependencies": {
|
|
328
328
|
"@clack/prompts": "^0.11.0",
|
|
329
329
|
"@cloudflare/workers-types": "^4.20250805.0",
|
|
330
|
-
"@
|
|
331
|
-
"@effect/platform-
|
|
332
|
-
"@effect/platform-node
|
|
330
|
+
"@cloudflare/puppeteer": "^1.1.0",
|
|
331
|
+
"@effect/platform-bun": ">=4.0.0-beta.74 || >=4.0.0",
|
|
332
|
+
"@effect/platform-node": ">=4.0.0-beta.74 || >=4.0.0",
|
|
333
|
+
"@effect/platform-node-shared": ">=4.0.0-beta.74 || >=4.0.0",
|
|
333
334
|
"@oxc-project/types": "^0.127.0",
|
|
334
335
|
"@types/pg": "^8.11.0",
|
|
335
336
|
"@types/aws-lambda": "^8.10.152",
|
|
@@ -339,7 +340,7 @@
|
|
|
339
340
|
"@types/react": "^19.2.2",
|
|
340
341
|
"@types/ws": "^8.18.1",
|
|
341
342
|
"better-auth": "^1.6.2",
|
|
342
|
-
"effect": ">=4.0.0-beta.
|
|
343
|
+
"effect": ">=4.0.0-beta.74 || >=4.0.0",
|
|
343
344
|
"react-devtools-core": "^7.0.1",
|
|
344
345
|
"solid-js": "latest",
|
|
345
346
|
"tsconfig-paths": "^4.2.0",
|
|
@@ -349,12 +350,12 @@
|
|
|
349
350
|
"ws": "^8.20.0"
|
|
350
351
|
},
|
|
351
352
|
"peerDependencies": {
|
|
352
|
-
"@effect/platform-bun": ">=4.0.0-beta.
|
|
353
|
-
"@effect/platform-node": ">=4.0.0-beta.
|
|
354
|
-
"@effect/sql-pg": ">=4.0.0-beta.
|
|
353
|
+
"@effect/platform-bun": ">=4.0.0-beta.74 || >=4.0.0",
|
|
354
|
+
"@effect/platform-node": ">=4.0.0-beta.74 || >=4.0.0",
|
|
355
|
+
"@effect/sql-pg": ">=4.0.0-beta.74 || >=4.0.0",
|
|
355
356
|
"drizzle-kit": ">=1.0.0-rc.1",
|
|
356
357
|
"drizzle-orm": ">=1.0.0-rc.1",
|
|
357
|
-
"effect": ">=4.0.0-beta.
|
|
358
|
+
"effect": ">=4.0.0-beta.74 || >=4.0.0",
|
|
358
359
|
"vite": "^8.0.7",
|
|
359
360
|
"ws": "^8.20.0"
|
|
360
361
|
},
|
|
@@ -5,8 +5,8 @@ import type { CreateFunctionRequest } from "@distilled.cloud/aws/lambda";
|
|
|
5
5
|
import * as Lambda from "@distilled.cloud/aws/lambda";
|
|
6
6
|
import { Region } from "@distilled.cloud/aws/Region";
|
|
7
7
|
import type * as lambda from "aws-lambda";
|
|
8
|
-
import * as Config from "effect/Config";
|
|
9
8
|
import * as Context from "effect/Context";
|
|
9
|
+
import * as Duration from "effect/Duration";
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as FileSystem from "effect/FileSystem";
|
|
12
12
|
import * as Option from "effect/Option";
|
|
@@ -94,8 +94,45 @@ export interface FunctionProps extends PlatformProps {
|
|
|
94
94
|
subnetIds: string[];
|
|
95
95
|
securityGroupIds: string[];
|
|
96
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Maximum execution time before the function is forcibly terminated.
|
|
99
|
+
* Rounded up to whole seconds.
|
|
100
|
+
*
|
|
101
|
+
* @default 3 seconds (AWS Lambda default)
|
|
102
|
+
*/
|
|
103
|
+
timeout?: Duration.Duration;
|
|
97
104
|
}
|
|
98
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Normalize a {@link FunctionProps.timeout} to whole seconds.
|
|
108
|
+
*
|
|
109
|
+
* State JSON round-trips flatten a `Duration` to its `toJSON` shape
|
|
110
|
+
* (`{_id:"Duration",_tag:"Millis"|"Nanos"|"Infinity",...}`), which is not a
|
|
111
|
+
* valid `Duration.Input`. Reconstruct an input that `Duration.toSeconds`
|
|
112
|
+
* accepts before delegating.
|
|
113
|
+
*/
|
|
114
|
+
export const toTimeoutSeconds = (
|
|
115
|
+
timeout: Duration.Duration | undefined,
|
|
116
|
+
): number | undefined => {
|
|
117
|
+
if (timeout === undefined) return undefined;
|
|
118
|
+
const json = timeout as {
|
|
119
|
+
_id?: unknown;
|
|
120
|
+
_tag?: "Millis" | "Nanos" | "Infinity" | "NegativeInfinity";
|
|
121
|
+
millis?: number;
|
|
122
|
+
nanos?: string;
|
|
123
|
+
};
|
|
124
|
+
const input: Duration.Input =
|
|
125
|
+
json._id === "Duration"
|
|
126
|
+
? json._tag === "Millis"
|
|
127
|
+
? json.millis!
|
|
128
|
+
: json._tag === "Nanos"
|
|
129
|
+
? BigInt(json.nanos!)
|
|
130
|
+
: "Infinity"
|
|
131
|
+
: timeout;
|
|
132
|
+
const seconds = Duration.toSeconds(input);
|
|
133
|
+
return Number.isFinite(seconds) ? Math.max(1, Math.ceil(seconds)) : undefined;
|
|
134
|
+
};
|
|
135
|
+
|
|
99
136
|
export interface Function extends Resource<
|
|
100
137
|
FunctionTypeId,
|
|
101
138
|
FunctionProps,
|
|
@@ -368,7 +405,9 @@ export const Function: Platform<
|
|
|
368
405
|
env,
|
|
369
406
|
set: (id: string, output: Output.Output) =>
|
|
370
407
|
Effect.sync(() => {
|
|
371
|
-
|
|
408
|
+
// Key is already canonical (see RuntimeContext.sanitizeKey); store it
|
|
409
|
+
// verbatim.
|
|
410
|
+
const key = id;
|
|
372
411
|
// Preserve `Redacted`-ness across the Output → Lambda env var
|
|
373
412
|
// round-trip. `JSON.stringify(Redacted)` would emit the literal
|
|
374
413
|
// string `"<redacted>"` and lose the value, so secrets are
|
|
@@ -387,34 +426,35 @@ export const Function: Platform<
|
|
|
387
426
|
return key;
|
|
388
427
|
}),
|
|
389
428
|
get: <T>(key: string) =>
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
429
|
+
// Read the captured value straight from `process.env`. We must NOT
|
|
430
|
+
// resolve through `Config.string` here: at runtime the ambient
|
|
431
|
+
// `ConfigProvider` is the interceptor installed in `Platform.ts`,
|
|
432
|
+
// whose runtime branch calls back into `ctx.get(key)`. Going through
|
|
433
|
+
// `Config` would re-enter that interceptor for the same key and
|
|
434
|
+
// recurse forever, allocating until the Lambda init OOMs. The Worker
|
|
435
|
+
// runtime reads from `WorkerEnvironment` for the same reason.
|
|
436
|
+
Effect.sync(() => {
|
|
437
|
+
// Key is already canonical (see RuntimeContext.sanitizeKey).
|
|
438
|
+
const val = process.env[key];
|
|
439
|
+
if (val === undefined) {
|
|
440
|
+
return undefined;
|
|
441
|
+
}
|
|
442
|
+
try {
|
|
443
|
+
const value = JSON.parse(val);
|
|
444
|
+
if (
|
|
445
|
+
typeof value === "object" &&
|
|
446
|
+
value?._tag === "Redacted" &&
|
|
447
|
+
"value" in value
|
|
448
|
+
) {
|
|
449
|
+
return Redacted.make(
|
|
450
|
+
(value as { value: unknown }).value,
|
|
451
|
+
) as unknown as T;
|
|
452
|
+
}
|
|
453
|
+
return value as T;
|
|
454
|
+
} catch {
|
|
455
|
+
return val as unknown as T; // assume it's just a string
|
|
456
|
+
}
|
|
457
|
+
}),
|
|
418
458
|
serve: (handler: HttpEffect) =>
|
|
419
459
|
ctx.listen(makeFunctionHttpHandler(handler)),
|
|
420
460
|
listen: ((
|
|
@@ -872,6 +912,7 @@ export default await Effect.runPromise(handlerEffect)
|
|
|
872
912
|
}
|
|
873
913
|
: undefined,
|
|
874
914
|
Tags: tags,
|
|
915
|
+
Timeout: toTimeoutSeconds(news.timeout),
|
|
875
916
|
VpcConfig: news.vpc
|
|
876
917
|
? {
|
|
877
918
|
SubnetIds: news.vpc.subnetIds,
|
|
@@ -1121,6 +1162,11 @@ export default await Effect.runPromise(handlerEffect)
|
|
|
1121
1162
|
// code changed
|
|
1122
1163
|
return { action: "update" };
|
|
1123
1164
|
}
|
|
1165
|
+
if (
|
|
1166
|
+
toTimeoutSeconds(olds.timeout) !== toTimeoutSeconds(news.timeout)
|
|
1167
|
+
) {
|
|
1168
|
+
return { action: "update" };
|
|
1169
|
+
}
|
|
1124
1170
|
}),
|
|
1125
1171
|
read: Effect.fnUntraced(function* ({ id, olds, output }) {
|
|
1126
1172
|
const functionName =
|
|
@@ -1161,7 +1207,7 @@ export default await Effect.runPromise(handlerEffect)
|
|
|
1161
1207
|
// Reuse the persisted output where we have it (e.g. code hash) so
|
|
1162
1208
|
// diff doesn't see drift it can't reconstruct from the API.
|
|
1163
1209
|
const attrs = {
|
|
1164
|
-
...
|
|
1210
|
+
...output,
|
|
1165
1211
|
functionArn: fn.FunctionArn,
|
|
1166
1212
|
functionName: fn.FunctionName,
|
|
1167
1213
|
functionUrl,
|
|
@@ -1185,8 +1231,15 @@ export default await Effect.runPromise(handlerEffect)
|
|
|
1185
1231
|
vpc: news.vpc,
|
|
1186
1232
|
});
|
|
1187
1233
|
|
|
1188
|
-
//
|
|
1189
|
-
|
|
1234
|
+
// Mock code for the pre-created stub. It responds 503 (rather than a
|
|
1235
|
+
// bare 200) so that, during the brief window where the real
|
|
1236
|
+
// code/config update is still `InProgress`, a Function URL hit serves
|
|
1237
|
+
// an honest "not ready" signal instead of a successful-but-empty 200.
|
|
1238
|
+
// Downstream readiness probes already retry on non-200, so they wait
|
|
1239
|
+
// for the real handler to go live without the provider blocking.
|
|
1240
|
+
const code = new TextEncoder().encode(
|
|
1241
|
+
`export default () => ({ statusCode: 503, headers: { "content-type": "application/json" }, body: JSON.stringify({ error: "function initializing" }) })`,
|
|
1242
|
+
);
|
|
1190
1243
|
const archive = yield* zipCode(code);
|
|
1191
1244
|
const hash = yield* hashBundle(code);
|
|
1192
1245
|
yield* createOrUpdateFunction({
|
|
@@ -1261,7 +1314,7 @@ export default await Effect.runPromise(handlerEffect)
|
|
|
1261
1314
|
yield* session.note(summary({ code }));
|
|
1262
1315
|
|
|
1263
1316
|
return {
|
|
1264
|
-
...
|
|
1317
|
+
...output,
|
|
1265
1318
|
functionArn,
|
|
1266
1319
|
functionName,
|
|
1267
1320
|
functionUrl: functionUrl as any,
|
package/src/AWS/Providers.ts
CHANGED
|
@@ -19,6 +19,7 @@ import * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
|
19
19
|
import { CredentialsStoreLive } from "../Auth/Credentials.ts";
|
|
20
20
|
import { Command, CommandProvider } from "../Build/Command.ts";
|
|
21
21
|
import * as Provider from "../Provider.ts";
|
|
22
|
+
import { KeyPair, KeyPairProvider } from "../KeyPair.ts";
|
|
22
23
|
import { Random, RandomProvider } from "../Random.ts";
|
|
23
24
|
import * as ACM from "./ACM/index.ts";
|
|
24
25
|
import * as ApiGateway from "./ApiGateway/index.ts";
|
|
@@ -63,6 +64,7 @@ export const providers = () =>
|
|
|
63
64
|
Providers,
|
|
64
65
|
Provider.collection([
|
|
65
66
|
Command,
|
|
67
|
+
KeyPair,
|
|
66
68
|
Random,
|
|
67
69
|
ACM.Certificate,
|
|
68
70
|
ApiGateway.Account,
|
|
@@ -571,6 +573,7 @@ export const providers = () =>
|
|
|
571
573
|
Layer.provideMerge(
|
|
572
574
|
Layer.mergeAll(
|
|
573
575
|
CommandProvider(),
|
|
576
|
+
KeyPairProvider(),
|
|
574
577
|
RandomProvider(),
|
|
575
578
|
Assets.AssetsProvider(),
|
|
576
579
|
),
|
package/src/Apply.ts
CHANGED
|
@@ -280,7 +280,24 @@ const executePlan = Effect.fnUntraced(function* (
|
|
|
280
280
|
Effect.all(
|
|
281
281
|
fqns
|
|
282
282
|
.filter((fqn) => fqn in ready)
|
|
283
|
-
.map((fqn) =>
|
|
283
|
+
.map((fqn) =>
|
|
284
|
+
// Non-cycle upstreams must be observed at their TERMINAL output
|
|
285
|
+
// (`readyStable`), not their early precreate signal (`ready`). This
|
|
286
|
+
// is what makes a failed upstream actually interrupt its downstream:
|
|
287
|
+
// a resource with `precreate` resolves `ready` before its real
|
|
288
|
+
// `reconcile` runs, so a downstream waiting on `ready` would proceed
|
|
289
|
+
// (and even finish) even though the upstream's reconcile later
|
|
290
|
+
// failed. Waiting on `readyStable` means the downstream's
|
|
291
|
+
// `waitForDeps` short-circuits with the upstream's failure cause.
|
|
292
|
+
//
|
|
293
|
+
// Cycle members are the exception: peers in an SCC depend on each
|
|
294
|
+
// other, so they must rendezvous on the early `ready`/precreate
|
|
295
|
+
// signal to break the deadlock. Phase 3 (`converge`) re-runs them
|
|
296
|
+
// against final outputs once the cycle settles.
|
|
297
|
+
plan.cycleMembers.has(fqn)
|
|
298
|
+
? Deferred.await(ready[fqn])
|
|
299
|
+
: Deferred.await(readyStable[fqn]),
|
|
300
|
+
),
|
|
284
301
|
{ concurrency: "unbounded" },
|
|
285
302
|
);
|
|
286
303
|
|
package/src/Auth/AuthProvider.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as Context from "effect/Context";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
|
+
import * as Semaphore from "effect/Semaphore";
|
|
5
6
|
import { withLock } from "./Lock.ts";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -14,6 +15,20 @@ import { withLock } from "./Lock.ts";
|
|
|
14
15
|
*/
|
|
15
16
|
const LOCKED_METHODS = new Set(["read", "login", "logout", "configure"]);
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Methods that may drive an interactive flow (prompts, browser-based
|
|
20
|
+
* OAuth, etc.). A process-wide mutex serializes these across providers
|
|
21
|
+
* so that, e.g., Cloudflare's `configure` finishes its prompt sequence
|
|
22
|
+
* before Planetscale's begins — even when the two auth provider Layers
|
|
23
|
+
* are built in parallel as part of a single `providers()` Layer.
|
|
24
|
+
*
|
|
25
|
+
* The clack prompt wrapper in `Util/Clank.ts` enforces per-prompt
|
|
26
|
+
* serialization; this mutex enforces per-flow serialization so the user
|
|
27
|
+
* sees one provider's prompts grouped together rather than interleaved.
|
|
28
|
+
*/
|
|
29
|
+
const INTERACTIVE_METHODS = new Set(["login", "configure"]);
|
|
30
|
+
const interactiveMutex = Semaphore.makeUnsafe(1);
|
|
31
|
+
|
|
17
32
|
export class AuthError extends Schema.TaggedErrorClass<AuthError>()(
|
|
18
33
|
"AuthError",
|
|
19
34
|
{
|
|
@@ -143,13 +158,18 @@ export const AuthProvider =
|
|
|
143
158
|
Object.entries(service).map(([methodName, fn]) => [
|
|
144
159
|
methodName,
|
|
145
160
|
(...args: Parameters<typeof fn>) => {
|
|
146
|
-
|
|
161
|
+
let eff = (fn as any)(...args).pipe(
|
|
147
162
|
Effect.provideContext(ctx),
|
|
148
163
|
);
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
164
|
+
if (LOCKED_METHODS.has(methodName)) {
|
|
165
|
+
// First positional arg is always `profileName`.
|
|
166
|
+
const profileName = args[0] as string;
|
|
167
|
+
eff = withLock(`${profileName}-${name}`, eff);
|
|
168
|
+
}
|
|
169
|
+
if (INTERACTIVE_METHODS.has(methodName)) {
|
|
170
|
+
eff = Semaphore.withPermits(interactiveMutex, 1)(eff);
|
|
171
|
+
}
|
|
172
|
+
return eff;
|
|
153
173
|
},
|
|
154
174
|
]),
|
|
155
175
|
),
|
package/src/Auth/Credentials.ts
CHANGED
|
@@ -70,13 +70,14 @@ export const CredentialsStoreLive = Layer.effect(
|
|
|
70
70
|
credentials: T,
|
|
71
71
|
): Effect.Effect<void, PlatformError> => {
|
|
72
72
|
const filePath = credentialsFilePath(profile, provider);
|
|
73
|
-
return fs
|
|
74
|
-
.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
)
|
|
79
|
-
)
|
|
73
|
+
return fs.makeDirectory(path.dirname(filePath), { recursive: true }).pipe(
|
|
74
|
+
Effect.flatMap(() => {
|
|
75
|
+
return fs.writeFileString(
|
|
76
|
+
filePath,
|
|
77
|
+
JSON.stringify(credentials, null, 2),
|
|
78
|
+
);
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
const remove_ = (profile: string, provider: string): Effect.Effect<void> =>
|
|
@@ -9,7 +9,12 @@ import * as Argument from "effect/unstable/cli/Argument";
|
|
|
9
9
|
import * as CliError from "effect/unstable/cli/CliError";
|
|
10
10
|
import * as Flag from "effect/unstable/cli/Flag";
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
type AuthProvider,
|
|
14
|
+
AuthError,
|
|
15
|
+
AuthProviders,
|
|
16
|
+
} from "../../Auth/AuthProvider.ts";
|
|
17
|
+
import type { AlchemyProfile } from "../../Auth/Profile.ts";
|
|
13
18
|
import type * as Stack from "../../Stack.ts";
|
|
14
19
|
import { recordCli } from "../../Telemetry/Metrics.ts";
|
|
15
20
|
import { PromptCancelled } from "../../Util/Clank.ts";
|
|
@@ -254,11 +259,49 @@ export const instrumentCommand =
|
|
|
254
259
|
recordCli(command),
|
|
255
260
|
);
|
|
256
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Render a profile's stored credential entries the same way across
|
|
264
|
+
* `alchemy login` and `alchemy profile show`: one `── Provider ──`
|
|
265
|
+
* header per entry, then either the provider's own `prettyPrint` block
|
|
266
|
+
* (preferred) or a JSON-style fallback when the provider isn't
|
|
267
|
+
* registered in the supplied {@link AuthProviders} registry.
|
|
268
|
+
*/
|
|
269
|
+
export const printProfile = Effect.fn(function* (
|
|
270
|
+
profile: string,
|
|
271
|
+
stored: AlchemyProfile,
|
|
272
|
+
registry: AuthProviders["Service"],
|
|
273
|
+
) {
|
|
274
|
+
yield* Console.log(`Profile: ${profile}`);
|
|
275
|
+
const names = Object.keys(stored).sort();
|
|
276
|
+
if (names.length === 0) {
|
|
277
|
+
yield* Console.log("(no providers configured)");
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
for (const name of names) {
|
|
281
|
+
const cfg = stored[name]!;
|
|
282
|
+
yield* Console.log("");
|
|
283
|
+
yield* Console.log(`── ${name} ──`);
|
|
284
|
+
const provider: AuthProvider | undefined = registry[name];
|
|
285
|
+
if (provider == null) {
|
|
286
|
+
yield* Console.log(` method: ${cfg.method}`);
|
|
287
|
+
const { method: _method, ...rest } = cfg as Record<string, unknown> & {
|
|
288
|
+
method: string;
|
|
289
|
+
};
|
|
290
|
+
for (const [k, v] of Object.entries(rest)) {
|
|
291
|
+
yield* Console.log(
|
|
292
|
+
` ${k}: ${typeof v === "string" ? v : JSON.stringify(v)}`,
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
yield* provider.prettyPrint(profile, cfg);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
|
|
257
301
|
export const importStack = Effect.fn(function* (main: string) {
|
|
258
302
|
const path = yield* Path.Path;
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
);
|
|
303
|
+
const url = import.meta.resolve(path.resolve(main));
|
|
304
|
+
const module = yield* Effect.promise(() => import(url));
|
|
262
305
|
const stackEffect = module.default as ReturnType<
|
|
263
306
|
ReturnType<typeof Stack.make>
|
|
264
307
|
>;
|
package/src/Cli/commands/dev.ts
CHANGED
|
@@ -40,7 +40,12 @@ export const devCommand = Command.make(
|
|
|
40
40
|
: [
|
|
41
41
|
"node",
|
|
42
42
|
...process.execArgv,
|
|
43
|
-
|
|
43
|
+
...(isTransformTypesSupported()
|
|
44
|
+
? [
|
|
45
|
+
"--experimental-transform-types",
|
|
46
|
+
"--no-warnings=ExperimentalWarning",
|
|
47
|
+
]
|
|
48
|
+
: []),
|
|
44
49
|
"--watch",
|
|
45
50
|
"--watch-preserve-output",
|
|
46
51
|
fileURLToPath(import.meta.resolve("alchemy/bin/exec.js")),
|
|
@@ -67,3 +72,10 @@ export const devCommand = Command.make(
|
|
|
67
72
|
)(effect),
|
|
68
73
|
),
|
|
69
74
|
);
|
|
75
|
+
|
|
76
|
+
const isTransformTypesSupported = (
|
|
77
|
+
version = process.versions.node,
|
|
78
|
+
): boolean => {
|
|
79
|
+
const [major, minor] = version.split(".").map(Number);
|
|
80
|
+
return (major === 22 && minor >= 7) || (major >= 23 && major < 26);
|
|
81
|
+
};
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
envFile,
|
|
19
19
|
importStack,
|
|
20
20
|
instrumentCommand,
|
|
21
|
+
printProfile,
|
|
21
22
|
profile,
|
|
22
23
|
script,
|
|
23
24
|
stage,
|
|
@@ -91,10 +92,12 @@ export const loginCommand = Command.make(
|
|
|
91
92
|
(provider) =>
|
|
92
93
|
Effect.gen(function* () {
|
|
93
94
|
const existing = yield* profiles.getProfile(profile);
|
|
94
|
-
|
|
95
|
+
// --configure treats every provider as missing, so configure
|
|
96
|
+
// runs unconditionally and overwrites the stored entry.
|
|
97
|
+
const stored = configure ? undefined : existing?.[provider.name];
|
|
95
98
|
|
|
96
99
|
let cfg: { method: string };
|
|
97
|
-
if (
|
|
100
|
+
if (stored == null) {
|
|
98
101
|
cfg = yield* provider.configure(profile, { ci });
|
|
99
102
|
yield* profiles.setProfile(profile, {
|
|
100
103
|
...existing,
|
|
@@ -104,11 +107,24 @@ export const loginCommand = Command.make(
|
|
|
104
107
|
cfg = stored;
|
|
105
108
|
}
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
// `read` succeeds when creds are present and not expired
|
|
111
|
+
// (refreshing OAuth proactively if near expiry). Any failure
|
|
112
|
+
// — missing file, dead refresh token, etc. — falls through
|
|
113
|
+
// to `login`.
|
|
114
|
+
yield* provider
|
|
115
|
+
.read(profile, cfg)
|
|
116
|
+
.pipe(Effect.catch(() => provider.login(profile, cfg)));
|
|
109
117
|
}),
|
|
110
118
|
{ discard: true },
|
|
111
119
|
);
|
|
120
|
+
|
|
121
|
+
// Print the resulting profile using the same renderer as
|
|
122
|
+
// `alchemy profile show`.
|
|
123
|
+
const final = yield* profiles.getProfile(profile);
|
|
124
|
+
if (final != null) {
|
|
125
|
+
yield* Console.log("");
|
|
126
|
+
yield* printProfile(profile, final, authProviders);
|
|
127
|
+
}
|
|
112
128
|
}).pipe(Effect.provide(services));
|
|
113
129
|
}),
|
|
114
130
|
),
|
|
@@ -9,11 +9,20 @@ import { AuthProviders } from "../../Auth/AuthProvider.ts";
|
|
|
9
9
|
import { CredentialsStore } from "../../Auth/Credentials.ts";
|
|
10
10
|
import { Profile, withProfileOverride } from "../../Auth/Profile.ts";
|
|
11
11
|
import { AwsAuth } from "../../AWS/AuthProvider.ts";
|
|
12
|
+
import { AxiomAuth } from "../../Axiom/AuthProvider.ts";
|
|
12
13
|
import { CloudflareAuth } from "../../Cloudflare/Auth/AuthProvider.ts";
|
|
14
|
+
import { GitHubAuth } from "../../GitHub/AuthProvider.ts";
|
|
15
|
+
import { NeonAuth } from "../../Neon/AuthProvider.ts";
|
|
16
|
+
import { PlanetscaleAuth } from "../../Planetscale/AuthProvider.ts";
|
|
13
17
|
import { loadConfigProvider } from "../../Util/ConfigProvider.ts";
|
|
14
18
|
import { fileLogger } from "../../Util/FileLogger.ts";
|
|
15
19
|
|
|
16
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
envFile,
|
|
22
|
+
instrumentCommand,
|
|
23
|
+
printProfile,
|
|
24
|
+
profile,
|
|
25
|
+
} from "./_shared.ts";
|
|
17
26
|
|
|
18
27
|
const showCommand = Command.make(
|
|
19
28
|
"show",
|
|
@@ -36,14 +45,6 @@ const showCommand = Command.make(
|
|
|
36
45
|
return;
|
|
37
46
|
}
|
|
38
47
|
|
|
39
|
-
yield* Console.log(`Profile: ${profile}`);
|
|
40
|
-
|
|
41
|
-
const providerNames = Object.keys(stored).sort();
|
|
42
|
-
if (providerNames.length === 0) {
|
|
43
|
-
yield* Console.log("(no providers configured)");
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
48
|
const authProviders: AuthProviders["Service"] = {};
|
|
48
49
|
const authRegistry = Layer.succeed(AuthProviders, authProviders);
|
|
49
50
|
const services = Layer.mergeAll(
|
|
@@ -54,33 +55,22 @@ const showCommand = Command.make(
|
|
|
54
55
|
Logger.layer([fileLogger("out")], { mergeWithExisting: true }),
|
|
55
56
|
// Building these layers triggers their AuthProviderLayer effect, which
|
|
56
57
|
// registers the provider into the shared `authProviders` registry.
|
|
57
|
-
Layer.provide(
|
|
58
|
+
Layer.provide(
|
|
59
|
+
Layer.mergeAll(
|
|
60
|
+
AwsAuth,
|
|
61
|
+
AxiomAuth,
|
|
62
|
+
CloudflareAuth,
|
|
63
|
+
GitHubAuth,
|
|
64
|
+
NeonAuth,
|
|
65
|
+
PlanetscaleAuth,
|
|
66
|
+
),
|
|
67
|
+
authRegistry,
|
|
68
|
+
),
|
|
58
69
|
);
|
|
59
70
|
|
|
60
|
-
yield*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
yield* Console.log("");
|
|
64
|
-
yield* Console.log(`── ${name} ──`);
|
|
65
|
-
const provider = authProviders[name];
|
|
66
|
-
if (provider == null) {
|
|
67
|
-
// Unknown provider — fall back to a JSON dump so the user can still
|
|
68
|
-
// see what's stored even if its module isn't bundled into the CLI.
|
|
69
|
-
yield* Console.log(`method: ${cfg.method}`);
|
|
70
|
-
const { method: _method, ...rest } = cfg as Record<
|
|
71
|
-
string,
|
|
72
|
-
unknown
|
|
73
|
-
> & { method: string };
|
|
74
|
-
for (const [k, v] of Object.entries(rest)) {
|
|
75
|
-
yield* Console.log(
|
|
76
|
-
`${k}: ${typeof v === "string" ? v : JSON.stringify(v)}`,
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
yield* provider.prettyPrint(profile, cfg);
|
|
82
|
-
}
|
|
83
|
-
}).pipe(Effect.provide(services));
|
|
71
|
+
yield* printProfile(profile, stored, authProviders).pipe(
|
|
72
|
+
Effect.provide(services),
|
|
73
|
+
);
|
|
84
74
|
}),
|
|
85
75
|
),
|
|
86
76
|
);
|
package/src/Cli/main.ts
CHANGED
|
@@ -8,12 +8,9 @@ import { AlchemyContextLive } from "alchemy/AlchemyContext";
|
|
|
8
8
|
import { CredentialsStoreLive } from "alchemy/Auth/Credentials";
|
|
9
9
|
import { ProfileLive } from "alchemy/Auth/Profile";
|
|
10
10
|
import { TelemetryLive } from "alchemy/Telemetry/Layer";
|
|
11
|
-
import { installLocalhostDns } from "alchemy/Util/LocalhostDns";
|
|
12
11
|
import { PlatformServices } from "alchemy/Util/PlatformServices";
|
|
13
12
|
import packageJson from "../../package.json" with { type: "json" };
|
|
14
13
|
|
|
15
|
-
installLocalhostDns();
|
|
16
|
-
|
|
17
14
|
import { checkLatestVersion } from "./checkVersion.ts";
|
|
18
15
|
import { handleCancellation } from "./commands/_shared.ts";
|
|
19
16
|
import { awsCommand } from "./commands/aws.ts";
|
|
@@ -190,8 +190,6 @@ export type AiGateway = Resource<
|
|
|
190
190
|
{
|
|
191
191
|
gatewayId: string;
|
|
192
192
|
accountId: string;
|
|
193
|
-
accountTag: string | undefined;
|
|
194
|
-
internalId: string | undefined;
|
|
195
193
|
cacheInvalidateOnUpdate: boolean;
|
|
196
194
|
cacheTtl: number | null;
|
|
197
195
|
collectLogs: boolean;
|
|
@@ -328,8 +326,8 @@ export const AiGatewayProvider = () =>
|
|
|
328
326
|
): AiGateway["Attributes"] => ({
|
|
329
327
|
gatewayId: gateway.id,
|
|
330
328
|
accountId,
|
|
331
|
-
accountTag: gateway.accountTag ?? undefined,
|
|
332
|
-
internalId: gateway.internalId ?? undefined,
|
|
329
|
+
// accountTag: gateway.accountTag ?? undefined,
|
|
330
|
+
// internalId: gateway.internalId ?? undefined,
|
|
333
331
|
cacheInvalidateOnUpdate: gateway.cacheInvalidateOnUpdate,
|
|
334
332
|
cacheTtl: nullIfZero(gateway.cacheTtl),
|
|
335
333
|
collectLogs: gateway.collectLogs,
|
|
@@ -387,7 +385,6 @@ export const AiGatewayProvider = () =>
|
|
|
387
385
|
rateLimitingLimit: next.rateLimitingLimit,
|
|
388
386
|
rateLimitingTechnique: next.rateLimitingTechnique,
|
|
389
387
|
authentication: next.authentication,
|
|
390
|
-
isDefault: next.isDefault,
|
|
391
388
|
logManagement: next.logManagement,
|
|
392
389
|
logManagementStrategy: next.logManagementStrategy,
|
|
393
390
|
logpush: next.logpush,
|
|
@@ -413,7 +410,6 @@ export const AiGatewayProvider = () =>
|
|
|
413
410
|
rateLimitingTechnique: next.rateLimitingTechnique,
|
|
414
411
|
authentication: next.authentication,
|
|
415
412
|
dlp: next.dlp,
|
|
416
|
-
isDefault: next.isDefault,
|
|
417
413
|
logManagement: next.logManagement,
|
|
418
414
|
logManagementStrategy: next.logManagementStrategy,
|
|
419
415
|
logpush: next.logpush,
|