@haex-space/vault-sdk 2.5.74 → 2.5.77

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.
@@ -1,4 +1,4 @@
1
- import { D as DatabaseQueryResult, M as Migration, b as MigrationResult, W as WebRequestOptions, c as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, d as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, e as ExternalRequestHandler, f as ExternalResponse, g as EventCallback } from './types-DiXJ5SF6.mjs';
1
+ import { D as DatabaseQueryResult, M as Migration, b as MigrationResult, W as WebRequestOptions, c as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, d as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, e as ExternalRequestHandler, f as ExternalResponse, g as EventCallback } from './types-CS-ggsXY.mjs';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  declare class StorageAPI {
@@ -244,6 +244,24 @@ declare class FilesystemAPI {
244
244
  * @param to Destination path
245
245
  */
246
246
  copy(from: string, to: string): Promise<void>;
247
+ /**
248
+ * Start watching a directory for file changes
249
+ * When files change, the "filesync:file-changed" event is emitted
250
+ * @param ruleId Unique identifier for this watch (e.g., sync rule ID)
251
+ * @param path Absolute path to the directory to watch
252
+ */
253
+ watch(ruleId: string, path: string): Promise<void>;
254
+ /**
255
+ * Stop watching a directory
256
+ * @param ruleId The rule ID that was used when starting the watch
257
+ */
258
+ unwatch(ruleId: string): Promise<void>;
259
+ /**
260
+ * Check if a directory is currently being watched
261
+ * @param ruleId The rule ID to check
262
+ * @returns True if the directory is being watched
263
+ */
264
+ isWatching(ruleId: string): Promise<boolean>;
247
265
  }
248
266
 
249
267
  declare class WebAPI {
@@ -1,4 +1,4 @@
1
- import { D as DatabaseQueryResult, M as Migration, b as MigrationResult, W as WebRequestOptions, c as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, d as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, e as ExternalRequestHandler, f as ExternalResponse, g as EventCallback } from './types-DiXJ5SF6.js';
1
+ import { D as DatabaseQueryResult, M as Migration, b as MigrationResult, W as WebRequestOptions, c as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, d as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, e as ExternalRequestHandler, f as ExternalResponse, g as EventCallback } from './types-CS-ggsXY.js';
2
2
  import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
3
3
 
4
4
  declare class StorageAPI {
@@ -244,6 +244,24 @@ declare class FilesystemAPI {
244
244
  * @param to Destination path
245
245
  */
246
246
  copy(from: string, to: string): Promise<void>;
247
+ /**
248
+ * Start watching a directory for file changes
249
+ * When files change, the "filesync:file-changed" event is emitted
250
+ * @param ruleId Unique identifier for this watch (e.g., sync rule ID)
251
+ * @param path Absolute path to the directory to watch
252
+ */
253
+ watch(ruleId: string, path: string): Promise<void>;
254
+ /**
255
+ * Stop watching a directory
256
+ * @param ruleId The rule ID that was used when starting the watch
257
+ */
258
+ unwatch(ruleId: string): Promise<void>;
259
+ /**
260
+ * Check if a directory is currently being watched
261
+ * @param ruleId The rule ID to check
262
+ * @returns True if the directory is being watched
263
+ */
264
+ isWatching(ruleId: string): Promise<boolean>;
247
265
  }
248
266
 
249
267
  declare class WebAPI {
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk } from './client-DTXGxFqD.mjs';
2
- export { D as DatabaseAPI, b as DirEntry, a as FileStat, F as FilesystemAPI, P as PermissionsAPI, A as RemoteAddBackendRequest, f as RemoteS3Config, g as RemoteS3PublicConfig, R as RemoteStorageAPI, e as RemoteStorageBackendInfo, h as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, d as SelectFileOptions, c as SelectFolderOptions, W as WebAPI } from './client-DTXGxFqD.mjs';
3
- import { E as ExtensionManifest, H as HaexHubConfig } from './types-DiXJ5SF6.mjs';
4
- export { A as ApplicationContext, t as AuthorizedClient, B as BlockedClient, C as ContextChangedEvent, F as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, U as EXTERNAL_EVENTS, z as ErrorCode, g as EventCallback, a as ExtensionInfo, v as ExternalAuthDecision, x as ExternalConnection, J as ExternalConnectionErrorCode, I as ExternalConnectionState, V as ExternalEvent, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, O as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, N as HaexVaultSdkError, Q as HaextensionEvent, u as PendingAuthorization, P as PermissionResponse, y as PermissionStatus, R as RequestedExtension, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, w as SessionAuthorization, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, L as canExternalClientSendRequests, G as getTableName, K as isExternalClientConnected } from './types-DiXJ5SF6.mjs';
1
+ import { H as HaexVaultSdk } from './client-C0fkm4FE.mjs';
2
+ export { D as DatabaseAPI, b as DirEntry, a as FileStat, F as FilesystemAPI, P as PermissionsAPI, A as RemoteAddBackendRequest, f as RemoteS3Config, g as RemoteS3PublicConfig, R as RemoteStorageAPI, e as RemoteStorageBackendInfo, h as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, d as SelectFileOptions, c as SelectFolderOptions, W as WebAPI } from './client-C0fkm4FE.mjs';
3
+ import { E as ExtensionManifest, H as HaexHubConfig } from './types-CS-ggsXY.mjs';
4
+ export { A as ApplicationContext, t as AuthorizedClient, B as BlockedClient, C as ContextChangedEvent, F as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, X as EXTERNAL_EVENTS, z as ErrorCode, g as EventCallback, a as ExtensionInfo, v as ExternalAuthDecision, x as ExternalConnection, J as ExternalConnectionErrorCode, I as ExternalConnectionState, Y as ExternalEvent, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, O as FileChangeEvent, Q as FileChangeType, U as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, N as HaexVaultSdkError, V as HaextensionEvent, u as PendingAuthorization, P as PermissionResponse, y as PermissionStatus, R as RequestedExtension, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, w as SessionAuthorization, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, L as canExternalClientSendRequests, G as getTableName, K as isExternalClientConnected } from './types-CS-ggsXY.mjs';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -216,6 +216,12 @@ declare const FILESYSTEM_COMMANDS: {
216
216
  readonly rename: "extension_filesystem_rename";
217
217
  /** Copy file or directory */
218
218
  readonly copy: "extension_filesystem_copy";
219
+ /** Start watching a directory for changes */
220
+ readonly watch: "extension_filesystem_watch";
221
+ /** Stop watching a directory */
222
+ readonly unwatch: "extension_filesystem_unwatch";
223
+ /** Check if a directory is being watched */
224
+ readonly isWatching: "extension_filesystem_is_watching";
219
225
  };
220
226
 
221
227
  /**
@@ -362,6 +368,9 @@ declare const TAURI_COMMANDS: {
362
368
  readonly selectFile: "extension_filesystem_select_file";
363
369
  readonly rename: "extension_filesystem_rename";
364
370
  readonly copy: "extension_filesystem_copy";
371
+ readonly watch: "extension_filesystem_watch";
372
+ readonly unwatch: "extension_filesystem_unwatch";
373
+ readonly isWatching: "extension_filesystem_is_watching";
365
374
  };
366
375
  readonly externalBridge: {
367
376
  readonly respond: "external_bridge_respond";
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HaexVaultSdk } from './client-C_0ajqhQ.js';
2
- export { D as DatabaseAPI, b as DirEntry, a as FileStat, F as FilesystemAPI, P as PermissionsAPI, A as RemoteAddBackendRequest, f as RemoteS3Config, g as RemoteS3PublicConfig, R as RemoteStorageAPI, e as RemoteStorageBackendInfo, h as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, d as SelectFileOptions, c as SelectFolderOptions, W as WebAPI } from './client-C_0ajqhQ.js';
3
- import { E as ExtensionManifest, H as HaexHubConfig } from './types-DiXJ5SF6.js';
4
- export { A as ApplicationContext, t as AuthorizedClient, B as BlockedClient, C as ContextChangedEvent, F as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, U as EXTERNAL_EVENTS, z as ErrorCode, g as EventCallback, a as ExtensionInfo, v as ExternalAuthDecision, x as ExternalConnection, J as ExternalConnectionErrorCode, I as ExternalConnectionState, V as ExternalEvent, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, O as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, N as HaexVaultSdkError, Q as HaextensionEvent, u as PendingAuthorization, P as PermissionResponse, y as PermissionStatus, R as RequestedExtension, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, w as SessionAuthorization, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, L as canExternalClientSendRequests, G as getTableName, K as isExternalClientConnected } from './types-DiXJ5SF6.js';
1
+ import { H as HaexVaultSdk } from './client-C8JtjQzm.js';
2
+ export { D as DatabaseAPI, b as DirEntry, a as FileStat, F as FilesystemAPI, P as PermissionsAPI, A as RemoteAddBackendRequest, f as RemoteS3Config, g as RemoteS3PublicConfig, R as RemoteStorageAPI, e as RemoteStorageBackendInfo, h as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, d as SelectFileOptions, c as SelectFolderOptions, W as WebAPI } from './client-C8JtjQzm.js';
3
+ import { E as ExtensionManifest, H as HaexHubConfig } from './types-CS-ggsXY.js';
4
+ export { A as ApplicationContext, t as AuthorizedClient, B as BlockedClient, C as ContextChangedEvent, F as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, X as EXTERNAL_EVENTS, z as ErrorCode, g as EventCallback, a as ExtensionInfo, v as ExternalAuthDecision, x as ExternalConnection, J as ExternalConnectionErrorCode, I as ExternalConnectionState, Y as ExternalEvent, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, O as FileChangeEvent, Q as FileChangeType, U as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, N as HaexVaultSdkError, V as HaextensionEvent, u as PendingAuthorization, P as PermissionResponse, y as PermissionStatus, R as RequestedExtension, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, w as SessionAuthorization, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, L as canExternalClientSendRequests, G as getTableName, K as isExternalClientConnected } from './types-CS-ggsXY.js';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.js';
6
6
  import 'drizzle-orm/sqlite-proxy';
7
7
 
@@ -216,6 +216,12 @@ declare const FILESYSTEM_COMMANDS: {
216
216
  readonly rename: "extension_filesystem_rename";
217
217
  /** Copy file or directory */
218
218
  readonly copy: "extension_filesystem_copy";
219
+ /** Start watching a directory for changes */
220
+ readonly watch: "extension_filesystem_watch";
221
+ /** Stop watching a directory */
222
+ readonly unwatch: "extension_filesystem_unwatch";
223
+ /** Check if a directory is being watched */
224
+ readonly isWatching: "extension_filesystem_is_watching";
219
225
  };
220
226
 
221
227
  /**
@@ -362,6 +368,9 @@ declare const TAURI_COMMANDS: {
362
368
  readonly selectFile: "extension_filesystem_select_file";
363
369
  readonly rename: "extension_filesystem_rename";
364
370
  readonly copy: "extension_filesystem_copy";
371
+ readonly watch: "extension_filesystem_watch";
372
+ readonly unwatch: "extension_filesystem_unwatch";
373
+ readonly isWatching: "extension_filesystem_is_watching";
365
374
  };
366
375
  readonly externalBridge: {
367
376
  readonly respond: "external_bridge_respond";
package/dist/index.js CHANGED
@@ -375,7 +375,9 @@ var HAEXTENSION_EVENTS = {
375
375
  /** Context (theme, locale, platform) has changed */
376
376
  CONTEXT_CHANGED: "haextension:context:changed",
377
377
  /** Search request from HaexHub */
378
- SEARCH_REQUEST: "haextension:search:request"
378
+ SEARCH_REQUEST: "haextension:search:request",
379
+ /** File system change detected (from native file watcher) */
380
+ FILE_CHANGED: "filesync:file-changed"
379
381
  };
380
382
  var EXTERNAL_EVENTS = {
381
383
  /** External request from authorized client */
@@ -548,7 +550,14 @@ var FILESYSTEM_COMMANDS = {
548
550
  /** Rename file or directory */
549
551
  rename: "extension_filesystem_rename",
550
552
  /** Copy file or directory */
551
- copy: "extension_filesystem_copy"
553
+ copy: "extension_filesystem_copy",
554
+ // File watcher operations
555
+ /** Start watching a directory for changes */
556
+ watch: "extension_filesystem_watch",
557
+ /** Stop watching a directory */
558
+ unwatch: "extension_filesystem_unwatch",
559
+ /** Check if a directory is being watched */
560
+ isWatching: "extension_filesystem_is_watching"
552
561
  };
553
562
 
554
563
  // src/commands/externalBridge.ts
@@ -1151,6 +1160,42 @@ var FilesystemAPI = class {
1151
1160
  { from, to }
1152
1161
  );
1153
1162
  }
1163
+ // ==========================================================================
1164
+ // File Watcher Operations
1165
+ // ==========================================================================
1166
+ /**
1167
+ * Start watching a directory for file changes
1168
+ * When files change, the "filesync:file-changed" event is emitted
1169
+ * @param ruleId Unique identifier for this watch (e.g., sync rule ID)
1170
+ * @param path Absolute path to the directory to watch
1171
+ */
1172
+ async watch(ruleId, path) {
1173
+ await this.client.request(
1174
+ FILESYSTEM_COMMANDS.watch,
1175
+ { ruleId, path }
1176
+ );
1177
+ }
1178
+ /**
1179
+ * Stop watching a directory
1180
+ * @param ruleId The rule ID that was used when starting the watch
1181
+ */
1182
+ async unwatch(ruleId) {
1183
+ await this.client.request(
1184
+ FILESYSTEM_COMMANDS.unwatch,
1185
+ { ruleId }
1186
+ );
1187
+ }
1188
+ /**
1189
+ * Check if a directory is currently being watched
1190
+ * @param ruleId The rule ID to check
1191
+ * @returns True if the directory is being watched
1192
+ */
1193
+ async isWatching(ruleId) {
1194
+ return this.client.request(
1195
+ FILESYSTEM_COMMANDS.isWatching,
1196
+ { ruleId }
1197
+ );
1198
+ }
1154
1199
  };
