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/README.md CHANGED
@@ -88,6 +88,7 @@ Create a session with a persistent context:
88
88
 
89
89
  ```ts
90
90
  const context = await client.contexts.create({
91
+ description: 'Office login context',
91
92
  metadata: { userId: '1001' },
92
93
  });
93
94
 
@@ -142,11 +143,12 @@ Create and inspect contexts:
142
143
 
143
144
  ```ts
144
145
  const context = await client.contexts.create({
146
+ description: 'Demo context',
145
147
  metadata: { owner: 'demo' },
146
148
  });
147
149
 
148
150
  const details = await client.contexts.get(context.id);
149
- console.log(details.status);
151
+ console.log(details.displayName, details.status);
150
152
  ```
151
153
 
152
154
  Fork an available context into a new context:
@@ -443,6 +445,7 @@ const session = await client.sessions.create({
443
445
 
444
446
  ```ts
445
447
  const context = await client.contexts.create({
448
+ description: 'Office login context',
446
449
  metadata: { userId: '1001' },
447
450
  });
448
451
 
@@ -497,11 +500,12 @@ const archive = await client.sessions.downloads.archive(session.id);
497
500
 
498
501
  ```ts
499
502
  const context = await client.contexts.create({
503
+ description: 'Demo context',
500
504
  metadata: { owner: 'demo' },
501
505
  });
502
506
 
503
507
  const details = await client.contexts.get(context.id);
504
- console.log(details.status);
508
+ console.log(details.displayName, details.status);
505
509
  ```
506
510
 
507
511
  基于一个 `available` context 创建新的 fork:
package/dist/index.d.mts CHANGED
@@ -68,6 +68,14 @@ interface SessionContext {
68
68
  * Context access mode.
69
69
  */
70
70
  mode: ContextAccessMode;
71
+ /**
72
+ * Optional context description when passing a ContextInfo-like object.
73
+ */
74
+ description?: string | null;
75
+ /**
76
+ * Optional display name when passing a ContextInfo-like object.
77
+ */
78
+ displayName?: string | null;
71
79
  }
72
80
  /**
73
81
  * Upstream proxy configuration for a session.
@@ -173,6 +181,10 @@ interface SessionCreateOptions {
173
181
  * Optional persistent context configuration.
174
182
  */
175
183
  context?: SessionContext;
184
+ /**
185
+ * Optional description for a context created as part of session creation.
186
+ */
187
+ contextDescription?: string;
176
188
  /**
177
189
  * Optional uploaded browser extension identifiers to mount.
178
190
  */
