The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Fix build error
Kiran K94c419b27e75
diff --git a/apps/web/app/api/links/count/route.ts b/apps/web/app/api/links/count/route.tsindex 43fc832803..effb8e778e 100644--- a/apps/web/app/api/links/count/route.ts+++ b/apps/web/app/api/links/count/route.ts@@ -1,7 +1,7 @@import { getLinksCount } from "@/lib/api/links";import { withAuth } from "@/lib/auth";import { handleAndReturnErrorResponse } from "@/lib/errors";-import { getLinksCountParamsSchema } from "@/lib/zod";+import { getLinksCountParamsSchema } from "@/lib/zod/schemas/links";import { NextResponse } from "next/server";// GET /api/links/count – get the number of links for a projectdiff --git a/apps/web/lib/api/links.ts b/apps/web/lib/api/links.tsindex cc4e957153..6b8be93ff6 100644--- a/apps/web/lib/api/links.ts+++ b/apps/web/lib/api/links.ts@@ -25,7 +25,7 @@ import { getLinkViaEdge } from "../planetscale";import { recordLink } from "../tinybird";import { LinkProps, ProjectProps, RedisLinkProps } from "../types";import z from "../zod";-import { getLinksQuerySchema } from "../zod/schemas/links";+import { getLinksCountParamsSchema, getLinksQuerySchema } from "@/lib/zod/schemas/links";export async function getLinksForProject({projectId,@@ -88,7 +88,7 @@ export async function getLinksCount({projectId,userId,}: {- searchParams: Record<string, string>;+ searchParams: z.infer<typeof getLinksCountParamsSchema>;projectId: string;userId?: string | null;}) {diff --git a/apps/web/lib/zod/index.ts b/apps/web/lib/zod/index.tsindex 620ef72294..32898654ae 100644--- a/apps/web/lib/zod/index.ts+++ b/apps/web/lib/zod/index.ts@@ -5,18 +5,7 @@ extendZodWithOpenApi(z);export default z;-export const getLinksCountParamsSchema = z.object({- userId: z.string().optional(),- tagId: z.string().optional(),- domain: z.string().optional(),- showArchived: z.coerce.boolean().optional(),- search: z.string().optional(),- groupBy: z.union([z.literal("domain"), z.literal("tagId")]).optional(),-});-export const domainKeySchema = z.object({domain: z.string().min(1),key: z.string().min(1),});--export type GetLinksCountParams = z.infer<typeof getLinksCountParamsSchema>;diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.tsindex 307e4b3189..646a98ee0d 100644--- a/apps/web/lib/zod/schemas/links.ts+++ b/apps/web/lib/zod/schemas/links.ts@@ -175,3 +175,12 @@ export const bulkCreateLinksBodySchema = zexport const LinkSchema = Link.extend({geo: z.record(z.string()).optional().nullable(),}).openapi({ title: "Link" });++export const getLinksCountParamsSchema = z.object({+ userId: z.string().optional(),+ tagId: z.string().optional(),+ domain: z.string().optional(),+ showArchived: z.coerce.boolean().optional(),+ search: z.string().optional(),+ groupBy: z.union([z.literal("domain"), z.literal("tagId")]).optional(),+});\ No newline at end of filediff --git a/apps/web/prisma/zod/index.ts b/apps/web/prisma/zod/index.tsindex af33ad782a..19d88ae733 100644--- a/apps/web/prisma/zod/index.ts+++ b/apps/web/prisma/zod/index.ts@@ -1,5 +1,5 @@-import { Prisma } from "@prisma/client";-import { z } from "zod";+import { z } from 'zod';+import { Prisma } from '@prisma/client';/////////////////////////////////////////// HELPER FUNCTIONS@@ -8,17 +8,11 @@ import { z } from "zod";// JSON//-------------------------------------------------------export type NullableJsonInput =- | Prisma.JsonValue- | null- | "JsonNull"- | "DbNull"- | Prisma.NullTypes.DbNull- | Prisma.NullTypes.JsonNull;+export type NullableJsonInput = Prisma.JsonValue | null | 'JsonNull' | 'DbNull' | Prisma.NullTypes.DbNull | Prisma.NullTypes.JsonNull;export const transformJsonNull = (v?: NullableJsonInput) => {- if (!v || v === "DbNull") return Prisma.DbNull;- if (v === "JsonNull") return Prisma.JsonNull;+ if (!v || v === 'DbNull') return Prisma.DbNull;+ if (v === 'JsonNull') return Prisma.JsonNull;return v;};@@ -30,369 +24,113 @@ export const JsonValueSchema: z.ZodType<Prisma.JsonValue> = z.lazy(() =>z.literal(null),z.record(z.lazy(() => JsonValueSchema.optional())),z.array(z.lazy(() => JsonValueSchema)),- ]),+ ]));export type JsonValueType = z.infer<typeof JsonValueSchema>;export const NullableJsonValue = z- .union([JsonValueSchema, z.literal("DbNull"), z.literal("JsonNull")])+ .union([JsonValueSchema, z.literal('DbNull'), z.literal('JsonNull')]).nullable().transform((v) => transformJsonNull(v));export type NullableJsonValueType = z.infer<typeof NullableJsonValue>;-export const InputJsonValueSchema: z.ZodType<Prisma.InputJsonValue> = z.lazy(- () =>- z.union([- z.string(),- z.number(),- z.boolean(),- z.object({ toJSON: z.function(z.tuple([]), z.any()) }),- z.record(z.lazy(() => z.union([InputJsonValueSchema, z.literal(null)]))),- z.array(z.lazy(() => z.union([InputJsonValueSchema, z.literal(null)]))),- ]),+export const InputJsonValueSchema: z.ZodType<Prisma.InputJsonValue> = z.lazy(() =>+ z.union([+ z.string(),+ z.number(),+ z.boolean(),+ z.object({ toJSON: z.function(z.tuple([]), z.any()) }),+ z.record(z.lazy(() => z.union([InputJsonValueSchema, z.literal(null)]))),+ z.array(z.lazy(() => z.union([InputJsonValueSchema, z.literal(null)]))),+ ]));export type InputJsonValueType = z.infer<typeof InputJsonValueSchema>;+/////////////////////////////////////////// ENUMS/////////////////////////////////////////-export const TransactionIsolationLevelSchema = z.enum([- "ReadUncommitted",- "ReadCommitted",- "RepeatableRead",- "Serializable",-]);--export const UserScalarFieldEnumSchema = z.enum([- "id",- "name",- "email",- "emailVerified",- "image",- "createdAt",-]);--export const AccountScalarFieldEnumSchema = z.enum([- "id",- "userId",- "type",- "provider",- "providerAccountId",- "refresh_token",- "refresh_token_expires_in",- "access_token",- "expires_at",- "token_type",- "scope",- "id_token",- "session_state",-]);--export const SessionScalarFieldEnumSchema = z.enum([- "id",- "sessionToken",- "userId",- "expires",-]);--export const VerificationTokenScalarFieldEnumSchema = z.enum([- "identifier",- "token",- "expires",-]);--export const TokenScalarFieldEnumSchema = z.enum([- "id",- "name",- "hashedKey",- "partialKey",- "expires",- "lastUsed",- "createdAt",- "updatedAt",- "userId",-]);--export const ProjectScalarFieldEnumSchema = z.enum([- "id",- "name",- "slug",- "logo",- "plan",- "stripeId",- "billingCycleStart",- "usage",- "usageLimit",- "linksUsage",- "linksLimit",- "domainsLimit",- "tagsLimit",- "usersLimit",- "monitoringId",- "createdAt",- "updatedAt",- "metadata",-]);--export const ProjectInviteScalarFieldEnumSchema = z.enum([- "email",- "expires",- "projectId",- "createdAt",-]);--export const ProjectUsersScalarFieldEnumSchema = z.enum([- "id",- "role",- "createdAt",- "updatedAt",- "userId",- "projectId",-]);--export const SentEmailScalarFieldEnumSchema = z.enum([- "id",- "type",- "createdAt",- "projectId",-]);--export const DomainScalarFieldEnumSchema = z.enum([- "id",- "slug",- "verified",- "target",- "type",- "placeholder",- "description",- "projectId",- "primary",- "archived",- "clicks",- "lastClicked",- "lastChecked",- "createdAt",- "updatedAt",-]);--export const LinkScalarFieldEnumSchema = z.enum([- "id",- "domain",- "key",- "url",- "archived",- "expiresAt",- "password",- "proxy",- "title",- "description",- "image",- "utm_source",- "utm_medium",- "utm_campaign",- "utm_term",- "utm_content",- "rewrite",- "ios",- "android",- "geo",- "userId",- "projectId",- "publicStats",- "clicks",- "lastClicked",- "checkDisabled",- "createdAt",- "updatedAt",- "tagId",- "comments",-]);--export const TagScalarFieldEnumSchema = z.enum([- "id",- "name",- "color",- "createdAt",- "updatedAt",- "projectId",-]);--export const Jackson_indexScalarFieldEnumSchema = z.enum([- "id",- "key",- "storeKey",-]);--export const Jackson_storeScalarFieldEnumSchema = z.enum([- "key",- "value",- "iv",- "tag",- "namespace",- "createdAt",- "modifiedAt",-]);--export const Jackson_ttlScalarFieldEnumSchema = z.enum(["key", "expiresAt"]);--export const SortOrderSchema = z.enum(["asc", "desc"]);--export const NullableJsonNullValueInputSchema = z- .enum(["DbNull", "JsonNull"])- .transform((value) =>- value === "JsonNull"- ? Prisma.JsonNull- : value === "DbNull"- ? Prisma.DbNull- : value,- );--export const NullsOrderSchema = z.enum(["first", "last"]);--export const UserOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "name",- "email",- "image",-]);--export const AccountOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "userId",- "type",- "provider",- "providerAccountId",- "refresh_token",- "access_token",- "token_type",- "scope",- "id_token",- "session_state",-]);--export const SessionOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "sessionToken",- "userId",-]);--export const VerificationTokenOrderByRelevanceFieldEnumSchema = z.enum([- "identifier",- "token",-]);--export const TokenOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "name",- "hashedKey",- "partialKey",- "userId",-]);--export const JsonNullValueFilterSchema = z- .enum(["DbNull", "JsonNull", "AnyNull"])- .transform((value) =>- value === "JsonNull"- ? Prisma.JsonNull- : value === "DbNull"- ? Prisma.JsonNull- : value === "AnyNull"- ? Prisma.AnyNull- : value,- );--export const ProjectOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "name",- "slug",- "logo",- "plan",- "stripeId",- "monitoringId",-]);--export const ProjectInviteOrderByRelevanceFieldEnumSchema = z.enum([- "email",- "projectId",-]);--export const ProjectUsersOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "userId",- "projectId",-]);--export const SentEmailOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "type",- "projectId",-]);--export const DomainOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "slug",- "target",- "type",- "placeholder",- "description",- "projectId",-]);--export const LinkOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "domain",- "key",- "url",- "password",- "title",- "description",- "image",- "utm_source",- "utm_medium",- "utm_campaign",- "utm_term",- "utm_content",- "ios",- "android",- "userId",- "projectId",- "tagId",- "comments",-]);--export const TagOrderByRelevanceFieldEnumSchema = z.enum([- "id",- "name",- "color",- "projectId",-]);--export const jackson_indexOrderByRelevanceFieldEnumSchema = z.enum([- "key",- "storeKey",-]);--export const jackson_storeOrderByRelevanceFieldEnumSchema = z.enum([- "key",- "value",- "iv",- "tag",- "namespace",-]);--export const jackson_ttlOrderByRelevanceFieldEnumSchema = z.enum(["key"]);--export const RoleSchema = z.enum(["owner", "member"]);--export type RoleType = `${z.infer<typeof RoleSchema>}`;--export const PlanSchema = z.enum(["free", "pro", "business", "enterprise"]);--export type PlanType = `${z.infer<typeof PlanSchema>}`;+export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']);++export const UserScalarFieldEnumSchema = z.enum(['id','name','email','emailVerified','image','createdAt']);++export const AccountScalarFieldEnumSchema = z.enum(['id','userId','type','provider','providerAccountId','refresh_token','refresh_token_expires_in','access_token','expires_at','token_type','scope','id_token','session_state']);++export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']);++export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']);++export const TokenScalarFieldEnumSchema = z.enum(['id','name','hashedKey','partialKey','expires','lastUsed','createdAt','updatedAt','userId']);++export const ProjectScalarFieldEnumSchema = z.enum(['id','name','slug','logo','plan','stripeId','billingCycleStart','usage','usageLimit','linksUsage','linksLimit','domainsLimit','tagsLimit','usersLimit','monitoringId','createdAt','updatedAt','metadata']);++export const ProjectInviteScalarFieldEnumSchema = z.enum(['email','expires','projectId','createdAt']);++export const ProjectUsersScalarFieldEnumSchema = z.enum(['id','role','createdAt','updatedAt','userId','projectId']);++export const SentEmailScalarFieldEnumSchema = z.enum(['id','type','createdAt','projectId']);++export const DomainScalarFieldEnumSchema = z.enum(['id','slug','verified','target','type','placeholder','description','projectId','primary','archived','clicks','lastClicked','lastChecked','createdAt','updatedAt']);++export const LinkScalarFieldEnumSchema = z.enum(['id','domain','key','url','archived','expiresAt','password','proxy','title','description','image','utm_source','utm_medium','utm_campaign','utm_term','utm_content','rewrite','ios','android','geo','userId','projectId','publicStats','clicks','lastClicked','checkDisabled','createdAt','updatedAt','tagId','comments']);++export const TagScalarFieldEnumSchema = z.enum(['id','name','color','createdAt','updatedAt','projectId']);++export const Jackson_indexScalarFieldEnumSchema = z.enum(['id','key','storeKey']);++export const Jackson_storeScalarFieldEnumSchema = z.enum(['key','value','iv','tag','namespace','createdAt','modifiedAt']);++export const Jackson_ttlScalarFieldEnumSchema = z.enum(['key','expiresAt']);++export const SortOrderSchema = z.enum(['asc','desc']);++export const NullableJsonNullValueInputSchema = z.enum(['DbNull','JsonNull',]).transform((value) => value === 'JsonNull' ? Prisma.JsonNull : value === 'DbNull' ? Prisma.DbNull : value);++export const NullsOrderSchema = z.enum(['first','last']);++export const UserOrderByRelevanceFieldEnumSchema = z.enum(['id','name','email','image']);++export const AccountOrderByRelevanceFieldEnumSchema = z.enum(['id','userId','type','provider','providerAccountId','refresh_token','access_token','token_type','scope','id_token','session_state']);++export const SessionOrderByRelevanceFieldEnumSchema = z.enum(['id','sessionToken','userId']);++export const VerificationTokenOrderByRelevanceFieldEnumSchema = z.enum(['identifier','token']);++export const TokenOrderByRelevanceFieldEnumSchema = z.enum(['id','name','hashedKey','partialKey','userId']);++export const JsonNullValueFilterSchema = z.enum(['DbNull','JsonNull','AnyNull',]).transform((value) => value === 'JsonNull' ? Prisma.JsonNull : value === 'DbNull' ? Prisma.JsonNull : value === 'AnyNull' ? Prisma.AnyNull : value);++export const ProjectOrderByRelevanceFieldEnumSchema = z.enum(['id','name','slug','logo','plan','stripeId','monitoringId']);++export const ProjectInviteOrderByRelevanceFieldEnumSchema = z.enum(['email','projectId']);++export const ProjectUsersOrderByRelevanceFieldEnumSchema = z.enum(['id','userId','projectId']);++export const SentEmailOrderByRelevanceFieldEnumSchema = z.enum(['id','type','projectId']);++export const DomainOrderByRelevanceFieldEnumSchema = z.enum(['id','slug','target','type','placeholder','description','projectId']);++export const LinkOrderByRelevanceFieldEnumSchema = z.enum(['id','domain','key','url','password','title','description','image','utm_source','utm_medium','utm_campaign','utm_term','utm_content','ios','android','userId','projectId','tagId','comments']);++export const TagOrderByRelevanceFieldEnumSchema = z.enum(['id','name','color','projectId']);++export const jackson_indexOrderByRelevanceFieldEnumSchema = z.enum(['key','storeKey']);++export const jackson_storeOrderByRelevanceFieldEnumSchema = z.enum(['key','value','iv','tag','namespace']);++export const jackson_ttlOrderByRelevanceFieldEnumSchema = z.enum(['key']);++export const RoleSchema = z.enum(['owner','member']);++export type RoleType = `${z.infer<typeof RoleSchema>}`++export const PlanSchema = z.enum(['free','pro','business','enterprise']);++export type PlanType = `${z.infer<typeof PlanSchema>}`/////////////////////////////////////////// MODELS@@ -409,9 +147,9 @@ export const UserSchema = z.object({emailVerified: z.coerce.date().nullable(),image: z.string().nullable(),createdAt: z.coerce.date(),-});+})-export type User = z.infer<typeof UserSchema>;+export type User = z.infer<typeof UserSchema>/////////////////////////////////////////// ACCOUNT SCHEMA@@ -431,9 +169,9 @@ export const AccountSchema = z.object({scope: z.string().nullable(),id_token: z.string().nullable(),session_state: z.string().nullable(),-});+})-export type Account = z.infer<typeof AccountSchema>;+export type Account = z.infer<typeof AccountSchema>/////////////////////////////////////////// SESSION SCHEMA@@ -444,9 +182,9 @@ export const SessionSchema = z.object({sessionToken: z.string(),userId: z.string(),expires: z.coerce.date(),-});+})-export type Session = z.infer<typeof SessionSchema>;+export type Session = z.infer<typeof SessionSchema>/////////////////////////////////////////// VERIFICATION TOKEN SCHEMA@@ -456,9 +194,9 @@ export const VerificationTokenSchema = z.object({identifier: z.string(),token: z.string(),expires: z.coerce.date(),-});+})-export type VerificationToken = z.infer<typeof VerificationTokenSchema>;+export type VerificationToken = z.infer<typeof VerificationTokenSchema>/////////////////////////////////////////// TOKEN SCHEMA@@ -474,9 +212,9 @@ export const TokenSchema = z.object({createdAt: z.coerce.date(),updatedAt: z.coerce.date(),userId: z.string(),-});+})-export type Token = z.infer<typeof TokenSchema>;+export type Token = z.infer<typeof TokenSchema>/////////////////////////////////////////// PROJECT SCHEMA@@ -501,9 +239,9 @@ export const ProjectSchema = z.object({createdAt: z.coerce.date(),updatedAt: z.coerce.date(),metadata: JsonValueSchema,-});+})-export type Project = z.infer<typeof ProjectSchema>;+export type Project = z.infer<typeof ProjectSchema>/////////////////////////////////////////// PROJECT INVITE SCHEMA@@ -514,9 +252,9 @@ export const ProjectInviteSchema = z.object({expires: z.coerce.date(),projectId: z.string(),createdAt: z.coerce.date(),-});+})-export type ProjectInvite = z.infer<typeof ProjectInviteSchema>;+export type ProjectInvite = z.infer<typeof ProjectInviteSchema>/////////////////////////////////////////// PROJECT USERS SCHEMA@@ -529,9 +267,9 @@ export const ProjectUsersSchema = z.object({updatedAt: z.coerce.date(),userId: z.string(),projectId: z.string(),-});+})-export type ProjectUsers = z.infer<typeof ProjectUsersSchema>;+export type ProjectUsers = z.infer<typeof ProjectUsersSchema>/////////////////////////////////////////// SENT EMAIL SCHEMA@@ -542,9 +280,9 @@ export const SentEmailSchema = z.object({type: z.string(),createdAt: z.coerce.date(),projectId: z.string().nullable(),-});+})-export type SentEmail = z.infer<typeof SentEmailSchema>;+export type SentEmail = z.infer<typeof SentEmailSchema>/////////////////////////////////////////// DOMAIN SCHEMA@@ -566,9 +304,9 @@ export const DomainSchema = z.object({lastChecked: z.coerce.date(),createdAt: z.coerce.date(),updatedAt: z.coerce.date(),-});+})-export type Domain = z.infer<typeof DomainSchema>;+export type Domain = z.infer<typeof DomainSchema>/////////////////////////////////////////// LINK SCHEMA@@ -605,9 +343,9 @@ export const LinkSchema = z.object({updatedAt: z.coerce.date(),tagId: z.string().nullable(),comments: z.string().nullable(),-});+})-export type Link = z.infer<typeof LinkSchema>;+export type Link = z.infer<typeof LinkSchema>/////////////////////////////////////////// TAG SCHEMA@@ -620,9 +358,9 @@ export const TagSchema = z.object({createdAt: z.coerce.date(),updatedAt: z.coerce.date(),projectId: z.string(),-});+})-export type Tag = z.infer<typeof TagSchema>;+export type Tag = z.infer<typeof TagSchema>/////////////////////////////////////////// JACKSON INDEX SCHEMA@@ -632,9 +370,9 @@ export const jackson_indexSchema = z.object({id: z.number().int(),key: z.string(),storeKey: z.string(),-});+})-export type jackson_index = z.infer<typeof jackson_indexSchema>;+export type jackson_index = z.infer<typeof jackson_indexSchema>/////////////////////////////////////////// JACKSON STORE SCHEMA@@ -648,9 +386,9 @@ export const jackson_storeSchema = z.object({namespace: z.string().nullable(),createdAt: z.coerce.date(),modifiedAt: z.coerce.date().nullable(),-});+})-export type jackson_store = z.infer<typeof jackson_storeSchema>;+export type jackson_store = z.infer<typeof jackson_storeSchema>/////////////////////////////////////////// JACKSON TTL SCHEMA@@ -659,6 +397,6 @@ export type jackson_store = z.infer<typeof jackson_storeSchema>;export const jackson_ttlSchema = z.object({key: z.string(),expiresAt: z.bigint(),-});+})-export type jackson_ttl = z.infer<typeof jackson_ttlSchema>;+export type jackson_ttl = z.infer<typeof jackson_ttlSchema>