lexmount 0.5.9 → 0.5.11
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.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +40 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -181,6 +181,12 @@ interface SessionCreateOptions {
|
|
|
181
181
|
* Optional upstream proxy configuration.
|
|
182
182
|
*/
|
|
183
183
|
proxy?: SessionProxyConfig;
|
|
184
|
+
/**
|
|
185
|
+
* Use the Lexmount official proxy pool for this session.
|
|
186
|
+
*
|
|
187
|
+
* Cannot be used together with `proxy`.
|
|
188
|
+
*/
|
|
189
|
+
officialProxy?: boolean;
|
|
184
190
|
/**
|
|
185
191
|
* Forward weak_lock to the API when creating sessions with read-write contexts.
|
|
186
192
|
*/
|
|
@@ -851,6 +857,6 @@ declare class TimeoutError extends LexmountError {
|
|
|
851
857
|
/**
|
|
852
858
|
* Lexmount Node.js SDK.
|
|
853
859
|
*/
|
|
854
|
-
declare const VERSION = "0.5.
|
|
860
|
+
declare const VERSION = "0.5.10";
|
|
855
861
|
|
|
856
862
|
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
|
@@ -181,6 +181,12 @@ interface SessionCreateOptions {
|
|
|
181
181
|
* Optional upstream proxy configuration.
|
|
182
182
|
*/
|
|
183
183
|
proxy?: SessionProxyConfig;
|
|
184
|
+
/**
|
|
185
|
+
* Use the Lexmount official proxy pool for this session.
|
|
186
|
+
*
|
|
187
|
+
* Cannot be used together with `proxy`.
|
|
188
|
+
*/
|
|
189
|
+
officialProxy?: boolean;
|
|
184
190
|
/**
|
|
185
191
|
* Forward weak_lock to the API when creating sessions with read-write contexts.
|
|
186
192
|
*/
|
|
@@ -851,6 +857,6 @@ declare class TimeoutError extends LexmountError {
|
|
|
851
857
|
/**
|
|
852
858
|
* Lexmount Node.js SDK.
|
|
853
859
|
*/
|
|
854
|
-
declare const VERSION = "0.5.
|
|
860
|
+
declare const VERSION = "0.5.10";
|
|
855
861
|
|
|
856
862
|
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.js
CHANGED
|
@@ -318,6 +318,9 @@ function withRequestedRegion(client, payload) {
|
|
|
318
318
|
const regionId = client.selectedRegion ?? client.region;
|
|
319
319
|
return regionId ? { ...payload, region_id: regionId } : payload;
|
|
320
320
|
}
|
|
321
|
+
function projectHeaders(projectId) {
|
|
322
|
+
return projectId ? { headers: { "x-project-id": projectId } } : void 0;
|
|
323
|
+
}
|
|
321
324
|
function getNumber(value) {
|
|
322
325
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
323
326
|
}
|
|
@@ -462,10 +465,8 @@ var SessionDownloadsResource = class {
|
|
|
462
465
|
async list(sessionId, projectId) {
|
|
463
466
|
const response = await this.client._post(
|
|
464
467
|
`${this.client.baseUrl}/instance/v1/sessions/${sessionId}/downloads/list`,
|
|
465
|
-
{
|
|
466
|
-
|
|
467
|
-
project_id: projectId ?? this.client.projectId
|
|
468
|
-
}
|
|
468
|
+
{},
|
|
469
|
+
projectHeaders(projectId)
|
|
469
470
|
);
|
|
470
471
|
if (response.status >= 400) {
|
|
471
472
|
this.handleError("list session downloads", response, sessionId);
|
|
@@ -493,12 +494,10 @@ var SessionDownloadsResource = class {
|
|
|
493
494
|
async get(sessionId, downloadId, projectId) {
|
|
494
495
|
const response = await this.client._get(
|
|
495
496
|
`${this.client.baseUrl}/instance/v1/sessions/${sessionId}/downloads/${downloadId}`,
|
|
497
|
+
void 0,
|
|
496
498
|
{
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
responseType: "arraybuffer"
|
|
499
|
+
responseType: "arraybuffer",
|
|
500
|
+
...projectHeaders(projectId) ?? {}
|
|
502
501
|
}
|
|
503
502
|
);
|
|
504
503
|
if (response.status >= 400) {
|
|
@@ -509,12 +508,10 @@ var SessionDownloadsResource = class {
|
|
|
509
508
|
async archive(sessionId, projectId) {
|
|
510
509
|
const response = await this.client._get(
|
|
511
510
|
`${this.client.baseUrl}/instance/v1/sessions/${sessionId}/downloads/archive`,
|
|
511
|
+
void 0,
|
|
512
512
|
{
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
responseType: "arraybuffer"
|
|
513
|
+
responseType: "arraybuffer",
|
|
514
|
+
...projectHeaders(projectId) ?? {}
|
|
518
515
|
}
|
|
519
516
|
);
|
|
520
517
|
if (response.status >= 400) {
|
|
@@ -525,10 +522,8 @@ var SessionDownloadsResource = class {
|
|
|
525
522
|
async delete(sessionId, projectId) {
|
|
526
523
|
const response = await this.client._delete(
|
|
527
524
|
`${this.client.baseUrl}/instance/v1/sessions/${sessionId}/downloads`,
|
|
528
|
-
{
|
|
529
|
-
|
|
530
|
-
project_id: projectId ?? this.client.projectId
|
|
531
|
-
}
|
|
525
|
+
{},
|
|
526
|
+
projectHeaders(projectId)
|
|
532
527
|
);
|
|
533
528
|
if (response.status >= 400) {
|
|
534
529
|
this.handleError("delete session downloads", response, sessionId);
|
|
@@ -566,8 +561,6 @@ var SessionsResource = class {
|
|
|
566
561
|
*/
|
|
567
562
|
async create(options = {}) {
|
|
568
563
|
const payload = {
|
|
569
|
-
api_key: this.client.apiKey,
|
|
570
|
-
project_id: options.projectId ?? this.client.projectId,
|
|
571
564
|
browser_mode: options.browserMode ?? "normal"
|
|
572
565
|
};
|
|
573
566
|
if (options.customImageId) {
|
|
@@ -595,6 +588,12 @@ var SessionsResource = class {
|
|
|
595
588
|
if (options.proxy) {
|
|
596
589
|
payload.proxy = this.normalizeProxy(options.proxy);
|
|
597
590
|
}
|
|
591
|
+
if (options.officialProxy) {
|
|
592
|
+
if (options.proxy) {
|
|
593
|
+
throw new ValidationError("officialProxy cannot be used together with proxy");
|
|
594
|
+
}
|
|
595
|
+
payload.official_proxy = true;
|
|
596
|
+
}
|
|
598
597
|
if (options.weakLock) {
|
|
599
598
|
payload.weak_lock = true;
|
|
600
599
|
}
|
|
@@ -602,7 +601,11 @@ var SessionsResource = class {
|
|
|
602
601
|
return this.createAsync(withRequestedRegion(this.client, payload), options);
|
|
603
602
|
}
|
|
604
603
|
const url = `${this.client.baseUrl}/instance`;
|
|
605
|
-
const response = await this.client._post(
|
|
604
|
+
const response = await this.client._post(
|
|
605
|
+
url,
|
|
606
|
+
withRequestedRegion(this.client, payload),
|
|
607
|
+
projectHeaders(options.projectId)
|
|
608
|
+
);
|
|
606
609
|
if (response.status >= 400) {
|
|
607
610
|
this.handleCreateError(response);
|
|
608
611
|
}
|
|
@@ -634,7 +637,11 @@ var SessionsResource = class {
|
|
|
634
637
|
});
|
|
635
638
|
}
|
|
636
639
|
async createAsync(payload, options) {
|
|
637
|
-
const response = await this.client._post(
|
|
640
|
+
const response = await this.client._post(
|
|
641
|
+
`${this.client.baseUrl}/instance/v2`,
|
|
642
|
+
payload,
|
|
643
|
+
projectHeaders(options.projectId)
|
|
644
|
+
);
|
|
638
645
|
if (response.status >= 400) {
|
|
639
646
|
this.handleCreateError(response);
|
|
640
647
|
}
|
|
@@ -696,10 +703,8 @@ var SessionsResource = class {
|
|
|
696
703
|
*/
|
|
697
704
|
async get(sessionId, projectId) {
|
|
698
705
|
const response = await this.client._post(`${this.client.baseUrl}/instance/session`, withRequestedRegion(this.client, {
|
|
699
|
-
api_key: this.client.apiKey,
|
|
700
|
-
project_id: projectId ?? this.client.projectId,
|
|
701
706
|
session_id: sessionId
|
|
702
|
-
}));
|
|
707
|
+
}), projectHeaders(projectId));
|
|
703
708
|
if (response.status >= 400) {
|
|
704
709
|
this.handleGetError(response, sessionId);
|
|
705
710
|
}
|
|
@@ -710,14 +715,15 @@ var SessionsResource = class {
|
|
|
710
715
|
*/
|
|
711
716
|
async list(options = {}) {
|
|
712
717
|
const url = `${this.client.baseUrl}/instance/v2/sessions`;
|
|
713
|
-
const payload = {
|
|
714
|
-
api_key: this.client.apiKey,
|
|
715
|
-
project_id: options.projectId ?? this.client.projectId
|
|
716
|
-
};
|
|
718
|
+
const payload = {};
|
|
717
719
|
if (options.status) {
|
|
718
720
|
payload.status = options.status;
|
|
719
721
|
}
|
|
720
|
-
const response = await this.client._post(
|
|
722
|
+
const response = await this.client._post(
|
|
723
|
+
url,
|
|
724
|
+
withRequestedRegion(this.client, payload),
|
|
725
|
+
projectHeaders(options.projectId)
|
|
726
|
+
);
|
|
721
727
|
if (response.status >= 400) {
|
|
722
728
|
this.handleListError(response);
|
|
723
729
|
}
|
|
@@ -744,11 +750,9 @@ var SessionsResource = class {
|
|
|
744
750
|
async delete(options) {
|
|
745
751
|
const url = `${this.client.baseUrl}/instance`;
|
|
746
752
|
const payload = withRequestedRegion(this.client, {
|
|
747
|
-
api_key: this.client.apiKey,
|
|
748
|
-
project_id: options.projectId ?? this.client.projectId,
|
|
749
753
|
session_id: options.sessionId
|
|
750
754
|
});
|
|
751
|
-
const response = await this.client._delete(url, payload);
|
|
755
|
+
const response = await this.client._delete(url, payload, projectHeaders(options.projectId));
|
|
752
756
|
if (response.status >= 400) {
|
|
753
757
|
this.handleDeleteError(response, options.sessionId);
|
|
754
758
|
}
|
|
@@ -1622,8 +1626,8 @@ var Lexmount = class {
|
|
|
1622
1626
|
logger2.debug(`${method} request to ${requestUrl}`);
|
|
1623
1627
|
try {
|
|
1624
1628
|
const headers = {
|
|
1625
|
-
|
|
1626
|
-
|
|
1629
|
+
"x-api-key": this.apiKey,
|
|
1630
|
+
"x-project-id": this.projectId,
|
|
1627
1631
|
...this.getDefaultHeaders(config2.data),
|
|
1628
1632
|
...config2.headers ?? {}
|
|
1629
1633
|
};
|
|
@@ -1769,7 +1773,7 @@ var Lexmount = class {
|
|
|
1769
1773
|
};
|
|
1770
1774
|
|
|
1771
1775
|
// src/index.ts
|
|
1772
|
-
var VERSION = "0.5.
|
|
1776
|
+
var VERSION = "0.5.10";
|
|
1773
1777
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1774
1778
|
0 && (module.exports = {
|
|
1775
1779
|
APIError,
|