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/Drift.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @effect-diagnostics anyUnknownInErrorContext:off */
|
|
2
2
|
import * as Cause from "effect/Cause";
|
|
3
3
|
import * as Data from "effect/Data";
|
|
4
|
+
import * as Deferred from "effect/Deferred";
|
|
4
5
|
import * as Effect from "effect/Effect";
|
|
5
6
|
import * as Layer from "effect/Layer";
|
|
6
7
|
import * as Option from "effect/Option";
|
|
@@ -14,15 +15,11 @@ import {
|
|
|
14
15
|
makeScopedArtifacts,
|
|
15
16
|
} from "./Artifacts.ts";
|
|
16
17
|
import { deepEqual } from "./Diff.ts";
|
|
18
|
+
import { captureEmit, emit } from "./Events.ts";
|
|
17
19
|
import type { Apply, Plan } from "./Plan.ts";
|
|
18
20
|
import { findProviderByType, Provider } from "./Provider.ts";
|
|
19
21
|
import { stampedMode } from "./ProviderMode.ts";
|
|
20
|
-
import {
|
|
21
|
-
noopSession,
|
|
22
|
-
Progress,
|
|
23
|
-
type PlanStatusSession,
|
|
24
|
-
type ScopedPlanStatusSession,
|
|
25
|
-
} from "./Report.ts";
|
|
22
|
+
import { resourceSession } from "./Report.ts";
|
|
26
23
|
import type { ResourceLike } from "./Resource.ts";
|
|
27
24
|
import { ResourceContext } from "./ResourceContext.ts";
|
|
28
25
|
import {
|
|
@@ -33,6 +30,7 @@ import {
|
|
|
33
30
|
type UpdatedResourceState,
|
|
34
31
|
} from "./State/index.ts";
|
|
35
32
|
import { type ResourceOp, recordResourceOp } from "./Telemetry/Metrics.ts";
|
|
33
|
+
import { findCycleMembers } from "./Util/scc.ts";
|
|
36
34
|
|
|
37
35
|
/**
|
|
38
36
|
* The outcome of checking or repairing drift for a single resource.
|
|
@@ -77,11 +75,6 @@ export interface DriftResult {
|
|
|
77
75
|
resources: Record<string, DriftResourceResult>;
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
export interface DriftOptions {
|
|
81
|
-
/** Optional progress session (the CLI passes one; tests usually don't). */
|
|
82
|
-
session?: PlanStatusSession;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
78
|
/** A provider lifecycle failure annotated with the resource being checked. */
|
|
86
79
|
export class DriftResourceError extends Data.TaggedError("DriftResourceError")<{
|
|
87
80
|
readonly message: string;
|
|
@@ -114,11 +107,14 @@ export class DriftResourceError extends Data.TaggedError("DriftResourceError")<{
|
|
|
114
107
|
* deterministic physical names regenerate identically.
|
|
115
108
|
* 4. **Persist** — write the fresh attributes back to the state store.
|
|
116
109
|
*
|
|
117
|
-
* Resources are
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* resource
|
|
110
|
+
* Resources are observed concurrently. Repairs follow the persisted
|
|
111
|
+
* `downstream` edges: a recreated topic exists before its subscription is
|
|
112
|
+
* recreated. Missing resources are recreated without their bindings first and
|
|
113
|
+
* bound once every missing resource exists again, because binding data (an S3
|
|
114
|
+
* notification's target topic) can point at a resource recreated later. A
|
|
115
|
+
* failure checking one resource does not interrupt the others; all failures
|
|
116
|
+
* are aggregated into a single combined cause after every resource has been
|
|
117
|
+
* attempted.
|
|
122
118
|
*
|
|
123
119
|
* Resources that cannot be checked are reported as `skipped` rather than
|
|
124
120
|
* failing the run: providers without `read` (nothing to observe), and
|
|
@@ -129,16 +125,18 @@ export class DriftResourceError extends Data.TaggedError("DriftResourceError")<{
|
|
|
129
125
|
*/
|
|
130
126
|
const runDrift = (
|
|
131
127
|
stack: { name: string; stage: string },
|
|
132
|
-
options:
|
|
128
|
+
options: {
|
|
129
|
+
readonly dryRun: boolean;
|
|
130
|
+
/** Check and repair only these resources; the rest of the stage is untouched. */
|
|
131
|
+
readonly only?: ReadonlyArray<string>;
|
|
132
|
+
},
|
|
133
133
|
): Effect.Effect<DriftResult, any, State> =>
|
|
134
134
|
Effect.gen(function* () {
|
|
135
|
-
// Phase markers
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
const reportPlanned = yield* Progress;
|
|
139
|
-
yield* reportPlanned({ _tag: "plan.phase", phase: "loading-state" });
|
|
135
|
+
// Phase markers and per-resource progress are emitted as events so
|
|
136
|
+
// renderers can show the drift check as it runs.
|
|
137
|
+
yield* emit({ type: "plan.phase", phase: "loading-state" });
|
|
140
138
|
const state = yield* yield* State;
|
|
141
|
-
const
|
|
139
|
+
const reportEvent = yield* captureEmit;
|
|
142
140
|
const stackName = stack.name;
|
|
143
141
|
const stage = stack.stage;
|
|
144
142
|
const dryRun = options.dryRun;
|
|
@@ -161,24 +159,14 @@ const runDrift = (
|
|
|
161
159
|
...partial,
|
|
162
160
|
});
|
|
163
161
|
|
|
164
|
-
const scopedSession =
|
|
165
|
-
...session,
|
|
166
|
-
note: (note, options?) =>
|
|
167
|
-
session.emit({
|
|
168
|
-
fqn,
|
|
169
|
-
id: logicalId,
|
|
170
|
-
_tag: "apply.resource.note",
|
|
171
|
-
message: note,
|
|
172
|
-
kind: options?.kind,
|
|
173
|
-
}),
|
|
174
|
-
} satisfies ScopedPlanStatusSession;
|
|
162
|
+
const scopedSession = resourceSession(reportEvent, fqn, logicalId);
|
|
175
163
|
|
|
176
164
|
const report = (status: "updating" | "updated" | "creating" | "created" | "skipped") =>
|
|
177
|
-
|
|
178
|
-
|
|
165
|
+
reportEvent({
|
|
166
|
+
type: "apply.resource.status",
|
|
179
167
|
fqn,
|
|
180
168
|
id: logicalId,
|
|
181
|
-
|
|
169
|
+
resourceType,
|
|
182
170
|
status,
|
|
183
171
|
});
|
|
184
172
|
|
|
@@ -211,20 +199,48 @@ const runDrift = (
|
|
|
211
199
|
return yield* skip(`provider '${resourceType}' does not implement read`);
|
|
212
200
|
}
|
|
213
201
|
|
|
214
|
-
|
|
215
|
-
|
|
202
|
+
// Persist a repaired row. Everything but the status, attributes and
|
|
203
|
+
// bindings carries over from the persisted row — notably the
|
|
204
|
+
// `providerMode` stamp, without which a repaired local row would be
|
|
205
|
+
// treated as live.
|
|
206
|
+
const commit = (
|
|
207
|
+
status: "created" | "updated",
|
|
208
|
+
attr: ResourceState["attr"],
|
|
209
|
+
bindings: ResourceState["bindings"],
|
|
210
|
+
) => {
|
|
211
|
+
const row = {
|
|
212
|
+
kind: old.kind,
|
|
213
|
+
namespace,
|
|
214
|
+
fqn,
|
|
215
|
+
logicalId,
|
|
216
|
+
instanceId,
|
|
217
|
+
resourceType,
|
|
218
|
+
props: old.props!,
|
|
219
|
+
attr: attr!,
|
|
220
|
+
providerVersion: provider.version ?? 0,
|
|
221
|
+
bindings,
|
|
222
|
+
downstream: old.downstream,
|
|
223
|
+
removalPolicy: old.removalPolicy,
|
|
224
|
+
providerMode: old.providerMode,
|
|
225
|
+
adoptionBlocked: old.adoptionBlocked,
|
|
226
|
+
};
|
|
227
|
+
return state.set({
|
|
216
228
|
stack: stackName,
|
|
217
229
|
stage,
|
|
218
230
|
fqn,
|
|
219
|
-
value:
|
|
231
|
+
value:
|
|
232
|
+
status === "created"
|
|
233
|
+
? ({ ...row, status } satisfies CreatedResourceState)
|
|
234
|
+
: ({ ...row, status } satisfies UpdatedResourceState),
|
|
220
235
|
});
|
|
236
|
+
};
|
|
221
237
|
|
|
222
238
|
// Paired with the resource-planned completion so renderers can show
|
|
223
239
|
// which rows' cloud reads are actually in flight (the slowest part of
|
|
224
240
|
// a drift check). Emitted after the skip gates: skipped rows settle
|
|
225
241
|
// instantly and never read the cloud.
|
|
226
|
-
yield*
|
|
227
|
-
|
|
242
|
+
yield* emit({
|
|
243
|
+
type: "plan.resource.started",
|
|
228
244
|
fqn,
|
|
229
245
|
logicalId,
|
|
230
246
|
resourceType,
|
|
@@ -240,39 +256,11 @@ const runDrift = (
|
|
|
240
256
|
})
|
|
241
257
|
.pipe(instrumentLifecycle("read", fqn, resourceType, logicalId, instanceId));
|
|
242
258
|
|
|
243
|
-
// ── missing — recreate under the same instance id ──
|
|
244
259
|
if (observed === undefined) {
|
|
245
260
|
if (dryRun) {
|
|
246
261
|
return result({ action: "missing" });
|
|
247
262
|
}
|
|
248
|
-
|
|
249
|
-
const attr = yield* provider
|
|
250
|
-
.reconcile({
|
|
251
|
-
id: logicalId,
|
|
252
|
-
fqn,
|
|
253
|
-
instanceId,
|
|
254
|
-
news: old.props as never,
|
|
255
|
-
olds: undefined,
|
|
256
|
-
output: undefined,
|
|
257
|
-
session: scopedSession,
|
|
258
|
-
bindings: old.bindings as never,
|
|
259
|
-
})
|
|
260
|
-
.pipe(instrumentLifecycle("create", fqn, resourceType, logicalId, instanceId));
|
|
261
|
-
yield* commit({
|
|
262
|
-
status: "created",
|
|
263
|
-
fqn,
|
|
264
|
-
logicalId,
|
|
265
|
-
instanceId,
|
|
266
|
-
resourceType,
|
|
267
|
-
props: old.props!,
|
|
268
|
-
attr,
|
|
269
|
-
providerVersion: provider.version ?? 0,
|
|
270
|
-
bindings: old.bindings,
|
|
271
|
-
downstream: old.downstream,
|
|
272
|
-
removalPolicy: old.removalPolicy,
|
|
273
|
-
} satisfies Omit<CreatedResourceState, "namespace">);
|
|
274
|
-
yield* report("created");
|
|
275
|
-
return result({ action: "recreated", attr });
|
|
263
|
+
return { fqn, old, provider, live: undefined, result, scopedSession, report, commit };
|
|
276
264
|
}
|
|
277
265
|
|
|
278
266
|
// `read` may brand the attributes as Unowned when ownership markers
|
|
@@ -289,9 +277,60 @@ const runDrift = (
|
|
|
289
277
|
if (dryRun) {
|
|
290
278
|
return result({ action: "drifted", attr: live });
|
|
291
279
|
}
|
|
280
|
+
return { fqn, old, provider, live, result, scopedSession, report, commit };
|
|
281
|
+
});
|
|
282
|
+
type PendingRepair = Extract<
|
|
283
|
+
Effect.Success<ReturnType<typeof driftResource>>,
|
|
284
|
+
{ old: unknown }
|
|
285
|
+
>;
|
|
286
|
+
const isPendingRepair = (
|
|
287
|
+
observed: DriftResourceResult | PendingRepair | undefined,
|
|
288
|
+
): observed is PendingRepair => observed !== undefined && "old" in observed;
|
|
289
|
+
|
|
290
|
+
// ── missing — recreate under the same instance id, without bindings ──
|
|
291
|
+
//
|
|
292
|
+
// Binding data often points at other resources (an S3 notification
|
|
293
|
+
// targets a topic), and a binding edge inside a cycle is not recorded in
|
|
294
|
+
// `downstream`. So, like Apply's precreate, missing resources are first
|
|
295
|
+
// created bare in `downstream` order; their bindings are attached in the
|
|
296
|
+
// second phase, once every missing resource exists again. The bare
|
|
297
|
+
// create is committed with no bindings so a crash in between leaves a
|
|
298
|
+
// row the next deploy re-binds.
|
|
299
|
+
const recreate = Effect.fn("drift.recreate")(function* (pending: PendingRepair) {
|
|
300
|
+
const { fqn, old, provider, report, commit, scopedSession, result } = pending;
|
|
301
|
+
const { logicalId, instanceId, resourceType } = old;
|
|
302
|
+
const bindings = old.bindings ?? [];
|
|
303
|
+
yield* report("creating");
|
|
304
|
+
const attr = yield* provider
|
|
305
|
+
.reconcile({
|
|
306
|
+
id: logicalId,
|
|
307
|
+
fqn,
|
|
308
|
+
instanceId,
|
|
309
|
+
news: old.props as never,
|
|
310
|
+
olds: undefined,
|
|
311
|
+
output: undefined,
|
|
312
|
+
session: scopedSession,
|
|
313
|
+
bindings: [] as never,
|
|
314
|
+
})
|
|
315
|
+
.pipe(instrumentLifecycle("create", fqn, resourceType, logicalId, instanceId));
|
|
316
|
+
yield* commit("created", attr, []);
|
|
317
|
+
if (bindings.length === 0) {
|
|
318
|
+
yield* report("created");
|
|
319
|
+
return { done: result({ action: "recreated", attr }) };
|
|
320
|
+
}
|
|
321
|
+
return { rebind: { ...pending, live: attr, recreated: true } };
|
|
322
|
+
});
|
|
292
323
|
|
|
293
|
-
|
|
294
|
-
|
|
324
|
+
// ── drifted — converge the cloud back to the last-deployed props ──
|
|
325
|
+
//
|
|
326
|
+
// Also attaches the bindings of resources recreated bare above.
|
|
327
|
+
const reconcile = Effect.fn("drift.reconcile")(function* (
|
|
328
|
+
pending: PendingRepair & { recreated: boolean },
|
|
329
|
+
) {
|
|
330
|
+
const { fqn, old, provider, live, report, commit, scopedSession, result, recreated } =
|
|
331
|
+
pending;
|
|
332
|
+
const { logicalId, instanceId, resourceType } = old;
|
|
333
|
+
if (!recreated) yield* report("updating");
|
|
295
334
|
const attr = yield* provider
|
|
296
335
|
.reconcile({
|
|
297
336
|
id: logicalId,
|
|
@@ -305,48 +344,51 @@ const runDrift = (
|
|
|
305
344
|
session: scopedSession,
|
|
306
345
|
bindings: old.bindings as never,
|
|
307
346
|
})
|
|
308
|
-
.pipe(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
removalPolicy: old.removalPolicy,
|
|
321
|
-
} satisfies Omit<UpdatedResourceState, "namespace">);
|
|
322
|
-
yield* report("updated");
|
|
323
|
-
return result({ action: "repaired", attr });
|
|
347
|
+
.pipe(
|
|
348
|
+
instrumentLifecycle(
|
|
349
|
+
recreated ? "create" : "update",
|
|
350
|
+
fqn,
|
|
351
|
+
resourceType,
|
|
352
|
+
logicalId,
|
|
353
|
+
instanceId,
|
|
354
|
+
),
|
|
355
|
+
);
|
|
356
|
+
yield* commit(recreated ? "created" : "updated", attr, old.bindings);
|
|
357
|
+
yield* report(recreated ? "created" : "updated");
|
|
358
|
+
return result({ action: recreated ? "recreated" : "repaired", attr });
|
|
324
359
|
});
|
|
325
360
|
|
|
326
|
-
const
|
|
327
|
-
|
|
361
|
+
const listed = yield* state.list({ stack: stackName, stage });
|
|
362
|
+
const fqns =
|
|
363
|
+
options.only === undefined ? listed : listed.filter((fqn) => options.only!.includes(fqn));
|
|
364
|
+
yield* emit({ type: "plan.phase", phase: "computing-plan" });
|
|
328
365
|
|
|
329
366
|
// Per-resource observation progress: each row is reported through the
|
|
330
|
-
//
|
|
367
|
+
// events as its cloud read lands (drift checks are the
|
|
331
368
|
// slowest planning path). Failed or action rows advance the count
|
|
332
369
|
// without an event, so progress stays monotonic.
|
|
333
370
|
const observedCount = yield* Ref.make(0);
|
|
334
|
-
const resourceObserved = (
|
|
371
|
+
const resourceObserved = (observed: DriftResourceResult | PendingRepair | undefined) =>
|
|
335
372
|
Ref.updateAndGet(observedCount, (count) => count + 1).pipe(
|
|
336
373
|
Effect.flatMap((completed) =>
|
|
337
|
-
|
|
374
|
+
observed === undefined
|
|
338
375
|
? Effect.void
|
|
339
|
-
:
|
|
340
|
-
|
|
341
|
-
fqn:
|
|
342
|
-
logicalId:
|
|
343
|
-
resourceType:
|
|
376
|
+
: emit({
|
|
377
|
+
type: "plan.resource.completed",
|
|
378
|
+
fqn: observed.fqn,
|
|
379
|
+
logicalId: isPendingRepair(observed) ? observed.old.logicalId : observed.logicalId,
|
|
380
|
+
resourceType: isPendingRepair(observed)
|
|
381
|
+
? observed.old.resourceType
|
|
382
|
+
: observed.resourceType,
|
|
344
383
|
// Drift observation compares attributes, not binding rows.
|
|
345
384
|
bindings: [],
|
|
346
|
-
action:
|
|
347
|
-
|
|
385
|
+
action: isPendingRepair(observed)
|
|
386
|
+
? observed.live === undefined
|
|
387
|
+
? "create"
|
|
388
|
+
: "update"
|
|
389
|
+
: observed.action === "drifted"
|
|
348
390
|
? "update"
|
|
349
|
-
:
|
|
391
|
+
: observed.action === "missing"
|
|
350
392
|
? "create"
|
|
351
393
|
: "noop",
|
|
352
394
|
completed,
|
|
@@ -358,34 +400,116 @@ const runDrift = (
|
|
|
358
400
|
// Drift every resource even if some fail, then surface all failures as
|
|
359
401
|
// one combined cause (mirrors Apply's failure aggregation).
|
|
360
402
|
const failures: Cause.Cause<unknown>[] = [];
|
|
361
|
-
const
|
|
362
|
-
|
|
403
|
+
const recordFailure = (fqn: string) => (cause: Cause.Cause<unknown>) =>
|
|
404
|
+
Effect.gen(function* () {
|
|
405
|
+
failures.push(cause);
|
|
406
|
+
const persisted = yield* state
|
|
407
|
+
.get({ stack: stackName, stage, fqn })
|
|
408
|
+
.pipe(Effect.orElseSucceed(() => undefined));
|
|
409
|
+
if (persisted && !isActionState(persisted)) {
|
|
410
|
+
yield* reportEvent({
|
|
411
|
+
type: "apply.resource.status",
|
|
412
|
+
fqn,
|
|
413
|
+
id: persisted.logicalId,
|
|
414
|
+
resourceType: persisted.resourceType,
|
|
415
|
+
status: "fail",
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
return undefined;
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
const observed = yield* Effect.forEach(
|
|
422
|
+
fqns,
|
|
423
|
+
(fqn) =>
|
|
363
424
|
driftResource(fqn).pipe(
|
|
364
|
-
Effect.catchCause((
|
|
365
|
-
Effect.gen(function* () {
|
|
366
|
-
failures.push(cause);
|
|
367
|
-
const persisted = yield* state
|
|
368
|
-
.get({ stack: stackName, stage, fqn })
|
|
369
|
-
.pipe(Effect.orElseSucceed(() => undefined));
|
|
370
|
-
if (persisted && !isActionState(persisted)) {
|
|
371
|
-
yield* session.emit({
|
|
372
|
-
_tag: "apply.resource.status",
|
|
373
|
-
fqn,
|
|
374
|
-
id: persisted.logicalId,
|
|
375
|
-
type: persisted.resourceType,
|
|
376
|
-
status: "fail",
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
return undefined;
|
|
380
|
-
}),
|
|
381
|
-
),
|
|
425
|
+
Effect.catchCause(recordFailure(fqn)),
|
|
382
426
|
Effect.tap(resourceObserved),
|
|
383
427
|
),
|
|
384
|
-
),
|
|
385
428
|
{ concurrency: "unbounded" },
|
|
386
429
|
);
|
|
387
430
|
|
|
388
|
-
|
|
431
|
+
const pending = observed.filter(isPendingRepair);
|
|
432
|
+
|
|
433
|
+
// Upstreams per the persisted `downstream` edges, among the resources
|
|
434
|
+
// being repaired (an unchanged or skipped upstream never blocks). Edges
|
|
435
|
+
// inside a cycle — only possible through merged historical edges — are
|
|
436
|
+
// dropped.
|
|
437
|
+
const upstream: Record<string, string[]> = Object.fromEntries(
|
|
438
|
+
pending.map((node) => [node.fqn, [] as string[]]),
|
|
439
|
+
);
|
|
440
|
+
for (const node of pending) {
|
|
441
|
+
for (const down of node.old.downstream ?? []) {
|
|
442
|
+
if (down !== node.fqn) upstream[down]?.push(node.fqn);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const cyclic = findCycleMembers(upstream);
|
|
446
|
+
const upstreamOf = (fqn: string) =>
|
|
447
|
+
upstream[fqn]!.filter((up) => !(cyclic.has(up) && cyclic.has(fqn)));
|
|
448
|
+
|
|
449
|
+
// Resources whose repair failed, or was skipped because an upstream's
|
|
450
|
+
// did. Like Apply, a dependent never runs against a failed upstream.
|
|
451
|
+
const failed = new Set<string>();
|
|
452
|
+
|
|
453
|
+
// Run `run` over `nodes`, each node after its upstreams in `nodes` have
|
|
454
|
+
// settled. Upstreams outside `nodes` settled in an earlier phase.
|
|
455
|
+
const inDependencyOrder = Effect.fn(function* <N extends PendingRepair, A>(
|
|
456
|
+
nodes: ReadonlyArray<N>,
|
|
457
|
+
run: (node: N) => Effect.Effect<A, unknown>,
|
|
458
|
+
) {
|
|
459
|
+
const settled = new Map<string, Deferred.Deferred<void>>();
|
|
460
|
+
for (const node of nodes) settled.set(node.fqn, yield* Deferred.make<void>());
|
|
461
|
+
return yield* Effect.forEach(
|
|
462
|
+
nodes,
|
|
463
|
+
(node) =>
|
|
464
|
+
Effect.gen(function* () {
|
|
465
|
+
const ups = upstreamOf(node.fqn);
|
|
466
|
+
yield* Effect.all(
|
|
467
|
+
ups.flatMap((up) => {
|
|
468
|
+
const deferred = settled.get(up);
|
|
469
|
+
return deferred ? [Deferred.await(deferred)] : [];
|
|
470
|
+
}),
|
|
471
|
+
);
|
|
472
|
+
const blocked = ups.filter((up) => failed.has(up));
|
|
473
|
+
if (blocked.length > 0) {
|
|
474
|
+
failed.add(node.fqn);
|
|
475
|
+
yield* node.scopedSession.note(
|
|
476
|
+
`not repaired: upstream ${blocked.map((up) => `'${up}'`).join(", ")} failed`,
|
|
477
|
+
);
|
|
478
|
+
yield* node.report("skipped");
|
|
479
|
+
return undefined;
|
|
480
|
+
}
|
|
481
|
+
return yield* run(node).pipe(
|
|
482
|
+
Effect.catchCause((cause) =>
|
|
483
|
+
Effect.sync(() => failed.add(node.fqn)).pipe(
|
|
484
|
+
Effect.andThen(recordFailure(node.fqn)(cause)),
|
|
485
|
+
),
|
|
486
|
+
),
|
|
487
|
+
);
|
|
488
|
+
}).pipe(Effect.ensuring(Deferred.succeed(settled.get(node.fqn)!, undefined))),
|
|
489
|
+
{ concurrency: "unbounded" },
|
|
490
|
+
);
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
const recreated = yield* inDependencyOrder(
|
|
494
|
+
pending.filter((node) => node.live === undefined),
|
|
495
|
+
recreate,
|
|
496
|
+
);
|
|
497
|
+
const rebind = recreated.flatMap((node) => (node?.rebind ? [node.rebind] : []));
|
|
498
|
+
const repaired = yield* inDependencyOrder(
|
|
499
|
+
[
|
|
500
|
+
...pending
|
|
501
|
+
.filter((node) => node.live !== undefined)
|
|
502
|
+
.map((node) => ({ ...node, recreated: false })),
|
|
503
|
+
...rebind,
|
|
504
|
+
],
|
|
505
|
+
reconcile,
|
|
506
|
+
);
|
|
507
|
+
|
|
508
|
+
const results = [
|
|
509
|
+
...observed.filter((r) => !isPendingRepair(r)),
|
|
510
|
+
...recreated.map((r) => r?.done),
|
|
511
|
+
...repaired,
|
|
512
|
+
].filter((r): r is DriftResourceResult => r !== undefined);
|
|
389
513
|
|
|
390
514
|
if (failures.length > 0) {
|
|
391
515
|
return yield* Effect.failCause(failures.reduce(Cause.combine) as Cause.Cause<never>);
|
|
@@ -410,9 +534,14 @@ const runDrift = (
|
|
|
410
534
|
/** Detect drift without reconciling resources or updating state. */
|
|
411
535
|
export const detect = (stack: { name: string; stage: string }) => runDrift(stack, { dryRun: true });
|
|
412
536
|
|
|
413
|
-
/**
|
|
414
|
-
|
|
415
|
-
|
|
537
|
+
/**
|
|
538
|
+
* Reconcile resources back to their last-deployed desired state. With
|
|
539
|
+
* `only`, just those resources are re-checked and repaired.
|
|
540
|
+
*/
|
|
541
|
+
export const repair = (
|
|
542
|
+
stack: { name: string; stage: string },
|
|
543
|
+
options: { readonly only?: ReadonlyArray<string> } = {},
|
|
544
|
+
) => runDrift(stack, { dryRun: false, only: options.only });
|
|
416
545
|
|
|
417
546
|
/**
|
|
418
547
|
* Same shape as Apply's lifecycle instrumentation: scoped artifacts +
|
package/src/EvalStack.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ConfigProvider } from "effect/ConfigProvider";
|
|
2
|
+
import type * as Context from "effect/Context";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as Option from "effect/Option";
|
|
7
|
+
import * as Scope from "effect/Scope";
|
|
8
|
+
import { AlchemyContext, AlchemyContextLive } from "./AlchemyContext.ts";
|
|
9
|
+
import { provideFreshArtifactStore } from "./Artifacts.ts";
|
|
10
|
+
import { CredentialsStoreLive } from "./Auth/Credentials.ts";
|
|
11
|
+
import { ProfileStoreLive } from "./Auth/Profile.ts";
|
|
12
|
+
import { type StackEffect, StateScope } from "./Stack.ts";
|
|
13
|
+
import { Stage } from "./Stage.ts";
|
|
14
|
+
import { loadConfigProvider } from "./Util/ConfigProvider.ts";
|
|
15
|
+
import { PlatformServices } from "./Util/PlatformServices.ts";
|
|
16
|
+
|
|
17
|
+
// TODO(unify stack builds): this is one of several ways to build a stack;
|
|
18
|
+
// the others are `Alchemist/Operations.ts` (`buildStack`,
|
|
19
|
+
// `buildWithoutProgram`) and the test harness's scratch stacks
|
|
20
|
+
// (`alchemy-test/src/Core.ts`). They differ in config (this one reloads `.env`
|
|
21
|
+
// and drops the caller's ConfigProvider), adopt/updateStateStore, and how
|
|
22
|
+
// the state-store lease is scoped. Migrate everything to `Alchemist.plan` /
|
|
23
|
+
// `Alchemist.apply`: give Alchemist this file's per-call lease scope
|
|
24
|
+
// (`StateScope`), reimplement `Deploy.deploy` / `Destroy.destroy` on it,
|
|
25
|
+
// move scratch stacks onto it, then delete this file.
|
|
26
|
+
|
|
27
|
+
// Deploy-time only: kept out of `Stack.ts` because every runtime imports the
|
|
28
|
+
// `Stack` tag, and this module's top-level platform layer (Node + Bun
|
|
29
|
+
// platforms, `ws`, profile and credential stores) survives tree-shaking.
|
|
30
|
+
|
|
31
|
+
const platform = Layer.mergeAll(
|
|
32
|
+
PlatformServices,
|
|
33
|
+
FetchHttpClient.layer,
|
|
34
|
+
Layer.provide(ProfileStoreLive, PlatformServices),
|
|
35
|
+
Layer.provide(CredentialsStoreLive, PlatformServices),
|
|
36
|
+
);
|
|
37
|
+
// override alchemy state store, CLI/reporting, state, and Config
|
|
38
|
+
const alchemy = (overrides?: { dev?: boolean }) =>
|
|
39
|
+
Layer.mergeAll(
|
|
40
|
+
// optional
|
|
41
|
+
overrides?.dev
|
|
42
|
+
? Layer.provide(
|
|
43
|
+
Layer.effect(
|
|
44
|
+
AlchemyContext,
|
|
45
|
+
AlchemyContext.useSync((ctx) => ({ ...ctx, dev: overrides.dev! })),
|
|
46
|
+
),
|
|
47
|
+
AlchemyContextLive,
|
|
48
|
+
)
|
|
49
|
+
: AlchemyContextLive,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export const evalStack = <S extends { services: Context.Context<any> }, B, StackErr, Err, Req>(
|
|
53
|
+
effect: StackEffect<S, StackErr, Stage | AlchemyContext>,
|
|
54
|
+
fn: (stack: S) => Effect.Effect<B, Err, Req>,
|
|
55
|
+
options: {
|
|
56
|
+
stage: string;
|
|
57
|
+
dev?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Optional caller-supplied scope. When provided, scoped resources
|
|
60
|
+
* (e.g. the dev sidecar process) live until the caller closes this
|
|
61
|
+
* scope instead of being torn down when `evalStack` resolves. Used
|
|
62
|
+
* by the test harness so the sidecar survives across `beforeAll`,
|
|
63
|
+
* tests, and `afterAll`. When omitted, behaves as before with a
|
|
64
|
+
* private scope closed on completion. The state store never outlives
|
|
65
|
+
* the call.
|
|
66
|
+
*/
|
|
67
|
+
scope?: Scope.Scope;
|
|
68
|
+
},
|
|
69
|
+
) => {
|
|
70
|
+
const body = Effect.gen(function* () {
|
|
71
|
+
const stack = yield* effect;
|
|
72
|
+
const configProvider = yield* loadConfigProvider(Option.none());
|
|
73
|
+
return yield* fn(stack).pipe(
|
|
74
|
+
provideFreshArtifactStore,
|
|
75
|
+
Effect.provide(
|
|
76
|
+
Layer.succeedContext(stack.services).pipe(
|
|
77
|
+
Layer.provideMerge(Layer.succeed(ConfigProvider, configProvider)),
|
|
78
|
+
),
|
|
79
|
+
),
|
|
80
|
+
);
|
|
81
|
+
}).pipe(
|
|
82
|
+
Effect.provide(
|
|
83
|
+
Layer.succeed(Stage, options.stage).pipe(
|
|
84
|
+
Layer.provideMerge(Layer.provideMerge(alchemy({ dev: options.dev }), platform)),
|
|
85
|
+
),
|
|
86
|
+
),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const scope = options.scope;
|
|
90
|
+
return scope === undefined
|
|
91
|
+
? Effect.scoped(body)
|
|
92
|
+
: // The state store closes with this call and releases its lease, so
|
|
93
|
+
// the next call on the same long-lived scope can take it.
|
|
94
|
+
Effect.scopedWith((stateScope) =>
|
|
95
|
+
Scope.provide(body.pipe(Effect.provideService(StateScope, stateScope)), scope),
|
|
96
|
+
);
|
|
97
|
+
};
|