instavm 0.13.0 → 0.15.0

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.ts CHANGED
@@ -721,6 +721,24 @@ interface SSHKey {
721
721
  createdAt: string;
722
722
  }
723
723
 
724
+ interface CurrentUserResponse extends Record<string, any> {
725
+ id: number;
726
+ name: string;
727
+ email: string;
728
+ is_verified: boolean;
729
+ }
730
+ interface SessionStatusResponse extends Record<string, any> {
731
+ session_id: string;
732
+ exists: boolean;
733
+ vm_assigned: boolean;
734
+ vm_status?: string | null;
735
+ vm_id?: string | null;
736
+ vm_alive: boolean;
737
+ uptime_seconds?: number | null;
738
+ expires_in_seconds?: number | null;
739
+ created_at?: string | null;
740
+ }
741
+
724
742
  interface InstaVMOptions {
725
743
  baseURL?: string;
726
744
  /**
@@ -832,6 +850,14 @@ declare class InstaVM {
832
850
  * Get usage statistics for a session
833
851
  */
834
852
  getUsage(sessionId?: string): Promise<UsageStats>;
853
+ /**
854
+ * Get the current user profile.
855
+ */
856
+ getCurrentUser(): Promise<CurrentUserResponse>;
857
+ /**
858
+ * Get the current status of a session.
859
+ */
860
+ getSessionStatus(sessionId?: string): Promise<SessionStatusResponse>;
835
861
  /**
836
862
  * Download a file from the remote VM
837
863
  */
@@ -990,4 +1016,4 @@ declare class UnsupportedOperationError extends InstaVMError {
990
1016
  constructor(message?: string, options?: any);
991
1017
  }
992
1018
 
993
- export { type APIKey, type APIKeyCreateRequest, APIKeysManager, type ApiResponse, type AsyncExecutionResult, type AuditEventQuery, AuditManager, AuthenticationError, BrowserError, BrowserInteractionError, BrowserManager, BrowserNavigationError, BrowserSession, BrowserSessionError, type BrowserSessionInfo, type BrowserSessionOptions, BrowserTimeoutError, type ClickOptions, ComputerUseManager, type ComputerUseProxyOptions, type ContentAnchor, type CustomDomainCreateRequest, CustomDomainsManager, type DownloadOptions, type DownloadResult, type EgressPolicy, type EgressPolicyOptions, ElementNotFoundError, type ExecuteOptions, ExecutionError, type ExecutionResult, type ExtractContentOptions, type ExtractOptions, type ExtractedContent, type ExtractedElement, type FileUpload, type FillOptions, type HttpClientConfig, InstaVM, InstaVMError, type InstaVMOptions, type InteractiveElement, type JsonMap, type NavigateOptions, type NavigationResult, NetworkError, QuotaExceededError, RateLimitError, type RequestConfig, type RetryConfig, type SSHKey, type ScreenshotOptions, type ScrollOptions, SessionError, type ShareCreateRequest, type ShareUpdateRequest, SharesManager, type SnapshotBuildArgs, type SnapshotCreateRequest, type SnapshotQueryOptions, SnapshotsManager, type TypeOptions, UnsupportedOperationError, type UploadOptions, type UploadResult, type UsageStats, type VMCloneRequest, type VMCreateRequest, type VMMountedVolumeResponse, type VMSnapshotRequest, type VMUpdateRequest, type VMVolumeMountRequest, VMsManager, type VolumeCheckpointCreateRequest, type VolumeCheckpointResponse, type VolumeCreateRequest, type VolumeFileDownloadResponse, type VolumeFileEntry, type VolumeFileListQuery, type VolumeFileUploadRequest, type VolumeResponse, type VolumeUpdateRequest, VolumesManager, type WaitCondition, type WebhookDeliveryQuery, type WebhookEndpointCreateRequest, type WebhookEndpointUpdateRequest, WebhooksManager };
1019
+ export { type APIKey, type APIKeyCreateRequest, APIKeysManager, type ApiResponse, type AsyncExecutionResult, type AuditEventQuery, AuditManager, AuthenticationError, BrowserError, BrowserInteractionError, BrowserManager, BrowserNavigationError, BrowserSession, BrowserSessionError, type BrowserSessionInfo, type BrowserSessionOptions, BrowserTimeoutError, type ClickOptions, ComputerUseManager, type ComputerUseProxyOptions, type ContentAnchor, type CurrentUserResponse, type CustomDomainCreateRequest, CustomDomainsManager, type DownloadOptions, type DownloadResult, type EgressPolicy, type EgressPolicyOptions, ElementNotFoundError, type ExecuteOptions, ExecutionError, type ExecutionResult, type ExtractContentOptions, type ExtractOptions, type ExtractedContent, type ExtractedElement, type FileUpload, type FillOptions, type HttpClientConfig, InstaVM, InstaVMError, type InstaVMOptions, type InteractiveElement, type JsonMap, type NavigateOptions, type NavigationResult, NetworkError, QuotaExceededError, RateLimitError, type RequestConfig, type RetryConfig, type SSHKey, type ScreenshotOptions, type ScrollOptions, SessionError, type SessionStatusResponse, type ShareCreateRequest, type ShareUpdateRequest, SharesManager, type SnapshotBuildArgs, type SnapshotCreateRequest, type SnapshotQueryOptions, SnapshotsManager, type TypeOptions, UnsupportedOperationError, type UploadOptions, type UploadResult, type UsageStats, type VMCloneRequest, type VMCreateRequest, type VMMountedVolumeResponse, type VMSnapshotRequest, type VMUpdateRequest, type VMVolumeMountRequest, VMsManager, type VolumeCheckpointCreateRequest, type VolumeCheckpointResponse, type VolumeCreateRequest, type VolumeFileDownloadResponse, type VolumeFileEntry, type VolumeFileListQuery, type VolumeFileUploadRequest, type VolumeResponse, type VolumeUpdateRequest, VolumesManager, type WaitCondition, type WebhookDeliveryQuery, type WebhookEndpointCreateRequest, type WebhookEndpointUpdateRequest, WebhooksManager };
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- "use strict";
3
2
  var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -199,7 +198,7 @@ var HTTPClient = class {
199
198
  timeout: config.timeout,
200
199
  headers: {
201
200
  "Content-Type": "application/json",
202
- "User-Agent": "instavm-js-sdk/0.12.0"
201
+ "User-Agent": "instavm-js-sdk/0.15.0"
203
202
  }
204
203
  });
