diff --git a/web/packages/next/types/file.ts b/web/packages/next/types/file.ts index e7d3ced5a..dc8a148e9 100644 --- a/web/packages/next/types/file.ts +++ b/web/packages/next/types/file.ts @@ -26,20 +26,6 @@ export interface DataStream { chunkCount: number; } -export interface WatchMappingSyncedFile { - path: string; - uploadedFileID: number; - collectionID: number; -} - -export interface WatchMapping { - rootFolderName: string; - folderPath: string; - uploadStrategy: UPLOAD_STRATEGY; - syncedFiles: WatchMappingSyncedFile[]; - ignoredFiles: string[]; -} - export interface EventQueueItem { type: "upload" | "trash"; folderPath: string; diff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.ts index 3477d745e..85986b639 100644 --- a/web/packages/next/types/ipc.ts +++ b/web/packages/next/types/ipc.ts @@ -3,7 +3,7 @@ // // See [Note: types.ts <-> preload.ts <-> ipc.ts] -import type { ElectronFile, WatchMapping } from "./file"; +import type { ElectronFile } from "./file"; export interface AppUpdateInfo { autoUpdatable: boolean; @@ -298,16 +298,16 @@ export interface Electron { removeWatchMapping: (folderPath: string) => Promise; - getWatchMappings: () => Promise; + getWatchMappings: () => Promise; updateWatchMappingSyncedFiles: ( folderPath: string, - files: WatchMapping["syncedFiles"], + files: FolderWatch["syncedFiles"], ) => Promise; updateWatchMappingIgnoredFiles: ( folderPath: string, - files: WatchMapping["ignoredFiles"], + files: FolderWatch["ignoredFiles"], ) => Promise; // - FS legacy @@ -332,3 +332,30 @@ export interface Electron { setToUploadCollection: (collectionName: string) => Promise; getDirFiles: (dirPath: string) => Promise; } + +/** + * A top level folder that was selected by the user for watching. + * + * The user can set up multiple such watches. Each of these can in turn be + * syncing multiple on disk folders to one or more (dependening on the + * {@link uploadStrategy}) Ente albums. + * + * This type is passed across the IPC boundary. It is persisted on the Node.js + * side. + */ +export interface FolderWatch { + rootFolderName: string; + uploadStrategy: number; + folderPath: string; + syncedFiles: FolderWatchSyncedFile[]; + ignoredFiles: string[]; +} + +/** + * An on-disk file that was synced as part of a folder watch. + */ +export interface FolderWatchSyncedFile { + path: string; + uploadedFileID: number; + collectionID: number; +}