@@ -181,6 +193,12 @@ interface SessionCreateOptions {
181
193
  * Optional upstream proxy configuration.
182
194
  */
183
195
  proxy?: SessionProxyConfig;
196
+ /**
197
+ * Use the Lexmount official proxy pool for this session.
198
+ *
199
+ * Cannot be used together with `proxy`.
200
+ */
201
+ officialProxy?: boolean;
184
202
  /**
185
203
  * Forward weak_lock to the API when creating sessions with read-write contexts.
186
204
  */
@@ -242,6 +260,10 @@ interface ContextCreateOptions {
242
260
  * Optional metadata used to organize contexts.
243
261
  */
244
262
  metadata?: ContextMetadata;
263
+ /**
264
+ * Optional UTF-8 description used for UI display.
265
+ */
266
+ description?: string;
245
267
  }
246
268
  /**
247
269
  * Context list options.
@@ -367,12 +389,19 @@ declare class ContextInfo {
367
389
  readonly id: string;
368
390
  readonly status: ContextStatus;
369
391
  readonly metadata: ContextMetadata;
392
+ readonly regionId: string | null;
393
+ readonly region_id: string | null;
394
+ readonly description: string | null;
395
+ readonly displayName: string;
370
396
  readonly createdAt: string | null;
371
397
  readonly updatedAt: string | null;
372
398
  constructor(options: {
373
399
  id: string;
374
400
  status: ContextStatus;
375
401
  metadata?: ContextMetadata;
402
+ regionId?: string | null;
403
+ description?: string | null;
404
+ displayName?: string | null;
376
405
  createdAt?: string | null;
377
406
  updatedAt?: string | null;
378
407
  });
@@ -556,6 +585,9 @@ interface SessionInfoOptions {
556
585
  apiKey: string;
557
586
  projectId: string;
558
587
  regionId?: string | null;
588
+ contextId?: string | null;
589
+ contextDescription?: string | null;
590
+ contextDisplayName?: string | null;
559
591
  browserType: BrowserMode | string;
560
592
  createdAt: string;
561
593
  inspectUrl: string;
@@ -574,6 +606,12 @@ declare class SessionInfo {
574
606
  readonly projectId: string;
575
607
  readonly regionId: string | null;
576
608
  readonly region_id: string | null;
609
+ readonly contextId: string | null;
610
+ readonly context_id: string | null;
611
+ readonly contextDescription: string | null;
612
+ readonly context_description: string | null;
613
+ readonly contextDisplayName: string | null;
614
+ readonly context_display_name: string | null;
577
615
  readonly browserType: BrowserMode | string;
578
616
  readonly createdAt: string;
579
617
  readonly inspectUrl: string;
@@ -851,6 +889,6 @@ declare class TimeoutError extends LexmountError {
851
889
  /**
852
890
  * Lexmount Node.js SDK.
853
891
  */
854
- declare const VERSION = "0.5.10";
892
+ declare const VERSION = "0.5.13";
855
893
 
856
894
  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
@@ -68,6 +68,14 @@ interface SessionContext {
68
68
  * Context access mode.
69
69
  */
70
70
  mode: ContextAccessMode;
71
+ /**
72
+ * Optional context description when passing a ContextInfo-like object.
73
+ */
74
+ description?: string | null;
75
+ /**
76
+ * Optional display name when passing a ContextInfo-like object.
77
+ */
78
+ displayName?: string | null;
71
79
  }
72
80
  /**
73
81
  * Upstream proxy configuration for a session.
@@ -173,6 +181,10 @@ interface SessionCreateOptions {
173
181
  * Optional persistent context configuration.
174
182
  */
175
183
  context?: SessionContext;
184
+ /**
185
+ * Optional description for a context created as part of session creation.
186
+ */
187
+ contextDescription?: string;
176
188
  /**
177
189
  * Optional uploaded browser extension identifiers to mount.
178
190
  */
@@ -181,6 +193,12 @@ interface SessionCreateOptions {
181
193
  * Optional upstream proxy configuration.
182
194
  */
183
195
  proxy?: SessionProxyConfig;
196
+ /**
197
+ * Use the Lexmount official proxy pool for this session.
198
+ *
199
+ * Cannot be used together with `proxy`.
200
+ */
201
+ officialProxy?: boolean;
184
202
  /**
185
203
  * Forward weak_lock to the API when creating sessions with read-write contexts.
186
204
  */
@@ -242,6 +260,10 @@ interface ContextCreateOptions {
242
260
  * Optional metadata used to organize contexts.
243
261
  */
244
262
  metadata?: ContextMetadata;
263
+ /**
264
+ * Optional UTF-8 description used for UI display.
265
+ */
266
+ description?: string;
245
267
  }
246
268
  /**
247
269
  * Context list options.
@@ -367,12 +389,19 @@ declare class ContextInfo {
367
389
  readonly id: string;
368
390
  readonly status: ContextStatus;
369
391
  readonly metadata: ContextMetadata;
392
+ readonly regionId: string | null;
393
+ readonly region_id: string | null;
394
+ readonly description: string | null;
395
+ readonly displayName: string;
370
396
  readonly createdAt: string | null;
371
397
  readonly updatedAt: string | null;
372
398
  constructor(options: {
373
399
  id: string;
374
400
  status: ContextStatus;
375
401
  metadata?: ContextMetadata;
402
+ regionId?: string | null;
403
+ description?: string | null;
404
+ displayName?: string | null;
376
405
  createdAt?: string | null;
377
406
  updatedAt?: string | null;
378
407
  });
@@ -556,6 +585,9 @@ interface SessionInfoOptions {
556
585
  apiKey: string;
557
586
  projectId: string;
558
587
  regionId?: string | null;
588
+ contextId?: string | null;
589
+ contextDescription?: string | null;
590
+ contextDisplayName?: string | null;
559
591
  browserType: BrowserMode | string;
560
592
  createdAt: string;
561
593
  inspectUrl: string;
@@ -574,6 +606,12 @@ declare class SessionInfo {
574
606
  readonly projectId: string;
575
607
  readonly regionId: string | null;
576
608
  readonly region_id: string | null;
609
+ readonly contextId: string | null;
610
+ readonly context_id: string | null;
611
+ readonly contextDescription: string | null;
612
+ readonly context_description: string | null;
613
+ readonly contextDisplayName: string | null;
614
+ readonly context_display_name: string | null;
577
615
  readonly browserType: BrowserMode | string;
578
616
  readonly createdAt: string;
579
617
  readonly inspectUrl: string;
@@ -851,6 +889,6 @@ declare class TimeoutError extends LexmountError {
851
889
  /**
852
890
  * Lexmount Node.js SDK.
853
891
  */
854
- declare const VERSION = "0.5.10";
892
+ declare const VERSION = "0.5.13";
855
893
 
856
894
  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
@@ -356,6 +356,12 @@ var SessionInfo = class {
356
356
  this.projectId = options.projectId;
357
357
  this.regionId = options.regionId ?? null;
358
358
  this.region_id = this.regionId;
359
+ this.contextId = options.contextId ?? null;
360
+ this.context_id = this.contextId;
361
+ this.contextDescription = options.contextDescription ?? null;
362
+ this.context_description = this.contextDescription;
363
+ this.contextDisplayName = options.contextDisplayName ?? this.contextDescription ?? this.contextId;
364
+ this.context_display_name = this.contextDisplayName;
359
365
  this.browserType = options.browserType;
360
366
  this.createdAt = options.createdAt;
361
367
  this.inspectUrl = options.inspectUrl;
@@ -576,6 +582,9 @@ var SessionsResource = class {
576
582
  mode: normalizeContextMode(options.context.mode)
577
583
  };
578
584
  payload.context = contextPayload;
585
+ if (options.contextDescription !== void 0) {
586
+ payload.context_description = options.contextDescription;
587
+ }
579
588
  getLogger().debug(
580
589
  `Creating session with context (id=${options.context.id}, mode=${contextPayload.mode})`
581
590
  );
@@ -588,6 +597,12 @@ var SessionsResource = class {
588
597
  if (options.proxy) {
589
598
  payload.proxy = this.normalizeProxy(options.proxy);
590
599
  }
600
+ if (options.officialProxy) {
601
+ if (options.proxy) {
602
+ throw new ValidationError("officialProxy cannot be used together with proxy");
603
+ }
604
+ payload.official_proxy = true;
605
+ }
591
606
  if (options.weakLock) {
592
607
  payload.weak_lock = true;
593
608
  }
@@ -622,6 +637,9 @@ var SessionsResource = class {
622
637
  apiKey: this.client.apiKey,
623
638
  projectId,
624
639
  regionId: createdSession?.regionId ?? this.client.selectedRegion ?? this.client.region ?? null,
640
+ contextId: createdSession?.contextId ?? options.context?.id ?? null,
641
+ contextDescription: createdSession?.contextDescription ?? options.context?.description ?? null,
642
+ contextDisplayName: createdSession?.contextDisplayName ?? options.context?.displayName ?? null,
625
643
  browserType: createdSession?.browserType ?? (options.browserMode ?? "normal"),
626
644
  createdAt: createdSession?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
627
645
  inspectUrl: createdSession?.inspectUrl ?? `${this.client.baseUrl}/inspect?session_id=${sessionId}`,
@@ -662,6 +680,9 @@ var SessionsResource = class {
662
680
  apiKey: this.client.apiKey,
663
681
  projectId,
664
682
  regionId: info.regionId ?? this.client.selectedRegion ?? this.client.region ?? null,
683
+ contextId: info.contextId ?? options.context?.id ?? null,
684
+ contextDescription: info.contextDescription ?? options.context?.description ?? null,
685
+ contextDisplayName: info.contextDisplayName ?? options.context?.displayName ?? null,
665
686
  browserType: info.browserType || (options.browserMode ?? "normal"),
666
687
  createdAt: info.createdAt,
667
688
  inspectUrl: info.inspectUrl,
@@ -926,6 +947,9 @@ var SessionsResource = class {
926
947
  apiKey: getString(raw.api_key) ?? this.client.apiKey,
927
948
  projectId: getString(raw.project_id) ?? (projectId ?? this.client.projectId),
928
949
  regionId: getString(raw.region_id) ?? this.client.selectedRegion ?? this.client.region ?? null,
950
+ contextId: getString(raw.context_id) ?? null,
951
+ contextDescription: getString(raw.context_description) ?? null,
952
+ contextDisplayName: getString(raw.context_display_name) ?? null,
929
953
  browserType: getString(raw.browser_type) ?? getString(raw.browser_mode) ?? "normal",
930
954
  createdAt: getString(raw.created_at) ?? "",
931
955
  inspectUrl: getString(raw.inspect_url) ?? `${this.client.baseUrl}/inspect?session_id=${sessionId}`,
@@ -1126,6 +1150,10 @@ var ContextInfo = class {
1126
1150
  this.id = options.id;
1127
1151
  this.status = options.status;
1128
1152
  this.metadata = options.metadata ?? {};
1153
+ this.regionId = options.regionId ?? null;
1154
+ this.region_id = this.regionId;
1155
+ this.description = options.description ?? null;
1156
+ this.displayName = options.displayName ?? options.description ?? options.id;
1129
1157
  this.createdAt = options.createdAt ?? null;
1130
1158
  this.updatedAt = options.updatedAt ?? null;
1131
1159
  }
@@ -1180,6 +1208,9 @@ var ContextsResource = class {
1180
1208
  if (options.metadata) {
1181
1209
  payload.metadata = options.metadata;
1182
1210
  }
1211
+ if (options.description !== void 0) {
1212
+ payload.description = options.description;
1213
+ }
1183
1214
  const response = await this.client._post(url, payload);
1184
1215
  if (response.status >= 400) {
1185
1216
  this.handleError(response, "create");
@@ -1196,6 +1227,9 @@ var ContextsResource = class {
1196
1227
  id: contextId,
1197
1228
  status: normalizeContextStatus(result.locked),
1198
1229
  metadata: result.metadata ?? options.metadata ?? {},
1230
+ regionId: getString2(result.region_id) ?? null,
1231
+ description: getString2(result.description) ?? null,
1232
+ displayName: getString2(result.display_name) ?? null,
1199
1233
  createdAt: parseTimestamp(result.created_at)
1200
1234
  });
1201
1235
  getLogger().info(`Successfully created context '${context.id}'`);
@@ -1226,7 +1260,10 @@ var ContextsResource = class {
1226
1260
  status: normalizeContextStatus(context.locked),
1227
1261
  createdAt: parseTimestamp(context.created_at),
1228
1262
  updatedAt: parseTimestamp(context.updated_at),
1229
- metadata: context.metadata ?? {}
1263
+ metadata: context.metadata ?? {},
1264
+ regionId: getString2(context.region_id) ?? null,
1265
+ description: getString2(context.description) ?? null,
1266
+ displayName: getString2(context.display_name) ?? null
1230
1267
  });
1231
1268
  }) : [];
1232
1269
  getLogger().info(`Retrieved ${contexts.length} contexts`);
@@ -1251,6 +1288,9 @@ var ContextsResource = class {
1251
1288
  id: getString2(context.context_id) ?? contextId,
1252
1289
  status: normalizeContextStatus(context.locked),
1253
1290
  metadata: context.metadata ?? {},
1291
+ regionId: getString2(context.region_id) ?? null,
1292
+ description: getString2(context.description) ?? null,
1293
+ displayName: getString2(context.display_name) ?? null,
1254
1294
  createdAt: parseTimestamp(context.created_at),
1255
1295
  updatedAt: parseTimestamp(context.updated_at)
1256
1296
  });
@@ -1282,6 +1322,9 @@ var ContextsResource = class {
1282
1322
  id: forkedContextId,
1283
1323
  status: normalizeContextStatus(result.locked),
1284
1324
  metadata: result.metadata ?? {},
1325
+ regionId: getString2(result.region_id) ?? null,
1326
+ description: getString2(result.description) ?? null,
1327
+ displayName: getString2(result.display_name) ?? null,
1285
1328
  createdAt: parseTimestamp(result.created_at),
1286
1329
  updatedAt: parseTimestamp(result.updated_at)
1287
1330
  });
@@ -1767,7 +1810,7 @@ var Lexmount = class {
1767
1810
  };
1768
1811
 
1769
1812
  // src/index.ts
1770
- var VERSION = "0.5.10";
1813
+ var VERSION = "0.5.13";
1771
1814
  // Annotate the CommonJS export names for ESM import in node:
1772
1815
  0 && (module.exports = {
1773
1816
  APIError,