mirror of
https://github.com/hexastack/hexabot
synced 2025-04-27 17:51:58 +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 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,
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user