Skip to main content

DebugClient

@webda/debug


Class: DebugClient

Defined in: debug/src/tui/client.ts:25

HTTP + WebSocket client for the debug server API.

Connects to the debug server started by webda debug and provides typed methods for each introspection endpoint, plus a reconnecting WebSocket subscription for live request events.

Constructors​

Constructor​

new DebugClient(baseUrl?): DebugClient

Defined in: debug/src/tui/client.ts:48

Creates a new DebugClient.

Parameters​

baseUrl?​

string = "http://localhost:18181"

Base URL of the debug server, e.g. "http://localhost:18181"

Returns​

DebugClient

Accessors​

connected​

Get Signature​

get connected(): boolean

Defined in: debug/src/tui/client.ts:56

Whether the WebSocket is currently connected.

Returns​

boolean

true if the WebSocket connection is open

Methods​

connectWebSocket()​

connectWebSocket(): void

Defined in: debug/src/tui/client.ts:192

Connect to the debug server WebSocket and begin receiving events. Automatically reconnects with exponential backoff on disconnect.

Returns​

void


disconnect()​

disconnect(): void

Defined in: debug/src/tui/client.ts:250

Disconnect the WebSocket and stop reconnecting.

Returns​

void


getAppInfo()​

getAppInfo(): Promise<any>

Defined in: debug/src/tui/client.ts:163

Fetch application info (package name, version, working directory).

Returns​

Promise<any>

project information record


getConfig()​

getConfig(): Promise<Record<string, any>>

Defined in: debug/src/tui/client.ts:120

Fetch the resolved application configuration.

Returns​

Promise<Record<string, any>>

resolved configuration record


getLogs()​

getLogs(): Promise<any[]>

Defined in: debug/src/tui/client.ts:155

Fetch recent application log entries.

Returns​

Promise<any[]>

array of log entries


getModel()​

getModel(id): Promise<any>

Defined in: debug/src/tui/client.ts:88

Fetch a single model by identifier.

Parameters​

id​

string

Fully-qualified model identifier

Returns​

Promise<any>

model metadata object


getModels()​

getModels(): Promise<any[]>

Defined in: debug/src/tui/client.ts:78

Fetch all registered models.

Returns​

Promise<any[]>

array of model metadata objects


getOpenAPI()​

getOpenAPI(): Promise<Record<string, any>>

Defined in: debug/src/tui/client.ts:128

Fetch the OpenAPI specification.

Returns​

Promise<Record<string, any>>

OpenAPI 3.0.3 document


getOperations()​

getOperations(): Promise<any[]>

Defined in: debug/src/tui/client.ts:104

Fetch all registered operations.

Returns​

Promise<any[]>

array of operation info objects


getRequestDetail()​

getRequestDetail(id): Promise<any>

Defined in: debug/src/tui/client.ts:147

Fetch the full detail of a single request by id, including captured headers, bodies, and any error.

Parameters​

id​

string

The request id (as returned in the summary list).

Returns​

Promise<any>

The detailed request entry.


getRequests()​

getRequests(): Promise<any[]>

Defined in: debug/src/tui/client.ts:136

Fetch recent request log entries (summary fields only — no headers/bodies).

Returns​

Promise<any[]>

array of request log entry summaries


getRoutes()​

getRoutes(): Promise<any[]>

Defined in: debug/src/tui/client.ts:112

Fetch all registered routes.

Returns​

Promise<any[]>

array of route info objects


getServices()​

getServices(): Promise<any[]>

Defined in: debug/src/tui/client.ts:96

Fetch all registered services.

Returns​

Promise<any[]>

array of service info objects


onEvent()​

onEvent(callback): () => void

Defined in: debug/src/tui/client.ts:183

Subscribe to WebSocket events.

Parameters​

callback​

WsEventCallback

Called for each event received

Returns​

Unsubscribe function

() => void


searchLogs()​

searchLogs(query): Promise<any[]>

Defined in: debug/src/tui/client.ts:173

Search application log entries by query string.

Parameters​

query​

string

search text to filter logs

Returns​

Promise<any[]>

array of matching log entries