@haex-space/vault-sdk 2.5.37 → 2.5.42
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-BF1XJY-3.d.mts → client-BAu3VPE3.d.mts} +264 -4
- package/dist/{client-D1sxoc42.d.ts → client-CF0wJxT2.d.ts} +264 -4
- package/dist/index.d.mts +68 -28
- package/dist/index.d.ts +68 -28
- package/dist/index.js +373 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +371 -81
- 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 +346 -80
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +346 -80
- 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 +346 -80
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +346 -80
- 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 +346 -80
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +346 -80
- 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 +346 -80
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +346 -80
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -107,7 +107,7 @@ interface LocalFileInfo {
|
|
|
107
107
|
modifiedAt: string | null;
|
|
108
108
|
}
|
|
109
109
|
type FileSyncState = "synced" | "syncing" | "localOnly" | "remoteOnly" | "conflict" | "error";
|
|
110
|
-
interface StorageBackendInfo {
|
|
110
|
+
interface StorageBackendInfo$1 {
|
|
111
111
|
id: string;
|
|
112
112
|
type: StorageBackendType;
|
|
113
113
|
name: string;
|
|
@@ -214,6 +214,96 @@ interface DownloadFileOptions {
|
|
|
214
214
|
fileId: string;
|
|
215
215
|
localPath: string;
|
|
216
216
|
}
|
|
217
|
+
/** Queue operation type */
|
|
218
|
+
type QueueOperation = 'upload' | 'download';
|
|
219
|
+
/** Queue entry status */
|
|
220
|
+
type QueueStatus = 'pending' | 'inProgress' | 'completed' | 'failed';
|
|
221
|
+
/** Queue operation constants */
|
|
222
|
+
declare const QUEUE_OPERATION: {
|
|
223
|
+
UPLOAD: "upload";
|
|
224
|
+
DOWNLOAD: "download";
|
|
225
|
+
};
|
|
226
|
+
/** Queue status constants */
|
|
227
|
+
declare const QUEUE_STATUS: {
|
|
228
|
+
PENDING: "pending";
|
|
229
|
+
IN_PROGRESS: "inProgress";
|
|
230
|
+
COMPLETED: "completed";
|
|
231
|
+
FAILED: "failed";
|
|
232
|
+
};
|
|
233
|
+
/** A sync queue entry representing a pending or in-progress file operation */
|
|
234
|
+
interface SyncQueueEntry {
|
|
235
|
+
id: string;
|
|
236
|
+
/** Device ID this entry belongs to */
|
|
237
|
+
deviceId: string;
|
|
238
|
+
/** Sync rule ID */
|
|
239
|
+
ruleId: string;
|
|
240
|
+
/** Full local path */
|
|
241
|
+
localPath: string;
|
|
242
|
+
/** Relative path from sync root (used as remote path) */
|
|
243
|
+
relativePath: string;
|
|
244
|
+
/** Operation type (upload/download) */
|
|
245
|
+
operation: QueueOperation;
|
|
246
|
+
/** Current status */
|
|
247
|
+
status: QueueStatus;
|
|
248
|
+
/** Priority (lower = higher priority) */
|
|
249
|
+
priority: number;
|
|
250
|
+
/** File size in bytes */
|
|
251
|
+
fileSize: number;
|
|
252
|
+
/** Error message if failed */
|
|
253
|
+
errorMessage: string | null;
|
|
254
|
+
/** Number of retry attempts */
|
|
255
|
+
retryCount: number;
|
|
256
|
+
/** When the entry was created */
|
|
257
|
+
createdAt: string;
|
|
258
|
+
/** When processing started */
|
|
259
|
+
startedAt: string | null;
|
|
260
|
+
/** When processing completed */
|
|
261
|
+
completedAt: string | null;
|
|
262
|
+
}
|
|
263
|
+
/** Request to add files to the sync queue */
|
|
264
|
+
interface AddToQueueOptions {
|
|
265
|
+
/** Sync rule ID */
|
|
266
|
+
ruleId: string;
|
|
267
|
+
/** Files to add */
|
|
268
|
+
files: QueueFileEntry[];
|
|
269
|
+
/** Operation type */
|
|
270
|
+
operation: QueueOperation;
|
|
271
|
+
/** Priority (optional, default 100) */
|
|
272
|
+
priority?: number;
|
|
273
|
+
}
|
|
274
|
+
/** A file entry for adding to the queue */
|
|
275
|
+
interface QueueFileEntry {
|
|
276
|
+
/** Full local path */
|
|
277
|
+
localPath: string;
|
|
278
|
+
/** Relative path from sync root */
|
|
279
|
+
relativePath: string;
|
|
280
|
+
/** File size in bytes */
|
|
281
|
+
fileSize: number;
|
|
282
|
+
}
|
|
283
|
+
/** Request to get queue entries */
|
|
284
|
+
interface GetQueueOptions {
|
|
285
|
+
/** Filter by rule ID (optional) */
|
|
286
|
+
ruleId?: string;
|
|
287
|
+
/** Filter by status (optional) */
|
|
288
|
+
status?: QueueStatus;
|
|
289
|
+
/** Include completed entries (default: false) */
|
|
290
|
+
includeCompleted?: boolean;
|
|
291
|
+
}
|
|
292
|
+
/** Aggregated queue status */
|
|
293
|
+
interface QueueSummary {
|
|
294
|
+
/** Number of pending items */
|
|
295
|
+
pendingCount: number;
|
|
296
|
+
/** Number of in-progress items */
|
|
297
|
+
inProgressCount: number;
|
|
298
|
+
/** Number of completed items */
|
|
299
|
+
completedCount: number;
|
|
300
|
+
/** Number of failed items */
|
|
301
|
+
failedCount: number;
|
|
302
|
+
/** Total bytes pending (sum of file_size for pending items) */
|
|
303
|
+
pendingBytes: number;
|
|
304
|
+
/** Currently processing entry (if any) */
|
|
305
|
+
currentEntry: SyncQueueEntry | null;
|
|
306
|
+
}
|
|
217
307
|
/**
|
|
218
308
|
* File Sync API for E2E encrypted file synchronization
|
|
219
309
|
*
|
|
@@ -262,11 +352,11 @@ declare class FileSyncAPI {
|
|
|
262
352
|
/**
|
|
263
353
|
* List configured storage backends
|
|
264
354
|
*/
|
|
265
|
-
listBackendsAsync(): Promise<StorageBackendInfo[]>;
|
|
355
|
+
listBackendsAsync(): Promise<StorageBackendInfo$1[]>;
|
|
266
356
|
/**
|
|
267
357
|
* Add a new storage backend
|
|
268
358
|
*/
|
|
269
|
-
addBackendAsync(options: AddBackendOptions): Promise<StorageBackendInfo>;
|
|
359
|
+
addBackendAsync(options: AddBackendOptions): Promise<StorageBackendInfo$1>;
|
|
270
360
|
/**
|
|
271
361
|
* Remove a storage backend
|
|
272
362
|
*/
|
|
@@ -315,6 +405,46 @@ declare class FileSyncAPI {
|
|
|
315
405
|
* Open a folder selection dialog
|
|
316
406
|
*/
|
|
317
407
|
selectFolderAsync(): Promise<string | null>;
|
|
408
|
+
/**
|
|
409
|
+
* Add files to the sync queue
|
|
410
|
+
*/
|
|
411
|
+
addToQueueAsync(options: AddToQueueOptions): Promise<SyncQueueEntry[]>;
|
|
412
|
+
/**
|
|
413
|
+
* Get queue entries for the current device
|
|
414
|
+
*/
|
|
415
|
+
getQueueAsync(options?: GetQueueOptions): Promise<SyncQueueEntry[]>;
|
|
416
|
+
/**
|
|
417
|
+
* Get aggregated queue summary for the current device
|
|
418
|
+
*/
|
|
419
|
+
getQueueSummaryAsync(): Promise<QueueSummary>;
|
|
420
|
+
/**
|
|
421
|
+
* Mark a queue entry as started (in_progress)
|
|
422
|
+
*/
|
|
423
|
+
startQueueEntryAsync(entryId: string): Promise<void>;
|
|
424
|
+
/**
|
|
425
|
+
* Mark a queue entry as completed
|
|
426
|
+
*/
|
|
427
|
+
completeQueueEntryAsync(entryId: string): Promise<void>;
|
|
428
|
+
/**
|
|
429
|
+
* Mark a queue entry as failed
|
|
430
|
+
*/
|
|
431
|
+
failQueueEntryAsync(entryId: string, errorMessage: string): Promise<void>;
|
|
432
|
+
/**
|
|
433
|
+
* Retry all failed queue entries (reset to pending)
|
|
434
|
+
*/
|
|
435
|
+
retryFailedQueueAsync(): Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Remove a queue entry
|
|
438
|
+
*/
|
|
439
|
+
removeQueueEntryAsync(entryId: string): Promise<void>;
|
|
440
|
+
/**
|
|
441
|
+
* Clear all queue entries for a sync rule
|
|
442
|
+
*/
|
|
443
|
+
clearQueueAsync(ruleId: string): Promise<void>;
|
|
444
|
+
/**
|
|
445
|
+
* Reset in_progress entries to pending (for recovery after crash)
|
|
446
|
+
*/
|
|
447
|
+
recoverQueueAsync(): Promise<void>;
|
|
318
448
|
}
|
|
319
449
|
|
|
320
450
|
interface SaveFileOptions {
|
|
@@ -458,6 +588,135 @@ declare class PermissionsAPI {
|
|
|
458
588
|
checkFilesystemAsync(path: string, operation: "read" | "write"): Promise<boolean>;
|
|
459
589
|
}
|
|
460
590
|
|
|
591
|
+
/**
|
|
592
|
+
* Storage backend info (public, without credentials)
|
|
593
|
+
*/
|
|
594
|
+
interface StorageBackendInfo {
|
|
595
|
+
id: string;
|
|
596
|
+
/** Backend type (e.g., "s3") */
|
|
597
|
+
type: string;
|
|
598
|
+
name: string;
|
|
599
|
+
enabled: boolean;
|
|
600
|
+
createdAt: string;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* S3-compatible backend configuration
|
|
604
|
+
*/
|
|
605
|
+
interface S3Config {
|
|
606
|
+
/** Custom endpoint URL (for non-AWS S3-compatible services) */
|
|
607
|
+
endpoint?: string;
|
|
608
|
+
/** AWS region or custom region name */
|
|
609
|
+
region: string;
|
|
610
|
+
/** Bucket name */
|
|
611
|
+
bucket: string;
|
|
612
|
+
/** Access key ID */
|
|
613
|
+
accessKeyId: string;
|
|
614
|
+
/** Secret access key */
|
|
615
|
+
secretAccessKey: string;
|
|
616
|
+
/** Use path-style URLs instead of virtual-hosted-style */
|
|
617
|
+
pathStyle?: boolean;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Request to add a new storage backend
|
|
621
|
+
*/
|
|
622
|
+
interface AddBackendRequest {
|
|
623
|
+
/** Display name for the backend */
|
|
624
|
+
name: string;
|
|
625
|
+
/** Backend type (currently only "s3") */
|
|
626
|
+
type: "s3";
|
|
627
|
+
/** Configuration (structure depends on type) */
|
|
628
|
+
config: S3Config | Record<string, unknown>;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Object info from list operation
|
|
632
|
+
*/
|
|
633
|
+
interface StorageObjectInfo {
|
|
634
|
+
/** Object key */
|
|
635
|
+
key: string;
|
|
636
|
+
/** Size in bytes */
|
|
637
|
+
size: number;
|
|
638
|
+
/** Last modified timestamp (ISO 8601) */
|
|
639
|
+
lastModified?: string;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Remote Storage API for S3-compatible (and future WebDAV, FTP) backends.
|
|
643
|
+
*
|
|
644
|
+
* This API provides access to external storage backends configured centrally
|
|
645
|
+
* in haex-vault. Extensions can upload/download files without CORS issues.
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* // List available backends
|
|
650
|
+
* const backends = await sdk.remoteStorage.backends.list();
|
|
651
|
+
*
|
|
652
|
+
* // Upload data
|
|
653
|
+
* const data = new TextEncoder().encode("Hello World");
|
|
654
|
+
* await sdk.remoteStorage.upload(backendId, "path/to/file.txt", data);
|
|
655
|
+
*
|
|
656
|
+
* // Download data
|
|
657
|
+
* const downloaded = await sdk.remoteStorage.download(backendId, "path/to/file.txt");
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
declare class RemoteStorageAPI {
|
|
661
|
+
private client;
|
|
662
|
+
readonly backends: BackendManagement;
|
|
663
|
+
constructor(client: HaexVaultSdk);
|
|
664
|
+
/**
|
|
665
|
+
* Upload data to a storage backend
|
|
666
|
+
* @param backendId - Backend ID to upload to
|
|
667
|
+
* @param key - Object key (path in the bucket)
|
|
668
|
+
* @param data - Data to upload
|
|
669
|
+
*/
|
|
670
|
+
upload(backendId: string, key: string, data: Uint8Array): Promise<void>;
|
|
671
|
+
/**
|
|
672
|
+
* Download data from a storage backend
|
|
673
|
+
* @param backendId - Backend ID to download from
|
|
674
|
+
* @param key - Object key (path in the bucket)
|
|
675
|
+
* @returns Downloaded data as Uint8Array
|
|
676
|
+
*/
|
|
677
|
+
download(backendId: string, key: string): Promise<Uint8Array>;
|
|
678
|
+
/**
|
|
679
|
+
* Delete an object from a storage backend
|
|
680
|
+
* @param backendId - Backend ID
|
|
681
|
+
* @param key - Object key to delete
|
|
682
|
+
*/
|
|
683
|
+
delete(backendId: string, key: string): Promise<void>;
|
|
684
|
+
/**
|
|
685
|
+
* List objects in a storage backend
|
|
686
|
+
* @param backendId - Backend ID
|
|
687
|
+
* @param prefix - Optional prefix to filter objects
|
|
688
|
+
* @returns List of objects
|
|
689
|
+
*/
|
|
690
|
+
list(backendId: string, prefix?: string): Promise<StorageObjectInfo[]>;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Backend management operations
|
|
694
|
+
*/
|
|
695
|
+
declare class BackendManagement {
|
|
696
|
+
private client;
|
|
697
|
+
constructor(client: HaexVaultSdk);
|
|
698
|
+
/**
|
|
699
|
+
* List all available storage backends
|
|
700
|
+
*/
|
|
701
|
+
list(): Promise<StorageBackendInfo[]>;
|
|
702
|
+
/**
|
|
703
|
+
* Add a new storage backend
|
|
704
|
+
* @param request - Backend configuration
|
|
705
|
+
* @returns Created backend info
|
|
706
|
+
*/
|
|
707
|
+
add(request: AddBackendRequest): Promise<StorageBackendInfo>;
|
|
708
|
+
/**
|
|
709
|
+
* Remove a storage backend
|
|
710
|
+
* @param backendId - Backend ID to remove
|
|
711
|
+
*/
|
|
712
|
+
remove(backendId: string): Promise<void>;
|
|
713
|
+
/**
|
|
714
|
+
* Test connection to a storage backend
|
|
715
|
+
* @param backendId - Backend ID to test
|
|
716
|
+
*/
|
|
717
|
+
test(backendId: string): Promise<void>;
|
|
718
|
+
}
|
|
719
|
+
|
|
461
720
|
/**
|
|
462
721
|
* HaexVault Client
|
|
463
722
|
*
|
|
@@ -488,6 +747,7 @@ declare class HaexVaultSdk {
|
|
|
488
747
|
readonly filesystem: FilesystemAPI;
|
|
489
748
|
readonly web: WebAPI;
|
|
490
749
|
readonly permissions: PermissionsAPI;
|
|
750
|
+
readonly remoteStorage: RemoteStorageAPI;
|
|
491
751
|
constructor(config?: HaexHubConfig);
|
|
492
752
|
ready(): Promise<void>;
|
|
493
753
|
get setupCompleted(): boolean;
|
|
@@ -531,4 +791,4 @@ declare class HaexVaultSdk {
|
|
|
531
791
|
private log;
|
|
532
792
|
}
|
|
533
793
|
|
|
534
|
-
export { type
|
|
794
|
+
export { type AddBackendRequest as A, type BackendConfig as B, type ConflictStrategy as C, DatabaseAPI as D, type QueueSummary as E, FilesystemAPI as F, type GetQueueOptions as G, HaexVaultSdk as H, FILE_SYNC_STATE as I, SYNC_DIRECTION as J, STORAGE_BACKEND_TYPE as K, type ListFilesOptions as L, CONFLICT_STRATEGY as M, QUEUE_OPERATION as N, QUEUE_STATUS as O, PermissionsAPI as P, type QueueOperation as Q, RemoteStorageAPI as R, StorageAPI as S, type UpdateSyncRuleOptions as U, WebAPI as W, FileSyncAPI as a, type StorageBackendInfo as b, type S3Config as c, type StorageObjectInfo as d, type FileSpace as e, type FileInfo as f, type FileSyncState as g, type StorageBackendInfo$1 as h, type StorageBackendType as i, type S3BackendConfig as j, type SyncRule as k, type SyncDirection as l, type SyncStatus as m, type SyncError as n, type SyncProgress as o, type CreateSpaceOptions as p, type AddBackendOptions as q, type AddSyncRuleOptions as r, type ScanLocalOptions as s, type UploadFileOptions as t, type DownloadFileOptions as u, type LocalFileInfo as v, type QueueStatus as w, type SyncQueueEntry as x, type AddToQueueOptions as y, type QueueFileEntry as z };
|
|
@@ -107,7 +107,7 @@ interface LocalFileInfo {
|
|
|
107
107
|
modifiedAt: string | null;
|
|
108
108
|
}
|
|
109
109
|
type FileSyncState = "synced" | "syncing" | "localOnly" | "remoteOnly" | "conflict" | "error";
|
|
110
|
-
interface StorageBackendInfo {
|
|
110
|
+
interface StorageBackendInfo$1 {
|
|
111
111
|
id: string;
|
|
112
112
|
type: StorageBackendType;
|
|
113
113
|
name: string;
|
|
@@ -214,6 +214,96 @@ interface DownloadFileOptions {
|
|
|
214
214
|
fileId: string;
|
|
215
215
|
localPath: string;
|
|
216
216
|
}
|
|
217
|
+
/** Queue operation type */
|
|
218
|
+
type QueueOperation = 'upload' | 'download';
|
|
219
|
+
/** Queue entry status */
|
|
220
|
+
type QueueStatus = 'pending' | 'inProgress' | 'completed' | 'failed';
|
|
221
|
+
/** Queue operation constants */
|
|
222
|
+
declare const QUEUE_OPERATION: {
|
|
223
|
+
UPLOAD: "upload";
|
|
224
|
+
DOWNLOAD: "download";
|
|
225
|
+
};
|
|
226
|
+
/** Queue status constants */
|
|
227
|
+
declare const QUEUE_STATUS: {
|
|
228
|
+
PENDING: "pending";
|
|
229
|
+
IN_PROGRESS: "inProgress";
|
|
230
|
+
COMPLETED: "completed";
|
|
231
|
+
FAILED: "failed";
|
|
232
|
+
};
|
|
233
|
+
/** A sync queue entry representing a pending or in-progress file operation */
|
|
234
|
+
interface SyncQueueEntry {
|
|
235
|
+
id: string;
|
|
236
|
+
/** Device ID this entry belongs to */
|
|
237
|
+
deviceId: string;
|
|
238
|
+
/** Sync rule ID */
|
|
239
|
+
ruleId: string;
|
|
240
|
+
/** Full local path */
|
|
241
|
+
localPath: string;
|
|
242
|
+
/** Relative path from sync root (used as remote path) */
|
|
243
|
+
relativePath: string;
|
|
244
|
+
/** Operation type (upload/download) */
|
|
245
|
+
operation: QueueOperation;
|
|
246
|
+
/** Current status */
|
|
247
|
+
status: QueueStatus;
|
|
248
|
+
/** Priority (lower = higher priority) */
|
|
249
|
+
priority: number;
|
|
250
|
+
/** File size in bytes */
|
|
251
|
+
fileSize: number;
|
|
252
|
+
/** Error message if failed */
|
|
253
|
+
errorMessage: string | null;
|
|
254
|
+
/** Number of retry attempts */
|
|
255
|
+
retryCount: number;
|
|
256
|
+
/** When the entry was created */
|
|
257
|
+
createdAt: string;
|
|
258
|
+
/** When processing started */
|
|
259
|
+
startedAt: string | null;
|
|
260
|
+
/** When processing completed */
|
|
261
|
+
completedAt: string | null;
|
|
262
|
+
}
|
|
263
|
+
/** Request to add files to the sync queue */
|
|
264
|
+
interface AddToQueueOptions {
|
|
265
|
+
/** Sync rule ID */
|
|
266
|
+
ruleId: string;
|
|
267
|
+
/** Files to add */
|
|
268
|
+
files: QueueFileEntry[];
|
|
269
|
+
/** Operation type */
|
|
270
|
+
operation: QueueOperation;
|
|
271
|
+
/** Priority (optional, default 100) */
|
|
272
|
+
priority?: number;
|
|
273
|
+
}
|
|
274
|
+
/** A file entry for adding to the queue */
|
|
275
|
+
interface QueueFileEntry {
|
|
276
|
+
/** Full local path */
|
|
277
|
+
localPath: string;
|
|
278
|
+
/** Relative path from sync root */
|
|
279
|
+
relativePath: string;
|
|
280
|
+
/** File size in bytes */
|
|
281
|
+
fileSize: number;
|
|
282
|
+
}
|
|
283
|
+
/** Request to get queue entries */
|
|
284
|
+
interface GetQueueOptions {
|
|
285
|
+
/** Filter by rule ID (optional) */
|
|
286
|
+
ruleId?: string;
|
|
287
|
+
/** Filter by status (optional) */
|
|
288
|
+
status?: QueueStatus;
|
|
289
|
+
/** Include completed entries (default: false) */
|
|
290
|
+
includeCompleted?: boolean;
|
|
291
|
+
}
|
|
292
|
+
/** Aggregated queue status */
|
|
293
|
+
interface QueueSummary {
|
|
294
|
+
/** Number of pending items */
|
|
295
|
+
pendingCount: number;
|
|
296
|
+
/** Number of in-progress items */
|
|
297
|
+
inProgressCount: number;
|
|
298
|
+
/** Number of completed items */
|
|
299
|
+
completedCount: number;
|
|
300
|
+
/** Number of failed items */
|
|
301
|
+
failedCount: number;
|
|
302
|
+
/** Total bytes pending (sum of file_size for pending items) */
|
|
303
|
+
pendingBytes: number;
|
|
304
|
+
/** Currently processing entry (if any) */
|
|
305
|
+
currentEntry: SyncQueueEntry | null;
|
|
306
|
+
}
|
|
217
307
|
/**
|
|
218
308
|
* File Sync API for E2E encrypted file synchronization
|
|
219
309
|
*
|
|
@@ -262,11 +352,11 @@ declare class FileSyncAPI {
|
|
|
262
352
|
/**
|
|
263
353
|
* List configured storage backends
|
|
264
354
|
*/
|
|
265
|
-
listBackendsAsync(): Promise<StorageBackendInfo[]>;
|
|
355
|
+
listBackendsAsync(): Promise<StorageBackendInfo$1[]>;
|
|
266
356
|
/**
|
|
267
357
|
* Add a new storage backend
|
|
268
358
|
*/
|
|
269
|
-
addBackendAsync(options: AddBackendOptions): Promise<StorageBackendInfo>;
|
|
359
|
+
addBackendAsync(options: AddBackendOptions): Promise<StorageBackendInfo$1>;
|
|
270
360
|
/**
|
|
271
361
|
* Remove a storage backend
|
|
272
362
|
*/
|
|
@@ -315,6 +405,46 @@ declare class FileSyncAPI {
|
|
|
315
405
|
* Open a folder selection dialog
|
|
316
406
|
*/
|
|
317
407
|
selectFolderAsync(): Promise<string | null>;
|
|
408
|
+
/**
|
|
409
|
+
* Add files to the sync queue
|
|
410
|
+
*/
|
|
411
|
+
addToQueueAsync(options: AddToQueueOptions): Promise<SyncQueueEntry[]>;
|
|
412
|
+
/**
|
|
413
|
+
* Get queue entries for the current device
|
|
414
|
+
*/
|
|
415
|
+
getQueueAsync(options?: GetQueueOptions): Promise<SyncQueueEntry[]>;
|
|
416
|
+
/**
|
|
417
|
+
* Get aggregated queue summary for the current device
|
|
418
|
+
*/
|
|
419
|
+
getQueueSummaryAsync(): Promise<QueueSummary>;
|
|
420
|
+
/**
|
|
421
|
+
* Mark a queue entry as started (in_progress)
|
|
422
|
+
*/
|
|
423
|
+
startQueueEntryAsync(entryId: string): Promise<void>;
|
|
424
|
+
/**
|
|
425
|
+
* Mark a queue entry as completed
|
|
426
|
+
*/
|
|
427
|
+
completeQueueEntryAsync(entryId: string): Promise<void>;
|
|
428
|
+
/**
|
|
429
|
+
* Mark a queue entry as failed
|
|
430
|
+
*/
|
|
431
|
+
failQueueEntryAsync(entryId: string, errorMessage: string): Promise<void>;
|
|
432
|
+
/**
|
|
433
|
+
* Retry all failed queue entries (reset to pending)
|
|
434
|
+
*/
|
|
435
|
+
retryFailedQueueAsync(): Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Remove a queue entry
|
|
438
|
+
*/
|
|
439
|
+
removeQueueEntryAsync(entryId: string): Promise<void>;
|
|
440
|
+
/**
|
|
441
|
+
* Clear all queue entries for a sync rule
|
|
442
|
+
*/
|
|
443
|
+
clearQueueAsync(ruleId: string): Promise<void>;
|
|
444
|
+
/**
|
|
445
|
+
* Reset in_progress entries to pending (for recovery after crash)
|
|
446
|
+
*/
|
|
447
|
+
recoverQueueAsync(): Promise<void>;
|
|
318
448
|
}
|
|
319
449
|
|
|
320
450
|
interface SaveFileOptions {
|
|
@@ -458,6 +588,135 @@ declare class PermissionsAPI {
|
|
|
458
588
|
checkFilesystemAsync(path: string, operation: "read" | "write"): Promise<boolean>;
|
|
459
589
|
}
|
|
460
590
|
|
|
591
|
+
/**
|
|
592
|
+
* Storage backend info (public, without credentials)
|
|
593
|
+
*/
|
|
594
|
+
interface StorageBackendInfo {
|
|
595
|
+
id: string;
|
|
596
|
+
/** Backend type (e.g., "s3") */
|
|
597
|
+
type: string;
|
|
598
|
+
name: string;
|
|
599
|
+
enabled: boolean;
|
|
600
|
+
createdAt: string;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* S3-compatible backend configuration
|
|
604
|
+
*/
|
|
605
|
+
interface S3Config {
|
|
606
|
+
/** Custom endpoint URL (for non-AWS S3-compatible services) */
|
|
607
|
+
endpoint?: string;
|
|
608
|
+
/** AWS region or custom region name */
|
|
609
|
+
region: string;
|
|
610
|
+
/** Bucket name */
|
|
611
|
+
bucket: string;
|
|
612
|
+
/** Access key ID */
|
|
613
|
+
accessKeyId: string;
|
|
614
|
+
/** Secret access key */
|
|
615
|
+
secretAccessKey: string;
|
|
616
|
+
/** Use path-style URLs instead of virtual-hosted-style */
|
|
617
|
+
pathStyle?: boolean;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Request to add a new storage backend
|
|
621
|
+
*/
|
|
622
|
+
interface AddBackendRequest {
|
|
623
|
+
/** Display name for the backend */
|
|
624
|
+
name: string;
|
|
625
|
+
/** Backend type (currently only "s3") */
|
|
626
|
+
type: "s3";
|
|
627
|
+
/** Configuration (structure depends on type) */
|
|
628
|
+
config: S3Config | Record<string, unknown>;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Object info from list operation
|
|
632
|
+
*/
|
|
633
|
+
interface StorageObjectInfo {
|
|
634
|
+
/** Object key */
|
|
635
|
+
key: string;
|
|
636
|
+
/** Size in bytes */
|
|
637
|
+
size: number;
|
|
638
|
+
/** Last modified timestamp (ISO 8601) */
|
|
639
|
+
lastModified?: string;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Remote Storage API for S3-compatible (and future WebDAV, FTP) backends.
|
|
643
|
+
*
|
|
644
|
+
* This API provides access to external storage backends configured centrally
|
|
645
|
+
* in haex-vault. Extensions can upload/download files without CORS issues.
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* // List available backends
|
|
650
|
+
* const backends = await sdk.remoteStorage.backends.list();
|
|
651
|
+
*
|
|
652
|
+
* // Upload data
|
|
653
|
+
* const data = new TextEncoder().encode("Hello World");
|
|
654
|
+
* await sdk.remoteStorage.upload(backendId, "path/to/file.txt", data);
|
|
655
|
+
*
|
|
656
|
+
* // Download data
|
|
657
|
+
* const downloaded = await sdk.remoteStorage.download(backendId, "path/to/file.txt");
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
declare class RemoteStorageAPI {
|
|
661
|
+
private client;
|
|
662
|
+
readonly backends: BackendManagement;
|
|
663
|
+
constructor(client: HaexVaultSdk);
|
|
664
|
+
/**
|
|
665
|
+
* Upload data to a storage backend
|
|
666
|
+
* @param backendId - Backend ID to upload to
|
|
667
|
+
* @param key - Object key (path in the bucket)
|
|
668
|
+
* @param data - Data to upload
|
|
669
|
+
*/
|
|
670
|
+
upload(backendId: string, key: string, data: Uint8Array): Promise<void>;
|
|
671
|
+
/**
|
|
672
|
+
* Download data from a storage backend
|
|
673
|
+
* @param backendId - Backend ID to download from
|
|
674
|
+
* @param key - Object key (path in the bucket)
|
|
675
|
+
* @returns Downloaded data as Uint8Array
|
|
676
|
+
*/
|
|
677
|
+
download(backendId: string, key: string): Promise<Uint8Array>;
|
|
678
|
+
/**
|
|
679
|
+
* Delete an object from a storage backend
|
|
680
|
+
* @param backendId - Backend ID
|
|
681
|
+
* @param key - Object key to delete
|
|
682
|
+
*/
|
|
683
|
+
delete(backendId: string, key: string): Promise<void>;
|
|
684
|
+
/**
|
|
685
|
+
* List objects in a storage backend
|
|
686
|
+
* @param backendId - Backend ID
|
|
687
|
+
* @param prefix - Optional prefix to filter objects
|
|
688
|
+
* @returns List of objects
|
|
689
|
+
*/
|
|
690
|
+
list(backendId: string, prefix?: string): Promise<StorageObjectInfo[]>;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Backend management operations
|
|
694
|
+
*/
|
|
695
|
+
declare class BackendManagement {
|
|
696
|
+
private client;
|
|
697
|
+
constructor(client: HaexVaultSdk);
|
|
698
|
+
/**
|
|
699
|
+
* List all available storage backends
|
|
700
|
+
*/
|
|
701
|
+
list(): Promise<StorageBackendInfo[]>;
|
|
702
|
+
/**
|
|
703
|
+
* Add a new storage backend
|
|
704
|
+
* @param request - Backend configuration
|
|
705
|
+
* @returns Created backend info
|
|
706
|
+
*/
|
|
707
|
+
add(request: AddBackendRequest): Promise<StorageBackendInfo>;
|
|
708
|
+
/**
|
|
709
|
+
* Remove a storage backend
|
|
710
|
+
* @param backendId - Backend ID to remove
|
|
711
|
+
*/
|
|
712
|
+
remove(backendId: string): Promise<void>;
|
|
713
|
+
/**
|
|
714
|
+
* Test connection to a storage backend
|
|
715
|
+
* @param backendId - Backend ID to test
|
|
716
|
+
*/
|
|
717
|
+
test(backendId: string): Promise<void>;
|
|
718
|
+
}
|
|
719
|
+
|
|
461
720
|
/**
|
|
462
721
|
* HaexVault Client
|
|
463
722
|
*
|
|
@@ -488,6 +747,7 @@ declare class HaexVaultSdk {
|
|
|
488
747
|
readonly filesystem: FilesystemAPI;
|
|
489
748
|
readonly web: WebAPI;
|
|
490
749
|
readonly permissions: PermissionsAPI;
|
|
750
|
+
readonly remoteStorage: RemoteStorageAPI;
|
|
491
751
|
constructor(config?: HaexHubConfig);
|
|
492
752
|
ready(): Promise<void>;
|
|
493
753
|
get setupCompleted(): boolean;
|
|
@@ -531,4 +791,4 @@ declare class HaexVaultSdk {
|
|
|
531
791
|
private log;
|
|
532
792
|
}
|
|
533
793
|
|
|
534
|
-
export { type
|
|
794
|
+
export { type AddBackendRequest as A, type BackendConfig as B, type ConflictStrategy as C, DatabaseAPI as D, type QueueSummary as E, FilesystemAPI as F, type GetQueueOptions as G, HaexVaultSdk as H, FILE_SYNC_STATE as I, SYNC_DIRECTION as J, STORAGE_BACKEND_TYPE as K, type ListFilesOptions as L, CONFLICT_STRATEGY as M, QUEUE_OPERATION as N, QUEUE_STATUS as O, PermissionsAPI as P, type QueueOperation as Q, RemoteStorageAPI as R, StorageAPI as S, type UpdateSyncRuleOptions as U, WebAPI as W, FileSyncAPI as a, type StorageBackendInfo as b, type S3Config as c, type StorageObjectInfo as d, type FileSpace as e, type FileInfo as f, type FileSyncState as g, type StorageBackendInfo$1 as h, type StorageBackendType as i, type S3BackendConfig as j, type SyncRule as k, type SyncDirection as l, type SyncStatus as m, type SyncError as n, type SyncProgress as o, type CreateSpaceOptions as p, type AddBackendOptions as q, type AddSyncRuleOptions as r, type ScanLocalOptions as s, type UploadFileOptions as t, type DownloadFileOptions as u, type LocalFileInfo as v, type QueueStatus as w, type SyncQueueEntry as x, type AddToQueueOptions as y, type QueueFileEntry as z };
|