@not-true/devtools
Version:
Remote debugging and development tools client library for React Native applications
92 lines (78 loc) • 2.19 kB
text/typescript
// Configuration interfaces
export interface RemoteDevToolsConfig {
serverUrl: string; // WebSocket server URL
name: string; // Client display name
version: string; // Application version
maxQueueSize?: number; // Max queued items (default: 1000)
maxReconnectAttempts?: number; // Max reconnection attempts (default: 5)
reconnectDelay?: number; // Reconnect delay in ms (default: 1000)
// Feature toggles
enableConsoleLogging?: boolean; // Default: true
enableStateSync?: boolean; // Default: true
enableREPL?: boolean; // Default: true
enableRemoteConfig?: boolean; // Default: true
// State sync settings
stateUpdateThrottle?: number; // ms, default: 500
// Device and client info
deviceInfo?: DeviceInfo;
clientInfo?: ClientInfo;
}
export interface DeviceInfo {
model?: string;
os?: string;
osVersion?: string;
screenSize?: { width: number; height: number };
[key: string]: any;
}
export interface ClientInfo {
userId?: string;
deviceId?: string;
buildNumber?: string;
[key: string]: any;
}
// Log entry interface
export interface LogEntry {
level: "log" | "info" | "warn" | "error";
args: any[];
timestamp: number;
message?: string;
}
// State sync interfaces
export interface StateUpdate {
type: "redux" | "context" | "async-storage" | "custom";
data: any;
statePath?: string;
}
// REPL interfaces
export interface REPLCommand {
commandId: string;
command: string;
}
export interface REPLResult {
commandId: string;
result: any;
error?: string;
executionTime: number;
}
// Remote config interfaces
export interface RemoteConfig {
configId: string;
config: Record<string, any>;
}
// Event handlers
export interface DevToolsEventHandlers {
onConnect?: () => void;
onDisconnect?: () => void;
onReconnect?: (attemptNumber: number) => void;
onReconnectError?: (error: Error) => void;
onRemoteConfig?: (config: RemoteConfig) => void;
onREPLCommand?: (command: REPLCommand) => Promise<any>;
onError?: (error: Error) => void;
}
// Internal queue item
export interface QueueItem {
type: "log" | "state" | "repl-result";
data: any;
timestamp: number;
}
// Socket.IO v2.5.0 compatibility - using any type for maximum compatibility