@4players/odin-common
Version:
A collection of commonly used type definitions and utility functions across ODIN web projects
241 lines (240 loc) • 7.82 kB
TypeScript
import * as z from 'zod';
export declare const PeerIdSchema: z.ZodNumber;
export type PeerId = z.infer<typeof PeerIdSchema>;
export declare const PeerPositionSchema: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
export type PeerPosition = z.infer<typeof PeerPositionSchema>;
export declare const PeerSchema: z.ZodObject<{
id: z.ZodNumber;
user_id: z.ZodString;
user_data: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
medias: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
properties: z.ZodUnion<[z.ZodObject<{
kind: z.ZodOptional<z.ZodLiteral<"audio">>;
uid: z.ZodOptional<z.ZodString>;
customType: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
}, {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
}>, z.ZodObject<{
kind: z.ZodOptional<z.ZodLiteral<"video">>;
codec: z.ZodOptional<z.ZodString>;
uid: z.ZodOptional<z.ZodString>;
customType: z.ZodOptional<z.ZodString>;
id: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
}, {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
}>]>;
paused: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
id: number;
paused: boolean;
properties: {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
} | {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
};
}, {
id: number;
paused: boolean;
properties: {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
} | {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
};
}>, "many">;
}, "strip", z.ZodTypeAny, {
id: number;
user_id: string;
user_data: Uint8Array;
medias: {
id: number;
paused: boolean;
properties: {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
} | {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
};
}[];
}, {
id: number;
user_id: string;
user_data: Uint8Array;
medias: {
id: number;
paused: boolean;
properties: {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
} | {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
};
}[];
}>;
export type Peer = z.infer<typeof PeerSchema>;
export declare const PeerUpdateSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
kind: z.ZodLiteral<"UserDataChanged">;
peer_id: z.ZodNumber;
user_data: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
}, "strip", z.ZodTypeAny, {
kind: "UserDataChanged";
user_data: Uint8Array;
peer_id: number;
}, {
kind: "UserDataChanged";
user_data: Uint8Array;
peer_id: number;
}>, z.ZodObject<{
kind: z.ZodLiteral<"MediaStarted">;
peer_id: z.ZodNumber;
media: z.ZodObject<{
id: z.ZodNumber;
properties: z.ZodUnion<[z.ZodObject<{
kind: z.ZodOptional<z.ZodLiteral<"audio">>;
uid: z.ZodOptional<z.ZodString>;
customType: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
}, {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
}>, z.ZodObject<{
kind: z.ZodOptional<z.ZodLiteral<"video">>;
codec: z.ZodOptional<z.ZodString>;
uid: z.ZodOptional<z.ZodString>;
customType: z.ZodOptional<z.ZodString>;
id: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
}, {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
}>]>;
paused: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
id: number;
paused: boolean;
properties: {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
} | {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
};
}, {
id: number;
paused: boolean;
properties: {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
} | {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
};
}>;
}, "strip", z.ZodTypeAny, {
media: {
id: number;
paused: boolean;
properties: {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
} | {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
};
};
kind: "MediaStarted";
peer_id: number;
}, {
media: {
id: number;
paused: boolean;
properties: {
uid?: string | undefined;
kind?: "audio" | undefined;
customType?: string | undefined;
} | {
id?: string | undefined;
codec?: string | undefined;
uid?: string | undefined;
kind?: "video" | undefined;
customType?: string | undefined;
};
};
kind: "MediaStarted";
peer_id: number;
}>, z.ZodObject<{
kind: z.ZodLiteral<"MediaStopped">;
peer_id: z.ZodNumber;
media_id: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
kind: "MediaStopped";
peer_id: number;
media_id: number;
}, {
kind: "MediaStopped";
peer_id: number;
media_id: number;
}>]>;
export type PeerUpdate = z.infer<typeof PeerUpdateSchema>;