aboutsummaryrefslogtreecommitdiff
path: root/src/server/Message.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-05-14 23:15:24 -0400
committerbobzel <zzzman@gmail.com>2024-05-14 23:15:24 -0400
commit3534aaf88a3c30a474b3b5a5b7f04adfe6f15fac (patch)
tree47fb7a8671b209bd4d76e0f755a5b035c6936607 /src/server/Message.ts
parent87bca251d87b5a95da06b2212400ce9427152193 (diff)
parent5cb7ad90e120123ca572e8ef5b1aa6ca41581134 (diff)
Merge branch 'restoringEslint' into sarah-ai-visualization
Diffstat (limited to 'src/server/Message.ts')
-rw-r--r--src/server/Message.ts91
1 files changed, 59 insertions, 32 deletions
diff --git a/src/server/Message.ts b/src/server/Message.ts
index 8f0af08bc..03150c841 100644
--- a/src/server/Message.ts
+++ b/src/server/Message.ts
@@ -1,22 +1,47 @@
-import { Point } from "../pen-gestures/ndollar";
-import { Utils } from "../Utils";
+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<T> {
private _name: string;
private _guid: string;
constructor(name: string) {
this._name = name;
- this._guid = Utils.GenerateDeterministicGuid(name);
+ this._guid = GenerateDeterministicGuid(name);
}
- get Name(): string { return this._name; }
- get Message(): string { return this._guid; }
+ 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
+ Number,
+ List,
+ Key,
+ Image,
+ Web,
+ Document,
+ Text,
+ Icon,
+ RichText,
+ DocumentReference,
+ Html,
+ Video,
+ Audio,
+ Ink,
+ PDF,
+ Tuple,
+ Boolean,
+ Script,
+ Templates,
}
export interface Transferable {
@@ -26,7 +51,9 @@ export interface Transferable {
}
export enum YoutubeQueryTypes {
- Channels, SearchVideo, VideoDetails
+ Channels,
+ SearchVideo,
+ VideoDetails,
}
export interface YoutubeQueryInput {
@@ -45,7 +72,7 @@ export interface Diff extends Reference {
export interface GestureContent {
readonly points: Array<Point>;
- readonly bounds: { right: number, left: number, bottom: number, top: number, width: number, height: number };
+ readonly bounds: { right: number; left: number; bottom: number; top: number; width: number; height: number };
readonly width?: string;
readonly color?: string;
}
@@ -73,27 +100,27 @@ export interface RoomMessage {
}
export namespace MessageStore {
- export const Foo = new Message<string>("Foo");
- export const Bar = new Message<string>("Bar");
- export const SetField = new Message<Transferable>("Set Field"); // send Transferable (no reply)
- export const GetField = new Message<string>("Get Field"); // send string 'id' get Transferable back
- export const GetFields = new Message<string[]>("Get Fields"); // send string[] of 'id' get Transferable[] back
- export const GetDocument = new Message<string>("Get Document");
- export const DeleteAll = new Message<any>("Delete All");
- export const ConnectionTerminated = new Message<string>("Connection Terminated");
-
- export const GesturePoints = new Message<GestureContent>("Gesture Points");
- export const MobileInkOverlayTrigger = new Message<MobileInkOverlayContent>("Trigger Mobile Ink Overlay");
- export const UpdateMobileInkOverlayPosition = new Message<UpdateMobileInkOverlayPositionContent>("Update Mobile Ink Overlay Position");
- export const MobileDocumentUpload = new Message<MobileDocumentUploadContent>("Upload Document From Mobile");
-
- export const GetRefField = new Message<string>("Get Ref Field");
- export const GetRefFields = new Message<string[]>("Get Ref Fields");
- export const UpdateField = new Message<Diff>("Update Ref Field");
- export const CreateField = new Message<Reference>("Create Ref Field");
- export const YoutubeApiQuery = new Message<YoutubeQueryInput>("Youtube Api Query");
- export const DeleteField = new Message<string>("Delete field");
- export const DeleteFields = new Message<string[]>("Delete fields");
-
- export const UpdateStats = new Message<string>("updatestats");
+ export const Foo = new Message<string>('Foo');
+ export const Bar = new Message<string>('Bar');
+ export const SetField = new Message<Transferable>('Set Field'); // send Transferable (no reply)
+ export const GetField = new Message<string>('Get Field'); // send string 'id' get Transferable back
+ export const GetFields = new Message<string[]>('Get Fields'); // send string[] of 'id' get Transferable[] back
+ export const GetDocument = new Message<string>('Get Document');
+ export const DeleteAll = new Message<any>('Delete All');
+ export const ConnectionTerminated = new Message<string>('Connection Terminated');
+
+ export const GesturePoints = new Message<GestureContent>('Gesture Points');
+ export const MobileInkOverlayTrigger = new Message<MobileInkOverlayContent>('Trigger Mobile Ink Overlay');
+ export const UpdateMobileInkOverlayPosition = new Message<UpdateMobileInkOverlayPositionContent>('Update Mobile Ink Overlay Position');
+ export const MobileDocumentUpload = new Message<MobileDocumentUploadContent>('Upload Document From Mobile');
+
+ export const GetRefField = new Message<string>('Get Ref Field');
+ export const GetRefFields = new Message<string[]>('Get Ref Fields');
+ export const UpdateField = new Message<Diff>('Update Ref Field');
+ export const CreateField = new Message<Reference>('Create Ref Field');
+ export const YoutubeApiQuery = new Message<YoutubeQueryInput>('Youtube Api Query');
+ export const DeleteField = new Message<string>('Delete field');
+ export const DeleteFields = new Message<string[]>('Delete fields');
+
+ export const UpdateStats = new Message<string>('updatestats');
}