11import * as z from "zod/v4" ;
2+ import { OrgUniqueId } from "./generic.js" ;
23
34export type ShortLinkEntry = {
45 slug : string ;
56 access : string ;
67 redir ?: string ;
78} ;
89
9- export const LINKRY_MAX_SLUG_LENGTH = 1000 ;
10+ export const LINKRY_MAX_SLUG_LENGTH = 100 ;
1011
1112export const getRequest = z . object ( {
1213 slug : z . string ( ) . min ( 1 ) . max ( LINKRY_MAX_SLUG_LENGTH ) . optional ( )
@@ -19,7 +20,10 @@ export const linkryAccessList = z.array(z.string().min(1)).meta({
1920
2021
2122export const createRequest = z . object ( {
22- slug : linkrySlug ,
23+ slug : linkrySlug . refine ( ( url ) => ! url . includes ( '#' ) , {
24+ message : "Slug must not contain a hashtag"
25+ } ) ,
26+ orgId : z . optional ( OrgUniqueId ) ,
2327 access : linkryAccessList ,
2428 redirect : z . url ( ) . min ( 1 ) . meta ( { description : "Full URL to redirect to when the short URL is visited." , example : "https://google.com" } )
2529} ) ;
@@ -33,14 +37,8 @@ export const linkRecord = z.object({
3337 owner : z . string ( ) . min ( 1 )
3438} ) ;
3539
36- export const delegatedLinkRecord = linkRecord . extend ( {
37- owner : z . string ( ) . min ( 1 )
38- } ) ;
39-
4040export type LinkRecord = z . infer < typeof linkRecord > ;
4141
42- export type DelegatedLinkRecord = z . infer < typeof delegatedLinkRecord > ;
43-
4442export const getLinksResponse = z . object ( {
4543 ownedLinks : z . array ( linkRecord ) ,
4644 delegatedLinks : z . array ( linkRecord )
0 commit comments