@haex-space/vault-sdk 2.3.12 → 2.3.15

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.
Files changed (42) hide show
  1. package/dist/cli/index.mjs +0 -0
  2. package/dist/{client-BdeVsDdi.d.mts → client-8eGxojZ1.d.mts} +197 -2
  3. package/dist/{client-Ctv_qXuk.d.ts → client-ChH7wiuU.d.ts} +197 -2
  4. package/dist/index.d.mts +25 -2
  5. package/dist/index.d.ts +25 -2
  6. package/dist/index.js +236 -4
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +236 -5
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/nuxt.js +7 -1
  11. package/dist/nuxt.js.map +1 -1
  12. package/dist/nuxt.mjs +7 -1
  13. package/dist/nuxt.mjs.map +1 -1
  14. package/dist/react.d.mts +1 -1
  15. package/dist/react.d.ts +1 -1
  16. package/dist/react.js +235 -4
  17. package/dist/react.js.map +1 -1
  18. package/dist/react.mjs +235 -4
  19. package/dist/react.mjs.map +1 -1
  20. package/dist/runtime/nuxt.plugin.client.d.mts +1 -1
  21. package/dist/runtime/nuxt.plugin.client.d.ts +1 -1
  22. package/dist/runtime/nuxt.plugin.client.js +235 -4
  23. package/dist/runtime/nuxt.plugin.client.js.map +1 -1
  24. package/dist/runtime/nuxt.plugin.client.mjs +235 -4
  25. package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
  26. package/dist/svelte.d.mts +1 -1
  27. package/dist/svelte.d.ts +1 -1
  28. package/dist/svelte.js +235 -4
  29. package/dist/svelte.js.map +1 -1
  30. package/dist/svelte.mjs +235 -4
  31. package/dist/svelte.mjs.map +1 -1
  32. package/dist/vite.js +7 -1
  33. package/dist/vite.js.map +1 -1
  34. package/dist/vite.mjs +7 -1
  35. package/dist/vite.mjs.map +1 -1
  36. package/dist/vue.d.mts +1 -1
  37. package/dist/vue.d.ts +1 -1
  38. package/dist/vue.js +235 -4
  39. package/dist/vue.js.map +1 -1
  40. package/dist/vue.mjs +235 -4
  41. package/dist/vue.mjs.map +1 -1
  42. package/package.json +14 -15
