|
@@ -1,167 +0,0 @@
|
|
|
-import { FILE_TYPE } from 'constants/file';
|
|
|
-import { Collection } from 'types/collection';
|
|
|
-import { B64EncryptionResult, LocalFileAttributes } from 'types/crypto';
|
|
|
-import {
|
|
|
- MetadataFileAttributes,
|
|
|
- S3FileAttributes,
|
|
|
- FilePublicMagicMetadata,
|
|
|
- FilePublicMagicMetadataProps,
|
|
|
-} from 'types/file';
|
|
|
-import { EncryptedMagicMetadata } from 'types/magicMetadata';
|
|
|
-
|
|
|
-export interface DataStream {
|
|
|
- stream: ReadableStream<Uint8Array>;
|
|
|
- chunkCount: number;
|
|
|
-}
|
|
|
-
|
|
|
-export function isDataStream(object: any): object is DataStream {
|
|
|
- return 'stream' in object;
|
|
|
-}
|
|
|
-
|
|
|
-export type Logger = (message: string) => void;
|
|
|
-
|
|
|
-export interface Metadata {
|
|
|
- title: string;
|
|
|
- creationTime: number;
|
|
|
- modificationTime: number;
|
|
|
- latitude: number;
|
|
|
- longitude: number;
|
|
|
- fileType: FILE_TYPE;
|
|
|
- hasStaticThumbnail?: boolean;
|
|
|
- hash?: string;
|
|
|
- imageHash?: string;
|
|
|
- videoHash?: string;
|
|
|
- localID?: number;
|
|
|
- version?: number;
|
|
|
- deviceFolder?: string;
|
|
|
-}
|
|
|
-
|
|
|
-export interface Location {
|
|
|
- latitude: number;
|
|
|
- longitude: number;
|
|
|
-}
|
|
|
-
|
|
|
-export interface ParsedMetadataJSON {
|
|
|
- creationTime: number;
|
|
|
- modificationTime: number;
|
|
|
- latitude: number;
|
|
|
- longitude: number;
|
|
|
-}
|
|
|
-
|
|
|
-export interface MultipartUploadURLs {
|
|
|
- objectKey: string;
|
|
|
- partURLs: string[];
|
|
|
- completeURL: string;
|
|
|
-}
|
|
|
-
|
|
|
-export interface FileTypeInfo {
|
|
|
- fileType: FILE_TYPE;
|
|
|
- exactType: string;
|
|
|
- mimeType?: string;
|
|
|
- imageType?: string;
|
|
|
- videoType?: string;
|
|
|
-}
|
|
|
-
|
|
|
-/*
|
|
|
- * ElectronFile is a custom interface that is used to represent
|
|
|
- * any file on disk as a File-like object in the Electron desktop app.
|
|
|
- *
|
|
|
- * This was added to support the auto-resuming of failed uploads
|
|
|
- * which needed absolute paths to the files which the
|
|
|
- * normal File interface does not provide.
|
|
|
- */
|
|
|
-export interface ElectronFile {
|
|
|
- name: string;
|
|
|
- path: string;
|
|
|
- size: number;
|
|
|
- lastModified: number;
|
|
|
- stream: () => Promise<ReadableStream<Uint8Array>>;
|
|
|
- blob: () => Promise<Blob>;
|
|
|
- arrayBuffer: () => Promise<Uint8Array>;
|
|
|
-}
|
|
|
-
|
|
|
-export interface UploadAsset {
|
|
|
- isLivePhoto?: boolean;
|
|
|
- file?: File | ElectronFile;
|
|
|
- livePhotoAssets?: LivePhotoAssets;
|
|
|
- isElectron?: boolean;
|
|
|
-}
|
|
|
-export interface LivePhotoAssets {
|
|
|
- image: globalThis.File | ElectronFile;
|
|
|
- video: globalThis.File | ElectronFile;
|
|
|
-}
|
|
|
-
|
|
|
-export interface FileWithCollection extends UploadAsset {
|
|
|
- localID: number;
|
|
|
- collection?: Collection;
|
|
|
- collectionID?: number;
|
|
|
-}
|
|
|
-
|
|
|
-export type ParsedMetadataJSONMap = Map<string, ParsedMetadataJSON>;
|
|
|
-
|
|
|
-export interface UploadURL {
|
|
|
- url: string;
|
|
|
- objectKey: string;
|
|
|
-}
|
|
|
-
|
|
|
-export interface FileInMemory {
|
|
|
- filedata: Uint8Array | DataStream;
|
|
|
- thumbnail: Uint8Array;
|
|
|
- hasStaticThumbnail: boolean;
|
|
|
-}
|
|
|
-
|
|
|
-export interface FileWithMetadata
|
|
|
- extends Omit<FileInMemory, 'hasStaticThumbnail'> {
|
|
|
- metadata: Metadata;
|
|
|
- localID: number;
|
|
|
- pubMagicMetadata: FilePublicMagicMetadata;
|
|
|
-}
|
|
|
-
|
|
|
-export interface EncryptedFile {
|
|
|
- file: ProcessedFile;
|
|
|
- fileKey: B64EncryptionResult;
|
|
|
-}
|
|
|
-export interface ProcessedFile {
|
|
|
- file: LocalFileAttributes<Uint8Array | DataStream>;
|
|
|
- thumbnail: LocalFileAttributes<Uint8Array>;
|
|
|
- metadata: LocalFileAttributes<string>;
|
|
|
- pubMagicMetadata: EncryptedMagicMetadata;
|
|
|
- localID: number;
|
|
|
-}
|
|
|
-export interface BackupedFile {
|
|
|
- file: S3FileAttributes;
|
|
|
- thumbnail: S3FileAttributes;
|
|
|
- metadata: MetadataFileAttributes;
|
|
|
- pubMagicMetadata: EncryptedMagicMetadata;
|
|
|
-}
|
|
|
-
|
|
|
-export interface UploadFile extends BackupedFile {
|
|
|
- collectionID: number;
|
|
|
- encryptedKey: string;
|
|
|
- keyDecryptionNonce: string;
|
|
|
-}
|
|
|
-
|
|
|
-export interface ParsedExtractedMetadata {
|
|
|
- location: Location;
|
|
|
- creationTime: number;
|
|
|
- width: number;
|
|
|
- height: number;
|
|
|
-}
|
|
|
-
|
|
|
-// This is used to prompt the user the make upload strategy choice
|
|
|
-export interface ImportSuggestion {
|
|
|
- rootFolderName: string;
|
|
|
- hasNestedFolders: boolean;
|
|
|
- hasRootLevelFileWithFolder: boolean;
|
|
|
-}
|
|
|
-
|
|
|
-export interface PublicUploadProps {
|
|
|
- token: string;
|
|
|
- passwordToken: string;
|
|
|
- accessedThroughSharedURL: boolean;
|
|
|
-}
|
|
|
-
|
|
|
-export interface ExtractMetadataResult {
|
|
|
- metadata: Metadata;
|
|
|
- publicMagicMetadata: FilePublicMagicMetadataProps;
|
|
|
-}
|