import type { SdapiBreakpoint, SdapiEvalResult, SdapiFault, SdapiObjectMembers, SdapiScriptThread, BreakpointInput } from './types.js'; /** * Error thrown when the SDAPI returns a fault response. */ export declare class SdapiError extends Error { readonly fault: SdapiFault; readonly status: number; constructor(fault: SdapiFault, status: number); } export interface SdapiClientConfig { hostname: string; username: string; password: string; clientId?: string; } /** * Creates a new SDAPI client. */ export declare function createSdapiClient(config: SdapiClientConfig): SdapiClient; export declare class SdapiClient { private readonly baseUrl; private readonly headers; private readonly logger; /** * Cookies (name -> value) returned by the SDAPI via Set-Cookie, replayed on * subsequent requests. The debugger establishes a session (e.g. `dwsid`) on * the first request that must be honored for the lifetime of this client. * * Replaying these cookies is required for server affinity: in multi-app * server instances/environments the `dwsid` pins the session to the app * server that holds the debugger state, so without it subsequent requests may * be routed to a different app server with no knowledge of the session. */ private readonly cookies; constructor(config: SdapiClientConfig); createClient(): Promise; deleteClient(): Promise; /** * Retrieves all currently set breakpoints for the debugger session. * @returns Promise resolving to array of breakpoints, or empty array if none are set. */ getBreakpoints(): Promise; /** * Sets or replaces breakpoints for the debugger. * @param breakpoints Array of breakpoint definitions to set. * @returns Promise resolving to array of confirmed breakpoints from the server. */ setBreakpoints(breakpoints: BreakpointInput[]): Promise; deleteBreakpoints(): Promise; deleteBreakpoint(id: number): Promise; /** * Gets all active script threads. * @returns Promise resolving to array of script threads, or empty array if none are active. */ getThreads(): Promise; /** * Retrieves a specific thread by ID. * @param threadId The thread identifier. * @returns Promise resolving to the thread object with its current state. */ getThread(threadId: number): Promise; resetThreads(): Promise; resume(threadId: number): Promise; stepOver(threadId: number): Promise; stepInto(threadId: number): Promise; stepOut(threadId: number): Promise; stopThread(threadId: number): Promise; getVariables(threadId: number, frameIndex: number): Promise; getMembers(threadId: number, frameIndex: number, objectPath?: string, start?: number, count?: number): Promise; /** * Evaluates a JavaScript expression in a frame context. * @param threadId The thread ID of the halted thread. * @param frameIndex The stack frame index (0 = topmost frame). * @param expr The JavaScript expression to evaluate. * @returns Promise resolving to the evaluation result. */ evaluate(threadId: number, frameIndex: number, expr: string): Promise; private request; private throwSdapiError; /** * Returns the value of a stored session cookie, or `undefined` if it has not * been set yet. The session cookie (`dwsid`) pins requests to the app server * holding the debugger session — callers may need it to route external * requests (e.g. a storefront browser) to the same app server. */ getCookie(name: string): string | undefined; /** * Builds the `Cookie` request header from stored session cookies, or an empty * object if none have been set yet. */ private cookieHeader; /** * Parses `Set-Cookie` headers from a response and stores them for replay on * subsequent requests (only the name=value pair is retained, attributes are * ignored). Uses `Headers.getSetCookie()` so multiple cookies are not * collapsed into a single comma-joined value. */ private storeCookies; }