From 618f5f5f250806d97929c808959853c44bf1f451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 25 Oct 2024 20:22:27 +0200 Subject: [PATCH] pl-api: Improve defaults for InteractionPolicy schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-api/lib/entities/interaction-policy.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/pl-api/lib/entities/interaction-policy.ts b/packages/pl-api/lib/entities/interaction-policy.ts index d76b064e2..ace8b2fba 100644 --- a/packages/pl-api/lib/entities/interaction-policy.ts +++ b/packages/pl-api/lib/entities/interaction-policy.ts @@ -4,8 +4,10 @@ import { coerceObject } from './utils'; const interactionPolicyEntrySchema = v.picklist(['public', 'followers', 'following', 'mutuals', 'mentioned', 'author', 'me']); +type InteractionPolicyEntry = v.InferOutput; + 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; -export { interactionPolicySchema, interactionPoliciesSchema, type InteractionPolicy, type InteractionPolicies }; +export { interactionPolicySchema, interactionPoliciesSchema, type InteractionPolicyEntry, type InteractionPolicy, type InteractionPolicies };