@vigilbase/cli
Version:
Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.
27 lines (26 loc) • 1.28 kB
TypeScript
import type { CliConfig } from './config.js';
export declare class NetworkError extends Error {
readonly code: string;
readonly status = 0;
constructor(message: string, code: string, cause?: unknown);
}
export declare function networkError(error: unknown, url: string, timeoutMs: number, timedOut: boolean): NetworkError;
export declare const MAX_RESPONSE_BYTES: number;
/** Bound decoded bytes even when Content-Length is absent, compressed, or dishonest. */
export declare function readBoundedBody(response: Response, signal: AbortSignal, maxBytes?: number): Promise<string>;
/**
* A signal that aborts with the reason of the first of `signals` to abort.
* Uses `AbortSignal.any` (Node 20.3+) and combines them by hand on older
* Node 20; `dispose` then removes the listeners so a long-lived signal does
* not collect one per request.
*/
export declare function anySignal(signals: AbortSignal[]): {
signal: AbortSignal;
dispose: () => void;
};
/** Keep the timeout active until the complete response body has been read. */
export declare function requestText(config: CliConfig, url: string, init?: RequestInit): Promise<{
response: Response;
text: string;
}>;
export declare function parseJsonResponse(response: Response, text: string): unknown;