@luka-cat-mimi/n8n-nodes-feishu-project
Version:
飞书项目 N8N 集成插件,支持附件管理等功能
113 lines • 5.17 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const RequestUtils_1 = __importDefault(require("../../../help/utils/RequestUtils"));
const sharedOptions_1 = require("../../../help/utils/sharedOptions");
const description_1 = require("../../../help/description");
const WorkflowNodeWbsViewOperate = {
name: '获取工作流详情(WBS)',
value: 'workflow_node:wbs_view',
order: 20,
options: [
description_1.DESCRIPTIONS.PROJECT_KEY,
{
displayName: '工作项类型 Name or ID',
name: 'work_item_type_key',
type: 'options',
default: '',
required: true,
description: '空间下工作项类型,需要先选择空间,详见:<a href="https://project.feishu.cn/b/helpcenter/2.0.0/1p8d7djs/3pjp854w">获取空间下工作项类型</a>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
typeOptions: {
loadOptionsMethod: 'loadWorkItemTypes',
},
},
{
displayName: '工作项ID',
name: 'work_item_id',
type: 'string',
required: true,
default: '',
description: '工作项实例 ID,在工作项实例详情中,展开右上角 ··· > ID 获取。',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
default: {},
options: [
{
displayName: '是否融合需要交付物',
name: 'need_union_deliverable',
type: 'boolean',
default: false,
description: 'Whether to include merged deliverable information. 是否需要融合交付物信息.',
},
{
displayName: '是否需要计划表聚合字段',
name: 'need_schedule_table_agg',
type: 'boolean',
default: false,
description: 'Whether to include schedule table custom column aggregation fields. 扩展查询,是否需要计划表自定义列聚合字段.',
},
{
displayName: '是否需要WBS链路层级信息',
name: 'need_wbs_relation_chain_path',
type: 'boolean',
default: false,
description: 'Whether to include WBS relation chain path information. 扩展查询,是否需要WBS链路层级信息.',
},
{
displayName: '是否需要WBS链路实例信息',
name: 'need_wbs_relation_chain_entity',
type: 'boolean',
default: false,
description: 'Whether to include WBS relation chain entity information. 扩展查询,是否需要WBS链路实例信息.',
},
sharedOptions_1.batchingOption,
sharedOptions_1.timeoutOption,
],
},
],
async call(index) {
const project_key = this.getNodeParameter('project_key', index, '', {
extractValue: true,
});
const work_item_type_key = this.getNodeParameter('work_item_type_key', index);
const work_item_id = this.getNodeParameter('work_item_id', index);
const options = this.getNodeParameter('options', index, {});
const qs = {};
if (options.need_union_deliverable !== undefined) {
qs.need_union_deliverable = options.need_union_deliverable;
}
if (options.need_schedule_table_agg !== undefined) {
qs.need_schedule_table_agg = options.need_schedule_table_agg;
}
const expand = {};
if (options.need_union_deliverable !== undefined) {
expand.need_union_deliverable = options.need_union_deliverable;
}
if (options.need_wbs_relation_chain_path !== undefined) {
expand.need_wbs_relation_chain_path = options.need_wbs_relation_chain_path;
}
if (options.need_wbs_relation_chain_entity !== undefined) {
expand.need_wbs_relation_chain_entity = options.need_wbs_relation_chain_entity;
}
const body = {};
if (Object.keys(expand).length > 0) {
body.expand = expand;
Object.assign(body, expand);
}
return RequestUtils_1.default.request.call(this, {
method: 'GET',
url: `/open_api/${project_key}/work_item/${work_item_type_key}/${work_item_id}/wbs_view`,
...(Object.keys(qs).length > 0 && { qs }),
...(Object.keys(body).length > 0 && { body }),
timeout: options.timeout,
});
}
};
exports.default = WorkflowNodeWbsViewOperate;
//# sourceMappingURL=WorkflowNodeWbsViewOperate.js.map