import { schema, SchemaType } from "./annotations.js"; import { Iterator } from "./encoding/decode.js"; import { Encoder } from "./encoder/Encoder.js"; import { Decoder } from "./decoder/Decoder.js"; import { Schema } from "./Schema.js"; import { FieldBuilder } from "./types/builder.js"; import { ArraySchema } from "./types/custom/ArraySchema.js"; /** * Static methods available on Reflection */ interface ReflectionStatic { /** * Encodes the TypeContext of an Encoder into a buffer. * * @param encoder Encoder instance * @param it * @returns */ encode: (encoder: Encoder, it?: Iterator) => Uint8Array; /** * Decodes the TypeContext from a buffer into a Decoder instance. * * @param bytes Reflection.encode() output * @param it * @returns Decoder instance */ decode: (bytes: Uint8Array, it?: Iterator) => Decoder; /** * Upgrade a class produced by `Reflection.decode` so its instances * can be used as encode sources (for `InputEncoder` or `Encoder`). * * `Reflection.decode` reconstructs classes with decoder-only field * slots — `inst.x = 7` lands as a direct own property and bypasses * the change-tracking + `$values` plumbing that encoders rely on. * Calling `makeEncodable(ctor)` installs the same prototype accessor * descriptors and `metadata[$encoders]` lookup table that the * `schema(...)` / `@type` builders install at class-definition time. * * Idempotent. Pay-as-you-go: callers that only decode never invoke * this and pay nothing extra. Must be called BEFORE any instance of * the class is constructed and assigned to. */ makeEncodable: (ctor: typeof Schema) => typeof Schema; } /** * Reflection */ /** * `t.quantized()` field descriptor as it rides the reflection handshake — * schema-typed (bit-exact float64 bounds), NOT a string grammar, so every * language port decodes it with the schema decoder it already has. */ export declare const QuantizedDescriptor: import("./annotations.js").SchemaWithExtendsConstructor<{ min: FieldBuilder; max: FieldBuilder; bits: FieldBuilder; mode: FieldBuilder; }, import("./index.js").BuilderInitProps<{ min: FieldBuilder; max: FieldBuilder; bits: FieldBuilder; mode: FieldBuilder; }>, typeof Schema>; export type QuantizedDescriptor = SchemaType; export declare const ReflectionField: import("./annotations.js").SchemaWithExtendsConstructor<{ name: FieldBuilder; type: FieldBuilder; referencedType: FieldBuilder; /** Primitive child of a collection (`array`/`map`/... of "string" etc.) — * its own slot, replacing the legacy `"array:string"` colon packing. */ childPrimitive: FieldBuilder; /** Set only on `t.quantized()` fields (`.optional()` — no auto-instantiated * default; its absence is the "not quantized" signal on decode). */ quantized: FieldBuilder<{ min: number; max: number; bits: number; mode: number; } & {} & Schema & Schema, true, true>; }, import("./index.js").BuilderInitProps<{ name: FieldBuilder; type: FieldBuilder; referencedType: FieldBuilder; /** Primitive child of a collection (`array`/`map`/... of "string" etc.) — * its own slot, replacing the legacy `"array:string"` colon packing. */ childPrimitive: FieldBuilder; /** Set only on `t.quantized()` fields (`.optional()` — no auto-instantiated * default; its absence is the "not quantized" signal on decode). */ quantized: FieldBuilder<{ min: number; max: number; bits: number; mode: number; } & {} & Schema & Schema, true, true>; }>, typeof Schema>; export type ReflectionField = SchemaType; export declare const ReflectionType: import("./annotations.js").SchemaWithExtendsConstructor<{ id: FieldBuilder; extendsId: FieldBuilder; fields: FieldBuilder & Schema; } & Schema & Schema>, true, false>; }, import("./index.js").BuilderInitProps<{ id: FieldBuilder; extendsId: FieldBuilder; fields: FieldBuilder & Schema; } & Schema & Schema>, true, false>; }>, typeof Schema>; export type ReflectionType = SchemaType; export declare const Reflection: ReturnType, true, false>; rootType: FieldBuilder; }>> & ReflectionStatic; export type Reflection = SchemaType; export {};