alchemy 2.0.0-beta.84 → 2.0.0-beta.85
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/THIRD_PARTY_LICENSES.md +2 -2
- package/bin/cli.js +14 -6
- package/bin/register-oxc.js +16 -12
- package/lib/AdoptPolicy.d.ts +73 -0
- package/lib/AdoptPolicy.d.ts.map +1 -1
- package/lib/AdoptPolicy.js +54 -0
- package/lib/AdoptPolicy.js.map +1 -1
- package/lib/Alchemist/AuthRegistry.d.ts +31 -0
- package/lib/Alchemist/AuthRegistry.d.ts.map +1 -0
- package/lib/Alchemist/AuthRegistry.js +95 -0
- package/lib/Alchemist/AuthRegistry.js.map +1 -0
- package/lib/Alchemist/Drift.d.ts +70 -0
- package/lib/Alchemist/Drift.d.ts.map +1 -0
- package/lib/Alchemist/Drift.js +54 -0
- package/lib/Alchemist/Drift.js.map +1 -0
- package/lib/Alchemist/Entrypoint.d.ts +27 -3
- package/lib/Alchemist/Entrypoint.d.ts.map +1 -1
- package/lib/Alchemist/Entrypoint.js +34 -3
- package/lib/Alchemist/Entrypoint.js.map +1 -1
- package/lib/Alchemist/Errors.d.ts +1 -1
- package/lib/Alchemist/Errors.d.ts.map +1 -1
- package/lib/Alchemist/Errors.js +1 -1
- package/lib/Alchemist/Errors.js.map +1 -1
- package/lib/Alchemist/Logs.d.ts +46 -0
- package/lib/Alchemist/Logs.d.ts.map +1 -0
- package/lib/Alchemist/{routes/logs.js → Logs.js} +21 -26
- package/lib/Alchemist/Logs.js.map +1 -0
- package/lib/Alchemist/Nuke.d.ts +69 -0
- package/lib/Alchemist/Nuke.d.ts.map +1 -0
- package/lib/Alchemist/Nuke.js +35 -0
- package/lib/Alchemist/Nuke.js.map +1 -0
- package/lib/Alchemist/Operations.d.ts +168 -0
- package/lib/Alchemist/Operations.d.ts.map +1 -0
- package/lib/Alchemist/Operations.js +165 -0
- package/lib/Alchemist/Operations.js.map +1 -0
- package/lib/Alchemist/Profile.d.ts +132 -0
- package/lib/Alchemist/Profile.d.ts.map +1 -0
- package/lib/Alchemist/{routes/profile.js → Profile.js} +20 -21
- package/lib/Alchemist/Profile.js.map +1 -0
- package/lib/Alchemist/{routes/provider.d.ts → Provider.d.ts} +4 -4
- package/lib/Alchemist/Provider.d.ts.map +1 -0
- package/lib/Alchemist/{routes/provider.js → Provider.js} +7 -6
- package/lib/Alchemist/Provider.js.map +1 -0
- package/lib/Alchemist/Runtime.d.ts +10 -6
- package/lib/Alchemist/Runtime.d.ts.map +1 -1
- package/lib/Alchemist/Runtime.js +38 -2
- package/lib/Alchemist/Runtime.js.map +1 -1
- package/lib/Alchemist/{routes/state.d.ts → State.d.ts} +36 -16
- package/lib/Alchemist/State.d.ts.map +1 -0
- package/lib/Alchemist/{routes/state.js → State.js} +50 -15
- package/lib/Alchemist/State.js.map +1 -0
- package/lib/Alchemist/index.d.ts +11 -10
- package/lib/Alchemist/index.d.ts.map +1 -1
- package/lib/Alchemist/index.js +10 -9
- package/lib/Alchemist/index.js.map +1 -1
- package/lib/Apply.d.ts +2 -8
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +364 -184
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts +24 -11
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +28 -12
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/BrowserOAuth.d.ts +6 -8
- package/lib/Auth/BrowserOAuth.d.ts.map +1 -1
- package/lib/Auth/BrowserOAuth.js +25 -41
- package/lib/Auth/BrowserOAuth.js.map +1 -1
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +2 -2
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/Auth/Demand.d.ts +4 -4
- package/lib/Auth/Demand.d.ts.map +1 -1
- package/lib/Auth/Demand.js +16 -10
- package/lib/Auth/Demand.js.map +1 -1
- package/lib/Auth/Env.d.ts +2 -1
- package/lib/Auth/Env.d.ts.map +1 -1
- package/lib/Auth/Env.js +4 -2
- package/lib/Auth/Env.js.map +1 -1
- package/lib/Auth/Inspect.d.ts +2 -2
- package/lib/Auth/Inspect.d.ts.map +1 -1
- package/lib/Auth/Inspect.js +3 -1
- package/lib/Auth/Inspect.js.map +1 -1
- package/lib/Auth/Lock.d.ts.map +1 -1
- package/lib/Auth/Lock.js +4 -8
- package/lib/Auth/Lock.js.map +1 -1
- package/lib/Auth/OAuthFlow.d.ts +3 -12
- package/lib/Auth/OAuthFlow.d.ts.map +1 -1
- package/lib/Auth/OAuthFlow.js +7 -17
- package/lib/Auth/OAuthFlow.js.map +1 -1
- package/lib/Auth/Paths.d.ts +2 -1
- package/lib/Auth/Paths.d.ts.map +1 -1
- package/lib/Auth/Paths.js +3 -2
- package/lib/Auth/Paths.js.map +1 -1
- package/lib/Auth/Profile.d.ts +10 -0
- package/lib/Auth/Profile.d.ts.map +1 -1
- package/lib/Auth/Profile.js +19 -2
- package/lib/Auth/Profile.js.map +1 -1
- package/lib/Auth/Registry.d.ts +20 -0
- package/lib/Auth/Registry.d.ts.map +1 -0
- package/lib/Auth/Registry.js +17 -0
- package/lib/Auth/Registry.js.map +1 -0
- package/lib/Auth/Resolve.d.ts +34 -2
- package/lib/Auth/Resolve.d.ts.map +1 -1
- package/lib/Auth/Resolve.js +51 -3
- package/lib/Auth/Resolve.js.map +1 -1
- package/lib/Auth/StoredAuthProvider.d.ts +1 -1
- package/lib/Auth/StoredAuthProvider.d.ts.map +1 -1
- package/lib/Auth/StoredAuthProvider.js +1 -2
- package/lib/Auth/StoredAuthProvider.js.map +1 -1
- package/lib/Binding.d.ts.map +1 -1
- package/lib/Binding.js +3 -1
- package/lib/Binding.js.map +1 -1
- package/lib/Bundle/Bundle.d.ts +5 -0
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +36 -6
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Bundle/NamespaceImportPlugin.d.ts +55 -0
- package/lib/Bundle/NamespaceImportPlugin.d.ts.map +1 -0
- package/lib/Bundle/NamespaceImportPlugin.js +226 -0
- package/lib/Bundle/NamespaceImportPlugin.js.map +1 -0
- package/lib/Bundle/index.d.ts +1 -0
- package/lib/Bundle/index.d.ts.map +1 -1
- package/lib/Bundle/index.js +1 -0
- package/lib/Bundle/index.js.map +1 -1
- package/lib/Cli/Format.d.ts.map +1 -1
- package/lib/Cli/Format.js +2 -1
- package/lib/Cli/Format.js.map +1 -1
- package/lib/Cli/GlobalLog.d.ts +72 -26
- package/lib/Cli/GlobalLog.d.ts.map +1 -1
- package/lib/Cli/GlobalLog.js +151 -59
- package/lib/Cli/GlobalLog.js.map +1 -1
- package/lib/Cli/LoggingCli.d.ts.map +1 -1
- package/lib/Cli/LoggingCli.js +24 -18
- package/lib/Cli/LoggingCli.js.map +1 -1
- package/lib/Cli/PlainCliFormatter.d.ts.map +1 -1
- package/lib/Cli/PlainCliFormatter.js +4 -1
- package/lib/Cli/PlainCliFormatter.js.map +1 -1
- package/lib/Cli/Present.d.ts +14 -0
- package/lib/Cli/Present.d.ts.map +1 -0
- package/lib/Cli/Present.js +22 -0
- package/lib/Cli/Present.js.map +1 -0
- package/lib/Cli/SigilRenderer.d.ts +58 -0
- package/lib/Cli/SigilRenderer.d.ts.map +1 -0
- package/lib/Cli/SigilRenderer.js +39 -0
- package/lib/Cli/SigilRenderer.js.map +1 -0
- package/lib/Cli/checkVersion.d.ts +11 -14
- package/lib/Cli/checkVersion.d.ts.map +1 -1
- package/lib/Cli/checkVersion.js +19 -77
- package/lib/Cli/checkVersion.js.map +1 -1
- package/lib/Cli/commands/confirm.d.ts +2 -2
- package/lib/Cli/commands/confirm.d.ts.map +1 -1
- package/lib/Cli/commands/confirm.js +3 -3
- package/lib/Cli/commands/confirm.js.map +1 -1
- package/lib/Cli/commands/deploy.d.ts +4 -4
- package/lib/Cli/commands/deploy.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.js +40 -39
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +41 -3
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cli/commands/drift.d.ts +2 -2
- package/lib/Cli/commands/drift.d.ts.map +1 -1
- package/lib/Cli/commands/drift.js +14 -13
- package/lib/Cli/commands/drift.js.map +1 -1
- package/lib/Cli/commands/errors.d.ts.map +1 -1
- package/lib/Cli/commands/errors.js +2 -1
- package/lib/Cli/commands/errors.js.map +1 -1
- package/lib/Cli/commands/instrument.d.ts +15 -5
- package/lib/Cli/commands/instrument.d.ts.map +1 -1
- package/lib/Cli/commands/instrument.js +33 -8
- package/lib/Cli/commands/instrument.js.map +1 -1
- package/lib/Cli/commands/logs.d.ts +1 -1
- package/lib/Cli/commands/logs.d.ts.map +1 -1
- package/lib/Cli/commands/logs.js +22 -22
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/nuke.d.ts +3 -2
- package/lib/Cli/commands/nuke.d.ts.map +1 -1
- package/lib/Cli/commands/nuke.js +19 -17
- package/lib/Cli/commands/nuke.js.map +1 -1
- package/lib/Cli/commands/profile/commands.d.ts +3 -2
- package/lib/Cli/commands/profile/commands.d.ts.map +1 -1
- package/lib/Cli/commands/profile/commands.js +26 -27
- package/lib/Cli/commands/profile/commands.js.map +1 -1
- package/lib/Cli/commands/profile/flows.d.ts +6 -5
- package/lib/Cli/commands/profile/flows.d.ts.map +1 -1
- package/lib/Cli/commands/profile/flows.js +19 -17
- package/lib/Cli/commands/profile/flows.js.map +1 -1
- package/lib/Cli/commands/profile/hub.d.ts +1 -2
- package/lib/Cli/commands/profile/hub.d.ts.map +1 -1
- package/lib/Cli/commands/profile/hub.js +15 -17
- package/lib/Cli/commands/profile/hub.js.map +1 -1
- package/lib/Cli/commands/provider.d.ts +3 -1
- package/lib/Cli/commands/provider.d.ts.map +1 -1
- package/lib/Cli/commands/provider.js +4 -4
- package/lib/Cli/commands/provider.js.map +1 -1
- package/lib/Cli/commands/render.d.ts +2 -4
- package/lib/Cli/commands/render.d.ts.map +1 -1
- package/lib/Cli/commands/render.js +33 -56
- package/lib/Cli/commands/render.js.map +1 -1
- package/lib/Cli/commands/state.d.ts +1 -2
- package/lib/Cli/commands/state.d.ts.map +1 -1
- package/lib/Cli/commands/state.js +74 -27
- package/lib/Cli/commands/state.js.map +1 -1
- package/lib/Cli/components/capabilities.d.ts +4 -0
- package/lib/Cli/components/capabilities.d.ts.map +1 -0
- package/lib/Cli/components/capabilities.js +18 -0
- package/lib/Cli/components/capabilities.js.map +1 -0
- package/lib/Cli/components/types.d.ts +2 -81
- package/lib/Cli/components/types.d.ts.map +1 -1
- package/lib/Cli/components/types.js +1 -3
- package/lib/Cli/components/types.js.map +1 -1
- package/lib/Cli/components/ui/Environment.d.ts +3 -3
- package/lib/Cli/components/ui/Environment.d.ts.map +1 -1
- package/lib/Cli/components/ui/Environment.js.map +1 -1
- package/lib/Cli/components/ui/Interactive.d.ts +17 -4
- package/lib/Cli/components/ui/Interactive.d.ts.map +1 -1
- package/lib/Cli/components/ui/Interactive.js +7 -11
- package/lib/Cli/components/ui/Interactive.js.map +1 -1
- package/lib/Cli/components/ui/Layout.d.ts +1 -1
- package/lib/Cli/components/ui/Layout.d.ts.map +1 -1
- package/lib/Cli/components/ui/Layout.js +1 -1
- package/lib/Cli/components/ui/Layout.js.map +1 -1
- package/lib/Cli/components/ui/Typography.d.ts +1 -1
- package/lib/Cli/components/ui/Typography.d.ts.map +1 -1
- package/lib/Cli/components/ui/Typography.js +1 -1
- package/lib/Cli/components/ui/Typography.js.map +1 -1
- package/lib/Cli/components/ui/index.d.ts +2 -2
- package/lib/Cli/components/ui/index.js +2 -2
- package/lib/Cli/components/view/ApprovePlan.d.ts +1 -1
- package/lib/Cli/components/view/ApprovePlan.d.ts.map +1 -1
- package/lib/Cli/components/view/ApprovePlan.js +2 -1
- package/lib/Cli/components/view/ApprovePlan.js.map +1 -1
- package/lib/Cli/components/view/Format.d.ts +5 -0
- package/lib/Cli/components/view/Format.d.ts.map +1 -0
- package/lib/Cli/components/view/Format.js +39 -0
- package/lib/Cli/components/view/Format.js.map +1 -0
- package/lib/Cli/components/view/Help.d.ts +2 -2
- package/lib/Cli/components/view/Help.d.ts.map +1 -1
- package/lib/Cli/components/view/Help.js +7 -5
- package/lib/Cli/components/view/Help.js.map +1 -1
- package/lib/Cli/components/view/Logo.js +1 -1
- package/lib/Cli/components/view/Logo.js.map +1 -1
- package/lib/Cli/components/view/Nuke.d.ts +8 -9
- package/lib/Cli/components/view/Nuke.d.ts.map +1 -1
- package/lib/Cli/components/view/Nuke.js +49 -52
- package/lib/Cli/components/view/Nuke.js.map +1 -1
- package/lib/Cli/components/view/PlanDecision.d.ts +1 -1
- package/lib/Cli/components/view/PlanDecision.d.ts.map +1 -1
- package/lib/Cli/components/view/PlanDecision.js +1 -1
- package/lib/Cli/components/view/PlanDecision.js.map +1 -1
- package/lib/Cli/components/view/PlanRow.js +1 -1
- package/lib/Cli/components/view/PlanRow.js.map +1 -1
- package/lib/Cli/components/view/PlanTree.d.ts +1 -1
- package/lib/Cli/components/view/PlanTree.d.ts.map +1 -1
- package/lib/Cli/components/view/PlanTree.js +1 -1
- package/lib/Cli/components/view/PlanView.js +1 -1
- package/lib/Cli/components/view/PlanView.js.map +1 -1
- package/lib/Cli/components/view/Profile.d.ts +1 -1
- package/lib/Cli/components/view/Profile.js +2 -2
- package/lib/Cli/components/view/Profile.js.map +1 -1
- package/lib/Cli/components/view/ProfileDashboard.d.ts +4 -4
- package/lib/Cli/components/view/ProfileDashboard.d.ts.map +1 -1
- package/lib/Cli/components/view/ProfileDashboard.js +9 -8
- package/lib/Cli/components/view/ProfileDashboard.js.map +1 -1
- package/lib/Cli/components/view/Prompts.d.ts +3 -3
- package/lib/Cli/components/view/Prompts.d.ts.map +1 -1
- package/lib/Cli/components/view/Prompts.js +11 -18
- package/lib/Cli/components/view/Prompts.js.map +1 -1
- package/lib/Cli/components/view/Runtime.d.ts +5 -5
- package/lib/Cli/components/view/Runtime.d.ts.map +1 -1
- package/lib/Cli/components/view/Runtime.js +136 -219
- package/lib/Cli/components/view/Runtime.js.map +1 -1
- package/lib/Cli/components/view/SigilCli.d.ts +2 -2
- package/lib/Cli/components/view/SigilCli.d.ts.map +1 -1
- package/lib/Cli/components/view/SigilCli.js +7 -7
- package/lib/Cli/components/view/SigilCli.js.map +1 -1
- package/lib/Cli/components/view/StateExplorer.d.ts +1 -1
- package/lib/Cli/components/view/StateExplorer.d.ts.map +1 -1
- package/lib/Cli/components/view/StateExplorer.js +2 -1
- package/lib/Cli/components/view/StateExplorer.js.map +1 -1
- package/lib/Cli/components/view/statusStyle.d.ts +2 -2
- package/lib/Cli/components/view/statusStyle.d.ts.map +1 -1
- package/lib/Cli/components/view/statusStyle.js +1 -1
- package/lib/Cli/components/view/statusStyle.js.map +1 -1
- package/lib/Cli/exec.d.ts +6 -1
- package/lib/Cli/exec.d.ts.map +1 -1
- package/lib/Cli/exec.js +29 -34
- package/lib/Cli/exec.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +35 -26
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cli/selectCli.d.ts +2 -2
- package/lib/Cli/selectCli.d.ts.map +1 -1
- package/lib/Cli/selectCli.js +2 -2
- package/lib/Cli/selectCli.js.map +1 -1
- package/lib/Command/Command.js +1 -1
- package/lib/Command/Command.js.map +1 -1
- package/lib/Command/Dev.d.ts +58 -4
- package/lib/Command/Dev.d.ts.map +1 -1
- package/lib/Command/Dev.js +87 -30
- package/lib/Command/Dev.js.map +1 -1
- package/lib/Command/Local.d.ts +1 -1
- package/lib/Command/Memo.js +1 -1
- package/lib/Command/Memo.js.map +1 -1
- package/lib/Command/Providers.d.ts +1 -1
- package/lib/Command/Providers.d.ts.map +1 -1
- package/lib/Contributions.d.ts +2 -3
- package/lib/Contributions.d.ts.map +1 -1
- package/lib/Contributions.js +38 -6
- package/lib/Contributions.js.map +1 -1
- package/lib/DNS/Adapter.d.ts +204 -0
- package/lib/DNS/Adapter.d.ts.map +1 -0
- package/lib/DNS/Adapter.js +112 -0
- package/lib/DNS/Adapter.js.map +1 -0
- package/lib/DNS/index.d.ts +2 -0
- package/lib/DNS/index.d.ts.map +1 -0
- package/lib/DNS/index.js +2 -0
- package/lib/DNS/index.js.map +1 -0
- package/lib/Deploy.d.ts +7 -2
- package/lib/Deploy.d.ts.map +1 -1
- package/lib/Deploy.js +8 -3
- package/lib/Deploy.js.map +1 -1
- package/lib/Destroy.d.ts +5 -8
- package/lib/Destroy.d.ts.map +1 -1
- package/lib/Destroy.js +10 -7
- package/lib/Destroy.js.map +1 -1
- package/lib/Diff.d.ts.map +1 -1
- package/lib/Diff.js +14 -4
- package/lib/Diff.js.map +1 -1
- package/lib/Drift.d.ts +7 -7
- package/lib/Drift.d.ts.map +1 -1
- package/lib/Drift.js +184 -101
- package/lib/Drift.js.map +1 -1
- package/lib/EvalStack.d.ts +23 -0
- package/lib/EvalStack.d.ts.map +1 -0
- package/lib/EvalStack.js +47 -0
- package/lib/EvalStack.js.map +1 -0
- package/lib/Events.d.ts +210 -0
- package/lib/Events.d.ts.map +1 -0
- package/lib/Events.js +244 -0
- package/lib/Events.js.map +1 -0
- package/lib/Interaction.d.ts +159 -48
- package/lib/Interaction.d.ts.map +1 -1
- package/lib/Interaction.js +139 -58
- package/lib/Interaction.js.map +1 -1
- package/lib/Local/LocalProvider.d.ts.map +1 -1
- package/lib/Local/LocalProvider.js +31 -9
- package/lib/Local/LocalProvider.js.map +1 -1
- package/lib/Local/RpcProvider.d.ts.map +1 -1
- package/lib/Local/RpcProvider.js +10 -1
- package/lib/Local/RpcProvider.js.map +1 -1
- package/lib/Local/RpcProviderProxy.d.ts +16 -0
- package/lib/Local/RpcProviderProxy.d.ts.map +1 -1
- package/lib/Local/RpcProviderProxy.js +19 -10
- package/lib/Local/RpcProviderProxy.js.map +1 -1
- package/lib/Local/RpcSerialization.d.ts +3 -2
- package/lib/Local/RpcSerialization.d.ts.map +1 -1
- package/lib/Local/RpcSerialization.js +13 -10
- package/lib/Local/RpcSerialization.js.map +1 -1
- package/lib/Local/RpcServer.d.ts +2 -1
- package/lib/Local/RpcServer.d.ts.map +1 -1
- package/lib/Local/RpcServer.js +19 -14
- package/lib/Local/RpcServer.js.map +1 -1
- package/lib/Local/RpcServerBun.d.ts.map +1 -1
- package/lib/Local/RpcServerBun.js +8 -4
- package/lib/Local/RpcServerBun.js.map +1 -1
- package/lib/Local/RpcServerEnvironment.d.ts +2 -3
- package/lib/Local/RpcServerEnvironment.d.ts.map +1 -1
- package/lib/Local/RpcServerEnvironment.js +2 -2
- package/lib/Local/RpcServerEnvironment.js.map +1 -1
- package/lib/Local/RpcServerNode.d.ts.map +1 -1
- package/lib/Local/RpcServerNode.js +5 -1
- package/lib/Local/RpcServerNode.js.map +1 -1
- package/lib/Local/RpcServerSession.d.ts +1 -1
- package/lib/Local/RpcServerSession.d.ts.map +1 -1
- package/lib/Local/RpcServerSession.js.map +1 -1
- package/lib/Local/RpcSpawner.d.ts +6 -8
- package/lib/Local/RpcSpawner.d.ts.map +1 -1
- package/lib/Local/RpcSpawner.js +45 -36
- package/lib/Local/RpcSpawner.js.map +1 -1
- package/lib/Local/Sidecar.d.ts +23 -0
- package/lib/Local/Sidecar.d.ts.map +1 -1
- package/lib/Local/Sidecar.js +14 -9
- package/lib/Local/Sidecar.js.map +1 -1
- package/lib/Nuke.d.ts +5 -23
- package/lib/Nuke.d.ts.map +1 -1
- package/lib/Nuke.js +48 -13
- package/lib/Nuke.js.map +1 -1
- package/lib/Output.d.ts +19 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +96 -3
- package/lib/Output.js.map +1 -1
- package/lib/Plan.d.ts +5 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +111 -33
- package/lib/Plan.js.map +1 -1
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +31 -7
- package/lib/Platform.js.map +1 -1
- package/lib/Provider.d.ts +45 -0
- package/lib/Provider.d.ts.map +1 -1
- package/lib/Provider.js +2 -2
- package/lib/Provider.js.map +1 -1
- package/lib/Report.d.ts +17 -195
- package/lib/Report.d.ts.map +1 -1
- package/lib/Report.js +39 -12
- package/lib/Report.js.map +1 -1
- package/lib/Runtime/ManagedHttpShutdown.d.ts +17 -0
- package/lib/Runtime/ManagedHttpShutdown.d.ts.map +1 -1
- package/lib/Runtime/ManagedHttpShutdown.js +11 -2
- package/lib/Runtime/ManagedHttpShutdown.js.map +1 -1
- package/lib/RuntimeContext.js +1 -1
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Stack.d.ts +49 -29
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +25 -31
- package/lib/Stack.js.map +1 -1
- package/lib/State/BucketState.d.ts.map +1 -1
- package/lib/State/BucketState.js +43 -14
- package/lib/State/BucketState.js.map +1 -1
- package/lib/State/LocalState.d.ts.map +1 -1
- package/lib/State/LocalState.js +3 -3
- package/lib/State/LocalState.js.map +1 -1
- package/lib/State/Provisioning.d.ts +5 -0
- package/lib/State/Provisioning.d.ts.map +1 -1
- package/lib/State/Provisioning.js +3 -1
- package/lib/State/Provisioning.js.map +1 -1
- package/lib/State/ResourceState.d.ts +2 -0
- package/lib/State/ResourceState.d.ts.map +1 -1
- package/lib/State/State.d.ts +26 -0
- package/lib/State/State.d.ts.map +1 -1
- package/lib/State/StateEncoding.d.ts +7 -0
- package/lib/State/StateEncoding.d.ts.map +1 -1
- package/lib/State/StateEncoding.js +19 -0
- package/lib/State/StateEncoding.js.map +1 -1
- package/lib/State/index.js +2 -2
- package/lib/State/index.js.map +1 -1
- package/lib/Telemetry/Layer.d.ts +2 -5
- package/lib/Telemetry/Layer.d.ts.map +1 -1
- package/lib/Telemetry/Layer.js +3 -23
- package/lib/Telemetry/Layer.js.map +1 -1
- package/lib/Telemetry/Metrics.d.ts +1 -1
- package/lib/Telemetry/Metrics.d.ts.map +1 -1
- package/lib/TelemetryRelay.js +1 -1
- package/lib/TelemetryRelay.js.map +1 -1
- package/lib/TelemetryRuntime.d.ts +1 -1
- package/lib/TelemetryRuntime.d.ts.map +1 -1
- package/lib/TelemetryRuntime.js +4 -3
- package/lib/TelemetryRuntime.js.map +1 -1
- package/lib/Util/ConsoleSink.d.ts +23 -2
- package/lib/Util/ConsoleSink.d.ts.map +1 -1
- package/lib/Util/ConsoleSink.js +54 -14
- package/lib/Util/ConsoleSink.js.map +1 -1
- package/lib/Util/LogAnnotation.d.ts +19 -0
- package/lib/Util/LogAnnotation.d.ts.map +1 -0
- package/lib/Util/LogAnnotation.js +19 -0
- package/lib/Util/LogAnnotation.js.map +1 -0
- package/lib/Util/LogRecord.d.ts +281 -0
- package/lib/Util/LogRecord.d.ts.map +1 -0
- package/lib/Util/LogRecord.js +267 -0
- package/lib/Util/LogRecord.js.map +1 -0
- package/lib/Util/Node.d.ts +9 -0
- package/lib/Util/Node.d.ts.map +1 -1
- package/lib/Util/Node.js +10 -6
- package/lib/Util/Node.js.map +1 -1
- package/lib/Util/PlatformServices.d.ts +3 -2
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +6 -2
- package/lib/Util/PlatformServices.js.map +1 -1
- package/lib/Util/ResourceOutput.d.ts +18 -10
- package/lib/Util/ResourceOutput.d.ts.map +1 -1
- package/lib/Util/ResourceOutput.js +22 -23
- package/lib/Util/ResourceOutput.js.map +1 -1
- package/lib/Util/Shutdown.d.ts +10 -0
- package/lib/Util/Shutdown.d.ts.map +1 -0
- package/lib/Util/Shutdown.js +32 -0
- package/lib/Util/Shutdown.js.map +1 -0
- package/lib/Util/Terminal.d.ts +2 -4
- package/lib/Util/Terminal.d.ts.map +1 -1
- package/lib/Util/Terminal.js +3 -11
- package/lib/Util/Terminal.js.map +1 -1
- package/lib/Util/TraceParent.d.ts +32 -0
- package/lib/Util/TraceParent.d.ts.map +1 -0
- package/lib/Util/TraceParent.js +42 -0
- package/lib/Util/TraceParent.js.map +1 -0
- package/lib/Util/base64.d.ts +7 -0
- package/lib/Util/base64.d.ts.map +1 -0
- package/lib/Util/base64.js +24 -0
- package/lib/Util/base64.js.map +1 -0
- package/lib/Util/cached-function.d.ts +5 -0
- package/lib/Util/cached-function.d.ts.map +1 -1
- package/lib/Util/cached-function.js +13 -8
- package/lib/Util/cached-function.js.map +1 -1
- package/lib/Util/data.d.ts +1 -1
- package/lib/Util/data.d.ts.map +1 -1
- package/lib/Util/data.js +1 -1
- package/lib/Util/data.js.map +1 -1
- package/lib/Util/equal.d.ts.map +1 -1
- package/lib/Util/equal.js +3 -2
- package/lib/Util/equal.js.map +1 -1
- package/lib/Util/extraFiles.d.ts.map +1 -1
- package/lib/Util/extraFiles.js +5 -5
- package/lib/Util/extraFiles.js.map +1 -1
- package/lib/Util/interactive.js +1 -1
- package/lib/Website/AstroOutput.d.ts +42 -0
- package/lib/Website/AstroOutput.d.ts.map +1 -0
- package/lib/Website/AstroOutput.js +34 -0
- package/lib/Website/AstroOutput.js.map +1 -0
- package/lib/Website/FrontendCore.d.ts +1 -1
- package/lib/Workflows.d.ts +9 -0
- package/lib/Workflows.d.ts.map +1 -1
- package/lib/Workflows.js +8 -0
- package/lib/Workflows.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +21 -28
- package/src/AdoptPolicy.ts +76 -0
- package/src/Alchemist/AuthRegistry.ts +164 -0
- package/src/Alchemist/Drift.ts +103 -0
- package/src/Alchemist/Entrypoint.ts +51 -3
- package/src/Alchemist/Errors.ts +1 -1
- package/src/Alchemist/{routes/logs.ts → Logs.ts} +28 -30
- package/src/Alchemist/Nuke.ts +90 -0
- package/src/Alchemist/Operations.ts +309 -0
- package/src/Alchemist/{routes/profile.ts → Profile.ts} +22 -22
- package/src/Alchemist/{routes/provider.ts → Provider.ts} +7 -6
- package/src/Alchemist/Runtime.ts +46 -12
- package/src/Alchemist/{routes/state.ts → State.ts} +78 -21
- package/src/Alchemist/index.ts +32 -15
- package/src/Apply.ts +513 -274
- package/src/Auth/AuthProvider.ts +76 -23
- package/src/Auth/BrowserOAuth.ts +37 -60
- package/src/Auth/Credentials.ts +2 -4
- package/src/Auth/Demand.ts +27 -18
- package/src/Auth/Env.ts +13 -8
- package/src/Auth/Inspect.ts +5 -2
- package/src/Auth/Lock.ts +4 -8
- package/src/Auth/OAuthFlow.ts +12 -26
- package/src/Auth/Paths.ts +3 -2
- package/src/Auth/Profile.ts +30 -2
- package/src/Auth/Registry.ts +27 -0
- package/src/Auth/Resolve.ts +75 -3
- package/src/Auth/StoredAuthProvider.ts +1 -2
- package/src/Binding.ts +3 -4
- package/src/Bundle/Bundle.ts +58 -7
- package/src/Bundle/NamespaceImportPlugin.ts +259 -0
- package/src/Bundle/index.ts +1 -0
- package/src/Cli/Format.ts +2 -1
- package/src/Cli/GlobalLog.ts +206 -68
- package/src/Cli/LoggingCli.ts +33 -20
- package/src/Cli/PlainCliFormatter.ts +4 -1
- package/src/Cli/Present.ts +34 -0
- package/src/Cli/SigilRenderer.ts +75 -0
- package/src/Cli/checkVersion.ts +25 -78
- package/src/Cli/commands/confirm.ts +3 -3
- package/src/Cli/commands/deploy.ts +53 -44
- package/src/Cli/commands/dev.ts +65 -7
- package/src/Cli/commands/drift.ts +20 -16
- package/src/Cli/commands/errors.ts +2 -3
- package/src/Cli/commands/instrument.ts +39 -8
- package/src/Cli/commands/logs.ts +22 -30
- package/src/Cli/commands/nuke.ts +25 -26
- package/src/Cli/commands/profile/commands.ts +34 -34
- package/src/Cli/commands/profile/flows.ts +26 -20
- package/src/Cli/commands/profile/hub.ts +16 -18
- package/src/Cli/commands/provider.ts +4 -4
- package/src/Cli/commands/render.ts +43 -71
- package/src/Cli/commands/state.ts +113 -33
- package/src/Cli/components/capabilities.ts +20 -0
- package/src/Cli/components/types.ts +13 -99
- package/src/Cli/components/ui/Environment.tsx +5 -5
- package/src/Cli/components/ui/Interactive.tsx +24 -15
- package/src/Cli/components/ui/Layout.tsx +1 -1
- package/src/Cli/components/ui/Typography.tsx +1 -1
- package/src/Cli/components/ui/index.ts +2 -2
- package/src/Cli/components/view/ApprovePlan.tsx +2 -1
- package/src/Cli/components/view/Format.tsx +58 -0
- package/src/Cli/components/view/Help.tsx +14 -17
- package/src/Cli/components/view/Logo.tsx +1 -1
- package/src/Cli/components/view/Nuke.tsx +74 -49
- package/src/Cli/components/view/PlanDecision.tsx +1 -1
- package/src/Cli/components/view/PlanRow.tsx +1 -1
- package/src/Cli/components/view/PlanTree.ts +2 -2
- package/src/Cli/components/view/PlanView.tsx +2 -2
- package/src/Cli/components/view/Profile.tsx +2 -2
- package/src/Cli/components/view/ProfileDashboard.tsx +12 -11
- package/src/Cli/components/view/Prompts.tsx +37 -75
- package/src/Cli/components/view/Runtime.tsx +132 -238
- package/src/Cli/components/view/SigilCli.tsx +12 -12
- package/src/Cli/components/view/StateExplorer.tsx +2 -1
- package/src/Cli/components/view/statusStyle.ts +2 -2
- package/src/Cli/exec.ts +48 -41
- package/src/Cli/main.ts +52 -33
- package/src/Cli/selectCli.ts +3 -3
- package/src/Command/Command.ts +1 -1
- package/src/Command/Dev.ts +129 -36
- package/src/Command/Memo.ts +1 -1
- package/src/Contributions.ts +42 -8
- package/src/DNS/Adapter.ts +289 -0
- package/src/DNS/index.ts +1 -0
- package/src/Deploy.ts +11 -3
- package/src/Destroy.ts +19 -13
- package/src/Diff.ts +17 -4
- package/src/Drift.ts +256 -127
- package/src/EvalStack.ts +97 -0
- package/src/Events.ts +296 -0
- package/src/Interaction.ts +332 -97
- package/src/Local/LocalProvider.ts +40 -9
- package/src/Local/RpcProvider.ts +11 -1
- package/src/Local/RpcProviderProxy.ts +29 -21
- package/src/Local/RpcSerialization.ts +32 -17
- package/src/Local/RpcServer.ts +25 -17
- package/src/Local/RpcServerBun.ts +10 -6
- package/src/Local/RpcServerEnvironment.ts +2 -2
- package/src/Local/RpcServerNode.ts +8 -1
- package/src/Local/RpcServerSession.ts +2 -2
- package/src/Local/RpcSpawner.ts +61 -37
- package/src/Local/Sidecar.ts +10 -1
- package/src/Nuke.ts +66 -43
- package/src/Output.ts +120 -7
- package/src/Plan.ts +140 -52
- package/src/Platform.ts +47 -18
- package/src/Provider.ts +48 -3
- package/src/Report.ts +77 -275
- package/src/Runtime/ManagedHttpShutdown.ts +21 -4
- package/src/RuntimeContext.ts +1 -1
- package/src/Stack.ts +113 -135
- package/src/State/BucketState.ts +53 -21
- package/src/State/LocalState.ts +7 -9
- package/src/State/Provisioning.ts +8 -1
- package/src/State/ResourceState.ts +2 -0
- package/src/State/State.ts +30 -0
- package/src/State/StateEncoding.ts +22 -0
- package/src/State/index.ts +2 -2
- package/src/Telemetry/Layer.ts +3 -24
- package/src/Telemetry/Metrics.ts +1 -1
- package/src/TelemetryRelay.ts +1 -1
- package/src/TelemetryRuntime.ts +8 -8
- package/src/Util/ConsoleSink.ts +76 -13
- package/src/Util/LogAnnotation.ts +18 -0
- package/src/Util/LogRecord.ts +386 -0
- package/src/Util/Node.ts +20 -6
- package/src/Util/PlatformServices.ts +17 -4
- package/src/Util/ResourceOutput.ts +26 -25
- package/src/Util/Shutdown.ts +52 -0
- package/src/Util/Terminal.ts +3 -20
- package/src/Util/TraceParent.ts +70 -0
- package/src/Util/base64.ts +22 -0
- package/src/Util/cached-function.ts +30 -19
- package/src/Util/data.ts +2 -2
- package/src/Util/equal.ts +3 -2
- package/src/Util/extraFiles.ts +9 -8
- package/src/Util/interactive.ts +1 -1
- package/src/Website/AstroOutput.ts +83 -0
- package/src/Workflows.ts +11 -0
- package/src/index.ts +1 -0
- package/lib/Alchemist/Progress.d.ts +0 -16
- package/lib/Alchemist/Progress.d.ts.map +0 -1
- package/lib/Alchemist/Progress.js +0 -123
- package/lib/Alchemist/Progress.js.map +0 -1
- package/lib/Alchemist/Session.d.ts +0 -116
- package/lib/Alchemist/Session.d.ts.map +0 -1
- package/lib/Alchemist/Session.js +0 -212
- package/lib/Alchemist/Session.js.map +0 -1
- package/lib/Alchemist/routes/drift.d.ts +0 -55
- package/lib/Alchemist/routes/drift.d.ts.map +0 -1
- package/lib/Alchemist/routes/drift.js +0 -52
- package/lib/Alchemist/routes/drift.js.map +0 -1
- package/lib/Alchemist/routes/logs.d.ts +0 -41
- package/lib/Alchemist/routes/logs.d.ts.map +0 -1
- package/lib/Alchemist/routes/logs.js.map +0 -1
- package/lib/Alchemist/routes/nuke.d.ts +0 -46
- package/lib/Alchemist/routes/nuke.d.ts.map +0 -1
- package/lib/Alchemist/routes/nuke.js +0 -80
- package/lib/Alchemist/routes/nuke.js.map +0 -1
- package/lib/Alchemist/routes/profile.d.ts +0 -133
- package/lib/Alchemist/routes/profile.d.ts.map +0 -1
- package/lib/Alchemist/routes/profile.js.map +0 -1
- package/lib/Alchemist/routes/provider.d.ts.map +0 -1
- package/lib/Alchemist/routes/provider.js.map +0 -1
- package/lib/Alchemist/routes/stack.d.ts +0 -95
- package/lib/Alchemist/routes/stack.d.ts.map +0 -1
- package/lib/Alchemist/routes/stack.js +0 -73
- package/lib/Alchemist/routes/stack.js.map +0 -1
- package/lib/Alchemist/routes/state.d.ts.map +0 -1
- package/lib/Alchemist/routes/state.js.map +0 -1
- package/lib/Cli/CliKit/CliKit.d.ts +0 -92
- package/lib/Cli/CliKit/CliKit.d.ts.map +0 -1
- package/lib/Cli/CliKit/CliKit.js +0 -27
- package/lib/Cli/CliKit/CliKit.js.map +0 -1
- package/lib/Cli/CliKit/index.d.ts +0 -9
- package/lib/Cli/CliKit/index.d.ts.map +0 -1
- package/lib/Cli/CliKit/index.js +0 -9
- package/lib/Cli/CliKit/index.js.map +0 -1
- package/lib/Cli/CliKit/interaction.d.ts +0 -13
- package/lib/Cli/CliKit/interaction.d.ts.map +0 -1
- package/lib/Cli/CliKit/interaction.js +0 -17
- package/lib/Cli/CliKit/interaction.js.map +0 -1
- package/lib/Cli/CliKit/layer.d.ts +0 -7
- package/lib/Cli/CliKit/layer.d.ts.map +0 -1
- package/lib/Cli/CliKit/layer.js +0 -33
- package/lib/Cli/CliKit/layer.js.map +0 -1
- package/lib/Local/DevLog.d.ts +0 -32
- package/lib/Local/DevLog.d.ts.map +0 -1
- package/lib/Local/DevLog.js +0 -112
- package/lib/Local/DevLog.js.map +0 -1
- package/lib/Test/Alchemy.d.ts +0 -79
- package/lib/Test/Alchemy.d.ts.map +0 -1
- package/lib/Test/Alchemy.js +0 -193
- package/lib/Test/Alchemy.js.map +0 -1
- package/lib/Test/Bun.d.ts +0 -69
- package/lib/Test/Bun.d.ts.map +0 -1
- package/lib/Test/Bun.js +0 -126
- package/lib/Test/Bun.js.map +0 -1
- package/lib/Test/Core.d.ts +0 -277
- package/lib/Test/Core.d.ts.map +0 -1
- package/lib/Test/Core.js +0 -362
- package/lib/Test/Core.js.map +0 -1
- package/lib/Test/Http.d.ts +0 -109
- package/lib/Test/Http.d.ts.map +0 -1
- package/lib/Test/Http.js +0 -123
- package/lib/Test/Http.js.map +0 -1
- package/lib/Test/TestState.d.ts +0 -12
- package/lib/Test/TestState.d.ts.map +0 -1
- package/lib/Test/TestState.js +0 -15
- package/lib/Test/TestState.js.map +0 -1
- package/lib/Test/Vitest.d.ts +0 -60
- package/lib/Test/Vitest.d.ts.map +0 -1
- package/lib/Test/Vitest.js +0 -132
- package/lib/Test/Vitest.js.map +0 -1
- package/lib/Test/index.d.ts +0 -3
- package/lib/Test/index.d.ts.map +0 -1
- package/lib/Test/index.js +0 -3
- package/lib/Test/index.js.map +0 -1
- package/lib/Util/FileLogger.d.ts +0 -7
- package/lib/Util/FileLogger.d.ts.map +0 -1
- package/lib/Util/FileLogger.js +0 -16
- package/lib/Util/FileLogger.js.map +0 -1
- package/src/Alchemist/Progress.ts +0 -167
- package/src/Alchemist/Session.ts +0 -415
- package/src/Alchemist/routes/drift.ts +0 -87
- package/src/Alchemist/routes/nuke.ts +0 -131
- package/src/Alchemist/routes/stack.ts +0 -173
- package/src/Cli/CliKit/CliKit.ts +0 -159
- package/src/Cli/CliKit/index.ts +0 -41
- package/src/Cli/CliKit/interaction.ts +0 -19
- package/src/Cli/CliKit/layer.ts +0 -44
- package/src/Local/DevLog.ts +0 -122
- package/src/Test/Alchemy.ts +0 -334
- package/src/Test/Bun.ts +0 -230
- package/src/Test/Core.ts +0 -785
- package/src/Test/Http.ts +0 -201
- package/src/Test/TestState.ts +0 -35
- package/src/Test/Vitest.ts +0 -239
- package/src/Test/index.ts +0 -2
- package/src/Util/FileLogger.ts +0 -20
package/src/Auth/AuthProvider.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Config from "effect/Config";
|
|
2
|
+
import * as ConfigProvider from "effect/ConfigProvider";
|
|
2
3
|
import * as Context from "effect/Context";
|
|
3
4
|
import * as Effect from "effect/Effect";
|
|
4
5
|
import * as FileSystem from "effect/FileSystem";
|
|
@@ -10,7 +11,9 @@ import * as Semaphore from "effect/Semaphore";
|
|
|
10
11
|
import { Interaction } from "../Interaction.ts";
|
|
11
12
|
import { UserFacingError } from "../UserFacingError.ts";
|
|
12
13
|
import { cachedFunction } from "../Util/cached-function.ts";
|
|
14
|
+
import { globalLogs } from "../Util/LogRecord.ts";
|
|
13
15
|
import { withProfileCredentialsLock } from "./Lock.ts";
|
|
16
|
+
import { AuthProviders } from "./Registry.ts";
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* Canonical web host for OAuth provider-agnostic landing pages
|
|
@@ -75,12 +78,7 @@ export const refreshHint = (provider: string, profileName: string): string =>
|
|
|
75
78
|
export const reconfigureHint = (provider: string, profileName: string): string =>
|
|
76
79
|
`Run \`alchemy profile edit --profile ${profileName} --reconfigure ${provider}\` to reconfigure.`;
|
|
77
80
|
|
|
78
|
-
export
|
|
79
|
-
AuthProviders,
|
|
80
|
-
{
|
|
81
|
-
[providerName: string]: AuthProvider;
|
|
82
|
-
}
|
|
83
|
-
>()("AuthProviders") {}
|
|
81
|
+
export { AuthProviders, AuthProvidersLive } from "./Registry.ts";
|
|
84
82
|
|
|
85
83
|
/**
|
|
86
84
|
* Declares one environment variable a provider's {@link AuthProviderImpl.readEnvironment}
|
|
@@ -246,10 +244,19 @@ export interface AuthProviderImpl<
|
|
|
246
244
|
*/
|
|
247
245
|
readonly configureMethods?: ReadonlyArray<ConfigureMethod>;
|
|
248
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Re-authenticate, silently refreshing when the stored credentials allow.
|
|
249
|
+
* Returns the new config for the caller to save, or nothing when the
|
|
250
|
+
* provider already saved it through `updateConfig` (a silent refresh saves
|
|
251
|
+
* under the credentials lock, so the caller must not write it again).
|
|
252
|
+
* `reload` reads the stored config; run it under the lock before
|
|
253
|
+
* refreshing, since refresh tokens can be single-use.
|
|
254
|
+
*/
|
|
249
255
|
login(
|
|
250
256
|
profileName: string,
|
|
251
257
|
config: Config,
|
|
252
258
|
updateConfig?: (config: Config) => Effect.Effect<void, AuthError>,
|
|
259
|
+
reload?: Effect.Effect<Config, AuthError>,
|
|
253
260
|
): Effect.Effect<Config | void, AuthError, R | Interaction>;
|
|
254
261
|
|
|
255
262
|
logout(profileName: string, config: Config): Effect.Effect<void, AuthError, R | Interaction>;
|
|
@@ -297,9 +304,29 @@ export interface AuthProviderImpl<
|
|
|
297
304
|
export interface AuthProvider<
|
|
298
305
|
Config extends { method: string } = { method: string },
|
|
299
306
|
Credentials = unknown,
|
|
300
|
-
> extends AuthProviderImpl<Config, Credentials> {
|
|
307
|
+
> extends Omit<AuthProviderImpl<Config, Credentials>, "read" | "details"> {
|
|
301
308
|
readonly kind: "AuthProvider";
|
|
302
309
|
readonly name: string;
|
|
310
|
+
/**
|
|
311
|
+
* {@link AuthProviderImpl.read} under the profile's credentials lock, with
|
|
312
|
+
* `loadConfig` run inside the lock. A silent refresh spends a single-use
|
|
313
|
+
* refresh token, so config loaded before the lock can hold a token that
|
|
314
|
+
* another process, or an earlier resolve in this one, already rotated.
|
|
315
|
+
*/
|
|
316
|
+
read<E>(
|
|
317
|
+
profileName: string,
|
|
318
|
+
loadConfig: Effect.Effect<Config, E>,
|
|
319
|
+
updateConfig?: (config: Config) => Effect.Effect<void, AuthError>,
|
|
320
|
+
): Effect.Effect<Credentials, E | AuthError | NeedsReauth>;
|
|
321
|
+
/**
|
|
322
|
+
* {@link AuthProviderImpl.details} under the profile's credentials lock,
|
|
323
|
+
* with `loadConfig` run inside the lock, since details may refresh.
|
|
324
|
+
*/
|
|
325
|
+
details<E>(
|
|
326
|
+
profileName: string,
|
|
327
|
+
loadConfig: Effect.Effect<Config, E>,
|
|
328
|
+
updateConfig?: (config: Config) => Effect.Effect<void, AuthError>,
|
|
329
|
+
): Effect.Effect<ProviderDetails, E | AuthError | NeedsReauth, Interaction>;
|
|
303
330
|
/** Log each environment contract once per built provider layer. */
|
|
304
331
|
readonly logEnvironmentCredentials: (used: ReadonlyArray<string>) => Effect.Effect<void>;
|
|
305
332
|
/**
|
|
@@ -325,7 +352,7 @@ export const AuthProvider =
|
|
|
325
352
|
) =>
|
|
326
353
|
Effect.gen(function* () {
|
|
327
354
|
// FileSystem/Path back the cross-process credentials lock that wraps
|
|
328
|
-
// `logout`/`read` below, so capture them with the impl's own services.
|
|
355
|
+
// `logout`/`read`/`details` below, so capture them with the impl's own services.
|
|
329
356
|
//
|
|
330
357
|
// `Effect.context()` snapshots the ENTIRE fiber context (the type
|
|
331
358
|
// parameter only narrows the type), and `Effect.provideContext` makes
|
|
@@ -344,6 +371,14 @@ export const AuthProvider =
|
|
|
344
371
|
const ctx = Context.omit(Interaction)(
|
|
345
372
|
yield* Effect.context<FileSystem.FileSystem | Path.Path | R | ImplReq>(),
|
|
346
373
|
) as Context.Context<FileSystem.FileSystem | Path.Path | R | ImplReq>;
|
|
374
|
+
// `read` and `readEnvironment` resolve credentials for a caller that
|
|
375
|
+
// has already chosen its ConfigProvider (`resolveProviderConfig`
|
|
376
|
+
// checks `presentEnvironment` under it), so they read through that
|
|
377
|
+
// one, not the one ambient at REGISTRATION. The profile-command
|
|
378
|
+
// methods keep the snapshot: they run under the process environment,
|
|
379
|
+
// and `--env-file` reaches them only through it.
|
|
380
|
+
// SAFETY: as above, the assertion only restores the pre-omit type.
|
|
381
|
+
const resolveCtx = Context.omit(ConfigProvider.ConfigProvider)(ctx) as typeof ctx;
|
|
347
382
|
const providers = yield* AuthProviders;
|
|
348
383
|
const service = yield* Effect.isEffect(impl) ? impl : Effect.succeed(impl);
|
|
349
384
|
// Validate the declared environment contract at registration so a
|
|
@@ -352,7 +387,7 @@ export const AuthProvider =
|
|
|
352
387
|
const environment =
|
|
353
388
|
service.environment === undefined
|
|
354
389
|
? []
|
|
355
|
-
: yield* Schema.
|
|
390
|
+
: yield* Schema.decodeEffect(EnvironmentVariables)(service.environment).pipe(
|
|
356
391
|
Effect.orDie,
|
|
357
392
|
);
|
|
358
393
|
if (service.readEnvironment !== undefined && environment.length === 0) {
|
|
@@ -373,12 +408,12 @@ export const AuthProvider =
|
|
|
373
408
|
);
|
|
374
409
|
}
|
|
375
410
|
|
|
411
|
+
// Auth and credentials are account-level: every method's logs go to
|
|
412
|
+
// the global run log, not the project's.
|
|
376
413
|
const provider: AuthProvider<Config, Credentials> = {
|
|
377
414
|
logEnvironmentCredentials: yield* cachedFunction(
|
|
378
415
|
(used: ReadonlyArray<string>) =>
|
|
379
|
-
Effect.logInfo(
|
|
380
|
-
`${name}: using environment variables (${used.join(", ")}) instead of the profile.`,
|
|
381
|
-
),
|
|
416
|
+
Effect.logInfo(`${name}: using environment variables (${used.join(", ")}).`),
|
|
382
417
|
{ key: ([used]) => JSON.stringify(used.toSorted()) },
|
|
383
418
|
),
|
|
384
419
|
kind: "AuthProvider",
|
|
@@ -395,21 +430,32 @@ export const AuthProvider =
|
|
|
395
430
|
Semaphore.withPermits(
|
|
396
431
|
interactiveMutex,
|
|
397
432
|
1,
|
|
398
|
-
)(
|
|
399
|
-
|
|
433
|
+
)(
|
|
434
|
+
service
|
|
435
|
+
.configure(profileName, currentConfig)
|
|
436
|
+
.pipe(Effect.provideContext(ctx), globalLogs),
|
|
437
|
+
),
|
|
438
|
+
login: (profileName, config, updateConfig, reload) =>
|
|
400
439
|
Semaphore.withPermits(
|
|
401
440
|
interactiveMutex,
|
|
402
441
|
1,
|
|
403
|
-
)(
|
|
442
|
+
)(
|
|
443
|
+
service
|
|
444
|
+
.login(profileName, config, updateConfig, reload)
|
|
445
|
+
.pipe(Effect.provideContext(ctx), globalLogs),
|
|
446
|
+
),
|
|
404
447
|
logout: (profileName, config) =>
|
|
405
448
|
withProfileCredentialsLock(profileName, service.logout(profileName, config)).pipe(
|
|
406
449
|
Effect.provideContext(ctx),
|
|
450
|
+
globalLogs,
|
|
407
451
|
),
|
|
408
|
-
details: (profileName,
|
|
452
|
+
details: (profileName, loadConfig, updateConfig) =>
|
|
409
453
|
withProfileCredentialsLock(
|
|
410
454
|
profileName,
|
|
411
|
-
|
|
412
|
-
|
|
455
|
+
Effect.flatMap(loadConfig, (config) =>
|
|
456
|
+
service.details(profileName, config, updateConfig),
|
|
457
|
+
),
|
|
458
|
+
).pipe(Effect.provideContext(ctx), globalLogs),
|
|
413
459
|
...(service.configureWith === undefined
|
|
414
460
|
? {}
|
|
415
461
|
: {
|
|
@@ -419,15 +465,22 @@ export const AuthProvider =
|
|
|
419
465
|
readonly method: string;
|
|
420
466
|
readonly values: Record<string, string>;
|
|
421
467
|
},
|
|
422
|
-
) =>
|
|
468
|
+
) =>
|
|
469
|
+
service.configureWith!(profileName, input).pipe(
|
|
470
|
+
Effect.provideContext(ctx),
|
|
471
|
+
globalLogs,
|
|
472
|
+
),
|
|
423
473
|
configureMethods: service.configureMethods,
|
|
424
474
|
}),
|
|
425
|
-
read: (profileName,
|
|
475
|
+
read: (profileName, loadConfig, updateConfig) =>
|
|
426
476
|
withProfileCredentialsLock(
|
|
427
477
|
profileName,
|
|
428
|
-
service.read(profileName, config, updateConfig),
|
|
429
|
-
).pipe(Effect.provideContext(
|
|
430
|
-
readEnvironment: service.readEnvironment?.pipe(
|
|
478
|
+
Effect.flatMap(loadConfig, (config) => service.read(profileName, config, updateConfig)),
|
|
479
|
+
).pipe(Effect.provideContext(resolveCtx), globalLogs),
|
|
480
|
+
readEnvironment: service.readEnvironment?.pipe(
|
|
481
|
+
Effect.provideContext(resolveCtx),
|
|
482
|
+
globalLogs,
|
|
483
|
+
),
|
|
431
484
|
environment,
|
|
432
485
|
configSchema: service.configSchema,
|
|
433
486
|
decodeConfig: (profileName, config) =>
|
package/src/Auth/BrowserOAuth.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared browser-OAuth ceremony for auth providers:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* manual code entry, `o` opens the browser again, and `c` copies the URL).
|
|
2
|
+
* Shared browser-OAuth ceremony for auth providers: an
|
|
3
|
+
* {@link Interaction.browserLogin} that waits for the provider's local
|
|
4
|
+
* callback listener, with manual code entry as the fallback.
|
|
6
5
|
*
|
|
7
6
|
* {@link deviceOAuth} is the device-code (RFC 8628) counterpart.
|
|
8
7
|
*
|
|
@@ -11,7 +10,6 @@
|
|
|
11
10
|
* login UX stays uniform.
|
|
12
11
|
*/
|
|
13
12
|
import * as Effect from "effect/Effect";
|
|
14
|
-
import type { ChildProcessSpawner } from "effect/process/ChildProcessSpawner";
|
|
15
13
|
import * as Interaction from "../Interaction.ts";
|
|
16
14
|
import { CallbackServerStartError, type DeviceAuthorization } from "./OAuthFlow.ts";
|
|
17
15
|
|
|
@@ -31,40 +29,33 @@ export interface BrowserOAuthOptions<A, E1, R1, E2, R2> {
|
|
|
31
29
|
export const browserOAuth = Effect.fn(function* <A, E1, R1, E2, R2>(
|
|
32
30
|
options: BrowserOAuthOptions<A, E1, R1, E2, R2>,
|
|
33
31
|
) {
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
openFailed,
|
|
62
|
-
onOpen: () => runPromise(Interaction.openUrl(options.url)),
|
|
63
|
-
inputLabel: "Paste the authorization code or callback URL",
|
|
64
|
-
validate: (value) => (value.trim().length > 0 ? undefined : "Paste a code or URL"),
|
|
65
|
-
})
|
|
66
|
-
.pipe(Effect.flatMap(options.exchange)),
|
|
67
|
-
);
|
|
32
|
+
// A callback server that cannot start (e.g. the port is taken) must not
|
|
33
|
+
// fail the race when the user can paste the code instead — warn and hang
|
|
34
|
+
// so manual entry stays available. Without terminal input there is no
|
|
35
|
+
// manual entry, so the startup error fails the login. Genuine OAuth
|
|
36
|
+
// failures delivered via the callback always fail fast.
|
|
37
|
+
const { input } = (yield* Interaction.Interaction).terminal;
|
|
38
|
+
return yield* Interaction.browserLogin({
|
|
39
|
+
provider: options.provider,
|
|
40
|
+
url: options.url,
|
|
41
|
+
waitingLabel: options.waitingLabel,
|
|
42
|
+
waitFor: input
|
|
43
|
+
? options.callback.pipe(
|
|
44
|
+
Effect.catchIf(
|
|
45
|
+
(e): e is E1 & CallbackServerStartError => e instanceof CallbackServerStartError,
|
|
46
|
+
(e) =>
|
|
47
|
+
Interaction.warning(`${e.message} — paste the authorization code instead.`).pipe(
|
|
48
|
+
Effect.andThen(Effect.never),
|
|
49
|
+
),
|
|
50
|
+
),
|
|
51
|
+
)
|
|
52
|
+
: options.callback,
|
|
53
|
+
manualCode: {
|
|
54
|
+
label: "Paste the authorization code or callback URL",
|
|
55
|
+
validate: (value) => (value.trim().length > 0 ? undefined : "Paste a code or URL"),
|
|
56
|
+
exchange: options.exchange,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
68
59
|
});
|
|
69
60
|
|
|
70
61
|
export interface DeviceOAuthOptions<A, E, R> {
|
|
@@ -81,24 +72,10 @@ export interface DeviceOAuthOptions<A, E, R> {
|
|
|
81
72
|
* URL, show the user code, and wait for the token poll. The prompt only
|
|
82
73
|
* renders the URL/code and re-opens the browser; the poll always wins.
|
|
83
74
|
*/
|
|
84
|
-
export const deviceOAuth =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
options.token,
|
|
92
|
-
Interaction.accessors.prompt
|
|
93
|
-
.awaitExternal({
|
|
94
|
-
message: `${options.provider} authorization`,
|
|
95
|
-
waitingLabel: "waiting for browser authorization (up to 5 minutes)…",
|
|
96
|
-
url,
|
|
97
|
-
code: options.authorization.userCode,
|
|
98
|
-
openFailed,
|
|
99
|
-
onOpen: () => runPromise(Interaction.openUrl(url)),
|
|
100
|
-
allowManualInput: false,
|
|
101
|
-
})
|
|
102
|
-
.pipe(Effect.andThen(Effect.never)),
|
|
103
|
-
);
|
|
104
|
-
});
|
|
75
|
+
export const deviceOAuth = <A, E, R>(options: DeviceOAuthOptions<A, E, R>) =>
|
|
76
|
+
Interaction.browserLogin({
|
|
77
|
+
provider: options.provider,
|
|
78
|
+
url: options.authorization.verificationUriComplete,
|
|
79
|
+
code: options.authorization.userCode,
|
|
80
|
+
waitFor: options.token,
|
|
81
|
+
});
|
package/src/Auth/Credentials.ts
CHANGED
|
@@ -66,7 +66,7 @@ export const CredentialsStoreLive = Layer.effect(
|
|
|
66
66
|
Effect.gen(function* () {
|
|
67
67
|
const filePath = yield* validateCredentialPath(profile, provider);
|
|
68
68
|
const data = yield* fs.readFileString(filePath).pipe(
|
|
69
|
-
Effect.catchReason("PlatformError", "NotFound", () => Effect.
|
|
69
|
+
Effect.catchReason("PlatformError", "NotFound", () => Effect.undefined),
|
|
70
70
|
Effect.mapError((cause) =>
|
|
71
71
|
AuthError.make({
|
|
72
72
|
message: `Could not read credentials at '${filePath}'.`,
|
|
@@ -75,9 +75,7 @@ export const CredentialsStoreLive = Layer.effect(
|
|
|
75
75
|
),
|
|
76
76
|
);
|
|
77
77
|
if (data === undefined) return undefined;
|
|
78
|
-
const json = yield* Schema.
|
|
79
|
-
data,
|
|
80
|
-
).pipe(
|
|
78
|
+
const json = yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Unknown))(data).pipe(
|
|
81
79
|
Effect.mapError((cause) =>
|
|
82
80
|
AuthError.make({
|
|
83
81
|
message: `Stored credentials at '${filePath}' contain invalid JSON.`,
|
package/src/Auth/Demand.ts
CHANGED
|
@@ -96,27 +96,36 @@ export class CredentialsRequired extends Data.TaggedError("CredentialsRequired")
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Live providers resolve credentials lazily, on their first cloud call
|
|
100
|
-
*
|
|
101
|
-
* {@link CredentialsUnavailable}
|
|
99
|
+
* Live providers resolve credentials lazily, on their first cloud call. A
|
|
100
|
+
* failed resolution fails (or, for alchemy services typed as never failing,
|
|
101
|
+
* dies) with {@link CredentialsUnavailable}. Applied around every provider
|
|
102
102
|
* lifecycle call, this fails the operation with {@link CredentialsRequired}
|
|
103
|
-
* naming the resource instead
|
|
103
|
+
* naming the resource instead.
|
|
104
104
|
*/
|
|
105
|
-
export const failCredentialsRequired =
|
|
106
|
-
(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
105
|
+
export const failCredentialsRequired = (fqn: string) =>
|
|
106
|
+
Effect.fn(function* <A, E, R>(self: Effect.Effect<A, E, R>) {
|
|
107
|
+
const isUnavailable = Schema.is(CredentialsUnavailable);
|
|
108
|
+
// Annotated: the catch handler returns this or a re-fail of E, and a
|
|
109
|
+
// union of Effects does not unify on its own.
|
|
110
|
+
const required = (
|
|
111
|
+
unavailable: CredentialsUnavailable,
|
|
112
|
+
): Effect.Effect<never, E | CredentialsRequired> =>
|
|
113
|
+
Effect.fail(
|
|
114
|
+
new CredentialsRequired({
|
|
115
|
+
provider: unavailable.provider,
|
|
116
|
+
resources: [fqn],
|
|
117
|
+
reason: "runs against the real cloud",
|
|
118
|
+
message: unavailable.message,
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
121
|
+
return yield* self.pipe(
|
|
122
|
+
// oxlint-disable-next-line effecttsgo/catch-conditional-refail-to-catch-if -- catchIf cannot narrow a generic E
|
|
123
|
+
Effect.catch((error) => (isUnavailable(error) ? required(error) : Effect.fail(error))),
|
|
124
|
+
Effect.catchDefect((defect) =>
|
|
125
|
+
isUnavailable(defect) ? required(defect) : Effect.die(defect),
|
|
126
|
+
),
|
|
119
127
|
);
|
|
128
|
+
});
|
|
120
129
|
|
|
121
130
|
const describeReason = (reason: CredentialDemandReason): string => {
|
|
122
131
|
switch (reason) {
|
package/src/Auth/Env.ts
CHANGED
|
@@ -36,14 +36,19 @@ export const getEnvRedactedRequired = (key: string) =>
|
|
|
36
36
|
Effect.mapError((cause) => AuthError.make({ message: `Missing required env: ${key}`, cause })),
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
) =>
|
|
39
|
+
/** Turn a cancelled or unavailable prompt into an `AuthError`; other errors pass through. */
|
|
40
|
+
export const mapPromptCancellation = <A, E, R>(self: Effect.Effect<A, E, R>) =>
|
|
42
41
|
self.pipe(
|
|
43
|
-
Effect.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
cause,
|
|
47
|
-
|
|
42
|
+
Effect.catchIf(
|
|
43
|
+
(cause): cause is Extract<E, Interaction.InteractionError> =>
|
|
44
|
+
cause instanceof Interaction.TerminalCancelled ||
|
|
45
|
+
cause instanceof Interaction.NonInteractiveTerminal,
|
|
46
|
+
(cause) =>
|
|
47
|
+
Effect.fail(
|
|
48
|
+
AuthError.make({
|
|
49
|
+
message: cause._tag === "TerminalCancelled" ? "User cancelled prompt" : cause.message,
|
|
50
|
+
cause,
|
|
51
|
+
}),
|
|
52
|
+
),
|
|
48
53
|
),
|
|
49
54
|
);
|
package/src/Auth/Inspect.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type AuthProviders,
|
|
8
8
|
type ProviderDetailLine,
|
|
9
9
|
} from "./AuthProvider.ts";
|
|
10
|
-
import type
|
|
10
|
+
import { ProfileStore, reloadProviderConfig, type ProviderConfig } from "./Profile.ts";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* What a connected provider looks like right now. Establishing this means
|
|
@@ -93,7 +93,10 @@ export const inspectProvider = Effect.fn("inspectProvider")(function* (
|
|
|
93
93
|
return broken(name, method, "error", "provider.invalid-config", decoded.failure.message);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const
|
|
96
|
+
const store = yield* ProfileStore;
|
|
97
|
+
const details = yield* Effect.result(
|
|
98
|
+
provider.details(profile, reloadProviderConfig(store, provider, profile), updateConfig),
|
|
99
|
+
);
|
|
97
100
|
if (Result.isSuccess(details)) {
|
|
98
101
|
return {
|
|
99
102
|
name,
|
package/src/Auth/Lock.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as Clock from "effect/Clock";
|
|
2
|
-
import * as Console from "effect/Console";
|
|
3
2
|
import * as Data from "effect/Data";
|
|
4
3
|
import * as Duration from "effect/Duration";
|
|
5
4
|
import * as Effect from "effect/Effect";
|
|
@@ -133,12 +132,9 @@ type Phase = { current: "waiting" | "held" };
|
|
|
133
132
|
/**
|
|
134
133
|
* Periodic "I am not dead, I am stuck here" notice, forked for the lifetime
|
|
135
134
|
* of a {@link withLock} call.
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* `Telemetry/Layer.ts`), so log records reach `.alchemy/log/out` but never
|
|
140
|
-
* the terminal. The whole point of this notice is to reach the user who is
|
|
141
|
-
* watching a frozen terminal, so it must not go through the logger.
|
|
135
|
+
* Logged as a warning: the console logger shows it above the noise floor
|
|
136
|
+
* (telemetry merges with it rather than replacing it), and JSON output and
|
|
137
|
+
* the run log carry it too.
|
|
142
138
|
*/
|
|
143
139
|
const stallNotice = (lockPath: string, label: string, phase: Phase, interval: Duration.Input) =>
|
|
144
140
|
Effect.gen(function* () {
|
|
@@ -148,7 +144,7 @@ const stallNotice = (lockPath: string, label: string, phase: Phase, interval: Du
|
|
|
148
144
|
// notice cadence and the reported wait must not drift apart.
|
|
149
145
|
const now = yield* Clock.currentTimeMillis;
|
|
150
146
|
const seconds = Math.round((now - start) / 1000);
|
|
151
|
-
yield*
|
|
147
|
+
yield* Effect.logWarning(
|
|
152
148
|
phase.current === "waiting"
|
|
153
149
|
? `alchemy: ${seconds}s waiting for the auth lock '${lockPath}' (${label}). ` +
|
|
154
150
|
`Another alchemy process holds it; if none is running, delete that directory.`
|
package/src/Auth/OAuthFlow.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import http from "node:http";
|
|
2
2
|
import * as Clock from "effect/Clock";
|
|
3
|
-
import * as
|
|
3
|
+
import * as Digest from "effect/crypto/Digest";
|
|
4
|
+
import * as SecureRandom from "effect/crypto/SecureRandom";
|
|
4
5
|
import * as Data from "effect/Data";
|
|
5
6
|
import * as Duration from "effect/Duration";
|
|
6
7
|
import * as Effect from "effect/Effect";
|
|
@@ -36,7 +37,7 @@ export class OAuthNetworkError extends Data.TaggedError("OAuthNetworkError")<{
|
|
|
36
37
|
cause: unknown;
|
|
37
38
|
}> {
|
|
38
39
|
override get message(): string {
|
|
39
|
-
return `Request to ${this.endpoint} failed: ${this.cause}`;
|
|
40
|
+
return `Request to ${this.endpoint} failed: ${this.cause instanceof Error ? this.cause.message : String(this.cause)}`;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -71,16 +72,6 @@ export type OAuthRequestError =
|
|
|
71
72
|
| OAuthServerUnavailable
|
|
72
73
|
| OAuthInvalidResponse;
|
|
73
74
|
|
|
74
|
-
/** Secure random generation or hashing for state/PKCE failed. */
|
|
75
|
-
export class OAuthCryptoError extends Data.TaggedError("OAuthCryptoError")<{
|
|
76
|
-
operation: string;
|
|
77
|
-
cause: unknown;
|
|
78
|
-
}> {
|
|
79
|
-
override get message(): string {
|
|
80
|
-
return `${this.operation} failed: ${this.cause}`;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
75
|
/** The client spec lacks the endpoints/URIs a flow needs. */
|
|
85
76
|
export class UnsupportedOAuthFlowError extends Data.TaggedError("UnsupportedOAuthFlowError")<{
|
|
86
77
|
flow: "browser" | "device";
|
|
@@ -245,7 +236,11 @@ export interface OAuthClient {
|
|
|
245
236
|
*/
|
|
246
237
|
readonly authorize: (
|
|
247
238
|
scopes?: ReadonlyArray<string>,
|
|
248
|
-
) => Effect.Effect<
|
|
239
|
+
) => Effect.Effect<
|
|
240
|
+
Authorization,
|
|
241
|
+
UnsupportedOAuthFlowError,
|
|
242
|
+
SecureRandom.SecureRandom | Digest.Digest
|
|
243
|
+
>;
|
|
249
244
|
/**
|
|
250
245
|
* Exchange an authorization code directly. `authorization` supplies the
|
|
251
246
|
* PKCE verifier; omit for non-PKCE clients (tests, relay-less flows).
|
|
@@ -312,23 +307,14 @@ export interface OAuthClient {
|
|
|
312
307
|
}
|
|
313
308
|
|
|
314
309
|
const randomText = Effect.fn(function* (length: number) {
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
.randomBytes(length)
|
|
318
|
-
.pipe(
|
|
319
|
-
Effect.mapError(
|
|
320
|
-
(cause) => new OAuthCryptoError({ operation: "Secure random generation", cause }),
|
|
321
|
-
),
|
|
322
|
-
);
|
|
323
|
-
return Base64Url.encode(bytes);
|
|
310
|
+
const random = yield* SecureRandom.SecureRandom;
|
|
311
|
+
return Base64Url.encode(yield* random.randomBytes(length));
|
|
324
312
|
});
|
|
325
313
|
|
|
326
314
|
const generatePKCE = Effect.fn(function* (length = 96) {
|
|
327
|
-
const
|
|
315
|
+
const digest = yield* Digest.Digest;
|
|
328
316
|
const verifier = yield* randomText(length);
|
|
329
|
-
const challenge = yield*
|
|
330
|
-
.digest("SHA-256", new TextEncoder().encode(verifier))
|
|
331
|
-
.pipe(Effect.mapError((cause) => new OAuthCryptoError({ operation: "PKCE digest", cause })));
|
|
317
|
+
const challenge = yield* digest.digest(Digest.sha256, new TextEncoder().encode(verifier));
|
|
332
318
|
return { verifier, challenge: Base64Url.encode(challenge) };
|
|
333
319
|
});
|
|
334
320
|
|
package/src/Auth/Paths.ts
CHANGED
|
@@ -6,9 +6,10 @@ import path from "pathe";
|
|
|
6
6
|
* `ALCHEMY_HOME`, which relocates profiles, credential files,
|
|
7
7
|
* and cross-process locks together — used by tests to isolate a temp home
|
|
8
8
|
* and available to users who keep dotfiles elsewhere. Resolved lazily so an
|
|
9
|
-
* override set after module load (e.g. in a test) still takes effect.
|
|
9
|
+
* override set after module load (e.g. in a test) still takes effect. An
|
|
10
|
+
* empty `ALCHEMY_HOME` counts as unset, never as the current directory.
|
|
10
11
|
*/
|
|
11
|
-
export const rootDir = () => process.env.ALCHEMY_HOME
|
|
12
|
+
export const rootDir = () => process.env.ALCHEMY_HOME || path.join(os.homedir(), ".alchemy");
|
|
12
13
|
|
|
13
14
|
export const configFilePath = () => path.join(rootDir(), "profiles.json");
|
|
14
15
|
|
package/src/Auth/Profile.ts
CHANGED
|
@@ -321,8 +321,7 @@ export const ProfileStoreLive = Layer.effect(
|
|
|
321
321
|
return V0.mergeSidecar(provider, values, decoded.success);
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
|
|
325
|
-
const migrateCentralManifest = provideLockServices(
|
|
324
|
+
const migrateCentralManifestLocked = provideLockServices(
|
|
326
325
|
withLock(
|
|
327
326
|
"profiles-migrate",
|
|
328
327
|
Effect.gen(function* () {
|
|
@@ -418,6 +417,12 @@ export const ProfileStoreLive = Layer.effect(
|
|
|
418
417
|
),
|
|
419
418
|
);
|
|
420
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Expand the released v0 store and preserve every original file. Checked
|
|
422
|
+
* once per process, on the first profile read, rather than on every read.
|
|
423
|
+
*/
|
|
424
|
+
const migrateCentralManifest = yield* Effect.cached(migrateCentralManifestLocked);
|
|
425
|
+
|
|
421
426
|
const readProviderFile = (profile: string, file: string) =>
|
|
422
427
|
Effect.gen(function* () {
|
|
423
428
|
const fullPath = pathService.join(profileDirPath(profile), file);
|
|
@@ -667,6 +672,29 @@ export const ProfileStoreLive = Layer.effect(
|
|
|
667
672
|
}),
|
|
668
673
|
);
|
|
669
674
|
|
|
675
|
+
/**
|
|
676
|
+
* Re-read a provider's stored configuration, failing only with
|
|
677
|
+
* {@link AuthError}. Silent refreshes rotate single-use refresh tokens, so
|
|
678
|
+
* {@link AuthProvider.read}/{@link AuthProvider.details} take this effect and
|
|
679
|
+
* run it under the profile's credentials lock instead of a config read before
|
|
680
|
+
* it.
|
|
681
|
+
*/
|
|
682
|
+
export const reloadProviderConfig = <Config extends { method: string }>(
|
|
683
|
+
store: ProfileStoreService,
|
|
684
|
+
auth: AuthProvider<Config>,
|
|
685
|
+
profileName: string,
|
|
686
|
+
): Effect.Effect<Config, AuthError> =>
|
|
687
|
+
store.loadProviderConfig(auth, profileName).pipe(
|
|
688
|
+
Effect.mapError((cause) =>
|
|
689
|
+
cause._tag === "AuthError"
|
|
690
|
+
? cause
|
|
691
|
+
: AuthError.make({
|
|
692
|
+
message: `Could not reload ${auth.name} configuration for profile '${profileName}'.`,
|
|
693
|
+
cause,
|
|
694
|
+
}),
|
|
695
|
+
),
|
|
696
|
+
);
|
|
697
|
+
|
|
670
698
|
/** The name of the currently selected profile. */
|
|
671
699
|
export const currentProfileName: Effect.Effect<string, ProfileError | PlatformError, ProfileStore> =
|
|
672
700
|
ProfileStore.use((store) => store.current).pipe(Effect.map((selection) => selection.name));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Option from "effect/Option";
|
|
5
|
+
import type { AuthProvider } from "./AuthProvider.ts";
|
|
6
|
+
|
|
7
|
+
// Kept apart from `AuthProvider.ts` because `Stack.ts`, which every runtime
|
|
8
|
+
// imports, provides the registry: this module pulls in nothing but Effect.
|
|
9
|
+
|
|
10
|
+
/** Every registered {@link AuthProvider}, by provider name. */
|
|
11
|
+
export class AuthProviders extends Context.Service<
|
|
12
|
+
AuthProviders,
|
|
13
|
+
{
|
|
14
|
+
[providerName: string]: AuthProvider;
|
|
15
|
+
}
|
|
16
|
+
>()("AuthProviders") {}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The registry a provider layer registers into: the ambient one when the
|
|
20
|
+
* caller supplies it (to read the registrations back, as `alchemy profile`
|
|
21
|
+
* does), otherwise a fresh one for this build. `Stack.build` provides it,
|
|
22
|
+
* so callers never supply an empty registry.
|
|
23
|
+
*/
|
|
24
|
+
export const AuthProvidersLive = Layer.effect(
|
|
25
|
+
AuthProviders,
|
|
26
|
+
Effect.serviceOption(AuthProviders).pipe(Effect.map(Option.getOrElse(() => ({})))),
|
|
27
|
+
);
|