@lark-project/cli
Version:
飞书项目插件开发工具
56 lines (55 loc) • 2.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPluginInfo = void 0;
const types_1 = require("../types");
const request_1 = require("./request");
async function getPluginInfo(pluginId, pluginSecret, siteDomain) {
const remotePluginInfo = await (0, request_1.request)(`${siteDomain}/goapi/v5/app/runtime/point_draft`, {
method: 'POST',
data: {
plugin_key: pluginId,
plugin_secret: pluginSecret,
},
});
const features = Object.keys(remotePluginInfo.point_info_map)
// 过滤掉 platform 为空的点位,e.g. automation
.filter(pointKey => remotePluginInfo.point_info_map[pointKey].platform)
.map(pointKey => {
var _a, _b, _c, _d;
const point = remotePluginInfo.point_info_map[pointKey];
return {
key: point.key,
component_type: point.component_type,
type: point.type,
name: point.name,
icon: point.icon,
description: point.description,
workItemTypeKeys: point.work_item_type,
customWorkItemTypeKeys: point.custom_work_item_type,
web: {
scenes: (_a = point.platform[types_1.EFeaturePlatform.web]) === null || _a === void 0 ? void 0 : _a.scene,
resourceId: {
resource: (_b = point.platform[types_1.EFeaturePlatform.web]) === null || _b === void 0 ? void 0 : _b.resource,
},
},
mobile: {
scenes: (_c = point.platform[types_1.EFeaturePlatform.mobile]) === null || _c === void 0 ? void 0 : _c.scene,
resourceId: {
resource: (_d = point.platform[types_1.EFeaturePlatform.mobile]) === null || _d === void 0 ? void 0 : _d.resource,
},
},
extension: point === null || point === void 0 ? void 0 : point.extension,
};
});
return {
frameworkVersion: remotePluginInfo.plugin_extension.runtime_version === '2.0.0'
? types_1.EPluginFrameworkVersion.v2
: types_1.EPluginFrameworkVersion.v1,
id: pluginId,
name: remotePluginInfo.plugin_info.name,
icon: remotePluginInfo.plugin_info.icon,
short: remotePluginInfo.plugin_info.short,
features,
};
}
exports.getPluginInfo = getPluginInfo;