The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
LinkErrorSchema
Steven Tey6e0396b52cf5
diff --git a/apps/web/lib/openapi/links/bulk-create-links.ts b/apps/web/lib/openapi/links/bulk-create-links.tsindex d1fd2644a1..5cca41dcf8 100644--- a/apps/web/lib/openapi/links/bulk-create-links.ts+++ b/apps/web/lib/openapi/links/bulk-create-links.ts@@ -1,6 +1,10 @@import { openApiErrorResponses } from "@/lib/openapi/responses";import z from "@/lib/zod";-import { LinkSchema, createLinkBodySchema } from "@/lib/zod/schemas/links";+import {+ LinkErrorSchema,+ LinkSchema,+ createLinkBodySchema,+} from "@/lib/zod/schemas/links";import { ZodOpenApiOperationObject } from "zod-openapi";export const bulkCreateLinks: ZodOpenApiOperationObject = {@@ -20,7 +24,8 @@ export const bulkCreateLinks: ZodOpenApiOperationObject = {description: "The created links",content: {"application/json": {- schema: z.array(LinkSchema),+ // array can be LinkSchema or LinkErrorSchema+ schema: z.array(LinkSchema.or(LinkErrorSchema)),},},},diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.tsindex 0bad4f1620..7f0ba26558 100644--- a/apps/web/lib/zod/schemas/links.ts+++ b/apps/web/lib/zod/schemas/links.ts@@ -1,3 +1,4 @@+import { ErrorCode } from "@/lib/api/errors";import z from "@/lib/zod";import {COUNTRY_CODES,@@ -611,6 +612,14 @@ export const getLinkInfoQuerySchema = domainKeySchema.partial().merge(}),);+export const LinkErrorSchema = z.object({+ link: createLinkBodySchema+ .partial()+ .describe("The link that caused the error."),+ error: z.string().describe("The error message."),+ code: ErrorCode.describe("The error code."),+});+export const getLinksQuerySchemaExtended = getLinksQuerySchemaBase.merge(z.object({// Only Dub UI uses the following query parametersdiff --git a/apps/web/scripts/update-webhook-cache.ts b/apps/web/scripts/update-webhook-cache.tsindex 7a408a6fa2..690e554232 100644--- a/apps/web/scripts/update-webhook-cache.ts+++ b/apps/web/scripts/update-webhook-cache.ts@@ -1,6 +1,6 @@-import { webhookCache } from "@/lib/webhook/cache";import { prisma } from "@dub/prisma";import "dotenv-flow/config";+import { webhookCache } from "../lib/webhook/cache";async function main() {// Find link level webhooks