package/dist/index.js CHANGED
@@ -394,7 +394,37 @@ var HAEXTENSION_METHODS = {
394
394
  filesystem: {
395
395
  saveFile: "haextension:filesystem:save-file",
396
396
  openFile: "haextension:filesystem:open-file",
397
- showImage: "haextension:filesystem:show-image"
397
+ showImage: "haextension:filesystem:show-image",
398
+ sync: {
399
+ // Spaces
400
+ listSpaces: "haextension:filesystem:sync:list-spaces",
401
+ createSpace: "haextension:filesystem:sync:create-space",
402
+ deleteSpace: "haextension:filesystem:sync:delete-space",
403
+ // Files
404
+ listFiles: "haextension:filesystem:sync:list-files",
405
+ getFile: "haextension:filesystem:sync:get-file",
406
+ uploadFile: "haextension:filesystem:sync:upload-file",
407
+ downloadFile: "haextension:filesystem:sync:download-file",
408
+ deleteFile: "haextension:filesystem:sync:delete-file",
409
+ // Backends
410
+ listBackends: "haextension:filesystem:sync:list-backends",
411
+ addBackend: "haextension:filesystem:sync:add-backend",
412
+ removeBackend: "haextension:filesystem:sync:remove-backend",
413
+ testBackend: "haextension:filesystem:sync:test-backend",
414
+ // Sync Rules
415
+ listSyncRules: "haextension:filesystem:sync:list-sync-rules",
416
+ addSyncRule: "haextension:filesystem:sync:add-sync-rule",
417
+ removeSyncRule: "haextension:filesystem:sync:remove-sync-rule",
418
+ // Sync Operations
419
+ getSyncStatus: "haextension:filesystem:sync:get-sync-status",
420
+ triggerSync: "haextension:filesystem:sync:trigger-sync",
421
+ pauseSync: "haextension:filesystem:sync:pause-sync",
422
+ resumeSync: "haextension:filesystem:sync:resume-sync",
423
+ // Conflict Resolution
424
+ resolveConflict: "haextension:filesystem:sync:resolve-conflict",
425
+ // UI Helpers
426
+ selectFolder: "haextension:filesystem:sync:select-folder"
427
+ }
398
428
  },
399
429
  storage: {
400
430
  getItem: "haextension:storage:get-item",
@@ -590,10 +620,210 @@ var DatabaseAPI = class {
590
620
  }
591
621
  };
592
622
 
623
+ // src/api/filesync.ts
624
+ var FileSyncAPI = class {
625
+ constructor(client) {
626
+ this.client = client;
627
+ }
628
+ // --------------------------------------------------------------------------
629
+ // Spaces
630
+ // --------------------------------------------------------------------------
631
+ /**
632
+ * List all file spaces
633
+ */
634
+ async listSpacesAsync() {
635
+ return this.client.request(
636
+ HAEXTENSION_METHODS.filesystem.sync.listSpaces
637
+ );
638
+ }
639
+ /**
640
+ * Create a new file space
641
+ */
642
+ async createSpaceAsync(options) {
643
+ return this.client.request(
644
+ HAEXTENSION_METHODS.filesystem.sync.createSpace,
645
+ options
646
+ );
647
+ }
648
+ /**
649
+ * Delete a file space
650
+ */
651
+ async deleteSpaceAsync(spaceId) {
652
+ await this.client.request(HAEXTENSION_METHODS.filesystem.sync.deleteSpace, {
653
+ spaceId
654
+ });
655
+ }
656
+ // --------------------------------------------------------------------------
657
+ // Files
658
+ // --------------------------------------------------------------------------
659
+ /**
660
+ * List files in a space
661
+ */
662
+ async listFilesAsync(options) {
663
+ return this.client.request(
664
+ HAEXTENSION_METHODS.filesystem.sync.listFiles,
665
+ options
666
+ );
667
+ }
668
+ /**
669
+ * Get file info by ID
670
+ */
671
+ async getFileAsync(fileId) {
672
+ return this.client.request(
673
+ HAEXTENSION_METHODS.filesystem.sync.getFile,
674
+ { fileId }
675
+ );
676
+ }
677
+ /**
678
+ * Upload a file to the sync system
679
+ */
680
+ async uploadFileAsync(options) {
681
+ return this.client.request(
682
+ HAEXTENSION_METHODS.filesystem.sync.uploadFile,
683
+ options
684
+ );
685
+ }
686
+ /**
687
+ * Download a file to local storage
688
+ */
689
+ async downloadFileAsync(options) {
690
+ await this.client.request(
691
+ HAEXTENSION_METHODS.filesystem.sync.downloadFile,
692
+ options
693
+ );
694
+ }
695
+ /**
696
+ * Delete a file from the sync system
697
+ */
698
+ async deleteFileAsync(fileId) {
699
+ await this.client.request(HAEXTENSION_METHODS.filesystem.sync.deleteFile, {
700
+ fileId
701
+ });
702
+ }
703
+ // --------------------------------------------------------------------------
704
+ // Storage Backends
705
+ // --------------------------------------------------------------------------
706
+ /**
707
+ * List configured storage backends
708
+ */
709
+ async listBackendsAsync() {
710
+ return this.client.request(
711
+ HAEXTENSION_METHODS.filesystem.sync.listBackends
712
+ );
713
+ }
714
+ /**
715
+ * Add a new storage backend
716
+ */
717
+ async addBackendAsync(options) {
718
+ return this.client.request(
719
+ HAEXTENSION_METHODS.filesystem.sync.addBackend,
720
+ options
721
+ );
722
+ }
723
+ /**
724
+ * Remove a storage backend
725
+ */
726
+ async removeBackendAsync(backendId) {
727
+ await this.client.request(HAEXTENSION_METHODS.filesystem.sync.removeBackend, {
728
+ backendId
729
+ });
730
+ }
731
+ /**
732
+ * Test backend connection
733
+ */
734
+ async testBackendAsync(backendId) {
735
+ return this.client.request(
736
+ HAEXTENSION_METHODS.filesystem.sync.testBackend,
737
+ { backendId }
738
+ );
739
+ }
740
+ // --------------------------------------------------------------------------
741
+ // Sync Rules
742
+ // --------------------------------------------------------------------------
743
+ /**
744
+ * List sync rules
745
+ */
746
+ async listSyncRulesAsync() {
747
+ return this.client.request(
748
+ HAEXTENSION_METHODS.filesystem.sync.listSyncRules
749
+ );
750
+ }
751
+ /**
752
+ * Add a sync rule
753
+ */
754
+ async addSyncRuleAsync(options) {
755
+ return this.client.request(
756
+ HAEXTENSION_METHODS.filesystem.sync.addSyncRule,
757
+ options
758
+ );
759
+ }
760
+ /**
761
+ * Remove a sync rule
762
+ */
763
+ async removeSyncRuleAsync(ruleId) {
764
+ await this.client.request(HAEXTENSION_METHODS.filesystem.sync.removeSyncRule, {
765
+ ruleId
766
+ });
767
+ }
768
+ // --------------------------------------------------------------------------
769
+ // Sync Operations
770
+ // --------------------------------------------------------------------------
771
+ /**
772
+ * Get current sync status
773
+ */
774
+ async getSyncStatusAsync() {
775
+ return this.client.request(
776
+ HAEXTENSION_METHODS.filesystem.sync.getSyncStatus
777
+ );
778
+ }
779
+ /**
780
+ * Trigger a manual sync
781
+ */
782
+ async triggerSyncAsync() {
783
+ await this.client.request(HAEXTENSION_METHODS.filesystem.sync.triggerSync);
784
+ }
785
+ /**
786
+ * Pause syncing
787
+ */
788
+ async pauseSyncAsync() {
789
+ await this.client.request(HAEXTENSION_METHODS.filesystem.sync.pauseSync);
790
+ }
791
+ /**
792
+ * Resume syncing
793
+ */
794
+ async resumeSyncAsync() {
795
+ await this.client.request(HAEXTENSION_METHODS.filesystem.sync.resumeSync);
796
+ }
797
+ // --------------------------------------------------------------------------
798
+ // Conflict Resolution
799
+ // --------------------------------------------------------------------------
800
+ /**
801
+ * Resolve a file conflict
802
+ */
803
+ async resolveConflictAsync(fileId, resolution) {
804
+ await this.client.request(HAEXTENSION_METHODS.filesystem.sync.resolveConflict, {
805
+ fileId,
806
+ resolution
807
+ });
808
+ }
809
+ // --------------------------------------------------------------------------
810
+ // Folder Selection (Native Dialog)
811
+ // --------------------------------------------------------------------------
812
+ /**
813
+ * Open a folder selection dialog
814
+ */
815
+ async selectFolderAsync() {
816
+ return this.client.request(
817
+ HAEXTENSION_METHODS.filesystem.sync.selectFolder
818
+ );
819
+ }
820
+ };
821
+
593
822
  // src/api/filesystem.ts
594
823
  var FilesystemAPI = class {
595
824
  constructor(client) {
596
825
  this.client = client;
826
+ this.sync = new FileSyncAPI(client);
597
827
  }
598
828
  /**
599
829
  * Opens a save file dialog and saves the provided data to the selected location
@@ -1117,11 +1347,12 @@ var HaexVaultClient = class {
1117
1347
  async respondToExternalRequest(response) {
1118
1348
  await this.request("external.respond", response);
1119
1349
  }
1120
- async request(method, params = {}) {
1350
+ async request(method, params) {
1351
+ const resolvedParams = params ?? {};
1121
1352
  if (this.isNativeWindow && typeof window.__TAURI__ !== "undefined") {
1122
- return this.invoke(method, params);
1353
+ return this.invoke(method, resolvedParams);
1123
1354
  }
1124
- return this.postMessage(method, params);
1355
+ return this.postMessage(method, resolvedParams);
1125
1356
  }
1126
1357
  async postMessage(method, params) {
1127
1358
  const requestId = this.generateRequestId();
@@ -1808,6 +2039,7 @@ function createHaexVaultClient(config = {}) {
1808
2039
  exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT;
1809
2040
  exports.DatabaseAPI = DatabaseAPI;
1810
2041
  exports.ErrorCode = ErrorCode;
2042
+ exports.FileSyncAPI = FileSyncAPI;
1811
2043
  exports.FilesystemAPI = FilesystemAPI;
1812
2044
  exports.HAEXSPACE_MESSAGE_TYPES = HAEXSPACE_MESSAGE_TYPES;
1813
2045
  exports.HAEXTENSION_EVENTS = HAEXTENSION_EVENTS;