UNPKG

statement-parser-fab

Version:

Parse bank and credit card statements. Updated fork with FAB (First Abu Dhabi Bank) support and maintained dependencies.

20 lines (19 loc) 1.54 kB
import { ParsedOutput } from './parsed-output'; import { ParsePdfFunction, ParseTextFunction } from './parser-function'; import { ParserKeyword } from './parser-options'; import { ParserInitInput } from './parser-state-machine'; export type ConvertPdfToTextFunction = (filePath: string) => Promise<string[]>; export type StatementParser<OutputType extends ParsedOutput, ParserOptions extends object | undefined = undefined> = { parsePdf: ParsePdfFunction<OutputType, ParserOptions>; parseText: ParseTextFunction<OutputType, ParserOptions>; convertPdfToText: (filePath: string) => Promise<string[]>; parserKeywords: ParserKeyword[]; }; export type CreateStatementParserInput<StateType, OutputType extends ParsedOutput, ParserOptions extends object | undefined = undefined> = { pdfProcessing?: (filePath: string) => Promise<string[][]> | string[][]; outputValidation?: (output: OutputType) => void; /** Keywords are used to preserve phrases in the statement text when sanitizing it for a test. */ parserKeywords: ParserKeyword[]; } & ParserInitInput<StateType, OutputType, ParserOptions>; export declare const createStatementParserInputDefault: Required<Pick<CreateStatementParserInput<unknown, ParsedOutput>, 'pdfProcessing'>>; export declare function createStatementParser<StateType, OutputType extends ParsedOutput, ParserOptions extends object | undefined = undefined>(rawInputs: Readonly<CreateStatementParserInput<StateType, OutputType, ParserOptions>>): Readonly<StatementParser<OutputType, ParserOptions>>;