import { Gindex, Tree } from "@chainsafe/persistent-merkle-tree"; import { Type, ValueOf } from "../type/abstract.ts"; import { BasicType } from "../type/basic.ts"; import { CompositeType } from "../type/composite.ts"; import { NonOptionalFields } from "../type/optional.ts"; import { BitArray } from "../value/bitArray.ts"; import { TreeView } from "./abstract.ts"; export type FieldEntry>> = { fieldName: keyof Fields; fieldType: Fields[keyof Fields]; jsonKey: string; gindex: Gindex; chunkIndex: number; optional: boolean; }; /** Expected API of this View's type. This interface allows to break a recursive dependency between types and views */ export type ContainerTypeGeneric>> = CompositeType, ContainerTreeViewType, unknown> & { readonly fields: Fields; readonly fieldsEntries: FieldEntry>[]; readonly activeFields: BitArray; }; export type ValueOfFields>> = { [K in keyof Fields]: ValueOf; }; export type FieldsView>> = { [K in keyof Fields]: Fields[K] extends CompositeType ? TV : Fields[K] extends BasicType ? V : never; }; export type ContainerTreeViewType>> = FieldsView & TreeView>; export type ContainerTreeViewTypeConstructor>> = { new (type: ContainerTypeGeneric, tree: Tree): ContainerTreeViewType; }; export declare function getProfileTreeViewClass>>(type: ContainerTypeGeneric): ContainerTreeViewTypeConstructor; type BytesRange = { start: number; end: number; }; /** * Precompute fixed and variable offsets position for faster deserialization. * @returns Does a single pass over all fields and returns: * - isFixedLen: If field index [i] is fixed length * - fieldRangesFixedLen: For fields with fixed length, their range of bytes * - variableOffsetsPosition: Position of the 4 bytes offset for variable size fields * - fixedEnd: End of the fixed size range * - offsets are relative to the start of serialized active fields, after the Bitvector[N] of optional fields */ export declare function computeSerdesData>>(optionalFields: BitArray, fields: FieldEntry[]): { isFixedLen: boolean[]; fieldRangesFixedLen: BytesRange[]; variableOffsetsPosition: number[]; fixedEnd: number; }; export {};