Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

combine to refine only

Steven Tey2c54493b5763
diff --git a/apps/web/lib/zod/schemas/leads.ts b/apps/web/lib/zod/schemas/leads.ts
index 56f4cd9592..bd0bfa86ed 100644
--- a/apps/web/lib/zod/schemas/leads.ts
+++ b/apps/web/lib/zod/schemas/leads.ts
@@ -65,9 +65,8 @@ export const trackLeadRequestSchema = z.object({
.record(z.unknown())
.nullish()
.default(null)
- .transform((val) => (val ? JSON.stringify(val) : null))
- .refine((val) => !val || val.length <= 10000, {
- message: "Metadata must be less than 10000 characters when stringified",
+ .refine((val) => !val || JSON.stringify(val).length <= 10000, {
+ message: "Metadata must be less than 10,000 characters when stringified",
})
.describe(
"Additional metadata to be stored with the lead event. Max 10,000 characters.",
diff --git a/apps/web/lib/zod/schemas/sales.ts b/apps/web/lib/zod/schemas/sales.ts
index a5a9867721..74af54369c 100644
--- a/apps/web/lib/zod/schemas/sales.ts
+++ b/apps/web/lib/zod/schemas/sales.ts
@@ -56,9 +56,8 @@ export const trackSaleRequestSchema = z.object({
.record(z.unknown())
.nullish()
.default(null)
- .transform((val) => (val ? JSON.stringify(val) : null))
- .refine((val) => !val || val.length <= 10000, {
- message: "Metadata must be less than 10000 characters when stringified",
+ .refine((val) => !val || JSON.stringify(val).length <= 10000, {
+ message: "Metadata must be less than 10,000 characters when stringified",
})
.describe(
"Additional metadata to be stored with the sale event. Max 10,000 characters.",