UNPKG

browser-debugger-cli

Version:

DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port.

73 lines 2.71 kB
/** * CDP Protocol Schema Loader * * Loads and parses the Chrome DevTools Protocol schema from the bundled * devtools-protocol package. Provides utilities for domain/method lookup * and introspection. */ import type { ProtocolSchema, Domain, Command } from './types.js'; /** * Load the CDP protocol schema. * * Merges browser_protocol.json and js_protocol.json from devtools-protocol package. * The browser protocol contains domains like Network, Page, DOM, etc. * The JS protocol contains Runtime, Debugger, Console, Profiler, etc. * The merged protocol is cached after first load for performance. * * @returns CDP protocol schema with all domains, commands, and types * * @example * ```typescript * const protocol = loadProtocol(); * console.log(`Protocol version: ${protocol.version.major}.${protocol.version.minor}`); * console.log(`Domains: ${protocol.domains.length}`); // ~53 domains (47 browser + 6 JS) * ``` */ export declare function loadProtocol(): ProtocolSchema; /** * Find a domain by name (case-insensitive). * * @param domainName - Domain name to find (e.g., 'network', 'Network', 'NETWORK') * @returns Domain object or undefined if not found * * @example * ```typescript * const domain = findDomain('network'); // Case-insensitive * console.log(domain?.domain); // 'Network' * console.log(domain?.commands.length); // 39 * ``` */ export declare function findDomain(domainName: string): Domain | undefined; /** * Find a command within a domain (case-insensitive). * * @param domainName - Domain name (e.g., 'Network') * @param commandName - Command name (e.g., 'getCookies', 'GETCOOKIES') * @returns Command object or undefined if not found * * @example * ```typescript * const cmd = findCommand('Network', 'getcookies'); // Case-insensitive * console.log(cmd?.name); // 'getCookies' * console.log(cmd?.parameters); // [...] * ``` */ export declare function findCommand(domainName: string, commandName: string): Command | undefined; /** * Normalize a CDP method name to proper casing. * * Converts user input (any case) to CDP's actual method name. * * @param input - Method name in any format (e.g., 'network.getcookies', 'Runtime.Evaluate') * @returns Normalized method name (e.g., 'Network.getCookies') or undefined if not found * * @example * ```typescript * normalizeMethod('network.getcookies') // 'Network.getCookies' * normalizeMethod('runtime.evaluate') // 'Runtime.evaluate' * normalizeMethod('NETWORK.GETCOOKIES') // 'Network.getCookies' * normalizeMethod('invalid.method') // undefined * ``` */ export declare function normalizeMethod(input: string): string | undefined; //# sourceMappingURL=protocol.d.ts.map