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/Stack.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import type { ConfigError } from "effect/Config";
|
|
2
|
-
import { ConfigProvider } from "effect/ConfigProvider";
|
|
3
2
|
import * as Context from "effect/Context";
|
|
4
|
-
import type {
|
|
3
|
+
import type { Digest } from "effect/crypto/Digest";
|
|
4
|
+
import type { SecureRandom } from "effect/crypto/SecureRandom";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
6
|
import { FileSystem } from "effect/FileSystem";
|
|
7
|
-
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
8
7
|
import type { HttpClient } from "effect/http/HttpClient";
|
|
9
8
|
import * as Layer from "effect/Layer";
|
|
10
|
-
import * as Logger from "effect/Logger";
|
|
11
9
|
import * as Option from "effect/Option";
|
|
12
10
|
import { Path } from "effect/Path";
|
|
13
11
|
import type { ChildProcessSpawner } from "effect/process/ChildProcessSpawner";
|
|
14
|
-
import * as Scope from "effect/Scope";
|
|
12
|
+
import type * as Scope from "effect/Scope";
|
|
15
13
|
import type { ActionLike } from "./Action.ts";
|
|
16
|
-
import { AlchemyContext
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
14
|
+
import type { AlchemyContext } from "./AlchemyContext.ts";
|
|
15
|
+
import type { ArtifactStore } from "./Artifacts.ts";
|
|
16
|
+
import type { CredentialsStore } from "./Auth/Credentials.ts";
|
|
17
|
+
import type { ProfileStore } from "./Auth/Profile.ts";
|
|
18
|
+
import { AuthProvidersLive, type AuthProviders } from "./Auth/Registry.ts";
|
|
21
19
|
import type { Input, InputProps } from "./Input.ts";
|
|
22
20
|
// Type-only: with verbatimModuleSyntax a value import would survive emit and
|
|
23
21
|
// drag the terminal helpers (node:tty, Sigil's ansi helpers) into every unbundled
|
|
@@ -30,17 +28,17 @@ import type { SecretsEntry, SecretsOption } from "./Secrets/Provider.ts";
|
|
|
30
28
|
import { StackContext } from "./StackContext.ts";
|
|
31
29
|
import { Stage } from "./Stage.ts";
|
|
32
30
|
import type { State } from "./State/State.ts";
|
|
33
|
-
import {
|
|
31
|
+
import { stackConfigLayer } from "./Util/ConfigProvider.ts";
|
|
34
32
|
import { effectClass, taggedFunction } from "./Util/effect.ts";
|
|
35
|
-
import {
|
|
36
|
-
import { PlatformServices } from "./Util/PlatformServices.ts";
|
|
33
|
+
import type { PlatformServices } from "./Util/PlatformServices.ts";
|
|
37
34
|
|
|
38
35
|
export type StackServices =
|
|
39
36
|
| Stack
|
|
40
37
|
| Stage
|
|
41
38
|
| Scope.Scope
|
|
42
39
|
| FileSystem
|
|
43
|
-
|
|
|
40
|
+
| Digest
|
|
41
|
+
| SecureRandom
|
|
44
42
|
| Path
|
|
45
43
|
| AlchemyContext
|
|
46
44
|
| HttpClient
|
|
@@ -138,6 +136,14 @@ export type ConfiguredStackMeta<Req = never> = {
|
|
|
138
136
|
readonly stackName: string;
|
|
139
137
|
} & StackProps<Req>;
|
|
140
138
|
|
|
139
|
+
/**
|
|
140
|
+
* What `Alchemy.Stack(...)` returns, and what an `alchemy.run.ts`
|
|
141
|
+
* default-exports: the stack program, not yet run, with its providers,
|
|
142
|
+
* state store, and secrets attached.
|
|
143
|
+
*/
|
|
144
|
+
export type ConfiguredStack<Output, Req> = Effect.Effect<CompiledStack<Output>, ConfigError> &
|
|
145
|
+
ConfiguredStackMeta<Req>;
|
|
146
|
+
|
|
141
147
|
export const Stack: Context.ServiceClass<Stack, "Stack", Omit<StackSpec, "output">> & {
|
|
142
148
|
make<A, Req>(
|
|
143
149
|
stack: {
|
|
@@ -158,16 +164,16 @@ export const Stack: Context.ServiceClass<Stack, "Stack", Omit<StackSpec, "output
|
|
|
158
164
|
};
|
|
159
165
|
};
|
|
160
166
|
};
|
|
161
|
-
<Self, Shape>(): {
|
|
167
|
+
<Self, Shape, Stages extends string = string>(): {
|
|
162
168
|
(stackName: string): Effect.Effect<Self> & {
|
|
163
169
|
new (_: never): Output.ToOutput<Shape>;
|
|
164
170
|
readonly stackName: string;
|
|
165
171
|
make: <A, Req>(
|
|
166
172
|
options: StackProps<NoInfer<Req>>,
|
|
167
173
|
effect: Effect.Effect<A, ConfigError, Req>,
|
|
168
|
-
) =>
|
|
174
|
+
) => ConfiguredStack<A, NoInfer<Req>>;
|
|
169
175
|
stage: {
|
|
170
|
-
[
|
|
176
|
+
readonly [S in Stages]: Effect.Effect<Self>;
|
|
171
177
|
};
|
|
172
178
|
};
|
|
173
179
|
};
|
|
@@ -175,7 +181,7 @@ export const Stack: Context.ServiceClass<Stack, "Stack", Omit<StackSpec, "output
|
|
|
175
181
|
stackName: string,
|
|
176
182
|
options: StackProps<NoInfer<Req>>,
|
|
177
183
|
eff: Effect.Effect<A, ConfigError, Req>,
|
|
178
|
-
):
|
|
184
|
+
): ConfiguredStack<A, NoInfer<Req>>;
|
|
179
185
|
} = Object.assign(
|
|
180
186
|
taggedFunction(
|
|
181
187
|
StackContext,
|
|
@@ -256,67 +262,96 @@ export const StackName = Stack.use((stack) => Effect.succeed(stack.name));
|
|
|
256
262
|
|
|
257
263
|
export interface MakeStackProps<ROut = never> {
|
|
258
264
|
name: string;
|
|
259
|
-
|
|
260
|
-
|
|
265
|
+
/** Required; {@link make} dies with setup guidance when it is missing. */
|
|
266
|
+
providers?: Layer.Layer<ROut, never, StackServices>;
|
|
267
|
+
/** Required; {@link make} dies with setup guidance when it is missing. */
|
|
268
|
+
state?: Layer.Layer<State, never, StackServices>;
|
|
261
269
|
/** Opt in to secret providers. When omitted, existing configuration is preserved. */
|
|
262
270
|
secrets?: StackSecrets;
|
|
263
271
|
/** @internal */
|
|
264
272
|
stack?: StackSpec;
|
|
265
273
|
}
|
|
266
274
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
)
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
275
|
+
/**
|
|
276
|
+
* The scope a stack's state store is built into when it must close sooner
|
|
277
|
+
* than the rest of the stack. A store holds its stack's lease until its scope
|
|
278
|
+
* closes, so `evalStack` (`EvalStack.ts`) gives it one per call even when the caller
|
|
279
|
+
* keeps providers alive in a longer scope.
|
|
280
|
+
*/
|
|
281
|
+
export class StateScope extends Context.Service<StateScope, Scope.Scope>()(
|
|
282
|
+
"alchemy/Stack/StateScope",
|
|
283
|
+
) {}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Build a stack's providers, state store, secrets config and `Stack` spec,
|
|
287
|
+
* without running its program. Destroy needs nothing more: it plans from state
|
|
288
|
+
* alone, and every row records the provider mode that deletes it.
|
|
289
|
+
*/
|
|
290
|
+
export const build = <ROut = never>(options: MakeStackProps<ROut>) =>
|
|
291
|
+
Effect.all([Effect.scope, Effect.serviceOption(StateScope)]).pipe(
|
|
292
|
+
Effect.flatMap(([scope, stateScope]) => {
|
|
293
|
+
if (options.state == null) {
|
|
294
|
+
return Effect.die(
|
|
295
|
+
new Error(
|
|
296
|
+
`Stack "${options.name}" is missing a state store. ` +
|
|
297
|
+
`Add a \`state\` layer to the stack options, e.g.:\n` +
|
|
298
|
+
` Alchemy.Stack("${options.name}", {\n` +
|
|
299
|
+
` providers: Cloudflare.providers(),\n` +
|
|
300
|
+
` state: Cloudflare.state(), // <-- required\n` +
|
|
301
|
+
` }, ...)\n` +
|
|
302
|
+
`See https://alchemy.run/state-store for available state stores.`,
|
|
303
|
+
),
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
if (options.providers == null) {
|
|
307
|
+
return Effect.die(
|
|
308
|
+
new Error(
|
|
309
|
+
`Stack "${options.name}" is missing a providers layer. ` +
|
|
310
|
+
`Add a \`providers\` layer to the stack options, e.g.:\n` +
|
|
311
|
+
` Alchemy.Stack("${options.name}", {\n` +
|
|
312
|
+
` providers: Cloudflare.providers(), // <-- required\n` +
|
|
313
|
+
` state: Cloudflare.state(),\n` +
|
|
314
|
+
` }, ...)`,
|
|
315
|
+
),
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
const state = options.state;
|
|
319
|
+
return options.providers.pipe(
|
|
320
|
+
Layer.provideMerge(
|
|
321
|
+
Option.match(stateScope, {
|
|
322
|
+
onNone: () => state,
|
|
323
|
+
onSome: (stateScope) => Layer.effectContext(Layer.buildWithScope(state, stateScope)),
|
|
324
|
+
}),
|
|
325
|
+
),
|
|
326
|
+
Layer.provideMerge(stackConfigLayer(options.secrets)),
|
|
327
|
+
Layer.provideMerge(
|
|
328
|
+
Layer.effect(
|
|
329
|
+
Stack,
|
|
330
|
+
Stage.pipe(
|
|
331
|
+
Effect.map(
|
|
332
|
+
(stage) =>
|
|
333
|
+
options.stack ?? {
|
|
334
|
+
name: options.name,
|
|
335
|
+
stage,
|
|
336
|
+
resources: {},
|
|
337
|
+
bindings: {},
|
|
338
|
+
actions: {},
|
|
339
|
+
},
|
|
314
340
|
),
|
|
315
341
|
),
|
|
316
342
|
),
|
|
317
|
-
|
|
318
|
-
)
|
|
319
|
-
|
|
343
|
+
),
|
|
344
|
+
Layer.provideMerge(AuthProvidersLive),
|
|
345
|
+
Layer.buildWithScope(scope),
|
|
346
|
+
);
|
|
347
|
+
}),
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
/** Build a stack's services with {@link build}, then run its program under them. */
|
|
351
|
+
export const make =
|
|
352
|
+
<ROut = never>(options: MakeStackProps<ROut>) =>
|
|
353
|
+
<A, Err = never, Req extends ROut | StackServices = never>(effect: Effect.Effect<A, Err, Req>) =>
|
|
354
|
+
build(options).pipe(
|
|
320
355
|
Effect.flatMap((context) =>
|
|
321
356
|
Effect.all([effect, Stack, Effect.context<ROut | StackServices>()]).pipe(
|
|
322
357
|
Effect.map(([output, stack, services]): CompiledStack<A, ROut | StackServices> => ({
|
|
@@ -329,71 +364,14 @@ export const make =
|
|
|
329
364
|
),
|
|
330
365
|
);
|
|
331
366
|
|
|
367
|
+
/** What `Alchemy.Stack(...)` attaches to the stack it returns: everything but its program. */
|
|
368
|
+
export interface StackDefinition<ROut = never> {
|
|
369
|
+
readonly stackName: string;
|
|
370
|
+
readonly providers?: Layer.Layer<ROut, never, StackServices>;
|
|
371
|
+
readonly state?: Layer.Layer<State, never, StackServices>;
|
|
372
|
+
readonly secrets?: StackSecrets;
|
|
373
|
+
}
|
|
374
|
+
|
|
332
375
|
export const CurrentStack = Effect.serviceOption(Stack)
|
|
333
376
|
|
|
334
377
|
.pipe(Effect.map(Option.getOrUndefined));
|
|
335
|
-
|
|
336
|
-
const platform = Layer.mergeAll(
|
|
337
|
-
PlatformServices,
|
|
338
|
-
FetchHttpClient.layer,
|
|
339
|
-
Logger.layer([fileLogger("out")], { mergeWithExisting: true }),
|
|
340
|
-
Layer.provide(ProfileStoreLive, PlatformServices),
|
|
341
|
-
Layer.provide(CredentialsStoreLive, PlatformServices),
|
|
342
|
-
);
|
|
343
|
-
// override alchemy state store, CLI/reporting, state, and Config
|
|
344
|
-
const alchemy = (overrides?: { dev?: boolean }) =>
|
|
345
|
-
Layer.mergeAll(
|
|
346
|
-
// optional
|
|
347
|
-
overrides?.dev
|
|
348
|
-
? Layer.provide(
|
|
349
|
-
Layer.effect(
|
|
350
|
-
AlchemyContext,
|
|
351
|
-
AlchemyContext.useSync((ctx) => ({ ...ctx, dev: overrides.dev! })),
|
|
352
|
-
),
|
|
353
|
-
AlchemyContextLive,
|
|
354
|
-
)
|
|
355
|
-
: AlchemyContextLive,
|
|
356
|
-
);
|
|
357
|
-
|
|
358
|
-
export const evalStack = <A, B, StackErr, Err, Req>(
|
|
359
|
-
effect: StackEffect<CompiledStack<A>, StackErr, Stage | AlchemyContext>,
|
|
360
|
-
fn: (stack: CompiledStack<A>) => Effect.Effect<B, Err, Req>,
|
|
361
|
-
options: {
|
|
362
|
-
stage: string;
|
|
363
|
-
dev?: boolean;
|
|
364
|
-
/**
|
|
365
|
-
* Optional caller-supplied scope. When provided, scoped resources
|
|
366
|
-
* (e.g. the dev sidecar process) live until the caller closes this
|
|
367
|
-
* scope instead of being torn down when `evalStack` resolves. Used
|
|
368
|
-
* by the test harness so the sidecar survives across `beforeAll`,
|
|
369
|
-
* tests, and `afterAll`. When omitted, behaves as before with a
|
|
370
|
-
* private scope closed on completion.
|
|
371
|
-
*/
|
|
372
|
-
scope?: Scope.Scope;
|
|
373
|
-
},
|
|
374
|
-
) => {
|
|
375
|
-
const body = Effect.gen(function* () {
|
|
376
|
-
const stack = yield* effect;
|
|
377
|
-
const configProvider = yield* loadConfigProvider(Option.none());
|
|
378
|
-
return yield* fn(stack).pipe(
|
|
379
|
-
provideFreshArtifactStore,
|
|
380
|
-
Effect.provide(
|
|
381
|
-
Layer.succeedContext(stack.services).pipe(
|
|
382
|
-
Layer.provideMerge(Layer.succeed(ConfigProvider, configProvider)),
|
|
383
|
-
),
|
|
384
|
-
),
|
|
385
|
-
);
|
|
386
|
-
}).pipe(
|
|
387
|
-
Effect.provide(
|
|
388
|
-
Layer.effect(
|
|
389
|
-
AuthProviders,
|
|
390
|
-
Effect.serviceOption(AuthProviders).pipe(Effect.map(Option.getOrElse(() => ({})))),
|
|
391
|
-
).pipe(
|
|
392
|
-
Layer.provideMerge(Layer.succeed(Stage, options.stage)),
|
|
393
|
-
Layer.provideMerge(Layer.provideMerge(alchemy({ dev: options.dev }), platform)),
|
|
394
|
-
),
|
|
395
|
-
),
|
|
396
|
-
);
|
|
397
|
-
|
|
398
|
-
return options.scope === undefined ? Effect.scoped(body) : Scope.provide(body, options.scope);
|
|
399
|
-
};
|
package/src/State/BucketState.ts
CHANGED
|
@@ -40,6 +40,9 @@ const OUTPUT_FILE = "__stack_output__.json";
|
|
|
40
40
|
* the lock outlives the objects it was guarding; the store deletes it on
|
|
41
41
|
* close.
|
|
42
42
|
*/
|
|
43
|
+
/** The lease token `alchemy state migrate` leaves on a stage it moved to DynamoDB. */
|
|
44
|
+
const MIGRATED_TOKEN = "migrated:dynamodb";
|
|
45
|
+
|
|
43
46
|
const LEASE_FILE = "__lease__.json";
|
|
44
47
|
|
|
45
48
|
/** How long a lease stays valid without a refresh. */
|
|
@@ -106,6 +109,12 @@ export interface BucketStateOptions {
|
|
|
106
109
|
readonly objects: Effect.Effect<BucketObjects, StateStoreError>;
|
|
107
110
|
}
|
|
108
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Tokens of the leases this process holds, so a conflict with one of them
|
|
114
|
+
* can say the holder is an earlier, still-open build in the same process.
|
|
115
|
+
*/
|
|
116
|
+
const heldInProcess = new Set<string>();
|
|
117
|
+
|
|
109
118
|
interface LeaseRecord {
|
|
110
119
|
readonly token: string;
|
|
111
120
|
readonly expiresAt: number;
|
|
@@ -182,7 +191,7 @@ export const makeBucketState = (options: BucketStateOptions) =>
|
|
|
182
191
|
use((o) => o.read(key)).pipe(
|
|
183
192
|
Effect.flatMap((object) =>
|
|
184
193
|
object === undefined
|
|
185
|
-
? Effect.
|
|
194
|
+
? Effect.undefined
|
|
186
195
|
: Effect.try({
|
|
187
196
|
try: () => JSON.parse(object.text, reviveState) as T,
|
|
188
197
|
catch: (cause) =>
|
|
@@ -208,9 +217,14 @@ export const makeBucketState = (options: BucketStateOptions) =>
|
|
|
208
217
|
),
|
|
209
218
|
);
|
|
210
219
|
|
|
211
|
-
const heldError = (stack: string, stage: string) =>
|
|
220
|
+
const heldError = (stack: string, stage: string, holder: string | undefined) =>
|
|
221
|
+
// The message always starts "another deploy holds": callers match on it
|
|
222
|
+
// (the AWS migration tells a held stage from a failed one by it).
|
|
212
223
|
new StateStoreError({
|
|
213
|
-
message:
|
|
224
|
+
message:
|
|
225
|
+
holder !== undefined && heldInProcess.has(holder)
|
|
226
|
+
? `another deploy holds the ${options.label} state lock '${stack}/${stage}': this process holds it, from an earlier operation on this stage that is still open. Run each operation in its own Effect.scoped so its build closes first.`
|
|
227
|
+
: `another deploy holds the ${options.label} state lock '${stack}/${stage}'`,
|
|
214
228
|
});
|
|
215
229
|
|
|
216
230
|
const lostError = (stack: string, stage: string) =>
|
|
@@ -240,16 +254,22 @@ export const makeBucketState = (options: BucketStateOptions) =>
|
|
|
240
254
|
if (version === undefined) {
|
|
241
255
|
const existing = yield* readLease(key);
|
|
242
256
|
const stillHeld = existing === undefined || existing.record.expiresAt > now;
|
|
257
|
+
if (existing?.record.token === MIGRATED_TOKEN) {
|
|
258
|
+
return yield* new StateStoreError({
|
|
259
|
+
message: `${heldError(stack, stage, undefined).message}: the stage moved to a DynamoDB state store. Deploy it with a version of alchemy that has AWS.state() on DynamoDB, or run 'alchemy state migrate --rollback' with that version to move it back.`,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
243
262
|
if (stillHeld) {
|
|
244
|
-
return yield*
|
|
263
|
+
return yield* heldError(stack, stage, existing?.record.token);
|
|
245
264
|
}
|
|
246
265
|
const replaced = yield* putLease(key, fresh, { ifVersion: existing.version });
|
|
247
266
|
if (replaced === undefined) {
|
|
248
|
-
return yield*
|
|
267
|
+
return yield* heldError(stack, stage, undefined);
|
|
249
268
|
}
|
|
250
269
|
version = replaced;
|
|
251
270
|
}
|
|
252
271
|
|
|
272
|
+
heldInProcess.add(token);
|
|
253
273
|
const cursor = { version, lost: false };
|
|
254
274
|
const gate = Semaphore.makeUnsafe(1);
|
|
255
275
|
|
|
@@ -286,16 +306,29 @@ export const makeBucketState = (options: BucketStateOptions) =>
|
|
|
286
306
|
1,
|
|
287
307
|
)(
|
|
288
308
|
Effect.gen(function* () {
|
|
289
|
-
if (cursor.lost) return yield*
|
|
309
|
+
if (cursor.lost) return yield* lostError(stack, stage);
|
|
290
310
|
const existing = yield* readLease(key);
|
|
291
|
-
|
|
292
|
-
const leaseLost =
|
|
293
|
-
existing === undefined ||
|
|
294
|
-
existing.record.token !== token ||
|
|
295
|
-
existing.record.expiresAt <= observedAt;
|
|
296
|
-
if (leaseLost) {
|
|
311
|
+
if (existing === undefined || existing.record.token !== token) {
|
|
297
312
|
cursor.lost = true;
|
|
298
|
-
return yield*
|
|
313
|
+
return yield* lostError(stack, stage);
|
|
314
|
+
}
|
|
315
|
+
const observedAt = yield* Clock.currentTimeMillis;
|
|
316
|
+
if (existing.record.expiresAt <= observedAt) {
|
|
317
|
+
// The lease lapsed without anyone taking it: a refresh queued
|
|
318
|
+
// behind a large deploy's writes missed its window. Take it
|
|
319
|
+
// back at the version we read, so a deploy that took it in
|
|
320
|
+
// the meantime wins and this one stops.
|
|
321
|
+
const reclaimed = yield* putLease(
|
|
322
|
+
key,
|
|
323
|
+
{ token, expiresAt: observedAt + LEASE_TTL_MS },
|
|
324
|
+
{ ifVersion: existing.version },
|
|
325
|
+
);
|
|
326
|
+
if (reclaimed === undefined) {
|
|
327
|
+
cursor.lost = true;
|
|
328
|
+
return yield* lostError(stack, stage);
|
|
329
|
+
}
|
|
330
|
+
cursor.version = reclaimed;
|
|
331
|
+
return;
|
|
299
332
|
}
|
|
300
333
|
cursor.version = existing.version;
|
|
301
334
|
}),
|
|
@@ -311,6 +344,7 @@ export const makeBucketState = (options: BucketStateOptions) =>
|
|
|
311
344
|
)(
|
|
312
345
|
Effect.gen(function* () {
|
|
313
346
|
cursor.lost = true;
|
|
347
|
+
heldInProcess.delete(token);
|
|
314
348
|
// Read the version we actually hold. A refresh that landed
|
|
315
349
|
// after the cursor was last stored would make a release
|
|
316
350
|
// against the old version a no-op, and the lease would stay.
|
|
@@ -393,14 +427,12 @@ export const makeBucketState = (options: BucketStateOptions) =>
|
|
|
393
427
|
verifyHeldLeases.pipe(Effect.andThen(listChildren(`${prefix}${stack}/`))),
|
|
394
428
|
get: (request) => guarded(request, readJson<PersistedState>(resourceKey(request))),
|
|
395
429
|
getReplacedResources: Effect.fn(function* (request) {
|
|
396
|
-
return (yield* Effect.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}),
|
|
403
|
-
),
|
|
430
|
+
return (yield* Effect.forEach(yield* state.list(request), (fqn) =>
|
|
431
|
+
state.get({
|
|
432
|
+
stack: request.stack,
|
|
433
|
+
stage: request.stage,
|
|
434
|
+
fqn,
|
|
435
|
+
}),
|
|
404
436
|
)).filter((r) => r?.status === "replaced");
|
|
405
437
|
}),
|
|
406
438
|
set: (request) =>
|
package/src/State/LocalState.ts
CHANGED
|
@@ -110,7 +110,7 @@ export const makeLocalState = () =>
|
|
|
110
110
|
|
|
111
111
|
const ensure = (dir: string) =>
|
|
112
112
|
created.has(dir)
|
|
113
|
-
? Effect.
|
|
113
|
+
? Effect.void
|
|
114
114
|
: fs
|
|
115
115
|
.makeDirectory(dir, { recursive: true })
|
|
116
116
|
.pipe(Effect.tap(() => Effect.sync(() => created.add(dir))));
|
|
@@ -134,14 +134,12 @@ export const makeLocalState = () =>
|
|
|
134
134
|
recover,
|
|
135
135
|
),
|
|
136
136
|
getReplacedResources: Effect.fn(function* (request) {
|
|
137
|
-
return (yield* Effect.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}),
|
|
144
|
-
),
|
|
137
|
+
return (yield* Effect.forEach(yield* state.list(request), (fqn) =>
|
|
138
|
+
state.get({
|
|
139
|
+
stack: request.stack,
|
|
140
|
+
stage: request.stage,
|
|
141
|
+
fqn,
|
|
142
|
+
}),
|
|
145
143
|
)).filter((r) => r?.status === "replaced");
|
|
146
144
|
}),
|
|
147
145
|
set: (request) =>
|
|
@@ -28,10 +28,17 @@ export interface StoreRef {
|
|
|
28
28
|
readonly name?: string;
|
|
29
29
|
/** e.g. `Cloudflare State Store 'alchemy-state-store'`. */
|
|
30
30
|
readonly label: string;
|
|
31
|
+
/**
|
|
32
|
+
* Only the stack's config describes this store, e.g. a custom Worker or
|
|
33
|
+
* bucket name or a pinned account, so `--backend` can't address it.
|
|
34
|
+
*/
|
|
35
|
+
readonly configured?: boolean;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
const required = (store: StoreRef, action: "bootstrap" | "upgrade", problem: string) => {
|
|
34
|
-
const command =
|
|
39
|
+
const command = store.configured
|
|
40
|
+
? "alchemy state bootstrap"
|
|
41
|
+
: `alchemy state bootstrap --backend ${store.backend}${store.name ? ` --name ${store.name}` : ""}`;
|
|
35
42
|
return new StateStoreError({
|
|
36
43
|
message: `${store.label} ${problem}. Run '${command} --profile <your-ci-profile>' first, or pass --yes.`,
|
|
37
44
|
requires: { action, command },
|
|
@@ -57,6 +57,8 @@ interface BaseResourceState {
|
|
|
57
57
|
removalPolicy?: RemovalPolicy["Service"];
|
|
58
58
|
/** Attr-less lookup could recover the predecessor migrated away from this FQN. */
|
|
59
59
|
adoptionBlocked?: "migrated-fqn";
|
|
60
|
+
/** Unresolved props were stripped from this attr-less checkpoint; they cannot identify it. */
|
|
61
|
+
propsIncomplete?: true;
|
|
60
62
|
/**
|
|
61
63
|
* The {@link ProviderMode} this resource was last reconciled with.
|
|
62
64
|
*
|
package/src/State/State.ts
CHANGED
|
@@ -131,4 +131,34 @@ export interface StateService {
|
|
|
131
131
|
stage: string;
|
|
132
132
|
value: unknown;
|
|
133
133
|
}): Effect.Effect<unknown, StateStoreError, never>;
|
|
134
|
+
/**
|
|
135
|
+
* Move stages into this store from the one it replaces, or back with
|
|
136
|
+
* `rollback`, for stores that replace another. Idempotent: run it again
|
|
137
|
+
* to finish what a failure or a blocked stage left.
|
|
138
|
+
*/
|
|
139
|
+
migrate?(
|
|
140
|
+
request: StateMigrationRequest,
|
|
141
|
+
): Effect.Effect<ReadonlyArray<StateMigration>, StateStoreError, never>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Which stages {@link StateService.migrate} moves. */
|
|
145
|
+
export interface StateMigrationRequest {
|
|
146
|
+
/** Only this stack's stages. */
|
|
147
|
+
readonly stack?: string;
|
|
148
|
+
/** Only stages of this name. */
|
|
149
|
+
readonly stage?: string;
|
|
150
|
+
/** Move stages back to the store this one replaces. */
|
|
151
|
+
readonly rollback?: boolean;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** What {@link StateService.migrate} did with one stage. */
|
|
155
|
+
export interface StateMigration {
|
|
156
|
+
readonly stack: string;
|
|
157
|
+
readonly stage: string;
|
|
158
|
+
/** e.g. `migrated`, `already-migrated`, `rolled-back`, `blocked` or `failed`. */
|
|
159
|
+
readonly status: string;
|
|
160
|
+
/** Records moved. */
|
|
161
|
+
readonly records?: number;
|
|
162
|
+
/** Why a stage was not moved. */
|
|
163
|
+
readonly reason?: string;
|
|
134
164
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Duration from "effect/Duration";
|
|
2
2
|
import * as Redacted from "effect/Redacted";
|
|
3
3
|
import { isResource } from "../Resource.ts";
|
|
4
|
+
import { base64ToBytes, bytesToBase64 } from "../Util/base64.ts";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* JSON marker used to tag a `Redacted<T>` value when writing state.
|
|
@@ -27,6 +28,14 @@ export const DURATION_MARKER = "__duration__";
|
|
|
27
28
|
*/
|
|
28
29
|
export const DATE_MARKER = "__date__";
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* JSON marker used to tag a byte array (`Uint8Array`) when writing state.
|
|
33
|
+
* The reviver rebuilds a real `Uint8Array`, so a byte-valued prop (a WAF
|
|
34
|
+
* byte-match string, a zip) read back out of persisted state is the same
|
|
35
|
+
* value the program declares — instead of an index-keyed object.
|
|
36
|
+
*/
|
|
37
|
+
export const BYTES_MARKER = "__bytes__";
|
|
38
|
+
|
|
30
39
|
const decodeDate = (encoded: unknown): Date | undefined => {
|
|
31
40
|
if (typeof encoded !== "string") return undefined;
|
|
32
41
|
const date = new Date(encoded);
|
|
@@ -103,6 +112,9 @@ export const encodeState = (value: unknown): unknown => {
|
|
|
103
112
|
if (value instanceof Date) {
|
|
104
113
|
return { [DATE_MARKER]: value.toJSON() };
|
|
105
114
|
}
|
|
115
|
+
if (value instanceof Uint8Array) {
|
|
116
|
+
return { [BYTES_MARKER]: bytesToBase64(value) };
|
|
117
|
+
}
|
|
106
118
|
if (isResource(value)) {
|
|
107
119
|
return {
|
|
108
120
|
id: value.LogicalId,
|
|
@@ -144,6 +156,13 @@ export const reviveState = (_key: string, value: unknown): unknown => {
|
|
|
144
156
|
const decoded = decodeDate(obj[DATE_MARKER]);
|
|
145
157
|
if (decoded !== undefined) return decoded;
|
|
146
158
|
}
|
|
159
|
+
if (
|
|
160
|
+
BYTES_MARKER in obj &&
|
|
161
|
+
Object.keys(obj).length === 1 &&
|
|
162
|
+
typeof obj[BYTES_MARKER] === "string"
|
|
163
|
+
) {
|
|
164
|
+
return base64ToBytes(obj[BYTES_MARKER]);
|
|
165
|
+
}
|
|
147
166
|
}
|
|
148
167
|
return value;
|
|
149
168
|
};
|
|
@@ -171,6 +190,9 @@ export const reviveStateRecursive = (value: unknown): unknown => {
|
|
|
171
190
|
const decoded = decodeDate(obj[DATE_MARKER]);
|
|
172
191
|
if (decoded !== undefined) return decoded;
|
|
173
192
|
}
|
|
193
|
+
if (keys.length === 1 && keys[0] === BYTES_MARKER && typeof obj[BYTES_MARKER] === "string") {
|
|
194
|
+
return base64ToBytes(obj[BYTES_MARKER]);
|
|
195
|
+
}
|
|
174
196
|
const result: Record<string, unknown> = {};
|
|
175
197
|
for (const [k, v] of Object.entries(obj)) {
|
|
176
198
|
result[k] = reviveStateRecursive(v);
|
package/src/State/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// PostgresState is intentionally NOT re-exported here: this barrel is pulled
|
|
2
2
|
// into worker bundles via the core engine, and PostgresState loads
|
|
3
|
-
// "@effect/sql-pg"
|
|
4
|
-
// instead: `@alchemy.run/sql/PostgresState`.
|
|
3
|
+
// "@effect/sql-pg", which opens sockets through Node's `net`/`tls`.
|
|
4
|
+
// Deep-import it instead: `@alchemy.run/sql/PostgresState`.
|
|
5
5
|
export * from "./Export.ts";
|
|
6
6
|
export * from "./HttpStateApi.ts";
|
|
7
7
|
export * from "./HttpStateStore.ts";
|