1 import type { SORT_DIRECTION } from '../../constants';
2 import type { FileRevisionState, Thumbnail } from './file';
3 import type { Photo } from './photos';
10 export enum LinkState {
16 export type SharedUrlInfo = {
18 ExpireTime: number | null;
24 export type SharingDetails = {
25 ShareUrl: SharedUrlInfo | null;
29 interface FileProperties {
30 ContentKeyPacket: string;
31 ContentKeyPacketSignature: string;
36 ManifestSignature: string;
37 SignatureAddress: string;
38 State: FileRevisionState;
45 Thumbnails: Thumbnail[];
50 interface FolderProperties {
54 interface DocumentProperties {
63 NameSignatureEmail: string;
64 EncryptedName: string;
69 // API returns only ModifyTime which represents modification on API, i.e.,
70 // the time when the last revision was uploaded. The real modification time
71 // (set by file system) is available in XAttr and these times are properly
72 // set during decryption of the link.
74 RealModifyTime: number;
75 Trashed: number | null;
78 NodePassphrase: string;
79 NodePassphraseSignature: string;
80 SignatureAddress: string;
83 FileProperties: FileProperties | null;
84 FolderProperties: FolderProperties | null;
85 DocumentProperties: DocumentProperties | null;
89 ShareUrls: SharedUrlInfo[];
90 SharingDetails: SharingDetails | null;
91 // XAttr has following JSON structure encrypted by node key:
94 // ModificationTime: "2021-09-16T07:40:54+0000",
99 // CachedThumbnailURL is computed URL to cached image. This is not part
100 // of any request and not filled automatically. To get this value, use
101 // `loadLinkThumbnail` from `useDrive`.
102 CachedThumbnailURL: string;
103 ThumbnailIsLoading: boolean;
107 export interface FileLinkMeta extends DriveLink {
109 FileProperties: FileProperties;
110 FolderProperties: null;
113 export interface FolderLinkMeta extends DriveLink {
114 Type: LinkType.FOLDER;
115 FolderProperties: FolderProperties;
116 FileProperties: null;
119 export type LinkMeta = FileLinkMeta | FolderLinkMeta;
121 export const isFolderLinkMeta = (link: LinkMeta): link is FolderLinkMeta => link.Type === LinkType.FOLDER;
123 export interface LinkMetaResult {
127 export interface LinkChildrenResult {
131 export interface HashCheckResult {
132 AvailableHashes: string[];
141 export interface MoveLink {
144 ParentLinkID: string;
145 NodePassphrase: string;
146 NodePassphraseSignature: string;
147 NameSignatureEmail: string;
149 ContentHash?: string;
152 export type DriveSectionSortKeys = keyof Pick<DriveLink, 'MIMEType' | 'ModifyTime' | 'Size' | 'Name'>;
153 export type SharedLinksSectionSortKeys =
154 | keyof Pick<DriveLink, 'Name'>
155 | keyof Pick<SharedUrlInfo, 'CreateTime' | 'ExpireTime'>;
157 export type AllSortKeys = DriveSectionSortKeys | SharedLinksSectionSortKeys;
159 export type SortParams<T extends AllSortKeys = AllSortKeys> = {
161 sortOrder: SORT_DIRECTION;
164 export interface ShareMapLink {
172 ParentLinkID: string | null;
176 // These will be missing for Link.Type !== LinkType.FOLDER
178 NodePassphrase?: string;
179 NodePassphraseSignature?: string;
180 NodePassphraseSignatureEmail?: string;
183 export interface ShareMapPayload {
184 Links: ShareMapLink[];
190 export interface LinkMetaBatchPayload {