import type { ImportEntity } from '../services/types.js'; import type { JobView } from '../web/jobView.js'; /** * What the upload page tells the admin about the type they chose, from the jobs * of `GET /import-open-jobs` (§ 8.2, D-32). The page writes the words; this says * which notices apply, which of them need a yes first, and whether the file can * be sent. */ export type UploadNotice = /** An import of the type is at work: nothing can be uploaded. */ { kind: 'busy'; job: JobView; percent: number; } /** An unfinished job that the new file replaces. `mine` is false for another admin's. */ | { kind: 'replace'; job: JobView; mine: boolean; } /** A stopped or interrupted import that wrote rows: the new file closes it. */ | { kind: 'close'; job: JobView; rows: number; }; export type FileProblem = 'empty' | 'tooLarge'; export interface UploadChoice { /** Customer addresses are always added (D-18): no choice of mode. */ showMode: boolean; /** Only files with images have the option. */ showCheckImages: boolean; notices: UploadNotice[]; /** The notices that need a yes before the upload (D-32). */ confirm: UploadNotice[]; fileProblem: FileProblem | null; canUpload: boolean; } export interface UploadInput { entity: ImportEntity; openJobs: readonly JobView[]; /** The id of the admin who is looking. */ me: number | null; file: { size: number; } | null; /** The largest file the store accepts, when it is known. */ maxFileBytes: number | null; uploading: boolean; } /** Running, or resumed and waiting for a worker (§ 8.4). */ export declare const isBusy: (job: JobView) => boolean; export declare function noticesFor(entity: ImportEntity, openJobs: readonly JobView[], me: number | null): UploadNotice[]; export declare function describeUpload(input: UploadInput): UploadChoice; /** A job id that cannot be a real one, standing in the address of the page of a job. */ export declare const PLACEHOLDER_ID = "00000000-0000-0000-0000-000000000000"; /** The address of the page of a job, from the address of the page of the placeholder. */ export declare function viewUrlFor(template: string, uuid: string): string;