@haex-space/vault-sdk 2.4.0 → 2.5.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.
@@ -17,10 +17,18 @@ declare const HAEXTENSION_EVENTS: {
17
17
  readonly CONTEXT_CHANGED: "haextension:context:changed";
18
18
  /** Search request from HaexHub */
19
19
  readonly SEARCH_REQUEST: "haextension:search:request";
20
- /** External request from authorized client (browser extension, CLI, server, etc.) */
21
- readonly EXTERNAL_REQUEST: "haextension:external:request";
22
20
  };
23
21
  type HaextensionEvent = typeof HAEXTENSION_EVENTS[keyof typeof HAEXTENSION_EVENTS];
22
+ /**
23
+ * Events for external client communication (browser extensions, CLI tools, servers, etc.)
24
+ */
25
+ declare const EXTERNAL_EVENTS: {
26
+ /** External request from authorized client */
27
+ readonly REQUEST: "haextension:external:request";
28
+ /** New external client requesting authorization */
29
+ readonly AUTHORIZATION_REQUEST: "external:authorization-request";
30
+ };
31
+ type ExternalEvent = typeof EXTERNAL_EVENTS[keyof typeof EXTERNAL_EVENTS];
24
32
 
25
33
  declare const DEFAULT_TIMEOUT = 30000;
26
34
  declare const TABLE_SEPARATOR = "__";
@@ -162,7 +170,7 @@ interface SearchRequestEvent extends HaexHubEvent {
162
170
  * These requests come through the WebSocket bridge and are routed to the appropriate extension.
163
171
  */
164
172
  interface ExternalRequestEvent extends HaexHubEvent {
165
- type: typeof HAEXTENSION_EVENTS.EXTERNAL_REQUEST;
173
+ type: typeof EXTERNAL_EVENTS.REQUEST;
166
174
  data: ExternalRequest;
167
175
  }
168
176
  /**
@@ -195,6 +203,57 @@ interface ExternalResponse {
195
203
  * Handler function type for external requests
196
204
  */
197
205
  type ExternalRequestHandler = (request: ExternalRequest) => Promise<ExternalResponse> | ExternalResponse;
206
+ /**
207
+ * An authorized external client stored in the database
208
+ */
209
+ interface AuthorizedClient {
210
+ /** Row ID */
211
+ id: string;
212
+ /** Unique client identifier (public key fingerprint) */
213
+ clientId: string;
214
+ /** Human-readable client name */
215
+ clientName: string;
216
+ /** Client's public key (base64) */
217
+ publicKey: string;
218
+ /** Extension ID this client can access */
219
+ extensionId: string;
220
+ /** When the client was authorized (ISO 8601) */
221
+ authorizedAt: string | null;
222
+ /** Last time the client connected (ISO 8601) */
223
+ lastSeen: string | null;
224
+ }
225
+ /**
226
+ * A blocked external client stored in the database
227
+ */
228
+ interface BlockedClient {
229
+ /** Row ID */
230
+ id: string;
231
+ /** Unique client identifier (public key fingerprint) */
232
+ clientId: string;
233
+ /** Human-readable client name */
234
+ clientName: string;
235
+ /** Client's public key (base64) */
236
+ publicKey: string;
237
+ /** When the client was blocked (ISO 8601) */
238
+ blockedAt: string | null;
239
+ }
240
+ /**
241
+ * Pending authorization request waiting for user approval
242
+ */
243
+ interface PendingAuthorization {
244
+ /** Unique client identifier */
245
+ clientId: string;
246
+ /** Human-readable client name */
247
+ clientName: string;
248
+ /** Client's public key (base64) */
249
+ publicKey: string;
250
+ /** Requested extension ID */
251
+ extensionId: string;
252
+ }
253
+ /**
254
+ * Decision type for external authorization prompts
255
+ */
256
+ type ExternalAuthDecision = 'allow' | 'deny';
198
257
  type EventCallback = (event: HaexHubEvent) => void;
199
258
  interface ExtensionManifest {
200
259
  name: string;
@@ -275,4 +334,4 @@ declare class HaexVaultSdkError extends Error {
275
334
  };
276
335
  }
277
336
 
278
- export { type ApplicationContext as A, type ContextChangedEvent as C, type DatabaseQueryResult as D, type ExtensionManifest as E, type HaexHubConfig as H, 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, PermissionStatus as t, ErrorCode as u, DEFAULT_TIMEOUT as v, getTableName as w, HaexVaultSdkError as x, HAEXTENSION_EVENTS as y, type HaextensionEvent as z };
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 };
@@ -17,10 +17,18 @@ declare const HAEXTENSION_EVENTS: {
17
17
  readonly CONTEXT_CHANGED: "haextension:context:changed";
18
18
  /** Search request from HaexHub */
19
19
  readonly SEARCH_REQUEST: "haextension:search:request";
20
- /** External request from authorized client (browser extension, CLI, server, etc.) */
21
- readonly EXTERNAL_REQUEST: "haextension:external:request";
22
20
  };
23
21
  type HaextensionEvent = typeof HAEXTENSION_EVENTS[keyof typeof HAEXTENSION_EVENTS];
