The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Revert "empty destination URLs on link response schemas"
Kiran Ka8a0c0c45122
diff --git a/apps/web/lib/zod/schemas/customers.ts b/apps/web/lib/zod/schemas/customers.tsindex cde8225114..96ffbe0ab2 100644--- a/apps/web/lib/zod/schemas/customers.ts+++ b/apps/web/lib/zod/schemas/customers.ts@@ -1,6 +1,6 @@import * as z from "zod/v4";import { DiscountSchema } from "./discount";-import { LinkSchema, linkUrlSchema } from "./links";+import { LinkSchema } from "./links";import {booleanQuerySchema,getCursorPaginationQuerySchema,@@ -185,12 +185,9 @@ export const CustomerEnrichedSchema = CustomerSchema.extend({domain: true,key: true,shortLink: true,+ url: true,programId: true,- })- .extend({- url: linkUrlSchema,- })- .nullish(),+ }).nullish(),programId: z.string().nullish(),partner: PartnerSchema.pick({id: true,diff --git a/apps/web/lib/zod/schemas/leads.ts b/apps/web/lib/zod/schemas/leads.tsindex 1705afd38f..2d1abdd75a 100644--- a/apps/web/lib/zod/schemas/leads.ts+++ b/apps/web/lib/zod/schemas/leads.ts@@ -2,7 +2,7 @@ import * as z from "zod/v4";import { clickEventSchema, clickEventSchemaTB } from "./clicks";import { CustomerSchema } from "./customers";import { commonDeprecatedEventFields } from "./deprecated";-import { linkEventSchema, LinkSchema, linkUrlSchema } from "./links";+import { linkEventSchema, LinkSchema } from "./links";export const trackLeadRequestSchema = z.object({clickId: z@@ -83,15 +83,12 @@ export const trackLeadResponseSchema = z.object({domain: true,key: true,shortLink: true,+ url: true,partnerId: true,programId: true,tenantId: true,externalId: true,- })- .extend({- url: linkUrlSchema,- })- .nullable(),+ }).nullable(),customer: z.object({name: z.string().nullable(),email: z.string().nullable(),diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.tsindex b30373e2d2..ef8fc55747 100644--- a/apps/web/lib/zod/schemas/links.ts+++ b/apps/web/lib/zod/schemas/links.ts@@ -847,13 +847,9 @@ export const getLinkInfoQuerySchemaExtended = getLinkInfoQuerySchema.extend({includeWebhooks: booleanQuerySchema.default(false),});-// Root domain links (`_root`) can have an empty destination URL.-export const linkUrlSchema = z- .string()- .describe("The destination URL of the short link.");-export const linkEventSchema = LinkSchema.extend({- url: linkUrlSchema,+ // here we use string because url can be empty+ url: z.string(),expiredUrl: z.string().nullable(),// coerce boolean fieldsarchived: z.coerce.boolean(),diff --git a/apps/web/lib/zod/schemas/partner-profile.ts b/apps/web/lib/zod/schemas/partner-profile.tsindex b0858b139d..303279daf9 100644--- a/apps/web/lib/zod/schemas/partner-profile.ts+++ b/apps/web/lib/zod/schemas/partner-profile.ts@@ -26,7 +26,7 @@ import {} from "./commissions";import { customerActivityResponseSchema } from "./customer-activity";import { CustomerEnrichedSchema } from "./customers";-import { LinkSchema, linkUrlSchema } from "./links";+import { LinkSchema } from "./links";import { getPaginationQuerySchema } from "./misc";import { payoutsQuerySchema } from "./payouts";import { submittedLeadFormDataSchema } from "./submitted-lead-form";@@ -46,11 +46,8 @@ export const PartnerEarningsSchema = CommissionSchema.omit({link: LinkSchema.pick({id: true,shortLink: true,- })- .extend({- url: linkUrlSchema,- })- .nullish(),+ url: true,+ }).nullish(),});export const getPartnerEarningsQuerySchema = getCommissionsQuerySchema@@ -93,13 +90,13 @@ export const PartnerProfileLinkSchema = LinkSchema.pick({domain: true,key: true,shortLink: true,+ url: true,clicks: true,leads: true,sales: true,saleAmount: true,comments: true,}).extend({- url: linkUrlSchema,createdAt: z.string().or(z.date()),partnerGroupDefaultLinkId: z.string().nullish(),discountCode: z.string().nullable().default(null),diff --git a/apps/web/lib/zod/schemas/programs.ts b/apps/web/lib/zod/schemas/programs.tsindex eb30aded47..0c1a5d1076 100644--- a/apps/web/lib/zod/schemas/programs.ts+++ b/apps/web/lib/zod/schemas/programs.ts@@ -15,7 +15,7 @@ import {import * as z from "zod/v4";import { DiscountSchema } from "./discount";import { GroupSchema } from "./groups";-import { LinkSchema, linkUrlSchema } from "./links";+import { LinkSchema } from "./links";import { programApplicationFormDataWithValuesSchema } from "./program-application-form";import { programInviteEmailDataSchema } from "./program-invite-email";import { RewardSchema } from "./rewards";@@ -114,13 +114,12 @@ export const ProgramPartnerLinkSchema = LinkSchema.pick({domain: true,key: true,shortLink: true,+ url: true,clicks: true,leads: true,conversions: true,sales: true,saleAmount: true,-}).extend({- url: linkUrlSchema,});export const ProgramEnrollmentApplicationSchema = z.object({diff --git a/apps/web/lib/zod/schemas/referrals-embed.ts b/apps/web/lib/zod/schemas/referrals-embed.tsindex 269d4a6a09..d5317d97e9 100644--- a/apps/web/lib/zod/schemas/referrals-embed.ts+++ b/apps/web/lib/zod/schemas/referrals-embed.ts@@ -1,16 +1,16 @@import * as z from "zod/v4";-import { LinkSchema, linkUrlSchema } from "./links";+import { LinkSchema } from "./links";export const ReferralsEmbedLinkSchema = LinkSchema.pick({id: true,domain: true,key: true,+ url: true,shortLink: true,clicks: true,leads: true,sales: true,saleAmount: true,}).extend({- url: linkUrlSchema,partnerGroupDefaultLinkId: z.string().nullish(),});