@capgo/cli
Version:
A CLI to upload to capgo servers
93 lines (92 loc) • 3.58 kB
TypeScript
import type { eventWithTime, serializedNodeWithId } from '@rrweb/types';
interface TerminalSnapshot {
node: serializedNodeWithId;
terminalNodeId: number;
}
export interface TerminalReplayFrame {
height: number;
html: string;
text: string;
width: number;
}
export interface TerminalPixelSize {
height: number;
width: number;
}
interface InitReplayGateInput {
analyticsEnabled?: boolean;
apikey?: string;
isCi?: boolean;
stdinIsTTY?: boolean;
stdoutIsTTY?: boolean;
telemetryDisabled?: boolean;
}
interface InitReplaySnapshotBody {
event: '$snapshot';
properties: {
$current_url: string;
$lib: string;
$lib_version: string;
$session_id: string;
$snapshot_bytes: number;
$snapshot_data: eventWithTime[];
$snapshot_source: string;
$window_id: string;
};
timestamp: string;
}
type InitReplayTransport = (url: string, body: InitReplaySnapshotBody, apikey: string, signal?: AbortSignal) => Promise<boolean>;
interface StartInitReplayOptions {
analyticsEnabled?: boolean;
apikey?: string;
ariaLabel?: string;
cols?: number;
currentUrl?: string;
isCi?: boolean;
replayUrl?: string;
rows?: number;
sessionPrefix?: string;
supaAnon?: string;
supaHost?: string;
throttleMs?: number;
terminalPixelSize?: TerminalPixelSize;
transport?: InitReplayTransport;
}
export interface InitReplayController {
finish: () => Promise<void>;
sessionId: string;
}
export declare function getActiveCliReplaySessionId(): string | undefined;
export declare function finishActiveCliReplay(): Promise<void>;
export declare function isCliTelemetryDisabled(): boolean;
export declare function shouldStartInitReplay(input: InitReplayGateInput): boolean;
export declare function resolveCapgoReplayUrl(host?: string): string | undefined;
export declare function resolveSupabaseReplayUrl(supaHost?: string): string | undefined;
export declare function resolveReplayUrlForFlush(replayUrl: Promise<string | undefined>, timeoutMs?: number, onTimeout?: () => void): Promise<string | undefined>;
export declare function parseTerminalPixelSizeResponse(input: string): TerminalPixelSize | undefined;
export declare function getReplayViewportSize(cols?: number, rows?: number, terminalPixelSize?: TerminalPixelSize): {
height: number;
width: number;
};
export declare function queryTerminalPixelSize(timeoutMs?: number): Promise<TerminalPixelSize | undefined>;
export declare function renderRedactedTerminalFrame(rawAnsi: string, cols?: number, rows?: number, terminalPixelSize?: TerminalPixelSize): Promise<TerminalReplayFrame>;
export declare function renderRedactedTerminalText(rawAnsi: string, cols?: number, rows?: number): Promise<string>;
export declare function createTerminalSnapshot(frameInput: TerminalReplayFrame | string, options?: {
ariaLabel?: string;
currentUrl?: string;
}): Promise<TerminalSnapshot>;
export declare function createTerminalSnapshotNode(frame: TerminalReplayFrame | string): Promise<serializedNodeWithId>;
export declare function createTerminalInteractionEvents(input: {
terminalNodeId: number;
text: string;
timestamp: number;
}): eventWithTime[];
export declare function buildInitReplayBody(input: {
currentUrl?: string;
events: eventWithTime[];
sessionId: string;
timestamp: string;
windowId: string;
}): InitReplaySnapshotBody;
export declare function startInitReplay(options?: StartInitReplayOptions): InitReplayController | undefined;
export {};