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