From 7332f77624673de361df93f53c36ce18be30cc28 Mon Sep 17 00:00:00 2001 From: abdou6666 Date: Tue, 4 Feb 2025 17:51:31 +0100 Subject: [PATCH] fix: apply feedback --- api/src/chat/schemas/types/message.ts | 6 +++--- api/src/chat/validation-rules/is-message.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/chat/schemas/types/message.ts b/api/src/chat/schemas/types/message.ts index d0efb09d..4cacffa7 100644 --- a/api/src/chat/schemas/types/message.ts +++ b/api/src/chat/schemas/types/message.ts @@ -165,7 +165,7 @@ export const stdPluginMessageSchema = z.object({ export type StdPluginMessage = z.infer; -export const BlockMessageSchema = z.union([ +export const blockMessageSchema = z.union([ z.array(z.string()), stdOutgoingTextMessageSchema, stdOutgoingQuickRepliesMessageSchema, @@ -175,7 +175,7 @@ export const BlockMessageSchema = z.union([ stdPluginMessageSchema, ]); -export type BlockMessage = z.infer; +export type BlockMessage = z.infer; export const StdOutgoingMessageSchema = z.union([ stdOutgoingTextMessageSchema, @@ -393,7 +393,7 @@ const attachmentBlockMessageSchema = z.object({ }); // BlockMessage Schema -export const blockMessageSchema = z.union([ +export const blockMessageObjectSchema = z.union([ pluginBlockMessageSchema, textBlockMessageSchema, buttonMessageSchema, diff --git a/api/src/chat/validation-rules/is-message.ts b/api/src/chat/validation-rules/is-message.ts index f08f75d3..20fc2f2b 100644 --- a/api/src/chat/validation-rules/is-message.ts +++ b/api/src/chat/validation-rules/is-message.ts @@ -15,7 +15,7 @@ import { import { BlockMessage, - blockMessageSchema, + blockMessageObjectSchema, messageRegexSchema, textSchema, } from '../schemas/types/message'; @@ -36,7 +36,7 @@ export function isValidMessage(msg: any) { } return result.success; } else if (typeof msg === 'object' && msg !== null) { - const result = blockMessageSchema.safeParse(msg); + const result = blockMessageObjectSchema.safeParse(msg); if (!result.success) { console.error('Block Model: Object validation failed!', result.error); }