@haex-space/vault-sdk 2.3.14 → 2.3.15
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-BdeVsDdi.d.mts → client-8eGxojZ1.d.mts} +197 -2
- package/dist/{client-Ctv_qXuk.d.ts → client-ChH7wiuU.d.ts} +197 -2
- package/dist/index.d.mts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +236 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +236 -5
- 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 +235 -4
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +235 -4
- 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 +235 -4
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +235 -4
- 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 +235 -4
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +235 -4
- 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 +235 -4
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +235 -4
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -28,7 +28,37 @@ var HAEXTENSION_METHODS = {
|
|
|
28
28
|
filesystem: {
|
|
29
29
|
saveFile: "haextension:filesystem:save-file",
|
|
30
30
|
openFile: "haextension:filesystem:open-file",
|
|
31
|
-
showImage: "haextension:filesystem:show-image"
|
|
31
|
+
showImage: "haextension:filesystem:show-image",
|
|
32
|
+
sync: {
|
|
33
|
+
// Spaces
|
|
34
|
+
listSpaces: "haextension:filesystem:sync:list-spaces",
|
|
35
|
+
createSpace: "haextension:filesystem:sync:create-space",
|
|
36
|
+
deleteSpace: "haextension:filesystem:sync:delete-space",
|
|
37
|
+
// Files
|
|
38
|
+
listFiles: "haextension:filesystem:sync:list-files",
|
|
39
|
+
getFile: "haextension:filesystem:sync:get-file",
|
|
40
|
+
uploadFile: "haextension:filesystem:sync:upload-file",
|
|
41
|
+
downloadFile: "haextension:filesystem:sync:download-file",
|
|
42
|
+
deleteFile: "haextension:filesystem:sync:delete-file",
|
|
43
|
+
// Backends
|
|
44
|
+
listBackends: "haextension:filesystem:sync:list-backends",
|
|
45
|
+
addBackend: "haextension:filesystem:sync:add-backend",
|
|
46
|
+
removeBackend: "haextension:filesystem:sync:remove-backend",
|
|
47
|
+
testBackend: "haextension:filesystem:sync:test-backend",
|
|
48
|
+
// Sync Rules
|
|
49
|
+
listSyncRules: "haextension:filesystem:sync:list-sync-rules",
|
|
50
|
+
addSyncRule: "haextension:filesystem:sync:add-sync-rule",
|
|
51
|
+
removeSyncRule: "haextension:filesystem:sync:remove-sync-rule",
|
|
52
|
+
// Sync Operations
|
|
53
|
+
getSyncStatus: "haextension:filesystem:sync:get-sync-status",
|
|
54
|
+
triggerSync: "haextension:filesystem:sync:trigger-sync",
|
|
55
|
+
pauseSync: "haextension:filesystem:sync:pause-sync",
|
|
56
|
+
resumeSync: "haextension:filesystem:sync:resume-sync",
|
|
57
|
+
// Conflict Resolution
|
|
58
|
+
resolveConflict: "haextension:filesystem:sync:resolve-conflict",
|
|
59
|
+
// UI Helpers
|
|
60
|
+
selectFolder: "haextension:filesystem:sync:select-folder"
|
|
61
|
+
}
|
|
32
62
|
},
|
|
33
63
|
storage: {
|
|
34
64
|
getItem: "haextension:storage:get-item",
|
|
@@ -209,10 +239,210 @@ var DatabaseAPI = class {
|
|
|
209
239
|
}
|
|
210
240
|
};
|
|
211
241
|
|
|
242
|
+
// src/api/filesync.ts
|
|
243
|
+
var FileSyncAPI = class {
|
|
244
|
+
constructor(client) {
|
|
245
|
+
this.client = client;
|
|
246
|
+
}
|
|
247
|
+
// --------------------------------------------------------------------------
|
|
248
|
+
// Spaces
|
|
249
|
+
// --------------------------------------------------------------------------
|
|
250
|
+
/**
|
|
251
|
+
* List all file spaces
|
|
252
|
+
*/
|
|
253
|
+
async listSpacesAsync() {
|
|
254
|
+
return this.client.request(
|
|
255
|
+
HAEXTENSION_METHODS.filesystem.sync.listSpaces
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Create a new file space
|
|
260
|
+
*/
|
|
261
|
+
async createSpaceAsync(options) {
|
|
262
|
+
return this.client.request(
|
|
263
|
+
HAEXTENSION_METHODS.filesystem.sync.createSpace,
|
|
264
|
+
options
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Delete a file space
|
|
269
|
+
*/
|
|
270
|
+
async deleteSpaceAsync(spaceId) {
|
|
271
|
+
await this.client.request(HAEXTENSION_METHODS.filesystem.sync.deleteSpace, {
|
|
272
|
+
spaceId
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
// --------------------------------------------------------------------------
|
|
276
|
+
// Files
|
|
277
|
+
// --------------------------------------------------------------------------
|
|
278
|
+
/**
|
|
279
|
+
* List files in a space
|
|
280
|
+
*/
|
|
281
|
+
async listFilesAsync(options) {
|
|
282
|
+
return this.client.request(
|
|
283
|
+
HAEXTENSION_METHODS.filesystem.sync.listFiles,
|
|
284
|
+
options
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Get file info by ID
|
|
289
|
+
*/
|
|
290
|
+
async getFileAsync(fileId) {
|
|
291
|
+
return this.client.request(
|
|
292
|
+
HAEXTENSION_METHODS.filesystem.sync.getFile,
|
|
293
|
+
{ fileId }
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Upload a file to the sync system
|
|
298
|
+
*/
|
|
299
|
+
async uploadFileAsync(options) {
|
|
300
|
+
return this.client.request(
|
|
301
|
+
HAEXTENSION_METHODS.filesystem.sync.uploadFile,
|
|
302
|
+
options
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Download a file to local storage
|
|
307
|
+
*/
|
|
308
|
+
async downloadFileAsync(options) {
|
|
309
|
+
await this.client.request(
|
|
310
|
+
HAEXTENSION_METHODS.filesystem.sync.downloadFile,
|
|
311
|
+
options
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Delete a file from the sync system
|
|
316
|
+
*/
|
|
317
|
+
async deleteFileAsync(fileId) {
|
|
318
|
+
await this.client.request(HAEXTENSION_METHODS.filesystem.sync.deleteFile, {
|
|
319
|
+
fileId
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
// --------------------------------------------------------------------------
|
|
323
|
+
// Storage Backends
|
|
324
|
+
// --------------------------------------------------------------------------
|
|
325
|
+
/**
|
|
326
|
+
* List configured storage backends
|
|
327
|
+
*/
|
|
328
|
+
async listBackendsAsync() {
|
|
329
|
+
return this.client.request(
|
|
330
|
+
HAEXTENSION_METHODS.filesystem.sync.listBackends
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Add a new storage backend
|
|
335
|
+
*/
|
|
336
|
+
async addBackendAsync(options) {
|
|
337
|
+
return this.client.request(
|
|
338
|
+
HAEXTENSION_METHODS.filesystem.sync.addBackend,
|
|
339
|
+
options
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Remove a storage backend
|
|
344
|
+
*/
|
|
345
|
+
async removeBackendAsync(backendId) {
|
|
346
|
+
await this.client.request(HAEXTENSION_METHODS.filesystem.sync.removeBackend, {
|
|
347
|
+
backendId
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Test backend connection
|
|
352
|
+
*/
|
|
353
|
+
async testBackendAsync(backendId) {
|
|
354
|
+
return this.client.request(
|
|
355
|
+
HAEXTENSION_METHODS.filesystem.sync.testBackend,
|
|
356
|
+
{ backendId }
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
// --------------------------------------------------------------------------
|
|
360
|
+
// Sync Rules
|
|
361
|
+
// --------------------------------------------------------------------------
|
|
362
|
+
/**
|
|
363
|
+
* List sync rules
|
|
364
|
+
*/
|
|
365
|
+
async listSyncRulesAsync() {
|
|
366
|
+
return this.client.request(
|
|
367
|
+
HAEXTENSION_METHODS.filesystem.sync.listSyncRules
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Add a sync rule
|
|
372
|
+
*/
|
|
373
|
+
async addSyncRuleAsync(options) {
|
|
374
|
+
return this.client.request(
|
|
375
|
+
HAEXTENSION_METHODS.filesystem.sync.addSyncRule,
|
|
376
|
+
options
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Remove a sync rule
|
|
381
|
+
*/
|
|
382
|
+
async removeSyncRuleAsync(ruleId) {
|
|
383
|
+
await this.client.request(HAEXTENSION_METHODS.filesystem.sync.removeSyncRule, {
|
|
384
|
+
ruleId
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
// --------------------------------------------------------------------------
|
|
388
|
+
// Sync Operations
|
|
389
|
+
// --------------------------------------------------------------------------
|
|
390
|
+
/**
|
|
391
|
+
* Get current sync status
|
|
392
|
+
*/
|
|
393
|
+
async getSyncStatusAsync() {
|
|
394
|
+
return this.client.request(
|
|
395
|
+
HAEXTENSION_METHODS.filesystem.sync.getSyncStatus
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Trigger a manual sync
|
|
400
|
+
*/
|
|
401
|
+
async triggerSyncAsync() {
|
|
402
|
+
await this.client.request(HAEXTENSION_METHODS.filesystem.sync.triggerSync);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Pause syncing
|
|
406
|
+
*/
|
|
407
|
+
async pauseSyncAsync() {
|
|
408
|
+
await this.client.request(HAEXTENSION_METHODS.filesystem.sync.pauseSync);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Resume syncing
|
|
412
|
+
*/
|
|
413
|
+
async resumeSyncAsync() {
|
|
414
|
+
await this.client.request(HAEXTENSION_METHODS.filesystem.sync.resumeSync);
|
|
415
|
+
}
|
|
416
|
+
// --------------------------------------------------------------------------
|
|
417
|
+
// Conflict Resolution
|
|
418
|
+
// --------------------------------------------------------------------------
|
|
419
|
+
/**
|
|
420
|
+
* Resolve a file conflict
|
|
421
|
+
*/
|
|
422
|
+
async resolveConflictAsync(fileId, resolution) {
|
|
423
|
+
await this.client.request(HAEXTENSION_METHODS.filesystem.sync.resolveConflict, {
|
|
424
|
+
fileId,
|
|
425
|
+
resolution
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
// --------------------------------------------------------------------------
|
|
429
|
+
// Folder Selection (Native Dialog)
|
|
430
|
+
// --------------------------------------------------------------------------
|
|
431
|
+
/**
|
|
432
|
+
* Open a folder selection dialog
|
|
433
|
+
*/
|
|
434
|
+
async selectFolderAsync() {
|
|
435
|
+
return this.client.request(
|
|
436
|
+
HAEXTENSION_METHODS.filesystem.sync.selectFolder
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
212
441
|
// src/api/filesystem.ts
|
|
213
442
|
var FilesystemAPI = class {
|
|
214
443
|
constructor(client) {
|
|
215
444
|
this.client = client;
|
|
445
|
+
this.sync = new FileSyncAPI(client);
|
|
216
446
|
}
|
|
217
447
|
/**
|
|
218
448
|
* Opens a save file dialog and saves the provided data to the selected location
|
|
@@ -802,11 +1032,12 @@ var HaexVaultClient = class {
|
|
|
802
1032
|
async respondToExternalRequest(response) {
|
|
803
1033
|
await this.request("external.respond", response);
|
|
804
1034
|
}
|
|
805
|
-
async request(method, params
|
|
1035
|
+
async request(method, params) {
|
|
1036
|
+
const resolvedParams = params ?? {};
|
|
806
1037
|
if (this.isNativeWindow && typeof window.__TAURI__ !== "undefined") {
|
|
807
|
-
return this.invoke(method,
|
|
1038
|
+
return this.invoke(method, resolvedParams);
|
|
808
1039
|
}
|
|
809
|
-
return this.postMessage(method,
|
|
1040
|
+
return this.postMessage(method, resolvedParams);
|
|
810
1041
|
}
|
|
811
1042
|
async postMessage(method, params) {
|
|
812
1043
|
const requestId = this.generateRequestId();
|