UNPKG

infopack

Version:

Information package generator

177 lines (176 loc) 4.54 kB
/** * The settings object can be used to pass settings down to the run function. * This method is particularly useful when working with generators. */ export interface PipelineStepSettings { } export declare class PipelineStep { private settings; run: (executor: Executor) => Promise<any>; constructor(runFn: (executor: Executor) => Promise<any>, settings?: PipelineStepSettings); } export interface PipelineOptions { title?: string; /** * If set this string will be suffixed to version with a dash */ versionSuffix?: string; namespace?: string; /** * The base path for the pipeline. It should be a relative path from infopack folder * @default "./" */ basePath?: string; /** * Name of folder where the input file are stored * @default "input" */ inputFolderName?: string; /** * Name of folder where the output file are stored * @default "output" */ outputFolderName?: string; /** * Name of folder where the input file are stored * @default "cache" */ cacheFolderName?: string; indexHtmlPath?: string; sidecarHtmlPath?: string; } /** * Main class that produces output from the input via a pipeline */ export declare class Pipeline { /** * Human readable name */ private title; /** * If set this string will be suffixed to version with a dash */ private versionSuffix; /** * Namespace for the package */ private namespace; /** * The steps which will be executed in the run method */ private steps; /** * Absolute path to base path of the infopack */ private basePath; /** * Absolute path to the input folder */ private inputPath; /** * Absolute path to the output folder */ private outputPath; /** * Absolute path to the cache folder */ private cachePath; private indexHtmlPath; private sidecarHtmlPath; indexHtml: string; sidecarHtml: string; constructor(inputSteps: PipelineStep[], options?: PipelineOptions); getSteps(): PipelineStep[]; getBasePath(relPath?: string): string; getInputPath(relPath?: string): string; getOutputPath(): string; getCachePath(): string; getNamespace(): string; getTitle(): string; getVersionSuffix(): string | undefined; /** * Import index template * @param filePath Optional absolute path to template */ importIndexTemplate(filePath: string): Promise<string>; /** * Import sidecar template * @param filePath Optional absolute path to template */ importSidecarTemplate(filePath: string): Promise<string>; /** * Method to start the pipeline operation */ run: () => void; addStep: (step: PipelineStep) => void; } export interface InfopackContentInput { /** * Path relative to output folder */ path: string; data: Buffer; title: string; description: string; labels?: Object; origin?: [string]; } /** * InfopackContent structures the files to be written list */ export interface InfopackContent { $schema: string; title: string; description: string; /** * Path relative to output folder */ path: string; dirname: string; filename: string; extname: string; data: Buffer; labels?: Object; origin?: [string]; } export interface ExecutorMeta { $schema: string; namespace?: string; name?: string; title?: string; description?: string; version?: string; /** * Timestamp mainly used in template generator */ packagedAt?: string; } export declare class Executor { pipeline: Pipeline; finished: boolean; currentStep: number; writeQueue: InfopackContent[]; private meta; private files; private test; constructor(pipeline: Pipeline); /** * This method will add infopackContent to the files queue. * @param infopackContent */ toOutput(infopackContentInput: InfopackContentInput): void; private rmdir; private mkdir; /** * Write buffered files to disk * @param target Specifies output target. Provide cache to write to cache * @returns Promise<any> */ private writeOutput; getBasePath(relPath?: string): string; getInputPath(relPath?: string): string; getOutputPath(): string; getCachePath(): string; createMeta(): void; execute: () => import("bluebird")<void>; }