import * as uuid from 'uuid'; import { Point } from '../pen-gestures/ndollar'; function GenerateDeterministicGuid(seed: string): string { return uuid.v5(seed, uuid.v5.URL); } // eslint-disable-next-line @typescript-eslint/no-unused-vars export class Message { private _name: string; private _guid: string; constructor(name: string) { this._name = name; this._guid = 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, Boolean, Script, Templates, } export interface Transferable { readonly id: string; readonly type: Types; readonly data?: any; } export enum YoutubeQueryTypes { Channels, SearchVideo, VideoDetails, } export interface YoutubeQueryInput { readonly type: YoutubeQueryTypes; readonly userInput?: string; readonly videoIds?: string; } export interface Reference { readonly id: string; } export interface Diff extends Reference { readonly diff: any; } export interface GestureContent { readonly points: Array; readonly bounds: { right: number; left: number; bottom: number; top: number; width: number; height: number }; readonly width?: string; readonly color?: string; } export interface MobileInkOverlayContent { readonly enableOverlay: boolean; readonly width?: number; readonly height?: number; readonly text?: string; } export interface UpdateMobileInkOverlayPositionContent { readonly dx?: number; readonly dy?: number; readonly dsize?: number; } export interface MobileDocumentUploadContent { readonly docId: string; } export interface RoomMessage { readonly message: string; readonly room: string; } 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 ConnectionTerminated = new Message('Connection Terminated'); export const GesturePoints = new Message('Gesture Points'); export const MobileInkOverlayTrigger = new Message('Trigger Mobile Ink Overlay'); export const UpdateMobileInkOverlayPosition = new Message('Update Mobile Ink Overlay Position'); export const MobileDocumentUpload = new Message('Upload Document From Mobile'); export const GetRefField = new Message('Get Ref Field'); export const GetRefFields = new Message('Get Ref Fields'); export const UpdateField = new Message('Update Ref Field'); export const CreateField = new Message('Create Ref Field'); export const YoutubeApiQuery = new Message('Youtube Api Query'); export const DeleteField = new Message('Delete field'); export const DeleteFields = new Message('Delete fields'); export const UpdateStats = new Message('updatestats'); }