/** * @_ignore: */ export declare const WordSize: number; /** * A [[Result]] is a sub-class of Array, which allows accessing any * of its values either positionally by its index or, if keys are * provided by its name * * @_docloc: api/abi */ export declare class Result extends Array { #private; [K: string | number]: any; /** * @private */ constructor(...args: Array); /** * Returns the Result as a normal Array * * This throws if there are any outstanding deferred * errors */ toArray(): Array; /** * Returns the Result as an Object with each name-value pair * * This throws if any value is unnamed, or if there are * any outstanding deferred errors */ toObject(): Record; /** * @_ignore */ slice(start?: number | undefined, end?: number | undefined): Result; /** * @_ignore */ filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result; /** * @_ignore */ map(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array; /** * Returns the value for %%name%% * * Since it is possible to have a key whose name conflicts with * a method on a [[Result]] or its superclass Array, or any * JavaScript keyword, this ensures all named values are still * accessible by name */ getValue(name: string): any; /** * Creates a new [[Result]] for %%items%% with each entry * also accessible by its corresponding name in %%keys%% */ static fromItems(items: Array, keys?: Array): Result; } /** * Returns all errors found in a [[Result]] * * Since certain errors encountered when creating a [[Result]] do * not impact the ability to continue parsing data, they are * deferred until they are actually accessed. Hence a faulty string * in an Event that is never used does not impact the program flow * * However, sometimes it may be useful to access, identify, or * validate correctness of a [[Result]] * * @_docloc api/abi */ export declare function checkResultErrors(result: Result): Array<{ path: Array; error: Error; }>; /** * @_ignore */ export declare abstract class Coder { readonly name: string; readonly type: string; readonly localName: string; readonly dynamic: boolean; constructor(name: string, type: string, localName: string, dynamic: boolean); _throwError(message: string, value: any): never; abstract encode(writer: Writer, value: any): number; abstract decode(reader: Reader): any; abstract defaultValue(): any; } /** * @_ignore */ export declare class Writer { #private; constructor(); get data(): string; get length(): number; appendWriter(writer: Writer): number; /** * Writes an array-like item, padding on the right to the nearest WordSize. */ writeBytes(value: Uint8Array): number; /** * Writes a numeric item, padding on the left to WordSize. */ writeValue(value: bigint): number; /** * Inserts a numeric placeholder and returns a callback that can adjust the value later. */ writeUpdatableValue(): (value: bigint) => void; } /** * @_ignore */ export declare class Reader { #private; readonly allowLoose: boolean; constructor(data: string | Uint8Array, allowLoose?: boolean); get data(): string; get dataLength(): number; get consumed(): number; get bytes(): Uint8Array; /** * Creates a sub-reader with the same underlying data, but with an offset. */ subReader(offset: number): Reader; /** * Reads bytes. */ readBytes(length: number, loose?: boolean): Uint8Array; /** * Reads a numeric value. */ readValue(): bigint; readIndex(): number; }