import type { MapSchema, ArraySchema, SetSchema } from "@colyseus/schema"; /** Keys of T whose value is a Colyseus collection (Map/Array/Set schema). */ export type CollectionKeys = { [K in keyof T]-?: T[K] extends MapSchema | ArraySchema | SetSchema ? K : never; }[keyof T] & string; /** Element type of a Colyseus collection. */ export type ChildOf = C extends MapSchema ? V : C extends ArraySchema ? V : C extends SetSchema ? V : never; /** Schema's own SoA: a dense array of a decoded instance's field values, indexed * by field index. Reading/writing it bypasses the per-field accessor and the * megamorphic dynamic-key path — reckon's scratch refill + extract use it. */ export declare const $VALUES: symbol; /** Stable integer id the decoder assigned this instance, or undefined if it * hasn't been decoded yet (attach/track called too early — see the Predictor * file header). */ export declare function refIdOf(instance: object): number | undefined; /** The schema metadata object: maps `name -> index` (number) and * `index -> { name, index, type }` (MetadataField). Undefined for non-schema * objects (e.g. plain test fixtures). */ export type SchemaMetadata = Record; export declare function metadataOf(instance: object): SchemaMetadata | undefined; /** * Field's declaration index from the schema's metadata, or -1 if unknown. * `metadata[name]` is the index. Only used on the COLD attach path (to stamp a * slot's SLOT_FIELD and seed reckon sim fields) — the hot `value()` read keys * its slot map by field NAME, so it never resolves an index per frame. */ export declare function fieldIndexOf(instance: object, field: string): number; /** PRIMITIVE (scalar) field names in declaration order, read from the schema * metadata. Empty for non-schema objects. Field indices are dense from 0, so * walk until the first gap. * * Only number / string / boolean (and the other primitive encodings — int8, * float32, …) are returned: in the metadata a primitive's `type` is a STRING * ("number", "string", …) whereas a collection (Map/Array/Set) or a nested * Schema carries an OBJECT `type`. The reckon snapshot uses this to clone the * SCALAR state a `step` reads — including string/enum discriminators (`kind`) * and booleans (`grounded`), which steps routinely branch on — while skipping * reference-typed fields. Those are structural, not forward-simulated, and * shallow-copying their reference into a scratch that `step` mutates could * corrupt the live tree; for the rare step that needs one, pass an explicit * `snapshot`. (Schema fields live behind getters over `$values`, so a plain * `{...instance}` spread copies nothing — hence the metadata walk.) */ export declare function scalarFieldNamesOf(instance: object): string[]; /** * One metadata walk returning BOTH scalar sets a world binding needs: * `fields` — every primitive field, in declaration order (the adopt set, * same rule as {@link scalarFieldNamesOf}); `numeric` — the subset whose * decoded value is a number (the pose/smoothing set). Both empty for * non-schema objects. */ export declare function scalarFieldsOf(instance: object): { fields: string[]; numeric: string[]; }; /** * The wire quantizer for one declared field: maps a predicted float64 to the * EXACT value the wire would deliver for it. `"float32"` → `Math.fround`; * `"number"` → the codec's dynamic rule ({@link quantizeAutoNumber}); every * type the wire round-trips exactly (ints, float64, boolean) — and any type * this doesn't model (e.g. `quantized`) — gets the identity, which degrades to * a bit-exact compare: conservative, never worse than always-adopting. * Identity for non-schema instances (no metadata — plain test fixtures). */ export declare function wireQuantizerOf(instance: object, field: string): (v: number) => number; export declare function makeUnrolledSnapshot(fieldNames: readonly string[]): (e: any) => any;