mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-05 08:33:10 +00:00
feat(id): brand PartID through Drizzle and Zod schemas (#16966)
This commit is contained in:
@@ -27,3 +27,15 @@ export const MessageID = messageIdSchema.pipe(
|
||||
zod: z.string().startsWith("msg").pipe(z.custom<MessageID>()),
|
||||
})),
|
||||
)
|
||||
|
||||
const partIdSchema = Schema.String.pipe(Schema.brand("PartId"))
|
||||
|
||||
export type PartID = typeof partIdSchema.Type
|
||||
|
||||
export const PartID = partIdSchema.pipe(
|
||||
withStatics((schema: typeof partIdSchema) => ({
|
||||
make: (id: string) => schema.makeUnsafe(id),
|
||||
ascending: (id?: string) => schema.makeUnsafe(Identifier.ascending("part", id)),
|
||||
zod: z.string().startsWith("prt").pipe(z.custom<PartID>()),
|
||||
})),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user