UNPKG

@aire-ux/aire-condensation

Version:

Client-side serialization library for Aire-UX

37 lines (36 loc) 1.48 kB
import TypeRegistry from "./type-registry"; import RemoteRegistry, { InvocationType } from "./remote-registry"; import { Address, Class, Pointer, Region } from "./types"; import { Deserializer } from "./deserializer"; export declare type Format = "json"; export interface Context { region: Region; create<T>(t: Class<T>, ...args: string[]): Pointer<T>; locate<T>(address: Address): T | null; move<T>(address: Address, target: Region): Pointer<T> | null; formalParams<T>(t: Class<T>, type: InvocationType, ...args: string[]): any[]; invokeDirect<T, U>(value: T, op: string, ...args: string[]): U | null; invoke<T, U>(address: Address | Pointer<T>, op: string, ...args: string[]): U | null; delete<T>(address: Address): T | null; addressOf<T>(t: T): Address | null; } /** * root context for all operations */ export declare class Condensation { static context: Context; static registry: TypeRegistry; static remoteRegistry: RemoteRegistry; static deserializerConfigurations: Map<Class<any>, Deserializer<any>>; static get typeRegistry(): TypeRegistry; static deserializerFor<T>(type: Class<T>): Deserializer<T>; static newContext(): Context; static defaultContext(): Context; } export declare type RegistrationDefinition = { type: Class<any>; deserializer: Deserializer<any>; }; export declare function register(...registrations: RegistrationDefinition[]): void; export declare namespace Condensation { }