@telecrypt-io/storage 0.3.0 → 0.5.7

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.
@@ -11,41 +11,50 @@
11
11
  * platform-specific and stays with the caller.
12
12
  */
13
13
  import { TeleCryptIOStorage } from "../TeleCryptIOStorage.js";
14
- import type { DownloadedFile, FileDetails, FileInfo, FolderDetails, FolderInfo, DeleteResult, JoinResult, Member, RecoveryRestore, RecoverySetup, RenameResult, ShareResult, UnshareResult } from "./types.js";
15
- export declare function createFolder(storage: TeleCryptIOStorage, name: string): Promise<FolderInfo>;
16
- /** Top-level folders only — excludes subdirectories of an existing tree. */
17
- export declare function listFolders(storage: TeleCryptIOStorage): Promise<FolderInfo[]>;
18
- /** Current account's effective role for a folder, or null while it is unavailable. */
19
- export declare function getMyFolderRole(storage: TeleCryptIOStorage, folderId: string): string | null;
20
- export declare function joinFolder(storage: TeleCryptIOStorage, folderId: string): Promise<JoinResult>;
14
+ import type { DownloadedFile, FolderDetails, FolderInfo, FileDetails, FileInfo, VaultDetails, VaultInfo, DeleteResult, JoinResult, Member, RecoveryRestore, RecoverySetup, RenameResult, ShareResult, UnshareResult } from "./types.js";
15
+ export interface OperationOptions {
16
+ /** Cancels bounded waits and rate-limit backoff before the next mutation. */
17
+ signal?: AbortSignal;
18
+ /** Total wall-clock budget for one mutation, including all descendants. */
19
+ timeoutMs?: number;
20
+ }
21
+ export declare function createVault(storage: TeleCryptIOStorage, name: string, options?: OperationOptions): Promise<VaultInfo>;
22
+ /** Top-level vaults only — excludes subdirectories of an existing tree. */
23
+ export declare function listVaults(storage: TeleCryptIOStorage, options?: OperationOptions): Promise<VaultInfo[]>;
24
+ /** Current account's effective role for a vault, or null while it is unavailable. */
25
+ export declare function getMyVaultRole(storage: TeleCryptIOStorage, vaultId: string): string | null;
26
+ export declare function joinVault(storage: TeleCryptIOStorage, vaultId: string, options?: OperationOptions): Promise<JoinResult>;
21
27
  /** Rooms where this account is invited and the room looks like a file tree. */
