home-hosted 0.10.3 → 0.12.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 +273 -628
- package/dist/chunks/archive-DpCwA8Nf.js +339 -0
- package/dist/chunks/archive-DpCwA8Nf.js.map +1 -0
- package/dist/chunks/atomic-CEfCUfkQ.js +25 -0
- package/dist/chunks/atomic-CEfCUfkQ.js.map +1 -0
- package/dist/chunks/backup-CPrJVPJI.js +797 -0
- package/dist/chunks/backup-CPrJVPJI.js.map +1 -0
- package/dist/chunks/backups-Bd2SF2qd.js +4346 -0
- package/dist/chunks/backups-Bd2SF2qd.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-ku5ypHXJ.js +2256 -0
- package/dist/chunks/contracts-ku5ypHXJ.js.map +1 -0
- package/dist/chunks/daemon-TwXk5vb8.js +215 -0
- package/dist/chunks/daemon-TwXk5vb8.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/docker-CGv4Uv7w.js +436 -0
- package/dist/chunks/docker-CGv4Uv7w.js.map +1 -0
- package/dist/chunks/down-BlX5X3bm.js +378 -0
- package/dist/chunks/down-BlX5X3bm.js.map +1 -0
- package/dist/chunks/init-DdmqHVra.js +263 -0
- package/dist/chunks/init-DdmqHVra.js.map +1 -0
- package/dist/chunks/last-stop-BZ08Z89-.js +52 -0
- package/dist/chunks/last-stop-BZ08Z89-.js.map +1 -0
- package/dist/chunks/layout-D74TGUnr.js +24 -0
- package/dist/chunks/layout-D74TGUnr.js.map +1 -0
- package/dist/chunks/log-buffer-HnP0jKhZ.js +350 -0
- package/dist/chunks/log-buffer-HnP0jKhZ.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-gI_69Q1P.js +265 -0
- package/dist/chunks/logs-gI_69Q1P.js.map +1 -0
- package/dist/chunks/migrate-BTlsibvF.js +155 -0
- package/dist/chunks/migrate-BTlsibvF.js.map +1 -0
- package/dist/chunks/nanny-20aBXL1o.js +1069 -0
- package/dist/chunks/nanny-20aBXL1o.js.map +1 -0
- package/dist/chunks/nanny-CjnnrIpm.js +132 -0
- package/dist/chunks/nanny-CjnnrIpm.js.map +1 -0
- package/dist/chunks/nanny-DUaAfCV-.js +39 -0
- package/dist/chunks/nanny-DUaAfCV-.js.map +1 -0
- package/dist/chunks/nanny-sweep-Ca9kPAVi.js +104 -0
- package/dist/chunks/nanny-sweep-Ca9kPAVi.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-B9owE47G.js +383 -0
- package/dist/chunks/parse-B9owE47G.js.map +1 -0
- package/dist/chunks/paths-BT94q6-w.js +172 -0
- package/dist/chunks/paths-BT94q6-w.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-UZgeDukG.js +126 -0
- package/dist/chunks/restart-UZgeDukG.js.map +1 -0
- package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/chunks/schema-o7Lgk0V1.js +102 -0
- package/dist/chunks/schema-o7Lgk0V1.js.map +1 -0
- package/dist/chunks/secrets-D7PdYh71.js +544 -0
- package/dist/chunks/secrets-D7PdYh71.js.map +1 -0
- package/dist/chunks/server-BuIeSsRu.js +169 -0
- package/dist/chunks/server-BuIeSsRu.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-DegMumPh.js +43 -0
- package/dist/chunks/set-password-DegMumPh.js.map +1 -0
- package/dist/chunks/set-token-21d1FTDC.js +78 -0
- package/dist/chunks/set-token-21d1FTDC.js.map +1 -0
- package/dist/chunks/settings-BVSBnIwJ.js +332 -0
- package/dist/chunks/settings-BVSBnIwJ.js.map +1 -0
- package/dist/chunks/setup-temp-XiuAtiW2.js +150 -0
- package/dist/chunks/setup-temp-XiuAtiW2.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-BL97vLVb.js +11153 -0
- package/dist/chunks/src-BL97vLVb.js.map +1 -0
- package/dist/chunks/status-EuWdRq8Q.js +119 -0
- package/dist/chunks/status-EuWdRq8Q.js.map +1 -0
- package/dist/chunks/ui-DbPuwddJ.js +323 -0
- package/dist/chunks/ui-DbPuwddJ.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-BhqOAhmM.js +27 -0
- package/dist/chunks/ui-revert-BhqOAhmM.js.map +1 -0
- package/dist/chunks/ui-switch-CMoslPO2.js +150 -0
- package/dist/chunks/ui-switch-CMoslPO2.js.map +1 -0
- package/dist/chunks/ui-update-TTBBoDik.js +272 -0
- package/dist/chunks/ui-update-TTBBoDik.js.map +1 -0
- package/dist/chunks/up-C4H13hBw.js +196 -0
- package/dist/chunks/up-C4H13hBw.js.map +1 -0
- package/dist/chunks/usage-CSBgLRN5.js +85 -0
- package/dist/chunks/usage-CSBgLRN5.js.map +1 -0
- package/dist/chunks/workspaces-CAln2sQ7.js +221 -0
- package/dist/chunks/workspaces-CAln2sQ7.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 +229 -24861
- package/dist/cli.js.map +1 -1
- package/dist/client.js +120 -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 +179 -0
- package/dist/types/api/control.d.ts +469 -0
- package/dist/types/api/ddns.d.ts +432 -0
- package/dist/types/api/events.d.ts +21 -0
- package/dist/types/api/health.d.ts +27 -0
- package/dist/types/api/logs.d.ts +95 -0
- package/dist/types/api/metrics.d.ts +19 -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 +492 -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 +6080 -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 +79 -0
- package/dist/types/cli/down.d.ts +75 -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 +64 -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 +42 -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 +90 -0
- package/dist/types/cli/usage.d.ts +23 -0
- package/dist/types/cli.d.ts +12 -0
- package/dist/types/client.d.ts +6284 -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 +206 -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 +74 -0
- package/dist/types/config/store.d.ts +132 -0
- package/dist/types/config/workspaces.d.ts +96 -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 +15 -0
- package/dist/types/helpers/daemon-log.d.ts +45 -0
- package/dist/types/helpers/daemon.d.ts +122 -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 +18 -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 +46 -0
- package/dist/types/helpers/paths.d.ts +94 -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/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 +37 -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 +29 -0
- package/dist/types/providers/nanny-sweep.d.ts +51 -0
- package/dist/types/providers/nanny.d.ts +94 -0
- package/dist/types/providers/port.d.ts +142 -0
- package/dist/types/providers/proc.d.ts +116 -0
- package/dist/types/providers/process.d.ts +61 -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 +32 -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 +69 -0
- package/dist/types/services/acme-challenge.d.ts +44 -0
- package/dist/types/services/auth.d.ts +145 -0
- package/dist/types/services/backups.d.ts +352 -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 +67 -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 +33 -0
- package/dist/types/services/history.d.ts +36 -0
- package/dist/types/services/host-monitor.d.ts +32 -0
- package/dist/types/services/init.d.ts +71 -0
- package/dist/types/services/log-buffer.d.ts +28 -0
- package/dist/types/services/log-files.d.ts +87 -0
- package/dist/types/services/log-relay.d.ts +36 -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 +194 -0
- package/dist/types/services/proxy-config.d.ts +83 -0
- package/dist/types/services/proxy.d.ts +454 -0
- package/dist/types/services/state.d.ts +41 -0
- package/dist/types/services/supervisor/compose.d.ts +17 -0
- package/dist/types/services/supervisor/entry.d.ts +139 -0
- package/dist/types/services/supervisor/health.d.ts +55 -0
- package/dist/types/services/supervisor/pending-load.d.ts +6 -0
- package/dist/types/services/supervisor/persistent.d.ts +55 -0
- package/dist/types/services/supervisor/port-preflight.d.ts +45 -0
- package/dist/types/services/supervisor/records.d.ts +38 -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 +113 -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/api-client.d.ts +137 -0
- package/dist/types/shared/backup-scope.d.ts +109 -0
- package/dist/types/shared/clone.d.ts +14 -0
- package/dist/types/shared/contracts.d.ts +4233 -0
- package/dist/types/shared/cpu-scale.d.ts +25 -0
- package/dist/types/shared/ddns-form.d.ts +62 -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/generated.d.ts +26 -0
- package/dist/types/shared/host-readings.d.ts +185 -0
- package/dist/types/shared/patch-diff.d.ts +94 -0
- package/dist/types/shared/probe-latency.d.ts +25 -0
- package/dist/types/shared/proxy-form.d.ts +182 -0
- package/dist/types/shared/server-attention.d.ts +37 -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/ui-format.d.ts +89 -0
- package/docs/API.md +180 -0
- package/docs/BACKUPS.md +97 -0
- package/docs/CLI.md +122 -0
- package/docs/DDNS.md +12 -3
- package/docs/NOTIFICATIONS.md +3 -1
- package/docs/RESTORE_DEMO.md +6 -4
- package/docs/REVERSE_PROXY.md +2 -2
- package/docs/SECURITY.md +82 -0
- package/docs/SERVERS.md +47 -15
- package/docs/UI_CREATION.md +82 -286
- package/package.json +18 -9
- package/uis/stock/dist/assets/de-DyGrM1KK.js +1 -0
- package/uis/stock/dist/assets/es-BebHdc0E.js +1 -0
- package/uis/stock/dist/assets/fr-DsDTrxhI.js +1 -0
- package/uis/stock/dist/assets/index-6LANO2Ua.css +2 -0
- package/uis/stock/dist/assets/index-D06cUZbM.js +56 -0
- package/uis/stock/dist/assets/ja-D3RARJjW.js +1 -0
- package/uis/stock/dist/assets/ko-CKI3dFoD.js +1 -0
- package/uis/stock/dist/assets/ru-DEU5ujXt.js +1 -0
- package/uis/stock/dist/assets/vi-ULKPnasj.js +1 -0
- package/uis/stock/dist/assets/zh-CN-tCvnOxWy.js +1 -0
- package/uis/stock/dist/index.html +2 -2
- package/uis/stock/dist/ui.json +3 -3
- package/AGENTS.md +0 -403
- package/uis/stock/dist/assets/de-CiSKBON6.js +0 -1
- package/uis/stock/dist/assets/es-BgNQbboq.js +0 -1
- package/uis/stock/dist/assets/fr-WzBF8AXI.js +0 -1
- package/uis/stock/dist/assets/index-CXDl25BP.js +0 -53
- package/uis/stock/dist/assets/index-Cok5msAO.css +0 -2
- package/uis/stock/dist/assets/ja-DMQqF4ip.js +0 -1
- package/uis/stock/dist/assets/ko-DgfSg9v_.js +0 -1
- package/uis/stock/dist/assets/ru-DjIByX61.js +0 -1
- package/uis/stock/dist/assets/vi-DOB8nYFC.js +0 -1
- package/uis/stock/dist/assets/zh-CN-DZ3WlUgy.js +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a server's `cpuPercent` sits on **this machine**.
|
|
3
|
+
*
|
|
4
|
+
* A server's figure is summed over its process tree, so it counts *cores*: `400` is four busy cores
|
|
5
|
+
* on any box, and on a 24-core host that is a sixth of the machine — normal work, not an emergency.
|
|
6
|
+
* A chart with a fixed ceiling of `100` clipped those points to the top edge, and a colour band with
|
|
7
|
+
* fixed `40`/`80` thresholds painted that busy worker red. Both answers were wrong in the same way:
|
|
8
|
+
* they measured one core and called it the machine.
|
|
9
|
+
*
|
|
10
|
+
* So the scale is `cpus × 100`, and it is decided **here** rather than restated at each surface. The
|
|
11
|
+
* stock card and detail page, and the noc-console list and detail page, all read it — the fourth copy
|
|
12
|
+
* is what drifted, leaving the detail page's number red while its own sparkline stayed accent.
|
|
13
|
+
*/
|
|
14
|
+
/** The chart's full scale: the whole machine's capacity in percent, floored at one core. */
|
|
15
|
+
export declare function cpuCapacity(cpus: number | null | undefined): number;
|
|
16
|
+
/** How urgent a cpu reading is, on that scale. */
|
|
17
|
+
export type CpuBand = 'unknown' | 'ok' | 'warn' | 'danger';
|
|
18
|
+
/**
|
|
19
|
+
* The band a reading falls in, as a share of `capacity`.
|
|
20
|
+
*
|
|
21
|
+
* `null` is a reading that does not exist — a stopped entry — and it is its own band rather than
|
|
22
|
+
* `'ok'`, because a missing measurement must never be painted as a healthy one. The thresholds are
|
|
23
|
+
* the ones the per-core bands used (40% and 80%), now taken against the machine.
|
|
24
|
+
*/
|
|
25
|
+
export declare function cpuBand(cpuPercent: number | null | undefined, cpus: number | null | undefined): CpuBand;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { DdnsAccount, DdnsConfig, DdnsDomain, DdnsPatch } from './contracts.js';
|
|
2
|
+
/**
|
|
3
|
+
* The DDNS form both UIs edit: the draft its rows are held in, the wire shape a save sends,
|
|
4
|
+
* and the diff the page's change list counts.
|
|
5
|
+
*
|
|
6
|
+
* It lives here because the two UIs' copies had already diverged (`noc-console` repaired an
|
|
7
|
+
* emptied box where `stock` fell back to a default) and both needed the same two fixes.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The draft relaxes the two regex-constrained fields, and gives every hostname row a stable key.
|
|
11
|
+
* Keying the rows on `host` re-created the row on each keystroke, which threw the caret out of the
|
|
12
|
+
* input after every character.
|
|
13
|
+
*/
|
|
14
|
+
export type DraftDomain = Omit<DdnsDomain, 'host'> & {
|
|
15
|
+
host: string;
|
|
16
|
+
key: string;
|
|
17
|
+
};
|
|
18
|
+
export type DraftAccount = Omit<DdnsAccount, 'id'> & {
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
export type DraftConfig = Omit<DdnsConfig, 'domains' | 'accounts'> & {
|
|
22
|
+
domains: DraftDomain[];
|
|
23
|
+
accounts: DraftAccount[];
|
|
24
|
+
};
|
|
25
|
+
/** One stable identity for a row the person just added. */
|
|
26
|
+
export declare function newDraftDomainKey(): string;
|
|
27
|
+
/**
|
|
28
|
+
* A detached, plain copy of a config the form may hold reactively.
|
|
29
|
+
*
|
|
30
|
+
* `structuredClone(toRaw(config))` does **not** detach it: a list the form rebuilt
|
|
31
|
+
* (`domains = domains.filter(...)`) holds Vue proxies inside the raw array, so the clone threw
|
|
32
|
+
* `DataCloneError` and every later edit stopped publishing a patch. See `clonePlain`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function cloneDdnsConfig(config: DdnsConfig | DraftConfig): DraftConfig;
|
|
35
|
+
/** The wire shape: a row key is a UI detail, and the schema rejects undeclared keys. */
|
|
36
|
+
export declare function toDdnsConfig(draft: DraftConfig | DdnsConfig): DdnsConfig;
|
|
37
|
+
/** Compares two blocks the way the server sees them, ignoring row keys. */
|
|
38
|
+
export declare function ddnsConfigEquals(a: DdnsConfig | DraftConfig | null, b: DdnsConfig | DraftConfig | null): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* What this form actually moved, in the wire shape.
|
|
41
|
+
*
|
|
42
|
+
* `ipv4`/`ipv6` are left to `diffFields`' nested diff, so they report the one member that changed;
|
|
43
|
+
* `accounts`/`domains` are leaves of their own, because the route **replaces** both lists — one
|
|
44
|
+
* edited hostname is one changed field however many rows the list holds.
|
|
45
|
+
*
|
|
46
|
+
* Counting the whole block instead listed all nine of its leaves for a single IPv6 toggle, and
|
|
47
|
+
* showed the untouched ones as `true → true`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function ddnsConfigPatch(baseline: DdnsConfig | DraftConfig, draft: DdnsConfig | DraftConfig): DdnsPatch | null;
|
|
50
|
+
/** The schema's own defaults for the two required numbers, in one place. */
|
|
51
|
+
export declare const DDNS_DEFAULTS: {
|
|
52
|
+
readonly intervalMs: 300000;
|
|
53
|
+
readonly ttl: 1;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Which value a required DDNS number should actually hold.
|
|
57
|
+
*
|
|
58
|
+
* A cleared box reports `NaN` (or `null`), and `JSON.stringify` turns that into `null` — which
|
|
59
|
+
* `ddnsConfigSchema` rejects, refusing the whole workspace-settings save rather than that one
|
|
60
|
+
* field. Fall back to the schema's default; the panel would have applied it anyway.
|
|
61
|
+
*/
|
|
62
|
+
export declare function requiredDdnsNumber(value: number | null, key: keyof typeof DDNS_DEFAULTS): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waits for a just-moved endpoint to answer, so a redirect does not race the rebind.
|
|
3
|
+
*
|
|
4
|
+
* Byte-identical in both UIs and importing nothing, so it belongs here: the listener can move to a
|
|
5
|
+
* different host and port, and the browser will follow to a socket that is not accepting yet. Polling
|
|
6
|
+
* `/api/auth/session` (which needs no session) is what makes the wait meaningful rather than a sleep.
|
|
7
|
+
*/
|
|
8
|
+
export declare function waitForEndpoint(url: string, timeoutMs?: number): Promise<boolean>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One rendering for a thrown value, so a caught error reads the same everywhere.
|
|
3
|
+
*
|
|
4
|
+
* `catch` binds `unknown`, and the same ternary was written out in ~60 places across the
|
|
5
|
+
* panel and both UIs. Two idioms in one codebase is how they drift, and the UIs are
|
|
6
|
+
* separate bundles: a fix applied to one copy silently misses the others.
|
|
7
|
+
*/
|
|
8
|
+
export declare function errorMessage(caught: unknown): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The textarea round-trips a server form needs: a list is one entry per line, an env
|
|
3
|
+
* map is `KEY=value` per line.
|
|
4
|
+
*
|
|
5
|
+
* These were written out in `uis/stock` and `uis/noc-console` and had already been
|
|
6
|
+
* copy-pasted twice inside one of them. The two products differ elsewhere, but not
|
|
7
|
+
* here — and a change to how a line is parsed has to be made once, not in four places.
|
|
8
|
+
* Imports nothing, so it is safe in a UI bundle.
|
|
9
|
+
*/
|
|
10
|
+
/** One entry per line, blank lines dropped, each entry trimmed. */
|
|
11
|
+
export declare function linesToArray(value: string): string[];
|
|
12
|
+
/** An env map as `KEY=value` lines, in the map's own order. */
|
|
13
|
+
export declare function envToText(env: Record<string, string>): string;
|
|
14
|
+
/**
|
|
15
|
+
* `KEY=value` lines into the map the config stores. A line with no `=`, or one that
|
|
16
|
+
* starts with it (which names nothing), is skipped rather than stored under an empty
|
|
17
|
+
* key; both halves of a pair are trimmed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function textToEnv(value: string): Record<string, string>;
|
|
20
|
+
/** Comma-separated ids into the list the config stores (`dependsOn`). */
|
|
21
|
+
export declare function commaList(value: string): string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names that only ever hold build output or installed dependencies — the things
|
|
3
|
+
* a `.gitignore` almost always lists.
|
|
4
|
+
*
|
|
5
|
+
* A backup walks a declared data directory and copies whatever it finds; on a
|
|
6
|
+
* project directory that is mostly `node_modules` and framework caches, which
|
|
7
|
+
* bloats the archive with content nobody needs to restore. An entry with
|
|
8
|
+
* `backupIgnoreGenerated` (on by default) skips these.
|
|
9
|
+
*
|
|
10
|
+
* Matching is by exact name, on any segment, at any depth: `dist/` and
|
|
11
|
+
* `app/node_modules/` are generated, `distributed/` and `my-node_modules/` are
|
|
12
|
+
* not.
|
|
13
|
+
*
|
|
14
|
+
* `.git` is deliberately absent however much a `.gitignore` would not list it:
|
|
15
|
+
* a package manager can reinstall `node_modules`, but nobody can restore a
|
|
16
|
+
* commit that was never pushed.
|
|
17
|
+
*/
|
|
18
|
+
/** Whole directories that are regenerated, never authored. */
|
|
19
|
+
export declare const GENERATED_DIRS: readonly string[];
|
|
20
|
+
/** One-off files worth skipping, by exact name. */
|
|
21
|
+
export declare const GENERATED_FILES: readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* True when a path *relative to the declared root* looks generated. Accepts
|
|
24
|
+
* either separator, so a `path.relative` result can be passed straight in.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isGeneratedPath(relative: string): boolean;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host's measurements, and the one place that decides a sample exists.
|
|
3
|
+
*
|
|
4
|
+
* `emptyHostView()` is what `HostMonitor` starts from, and it is also the frame a panel keeps for
|
|
5
|
+
* ever when host vitals are switched off: `sampledAt: null`, with **every value zero** because the
|
|
6
|
+
* wire type says `number`. `/api/metrics` refuses to publish those zeros — a scrape has no page to
|
|
7
|
+
* qualify a number, so a `0` it invents silences the alert rule that exists to catch a full disk.
|
|
8
|
+
* The panel's own pages read the same frame and printed it: `0.0%` memory, `0.0%` swap, `0.00`
|
|
9
|
+
* load, under a head that says "sampling off". On a homelab box being told memory is at 0% is the
|
|
10
|
+
* same lie as a dashboard being told it, told to the person instead.
|
|
11
|
+
*
|
|
12
|
+
* So `sampledAt === null` means "nothing has been measured" and every reading here is `null`.
|
|
13
|
+
* The zeros stay on the wire: an older overridden UI under `.hh/.ui` reads `memoryUsedPercent` as a
|
|
14
|
+
* `number` and calls `.toFixed()` on it, so a nullable field would crash it — the absence is decided
|
|
15
|
+
* where it is rendered, once, instead.
|
|
16
|
+
*
|
|
17
|
+
* `cpus` and `uptimeMs` are **not** readings: they describe the machine, not a sample, and the
|
|
18
|
+
* empty frame already reports them truthfully.
|
|
19
|
+
*
|
|
20
|
+
* `loadAlertPerCpu` is not a reading either: it is the threshold the panel *notifies* on, and it
|
|
21
|
+
* travels with the frame so a surface can band the load against the number a person actually
|
|
22
|
+
* chose. `AGENTS.md` names the rule — a verdict is measured against the configured threshold, and
|
|
23
|
+
* one module decides it — after two surfaces hardcoded the default and kept calling a box a person
|
|
24
|
+
* had raised the threshold on `danger`, for a notification that stayed silent.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* The load per cpu a panel notifies on when nothing else is configured.
|
|
28
|
+
*
|
|
29
|
+
* One home: `hostSchema` defaults to it, and a surface reading a frame from a panel that predates
|
|
30
|
+
* the field bands its load against the same number the older panel alerted on.
|
|
31
|
+
*/
|
|
32
|
+
export declare const LOAD_ALERT_PER_CPU_DEFAULT = 2;
|
|
33
|
+
/**
|
|
34
|
+
* The alert thresholds a percentage reading is banded against, when the frame carries none.
|
|
35
|
+
*
|
|
36
|
+
* One home, the same rule as `LOAD_ALERT_PER_CPU_DEFAULT`: `hostSchema` defaults to these, and a
|
|
37
|
+
* surface reading a frame from a panel that predates the fields bands against the numbers that
|
|
38
|
+
* panel alerted on.
|
|
39
|
+
*/
|
|
40
|
+
export declare const HOST_ALERT_DEFAULTS: {
|
|
41
|
+
readonly diskUsedPercent: 90;
|
|
42
|
+
readonly memoryUsedPercent: 90;
|
|
43
|
+
readonly swapUsedPercent: 50;
|
|
44
|
+
readonly tempCelsius: 85;
|
|
45
|
+
};
|
|
46
|
+
/** A configurable alert threshold, as it travels on the frame. */
|
|
47
|
+
export interface HostAlertThresholds {
|
|
48
|
+
/** `host.diskUsedPercent` — the threshold the panel notifies on, `0` disabling it. */
|
|
49
|
+
diskUsedPercentAlert?: number;
|
|
50
|
+
/** `host.memoryUsedPercent` — the threshold the panel notifies on, `0` disabling it. */
|
|
51
|
+
memoryUsedPercentAlert?: number;
|
|
52
|
+
swapUsedPercentAlert?: number;
|
|
53
|
+
tempCelsiusAlert?: number;
|
|
54
|
+
}
|
|
55
|
+
/** One configured filesystem, with the band its own usage is painted in. */
|
|
56
|
+
export interface HostDiskReading {
|
|
57
|
+
path: string;
|
|
58
|
+
totalBytes: number;
|
|
59
|
+
freeBytes: number;
|
|
60
|
+
usedPercent: number;
|
|
61
|
+
/**
|
|
62
|
+
* How urgent that filesystem's usage is, against `host.diskUsedPercent` — the threshold the panel
|
|
63
|
+
* **notifies** on — else `null` when nothing was measured.
|
|
64
|
+
*
|
|
65
|
+
* It rides on the disk rather than beside the frame because the threshold is per-path usage and a
|
|
66
|
+
* frame can carry several paths; a single `diskBand` next to `memoryBand` would answer for one of
|
|
67
|
+
* them. The band was the last literal: `Gauge`/`Meter` defaulted to `75`/`90` and both
|
|
68
|
+
* noc-console surfaces restated the same pair, which is `hostSchema`'s *default*, so lowering
|
|
69
|
+
* `host.diskUsedPercent` to 80 made the panel notify at 82% while every surface called it `warn`.
|
|
70
|
+
*/
|
|
71
|
+
band: HostBand;
|
|
72
|
+
}
|
|
73
|
+
/** What the predicate needs: the sample's stamp and the numbers the frame carries. */
|
|
74
|
+
export interface HostReadingSource extends HostAlertThresholds {
|
|
75
|
+
sampledAt: number | null;
|
|
76
|
+
cpus: number;
|
|
77
|
+
/** The alert thresholds from the panel's own config; absent on a panel that predates the fields. */
|
|
78
|
+
loadAlertPerCpu?: number;
|
|
79
|
+
cpuUsedPercent?: number | null;
|
|
80
|
+
memoryUsedPercent: number;
|
|
81
|
+
swapUsedPercent: number;
|
|
82
|
+
loadAvg: number[];
|
|
83
|
+
tempCelsius: number | null;
|
|
84
|
+
disks: Array<{
|
|
85
|
+
path: string;
|
|
86
|
+
totalBytes: number;
|
|
87
|
+
freeBytes: number;
|
|
88
|
+
usedPercent: number;
|
|
89
|
+
}>;
|
|
90
|
+
}
|
|
91
|
+
/** One host sample, with every measurement absent until the host has been sampled. */
|
|
92
|
+
export interface HostReadings {
|
|
93
|
+
/** Whether the frame carries a sample at all. */
|
|
94
|
+
sampled: boolean;
|
|
95
|
+
cpuUsedPercent: number | null;
|
|
96
|
+
memoryUsedPercent: number | null;
|
|
97
|
+
swapUsedPercent: number | null;
|
|
98
|
+
load1m: number | null;
|
|
99
|
+
load5m: number | null;
|
|
100
|
+
load15m: number | null;
|
|
101
|
+
/**
|
|
102
|
+
* The 1-minute load as a share of one core. Load is a **count of runnable tasks**, so this is a
|
|
103
|
+
* count per core, never a percentage — `1.00` is one core's worth of work.
|
|
104
|
+
*/
|
|
105
|
+
loadPerCpu: number | null;
|
|
106
|
+
tempCelsius: number | null;
|
|
107
|
+
/** Each configured filesystem, carrying its own band. Empty when nothing was sampled. */
|
|
108
|
+
disks: HostDiskReading[];
|
|
109
|
+
/**
|
|
110
|
+
* How urgent that per-cpu load is: `null` when nothing was measured (an absent reading has no
|
|
111
|
+
* band of its own, or a zero would read as healthy), else the alert threshold it crossed.
|
|
112
|
+
*/
|
|
113
|
+
loadBand: HostBand;
|
|
114
|
+
/**
|
|
115
|
+
* The same verdict for the three percentage readings, each against the threshold the panel
|
|
116
|
+
* **notifies** on — `null` when nothing was measured. A surface paints `thresholdBand`, never a
|
|
117
|
+
* literal: the swap bar used to call 50% `warn` while the alert fired there, and a raised
|
|
118
|
+
* `tempCelsius` left a box painted `danger` for a notification that never arrives.
|
|
119
|
+
*/
|
|
120
|
+
memoryBand: HostBand;
|
|
121
|
+
swapBand: HostBand;
|
|
122
|
+
tempBand: HostBand;
|
|
123
|
+
}
|
|
124
|
+
/** A reading's urgency, or `null` when there is no reading to judge. */
|
|
125
|
+
export type HostBand = 'ok' | 'warn' | 'danger' | null;
|
|
126
|
+
/**
|
|
127
|
+
* How a per-cpu load sits against the threshold the panel notifies on.
|
|
128
|
+
*
|
|
129
|
+
* The ratio is what a person configures: `host.loadPerCpu` is the count the alert fires at, so
|
|
130
|
+
* `danger` is that number itself and `warn` is the approach to it. `0` disables the alert in
|
|
131
|
+
* `sampleHost`, so nothing can breach it and the band is `ok` — painting a box red for a
|
|
132
|
+
* notification that will never arrive is the same defect as inventing a reading. It lives here
|
|
133
|
+
* rather than in a component so both UIs share one band, the mistake that produced two hardcoded
|
|
134
|
+
* copies of the default.
|
|
135
|
+
*/
|
|
136
|
+
export declare function loadBand(loadPerCpu: number | null, alertPerCpu: number | undefined): HostBand;
|
|
137
|
+
/**
|
|
138
|
+
* The band for the host's own CPU share, which has no configurable alert.
|
|
139
|
+
*
|
|
140
|
+
* `host.cpuUsedPercent` is a share of the whole machine, and `hostSchema` has no threshold for it —
|
|
141
|
+
* so there is nothing a person chose for a surface to follow, and a fixed band is a decision. The
|
|
142
|
+
* decision is *this one*: the two UIs disagreed (noc-console painted 70/90, every stock dial 80/95),
|
|
143
|
+
* so one 75% reading came back `warn` on one page and `ok` on the other — `AGENTS.md`'s "UIs move
|
|
144
|
+
* together" broken by two literal pairs. A real alert would make this a `…Alert` field on the frame
|
|
145
|
+
* like its neighbours; until then it is a constant here, not a pair at each call site.
|
|
146
|
+
*/
|
|
147
|
+
export declare const HOST_CPU_BAND: {
|
|
148
|
+
readonly warnAt: 80;
|
|
149
|
+
readonly dangerAt: 95;
|
|
150
|
+
};
|
|
151
|
+
/** The band for a host cpu share, against {@link HOST_CPU_BAND}. */
|
|
152
|
+
export declare function hostCpuBand(percent: number | null): HostBand;
|
|
153
|
+
/**
|
|
154
|
+
* How a reading sits against the threshold the panel notifies on.
|
|
155
|
+
*
|
|
156
|
+
* `danger` at the threshold is the whole point: the alert fires there, so a bar that stays `warn`
|
|
157
|
+
* while a notification goes out disagrees with the panel's own verdict. `0` disables that alert in
|
|
158
|
+
* `sampleHost`, so nothing can breach it and the band is `ok`. One rule for the per-cpu load, the
|
|
159
|
+
* three percentages and each disk — they differ only in what the number means, and the mistake this
|
|
160
|
+
* replaced was four surfaces each deciding a band for itself.
|
|
161
|
+
*/
|
|
162
|
+
export declare function percentageBand(value: number | null, alertAt: number | undefined, fallback: number): HostBand;
|
|
163
|
+
/**
|
|
164
|
+
* The full scale of a temperature dial: the threshold the panel **notifies** on.
|
|
165
|
+
*
|
|
166
|
+
* There is no natural `100 °C`, so unlike a percentage a temperature has no scale of its own —
|
|
167
|
+
* the alert is the only number a person configured for it, and it is what the dial is drawn
|
|
168
|
+
* against. `0` disables the alert and leaves no scale to draw, so the default the older panels
|
|
169
|
+
* alerted on is kept rather than dividing by zero.
|
|
170
|
+
*
|
|
171
|
+
* This exists because the *band* was moved onto the frame and the *scale* was not: one stock
|
|
172
|
+
* surface scaled by `tempCelsiusAlert` while the other kept `(tempCelsius / 85) * 100`, so one
|
|
173
|
+
* frame at 60 °C against an alert of 95 drew arcs of `101.19` and `113.10` — the same number
|
|
174
|
+
* fuller on one page than the other. A tone test cannot see that; only the arc can.
|
|
175
|
+
*/
|
|
176
|
+
export declare function tempScale(alertAt: number | undefined): number;
|
|
177
|
+
/**
|
|
178
|
+
* How full a temperature dial is, as the percentage a `Gauge`/bar draws: a share of `tempScale`.
|
|
179
|
+
*
|
|
180
|
+
* `null` when nothing was measured — an absent reading has no dial, the same rule every other
|
|
181
|
+
* reading on the frame follows.
|
|
182
|
+
*/
|
|
183
|
+
export declare function tempDialPercent(temp: number | null | undefined, alertAt: number | undefined): number | null;
|
|
184
|
+
/** The readings of one host frame; a missing frame is the same as an unsampled one. */
|
|
185
|
+
export declare function hostReadings(host: HostReadingSource | null | undefined): HostReadings;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ServerConfig } from './contracts.js';
|
|
2
|
+
export type Patch = Record<string, unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* Keeps only the fields that differ from `current`.
|
|
5
|
+
*
|
|
6
|
+
* Nested groups list only the sub-keys that changed, which is what lets the
|
|
7
|
+
* server merge a partial patch instead of replacing the whole group. Every
|
|
8
|
+
* comparison goes through `same`, including the one inside a group: `health.http`
|
|
9
|
+
* is an object, so comparing those members by reference reported the whole group
|
|
10
|
+
* as changed on a form nobody had touched, and a `null` the form carries where
|
|
11
|
+
* the config has no key at all is the same "nothing here" the server would clear.
|
|
12
|
+
*/
|
|
13
|
+
export declare function diffFields(current: Patch, next: Patch, nested?: readonly string[]): Patch;
|
|
14
|
+
/**
|
|
15
|
+
* Has a **replaced** list been touched by this form?
|
|
16
|
+
*
|
|
17
|
+
* A list a patch replaces (`destinations`, `routes`) is all-or-nothing on the wire:
|
|
18
|
+
* sending it writes the sender's whole view, including the entries it has never
|
|
19
|
+
* seen. So the comparison that decides "send it" must be against the list this form
|
|
20
|
+
* was **filled with**, never against live state — live state moving is precisely
|
|
21
|
+
* what another client's save looks like, and a form that treats that as its own
|
|
22
|
+
* edit deletes whatever arrived while it was open. Measured: with the workspace
|
|
23
|
+
* settings page open on `alpha`, a second client added `beta`; saving an unrelated
|
|
24
|
+
* policy toggle on the first page removed `beta` from disk.
|
|
25
|
+
*
|
|
26
|
+
* `filled` absent means the block was never filled, and a list that was never
|
|
27
|
+
* filled must not travel either: it is `[]`, and `[]` on a replaced list is
|
|
28
|
+
* "delete every entry".
|
|
29
|
+
*/
|
|
30
|
+
export declare function replacedListEdited(filled: readonly unknown[] | undefined, next: readonly unknown[]): boolean;
|
|
31
|
+
/** The wire form of a replaced list, each entry compared by value. */
|
|
32
|
+
export declare function replacedListPatch<T>(filled: readonly unknown[] | undefined, next: readonly T[]): T[] | null;
|
|
33
|
+
export interface ReplacedListMerge<T> {
|
|
34
|
+
/** The list this form was filled with; absent means it was never filled. */
|
|
35
|
+
filled: readonly T[] | undefined;
|
|
36
|
+
/** What the form holds now. */
|
|
37
|
+
draft: readonly T[];
|
|
38
|
+
/** What the panel holds now, which another client may have changed. */
|
|
39
|
+
live: readonly T[];
|
|
40
|
+
/** One entry's identity; entries sharing a key are the same entry. */
|
|
41
|
+
key: (entry: T) => string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The entries two clients both changed while this form was open.
|
|
45
|
+
*
|
|
46
|
+
* A replaced list is merged three ways, which keeps a concurrent *addition*. It cannot keep a
|
|
47
|
+
* concurrent *edit*: both sides start from the same `filled` entry and both end with a different
|
|
48
|
+
* value, so whichever the merge prefers, the other is lost without a word. This names them so the
|
|
49
|
+
* save can refuse instead of choosing.
|
|
50
|
+
*
|
|
51
|
+
* The test is three-way and needs no revision field: this form changed the entry (`draft` differs
|
|
52
|
+
* from `filled`) **and** the panel changed it (`live` differs from `filled`). A change on one side
|
|
53
|
+
* only is ordinary — an edit here, or someone else's edit landing before this form saved — and is
|
|
54
|
+
* not a conflict. `filled` absent means the list was never filled, so nothing is comparable.
|
|
55
|
+
*/
|
|
56
|
+
export declare function replacedListConflicts<T>({ filled, draft, live, key }: ReplacedListMerge<T>): string[];
|
|
57
|
+
/**
|
|
58
|
+
* The list to send for a replaced list, or `null` when this form changed nothing.
|
|
59
|
+
*
|
|
60
|
+
* The form's own edits win, an entry it **removed** stays removed, and an entry that
|
|
61
|
+
* appeared while it was open is kept. That last half is the point: a replaced list is
|
|
62
|
+
* all-or-nothing, so sending only the draft writes "the list I saw when I opened this
|
|
63
|
+
* page" and silently deletes a concurrent addition. A three-way merge — what I filled,
|
|
64
|
+
* what I hold, what is there now — keeps both.
|
|
65
|
+
*
|
|
66
|
+
* A concurrent edit to the *same* entry is not reconcilable here; `replacedListConflicts` names it
|
|
67
|
+
* and the caller refuses the save.
|
|
68
|
+
*/
|
|
69
|
+
export declare function mergeReplacedList<T>({ filled, draft, live, key }: ReplacedListMerge<T>): T[] | null;
|
|
70
|
+
/**
|
|
71
|
+
* Edits to one server entry.
|
|
72
|
+
*
|
|
73
|
+
* Comparing against the *effective* config (defaults already merged) means an
|
|
74
|
+
* untouched field is omitted from the patch, so an inherited default stays
|
|
75
|
+
* inherited instead of being frozen into `servers.config.json`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function diffServerConfig(current: ServerConfig, next: Patch): Patch;
|
|
78
|
+
export interface FieldChange {
|
|
79
|
+
path: string;
|
|
80
|
+
from: unknown;
|
|
81
|
+
to: unknown;
|
|
82
|
+
}
|
|
83
|
+
/** Flattens `{ a: { b: 1 } }` into `[{ path: 'a.b', value: 1 }]`. */
|
|
84
|
+
export declare function flattenLeaves(value: unknown, prefix?: string): Array<{
|
|
85
|
+
path: string;
|
|
86
|
+
value: unknown;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* The pending patch as a readable list: what each changed leaf was, and what it
|
|
90
|
+
* is about to become. Values a snapshot does not have show as "unset".
|
|
91
|
+
*/
|
|
92
|
+
export declare function describeChanges(patch: Patch, current: Patch): FieldChange[];
|
|
93
|
+
/** Leaf count of a patch, for the "N fields changed" summary. */
|
|
94
|
+
export declare function countLeaves(patch: Patch): number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a health probe's latency sits, decided **once**.
|
|
3
|
+
*
|
|
4
|
+
* `responseMs` is rendered three times — the detail tile's number, the sparkline under it, and the
|
|
5
|
+
* list row's cell — and each restated its own thresholds: the number used `300`/`1000`, the
|
|
6
|
+
* sparkline had a second copy of the same two numbers in `probeColor()`, and the row called `1000`
|
|
7
|
+
* alone, in a different colour class. A latency of `1500` therefore read `danger` in the pane and
|
|
8
|
+
* `warn` in the row one click away, and a `500` reading was `warn` in the pane and plain in the row.
|
|
9
|
+
*
|
|
10
|
+
* The thresholds are a fixed decision by nature — `healthSchema` has no latency field for a person
|
|
11
|
+
* to set — so, like `hostCpuBand`, the band is a constant that one predicate owns and a surface
|
|
12
|
+
* paints. `cpu-scale.ts` is the same shape for a capacity.
|
|
13
|
+
*/
|
|
14
|
+
/** A probe slower than this is worth a warning; past `PROBE_DANGER_MS` it is an unhealthy entry. */
|
|
15
|
+
export declare const PROBE_WARN_MS = 300;
|
|
16
|
+
export declare const PROBE_DANGER_MS = 1000;
|
|
17
|
+
/**
|
|
18
|
+
* A reading is `unknown` when it does not exist — a stopped entry, or a probe that has not run.
|
|
19
|
+
*
|
|
20
|
+
* It is its own band rather than `ok`: the tile painted an absent reading `--ok` (`probeColor` read
|
|
21
|
+
* `responseMs ?? 0`), which is a healthy verdict for a number nobody measured.
|
|
22
|
+
*/
|
|
23
|
+
export type ProbeBand = 'unknown' | 'ok' | 'warn' | 'danger';
|
|
24
|
+
/** The band a probe latency falls in. `null` is a reading that does not exist. */
|
|
25
|
+
export declare function probeBand(responseMs: number | null | undefined): ProbeBand;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { ProxyCertificateView, ProxyConfig, ProxyPatch, ProxyRoute, ProxyRoutePatch } from './contracts.js';
|
|
2
|
+
/**
|
|
3
|
+
* The reverse-proxy form, shared by both UIs: the route draft the table edits, the patch a save
|
|
4
|
+
* sends, and the checks the panel would otherwise answer with a 400.
|
|
5
|
+
*
|
|
6
|
+
* These declarations were identical copies in `uis/stock` and `uis/noc-console`
|
|
7
|
+
* (`parseUpstream` differs only in a doc comment, so it takes the fuller one). Eight commits had
|
|
8
|
+
* touched both files, one literally "carry the fix into the other UI" — a measured cost.
|
|
9
|
+
*
|
|
10
|
+
* Nothing here may import Vue: the UIs bundle it as a devDependency while the published package
|
|
11
|
+
* does not ship it, so a Vue import would break the server if it ever read this file. That is also
|
|
12
|
+
* why the detach is `clonePlain` (`./clone.ts`), never `structuredClone(toRaw(...))`.
|
|
13
|
+
*/
|
|
14
|
+
export interface CertificateErrors {
|
|
15
|
+
label?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
certificate?: string;
|
|
18
|
+
privateKey?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const HOST_PATTERN: RegExp;
|
|
21
|
+
export declare const LOCAL_LISTENER: RegExp;
|
|
22
|
+
export declare const LOCAL_TLDS: string[];
|
|
23
|
+
/** The panel-wide block a save writes besides the route table. */
|
|
24
|
+
export interface ListenerDraft {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
httpPort: number;
|
|
27
|
+
httpsPort: number;
|
|
28
|
+
email: string;
|
|
29
|
+
staging: boolean;
|
|
30
|
+
/** DNS-01: the panel answers the challenge instead of the engine using ports. */
|
|
31
|
+
dns01: boolean;
|
|
32
|
+
/** Nameservers the engine checks the record against, as typed: one per line or comma. */
|
|
33
|
+
resolvers: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ProxyWorkspace {
|
|
36
|
+
id: string;
|
|
37
|
+
label: string;
|
|
38
|
+
servers: Array<{
|
|
39
|
+
id: string;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export declare const ROUTE_ID_PATTERN: RegExp;
|
|
43
|
+
/** The route as the page edits it: the config plus a stable key for `v-for`. */
|
|
44
|
+
export interface RouteDraft extends ProxyRoute {
|
|
45
|
+
key: string;
|
|
46
|
+
}
|
|
47
|
+
export interface RouteErrors {
|
|
48
|
+
host?: string;
|
|
49
|
+
id?: string;
|
|
50
|
+
workspace?: string;
|
|
51
|
+
server?: string;
|
|
52
|
+
url?: string;
|
|
53
|
+
path?: string;
|
|
54
|
+
form?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The sentences `validateRouteDraft` puts in {@link RouteErrors}, as a seam for translation.
|
|
58
|
+
*
|
|
59
|
+
* The rules belong here — both UIs must refuse the same input for the same reason — but the
|
|
60
|
+
* wording does not: a UI shipping more than one language has to render these in the reader's
|
|
61
|
+
* language, and `src/shared/` may not import Vue or the UI's i18n. So the caller passes messages
|
|
62
|
+
* and the defaults keep every existing caller's output byte-identical.
|
|
63
|
+
*/
|
|
64
|
+
export interface RouteErrorMessages {
|
|
65
|
+
hostRequired: () => string;
|
|
66
|
+
hostInvalid: () => string;
|
|
67
|
+
hostDuplicate: (host: string) => string;
|
|
68
|
+
pathNeedsSlash: () => string;
|
|
69
|
+
pathHasSpace: () => string;
|
|
70
|
+
idInvalid: () => string;
|
|
71
|
+
idDuplicate: (id: string) => string;
|
|
72
|
+
workspaceRequired: () => string;
|
|
73
|
+
serverRequired: () => string;
|
|
74
|
+
urlInvalid: () => string;
|
|
75
|
+
}
|
|
76
|
+
/** The words the route list shows for a target or a retry delay, as a translation seam. */
|
|
77
|
+
export interface RouteSummaryLabels {
|
|
78
|
+
controlPanel: () => string;
|
|
79
|
+
noUpstream: () => string;
|
|
80
|
+
noServerPicked: () => string;
|
|
81
|
+
fallbackRetry: () => string;
|
|
82
|
+
retryOne: (count: number, unit: 'minute' | 'hour') => string;
|
|
83
|
+
retryMany: (count: number, unit: 'minute' | 'hour') => string;
|
|
84
|
+
}
|
|
85
|
+
export declare const UNPRIVILEGED_HTTPS_PORT = 4443;
|
|
86
|
+
export declare const UNPRIVILEGED_HTTP_PORT = 4480;
|
|
87
|
+
/** One uploaded pair, as the list shows it; the files themselves are on disk. */
|
|
88
|
+
export declare function certificateTitle(certificate: Pick<ProxyCertificateView, 'label' | 'id'>): string;
|
|
89
|
+
/** The first public name that would need the e-mail, for the hint to name it. */
|
|
90
|
+
export declare function firstPublicHost(routes: readonly RouteDraft[]): string | null;
|
|
91
|
+
export declare function formatBytes(bytes: number | null): string;
|
|
92
|
+
export declare function isPrivilegedPort(port: number): boolean;
|
|
93
|
+
/** A name an ACME CA could issue for; anything else gets the engine's own CA. */
|
|
94
|
+
export declare function isPublicHost(host: string): boolean;
|
|
95
|
+
export declare function listenerPatch(current: ProxyConfig, draft: ListenerDraft): Partial<ProxyPatch>;
|
|
96
|
+
export declare function newRouteDraft(): RouteDraft;
|
|
97
|
+
export declare function newRouteKey(): string;
|
|
98
|
+
/**
|
|
99
|
+
* A detached, plain copy of the route list, so an edit cannot reach live state.
|
|
100
|
+
*
|
|
101
|
+
* `clonePlain`, not `structuredClone(toRaw(...))`: a list the page rebuilt holds Vue proxies
|
|
102
|
+
* inside the raw array, and the clone then throws `DataCloneError`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function cloneRoutes(routes: readonly ProxyRoute[]): RouteDraft[];
|
|
105
|
+
/**
|
|
106
|
+
* Applies a dialog result to the draft list.
|
|
107
|
+
*
|
|
108
|
+
* `edited` is matched by route **id**, never by the row's `key`: a state frame arriving while the
|
|
109
|
+
* dialog is open re-clones the list and mints a fresh key per row, so the row the dialog was opened
|
|
110
|
+
* from no longer matches by key — and the edit was then dropped with the dialog closing as if it
|
|
111
|
+
* had saved. An id survives the re-clone. `null` means the dialog is adding, which is why the add
|
|
112
|
+
* case is not "no match found".
|
|
113
|
+
*/
|
|
114
|
+
export declare function applyRouteDraft(routes: readonly RouteDraft[], edited: RouteDraft | null, next: RouteDraft): RouteDraft[];
|
|
115
|
+
/** Nameservers as typed: split on commas or newlines, trimmed, empties dropped. */
|
|
116
|
+
export declare function parseResolvers(value: string): string[];
|
|
117
|
+
/** The whole patch a save sends, or `null` when nothing changed. */
|
|
118
|
+
export declare function proxyPatch(current: ProxyConfig, listener: ListenerDraft, drafts: readonly RouteDraft[], filledRoutes?: readonly ProxyRoute[]): ProxyPatch | null;
|
|
119
|
+
/**
|
|
120
|
+
* The e-mail rule the panel enforces: a public name served over TLS needs an
|
|
121
|
+
* ACME account address. A local-only name gets the engine's own CA, so a
|
|
122
|
+
* LAN-only setup never needs one.
|
|
123
|
+
*/
|
|
124
|
+
export declare function requiresEmail(listener: Pick<ListenerDraft, 'email' | 'staging'>, routes: readonly RouteDraft[]): boolean;
|
|
125
|
+
export declare function retryInLabel(minutes: number | null, labels?: RouteSummaryLabels): string;
|
|
126
|
+
/**
|
|
127
|
+
* Where a route answers, for the list's link. A route with TLS off is served on the
|
|
128
|
+
* plain port, and a standard port stays out of the URL.
|
|
129
|
+
*/
|
|
130
|
+
export declare function routeUrl(route: Pick<ProxyRoute, 'host' | 'path' | 'tls'>, httpPort: number, httpsPort: number): string | null;
|
|
131
|
+
export declare function routesEqual(current: readonly ProxyRoute[], drafts: readonly RouteDraft[]): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The route table to send, or `null` when unchanged.
|
|
134
|
+
*
|
|
135
|
+
* `filled` is the table this form was filled with. With it the patch is a three-way merge, so a
|
|
136
|
+
* route another client added while the page was open survives a save from this one; without it the
|
|
137
|
+
* draft's whole view is sent, which is only safe when the caller knows it holds the current table.
|
|
138
|
+
*/
|
|
139
|
+
export declare function routesPatch(current: readonly ProxyRoute[], drafts: readonly RouteDraft[], filled?: readonly ProxyRoute[]): ProxyRoutePatch[] | null;
|
|
140
|
+
/**
|
|
141
|
+
* The routes both this form and another client changed, so the save can refuse instead of choosing.
|
|
142
|
+
*
|
|
143
|
+
* Same rule as `destinationConflicts`: a three-way merge keeps a concurrent addition but cannot keep
|
|
144
|
+
* a concurrent edit to one route, because both sides moved it off the same baseline.
|
|
145
|
+
*/
|
|
146
|
+
export declare function routeConflicts(current: readonly ProxyRoute[], drafts: readonly RouteDraft[], filled?: readonly ProxyRoute[]): string[];
|
|
147
|
+
export declare function sameWire(a: ProxyRoute, b: ProxyRoute): boolean;
|
|
148
|
+
/** A certificate is named by its label; the id names the files on disk. */
|
|
149
|
+
export declare function slugifyCertificateId(label: string): string;
|
|
150
|
+
export declare function slugifyId(value: string, fallback: string): string;
|
|
151
|
+
export declare function slugifyRouteId(host: string): string;
|
|
152
|
+
/** What the target column reads: who a route forwards to. */
|
|
153
|
+
export declare function targetSummary(route: ProxyRoute, workspaces: readonly ProxyWorkspace[], labels?: RouteSummaryLabels): string;
|
|
154
|
+
export declare function toProxyRoutes(drafts: readonly RouteDraft[]): ProxyRoutePatch[];
|
|
155
|
+
/**
|
|
156
|
+
* The wire shape of a route: a row key is a UI detail, and the schema rejects
|
|
157
|
+
* undeclared keys.
|
|
158
|
+
*/
|
|
159
|
+
export declare function toRouteWire(route: ProxyRoute): ProxyRoutePatch;
|
|
160
|
+
export declare function uniqueCertificateId(base: string, taken: readonly string[]): string;
|
|
161
|
+
export declare function uniqueId(base: string, taken: readonly string[]): string;
|
|
162
|
+
export declare function uniqueRouteId(base: string, taken: readonly string[]): string;
|
|
163
|
+
/** True while the ports are the unprivileged pair this page offers as a switch. */
|
|
164
|
+
export declare function usesFallbackPorts(config: Pick<ProxyConfig, 'httpPort' | 'httpsPort'>): boolean;
|
|
165
|
+
export declare function validateRouteDraft(draft: RouteDraft, options: {
|
|
166
|
+
others: readonly RouteDraft[];
|
|
167
|
+
workspaces: readonly ProxyWorkspace[];
|
|
168
|
+
messages?: Partial<RouteErrorMessages>;
|
|
169
|
+
}): RouteErrors;
|
|
170
|
+
/**
|
|
171
|
+
* The panel accepts an upstream with or without a scheme, and a port is optional
|
|
172
|
+
* because every scheme has a default one — the panel fills in :80 or :443.
|
|
173
|
+
*
|
|
174
|
+
* A typed default port is dropped on the way to the panel: `new URL` normalizes
|
|
175
|
+
* `:80` on `http:` away, so `http://10.0.0.5:80` and `http://10.0.0.5` are one
|
|
176
|
+
* upstream, and a route table that keeps both forms would read as unchanged after
|
|
177
|
+
* a save that the panel had actually rewritten.
|
|
178
|
+
*/
|
|
179
|
+
export declare function parseUpstream(value: string): {
|
|
180
|
+
host: string;
|
|
181
|
+
port: string;
|
|
182
|
+
} | null;
|