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",
|
"docker",
|
||||||
"port",
|
"port",
|
||||||
"game",
|
"game",
|
||||||
|
"grpc",
|
||||||
"unknown",
|
"unknown",
|
||||||
] as const;
|
] as const;
|
||||||
export type MonitorType = (typeof MonitorTypes)[number];
|
export type MonitorType = (typeof MonitorTypes)[number];
|
||||||
@@ -58,6 +59,7 @@ export interface Monitor {
|
|||||||
tempAlertCounter: number;
|
tempAlertCounter: number;
|
||||||
selectedDisks: string[];
|
selectedDisks: string[];
|
||||||
gameId?: string;
|
gameId?: string;
|
||||||
|
grpcServiceName?: string;
|
||||||
group: string | null;
|
group: string | null;
|
||||||
recentChecks: CheckSnapshot[];
|
recentChecks: CheckSnapshot[];
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
|
|||||||
@@ -66,6 +66,18 @@ const gameSchema = baseSchema.extend({
|
|||||||
gameId: z.string().min(1, "Game type is required"),
|
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
|
// PageSpeed monitor schema
|
||||||
const pagespeedSchema = baseSchema.extend({
|
const pagespeedSchema = baseSchema.extend({
|
||||||
type: z.literal("pagespeed"),
|
type: z.literal("pagespeed"),
|
||||||
@@ -103,6 +115,7 @@ export const monitorSchema = z.discriminatedUnion("type", [
|
|||||||
portSchema,
|
portSchema,
|
||||||
dockerSchema,
|
dockerSchema,
|
||||||
gameSchema,
|
gameSchema,
|
||||||
|
grpcSchema,
|
||||||
pagespeedSchema,
|
pagespeedSchema,
|
||||||
hardwareSchema,
|
hardwareSchema,
|
||||||
]);
|
]);
|
||||||
@@ -116,6 +129,7 @@ export {
|
|||||||
portSchema,
|
portSchema,
|
||||||
dockerSchema,
|
dockerSchema,
|
||||||
gameSchema,
|
gameSchema,
|
||||||
|
grpcSchema,
|
||||||
pagespeedSchema,
|
pagespeedSchema,
|
||||||
hardwareSchema,
|
hardwareSchema,
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user