rooooms are mostly dooone, misc routes, instance management stubs, and matchmaking base

This commit is contained in:
2025-09-07 17:28:13 -04:00
parent 2aa5352350
commit eef3667618
36 changed files with 627 additions and 122 deletions

View File

@@ -23,6 +23,9 @@ export const typedZValidator = <
>;
};
/**
* @deprecated Use transformCheckEnum after #.coerce.number() (optionally)
*/
export const transformStringToEnum = <T>(anEnum: { [s: string]: string | number }, str?: boolean) => {
return (arg: string, ctx: z.RefinementCtx<string | number>) => {
if (!str) {
@@ -36,4 +39,13 @@ export const transformStringToEnum = <T>(anEnum: { [s: string]: string | number
else ctx.addIssue("string was not a valid enum member");
}
}
}
export const transformCheckEnum = <T>(anEnum: { [s: string]: string | number }) => {
return (arg: number | string, ctx: z.RefinementCtx<number | string>) => {
if (typeof anEnum[arg] == 'undefined') {
ctx.addIssue("Not an enum member");
return null;
} else return anEnum[arg] as T;
}
}