@haex-space/vault-sdk 2.5.40 → 2.5.43

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,6 +1,6 @@
1
1
  import * as nuxt_app from 'nuxt/app';
2
2
  import { ShallowRef } from 'vue';
3
- import { H as HaexVaultSdk } from '../client-BEWYbywm.mjs';
3
+ import { H as HaexVaultSdk } from '../client-9QruY0rX.mjs';
4
4
  import { A as ApplicationContext } from '../types-DiXJ5SF6.mjs';
5
5
  import 'drizzle-orm/sqlite-proxy';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import * as nuxt_app from 'nuxt/app';
2
2
  import { ShallowRef } from 'vue';
3
- import { H as HaexVaultSdk } from '../client-CYgMbZKT.js';
3
+ import { H as HaexVaultSdk } from '../client-Bp4IqvzW.js';
4
4
  import { A as ApplicationContext } from '../types-DiXJ5SF6.js';
5
5
  import 'drizzle-orm/sqlite-proxy';
6
6
 
@@ -74,7 +74,19 @@ var HAEXTENSION_METHODS = {
74
74
  filesystem: {
75
75
  saveFile: "haextension:filesystem:save-file",
76
76
  openFile: "haextension:filesystem:open-file",
77
- showImage: "haextension:filesystem:show-image"
77
+ showImage: "haextension:filesystem:show-image",
78
+ // Generic FS operations (Phase 2)
79
+ readFile: "haextension:filesystem:read-file",
80
+ writeFile: "haextension:filesystem:write-file",
81
+ readDir: "haextension:filesystem:read-dir",
82
+ mkdir: "haextension:filesystem:mkdir",
83
+ remove: "haextension:filesystem:remove",
84
+ exists: "haextension:filesystem:exists",
85
+ stat: "haextension:filesystem:stat",
86
+ selectFolder: "haextension:filesystem:select-folder",
87
+ selectFile: "haextension:filesystem:select-file",
88
+ rename: "haextension:filesystem:rename",
89
+ copy: "haextension:filesystem:copy"
78
90
  },
79
91
  filesync: {
80
92
  // Spaces
@@ -126,6 +138,19 @@ var HAEXTENSION_METHODS = {
126
138
  clear: "haextension:storage:clear",
127
139
  keys: "haextension:storage:keys"
128
140
  },
141
+ // Remote Storage API (S3, WebDAV, FTP, etc.)
142
+ remoteStorage: {
143
+ // Backend Management
144
+ listBackends: "haextension:remote-storage:list-backends",
145
+ addBackend: "haextension:remote-storage:add-backend",
146
+ removeBackend: "haextension:remote-storage:remove-backend",
147
+ testBackend: "haextension:remote-storage:test-backend",
148
+ // Storage Operations
149
+ upload: "haextension:remote-storage:upload",
150
+ download: "haextension:remote-storage:download",
151
+ delete: "haextension:remote-storage:delete",
152
+ list: "haextension:remote-storage:list"
153
+ },
129
154
  web: {
130
155
  fetch: "haextension:web:fetch"
131
156
  },
@@ -609,6 +634,136 @@ var FilesystemAPI = class {
609
634
  );
610
635
  return result;
611
636
  }
637
+ // ==========================================================================
638
+ // Generic Filesystem Operations (Phase 2)
639
+ // ==========================================================================
640
+ /**
641
+ * Read file contents
642
+ * @param path Absolute path to the file
643
+ * @returns File contents as Uint8Array
644
+ */
645
+ async readFile(path) {
646
+ const base64 = await this.client.request(
647
+ HAEXTENSION_METHODS.filesystem.readFile,
648
+ { path }
649
+ );
650
+ const binary = atob(base64);
651
+ const bytes = new Uint8Array(binary.length);
652
+ for (let i = 0; i < binary.length; i++) {
653
+ bytes[i] = binary.charCodeAt(i);
654
+ }
655
+ return bytes;
656
+ }
657
+ /**
658
+ * Write file contents
659
+ * @param path Absolute path to the file
660
+ * @param data File contents as Uint8Array
661
+ */
662
+ async writeFile(path, data) {
663
+ const base64 = btoa(String.fromCharCode(...data));
664
+ await this.client.request(
665
+ HAEXTENSION_METHODS.filesystem.writeFile,
666
+ { path, data: base64 }
667
+ );
668
+ }
669
+ /**
670
+ * Read directory contents
671
+ * @param path Absolute path to the directory
672
+ * @returns Array of directory entries
673
+ */
674
+ async readDir(path) {
675
+ return this.client.request(
676
+ HAEXTENSION_METHODS.filesystem.readDir,
677
+ { path }
678
+ );
679
+ }
680
+ /**
681
+ * Create a directory (and parent directories if needed)
682
+ * @param path Absolute path to create
683
+ */
684
+ async mkdir(path) {
685
+ await this.client.request(
686
+ HAEXTENSION_METHODS.filesystem.mkdir,
687
+ { path }
688
+ );
689
+ }
690
+ /**
691
+ * Remove a file or directory
692
+ * @param path Absolute path to remove
693
+ * @param recursive If true, remove directories recursively
694
+ */
695
+ async remove(path, recursive = false) {
696
+ await this.client.request(
697
+ HAEXTENSION_METHODS.filesystem.remove,
698
+ { path, recursive }
699
+ );
700
+ }
701
+ /**
702
+ * Check if a path exists
703
+ * @param path Absolute path to check
704
+ * @returns True if the path exists
705
+ */
706
+ async exists(path) {
707
+ return this.client.request(
708
+ HAEXTENSION_METHODS.filesystem.exists,
709
+ { path }
710
+ );
711
+ }
712
+ /**
713
+ * Get file/directory metadata
714
+ * @param path Absolute path
715
+ * @returns File metadata
716
+ */
717
+ async stat(path) {
718
+ return this.client.request(
719
+ HAEXTENSION_METHODS.filesystem.stat,
720
+ { path }
721
+ );
722
+ }
723
+ /**
724
+ * Open a folder selection dialog
725
+ * @param options Dialog options
726
+ * @returns Selected folder path, or null if cancelled
727
+ */
728
+ async selectFolder(options = {}) {
729
+ return this.client.request(
730
+ HAEXTENSION_METHODS.filesystem.selectFolder,
731
+ options
732
+ );
733
+ }
734
+ /**
735
+ * Open a file selection dialog
736
+ * @param options Dialog options
737
+ * @returns Selected file paths, or null if cancelled
738
+ */
739
+ async selectFile(options = {}) {
740
+ return this.client.request(
741
+ HAEXTENSION_METHODS.filesystem.selectFile,
742
+ options
743
+ );
744
+ }
745
+ /**
746
+ * Rename/move a file or directory
747
+ * @param from Source path
748
+ * @param to Destination path
749
+ */
750
+ async rename(from, to) {
751
+ await this.client.request(
752
+ HAEXTENSION_METHODS.filesystem.rename,
753
+ { from, to }
754
+ );
755
+ }
756
+ /**
757
+ * Copy a file
758
+ * @param from Source path
759
+ * @param to Destination path
760
+ */
761
+ async copy(from, to) {
762
+ await this.client.request(
763
+ HAEXTENSION_METHODS.filesystem.copy,
764
+ { from, to }
765
+ );
766
+ }
612
767
  };
