lexmount 0.5.8 → 0.5.10
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +47 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -248,6 +248,9 @@ function withRequestedRegion(client, payload) {
|
|
|
248
248
|
const regionId = client.selectedRegion ?? client.region;
|
|
249
249
|
return regionId ? { ...payload, region_id: regionId } : payload;
|
|
250
250
|
}
|
|
251
|
+
function projectHeaders(projectId) {
|
|
252
|
+
return projectId ? { headers: { "x-project-id": projectId } } : void 0;
|
|
253
|
+
}
|
|
251
254
|
function getNumber(value) {
|
|
252
255
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
253
256
|
}
|
|
@@ -392,10 +395,8 @@ var SessionDownloadsResource = class {
|
|
|
392
395
|
async list(sessionId, projectId) {
|
|
393
396
|
const response = await this.client._post(
|
|
394
397
|
`${this.client.baseUrl}/instance/v1/sessions/${sessionId}/downloads/list`,
|
|
395
|
-
{
|
|
396
|
-
|
|
397
|
-
project_id: projectId ?? this.client.projectId
|
|
398
|
-
}
|
|
398
|
+
{},
|
|
399
|
+
projectHeaders(projectId)
|
|
399
400
|
);
|
|
400
401
|
if (response.status >= 400) {
|
|
401
402
|
this.handleError("list session downloads", response, sessionId);
|
|
@@ -423,12 +424,10 @@ var SessionDownloadsResource = class {
|
|
|
423
424
|
async get(sessionId, downloadId, projectId) {
|
|
424
425
|
const response = await this.client._get(
|
|
425
426
|
`${this.client.baseUrl}/instance/v1/sessions/${sessionId}/downloads/${downloadId}`,
|
|
427
|
+
void 0,
|
|
426
428
|
{
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
responseType: "arraybuffer"
|
|
429
|
+
responseType: "arraybuffer",
|
|
430
|
+
...projectHeaders(projectId) ?? {}
|
|
432
431
|
}
|
|
433
432
|
);
|
|
434
433
|
if (response.status >= 400) {
|
|
@@ -439,12 +438,10 @@ var SessionDownloadsResource = class {
|
|
|
439
438
|
async archive(sessionId, projectId) {
|
|
440
439
|
const response = await this.client._get(
|
|
441
440
|
`${this.client.baseUrl}/instance/v1/sessions/${sessionId}/downloads/archive`,
|
|
441
|
+
void 0,
|
|
442
442
|
{
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
responseType: "arraybuffer"
|
|
443
|
+
responseType: "arraybuffer",
|
|
444
|
+
...projectHeaders(projectId) ?? {}
|
|
448
445
|
}
|
|
449
446
|
);
|
|
450
447
|
if (response.status >= 400) {
|
|
@@ -455,10 +452,8 @@ var SessionDownloadsResource = class {
|
|
|
455
452
|
async delete(sessionId, projectId) {
|
|
456
453
|
const response = await this.client._delete(
|
|
457
454
|
`${this.client.baseUrl}/instance/v1/sessions/${sessionId}/downloads`,
|
|
458
|
-
{
|
|
459
|
-
|
|
460
|
-
project_id: projectId ?? this.client.projectId
|
|
461
|
-
}
|
|
455
|
+
{},
|
|
456
|
+
projectHeaders(projectId)
|
|
462
457
|
);
|
|
463
458
|
if (response.status >= 400) {
|
|
464
459
|
this.handleError("delete session downloads", response, sessionId);
|
|
@@ -496,8 +491,6 @@ var SessionsResource = class {
|
|
|
496
491
|
*/
|
|
497
492
|
async create(options = {}) {
|
|
498
493
|
const payload = {
|
|
499
|
-
api_key: this.client.apiKey,
|
|
500
|
-
project_id: options.projectId ?? this.client.projectId,
|
|
501
494
|
browser_mode: options.browserMode ?? "normal"
|
|
502
495
|
};
|
|
503
496
|
if (options.customImageId) {
|
|
@@ -532,7 +525,11 @@ var SessionsResource = class {
|
|
|
532
525
|
return this.createAsync(withRequestedRegion(this.client, payload), options);
|
|
533
526
|
}
|
|
534
527
|
const url = `${this.client.baseUrl}/instance`;
|
|
535
|
-
const response = await this.client._post(
|
|
528
|
+
const response = await this.client._post(
|
|
529
|
+
url,
|
|
530
|
+
withRequestedRegion(this.client, payload),
|
|
531
|
+
projectHeaders(options.projectId)
|
|
532
|
+
);
|
|
536
533
|
if (response.status >= 400) {
|
|
537
534
|
this.handleCreateError(response);
|
|
538
535
|
}
|
|
@@ -564,7 +561,11 @@ var SessionsResource = class {
|
|
|
564
561
|
});
|
|
565
562
|
}
|
|
566
563
|
async createAsync(payload, options) {
|
|
567
|
-
const response = await this.client._post(
|
|
564
|
+
const response = await this.client._post(
|
|
565
|
+
`${this.client.baseUrl}/instance/v2`,
|
|
566
|
+
payload,
|
|
567
|
+
projectHeaders(options.projectId)
|
|
568
|
+
);
|
|
568
569
|
if (response.status >= 400) {
|
|
569
570
|
this.handleCreateError(response);
|
|
570
571
|
}
|
|
@@ -626,10 +627,8 @@ var SessionsResource = class {
|
|
|
626
627
|
*/
|
|
627
628
|
async get(sessionId, projectId) {
|
|
628
629
|
const response = await this.client._post(`${this.client.baseUrl}/instance/session`, withRequestedRegion(this.client, {
|
|
629
|
-
api_key: this.client.apiKey,
|
|
630
|
-
project_id: projectId ?? this.client.projectId,
|
|
631
630
|
session_id: sessionId
|
|
632
|
-
}));
|
|
631
|
+
}), projectHeaders(projectId));
|
|
633
632
|
if (response.status >= 400) {
|
|
634
633
|
this.handleGetError(response, sessionId);
|
|
635
634
|
}
|
|
@@ -640,14 +639,15 @@ var SessionsResource = class {
|
|
|
640
639
|
*/
|
|
641
640
|
async list(options = {}) {
|
|
642
641
|
const url = `${this.client.baseUrl}/instance/v2/sessions`;
|
|
643
|
-
const payload = {
|
|
644
|
-
api_key: this.client.apiKey,
|
|
645
|
-
project_id: options.projectId ?? this.client.projectId
|
|
646
|
-
};
|
|
642
|
+
const payload = {};
|
|
647
643
|
if (options.status) {
|
|
648
644
|
payload.status = options.status;
|
|
649
645
|
}
|
|
650
|
-
const response = await this.client._post(
|
|
646
|
+
const response = await this.client._post(
|
|
647
|
+
url,
|
|
648
|
+
withRequestedRegion(this.client, payload),
|
|
649
|
+
projectHeaders(options.projectId)
|
|
650
|
+
);
|
|
651
651
|
if (response.status >= 400) {
|
|
652
652
|
this.handleListError(response);
|
|
653
653
|
}
|
|
@@ -674,11 +674,9 @@ var SessionsResource = class {
|
|
|
674
674
|
async delete(options) {
|
|
675
675
|
const url = `${this.client.baseUrl}/instance`;
|
|
676
676
|
const payload = withRequestedRegion(this.client, {
|
|
677
|
-
api_key: this.client.apiKey,
|
|
678
|
-
project_id: options.projectId ?? this.client.projectId,
|
|
679
677
|
session_id: options.sessionId
|
|
680
678
|
});
|
|
681
|
-
const response = await this.client._delete(url, payload);
|
|
679
|
+
const response = await this.client._delete(url, payload, projectHeaders(options.projectId));
|
|
682
680
|
if (response.status >= 400) {
|
|
683
681
|
this.handleDeleteError(response, options.sessionId);
|
|
684
682
|
}
|
|
@@ -964,6 +962,19 @@ async function registerIntegratedAuthCallback(sessionOrClient, callback) {
|
|
|
964
962
|
);
|
|
965
963
|
return;
|
|
966
964
|
}
|
|
965
|
+
if (result.skip) {
|
|
966
|
+
await client.send(
|
|
967
|
+
"Fetch.continueWithIntegratedAuth",
|
|
968
|
+
{
|
|
969
|
+
requestId: params.requestId,
|
|
970
|
+
authChallengeResponse: {
|
|
971
|
+
response: "SkipAuth"
|
|
972
|
+
}
|
|
973
|
+
},
|
|
974
|
+
sessionId
|
|
975
|
+
);
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
967
978
|
await client.send(
|
|
968
979
|
"Fetch.continueWithIntegratedAuth",
|
|
969
980
|
{
|
|
@@ -1539,8 +1550,8 @@ var Lexmount = class {
|
|
|
1539
1550
|
logger2.debug(`${method} request to ${requestUrl}`);
|
|
1540
1551
|
try {
|
|
1541
1552
|
const headers = {
|
|
1542
|
-
|
|
1543
|
-
|
|
1553
|
+
"x-api-key": this.apiKey,
|
|
1554
|
+
"x-project-id": this.projectId,
|
|
1544
1555
|
...this.getDefaultHeaders(config2.data),
|
|
1545
1556
|
...config2.headers ?? {}
|
|
1546
1557
|
};
|
|
@@ -1686,7 +1697,7 @@ var Lexmount = class {
|
|
|
1686
1697
|
};
|
|
1687
1698
|
|
|
1688
1699
|
// src/index.ts
|
|
1689
|
-
var VERSION = "0.5.
|
|
1700
|
+
var VERSION = "0.5.10";
|
|
1690
1701
|
export {
|
|
1691
1702
|
APIError,
|
|
1692
1703
|
AuthenticationError,
|