Skip to content

Commit

Permalink
fix: apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
abdou6666 committed Feb 4, 2025
1 parent 5150b2e commit 7332f77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions api/src/chat/schemas/types/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const stdPluginMessageSchema = z.object({

export type StdPluginMessage = z.infer<typeof stdPluginMessageSchema>;

export const BlockMessageSchema = z.union([
export const blockMessageSchema = z.union([
z.array(z.string()),
stdOutgoingTextMessageSchema,
stdOutgoingQuickRepliesMessageSchema,
Expand All @@ -175,7 +175,7 @@ export const BlockMessageSchema = z.union([
stdPluginMessageSchema,
]);

export type BlockMessage = z.infer<typeof BlockMessageSchema>;
export type BlockMessage = z.infer<typeof blockMessageSchema>;

export const StdOutgoingMessageSchema = z.union([
stdOutgoingTextMessageSchema,
Expand Down Expand Up @@ -393,7 +393,7 @@ const attachmentBlockMessageSchema = z.object({
});

// BlockMessage Schema
export const blockMessageSchema = z.union([
export const blockMessageObjectSchema = z.union([
pluginBlockMessageSchema,
textBlockMessageSchema,
buttonMessageSchema,
Expand Down
4 changes: 2 additions & 2 deletions api/src/chat/validation-rules/is-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

import {
BlockMessage,
blockMessageSchema,
blockMessageObjectSchema,
messageRegexSchema,
textSchema,
} from '../schemas/types/message';
Expand All @@ -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);
}
Expand Down

0 comments on commit 7332f77

Please sign in to comment.