diff options
| author | Volpeon <git@volpeon.ink> | 2026-07-22 19:40:59 +0200 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2026-07-22 19:40:59 +0200 |
| commit | c1e28224aa2e1450031669d9a7e359b63e04687d (patch) | |
| tree | 68f3d8905c763a91f68001d868197effa92adafa /src/schemas | |
| download | corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.gz corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.bz2 corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.zip | |
Init
Diffstat (limited to 'src/schemas')
| -rw-r--r-- | src/schemas/misc.ts | 16 | ||||
| -rw-r--r-- | src/schemas/mod.ts | 8 | ||||
| -rw-r--r-- | src/schemas/releases.ts | 18 |
3 files changed, 42 insertions, 0 deletions
diff --git a/src/schemas/misc.ts b/src/schemas/misc.ts new file mode 100644 index 0000000..e86df72 --- /dev/null +++ b/src/schemas/misc.ts | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | import { type } from "arktype"; | ||
| 2 | |||
| 3 | export const miscSchema = type.or( | ||
| 4 | { | ||
| 5 | type: "'home'", | ||
| 6 | title: "string", | ||
| 7 | description: "string", | ||
| 8 | }, | ||
| 9 | { | ||
| 10 | type: "'releases-index'", | ||
| 11 | title: "string", | ||
| 12 | description: "string", | ||
| 13 | }, | ||
| 14 | ); | ||
| 15 | |||
| 16 | export type Misc = typeof miscSchema.infer; | ||
diff --git a/src/schemas/mod.ts b/src/schemas/mod.ts new file mode 100644 index 0000000..69d6c6f --- /dev/null +++ b/src/schemas/mod.ts | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | import { type } from "arktype"; | ||
| 2 | |||
| 3 | import { miscSchema } from "$/schemas/misc.ts"; | ||
| 4 | import { releaseSchema } from "$/schemas/releases.ts"; | ||
| 5 | |||
| 6 | export const pageDataSchema = type.or(releaseSchema, miscSchema); | ||
| 7 | |||
| 8 | export type PageData = typeof pageDataSchema.infer; | ||
diff --git a/src/schemas/releases.ts b/src/schemas/releases.ts new file mode 100644 index 0000000..0ccb6a6 --- /dev/null +++ b/src/schemas/releases.ts | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | import { type } from "arktype"; | ||
| 2 | |||
| 3 | import { nodeSchema } from "../deps/strapi.tsx"; | ||
| 4 | import { strapiLoader } from "../deps/strapi.tsx"; | ||
| 5 | |||
| 6 | export const releaseStrapiSchema = type({ | ||
| 7 | "version": "string", | ||
| 8 | "date": "string.date.parse", | ||
| 9 | "notes?": nodeSchema.array().or("null"), | ||
| 10 | "files": strapiLoader.resolvedFileAttributeSchema, | ||
| 11 | }); | ||
| 12 | |||
| 13 | export const releaseSchema = releaseStrapiSchema.merge({ | ||
| 14 | type: "'release'", | ||
| 15 | title: "string", | ||
| 16 | }); | ||
| 17 | |||
| 18 | export type Release = typeof releaseSchema.infer; | ||
