@luka-cat-mimi/n8n-nodes-feishu-project
Version:
飞书项目 N8N 集成插件,支持附件管理等功能
67 lines • 3.35 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 NodeUtils_1 = __importDefault(require("../../../help/utils/NodeUtils"));
const sharedOptions_1 = require("../../../help/utils/sharedOptions");
const description_1 = require("../../../help/description");
const WorkflowConfigTemplateUpdateOperate = {
name: '更新流程模板',
value: 'workflow_config:template_update',
order: 40,
options: [
description_1.DESCRIPTIONS.PROJECT_KEY,
{
displayName: '模板ID',
name: 'template_id',
type: 'string',
default: '',
required: true,
description: '模板 ID。如果不提供,将自动选择指定工作项类型的第一个流程模板。可通过以下方式获取:1. 通过"获取创建工作项元数据"接口的 template 字段的 options 中,选择对应的 value;2. 通过"工作项下流程模板列表"接口返回的 template_id;3. 通过"获取字段信息"接口的 template 字段的 options 中,选择对应的 value',
},
{
displayName: '节点流程配置',
name: 'workflow_confs',
type: 'json',
default: JSON.stringify([], null, 2),
description: '节点流程配置,遵循 WorkflowConf 结构规范,JSON格式 , 详见:https://project.feishu.cn/b/helpcenter/2.0.0/1p8d7djs/5hi2qv80',
},
{
displayName: '状态流程配置',
name: 'state_flow_confs',
type: 'json',
default: JSON.stringify([], null, 2),
description: '状态流程配置,遵循 StateFlowConf 结构规范,JSON格式 , 详见:https://project.feishu.cn/b/helpcenter/2.0.0/1p8d7djs/5hi2qv80',
},
sharedOptions_1.commonOptions,
],
async call(index) {
const projectKey = this.getNodeParameter('project_key', index, '', {
extractValue: true,
});
const templateId = this.getNodeParameter('template_id', index);
const workflowConfsParam = this.getNodeParameter('workflow_confs', index);
const stateFlowConfsParam = this.getNodeParameter('state_flow_confs', index);
const options = this.getNodeParameter('options', index, {});
const body = {
project_key: projectKey,
template_id: Number(templateId),
};
if (workflowConfsParam && workflowConfsParam.trim()) {
body.workflow_confs = NodeUtils_1.default.parseJsonParameter(workflowConfsParam, '节点流程配置');
}
if (stateFlowConfsParam && stateFlowConfsParam.trim()) {
body.state_flow_confs = NodeUtils_1.default.parseJsonParameter(stateFlowConfsParam, '状态流程配置');
}
return RequestUtils_1.default.request.call(this, {
method: 'PUT',
url: `/open_api/template/v2/update_template`,
body: body,
timeout: options.timeout,
});
}
};
exports.default = WorkflowConfigTemplateUpdateOperate;
//# sourceMappingURL=WorkflowConfigTemplateUpdateOperate.js.map