home-hosted 0.11.0 → 0.13.0
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/README.md +319 -628
- package/dist/chunks/archive-DP-XQR8X.js +352 -0
- package/dist/chunks/archive-DP-XQR8X.js.map +1 -0
- package/dist/chunks/atomic-C1PfJpE7.js +26 -0
- package/dist/chunks/atomic-C1PfJpE7.js.map +1 -0
- package/dist/chunks/backup-CZcVca2a.js +822 -0
- package/dist/chunks/backup-CZcVca2a.js.map +1 -0
- package/dist/chunks/backups-CFRaWe_m.js +4691 -0
- package/dist/chunks/backups-CFRaWe_m.js.map +1 -0
- package/dist/chunks/config-text-DifCHhnz.js +50 -0
- package/dist/chunks/config-text-DifCHhnz.js.map +1 -0
- package/dist/chunks/contracts-CMBD1TF9.js +2230 -0
- package/dist/chunks/contracts-CMBD1TF9.js.map +1 -0
- package/dist/chunks/daemon-log-BVj8cDEo.js +241 -0
- package/dist/chunks/daemon-log-BVj8cDEo.js.map +1 -0
- package/dist/chunks/daemon-qKVECISl.js +247 -0
- package/dist/chunks/daemon-qKVECISl.js.map +1 -0
- package/dist/chunks/docker-Cy9Lyvda.js +437 -0
- package/dist/chunks/docker-Cy9Lyvda.js.map +1 -0
- package/dist/chunks/down-pKbGCW9d.js +383 -0
- package/dist/chunks/down-pKbGCW9d.js.map +1 -0
- package/dist/chunks/init-BZ7hK9Vf.js +276 -0
- package/dist/chunks/init-BZ7hK9Vf.js.map +1 -0
- package/dist/chunks/last-stop-C-BXz_XI.js +53 -0
- package/dist/chunks/last-stop-C-BXz_XI.js.map +1 -0
- package/dist/chunks/layout-DwTtmund.js +24 -0
- package/dist/chunks/layout-DwTtmund.js.map +1 -0
- package/dist/chunks/lazy-Ce5zEAq1.js +66 -0
- package/dist/chunks/lazy-Ce5zEAq1.js.map +1 -0
- package/dist/chunks/log-buffer-Dy9HHDMD.js +414 -0
- package/dist/chunks/log-buffer-Dy9HHDMD.js.map +1 -0
- package/dist/chunks/logger-B5U4GD3j.js +13 -0
- package/dist/chunks/logger-B5U4GD3j.js.map +1 -0
- package/dist/chunks/logs---TI_bxM.js +267 -0
- package/dist/chunks/logs---TI_bxM.js.map +1 -0
- package/dist/chunks/migrate-Cfoq-Vgh.js +155 -0
- package/dist/chunks/migrate-Cfoq-Vgh.js.map +1 -0
- package/dist/chunks/nanny-B-Eu0sFW.js +132 -0
- package/dist/chunks/nanny-B-Eu0sFW.js.map +1 -0
- package/dist/chunks/nanny-BtWfy0QH.js +1167 -0
- package/dist/chunks/nanny-BtWfy0QH.js.map +1 -0
- package/dist/chunks/nanny-ChMtq1Zl.js +39 -0
- package/dist/chunks/nanny-ChMtq1Zl.js.map +1 -0
- package/dist/chunks/nanny-sweep-DErnlPY1.js +105 -0
- package/dist/chunks/nanny-sweep-DErnlPY1.js.map +1 -0
- package/dist/chunks/nearest-6KgQEDUe.js +41 -0
- package/dist/chunks/nearest-6KgQEDUe.js.map +1 -0
- package/dist/chunks/parse-DhmG26fI.js +383 -0
- package/dist/chunks/parse-DhmG26fI.js.map +1 -0
- package/dist/chunks/paths-CGlGDrOU.js +206 -0
- package/dist/chunks/paths-CGlGDrOU.js.map +1 -0
- package/dist/chunks/port-B8WBTRMk.js +333 -0
- package/dist/chunks/port-B8WBTRMk.js.map +1 -0
- package/dist/chunks/restart-Des4DrAN.js +92 -0
- package/dist/chunks/restart-Des4DrAN.js.map +1 -0
- package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/chunks/schema-B240VXcV.js +103 -0
- package/dist/chunks/schema-B240VXcV.js.map +1 -0
- package/dist/chunks/secrets-BieELnZh.js +562 -0
- package/dist/chunks/secrets-BieELnZh.js.map +1 -0
- package/dist/chunks/server-Bge2r2qQ.js +169 -0
- package/dist/chunks/server-Bge2r2qQ.js.map +1 -0
- package/dist/chunks/server-ids-DRuNLVCV.js +32 -0
- package/dist/chunks/server-ids-DRuNLVCV.js.map +1 -0
- package/dist/chunks/set-password-D5vZqqSX.js +43 -0
- package/dist/chunks/set-password-D5vZqqSX.js.map +1 -0
- package/dist/chunks/set-token-obPiEJYk.js +78 -0
- package/dist/chunks/set-token-obPiEJYk.js.map +1 -0
- package/dist/chunks/settings-xu-XTfWg.js +423 -0
- package/dist/chunks/settings-xu-XTfWg.js.map +1 -0
- package/dist/chunks/setup-temp-CAN4_bA-.js +150 -0
- package/dist/chunks/setup-temp-CAN4_bA-.js.map +1 -0
- package/dist/chunks/shape-DnTKzjQ2.js +24 -0
- package/dist/chunks/shape-DnTKzjQ2.js.map +1 -0
- package/dist/chunks/src-BtWMFmzZ.js +12338 -0
- package/dist/chunks/src-BtWMFmzZ.js.map +1 -0
- package/dist/chunks/status-DT1EsA-B.js +123 -0
- package/dist/chunks/status-DT1EsA-B.js.map +1 -0
- package/dist/chunks/ui-D562aqw5.js +325 -0
- package/dist/chunks/ui-D562aqw5.js.map +1 -0
- package/dist/chunks/ui-dir-CsU3uLNV.js +39 -0
- package/dist/chunks/ui-dir-CsU3uLNV.js.map +1 -0
- package/dist/chunks/ui-release-DKzVvlLd.js +312 -0
- package/dist/chunks/ui-release-DKzVvlLd.js.map +1 -0
- package/dist/chunks/ui-revert-EkBBwRTt.js +27 -0
- package/dist/chunks/ui-revert-EkBBwRTt.js.map +1 -0
- package/dist/chunks/ui-switch-BnZTdMDd.js +150 -0
- package/dist/chunks/ui-switch-BnZTdMDd.js.map +1 -0
- package/dist/chunks/ui-update-_xryLYxw.js +272 -0
- package/dist/chunks/ui-update-_xryLYxw.js.map +1 -0
- package/dist/chunks/up-Pdz-l6IH.js +210 -0
- package/dist/chunks/up-Pdz-l6IH.js.map +1 -0
- package/dist/chunks/usage-DFrCVXpT.js +111 -0
- package/dist/chunks/usage-DFrCVXpT.js.map +1 -0
- package/dist/chunks/workspaces-DYcfvKV_.js +229 -0
- package/dist/chunks/workspaces-DYcfvKV_.js.map +1 -0
- package/dist/chunks/wsl-temperature-BiCI4iK6.js +322 -0
- package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +1 -0
- package/dist/cli.js +441 -25418
- package/dist/cli.js.map +1 -1
- package/dist/client.js +144 -0
- package/dist/client.js.map +1 -0
- package/dist/types/api/acme.d.ts +24 -0
- package/dist/types/api/auth/$.routes.d.ts +103 -0
- package/dist/types/api/backups.d.ts +184 -0
- package/dist/types/api/control.d.ts +470 -0
- package/dist/types/api/ddns.d.ts +432 -0
- package/dist/types/api/events.d.ts +22 -0
- package/dist/types/api/health.d.ts +28 -0
- package/dist/types/api/logs.d.ts +95 -0
- package/dist/types/api/metrics.d.ts +21 -0
- package/dist/types/api/notifications.d.ts +141 -0
- package/dist/types/api/proxy.d.ts +1128 -0
- package/dist/types/api/servers/$.routes.d.ts +1318 -0
- package/dist/types/api/settings.d.ts +642 -0
- package/dist/types/api/state.d.ts +498 -0
- package/dist/types/api/static.d.ts +11 -0
- package/dist/types/api/tls.d.ts +112 -0
- package/dist/types/api/workspaces/$.routes.d.ts +797 -0
- package/dist/types/api/wsl-temperature.d.ts +113 -0
- package/dist/types/app.d.ts +6095 -0
- package/dist/types/cli/args.d.ts +75 -0
- package/dist/types/cli/backup-offline.d.ts +23 -0
- package/dist/types/cli/backup.d.ts +86 -0
- package/dist/types/cli/down.d.ts +80 -0
- package/dist/types/cli/init.d.ts +60 -0
- package/dist/types/cli/io.d.ts +65 -0
- package/dist/types/cli/logs.d.ts +76 -0
- package/dist/types/cli/migrate.d.ts +33 -0
- package/dist/types/cli/nanny.d.ts +19 -0
- package/dist/types/cli/nearest.d.ts +10 -0
- package/dist/types/cli/restart.d.ts +41 -0
- package/dist/types/cli/server.d.ts +68 -0
- package/dist/types/cli/set-password.d.ts +14 -0
- package/dist/types/cli/set-token.d.ts +21 -0
- package/dist/types/cli/setup-temp.d.ts +65 -0
- package/dist/types/cli/status.d.ts +14 -0
- package/dist/types/cli/ui-revert.d.ts +3 -0
- package/dist/types/cli/ui-switch.d.ts +27 -0
- package/dist/types/cli/ui-update.d.ts +72 -0
- package/dist/types/cli/up.d.ts +96 -0
- package/dist/types/cli/usage.d.ts +23 -0
- package/dist/types/cli.d.ts +12 -0
- package/dist/types/client.d.ts +11891 -0
- package/dist/types/config/layout.d.ts +11 -0
- package/dist/types/config/migrations.d.ts +69 -0
- package/dist/types/config/parse.d.ts +54 -0
- package/dist/types/config/patch.d.ts +20 -0
- package/dist/types/config/schema.d.ts +318 -0
- package/dist/types/config/secret-parts.d.ts +48 -0
- package/dist/types/config/secrets.d.ts +208 -0
- package/dist/types/config/seed.d.ts +30 -0
- package/dist/types/config/server-ids.d.ts +14 -0
- package/dist/types/config/settings.d.ts +120 -0
- package/dist/types/config/store.d.ts +145 -0
- package/dist/types/config/workspaces.d.ts +99 -0
- package/dist/types/helpers/action-result.d.ts +46 -0
- package/dist/types/helpers/atomic.d.ts +9 -0
- package/dist/types/helpers/backoff.d.ts +7 -0
- package/dist/types/helpers/bind.d.ts +16 -0
- package/dist/types/helpers/config-text.d.ts +23 -0
- package/dist/types/helpers/cookies.d.ts +19 -0
- package/dist/types/helpers/copy-tree.d.ts +20 -0
- package/dist/types/helpers/daemon-log.d.ts +45 -0
- package/dist/types/helpers/daemon.d.ts +135 -0
- package/dist/types/helpers/deferred.d.ts +7 -0
- package/dist/types/helpers/env-file.d.ts +20 -0
- package/dist/types/helpers/error.d.ts +26 -0
- package/dist/types/helpers/event-stream.d.ts +21 -0
- package/dist/types/helpers/factory.d.ts +6 -0
- package/dist/types/helpers/last-stop.d.ts +20 -0
- package/dist/types/helpers/logger.d.ts +7 -0
- package/dist/types/helpers/open.d.ts +2 -0
- package/dist/types/helpers/openapi.d.ts +34 -0
- package/dist/types/helpers/paths.d.ts +112 -0
- package/dist/types/helpers/restore-lock.d.ts +32 -0
- package/dist/types/helpers/runtime.d.ts +18 -0
- package/dist/types/helpers/secret-compare.d.ts +13 -0
- package/dist/types/helpers/shell.d.ts +19 -0
- package/dist/types/helpers/sse.d.ts +23 -0
- package/dist/types/helpers/template.d.ts +8 -0
- package/dist/types/helpers/ui-dir.d.ts +11 -0
- package/dist/types/helpers/utf8-chunks.d.ts +15 -0
- package/dist/types/helpers/validate.d.ts +7 -0
- package/dist/types/helpers/validator.d.ts +12 -0
- package/dist/types/helpers/version.d.ts +10 -0
- package/dist/types/helpers/workspace.d.ts +25 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/middleware/auth.d.ts +53 -0
- package/dist/types/middleware/host.d.ts +29 -0
- package/dist/types/middleware/loopback.d.ts +18 -0
- package/dist/types/openapi-reference.d.ts +22 -0
- package/dist/types/openapi.d.ts +34 -0
- package/dist/types/providers/archive.d.ts +54 -0
- package/dist/types/providers/backup-hook.d.ts +34 -0
- package/dist/types/providers/ddns/cloudflare.d.ts +2 -0
- package/dist/types/providers/ddns/desec.d.ts +2 -0
- package/dist/types/providers/ddns/digitalocean.d.ts +2 -0
- package/dist/types/providers/ddns/duckdns.d.ts +2 -0
- package/dist/types/providers/ddns/dyndns2.d.ts +15 -0
- package/dist/types/providers/ddns/dynu.d.ts +2 -0
- package/dist/types/providers/ddns/freedns.d.ts +2 -0
- package/dist/types/providers/ddns/gandi.d.ts +2 -0
- package/dist/types/providers/ddns/godaddy.d.ts +2 -0
- package/dist/types/providers/ddns/henet.d.ts +3 -0
- package/dist/types/providers/ddns/index.d.ts +12 -0
- package/dist/types/providers/ddns/ip.d.ts +27 -0
- package/dist/types/providers/ddns/namecheap-api.d.ts +13 -0
- package/dist/types/providers/ddns/namecheap.d.ts +6 -0
- package/dist/types/providers/ddns/noip.d.ts +2 -0
- package/dist/types/providers/ddns/porkbun.d.ts +2 -0
- package/dist/types/providers/ddns/spaceship.d.ts +7 -0
- package/dist/types/providers/ddns/types.d.ts +98 -0
- package/dist/types/providers/ddns/zone.d.ts +11 -0
- package/dist/types/providers/docker.d.ts +117 -0
- package/dist/types/providers/entry-state.d.ts +15 -0
- package/dist/types/providers/health-check.d.ts +27 -0
- package/dist/types/providers/host.d.ts +147 -0
- package/dist/types/providers/identity.d.ts +54 -0
- package/dist/types/providers/log-tail.d.ts +56 -0
- package/dist/types/providers/nanny-sweep.d.ts +54 -0
- package/dist/types/providers/nanny.d.ts +104 -0
- package/dist/types/providers/port.d.ts +142 -0
- package/dist/types/providers/proc.d.ts +125 -0
- package/dist/types/providers/process.d.ts +78 -0
- package/dist/types/providers/proxy/caddy.d.ts +2 -0
- package/dist/types/providers/proxy/index.d.ts +7 -0
- package/dist/types/providers/proxy/types.d.ts +54 -0
- package/dist/types/providers/server-vars.d.ts +4 -0
- package/dist/types/providers/telegram.d.ts +74 -0
- package/dist/types/providers/ui-release.d.ts +113 -0
- package/dist/types/providers/webhook.d.ts +64 -0
- package/dist/types/providers/wsl-temperature.d.ts +65 -0
- package/dist/types/services/acme-challenge.d.ts +44 -0
- package/dist/types/services/auth.d.ts +177 -0
- package/dist/types/services/backups.d.ts +476 -0
- package/dist/types/services/config-watch.d.ts +40 -0
- package/dist/types/services/control-server.d.ts +58 -0
- package/dist/types/services/ddns.d.ts +72 -0
- package/dist/types/services/dependencies.d.ts +21 -0
- package/dist/types/services/events.d.ts +17 -0
- package/dist/types/services/exposure.d.ts +86 -0
- package/dist/types/services/history.d.ts +37 -0
- package/dist/types/services/host-monitor.d.ts +33 -0
- package/dist/types/services/init.d.ts +71 -0
- package/dist/types/services/log-buffer.d.ts +39 -0
- package/dist/types/services/log-files.d.ts +77 -0
- package/dist/types/services/log-relay.d.ts +35 -0
- package/dist/types/services/nanny.d.ts +14 -0
- package/dist/types/services/notifications.d.ts +124 -0
- package/dist/types/services/panel.d.ts +213 -0
- package/dist/types/services/proxy-certificates/certificates.d.ts +116 -0
- package/dist/types/services/proxy-config.d.ts +83 -0
- package/dist/types/services/proxy.d.ts +431 -0
- package/dist/types/services/state.d.ts +38 -0
- package/dist/types/services/supervisor/compose.d.ts +17 -0
- package/dist/types/services/supervisor/entry.d.ts +149 -0
- package/dist/types/services/supervisor/health.d.ts +56 -0
- package/dist/types/services/supervisor/output.d.ts +126 -0
- package/dist/types/services/supervisor/pending-load.d.ts +6 -0
- package/dist/types/services/supervisor/persistent.d.ts +58 -0
- package/dist/types/services/supervisor/port-preflight.d.ts +45 -0
- package/dist/types/services/supervisor/records.d.ts +118 -0
- package/dist/types/services/supervisor/spawn.d.ts +15 -0
- package/dist/types/services/supervisor/view.d.ts +4 -0
- package/dist/types/services/supervisor.d.ts +145 -0
- package/dist/types/services/tls.d.ts +48 -0
- package/dist/types/services/ui-update.d.ts +44 -0
- package/dist/types/services/ui.d.ts +50 -0
- package/dist/types/shared/action-outcome.d.ts +25 -0
- package/dist/types/shared/api-client.d.ts +351 -0
- package/dist/types/shared/backup-scope.d.ts +167 -0
- package/dist/types/shared/clone.d.ts +14 -0
- package/dist/types/shared/contracts.d.ts +4175 -0
- package/dist/types/shared/cpu-scale.d.ts +25 -0
- package/dist/types/shared/ddns-form.d.ts +75 -0
- package/dist/types/shared/endpoint.d.ts +8 -0
- package/dist/types/shared/error-message.d.ts +8 -0
- package/dist/types/shared/fields.d.ts +21 -0
- package/dist/types/shared/form-repair.d.ts +6 -0
- package/dist/types/shared/generated.d.ts +26 -0
- package/dist/types/shared/host-readings.d.ts +185 -0
- package/dist/types/shared/lazy.d.ts +4 -0
- package/dist/types/shared/live-frames.d.ts +22 -0
- package/dist/types/shared/live-series.d.ts +21 -0
- package/dist/types/shared/live-store.d.ts +72 -0
- package/dist/types/shared/patch-diff.d.ts +105 -0
- package/dist/types/shared/probe-latency.d.ts +25 -0
- package/dist/types/shared/proxy-form.d.ts +184 -0
- package/dist/types/shared/server-attention.d.ts +37 -0
- package/dist/types/shared/server-form.d.ts +121 -0
- package/dist/types/shared/server-key.d.ts +13 -0
- package/dist/types/shared/server-readings.d.ts +55 -0
- package/dist/types/shared/server-url.d.ts +43 -0
- package/dist/types/shared/shape.d.ts +17 -0
- package/dist/types/shared/stream-access.d.ts +20 -0
- package/dist/types/shared/ui-format.d.ts +89 -0
- package/docs/API.md +209 -0
- package/docs/BACKUPS.md +117 -0
- package/docs/CLI.md +95 -0
- package/docs/DDNS.md +11 -1
- package/docs/NOTIFICATIONS.md +7 -1
- package/docs/REVERSE_PROXY.md +9 -3
- package/docs/SECURITY.md +93 -0
- package/docs/SERVERS.md +141 -34
- package/docs/UI_CREATION.md +91 -291
- package/docs/demo/blank-host-restore.sh +4 -3
- package/package.json +22 -14
- package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +1 -0
- package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +1 -0
- package/uis/stock/dist/assets/LogViewer-DIliXy62.js +1 -0
- package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +1 -0
- package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +39 -0
- package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +1 -0
- package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +2 -0
- package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +1 -0
- package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +2 -0
- package/uis/stock/dist/assets/de-BRITeb0H.js +1 -0
- package/uis/stock/dist/assets/es-B2zIEssV.js +1 -0
- package/uis/stock/dist/assets/fr-s0ZOBEqh.js +1 -0
- package/uis/stock/dist/assets/index-C1MehbKy.css +2 -0
- package/uis/stock/dist/assets/index-CnBN54wF.js +15 -0
- package/uis/stock/dist/assets/ja-CU7MR85V.js +1 -0
- package/uis/stock/dist/assets/ko-tL5Me6d-.js +1 -0
- package/uis/stock/dist/assets/ru-92yrvkNJ.js +1 -0
- package/uis/stock/dist/assets/vi-CzvY16k2.js +1 -0
- package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +1 -0
- package/uis/stock/dist/index.html +3 -2
- package/uis/stock/dist/ui.json +3 -3
- package/docs/RESTORE_DEMO.md +0 -306
- package/uis/stock/dist/assets/de-0YLueNal.js +0 -1
- package/uis/stock/dist/assets/es-FCHhRmn2.js +0 -1
- package/uis/stock/dist/assets/fr-C69Z8o0z.js +0 -1
- package/uis/stock/dist/assets/index-Cok5msAO.css +0 -2
- package/uis/stock/dist/assets/index-KdyqrVv8.js +0 -53
- package/uis/stock/dist/assets/ja-Chz9YOqR.js +0 -1
- package/uis/stock/dist/assets/ko-CtXZ2x1l.js +0 -1
- package/uis/stock/dist/assets/ru-D_jE64xN.js +0 -1
- package/uis/stock/dist/assets/vi-sxSffss7.js +0 -1
- package/uis/stock/dist/assets/zh-CN-ChTpf29X.js +0 -1
|
@@ -0,0 +1,822 @@
|
|
|
1
|
+
import { C as errorMessage, _ as prompt, c as bold, d as dim, f as fail, g as paint, h as invocation, m as green } from "../cli.js";
|
|
2
|
+
import { C as tlsDir, N as workspacesPath, a as globalSecretsPath, c as hhDir, i as ensureStateDir, o as globalSettingsPath, x as resolveUserPath } from "./paths-CGlGDrOU.js";
|
|
3
|
+
import { n as GlobalSettingsStore } from "./settings-xu-XTfWg.js";
|
|
4
|
+
import { _ as entryStatePath, a as unknownBackupIds, b as WorkspaceStore, n as buildBackupSources, t as BackupService, v as readEntryState, y as writeEntryState } from "./backups-CFRaWe_m.js";
|
|
5
|
+
import { n as WorkspaceRegistry } from "./workspaces-DYcfvKV_.js";
|
|
6
|
+
import { _ as readNannyState } from "./nanny-BtWfy0QH.js";
|
|
7
|
+
import process from "node:process";
|
|
8
|
+
import { defineCommand } from "citty";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
//#region src/cli/backup-offline.ts
|
|
12
|
+
/**
|
|
13
|
+
* A backup service for a host whose panel is **not running**.
|
|
14
|
+
*
|
|
15
|
+
* `backup` used to need the daemon because the service is built inside it, so backing up or
|
|
16
|
+
* restoring meant leaving the panel up — the opposite of what someone migrating a machine wants.
|
|
17
|
+
* Nothing in the service needs the daemon: every source is a file, and the one live fact it wants
|
|
18
|
+
* (which entries are running) is on disk as the nanny state each entry writes.
|
|
19
|
+
*
|
|
20
|
+
* This builds the same sources the panel does, through the same `buildBackupSources`, so an offline
|
|
21
|
+
* archive cannot differ from an online one. `runningServers` is answered from `.state/*.json` rather
|
|
22
|
+
* than from supervisor views: a *persistent* entry keeps running when the panel stops, so "no panel"
|
|
23
|
+
* does not mean "nothing is running", and the restore warning has to keep telling the truth.
|
|
24
|
+
*/
|
|
25
|
+
/** The workspace ids this host knows, from the registry on disk. */
|
|
26
|
+
function workspaceIds(registry) {
|
|
27
|
+
return registry.all().map((workspace) => ({
|
|
28
|
+
id: workspace.id,
|
|
29
|
+
label: workspace.label
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Entries whose nanny is alive right now, read from the state files they rewrite.
|
|
34
|
+
*
|
|
35
|
+
* Every path comes from `hhDir`, never from the module-level helpers: those resolve from this
|
|
36
|
+
* process's own `HHOSTED_HOME`, so a caller passing `--home` elsewhere would read a different host's
|
|
37
|
+
* state — which is exactly how a test came to depend on the developer's real `~/.home-hosted`.
|
|
38
|
+
*/
|
|
39
|
+
function runningFromDisk(hhDir, ids) {
|
|
40
|
+
const running = [];
|
|
41
|
+
for (const workspaceId of ids) {
|
|
42
|
+
const stateDir = path.join(hhDir, workspaceId, ".state");
|
|
43
|
+
let names;
|
|
44
|
+
try {
|
|
45
|
+
names = fs.readdirSync(stateDir);
|
|
46
|
+
} catch {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
for (const name of names) {
|
|
50
|
+
if (!name.endsWith(".json") || name.endsWith(".spec.json") || name.endsWith(".tmp")) continue;
|
|
51
|
+
const serverId = name.replace(/\.run\.json$|\.json$/, "");
|
|
52
|
+
if (serverId.length === 0) continue;
|
|
53
|
+
const state = readNannyState(path.join(stateDir, name));
|
|
54
|
+
if (state === null) continue;
|
|
55
|
+
if (Date.now() - state.heartbeatAt <= 3e4) running.push({
|
|
56
|
+
workspaceId,
|
|
57
|
+
serverId
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return running;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Build the service against this host's files.
|
|
65
|
+
*
|
|
66
|
+
* `ensureWorkspace` and `onRestored` are the two panel hooks, and both are deliberately absent: with
|
|
67
|
+
* no daemon there is nothing to reload, and a restore that brings a workspace this host lacks leaves
|
|
68
|
+
* it on disk for the next `up` to pick up. The registry is written by the service itself, which is
|
|
69
|
+
* what makes that work.
|
|
70
|
+
*/
|
|
71
|
+
function createOfflineBackup(options = {}) {
|
|
72
|
+
const hhDir$1 = options.hhDir ?? hhDir;
|
|
73
|
+
const settingsPath = options.settingsPath ?? globalSettingsPath;
|
|
74
|
+
const registryPath = path.join(hhDir$1, path.basename(workspacesPath));
|
|
75
|
+
const settings = new GlobalSettingsStore(settingsPath);
|
|
76
|
+
settings.load({ write: false });
|
|
77
|
+
const registry = new WorkspaceRegistry(registryPath);
|
|
78
|
+
registry.load({ write: false });
|
|
79
|
+
const workspaces = workspaceIds(registry);
|
|
80
|
+
const ids = workspaces.map((workspace) => workspace.id);
|
|
81
|
+
const loaded = workspaces.map((workspace) => {
|
|
82
|
+
const dir = path.join(hhDir$1, workspace.id);
|
|
83
|
+
const settingsPath = path.join(dir, "settings.json");
|
|
84
|
+
const serversPath = path.join(dir, "servers.config.json");
|
|
85
|
+
const secretsPath = path.join(dir, ".secrets.json");
|
|
86
|
+
const store = new WorkspaceStore(workspace.id, settingsPath, serversPath);
|
|
87
|
+
store.load({ write: false });
|
|
88
|
+
return {
|
|
89
|
+
id: workspace.id,
|
|
90
|
+
label: workspace.label,
|
|
91
|
+
settingsPath,
|
|
92
|
+
serversPath,
|
|
93
|
+
secretsPath,
|
|
94
|
+
servers: store.servers
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
service: new BackupService({
|
|
99
|
+
dataRoot: hhDir$1,
|
|
100
|
+
getConfig: () => settings.backups,
|
|
101
|
+
/**
|
|
102
|
+
* Register a workspace the archive brought.
|
|
103
|
+
*
|
|
104
|
+
* A panel-only hook in the running case, because the panel creates the runtime itself. With no
|
|
105
|
+
* panel there is nobody to do it, so the registry is written here — otherwise a restored
|
|
106
|
+
* workspace's files land on disk unreachable, and the next `up` never looks at them.
|
|
107
|
+
*/
|
|
108
|
+
/**
|
|
109
|
+
* Record the staged dump so the entry's next `up` loads it.
|
|
110
|
+
*
|
|
111
|
+
* Nothing is running to hold it in memory, so this is the only path that matters offline: the
|
|
112
|
+
* panel is started afterwards, reads the entry state, and runs the hook.
|
|
113
|
+
*/
|
|
114
|
+
onLoadPending: (workspaceId, serverId, dumpDir) => {
|
|
115
|
+
const dir = path.join(hhDir$1, workspaceId, ".state");
|
|
116
|
+
ensureStateDir(dir);
|
|
117
|
+
const statePath = entryStatePath(dir, serverId);
|
|
118
|
+
const persisted = readEntryState(statePath);
|
|
119
|
+
writeEntryState(statePath, {
|
|
120
|
+
...persisted ?? {
|
|
121
|
+
restarts: 0,
|
|
122
|
+
bootstrapDone: false
|
|
123
|
+
},
|
|
124
|
+
pendingLoad: dumpDir
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
ensureWorkspace: (input) => {
|
|
128
|
+
if (registry.has(input.id)) return;
|
|
129
|
+
registry.create(input);
|
|
130
|
+
},
|
|
131
|
+
getSources: () => buildBackupSources({
|
|
132
|
+
globalSettingsPath: settings.path,
|
|
133
|
+
globalSecretsPath: path.join(hhDir$1, path.basename(globalSecretsPath)),
|
|
134
|
+
tlsDir: path.join(hhDir$1, path.basename(tlsDir)),
|
|
135
|
+
registryPath,
|
|
136
|
+
includePaths: settings.backups.includePaths,
|
|
137
|
+
runningServers: () => runningFromDisk(hhDir$1, ids),
|
|
138
|
+
workspaces: loaded
|
|
139
|
+
})
|
|
140
|
+
}),
|
|
141
|
+
workspaceIds: ids,
|
|
142
|
+
runningNow: () => runningFromDisk(hhDir$1, ids)
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/cli/backup.ts
|
|
147
|
+
/**
|
|
148
|
+
* Render plan ids as the tree they already are.
|
|
149
|
+
*
|
|
150
|
+
* Every id is a colon-separated path, so the hierarchy is in the data and the renderer's only job is
|
|
151
|
+
* to show it: one row per prefix, each one level deeper than its parent. Depth is whatever the id
|
|
152
|
+
* says, not a fixed number of columns — `workspace:default:secrets:telegram` sits three deep, and a
|
|
153
|
+
* renderer that assumed two printed it beside its own parent.
|
|
154
|
+
*
|
|
155
|
+
* Both directions print through this, and so does the "what could I act on" list, so the three read
|
|
156
|
+
* alike. A row's note is the panel's own wording, passed through untouched.
|
|
157
|
+
*/
|
|
158
|
+
function printPlanTree(rows, out = (text) => process.stdout.write(text)) {
|
|
159
|
+
const known = new Set(rows.map((row) => row.id));
|
|
160
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
161
|
+
const ensure = (id) => {
|
|
162
|
+
const existing = nodes.get(id);
|
|
163
|
+
if (existing !== void 0) return existing;
|
|
164
|
+
const created = {
|
|
165
|
+
note: null,
|
|
166
|
+
children: /* @__PURE__ */ new Set()
|
|
167
|
+
};
|
|
168
|
+
nodes.set(id, created);
|
|
169
|
+
return created;
|
|
170
|
+
};
|
|
171
|
+
for (const row of rows) {
|
|
172
|
+
const segments = row.id.split(":");
|
|
173
|
+
for (let depth = 1; depth <= segments.length; depth++) {
|
|
174
|
+
const id = segments.slice(0, depth).join(":");
|
|
175
|
+
const node = ensure(id);
|
|
176
|
+
if (depth > 1) ensure(segments.slice(0, depth - 1).join(":")).children.add(id);
|
|
177
|
+
if (depth === segments.length && known.has(row.id)) node.note = row.note ?? null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const roots = [...nodes.keys()].filter((id) => !id.includes(":"));
|
|
181
|
+
const write = (id, depth) => {
|
|
182
|
+
const node = nodes.get(id);
|
|
183
|
+
if (node === void 0) return;
|
|
184
|
+
out(`${" ".repeat(depth)}${depth === 1 ? "" : "- "}${id}${node.note === null ? "" : ` ${dim(`(${node.note})`)}`}\n`);
|
|
185
|
+
for (const child of node.children) write(child, depth + 1);
|
|
186
|
+
};
|
|
187
|
+
for (const root of roots) write(root, 1);
|
|
188
|
+
}
|
|
189
|
+
function human(bytes) {
|
|
190
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
191
|
+
if (bytes < 1048576) return `${Math.round(bytes / 1024)} KB`;
|
|
192
|
+
return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
193
|
+
}
|
|
194
|
+
/** The running panel's record, or a message saying what to do instead. */
|
|
195
|
+
async function livePanel() {
|
|
196
|
+
const daemon = await import("./daemon-qKVECISl.js");
|
|
197
|
+
const runtime = daemon.readRuntime();
|
|
198
|
+
if (runtime === null || !await daemon.runtimeIsAlive(runtime)) {
|
|
199
|
+
if (runtime !== null && await daemon.runtimeIsGone(runtime)) daemon.clearRuntime();
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
return Object.assign(runtime, { request: daemon.requestControl });
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Whether to talk to a panel or work on the files directly.
|
|
206
|
+
*
|
|
207
|
+
* Both paths run the same service, so the only question is who owns the state: a live panel is the
|
|
208
|
+
* authority on what is running, and a stopped one has no opinion to disagree with.
|
|
209
|
+
*/
|
|
210
|
+
async function usesPanel() {
|
|
211
|
+
const daemon = await import("./daemon-qKVECISl.js");
|
|
212
|
+
const runtime = daemon.readRuntime();
|
|
213
|
+
if (runtime === null || !await daemon.runtimeIsAlive(runtime)) return false;
|
|
214
|
+
return (await daemon.probeRuntime(runtime)).reachable;
|
|
215
|
+
}
|
|
216
|
+
/** Exit on a non-200 control answer with the panel's own message, or the status. */
|
|
217
|
+
function failWithAnswer(answer) {
|
|
218
|
+
const body = answer.body;
|
|
219
|
+
if (body?.message !== void 0) fail(body.message);
|
|
220
|
+
fail(`the panel answered ${answer.status}`);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The flag combination, as far as it can be judged without asking the panel.
|
|
224
|
+
*
|
|
225
|
+
* `null` means "neither flag", which only the caller can resolve — it lists the available ids, and
|
|
226
|
+
* that needs a panel. Every other case is decided here, before any lookup, so a typo is refused
|
|
227
|
+
* whether or not anything is running.
|
|
228
|
+
*/
|
|
229
|
+
function parseScope(all, raw) {
|
|
230
|
+
if (all && raw !== void 0) fail("--include and --all are exclusive — pass one or the other");
|
|
231
|
+
if (all) return { kind: "all" };
|
|
232
|
+
if (raw === void 0) return null;
|
|
233
|
+
const ids = raw.split(",").map((part) => part.trim()).filter((part) => part.length > 0);
|
|
234
|
+
if (ids.length === 0) fail("--include is empty — name the ids to act on, or pass --all for everything");
|
|
235
|
+
return {
|
|
236
|
+
kind: "include",
|
|
237
|
+
ids
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The plan rows a scope selects, and an exclusion drops.
|
|
242
|
+
*
|
|
243
|
+
* `kind` is deliberately not part of this: it is the panel's label for a row, not an id, and every id
|
|
244
|
+
* the plan prints is already prefixed with it (`global:settings`, `workspace:default:servers`).
|
|
245
|
+
*/
|
|
246
|
+
/** Flatten a nested plan into the rows the tree renders. */
|
|
247
|
+
function flattenRows(rows) {
|
|
248
|
+
return rows.flatMap((row) => [{
|
|
249
|
+
id: row.id,
|
|
250
|
+
note: row.note ?? null
|
|
251
|
+
}, ...(row.items ?? []).map((leaf) => ({
|
|
252
|
+
id: leaf.id,
|
|
253
|
+
note: leaf.note ?? null
|
|
254
|
+
}))]);
|
|
255
|
+
}
|
|
256
|
+
function filterEntries(entries, scope, exclude) {
|
|
257
|
+
const unwanted = exclude ?? [];
|
|
258
|
+
const excluded = (id) => unwanted.some((entry) => id === entry || id.startsWith(`${entry}:`));
|
|
259
|
+
const named = (id) => scope.kind === "all" || scope.ids.some((entry) => id === entry || id.startsWith(`${entry}:`) || entry.startsWith(`${id}:`));
|
|
260
|
+
return entries.filter((entry) => named(entry.id) && !excluded(entry.id)).map((entry) => entry.items === void 0 ? entry : {
|
|
261
|
+
...entry,
|
|
262
|
+
items: entry.items.filter((leaf) => named(leaf.id) && !excluded(leaf.id))
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Refuse an id the plan does not have.
|
|
267
|
+
*
|
|
268
|
+
* An id that matches nothing is silently ignored by the service, which is right for an archive that
|
|
269
|
+
* simply does not carry something — and wrong for a typo: `--exclude global:secret` excludes nothing
|
|
270
|
+
* and says nothing, so the archive carries the credentials the person believed they had dropped.
|
|
271
|
+
*
|
|
272
|
+
* `action` decides the hint, because the two directions list their ids from different places: a
|
|
273
|
+
* create plan lists what this host declares, a restore plan lists what the archive holds — and the
|
|
274
|
+
* command that prints that one is a restore, not a create.
|
|
275
|
+
*/
|
|
276
|
+
function assertKnown(ids, entries, flag, action) {
|
|
277
|
+
if (ids === void 0) return;
|
|
278
|
+
const unknown = unknownBackupIds(ids, entries);
|
|
279
|
+
if (unknown.length > 0) {
|
|
280
|
+
const hint = action === "create" ? `\`backup create\` with no flags lists the ids` : `\`backup restore <name>\` with no --include/--exclude lists the ids the archive holds`;
|
|
281
|
+
fail(`${flag} names ${unknown.map((id) => `"${id}"`).join(", ")}, which ${unknown.length === 1 ? "is" : "are"} not in this plan — ${hint}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/** `--exclude` parsed. An empty value is a mistake, not "exclude nothing". */
|
|
285
|
+
function parseExclude(raw) {
|
|
286
|
+
if (raw === void 0) return void 0;
|
|
287
|
+
const ids = raw.split(",").map((part) => part.trim()).filter((part) => part.length > 0);
|
|
288
|
+
if (ids.length === 0) fail("--exclude is empty — name the ids to leave out, or drop the flag");
|
|
289
|
+
return ids;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Neither flag given. Refused outright — the ids are a *bonus*, not the reason.
|
|
293
|
+
*
|
|
294
|
+
* The refusal must not depend on a panel being up: a mistyped command deserves the flag error, not
|
|
295
|
+
* "home-hosted is not running". So the list is best-effort, and a failure to produce it is silent.
|
|
296
|
+
*/
|
|
297
|
+
async function refuseWithoutScope(action, suffix) {
|
|
298
|
+
const rows = await availableRows(action, suffix).catch(() => []);
|
|
299
|
+
if (rows.length === 0) fail("name what to act on — pass --include <ids> or --all");
|
|
300
|
+
process.stderr.write(`${paint("31", "error")} name what to act on — pass --include <ids> or --all\n\n`);
|
|
301
|
+
process.stderr.write("available (or narrow it):\n");
|
|
302
|
+
printPlanTree(flattenRows(rows), (text) => process.stderr.write(text));
|
|
303
|
+
process.stderr.write("\n--exclude <ids> leaves those out: --all --exclude global:secrets\n");
|
|
304
|
+
process.exit(1);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* The ids an offline run could act on, read from the state files.
|
|
308
|
+
*
|
|
309
|
+
* The refusal has to name real ids whether or not a panel is up — an empty list is the one answer
|
|
310
|
+
* worse than no list, because it reads as "there is nothing to back up".
|
|
311
|
+
*/
|
|
312
|
+
async function availableRowsFromDisk(action, suffix) {
|
|
313
|
+
try {
|
|
314
|
+
const { service } = createOfflineBackup();
|
|
315
|
+
await service.warm();
|
|
316
|
+
if (action === "create") return service.selection().entries;
|
|
317
|
+
const query = new URLSearchParams(suffix.startsWith("?") ? suffix.slice(1) : suffix);
|
|
318
|
+
const from = query.get("from");
|
|
319
|
+
const name = query.get("name");
|
|
320
|
+
const archive = from !== null && from.length > 0 ? fs.existsSync(from) && fs.statSync(from).isFile() ? from : null : name === null || name.length === 0 ? null : service.resolve(name);
|
|
321
|
+
if (archive === null) return [];
|
|
322
|
+
return ((await service.restore(archive, { confirm: false })).items ?? []).filter((item) => item.selected !== false);
|
|
323
|
+
} catch {
|
|
324
|
+
return [];
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* The ids this action could be scoped to.
|
|
329
|
+
*
|
|
330
|
+
* `create` asks what the entries declare; `restore` asks what the archive holds. Both come from the
|
|
331
|
+
* panel, so the list in a refusal is the real one rather than a hardcoded guess. A panel that cannot
|
|
332
|
+
* be reached yields no ids — the refusal still fires, it just cannot enumerate.
|
|
333
|
+
*/
|
|
334
|
+
async function availableRows(action, suffix) {
|
|
335
|
+
const daemon = await import("./daemon-qKVECISl.js");
|
|
336
|
+
const runtime = daemon.readRuntime();
|
|
337
|
+
if (runtime === null || !await daemon.runtimeIsAlive(runtime)) return await availableRowsFromDisk(action, suffix);
|
|
338
|
+
const path = action === "create" ? "/_hh/backups" : "/_hh/backups/restore";
|
|
339
|
+
const answer = await daemon.requestControl(runtime, `${path}${suffix}`, 12e4);
|
|
340
|
+
if (answer === null || answer.status !== 200) return [];
|
|
341
|
+
const body = answer.body;
|
|
342
|
+
return action === "create" ? body?.entries ?? [] : body?.items ?? [];
|
|
343
|
+
}
|
|
344
|
+
/** `?a=b`, or `''`. */
|
|
345
|
+
function suffixOf(query) {
|
|
346
|
+
return query.size === 0 ? "" : `?${query.toString()}`;
|
|
347
|
+
}
|
|
348
|
+
/** Appends one query parameter, keeping the `?`/`&` right. */
|
|
349
|
+
function withParam(suffix, key, value) {
|
|
350
|
+
return `${suffix}${suffix === "" ? "?" : "&"}${key}=${encodeURIComponent(value)}`;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Ask before writing.
|
|
354
|
+
*
|
|
355
|
+
* A session that cannot be asked is refused, exit 1, after the plan: not a silent write, and not a
|
|
356
|
+
* success. Exiting 0 here meant a cron job's `backup create --all` printed a plan every night and
|
|
357
|
+
* never took a backup, with nothing in its exit status to say so. (`--json` without `--confirm` is
|
|
358
|
+
* the explicit "show me the plan" request and still exits 0; it never reaches this.)
|
|
359
|
+
*/
|
|
360
|
+
async function consent(question) {
|
|
361
|
+
if (process.stdin.isTTY !== true) fail("not applied — this session cannot ask for consent; re-run with --confirm to apply (or --json to only read the plan)");
|
|
362
|
+
const answer = await prompt(`${question} [y/N] `);
|
|
363
|
+
if (/^yes$|^y$/i.test(answer.trim())) {
|
|
364
|
+
process.stdout.write("\n");
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
process.stdout.write("cancelled — nothing was written\n");
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Run against the panel when one is up, and against the files when it is not.
|
|
372
|
+
*
|
|
373
|
+
* Both run the same `BackupService`, so the archive cannot differ; only the authority on what is
|
|
374
|
+
* running changes. A stopped panel is exactly when someone wants to back up or restore — the services
|
|
375
|
+
* are down because they stopped them on purpose.
|
|
376
|
+
*/
|
|
377
|
+
async function runBackupList(json) {
|
|
378
|
+
if (await usesPanel()) {
|
|
379
|
+
const runtime = await livePanel();
|
|
380
|
+
if (runtime !== null) {
|
|
381
|
+
const answer = await runtime.request(runtime, "/_hh/backups", 3e4, "GET");
|
|
382
|
+
if (answer === null) fail(`the control panel is not answering on ${runtime.probeUrl}`);
|
|
383
|
+
if (answer.status !== 200) failWithAnswer(answer);
|
|
384
|
+
printList(answer.body, json);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const { service } = createOfflineBackup();
|
|
389
|
+
await service.warm();
|
|
390
|
+
printList(service.selection(), json);
|
|
391
|
+
}
|
|
392
|
+
function printList(view, json) {
|
|
393
|
+
const files = view?.files ?? [];
|
|
394
|
+
if (json) {
|
|
395
|
+
process.stdout.write(`${JSON.stringify(view, null, 2)}\n`);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (files.length === 0) {
|
|
399
|
+
process.stdout.write(`no backups yet — \`${invocation()} backup create --all\` takes one\n`);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const noun = files.length === 1 ? "archive" : "archives";
|
|
403
|
+
process.stdout.write(`${bold(String(files.length))} ${noun}${view?.dir === void 0 ? "" : ` in ${dim(view.dir)}`}\n`);
|
|
404
|
+
for (const file of files) {
|
|
405
|
+
const when = file.createdAt == null ? "" : new Date(file.createdAt).toISOString().replace("T", " ").slice(0, 16);
|
|
406
|
+
process.stdout.write(` ${file.name.padEnd(36)} ${human(file.sizeBytes).padStart(8)} ${dim(when)}${file.automatic ? dim(" auto") : ""}\n`);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Name the entries still running, without blocking.
|
|
411
|
+
*
|
|
412
|
+
* A **persistent** entry keeps running while the panel is stopped, so "panel off" is not "services
|
|
413
|
+
* off" — and its data being captured mid-write is worth knowing before it is relied on. Warned rather
|
|
414
|
+
* than refused: the user may know, and the panel's own backup has always proceeded here.
|
|
415
|
+
*/
|
|
416
|
+
function warnRunning(entries) {
|
|
417
|
+
if (entries.length === 0) return;
|
|
418
|
+
const named = entries.map((entry) => entry.serverId ?? entry.id ?? "").filter((name) => name.length > 0);
|
|
419
|
+
const isOne = named.length === 1;
|
|
420
|
+
process.stdout.write(`${dim(`! ${named.length} entr${isOne ? "y is" : "ies are"} still running (${named.join(", ")}) — its data may be captured mid-write`)}\n`);
|
|
421
|
+
}
|
|
422
|
+
async function runBackupCreate(options) {
|
|
423
|
+
const scope = options.scope;
|
|
424
|
+
const online = await usesPanel();
|
|
425
|
+
const entries = await (async () => {
|
|
426
|
+
if (online) {
|
|
427
|
+
const runtime = await livePanel();
|
|
428
|
+
if (runtime !== null) {
|
|
429
|
+
const answer = await runtime.request(runtime, "/_hh/backups", 12e4);
|
|
430
|
+
if (answer === null) fail(`the control panel is not answering on ${runtime.probeUrl}`);
|
|
431
|
+
if (answer.status !== 200) failWithAnswer(answer);
|
|
432
|
+
return answer.body?.entries ?? [];
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
const { service } = createOfflineBackup();
|
|
436
|
+
await service.warm();
|
|
437
|
+
return service.selection().entries;
|
|
438
|
+
})();
|
|
439
|
+
assertKnown(options.exclude, entries, "--exclude", "create");
|
|
440
|
+
assertKnown(scope.kind === "include" ? scope.ids : void 0, entries, "--include", "create");
|
|
441
|
+
const wanted = filterEntries(entries, scope, options.exclude);
|
|
442
|
+
if (!options.confirm) {
|
|
443
|
+
if (options.json) {
|
|
444
|
+
process.stdout.write(`${JSON.stringify({
|
|
445
|
+
action: "create",
|
|
446
|
+
apply: false,
|
|
447
|
+
entries: wanted
|
|
448
|
+
}, null, 2)}\n`);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
process.stdout.write(`${bold("Plan")} — what a backup would capture; nothing has been written yet\n`);
|
|
452
|
+
printPlanTree(flattenRows(wanted));
|
|
453
|
+
if (wanted.length === 0) {
|
|
454
|
+
process.stdout.write(" (nothing matched — check --include, or what the entries declare)\n");
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
warnRunning(createOfflineBackup().runningNow());
|
|
458
|
+
if (!await consent("Take this backup?")) return;
|
|
459
|
+
}
|
|
460
|
+
const include = scope.kind === "include" ? scope.ids : void 0;
|
|
461
|
+
const exclude = options.exclude;
|
|
462
|
+
const created = await (async () => {
|
|
463
|
+
if (online) {
|
|
464
|
+
const runtime = await livePanel();
|
|
465
|
+
if (runtime !== null) {
|
|
466
|
+
const query = new URLSearchParams();
|
|
467
|
+
if (options.password !== void 0 && options.password.length > 0) query.set("password", options.password);
|
|
468
|
+
if (include !== void 0) query.set("include", include.join(","));
|
|
469
|
+
if (exclude !== void 0) query.set("exclude", exclude.join(","));
|
|
470
|
+
const answer = await runtime.request(runtime, `/_hh/backups${withParam(suffixOf(query), "confirm", "true")}`, 6e5);
|
|
471
|
+
if (answer === null) fail(`the control panel is not answering on ${runtime.probeUrl}`);
|
|
472
|
+
if (answer.status !== 200) failWithAnswer(answer);
|
|
473
|
+
return answer.body;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const { service } = createOfflineBackup();
|
|
477
|
+
await service.warm();
|
|
478
|
+
const result = await service.create({
|
|
479
|
+
password: options.password,
|
|
480
|
+
include,
|
|
481
|
+
exclude
|
|
482
|
+
});
|
|
483
|
+
if (!result.ok) fail(result.error ?? "the backup failed");
|
|
484
|
+
return {
|
|
485
|
+
file: result.file,
|
|
486
|
+
...result.warnings === void 0 ? {} : { warnings: result.warnings }
|
|
487
|
+
};
|
|
488
|
+
})();
|
|
489
|
+
const file = created?.file;
|
|
490
|
+
if (file === void 0) fail("the backup reported success but named no archive");
|
|
491
|
+
const warnings = created?.warnings ?? [];
|
|
492
|
+
if (options.json) {
|
|
493
|
+
process.stdout.write(`${JSON.stringify({
|
|
494
|
+
action: "create",
|
|
495
|
+
apply: true,
|
|
496
|
+
file,
|
|
497
|
+
...warnings.length === 0 ? {} : { warnings }
|
|
498
|
+
}, null, 2)}\n`);
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
process.stdout.write(`${green("backup created")} ${file.name} ${dim(`(${human(file.sizeBytes)})`)}\n`);
|
|
502
|
+
for (const warning of warnings) process.stderr.write(`warning: ${warning}\n`);
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Why a restore plan is not something to apply, or `null`.
|
|
506
|
+
*
|
|
507
|
+
* The service answers a plan for every archive, including ones it refuses to read: `error` carries
|
|
508
|
+
* the refusal and `items` is empty. A caller that reads only `items` sees a tidy empty restore — and
|
|
509
|
+
* on a blank host, `restored 0 items` printed with exit 0 is the worst possible answer, because
|
|
510
|
+
* nothing distinguishes "this archive was empty" from "this archive could not be opened".
|
|
511
|
+
*
|
|
512
|
+
* `needsPassword` is its own case: it is the one refusal the person can fix from the same command.
|
|
513
|
+
*/
|
|
514
|
+
function planRefusal(plan) {
|
|
515
|
+
if (plan === null) return null;
|
|
516
|
+
if (plan.needsPassword === true) return `${plan.error ?? "this backup is password-protected"} — add \`--password <text>\` to unlock it`;
|
|
517
|
+
if (plan.error !== void 0 && plan.error.length > 0) return plan.error;
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
async function runBackupRestore(options) {
|
|
521
|
+
const scope = options.scope;
|
|
522
|
+
const online = await usesPanel();
|
|
523
|
+
/**
|
|
524
|
+
* What this restore reads from: an archive **name** in the backups directory, or a **path**.
|
|
525
|
+
*
|
|
526
|
+
* A name is an allowlist entry, which is why it is the default. `--from` is for the blank host
|
|
527
|
+
* where the archive is on a USB stick: it names the file to read, not a directory to write in.
|
|
528
|
+
* The two are refused together rather than one quietly winning — on the one command that
|
|
529
|
+
* overwrites live data, a guess about which archive was meant is the wrong default.
|
|
530
|
+
*
|
|
531
|
+
* The path is resolved against *this* process's directory; the panel would resolve a relative
|
|
532
|
+
* one against its own cwd, which is a different directory and so a different file.
|
|
533
|
+
*/
|
|
534
|
+
const source = options.from !== void 0 ? {
|
|
535
|
+
kind: "from",
|
|
536
|
+
path: resolveUserPath(options.from)
|
|
537
|
+
} : {
|
|
538
|
+
kind: "name",
|
|
539
|
+
name: options.name ?? ""
|
|
540
|
+
};
|
|
541
|
+
/** What to call it in the plan and the result: the file it read, name or path. */
|
|
542
|
+
const label = source.kind === "from" ? path.basename(source.path) : source.name;
|
|
543
|
+
if (source.kind === "from" && (!fs.existsSync(source.path) || !fs.statSync(source.path).isFile())) fail(`no file at ${source.path} — \`--from\` takes the path to an archive on this machine`);
|
|
544
|
+
const service = online ? null : createOfflineBackup().service;
|
|
545
|
+
if (service !== null) await service.warm();
|
|
546
|
+
const plan = await (async () => {
|
|
547
|
+
if (service !== null) {
|
|
548
|
+
if (source.kind === "from") return await service.restore(source.path, {
|
|
549
|
+
confirm: false,
|
|
550
|
+
password: options.password,
|
|
551
|
+
include: scope.kind === "include" ? scope.ids : void 0,
|
|
552
|
+
exclude: options.exclude
|
|
553
|
+
});
|
|
554
|
+
const archive = service.resolve(source.name);
|
|
555
|
+
if (archive === null) fail(`no backup named "${source.name}" in ${service.directory} — a restore takes the archive's file name, not a path; pass --from <path> to read the file where it is, or copy it into that directory (\`${invocation()} backup list\` shows what is there)`);
|
|
556
|
+
return await service.restore(archive, {
|
|
557
|
+
confirm: false,
|
|
558
|
+
password: options.password,
|
|
559
|
+
include: scope.kind === "include" ? scope.ids : void 0,
|
|
560
|
+
exclude: options.exclude
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
const runtime = await livePanel();
|
|
564
|
+
if (runtime === null) fail(`the control panel is not answering — try again once it is up`);
|
|
565
|
+
const base = restoreQuery(source, options, scope);
|
|
566
|
+
const answer = await runtime.request(runtime, `/_hh/backups/restore${suffixOf(base)}`, 12e4);
|
|
567
|
+
if (answer === null) fail(`the control panel is not answering at ${runtime.probeUrl}`);
|
|
568
|
+
if (answer.status !== 200) failWithAnswer(answer);
|
|
569
|
+
return answer.body;
|
|
570
|
+
})();
|
|
571
|
+
const refused = planRefusal(plan);
|
|
572
|
+
if (refused !== null) {
|
|
573
|
+
if (options.json) process.stdout.write(`${JSON.stringify({
|
|
574
|
+
action: "restore",
|
|
575
|
+
apply: false,
|
|
576
|
+
name: label,
|
|
577
|
+
error: refused
|
|
578
|
+
}, null, 2)}\n`);
|
|
579
|
+
fail(refused);
|
|
580
|
+
}
|
|
581
|
+
const items = (plan?.items ?? []).filter((item) => item.selected !== false);
|
|
582
|
+
const archiveItems = plan?.items ?? [];
|
|
583
|
+
if (options.exclude !== void 0) assertKnown(options.exclude, archiveItems, "--exclude", "restore");
|
|
584
|
+
if (scope.kind === "include") assertKnown(scope.ids, archiveItems, "--include", "restore");
|
|
585
|
+
if (options.json && !options.confirm) {
|
|
586
|
+
process.stdout.write(`${JSON.stringify({
|
|
587
|
+
action: "restore",
|
|
588
|
+
apply: false,
|
|
589
|
+
name: label,
|
|
590
|
+
items,
|
|
591
|
+
skipped: plan?.skipped ?? []
|
|
592
|
+
}, null, 2)}\n`);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (!options.json) {
|
|
596
|
+
process.stdout.write(options.confirm ? `${bold("Plan")} for ${label} — applying it now\n` : `${bold("Plan")} for ${label} — nothing has been written yet\n`);
|
|
597
|
+
printPlanTree(items.map((item) => ({
|
|
598
|
+
id: item.id,
|
|
599
|
+
note: item.note ?? null
|
|
600
|
+
})));
|
|
601
|
+
if (!options.confirm) for (const note of plan?.skipped ?? []) process.stdout.write(` ${dim("!")} ${note}\n`);
|
|
602
|
+
if (items.length === 0) {
|
|
603
|
+
process.stdout.write(" (nothing to restore — check --include, or what this host declares)\n");
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (!options.confirm && !await consent(`Restore these ${items.length} item(s) over this host?`)) return;
|
|
608
|
+
{
|
|
609
|
+
const outcome = await (async () => {
|
|
610
|
+
if (service !== null) {
|
|
611
|
+
const archive = source.kind === "from" ? source.path : service.resolve(source.name);
|
|
612
|
+
const result = await service.restore(archive, {
|
|
613
|
+
confirm: true,
|
|
614
|
+
password: options.password,
|
|
615
|
+
include: scope.kind === "include" ? scope.ids : void 0,
|
|
616
|
+
exclude: options.exclude
|
|
617
|
+
});
|
|
618
|
+
return {
|
|
619
|
+
...result,
|
|
620
|
+
items: (result.items ?? []).filter((item) => item.selected !== false)
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
const runtime = await livePanel();
|
|
624
|
+
if (runtime === null) fail("the control panel stopped answering — nothing further was written");
|
|
625
|
+
const base = restoreQuery(source, options, scope);
|
|
626
|
+
const answer = await runtime.request(runtime, `/_hh/backups/restore${withParam(suffixOf(base), "confirm", "true")}`, 6e5);
|
|
627
|
+
if (answer === null) fail(`the control panel is not answering at ${runtime.probeUrl}`);
|
|
628
|
+
if (answer.status !== 200) failWithAnswer(answer);
|
|
629
|
+
const result = answer.body;
|
|
630
|
+
return {
|
|
631
|
+
...result,
|
|
632
|
+
items: (result?.items ?? plan?.items ?? []).filter((item) => item.selected !== false),
|
|
633
|
+
...result?.hooks === void 0 && plan?.hooks !== void 0 ? { hooks: plan.hooks } : {}
|
|
634
|
+
};
|
|
635
|
+
})();
|
|
636
|
+
const applyRefused = planRefusal(outcome);
|
|
637
|
+
if (applyRefused !== null) {
|
|
638
|
+
if (options.json) process.stdout.write(`${JSON.stringify({
|
|
639
|
+
action: "restore",
|
|
640
|
+
apply: true,
|
|
641
|
+
name: label,
|
|
642
|
+
error: applyRefused
|
|
643
|
+
}, null, 2)}\n`);
|
|
644
|
+
fail(applyRefused);
|
|
645
|
+
}
|
|
646
|
+
const applied = (outcome.items ?? []).filter((item) => item.selected !== false);
|
|
647
|
+
const hooks = (outcome.hooks ?? []).filter((hook) => hook.action === "load");
|
|
648
|
+
const notes = outcome.skipped ?? [];
|
|
649
|
+
if (options.json) {
|
|
650
|
+
process.stdout.write(`${JSON.stringify({
|
|
651
|
+
action: "restore",
|
|
652
|
+
apply: true,
|
|
653
|
+
name: label,
|
|
654
|
+
items: applied,
|
|
655
|
+
hooks,
|
|
656
|
+
skipped: notes,
|
|
657
|
+
...outcome.restartRequired === true ? { restartRequired: true } : {},
|
|
658
|
+
...(outcome.createdWorkspaces ?? []).length === 0 ? {} : { createdWorkspaces: outcome.createdWorkspaces },
|
|
659
|
+
...(outcome.replacedUnderRunning ?? []).length === 0 ? {} : { replacedUnderRunning: outcome.replacedUnderRunning }
|
|
660
|
+
}, null, 2)}\n`);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
if (applied.length === 0) process.stdout.write(`${green("restored")} nothing — the archive carried no item this host can take\n`);
|
|
664
|
+
else process.stdout.write(`${green("restored")} ${applied.length} ${applied.length === 1 ? "item" : "items"} from ${label}\n`);
|
|
665
|
+
for (const hook of hooks) process.stdout.write(` ${dim(`load ${hook.serverId}: ${hook.output ?? "staged"}`)}\n`);
|
|
666
|
+
for (const note of notes) process.stdout.write(` ${dim("!")} ${note}\n`);
|
|
667
|
+
if (outcome.restartRequired === true) process.stdout.write(` ${dim(`! the panel's listener changed — restart it so it binds where the archive says (\`${invocation()} restart\`)`)}\n`);
|
|
668
|
+
if ((outcome.createdWorkspaces ?? []).length > 0) process.stdout.write(` ${dim(`! created ${outcome.createdWorkspaces.join(", ")}, which this host did not have`)}\n`);
|
|
669
|
+
if (service !== null) process.stdout.write(dim(`the panel is not running, so nothing was reloaded — the next \`${invocation()} up\` reads what was restored\n`));
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* The restore query both the plan and the apply send.
|
|
674
|
+
*
|
|
675
|
+
* One builder, because the two requests must agree: a password or a selection on the plan and not on
|
|
676
|
+
* the apply made the apply answer about different items than the person approved.
|
|
677
|
+
*/
|
|
678
|
+
function restoreQuery(source, options, scope) {
|
|
679
|
+
const base = source.kind === "from" ? new URLSearchParams({ from: source.path }) : new URLSearchParams({ name: source.name });
|
|
680
|
+
if (options.password !== void 0 && options.password.length > 0) base.set("password", options.password);
|
|
681
|
+
if (scope.kind === "include") base.set("include", scope.ids.join(","));
|
|
682
|
+
if (options.exclude !== void 0) base.set("exclude", options.exclude.join(","));
|
|
683
|
+
return base;
|
|
684
|
+
}
|
|
685
|
+
/** What each action reads. Anything else given is refused, never parsed and dropped. */
|
|
686
|
+
var HONOURED = {
|
|
687
|
+
list: /* @__PURE__ */ new Set(["json"]),
|
|
688
|
+
create: /* @__PURE__ */ new Set([
|
|
689
|
+
"password",
|
|
690
|
+
"include",
|
|
691
|
+
"exclude",
|
|
692
|
+
"all",
|
|
693
|
+
"confirm",
|
|
694
|
+
"json"
|
|
695
|
+
]),
|
|
696
|
+
restore: /* @__PURE__ */ new Set([
|
|
697
|
+
"target",
|
|
698
|
+
"from",
|
|
699
|
+
"password",
|
|
700
|
+
"include",
|
|
701
|
+
"exclude",
|
|
702
|
+
"all",
|
|
703
|
+
"confirm",
|
|
704
|
+
"json"
|
|
705
|
+
])
|
|
706
|
+
};
|
|
707
|
+
/**
|
|
708
|
+
* A flag the action cannot honour is refused, not ignored: `backup list --all --include x` listed
|
|
709
|
+
* every archive, and `backup create foo --all` dropped `foo` without a word.
|
|
710
|
+
*/
|
|
711
|
+
function unhonouredBackupFlag(action, given) {
|
|
712
|
+
for (const flag of Object.keys(given)) {
|
|
713
|
+
if (given[flag] === void 0 || HONOURED[action].has(flag)) continue;
|
|
714
|
+
if (flag === "target") return `\`backup ${action}\` takes no archive name ("${String(given.target)}") — only restore reads one`;
|
|
715
|
+
return `--${flag} does nothing for \`backup ${action}\` — drop it`;
|
|
716
|
+
}
|
|
717
|
+
return null;
|
|
718
|
+
}
|
|
719
|
+
function refuseUnhonouredFlags(action, args) {
|
|
720
|
+
const given = {};
|
|
721
|
+
for (const flag of [
|
|
722
|
+
"target",
|
|
723
|
+
"from",
|
|
724
|
+
"password",
|
|
725
|
+
"include",
|
|
726
|
+
"exclude",
|
|
727
|
+
"all",
|
|
728
|
+
"confirm",
|
|
729
|
+
"json"
|
|
730
|
+
]) {
|
|
731
|
+
const value = args[flag];
|
|
732
|
+
if (value !== void 0 && value !== "") given[flag] = value;
|
|
733
|
+
}
|
|
734
|
+
const problem = unhonouredBackupFlag(action, given);
|
|
735
|
+
if (problem !== null) fail(problem);
|
|
736
|
+
}
|
|
737
|
+
var backupCommand = defineCommand({
|
|
738
|
+
meta: { name: "backup" },
|
|
739
|
+
args: {
|
|
740
|
+
action: {
|
|
741
|
+
type: "positional",
|
|
742
|
+
description: "list (default) | create | restore",
|
|
743
|
+
required: false
|
|
744
|
+
},
|
|
745
|
+
target: {
|
|
746
|
+
type: "positional",
|
|
747
|
+
description: "the archive name, for restore",
|
|
748
|
+
required: false
|
|
749
|
+
},
|
|
750
|
+
from: {
|
|
751
|
+
type: "string",
|
|
752
|
+
description: "restore from this archive file anywhere on the machine, instead of a name in the backups directory"
|
|
753
|
+
},
|
|
754
|
+
password: {
|
|
755
|
+
type: "string",
|
|
756
|
+
description: "encrypt the archive, or unlock it on restore"
|
|
757
|
+
},
|
|
758
|
+
include: {
|
|
759
|
+
type: "string",
|
|
760
|
+
description: "comma-separated item ids to act on"
|
|
761
|
+
},
|
|
762
|
+
exclude: {
|
|
763
|
+
type: "string",
|
|
764
|
+
description: "comma-separated item ids to leave out, applied after --include"
|
|
765
|
+
},
|
|
766
|
+
all: {
|
|
767
|
+
type: "boolean",
|
|
768
|
+
description: "act on everything, rather than naming ids"
|
|
769
|
+
},
|
|
770
|
+
confirm: {
|
|
771
|
+
type: "boolean",
|
|
772
|
+
description: "apply without asking (a restore writes over live data)"
|
|
773
|
+
},
|
|
774
|
+
json: {
|
|
775
|
+
type: "boolean",
|
|
776
|
+
description: "print the plan or the result as JSON"
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
async run({ args }) {
|
|
780
|
+
try {
|
|
781
|
+
const action = args.action === void 0 || args.action.length === 0 ? "list" : args.action;
|
|
782
|
+
if (action !== "list" && action !== "create" && action !== "restore") fail(`unknown action "${action}" — use list, create or restore`);
|
|
783
|
+
refuseUnhonouredFlags(action, args);
|
|
784
|
+
const parsed = action === "create" || action === "restore" ? parseScope(args.all === true, args.include) : null;
|
|
785
|
+
const exclude = action === "create" || action === "restore" ? parseExclude(args.exclude) : void 0;
|
|
786
|
+
if (action === "list") await runBackupList(args.json === true);
|
|
787
|
+
else if (action === "create") {
|
|
788
|
+
const scope = parsed ?? await refuseWithoutScope("create", "");
|
|
789
|
+
await runBackupCreate({
|
|
790
|
+
password: args.password,
|
|
791
|
+
scope,
|
|
792
|
+
exclude,
|
|
793
|
+
confirm: args.confirm === true,
|
|
794
|
+
json: args.json === true
|
|
795
|
+
});
|
|
796
|
+
} else {
|
|
797
|
+
const from = args.from !== void 0 && args.from.length > 0 ? args.from : void 0;
|
|
798
|
+
const name = args.target !== void 0 && args.target.length > 0 ? args.target : void 0;
|
|
799
|
+
if (from !== void 0 && name !== void 0) fail("pass an archive name or --from <path>, not both — they name two different archives");
|
|
800
|
+
if (from === void 0 && name === void 0) fail("restore needs an archive — a name (`backup list` shows them), or --from <path> for a file anywhere on this machine");
|
|
801
|
+
const suffix = from !== void 0 ? `?from=${encodeURIComponent(resolveUserPath(from))}` : `?name=${encodeURIComponent(name)}`;
|
|
802
|
+
if (from !== void 0 && parsed === null && !(fs.existsSync(resolveUserPath(from)) && fs.statSync(resolveUserPath(from)).isFile())) fail(`no file at ${resolveUserPath(from)} — \`--from\` takes the path to an archive on this machine`);
|
|
803
|
+
const scope = parsed ?? await refuseWithoutScope("restore", suffix);
|
|
804
|
+
await runBackupRestore({
|
|
805
|
+
...name === void 0 ? {} : { name },
|
|
806
|
+
...from === void 0 ? {} : { from },
|
|
807
|
+
password: args.password,
|
|
808
|
+
scope,
|
|
809
|
+
exclude,
|
|
810
|
+
confirm: args.confirm === true,
|
|
811
|
+
json: args.json === true
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
} catch (error) {
|
|
815
|
+
fail(errorMessage(error));
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
//#endregion
|
|
820
|
+
export { backupCommand };
|
|
821
|
+
|
|
822
|
+
//# sourceMappingURL=backup-CZcVca2a.js.map
|