import * as v from 'valibot'; const baseRuleSchema = v.object({ id: v.string(), text: v.fallback(v.string(), ''), hint: v.fallback(v.string(), ''), }); /** * @category Schemas * @see {@link https://docs.joinmastodon.org/entities/Rule/} */ const ruleSchema = v.pipe( v.any(), v.transform((data: any) => ({ ...data, hint: data.hint || data.subtext, })), baseRuleSchema, ); /** * @category Entity types */ type Rule = v.InferOutput; export { ruleSchema, type Rule };