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.

Format

Kiran K83ffd2e7a762
diff --git a/apps/web/app/api/links/[linkId]/route.ts b/apps/web/app/api/links/[linkId]/route.ts
index 9a67df7c4d..5fccfa82c9 100644
--- a/apps/web/app/api/links/[linkId]/route.ts
+++ b/apps/web/app/api/links/[linkId]/route.ts
@@ -1,7 +1,11 @@
import { deleteLink, editLink, processLink } from "@/lib/api/links";
import { withAuth } from "@/lib/auth";
import { qstash } from "@/lib/cron";
-import { DubApiError, ErrorCodes, handleAndReturnErrorResponse } from "@/lib/errors";
+import {
+ DubApiError,
+ ErrorCodes,
+ handleAndReturnErrorResponse,
+} from "@/lib/errors";
import { LinkProps } from "@/lib/types";
import { createLinkBodySchema } from "@/lib/zod/schemas/links";
import { APP_DOMAIN_WITH_NGROK } from "@dub/utils";
diff --git a/apps/web/app/api/links/bulk/route.ts b/apps/web/app/api/links/bulk/route.ts
index 7bf65b9b8e..a3d7db5d29 100644
--- a/apps/web/app/api/links/bulk/route.ts
+++ b/apps/web/app/api/links/bulk/route.ts
@@ -52,7 +52,7 @@ export const POST = withAuth(
.map(({ link, error, code }) => ({
link,
error,
- code
+ code,
}));
const validLinksResponse =
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index 30fad8bd0c..a06021f820 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -178,131 +178,140 @@ export const getLinksCountParamsSchema = z.object({
groupBy: z.union([z.literal("domain"), z.literal("tagId")]).optional(),
});
-export const LinkSchema = z.object({
- id: z.string().describe("The unique ID of the short link."),
- domain: z
- .string()
- .describe(
- "The domain of the short link. If not provided, the primary domain for the project will be used (or `dub.sh` if the project has no domains).",
- ),
- key: z
- .string()
- .describe(
- "The short link slug. If not provided, a random 7-character slug will be generated.",
- ),
- url: z.string().url().describe("The destination URL of the short link."),
- archived: z
- .boolean()
- .default(false)
- .describe("Whether the short link is archived."),
- expiresAt: z
- .string()
- .nullable()
- .describe(
- "The date and time when the short link will expire in ISO-8601 format. Must be in the future.",
- ),
- password: z
- .string()
- .nullable()
- .describe(
- "The password required to access the destination URL of the short link.",
- ),
- proxy: z
- .boolean()
- .default(false)
- .describe("Whether the short link uses Custom Social Media Cards feature."),
- title: z
- .string()
- .nullable()
- .describe(
- "The title of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.",
- ),
- description: z
- .string()
- .nullable()
- .describe(
- "The description of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.",
- ),
- image: z
- .string()
- .nullable()
- .describe(
- "The image of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.",
- ),
- rewrite: z
- .boolean()
- .default(false)
- .describe("Whether the short link uses link cloaking."),
- ios: z
- .string()
- .nullable()
- .describe(
- "The iOS destination URL for the short link for iOS device targeting.",
- ),
- android: z
- .string()
- .nullable()
- .describe(
- "The Android destination URL for the short link for Android device targeting.",
- ),
- geo: z
- .record(z.string())
- .nullable()
- .describe(
- "Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. Learn more: https://dub.sh/geo",
- ),
- publicStats: z
- .boolean()
- .default(false)
- .describe("Whether the short link's stats are publicly accessible."),
- tagId: z
- .string()
- .nullable()
- .describe("The unique id of the tag assigned to the short link."),
- comments: z.string().nullable().describe("The comments for the short link."),
- shortLink: z
- .string()
- .url()
- .describe(
- "The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`).",
- ),
- qrCode: z
- .string()
- .url()
- .describe(
- "The full URL of the QR code for the short link (e.g. `https://api.dub.co/qr?url=https://dub.sh/try`).",
- ),
- utm_source: z
- .string()
- .nullable()
- .describe("The UTM source of the short link."),
- utm_medium: z
- .string()
- .nullable()
- .describe("The UTM medium of the short link."),
- utm_campaign: z
- .string()
- .nullable()
- .describe("The UTM campaign of the short link."),
- utm_term: z.string().nullable().describe("The UTM term of the short link."),
- utm_content: z
- .string()
- .nullable()
- .describe("The UTM content of the short link."),
- userId: z.string().describe("The user ID of the creator of the short link."),
- projectId: z.string().describe("The project ID of the short link."),
- clicks: z
- .number()
- .default(0)
- .describe("The number of clicks on the short link."),
- lastClicked: z
- .string()
- .nullable()
- .describe("The date and time when the short link was last clicked."),
- createdAt: z
- .string()
- .describe("The date and time when the short link was created."),
- updatedAt: z
- .string()
- .describe("The date and time when the short link was last updated."),
-}).openapi({ title: "Link" });
+export const LinkSchema = z
+ .object({
+ id: z.string().describe("The unique ID of the short link."),
+ domain: z
+ .string()
+ .describe(
+ "The domain of the short link. If not provided, the primary domain for the project will be used (or `dub.sh` if the project has no domains).",
+ ),
+ key: z
+ .string()
+ .describe(
+ "The short link slug. If not provided, a random 7-character slug will be generated.",
+ ),
+ url: z.string().url().describe("The destination URL of the short link."),
+ archived: z
+ .boolean()
+ .default(false)
+ .describe("Whether the short link is archived."),
+ expiresAt: z
+ .string()
+ .nullable()
+ .describe(
+ "The date and time when the short link will expire in ISO-8601 format. Must be in the future.",
+ ),
+ password: z
+ .string()
+ .nullable()
+ .describe(
+ "The password required to access the destination URL of the short link.",
+ ),
+ proxy: z
+ .boolean()
+ .default(false)
+ .describe(
+ "Whether the short link uses Custom Social Media Cards feature.",
+ ),
+ title: z
+ .string()
+ .nullable()
+ .describe(
+ "The title of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.",
+ ),
+ description: z
+ .string()
+ .nullable()
+ .describe(
+ "The description of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.",
+ ),
+ image: z
+ .string()
+ .nullable()
+ .describe(
+ "The image of the short link generated via `api.dub.co/metatags`. Will be used for Custom Social Media Cards if `proxy` is true.",
+ ),
+ rewrite: z
+ .boolean()
+ .default(false)
+ .describe("Whether the short link uses link cloaking."),
+ ios: z
+ .string()
+ .nullable()
+ .describe(
+ "The iOS destination URL for the short link for iOS device targeting.",
+ ),
+ android: z
+ .string()
+ .nullable()
+ .describe(
+ "The Android destination URL for the short link for Android device targeting.",
+ ),
+ geo: z
+ .record(z.string())
+ .nullable()
+ .describe(
+ "Geo targeting information for the short link in JSON format `{[COUNTRY]: https://example.com }`. Learn more: https://dub.sh/geo",
+ ),
+ publicStats: z
+ .boolean()
+ .default(false)
+ .describe("Whether the short link's stats are publicly accessible."),
+ tagId: z
+ .string()
+ .nullable()
+ .describe("The unique id of the tag assigned to the short link."),
+ comments: z
+ .string()
+ .nullable()
+ .describe("The comments for the short link."),
+ shortLink: z
+ .string()
+ .url()
+ .describe(
+ "The full URL of the short link, including the https protocol (e.g. `https://dub.sh/try`).",
+ ),
+ qrCode: z
+ .string()
+ .url()
+ .describe(
+ "The full URL of the QR code for the short link (e.g. `https://api.dub.co/qr?url=https://dub.sh/try`).",
+ ),
+ utm_source: z
+ .string()
+ .nullable()
+ .describe("The UTM source of the short link."),
+ utm_medium: z
+ .string()
+ .nullable()
+ .describe("The UTM medium of the short link."),
+ utm_campaign: z
+ .string()
+ .nullable()
+ .describe("The UTM campaign of the short link."),
+ utm_term: z.string().nullable().describe("The UTM term of the short link."),
+ utm_content: z
+ .string()
+ .nullable()
+ .describe("The UTM content of the short link."),
+ userId: z
+ .string()
+ .describe("The user ID of the creator of the short link."),
+ projectId: z.string().describe("The project ID of the short link."),
+ clicks: z
+ .number()
+ .default(0)
+ .describe("The number of clicks on the short link."),
+ lastClicked: z
+ .string()
+ .nullable()
+ .describe("The date and time when the short link was last clicked."),
+ createdAt: z
+ .string()
+ .describe("The date and time when the short link was created."),
+ updatedAt: z
+ .string()
+ .describe("The date and time when the short link was last updated."),
+ })
+ .openapi({ title: "Link" });
diff --git a/packages/ui/src/input-select.tsx b/packages/ui/src/input-select.tsx
index 4fd00b1e3b..31ffa7c33f 100644
--- a/packages/ui/src/input-select.tsx
+++ b/packages/ui/src/input-select.tsx
@@ -1,5 +1,6 @@
"use client";
import { Command, useCommandState } from "cmdk";
+import { Check, ChevronDown, Search, X } from "lucide-react";
import {
Dispatch,
InputHTMLAttributes,
@@ -9,7 +10,6 @@ import {
useRef,
useState,
} from "react";
-import { Check, ChevronDown, Search, X } from "lucide-react";
export interface InputSelectItemProps {
id: string;