30 lines
642 B
TypeScript
30 lines
642 B
TypeScript
/**
|
|
* Interface of the server (auto-generated code)
|
|
*/
|
|
import { z as zod } from "zod";
|
|
|
|
import {ZodLong} from "./long";
|
|
import {ZodPartRight} from "./part-right";
|
|
|
|
export const ZodUserMe = zod.object({
|
|
id: ZodLong,
|
|
login: zod.string().optional(),
|
|
/**
|
|
* Map<EntityName, Map<PartName, Right>>
|
|
*/
|
|
rights: zod.record(zod.string(), zod.record(zod.string(), ZodPartRight)),
|
|
|
|
});
|
|
|
|
export type UserMe = zod.infer<typeof ZodUserMe>;
|
|
|
|
export function isUserMe(data: any): data is UserMe {
|
|
try {
|
|
ZodUserMe.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodUserMe' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|