From a06a2f1a15b9eb4f725444216bcef60947c85987 Mon Sep 17 00:00:00 2001 From: Niels Kaspers Date: Fri, 3 Apr 2026 09:07:53 +0300 Subject: [PATCH] fix(ai): default series type to event in funnel report tool (#327) --- packages/validation/src/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/validation/src/index.ts b/packages/validation/src/index.ts index 2b27593e5..97c25f33c 100644 --- a/packages/validation/src/index.ts +++ b/packages/validation/src/index.ts @@ -76,10 +76,13 @@ export const zChartEventWithType = zChartEvent.extend({ type: z.literal('event'), }); -export const zChartEventItem = z.discriminatedUnion('type', [ - zChartEventWithType, - zChartFormula, -]); +export const zChartEventItem = z + .preprocess((val) => { + if (typeof val === 'object' && val !== null && !('type' in val)) { + return { ...val, type: 'event' }; + } + return val; + }, z.discriminatedUnion('type', [zChartEventWithType, zChartFormula])); export const zChartBreakdown = z.object({ id: z.string().optional(),