@saptools/cf-inspector 0.6.2 → 0.7.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
@@ -170,6 +170,7 @@ interface SnapshotCaptureResult {
170
170
  readonly captures: readonly CapturedExpression[];
171
171
  readonly stack?: readonly FrameSnapshot[];
172
172
  readonly exception?: ExceptionSnapshot;
173
+ readonly isolate?: InspectorIsolate;
173
174
  }
174
175
  interface SnapshotResult extends SnapshotCaptureResult {
175
176
  readonly pausedDurationMs: number | null;
@@ -184,7 +185,14 @@ interface WatchEvent {
184
185
  readonly captures: readonly CapturedExpression[];
185
186
  readonly stack?: readonly FrameSnapshot[];
186
187
  readonly exception?: ExceptionSnapshot;
188
+ readonly isolate?: InspectorIsolate;
187
189
  }
190
+ type InspectorIsolate = {
191
+ readonly kind: "main";
192
+ } | {
193
+ readonly kind: "worker";
194
+ readonly workerId: string;
195
+ };
188
196
  interface ScriptInfo {
189
197
  readonly scriptId: string;
190
198
  readonly url: string;
@@ -208,6 +216,7 @@ interface InspectorConnectOptions {
208
216
  readonly connectTimeoutMs?: number;
209
217
  readonly targetIndex?: number;
210
218
  readonly workerIndex?: number;
219
+ readonly workerId?: string;
211
220
  }
212
221
 
213
222
  declare function parseBreakpointSpec(input: string): BreakpointLocation;
@@ -289,8 +298,19 @@ interface InspectorVersion {
289
298
  readonly browser: string;
290
299
  readonly protocolVersion: string;
291
300
  }
301
+ interface InspectorKeepaliveOptions {
302
+ readonly intervalMs?: number;
303
+ readonly probeTimeoutMs?: number;
304
+ readonly failureThreshold?: number;
305
+ readonly probe?: () => Promise<unknown>;
306
+ }
307
+ interface InspectorKeepalive {
308
+ readonly failure: Promise<never>;
309
+ cancel(): void;
310
+ }
292
311
  declare function discoverInspectorTargets(host: string, port: number, timeoutMs: number): Promise<readonly InspectorTarget[]>;
293
312
  declare function fetchInspectorVersion(host: string, port: number, timeoutMs: number): Promise<InspectorVersion>;
313
+ declare function startInspectorKeepalive(host: string, port: number, options?: InspectorKeepaliveOptions): InspectorKeepalive;
294
314
 
295
315
  /**
296
316
  * Internal coordination flag between the always-on `Debugger.paused` buffer in
@@ -302,7 +322,9 @@ interface PauseWaitGate {
302
322
  active: boolean;
303
323
  }
304
324
  interface DebuggerState {
325
+ currentPause?: PauseEvent;
305
326
  lastResumedAtMs?: number;
327
+ paused?: boolean;
306
328
  }
307
329
  interface InspectorSession {
308
330
  readonly client: CdpClient;
@@ -311,6 +333,7 @@ interface InspectorSession {
311
333
  readonly pauseBuffer: PauseEvent[];
312
334
  readonly pauseWaitGate: PauseWaitGate;
313
335
  readonly debuggerState: DebuggerState;
336
+ readonly isolate?: InspectorIsolate;
314
337
  readonly targetIndex?: number;
315
338
  readonly targetCount?: number;
316
339
  readonly workerIndex?: number;
@@ -318,6 +341,16 @@ interface InspectorSession {
318
341
  readonly workerDiscoverySupported?: boolean;
319
342
  dispose(): Promise<void>;
320
343
  }
344
+ interface InspectorSessionGroup {
345
+ readonly targetIndex: number;
346
+ readonly targetCount: number;
347
+ readonly workerDiscoverySupported: boolean;
348
+ list(): readonly InspectorSession[];
349
+ onSession(listener: (session: InspectorSession) => void): () => void;
350
+ onSessionRemoved(listener: (session: InspectorSession) => void): () => void;
351
+ onError(listener: (error: Error) => void): () => void;
352
+ dispose(): Promise<void>;
353
+ }
321
354
  interface InspectorWorkerTarget {
322
355
  readonly sessionId: string;
323
356
  readonly workerId: string;
@@ -373,6 +406,40 @@ declare function setBreakpointAtLocation(session: InspectorSession, input: SetBr
373
406
 
374
407
  declare function waitForPause(session: InspectorSession, options: WaitForPauseOptions): Promise<PauseEvent>;
375
408
 
409
+ interface SessionBreakpointSetup {
410
+ readonly handles: readonly BreakpointHandle[];
411
+ }
412
+ interface IsolatePause {
413
+ readonly session: InspectorSession;
414
+ readonly pause: PauseEvent;
415
+ }
416
+ interface FanoutCleanupSummary {
417
+ readonly attempted: number;
418
+ readonly cleared: number;
419
+ readonly resumed: number;
420
+ }
421
+ declare class BreakpointFanout {
422
+ private readonly records;
423
+ private readonly setupErrors;
424
+ private readonly detach;
425
+ private readonly detachRemoved;
426
+ private readonly detachError;
427
+ private activeRace;
428
+ private pauseReasons;
429
+ constructor(group: InspectorSessionGroup, setupSession: (session: InspectorSession, trackHandle: (handle: BreakpointHandle) => void) => Promise<SessionBreakpointSetup>, pauseReasons?: readonly string[]);
430
+ ready(): Promise<void>;
431
+ trackHandle(session: InspectorSession, handle: BreakpointHandle): void;
432
+ availableOutcomes(): readonly {
433
+ readonly session: InspectorSession;
434
+ readonly setup: SessionBreakpointSetup;
435
+ }[];
436
+ waitForFirst(timeoutMs: number, options?: Omit<WaitForPauseOptions, "timeoutMs" | "breakpointIds" | "signal">, signal?: AbortSignal): Promise<IsolatePause>;
437
+ resumePaused(except?: InspectorSession): Promise<number>;
438
+ cleanup(timeoutMs?: number, preservePaused?: InspectorSession): Promise<FanoutCleanupSummary>;
439
+ private resumePausedLosers;
440
+ private ownsCurrentPause;
441
+ }
442
+
376
443
  type PauseOnExceptionsState = "none" | "uncaught" | "caught" | "all";
377
444
  interface EvaluateOnFrameOptions {
378
445
  readonly throwOnSideEffect?: boolean;
@@ -398,6 +465,7 @@ declare function releaseObject(session: InspectorSession, objectId: string): Pro
398
465
  declare function releaseObjectGroup(session: InspectorSession, objectGroup: string): Promise<void>;
399
466
 
400
467
  declare function connectInspector(options: InspectorConnectOptions): Promise<InspectorSession>;
468
+ declare function connectInspectorGroup(options: Omit<InspectorConnectOptions, "workerIndex" | "workerId">): Promise<InspectorSessionGroup>;
401
469
 
402
470
  interface CaptureSnapshotOptions {
403
471
  readonly captures?: readonly string[];
@@ -434,6 +502,7 @@ interface LogpointEvent {
434
502
  readonly raw?: string;
435
503
  readonly truncated?: true;
436
504
  readonly originalLength?: number;
505
+ readonly isolate?: InspectorIsolate;
437
506
  }
438
507
 
439
508
  type LogpointStopReason = "duration" | "signal" | "transport-closed" | "max-events";
@@ -482,4 +551,4 @@ interface OpenedTunnel {
482
551
  declare function openOwnedCfTunnel(target: TunnelTarget): Promise<OpenedTunnel>;
483
552
  declare function openCfTunnel(target: TunnelTarget): Promise<OpenedTunnel>;
484
553
 
485
- 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, setAsyncCallStackDepth, setBreakpoint, setBreakpointAtLocation, setPauseOnExceptions, stepInto, stepOut, stepOver, streamLogpoint, validateExpression, waitForPause, walkStack };
554
+ export { type BreakLocation, BreakpointFanout, 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 InspectorIsolate, type InspectorSession, type InspectorSessionGroup, 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, connectInspectorGroup, discoverInspectorTargets, evaluateGlobal, evaluateOnFrame, fetchInspectorVersion, getPossibleBreakpoints, getProperties, getScriptSource, listScripts, openCfTunnel, openOwnedCfTunnel, parseBreakpointSpec, parseRemoteRoot, releaseObject, releaseObjectGroup, removeBreakpoint, resume, runSetupEvals, setAsyncCallStackDepth, setBreakpoint, setBreakpointAtLocation, setPauseOnExceptions, startInspectorKeepalive, stepInto, stepOut, stepOver, streamLogpoint, validateExpression, waitForPause, walkStack };