/* * Typings for the plugin configuration schema * The schema is used to validate the configuration file * * If you want to learn about plugin.yaml, see the documentation: * https://docs.partner.ones.cn/docs/api/config/plugin */ import type { MODULE_TYPE } from '@ones-open/utils' import type { PluginType } from '../../enums/plugin-types' type ModuleTypeKey = keyof typeof MODULE_TYPE type ModuleTypeInfo = (typeof MODULE_TYPE)[ModuleTypeKey] interface ProjectPluginConfigServiceField { app_id: string version: string name: string description: string language: string language_version: string host_version: string host_sub_version: string min_system_version: string config: null | ProjectPluginConfigServiceConfig[] scope: PluginType } interface ProjectPluginConfigServiceConfig { key: string value: string type: number required: boolean } interface RelateModule { [k: string]: string } interface ProjectPluginConfigAbilitiesField { id: string version: string name: string templateName?: string abilityType: string relateModule?: RelateModule function: Record config: null | Array<{ key: string; value: string; [k: string]: string }> } interface ProjectPluginConfigApisField { type: string methods: string[] url: string function: string scope?: string } interface ProjectPluginConfigModulesField { id: string moduleType: ModuleTypeKey title: string description: string icon: string link?: string entry?: string disabled: boolean manual: boolean preload: boolean displayConditions?: { teamSize?: Array<'single' | 'multiple'> plan?: Array<'free' | 'team' | 'enterprise'> } modules?: ProjectPluginConfigSubModulesField[] enableMemoryRouter?: boolean actions?: Array } type ProjectPluginConfigSubModulesField = { id: string title: string } & Partial interface SubscribeEvent { eventType: string function: string } interface ProjectPluginConfig { service: ProjectPluginConfigServiceField abilities?: ProjectPluginConfigAbilitiesField[] apis?: ProjectPluginConfigApisField[] modules?: ProjectPluginConfigModulesField[] events?: SubscribeEvent[] } export type { ModuleTypeKey, ModuleTypeInfo, ProjectPluginConfig, ProjectPluginConfigServiceField, ProjectPluginConfigAbilitiesField, ProjectPluginConfigApisField, ProjectPluginConfigModulesField, ProjectPluginConfigSubModulesField, RelateModule, }