mirror of
https://github.com/hexastack/hexabot
synced 2025-04-25 00:39:43 +00:00
fix: typing & remove type assertion
This commit is contained in:
parent
1f8285a09c
commit
4e80a0a215
@ -280,10 +280,7 @@ export type StdOutgoingButtonsEnvelope = z.infer<
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
export const stdOutgoingListEnvelopeSchema = z.object({
|
export const stdOutgoingListEnvelopeSchema = z.object({
|
||||||
format: z.union([
|
format: z.enum(['list', 'carousel']),
|
||||||
z.literal(OutgoingMessageFormat.list),
|
|
||||||
z.literal(OutgoingMessageFormat.carousel),
|
|
||||||
]),
|
|
||||||
message: stdOutgoingListMessageSchema,
|
message: stdOutgoingListMessageSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -9,10 +9,9 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { buttonSchema } from './button';
|
import { buttonSchema } from './button';
|
||||||
import { OutgoingMessageFormat } from './message';
|
|
||||||
|
|
||||||
export const contentOptionsSchema = z.object({
|
export const contentOptionsSchema = z.object({
|
||||||
display: z.nativeEnum(OutgoingMessageFormat),
|
display: z.enum(['list', 'carousel']),
|
||||||
fields: z.object({
|
fields: z.object({
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
subtitle: z.string().nullable(),
|
subtitle: z.string().nullable(),
|
||||||
|
@ -576,13 +576,13 @@ export class BlockService extends BaseService<
|
|||||||
contentBlockOptions,
|
contentBlockOptions,
|
||||||
skip,
|
skip,
|
||||||
);
|
);
|
||||||
const envelope = {
|
const envelope: StdOutgoingEnvelope = {
|
||||||
format: contentBlockOptions.display,
|
format: contentBlockOptions.display,
|
||||||
message: {
|
message: {
|
||||||
...results,
|
...results,
|
||||||
options: contentBlockOptions,
|
options: contentBlockOptions,
|
||||||
},
|
},
|
||||||
} as StdOutgoingEnvelope;
|
};
|
||||||
return envelope;
|
return envelope;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
|
Loading…
Reference in New Issue
Block a user