From afd730e1c80a0f70223dd8b37c1503afc0176b5c Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Wed, 27 Nov 2024 10:44:45 +0530 Subject: [PATCH] fix: (Hotfix)any group of rules in routing (#17869) --- packages/lib/raqb/zod.test.ts | 13 +++++++++++++ packages/lib/raqb/zod.ts | 2 ++ 2 files changed, 15 insertions(+) diff --git a/packages/lib/raqb/zod.test.ts b/packages/lib/raqb/zod.test.ts index 17df1c3a4c..608d90717a 100644 --- a/packages/lib/raqb/zod.test.ts +++ b/packages/lib/raqb/zod.test.ts @@ -247,4 +247,17 @@ describe("queryValueValidationSchema", () => { }); expect(result.success).toBe(false); }); + + it("should allow properties in the query that has rule grouping details", () => { + const result = raqbQueryValueSchema.parse({ + id: "8", + type: "group", + properties: { + not: false, + conjunction: "OR", + }, + }); + expect(result.properties.not).toBe(false); + expect(result.properties.conjunction).toBe("OR"); + }); }); diff --git a/packages/lib/raqb/zod.ts b/packages/lib/raqb/zod.ts index 69c74aa296..28fd0eef7d 100644 --- a/packages/lib/raqb/zod.ts +++ b/packages/lib/raqb/zod.ts @@ -88,11 +88,13 @@ export const raqbQueryValueSchema = z.union([ id: z.string().optional(), type: z.literal("group"), children1: raqbChildren1Schema.optional(), + properties: z.any(), }), z.object({ id: z.string().optional(), type: z.literal("switch_group"), children1: raqbChildren1Schema.optional(), + properties: z.any(), }), ]);