Suite of AT Protocol TypeScript libraries built on web standards
21
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 40 lines 1.1 kB view raw
1import { ArraySchema } from "./array.ts"; 2import { BooleanSchema } from "./boolean.ts"; 3import { DictSchema } from "./dict.ts"; 4import { IntegerSchema } from "./integer.ts"; 5import { StringSchema } from "./string.ts"; 6import { UnionSchema } from "./union.ts"; 7import type { Infer, Validator } from "../validation.ts"; 8 9export type ParamScalar = Infer<typeof paramScalarSchema>; 10const paramScalarSchema: UnionSchema< 11 readonly [ 12 BooleanSchema, 13 IntegerSchema, 14 StringSchema<NonNullable<unknown>>, 15 ] 16> = new UnionSchema([ 17 new BooleanSchema({}), 18 new IntegerSchema({}), 19 new StringSchema({}), 20]); 21 22export type Param = Infer<typeof paramSchema>; 23export const paramSchema: UnionSchema< 24 readonly [ 25 typeof paramScalarSchema, 26 ArraySchema<typeof paramScalarSchema>, 27 ] 28> = new UnionSchema([ 29 paramScalarSchema, 30 new ArraySchema(paramScalarSchema, {}), 31]); 32 33export type Params = { [_: string]: undefined | Param }; 34export const paramsSchema: DictSchema< 35 StringSchema<NonNullable<unknown>>, 36 typeof paramSchema 37> = new DictSchema( 38 new StringSchema({}), 39 paramSchema, 40) satisfies Validator<Params>;