@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.
- package/dist/{client-BEWYbywm.d.mts → client-9QruY0rX.d.mts} +257 -4
- package/dist/{client-CYgMbZKT.d.ts → client-Bp4IqvzW.d.ts} +257 -4
- package/dist/index.d.mts +45 -3
- package/dist/index.d.ts +45 -3
- package/dist/index.js +291 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +291 -3
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +263 -3
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +263 -3
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +1 -1
- package/dist/runtime/nuxt.plugin.client.d.ts +1 -1
- package/dist/runtime/nuxt.plugin.client.js +263 -3
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +263 -3
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +263 -3
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +263 -3
- package/dist/svelte.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +263 -3
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +263 -3
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.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
|
|
@@ -450,6 +462,19 @@ var HAEXTENSION_METHODS = {
|
|
|
450
462
|
clear: "haextension:storage:clear",
|
|
451
463
|
keys: "haextension:storage:keys"
|
|
452
464
|
},
|
|
465
|
+
// Remote Storage API (S3, WebDAV, FTP, etc.)
|
|
466
|
+
remoteStorage: {
|
|
467
|
+
// Backend Management
|
|
468
|
+
listBackends: "haextension:remote-storage:list-backends",
|
|
469
|
+
addBackend: "haextension:remote-storage:add-backend",
|
|
470
|
+
removeBackend: "haextension:remote-storage:remove-backend",
|
|
471
|
+
testBackend: "haextension:remote-storage:test-backend",
|
|
472
|
+
// Storage Operations
|
|
473
|
+
upload: "haextension:remote-storage:upload",
|
|
474
|
+
download: "haextension:remote-storage:download",
|
|
475
|
+
delete: "haextension:remote-storage:delete",
|
|
476
|
+
list: "haextension:remote-storage:list"
|
|
477
|
+
},
|
|
453
478
|
web: {
|
|
454
479
|
fetch: "haextension:web:fetch"
|
|
455
480
|
},
|
|
@@ -933,6 +958,136 @@ var FilesystemAPI = class {
|
|
|
933
958
|
);
|
|
934
959
|
return result;
|
|
935
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
|
+
}
|
|
936
1091
|
};
|
|
937
1092
|
|
|
938
1093
|
// src/api/web.ts
|
|
@@ -1102,6 +1257,111 @@ var PermissionsAPI = class {
|
|
|
1102
1257
|
}
|
|
1103
1258
|
};
|
|
1104
1259
|
|
|
1260
|
+
// src/api/remoteStorage.ts
|
|
1261
|
+
var RemoteStorageAPI = class {
|
|
1262
|
+
constructor(client) {
|
|
1263
|
+
this.client = client;
|
|
1264
|
+
this.backends = new BackendManagement(client);
|
|
1265
|
+
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Upload data to a storage backend
|
|
1268
|
+
* @param backendId - Backend ID to upload to
|
|
1269
|
+
* @param key - Object key (path in the bucket)
|
|
1270
|
+
* @param data - Data to upload
|
|
1271
|
+
*/
|
|
1272
|
+
async upload(backendId, key, data) {
|
|
1273
|
+
const base64 = btoa(String.fromCharCode(...data));
|
|
1274
|
+
await this.client.request(HAEXTENSION_METHODS.remoteStorage.upload, {
|
|
1275
|
+
backendId,
|
|
1276
|
+
key,
|
|
1277
|
+
data: base64
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Download data from a storage backend
|
|
1282
|
+
* @param backendId - Backend ID to download from
|
|
1283
|
+
* @param key - Object key (path in the bucket)
|
|
1284
|
+
* @returns Downloaded data as Uint8Array
|
|
1285
|
+
*/
|
|
1286
|
+
async download(backendId, key) {
|
|
1287
|
+
const base64 = await this.client.request(
|
|
1288
|
+
HAEXTENSION_METHODS.remoteStorage.download,
|
|
1289
|
+
{ backendId, key }
|
|
1290
|
+
);
|
|
1291
|
+
const binary = atob(base64);
|
|
1292
|
+
const bytes = new Uint8Array(binary.length);
|
|
1293
|
+
for (let i = 0; i < binary.length; i++) {
|
|
1294
|
+
bytes[i] = binary.charCodeAt(i);
|
|
1295
|
+
}
|
|
1296
|
+
return bytes;
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Delete an object from a storage backend
|
|
1300
|
+
* @param backendId - Backend ID
|
|
1301
|
+
* @param key - Object key to delete
|
|
1302
|
+
*/
|
|
1303
|
+
async delete(backendId, key) {
|
|
1304
|
+
await this.client.request(HAEXTENSION_METHODS.remoteStorage.delete, {
|
|
1305
|
+
backendId,
|
|
1306
|
+
key
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* List objects in a storage backend
|
|
1311
|
+
* @param backendId - Backend ID
|
|
1312
|
+
* @param prefix - Optional prefix to filter objects
|
|
1313
|
+
* @returns List of objects
|
|
1314
|
+
*/
|
|
1315
|
+
async list(backendId, prefix) {
|
|
1316
|
+
return this.client.request(
|
|
1317
|
+
HAEXTENSION_METHODS.remoteStorage.list,
|
|
1318
|
+
{ backendId, prefix }
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
var BackendManagement = class {
|
|
1323
|
+
constructor(client) {
|
|
1324
|
+
this.client = client;
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* List all available storage backends
|
|
1328
|
+
*/
|
|
1329
|
+
async list() {
|
|
1330
|
+
return this.client.request(
|
|
1331
|
+
HAEXTENSION_METHODS.remoteStorage.listBackends
|
|
1332
|
+
);
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* Add a new storage backend
|
|
1336
|
+
* @param request - Backend configuration
|
|
1337
|
+
* @returns Created backend info
|
|
1338
|
+
*/
|
|
1339
|
+
async add(request) {
|
|
1340
|
+
return this.client.request(
|
|
1341
|
+
HAEXTENSION_METHODS.remoteStorage.addBackend,
|
|
1342
|
+
request
|
|
1343
|
+
);
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Remove a storage backend
|
|
1347
|
+
* @param backendId - Backend ID to remove
|
|
1348
|
+
*/
|
|
1349
|
+
async remove(backendId) {
|
|
1350
|
+
await this.client.request(HAEXTENSION_METHODS.remoteStorage.removeBackend, {
|
|
1351
|
+
backendId
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Test connection to a storage backend
|
|
1356
|
+
* @param backendId - Backend ID to test
|
|
1357
|
+
*/
|
|
1358
|
+
async test(backendId) {
|
|
1359
|
+
await this.client.request(HAEXTENSION_METHODS.remoteStorage.testBackend, {
|
|
1360
|
+
backendId
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1105
1365
|
// src/client/tableName.ts
|
|
1106
1366
|
function validatePublicKey(publicKey) {
|
|
1107
1367
|
if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
|
|
@@ -1322,8 +1582,7 @@ var TAURI_COMMANDS = {
|
|
|
1322
1582
|
filesystem: {
|
|
1323
1583
|
saveFile: "webview_extension_fs_save_file",
|
|
1324
1584
|
openFile: "webview_extension_fs_open_file",
|
|
1325
|
-
showImage: "webview_extension_fs_show_image"
|
|
1326
|
-
},
|
|
1585
|
+
showImage: "webview_extension_fs_show_image"},
|
|
1327
1586
|
external: {
|
|
1328
1587
|
// Response handling (called by extensions running in WebView)
|
|
1329
1588
|
respond: "webview_extension_external_respond"},
|
|
@@ -1947,6 +2206,7 @@ var HaexVaultSdk = class {
|
|
|
1947
2206
|
this.filesystem = new FilesystemAPI(this);
|
|
1948
2207
|
this.web = new WebAPI(this);
|
|
1949
2208
|
this.permissions = new PermissionsAPI(this);
|
|
2209
|
+
this.remoteStorage = new RemoteStorageAPI(this);
|
|
1950
2210
|
installConsoleForwarding(this.config.debug);
|
|
1951
2211
|
this.readyPromise = new Promise((resolve) => {
|
|
1952
2212
|
this.resolveReady = resolve;
|