@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
|
@@ -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;
|
|
@@ -352,11 +352,11 @@ declare class FileSyncAPI {
|
|
|
352
352
|
/**
|
|
353
353
|
* List configured storage backends
|
|
354
354
|
*/
|
|
355
|
-
listBackendsAsync(): Promise<StorageBackendInfo[]>;
|
|
355
|
+
listBackendsAsync(): Promise<StorageBackendInfo$1[]>;
|
|
356
356
|
/**
|
|
357
357
|
* Add a new storage backend
|
|
358
358
|
*/
|
|
359
|
-
addBackendAsync(options: AddBackendOptions): Promise<StorageBackendInfo>;
|
|
359
|
+
addBackendAsync(options: AddBackendOptions): Promise<StorageBackendInfo$1>;
|
|
360
360
|
/**
|
|
361
361
|
* Remove a storage backend
|
|
362
362
|
*/
|
|
@@ -502,6 +502,64 @@ interface ShowImageResult {
|
|
|
502
502
|
*/
|
|
503
503
|
success: boolean;
|
|
504
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* File/directory metadata
|
|
507
|
+
*/
|
|
508
|
+
interface FileStat {
|
|
509
|
+
/** File size in bytes */
|
|
510
|
+
size: number;
|
|
511
|
+
/** True if this is a file */
|
|
512
|
+
isFile: boolean;
|
|
513
|
+
/** True if this is a directory */
|
|
514
|
+
isDirectory: boolean;
|
|
515
|
+
/** True if this is a symbolic link */
|
|
516
|
+
isSymlink: boolean;
|
|
517
|
+
/** Last modified time (Unix timestamp in milliseconds) */
|
|
518
|
+
modified?: number;
|
|
519
|
+
/** Created time (Unix timestamp in milliseconds) */
|
|
520
|
+
created?: number;
|
|
521
|
+
/** Whether the file is read-only */
|
|
522
|
+
readonly: boolean;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Directory entry
|
|
526
|
+
*/
|
|
527
|
+
interface DirEntry {
|
|
528
|
+
/** Entry name (not full path) */
|
|
529
|
+
name: string;
|
|
530
|
+
/** Full path */
|
|
531
|
+
path: string;
|
|
532
|
+
/** True if this is a file */
|
|
533
|
+
isFile: boolean;
|
|
534
|
+
/** True if this is a directory */
|
|
535
|
+
isDirectory: boolean;
|
|
536
|
+
/** File size in bytes (0 for directories) */
|
|
537
|
+
size: number;
|
|
538
|
+
/** Last modified time (Unix timestamp in milliseconds) */
|
|
539
|
+
modified?: number;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Options for selecting a folder
|
|
543
|
+
*/
|
|
544
|
+
interface SelectFolderOptions {
|
|
545
|
+
/** Dialog title */
|
|
546
|
+
title?: string;
|
|
547
|
+
/** Default path to open */
|
|
548
|
+
defaultPath?: string;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Options for selecting files
|
|
552
|
+
*/
|
|
553
|
+
interface SelectFileOptions {
|
|
554
|
+
/** Dialog title */
|
|
555
|
+
title?: string;
|
|
556
|
+
/** Default path to open */
|
|
557
|
+
defaultPath?: string;
|
|
558
|
+
/** File filters (name -> extensions) */
|
|
559
|
+
filters?: Array<[string, string[]]>;
|
|
560
|
+
/** Allow multiple file selection */
|
|
561
|
+
multiple?: boolean;
|
|
562
|
+
}
|
|
505
563
|
declare class FilesystemAPI {
|
|
506
564
|
private client;
|
|
507
565
|
readonly sync: FileSyncAPI;
|
|
@@ -528,6 +586,71 @@ declare class FilesystemAPI {
|
|
|
528
586
|
* @returns The result of the operation
|
|
529
587
|
*/
|
|
530
588
|
showImageAsync(options: ShowImageOptions): Promise<ShowImageResult>;
|
|
589
|
+
/**
|
|
590
|
+
* Read file contents
|
|
591
|
+
* @param path Absolute path to the file
|
|
592
|
+
* @returns File contents as Uint8Array
|
|
593
|
+
*/
|
|
594
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
595
|
+
/**
|
|
596
|
+
* Write file contents
|
|
597
|
+
* @param path Absolute path to the file
|
|
598
|
+
* @param data File contents as Uint8Array
|
|
599
|
+
*/
|
|
600
|
+
writeFile(path: string, data: Uint8Array): Promise<void>;
|
|
601
|
+
/**
|
|
602
|
+
* Read directory contents
|
|
603
|
+
* @param path Absolute path to the directory
|
|
604
|
+
* @returns Array of directory entries
|
|
605
|
+
*/
|
|
606
|
+
readDir(path: string): Promise<DirEntry[]>;
|
|
607
|
+
/**
|
|
608
|
+
* Create a directory (and parent directories if needed)
|
|
609
|
+
* @param path Absolute path to create
|
|
610
|
+
*/
|
|
611
|
+
mkdir(path: string): Promise<void>;
|
|
612
|
+
/**
|
|
613
|
+
* Remove a file or directory
|
|
614
|
+
* @param path Absolute path to remove
|
|
615
|
+
* @param recursive If true, remove directories recursively
|
|
616
|
+
*/
|
|
617
|
+
remove(path: string, recursive?: boolean): Promise<void>;
|
|
618
|
+
/**
|
|
619
|
+
* Check if a path exists
|
|
620
|
+
* @param path Absolute path to check
|
|
621
|
+
* @returns True if the path exists
|
|
622
|
+
*/
|
|
623
|
+
exists(path: string): Promise<boolean>;
|
|
624
|
+
/**
|
|
625
|
+
* Get file/directory metadata
|
|
626
|
+
* @param path Absolute path
|
|
627
|
+
* @returns File metadata
|
|
628
|
+
*/
|
|
629
|
+
stat(path: string): Promise<FileStat>;
|
|
630
|
+
/**
|
|
631
|
+
* Open a folder selection dialog
|
|
632
|
+
* @param options Dialog options
|
|
633
|
+
* @returns Selected folder path, or null if cancelled
|
|
634
|
+
*/
|
|
635
|
+
selectFolder(options?: SelectFolderOptions): Promise<string | null>;
|
|
636
|
+
/**
|
|
637
|
+
* Open a file selection dialog
|
|
638
|
+
* @param options Dialog options
|
|
639
|
+
* @returns Selected file paths, or null if cancelled
|
|
640
|
+
*/
|
|
641
|
+
selectFile(options?: SelectFileOptions): Promise<string[] | null>;
|
|
642
|
+
/**
|
|
643
|
+
* Rename/move a file or directory
|
|
644
|
+
* @param from Source path
|
|
645
|
+
* @param to Destination path
|
|
646
|
+
*/
|
|
647
|
+
rename(from: string, to: string): Promise<void>;
|
|
648
|
+
/**
|
|
649
|
+
* Copy a file
|
|
650
|
+
* @param from Source path
|
|
651
|
+
* @param to Destination path
|
|
652
|
+
*/
|
|
653
|
+
copy(from: string, to: string): Promise<void>;
|
|
531
654
|
}
|
|
532
655
|
|
|
533
656
|
declare class WebAPI {
|
|
@@ -588,6 +711,135 @@ declare class PermissionsAPI {
|
|
|
588
711
|
checkFilesystemAsync(path: string, operation: "read" | "write"): Promise<boolean>;
|
|
589
712
|
}
|
|
590
713
|
|
|
714
|
+
/**
|
|
715
|
+
* Storage backend info (public, without credentials)
|
|
716
|
+
*/
|
|
717
|
+
interface StorageBackendInfo {
|
|
718
|
+
id: string;
|
|
719
|
+
/** Backend type (e.g., "s3") */
|
|
720
|
+
type: string;
|
|
721
|
+
name: string;
|
|
722
|
+
enabled: boolean;
|
|
723
|
+
createdAt: string;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* S3-compatible backend configuration
|
|
727
|
+
*/
|
|
728
|
+
interface S3Config {
|
|
729
|
+
/** Custom endpoint URL (for non-AWS S3-compatible services) */
|
|
730
|
+
endpoint?: string;
|
|
731
|
+
/** AWS region or custom region name */
|
|
732
|
+
region: string;
|
|
733
|
+
/** Bucket name */
|
|
734
|
+
bucket: string;
|
|
735
|
+
/** Access key ID */
|
|
736
|
+
accessKeyId: string;
|
|
737
|
+
/** Secret access key */
|
|
738
|
+
secretAccessKey: string;
|
|
739
|
+
/** Use path-style URLs instead of virtual-hosted-style */
|
|
740
|
+
pathStyle?: boolean;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Request to add a new storage backend
|
|
744
|
+
*/
|
|
745
|
+
interface AddBackendRequest {
|
|
746
|
+
/** Display name for the backend */
|
|
747
|
+
name: string;
|
|
748
|
+
/** Backend type (currently only "s3") */
|
|
749
|
+
type: "s3";
|
|
750
|
+
/** Configuration (structure depends on type) */
|
|
751
|
+
config: S3Config | Record<string, unknown>;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Object info from list operation
|
|
755
|
+
*/
|
|
756
|
+
interface StorageObjectInfo {
|
|
757
|
+
/** Object key */
|
|
758
|
+
key: string;
|
|
759
|
+
/** Size in bytes */
|
|
760
|
+
size: number;
|
|
761
|
+
/** Last modified timestamp (ISO 8601) */
|
|
762
|
+
lastModified?: string;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Remote Storage API for S3-compatible (and future WebDAV, FTP) backends.
|
|
766
|
+
*
|
|
767
|
+
* This API provides access to external storage backends configured centrally
|
|
768
|
+
* in haex-vault. Extensions can upload/download files without CORS issues.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```typescript
|
|
772
|
+
* // List available backends
|
|
773
|
+
* const backends = await sdk.remoteStorage.backends.list();
|
|
774
|
+
*
|
|
775
|
+
* // Upload data
|
|
776
|
+
* const data = new TextEncoder().encode("Hello World");
|
|
777
|
+
* await sdk.remoteStorage.upload(backendId, "path/to/file.txt", data);
|
|
778
|
+
*
|
|
779
|
+
* // Download data
|
|
780
|
+
* const downloaded = await sdk.remoteStorage.download(backendId, "path/to/file.txt");
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
declare class RemoteStorageAPI {
|
|
784
|
+
private client;
|
|
785
|
+
readonly backends: BackendManagement;
|
|
786
|
+
constructor(client: HaexVaultSdk);
|
|
787
|
+
/**
|
|
788
|
+
* Upload data to a storage backend
|
|
789
|
+
* @param backendId - Backend ID to upload to
|
|
790
|
+
* @param key - Object key (path in the bucket)
|
|
791
|
+
* @param data - Data to upload
|
|
792
|
+
*/
|
|
793
|
+
upload(backendId: string, key: string, data: Uint8Array): Promise<void>;
|
|
794
|
+
/**
|
|
795
|
+
* Download data from a storage backend
|
|
796
|
+
* @param backendId - Backend ID to download from
|
|
797
|
+
* @param key - Object key (path in the bucket)
|
|
798
|
+
* @returns Downloaded data as Uint8Array
|
|
799
|
+
*/
|
|
800
|
+
download(backendId: string, key: string): Promise<Uint8Array>;
|
|
801
|
+
/**
|
|
802
|
+
* Delete an object from a storage backend
|
|
803
|
+
* @param backendId - Backend ID
|
|
804
|
+
* @param key - Object key to delete
|
|
805
|
+
*/
|
|
806
|
+
delete(backendId: string, key: string): Promise<void>;
|
|
807
|
+
/**
|
|
808
|
+
* List objects in a storage backend
|
|
809
|
+
* @param backendId - Backend ID
|
|
810
|
+
* @param prefix - Optional prefix to filter objects
|
|
811
|
+
* @returns List of objects
|
|
812
|
+
*/
|
|
813
|
+
list(backendId: string, prefix?: string): Promise<StorageObjectInfo[]>;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Backend management operations
|
|
817
|
+
*/
|
|
818
|
+
declare class BackendManagement {
|
|
819
|
+
private client;
|
|
820
|
+
constructor(client: HaexVaultSdk);
|
|
821
|
+
/**
|
|
822
|
+
* List all available storage backends
|
|
823
|
+
*/
|
|
824
|
+
list(): Promise<StorageBackendInfo[]>;
|
|
825
|
+
/**
|
|
826
|
+
* Add a new storage backend
|
|
827
|
+
* @param request - Backend configuration
|
|
828
|
+
* @returns Created backend info
|
|
829
|
+
*/
|
|
830
|
+
add(request: AddBackendRequest): Promise<StorageBackendInfo>;
|
|
831
|
+
/**
|
|
832
|
+
* Remove a storage backend
|
|
833
|
+
* @param backendId - Backend ID to remove
|
|
834
|
+
*/
|
|
835
|
+
remove(backendId: string): Promise<void>;
|
|
836
|
+
/**
|
|
837
|
+
* Test connection to a storage backend
|
|
838
|
+
* @param backendId - Backend ID to test
|
|
839
|
+
*/
|
|
840
|
+
test(backendId: string): Promise<void>;
|
|
841
|
+
}
|
|
842
|
+
|
|
591
843
|
/**
|
|
592
844
|
* HaexVault Client
|
|
593
845
|
*
|
|
@@ -618,6 +870,7 @@ declare class HaexVaultSdk {
|
|
|
618
870
|
readonly filesystem: FilesystemAPI;
|
|
619
871
|
readonly web: WebAPI;
|
|
620
872
|
readonly permissions: PermissionsAPI;
|
|
873
|
+
readonly remoteStorage: RemoteStorageAPI;
|
|
621
874
|
constructor(config?: HaexHubConfig);
|
|
622
875
|
ready(): Promise<void>;
|
|
623
876
|
get setupCompleted(): boolean;
|
|
@@ -661,4 +914,4 @@ declare class HaexVaultSdk {
|
|
|
661
914
|
private log;
|
|
662
915
|
}
|
|
663
916
|
|
|
664
|
-
export { type
|
|
917
|
+
export { type AddBackendRequest as A, type BackendConfig as B, type ConflictStrategy as C, DatabaseAPI as D, type QueueStatus as E, FilesystemAPI as F, type SyncQueueEntry as G, HaexVaultSdk as H, type AddToQueueOptions as I, type QueueFileEntry as J, type GetQueueOptions as K, type ListFilesOptions as L, type QueueSummary as M, FILE_SYNC_STATE as N, SYNC_DIRECTION as O, PermissionsAPI as P, type QueueOperation as Q, RemoteStorageAPI as R, StorageAPI as S, STORAGE_BACKEND_TYPE as T, type UpdateSyncRuleOptions as U, CONFLICT_STRATEGY as V, WebAPI as W, QUEUE_OPERATION as X, QUEUE_STATUS as Y, type FileStat as a, type DirEntry as b, type SelectFolderOptions as c, type SelectFileOptions as d, FileSyncAPI as e, type StorageBackendInfo as f, type S3Config as g, type StorageObjectInfo as h, type FileSpace as i, type FileInfo as j, type FileSyncState as k, type StorageBackendInfo$1 as l, type StorageBackendType as m, type S3BackendConfig as n, type SyncRule as o, type SyncDirection as p, type SyncStatus as q, type SyncError as r, type SyncProgress as s, type CreateSpaceOptions as t, type AddBackendOptions as u, type AddSyncRuleOptions as v, type ScanLocalOptions as w, type UploadFileOptions as x, type DownloadFileOptions as y, type LocalFileInfo 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;
|
|
@@ -352,11 +352,11 @@ declare class FileSyncAPI {
|
|
|
352
352
|
/**
|
|
353
353
|
* List configured storage backends
|
|
354
354
|
*/
|
|
355
|
-
listBackendsAsync(): Promise<StorageBackendInfo[]>;
|
|
355
|
+
listBackendsAsync(): Promise<StorageBackendInfo$1[]>;
|
|
356
356
|
/**
|
|
357
357
|
* Add a new storage backend
|
|
358
358
|
*/
|
|
359
|
-
addBackendAsync(options: AddBackendOptions): Promise<StorageBackendInfo>;
|
|
359
|
+
addBackendAsync(options: AddBackendOptions): Promise<StorageBackendInfo$1>;
|
|
360
360
|
/**
|
|
361
361
|
* Remove a storage backend
|
|
362
362
|
*/
|
|
@@ -502,6 +502,64 @@ interface ShowImageResult {
|
|
|
502
502
|
*/
|
|
503
503
|
success: boolean;
|
|
504
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* File/directory metadata
|
|
507
|
+
*/
|
|
508
|
+
interface FileStat {
|
|
509
|
+
/** File size in bytes */
|
|
510
|
+
size: number;
|
|
511
|
+
/** True if this is a file */
|
|
512
|
+
isFile: boolean;
|
|
513
|
+
/** True if this is a directory */
|
|
514
|
+
isDirectory: boolean;
|
|
515
|
+
/** True if this is a symbolic link */
|
|
516
|
+
isSymlink: boolean;
|
|
517
|
+
/** Last modified time (Unix timestamp in milliseconds) */
|
|
518
|
+
modified?: number;
|
|
519
|
+
/** Created time (Unix timestamp in milliseconds) */
|
|
520
|
+
created?: number;
|
|
521
|
+
/** Whether the file is read-only */
|
|
522
|
+
readonly: boolean;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Directory entry
|
|
526
|
+
*/
|
|
527
|
+
interface DirEntry {
|
|
528
|
+
/** Entry name (not full path) */
|
|
529
|
+
name: string;
|
|
530
|
+
/** Full path */
|
|
531
|
+
path: string;
|
|
532
|
+
/** True if this is a file */
|
|
533
|
+
isFile: boolean;
|
|
534
|
+
/** True if this is a directory */
|
|
535
|
+
isDirectory: boolean;
|
|
536
|
+
/** File size in bytes (0 for directories) */
|
|
537
|
+
size: number;
|
|
538
|
+
/** Last modified time (Unix timestamp in milliseconds) */
|
|
539
|
+
modified?: number;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Options for selecting a folder
|
|
543
|
+
*/
|
|
544
|
+
interface SelectFolderOptions {
|
|
545
|
+
/** Dialog title */
|
|
546
|
+
title?: string;
|
|
547
|
+
/** Default path to open */
|
|
548
|
+
defaultPath?: string;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Options for selecting files
|
|
552
|
+
*/
|
|
553
|
+
interface SelectFileOptions {
|
|
554
|
+
/** Dialog title */
|
|
555
|
+
title?: string;
|
|
556
|
+
/** Default path to open */
|
|
557
|
+
defaultPath?: string;
|
|
558
|
+
/** File filters (name -> extensions) */
|
|
559
|
+
filters?: Array<[string, string[]]>;
|
|
560
|
+
/** Allow multiple file selection */
|
|
561
|
+
multiple?: boolean;
|
|
562
|
+
}
|
|
505
563
|
declare class FilesystemAPI {
|
|
506
564
|
private client;
|
|
507
565
|
readonly sync: FileSyncAPI;
|
|
@@ -528,6 +586,71 @@ declare class FilesystemAPI {
|
|
|
528
586
|
* @returns The result of the operation
|
|
529
587
|
*/
|
|
530
588
|
showImageAsync(options: ShowImageOptions): Promise<ShowImageResult>;
|
|
589
|
+
/**
|
|
590
|
+
* Read file contents
|
|
591
|
+
* @param path Absolute path to the file
|
|
592
|
+
* @returns File contents as Uint8Array
|
|
593
|
+
*/
|
|
594
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
595
|
+
/**
|
|
596
|
+
* Write file contents
|
|
597
|
+
* @param path Absolute path to the file
|
|
598
|
+
* @param data File contents as Uint8Array
|
|
599
|
+
*/
|
|
600
|
+
writeFile(path: string, data: Uint8Array): Promise<void>;
|
|
601
|
+
/**
|
|
602
|
+
* Read directory contents
|
|
603
|
+
* @param path Absolute path to the directory
|
|
604
|
+
* @returns Array of directory entries
|
|
605
|
+
*/
|
|
606
|
+
readDir(path: string): Promise<DirEntry[]>;
|
|
607
|
+
/**
|
|
608
|
+
* Create a directory (and parent directories if needed)
|
|
609
|
+
* @param path Absolute path to create
|
|
610
|
+
*/
|
|
611
|
+
mkdir(path: string): Promise<void>;
|
|
612
|
+
/**
|
|
613
|
+
* Remove a file or directory
|
|
614
|
+
* @param path Absolute path to remove
|
|
615
|
+
* @param recursive If true, remove directories recursively
|
|
616
|
+
*/
|
|
617
|
+
remove(path: string, recursive?: boolean): Promise<void>;
|
|
618
|
+
/**
|
|
619
|
+
* Check if a path exists
|
|
620
|
+
* @param path Absolute path to check
|
|
621
|
+
* @returns True if the path exists
|
|
622
|
+
*/
|
|
623
|
+
exists(path: string): Promise<boolean>;
|
|
624
|
+
/**
|
|
625
|
+
* Get file/directory metadata
|
|
626
|
+
* @param path Absolute path
|
|
627
|
+
* @returns File metadata
|
|
628
|
+
*/
|
|
629
|
+
stat(path: string): Promise<FileStat>;
|
|
630
|
+
/**
|
|
631
|
+
* Open a folder selection dialog
|
|
632
|
+
* @param options Dialog options
|
|
633
|
+
* @returns Selected folder path, or null if cancelled
|
|
634
|
+
*/
|
|
635
|
+
selectFolder(options?: SelectFolderOptions): Promise<string | null>;
|
|
636
|
+
/**
|
|
637
|
+
* Open a file selection dialog
|
|
638
|
+
* @param options Dialog options
|
|
639
|
+
* @returns Selected file paths, or null if cancelled
|
|
640
|
+
*/
|
|
641
|
+
selectFile(options?: SelectFileOptions): Promise<string[] | null>;
|
|
642
|
+
/**
|
|
643
|
+
* Rename/move a file or directory
|
|
644
|
+
* @param from Source path
|
|
645
|
+
* @param to Destination path
|
|
646
|
+
*/
|
|
647
|
+
rename(from: string, to: string): Promise<void>;
|
|
648
|
+
/**
|
|
649
|
+
* Copy a file
|
|
650
|
+
* @param from Source path
|
|
651
|
+
* @param to Destination path
|
|
652
|
+
*/
|
|
653
|
+
copy(from: string, to: string): Promise<void>;
|
|
531
654
|
}
|
|
532
655
|
|
|
533
656
|
declare class WebAPI {
|
|
@@ -588,6 +711,135 @@ declare class PermissionsAPI {
|
|
|
588
711
|
checkFilesystemAsync(path: string, operation: "read" | "write"): Promise<boolean>;
|
|
589
712
|
}
|
|
590
713
|
|
|
714
|
+
/**
|
|
715
|
+
* Storage backend info (public, without credentials)
|
|
716
|
+
*/
|
|
717
|
+
interface StorageBackendInfo {
|
|
718
|
+
id: string;
|
|
719
|
+
/** Backend type (e.g., "s3") */
|
|
720
|
+
type: string;
|
|
721
|
+
name: string;
|
|
722
|
+
enabled: boolean;
|
|
723
|
+
createdAt: string;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* S3-compatible backend configuration
|
|
727
|
+
*/
|
|
728
|
+
interface S3Config {
|
|
729
|
+
/** Custom endpoint URL (for non-AWS S3-compatible services) */
|
|
730
|
+
endpoint?: string;
|
|
731
|
+
/** AWS region or custom region name */
|
|
732
|
+
region: string;
|
|
733
|
+
/** Bucket name */
|
|
734
|
+
bucket: string;
|
|
735
|
+
/** Access key ID */
|
|
736
|
+
accessKeyId: string;
|
|
737
|
+
/** Secret access key */
|
|
738
|
+
secretAccessKey: string;
|
|
739
|
+
/** Use path-style URLs instead of virtual-hosted-style */
|
|
740
|
+
pathStyle?: boolean;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Request to add a new storage backend
|
|
744
|
+
*/
|
|
745
|
+
interface AddBackendRequest {
|
|
746
|
+
/** Display name for the backend */
|
|
747
|
+
name: string;
|
|
748
|
+
/** Backend type (currently only "s3") */
|
|
749
|
+
type: "s3";
|
|
750
|
+
/** Configuration (structure depends on type) */
|
|
751
|
+
config: S3Config | Record<string, unknown>;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Object info from list operation
|
|
755
|
+
*/
|
|
756
|
+
interface StorageObjectInfo {
|
|
757
|
+
/** Object key */
|
|
758
|
+
key: string;
|
|
759
|
+
/** Size in bytes */
|
|
760
|
+
size: number;
|
|
761
|
+
/** Last modified timestamp (ISO 8601) */
|
|
762
|
+
lastModified?: string;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Remote Storage API for S3-compatible (and future WebDAV, FTP) backends.
|
|
766
|
+
*
|
|
767
|
+
* This API provides access to external storage backends configured centrally
|
|
768
|
+
* in haex-vault. Extensions can upload/download files without CORS issues.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* ```typescript
|
|
772
|
+
* // List available backends
|
|
773
|
+
* const backends = await sdk.remoteStorage.backends.list();
|
|
774
|
+
*
|
|
775
|
+
* // Upload data
|
|
776
|
+
* const data = new TextEncoder().encode("Hello World");
|
|
777
|
+
* await sdk.remoteStorage.upload(backendId, "path/to/file.txt", data);
|
|
778
|
+
*
|
|
779
|
+
* // Download data
|
|
780
|
+
* const downloaded = await sdk.remoteStorage.download(backendId, "path/to/file.txt");
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
declare class RemoteStorageAPI {
|
|
784
|
+
private client;
|
|
785
|
+
readonly backends: BackendManagement;
|
|
786
|
+
constructor(client: HaexVaultSdk);
|
|
787
|
+
/**
|
|
788
|
+
* Upload data to a storage backend
|
|
789
|
+
* @param backendId - Backend ID to upload to
|
|
790
|
+
* @param key - Object key (path in the bucket)
|
|
791
|
+
* @param data - Data to upload
|
|
792
|
+
*/
|
|
793
|
+
upload(backendId: string, key: string, data: Uint8Array): Promise<void>;
|
|
794
|
+
/**
|
|
795
|
+
* Download data from a storage backend
|
|
796
|
+
* @param backendId - Backend ID to download from
|
|
797
|
+
* @param key - Object key (path in the bucket)
|
|
798
|
+
* @returns Downloaded data as Uint8Array
|
|
799
|
+
*/
|
|
800
|
+
download(backendId: string, key: string): Promise<Uint8Array>;
|
|
801
|
+
/**
|
|
802
|
+
* Delete an object from a storage backend
|
|
803
|
+
* @param backendId - Backend ID
|
|
804
|
+
* @param key - Object key to delete
|
|
805
|
+
*/
|
|
806
|
+
delete(backendId: string, key: string): Promise<void>;
|
|
807
|
+
/**
|
|
808
|
+
* List objects in a storage backend
|
|
809
|
+
* @param backendId - Backend ID
|
|
810
|
+
* @param prefix - Optional prefix to filter objects
|
|
811
|
+
* @returns List of objects
|
|
812
|
+
*/
|
|
813
|
+
list(backendId: string, prefix?: string): Promise<StorageObjectInfo[]>;
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Backend management operations
|
|
817
|
+
*/
|
|
818
|
+
declare class BackendManagement {
|
|
819
|
+
private client;
|
|
820
|
+
constructor(client: HaexVaultSdk);
|
|
821
|
+
/**
|
|
822
|
+
* List all available storage backends
|
|
823
|
+
*/
|
|
824
|
+
list(): Promise<StorageBackendInfo[]>;
|
|
825
|
+
/**
|
|
826
|
+
* Add a new storage backend
|
|
827
|
+
* @param request - Backend configuration
|
|
828
|
+
* @returns Created backend info
|
|
829
|
+
*/
|
|
830
|
+
add(request: AddBackendRequest): Promise<StorageBackendInfo>;
|
|
831
|
+
/**
|
|
832
|
+
* Remove a storage backend
|
|
833
|
+
* @param backendId - Backend ID to remove
|
|
834
|
+
*/
|
|
835
|
+
remove(backendId: string): Promise<void>;
|
|
836
|
+
/**
|
|
837
|
+
* Test connection to a storage backend
|
|
838
|
+
* @param backendId - Backend ID to test
|
|
839
|
+
*/
|
|
840
|
+
test(backendId: string): Promise<void>;
|
|
841
|
+
}
|
|
842
|
+
|
|
591
843
|
/**
|
|
592
844
|
* HaexVault Client
|
|
593
845
|
*
|
|
@@ -618,6 +870,7 @@ declare class HaexVaultSdk {
|
|
|
618
870
|
readonly filesystem: FilesystemAPI;
|
|
619
871
|
readonly web: WebAPI;
|
|
620
872
|
readonly permissions: PermissionsAPI;
|
|
873
|
+
readonly remoteStorage: RemoteStorageAPI;
|
|
621
874
|
constructor(config?: HaexHubConfig);
|
|
622
875
|
ready(): Promise<void>;
|
|
623
876
|
get setupCompleted(): boolean;
|
|
@@ -661,4 +914,4 @@ declare class HaexVaultSdk {
|
|
|
661
914
|
private log;
|
|
662
915
|
}
|
|
663
916
|
|
|
664
|
-
export { type
|
|
917
|
+
export { type AddBackendRequest as A, type BackendConfig as B, type ConflictStrategy as C, DatabaseAPI as D, type QueueStatus as E, FilesystemAPI as F, type SyncQueueEntry as G, HaexVaultSdk as H, type AddToQueueOptions as I, type QueueFileEntry as J, type GetQueueOptions as K, type ListFilesOptions as L, type QueueSummary as M, FILE_SYNC_STATE as N, SYNC_DIRECTION as O, PermissionsAPI as P, type QueueOperation as Q, RemoteStorageAPI as R, StorageAPI as S, STORAGE_BACKEND_TYPE as T, type UpdateSyncRuleOptions as U, CONFLICT_STRATEGY as V, WebAPI as W, QUEUE_OPERATION as X, QUEUE_STATUS as Y, type FileStat as a, type DirEntry as b, type SelectFolderOptions as c, type SelectFileOptions as d, FileSyncAPI as e, type StorageBackendInfo as f, type S3Config as g, type StorageObjectInfo as h, type FileSpace as i, type FileInfo as j, type FileSyncState as k, type StorageBackendInfo$1 as l, type StorageBackendType as m, type S3BackendConfig as n, type SyncRule as o, type SyncDirection as p, type SyncStatus as q, type SyncError as r, type SyncProgress as s, type CreateSpaceOptions as t, type AddBackendOptions as u, type AddSyncRuleOptions as v, type ScanLocalOptions as w, type UploadFileOptions as x, type DownloadFileOptions as y, type LocalFileInfo as z };
|