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.

Metadata max length

Steven Tey8307ee845610
diff --git a/apps/web/lib/zod/schemas/leads.ts b/apps/web/lib/zod/schemas/leads.ts
index 0f38f699b3..86ad736713 100644
--- a/apps/web/lib/zod/schemas/leads.ts
+++ b/apps/web/lib/zod/schemas/leads.ts
@@ -65,7 +65,13 @@ export const trackLeadRequestSchema = z.object({
.record(z.unknown())
.nullish()
.default(null)
- .describe("Additional metadata to be stored with the lead event"),
+ .transform((val) => (val ? JSON.stringify(val) : null))
+ .refine((val) => !val || val.length <= 1000, {
+ message: "Metadata must be less than 1000 characters when stringified",
+ })
+ .describe(
+ "Additional metadata to be stored with the lead event. Max 1000 characters.",
+ ),
mode: z
.enum(["async", "wait"])
.default("async")
diff --git a/apps/web/lib/zod/schemas/sales.ts b/apps/web/lib/zod/schemas/sales.ts
index 49e34962d3..9de60c2f4c 100644
--- a/apps/web/lib/zod/schemas/sales.ts
+++ b/apps/web/lib/zod/schemas/sales.ts
@@ -56,7 +56,13 @@ export const trackSaleRequestSchema = z.object({
.record(z.unknown())
.nullish()
.default(null)
- .describe("Additional metadata to be stored with the sale event."),
+ .transform((val) => (val ? JSON.stringify(val) : null))
+ .refine((val) => !val || val.length <= 1000, {
+ message: "Metadata must be less than 1000 characters when stringified",
+ })
+ .describe(
+ "Additional metadata to be stored with the sale event. Max 1000 characters.",
+ ),
leadEventName: z
.string()
.nullish()