UNPKG

@lark-project/cli

Version:

飞书项目插件开发工具

283 lines (282 loc) 8.26 kB
export type PlatformKey = 'web' | 'mobile'; export type I18nInfoMap = Record<string, { name?: string; description?: string; }>; export type PlatformResourceInfo = { /** api_app_common.AppIntegratePointResourceInfo.Resource */ resource?: string; /** api_app_common.AppIntegratePointResourceInfo.Scene */ scene?: number[]; /** api_app_common.AppIntegratePointResourceInfo.Type */ type?: string; /** schema 中存在的其它端侧字段(会被转换进 extension 或忽略) */ [key: string]: unknown; }; export type PlatformConfig = Partial<Record<PlatformKey, PlatformResourceInfo>>; export type PointEventConfigInput = { work_item_type?: string[]; event_type?: number[]; custom_work_item_type?: string[]; }; export type PagePointInput = { key: string; icon: string; name: string; description?: string; i18n_info?: I18nInfoMap; platform?: PlatformConfig; }; export type ViewPointInput = { key: string; icon: string; name: string; description?: string; i18n_info?: I18nInfoMap; work_item_type?: string[]; platform?: PlatformConfig; }; export type DashboardPointInput = { key: string; name: string; description?: string; i18n_info?: I18nInfoMap; work_item_type?: string[]; custom_work_item_type?: string[]; platform?: PlatformConfig; }; export type ConfigurationPointInput = { key: string; platform?: PlatformConfig; }; export type ControlPointInput = { key: string; name?: string; description?: string; i18n_info?: I18nInfoMap; work_item_type?: string[]; url?: string; token?: string; platform?: PlatformConfig & { web?: PlatformResourceInfo & { /** * 表格列 DSL:可填裸 template(含顶层 `type`)或完整 { definitions, template } * CLI 会自动包装/补齐 definitions 三键。兼容老版本的 JSON 字符串形式。 */ table_cell?: Record<string, unknown> | string; table_url?: { url?: string; token?: string; }; }; mobile?: PlatformResourceInfo & { mobile_block_style?: string; }; }; }; export type ButtonPointInput = { key: string; name?: string; description?: string; i18n_info?: I18nInfoMap; work_item_type?: string[]; custom_work_item_type?: string[]; platform?: PlatformConfig & { web?: PlatformResourceInfo & { mode?: 'ui' | 'script'; init_size?: { width: number; height: number; width_type: 'static' | 'dynamic'; height_type: 'static' | 'dynamic'; }; }; }; }; export type InterceptPointInput = { key: string; type?: 'intercept'; name: string; description?: string; i18n_info?: I18nInfoMap; url: string; token: string; event_config: PointEventConfigInput[]; platform?: PlatformConfig; }; export type ListenEventPointInput = { /** schema 里未强制,但后端 point_info_map 仍需要 key,故这里允许 */ key?: string; type?: 'listen_event'; url: string; token: string; event_config: PointEventConfigInput[]; }; export type ComponentSchedulePointInput = { key: string; component_type: 'schedule'; work_item_type?: string[]; platform?: { web?: PlatformResourceInfo; }; }; export type SubFieldI18nInfo = Record<string, { name: string; desc?: string; }>; export type CustomFieldSubFieldInput = { name?: string; desc?: string; i18n_info: SubFieldI18nInfo; field_type: string; field_key: string; options?: unknown[]; }; export type CustomFieldPointInput = { key: string; /** schema 中是单对象;后端则是多语言 map,这里保持 schema 形态 */ i18n_info: { name: string; description: string; }; subfield: CustomFieldSubFieldInput[]; platform: { web: { resource: string; need_extra_config?: boolean; table_layout: unknown; table_data_url?: string; table_data_token?: string; }; mobile: { resource: string; mobile_block_style: string; }; }; }; export type LiteAppComponentPropertyInput = { name: { zh?: string; en?: string; ja?: string; }; prop_type: string; prop_key: string; with_field?: boolean; options?: { label: string; translation: { zh: string; en: string; ja: string; }; }[]; }; export type LiteAppComponentPointInput = { key: string; i18n_info: Record<string, { name: string; description: string; }>; /** @deprecated 已废弃,上传时被忽略;后端统一使用插件级 icon。pull 回写保留仅为向后兼容。 */ icon_url?: string; properties: LiteAppComponentPropertyInput[]; outputs?: LiteAppComponentPropertyInput[]; platform: { web: { resource: string; layout: { mode: 0 | 1; staticHeight?: number; staticWidth?: number; minW?: number; maxW?: number; minH?: number; maxH?: number; presetW?: number; presetH?: number; }; }; }; }; export type AIPropI18nText = { zh?: string; en?: string; ja?: string; }; export type AIPropOption = { label: string; translation: { zh: string; en: string; ja: string; }; }; /** ai_node property 的合法 data_type 值(与 schema enum + GUI PropertyItemForm 对齐) */ export type AINodePropertyDataType = 'field' | 'node_form' | 'node_field' | 'select' | 'multi_select' | 'text' | 'number'; /** ai_field property 的合法 data_type 值(与 ai_node 相比:去 node_form/node_field,加 role_type / prompt) */ export type AIFieldPropertyDataType = 'field' | 'role_type' | 'select' | 'multi_select' | 'text' | 'number' | 'prompt'; export type AINodePropertyInput = { key: string; name: AIPropI18nText; description?: AIPropI18nText; data_type: AINodePropertyDataType[]; input_field_types?: string[]; /** ai_node 支持;ai_field 不允许 */ max_field_count?: number; options?: AIPropOption[]; }; export type AIFieldPropertyInput = { key: string; name: AIPropI18nText; description?: AIPropI18nText; data_type: AIFieldPropertyDataType[]; input_field_types?: string[]; options?: AIPropOption[]; }; export type AINodePointInput = { key: string; /** 固定 'ai_node';CLI 转换时强制覆盖,可省略 */ type?: 'ai_node'; url: string; token: string; properties?: AINodePropertyInput[]; needCustomCard?: boolean; /** needCustomCard=true 时必填,至少一端 */ platform?: { web?: { resource: string; }; mobile?: { resource: string; }; }; }; export type AIFieldPointInput = { key: string; type?: 'ai_field'; url: string; token: string; properties?: AIFieldPropertyInput[]; /** 输出字段类型 key 列表,至少一项;后端字段名为 field_types */ output_field_types: string[]; }; export type QueryLocalConfigInput = { page?: PagePointInput[]; view?: ViewPointInput[]; dashboard?: DashboardPointInput[]; configuration?: ConfigurationPointInput[]; control?: ControlPointInput[]; button?: ButtonPointInput[]; intercept?: InterceptPointInput[]; listen_event?: ListenEventPointInput[]; component?: ComponentSchedulePointInput[]; customField?: CustomFieldPointInput[]; liteAppComponent?: LiteAppComponentPointInput[]; /** * AI Node / AI Field:与其他点位不同,是**单对象**而非数组——AI 插件全工程恰好一个。 * yaml 里写成 `aiNode: { ... }` / `aiField: { ... }`,写成数组会被 schema + preflight 同时阻断。 */ aiNode?: AINodePointInput; aiField?: AIFieldPointInput; };