feat(id): brand PermissionID, PtyID, QuestionID, and ToolID (#17042)

This commit is contained in:
Kit Langton
2026-03-11 21:49:57 -04:00
committed by GitHub
parent b0bca6342e
commit 2a4dedc210
19 changed files with 127 additions and 52 deletions

View File

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