lexmount 0.5.11 → 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
  */
@@ -248,6 +260,10 @@ interface ContextCreateOptions {
248
260
  * Optional metadata used to organize contexts.
249
261
  */
250
262
  metadata?: ContextMetadata;
263
+ /**
264
+ * Optional UTF-8 description used for UI display.
265
+ */
266
+ description?: string;
251
267
  }
252
268
  /**
253
269
  * Context list options.
@@ -373,12 +389,19 @@ declare class ContextInfo {
373
389
  readonly id: string;
374
390
  readonly status: ContextStatus;
375
391
  readonly metadata: ContextMetadata;
392
+ readonly regionId: string | null;
393
+ readonly region_id: string | null;
394
+ readonly description: string | null;
395
+ readonly displayName: string;
376
396
  readonly createdAt: string | null;
377
397
  readonly updatedAt: string | null;
378
398
  constructor(options: {
379
399
  id: string;
380
400
  status: ContextStatus;
381
401
  metadata?: ContextMetadata;
402
+ regionId?: string | null;
403
+ description?: string | null;
404
+ displayName?: string | null;
382
405
  createdAt?: string | null;
383
406
  updatedAt?: string | null;
384
407
  });
@@ -562,6 +585,9 @@ interface SessionInfoOptions {
562
585
  apiKey: string;
563
586
  projectId: string;
564
587
  regionId?: string | null;
588
+ contextId?: string | null;
589
+ contextDescription?: string | null;
590
+ contextDisplayName?: string | null;
565
591
  browserType: BrowserMode | string;
566
592
  createdAt: string;
567
593
  inspectUrl: string;
@@ -580,6 +606,12 @@ declare class SessionInfo {
580
606
  readonly projectId: string;
581
607
  readonly regionId: string | null;
582
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;
583
615
  readonly browserType: BrowserMode | string;
584
616
  readonly createdAt: string;
585
617
  readonly inspectUrl: string;
@@ -857,6 +889,6 @@ declare class TimeoutError extends LexmountError {
857
889
  /**
858
890
  * Lexmount Node.js SDK.
859
891
  */
860
- declare const VERSION = "0.5.10";
892
+ declare const VERSION = "0.5.13";
861
893
 
862
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
  */
@@ -248,6 +260,10 @@ interface ContextCreateOptions {
248
260
  * Optional metadata used to organize contexts.
249
261
  */
250
262
  metadata?: ContextMetadata;
263
+ /**
264
+ * Optional UTF-8 description used for UI display.
265
+ */
266
+ description?: string;
251
267
  }
252
268
  /**
253
269
  * Context list options.
@@ -373,12 +389,19 @@ declare class ContextInfo {
373
389
  readonly id: string;
374
390
  readonly status: ContextStatus;
375
391
  readonly metadata: ContextMetadata;
392
+ readonly regionId: string | null;
393
+ readonly region_id: string | null;
394
+ readonly description: string | null;
395
+ readonly displayName: string;
376
396
  readonly createdAt: string | null;
377
397
  readonly updatedAt: string | null;
378
398
  constructor(options: {
379
399
  id: string;
380
400
  status: ContextStatus;
381
401
  metadata?: ContextMetadata;
402
+ regionId?: string | null;
403
+ description?: string | null;
404
+ displayName?: string | null;
382
405
  createdAt?: string | null;
383
406
  updatedAt?: string | null;
384
407
  });
@@ -562,6 +585,9 @@ interface SessionInfoOptions {
562
585
  apiKey: string;
563
586
  projectId: string;
564
587
  regionId?: string | null;
588
+ contextId?: string | null;
589
+ contextDescription?: string | null;
590
+ contextDisplayName?: string | null;
565
591
  browserType: BrowserMode | string;
566
592
  createdAt: string;
567
593
  inspectUrl: string;
@@ -580,6 +606,12 @@ declare class SessionInfo {
580
606
  readonly projectId: string;
581
607
  readonly regionId: string | null;
582
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;
583
615
  readonly browserType: BrowserMode | string;
584
616
  readonly createdAt: string;
585
617
  readonly inspectUrl: string;
@@ -857,6 +889,6 @@ declare class TimeoutError extends LexmountError {
857
889
  /**
858
890
  * Lexmount Node.js SDK.
859
891
  */
860
- declare const VERSION = "0.5.10";
892
+ declare const VERSION = "0.5.13";
861
893
 
862
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
  );
