lexmount 0.5.10 → 0.5.13

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.mjs CHANGED
@@ -286,6 +286,12 @@ var SessionInfo = class {
286
286
  this.projectId = options.projectId;
287
287
  this.regionId = options.regionId ?? null;
288
288
  this.region_id = this.regionId;
289
+ this.contextId = options.contextId ?? null;
290
+ this.context_id = this.contextId;
291
+ this.contextDescription = options.contextDescription ?? null;
292
+ this.context_description = this.contextDescription;
293
+ this.contextDisplayName = options.contextDisplayName ?? this.contextDescription ?? this.contextId;
294
+ this.context_display_name = this.contextDisplayName;
289
295
  this.browserType = options.browserType;
290
296
  this.createdAt = options.createdAt;
291
297
  this.inspectUrl = options.inspectUrl;
@@ -506,6 +512,9 @@ var SessionsResource = class {
506
512
  mode: normalizeContextMode(options.context.mode)
507
513
  };
508
514
  payload.context = contextPayload;
515
+ if (options.contextDescription !== void 0) {
516
+ payload.context_description = options.contextDescription;
517
+ }
509
518
  getLogger().debug(
510
519
  `Creating session with context (id=${options.context.id}, mode=${contextPayload.mode})`
511
520
  );
@@ -518,6 +527,12 @@ var SessionsResource = class {
518
527
  if (options.proxy) {
519
528
  payload.proxy = this.normalizeProxy(options.proxy);
520
529
  }
530
+ if (options.officialProxy) {
531
+ if (options.proxy) {
532
+ throw new ValidationError("officialProxy cannot be used together with proxy");
533
+ }
534
+ payload.official_proxy = true;
535
+ }
521
536
  if (options.weakLock) {
522
537
  payload.weak_lock = true;
523
538
  }
@@ -552,6 +567,9 @@ var SessionsResource = class {
552
567
  apiKey: this.client.apiKey,
553
568
  projectId,
554
569
  regionId: createdSession?.regionId ?? this.client.selectedRegion ?? this.client.region ?? null,
570
+ contextId: createdSession?.contextId ?? options.context?.id ?? null,
571
+ contextDescription: createdSession?.contextDescription ?? options.context?.description ?? null,
572
+ contextDisplayName: createdSession?.contextDisplayName ?? options.context?.displayName ?? null,
555
573
  browserType: createdSession?.browserType ?? (options.browserMode ?? "normal"),
556
574
  createdAt: createdSession?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
557
575
  inspectUrl: createdSession?.inspectUrl ?? `${this.client.baseUrl}/inspect?session_id=${sessionId}`,
@@ -592,6 +610,9 @@ var SessionsResource = class {
592
610
  apiKey: this.client.apiKey,
593
611
  projectId,
594
612
  regionId: info.regionId ?? this.client.selectedRegion ?? this.client.region ?? null,
613
+ contextId: info.contextId ?? options.context?.id ?? null,
614
+ contextDescription: info.contextDescription ?? options.context?.description ?? null,
615
+ contextDisplayName: info.contextDisplayName ?? options.context?.displayName ?? null,
595
616
  browserType: info.browserType || (options.browserMode ?? "normal"),
596
617
  createdAt: info.createdAt,
597
618
  inspectUrl: info.inspectUrl,
@@ -856,6 +877,9 @@ var SessionsResource = class {
856
877
  apiKey: getString(raw.api_key) ?? this.client.apiKey,
857
878
  projectId: getString(raw.project_id) ?? (projectId ?? this.client.projectId),
858
879
  regionId: getString(raw.region_id) ?? this.client.selectedRegion ?? this.client.region ?? null,
880
+ contextId: getString(raw.context_id) ?? null,
881
+ contextDescription: getString(raw.context_description) ?? null,
882
+ contextDisplayName: getString(raw.context_display_name) ?? null,
859
883
  browserType: getString(raw.browser_type) ?? getString(raw.browser_mode) ?? "normal",
860
884
  createdAt: getString(raw.created_at) ?? "",
861
885
  inspectUrl: getString(raw.inspect_url) ?? `${this.client.baseUrl}/inspect?session_id=${sessionId}`,
@@ -1056,6 +1080,10 @@ var ContextInfo = class {
1056
1080
  this.id = options.id;
1057
1081
  this.status = options.status;
1058
1082
  this.metadata = options.metadata ?? {};
1083
+ this.regionId = options.regionId ?? null;
1084
+ this.region_id = this.regionId;
1085
+ this.description = options.description ?? null;
1086
+ this.displayName = options.displayName ?? options.description ?? options.id;
1059
1087
  this.createdAt = options.createdAt ?? null;
1060
1088
  this.updatedAt = options.updatedAt ?? null;
1061
1089
  }
@@ -1110,6 +1138,9 @@ var ContextsResource = class {
1110
1138
  if (options.metadata) {
1111
1139
  payload.metadata = options.metadata;
1112
1140
  }
1141
+ if (options.description !== void 0) {
1142
+ payload.description = options.description;
1143
+ }
1113
1144
  const response = await this.client._post(url, payload);
1114
1145
  if (response.status >= 400) {
1115
1146
  this.handleError(response, "create");
@@ -1126,6 +1157,9 @@ var ContextsResource = class {
1126
1157
  id: contextId,
1127
1158
  status: normalizeContextStatus(result.locked),
1128
1159
  metadata: result.metadata ?? options.metadata ?? {},
1160
+ regionId: getString2(result.region_id) ?? null,
1161
+ description: getString2(result.description) ?? null,
1162
+ displayName: getString2(result.display_name) ?? null,
1129
1163
  createdAt: parseTimestamp(result.created_at)
1130
1164
  });
1131
1165
  getLogger().info(`Successfully created context '${context.id}'`);
@@ -1156,7 +1190,10 @@ var ContextsResource = class {
1156
1190
  status: normalizeContextStatus(context.locked),
1157
1191
  createdAt: parseTimestamp(context.created_at),
1158
1192
  updatedAt: parseTimestamp(context.updated_at),
1159
- metadata: context.metadata ?? {}
1193
+ metadata: context.metadata ?? {},
1194
+ regionId: getString2(context.region_id) ?? null,
1195
+ description: getString2(context.description) ?? null,
1196
+ displayName: getString2(context.display_name) ?? null
1160
1197
  });
1161
1198
  }) : [];
1162
1199
  getLogger().info(`Retrieved ${contexts.length} contexts`);
@@ -1181,6 +1218,9 @@ var ContextsResource = class {
1181
1218
  id: getString2(context.context_id) ?? contextId,
1182
1219
  status: normalizeContextStatus(context.locked),
1183
1220
  metadata: context.metadata ?? {},
1221
+ regionId: getString2(context.region_id) ?? null,
1222
+ description: getString2(context.description) ?? null,
1223
+ displayName: getString2(context.display_name) ?? null,
1184
1224
  createdAt: parseTimestamp(context.created_at),
1185
1225
  updatedAt: parseTimestamp(context.updated_at)
1186
1226
  });
@@ -1212,6 +1252,9 @@ var ContextsResource = class {
1212
1252
  id: forkedContextId,
1213
1253
  status: normalizeContextStatus(result.locked),
1214
1254
  metadata: result.metadata ?? {},
1255
+ regionId: getString2(result.region_id) ?? null,
1256
+ description: getString2(result.description) ?? null,
1257
+ displayName: getString2(result.display_name) ?? null,
1215
1258
  createdAt: parseTimestamp(result.created_at),
1216
1259
  updatedAt: parseTimestamp(result.updated_at)
1217
1260
  });
@@ -1697,7 +1740,7 @@ var Lexmount = class {
1697
1740
  };
1698
1741
 
1699
1742
  // src/index.ts
1700
- var VERSION = "0.5.10";
1743
+ var VERSION = "0.5.13";
1701
1744
  export {
1702
1745
  APIError,
1703
1746
  AuthenticationError,