import 'reflect-metadata'; import { ModelPack, IModelPack } from "./model-pack"; import { Type } from "./type"; import { DeleteCBAsync, RetrieveCBAsync, ValueMapType, ValueType } from "./value"; import { Serialized, SerializedType } from "./serialize"; import { BehaviorSubject } from "rxjs"; /** * @ignore */ export interface IPackedHologram { [_: string]: ValueType; id: string; values: { name: string; value: ValueType; }[]; model: IModelPack; } /** * @ignore */ export interface IHologram { get internal(): InternalHologram | undefined; } /** * @internal */ export declare class InternalBaseHologram { protected _id?: string; protected _values: Map>; protected _valueItems?: ValueMapType; protected _model?: ModelPack; protected _valueMembers: Map>; protected _methodMembers: Map>; get id(): string; get model(): ModelPack; get values(): ValueMapType; getValue(name: string): HologramValue; getMethod(name: string): HologramMethod; } export type SetValueCB = (hgId: string, name: string, value: Serialized) => Promise; export type InvokeCB = (hgId: string, name: string, input: Serialized) => Promise>; export declare class HologramValue { protected _hologram: InternalHologram; protected _name: string; protected _type: Type; protected _value: any; constructor(hologram: InternalHologram, name: string, type: Type, value: any); get hologram(): InternalBaseHologram; get name(): string; get value(): T; set value(value: Serialized | SerializedType); } export declare class HologramMethod { protected _hologram: InternalHologram; protected _name: string; protected _inputType: Type; protected _outputType: Type; constructor(hologram: InternalHologram, name: string, inputType: Type, outputType: Type); invoke(input: Serialized): Promise>; } export interface HologramCallbacks { setValueCB: SetValueCB; invokeCB: InvokeCB; retrieveCB: RetrieveCBAsync; deleteCB: DeleteCBAsync; } export declare class InternalHologram extends InternalBaseHologram { private _deleted; private _external?; cbs: HologramCallbacks; unpack(val: Serialized): Promise; get external(): Hologram | undefined; /** * @internal */ set external(value: Hologram | undefined); getValueItem(name: string): T; setValue(name: string, value: Serialized): Promise; invokeMethod(name: string, input: Serialized): Promise>; getInternalValue(name: string): InternalHologramValue; get valueItems(): ValueMapType; delete(): Promise; set deleted(value: boolean); get deleted(): boolean; } export declare class InternalHologramValue extends HologramValue { setValue(val: ValueType): void; } export declare class InternalHologramMethod extends HologramMethod { } export interface IPackedFixture { [_: string]: ValueType; name: string; hologram: IPackedHologram; } export interface InternalFixture { name: string; hologram: InternalHologram; } export type hologramCtor = new (..._: any) => T; /** * @internal */ export declare function constructHG(holoCtor: hologramCtor, hg: InternalHologram): T; /** * The base class for all holograms. */ export declare class Hologram { protected hg?: InternalHologram; protected _create: BehaviorSubject; protected modelVersion?: string; protected classVersion?: string; protected createHologram(values?: SerializedType): void; /** * This method is used to construct the basics of the hologram so that we can safely bypass the constructor * internally when creating a hologram from a packed hologram. * @internal */ private __constr; get create(): Promise; get internal(): InternalHologram | undefined; protected set internal(value: InternalHologram); get model(): ModelPack | undefined; /** * The ID of the hologram. */ get id(): string; /** * Deletes the hologram. */ delete(): Promise; /** * Returns a boolean indicating whether the hologram has been deleted. */ get deleted(): boolean; protected get hr(): RetrieveCBAsync; protected getValue(name: string): HologramValue; protected getMethod(name: string): HologramMethod; } /** * @ignore */ export declare function checkCreate(thisCtor: hologramCtor, actualCtor: hologramCtor): boolean; /** * Decorator for marking a class as a hologram model. * * @param model The model version of the hologram. * @constructor */ export declare function BitModel(model: string): ClassDecorator; /** * Decorator for marking a class as a hologram class. * * @param clazz The class version of the hologram. * @constructor */ export declare function BitClass(clazz: string): ClassDecorator;