pl-api: Improve defaults for InteractionPolicy schema

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-25 20:22:27 +02:00
parent 444f9126d2
commit 618f5f5f25

View file

@ -4,8 +4,10 @@ import { coerceObject } from './utils';
const interactionPolicyEntrySchema = v.picklist(['public', 'followers', 'following', 'mutuals', 'mentioned', 'author', 'me']);
type InteractionPolicyEntry = v.InferOutput<typeof interactionPolicyEntrySchema>;
const interactionPolicyRuleSchema = coerceObject({
always: v.fallback(v.array(interactionPolicyEntrySchema), ['public']),
always: v.fallback(v.array(interactionPolicyEntrySchema), ['public', 'me']),
with_approval: v.fallback(v.array(interactionPolicyEntrySchema), []),
});
@ -27,5 +29,5 @@ const interactionPoliciesSchema = coerceObject({
type InteractionPolicies = v.InferOutput<typeof interactionPoliciesSchema>;
export { interactionPolicySchema, interactionPoliciesSchema, type InteractionPolicy, type InteractionPolicies };
export { interactionPolicySchema, interactionPoliciesSchema, type InteractionPolicyEntry, type InteractionPolicy, type InteractionPolicies };