|
1 | 1 | import { Schema } from "effect" |
2 | 2 |
|
3 | 3 | import { Identifier } from "@/id/id" |
4 | | -import { zod, ZodOverride } from "@opencode-ai/core/effect-zod" |
| 4 | +import { zod } from "@opencode-ai/core/effect-zod" |
5 | 5 | import { withStatics } from "@opencode-ai/core/schema" |
6 | 6 |
|
7 | | -export const SessionID = Schema.String.check(Schema.isStartsWith("ses")) |
8 | | - .annotate({ |
9 | | - [ZodOverride]: Identifier.schema("session"), |
10 | | - }) |
11 | | - .pipe( |
12 | | - Schema.brand("SessionID"), |
13 | | - withStatics((s) => ({ |
14 | | - descending: (id?: string) => s.make(Identifier.descending("session", id)), |
15 | | - zod: zod(s), |
16 | | - })), |
17 | | - ) |
| 7 | +export const SessionID = Schema.String.check(Schema.isStartsWith("ses")).pipe( |
| 8 | + Schema.brand("SessionID"), |
| 9 | + withStatics((s) => ({ |
| 10 | + descending: (id?: string) => s.make(Identifier.descending("session", id)), |
| 11 | + zod: zod(s), |
| 12 | + })), |
| 13 | +) |
18 | 14 |
|
19 | 15 | export type SessionID = Schema.Schema.Type<typeof SessionID> |
20 | 16 |
|
21 | | -export const MessageID = Schema.String.check(Schema.isStartsWith("msg")) |
22 | | - .annotate({ |
23 | | - [ZodOverride]: Identifier.schema("message"), |
24 | | - }) |
25 | | - .pipe( |
26 | | - Schema.brand("MessageID"), |
27 | | - withStatics((s) => ({ |
28 | | - ascending: (id?: string) => s.make(Identifier.ascending("message", id)), |
29 | | - zod: zod(s), |
30 | | - })), |
31 | | - ) |
| 17 | +export const MessageID = Schema.String.check(Schema.isStartsWith("msg")).pipe( |
| 18 | + Schema.brand("MessageID"), |
| 19 | + withStatics((s) => ({ |
| 20 | + ascending: (id?: string) => s.make(Identifier.ascending("message", id)), |
| 21 | + zod: zod(s), |
| 22 | + })), |
| 23 | +) |
32 | 24 |
|
33 | 25 | export type MessageID = Schema.Schema.Type<typeof MessageID> |
34 | 26 |
|
35 | | -export const PartID = Schema.String.check(Schema.isStartsWith("prt")) |
36 | | - .annotate({ |
37 | | - [ZodOverride]: Identifier.schema("part"), |
38 | | - }) |
39 | | - .pipe( |
40 | | - Schema.brand("PartID"), |
41 | | - withStatics((s) => ({ |
42 | | - ascending: (id?: string) => s.make(Identifier.ascending("part", id)), |
43 | | - zod: zod(s), |
44 | | - })), |
45 | | - ) |
| 27 | +export const PartID = Schema.String.check(Schema.isStartsWith("prt")).pipe( |
| 28 | + Schema.brand("PartID"), |
| 29 | + withStatics((s) => ({ |
| 30 | + ascending: (id?: string) => s.make(Identifier.ascending("part", id)), |
| 31 | + zod: zod(s), |
| 32 | + })), |
| 33 | +) |
46 | 34 |
|
47 | 35 | export type PartID = Schema.Schema.Type<typeof PartID> |
0 commit comments