@lark-project/cli
Version:
飞书项目插件开发工具
709 lines (708 loc) • 29.5 kB
JavaScript
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformQueryLocalConfig = void 0;
const crypto_1 = require("crypto");
const dsl_1 = require("./dsl");
function omitUndefinedKeys(obj) {
const next = {};
for (const [k, v] of Object.entries(obj)) {
if (v !== undefined) {
next[k] = v;
}
}
return next;
}
/**
* tree-multi-select 选项的空 `children: []` 后端不接受(只支持不传),这里把空数组的
* children 键剔掉。递归处理任意层级的级联子项(非空 children 保留并下钻剔其空子项)。
*/
function stripEmptyTreeChildren(options) {
if (!Array.isArray(options))
return options;
return options.map(opt => {
if (!opt || !Array.isArray(opt.children))
return opt;
if (opt.children.length === 0) {
const { children } = opt, rest = __rest(opt, ["children"]);
return rest;
}
return Object.assign(Object.assign({}, opt), { children: stripEmptyTreeChildren(opt.children) });
});
}
/** Extract zh-cn name from i18n_info as fallback when name is empty */
function getZhName(i18nInfo) {
if (!i18nInfo)
return '';
const zh = i18nInfo['zh-cn'] || i18nInfo['zh_cn'] || i18nInfo['zh-CN'] || i18nInfo['zh_CN'] || i18nInfo['zh'];
return (zh === null || zh === void 0 ? void 0 : zh.name) || '';
}
function normalizeI18nInfo(i18nInfo) {
var _a, _b;
if (!i18nInfo)
return undefined;
const out = {};
for (const [lang, value] of Object.entries(i18nInfo)) {
out[lang] = {
name: (_a = value === null || value === void 0 ? void 0 : value.name) !== null && _a !== void 0 ? _a : '',
description: (_b = value === null || value === void 0 ? void 0 : value.description) !== null && _b !== void 0 ? _b : '',
};
}
return out;
}
function normalizeSingleI18nInfoToZhCN(input) {
var _a, _b;
if (!input)
return undefined;
return {
'zh-cn': {
name: (_a = input.name) !== null && _a !== void 0 ? _a : '',
description: (_b = input.description) !== null && _b !== void 0 ? _b : '',
},
};
}
function normalizePlatform(platform) {
if (!platform)
return undefined;
const out = {};
for (const [key, value] of Object.entries(platform)) {
if (!value)
continue;
const item = omitUndefinedKeys({
resource: typeof value.resource === 'string' ? value.resource : undefined,
scene: Array.isArray(value.scene)
? value.scene.filter((v) => typeof v === 'number')
: undefined,
type: typeof value.type === 'string' ? value.type : undefined,
});
if (Object.keys(item).length > 0) {
out[key] = item;
}
}
return Object.keys(out).length > 0 ? out : undefined;
}
function patchWebPlatformDefaults(platform) {
if (!(platform === null || platform === void 0 ? void 0 : platform.web))
return platform;
const web = platform.web;
return Object.assign(Object.assign({}, platform), { web: Object.assign(Object.assign({}, web), { type: web.type || 'display', scene_info_list: [] }) });
}
function buildExtension(ext_type, ext_subType, key, value) {
return {
ext_key: key,
ext_type,
ext_subType,
ext_config: {
[key]: value,
},
};
}
function mergeExtensions(...lists) {
const out = [];
for (const list of lists) {
if (list === null || list === void 0 ? void 0 : list.length) {
out.push(...list);
}
}
return out.length ? out : undefined;
}
function transformPagePoint(input) {
return omitUndefinedKeys({
key: input.key,
name: input.name || getZhName(input.i18n_info),
type: 'board',
description: input.description,
icon: input.icon,
i18n_info: normalizeI18nInfo(input.i18n_info),
platform: patchWebPlatformDefaults(normalizePlatform(input.platform)),
});
}
function transformViewPoint(input) {
return omitUndefinedKeys({
key: input.key,
name: input.name || getZhName(input.i18n_info),
type: 'view',
description: input.description,
icon: input.icon,
i18n_info: normalizeI18nInfo(input.i18n_info),
work_item_type: input.work_item_type,
platform: normalizePlatform(input.platform),
});
}
function transformDashboardPoint(input) {
return omitUndefinedKeys({
key: input.key,
name: input.name || getZhName(input.i18n_info),
type: 'dashboard',
description: input.description,
i18n_info: normalizeI18nInfo(input.i18n_info),
work_item_type: input.work_item_type,
custom_work_item_type: input.custom_work_item_type,
platform: normalizePlatform(input.platform),
});
}
function transformConfigurationPoint(input) {
return omitUndefinedKeys({
key: input.key,
type: 'config',
platform: patchWebPlatformDefaults(normalizePlatform(input.platform)),
});
}
function transformControlPoint(input) {
var _a, _b, _c, _d, _e, _f;
const key = input.key;
const extensions = [];
const tableCellNormalized = (0, dsl_1.normalizeDslForBackend)((_b = (_a = input.platform) === null || _a === void 0 ? void 0 : _a.web) === null || _b === void 0 ? void 0 : _b.table_cell);
if (tableCellNormalized) {
extensions.push(buildExtension('control', 'web_control_table_cell', key, tableCellNormalized));
}
const tableUrl = (_d = (_c = input.platform) === null || _c === void 0 ? void 0 : _c.web) === null || _d === void 0 ? void 0 : _d.table_url;
if (tableUrl) {
const url = tableUrl.url ? tableUrl.url : '';
const token = tableUrl.url ? tableUrl.token || (0, crypto_1.randomUUID)() : '';
extensions.push(buildExtension('control', 'web_control_table_url', key, { url, token }));
}
const mobileBlockStyle = (_f = (_e = input.platform) === null || _e === void 0 ? void 0 : _e.mobile) === null || _f === void 0 ? void 0 : _f.mobile_block_style;
if (typeof mobileBlockStyle === 'string' && mobileBlockStyle) {
extensions.push(buildExtension('control', 'mob_control_block_style', key, mobileBlockStyle));
}
const platform = normalizePlatform(input.platform);
return omitUndefinedKeys({
key,
name: input.name || getZhName(input.i18n_info),
type: 'control',
description: input.description,
i18n_info: normalizeI18nInfo(input.i18n_info),
work_item_type: input.work_item_type,
url: input.url,
token: input.url ? input.token || (0, crypto_1.randomUUID)() : input.token,
platform,
extension: mergeExtensions(extensions),
});
}
function transformButtonPoint(input) {
var _a, _b, _c, _d;
const key = input.key;
const extensions = [];
const mode = (_b = (_a = input.platform) === null || _a === void 0 ? void 0 : _a.web) === null || _b === void 0 ? void 0 : _b.mode;
if (mode) {
extensions.push(buildExtension('button', 'point_run_mode', key, mode));
}
const initSize = (_d = (_c = input.platform) === null || _c === void 0 ? void 0 : _c.web) === null || _d === void 0 ? void 0 : _d.init_size;
if (initSize) {
extensions.push(buildExtension('button', 'button_pop_up_init_size', key, initSize));
}
return omitUndefinedKeys({
key,
name: input.name || getZhName(input.i18n_info),
type: 'button',
description: input.description,
i18n_info: normalizeI18nInfo(input.i18n_info),
work_item_type: input.work_item_type,
custom_work_item_type: input.custom_work_item_type,
platform: normalizePlatform(input.platform),
extension: mergeExtensions(extensions),
});
}
function transformInterceptPoint(input) {
return omitUndefinedKeys({
key: input.key,
name: input.name || getZhName(input.i18n_info),
type: 'intercept',
description: input.description,
i18n_info: normalizeI18nInfo(input.i18n_info),
url: input.url,
token: input.url ? input.token || (0, crypto_1.randomUUID)() : input.token,
event_config: input.event_config,
platform: normalizePlatform(input.platform),
});
}
function transformListenEventPoint(input) {
const key = input.key || 'listen_event';
return omitUndefinedKeys({
key,
type: 'listen_event',
url: input.url,
token: input.url ? input.token || (0, crypto_1.randomUUID)() : input.token,
event_config: input.event_config,
});
}
function transformComponentSchedulePoint(input) {
return omitUndefinedKeys({
key: input.key,
type: 'component',
component_type: input.component_type,
work_item_type: input.work_item_type,
platform: normalizePlatform(input.platform),
});
}
function transformCustomFieldPoint(input) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
const key = input.key;
const extensions = [];
const tableLayoutNormalized = (0, dsl_1.normalizeDslForBackend)((_b = (_a = input.platform) === null || _a === void 0 ? void 0 : _a.web) === null || _b === void 0 ? void 0 : _b.table_layout);
if (tableLayoutNormalized) {
extensions.push(buildExtension('field_template', 'field_template_table_cell', key, tableLayoutNormalized));
}
if (((_d = (_c = input.platform) === null || _c === void 0 ? void 0 : _c.web) === null || _d === void 0 ? void 0 : _d.table_data_url) || ((_f = (_e = input.platform) === null || _e === void 0 ? void 0 : _e.web) === null || _f === void 0 ? void 0 : _f.table_data_token)) {
const url = ((_h = (_g = input.platform) === null || _g === void 0 ? void 0 : _g.web) === null || _h === void 0 ? void 0 : _h.table_data_url) ? input.platform.web.table_data_url : '';
const token = ((_k = (_j = input.platform) === null || _j === void 0 ? void 0 : _j.web) === null || _k === void 0 ? void 0 : _k.table_data_url)
? ((_m = (_l = input.platform) === null || _l === void 0 ? void 0 : _l.web) === null || _m === void 0 ? void 0 : _m.table_data_token) || (0, crypto_1.randomUUID)()
: '';
extensions.push(buildExtension('field_template', 'field_template_table_url', key, { url, token }));
}
if ((_p = (_o = input.platform) === null || _o === void 0 ? void 0 : _o.mobile) === null || _p === void 0 ? void 0 : _p.mobile_block_style) {
extensions.push(buildExtension('field_template', 'mob_field_template_block_style', key, input.platform.mobile.mobile_block_style));
}
if (((_r = (_q = input.platform) === null || _q === void 0 ? void 0 : _q.web) === null || _r === void 0 ? void 0 : _r.need_extra_config) !== undefined) {
extensions.push(buildExtension('field_template', 'field_template_extra', key, {
enable_extra_config: input.platform.web.need_extra_config,
}));
}
if (input.subfield) {
const sub_fields = input.subfield.map(sf => {
var _a, _b, _c;
// name 为空时,从 i18n_info 中取中文 name
const fieldName = sf.name || ((_b = (_a = sf.i18n_info) === null || _a === void 0 ? void 0 : _a.zh) === null || _b === void 0 ? void 0 : _b.name) || '';
return {
field_name: fieldName,
field_desc: (_c = sf.desc) !== null && _c !== void 0 ? _c : '',
field_type: sf.field_type,
field_key: sf.field_key,
options: stripEmptyTreeChildren(sf.options),
i18n_info: sf.i18n_info,
};
});
extensions.push(buildExtension('field_template', 'field_template_sub_field', key, {
sub_fields,
}));
}
const platform = {
web: {
resource: input.platform.web.resource,
},
mobile: {
resource: input.platform.mobile.resource,
},
};
return omitUndefinedKeys({
key,
type: 'field_template',
i18n_info: normalizeSingleI18nInfoToZhCN(input.i18n_info),
platform,
extension: mergeExtensions(extensions),
});
}
function builderPropToTemplate(propType, with_field) {
switch (propType) {
case 'text':
return 'text';
case 'number':
return 'number';
case 'precise_date':
return 'dateWithTime';
case 'date_range':
return 'dateRange';
case 'boolean':
return 'boolean';
case 'select':
return 'select';
case 'multi_select':
return 'multiSelect';
case 'work_item_instance':
return with_field ? 'workItemInstanceWithField' : 'workItemInstance';
case 'work_item_type':
return with_field ? 'workItemTypeWithField' : 'workItemTypeSelect';
case 'view_select':
return 'viewSelect';
case 'data_source':
case 'dataSource': // 兼容历史驼峰写法
return with_field ? 'dataSourceWithField' : 'dataSource';
default:
return undefined;
}
}
function builderSubscribePropToTemplate(propType) {
switch (propType) {
case 'text':
return 'text';
case 'number':
return 'number';
case 'precise_date':
return 'dateWithTime';
case 'date_range':
return 'dateRange';
case 'work_item_instance':
return 'workItemInstance';
case 'work_item_type':
return 'workItemTypeSelect';
case 'view_select':
return 'viewSelect';
case 'data_source':
case 'dataSource': // 兼容历史驼峰写法
return 'dataSource';
default:
return undefined;
}
}
function transformLiteAppComponentPoint(input, fallbackIconUrl) {
var _a, _b, _c, _d;
const key = input.key;
const extensions = [];
// layout
const layout = (_b = (_a = input.platform) === null || _a === void 0 ? void 0 : _a.web) === null || _b === void 0 ? void 0 : _b.layout;
extensions.push(buildExtension('builder_comp', 'builder_comp_layout', key, (layout === null || layout === void 0 ? void 0 : layout.mode) !== undefined ? {
mode: layout.mode,
delete_disable: undefined,
minWidth: layout.minW,
maxWidth: layout.maxW,
minHeight: layout.minH,
maxHeight: layout.maxH,
staticHeight: layout.staticHeight,
staticWidth: layout.staticWidth,
} : {}));
// preset
const presetLayout = {};
if ((layout === null || layout === void 0 ? void 0 : layout.presetW) !== undefined) {
presetLayout.width = layout.presetW;
}
if ((layout === null || layout === void 0 ? void 0 : layout.presetH) !== undefined) {
presetLayout.height = layout.presetH;
}
extensions.push(buildExtension('builder_comp', 'builder_comp_default_value', key, {
presets: [
{
presetId: 'default',
layout: presetLayout,
},
],
}));
// properties
// title / border / backgroundColor 恒下发 need:true——轻应用组件框架始终需要这套外框配置,
// 不能因为没声明 properties 就退化成空对象(后端会把缺失字段读成 null,外框失效)。
// sub_comp 仍随 properties 生成:没有可配置属性时为空数组。
const propSubComp = ((_c = input.properties) !== null && _c !== void 0 ? _c : [])
.map((prop, index) => {
const template = builderPropToTemplate(prop.prop_type, prop.with_field);
if (!template)
return undefined;
const base = {
order: index,
template,
propKey: prop.prop_key,
propName: prop.name,
};
if (template === 'select') {
base.options = { optionList: prop.options, useDynamic: true };
}
else if (template === 'multiSelect') {
base.options = { optionList: prop.options, multiple: true, useDynamic: true };
}
else {
base.options = { useDynamic: true };
}
return base;
})
.filter(Boolean);
extensions.push(buildExtension('builder_comp', 'builder_comp_prop_config', key, {
title: { need: true },
border: { need: true },
backgroundColor: { need: true },
sub_comp: propSubComp,
}));
// outputs
if ((_d = input.outputs) === null || _d === void 0 ? void 0 : _d.length) {
const subComp = input.outputs
.map((prop, index) => {
const template = builderSubscribePropToTemplate(prop.prop_type);
if (!template)
return undefined;
return {
order: index,
template,
propKey: prop.prop_key,
propName: prop.name,
};
})
.filter(Boolean);
extensions.push(buildExtension('builder_comp', 'builder_comp_subscribe_prop_config', key, {
sub_comp: subComp,
}));
}
else {
extensions.push(buildExtension('builder_comp', 'builder_comp_subscribe_prop_config', key, {}));
}
// icon:AI 生成的 icon_url 不可信(可能指向不可访问或不合规的图片),统一走后端 fallback
// (插件级 icon → builder 专用生成图),用户在 yaml 里手填 icon_url 也不生效。
extensions.push(buildExtension('builder_comp', 'point_icon', key, fallbackIconUrl ? { url: fallbackIconUrl } : {}));
const platform = {
web: {
resource: input.platform.web.resource,
},
};
return omitUndefinedKeys({
key,
type: 'builder_comp',
i18n_info: input.i18n_info,
platform,
extension: mergeExtensions(extensions),
});
}
const FIELD_GROUP_TYPES = new Set(['field', 'node_form', 'node_field']);
function deriveAITemplate(dataType) {
if (!(dataType === null || dataType === void 0 ? void 0 : dataType.length))
return 'fieldSelect';
if (dataType.some(t => FIELD_GROUP_TYPES.has(t)))
return 'fieldSelect';
// 自定义属性组(select/multi_select/text/number)schema 限定 maxItems:1,取首项即代表
const t = dataType[0];
if (t === 'select' || t === 'multi_select' || t === 'text' || t === 'number' || t === 'prompt') {
return t;
}
return 'fieldSelect';
}
function buildOptionListForWire(options) {
return options.map(o => {
var _a, _b;
return ({
// wire.label 是后端展示用名称,缺省取中文翻译;本地 label 原始值放到 wire.value
label: (_b = (_a = o.translation) === null || _a === void 0 ? void 0 : _a.zh) !== null && _b !== void 0 ? _b : o.label,
value: o.label,
translation: o.translation,
});
});
}
function buildAINodeSubProp(prop) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
const template = deriveAITemplate(prop.data_type);
const base = {
propKey: prop.key,
propName: {
zh: (_b = (_a = prop.name) === null || _a === void 0 ? void 0 : _a.zh) !== null && _b !== void 0 ? _b : '',
en: (_d = (_c = prop.name) === null || _c === void 0 ? void 0 : _c.en) !== null && _d !== void 0 ? _d : '',
ja: (_f = (_e = prop.name) === null || _e === void 0 ? void 0 : _e.ja) !== null && _f !== void 0 ? _f : '',
},
propDesc: {
zh: (_h = (_g = prop.description) === null || _g === void 0 ? void 0 : _g.zh) !== null && _h !== void 0 ? _h : '',
en: (_k = (_j = prop.description) === null || _j === void 0 ? void 0 : _j.en) !== null && _k !== void 0 ? _k : '',
ja: (_m = (_l = prop.description) === null || _l === void 0 ? void 0 : _l.ja) !== null && _m !== void 0 ? _m : '',
},
template,
};
if (template === 'fieldSelect') {
return Object.assign(Object.assign({}, base), { options: {
dataType: prop.data_type,
fieldType: (_o = prop.input_field_types) !== null && _o !== void 0 ? _o : [],
max: prop.max_field_count,
useDynamic: false,
} });
}
if (template === 'select' || template === 'multi_select') {
return Object.assign(Object.assign({}, base), { options: {
optionList: buildOptionListForWire((_p = prop.options) !== null && _p !== void 0 ? _p : []),
dataType: null,
fieldType: null,
max: null,
useDynamic: false,
} });
}
// text / number
return Object.assign(Object.assign({}, base), { options: {
dataType: null,
fieldType: null,
max: null,
useDynamic: false,
} });
}
function buildAIFieldSubProp(prop) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
const template = deriveAITemplate(prop.data_type);
const base = {
propKey: prop.key,
propName: {
zh: (_b = (_a = prop.name) === null || _a === void 0 ? void 0 : _a.zh) !== null && _b !== void 0 ? _b : '',
en: (_d = (_c = prop.name) === null || _c === void 0 ? void 0 : _c.en) !== null && _d !== void 0 ? _d : '',
ja: (_f = (_e = prop.name) === null || _e === void 0 ? void 0 : _e.ja) !== null && _f !== void 0 ? _f : '',
},
propDesc: {
zh: (_h = (_g = prop.description) === null || _g === void 0 ? void 0 : _g.zh) !== null && _h !== void 0 ? _h : '',
en: (_k = (_j = prop.description) === null || _j === void 0 ? void 0 : _j.en) !== null && _k !== void 0 ? _k : '',
ja: (_m = (_l = prop.description) === null || _l === void 0 ? void 0 : _l.ja) !== null && _m !== void 0 ? _m : '',
},
template,
};
if (template === 'prompt') {
// prompt 模板不带 dataType / fieldType / optionList
return Object.assign(Object.assign({}, base), { options: { useDynamic: false } });
}
if (template === 'fieldSelect') {
return Object.assign(Object.assign({}, base), { options: {
dataType: prop.data_type,
fieldType: (_o = prop.input_field_types) !== null && _o !== void 0 ? _o : [],
useDynamic: false,
} });
}
if (template === 'select' || template === 'multi_select') {
return Object.assign(Object.assign({}, base), { options: {
optionList: buildOptionListForWire((_p = prop.options) !== null && _p !== void 0 ? _p : []),
dataType: null,
fieldType: null,
max: null,
useDynamic: false,
} });
}
// text / number
return Object.assign(Object.assign({}, base), { options: {
dataType: null,
fieldType: null,
max: null,
useDynamic: false,
} });
}
function transformAINodePoint(input) {
var _a;
const key = input.key;
const extensions = [];
const subProps = ((_a = input.properties) !== null && _a !== void 0 ? _a : []).map(buildAINodeSubProp);
extensions.push(buildExtension('ai_node', 'ai_node_properties', key, { sub_prop: subProps }));
// 自定义卡片开关:缺省视为 false(与 schema `not.required:[platform]` 保持一致:
// 不启用时不允许带 platform,写出时也不发 platform;启用时下面正常带)
const enableCard = !!input.needCustomCard;
extensions.push(buildExtension('ai_node', 'ai_node_card', key, {
enable_ai_workflow_node_card: enableCard,
}));
const platform = enableCard && input.platform
? omitUndefinedKeys({
web: input.platform.web ? { resource: input.platform.web.resource } : undefined,
mobile: input.platform.mobile ? { resource: input.platform.mobile.resource } : undefined,
})
: undefined;
return omitUndefinedKeys({
key,
type: 'ai_node',
url: input.url,
token: input.token || (0, crypto_1.randomUUID)(),
platform,
extension: mergeExtensions(extensions),
});
}
// 'all' 在本地配置里是 user-friendly 通配(schema 通过 oneOf 强制其与显式枚举互斥——
// 写了 'all' 就只能这一项);后端不收 'all',CLI 在这里展开成 frontend
// INCLUDE_AI_FIELD_TYPES 白名单全集。业务侧扩展白名单时同步此处 + schema enum + 远端 TCC。
const AI_FIELD_OUTPUT_TYPES_ALL = [
'text',
'number',
'date',
'schedule',
'bool',
'multi-text',
'multi-user',
'user',
'multi-file',
'link',
];
function expandAIFieldOutputTypes(input) {
if (!(input === null || input === void 0 ? void 0 : input.length))
return input;
return input.includes('all') ? [...AI_FIELD_OUTPUT_TYPES_ALL] : input;
}
function transformAIFieldPoint(input) {
var _a;
const key = input.key;
const extensions = [];
const subProps = ((_a = input.properties) !== null && _a !== void 0 ? _a : []).map(buildAIFieldSubProp);
extensions.push(buildExtension('ai_field', 'ai_field_properties', key, { sub_prop: subProps }));
// 前端 extensionData.ts 把 outputFieldTypes 落到 RemoteData.field_types 顶层;
// backend.ts 已对应补 AppIntegratePointInfo.field_types,无需再断言交叉类型。
return omitUndefinedKeys({
key,
type: 'ai_field',
url: input.url,
token: input.token || (0, crypto_1.randomUUID)(),
field_types: expandAIFieldOutputTypes(input.output_field_types),
extension: mergeExtensions(extensions),
});
}
/**
* 主入口:把符合 yaml schema 的对象转换为后端 point_info_map。
*/
function transformQueryLocalConfig(input, options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
const out = {};
if ((_a = input.page) === null || _a === void 0 ? void 0 : _a.length) {
input.page.forEach(item => {
out[item.key] = transformPagePoint(item);
});
}
if ((_b = input.view) === null || _b === void 0 ? void 0 : _b.length) {
input.view.forEach(item => {
out[item.key] = transformViewPoint(item);
});
}
if ((_c = input.dashboard) === null || _c === void 0 ? void 0 : _c.length) {
input.dashboard.forEach(item => {
out[item.key] = transformDashboardPoint(item);
});
}
if ((_d = input.configuration) === null || _d === void 0 ? void 0 : _d.length) {
input.configuration.forEach(item => {
out[item.key] = transformConfigurationPoint(item);
});
}
if ((_e = input.control) === null || _e === void 0 ? void 0 : _e.length) {
input.control.forEach(item => {
out[item.key] = transformControlPoint(item);
});
}
if ((_f = input.button) === null || _f === void 0 ? void 0 : _f.length) {
input.button.forEach(item => {
out[item.key] = transformButtonPoint(item);
});
}
if ((_g = input.intercept) === null || _g === void 0 ? void 0 : _g.length) {
input.intercept.forEach(item => {
out[item.key] = transformInterceptPoint(item);
});
}
if ((_h = input.listen_event) === null || _h === void 0 ? void 0 : _h.length) {
input.listen_event.forEach(item => {
const key = item.key || 'listen_event';
out[key] = transformListenEventPoint(Object.assign(Object.assign({}, item), { key }));
});
}
if ((_j = input.component) === null || _j === void 0 ? void 0 : _j.length) {
input.component.forEach(item => {
out[item.key] = transformComponentSchedulePoint(item);
});
}
if ((_k = input.customField) === null || _k === void 0 ? void 0 : _k.length) {
input.customField.forEach(item => {
out[item.key] = transformCustomFieldPoint(item);
});
}
if ((_l = input.liteAppComponent) === null || _l === void 0 ? void 0 : _l.length) {
input.liteAppComponent.forEach(item => {
out[item.key] = transformLiteAppComponentPoint(item, options === null || options === void 0 ? void 0 : options.fallbackIconUrl);
});
}
// aiNode / aiField 是单对象(非数组)—— AI 插件全工程恰好一个,与 GUI 表单同构。
// 写成数组形态会被 schema + preflight 同时阻断,所以这里只处理对象分支。
if (input.aiNode) {
out[input.aiNode.key] = transformAINodePoint(input.aiNode);
}
if (input.aiField) {
out[input.aiField.key] = transformAIFieldPoint(input.aiField);
}
return out;
}
exports.transformQueryLocalConfig = transformQueryLocalConfig;