lexmount 0.5.4 → 0.5.6
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/README.md +73 -0
- package/dist/index.d.mts +132 -69
- package/dist/index.d.ts +132 -69
- package/dist/index.js +1066 -825
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1062 -825
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
- package/types/chrome-remote-interface.d.ts +46 -0
package/README.md
CHANGED
|
@@ -224,6 +224,41 @@ await session.close();
|
|
|
224
224
|
client.close();
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
### Integrated Auth with lexmount-extra
|
|
228
|
+
|
|
229
|
+
For NTLM or Kerberos integrated auth, install `lexmount-extra` in your
|
|
230
|
+
application and register the callback factories it provides:
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
import { Lexmount, connectOverCDP, registerIntegratedAuthCallback } from 'lexmount';
|
|
234
|
+
import { createKerberosAuthCallback, createNTLMAuthCallback } from 'lexmount-extra';
|
|
235
|
+
|
|
236
|
+
const client = new Lexmount();
|
|
237
|
+
const session = await client.sessions.create({ browserMode: 'normal' });
|
|
238
|
+
const cdpClient = await connectOverCDP(session);
|
|
239
|
+
|
|
240
|
+
await registerIntegratedAuthCallback(
|
|
241
|
+
cdpClient,
|
|
242
|
+
createNTLMAuthCallback({
|
|
243
|
+
hostname: 'web.lab.local',
|
|
244
|
+
domain: 'LAB',
|
|
245
|
+
username: process.env.LEXMOUNT_NTLM_USERNAME,
|
|
246
|
+
password: process.env.LEXMOUNT_NTLM_PASSWORD,
|
|
247
|
+
})
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
await registerIntegratedAuthCallback(
|
|
251
|
+
cdpClient,
|
|
252
|
+
createKerberosAuthCallback({
|
|
253
|
+
hostname: 'web.lab.test',
|
|
254
|
+
})
|
|
255
|
+
);
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
`lexmount-extra` can derive some NTLM and Kerberos defaults from the current
|
|
259
|
+
environment, but explicit callback options are usually clearer for reproducible
|
|
260
|
+
integrations.
|
|
261
|
+
|
|
227
262
|
### Error Handling
|
|
228
263
|
|
|
229
264
|
```ts
|
|
@@ -283,6 +318,7 @@ Generated files are written to `generated-docs/` and are not meant to be committ
|
|
|
283
318
|
|
|
284
319
|
Example scripts live in [examples](./examples):
|
|
285
320
|
|
|
321
|
+
- `auth-basic.ts`
|
|
286
322
|
- `playwright-basic.ts`
|
|
287
323
|
- `session-management.ts`
|
|
288
324
|
- `context-basic.ts`
|
|
@@ -299,6 +335,7 @@ Run them with:
|
|
|
299
335
|
```bash
|
|
300
336
|
cd examples
|
|
301
337
|
npm install
|
|
338
|
+
npm run auth-basic
|
|
302
339
|
npm run context-fork
|
|
303
340
|
npm run playwright-basic
|
|
304
341
|
npm run session-management
|
|
@@ -542,6 +579,40 @@ await session.close();
|
|
|
542
579
|
client.close();
|
|
543
580
|
```
|
|
544
581
|
|
|
582
|
+
### 使用 lexmount-extra 集成认证
|
|
583
|
+
|
|
584
|
+
如果需要 NTLM 或 Kerberos 集成认证,可以在业务项目中安装 `lexmount-extra`,
|
|
585
|
+
并注册它提供的回调工厂:
|
|
586
|
+
|
|
587
|
+
```ts
|
|
588
|
+
import { Lexmount, connectOverCDP, registerIntegratedAuthCallback } from 'lexmount';
|
|
589
|
+
import { createKerberosAuthCallback, createNTLMAuthCallback } from 'lexmount-extra';
|
|
590
|
+
|
|
591
|
+
const client = new Lexmount();
|
|
592
|
+
const session = await client.sessions.create({ browserMode: 'normal' });
|
|
593
|
+
const cdpClient = await connectOverCDP(session);
|
|
594
|
+
|
|
595
|
+
await registerIntegratedAuthCallback(
|
|
596
|
+
cdpClient,
|
|
597
|
+
createNTLMAuthCallback({
|
|
598
|
+
hostname: 'web.lab.local',
|
|
599
|
+
domain: 'LAB',
|
|
600
|
+
username: process.env.LEXMOUNT_NTLM_USERNAME,
|
|
601
|
+
password: process.env.LEXMOUNT_NTLM_PASSWORD,
|
|
602
|
+
})
|
|
603
|
+
);
|
|
604
|
+
|
|
605
|
+
await registerIntegratedAuthCallback(
|
|
606
|
+
cdpClient,
|
|
607
|
+
createKerberosAuthCallback({
|
|
608
|
+
hostname: 'web.lab.test',
|
|
609
|
+
})
|
|
610
|
+
);
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
`lexmount-extra` 可以从当前环境推导部分 NTLM/Kerberos 默认值,但显式传入回调
|
|
614
|
+
选项更适合可复现的集成。
|
|
615
|
+
|
|
545
616
|
### 错误处理
|
|
546
617
|
|
|
547
618
|
```ts
|
|
@@ -601,6 +672,7 @@ npm run docs:html
|
|
|
601
672
|
|
|
602
673
|
示例脚本位于 [examples](./examples):
|
|
603
674
|
|
|
675
|
+
- `auth-basic.ts`
|
|
604
676
|
- `playwright-basic.ts`
|
|
605
677
|
- `session-management.ts`
|
|
606
678
|
- `context-basic.ts`
|
|
@@ -617,6 +689,7 @@ npm run docs:html
|
|
|
617
689
|
```bash
|
|
618
690
|
cd examples
|
|
619
691
|
npm install
|
|
692
|
+
npm run auth-basic
|
|
620
693
|
npm run context-fork
|
|
621
694
|
npm run playwright-basic
|
|
622
695
|
npm run session-management
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference path="../types/chrome-remote-interface.d.ts" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
1
3
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -443,6 +445,87 @@ declare class ExtensionsResource {
|
|
|
443
445
|
private handleError;
|
|
444
446
|
}
|
|
445
447
|
|
|
448
|
+
/**
|
|
449
|
+
* Lexmount API client.
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Main Lexmount SDK client.
|
|
454
|
+
*/
|
|
455
|
+
declare class Lexmount {
|
|
456
|
+
/**
|
|
457
|
+
* API key used for authentication.
|
|
458
|
+
*/
|
|
459
|
+
readonly apiKey: string;
|
|
460
|
+
/**
|
|
461
|
+
* Default project identifier used by resource methods.
|
|
462
|
+
*/
|
|
463
|
+
readonly projectId: string;
|
|
464
|
+
/**
|
|
465
|
+
* API base URL.
|
|
466
|
+
*/
|
|
467
|
+
readonly baseUrl: string;
|
|
468
|
+
readonly region?: string;
|
|
469
|
+
selectedRegion?: string;
|
|
470
|
+
private endpointBaseUrl?;
|
|
471
|
+
private selectedHost?;
|
|
472
|
+
private regionResolutionAttempted;
|
|
473
|
+
private regionResolutionPromise?;
|
|
474
|
+
/**
|
|
475
|
+
* Session operations.
|
|
476
|
+
*/
|
|
477
|
+
readonly sessions: SessionsResource;
|
|
478
|
+
/**
|
|
479
|
+
* Persistent context operations.
|
|
480
|
+
*/
|
|
481
|
+
readonly contexts: ContextsResource;
|
|
482
|
+
/**
|
|
483
|
+
* Browser extension operations.
|
|
484
|
+
*/
|
|
485
|
+
readonly extensions: ExtensionsResource;
|
|
486
|
+
private readonly httpClient;
|
|
487
|
+
constructor(config?: LexmountConfig);
|
|
488
|
+
/**
|
|
489
|
+
* Internal POST request helper with timeout and network error mapping.
|
|
490
|
+
*
|
|
491
|
+
* @internal
|
|
492
|
+
*/
|
|
493
|
+
_post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
494
|
+
/**
|
|
495
|
+
* Internal GET request helper with timeout and network error mapping.
|
|
496
|
+
*
|
|
497
|
+
* @internal
|
|
498
|
+
*/
|
|
499
|
+
_get<T = unknown>(url: string, params?: Record<string, unknown>, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
500
|
+
/**
|
|
501
|
+
* Internal DELETE request helper with timeout and network error mapping.
|
|
502
|
+
*
|
|
503
|
+
* @internal
|
|
504
|
+
*/
|
|
505
|
+
_delete<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
506
|
+
regionInfo(): Promise<RegionInfo>;
|
|
507
|
+
catalogInfo(): Promise<CatalogInfo>;
|
|
508
|
+
/**
|
|
509
|
+
* Close the client.
|
|
510
|
+
*
|
|
511
|
+
* Axios does not require explicit teardown, but the method is kept for API symmetry.
|
|
512
|
+
*/
|
|
513
|
+
close(): void;
|
|
514
|
+
/**
|
|
515
|
+
* String representation of the client.
|
|
516
|
+
*/
|
|
517
|
+
toString(): string;
|
|
518
|
+
private request;
|
|
519
|
+
private normalizeRequestError;
|
|
520
|
+
private getDefaultHeaders;
|
|
521
|
+
private ensureRegionResolved;
|
|
522
|
+
private resolveRegion;
|
|
523
|
+
private selectCatalogRegion;
|
|
524
|
+
private probeRegionHost;
|
|
525
|
+
private isAllowedCatalogHost;
|
|
526
|
+
private rewriteUrl;
|
|
527
|
+
}
|
|
528
|
+
|
|
446
529
|
/**
|
|
447
530
|
* Session resource implementation.
|
|
448
531
|
*/
|
|
@@ -630,85 +713,65 @@ declare class SessionsResource {
|
|
|
630
713
|
}
|
|
631
714
|
|
|
632
715
|
/**
|
|
633
|
-
*
|
|
716
|
+
* Chrome DevTools Protocol connection helpers.
|
|
634
717
|
*/
|
|
635
718
|
|
|
719
|
+
interface CDPEventMessage {
|
|
720
|
+
method: string;
|
|
721
|
+
params?: Record<string, unknown>;
|
|
722
|
+
sessionId?: string;
|
|
723
|
+
}
|
|
636
724
|
/**
|
|
637
|
-
*
|
|
725
|
+
* Lexmount CDP client.
|
|
726
|
+
*
|
|
727
|
+
* It forwards Chrome DevTools Protocol notifications through EventEmitter and
|
|
728
|
+
* exposes `send()` for raw CDP commands.
|
|
638
729
|
*/
|
|
639
|
-
declare class
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Default project identifier used by resource methods.
|
|
646
|
-
*/
|
|
647
|
-
readonly projectId: string;
|
|
648
|
-
/**
|
|
649
|
-
* API base URL.
|
|
650
|
-
*/
|
|
651
|
-
readonly baseUrl: string;
|
|
652
|
-
readonly region?: string;
|
|
653
|
-
selectedRegion?: string;
|
|
654
|
-
private endpointBaseUrl?;
|
|
655
|
-
private selectedHost?;
|
|
656
|
-
private regionResolutionAttempted;
|
|
657
|
-
private regionResolutionPromise?;
|
|
658
|
-
/**
|
|
659
|
-
* Session operations.
|
|
660
|
-
*/
|
|
661
|
-
readonly sessions: SessionsResource;
|
|
662
|
-
/**
|
|
663
|
-
* Persistent context operations.
|
|
664
|
-
*/
|
|
665
|
-
readonly contexts: ContextsResource;
|
|
666
|
-
/**
|
|
667
|
-
* Browser extension operations.
|
|
668
|
-
*/
|
|
669
|
-
readonly extensions: ExtensionsResource;
|
|
670
|
-
private readonly httpClient;
|
|
671
|
-
constructor(config?: LexmountConfig);
|
|
672
|
-
/**
|
|
673
|
-
* Internal POST request helper with timeout and network error mapping.
|
|
674
|
-
*
|
|
675
|
-
* @internal
|
|
676
|
-
*/
|
|
677
|
-
_post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
678
|
-
/**
|
|
679
|
-
* Internal GET request helper with timeout and network error mapping.
|
|
680
|
-
*
|
|
681
|
-
* @internal
|
|
682
|
-
*/
|
|
683
|
-
_get<T = unknown>(url: string, params?: Record<string, unknown>, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
730
|
+
declare class CDPClient extends EventEmitter {
|
|
731
|
+
readonly session: SessionInfo;
|
|
732
|
+
private closed;
|
|
733
|
+
private rawClient?;
|
|
734
|
+
constructor(session: SessionInfo);
|
|
684
735
|
/**
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
* @internal
|
|
736
|
+
* Connect the CDP client to the session.
|
|
688
737
|
*/
|
|
689
|
-
|
|
690
|
-
regionInfo(): Promise<RegionInfo>;
|
|
691
|
-
catalogInfo(): Promise<CatalogInfo>;
|
|
738
|
+
connect(): Promise<this>;
|
|
692
739
|
/**
|
|
693
|
-
*
|
|
740
|
+
* Send a raw Chrome DevTools Protocol command.
|
|
694
741
|
*
|
|
695
|
-
*
|
|
742
|
+
* Returns `undefined` if called before the client has connected.
|
|
696
743
|
*/
|
|
697
|
-
|
|
744
|
+
send(method: string, params?: any, sessionId?: string): Promise<any | undefined>;
|
|
698
745
|
/**
|
|
699
|
-
*
|
|
746
|
+
* Close the CDP connection and release internal listeners.
|
|
700
747
|
*/
|
|
701
|
-
|
|
702
|
-
private request;
|
|
703
|
-
private normalizeRequestError;
|
|
704
|
-
private getDefaultHeaders;
|
|
705
|
-
private ensureRegionResolved;
|
|
706
|
-
private resolveRegion;
|
|
707
|
-
private selectCatalogRegion;
|
|
708
|
-
private probeRegionHost;
|
|
709
|
-
private isAllowedCatalogHost;
|
|
710
|
-
private rewriteUrl;
|
|
748
|
+
close(): Promise<void>;
|
|
711
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* Connect to a Lexmount browser session over Chrome DevTools Protocol.
|
|
752
|
+
*/
|
|
753
|
+
declare function connectOverCDP(session: SessionInfo): Promise<CDPClient>;
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Integrated authentication helpers.
|
|
757
|
+
*/
|
|
758
|
+
|
|
759
|
+
type IntegratedAuthCallbackResult = {
|
|
760
|
+
cancel: true;
|
|
761
|
+
} | {
|
|
762
|
+
cancel: false;
|
|
763
|
+
scheme: string;
|
|
764
|
+
token: string;
|
|
765
|
+
};
|
|
766
|
+
type IntegratedAuthCallback = (params: any, callback: (result: IntegratedAuthCallbackResult) => Promise<void>) => void | Promise<void>;
|
|
767
|
+
/**
|
|
768
|
+
* Register an integrated auth callback for a session.
|
|
769
|
+
*/
|
|
770
|
+
declare function registerIntegratedAuthCallback(sessionOrClient: SessionInfo | CDPClient, callback: IntegratedAuthCallback): Promise<void>;
|
|
771
|
+
/**
|
|
772
|
+
* Deregister a previously registered integrated auth callback.
|
|
773
|
+
*/
|
|
774
|
+
declare function deregisterIntegratedAuthCallback(sessionOrClient: SessionInfo | CDPClient, callback: IntegratedAuthCallback): void;
|
|
712
775
|
|
|
713
776
|
/**
|
|
714
777
|
* Lexmount SDK error hierarchy.
|
|
@@ -775,6 +838,6 @@ declare class TimeoutError extends LexmountError {
|
|
|
775
838
|
/**
|
|
776
839
|
* Lexmount Node.js SDK.
|
|
777
840
|
*/
|
|
778
|
-
declare const VERSION = "0.5.
|
|
841
|
+
declare const VERSION = "0.5.6";
|
|
779
842
|
|
|
780
|
-
export { APIError, AuthenticationError, type BrowserMode, type CatalogInfo, type ContextAccessMode, type ContextCreateOptions, ContextInfo, type ContextListOptions, ContextListResponse, ContextLockedError, type ContextMetadata, ContextNotFoundError, type ContextStatus, ContextsResource, ExtensionInfo, type ExtensionInfoShape, type ExtensionListOptions, type ExtensionUploadOptions, ExtensionsResource, type ForceReleaseResponse, Lexmount, type LexmountConfig, LexmountError, LexmountLogger, type LogLevel, NetworkError, PaginationInfo, type PaginationInfoShape, type RegionCatalogEntry, type RegionInfo, type SessionContext, type SessionCreateOptions, type SessionCreateResponse, type SessionDeleteOptions, SessionDownloadInfo, type SessionDownloadInfoShape, SessionDownloadsDeleteResponse, type SessionDownloadsDeleteResponseShape, SessionDownloadsListResponse, type SessionDownloadsListResponseShape, SessionDownloadsResource, SessionInfo, type SessionListOptions, SessionListResponse, SessionNotFoundError, type SessionProxyConfig, type SessionStatus, SessionTargetInfo, type SessionTargetInfoShape, SessionsResource, TimeoutError, VERSION, ValidationError, Lexmount as default, disableLogging, enableLogging, getLogger, setLogLevel };
|
|
843
|
+
export { APIError, AuthenticationError, type BrowserMode, CDPClient, type CDPEventMessage, type CatalogInfo, type ContextAccessMode, type ContextCreateOptions, ContextInfo, type ContextListOptions, ContextListResponse, ContextLockedError, type ContextMetadata, ContextNotFoundError, type ContextStatus, ContextsResource, ExtensionInfo, type ExtensionInfoShape, type ExtensionListOptions, type ExtensionUploadOptions, ExtensionsResource, type ForceReleaseResponse, type IntegratedAuthCallback, type IntegratedAuthCallbackResult, Lexmount, type LexmountConfig, LexmountError, LexmountLogger, type LogLevel, NetworkError, PaginationInfo, type PaginationInfoShape, type RegionCatalogEntry, type RegionInfo, type SessionContext, type SessionCreateOptions, type SessionCreateResponse, type SessionDeleteOptions, SessionDownloadInfo, type SessionDownloadInfoShape, SessionDownloadsDeleteResponse, type SessionDownloadsDeleteResponseShape, SessionDownloadsListResponse, type SessionDownloadsListResponseShape, SessionDownloadsResource, SessionInfo, type SessionListOptions, SessionListResponse, SessionNotFoundError, type SessionProxyConfig, type SessionStatus, SessionTargetInfo, type SessionTargetInfoShape, SessionsResource, TimeoutError, VERSION, ValidationError, connectOverCDP, Lexmount as default, deregisterIntegratedAuthCallback, disableLogging, enableLogging, getLogger, registerIntegratedAuthCallback, setLogLevel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference path="../types/chrome-remote-interface.d.ts" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
1
3
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -443,6 +445,87 @@ declare class ExtensionsResource {
|
|
|
443
445
|
private handleError;
|
|
444
446
|
}
|
|
445
447
|
|
|
448
|
+
/**
|
|
449
|
+
* Lexmount API client.
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Main Lexmount SDK client.
|
|
454
|
+
*/
|
|
455
|
+
declare class Lexmount {
|
|
456
|
+
/**
|
|
457
|
+
* API key used for authentication.
|
|
458
|
+
*/
|
|
459
|
+
readonly apiKey: string;
|
|
460
|
+
/**
|
|
461
|
+
* Default project identifier used by resource methods.
|
|
462
|
+
*/
|
|
463
|
+
readonly projectId: string;
|
|
464
|
+
/**
|
|
465
|
+
* API base URL.
|
|
466
|
+
*/
|
|
467
|
+
readonly baseUrl: string;
|
|
468
|
+
readonly region?: string;
|
|
469
|
+
selectedRegion?: string;
|
|
470
|
+
private endpointBaseUrl?;
|
|
471
|
+
private selectedHost?;
|
|
472
|
+
private regionResolutionAttempted;
|
|
473
|
+
private regionResolutionPromise?;
|
|
474
|
+
/**
|
|
475
|
+
* Session operations.
|
|
476
|
+
*/
|
|
477
|
+
readonly sessions: SessionsResource;
|
|
478
|
+
/**
|
|
479
|
+
* Persistent context operations.
|
|
480
|
+
*/
|
|
481
|
+
readonly contexts: ContextsResource;
|
|
482
|
+
/**
|
|
483
|
+
* Browser extension operations.
|
|
484
|
+
*/
|
|
485
|
+
readonly extensions: ExtensionsResource;
|
|
486
|
+
private readonly httpClient;
|
|
487
|
+
constructor(config?: LexmountConfig);
|
|
488
|
+
/**
|
|
489
|
+
* Internal POST request helper with timeout and network error mapping.
|
|
490
|
+
*
|
|
491
|
+
* @internal
|
|
492
|
+
*/
|
|
493
|
+
_post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
494
|
+
/**
|
|
495
|
+
* Internal GET request helper with timeout and network error mapping.
|
|
496
|
+
*
|
|
497
|
+
* @internal
|
|
498
|
+
*/
|
|
499
|
+
_get<T = unknown>(url: string, params?: Record<string, unknown>, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
500
|
+
/**
|
|
501
|
+
* Internal DELETE request helper with timeout and network error mapping.
|
|
502
|
+
*
|
|
503
|
+
* @internal
|
|
504
|
+
*/
|
|
505
|
+
_delete<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
506
|
+
regionInfo(): Promise<RegionInfo>;
|
|
507
|
+
catalogInfo(): Promise<CatalogInfo>;
|
|
508
|
+
/**
|
|
509
|
+
* Close the client.
|
|
510
|
+
*
|
|
511
|
+
* Axios does not require explicit teardown, but the method is kept for API symmetry.
|
|
512
|
+
*/
|
|
513
|
+
close(): void;
|
|
514
|
+
/**
|
|
515
|
+
* String representation of the client.
|
|
516
|
+
*/
|
|
517
|
+
toString(): string;
|
|
518
|
+
private request;
|
|
519
|
+
private normalizeRequestError;
|
|
520
|
+
private getDefaultHeaders;
|
|
521
|
+
private ensureRegionResolved;
|
|
522
|
+
private resolveRegion;
|
|
523
|
+
private selectCatalogRegion;
|
|
524
|
+
private probeRegionHost;
|
|
525
|
+
private isAllowedCatalogHost;
|
|
526
|
+
private rewriteUrl;
|
|
527
|
+
}
|
|
528
|
+
|
|
446
529
|
/**
|
|
447
530
|
* Session resource implementation.
|
|
448
531
|
*/
|
|
@@ -630,85 +713,65 @@ declare class SessionsResource {
|
|
|
630
713
|
}
|
|
631
714
|
|
|
632
715
|
/**
|
|
633
|
-
*
|
|
716
|
+
* Chrome DevTools Protocol connection helpers.
|
|
634
717
|
*/
|
|
635
718
|
|
|
719
|
+
interface CDPEventMessage {
|
|
720
|
+
method: string;
|
|
721
|
+
params?: Record<string, unknown>;
|
|
722
|
+
sessionId?: string;
|
|
723
|
+
}
|
|
636
724
|
/**
|
|
637
|
-
*
|
|
725
|
+
* Lexmount CDP client.
|
|
726
|
+
*
|
|
727
|
+
* It forwards Chrome DevTools Protocol notifications through EventEmitter and
|
|
728
|
+
* exposes `send()` for raw CDP commands.
|
|
638
729
|
*/
|
|
639
|
-
declare class
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Default project identifier used by resource methods.
|
|
646
|
-
*/
|
|
647
|
-
readonly projectId: string;
|
|
648
|
-
/**
|
|
649
|
-
* API base URL.
|
|
650
|
-
*/
|
|
651
|
-
readonly baseUrl: string;
|
|
652
|
-
readonly region?: string;
|
|
653
|
-
selectedRegion?: string;
|
|
654
|
-
private endpointBaseUrl?;
|
|
655
|
-
private selectedHost?;
|
|
656
|
-
private regionResolutionAttempted;
|
|
657
|
-
private regionResolutionPromise?;
|
|
658
|
-
/**
|
|
659
|
-
* Session operations.
|
|
660
|
-
*/
|
|
661
|
-
readonly sessions: SessionsResource;
|
|
662
|
-
/**
|
|
663
|
-
* Persistent context operations.
|
|
664
|
-
*/
|
|
665
|
-
readonly contexts: ContextsResource;
|
|
666
|
-
/**
|
|
667
|
-
* Browser extension operations.
|
|
668
|
-
*/
|
|
669
|
-
readonly extensions: ExtensionsResource;
|
|
670
|
-
private readonly httpClient;
|
|
671
|
-
constructor(config?: LexmountConfig);
|
|
672
|
-
/**
|
|
673
|
-
* Internal POST request helper with timeout and network error mapping.
|
|
674
|
-
*
|
|
675
|
-
* @internal
|
|
676
|
-
*/
|
|
677
|
-
_post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
678
|
-
/**
|
|
679
|
-
* Internal GET request helper with timeout and network error mapping.
|
|
680
|
-
*
|
|
681
|
-
* @internal
|
|
682
|
-
*/
|
|
683
|
-
_get<T = unknown>(url: string, params?: Record<string, unknown>, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
730
|
+
declare class CDPClient extends EventEmitter {
|
|
731
|
+
readonly session: SessionInfo;
|
|
732
|
+
private closed;
|
|
733
|
+
private rawClient?;
|
|
734
|
+
constructor(session: SessionInfo);
|
|
684
735
|
/**
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
* @internal
|
|
736
|
+
* Connect the CDP client to the session.
|
|
688
737
|
*/
|
|
689
|
-
|
|
690
|
-
regionInfo(): Promise<RegionInfo>;
|
|
691
|
-
catalogInfo(): Promise<CatalogInfo>;
|
|
738
|
+
connect(): Promise<this>;
|
|
692
739
|
/**
|
|
693
|
-
*
|
|
740
|
+
* Send a raw Chrome DevTools Protocol command.
|
|
694
741
|
*
|
|
695
|
-
*
|
|
742
|
+
* Returns `undefined` if called before the client has connected.
|
|
696
743
|
*/
|
|
697
|
-
|
|
744
|
+
send(method: string, params?: any, sessionId?: string): Promise<any | undefined>;
|
|
698
745
|
/**
|
|
699
|
-
*
|
|
746
|
+
* Close the CDP connection and release internal listeners.
|
|
700
747
|
*/
|
|
701
|
-
|
|
702
|
-
private request;
|
|
703
|
-
private normalizeRequestError;
|
|
704
|
-
private getDefaultHeaders;
|
|
705
|
-
private ensureRegionResolved;
|
|
706
|
-
private resolveRegion;
|
|
707
|
-
private selectCatalogRegion;
|
|
708
|
-
private probeRegionHost;
|
|
709
|
-
private isAllowedCatalogHost;
|
|
710
|
-
private rewriteUrl;
|
|
748
|
+
close(): Promise<void>;
|
|
711
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* Connect to a Lexmount browser session over Chrome DevTools Protocol.
|
|
752
|
+
*/
|
|
753
|
+
declare function connectOverCDP(session: SessionInfo): Promise<CDPClient>;
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Integrated authentication helpers.
|
|
757
|
+
*/
|
|
758
|
+
|
|
759
|
+
type IntegratedAuthCallbackResult = {
|
|
760
|
+
cancel: true;
|
|
761
|
+
} | {
|
|
762
|
+
cancel: false;
|
|
763
|
+
scheme: string;
|
|
764
|
+
token: string;
|
|
765
|
+
};
|
|
766
|
+
type IntegratedAuthCallback = (params: any, callback: (result: IntegratedAuthCallbackResult) => Promise<void>) => void | Promise<void>;
|
|
767
|
+
/**
|
|
768
|
+
* Register an integrated auth callback for a session.
|
|
769
|
+
*/
|
|
770
|
+
declare function registerIntegratedAuthCallback(sessionOrClient: SessionInfo | CDPClient, callback: IntegratedAuthCallback): Promise<void>;
|
|
771
|
+
/**
|
|
772
|
+
* Deregister a previously registered integrated auth callback.
|
|
773
|
+
*/
|
|
774
|
+
declare function deregisterIntegratedAuthCallback(sessionOrClient: SessionInfo | CDPClient, callback: IntegratedAuthCallback): void;
|
|
712
775
|
|
|
713
776
|
/**
|
|
714
777
|
* Lexmount SDK error hierarchy.
|
|
@@ -775,6 +838,6 @@ declare class TimeoutError extends LexmountError {
|
|
|
775
838
|
/**
|
|
776
839
|
* Lexmount Node.js SDK.
|
|
777
840
|
*/
|
|
778
|
-
declare const VERSION = "0.5.
|
|
841
|
+
declare const VERSION = "0.5.6";
|
|
779
842
|
|
|
780
|
-
export { APIError, AuthenticationError, type BrowserMode, type CatalogInfo, type ContextAccessMode, type ContextCreateOptions, ContextInfo, type ContextListOptions, ContextListResponse, ContextLockedError, type ContextMetadata, ContextNotFoundError, type ContextStatus, ContextsResource, ExtensionInfo, type ExtensionInfoShape, type ExtensionListOptions, type ExtensionUploadOptions, ExtensionsResource, type ForceReleaseResponse, Lexmount, type LexmountConfig, LexmountError, LexmountLogger, type LogLevel, NetworkError, PaginationInfo, type PaginationInfoShape, type RegionCatalogEntry, type RegionInfo, type SessionContext, type SessionCreateOptions, type SessionCreateResponse, type SessionDeleteOptions, SessionDownloadInfo, type SessionDownloadInfoShape, SessionDownloadsDeleteResponse, type SessionDownloadsDeleteResponseShape, SessionDownloadsListResponse, type SessionDownloadsListResponseShape, SessionDownloadsResource, SessionInfo, type SessionListOptions, SessionListResponse, SessionNotFoundError, type SessionProxyConfig, type SessionStatus, SessionTargetInfo, type SessionTargetInfoShape, SessionsResource, TimeoutError, VERSION, ValidationError, Lexmount as default, disableLogging, enableLogging, getLogger, setLogLevel };
|
|
843
|
+
export { APIError, AuthenticationError, type BrowserMode, CDPClient, type CDPEventMessage, type CatalogInfo, type ContextAccessMode, type ContextCreateOptions, ContextInfo, type ContextListOptions, ContextListResponse, ContextLockedError, type ContextMetadata, ContextNotFoundError, type ContextStatus, ContextsResource, ExtensionInfo, type ExtensionInfoShape, type ExtensionListOptions, type ExtensionUploadOptions, ExtensionsResource, type ForceReleaseResponse, type IntegratedAuthCallback, type IntegratedAuthCallbackResult, Lexmount, type LexmountConfig, LexmountError, LexmountLogger, type LogLevel, NetworkError, PaginationInfo, type PaginationInfoShape, type RegionCatalogEntry, type RegionInfo, type SessionContext, type SessionCreateOptions, type SessionCreateResponse, type SessionDeleteOptions, SessionDownloadInfo, type SessionDownloadInfoShape, SessionDownloadsDeleteResponse, type SessionDownloadsDeleteResponseShape, SessionDownloadsListResponse, type SessionDownloadsListResponseShape, SessionDownloadsResource, SessionInfo, type SessionListOptions, SessionListResponse, SessionNotFoundError, type SessionProxyConfig, type SessionStatus, SessionTargetInfo, type SessionTargetInfoShape, SessionsResource, TimeoutError, VERSION, ValidationError, connectOverCDP, Lexmount as default, deregisterIntegratedAuthCallback, disableLogging, enableLogging, getLogger, registerIntegratedAuthCallback, setLogLevel };
|