@haex-space/vault-sdk 2.5.42 → 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.
package/dist/vue.mjs CHANGED
@@ -398,7 +398,19 @@ var HAEXTENSION_METHODS = {
398
398
  filesystem: {
399
399
  saveFile: "haextension:filesystem:save-file",
400
400
  openFile: "haextension:filesystem:open-file",
401
- showImage: "haextension:filesystem:show-image"
401
+ showImage: "haextension:filesystem:show-image",
402
+ // Generic FS operations (Phase 2)
403
+ readFile: "haextension:filesystem:read-file",
404
+ writeFile: "haextension:filesystem:write-file",
405
+ readDir: "haextension:filesystem:read-dir",
406
+ mkdir: "haextension:filesystem:mkdir",
407
+ remove: "haextension:filesystem:remove",
408
+ exists: "haextension:filesystem:exists",
409
+ stat: "haextension:filesystem:stat",
410
+ selectFolder: "haextension:filesystem:select-folder",
411
+ selectFile: "haextension:filesystem:select-file",
412
+ rename: "haextension:filesystem:rename",
413
+ copy: "haextension:filesystem:copy"
402
414
  },
403
415
  filesync: {
404
416
  // Spaces
@@ -946,6 +958,136 @@ var FilesystemAPI = class {
946
958
  );
947
959
  return result;
948
960
  }
961
+ // ==========================================================================
962
+ // Generic Filesystem Operations (Phase 2)
963
+ // ==========================================================================
964
+ /**
965
+ * Read file contents
966
+ * @param path Absolute path to the file
967
+ * @returns File contents as Uint8Array
968
+ */
969
+ async readFile(path) {
970
+ const base64 = await this.client.request(
971
+ HAEXTENSION_METHODS.filesystem.readFile,
972
+ { path }
973
+ );
974
+ const binary = atob(base64);
975
+ const bytes = new Uint8Array(binary.length);
976
+ for (let i = 0; i < binary.length; i++) {
977
+ bytes[i] = binary.charCodeAt(i);
978
+ }
979
+ return bytes;
980
+ }
981
+ /**
982
+ * Write file contents
983
+ * @param path Absolute path to the file
984
+ * @param data File contents as Uint8Array
985
+ */
986
+ async writeFile(path, data) {
987
+ const base64 = btoa(String.fromCharCode(...data));
988
+ await this.client.request(
989
+ HAEXTENSION_METHODS.filesystem.writeFile,
990
+ { path, data: base64 }
991
+ );
992
+ }
993
+ /**
994
+ * Read directory contents
995
+ * @param path Absolute path to the directory
996
+ * @returns Array of directory entries
997
+ */
998
+ async readDir(path) {
999
+ return this.client.request(
1000
+ HAEXTENSION_METHODS.filesystem.readDir,
1001
+ { path }
1002
+ );
1003
+ }
1004
+ /**
1005
+ * Create a directory (and parent directories if needed)
1006
+ * @param path Absolute path to create
1007
+ */
1008
+ async mkdir(path) {
1009
+ await this.client.request(
1010
+ HAEXTENSION_METHODS.filesystem.mkdir,
1011
+ { path }
1012
+ );
1013
+ }
1014
+ /**
1015
+ * Remove a file or directory
1016
+ * @param path Absolute path to remove
1017
+ * @param recursive If true, remove directories recursively
1018
+ */
1019
+ async remove(path, recursive = false) {
1020
+ await this.client.request(
1021
+ HAEXTENSION_METHODS.filesystem.remove,
1022
+ { path, recursive }
1023
+ );
1024
+ }
1025
+ /**
1026
+ * Check if a path exists
1027
+ * @param path Absolute path to check
1028
+ * @returns True if the path exists
1029
+ */
1030
+ async exists(path) {
1031
+ return this.client.request(
1032
+ HAEXTENSION_METHODS.filesystem.exists,
1033
+ { path }
1034
+ );
1035
+ }
1036
+ /**
1037
+ * Get file/directory metadata
1038
+ * @param path Absolute path
1039
+ * @returns File metadata
1040
+ */
1041
+ async stat(path) {
1042
+ return this.client.request(
1043
+ HAEXTENSION_METHODS.filesystem.stat,
1044
+ { path }
1045
+ );
1046
+ }
1047
+ /**
1048
+ * Open a folder selection dialog
1049
+ * @param options Dialog options
1050
+ * @returns Selected folder path, or null if cancelled
1051
+ */
1052
+ async selectFolder(options = {}) {
1053
+ return this.client.request(
1054
+ HAEXTENSION_METHODS.filesystem.selectFolder,
1055
+ options
1056
+ );
1057
+ }
1058
+ /**
1059
+ * Open a file selection dialog
1060
+ * @param options Dialog options
1061
+ * @returns Selected file paths, or null if cancelled
1062
+ */
1063
+ async selectFile(options = {}) {
1064
+ return this.client.request(
1065
+ HAEXTENSION_METHODS.filesystem.selectFile,
1066
+ options
1067
+ );
1068
+ }
1069
+ /**
1070
+ * Rename/move a file or directory
1071
+ * @param from Source path
1072
+ * @param to Destination path
1073
+ */
1074
+ async rename(from, to) {
1075
+ await this.client.request(
1076
+ HAEXTENSION_METHODS.filesystem.rename,
1077
+ { from, to }
1078
+ );
1079
+ }
1080
+ /**
1081
+ * Copy a file
1082
+ * @param from Source path
1083
+ * @param to Destination path
1084
+ */
1085
+ async copy(from, to) {
1086
+ await this.client.request(
1087
+ HAEXTENSION_METHODS.filesystem.copy,
1088
+ { from, to }
1089
+ );
1090
+ }
949
1091
  };
950
1092
 
951
1093
  // src/api/web.ts
@@ -1440,8 +1582,7 @@ var TAURI_COMMANDS = {
1440
1582
  filesystem: {
1441
1583
  saveFile: "webview_extension_fs_save_file",
1442
1584
  openFile: "webview_extension_fs_open_file",
1443
- showImage: "webview_extension_fs_show_image"
1444
- },
1585
+ showImage: "webview_extension_fs_show_image"},
1445
1586
  external: {
1446
1587
  // Response handling (called by extensions running in WebView)
1447
1588
  respond: "webview_extension_external_respond"},