613
768
 
614
769
  // src/api/web.ts
@@ -778,6 +933,111 @@ var PermissionsAPI = class {
778
933
  }
779
934
  };
780
935
 
936
+ // src/api/remoteStorage.ts
937
+ var RemoteStorageAPI = class {
938
+ constructor(client) {
939
+ this.client = client;
940
+ this.backends = new BackendManagement(client);
941
+ }
942
+ /**
943
+ * Upload data to a storage backend
944
+ * @param backendId - Backend ID to upload to
945
+ * @param key - Object key (path in the bucket)
946
+ * @param data - Data to upload
947
+ */
948
+ async upload(backendId, key, data) {
949
+ const base64 = btoa(String.fromCharCode(...data));
950
+ await this.client.request(HAEXTENSION_METHODS.remoteStorage.upload, {
951
+ backendId,
952
+ key,
953
+ data: base64
954
+ });
955
+ }
956
+ /**
957
+ * Download data from a storage backend
958
+ * @param backendId - Backend ID to download from
959
+ * @param key - Object key (path in the bucket)
960
+ * @returns Downloaded data as Uint8Array
961
+ */
962
+ async download(backendId, key) {
963
+ const base64 = await this.client.request(
964
+ HAEXTENSION_METHODS.remoteStorage.download,
965
+ { backendId, key }
966
+ );
967
+ const binary = atob(base64);
968
+ const bytes = new Uint8Array(binary.length);
969
+ for (let i = 0; i < binary.length; i++) {
970
+ bytes[i] = binary.charCodeAt(i);
971
+ }
972
+ return bytes;
973
+ }
974
+ /**
975
+ * Delete an object from a storage backend
976
+ * @param backendId - Backend ID
977
+ * @param key - Object key to delete
978
+ */
979
+ async delete(backendId, key) {
980
+ await this.client.request(HAEXTENSION_METHODS.remoteStorage.delete, {
981
+ backendId,
982
+ key
983
+ });
984
+ }
985
+ /**
986
+ * List objects in a storage backend
987
+ * @param backendId - Backend ID
988
+ * @param prefix - Optional prefix to filter objects
989
+ * @returns List of objects
990
+ */
991
+ async list(backendId, prefix) {
992
+ return this.client.request(
993
+ HAEXTENSION_METHODS.remoteStorage.list,
994
+ { backendId, prefix }
995
+ );
996
+ }
997
+ };
998
+ var BackendManagement = class {
999
+ constructor(client) {
1000
+ this.client = client;
1001
+ }
1002
+ /**
1003
+ * List all available storage backends
1004
+ */
1005
+ async list() {
1006
+ return this.client.request(
1007
+ HAEXTENSION_METHODS.remoteStorage.listBackends
1008
+ );
1009
+ }
1010
+ /**
1011
+ * Add a new storage backend
1012
+ * @param request - Backend configuration
1013
+ * @returns Created backend info
1014
+ */
1015
+ async add(request) {
1016
+ return this.client.request(
1017
+ HAEXTENSION_METHODS.remoteStorage.addBackend,
1018
+ request
1019
+ );
1020
+ }
1021
+ /**
1022
+ * Remove a storage backend
1023
+ * @param backendId - Backend ID to remove
1024
+ */
1025
+ async remove(backendId) {
1026
+ await this.client.request(HAEXTENSION_METHODS.remoteStorage.removeBackend, {
1027
+ backendId
1028
+ });
1029
+ }
1030
+ /**
1031
+ * Test connection to a storage backend
1032
+ * @param backendId - Backend ID to test
1033
+ */
1034
+ async test(backendId) {
1035
+ await this.client.request(HAEXTENSION_METHODS.remoteStorage.testBackend, {
1036
+ backendId
1037
+ });
1038
+ }
1039
+ };
1040
+
781
1041
  // src/messages.ts
782
1042
  var HAEXSPACE_MESSAGE_TYPES = {
783
1043
  /** Debug message for development/troubleshooting */
@@ -1072,8 +1332,7 @@ var TAURI_COMMANDS = {
1072
1332
  filesystem: {
1073
1333
  saveFile: "webview_extension_fs_save_file",
1074
1334
  openFile: "webview_extension_fs_open_file",
1075
- showImage: "webview_extension_fs_show_image"
1076
- },
1335
+ showImage: "webview_extension_fs_show_image"},
1077
1336
  external: {
1078
1337
  // Response handling (called by extensions running in WebView)
1079
1338
  respond: "webview_extension_external_respond"},
@@ -1697,6 +1956,7 @@ var HaexVaultSdk = class {
1697
1956
  this.filesystem = new FilesystemAPI(this);
1698
1957
  this.web = new WebAPI(this);
1699
1958
  this.permissions = new PermissionsAPI(this);
1959
+ this.remoteStorage = new RemoteStorageAPI(this);
1700
1960
  installConsoleForwarding(this.config.debug);
1701
1961
  this.readyPromise = new Promise((resolve) => {
1702
1962
  this.resolveReady = resolve;