From 194c51695701431bf92988c4f593737516de7c21 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 23:41:46 +0100 Subject: [PATCH] refactor: trim install infra exports --- src/infra/heartbeat-runner.test-utils.ts | 6 +++--- src/infra/install-flow.ts | 2 +- src/infra/install-mode-options.ts | 6 +++--- src/infra/network-discovery-display.ts | 7 ++----- src/infra/network-interfaces.ts | 4 ++-- src/infra/node-pairing-authz.ts | 6 +++--- src/infra/node-pairing.ts | 8 ++++---- src/infra/npm-integrity.ts | 2 +- src/infra/npm-pack-install.ts | 2 +- src/infra/os-summary.ts | 2 +- src/infra/package-dist-inventory.ts | 2 +- src/infra/package-update-steps.ts | 2 +- src/infra/plugin-install-path-warnings.ts | 2 +- src/infra/process-respawn.ts | 4 ++-- 14 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/infra/heartbeat-runner.test-utils.ts b/src/infra/heartbeat-runner.test-utils.ts index 7becd175a4a..3b1a2bb1230 100644 --- a/src/infra/heartbeat-runner.test-utils.ts +++ b/src/infra/heartbeat-runner.test-utils.ts @@ -9,7 +9,7 @@ import { setActivePluginRegistry } from "../plugins/runtime.js"; import { createTestRegistry } from "../test-utils/channel-plugins.js"; import type { HeartbeatDeps } from "./heartbeat-runner.js"; -export type HeartbeatSessionSeed = { +type HeartbeatSessionSeed = { sessionId?: string; updatedAt?: number; lastChannel: string; @@ -17,10 +17,10 @@ export type HeartbeatSessionSeed = { lastTo: string; }; -export type HeartbeatReplyFn = NonNullable; +type HeartbeatReplyFn = NonNullable; export type HeartbeatReplySpy = ReturnType>; -export function createHeartbeatReplySpy(): HeartbeatReplySpy { +function createHeartbeatReplySpy(): HeartbeatReplySpy { const replySpy: HeartbeatReplySpy = vi.fn(); replySpy.mockResolvedValue({ text: "ok" }); return replySpy; diff --git a/src/infra/install-flow.ts b/src/infra/install-flow.ts index 7a4d1531ef1..07ede657f42 100644 --- a/src/infra/install-flow.ts +++ b/src/infra/install-flow.ts @@ -5,7 +5,7 @@ import { resolveUserPath } from "../utils.js"; import { type ArchiveLogger, extractArchive, fileExists, resolvePackedRootDir } from "./archive.js"; import { withTempDir } from "./install-source-utils.js"; -export type ExistingInstallPathResult = +type ExistingInstallPathResult = | { ok: true; resolvedPath: string; diff --git a/src/infra/install-mode-options.ts b/src/infra/install-mode-options.ts index dabb8f5380e..c12186875df 100644 --- a/src/infra/install-mode-options.ts +++ b/src/infra/install-mode-options.ts @@ -1,12 +1,12 @@ -export type InstallMode = "install" | "update"; +type InstallMode = "install" | "update"; -export type InstallModeOptions = { +type InstallModeOptions = { logger?: TLogger; mode?: InstallMode; dryRun?: boolean; }; -export type TimedInstallModeOptions = InstallModeOptions & { +type TimedInstallModeOptions = InstallModeOptions & { timeoutMs?: number; }; diff --git a/src/infra/network-discovery-display.ts b/src/infra/network-discovery-display.ts index af2ba818213..2ee4017813c 100644 --- a/src/infra/network-discovery-display.ts +++ b/src/infra/network-discovery-display.ts @@ -2,7 +2,7 @@ import type { GatewayBindMode } from "../config/types.js"; import { pickPrimaryLanIPv4, resolveGatewayBindHost } from "../gateway/net.js"; import { pickPrimaryTailnetIPv4 } from "./tailnet.js"; -export function summarizeDisplayNetworkError(error: unknown): string { +function summarizeDisplayNetworkError(error: unknown): string { if (error instanceof Error) { const message = error.message.trim(); if (message) { @@ -12,10 +12,7 @@ export function summarizeDisplayNetworkError(error: unknown): string { return "network interface discovery failed"; } -export function fallbackBindHostForDisplay( - bindMode: GatewayBindMode, - customBindHost?: string, -): string { +function fallbackBindHostForDisplay(bindMode: GatewayBindMode, customBindHost?: string): string { if (bindMode === "lan") { return "0.0.0.0"; } diff --git a/src/infra/network-interfaces.ts b/src/infra/network-interfaces.ts index 4b1329ec4ad..42a52652f87 100644 --- a/src/infra/network-interfaces.ts +++ b/src/infra/network-interfaces.ts @@ -1,8 +1,8 @@ import os from "node:os"; export type NetworkInterfacesSnapshot = ReturnType; -export type NetworkInterfaceFamily = "IPv4" | "IPv6"; -export type ExternalNetworkInterfaceAddress = { +type NetworkInterfaceFamily = "IPv4" | "IPv6"; +type ExternalNetworkInterfaceAddress = { name: string; address: string; family: NetworkInterfaceFamily; diff --git a/src/infra/node-pairing-authz.ts b/src/infra/node-pairing-authz.ts index 92e1fbe2381..4d675949a9f 100644 --- a/src/infra/node-pairing-authz.ts +++ b/src/infra/node-pairing-authz.ts @@ -2,9 +2,9 @@ import { NODE_SYSTEM_RUN_COMMANDS } from "./node-commands.js"; export type NodeApprovalScope = "operator.pairing" | "operator.write" | "operator.admin"; -export const OPERATOR_PAIRING_SCOPE: NodeApprovalScope = "operator.pairing"; -export const OPERATOR_WRITE_SCOPE: NodeApprovalScope = "operator.write"; -export const OPERATOR_ADMIN_SCOPE: NodeApprovalScope = "operator.admin"; +const OPERATOR_PAIRING_SCOPE: NodeApprovalScope = "operator.pairing"; +const OPERATOR_WRITE_SCOPE: NodeApprovalScope = "operator.write"; +const OPERATOR_ADMIN_SCOPE: NodeApprovalScope = "operator.admin"; export function resolveNodePairApprovalScopes(commands: unknown): NodeApprovalScope[] { const normalized = Array.isArray(commands) diff --git a/src/infra/node-pairing.ts b/src/infra/node-pairing.ts index df076dbf257..74920c8485d 100644 --- a/src/infra/node-pairing.ts +++ b/src/infra/node-pairing.ts @@ -14,7 +14,7 @@ import { import { rejectPendingPairingRequest } from "./pairing-pending.js"; import { generatePairingToken, verifyPairingToken } from "./pairing-token.js"; -export type NodeDeclaredSurface = { +type NodeDeclaredSurface = { nodeId: string; displayName?: string; platform?: string; @@ -29,7 +29,7 @@ export type NodeDeclaredSurface = { remoteIp?: string; }; -export type NodeApprovedSurface = NodeDeclaredSurface; +type NodeApprovedSurface = NodeDeclaredSurface; export type NodePairingRequestInput = NodeDeclaredSurface & { silent?: boolean; @@ -41,7 +41,7 @@ export type NodePairingPendingRequest = NodePairingRequestInput & { ts: number; }; -export type NodePairingPendingEntry = NodePairingPendingRequest & { +type NodePairingPendingEntry = NodePairingPendingRequest & { requiredApproveScopes: NodeApprovalScope[]; }; @@ -55,7 +55,7 @@ export type NodePairingPairedNode = NodeApprovedSurface & { lastSeenReason?: string; }; -export type NodePairingList = { +type NodePairingList = { pending: NodePairingPendingEntry[]; paired: NodePairingPairedNode[]; }; diff --git a/src/infra/npm-integrity.ts b/src/infra/npm-integrity.ts index fefa4f6c231..36e782a4961 100644 --- a/src/infra/npm-integrity.ts +++ b/src/infra/npm-integrity.ts @@ -21,7 +21,7 @@ type ResolveNpmIntegrityDriftParams = { warn?: (payload: TPayload) => void; }; -export type ResolveNpmIntegrityDriftResult = { +type ResolveNpmIntegrityDriftResult = { integrityDrift?: NpmIntegrityDrift; proceed: boolean; payload?: TPayload; diff --git a/src/infra/npm-pack-install.ts b/src/infra/npm-pack-install.ts index e7c8f97ca84..1a36d175e60 100644 --- a/src/infra/npm-pack-install.ts +++ b/src/infra/npm-pack-install.ts @@ -14,7 +14,7 @@ import { parseRegistryNpmSpec, } from "./npm-registry-spec.js"; -export type NpmSpecArchiveInstallFlowResult = +type NpmSpecArchiveInstallFlowResult = | { ok: false; error: string; diff --git a/src/infra/os-summary.ts b/src/infra/os-summary.ts index 867d10265b4..4cbb5775210 100644 --- a/src/infra/os-summary.ts +++ b/src/infra/os-summary.ts @@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process"; import os from "node:os"; import { normalizeOptionalString } from "../shared/string-coerce.js"; -export type OsSummary = { +type OsSummary = { platform: NodeJS.Platform; arch: string; release: string; diff --git a/src/infra/package-dist-inventory.ts b/src/infra/package-dist-inventory.ts index a3662cab06f..91130a3e9b3 100644 --- a/src/infra/package-dist-inventory.ts +++ b/src/infra/package-dist-inventory.ts @@ -253,7 +253,7 @@ export async function writePackageDistInventory(packageRoot: string): Promise { +async function readPackageDistInventory(packageRoot: string): Promise { const inventoryPath = path.join(packageRoot, PACKAGE_DIST_INVENTORY_RELATIVE_PATH); const raw = await fs.readFile(inventoryPath, "utf8"); const parsed = JSON.parse(raw) as unknown; diff --git a/src/infra/package-update-steps.ts b/src/infra/package-update-steps.ts index 9ad7e0d2058..740469cb5e1 100644 --- a/src/infra/package-update-steps.ts +++ b/src/infra/package-update-steps.ts @@ -24,7 +24,7 @@ export type PackageUpdateStepResult = { stderrTail?: string | null; }; -export type PackageUpdateStepRunner = (params: { +type PackageUpdateStepRunner = (params: { name: string; argv: string[]; cwd?: string; diff --git a/src/infra/plugin-install-path-warnings.ts b/src/infra/plugin-install-path-warnings.ts index 0a6db81501f..70b5eb2e3db 100644 --- a/src/infra/plugin-install-path-warnings.ts +++ b/src/infra/plugin-install-path-warnings.ts @@ -3,7 +3,7 @@ import path from "node:path"; import type { PluginInstallRecord } from "../config/types.plugins.js"; import { normalizeOptionalString } from "../shared/string-coerce.js"; -export type PluginInstallPathIssue = { +type PluginInstallPathIssue = { kind: "custom-path" | "missing-path"; pluginId: string; path: string; diff --git a/src/infra/process-respawn.ts b/src/infra/process-respawn.ts index 9926a4e5bb9..cfd29d4552d 100644 --- a/src/infra/process-respawn.ts +++ b/src/infra/process-respawn.ts @@ -7,13 +7,13 @@ import { detectRespawnSupervisor } from "./supervisor-markers.js"; type RespawnMode = "spawned" | "supervised" | "disabled" | "failed"; -export type GatewayRespawnResult = { +type GatewayRespawnResult = { mode: RespawnMode; pid?: number; detail?: string; }; -export type GatewayUpdateRespawnResult = GatewayRespawnResult & { +type GatewayUpdateRespawnResult = GatewayRespawnResult & { child?: ChildProcess; };