@saptools/cf-inspector 0.3.16 → 0.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -147,6 +147,10 @@ declare class CdpClient {
147
147
  onClose(listener: (err: Error) => void): () => void;
148
148
  dispose(): void;
149
149
  get isClosed(): boolean;
150
+ private handleResponse;
151
+ private createRequestTimer;
152
+ private createWaitTimeoutError;
153
+ private sendPayload;
150
154
  private markClosed;
151
155
  }
152
156
 
@@ -171,7 +175,7 @@ declare function fetchInspectorVersion(host: string, port: number, timeoutMs: nu
171
175
  * Internal coordination flag between the always-on `Debugger.paused` buffer in
172
176
  * `connectInspector` and an active `waitForPause`. When `active` is true, the
173
177
  * buffer listener skips pushing the live event so it cannot be replayed by a
174
- * subsequent `waitForPause` call. See `connectInspector` for the full rationale.
178
+ * subsequent `waitForPause` call.
175
179
  */
176
180
  interface PauseWaitGate {
177
181
  active: boolean;
@@ -202,47 +206,40 @@ interface CdpEvalResult {
202
206
  };
203
207
  };
204
208
  }
205
- declare function connectInspector(options: InspectorConnectOptions): Promise<InspectorSession>;
209
+ interface CdpProperty {
210
+ name?: unknown;
211
+ value?: {
212
+ type?: unknown;
213
+ value?: unknown;
214
+ description?: unknown;
215
+ objectId?: unknown;
216
+ };
217
+ }
206
218
  interface SetBreakpointInput extends BreakpointLocation {
207
219
  readonly remoteRoot?: RemoteRootSetting;
208
220
  readonly condition?: string;
209
221
  }
210
- declare function setBreakpoint(session: InspectorSession, input: SetBreakpointInput): Promise<BreakpointHandle>;
211
- declare function removeBreakpoint(session: InspectorSession, breakpointId: string): Promise<void>;
212
222
  interface WaitForPauseOptions {
213
223
  readonly timeoutMs: number;
214
224
  readonly breakpointIds?: readonly string[];
215
225
  readonly unmatchedPausePolicy?: "wait-for-resume" | "fail";
216
226
  readonly onUnmatchedPause?: (pause: PauseEvent) => void;
217
227
  }
228
+
229
+ declare function setBreakpoint(session: InspectorSession, input: SetBreakpointInput): Promise<BreakpointHandle>;
230
+ declare function removeBreakpoint(session: InspectorSession, breakpointId: string): Promise<void>;
231
+
218
232
  declare function waitForPause(session: InspectorSession, options: WaitForPauseOptions): Promise<PauseEvent>;
233
+
219
234
  declare function resume(session: InspectorSession): Promise<void>;
220
235
  declare function evaluateOnFrame(session: InspectorSession, callFrameId: string, expression: string): Promise<CdpEvalResult>;
221
236
  declare function evaluateGlobal(session: InspectorSession, expression: string): Promise<CdpEvalResult>;
222
237
  declare function listScripts(session: InspectorSession): readonly ScriptInfo[];
223
- /**
224
- * Pre-compile a JS expression on the inspectee using Runtime.compileScript so
225
- * syntax errors surface as a CfInspectorError("INVALID_EXPRESSION") instead of
226
- * being silently swallowed by V8 when wired into a breakpoint condition or a
227
- * logpoint. Without this guard, a typo in --condition or --expr causes the
228
- * breakpoint to silently never fire — the user would see BREAKPOINT_NOT_HIT
229
- * after the timeout and have no idea why.
230
- *
231
- * persistScript: false — we don't actually want the compiled script around;
232
- * we just want V8 to parse it and report any SyntaxError.
233
- */
234
238
  declare function validateExpression(session: InspectorSession, expression: string): Promise<void>;
235
- interface CdpProperty {
236
- name?: unknown;
237
- value?: {
238
- type?: unknown;
239
- value?: unknown;
240
- description?: unknown;
241
- objectId?: unknown;
242
- };
243
- }
244
239
  declare function getProperties(session: InspectorSession, objectId: string): Promise<readonly CdpProperty[]>;
245
240
 
241
+ declare function connectInspector(options: InspectorConnectOptions): Promise<InspectorSession>;
242
+
246
243
  interface CaptureSnapshotOptions {
247
244
  readonly captures?: readonly string[];
248
245
  readonly includeScopes?: boolean;
@@ -250,6 +247,8 @@ interface CaptureSnapshotOptions {
250
247
  }
251
248
  declare function captureSnapshot(session: InspectorSession, pause: PauseEvent, options?: CaptureSnapshotOptions): Promise<SnapshotCaptureResult>;
252
249
 
250
+ declare function buildLogpointCondition(sentinel: string, expression: string): string;
251
+
253
252
  interface LogpointEvent {
254
253
  readonly ts: string;
255
254
  readonly at: string;
@@ -257,6 +256,7 @@ interface LogpointEvent {
257
256
  readonly error?: string;
258
257
  readonly raw?: string;
259
258
  }
259
+
260
260
  interface LogpointStreamOptions {
261
261
  readonly location: BreakpointLocation;
262
262
  readonly expression: string;
@@ -264,31 +264,14 @@ interface LogpointStreamOptions {
264
264
  readonly durationMs?: number;
265
265
  readonly signal?: AbortSignal;
266
266
  readonly onEvent: (event: LogpointEvent) => void;
267
- /**
268
- * Fires once, immediately after `Debugger.setBreakpointByUrl` returns, with
269
- * the resolved breakpoint handle. Useful for surfacing warnings such as a BP
270
- * that did not bind to any script — the caller can warn the user before
271
- * the stream window elapses.
272
- */
273
267
  readonly onBreakpointSet?: (handle: BreakpointHandle) => void;
274
268
  }
275
269
  interface LogpointStreamResult {
276
270
  readonly handle: BreakpointHandle;
277
271
  readonly sentinel: string;
278
- /** Emitted log count, including parse errors that kept the sentinel. */
279
272
  readonly emitted: number;
280
273
  readonly stoppedReason: "duration" | "signal" | "transport-closed";
281
274
  }
282
- /**
283
- * Serialize a CDP-side IIFE that runs the user's expression as a "logpoint":
284
- * never pauses (always returns false), tags each emitted log with a unique
285
- * sentinel so we can distinguish our logs from app traffic, and wraps both the
286
- * user expression and JSON.stringify in try/catch so a thrown expression still
287
- * surfaces an error event instead of silently breaking the breakpoint.
288
- *
289
- * Exported for unit testing — the wire format is part of the contract.
290
- */
291
- declare function buildLogpointCondition(sentinel: string, expression: string): string;
292
275
  declare function streamLogpoint(session: InspectorSession, options: LogpointStreamOptions): Promise<LogpointStreamResult>;
293
276
 
294
277
  interface TunnelTarget {