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