Adding wokalist type checking on front

Additionally, we are making superLoad.json accept a new "immediateCallback" parameter that resolves during the event handler (and not after)
This commit is contained in:
David Négrier
2022-03-21 10:33:25 +01:00
parent 2d3e2805a1
commit 705c75e3c7
18 changed files with 114 additions and 132 deletions
+48
View File
@@ -0,0 +1,48 @@
import * as tg from "generic-type-guard";
import { z } from "zod";
//The list of all the player textures, both the default models and the partial textures used for customization
const wokaTexture = z.object({
id: z.string(),
name: z.string(),
url: z.string(),
tags: z.array(z.string()).optional(),
tintable: z.boolean().optional(),
});
export type WokaTexture = z.infer<typeof wokaTexture>;
const wokaTextureCollection = z.object({
name: z.string(),
textures: z.array(wokaTexture),
});
export type WokaTextureCollection = z.infer<typeof wokaTextureCollection>;
const wokaPartType = z.object({
collections: z.array(wokaTextureCollection),
required: z.boolean().optional(),
});
export type WokaPartType = z.infer<typeof wokaPartType>;
export const wokaList = z.record(wokaPartType);
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 type WokaDetail = tg.GuardedType<typeof isWokaDetail>;
export type WokaDetailsResult = WokaDetail[];
+2 -1
View File
@@ -21,7 +21,8 @@
"generic-type-guard": "^3.5.0",
"google-protobuf": "^3.13.0",
"grpc": "^1.24.4",
"ts-proto": "^1.96.0"
"ts-proto": "^1.96.0",
"zod": "^3.12.0"
},
"devDependencies": {
"@types/google-protobuf": "^3.7.4",
+5
View File
@@ -4645,3 +4645,8 @@ year@^0.2.1:
version "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==