Feat: Add gRPC to client validation
This commit is contained in:
1 parent
c95db26437
commit
c06f81ef76
2 files changed
+16
No files matched your search
@@ -9,6 +9,7 @@ export const MonitorTypes = [
|
||||
"docker",
|
||||
"port",
|
||||
"game",
|
||||
"grpc",
|
||||
"unknown",
|
||||
] as const;
|
||||
export type MonitorType = (typeof MonitorTypes)[number];
|
||||
@@ -58,6 +59,7 @@ export interface Monitor {
|
||||
tempAlertCounter: number;
|
||||
selectedDisks: string[];
|
||||
gameId?: string;
|
||||
grpcServiceName?: string;
|
||||
group: string | null;
|
||||
recentChecks: CheckSnapshot[];
|
||||
createdAt: string;
|
||||
|
||||
@@ -66,6 +66,18 @@ const gameSchema = baseSchema.extend({
|
||||
gameId: z.string().min(1, "Game type is required"),
|
||||
});
|
||||
|
||||
// gRPC monitor schema
|
||||
const grpcSchema = baseSchema.extend({
|
||||
type: z.literal("grpc"),
|
||||
url: z.string().min(1, "Host is required"),
|
||||
port: z
|
||||
.number()
|
||||
.min(1, "Port must be at least 1")
|
||||
.max(65535, "Port must be at most 65535"),
|
||||
grpcServiceName: z.string().optional(),
|
||||
ignoreTlsErrors: z.boolean(),
|
||||
});
|
||||
|
||||
// PageSpeed monitor schema
|
||||
const pagespeedSchema = baseSchema.extend({
|
||||
type: z.literal("pagespeed"),
|
||||
@@ -103,6 +115,7 @@ export const monitorSchema = z.discriminatedUnion("type", [
|
||||
portSchema,
|
||||
dockerSchema,
|
||||
gameSchema,
|
||||
grpcSchema,
|
||||
pagespeedSchema,
|
||||
hardwareSchema,
|
||||
]);
|
||||
@@ -116,6 +129,7 @@ export {
|
||||
portSchema,
|
||||
dockerSchema,
|
||||
gameSchema,
|
||||
grpcSchema,
|
||||
pagespeedSchema,
|
||||
hardwareSchema,
|
||||
};
|
||||
Reference in new issue
Block a user