From 7990b6de6457ab746b71dd4eb7e0f2de094eb580 Mon Sep 17 00:00:00 2001 From: abdou6666 Date: Thu, 27 Mar 2025 14:50:12 +0100 Subject: [PATCH] fix: plugin setting --- api/src/plugins/types.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/api/src/plugins/types.ts b/api/src/plugins/types.ts index d296de6d..87b69eef 100644 --- a/api/src/plugins/types.ts +++ b/api/src/plugins/types.ts @@ -11,6 +11,7 @@ import { BlockCreateDto } from '@/chat/dto/block.dto'; import { Block } from '@/chat/schemas/block.schema'; import { Conversation } from '@/chat/schemas/conversation.schema'; import { SettingCreateDto } from '@/setting/dto/setting.dto'; +import { SettingType } from '@/setting/schemas/types'; export type PluginName = `${string}-plugin`; @@ -23,7 +24,21 @@ export interface CustomBlocks {} type BlockAttrs = Partial & { name: string }; -export type PluginSetting = Omit; +type EnforceTranslatable = T extends + | 'text' + | 'multiple_text' + ? { translatable: boolean } + : { translatable: boolean }; + +export type SettingCreateDtoStrict< + T extends SettingType, + S extends SettingCreateDto, +> = S & EnforceTranslatable; + +export type PluginSetting = Omit< + SettingCreateDtoStrict, + 'weight' +>; export type PluginBlockTemplate = Omit< BlockAttrs,