mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-04 16:13:11 +00:00
feat(id): brand PermissionID, PtyID, QuestionID, and ToolID (#17042)
This commit is contained in:
@@ -4,7 +4,7 @@ import z from "zod"
|
||||
import { withStatics } from "@/util/schema"
|
||||
import { Identifier } from "@/id/id"
|
||||
|
||||
const workspaceIdSchema = Schema.String.pipe(Schema.brand("WorkspaceId"))
|
||||
const workspaceIdSchema = Schema.String.pipe(Schema.brand("WorkspaceID"))
|
||||
|
||||
export type WorkspaceID = typeof workspaceIdSchema.Type
|
||||
|
||||
@@ -12,6 +12,6 @@ export const WorkspaceID = workspaceIdSchema.pipe(
|
||||
withStatics((schema: typeof workspaceIdSchema) => ({
|
||||
make: (id: string) => schema.makeUnsafe(id),
|
||||
ascending: (id?: string) => schema.makeUnsafe(Identifier.ascending("workspace", id)),
|
||||
zod: z.string().startsWith("wrk").pipe(z.custom<WorkspaceID>()),
|
||||
zod: Identifier.schema("workspace").pipe(z.custom<WorkspaceID>()),
|
||||
})),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user