@saptools/cf-inspector 0.3.19 → 0.4.1

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
@@ -1,6 +1,6 @@
1
1
  import { DebuggerHandle } from '@saptools/cf-debugger';
2
2
 
3
- type CfInspectorErrorCode = "INVALID_ARGUMENT" | "INVALID_BREAKPOINT" | "INVALID_REMOTE_ROOT" | "INVALID_EXPRESSION" | "BREAKPOINT_DID_NOT_BIND" | "INSPECTOR_DISCOVERY_FAILED" | "INSPECTOR_CONNECTION_FAILED" | "CDP_REQUEST_FAILED" | "BREAKPOINT_NOT_HIT" | "UNRELATED_PAUSE" | "UNRELATED_PAUSE_TIMEOUT" | "EVALUATION_FAILED" | "MISSING_TARGET" | "ABORTED";
3
+ type CfInspectorErrorCode = "INVALID_ARGUMENT" | "INVALID_BREAKPOINT" | "INVALID_REMOTE_ROOT" | "INVALID_EXPRESSION" | "INVALID_HIT_COUNT" | "INVALID_PAUSE_TYPE" | "BREAKPOINT_DID_NOT_BIND" | "INSPECTOR_DISCOVERY_FAILED" | "INSPECTOR_CONNECTION_FAILED" | "CDP_REQUEST_FAILED" | "BREAKPOINT_NOT_HIT" | "UNRELATED_PAUSE" | "UNRELATED_PAUSE_TIMEOUT" | "EVALUATION_FAILED" | "MISSING_TARGET" | "ABORTED";
4
4
  declare class CfInspectorError extends Error {
5
5
  readonly code: CfInspectorErrorCode;
6
6
  readonly detail?: string;
@@ -55,6 +55,7 @@ interface PauseEvent {
55
55
  readonly hitBreakpoints: readonly string[];
56
56
  readonly callFrames: readonly CallFrameInfo[];
57
57
  readonly receivedAtMs?: number;
58
+ readonly data?: unknown;
58
59
  }
59
60
  interface VariableSnapshot {
60
61
  readonly name: string;
@@ -72,6 +73,7 @@ interface FrameSnapshot {
72
73
  readonly line: number;
73
74
  readonly column: number;
74
75
  readonly scopes?: readonly ScopeSnapshot[];
76
+ readonly captures?: readonly CapturedExpression[];
75
77
  }
76
78
  interface CapturedExpression {
77
79
  readonly expression: string;
@@ -79,16 +81,35 @@ interface CapturedExpression {
79
81
  readonly type?: string;
80
82
  readonly error?: string;
81
83
  }
84
+ interface ExceptionSnapshot {
85
+ readonly value?: string;
86
+ readonly type?: string;
87
+ readonly description?: string;
88
+ readonly error?: string;
89
+ }
82
90
  interface SnapshotCaptureResult {
83
91
  readonly reason: string;
84
92
  readonly hitBreakpoints: readonly string[];
85
93
  readonly capturedAt: string;
86
94
  readonly topFrame?: FrameSnapshot;
87
95
  readonly captures: readonly CapturedExpression[];
96
+ readonly stack?: readonly FrameSnapshot[];
97
+ readonly exception?: ExceptionSnapshot;
88
98
  }
89
99
  interface SnapshotResult extends SnapshotCaptureResult {
90
100
  readonly pausedDurationMs: number | null;
91
101
  }
102
+ interface WatchEvent {
103
+ readonly ts: string;
104
+ readonly at: string;
105
+ readonly hit: number;
106
+ readonly reason: string;
107
+ readonly hitBreakpoints: readonly string[];
108
+ readonly topFrame?: FrameSnapshot;
109
+ readonly captures: readonly CapturedExpression[];
110
+ readonly stack?: readonly FrameSnapshot[];
111
+ readonly exception?: ExceptionSnapshot;
112
+ }
92
113
  interface ScriptInfo {
93
114
  readonly scriptId: string;
94
115
  readonly url: string;
@@ -119,11 +140,15 @@ interface CdpTransport {
119
140
  on<E extends keyof CdpTransportEventMap>(event: E, listener: CdpTransportEventMap[E]): void;
120
141
  off<E extends keyof CdpTransportEventMap>(event: E, listener: CdpTransportEventMap[E]): void;
121
142
  }
122
- type CdpTransportFactory = (url: string) => Promise<CdpTransport>;
143
+ interface CdpTransportFactoryOptions {
144
+ readonly connectTimeoutMs?: number;
145
+ }
146
+ type CdpTransportFactory = (url: string, options?: CdpTransportFactoryOptions) => Promise<CdpTransport>;
123
147
  interface CdpClientOptions {
124
148
  readonly url: string;
125
149
  readonly transportFactory?: CdpTransportFactory;
126
150
  readonly requestTimeoutMs?: number;
151
+ readonly connectTimeoutMs?: number;
127
152
  }
128
153
  declare class CdpClient {
129
154
  private readonly transport;
@@ -134,6 +159,7 @@ declare class CdpClient {
134
159
  private closed;
135
160
  private closeReason;
136
161
  private readonly handleMessage;
162
+ private safeEmit;
137
163
  private readonly handleClose;
138
164
  private readonly handleError;
139
165
  private constructor();
@@ -218,20 +244,25 @@ interface CdpProperty {
218
244
  interface SetBreakpointInput extends BreakpointLocation {
219
245
  readonly remoteRoot?: RemoteRootSetting;
220
246
  readonly condition?: string;
247
+ readonly hitCount?: number;
221
248
  }
222
249
  interface WaitForPauseOptions {
223
250
  readonly timeoutMs: number;
224
251
  readonly breakpointIds?: readonly string[];
252
+ readonly pauseReasons?: readonly string[];
225
253
  readonly unmatchedPausePolicy?: "wait-for-resume" | "fail";
226
254
  readonly onUnmatchedPause?: (pause: PauseEvent) => void;
227
255
  }
228
256
 
257
+ declare function buildHitCountedCondition(hitCount: number, counterKey: string, userCondition: string | undefined): string;
229
258
  declare function setBreakpoint(session: InspectorSession, input: SetBreakpointInput): Promise<BreakpointHandle>;
230
259
  declare function removeBreakpoint(session: InspectorSession, breakpointId: string): Promise<void>;
231
260
 
232
261
  declare function waitForPause(session: InspectorSession, options: WaitForPauseOptions): Promise<PauseEvent>;
233
262
 
263
+ type PauseOnExceptionsState = "none" | "uncaught" | "caught" | "all";
234
264
  declare function resume(session: InspectorSession): Promise<void>;
265
+ declare function setPauseOnExceptions(session: InspectorSession, state: PauseOnExceptionsState): Promise<void>;
235
266
  declare function evaluateOnFrame(session: InspectorSession, callFrameId: string, expression: string): Promise<CdpEvalResult>;
236
267
  declare function evaluateGlobal(session: InspectorSession, expression: string): Promise<CdpEvalResult>;
237
268
  declare function listScripts(session: InspectorSession): readonly ScriptInfo[];
@@ -244,10 +275,26 @@ interface CaptureSnapshotOptions {
244
275
  readonly captures?: readonly string[];
245
276
  readonly includeScopes?: boolean;
246
277
  readonly maxValueLength?: number;
278
+ readonly stackDepth?: number;
279
+ readonly stackCaptures?: readonly string[];
247
280
  }
248
281
  declare function captureSnapshot(session: InspectorSession, pause: PauseEvent, options?: CaptureSnapshotOptions): Promise<SnapshotCaptureResult>;
249
282
 
250
- declare function buildLogpointCondition(sentinel: string, expression: string): string;
283
+ declare function captureException(session: InspectorSession, pause: PauseEvent, maxValueLength: number): Promise<ExceptionSnapshot | undefined>;
284
+
285
+ interface WalkStackOptions {
286
+ readonly stackDepth: number;
287
+ readonly stackCaptures: readonly string[];
288
+ readonly maxValueLength: number;
289
+ }
290
+ declare function walkStack(session: InspectorSession, callFrames: readonly CallFrameInfo[], options: WalkStackOptions): Promise<readonly FrameSnapshot[]>;
291
+
292
+ interface LogpointConditionOptions {
293
+ readonly predicate?: string;
294
+ readonly hitCount?: number;
295
+ readonly counterKey?: string;
296
+ }
297
+ declare function buildLogpointCondition(sentinel: string, expression: string, options?: LogpointConditionOptions): string;
251
298
 
252
299
  interface LogpointEvent {
253
300
  readonly ts: string;
@@ -257,11 +304,15 @@ interface LogpointEvent {
257
304
  readonly raw?: string;
258
305
  }
259
306
 
307
+ type LogpointStopReason = "duration" | "signal" | "transport-closed" | "max-events";
260
308
  interface LogpointStreamOptions {
261
309
  readonly location: BreakpointLocation;
262
310
  readonly expression: string;
263
311
  readonly remoteRoot?: RemoteRootSetting;
264
312
  readonly durationMs?: number;
313
+ readonly maxEvents?: number;
314
+ readonly hitCount?: number;
315
+ readonly condition?: string;
265
316
  readonly signal?: AbortSignal;
266
317
  readonly onEvent: (event: LogpointEvent) => void;
267
318
  readonly onBreakpointSet?: (handle: BreakpointHandle) => void;
@@ -270,7 +321,7 @@ interface LogpointStreamResult {
270
321
  readonly handle: BreakpointHandle;
271
322
  readonly sentinel: string;
272
323
  readonly emitted: number;
273
- readonly stoppedReason: "duration" | "signal" | "transport-closed";
324
+ readonly stoppedReason: LogpointStopReason;
274
325
  }
275
326
  declare function streamLogpoint(session: InspectorSession, options: LogpointStreamOptions): Promise<LogpointStreamResult>;
276
327
 
@@ -291,4 +342,4 @@ interface OpenedTunnel {
291
342
  }
292
343
  declare function openCfTunnel(target: TunnelTarget): Promise<OpenedTunnel>;
293
344
 
294
- export { type BreakpointHandle, type BreakpointLocation, type CallFrameInfo, type CaptureSnapshotOptions, type CapturedExpression, CfInspectorError, type CfInspectorErrorCode, type DebuggerState, type FrameSnapshot, type InspectorConnectOptions, type InspectorSession, type InspectorTarget, type LogpointEvent, type LogpointStreamOptions, type LogpointStreamResult, type OpenedTunnel, type PauseEvent, type RemoteRootSetting, type ResolvedLocation, type ScopeInfo, type ScopeSnapshot, type ScriptInfo, type SetBreakpointInput, type SnapshotCaptureResult, type SnapshotResult, type TunnelTarget, type VariableSnapshot, type WaitForPauseOptions, buildBreakpointUrlRegex, buildLogpointCondition, captureSnapshot, connectInspector, discoverInspectorTargets, evaluateGlobal, evaluateOnFrame, fetchInspectorVersion, getProperties, listScripts, openCfTunnel, parseBreakpointSpec, parseRemoteRoot, removeBreakpoint, resume, setBreakpoint, streamLogpoint, validateExpression, waitForPause };
345
+ export { type BreakpointHandle, type BreakpointLocation, type CallFrameInfo, type CaptureSnapshotOptions, type CapturedExpression, CfInspectorError, type CfInspectorErrorCode, type DebuggerState, type ExceptionSnapshot, type FrameSnapshot, type InspectorConnectOptions, type InspectorSession, type InspectorTarget, type LogpointConditionOptions, type LogpointEvent, type LogpointStopReason, type LogpointStreamOptions, type LogpointStreamResult, type OpenedTunnel, type PauseEvent, type PauseOnExceptionsState, type RemoteRootSetting, type ResolvedLocation, type ScopeInfo, type ScopeSnapshot, type ScriptInfo, type SetBreakpointInput, type SnapshotCaptureResult, type SnapshotResult, type TunnelTarget, type VariableSnapshot, type WaitForPauseOptions, type WalkStackOptions, type WatchEvent, buildBreakpointUrlRegex, buildHitCountedCondition, buildLogpointCondition, captureException, captureSnapshot, connectInspector, discoverInspectorTargets, evaluateGlobal, evaluateOnFrame, fetchInspectorVersion, getProperties, listScripts, openCfTunnel, parseBreakpointSpec, parseRemoteRoot, removeBreakpoint, resume, setBreakpoint, setPauseOnExceptions, streamLogpoint, validateExpression, waitForPause, walkStack };