22
+ /**
23
+ * Events for external client communication (browser extensions, CLI tools, servers, etc.)
24
+ */
25
+ declare const EXTERNAL_EVENTS: {
26
+ /** External request from authorized client */
27
+ readonly REQUEST: "haextension:external:request";
28
+ /** New external client requesting authorization */
29
+ readonly AUTHORIZATION_REQUEST: "external:authorization-request";
30
+ };
31
+ type ExternalEvent = typeof EXTERNAL_EVENTS[keyof typeof EXTERNAL_EVENTS];
24
32
 
25
33
  declare const DEFAULT_TIMEOUT = 30000;
26
34
  declare const TABLE_SEPARATOR = "__";
@@ -162,7 +170,7 @@ interface SearchRequestEvent extends HaexHubEvent {
162
170
  * These requests come through the WebSocket bridge and are routed to the appropriate extension.
163
171
  */
164
172
  interface ExternalRequestEvent extends HaexHubEvent {
165
- type: typeof HAEXTENSION_EVENTS.EXTERNAL_REQUEST;
173
+ type: typeof EXTERNAL_EVENTS.REQUEST;
166
174
  data: ExternalRequest;
167
175
  }
168
176
  /**
@@ -195,6 +203,57 @@ interface ExternalResponse {
195
203
  * Handler function type for external requests
196
204
  */
197
205
  type ExternalRequestHandler = (request: ExternalRequest) => Promise<ExternalResponse> | ExternalResponse;
206
+ /**
207
+ * An authorized external client stored in the database
208
+ */
209
+ interface AuthorizedClient {
210
+ /** Row ID */
211
+ id: string;
212
+ /** Unique client identifier (public key fingerprint) */
213
+ clientId: string;
214
+ /** Human-readable client name */
215
+ clientName: string;
216
+ /** Client's public key (base64) */
217
+ publicKey: string;
218
+ /** Extension ID this client can access */
219
+ extensionId: string;
220
+ /** When the client was authorized (ISO 8601) */
221
+ authorizedAt: string | null;
222
+ /** Last time the client connected (ISO 8601) */
223
+ lastSeen: string | null;
224
+ }
225
+ /**
226
+ * A blocked external client stored in the database
227
+ */
228
+ interface BlockedClient {
229
+ /** Row ID */
230
+ id: string;
231
+ /** Unique client identifier (public key fingerprint) */
232
+ clientId: string;
233
+ /** Human-readable client name */
234
+ clientName: string;
235
+ /** Client's public key (base64) */
236
+ publicKey: string;
237
+ /** When the client was blocked (ISO 8601) */
238
+ blockedAt: string | null;
239
+ }
240
+ /**
241
+ * Pending authorization request waiting for user approval
242
+ */
243
+ interface PendingAuthorization {
244
+ /** Unique client identifier */
245
+ clientId: string;
246
+ /** Human-readable client name */
247
+ clientName: string;
248
+ /** Client's public key (base64) */
249
+ publicKey: string;
250
+ /** Requested extension ID */
251
+ extensionId: string;
252
+ }
253
+ /**
254
+ * Decision type for external authorization prompts
255
+ */
256
+ type ExternalAuthDecision = 'allow' | 'deny';
198
257
  type EventCallback = (event: HaexHubEvent) => void;
199
258
  interface ExtensionManifest {
200
259
  name: string;
@@ -275,4 +334,4 @@ declare class HaexVaultSdkError extends Error {
275
334
  };
276
335
  }
277
336
 
278
- export { type ApplicationContext as A, type ContextChangedEvent as C, type DatabaseQueryResult as D, type ExtensionManifest as E, type HaexHubConfig as H, 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, PermissionStatus as t, ErrorCode as u, DEFAULT_TIMEOUT as v, getTableName as w, HaexVaultSdkError as x, HAEXTENSION_EVENTS as y, type HaextensionEvent as z };
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 };
package/dist/vue.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultClient, S as StorageAPI } from './client-ClYpUDoI.mjs';
1
+ import { H as HaexVaultClient, S as StorageAPI } from './client-DQ6VwHic.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-CmPqOcLB.mjs';
4
+ import { H as HaexHubConfig } from './types-Bw5uc1vm.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-BSdAg7D1.js';
1
+ import { H as HaexVaultClient, S as StorageAPI } from './client-BNq2TcVs.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-CmPqOcLB.js';
4
+ import { H as HaexHubConfig } from './types-Bw5uc1vm.js';
5
5
 
6
6
  /**
7
7
  * Vue 3 composable for HaexHub SDK
package/dist/vue.js CHANGED
@@ -337,9 +337,7 @@ var HAEXTENSION_EVENTS = {
337
337
  /** Context (theme, locale, platform) has changed */
338
338
  CONTEXT_CHANGED: "haextension:context:changed",
339
339
  /** Search request from HaexHub */
340
- SEARCH_REQUEST: "haextension:search:request",
341
- /** External request from authorized client (browser extension, CLI, server, etc.) */
342
- EXTERNAL_REQUEST: "haextension:external:request"
340
+ SEARCH_REQUEST: "haextension:search:request"
343
341
  };
344
342
 
345
343
  // src/types.ts
@@ -1205,8 +1203,8 @@ var TAURI_COMMANDS = {
1205
1203
  showImage: "webview_extension_fs_show_image"
1206
1204
  },
1207
1205
  external: {
1208
- respond: "webview_extension_external_respond"
1209
- },
1206
+ // Response handling (called by extensions)
1207
+ respond: "external_respond"},
1210
1208
  filesync: {
1211
1209
  // Spaces
1212
1210
  listSpaces: "filesync_list_spaces",