feat(id): brand WorkspaceID through Drizzle and Zod schemas (#16964)

This commit is contained in:
Kit Langton
2026-03-11 19:30:17 -04:00
committed by GitHub
parent f1c3a44190
commit 16a6d6feba
49 changed files with 205 additions and 157 deletions

View File

@@ -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>()),
})),
)