@@ -628,6 +637,9 @@ var SessionsResource = class {
628
637
  apiKey: this.client.apiKey,
629
638
  projectId,
630
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,
631
643
  browserType: createdSession?.browserType ?? (options.browserMode ?? "normal"),
632
644
  createdAt: createdSession?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
633
645
  inspectUrl: createdSession?.inspectUrl ?? `${this.client.baseUrl}/inspect?session_id=${sessionId}`,
@@ -668,6 +680,9 @@ var SessionsResource = class {
668
680
  apiKey: this.client.apiKey,
669
681
  projectId,
670
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,
671
686
  browserType: info.browserType || (options.browserMode ?? "normal"),
672
687
  createdAt: info.createdAt,
673
688
  inspectUrl: info.inspectUrl,
@@ -932,6 +947,9 @@ var SessionsResource = class {
932
947
  apiKey: getString(raw.api_key) ?? this.client.apiKey,
933
948
  projectId: getString(raw.project_id) ?? (projectId ?? this.client.projectId),
934
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,
935
953
  browserType: getString(raw.browser_type) ?? getString(raw.browser_mode) ?? "normal",
936
954
  createdAt: getString(raw.created_at) ?? "",
937
955
  inspectUrl: getString(raw.inspect_url) ?? `${this.client.baseUrl}/inspect?session_id=${sessionId}`,
@@ -1132,6 +1150,10 @@ var ContextInfo = class {
1132
1150
  this.id = options.id;
1133
1151
  this.status = options.status;
1134
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;
1135
1157
  this.createdAt = options.createdAt ?? null;
1136
1158
  this.updatedAt = options.updatedAt ?? null;
1137
1159
  }
@@ -1186,6 +1208,9 @@ var ContextsResource = class {
1186
1208
  if (options.metadata) {
1187
1209
  payload.metadata = options.metadata;
1188
1210
  }
1211
+ if (options.description !== void 0) {
1212
+ payload.description = options.description;
1213
+ }
1189
1214
  const response = await this.client._post(url, payload);
1190
1215
  if (response.status >= 400) {
1191
1216
  this.handleError(response, "create");
@@ -1202,6 +1227,9 @@ var ContextsResource = class {
1202
1227
  id: contextId,
1203
1228
  status: normalizeContextStatus(result.locked),
1204
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,
1205
1233
  createdAt: parseTimestamp(result.created_at)
1206
1234
  });
1207
1235
  getLogger().info(`Successfully created context '${context.id}'`);
@@ -1232,7 +1260,10 @@ var ContextsResource = class {
1232
1260
  status: normalizeContextStatus(context.locked),
1233
1261
  createdAt: parseTimestamp(context.created_at),
1234
1262
  updatedAt: parseTimestamp(context.updated_at),
1235
- 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
1236
1267
  });
1237
1268
  }) : [];
1238
1269
  getLogger().info(`Retrieved ${contexts.length} contexts`);
@@ -1257,6 +1288,9 @@ var ContextsResource = class {
1257
1288
  id: getString2(context.context_id) ?? contextId,
1258
1289
  status: normalizeContextStatus(context.locked),
1259
1290
  metadata: context.metadata ?? {},
1291
+ regionId: getString2(context.region_id) ?? null,
1292
+ description: getString2(context.description) ?? null,
1293
+ displayName: getString2(context.display_name) ?? null,
1260
1294
  createdAt: parseTimestamp(context.created_at),
1261
1295
  updatedAt: parseTimestamp(context.updated_at)
1262
1296
  });
@@ -1288,6 +1322,9 @@ var ContextsResource = class {
1288
1322
  id: forkedContextId,
1289
1323
  status: normalizeContextStatus(result.locked),
1290
1324
  metadata: result.metadata ?? {},
1325
+ regionId: getString2(result.region_id) ?? null,
1326
+ description: getString2(result.description) ?? null,
1327
+ displayName: getString2(result.display_name) ?? null,
1291
1328
  createdAt: parseTimestamp(result.created_at),
1292
1329
  updatedAt: parseTimestamp(result.updated_at)
1293
1330
  });
@@ -1773,7 +1810,7 @@ var Lexmount = class {
1773
1810
  };
1774
1811
 
1775
1812
  // src/index.ts
1776
- var VERSION = "0.5.10";
1813
+ var VERSION = "0.5.13";
1777
1814
  // Annotate the CommonJS export names for ESM import in node:
1778
1815
  0 && (module.exports = {
1779
1816
  APIError,