1155
1200
 
1156
1201
  // src/api/web.ts
@@ -1584,6 +1629,26 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1584
1629
  console.error("[HaexVault SDK] Failed to setup external request listener:", error);
1585
1630
  log("Failed to setup external request listener:", error);
1586
1631
  }
1632
+ try {
1633
+ await listen(HAEXTENSION_EVENTS.FILE_CHANGED, (event) => {
1634
+ console.log("[HaexVault SDK] File change event received:", event.payload);
1635
+ log("Received file change event:", event);
1636
+ if (event.payload) {
1637
+ const payload = event.payload;
1638
+ onEvent({
1639
+ type: HAEXTENSION_EVENTS.FILE_CHANGED,
1640
+ ruleId: payload.ruleId,
1641
+ changeType: payload.changeType,
1642
+ path: payload.path,
1643
+ timestamp: Date.now()
1644
+ });
1645
+ }
1646
+ });
1647
+ console.log("[HaexVault SDK] File change listener registered successfully");
1648
+ } catch (error) {
1649
+ console.error("[HaexVault SDK] Failed to setup file change listener:", error);
1650
+ log("Failed to setup file change listener:", error);
1651
+ }
1587
1652
  }
1588
1653
  async function initIframeMode(ctx, log, messageHandler, request) {
1589
1654
  if (!isInIframe()) {