mirror of
https://github.com/hexastack/hexabot
synced 2025-04-10 15:55:55 +00:00
fix: apply feedback
This commit is contained in:
parent
5150b2e3a6
commit
7332f77624
@ -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,
|
||||
@ -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,
|
||||
@ -393,7 +393,7 @@ const attachmentBlockMessageSchema = z.object({
|
||||
});
|
||||
|
||||
// BlockMessage Schema
|
||||
export const blockMessageSchema = z.union([
|
||||
export const blockMessageObjectSchema = z.union([
|
||||
pluginBlockMessageSchema,
|
||||
textBlockMessageSchema,
|
||||
buttonMessageSchema,
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user