41 lines
988 B
TypeScript
41 lines
988 B
TypeScript
/**
|
|
* Interface of the server (auto-generated code)
|
|
*/
|
|
import { z as zod } from "zod";
|
|
|
|
import {ZodLong} from "./long";
|
|
import {ZodGenericTiming, ZodGenericTimingWrite } from "./generic-timing";
|
|
|
|
export const ZodGenericData = ZodGenericTiming.extend({
|
|
/**
|
|
* Unique Id of the object
|
|
*/
|
|
id: ZodLong.readonly(),
|
|
|
|
});
|
|
|
|
export type GenericData = zod.infer<typeof ZodGenericData>;
|
|
|
|
export function isGenericData(data: any): data is GenericData {
|
|
try {
|
|
ZodGenericData.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodGenericData' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|
|
export const ZodGenericDataWrite = ZodGenericTimingWrite;
|
|
|
|
export type GenericDataWrite = zod.infer<typeof ZodGenericDataWrite>;
|
|
|
|
export function isGenericDataWrite(data: any): data is GenericDataWrite {
|
|
try {
|
|
ZodGenericDataWrite.parse(data);
|
|
return true;
|
|
} catch (e: any) {
|
|
console.log(`Fail to parse data type='ZodGenericDataWrite' error=${e}`);
|
|
return false;
|
|
}
|
|
}
|