@saptools/cf-inspector 0.4.12 → 0.6.0

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, SessionStatus } from '@saptools/cf-debugger';
2
2
 
3
- type CfInspectorErrorCode = "INVALID_ARGUMENT" | "INVALID_BREAKPOINT" | "INVALID_REMOTE_ROOT" | "INVALID_EXPRESSION" | "SETUP_EVAL_FAILED" | "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";
3
+ type CfInspectorErrorCode = "INVALID_ARGUMENT" | "INVALID_BREAKPOINT" | "INVALID_REMOTE_ROOT" | "INVALID_EXPRESSION" | "MUTATION_NOT_ALLOWED" | "SETUP_EVAL_FAILED" | "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;
@@ -30,24 +30,80 @@ interface BreakpointHandle {
30
30
  readonly urlRegex: string;
31
31
  readonly resolvedLocations: readonly ResolvedLocation[];
32
32
  }
33
- interface ResolvedLocation {
33
+ interface ScriptLocation {
34
34
  readonly scriptId: string;
35
- readonly url?: string;
36
35
  readonly lineNumber: number;
37
36
  readonly columnNumber?: number;
38
37
  }
38
+ interface BreakLocation extends ScriptLocation {
39
+ readonly type?: string;
40
+ }
41
+ interface ResolvedLocation extends ScriptLocation {
42
+ readonly url?: string;
43
+ }
44
+ interface GetPossibleBreakpointsOptions {
45
+ readonly start: ScriptLocation;
46
+ readonly end?: ScriptLocation;
47
+ readonly restrictToFunction?: boolean;
48
+ }
49
+ interface SetBreakpointAtLocationInput {
50
+ readonly location: ScriptLocation;
51
+ readonly condition?: string;
52
+ }
53
+ interface ExactBreakpointHandle {
54
+ readonly breakpointId: string;
55
+ readonly requestedLocation: ScriptLocation;
56
+ readonly actualLocation: ScriptLocation;
57
+ }
58
+ interface RemoteObjectInfo {
59
+ readonly type: string;
60
+ readonly subtype?: string;
61
+ readonly className?: string;
62
+ readonly completeness?: "truncated" | "unavailable";
63
+ readonly value?: unknown;
64
+ readonly unserializableValue?: string;
65
+ readonly description?: string;
66
+ readonly deepSerializedValue?: unknown;
67
+ readonly objectId?: string;
68
+ readonly preview?: unknown;
69
+ readonly customPreview?: unknown;
70
+ }
71
+ interface StackTraceIdInfo {
72
+ readonly id: string;
73
+ readonly debuggerId?: string;
74
+ }
75
+ interface StackTraceFrameInfo {
76
+ readonly functionName: string;
77
+ readonly scriptId: string;
78
+ readonly url: string;
79
+ readonly lineNumber: number;
80
+ readonly columnNumber: number;
81
+ }
82
+ interface StackTraceInfo {
83
+ readonly description?: string;
84
+ readonly callFrames: readonly StackTraceFrameInfo[];
85
+ readonly parent?: StackTraceInfo;
86
+ readonly parentId?: StackTraceIdInfo;
87
+ }
39
88
  interface CallFrameInfo {
40
89
  readonly callFrameId: string;
41
90
  readonly functionName: string;
91
+ readonly scriptId?: string;
92
+ readonly functionLocation?: ScriptLocation;
42
93
  readonly url?: string;
43
94
  readonly lineNumber: number;
44
95
  readonly columnNumber: number;
45
96
  readonly scopeChain: readonly ScopeInfo[];
97
+ readonly thisObject?: RemoteObjectInfo;
98
+ readonly returnValue?: RemoteObjectInfo;
46
99
  }
47
100
  interface ScopeInfo {
48
101
  readonly type: string;
49
102
  readonly objectId?: string;
103
+ readonly object?: RemoteObjectInfo;
50
104
  readonly name?: string;
105
+ readonly startLocation?: ScriptLocation;
106
+ readonly endLocation?: ScriptLocation;
51
107
  }
52
108
  interface PauseEvent {
53
109
  readonly reason: string;
@@ -55,16 +111,24 @@ interface PauseEvent {
55
111
  readonly callFrames: readonly CallFrameInfo[];
56
112
  readonly receivedAtMs?: number;
57
113
  readonly data?: unknown;
114
+ readonly asyncStackTrace?: StackTraceInfo;
115
+ readonly asyncStackTraceId?: StackTraceIdInfo;
116
+ readonly asyncCallStackTraceId?: StackTraceIdInfo;
58
117
  }
59
118
  interface VariableSnapshot {
60
119
  readonly name: string;
61
120
  readonly value: string;
62
121
  readonly type?: string;
63
122
  readonly children?: readonly VariableSnapshot[];
123
+ readonly truncated?: true;
124
+ readonly originalLength?: number;
125
+ readonly omittedCount?: number;
64
126
  }
65
127
  interface ScopeSnapshot {
66
128
  readonly type: string;
67
129
  readonly variables: readonly VariableSnapshot[];
130
+ readonly truncated?: true;
131
+ readonly omittedCount?: number;
68
132
  }
69
133
  interface FrameSnapshot {
70
134
  readonly functionName: string;
@@ -73,18 +137,30 @@ interface FrameSnapshot {
73
137
  readonly column: number;
74
138
  readonly scopes?: readonly ScopeSnapshot[];
75
139
  readonly captures?: readonly CapturedExpression[];
140
+ readonly truncated?: true;
141
+ readonly omittedCount?: number;
76
142
  }
77
143
  interface CapturedExpression {
78
144
  readonly expression: string;
79
145
  readonly value?: string;
80
146
  readonly type?: string;
81
147
  readonly error?: string;
148
+ readonly mutationRisk?: boolean;
149
+ readonly blocked?: true;
150
+ readonly truncated?: true;
151
+ readonly originalLength?: number;
152
+ readonly omittedCount?: number;
82
153
  }
83
154
  interface ExceptionSnapshot {
84
155
  readonly value?: string;
85
156
  readonly type?: string;
86
157
  readonly description?: string;
87
158
  readonly error?: string;
159
+ readonly truncated?: true;
160
+ readonly originalLength?: number;
161
+ readonly valueOriginalLength?: number;
162
+ readonly descriptionOriginalLength?: number;
163
+ readonly omittedCount?: number;
88
164
  }
89
165
  interface SnapshotCaptureResult {
90
166
  readonly reason: string;
@@ -112,12 +188,26 @@ interface WatchEvent {
112
188
  interface ScriptInfo {
113
189
  readonly scriptId: string;
114
190
  readonly url: string;
191
+ readonly startLine?: number;
192
+ readonly startColumn?: number;
193
+ readonly endLine?: number;
194
+ readonly endColumn?: number;
195
+ readonly executionContextId?: number;
196
+ readonly hash?: string;
197
+ readonly buildId?: string;
198
+ readonly executionContextAuxData?: unknown;
199
+ readonly sourceMapURL?: string;
200
+ readonly hasSourceURL?: boolean;
201
+ readonly isModule?: boolean;
202
+ readonly length?: number;
203
+ readonly stackTrace?: StackTraceInfo;
115
204
  }
116
205
  interface InspectorConnectOptions {
117
206
  readonly port: number;
118
207
  readonly host?: string;
119
208
  readonly connectTimeoutMs?: number;
120
209
  readonly targetIndex?: number;
210
+ readonly workerIndex?: number;
121
211
  }
122
212
 
123
213
  declare function parseBreakpointSpec(input: string): BreakpointLocation;
@@ -150,6 +240,11 @@ interface CdpClientOptions {
150
240
  readonly requestTimeoutMs?: number;
151
241
  readonly connectTimeoutMs?: number;
152
242
  }
243
+ interface CdpWaitOptions<T> {
244
+ readonly timeoutMs: number;
245
+ readonly predicate?: (params: T) => boolean;
246
+ readonly signal?: AbortSignal;
247
+ }
153
248
  declare class CdpClient {
154
249
  private readonly transport;
155
250
  private readonly requestTimeoutMs;
@@ -166,16 +261,16 @@ declare class CdpClient {
166
261
  static connect(options: CdpClientOptions): Promise<CdpClient>;
167
262
  send<TResult = unknown>(method: string, params?: Record<string, unknown>): Promise<TResult>;
168
263
  on(method: string, listener: (params: unknown) => void): () => void;
169
- waitFor<T = unknown>(method: string, options?: {
170
- readonly timeoutMs: number;
171
- readonly predicate?: (params: T) => boolean;
172
- }): Promise<T>;
264
+ waitFor<T = unknown>(method: string, options?: CdpWaitOptions<T>): Promise<T>;
265
+ private createEventWait;
266
+ private eventMatches;
173
267
  onClose(listener: (err: Error) => void): () => void;
174
268
  dispose(): void;
175
269
  get isClosed(): boolean;
176
270
  private handleResponse;
177
271
  private createRequestTimer;
178
272
  private createWaitTimeoutError;
273
+ private createWaitAbortError;
179
274
  private sendPayload;
180
275
  private markClosed;
181
276
  }
@@ -216,11 +311,25 @@ interface InspectorSession {
216
311
  readonly pauseBuffer: PauseEvent[];
217
312
  readonly pauseWaitGate: PauseWaitGate;
218
313
  readonly debuggerState: DebuggerState;
314
+ readonly targetIndex?: number;
315
+ readonly targetCount?: number;
316
+ readonly workerIndex?: number;
317
+ readonly workerTargets?: readonly InspectorWorkerTarget[];
318
+ readonly workerDiscoverySupported?: boolean;
219
319
  dispose(): Promise<void>;
220
320
  }
321
+ interface InspectorWorkerTarget {
322
+ readonly sessionId: string;
323
+ readonly workerId: string;
324
+ readonly type: string;
325
+ readonly title: string;
326
+ readonly url: string;
327
+ }
221
328
  interface CdpEvalResult {
222
329
  result?: {
223
330
  type?: unknown;
331
+ subtype?: unknown;
332
+ className?: unknown;
224
333
  value?: unknown;
225
334
  description?: unknown;
226
335
  objectId?: unknown;
@@ -228,6 +337,7 @@ interface CdpEvalResult {
228
337
  exceptionDetails?: {
229
338
  text?: unknown;
230
339
  exception?: {
340
+ className?: unknown;
231
341
  description?: unknown;
232
342
  };
233
343
  };
@@ -252,23 +362,39 @@ interface WaitForPauseOptions {
252
362
  readonly pauseReasons?: readonly string[];
253
363
  readonly unmatchedPausePolicy?: "wait-for-resume" | "fail";
254
364
  readonly onUnmatchedPause?: (pause: PauseEvent) => void;
365
+ readonly signal?: AbortSignal;
255
366
  }
256
367
 
257
368
  declare function buildHitCountedCondition(hitCount: number, counterKey: string, userCondition: string | undefined): string;
258
369
  declare function setBreakpoint(session: InspectorSession, input: SetBreakpointInput): Promise<BreakpointHandle>;
259
370
  declare function removeBreakpoint(session: InspectorSession, breakpointId: string): Promise<void>;
371
+ declare function getPossibleBreakpoints(session: InspectorSession, options: GetPossibleBreakpointsOptions): Promise<readonly BreakLocation[]>;
372
+ declare function setBreakpointAtLocation(session: InspectorSession, input: SetBreakpointAtLocationInput): Promise<ExactBreakpointHandle>;
260
373
 
261
374
  declare function waitForPause(session: InspectorSession, options: WaitForPauseOptions): Promise<PauseEvent>;
262
375
 
263
376
  type PauseOnExceptionsState = "none" | "uncaught" | "caught" | "all";
377
+ interface EvaluateOnFrameOptions {
378
+ readonly throwOnSideEffect?: boolean;
379
+ readonly objectGroup?: string;
380
+ }
381
+ interface StepIntoOptions {
382
+ readonly breakOnAsyncCall?: boolean;
383
+ }
264
384
  declare function resume(session: InspectorSession): Promise<void>;
265
385
  declare function setPauseOnExceptions(session: InspectorSession, state: PauseOnExceptionsState): Promise<void>;
266
- declare function evaluateOnFrame(session: InspectorSession, callFrameId: string, expression: string): Promise<CdpEvalResult>;
386
+ declare function evaluateOnFrame(session: InspectorSession, callFrameId: string, expression: string, options?: EvaluateOnFrameOptions): Promise<CdpEvalResult>;
267
387
  declare function evaluateGlobal(session: InspectorSession, expression: string): Promise<CdpEvalResult>;
268
388
  declare function runSetupEvals(session: InspectorSession, expressions: readonly string[]): Promise<void>;
269
389
  declare function listScripts(session: InspectorSession): readonly ScriptInfo[];
270
390
  declare function validateExpression(session: InspectorSession, expression: string): Promise<void>;
271
391
  declare function getProperties(session: InspectorSession, objectId: string): Promise<readonly CdpProperty[]>;
392
+ declare function getScriptSource(session: InspectorSession, scriptId: string): Promise<string>;
393
+ declare function stepInto(session: InspectorSession, options?: StepIntoOptions): Promise<void>;
394
+ declare function stepOver(session: InspectorSession): Promise<void>;
395
+ declare function stepOut(session: InspectorSession): Promise<void>;
396
+ declare function releaseObject(session: InspectorSession, objectId: string): Promise<void>;
397
+ declare function releaseObjectGroup(session: InspectorSession, objectGroup: string): Promise<void>;
272
398
 
273
399
  declare function connectInspector(options: InspectorConnectOptions): Promise<InspectorSession>;
274
400
 
@@ -278,6 +404,7 @@ interface CaptureSnapshotOptions {
278
404
  readonly maxValueLength?: number;
279
405
  readonly stackDepth?: number;
280
406
  readonly stackCaptures?: readonly string[];
407
+ readonly throwOnSideEffect?: boolean;
281
408
  }
282
409
  declare function captureSnapshot(session: InspectorSession, pause: PauseEvent, options?: CaptureSnapshotOptions): Promise<SnapshotCaptureResult>;
283
410
 
@@ -287,6 +414,7 @@ interface WalkStackOptions {
287
414
  readonly stackDepth: number;
288
415
  readonly stackCaptures: readonly string[];
289
416
  readonly maxValueLength: number;
417
+ readonly throwOnSideEffect?: boolean;
290
418
  }
291
419
  declare function walkStack(session: InspectorSession, callFrames: readonly CallFrameInfo[], options: WalkStackOptions): Promise<readonly FrameSnapshot[]>;
292
420
 
@@ -303,6 +431,8 @@ interface LogpointEvent {
303
431
  readonly value?: string;
304
432
  readonly error?: string;
305
433
  readonly raw?: string;
434
+ readonly truncated?: true;
435
+ readonly originalLength?: number;
306
436
  }
307
437
 
308
438
  type LogpointStopReason = "duration" | "signal" | "transport-closed" | "max-events";
@@ -314,6 +444,7 @@ interface LogpointStreamOptions {
314
444
  readonly maxEvents?: number;
315
445
  readonly hitCount?: number;
316
446
  readonly condition?: string;
447
+ readonly maxValueLength?: number;
317
448
  readonly signal?: AbortSignal;
318
449
  readonly onEvent: (event: LogpointEvent) => void;
319
450
  readonly onBreakpointSet?: (handle: BreakpointHandle) => void;
@@ -332,6 +463,10 @@ interface TunnelTarget {
332
463
  readonly org: string;
333
464
  readonly space: string;
334
465
  readonly app: string;
466
+ readonly process?: string;
467
+ readonly instance?: number;
468
+ readonly nodePid?: number;
469
+ readonly allowSshEnableRestart?: boolean;
335
470
  readonly tunnelReadyTimeoutMs?: number;
336
471
  readonly preferredPort?: number;
337
472
  readonly verbose?: boolean;
@@ -343,6 +478,7 @@ interface OpenedTunnel {
343
478
  readonly handle?: DebuggerHandle;
344
479
  dispose(): Promise<void>;
345
480
  }
481
+ declare function openOwnedCfTunnel(target: TunnelTarget): Promise<OpenedTunnel>;
346
482
  declare function openCfTunnel(target: TunnelTarget): Promise<OpenedTunnel>;
347
483
 
348
- 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, runSetupEvals, setBreakpoint, setPauseOnExceptions, streamLogpoint, validateExpression, waitForPause, walkStack };
484
+ export { type BreakLocation, type BreakpointHandle, type BreakpointLocation, type CallFrameInfo, type CaptureSnapshotOptions, type CapturedExpression, CfInspectorError, type CfInspectorErrorCode, type DebuggerState, type EvaluateOnFrameOptions, type ExactBreakpointHandle, type ExceptionSnapshot, type FrameSnapshot, type GetPossibleBreakpointsOptions, type InspectorConnectOptions, type InspectorSession, type InspectorTarget, type InspectorWorkerTarget, type LogpointConditionOptions, type LogpointEvent, type LogpointStopReason, type LogpointStreamOptions, type LogpointStreamResult, type OpenedTunnel, type PauseEvent, type PauseOnExceptionsState, type RemoteObjectInfo, type RemoteRootSetting, type ResolvedLocation, type ScopeInfo, type ScopeSnapshot, type ScriptInfo, type ScriptLocation, type SetBreakpointAtLocationInput, type SetBreakpointInput, type SnapshotCaptureResult, type SnapshotResult, type StackTraceFrameInfo, type StackTraceIdInfo, type StackTraceInfo, type StepIntoOptions, type TunnelTarget, type VariableSnapshot, type WaitForPauseOptions, type WalkStackOptions, type WatchEvent, buildBreakpointUrlRegex, buildHitCountedCondition, buildLogpointCondition, captureException, captureSnapshot, connectInspector, discoverInspectorTargets, evaluateGlobal, evaluateOnFrame, fetchInspectorVersion, getPossibleBreakpoints, getProperties, getScriptSource, listScripts, openCfTunnel, openOwnedCfTunnel, parseBreakpointSpec, parseRemoteRoot, releaseObject, releaseObjectGroup, removeBreakpoint, resume, runSetupEvals, setBreakpoint, setBreakpointAtLocation, setPauseOnExceptions, stepInto, stepOut, stepOver, streamLogpoint, validateExpression, waitForPause, walkStack };