UNPKG

ts-edifact

Version:
83 lines 2.28 kB
import { Tokenizer } from "./tokenizer"; export declare class Dictionary<T> { private entries; constructor(data?: { [key: string]: T; }); contains(key: string): boolean; get(key: string): T | undefined; keys(): string[]; add(key: string, value: T): T; length(): number; } export declare type SegmentEntry = { requires: number; elements: string[]; }; export declare type ElementEntry = { requires: number; components: string[]; }; interface FormatType { alpha: boolean; numeric: boolean; minimum: number; maximum: number; } export declare enum ValidatorStates { NONE = 0, SEGMENTS = 1, ELEMENTS = 2, ALL = 3, ENTER = 4, ENABLE = 5 } export interface Validator { onOpenSegment(segment: string): void; onElement(): void; onOpenComponent(buffer: Tokenizer): void; onCloseComponent(buffer: Tokenizer): void; onCloseSegment(segment: string): void; disable(): void; enable(): void; define(definitions: (Dictionary<SegmentEntry> | Dictionary<ElementEntry>)): void; format(formatString: string): FormatType | undefined; } export declare class NullValidator implements Validator { onOpenSegment(): void; onElement(): void; onOpenComponent(): void; onCloseComponent(): void; onCloseSegment(): void; disable(): void; enable(): void; define(): void; format(): FormatType | undefined; } export declare class ValidatorImpl implements Validator { private segments; private elements; private formats; private counts; private state; private segment; private element; private component; private required; private minimum; private maximum; private throwOnMissingDefinitions; constructor(throwOnMissingDefinitions?: boolean); disable(): void; enable(): void; define(definitions: (Dictionary<SegmentEntry> | Dictionary<ElementEntry>)): void; format(formatString: string): FormatType | undefined; onOpenSegment(segment: string): void; onElement(): void; onOpenComponent(buffer: Tokenizer): void; onCloseComponent(buffer: Tokenizer): void; onCloseSegment(segment: string): void; private errors; } export {}; //# sourceMappingURL=validator.d.ts.map