import { EntitySubscriberInterface, InsertEvent } from 'typeorm'; import DBSubmission from "./db-submission"; import DBComment from "./db-comment"; import { DBEntity } from "./db-entity"; import { DBPost } from "../db"; import DBUrl from "./db-url"; import { DownloadProgress } from "../../util/state"; export default class DBDownload extends DBEntity { id: number; /** * By default, a random UUID. If more URLs are located during processing, they should inherit this ID. */ albumID: string | null; isAlbumParent: boolean; parentSubmission: Promise; parentComment: Promise; url: DBUrl; progress?: DownloadProgress; getDBParent(): Promise; /** * Creates/Finds a DBDownload instance, using the given URL (and optionally album). * * The returned Downloads will always be backed by a single global DBUrl+DBFile, * but the DBDownload itself may be new - and exists per-album. * * Does not save automatically. */ static getDownloader(post: DBPost, url: string, albumID?: string): Promise; } /** * Subscribable static emitter for all new, *unprocessed* DBDownloads. * Emits after each DBDownload is saved to the database. */ export declare class DownloadSubscriber implements EntitySubscriberInterface { private static waiting; listenTo(): typeof DBDownload; afterInsert(event: InsertEvent): void; /** * Wait for a new *unprocessed* DBUrl to be saved. Hands out new entities in the order that they were requested. * * Will only return `undefined` when {@link flush} is called. */ static awaitNew(): Promise; /** * Return `undefined` to all pending listeners. */ static flush(): void; }