2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-30 10:28:12 -07:00
|
|
|
|
2024-11-29 06:52:33 -08:00
|
|
|
/**
|
|
|
|
* @category Directory schemas
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
const directoryServerSchema = v.object({
|
|
|
|
domain: v.string(),
|
|
|
|
version: v.string(),
|
|
|
|
description: v.string(),
|
2024-10-14 13:50:34 -07:00
|
|
|
languages: v.array(v.string()),
|
2024-10-13 15:25:30 -07:00
|
|
|
region: v.string(),
|
2024-10-14 13:50:34 -07:00
|
|
|
categories: v.array(v.string()),
|
|
|
|
proxied_thumbnail: v.fallback(v.nullable(v.pipe(v.string(), v.url())), null),
|
2024-10-13 15:25:30 -07:00
|
|
|
blurhash: v.fallback(v.nullable(v.string()), null),
|
2024-10-14 13:50:34 -07:00
|
|
|
total_users: v.pipe(v.unknown(), v.transform(Number)),
|
|
|
|
last_week_users: v.pipe(v.unknown(), v.transform(Number)),
|
2024-10-13 15:25:30 -07:00
|
|
|
approval_required: v.boolean(),
|
|
|
|
language: v.string(),
|
|
|
|
category: v.string(),
|
2024-08-30 10:28:12 -07:00
|
|
|
});
|
|
|
|
|
2024-11-29 06:52:33 -08:00
|
|
|
/**
|
2024-11-29 07:01:54 -08:00
|
|
|
* @category Directory entity types
|
2024-11-29 06:52:33 -08:00
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
type DirectoryServer = v.InferOutput<typeof directoryServerSchema>;
|
2024-08-30 10:28:12 -07:00
|
|
|
|
|
|
|
export { directoryServerSchema, type DirectoryServer };
|