Merge branch 'master' of github.com:thecodingmachine/workadventure into develop

This commit is contained in:
David Négrier 2021-12-07 14:59:17 +01:00
commit 1e6ce4dec8
8 changed files with 205 additions and 86 deletions

View file

@ -0,0 +1,30 @@
import * as tg from "generic-type-guard";
export const isBanBannedAdminMessageInterface = new tg.IsInterface()
.withProperties({
type: tg.isSingletonStringUnion("ban", "banned"),
message: tg.isString,
userUuid: tg.isString,
})
.get();
export const isUserMessageAdminMessageInterface = new tg.IsInterface()
.withProperties({
event: tg.isSingletonString("user-message"),
message: isBanBannedAdminMessageInterface,
world: tg.isString,
jwt: tg.isString,
})
.get();
export const isListenRoomsMessageInterface = new tg.IsInterface()
.withProperties({
event: tg.isSingletonString("listen"),
roomIds: tg.isArray(tg.isString),
jwt: tg.isString,
})
.get();
export const isAdminMessageInterface = tg.isUnion(isUserMessageAdminMessageInterface, isListenRoomsMessageInterface);
export type AdminMessageInterface = tg.GuardedType<typeof isAdminMessageInterface>;