refactor: trim install infra exports

This commit is contained in:
Peter Steinberger
2026-05-01 23:41:46 +01:00
parent d85980a529
commit 194c516957
14 changed files with 26 additions and 29 deletions

View File

@@ -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<HeartbeatDeps["getReplyFromConfig"]>;
type HeartbeatReplyFn = NonNullable<HeartbeatDeps["getReplyFromConfig"]>;
export type HeartbeatReplySpy = ReturnType<typeof vi.fn<HeartbeatReplyFn>>;
export function createHeartbeatReplySpy(): HeartbeatReplySpy {
function createHeartbeatReplySpy(): HeartbeatReplySpy {
const replySpy: HeartbeatReplySpy = vi.fn<HeartbeatReplyFn>();
replySpy.mockResolvedValue({ text: "ok" });
return replySpy;

View File

@@ -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;

View File

@@ -1,12 +1,12 @@
export type InstallMode = "install" | "update";
type InstallMode = "install" | "update";
export type InstallModeOptions<TLogger> = {
type InstallModeOptions<TLogger> = {
logger?: TLogger;
mode?: InstallMode;
dryRun?: boolean;
};
export type TimedInstallModeOptions<TLogger> = InstallModeOptions<TLogger> & {
type TimedInstallModeOptions<TLogger> = InstallModeOptions<TLogger> & {
timeoutMs?: number;
};

View File

@@ -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";
}

View File

@@ -1,8 +1,8 @@
import os from "node:os";
export type NetworkInterfacesSnapshot = ReturnType<typeof os.networkInterfaces>;
export type NetworkInterfaceFamily = "IPv4" | "IPv6";
export type ExternalNetworkInterfaceAddress = {
type NetworkInterfaceFamily = "IPv4" | "IPv6";
type ExternalNetworkInterfaceAddress = {
name: string;
address: string;
family: NetworkInterfaceFamily;

View File

@@ -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)

View File

@@ -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[];
};

View File

@@ -21,7 +21,7 @@ type ResolveNpmIntegrityDriftParams<TPayload> = {
warn?: (payload: TPayload) => void;
};
export type ResolveNpmIntegrityDriftResult<TPayload> = {
type ResolveNpmIntegrityDriftResult<TPayload> = {
integrityDrift?: NpmIntegrityDrift;
proceed: boolean;
payload?: TPayload;

View File

@@ -14,7 +14,7 @@ import {
parseRegistryNpmSpec,
} from "./npm-registry-spec.js";
export type NpmSpecArchiveInstallFlowResult<TResult extends { ok: boolean }> =
type NpmSpecArchiveInstallFlowResult<TResult extends { ok: boolean }> =
| {
ok: false;
error: string;

View File

@@ -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;

View File

@@ -253,7 +253,7 @@ export async function writePackageDistInventory(packageRoot: string): Promise<st
return inventory;
}
export async function readPackageDistInventory(packageRoot: string): Promise<string[]> {
async function readPackageDistInventory(packageRoot: string): Promise<string[]> {
const inventoryPath = path.join(packageRoot, PACKAGE_DIST_INVENTORY_RELATIVE_PATH);
const raw = await fs.readFile(inventoryPath, "utf8");
const parsed = JSON.parse(raw) as unknown;

View File

@@ -24,7 +24,7 @@ export type PackageUpdateStepResult = {
stderrTail?: string | null;
};
export type PackageUpdateStepRunner = (params: {
type PackageUpdateStepRunner = (params: {
name: string;
argv: string[];
cwd?: string;

View File

@@ -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;

View File

@@ -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;
};