2026-03-11 23:16:56 +00:00
|
|
|
import { Schema } from "effect"
|
|
|
|
|
|
|
|
|
|
import { Identifier } from "@/id/id"
|
2026-04-22 02:51:18 +00:00
|
|
|
import { zod, ZodOverride } from "@/util/effect-zod"
|
2026-03-14 16:14:46 +00:00
|
|
|
import { withStatics } from "@/util/schema"
|
2026-03-11 23:16:56 +00:00
|
|
|
|
2026-04-15 21:28:01 +00:00
|
|
|
export const SessionID = Schema.String.annotate({ [ZodOverride]: Identifier.schema("session") }).pipe(
|
2026-03-14 16:14:46 +00:00
|
|
|
Schema.brand("SessionID"),
|
|
|
|
|
withStatics((s) => ({
|
2026-04-11 03:06:28 +00:00
|
|
|
descending: (id?: string) => s.make(Identifier.descending("session", id)),
|
2026-04-22 02:51:18 +00:00
|
|
|
zod: zod(s),
|
2026-03-11 23:16:56 +00:00
|
|
|
})),
|
|
|
|
|
)
|
2026-03-11 23:30:17 +00:00
|
|
|
|
2026-03-14 16:14:46 +00:00
|
|
|
export type SessionID = Schema.Schema.Type<typeof SessionID>
|
2026-03-11 23:30:17 +00:00
|
|
|
|
2026-04-15 21:28:01 +00:00
|
|
|
export const MessageID = Schema.String.annotate({ [ZodOverride]: Identifier.schema("message") }).pipe(
|
2026-03-14 16:14:46 +00:00
|
|
|
Schema.brand("MessageID"),
|
|
|
|
|
withStatics((s) => ({
|
2026-04-11 03:06:28 +00:00
|
|
|
ascending: (id?: string) => s.make(Identifier.ascending("message", id)),
|
2026-04-22 02:51:18 +00:00
|
|
|
zod: zod(s),
|
2026-03-11 23:30:17 +00:00
|
|
|
})),
|
|
|
|
|
)
|
2026-03-11 23:40:50 +00:00
|
|
|
|
2026-03-14 16:14:46 +00:00
|
|
|
export type MessageID = Schema.Schema.Type<typeof MessageID>
|
2026-03-11 23:40:50 +00:00
|
|
|
|
2026-04-15 21:28:01 +00:00
|
|
|
export const PartID = Schema.String.annotate({ [ZodOverride]: Identifier.schema("part") }).pipe(
|
2026-03-14 16:14:46 +00:00
|
|
|
Schema.brand("PartID"),
|
|
|
|
|
withStatics((s) => ({
|
2026-04-11 03:06:28 +00:00
|
|
|
ascending: (id?: string) => s.make(Identifier.ascending("part", id)),
|
2026-04-22 02:51:18 +00:00
|
|
|
zod: zod(s),
|
2026-03-11 23:40:50 +00:00
|
|
|
})),
|
|
|
|
|
)
|
2026-03-14 16:14:46 +00:00
|
|
|
|
|
|
|
|
export type PartID = Schema.Schema.Type<typeof PartID>
|