import { ArraySchema, CollectionSchema, MapSchema, Schema, SetSchema } from '@colyseus/schema'; import { ManagedCallbackProxy } from './managed-callback-proxy'; export type Primitive = number | string | boolean | null | undefined; export type Container = Schema | ArraySchema | MapSchema | CollectionSchema | SetSchema; export type Colyseus = Primitive | Container; /** * Minimal Colyseus Room interface for wireEvents */ export interface ColRoom { state: T; serializer: unknown; } export declare function isPrimitive(val: unknown): val is Primitive; export declare function isContainer(val: unknown): val is Container; export interface Events { emit(eventName: E, value: Event): unknown; } export type Add = { op: 'add'; path: string; value: Colyseus; }; export type Replace = { op: 'replace'; path: string; value: Colyseus; }; export type Remove = { op: 'remove'; path: string; }; export type Event = Add | Remove | Replace; export declare function Add(path: string, value: Colyseus): Add; export declare function Replace(path: string, value: Colyseus): Replace; export declare function Remove(path: string): Remove; export type Traverse = (state: Colyseus, events: T, jsonPath: string, callbackProxy: ManagedCallbackProxy) => unknown; /** * logic to wire events for a single entity type */ export type Visitor = { /** * optionally wire events to a single state container * @param traverse call this function for each property of the state container * @param state the state container * @param events events emitter to emit events on * @param jsonPath the path of the current state container * @param callbackProxy the callback proxy function for registering callbacks on state * @return `true` if this visitor wired and traversed the current `state`. Otherwise do nothing and treturn `false`. */ visit(traverse: Traverse, state: Container, events: Events, jsonPath: string, callbackProxy: ManagedCallbackProxy): boolean; }; //# sourceMappingURL=types.d.ts.map