import { Utils } from "../Utils"; export class Message { private _name: string; private _guid: string; constructor(name: string) { this._name = name; this._guid = Utils.GenerateDeterministicGuid(name); } get Name(): string { return this._name; } get Message(): string { return this._guid; } } export enum Types { Number, List, Key, Image, Web, Document, Text, Icon, RichText, DocumentReference, Html, Video, Audio, Ink, PDF, Tuple, HistogramOp, Boolean, Script, } export interface Transferable { readonly id: string; readonly type: Types; readonly data?: any; } export interface Reference { readonly id: string; } export interface Diff extends Reference { readonly diff: any; } export namespace MessageStore { export const Foo = new Message("Foo"); export const Bar = new Message("Bar"); export const SetField = new Message("Set Field"); // send Transferable (no reply) export const GetField = new Message("Get Field"); // send string 'id' get Transferable back export const GetFields = new Message("Get Fields"); // send string[] of 'id' get Transferable[] back export const GetDocument = new Message("Get Document"); export const DeleteAll = new Message("Delete All"); export const GetRefField = new Message("Get Ref Field"); export const UpdateField = new Message("Update Ref Field"); export const CreateField = new Message("Create Ref Field"); }