@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,7 +1,7 @@
1
1
  import * as nuxt_app from 'nuxt/app';
2
2
  import { ShallowRef } from 'vue';
3
- import { H as HaexVaultSdk } from '../client-DTXGxFqD.mjs';
4
- import { A as ApplicationContext } from '../types-DiXJ5SF6.mjs';
3
+ import { H as HaexVaultSdk } from '../client-C0fkm4FE.mjs';
4
+ import { A as ApplicationContext } from '../types-CS-ggsXY.mjs';
5
5
  import 'drizzle-orm/sqlite-proxy';
6
6
 
7
7
  declare const _default: nuxt_app.Plugin<{
@@ -1,7 +1,7 @@
1
1
  import * as nuxt_app from 'nuxt/app';
2
2
  import { ShallowRef } from 'vue';
3
- import { H as HaexVaultSdk } from '../client-C_0ajqhQ.js';
4
- import { A as ApplicationContext } from '../types-DiXJ5SF6.js';
3
+ import { H as HaexVaultSdk } from '../client-C8JtjQzm.js';
4
+ import { A as ApplicationContext } from '../types-CS-ggsXY.js';
5
5
  import 'drizzle-orm/sqlite-proxy';
6
6
 
7
7
  declare const _default: nuxt_app.Plugin<{
@@ -11,7 +11,9 @@ var HAEXTENSION_EVENTS = {
11
11
  /** Context (theme, locale, platform) has changed */
12
12
  CONTEXT_CHANGED: "haextension:context:changed",
13
13
  /** Search request from HaexHub */
14
- SEARCH_REQUEST: "haextension:search:request"
14
+ SEARCH_REQUEST: "haextension:search:request",
15
+ /** File system change detected (from native file watcher) */
16
+ FILE_CHANGED: "filesync:file-changed"
15
17
  };
16
18
  var EXTERNAL_EVENTS = {
17
19
  /** External request from authorized client */
@@ -135,7 +137,14 @@ var FILESYSTEM_COMMANDS = {
135
137
  /** Rename file or directory */
136
138
  rename: "extension_filesystem_rename",
137
139
  /** Copy file or directory */
138
- copy: "extension_filesystem_copy"
140
+ copy: "extension_filesystem_copy",
141
+ // File watcher operations
142
+ /** Start watching a directory for changes */
143
+ watch: "extension_filesystem_watch",
144
+ /** Stop watching a directory */
145
+ unwatch: "extension_filesystem_unwatch",
146
+ /** Check if a directory is being watched */
147
+ isWatching: "extension_filesystem_is_watching"
139
148
  };
140
149
 
141
150
  // src/commands/externalBridge.ts
@@ -502,6 +511,42 @@ var FilesystemAPI = class {
502
511
  { from, to }
503
512
  );
504
513
  }
514
+ // ==========================================================================
515
+ // File Watcher Operations
516
+ // ==========================================================================
517
+ /**
518
+ * Start watching a directory for file changes
519
+ * When files change, the "filesync:file-changed" event is emitted
520
+ * @param ruleId Unique identifier for this watch (e.g., sync rule ID)
521
+ * @param path Absolute path to the directory to watch
522
+ */
523
+ async watch(ruleId, path) {
524
+ await this.client.request(
525
+ FILESYSTEM_COMMANDS.watch,
526
+ { ruleId, path }
527
+ );
528
+ }
529
+ /**
530
+ * Stop watching a directory
531
+ * @param ruleId The rule ID that was used when starting the watch
532
+ */
533
+ async unwatch(ruleId) {
534
+ await this.client.request(
535
+ FILESYSTEM_COMMANDS.unwatch,
536
+ { ruleId }
537
+ );
538
+ }
539
+ /**
540
+ * Check if a directory is currently being watched
541
+ * @param ruleId The rule ID to check
542
+ * @returns True if the directory is being watched
543
+ */
544
+ async isWatching(ruleId) {
545
+ return this.client.request(
546
+ FILESYSTEM_COMMANDS.isWatching,
547
+ { ruleId }
548
+ );
549
+ }
505
550
  };
506
551
 
507
552
  // src/api/web.ts
@@ -1009,6 +1054,26 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1009
1054
  console.error("[HaexVault SDK] Failed to setup external request listener:", error);
1010
1055
  log("Failed to setup external request listener:", error);
1011
1056
  }
1057
+ try {
1058
+ await listen(HAEXTENSION_EVENTS.FILE_CHANGED, (event) => {
1059
+ console.log("[HaexVault SDK] File change event received:", event.payload);
1060
+ log("Received file change event:", event);
1061
+ if (event.payload) {
1062
+ const payload = event.payload;
1063
+ onEvent({
1064
+ type: HAEXTENSION_EVENTS.FILE_CHANGED,
1065
+ ruleId: payload.ruleId,
1066
+ changeType: payload.changeType,
1067
+ path: payload.path,
1068
+ timestamp: Date.now()
1069
+ });
1070
+ }
1071
+ });
1072
+ console.log("[HaexVault SDK] File change listener registered successfully");
1073
+ } catch (error) {
1074
+ console.error("[HaexVault SDK] Failed to setup file change listener:", error);
1075
+ log("Failed to setup file change listener:", error);
1076
+ }
1012
1077
  }
1013
1078
  async function initIframeMode(ctx, log, messageHandler, request) {
1014
1079
  if (!isInIframe()) {