home-hosted 0.13.0 → 0.20.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 +117 -322
- package/bin/home-hosted.mjs +41 -0
- package/dist/chunks/account-DiLrSyww.js +359 -0
- package/dist/chunks/account-DiLrSyww.js.map +1 -0
- package/dist/chunks/add-DEIYVkNK.js +183 -0
- package/dist/chunks/add-DEIYVkNK.js.map +1 -0
- package/dist/chunks/{archive-DP-XQR8X.js → archive-DFi3qK1c.js} +25 -73
- package/dist/chunks/archive-DFi3qK1c.js.map +1 -0
- package/dist/chunks/{atomic-C1PfJpE7.js → atomic-SZUwDtGD.js} +3 -6
- package/dist/chunks/atomic-SZUwDtGD.js.map +1 -0
- package/dist/chunks/{backup-CZcVca2a.js → backup-DnyxIzw0.js} +110 -190
- package/dist/chunks/backup-DnyxIzw0.js.map +1 -0
- package/dist/chunks/backups-BrrN6cwW.js +2203 -0
- package/dist/chunks/backups-BrrN6cwW.js.map +1 -0
- package/dist/chunks/bind-DIxrnUst.js +43 -0
- package/dist/chunks/bind-DIxrnUst.js.map +1 -0
- package/dist/chunks/config-text-DxMOQQnk.js +34 -0
- package/dist/chunks/config-text-DxMOQQnk.js.map +1 -0
- package/dist/chunks/{contracts-CMBD1TF9.js → contracts-CxZ7u1L3.js} +1239 -1454
- package/dist/chunks/contracts-CxZ7u1L3.js.map +1 -0
- package/dist/chunks/daemon-BAAYUYQC.js +211 -0
- package/dist/chunks/daemon-BAAYUYQC.js.map +1 -0
- package/dist/chunks/daemon-log-Ccu-69vB.js +179 -0
- package/dist/chunks/daemon-log-Ccu-69vB.js.map +1 -0
- package/dist/chunks/deploy-CggSOEkq.js +144 -0
- package/dist/chunks/deploy-CggSOEkq.js.map +1 -0
- package/dist/chunks/{docker-Cy9Lyvda.js → docker--Un0uLfF.js} +32 -68
- package/dist/chunks/docker--Un0uLfF.js.map +1 -0
- package/dist/chunks/{down-pKbGCW9d.js → down-CpIN7LEQ.js} +34 -94
- package/dist/chunks/down-CpIN7LEQ.js.map +1 -0
- package/dist/chunks/exposure-CDJNvOCK.js +229 -0
- package/dist/chunks/exposure-CDJNvOCK.js.map +1 -0
- package/dist/chunks/import-Bd4VZH0f.js +205 -0
- package/dist/chunks/import-Bd4VZH0f.js.map +1 -0
- package/dist/chunks/import-plan--fDS_l5r.js +147 -0
- package/dist/chunks/import-plan--fDS_l5r.js.map +1 -0
- package/dist/chunks/import-write-BTfbeV26.js +42 -0
- package/dist/chunks/import-write-BTfbeV26.js.map +1 -0
- package/dist/chunks/{init-BZ7hK9Vf.js → init-Bv3oH65x.js} +14 -50
- package/dist/chunks/init-Bv3oH65x.js.map +1 -0
- package/dist/chunks/job-CYOdN6Ub.js +341 -0
- package/dist/chunks/job-CYOdN6Ub.js.map +1 -0
- package/dist/chunks/jobs-BX4ahcfh.js +489 -0
- package/dist/chunks/jobs-BX4ahcfh.js.map +1 -0
- package/dist/chunks/last-stop-DD3lHwo_.js +42 -0
- package/dist/chunks/last-stop-DD3lHwo_.js.map +1 -0
- package/dist/chunks/layout-D0ysDNav.js +18 -0
- package/dist/chunks/layout-D0ysDNav.js.map +1 -0
- package/dist/chunks/lazy-kfcBNeqj.js +48 -0
- package/dist/chunks/lazy-kfcBNeqj.js.map +1 -0
- package/dist/chunks/log-buffer-B7jmn7ts.js +110 -0
- package/dist/chunks/log-buffer-B7jmn7ts.js.map +1 -0
- package/dist/chunks/log-files-CZL2UhuE.js +488 -0
- package/dist/chunks/log-files-CZL2UhuE.js.map +1 -0
- package/dist/chunks/{logger-B5U4GD3j.js → logger-BnrKTBHQ.js} +2 -6
- package/dist/chunks/logger-BnrKTBHQ.js.map +1 -0
- package/dist/chunks/{logs---TI_bxM.js → logs-DxKI6OW2.js} +23 -73
- package/dist/chunks/logs-DxKI6OW2.js.map +1 -0
- package/dist/chunks/ls-BseUHy_m.js +128 -0
- package/dist/chunks/ls-BseUHy_m.js.map +1 -0
- package/dist/chunks/migrate-D4w_dXDm.js +268 -0
- package/dist/chunks/migrate-D4w_dXDm.js.map +1 -0
- package/dist/chunks/{nanny-B-Eu0sFW.js → nanny-BWh7nuvv.js} +21 -14
- package/dist/chunks/nanny-BWh7nuvv.js.map +1 -0
- package/dist/chunks/{nanny-ChMtq1Zl.js → nanny-BjF2-1pv.js} +3 -3
- package/dist/chunks/{nanny-ChMtq1Zl.js.map → nanny-BjF2-1pv.js.map} +1 -1
- package/dist/chunks/nanny-DGTXVq5d.js +806 -0
- package/dist/chunks/nanny-DGTXVq5d.js.map +1 -0
- package/dist/chunks/{nanny-sweep-DErnlPY1.js → nanny-sweep-hjmZ_p7S.js} +14 -24
- package/dist/chunks/nanny-sweep-hjmZ_p7S.js.map +1 -0
- package/dist/chunks/{nearest-6KgQEDUe.js → nearest-DOx4jySJ.js} +2 -10
- package/dist/chunks/nearest-DOx4jySJ.js.map +1 -0
- package/dist/chunks/{parse-DhmG26fI.js → parse-DVMPLUDe.js} +47 -72
- package/dist/chunks/parse-DVMPLUDe.js.map +1 -0
- package/dist/chunks/password-policy-Clq6PGE-.js +9 -0
- package/dist/chunks/password-policy-Clq6PGE-.js.map +1 -0
- package/dist/chunks/{paths-CGlGDrOU.js → paths-C34-TJLh.js} +32 -56
- package/dist/chunks/paths-C34-TJLh.js.map +1 -0
- package/dist/chunks/{port-B8WBTRMk.js → port-CnsrxKNR.js} +27 -71
- package/dist/chunks/port-CnsrxKNR.js.map +1 -0
- package/dist/chunks/process-CboOFPU_.js +192 -0
- package/dist/chunks/process-CboOFPU_.js.map +1 -0
- package/dist/chunks/{restart-Des4DrAN.js → restart-C0J8dZ2L.js} +11 -29
- package/dist/chunks/restart-C0J8dZ2L.js.map +1 -0
- package/dist/chunks/run-deploy-DoNDvwT4.js +91 -0
- package/dist/chunks/run-deploy-DoNDvwT4.js.map +1 -0
- package/dist/chunks/{schema-B240VXcV.js → schema-CZ6f-PHD.js} +7 -20
- package/dist/chunks/schema-CZ6f-PHD.js.map +1 -0
- package/dist/chunks/secret-MY397r90.js +219 -0
- package/dist/chunks/secret-MY397r90.js.map +1 -0
- package/dist/chunks/secrets-CG5N4lwY.js +1061 -0
- package/dist/chunks/secrets-CG5N4lwY.js.map +1 -0
- package/dist/chunks/server-Dm_dXfTW.js +255 -0
- package/dist/chunks/server-Dm_dXfTW.js.map +1 -0
- package/dist/chunks/server-attention-UQwYXqKe.js +10 -0
- package/dist/chunks/server-attention-UQwYXqKe.js.map +1 -0
- package/dist/chunks/server-create-D7nvhgBd.js +96 -0
- package/dist/chunks/server-create-D7nvhgBd.js.map +1 -0
- package/dist/chunks/server-ids-BEQD2rFz.js +23 -0
- package/dist/chunks/server-ids-BEQD2rFz.js.map +1 -0
- package/dist/chunks/server-vars-DMYmHutL.js +27 -0
- package/dist/chunks/server-vars-DMYmHutL.js.map +1 -0
- package/dist/chunks/service-C8l-ewNA.js +585 -0
- package/dist/chunks/service-C8l-ewNA.js.map +1 -0
- package/dist/chunks/{settings-xu-XTfWg.js → settings-CtYDs5PX.js} +62 -78
- package/dist/chunks/settings-CtYDs5PX.js.map +1 -0
- package/dist/chunks/{setup-temp-CAN4_bA-.js → setup-temp-TAtDmMMU.js} +43 -37
- package/dist/chunks/setup-temp-TAtDmMMU.js.map +1 -0
- package/dist/chunks/shape-CDGeYl_J.js +9 -0
- package/dist/chunks/shape-CDGeYl_J.js.map +1 -0
- package/dist/chunks/{src-BtWMFmzZ.js → src-BnzkVy_M.js} +12548 -10576
- package/dist/chunks/src-BnzkVy_M.js.map +1 -0
- package/dist/chunks/{status-DT1EsA-B.js → status-efbbfYZQ.js} +53 -26
- package/dist/chunks/status-efbbfYZQ.js.map +1 -0
- package/dist/chunks/store-Bs_Lljjm.js +2082 -0
- package/dist/chunks/store-Bs_Lljjm.js.map +1 -0
- package/dist/chunks/template-xan58bJh.js +28 -0
- package/dist/chunks/template-xan58bJh.js.map +1 -0
- package/dist/chunks/token-DDeWfZA4.js +142 -0
- package/dist/chunks/token-DDeWfZA4.js.map +1 -0
- package/dist/chunks/{ui-D562aqw5.js → ui-BcIAtyxE.js} +68 -79
- package/dist/chunks/ui-BcIAtyxE.js.map +1 -0
- package/dist/chunks/{ui-dir-CsU3uLNV.js → ui-dir-ClCzVRc3.js} +3 -7
- package/dist/chunks/ui-dir-ClCzVRc3.js.map +1 -0
- package/dist/chunks/ui-format-CDvvqOoi.js +53 -0
- package/dist/chunks/ui-format-CDvvqOoi.js.map +1 -0
- package/dist/chunks/{ui-release-DKzVvlLd.js → ui-release-XbJ85pYI.js} +36 -38
- package/dist/chunks/ui-release-XbJ85pYI.js.map +1 -0
- package/dist/chunks/{ui-revert-EkBBwRTt.js → ui-revert-Dgawq7ze.js} +4 -4
- package/dist/chunks/ui-revert-Dgawq7ze.js.map +1 -0
- package/dist/chunks/{ui-switch-BnZTdMDd.js → ui-switch-CfQMbZ0g.js} +31 -38
- package/dist/chunks/ui-switch-CfQMbZ0g.js.map +1 -0
- package/dist/chunks/{ui-update-_xryLYxw.js → ui-update-B3PPivUm.js} +30 -48
- package/dist/chunks/ui-update-B3PPivUm.js.map +1 -0
- package/dist/chunks/ui-update-CAiH2tFb.js +109 -0
- package/dist/chunks/ui-update-CAiH2tFb.js.map +1 -0
- package/dist/chunks/{up-Pdz-l6IH.js → up-BQSnYxYd.js} +47 -53
- package/dist/chunks/up-BQSnYxYd.js.map +1 -0
- package/dist/chunks/{usage-DFrCVXpT.js → usage-KG8TeOio.js} +7 -20
- package/dist/chunks/usage-KG8TeOio.js.map +1 -0
- package/dist/chunks/{workspaces-DYcfvKV_.js → workspaces-D9akpzU8.js} +80 -68
- package/dist/chunks/workspaces-D9akpzU8.js.map +1 -0
- package/dist/chunks/{wsl-temperature-BiCI4iK6.js → wsl-temperature-D-_d4Yk1.js} +47 -42
- package/dist/chunks/wsl-temperature-D-_d4Yk1.js.map +1 -0
- package/dist/cli.js +306 -238
- package/dist/cli.js.map +1 -1
- package/dist/client.js +76 -29
- package/dist/client.js.map +1 -1
- package/dist/types/api/acme.d.ts +3 -7
- package/dist/types/api/auth/$.routes.d.ts +107 -16
- package/dist/types/api/backups.d.ts +5 -5
- package/dist/types/api/control.d.ts +747 -38
- package/dist/types/api/ddns.d.ts +13 -18
- package/dist/types/api/events.d.ts +9 -3
- package/dist/types/api/health.d.ts +2 -4
- package/dist/types/api/jobs.d.ts +438 -0
- package/dist/types/api/logs.d.ts +20 -0
- package/dist/types/api/metrics.d.ts +2 -5
- package/dist/types/api/notifications.d.ts +3 -6
- package/dist/types/api/proxy.d.ts +63 -23
- package/dist/types/api/server-ops.d.ts +17 -0
- package/dist/types/api/servers/$.routes.d.ts +418 -186
- package/dist/types/api/session-required.d.ts +16 -0
- package/dist/types/api/settings.d.ts +7 -7
- package/dist/types/api/state.d.ts +100 -10
- package/dist/types/api/static.d.ts +2 -2
- package/dist/types/api/tls.d.ts +2 -5
- package/dist/types/api/workspaces/$.routes.d.ts +186 -12
- package/dist/types/api/wsl-temperature.d.ts +4 -10
- package/dist/types/app.d.ts +4511 -2778
- package/dist/types/cli/account.d.ts +23 -0
- package/dist/types/cli/add.d.ts +96 -0
- package/dist/types/cli/args.d.ts +24 -35
- package/dist/types/cli/backup-offline.d.ts +2 -8
- package/dist/types/cli/backup.d.ts +12 -21
- package/dist/types/cli/down.d.ts +15 -41
- package/dist/types/cli/import-plan.d.ts +55 -0
- package/dist/types/cli/import-write.d.ts +5 -0
- package/dist/types/cli/import.d.ts +86 -0
- package/dist/types/cli/io.d.ts +26 -35
- package/dist/types/cli/job.d.ts +99 -0
- package/dist/types/cli/logs.d.ts +1 -10
- package/dist/types/cli/ls.d.ts +57 -0
- package/dist/types/cli/migrate.d.ts +31 -8
- package/dist/types/cli/nearest.d.ts +1 -9
- package/dist/types/cli/run-deploy.d.ts +36 -0
- package/dist/types/cli/secret.d.ts +90 -0
- package/dist/types/cli/server.d.ts +6 -15
- package/dist/types/cli/service.d.ts +135 -0
- package/dist/types/cli/setup-temp.d.ts +17 -13
- package/dist/types/cli/status.d.ts +7 -1
- package/dist/types/cli/token.d.ts +6 -0
- package/dist/types/cli/ui-switch.d.ts +3 -14
- package/dist/types/cli/ui-update.d.ts +3 -16
- package/dist/types/cli/up.d.ts +9 -22
- package/dist/types/cli/usage.d.ts +2 -6
- package/dist/types/cli.d.ts +1 -10
- package/dist/types/client.d.ts +4099 -1142
- package/dist/types/config/accounts.d.ts +16 -0
- package/dist/types/config/jobs.d.ts +68 -0
- package/dist/types/config/layout.d.ts +2 -8
- package/dist/types/config/migrations.d.ts +9 -41
- package/dist/types/config/parse.d.ts +8 -13
- package/dist/types/config/patch.d.ts +1 -6
- package/dist/types/config/schema.d.ts +16 -18
- package/dist/types/config/secret-parts.d.ts +6 -27
- package/dist/types/config/secrets.d.ts +167 -88
- package/dist/types/config/seed.d.ts +1 -6
- package/dist/types/config/server-ids.d.ts +2 -11
- package/dist/types/config/settings.d.ts +13 -49
- package/dist/types/config/store.d.ts +17 -54
- package/dist/types/config/workspaces.d.ts +24 -56
- package/dist/types/helpers/action-result.d.ts +18 -32
- package/dist/types/helpers/atomic.d.ts +1 -4
- package/dist/types/helpers/backoff.d.ts +0 -1
- package/dist/types/helpers/bind.d.ts +3 -11
- package/dist/types/helpers/config-text.d.ts +4 -19
- package/dist/types/helpers/cookies.d.ts +2 -7
- package/dist/types/helpers/copy-tree.d.ts +4 -12
- package/dist/types/helpers/daemon-log.d.ts +8 -33
- package/dist/types/helpers/daemon.d.ts +20 -70
- package/dist/types/helpers/deferred.d.ts +2 -4
- package/dist/types/helpers/env-file.d.ts +2 -7
- package/dist/types/helpers/error.d.ts +3 -14
- package/dist/types/helpers/event-stream.d.ts +18 -10
- package/dist/types/helpers/factory.d.ts +2 -3
- package/dist/types/helpers/last-stop.d.ts +5 -12
- package/dist/types/helpers/logger.d.ts +1 -5
- package/dist/types/helpers/open.d.ts +0 -1
- package/dist/types/helpers/openapi.d.ts +19 -5
- package/dist/types/helpers/paths.d.ts +18 -53
- package/dist/types/helpers/restore-lock.d.ts +2 -17
- package/dist/types/helpers/runtime.d.ts +3 -13
- package/dist/types/helpers/secret-compare.d.ts +2 -10
- package/dist/types/helpers/server-create.d.ts +15 -0
- package/dist/types/helpers/shell.d.ts +2 -16
- package/dist/types/helpers/sse.d.ts +8 -6
- package/dist/types/helpers/ui-dir.d.ts +1 -5
- package/dist/types/helpers/utf8-chunks.d.ts +2 -8
- package/dist/types/helpers/validate.d.ts +2 -4
- package/dist/types/helpers/validator.d.ts +8 -4
- package/dist/types/helpers/version.d.ts +1 -6
- package/dist/types/helpers/workspace.d.ts +24 -16
- package/dist/types/index.d.ts +2 -3
- package/dist/types/middleware/auth.d.ts +8 -27
- package/dist/types/middleware/body-limit.d.ts +10 -0
- package/dist/types/middleware/host.d.ts +4 -23
- package/dist/types/middleware/loopback.d.ts +1 -8
- package/dist/types/middleware/token-scope.d.ts +34 -0
- package/dist/types/node-compat.d.ts +43 -0
- package/dist/types/openapi-reference.d.ts +4 -19
- package/dist/types/openapi.d.ts +5 -8
- package/dist/types/providers/archive.d.ts +8 -25
- package/dist/types/providers/backup-hook.d.ts +4 -19
- package/dist/types/providers/ddns/dyndns2.d.ts +0 -3
- package/dist/types/providers/ddns/index.d.ts +2 -3
- package/dist/types/providers/ddns/ip.d.ts +2 -12
- package/dist/types/providers/ddns/namecheap-api.d.ts +3 -2
- package/dist/types/providers/ddns/types.d.ts +6 -32
- package/dist/types/providers/ddns/zone.d.ts +1 -4
- package/dist/types/providers/docker.d.ts +18 -45
- package/dist/types/providers/entry-state.d.ts +4 -9
- package/dist/types/providers/health-check.d.ts +1 -5
- package/dist/types/providers/host.d.ts +33 -108
- package/dist/types/providers/identity.d.ts +9 -34
- package/dist/types/providers/log-tail.d.ts +14 -24
- package/dist/types/providers/nanny-sweep.d.ts +8 -25
- package/dist/types/providers/nanny.d.ts +16 -58
- package/dist/types/providers/port.d.ts +28 -83
- package/dist/types/providers/proc.d.ts +22 -80
- package/dist/types/providers/process.d.ts +12 -36
- package/dist/types/providers/proxy/admin.d.ts +11 -0
- package/dist/types/providers/proxy/types.d.ts +4 -16
- package/dist/types/providers/telegram.d.ts +1 -17
- package/dist/types/providers/ui-release.d.ts +15 -25
- package/dist/types/providers/webhook.d.ts +8 -29
- package/dist/types/providers/wsl-temperature.d.ts +13 -22
- package/dist/types/services/acme-challenge.d.ts +2 -16
- package/dist/types/services/auth.d.ts +65 -80
- package/dist/types/services/backups/archive-safety.d.ts +30 -0
- package/dist/types/services/backups/paths.d.ts +31 -0
- package/dist/types/services/backups.d.ts +61 -271
- package/dist/types/services/config-watch.d.ts +3 -15
- package/dist/types/services/control-server.d.ts +6 -10
- package/dist/types/services/ddns.d.ts +12 -13
- package/dist/types/services/dependencies.d.ts +3 -14
- package/dist/types/services/deploy.d.ts +34 -0
- package/dist/types/services/events.d.ts +15 -9
- package/dist/types/services/exposure.d.ts +13 -63
- package/dist/types/services/history.d.ts +5 -14
- package/dist/types/services/host-monitor.d.ts +6 -11
- package/dist/types/services/init.d.ts +5 -35
- package/dist/types/services/job-ledger.d.ts +27 -0
- package/dist/types/services/jobs.d.ts +113 -0
- package/dist/types/services/log-buffer.d.ts +7 -8
- package/dist/types/services/log-files.d.ts +12 -42
- package/dist/types/services/log-relay.d.ts +3 -13
- package/dist/types/services/nanny.d.ts +3 -10
- package/dist/types/services/notifications.d.ts +31 -61
- package/dist/types/services/panel.d.ts +32 -78
- package/dist/types/services/proxy-certificates/certificates.d.ts +31 -69
- package/dist/types/services/proxy-config.d.ts +15 -36
- package/dist/types/services/proxy-dns01.d.ts +14 -0
- package/dist/types/services/proxy.d.ts +73 -254
- package/dist/types/services/scheduler.d.ts +46 -0
- package/dist/types/services/state.d.ts +17 -8
- package/dist/types/services/supervisor/compose.d.ts +2 -6
- package/dist/types/services/supervisor/entry.d.ts +29 -32
- package/dist/types/services/supervisor/health.d.ts +8 -31
- package/dist/types/services/supervisor/job-run.d.ts +36 -0
- package/dist/types/services/supervisor/output.d.ts +13 -77
- package/dist/types/services/supervisor/persistent.d.ts +5 -11
- package/dist/types/services/supervisor/port-preflight.d.ts +4 -10
- package/dist/types/services/supervisor/records.d.ts +27 -60
- package/dist/types/services/supervisor/restart-required.d.ts +13 -0
- package/dist/types/services/supervisor/spawn.d.ts +3 -5
- package/dist/types/services/supervisor/view.d.ts +3 -1
- package/dist/types/services/supervisor.d.ts +31 -43
- package/dist/types/services/tls.d.ts +6 -17
- package/dist/types/services/ui-update.d.ts +19 -17
- package/dist/types/services/ui.d.ts +10 -19
- package/dist/types/shared/action-outcome.d.ts +2 -7
- package/dist/types/shared/api-client.d.ts +133 -177
- package/dist/types/shared/api-scopes.d.ts +17 -0
- package/dist/types/shared/backup-scope.d.ts +16 -90
- package/dist/types/shared/clone.d.ts +2 -11
- package/dist/types/shared/contracts/accounts.d.ts +99 -0
- package/dist/types/shared/contracts/backups.d.ts +219 -0
- package/dist/types/shared/contracts/ddns.d.ts +208 -0
- package/dist/types/shared/contracts/frames.d.ts +1395 -0
- package/dist/types/shared/contracts/index.d.ts +3 -0
- package/dist/types/shared/contracts/logs.d.ts +107 -0
- package/dist/types/shared/contracts/proxy.d.ts +303 -0
- package/dist/types/shared/contracts.d.ts +852 -1982
- package/dist/types/shared/cpu-scale.d.ts +3 -19
- package/dist/types/shared/crash-cause.d.ts +8 -0
- package/dist/types/shared/cron.d.ts +70 -0
- package/dist/types/shared/ddns-form.d.ts +9 -43
- package/dist/types/shared/endpoint.d.ts +1 -7
- package/dist/types/shared/error-codes.d.ts +438 -0
- package/dist/types/shared/error-message.d.ts +1 -7
- package/dist/types/shared/fields.d.ts +7 -17
- package/dist/types/shared/form-repair.d.ts +1 -5
- package/dist/types/shared/generated.d.ts +3 -19
- package/dist/types/shared/host-readings.d.ts +25 -128
- package/dist/types/shared/lazy.d.ts +1 -1
- package/dist/types/shared/live-frames.d.ts +2 -8
- package/dist/types/shared/live-series.d.ts +2 -8
- package/dist/types/shared/live-store.d.ts +4 -8
- package/dist/types/shared/log-download.d.ts +6 -0
- package/dist/types/shared/meta.d.ts +6 -0
- package/dist/types/shared/password-policy.d.ts +10 -0
- package/dist/types/shared/patch-diff.d.ts +13 -72
- package/dist/types/shared/port-reading.d.ts +18 -0
- package/dist/types/shared/probe-latency.d.ts +3 -21
- package/dist/types/shared/proxy-form.d.ts +33 -74
- package/dist/types/shared/proxy-validate.d.ts +11 -0
- package/dist/types/shared/query-params.d.ts +8 -0
- package/dist/types/shared/server-attention.d.ts +2 -27
- package/dist/types/shared/server-form.d.ts +15 -54
- package/dist/types/shared/server-key.d.ts +1 -12
- package/dist/types/shared/server-readings.d.ts +7 -32
- package/dist/types/shared/server-url.d.ts +9 -31
- package/dist/types/shared/shape.d.ts +1 -16
- package/dist/types/shared/stream-access.d.ts +2 -8
- package/dist/types/shared/ui-format.d.ts +25 -65
- package/docs/API.md +315 -107
- package/docs/BACKUPS.md +61 -56
- package/docs/CLI.md +255 -49
- package/docs/DDNS.md +35 -49
- package/docs/JOBS.md +129 -0
- package/docs/NOTIFICATIONS.md +58 -90
- package/docs/REVERSE_PROXY.md +116 -188
- package/docs/SECURITY.md +126 -44
- package/docs/SERVERS.md +282 -409
- package/docs/UI_CREATION.md +90 -47
- package/docs/demo/blank-host-restore.sh +31 -7
- package/package.json +15 -6
- package/scripts/prepare.mjs +47 -0
- package/uis/stock/dist/assets/CopyButton-8mliL0xi.js +1 -0
- package/uis/stock/dist/assets/GlobalSettingsView-BINXY77E.js +1 -0
- package/uis/stock/dist/assets/LogViewer-kiSnTwdY.js +1 -0
- package/uis/stock/dist/assets/LogsView-DDXf_ONs.js +1 -0
- package/uis/stock/dist/assets/Modal-lrUuViF2.js +39 -0
- package/uis/stock/dist/assets/ProxyView-uXMaJdSQ.js +1 -0
- package/uis/stock/dist/assets/ServerDetailView-CW0Vb_c0.js +4 -0
- package/uis/stock/dist/assets/SettingsShell-B135xWjJ.js +1 -0
- package/uis/stock/dist/assets/SettingsView-BLtWxVkl.js +2 -0
- package/uis/stock/dist/assets/de-BIoTrHBQ.js +1 -0
- package/uis/stock/dist/assets/es-x4-ih8lH.js +1 -0
- package/uis/stock/dist/assets/fr-DatqBBkO.js +1 -0
- package/uis/stock/dist/assets/index-CnojaKcA.css +2 -0
- package/uis/stock/dist/assets/index-D-CiZReu.js +16 -0
- package/uis/stock/dist/assets/ja-CW1703Gw.js +1 -0
- package/uis/stock/dist/assets/ko-wFbT4XtK.js +1 -0
- package/uis/stock/dist/assets/ru-C1p5C4VN.js +1 -0
- package/uis/stock/dist/assets/useUnsavedGuard-BcsXsfCC.js +9 -0
- package/uis/stock/dist/assets/vi-CDqr0uie.js +1 -0
- package/uis/stock/dist/assets/zh-CN-BJ7iit-X.js +1 -0
- package/uis/stock/dist/index.html +4 -3
- package/uis/stock/dist/ui.json +3 -3
- package/dist/chunks/archive-DP-XQR8X.js.map +0 -1
- package/dist/chunks/atomic-C1PfJpE7.js.map +0 -1
- package/dist/chunks/backup-CZcVca2a.js.map +0 -1
- package/dist/chunks/backups-CFRaWe_m.js +0 -4691
- package/dist/chunks/backups-CFRaWe_m.js.map +0 -1
- package/dist/chunks/config-text-DifCHhnz.js +0 -50
- package/dist/chunks/config-text-DifCHhnz.js.map +0 -1
- package/dist/chunks/contracts-CMBD1TF9.js.map +0 -1
- package/dist/chunks/daemon-log-BVj8cDEo.js +0 -241
- package/dist/chunks/daemon-log-BVj8cDEo.js.map +0 -1
- package/dist/chunks/daemon-qKVECISl.js +0 -247
- package/dist/chunks/daemon-qKVECISl.js.map +0 -1
- package/dist/chunks/docker-Cy9Lyvda.js.map +0 -1
- package/dist/chunks/down-pKbGCW9d.js.map +0 -1
- package/dist/chunks/init-BZ7hK9Vf.js.map +0 -1
- package/dist/chunks/last-stop-C-BXz_XI.js +0 -53
- package/dist/chunks/last-stop-C-BXz_XI.js.map +0 -1
- package/dist/chunks/layout-DwTtmund.js +0 -24
- package/dist/chunks/layout-DwTtmund.js.map +0 -1
- package/dist/chunks/lazy-Ce5zEAq1.js +0 -66
- package/dist/chunks/lazy-Ce5zEAq1.js.map +0 -1
- package/dist/chunks/log-buffer-Dy9HHDMD.js +0 -414
- package/dist/chunks/log-buffer-Dy9HHDMD.js.map +0 -1
- package/dist/chunks/logger-B5U4GD3j.js.map +0 -1
- package/dist/chunks/logs---TI_bxM.js.map +0 -1
- package/dist/chunks/migrate-Cfoq-Vgh.js +0 -155
- package/dist/chunks/migrate-Cfoq-Vgh.js.map +0 -1
- package/dist/chunks/nanny-B-Eu0sFW.js.map +0 -1
- package/dist/chunks/nanny-BtWfy0QH.js +0 -1167
- package/dist/chunks/nanny-BtWfy0QH.js.map +0 -1
- package/dist/chunks/nanny-sweep-DErnlPY1.js.map +0 -1
- package/dist/chunks/nearest-6KgQEDUe.js.map +0 -1
- package/dist/chunks/parse-DhmG26fI.js.map +0 -1
- package/dist/chunks/paths-CGlGDrOU.js.map +0 -1
- package/dist/chunks/port-B8WBTRMk.js.map +0 -1
- package/dist/chunks/restart-Des4DrAN.js.map +0 -1
- package/dist/chunks/schema-B240VXcV.js.map +0 -1
- package/dist/chunks/secrets-BieELnZh.js +0 -562
- package/dist/chunks/secrets-BieELnZh.js.map +0 -1
- package/dist/chunks/server-Bge2r2qQ.js +0 -169
- package/dist/chunks/server-Bge2r2qQ.js.map +0 -1
- package/dist/chunks/server-ids-DRuNLVCV.js +0 -32
- package/dist/chunks/server-ids-DRuNLVCV.js.map +0 -1
- package/dist/chunks/set-password-D5vZqqSX.js +0 -43
- package/dist/chunks/set-password-D5vZqqSX.js.map +0 -1
- package/dist/chunks/set-token-obPiEJYk.js +0 -78
- package/dist/chunks/set-token-obPiEJYk.js.map +0 -1
- package/dist/chunks/settings-xu-XTfWg.js.map +0 -1
- package/dist/chunks/setup-temp-CAN4_bA-.js.map +0 -1
- package/dist/chunks/shape-DnTKzjQ2.js +0 -24
- package/dist/chunks/shape-DnTKzjQ2.js.map +0 -1
- package/dist/chunks/src-BtWMFmzZ.js.map +0 -1
- package/dist/chunks/status-DT1EsA-B.js.map +0 -1
- package/dist/chunks/ui-D562aqw5.js.map +0 -1
- package/dist/chunks/ui-dir-CsU3uLNV.js.map +0 -1
- package/dist/chunks/ui-release-DKzVvlLd.js.map +0 -1
- package/dist/chunks/ui-revert-EkBBwRTt.js.map +0 -1
- package/dist/chunks/ui-switch-BnZTdMDd.js.map +0 -1
- package/dist/chunks/ui-update-_xryLYxw.js.map +0 -1
- package/dist/chunks/up-Pdz-l6IH.js.map +0 -1
- package/dist/chunks/usage-DFrCVXpT.js.map +0 -1
- package/dist/chunks/workspaces-DYcfvKV_.js.map +0 -1
- package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +0 -1
- package/dist/types/cli/set-password.d.ts +0 -14
- package/dist/types/cli/set-token.d.ts +0 -21
- package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +0 -1
- package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +0 -1
- package/uis/stock/dist/assets/LogViewer-DIliXy62.js +0 -1
- package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +0 -1
- package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +0 -39
- package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +0 -1
- package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +0 -2
- package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +0 -1
- package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +0 -2
- package/uis/stock/dist/assets/de-BRITeb0H.js +0 -1
- package/uis/stock/dist/assets/es-B2zIEssV.js +0 -1
- package/uis/stock/dist/assets/fr-s0ZOBEqh.js +0 -1
- package/uis/stock/dist/assets/index-C1MehbKy.css +0 -2
- package/uis/stock/dist/assets/index-CnBN54wF.js +0 -15
- package/uis/stock/dist/assets/ja-CU7MR85V.js +0 -1
- package/uis/stock/dist/assets/ko-tL5Me6d-.js +0 -1
- package/uis/stock/dist/assets/ru-92yrvkNJ.js +0 -1
- package/uis/stock/dist/assets/vi-CzvY16k2.js +0 -1
- package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-DEIYVkNK.js","names":[],"sources":["../../src/cli/add.ts"],"sourcesContent":["import process from 'node:process'\nimport { defineCommand, parseArgs } from 'citty'\nimport { dim, fail, green, invocation, paint } from '#src/cli/io'\nimport { errorMessage } from '#src/shared/error-message'\n\n/**\n * `add <id> [--port N] [--cwd DIR] [--workspace W] [--persistent] [--autostart] [--secret-env NAME]… -- <command> [args…]`\n *\n * Through the running panel when it is up, otherwise into `servers.config.json` with the same\n * validation. The entry is not started.\n */\n\nexport const addArgs = {\n id: { type: 'positional', required: false, description: 'the new server id (a-z, 0-9, - and _)' },\n port: { type: 'string', description: 'the port it listens on' },\n cwd: { type: 'string', description: 'its working directory' },\n workspace: { type: 'string', alias: 'w', description: 'the workspace to add it to (default: the default workspace)' },\n persistent: { type: 'boolean', description: 'keep it running when the panel stops' },\n autostart: { type: 'boolean', description: 'start it whenever the panel starts' },\n secretEnv: { type: 'string', description: 'declare a secret environment variable (repeatable, or comma-separated)' },\n} as const\n\nconst ID_PATTERN = /^[a-z0-9][a-z0-9_-]*$/\nconst ID_RULE = 'lowercase letters, digits, - and _, starting with a letter or digit'\n\nexport interface AddInput {\n id?: string\n port?: string\n cwd?: string\n persistent?: boolean\n autostart?: boolean\n /** Every `--secret-env` value, each possibly a comma list. */\n secretEnv?: string[]\n command: string[]\n}\n\n/** The create body for these flags, or the sentence that refuses them; the caller checks the schema. */\nexport function buildServerEntry(input: AddInput): { entry: Record<string, unknown>, warnings: string[] } | { error: string } {\n const id = input.id?.trim() ?? ''\n if (id.length === 0)\n return { error: 'add needs a server id — `add <id> -- <command> [args…]`' }\n if (!ID_PATTERN.test(id))\n return { error: `invalid server id \"${id}\": use ${ID_RULE}` }\n const [command, ...args] = input.command\n if (command === undefined || command.trim().length === 0)\n return { error: `add needs the command after \\`--\\` — \\`add ${id} -- node server.js\\`` }\n\n const warnings: string[] = []\n // A quoted `\"node server.js\"` reaches us as one word, which is looked up as one program name.\n if (/\\s/.test(command.trim())) {\n const [program, ...rest] = command.trim().split(/\\s+/)\n warnings.push(`the command \"${command}\" contains a space, so it is run as one program of that name, not as a shell line — to run ${program} with arguments, leave them unquoted: \\`add ${id} -- ${[program, ...rest, ...args].join(' ')}\\``)\n }\n\n const secretEnv = [...new Set((input.secretEnv ?? []).flatMap(value => value.split(',')).map(name => name.trim()).filter(name => name.length > 0))]\n const badName = secretEnv.find(name => !/^[A-Z_]\\w*$/i.test(name))\n if (badName !== undefined)\n return { error: `invalid --secret-env name \"${badName}\": a letter or underscore, then letters, digits or underscores` }\n\n let port: number | undefined\n if (input.port !== undefined) {\n const raw = input.port.trim()\n port = /^\\d+$/.test(raw) ? Number.parseInt(raw, 10) : Number.NaN\n if (!Number.isInteger(port) || port <= 0 || port > 65535)\n return { error: `invalid port: ${input.port}` }\n }\n if (input.cwd !== undefined && input.cwd.trim().length === 0)\n return { error: '--cwd needs a directory' }\n\n return {\n entry: {\n id,\n command,\n args,\n ...(port === undefined ? {} : { port }),\n ...(input.cwd === undefined ? {} : { cwd: input.cwd }),\n ...(input.persistent === true ? { persistent: true } : {}),\n ...(input.autostart === true ? { autostart: true } : {}),\n ...(secretEnv.length === 0 ? {} : { secretEnv }),\n },\n warnings,\n }\n}\n\n/** Every value given to `--secret-env`, in either spelling, from the words before `--`. */\nexport function secretEnvFlags(declaration: readonly string[]): string[] {\n const values: string[] = []\n for (let index = 0; index < declaration.length; index++) {\n const word = declaration[index]!\n if (word === '--secret-env' || word === '--secretEnv') {\n const value = declaration[index + 1]\n if (value !== undefined)\n values.push(value)\n index += 1\n }\n else if (word.startsWith('--secret-env=') || word.startsWith('--secretEnv=')) {\n values.push(word.slice(word.indexOf('=') + 1))\n }\n }\n return values\n}\n\nexport function commandAfterDashes(rawArgs: readonly string[]): string[] {\n const index = rawArgs.indexOf('--')\n return index === -1 ? [] : rawArgs.slice(index + 1)\n}\n\n/**\n * The words before the first `--`. citty's positional filler reads the whole argv, so without this\n * `add -- node server.js` would bind `id = \"node\"`.\n */\nexport function declarationAfterDashes(rawArgs: readonly string[]): string[] {\n const index = rawArgs.indexOf('--')\n return index === -1 ? [...rawArgs] : rawArgs.slice(0, index)\n}\n\nexport async function runAdd(input: AddInput, workspace?: string): Promise<void> {\n const built = buildServerEntry(input)\n if ('error' in built)\n fail(built.error)\n const { entry, warnings } = built\n const id = String(entry.id)\n for (const warning of warnings)\n process.stderr.write(`${paint('33', 'note')} ${warning}\\n`)\n\n const { serverCreateSchema } = await import('#src/shared/contracts')\n const { type } = await import('arktype')\n const checked = serverCreateSchema(entry)\n if (checked instanceof type.errors)\n fail(`invalid server: ${checked.summary}`)\n\n const { readRuntime, requestControl, runtimeIsAlive } = await import('#src/helpers/daemon')\n const runtime = readRuntime()\n const live = runtime !== null && await runtimeIsAlive(runtime)\n const where = workspace === undefined || workspace.length === 0 ? '' : `?workspace=${encodeURIComponent(workspace)}`\n let workspaceId = workspace\n\n if (live) {\n const answer = await requestControl(runtime, `/_hh/servers${where}`, 15_000, 'POST', entry)\n if (answer === null)\n fail(`the control panel is not answering on ${runtime.probeUrl}`)\n if (answer.status === 404 && (answer.body as { code?: string } | null)?.code !== 'UNKNOWN_WORKSPACE')\n fail(`the panel on ${runtime.url} is home-hosted ${runtime.version}, which cannot add a server from the CLI — restart it on this release, or use the panel`)\n if (answer.status !== 201)\n fail((answer.body as { message?: string } | null)?.message ?? `the panel answered ${answer.status}`)\n }\n else {\n workspaceId = await addOffline(entry, workspace)\n }\n\n const label = workspaceId === undefined || workspaceId.length === 0 || workspaceId === 'default' ? id : `${workspaceId}/${id}`\n const flag = workspace === undefined || workspace.length === 0 ? '' : ` -w ${workspace}`\n process.stdout.write(`${green('added')} ${label}\\n`)\n const secretEnv = (entry.secretEnv as string[] | undefined) ?? []\n if (secretEnv.length > 0)\n process.stdout.write(`${dim(`set ${secretEnv.length === 1 ? 'its secret' : 'each secret'}: ${secretEnv.map(name => `\\`${invocation()} secret set ${id} ${name}${flag}\\``).join(', ')}`)}\\n`)\n if (live)\n process.stdout.write(`${dim(`not started${entry.autostart === true ? ' (autostart applies when the panel starts)' : ''} — \\`${invocation()} start ${id}${flag}\\``)}\\n`)\n else\n process.stdout.write(`${dim(`the panel is not running — \\`${invocation()} up\\`${entry.autostart === true ? ` starts it with ${id}` : `, then \\`${invocation()} start ${id}${flag}\\``}`)}\\n`)\n}\n\nasync function addOffline(entry: Record<string, unknown>, workspace?: string): Promise<string> {\n const { readDefaultWorkspaceId, WorkspaceRegistry } = await import('#src/config/workspaces')\n const { WorkspaceStore } = await import('#src/config/store')\n const { addServerEntry } = await import('#src/helpers/server-create')\n const { workspaceServersPath, workspaceSettingsPath, workspacesPath } = await import('#src/helpers/paths')\n const fs = await import('node:fs')\n\n const id = workspace === undefined || workspace.length === 0 ? readDefaultWorkspaceId(workspacesPath) : workspace\n if (fs.existsSync(workspacesPath)) {\n const registry = new WorkspaceRegistry(workspacesPath)\n registry.load({ write: false })\n if (registry.configError !== null)\n fail(`cannot read ${workspacesPath}: ${registry.configError}`)\n if (!registry.all().some(known => known.id === id))\n fail(`unknown workspace \"${id}\" — add it in the panel first (known: ${registry.all().map(known => known.id).join(', ')})`)\n }\n else if (id !== 'default') {\n fail(`unknown workspace \"${id}\" — this home has only the default workspace`)\n }\n\n const store = new WorkspaceStore(id, workspaceSettingsPath(id), workspaceServersPath(id))\n store.load()\n if (store.pendingMigrations.length > 0)\n fail(`${store.path} needs ${store.pendingMigrations.length} migration(s) first — \\`${invocation()} migrate\\``)\n if (store.configError !== null)\n fail(`refusing to write ${store.path}: ${store.configError}`)\n try {\n addServerEntry(store, entry)\n }\n catch (error) {\n fail(errorMessage(error))\n }\n return id\n}\n\nexport const addCommand = defineCommand({\n meta: { name: 'add' },\n args: addArgs,\n run: async ({ args, rawArgs }) => {\n const workspace = typeof args.workspace === 'string' ? args.workspace.trim() : undefined\n // The id comes from the pre-`--` words, re-parsed with the same flag definitions so a flag's value is\n // not taken as the positional.\n const declared = parseArgs(declarationAfterDashes(rawArgs), addArgs)\n await runAdd({\n id: typeof declared.id === 'string' ? declared.id : undefined,\n port: args.port,\n cwd: args.cwd,\n persistent: args.persistent,\n autostart: args.autostart,\n secretEnv: secretEnvFlags(declarationAfterDashes(rawArgs)),\n command: commandAfterDashes(rawArgs),\n }, workspace)\n },\n})\n"],"mappings":";;;;;;;;;;AAYA,IAAa,UAAU;CACrB,IAAI;EAAE,MAAM;EAAc,UAAU;EAAO,aAAa;CAAwC;CAChG,MAAM;EAAE,MAAM;EAAU,aAAa;CAAyB;CAC9D,KAAK;EAAE,MAAM;EAAU,aAAa;CAAwB;CAC5D,WAAW;EAAE,MAAM;EAAU,OAAO;EAAK,aAAa;CAA8D;CACpH,YAAY;EAAE,MAAM;EAAW,aAAa;CAAuC;CACnF,WAAW;EAAE,MAAM;EAAW,aAAa;CAAqC;CAChF,WAAW;EAAE,MAAM;EAAU,aAAa;CAAyE;AACrH;AAEA,IAAM,aAAa;AACnB,IAAM,UAAU;;AAchB,SAAgB,iBAAiB,OAA6F;CAC5H,MAAM,KAAK,MAAM,IAAI,KAAK,KAAK;CAC/B,IAAI,GAAG,WAAW,GAChB,OAAO,EAAE,OAAO,0DAA0D;CAC5E,IAAI,CAAC,WAAW,KAAK,EAAE,GACrB,OAAO,EAAE,OAAO,sBAAsB,GAAG,SAAS,UAAU;CAC9D,MAAM,CAAC,SAAS,GAAG,QAAQ,MAAM;CACjC,IAAI,YAAY,KAAA,KAAa,QAAQ,KAAK,CAAC,CAAC,WAAW,GACrD,OAAO,EAAE,OAAO,8CAA8C,GAAG,sBAAsB;CAEzF,MAAM,WAAqB,CAAC;CAE5B,IAAI,KAAK,KAAK,QAAQ,KAAK,CAAC,GAAG;EAC7B,MAAM,CAAC,SAAS,GAAG,QAAQ,QAAQ,KAAK,CAAC,CAAC,MAAM,KAAK;EACrD,SAAS,KAAK,gBAAgB,QAAQ,6FAA6F,QAAQ,8CAA8C,GAAG,MAAM;GAAC;GAAS,GAAG;GAAM,GAAG;EAAI,CAAC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AO,KAAK;CAC7B,SACO,OAAO;EACZ,KAAK,aAAa,KAAK,CAAC;CAC1B;CACA,OAAO;AACT;AAEA,IAAa,aAAa,cAAc;CACtC,MAAM,EAAE,MAAM,MAAM;CACpB,MAAM;CACN,KAAK,OAAO,EAAE,MAAM,cAAc;EAChC,MAAM,YAAY,OAAO,KAAK,cAAc,WAAW,KAAK,UAAU,KAAK,IAAI,KAAA;EAG/E,MAAM,WAAW,UAAU,uBAAuB,OAAO,GAAG,OAAO;EACnE,MAAM,OAAO;GACX,IAAI,OAAO,SAAS,OAAO,WAAW,SAAS,KAAK,KAAA;GACpD,MAAM,KAAK;GACX,KAAK,KAAK;GACV,YAAY,KAAK;GACjB,WAAW,KAAK;GAChB,WAAW,eAAe,uBAAuB,OAAO,CAAC;GACzD,SAAS,mBAAmB,OAAO;EACrC,GAAG,SAAS;CACd;AACF,CAAC"}
|
|
@@ -9,13 +9,10 @@ import { Readable, Writable } from "node:stream";
|
|
|
9
9
|
import { finished } from "node:stream/promises";
|
|
10
10
|
import { BlobReader, ZipReader, ZipWriter, configure } from "@zip.js/zip.js";
|
|
11
11
|
//#region src/helpers/copy-tree.ts
|
|
12
|
-
/** How long a tree operation may hold the event loop before the panel gets a turn. */
|
|
13
12
|
var SLICE_MS = 10;
|
|
14
13
|
/**
|
|
15
|
-
* A checkpoint that yields to the event loop once `SLICE_MS` of synchronous work has passed.
|
|
16
|
-
*
|
|
17
|
-
* Sync calls in slices, not `fs.promises`: every async call is a thread-pool round trip, which made a
|
|
18
|
-
* tree of small files 10-20x slower to copy and walk than the sync calls it replaced.
|
|
14
|
+
* A checkpoint that yields to the event loop once `SLICE_MS` of synchronous work has passed. Sync
|
|
15
|
+
* calls in slices, because per-call `fs.promises` round trips are far slower on many small files.
|
|
19
16
|
*/
|
|
20
17
|
function eventLoopSlicer() {
|
|
21
18
|
let since = performance.now();
|
|
@@ -28,14 +25,8 @@ function eventLoopSlicer() {
|
|
|
28
25
|
/**
|
|
29
26
|
* `fs.cpSync(source, target, { recursive: true, force: true, filter })`, yielding between entries.
|
|
30
27
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* its source mode after its contents are written.
|
|
34
|
-
*
|
|
35
|
-
* The two roots are dereferenced: a declared `data -> /mnt/disk/data` *is* the data, so it is copied
|
|
36
|
-
* as its target rather than as a link (which the archive walk then drops as outside the tree, leaving
|
|
37
|
-
* an empty capture), and a restore writes into the directory a linked target names instead of
|
|
38
|
-
* refusing it as a non-directory. Links *below* the roots are untouched.
|
|
28
|
+
* The two roots are dereferenced: a declared `data -> /mnt/disk/data` *is* the data. Links *below*
|
|
29
|
+
* the roots are untouched.
|
|
39
30
|
*/
|
|
40
31
|
async function copyTree(source, target, filter) {
|
|
41
32
|
const slice = eventLoopSlicer();
|
|
@@ -51,7 +42,10 @@ async function copyTree(source, target, filter) {
|
|
|
51
42
|
return;
|
|
52
43
|
}
|
|
53
44
|
const existing = fs.lstatSync(to, { throwIfNoEntry: false });
|
|
54
|
-
if (existing !== void 0 && !existing.isDirectory()) throw new DetailedError(`cannot overwrite non-directory ${to} with directory ${from}`, {
|
|
45
|
+
if (existing !== void 0 && !existing.isDirectory()) throw new DetailedError(`cannot overwrite non-directory ${to} with directory ${from}`, {
|
|
46
|
+
statusCode: 400,
|
|
47
|
+
code: "CONFIG_COPY_CONFLICT"
|
|
48
|
+
});
|
|
55
49
|
if (existing === void 0) fs.mkdirSync(to);
|
|
56
50
|
for (const name of fs.readdirSync(from)) await visit(path.join(from, name), path.join(to, name));
|
|
57
51
|
if (existing === void 0) fs.chmodSync(to, stats.mode);
|
|
@@ -59,7 +53,6 @@ async function copyTree(source, target, filter) {
|
|
|
59
53
|
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
60
54
|
await visit(realpathOr(source), realpathOr(target));
|
|
61
55
|
}
|
|
62
|
-
/** The path a link names, or the path itself when it does not resolve (absent, dangling). */
|
|
63
56
|
function realpathOr(target) {
|
|
64
57
|
try {
|
|
65
58
|
return fs.realpathSync(target);
|
|
@@ -70,13 +63,8 @@ function realpathOr(target) {
|
|
|
70
63
|
//#endregion
|
|
71
64
|
//#region src/providers/archive.ts
|
|
72
65
|
/**
|
|
73
|
-
* Backups are ordinary zip files
|
|
74
|
-
* password
|
|
75
|
-
* into Windows and macOS), and produced without a native binary — zip.js is pure
|
|
76
|
-
* JavaScript.
|
|
77
|
-
*
|
|
78
|
-
* A password means WinZip AES-256 (`encryptionStrength: 3`, AE-2): strong, and
|
|
79
|
-
* still standard, unlike the legacy ZipCrypto encryption.
|
|
66
|
+
* Backups are ordinary zip files, openable by any archive manager and written by pure-JS zip.js.
|
|
67
|
+
* A password means WinZip AES-256 (AE-2), not legacy ZipCrypto.
|
|
80
68
|
*/
|
|
81
69
|
configure({ useWebWorkers: false });
|
|
82
70
|
var ZIPS = [
|
|
@@ -129,27 +117,16 @@ async function listZip(file) {
|
|
|
129
117
|
}
|
|
130
118
|
}
|
|
131
119
|
/**
|
|
132
|
-
* True when the archive rejected the password
|
|
133
|
-
*
|
|
134
|
-
* Matched on the wording zip.js raises for a bad password, not on the word alone: the message is
|
|
135
|
-
* `Invalid password`, while a *file it cannot open* produces `ENOENT: … stat '/tmp/…/my-password-
|
|
136
|
-
* backup.zip'` — which carries the word because the caller named the archive that. A substring test
|
|
137
|
-
* read that as a wrong password and told the person to re-enter one, when the archive was simply
|
|
138
|
-
* not there. (Caught by CI, where Node's fs message names the path; the local run said
|
|
139
|
-
* `Unable to open file as blob`, so the same call looked fine.)
|
|
120
|
+
* True when the archive rejected the password. Matched on zip.js's exact wording: a missing file
|
|
121
|
+
* whose path contains "password" must not read as a wrong password.
|
|
140
122
|
*/
|
|
141
123
|
function isInvalidPassword(error) {
|
|
142
124
|
return error instanceof Error && /invalid password/i.test(error.message);
|
|
143
125
|
}
|
|
144
126
|
/**
|
|
145
|
-
* Writes
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* The mode is captured because the tree is somebody's data directory: a `0600` key, a `0700`
|
|
149
|
-
* directory and a `0755` script are all routine there, and a backup that restores them as `0644`
|
|
150
|
-
* changes who can read the data it was taken to protect. What a symlink may bring in is bounded by
|
|
151
|
-
* the tree itself (`walk`): the target has to be inside it, so a declared path cannot capture bytes
|
|
152
|
-
* from outside itself. Streams from disk to disk: nothing is buffered whole.
|
|
127
|
+
* Writes `sourceDir` into `destination`, streaming disk to disk and keeping each entry's permission
|
|
128
|
+
* bits (a `0600` key restored as `0644` would change who can read it). Symlinks may only bring in
|
|
129
|
+
* content from inside the tree (`walk`).
|
|
153
130
|
*/
|
|
154
131
|
async function createZip(sourceDir, destination, options = {}) {
|
|
155
132
|
const partial = path.join(path.dirname(destination), `.${path.basename(destination)}.partial`);
|
|
@@ -188,18 +165,13 @@ async function createZip(sourceDir, destination, options = {}) {
|
|
|
188
165
|
}
|
|
189
166
|
}
|
|
190
167
|
/**
|
|
191
|
-
* Extracts the given entries (already validated by the caller) into
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* An entry's permission bits are applied after it lands. The file is created under a restrictive
|
|
196
|
-
* mode first, so a `0600` secret never exists world-readable between two calls, and a mode the
|
|
197
|
-
* current umask would widen is set with an explicit `chmod` rather than left to the create.
|
|
168
|
+
* Extracts the given entries (already validated by the caller) into `destination`. Symbolic links
|
|
169
|
+
* are never recreated. Permission bits are applied after a file is created under a restrictive mode,
|
|
170
|
+
* so a `0600` secret is never world-readable in between.
|
|
198
171
|
*/
|
|
199
172
|
async function extractZip(file, destination, options) {
|
|
200
173
|
const reader = await open(file, options.password);
|
|
201
174
|
const skipped = [];
|
|
202
|
-
/** Directory modes, applied after their contents: a `0700` dir cannot be written into. */
|
|
203
175
|
const pendingDirModes = [];
|
|
204
176
|
try {
|
|
205
177
|
const entries = new Map((await reader.getEntries()).map((entry) => [entry.filename, entry]));
|
|
@@ -246,49 +218,29 @@ async function open(file, password) {
|
|
|
246
218
|
const blob = await fs.openAsBlob(file, { type: "application/zip" });
|
|
247
219
|
return password === void 0 ? new ZipReader(new BlobReader(blob)) : new ZipReader(new BlobReader(blob), { password });
|
|
248
220
|
}
|
|
249
|
-
/**
|
|
250
|
-
* The `st_mode` an entry should carry, or `null` where the platform does not report one.
|
|
251
|
-
*
|
|
252
|
-
* Only the permission bits and the file type are kept: the archive records a mode, not an owner,
|
|
253
|
-
* because a restore runs as whoever restores it and a foreign uid would be a worse lie than the
|
|
254
|
-
* restoring user's own.
|
|
255
|
-
*/
|
|
221
|
+
/** The permission bits and file type an entry should carry, or `null` where the platform reports none. No owner. */
|
|
256
222
|
function archiveMode(stats) {
|
|
257
223
|
const bits = stats.mode & 511;
|
|
258
224
|
if (process.platform === "win32" || bits === 0) return null;
|
|
259
225
|
return (stats.isDirectory() ? 16384 : 32768) | bits;
|
|
260
226
|
}
|
|
261
227
|
/**
|
|
262
|
-
* The permission bits an extracted entry
|
|
263
|
-
*
|
|
264
|
-
* Zip stores the type in the same field, so the file type is dropped: the entry is written as the
|
|
265
|
-
* ordinary file or directory this call is creating, never as a fifo or a device node an archive
|
|
266
|
-
* could name. The setuid/setgid/sticky bits are dropped too — an archive from another host does not
|
|
267
|
-
* get to install a privileged binary here.
|
|
228
|
+
* The permission bits for an extracted entry, or `null` when the archive carries none. The file type
|
|
229
|
+
* and setuid/setgid/sticky bits are dropped: an archive may not install a device node or a privileged binary.
|
|
268
230
|
*/
|
|
269
231
|
function permissionBits(unixMode) {
|
|
270
232
|
if (unixMode === void 0 || unixMode === 0) return null;
|
|
271
233
|
const bits = unixMode & 511;
|
|
272
234
|
return bits === 0 ? null : bits;
|
|
273
235
|
}
|
|
274
|
-
/** True when `child` is `parent` itself or lives underneath it, after resolving both. */
|
|
275
236
|
function isUnderResolved(parent, child) {
|
|
276
237
|
const relative = path.relative(parent, child);
|
|
277
238
|
return relative === "" || !path.isAbsolute(relative) && !relative.startsWith("..");
|
|
278
239
|
}
|
|
279
240
|
/**
|
|
280
|
-
* Sorted, deterministic walk with directory loops broken
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* build directory being cleaned, a container being torn down) must leave it out of
|
|
284
|
-
* the archive rather than reject `createZip` and turn a backup into a failure.
|
|
285
|
-
*
|
|
286
|
-
* A link that resolves **outside** `root` is left out rather than followed. `root` is a copy of the
|
|
287
|
-
* declared path, so a link inside it points back at the live tree — following one captured bytes
|
|
288
|
-
* from outside the path the person declared (a `media -> /mnt/nas` symlink pulled the whole share
|
|
289
|
-
* into the archive), and it captured the *live* copy of anything the copy had already frozen. A
|
|
290
|
-
* restore never recreates links anyway, so the link itself has nothing to restore; its content, if
|
|
291
|
-
* it is wanted, is declared as its own path.
|
|
241
|
+
* Sorted, deterministic walk with directory loops broken. Best-effort: a directory that vanishes
|
|
242
|
+
* mid-walk is left out rather than failing the backup. A link resolving outside `root` is left out
|
|
243
|
+
* rather than followed, so a declared path cannot capture bytes from outside itself.
|
|
292
244
|
*/
|
|
293
245
|
async function walk(root) {
|
|
294
246
|
const files = [];
|
|
@@ -349,4 +301,4 @@ async function walk(root) {
|
|
|
349
301
|
//#endregion
|
|
350
302
|
export { listZip as a, isZipArchive as i, extractZip as n, copyTree as o, isInvalidPassword as r, createZip as t };
|
|
351
303
|
|
|
352
|
-
//# sourceMappingURL=archive-
|
|
304
|
+
//# sourceMappingURL=archive-DFi3qK1c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-DFi3qK1c.js","names":[],"sources":["../../src/helpers/copy-tree.ts","../../src/providers/archive.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { performance } from 'node:perf_hooks'\nimport { setImmediate } from 'node:timers/promises'\nimport { DetailedError } from '@namesmt/utils'\n\nconst SLICE_MS = 10\n\n/**\n * A checkpoint that yields to the event loop once `SLICE_MS` of synchronous work has passed. Sync\n * calls in slices, because per-call `fs.promises` round trips are far slower on many small files.\n */\nexport function eventLoopSlicer(): () => Promise<void> {\n let since = performance.now()\n return async () => {\n if (performance.now() - since < SLICE_MS)\n return\n await setImmediate()\n since = performance.now()\n }\n}\n\n/**\n * `fs.cpSync(source, target, { recursive: true, force: true, filter })`, yielding between entries.\n *\n * The two roots are dereferenced: a declared `data -> /mnt/disk/data` *is* the data. Links *below*\n * the roots are untouched.\n */\nexport async function copyTree(source: string, target: string, filter: (source: string, target: string) => boolean): Promise<void> {\n const slice = eventLoopSlicer()\n const visit = async (from: string, to: string): Promise<void> => {\n if (!filter(from, to))\n return\n await slice()\n const stats = fs.lstatSync(from)\n if (!stats.isDirectory()) {\n fs.cpSync(from, to, { recursive: true, force: true })\n return\n }\n const existing = fs.lstatSync(to, { throwIfNoEntry: false })\n if (existing !== undefined && !existing.isDirectory())\n throw new DetailedError(`cannot overwrite non-directory ${to} with directory ${from}`, { statusCode: 400, code: 'CONFIG_COPY_CONFLICT' })\n if (existing === undefined)\n fs.mkdirSync(to)\n for (const name of fs.readdirSync(from))\n await visit(path.join(from, name), path.join(to, name))\n if (existing === undefined)\n fs.chmodSync(to, stats.mode)\n }\n fs.mkdirSync(path.dirname(target), { recursive: true })\n await visit(realpathOr(source), realpathOr(target))\n}\n\nfunction realpathOr(target: string): string {\n try {\n return fs.realpathSync(target)\n }\n catch {\n return target\n }\n}\n","import type { FileEntry } from '@zip.js/zip.js'\nimport { Buffer } from 'node:buffer'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { Readable, Writable } from 'node:stream'\nimport { finished } from 'node:stream/promises'\nimport { BlobReader, configure, ZipReader, ZipWriter } from '@zip.js/zip.js'\nimport { eventLoopSlicer } from '#src/helpers/copy-tree'\n\n/**\n * `Readable.toWeb` and zip.js type `ReadableStream` under different declarations depending on the\n * tsconfig; these aliases take the one zip.js expects.\n */\ntype ZipInput = Parameters<ZipWriter<unknown>['add']>[1]\ntype ZipOutput = ConstructorParameters<typeof ZipWriter>[0] & { abort: (reason?: unknown) => Promise<void> }\ntype ZipDataOutput = Parameters<FileEntry['getData']>[0]\n\n/**\n * Backups are ordinary zip files, openable by any archive manager and written by pure-JS zip.js.\n * A password means WinZip AES-256 (AE-2), not legacy ZipCrypto.\n */\n\n// Deterministic, in-process codecs: a bundled CLI has no worker file to load.\nconfigure({ useWebWorkers: false })\n\nconst ZIPS = [\n [0x50, 0x4B, 0x03, 0x04],\n [0x50, 0x4B, 0x05, 0x06],\n [0x50, 0x4B, 0x07, 0x08],\n]\n\n/** Recognised by content, never by the file's name. */\nexport function isZipArchive(file: string): boolean {\n let fd: number | null = null\n try {\n fd = fs.openSync(file, 'r')\n const head = Buffer.alloc(4)\n const read = fs.readSync(fd, head, 0, 4, 0)\n return read === 4 && ZIPS.some(magic => magic.every((byte, index) => head[index] === byte))\n }\n catch {\n return false\n }\n finally {\n if (fd !== null)\n fs.closeSync(fd)\n }\n}\n\nexport interface ArchiveEntry {\n name: string\n directory: boolean\n encrypted: boolean\n symlink: boolean\n /** Uncompressed size, for callers that cap what they will extract. */\n size: number\n mode?: number\n}\n\n/** The central directory is not encrypted, so this works without a password. */\nexport async function listZip(file: string): Promise<ArchiveEntry[]> {\n const reader = await open(file)\n try {\n const entries = await reader.getEntries()\n return entries.map(entry => ({\n name: entry.filename,\n directory: entry.directory === true,\n encrypted: entry.encrypted === true,\n symlink: entry.symlink === true,\n size: entry.uncompressedSize ?? 0,\n ...(entry.unixMode === undefined ? {} : { mode: entry.unixMode }),\n }))\n }\n finally {\n await reader.close()\n }\n}\n\n/**\n * True when the archive rejected the password. Matched on zip.js's exact wording: a missing file\n * whose path contains \"password\" must not read as a wrong password.\n */\nexport function isInvalidPassword(error: unknown): boolean {\n return error instanceof Error && /invalid password/i.test(error.message)\n}\n\n/**\n * Writes `sourceDir` into `destination`, streaming disk to disk and keeping each entry's permission\n * bits (a `0600` key restored as `0644` would change who can read it). Symlinks may only bring in\n * content from inside the tree (`walk`).\n */\nexport async function createZip(sourceDir: string, destination: string, options: { password?: string } = {}): Promise<void> {\n // Written beside the destination and renamed on success, so an interrupted run leaves no `.zip`.\n const partial = path.join(path.dirname(destination), `.${path.basename(destination)}.partial`)\n const output = fs.createWriteStream(partial, { mode: 0o600 })\n // Attached up front: a listener added after the web stream ends would wait forever.\n const flushed = finished(output)\n const writer = Writable.toWeb(output) as unknown as ZipOutput\n const zip = new ZipWriter(writer, {\n ...(options.password === undefined ? {} : { password: options.password, encryptionStrength: 3 as const }),\n level: 6,\n keepOrder: true,\n })\n\n try {\n for (const item of await walk(sourceDir)) {\n const mode = item.mode === null ? {} : { unixMode: item.mode }\n if (item.directory)\n await zip.add(item.name, null, { directory: true, ...mode })\n else if (item.size === 0)\n // An empty file as a plain AE-2 entry makes older tools (p7zip 16.02) report a CRC failure.\n await zip.add(item.name, null, { directory: false, ...mode })\n else\n await zip.add(item.name, Readable.toWeb(fs.createReadStream(item.absolute)) as unknown as ZipInput, mode)\n }\n await zip.close()\n await flushed\n await fs.promises.rename(partial, destination)\n }\n catch (error) {\n await writer.abort(error).catch(() => {})\n // An unobserved rejection (full disk) would take the control plane down.\n await flushed.catch(() => {})\n await fs.promises.rm(partial, { force: true }).catch(() => {})\n throw error\n }\n}\n\n/**\n * Extracts the given entries (already validated by the caller) into `destination`. Symbolic links\n * are never recreated. Permission bits are applied after a file is created under a restrictive mode,\n * so a `0600` secret is never world-readable in between.\n */\nexport async function extractZip(\n file: string,\n destination: string,\n options: { names: string[], password?: string },\n): Promise<{ skipped: string[] }> {\n const reader = await open(file, options.password)\n const skipped: string[] = []\n const pendingDirModes: Array<{ target: string, mode: number }> = []\n\n try {\n const entries = new Map((await reader.getEntries()).map(entry => [entry.filename, entry]))\n\n for (const name of options.names) {\n const entry = entries.get(name)\n if (entry === undefined) {\n skipped.push(name)\n continue\n }\n\n const target = path.join(destination, name)\n if (entry.directory) {\n fs.mkdirSync(target, { recursive: true })\n // Applied after the files under it are written, or a `0700` dir would close itself to them.\n const mode = permissionBits(entry.unixMode)\n if (mode !== null)\n pendingDirModes.push({ target, mode })\n continue\n }\n if (entry.symlink) {\n skipped.push(name)\n continue\n }\n\n fs.mkdirSync(path.dirname(target), { recursive: true })\n await entry.getData(Writable.toWeb(fs.createWriteStream(target, { mode: 0o600 })) as unknown as ZipDataOutput, writeOptions(entry, options.password))\n const mode = permissionBits(entry.unixMode)\n if (mode !== null) {\n try {\n fs.chmodSync(target, mode)\n }\n catch {\n // A filesystem without POSIX modes (FAT, a Windows share) keeps the file: the data matters more than the bit.\n }\n }\n }\n }\n finally {\n await reader.close()\n for (const { target, mode } of pendingDirModes.sort((left, right) => right.target.length - left.target.length)) {\n try {\n fs.chmodSync(target, mode)\n }\n catch {}\n }\n pendingDirModes.length = 0\n }\n\n return { skipped }\n}\n\nfunction writeOptions(entry: FileEntry, password: string | undefined): { password?: string } {\n return entry.encrypted && password !== undefined ? { password } : {}\n}\n\nasync function open(file: string, password?: string): Promise<ZipReader<unknown>> {\n // A lazily-read Blob keeps a multi-gigabyte archive out of memory.\n const blob = await fs.openAsBlob(file, { type: 'application/zip' })\n return password === undefined\n ? new ZipReader(new BlobReader(blob))\n : new ZipReader(new BlobReader(blob), { password })\n}\n\ninterface WalkedFile {\n name: string\n absolute: string\n directory: boolean\n size: number\n mode: number | null\n}\n\n/** The permission bits and file type an entry should carry, or `null` where the platform reports none. No owner. */\nfunction archiveMode(stats: fs.Stats): number | null {\n const bits = stats.mode & 0o777\n if (process.platform === 'win32' || bits === 0)\n return null\n return (stats.isDirectory() ? 0o040000 : 0o100000) | bits\n}\n\n/**\n * The permission bits for an extracted entry, or `null` when the archive carries none. The file type\n * and setuid/setgid/sticky bits are dropped: an archive may not install a device node or a privileged binary.\n */\nfunction permissionBits(unixMode: number | undefined): number | null {\n if (unixMode === undefined || unixMode === 0)\n return null\n const bits = unixMode & 0o777\n return bits === 0 ? null : bits\n}\n\nfunction isUnderResolved(parent: string, child: string): boolean {\n const relative = path.relative(parent, child)\n return relative === '' || (!path.isAbsolute(relative) && !relative.startsWith('..'))\n}\n\n/**\n * Sorted, deterministic walk with directory loops broken. Best-effort: a directory that vanishes\n * mid-walk is left out rather than failing the backup. A link resolving outside `root` is left out\n * rather than followed, so a declared path cannot capture bytes from outside itself.\n */\nasync function walk(root: string): Promise<WalkedFile[]> {\n const files: WalkedFile[] = []\n const seen = new Set<string>()\n const slice = eventLoopSlicer()\n let realRoot: string\n try {\n realRoot = fs.realpathSync(root)\n }\n catch {\n return files\n }\n\n const readDir = (absolute: string): string[] => {\n try {\n return fs.readdirSync(absolute).sort()\n }\n catch {\n return []\n }\n }\n\n const visit = async (absolute: string, name: string): Promise<void> => {\n await slice()\n let stats: fs.Stats\n try {\n stats = fs.statSync(absolute)\n }\n catch {\n return\n }\n\n let real: string\n try {\n real = fs.realpathSync(absolute)\n }\n catch {\n return\n }\n if (!isUnderResolved(realRoot, real))\n return\n\n if (stats.isDirectory()) {\n if (seen.has(real))\n return\n seen.add(real)\n files.push({ name: `${name}/`, absolute, directory: true, size: 0, mode: archiveMode(stats) })\n for (const child of readDir(absolute))\n await visit(path.join(absolute, child), `${name}/${child}`)\n return\n }\n\n if (stats.isFile())\n files.push({ name, absolute, directory: false, size: stats.size, mode: archiveMode(stats) })\n }\n\n for (const child of readDir(root))\n await visit(path.join(root, child), child)\n\n return files\n}\n"],"mappings":";;;;;;;;;;;AAMA,IAAM,WAAW;;;;;AAMjB,SAAgB,kBAAuC;CACrD,IAAI,QAAQ,YAAY,IAAI;CAC5B,OAAO,YAAY;EACjB,IAAI,YAAY,IAAI,IAAI,QAAQ,UAC9B;EACF,MAAM,aAAa;EACnB,QAAQ,YAAY,IAAI;CAC1B;AACF;;;;;;;AAQA,eAAsB,SAAS,QAAgB,QAAgB,QAAoE;CACjI,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,QAAQ,OAAO,MAAc,OAA8B;EAC/D,IAAI,CAAC,OAAO,MAAM,EAAE,GAClB;EACF,MAAM,MAAM;EACZ,MAAM,QAAQ,GAAG,UAAU,IAAI;EAC/B,IAAI,CAAC,MAAM,YAAY,GAAG;GACxB,GAAG,OAAO,MAAM,IAAI;IAAE,WAAW;IAA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
import { i as ensureStateDir } from "./paths-C34-TJLh.js";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
6
|
//#region src/helpers/atomic.ts
|
|
7
|
-
/**
|
|
8
|
-
* Write via a temp file in the same directory, then rename: readers never see a
|
|
9
|
-
* half-written file, and a crash cannot truncate the previous config.
|
|
10
|
-
*/
|
|
7
|
+
/** Write via a temp file in the same directory, then rename: readers never see a half-written file. */
|
|
11
8
|
function writeFileAtomic(file, content, options = {}) {
|
|
12
9
|
ensureStateDir(path.dirname(file));
|
|
13
10
|
const tmp = `${file}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
|
|
@@ -23,4 +20,4 @@ function writeFileAtomic(file, content, options = {}) {
|
|
|
23
20
|
//#endregion
|
|
24
21
|
export { writeFileAtomic as t };
|
|
25
22
|
|
|
26
|
-
//# sourceMappingURL=atomic-
|
|
23
|
+
//# sourceMappingURL=atomic-SZUwDtGD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-SZUwDtGD.js","names":[],"sources":["../../src/helpers/atomic.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { ensureStateDir } from '#src/helpers/paths'\n\nexport interface WriteFileOptions {\n /** Applied to the temp file before the rename, so secrets never exist world-readable. */\n mode?: number\n}\n\n/** Write via a temp file in the same directory, then rename: readers never see a half-written file. */\nexport function writeFileAtomic(file: string, content: string, options: WriteFileOptions = {}): void {\n ensureStateDir(path.dirname(file))\n // Unique per call: two writes to one file in one process would otherwise share a temp name.\n const tmp = `${file}.${process.pid}.${randomBytes(4).toString('hex')}.tmp`\n try {\n fs.writeFileSync(tmp, content, options.mode === undefined ? undefined : { mode: options.mode })\n if (options.mode !== undefined)\n fs.chmodSync(tmp, options.mode)\n fs.renameSync(tmp, file)\n }\n catch (error) {\n fs.rmSync(tmp, { force: true })\n throw error\n }\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,gBAAgB,MAAc,SAAiB,UAA4B,CAAC,GAAS;CACnG,eAAe,KAAK,QAAQ,IAAI,CAAC;CAEjC,MAAM,MAAM,GAAG,KAAK,GAAG,QAAQ,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK,EAAE;CACrE,IAAI;EACF,GAAG,cAAc,KAAK,SAAS,QAAQ,SAAS,KAAA,IAAY,KAAA,IAAY,EAAE,MAAM,QAAQ,KAAK,CAAC;EAC9F,IAAI,QAAQ,SAAS,KAAA,GACnB,GAAG,UAAU,KAAK,QAAQ,IAAI;EAChC,GAAG,WAAW,KAAK,IAAI;CACzB,SACO,OAAO;EACZ,GAAG,OAAO,KAAK,EAAE,OAAO,KAAK,CAAC;EAC9B,MAAM;CACR;AACF"}
|