205
204
  this.setupInterceptors();
@@ -2046,7 +2045,9 @@ var InstaVM = class {
2046
2045
  }
2047
2046
  try {
2048
2047
  const response = await this.httpClient.get(
2049
- `/v1/sessions/usage/${targetSessionId}`
2048
+ `/v1/sessions/usage/${targetSessionId}`,
2049
+ void 0,
2050
+ { "X-API-Key": this.httpClient.apiKey }
2050
2051
  );
2051
2052
  return {
2052
2053
  sessionsUsed: response.sessions_used || 0,
@@ -2062,6 +2063,32 @@ var InstaVM = class {
2062
2063
  );
2063
2064
  }
2064
2065
  }
2066
+ /**
2067
+ * Get the current user profile.
2068
+ */
2069
+ async getCurrentUser() {
2070
+ this.ensureNotLocal("User profile lookup");
2071
+ return this.httpClient.get(
2072
+ "/v1/me",
2073
+ void 0,
2074
+ { "X-API-Key": this.httpClient.apiKey }
2075
+ );
2076
+ }
2077
+ /**
2078
+ * Get the current status of a session.
2079
+ */
2080
+ async getSessionStatus(sessionId) {
2081
+ this.ensureNotLocal("Session management");
2082
+ const targetSessionId = sessionId || this._sessionId;
2083
+ if (!targetSessionId) {
2084
+ throw new SessionError("Session ID not set. Please create a session first.");
2085
+ }
2086
+ return this.httpClient.get(
2087
+ `/v1/sessions/status/${targetSessionId}`,
2088
+ void 0,
2089
+ { "X-API-Key": this.httpClient.apiKey }
2090
+ );
2091
+ }
2065
2092
  /**
2066
2093
  * Download a file from the remote VM
2067
2094
  */