import { RozeniteDevToolsClient } from '@rozenite/plugin-bridge'; export declare type BootRecordingOptions = NetworkInspectorConfig & EventsListenerOptions & { /** * Enable queuing of events during boot before DevTools connects. * When true, network activity is captured and queued until DevTools is ready. * When false, nothing is queued and inspectors are not even set up. * @default true */ enableBootRecording?: boolean; }; declare type EventsListenerOptions = { /** * Maximum number of messages to queue before DevTools connects. * @default 200 */ maxQueueSize?: number; }; declare type HttpEventMap = { 'request-sent': { requestId: RequestId; request: Request_2; timestamp: Timestamp; initiator: Initiator; type: ResourceType; source?: NetworkEventSource; }; 'response-received': { requestId: RequestId; timestamp: Timestamp; type: ResourceType; response: Response_2; source?: NetworkEventSource; }; 'request-completed': { requestId: RequestId; timestamp: Timestamp; duration: number; size: number | null; ttfb: number; source?: NetworkEventSource; }; 'request-failed': { requestId: RequestId; timestamp: Timestamp; type: ResourceType; error: string; canceled: boolean; source?: NetworkEventSource; }; 'request-progress': { requestId: RequestId; timestamp: Timestamp; loaded: number; total: number; lengthComputable: boolean; source?: NetworkEventSource; }; 'get-response-body': { requestId: RequestId; }; 'response-body': { requestId: RequestId; body: ResponseBody; }; 'set-overrides': { overrides: [string, RequestOverride][]; }; }; declare type HttpHeaders = Record; declare type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD'; declare type Initiator = { type: string; symbolicationStatus?: 'pending' | 'complete' | 'failed' | 'unavailable'; symbolicationError?: string; functionName?: string; url?: string; lineNumber?: number; columnNumber?: number; generatedUrl?: string; generatedLineNumber?: number; generatedColumnNumber?: number; codeFrame?: InitiatorCodeFrame | null; stack?: InitiatorStackFrame[]; }; declare type InitiatorCodeFrame = { content: string; fileName: string; location?: { row: number; column: number; } | null; }; declare type InitiatorStackFrame = { functionName?: string; url?: string; lineNumber?: number; columnNumber?: number; generatedUrl?: string; generatedLineNumber?: number; generatedColumnNumber?: number; isCollapsed?: boolean; }; declare type InspectorsConfig = { [key in InspectorType]?: boolean; }; declare type InspectorType = 'http' | 'websocket' | 'sse'; declare type NetworkActivityClientUISettings = { showUrlAsName?: boolean; }; export declare type NetworkActivityDevToolsConfig = NetworkInspectorConfig & { clientUISettings?: { /** * If true, display the entire relative URL as the request name in the UI instead of only the last path segment. * @default false */ showUrlAsName?: boolean; }; }; declare type NetworkActivityEventMap = { 'network-enable': unknown; 'network-disable': unknown; 'recording-state': { isRecording: boolean; }; 'get-client-ui-settings': unknown; 'client-ui-settings': { settings?: NetworkActivityClientUISettings; }; } & HttpEventMap & WebSocketEventMap_2 & SSEEventMap; declare type NetworkEventSource = 'builtin' | 'nitro'; declare type NetworkInspectorConfig = { /** * Specifies which network inspectors are enabled. * Set to `false` to disable monitoring for a specific type of network traffic. * @default { http: true, websocket: true, sse: true } */ inspectors?: InspectorsConfig; }; declare type Request_2 = { url: string; method: HttpMethod; headers: HttpHeaders; postData?: RequestPostData; }; declare type RequestBinaryPostData = { type: 'binary'; value: { size: number; type?: string; name?: string; }; }; declare type RequestFormDataPostData = { type: 'form-data'; value: Record; }; declare type RequestId = string; declare type RequestOverride = { status?: number; body?: string; }; declare type RequestPostData = RequestTextPostData | RequestFormDataPostData | RequestBinaryPostData | null | undefined; declare type RequestTextPostData = { type: 'text'; value: string; }; declare type ResourceType = 'XHR' | 'Fetch' | 'Other'; declare type Response_2 = { url: string; status: number; statusText: string; headers: HttpHeaders; contentType: string; size: number | null; responseTime: Timestamp; }; declare type ResponseBody = string | { kind: 'binary'; base64: string; } | { kind: 'binary-too-large'; size: number; } | null; declare type SSECloseEvent = { type: 'sse-close'; requestId: SSERequestId; timestamp: number; }; declare type SSEErrorEvent = { type: 'sse-error'; requestId: SSERequestId; timestamp: number; error: { type: 'error' | 'timeout' | 'exception'; message: string; }; }; declare type SSEEvent = SSEOpenEvent | SSEMessageEvent | SSEErrorEvent | SSECloseEvent; declare type SSEEventMap = { [K in SSEEvent['type']]: Extract; }; declare type SSEMessageEvent = { type: 'sse-message'; requestId: SSERequestId; timestamp: number; payload: { type: string; data: string; }; }; declare type SSEOpenEvent = { type: 'sse-open'; requestId: SSERequestId; timestamp: number; response: Response_2; }; declare type SSERequestId = string; declare type Timestamp = number; export declare let useNetworkActivityDevTools: typeof useNetworkActivityDevTools_2; declare const useNetworkActivityDevTools_2: (config?: NetworkActivityDevToolsConfig) => RozeniteDevToolsClient | null; declare type WebSocketCloseEvent = { type: 'websocket-close'; url: string; socketId: string; timestamp: number; code: number; reason?: string; source?: NetworkEventSource; }; declare type WebSocketConnectEvent = { type: 'websocket-connect'; url: string; socketId: string; timestamp: number; protocols: string[] | null; options: string[]; source?: NetworkEventSource; }; declare type WebSocketConnectionStatus = 'connecting' | 'open' | 'closing' | 'closed'; declare type WebSocketConnectionStatusChangedEvent = { type: 'websocket-connection-status-changed'; url: string; socketId: string; timestamp: number; status: WebSocketConnectionStatus; source?: NetworkEventSource; }; declare type WebSocketErrorEvent = { type: 'websocket-error'; url: string; socketId: string; timestamp: number; error: string; source?: NetworkEventSource; }; declare type WebSocketEvent = WebSocketConnectEvent | WebSocketOpenEvent | WebSocketCloseEvent | WebSocketMessageSentEvent | WebSocketMessageReceivedEvent | WebSocketErrorEvent | WebSocketConnectionStatusChangedEvent; declare type WebSocketEventMap_2 = { [K in WebSocketEvent['type']]: Extract; }; declare type WebSocketMessageReceivedEvent = { type: 'websocket-message-received'; url: string; socketId: string; timestamp: number; data: string; messageType: WebSocketMessageType; source?: NetworkEventSource; }; declare type WebSocketMessageSentEvent = { type: 'websocket-message-sent'; url: string; socketId: string; timestamp: number; data: string; messageType: WebSocketMessageType; source?: NetworkEventSource; }; declare type WebSocketMessageType = 'text' | 'binary'; declare type WebSocketOpenEvent = { type: 'websocket-open'; url: string; socketId: string; timestamp: number; source?: NetworkEventSource; }; export declare let withOnBootNetworkActivityRecording: typeof withOnBootNetworkActivityRecording_2; /** * Enable network activity recording during app boot, before DevTools connects. * Call this at the root of your app to capture early network requests. * * @example * ```tsx * import { withOnBootNetworkActivityRecording } from '@rozenite/network-activity-plugin'; * * // At app entry point, before any network requests * withOnBootNetworkActivityRecording(); * * function App() { * useNetworkActivityDevTools(); * // ... * } * ``` */ declare const withOnBootNetworkActivityRecording_2: (options?: BootRecordingOptions) => void; export { }