22
- export declare function listPendingInvites(storage: TeleCryptIOStorage): Promise<FolderInfo[]>;
23
- /** Decline a folder invite (same as leaving before join). */
24
- export declare function declineInvite(storage: TeleCryptIOStorage, folderId: string): Promise<{
25
- folderId: string;
28
+ export declare function listPendingInvites(storage: TeleCryptIOStorage, options?: OperationOptions): Promise<VaultInfo[]>;
29
+ /** Decline a vault invite (same as leaving before join). */
30
+ export declare function declineInvite(storage: TeleCryptIOStorage, vaultId: string, options?: OperationOptions): Promise<{
31
+ vaultId: string;
26
32
  declined: boolean;
27
33
  }>;
28
- /**
29
- * Invites `userId` to the folder at `role` and applies the role's
30
- * permissions. Doubles as "change an existing participant's role" (call
31
- * again with a different role): inviting someone who's already a member is
32
- * a 403 from the server, not a real failure — that specific error is
33
- * swallowed and the role change still applies. Any other invite failure
34
- * (e.g. unknown user) propagates.
35
- */
36
- export declare function shareFolder(storage: TeleCryptIOStorage, folderId: string, userId: string, role: string): Promise<ShareResult>;
37
- export declare function unshareFolder(storage: TeleCryptIOStorage, folderId: string, userId: string): Promise<UnshareResult>;
38
- export declare function listMembers(storage: TeleCryptIOStorage, folderId: string): Promise<Member[]>;
39
- export declare function listFiles(storage: TeleCryptIOStorage, folderId: string): Promise<FileInfo[]>;
40
- export declare function listSubfolders(storage: TeleCryptIOStorage, folderId: string): Promise<FolderInfo[]>;
41
- export declare function createSubfolder(storage: TeleCryptIOStorage, folderId: string, name: string): Promise<FolderInfo>;
42
- export declare function renameFolder(storage: TeleCryptIOStorage, folderId: string, name: string): Promise<RenameResult>;
43
- export declare function deleteFolder(storage: TeleCryptIOStorage, folderId: string): Promise<DeleteResult>;
44
- export declare function renameFile(storage: TeleCryptIOStorage, folderId: string, fileId: string, name: string): Promise<RenameResult>;
45
- export declare function deleteFile(storage: TeleCryptIOStorage, folderId: string, fileId: string): Promise<DeleteResult>;
46
- export declare function uploadFile(storage: TeleCryptIOStorage, folderId: string, name: string, bytes: Uint8Array, mimetype: string): Promise<FileInfo>;
47
- export declare function downloadFile(storage: TeleCryptIOStorage, folderId: string, fileId: string): Promise<DownloadedFile>;
48
- export declare function setupRecovery(storage: TeleCryptIOStorage): Promise<RecoverySetup>;
49
- export declare function restoreRecovery(storage: TeleCryptIOStorage, recoveryKey: string): Promise<RecoveryRestore>;
50
- export declare function getFileDetails(storage: TeleCryptIOStorage, folderId: string, fileId: string): Promise<FileDetails>;
51
- export declare function getFolderDetails(storage: TeleCryptIOStorage, folderId: string): Promise<FolderDetails>;
34
+ /** Invites `userId` to the vault and applies the requested role. */
35
+ export declare function shareVault(storage: TeleCryptIOStorage, vaultId: string, userId: string, role: string, options?: OperationOptions): Promise<ShareResult>;
36
+ export declare function unshareVault(storage: TeleCryptIOStorage, vaultId: string, userId: string, options?: OperationOptions): Promise<UnshareResult>;
37
+ export declare function listMembers(storage: TeleCryptIOStorage, vaultId: string, options?: OperationOptions): Promise<Member[]>;
38
+ export declare function listFiles(storage: TeleCryptIOStorage, treeId: string, options?: OperationOptions): Promise<FileInfo[]>;
39
+ /** Lists the direct child folders of a vault or folder. */
40
+ export declare function listSubfolders(storage: TeleCryptIOStorage, parentId: string, options?: OperationOptions): Promise<FolderInfo[]>;
41
+ export declare function createSubfolder(storage: TeleCryptIOStorage, parentId: string, name: string, options?: OperationOptions): Promise<FolderInfo>;
42
+ /** Renames a top-level Vault. */
43
+ export declare function renameVault(storage: TeleCryptIOStorage, vaultId: string, name: string, options?: OperationOptions): Promise<RenameResult>;
44
+ /** Renames a nested folder. */
45
+ export declare function renameFolder(storage: TeleCryptIOStorage, folderId: string, name: string, options?: OperationOptions): Promise<RenameResult>;
46
+ /** Deletes a top-level Vault. */
47
+ export declare function deleteVault(storage: TeleCryptIOStorage, vaultId: string, options?: OperationOptions): Promise<DeleteResult>;
48
+ /** Deletes a nested folder. */
49
+ export declare function deleteFolder(storage: TeleCryptIOStorage, folderId: string, options?: OperationOptions): Promise<DeleteResult>;
50
+ export declare function renameFile(storage: TeleCryptIOStorage, treeId: string, fileId: string, name: string, options?: OperationOptions): Promise<RenameResult>;
51
+ export declare function deleteFile(storage: TeleCryptIOStorage, treeId: string, fileId: string, options?: OperationOptions): Promise<DeleteResult>;
52
+ export declare function uploadFile(storage: TeleCryptIOStorage, treeId: string, name: string, bytes: Uint8Array, mimetype: string, options?: OperationOptions): Promise<FileInfo>;
53
+ export declare function downloadFile(storage: TeleCryptIOStorage, treeId: string, fileId: string, options?: OperationOptions): Promise<DownloadedFile>;
54
+ export declare function setupRecovery(storage: TeleCryptIOStorage, options?: OperationOptions): Promise<RecoverySetup>;
55
+ export declare function restoreRecovery(storage: TeleCryptIOStorage, recoveryKey: string, options?: OperationOptions): Promise<RecoveryRestore>;
56
+ export declare function getFileDetails(storage: TeleCryptIOStorage, treeId: string, fileId: string, options?: OperationOptions): Promise<FileDetails>;
57
+ /** Returns details for a top-level Vault. */
58
+ export declare function getVaultDetails(storage: TeleCryptIOStorage, vaultId: string, options?: OperationOptions): Promise<VaultDetails>;
59
+ /** Returns details for a nested folder. */
60
+ export declare function getFolderDetails(storage: TeleCryptIOStorage, folderId: string, options?: OperationOptions): Promise<FolderDetails>;