2026-03-12 01:49:57 +00:00
|
|
|
import { Schema } from "effect"
|
|
|
|
|
import z from "zod"
|
|
|
|
|
|
|
|
|
|
import { Identifier } from "@/id/id"
|
2026-04-15 21:28:01 +00:00
|
|
|
import { ZodOverride } from "@/util/effect-zod"
|
2026-03-12 01:49:57 +00:00
|
|
|
import { withStatics } from "@/util/schema"
|
|
|
|
|
|
2026-04-15 21:28:01 +00:00
|
|
|
const toolIdSchema = Schema.String.annotate({ [ZodOverride]: Identifier.schema("tool") }).pipe(Schema.brand("ToolID"))
|
2026-03-12 01:49:57 +00:00
|
|
|
|
|
|
|
|
export type ToolID = typeof toolIdSchema.Type
|
|
|
|
|
|
|
|
|
|
export const ToolID = toolIdSchema.pipe(
|
|
|
|
|
withStatics((schema: typeof toolIdSchema) => ({
|
2026-04-11 03:06:28 +00:00
|
|
|
ascending: (id?: string) => schema.make(Identifier.ascending("tool", id)),
|
2026-03-12 01:49:57 +00:00
|
|
|
zod: Identifier.schema("tool").pipe(z.custom<ToolID>()),
|
|
|
|
|
})),
|
|
|
|
|
)
|