///
import * as fs from "fs";
declare namespace JsReport {
type Helpers = string | { [fun: string]: (...args: any[]) => any };
type Engine = "none";
type Recipe = "html";
interface TemplateBase {
/** template for the engine */
content?: string | undefined;
/** templating engine used to assemble document */
engine: Engine | string;
/** javascript helper functions used by templating engines */
helpers?: Helpers | undefined;
/** recipe used for printing previously assembled document */
recipe: Recipe | string;
pathToEngine?: string | undefined;
unoconv?: {
format?: string | undefined;
enabled?: boolean | undefined;
};
}
interface Template extends TemplateBase {
/** template for the engine */
content: string;
}
interface TemplateRegistry {
Template: Template;
}
type TemplateLike = TemplateRegistry[keyof TemplateRegistry]; // Template | NamedTemplate
interface RequestOptions {
preview?: boolean | undefined;
/** sets the request timeout in milliseconds */
timeout?: number | undefined;
/** defines the name of the report being to be generated */
reportName?: string | undefined;
}
interface Request {
/** @default true */
value?: boolean | undefined;
/** @default false */
writable?: boolean | undefined;
/** @default false */
configurable?: boolean | undefined;
/** @default false */
enumerable?: boolean | undefined;
/** defines the template of used for report generation */
template: TemplateLike;
/** defines options such as report name and request timeout */
options?: Partial | undefined;
context?: Context | undefined;
data?: any;
}
interface Context {
shared?: any;
originalInputDataIsEmpty?: boolean | undefined;
isChildRequest?: boolean | undefined;
logs: any;
timeoutLimit: number;
}
interface Response {
content: Buffer;
stream: NodeJS.ReadableStream;
headers: {
[header: string]: string | number | boolean;
};
}
interface ListenerCollection {
add(
type: string,
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
callback: (req: Request, res: Response, err?: any) => Promise | void,
): void;
}
interface Collection {
find(query: { [field: string]: any }): Promise