UNPKG

amazon-route-53-dns-zone-file

Version:

Makes DNS Zone File easy. Parses and validates BIND zone files and can be extended for custom features. Functionality is modular. Features are made open for extension and closed for runtime mutation. Written in TypeScript.

41 lines (33 loc) 1.08 kB
import { ParsingError } from '../errors/parsing_error'; import { SourceMapTypings, ParserTypings } from '../parser/types_parser'; export namespace Validation { export interface I18nRenderObj { [key: string]: string | number | null; } export type ErrorEntry = SourceMapTypings.Value & { parsingLineNumber: number; }; export type GetErrorTextFn<ReturnType = string | any> = ( entry: ErrorEntry, i18nArgs?: I18nRenderObj ) => ReturnType; export type Cb = ( parser: ParserTypings.Parser, errorBuilder: ValidationErrorBuilder ) => void; export interface ValidationOptions { loopValidators?: Validation.Cb[]; getErrorText?: GetErrorTextFn; preValidators?: Validation.Cb[]; postValidators?: Validation.Cb[]; } export interface ValidationErrorBuilder { parsingLineNumber: number; entry: SourceMapTypings.Value; getErrorText: Validation.GetErrorTextFn; create<Overrides extends Partial<ParserTypings.MetaArg>>( overrides?: Overrides, i18nArgs?: Validation.I18nRenderObj ): ParsingError; } }