fix(apps/web): removed deprecated zod params.
Close #2546
import * as z from "zod";
const baz = z
.object({
a: z.string(),
});
const foo = z
.object({
b: z.string(),
})
.merge(baz);
const bar = foo
// Try to comment this out and see the type of y
.omit({ s: true })
.extend({
c: z.string(),
})
const x: Record<string, string> = {}
// check the type of y here
const y = bar.parse(x);
Summary by CodeRabbit
-
New Features
- Events reports: sorting and pagination are now supported in event filters and queries.
- Partner profile queries can now accept workspace selection for analytics and event requests.
- Bulk link updates may now include link IDs; partner creation accepts project IDs in link properties.
-
Bug Fixes
- General analytics filters no longer expose an unsupported sort option.
- Payout count responses may include aggregated counts; exclusion of the current month was removed.
@zhyd1997 is attempting to deploy a commit to the Dub Team on Vercel.
A member of the Team first needs to authorize it.
Walkthrough
Updated multiple Zod schemas across analytics, partner-profile, links, partners, payouts and analytics types: several fields were removed from omit/pick lists or reintroduced, altering public shapes for analytics filters/queries, partner-profile queries, link bulk updates, partner creation linkProps, payouts query/response, and partner events types.
Changes
| Cohort / File(s) | Summary |
|---|---|
Analytics Zod Schemasapps/web/lib/zod/schemas/analytics.ts |
Removed sortBy from analyticsFilterTB pick; changed eventsFilterTB .omit to only exclude granularity and timezone (now permits page and sortBy); changed eventsQuerySchema .omit to exclude only groupBy (keeps sortBy). |
Partner-profile Zod Schemasapps/web/lib/zod/schemas/partner-profile.ts |
Removed workspaceId from the .omit lists in partnerProfileAnalyticsQuerySchema and partnerProfileEventsQuerySchema, allowing workspaceId in those query inputs. |
Analytics typesapps/web/lib/analytics/types.ts |
Removed groupBy from partnerEventsSchema.pick, dropping groupBy from the inferred PartnerEventsFilters type. |
Links Zod Schemaapps/web/lib/zod/schemas/links.ts |
bulkUpdateLinksBodySchema no longer omits id in the data payload (id may now be present). |
Partners Zod Schemaapps/web/lib/zod/schemas/partners.ts |
In createPartnerSchema, linkProps omit list no longer excludes projectId, allowing projectId in linkProps. |
Payouts Zod Schemaapps/web/lib/zod/schemas/payouts.ts |
Removed excludeCurrentMonth from payoutsCountQuerySchema pick; removed _count from omit list in PartnerPayoutResponseSchema, allowing _count in responses. |
API route TS checksapps/web/app/api/analytics/route.ts, apps/web/app/api/resend/webhook/route.ts |
Added // @ts-expect-error comments to suppress TypeScript/Zod type-check issues at specific lines; no runtime logic changes. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
Fix build error by ensuring parsed params include domain for events export route (#2546) |
❌ | This PR does not add or expose domain on the schemas used by the export route; change set focuses on other fields. |
Align analytics/events query schemas with route expectations for domain/interval/start/end/columns/key/folderId (#2546) |
❓ | PR modifies sortBy/page/workspaceId omissions only; whether the export route's specific schema now includes domain etc. cannot be confirmed from these edits alone. |
Assessment against linked issues: Out-of-scope changes
| Code Change | Explanation |
|---|---|
Removed sortBy from analyticsFilterTB (apps/web/lib/zod/schemas/analytics.ts) |
Linked issue requires domain in export route params; this change concerns sorting fields, unrelated to domain. |
Allowed id in bulk update payload (apps/web/lib/zod/schemas/links.ts) |
Change affects link bulk-update shape, not the build error or export route schema referenced in the issue. |
Reintroduced workspaceId in partner-profile queries (apps/web/lib/zod/schemas/partner-profile.ts) |
Enables workspaceId for partner-profile queries; unrelated to the domain parsing/build-failure objective. |
Possibly related PRs
- dubinc/dub#2539 — Modifies
sortByhandling in analytics Zod schemas; directly overlaps with analytics schema edits here. - dubinc/dub#2648 — Also changes analytics query/filter schema fields (page/sortBy/groupBy) and likely touches same validations.
- dubinc/dub#2725 — Adjusts
analyticsQuerySchemafields (e.g., linkIds/sortBy) and may conflict or interact with these changes.
Suggested reviewers
- steven-tey
Poem
I twitch my ears at schemas’ tune,
SortBy hops out, page hops in soon.
WorkspaceId peeks from its den,
IDs return and fields align again.
Hop on—let types and builds befriend! 🐇✨
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.