|
1 | 1 | export * as ConfigFormatter from "./formatter" |
2 | 2 |
|
3 | | -import z from "zod" |
| 3 | +import { Schema } from "effect" |
| 4 | +import { zod } from "@/util/effect-zod" |
| 5 | +import { withStatics } from "@/util/schema" |
4 | 6 |
|
5 | | -export const Entry = z.object({ |
6 | | - disabled: z.boolean().optional(), |
7 | | - command: z.array(z.string()).optional(), |
8 | | - environment: z.record(z.string(), z.string()).optional(), |
9 | | - extensions: z.array(z.string()).optional(), |
10 | | -}) |
| 7 | +export const Entry = Schema.Struct({ |
| 8 | + disabled: Schema.optional(Schema.Boolean), |
| 9 | + command: Schema.optional(Schema.mutable(Schema.Array(Schema.String))), |
| 10 | + environment: Schema.optional(Schema.Record(Schema.String, Schema.String)), |
| 11 | + extensions: Schema.optional(Schema.mutable(Schema.Array(Schema.String))), |
| 12 | +}).pipe(withStatics((s) => ({ zod: zod(s) }))) |
11 | 13 |
|
12 | | -export const Info = z.union([z.boolean(), z.record(z.string(), Entry)]) |
13 | | -export type Info = z.infer<typeof Info> |
| 14 | +export const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)]).pipe( |
| 15 | + withStatics((s) => ({ zod: zod(s) })), |
| 16 | +) |
| 17 | +export type Info = Schema.Schema.Type<typeof Info> |
0 commit comments