fix: apply feedback

This commit is contained in:
abdou6666 2025-02-04 17:51:31 +01:00
parent 5150b2e3a6
commit 7332f77624
2 changed files with 5 additions and 5 deletions

View File

@ -165,7 +165,7 @@ export const stdPluginMessageSchema = z.object({
export type StdPluginMessage = z.infer<typeof stdPluginMessageSchema>; export type StdPluginMessage = z.infer<typeof stdPluginMessageSchema>;
export const BlockMessageSchema = z.union([ export const blockMessageSchema = z.union([
z.array(z.string()), z.array(z.string()),
stdOutgoingTextMessageSchema, stdOutgoingTextMessageSchema,
stdOutgoingQuickRepliesMessageSchema, stdOutgoingQuickRepliesMessageSchema,
@ -175,7 +175,7 @@ export const BlockMessageSchema = z.union([
stdPluginMessageSchema, stdPluginMessageSchema,
]); ]);
export type BlockMessage = z.infer<typeof BlockMessageSchema>; export type BlockMessage = z.infer<typeof blockMessageSchema>;
export const StdOutgoingMessageSchema = z.union([ export const StdOutgoingMessageSchema = z.union([
stdOutgoingTextMessageSchema, stdOutgoingTextMessageSchema,
@ -393,7 +393,7 @@ const attachmentBlockMessageSchema = z.object({
}); });
// BlockMessage Schema // BlockMessage Schema
export const blockMessageSchema = z.union([ export const blockMessageObjectSchema = z.union([
pluginBlockMessageSchema, pluginBlockMessageSchema,
textBlockMessageSchema, textBlockMessageSchema,
buttonMessageSchema, buttonMessageSchema,

View File

@ -15,7 +15,7 @@ import {
import { import {
BlockMessage, BlockMessage,
blockMessageSchema, blockMessageObjectSchema,
messageRegexSchema, messageRegexSchema,
textSchema, textSchema,
} from '../schemas/types/message'; } from '../schemas/types/message';
@ -36,7 +36,7 @@ export function isValidMessage(msg: any) {
} }
return result.success; return result.success;
} else if (typeof msg === 'object' && msg !== null) { } else if (typeof msg === 'object' && msg !== null) {
const result = blockMessageSchema.safeParse(msg); const result = blockMessageObjectSchema.safeParse(msg);
if (!result.success) { if (!result.success) {
console.error('Block Model: Object validation failed!', result.error); console.error('Block Model: Object validation failed!', result.error);
} }