mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-05 16:36:52 +00:00
feat(id): brand WorkspaceID through Drizzle and Zod schemas (#16964)
This commit is contained in:
@@ -15,3 +15,15 @@ export const SessionID = sessionIdSchema.pipe(
|
||||
zod: z.string().startsWith("ses").pipe(z.custom<SessionID>()),
|
||||
})),
|
||||
)
|
||||
|
||||
const messageIdSchema = Schema.String.pipe(Schema.brand("MessageId"))
|
||||
|
||||
export type MessageID = typeof messageIdSchema.Type
|
||||
|
||||
export const MessageID = messageIdSchema.pipe(
|
||||
withStatics((schema: typeof messageIdSchema) => ({
|
||||
make: (id: string) => schema.makeUnsafe(id),
|
||||
ascending: (id?: string) => schema.makeUnsafe(Identifier.ascending("message", id)),
|
||||
zod: z.string().startsWith("msg").pipe(z.custom<MessageID>()),
|
||||
})),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user