@haex-space/vault-sdk 2.5.0 → 2.5.4

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.
@@ -254,6 +254,68 @@ interface PendingAuthorization {
254
254
  * Decision type for external authorization prompts
255
255
  */
256
256
  type ExternalAuthDecision = 'allow' | 'deny';
257
+ /**
258
+ * Connection state for external clients connecting to haex-vault via WebSocket.
259
+ * Used by browser extensions, CLI tools, servers, and other external clients.
260
+ */
261
+ declare enum ExternalConnectionState {
262
+ /** Not connected to haex-vault */
263
+ DISCONNECTED = "disconnected",
264
+ /** Attempting to establish connection */
265
+ CONNECTING = "connecting",
266
+ /** WebSocket connected but not yet authorized */
267
+ CONNECTED = "connected",
268
+ /** Connected and waiting for user approval in haex-vault */
269
+ PENDING_APPROVAL = "pending_approval",
270
+ /** Connected and authorized to communicate */
271
+ PAIRED = "paired"
272
+ }
273
+ /**
274
+ * Error codes for external client connections.
275
+ * Used to identify specific error conditions for i18n in the frontend.
276
+ */
277
+ declare enum ExternalConnectionErrorCode {
278
+ /** No error */
279
+ NONE = "none",
280
+ /** Client is not authorized (rejected or not yet approved) */
281
+ CLIENT_NOT_AUTHORIZED = "client_not_authorized",
282
+ /** Client was blocked by the user */
283
+ CLIENT_BLOCKED = "client_blocked",
284
+ /** Connection to haex-vault failed (not running or network error) */
285
+ CONNECTION_FAILED = "connection_failed",
286
+ /** Connection timed out */
287
+ CONNECTION_TIMEOUT = "connection_timeout",
288
+ /** WebSocket connection was closed unexpectedly */
289
+ CONNECTION_CLOSED = "connection_closed",
290
+ /** Failed to decrypt message (invalid key or corrupted data) */
291
+ DECRYPTION_FAILED = "decryption_failed",
292
+ /** Invalid message format received */
293
+ INVALID_MESSAGE = "invalid_message",
294
+ /** Unknown or unspecified error */
295
+ UNKNOWN = "unknown"
296
+ }
297
+ /**
298
+ * Full connection status including state, client ID, and any error
299
+ */
300
+ interface ExternalConnection {
301
+ /** Current connection state */
302
+ state: ExternalConnectionState;
303
+ /** Client identifier (derived from public key) */
304
+ clientId: string | null;
305
+ /** Error code for i18n (use this for translations) */
306
+ errorCode: ExternalConnectionErrorCode;
307
+ /** Error message (original message, for logging/debugging) */
308
+ errorMessage: string | null;
309
+ }
310
+ /**
311
+ * Check if external client connection state indicates an active connection
312
+ * (connected, pending approval, or paired)
313
+ */
314
+ declare function isExternalClientConnected(state: ExternalConnectionState): boolean;
315
+ /**
316
+ * Check if external client can send requests (only when paired/authorized)
317
+ */
318
+ declare function canExternalClientSendRequests(state: ExternalConnectionState): boolean;
257
319
  type EventCallback = (event: HaexHubEvent) => void;
258
320
  interface ExtensionManifest {
259
321
  name: string;
@@ -334,4 +396,4 @@ declare class HaexVaultSdkError extends Error {
334
396
  };
335
397
  }
336
398
 
337
- export { type ApplicationContext as A, type BlockedClient as B, type ContextChangedEvent as C, type DatabaseQueryResult as D, type ExtensionManifest as E, HaexVaultSdkError as F, HAEXTENSION_EVENTS as G, type HaexHubConfig as H, type HaextensionEvent as I, EXTERNAL_EVENTS as J, type ExternalEvent as K, type Migration as M, type PermissionResponse as P, type SearchResult as S, TABLE_SEPARATOR as T, type WebRequestOptions as W, type ExtensionInfo as a, type MigrationResult as b, type WebResponse as c, type DatabasePermissionRequest as d, type ExternalRequestHandler as e, type ExternalResponse as f, type EventCallback as g, type HaexHubRequest as h, type HaexHubResponse as i, type HaexHubEvent as j, type DatabasePermission as k, type DatabaseQueryParams as l, type DatabaseExecuteParams as m, type DatabaseTableInfo as n, type DatabaseColumnInfo as o, type SearchQuery as p, type SearchRequestEvent as q, type ExternalRequestEvent as r, type ExternalRequest as s, type AuthorizedClient as t, type PendingAuthorization as u, type ExternalAuthDecision as v, PermissionStatus as w, ErrorCode as x, DEFAULT_TIMEOUT as y, getTableName as z };
399
+ export { type ApplicationContext as A, type BlockedClient as B, type ContextChangedEvent as C, type DatabaseQueryResult as D, type ExtensionManifest as E, getTableName as F, ExternalConnectionState as G, type HaexHubConfig as H, ExternalConnectionErrorCode as I, isExternalClientConnected as J, canExternalClientSendRequests as K, HaexVaultSdkError as L, type Migration as M, HAEXTENSION_EVENTS as N, type HaextensionEvent as O, type PermissionResponse as P, EXTERNAL_EVENTS as Q, type ExternalEvent as R, type SearchResult as S, TABLE_SEPARATOR as T, type WebRequestOptions as W, type ExtensionInfo as a, type MigrationResult as b, type WebResponse as c, type DatabasePermissionRequest as d, type ExternalRequestHandler as e, type ExternalResponse as f, type EventCallback as g, type HaexHubRequest as h, type HaexHubResponse as i, type HaexHubEvent as j, type DatabasePermission as k, type DatabaseQueryParams as l, type DatabaseExecuteParams as m, type DatabaseTableInfo as n, type DatabaseColumnInfo as o, type SearchQuery as p, type SearchRequestEvent as q, type ExternalRequestEvent as r, type ExternalRequest as s, type AuthorizedClient as t, type PendingAuthorization as u, type ExternalAuthDecision as v, type ExternalConnection as w, PermissionStatus as x, ErrorCode as y, DEFAULT_TIMEOUT as z };
@@ -254,6 +254,68 @@ interface PendingAuthorization {
254
254
  * Decision type for external authorization prompts
255
255
  */
256
256
  type ExternalAuthDecision = 'allow' | 'deny';
257
+ /**
258
+ * Connection state for external clients connecting to haex-vault via WebSocket.
259
+ * Used by browser extensions, CLI tools, servers, and other external clients.
260
+ */
261
+ declare enum ExternalConnectionState {
262
+ /** Not connected to haex-vault */
263
+ DISCONNECTED = "disconnected",
264
+ /** Attempting to establish connection */
265
+ CONNECTING = "connecting",
266
+ /** WebSocket connected but not yet authorized */
267
+ CONNECTED = "connected",
268
+ /** Connected and waiting for user approval in haex-vault */
269
+ PENDING_APPROVAL = "pending_approval",
270
+ /** Connected and authorized to communicate */
271
+ PAIRED = "paired"
272
+ }
273
+ /**
274
+ * Error codes for external client connections.
275
+ * Used to identify specific error conditions for i18n in the frontend.
276
+ */
277
+ declare enum ExternalConnectionErrorCode {
278
+ /** No error */
279
+ NONE = "none",
280
+ /** Client is not authorized (rejected or not yet approved) */
281
+ CLIENT_NOT_AUTHORIZED = "client_not_authorized",
282
+ /** Client was blocked by the user */
283
+ CLIENT_BLOCKED = "client_blocked",
284
+ /** Connection to haex-vault failed (not running or network error) */
285
+ CONNECTION_FAILED = "connection_failed",
286
+ /** Connection timed out */
287
+ CONNECTION_TIMEOUT = "connection_timeout",
288
+ /** WebSocket connection was closed unexpectedly */
289
+ CONNECTION_CLOSED = "connection_closed",
290
+ /** Failed to decrypt message (invalid key or corrupted data) */
291
+ DECRYPTION_FAILED = "decryption_failed",
292
+ /** Invalid message format received */
293
+ INVALID_MESSAGE = "invalid_message",
294
+ /** Unknown or unspecified error */
295
+ UNKNOWN = "unknown"
296
+ }
297
+ /**
298
+ * Full connection status including state, client ID, and any error
299
+ */
300
+ interface ExternalConnection {
301
+ /** Current connection state */
302
+ state: ExternalConnectionState;
303
+ /** Client identifier (derived from public key) */
304
+ clientId: string | null;
305
+ /** Error code for i18n (use this for translations) */
306
+ errorCode: ExternalConnectionErrorCode;
307
+ /** Error message (original message, for logging/debugging) */
308
+ errorMessage: string | null;
309
+ }
310
+ /**
311
+ * Check if external client connection state indicates an active connection
312
+ * (connected, pending approval, or paired)
313
+ */
314
+ declare function isExternalClientConnected(state: ExternalConnectionState): boolean;
315
+ /**
316
+ * Check if external client can send requests (only when paired/authorized)
317
+ */
318
+ declare function canExternalClientSendRequests(state: ExternalConnectionState): boolean;
257
319
  type EventCallback = (event: HaexHubEvent) => void;
258
320
  interface ExtensionManifest {
259
321
  name: string;
@@ -334,4 +396,4 @@ declare class HaexVaultSdkError extends Error {
334
396
  };
335
397
  }
336
398
 
337
- export { type ApplicationContext as A, type BlockedClient as B, type ContextChangedEvent as C, type DatabaseQueryResult as D, type ExtensionManifest as E, HaexVaultSdkError as F, HAEXTENSION_EVENTS as G, type HaexHubConfig as H, type HaextensionEvent as I, EXTERNAL_EVENTS as J, type ExternalEvent as K, type Migration as M, type PermissionResponse as P, type SearchResult as S, TABLE_SEPARATOR as T, type WebRequestOptions as W, type ExtensionInfo as a, type MigrationResult as b, type WebResponse as c, type DatabasePermissionRequest as d, type ExternalRequestHandler as e, type ExternalResponse as f, type EventCallback as g, type HaexHubRequest as h, type HaexHubResponse as i, type HaexHubEvent as j, type DatabasePermission as k, type DatabaseQueryParams as l, type DatabaseExecuteParams as m, type DatabaseTableInfo as n, type DatabaseColumnInfo as o, type SearchQuery as p, type SearchRequestEvent as q, type ExternalRequestEvent as r, type ExternalRequest as s, type AuthorizedClient as t, type PendingAuthorization as u, type ExternalAuthDecision as v, PermissionStatus as w, ErrorCode as x, DEFAULT_TIMEOUT as y, getTableName as z };
399
+ export { type ApplicationContext as A, type BlockedClient as B, type ContextChangedEvent as C, type DatabaseQueryResult as D, type ExtensionManifest as E, getTableName as F, ExternalConnectionState as G, type HaexHubConfig as H, ExternalConnectionErrorCode as I, isExternalClientConnected as J, canExternalClientSendRequests as K, HaexVaultSdkError as L, type Migration as M, HAEXTENSION_EVENTS as N, type HaextensionEvent as O, type PermissionResponse as P, EXTERNAL_EVENTS as Q, type ExternalEvent as R, type SearchResult as S, TABLE_SEPARATOR as T, type WebRequestOptions as W, type ExtensionInfo as a, type MigrationResult as b, type WebResponse as c, type DatabasePermissionRequest as d, type ExternalRequestHandler as e, type ExternalResponse as f, type EventCallback as g, type HaexHubRequest as h, type HaexHubResponse as i, type HaexHubEvent as j, type DatabasePermission as k, type DatabaseQueryParams as l, type DatabaseExecuteParams as m, type DatabaseTableInfo as n, type DatabaseColumnInfo as o, type SearchQuery as p, type SearchRequestEvent as q, type ExternalRequestEvent as r, type ExternalRequest as s, type AuthorizedClient as t, type PendingAuthorization as u, type ExternalAuthDecision as v, type ExternalConnection as w, PermissionStatus as x, ErrorCode as y, DEFAULT_TIMEOUT as z };
package/dist/vue.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultClient, S as StorageAPI } from './client-DQ6VwHic.mjs';
1
+ import { H as HaexVaultClient, S as StorageAPI } from './client-Bw04hBmE.mjs';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
3
  import { Ref } from 'vue';
4
- import { H as HaexHubConfig } from './types-Bw5uc1vm.mjs';
4
+ import { H as HaexHubConfig } from './types-mMVOhsmm.mjs';
5
5
 
6
6
  /**
7
7
  * Vue 3 composable for HaexHub SDK
package/dist/vue.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultClient, S as StorageAPI } from './client-BNq2TcVs.js';
1
+ import { H as HaexVaultClient, S as StorageAPI } from './client-CJC-_fwd.js';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
3
  import { Ref } from 'vue';
4
- import { H as HaexHubConfig } from './types-Bw5uc1vm.js';
4
+ import { H as HaexHubConfig } from './types-mMVOhsmm.js';
5
5
 
6
6
  /**
7
7
  * Vue 3 composable for HaexHub SDK