Merge branch 'develop' into codeAPI

This commit is contained in:
César Cardinale
2022-04-13 17:00:55 +02:00
committed by GitHub
183 changed files with 1645 additions and 1330 deletions
+10 -13
View File
@@ -1,19 +1,16 @@
import * as tg from "generic-type-guard";
import { z } from "zod";
/*
* WARNING! The original file is in /messages/JsonMessages.
* All other files are automatically copied from this file on container startup / build
*/
export const isAdminApiData = new tg.IsInterface()
.withProperties({
userUuid: tg.isString,
email: tg.isNullable(tg.isString),
roomUrl: tg.isString,
mapUrlStart: tg.isString,
})
.withOptionalProperties({
messages: tg.isArray(tg.isUnknown),
})
.get();
export type AdminApiData = tg.GuardedType<typeof isAdminApiData>;
export const isAdminApiData = z.object({
userUuid: z.string(),
email: z.nullable(z.string()),
roomUrl: z.string(),
mapUrlStart: z.string(),
messages: z.optional(z.array(z.unknown())),
});
export type AdminApiData = z.infer<typeof isAdminApiData>;
+21 -25
View File
@@ -1,32 +1,28 @@
import * as tg from "generic-type-guard";
import { isNumber } from "generic-type-guard";
import { z } from "zod";
/*
* WARNING! The original file is in /messages/JsonMessages.
* All other files are automatically copied from this file on container startup / build
*/
export const isMapDetailsData = new tg.IsInterface()
.withProperties({
mapUrl: tg.isString,
policy_type: isNumber, //isNumericEnum(GameRoomPolicyTypes),
tags: tg.isArray(tg.isString),
authenticationMandatory: tg.isUnion(tg.isNullable(tg.isBoolean), tg.isUndefined),
roomSlug: tg.isNullable(tg.isString), // deprecated
contactPage: tg.isNullable(tg.isString),
group: tg.isNullable(tg.isString),
})
.withOptionalProperties({
iframeAuthentication: tg.isNullable(tg.isString),
// The date (in ISO 8601 format) at which the room will expire
expireOn: tg.isString,
// Whether the "report" feature is enabled or not on this room
canReport: tg.isBoolean,
// The URL of the logo image on the loading screen
loadingLogo: tg.isNullable(tg.isString),
// The URL of the logo image on "LoginScene"
loginSceneLogo: tg.isNullable(tg.isString),
})
.get();
export const isMapDetailsData = z.object({
mapUrl: z.string(),
policy_type: z.number(),
tags: z.array(z.string()),
authenticationMandatory: z.optional(z.nullable(z.boolean())),
roomSlug: z.nullable(z.string()), // deprecated
contactPage: z.nullable(z.string()),
group: z.nullable(z.string()),
export type MapDetailsData = tg.GuardedType<typeof isMapDetailsData>;
iframeAuthentication: z.optional(z.nullable(z.string())),
// The date (in ISO 8601 format) at which the room will expire
expireOn: z.optional(z.string()),
// Whether the "report" feature is enabled or not on this room
canReport: z.optional(z.boolean()),
// The URL of the logo image on the loading screen
loadingLogo: z.optional(z.nullable(z.string())),
// The URL of the logo image on "LoginScene"
loginSceneLogo: z.optional(z.nullable(z.string())),
});
export type MapDetailsData = z.infer<typeof isMapDetailsData>;
+11 -11
View File
@@ -1,6 +1,10 @@
import * as tg from "generic-type-guard";
import { z } from "zod";
/*
* WARNING! The original file is in /messages/JsonMessages.
* All other files are automatically copied from this file on container startup / build
*/
//The list of all the player textures, both the default models and the partial textures used for customization
const wokaTexture = z.object({
@@ -33,16 +37,12 @@ export type WokaList = z.infer<typeof wokaList>;
export const wokaPartNames = ["woka", "body", "eyes", "hair", "clothes", "hat", "accessory"];
export const isWokaDetail = new tg.IsInterface()
.withProperties({
id: tg.isString,
})
.withOptionalProperties({
url: tg.isString,
layer: tg.isString,
})
.get();
export const isWokaDetail = z.object({
id: z.string(),
url: z.optional(z.string()),
layer: z.optional(z.string()),
});
export type WokaDetail = tg.GuardedType<typeof isWokaDetail>;
export type WokaDetail = z.infer<typeof isWokaDetail>;
export type WokaDetailsResult = WokaDetail[];
+12 -16
View File
@@ -1,22 +1,18 @@
import * as tg from "generic-type-guard";
//import { isCharacterTexture } from "./CharacterTexture";
import { z } from "zod";
/*
* WARNING! The original file is in /messages/JsonMessages.
* All other files are automatically copied from this file on container startup / build
*/
export const isRegisterData = new tg.IsInterface()
.withProperties({
roomUrl: tg.isString,
email: tg.isNullable(tg.isString),
organizationMemberToken: tg.isNullable(tg.isString),
mapUrlStart: tg.isString,
userUuid: tg.isString,
authToken: tg.isString,
})
.withOptionalProperties({
messages: tg.isArray(tg.isUnknown),
})
.get();
export type RegisterData = tg.GuardedType<typeof isRegisterData>;
export const isRegisterData = z.object({
roomUrl: z.string(),
email: z.nullable(z.string()),
organizationMemberToken: z.nullable(z.string()),
mapUrlStart: z.string(),
userUuid: z.string(),
authToken: z.string(),
messages: z.optional(z.array(z.unknown())),
});
export type RegisterData = z.infer<typeof isRegisterData>;
+6 -7
View File
@@ -1,13 +1,12 @@
import * as tg from "generic-type-guard";
import { z } from "zod";
/*
* WARNING! The original file is in /messages/JsonMessages.
* All other files are automatically copied from this file on container startup / build
*/
export const isRoomRedirect = new tg.IsInterface()
.withProperties({
redirectUrl: tg.isString,
})
.get();
export type RoomRedirect = tg.GuardedType<typeof isRoomRedirect>;
export const isRoomRedirect = z.object({
redirectUrl: z.string(),
});
export type RoomRedirect = z.infer<typeof isRoomRedirect>;
+1 -2
View File
@@ -18,11 +18,10 @@
"pretty-check": "yarn prettier --check 'JsonMessages/**/*.ts'"
},
"dependencies": {
"generic-type-guard": "^3.5.0",
"google-protobuf": "^3.13.0",
"grpc": "^1.24.4",
"ts-proto": "^1.96.0",
"zod": "^3.12.0"
"zod": "^3.14.3"
},
"devDependencies": {
"@types/google-protobuf": "^3.7.4",
+4 -9
View File
@@ -1901,11 +1901,6 @@ gauge@~2.7.3:
strip-ansi "^3.0.1"
wide-align "^1.1.0"
generic-type-guard@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/generic-type-guard/-/generic-type-guard-3.5.0.tgz#39de9f8fceee65d79e7540959f0e7b23210c07b6"
integrity sha512-OpgXv/sbRobhFboaSyN/Tsh97Sxt5pcfLLxCiYZgYIIWFFp+kn2EzAXiaQZKEVRlq1rOE/zh8cYhJXEwplbJiQ==
get-caller-file@^2.0.1:
version "2.0.5"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
@@ -4646,7 +4641,7 @@ year@^0.2.1:
resolved "https://registry.yarnpkg.com/year/-/year-0.2.1.tgz#4083ae520a318b23ec86037f3000cb892bdf9bb0"
integrity sha1-QIOuUgoxiyPshgN/MADLiSvfm7A=
zod@^3.12.0:
version "3.14.2"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.14.2.tgz#0b4ed79085c471adce0e7f2c0a4fbb5ddc516ba2"
integrity sha512-iF+wrtzz7fQfkmn60PG6XFxaWBhYYKzp2i+nv24WbLUWb2JjymdkHlzBwP0erpc78WotwP5g9AAu7Sk8GWVVNw==
zod@^3.14.3:
version "3.14.3"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.14.3.tgz#60e86341c05883c281fe96a0e79acea48a09f123"
integrity sha512-OzwRCSXB1+/8F6w6HkYHdbuWysYWnAF4fkRgKDcSFc54CE+Sv0rHXKfeNUReGCrHukm1LNpi6AYeXotznhYJbQ==