{"version":3,"file":"DownloaderInterface.mjs","sources":["../../src/DownloaderInterface.ts"],"sourcesContent":["import { InterfaceImplementationMissingError } from './errors';\nimport type { GenericAbortSignal } from './GenericAbortSignal';\nimport type { GenericFile } from './GenericFile';\n\n/**\n * Defines the interface for a downloader.\n * It allows us to fetch files from given URIs.\n *\n * @category Context and Interfaces\n */\nexport interface DownloaderInterface {\n  /** Downloads multiple files from a list of URIs. */\n  download: (\n    uris: string[],\n    options?: DownloaderOptions\n  ) => Promise<GenericFile[]>;\n\n  /** Downloads and parses a JSON file from a given URI. */\n  downloadJson: <T>(uri: string, options?: DownloaderOptions) => Promise<T>;\n}\n\n/**\n * Defines the options that can be passed when downloading files. *\n * @category Storage\n */\nexport type DownloaderOptions = {\n  /** An abort signal to cancel the download. */\n  signal?: GenericAbortSignal;\n};\n\n/**\n * An implementation of the {@link DownloaderInterface} that throws an error when called.\n * @category Storage\n */\nexport function createNullDownloader(): DownloaderInterface {\n  const errorHandler = () => {\n    throw new InterfaceImplementationMissingError(\n      'DownloaderInterface',\n      'downloader'\n    );\n  };\n  return { download: errorHandler, downloadJson: errorHandler };\n}\n"],"names":["createNullDownloader","errorHandler","InterfaceImplementationMissingError","download","downloadJson"],"mappings":";;AA8BA;AACA;AACA;AACA;AACO,SAASA,oBAAoB,GAAwB;EAC1D,MAAMC,YAAY,GAAG,MAAM;AACzB,IAAA,MAAM,IAAIC,mCAAmC,CAC3C,qBAAqB,EACrB,YAAY,CACb,CAAA;GACF,CAAA;EACD,OAAO;AAAEC,IAAAA,QAAQ,EAAEF,YAAY;AAAEG,IAAAA,YAAY,EAAEH,YAAAA;GAAc,CAAA;AAC/D;;;;"}