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 CHANGED
@@ -769,6 +769,10 @@ type IntegratedAuthCallbackResult = {
769
769
  cancel: true;
770
770
  } | {
771
771
  cancel: false;
772
+ skip: true;
773
+ } | {
774
+ cancel: false;
775
+ skip?: false;
772
776
  scheme: string;
773
777
  token: string;
774
778
  };
@@ -847,6 +851,6 @@ declare class TimeoutError extends LexmountError {
847
851
  /**
848
852
  * Lexmount Node.js SDK.
849
853
  */
850
- declare const VERSION = "0.5.8";
854
+ declare const VERSION = "0.5.10";
851
855
 
852
856
  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
@@ -769,6 +769,10 @@ type IntegratedAuthCallbackResult = {
769
769
  cancel: true;
770
770
  } | {
771
771
  cancel: false;
772
+ skip: true;
773
+ } | {
774
+ cancel: false;
775
+ skip?: false;
772
776
  scheme: string;
773
777
  token: string;
774
778
  };
@@ -847,6 +851,6 @@ declare class TimeoutError extends LexmountError {
847
851
  /**
848
852
  * Lexmount Node.js SDK.
849
853
  */
850
- declare const VERSION = "0.5.8";
854
+ declare const VERSION = "0.5.10";
851
855
 
852
856
  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
- api_key: this.client.apiKey,
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
- api_key: this.client.apiKey,
498
- project_id: projectId ?? this.client.projectId
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
- api_key: this.client.apiKey,
514
- project_id: projectId ?? this.client.projectId
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
- api_key: this.client.apiKey,
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) {
@@ -602,7 +595,11 @@ var SessionsResource = class {
602
595
  return this.createAsync(withRequestedRegion(this.client, payload), options);
603
596
  }
604
597
  const url = `${this.client.baseUrl}/instance`;
605
- const response = await this.client._post(url, withRequestedRegion(this.client, payload));
598
+ const response = await this.client._post(
599
+ url,
600
+ withRequestedRegion(this.client, payload),
601
+ projectHeaders(options.projectId)
602
+ );
606
603
  if (response.status >= 400) {
607
604
  this.handleCreateError(response);
608
605
  }
@@ -634,7 +631,11 @@ var SessionsResource = class {
634
631
  });
635
632
  }
636
633
  async createAsync(payload, options) {
637
- const response = await this.client._post(`${this.client.baseUrl}/instance/v2`, payload);
634
+ const response = await this.client._post(
635
+ `${this.client.baseUrl}/instance/v2`,
636
+ payload,
637
+ projectHeaders(options.projectId)
638
+ );
638
639
  if (response.status >= 400) {
639
640
  this.handleCreateError(response);
640
641
  }
@@ -696,10 +697,8 @@ var SessionsResource = class {
696
697
  */
697
698
  async get(sessionId, projectId) {
698
699
  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
700
  session_id: sessionId
702
- }));
701
+ }), projectHeaders(projectId));
703
702
  if (response.status >= 400) {
704
703
  this.handleGetError(response, sessionId);
705
704
  }
@@ -710,14 +709,15 @@ var SessionsResource = class {
710
709
  */
711
710
  async list(options = {}) {
712
711
  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
- };
712
+ const payload = {};
717
713
  if (options.status) {
718
714
  payload.status = options.status;
719
715
  }
720
- const response = await this.client._post(url, withRequestedRegion(this.client, payload));
716
+ const response = await this.client._post(
717
+ url,
718
+ withRequestedRegion(this.client, payload),
719
+ projectHeaders(options.projectId)
720
+ );
721
721
  if (response.status >= 400) {
722
722
  this.handleListError(response);
723
723
  }
@@ -744,11 +744,9 @@ var SessionsResource = class {
744
744
  async delete(options) {
745
745
  const url = `${this.client.baseUrl}/instance`;
746
746
  const payload = withRequestedRegion(this.client, {
747
- api_key: this.client.apiKey,
748
- project_id: options.projectId ?? this.client.projectId,
749
747
  session_id: options.sessionId
750
748
  });
751
- const response = await this.client._delete(url, payload);
749
+ const response = await this.client._delete(url, payload, projectHeaders(options.projectId));
752
750
  if (response.status >= 400) {
753
751
  this.handleDeleteError(response, options.sessionId);
754
752
  }
@@ -1034,6 +1032,19 @@ async function registerIntegratedAuthCallback(sessionOrClient, callback) {
1034
1032
  );
1035
1033
  return;
1036
1034
  }
1035
+ if (result.skip) {
1036
+ await client.send(
1037
+ "Fetch.continueWithIntegratedAuth",
1038
+ {
1039
+ requestId: params.requestId,
1040
+ authChallengeResponse: {
1041
+ response: "SkipAuth"
1042
+ }
1043
+ },
1044
+ sessionId
1045
+ );
1046
+ return;
1047
+ }
1037
1048
  await client.send(
1038
1049
  "Fetch.continueWithIntegratedAuth",
1039
1050
  {
@@ -1609,8 +1620,8 @@ var Lexmount = class {
1609
1620
  logger2.debug(`${method} request to ${requestUrl}`);
1610
1621
  try {
1611
1622
  const headers = {
1612
- api_key: this.apiKey,
1613
- project_id: this.projectId,
1623
+ "x-api-key": this.apiKey,
1624
+ "x-project-id": this.projectId,
1614
1625
  ...this.getDefaultHeaders(config2.data),
1615
1626
  ...config2.headers ?? {}
1616
1627
  };
@@ -1756,7 +1767,7 @@ var Lexmount = class {
1756
1767
  };
1757
1768
 
1758
1769
  // src/index.ts
1759
- var VERSION = "0.5.8";
1770
+ var VERSION = "0.5.10";
1760
1771
  // Annotate the CommonJS export names for ESM import in node:
1761
1772
  0 && (module.exports = {
1762
1773
  APIError,