From aa911771c436c227d584555a011946a1575dce69 Mon Sep 17 00:00:00 2001 From: Mike Shi Date: Thu, 22 Feb 2024 14:49:09 -0800 Subject: [PATCH] Fixed types --- packages/api/src/tasks/checkAlerts.ts | 4 ++-- packages/api/src/utils/zod.ts | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/api/src/tasks/checkAlerts.ts b/packages/api/src/tasks/checkAlerts.ts index 9b2a132c6..5d9d38d74 100644 --- a/packages/api/src/tasks/checkAlerts.ts +++ b/packages/api/src/tasks/checkAlerts.ts @@ -173,7 +173,7 @@ export const buildAlertMessageTemplateTitle = ({ template, view, }: { - template?: string; + template?: string | null; view: AlertMessageTemplateDefaultView; }) => { const { alert, dashboard, savedSearch, value } = view; @@ -210,7 +210,7 @@ export const buildAlertMessageTemplateBody = async ({ template, view, }: { - template?: string; + template?: string | null; view: AlertMessageTemplateDefaultView; }) => { const { diff --git a/packages/api/src/utils/zod.ts b/packages/api/src/utils/zod.ts index 15f64a2f2..43239a492 100644 --- a/packages/api/src/utils/zod.ts +++ b/packages/api/src/utils/zod.ts @@ -215,8 +215,8 @@ export const alertSchema = z threshold: z.number().min(0), type: z.enum(['presence', 'absence']), source: z.enum(['LOG', 'CHART']).default('LOG'), - templateTitle: z.string().min(1).max(512).nullable().optional(), - templateBody: z.string().min(1).max(4096).nullable().optional(), + templateTitle: z.string().min(1).max(512).nullish(), + templateBody: z.string().min(1).max(4096).nullish(), }) .and(zLogAlert.or(zChartAlert)); @@ -233,7 +233,6 @@ export const externalSearchAlertSchema = z.object({ source: z.literal('search'), groupBy: z.string().optional(), savedSearchId: objectIdSchema, - message: z.string().optional(), }); export const externalChartAlertSchema = z.object({ @@ -249,8 +248,8 @@ export const externalAlertSchema = z threshold: z.number().min(0), threshold_type: z.enum(['above', 'below']), source: z.enum(['search', 'chart']).default('search'), - name: z.string().min(1).max(512).nullable().optional(), - message: z.string().min(1).max(4096).nullable().optional(), + name: z.string().min(1).max(512).nullish(), + message: z.string().min(1).max(4096).nullish(), }) .and(externalSearchAlertSchema.or(externalChartAlertSchema));