AK-21/Graphite-Industrial-Intelligence
0
1/**2 * The `node:inspector` module provides an API for interacting with the V83 * inspector.4 * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/inspector.js)5 */6declare module "inspector" {7 import EventEmitter = require("node:events");8 /**9 * The `inspector.Session` is used for dispatching messages to the V8 inspector10 * back-end and receiving message responses and notifications.11 */12 class Session extends EventEmitter {13 /**14 * Create a new instance of the inspector.Session class.15 * The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.16 */17 constructor();18 /**19 * Connects a session to the inspector back-end.20 */21 connect(): void;22 /**23 * Connects a session to the inspector back-end.24 * An exception will be thrown if this API was not called on a Worker thread.25 * @since v12.11.026 */27 connectToMainThread(): void;28 /**29 * Immediately close the session. All pending message callbacks will be called with an error.30 * `session.connect()` will need to be called to be able to send messages again.31 * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.32 */33 disconnect(): void;34 }35 /**36 * Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has37 * started.38 *39 * If wait is `true`, will block until a client has connected to the inspect port40 * and flow control has been passed to the debugger client.41 *42 * See the [security warning](https://nodejs.org/docs/latest-v24.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure)43 * regarding the `host` parameter usage.44 * @param port Port to listen on for inspector connections. Defaults to what was specified on the CLI.45 * @param host Host to listen on for inspector connections. Defaults to what was specified on the CLI.46 * @param wait Block until a client has connected. Defaults to what was specified on the CLI.47 * @returns Disposable that calls `inspector.close()`.48 */49 function open(port?: number, host?: string, wait?: boolean): Disposable;50 /**51 * Deactivate the inspector. Blocks until there are no active connections.52 */53 function close(): void;54 /**55 * Return the URL of the active inspector, or `undefined` if there is none.56 *57 * ```console58 * $ node --inspect -p 'inspector.url()'59 * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c3460 * For help, see: https://nodejs.org/en/docs/inspector61 * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c3462 *63 * $ node --inspect=localhost:3000 -p 'inspector.url()'64 * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a65 * For help, see: https://nodejs.org/en/docs/inspector66 * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a67 *68 * $ node -p 'inspector.url()'69 * undefined70 * ```71 */72 function url(): string | undefined;73 /**74 * Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command.75 *76 * An exception will be thrown if there is no active inspector.77 * @since v12.7.078 */79 function waitForDebugger(): void;80 // These methods are exposed by the V8 inspector console API (inspector/v8-console.h).81 // The method signatures differ from those of the Node.js console, and are deliberately82 // typed permissively.83 interface InspectorConsole {84 debug(...data: any[]): void;85 error(...data: any[]): void;86 info(...data: any[]): void;87 log(...data: any[]): void;88 warn(...data: any[]): void;89 dir(...data: any[]): void;90 dirxml(...data: any[]): void;91 table(...data: any[]): void;92 trace(...data: any[]): void;93 group(...data: any[]): void;94 groupCollapsed(...data: any[]): void;95 groupEnd(...data: any[]): void;96 clear(...data: any[]): void;97 count(label?: any): void;98 countReset(label?: any): void;99 assert(value?: any, ...data: any[]): void;100 profile(label?: any): void;101 profileEnd(label?: any): void;102 time(label?: any): void;103 timeLog(label?: any): void;104 timeStamp(label?: any): void;105 }106 /**107 * An object to send messages to the remote inspector console.108 * @since v11.0.0109 */110 const console: InspectorConsole;111 // DevTools protocol event broadcast methods112 namespace Network {113 /**114 * This feature is only available with the `--experimental-network-inspection` flag enabled.115 *116 * Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that117 * the application is about to send an HTTP request.118 * @since v22.6.0119 */120 function requestWillBeSent(params: RequestWillBeSentEventDataType): void;121 /**122 * This feature is only available with the `--experimental-network-inspection` flag enabled.123 *124 * Broadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if125 * `Network.streamResourceContent` command was not invoked for the given request yet.126 *127 * Also enables `Network.getResponseBody` command to retrieve the response data.128 * @since v24.2.0129 */130 function dataReceived(params: DataReceivedEventDataType): void;131 /**132 * This feature is only available with the `--experimental-network-inspection` flag enabled.133 *134 * Enables `Network.getRequestPostData` command to retrieve the request data.135 * @since v24.3.0136 */137 function dataSent(params: unknown): void;138 /**139 * This feature is only available with the `--experimental-network-inspection` flag enabled.140 *141 * Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that142 * HTTP response is available.143 * @since v22.6.0144 */145 function responseReceived(params: ResponseReceivedEventDataType): void;146 /**147 * This feature is only available with the `--experimental-network-inspection` flag enabled.148 *149 * Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that150 * HTTP request has finished loading.151 * @since v22.6.0152 */153 function loadingFinished(params: LoadingFinishedEventDataType): void;154 /**155 * This feature is only available with the `--experimental-network-inspection` flag enabled.156 *157 * Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that158 * HTTP request has failed to load.159 * @since v22.7.0160 */161 function loadingFailed(params: LoadingFailedEventDataType): void;162 /**163 * This feature is only available with the `--experimental-network-inspection` flag enabled.164 *165 * Broadcasts the `Network.webSocketCreated` event to connected frontends. This event indicates that166 * a WebSocket connection has been initiated.167 * @since v24.7.0168 */169 function webSocketCreated(params: WebSocketCreatedEventDataType): void;170 /**171 * This feature is only available with the `--experimental-network-inspection` flag enabled.172 *173 * Broadcasts the `Network.webSocketHandshakeResponseReceived` event to connected frontends.174 * This event indicates that the WebSocket handshake response has been received.175 * @since v24.7.0176 */177 function webSocketHandshakeResponseReceived(params: WebSocketHandshakeResponseReceivedEventDataType): void;178 /**179 * This feature is only available with the `--experimental-network-inspection` flag enabled.180 *181 * Broadcasts the `Network.webSocketClosed` event to connected frontends.182 * This event indicates that a WebSocket connection has been closed.183 * @since v24.7.0184 */185 function webSocketClosed(params: WebSocketClosedEventDataType): void;186 }187 namespace NetworkResources {188 /**189 * This feature is only available with the `--experimental-inspector-network-resource` flag enabled.190 *191 * The inspector.NetworkResources.put method is used to provide a response for a loadNetworkResource192 * request issued via the Chrome DevTools Protocol (CDP).193 * This is typically triggered when a source map is specified by URL, and a DevTools frontend—such as194 * Chrome—requests the resource to retrieve the source map.195 *196 * This method allows developers to predefine the resource content to be served in response to such CDP requests.197 *198 * ```js199 * const inspector = require('node:inspector');200 * // By preemptively calling put to register the resource, a source map can be resolved when201 * // a loadNetworkResource request is made from the frontend.202 * async function setNetworkResources() {203 * const mapUrl = 'http://localhost:3000/dist/app.js.map';204 * const tsUrl = 'http://localhost:3000/src/app.ts';205 * const distAppJsMap = await fetch(mapUrl).then((res) => res.text());206 * const srcAppTs = await fetch(tsUrl).then((res) => res.text());207 * inspector.NetworkResources.put(mapUrl, distAppJsMap);208 * inspector.NetworkResources.put(tsUrl, srcAppTs);209 * };210 * setNetworkResources().then(() => {211 * require('./dist/app');212 * });213 * ```214 *215 * For more details, see the official CDP documentation: [Network.loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource)216 * @since v24.5.0217 * @experimental218 */219 function put(url: string, data: string): void;220 }221}222 223/**224 * The `node:inspector` module provides an API for interacting with the V8225 * inspector.226 */227declare module "node:inspector" {228 export * from "inspector";229}230 231/**232 * The `node:inspector/promises` module provides an API for interacting with the V8233 * inspector.234 * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/inspector/promises.js)235 * @since v19.0.0236 */237declare module "inspector/promises" {238 import EventEmitter = require("node:events");239 export { close, console, NetworkResources, open, url, waitForDebugger } from "inspector";240 /**241 * The `inspector.Session` is used for dispatching messages to the V8 inspector242 * back-end and receiving message responses and notifications.243 * @since v19.0.0244 */245 export class Session extends EventEmitter {246 /**247 * Create a new instance of the inspector.Session class.248 * The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.249 */250 constructor();251 /**252 * Connects a session to the inspector back-end.253 */254 connect(): void;255 /**256 * Connects a session to the inspector back-end.257 * An exception will be thrown if this API was not called on a Worker thread.258 * @since v12.11.0259 */260 connectToMainThread(): void;261 /**262 * Immediately close the session. All pending message callbacks will be called with an error.263 * `session.connect()` will need to be called to be able to send messages again.264 * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.265 */266 disconnect(): void;267 }268}269 270/**271 * The `node:inspector/promises` module provides an API for interacting with the V8272 * inspector.273 * @since v19.0.0274 */275declare module "node:inspector/promises" {276 export * from "inspector/promises";277}278 