import ParserBase from './parser-base'; import MetaProcessor from './meta/meta-protobuf'; import type * as ProtoBuf from 'protobufjs'; declare type ProtoBufEngine = typeof ProtoBuf; /** * Protobuf Parser. */ declare class ParserProtobuf extends ParserBase { static FORMAT_NAME: string; name: string; protobuf: ProtoBufEngine; schemasMap: Record; schemasSourceMap: Record; lastSchemaName: string | null; metaProcessor: MetaProcessor; constructor(name: string, engine: ProtoBufEngine); /** * Create root schema and register custom wrappers to support JS types. ie. casting Google.Timestamp to JS Date. * */ private createRootSchema; getSchemaType(schemaName: string, typeName: string): ProtoBuf.Type | null | undefined; getSchemaName(): string | null; getSchema(name: string): ProtoBuf.IParserResult; getSchemaNames(): string[]; /** * Parses and adds schema to local schema map. * @param schemaData - The schema data, not parsed, in raw, string format. * @param name - The schema name, under which it will be saved in schema map. * @returns Returns true if there were no issues, false otherwise. */ addSchema(schemaData: string, name: string): boolean; /** * Parse data using given schema. Data should be in base64 format. * @param data - The data to parse. Data should be in base64 format. * @param schemaName - The name of a schema to be used for parsing. * @returns Result of parsing, if successful. Returns null if parsing fails or there is no data. */ parse(data: string | Uint8Array | null | undefined, schemaName: string): { [x: string]: any; } | null; stringify(data: ProtoBuf.Message | Record, schemaName: string): string | null; encode(data: ProtoBuf.Message | Record, schemaName: string, typeName: string): Uint8Array | null; getFormatName(): string; } export default ParserProtobuf;