Refactor workflow auto-run to node graph
This commit is contained in:
@@ -26,6 +26,21 @@
|
||||
return flowBuilder.getRuleDefinition(step, state);
|
||||
}
|
||||
|
||||
function getVerificationMailRuleForNode(nodeId, state = {}) {
|
||||
const flowId = resolveFlowId(state);
|
||||
const flowBuilder = getFlowBuilder(flowId);
|
||||
if (!flowBuilder) {
|
||||
throw new Error(`未找到 flow=${flowId} 的邮件规则定义。`);
|
||||
}
|
||||
if (typeof flowBuilder.getRuleDefinitionForNode === 'function') {
|
||||
return flowBuilder.getRuleDefinitionForNode(nodeId, state);
|
||||
}
|
||||
if (typeof flowBuilder.getRuleDefinition === 'function') {
|
||||
return flowBuilder.getRuleDefinition({ nodeId }, state);
|
||||
}
|
||||
throw new Error(`未找到 flow=${flowId} 的邮件规则定义。`);
|
||||
}
|
||||
|
||||
function buildVerificationPollPayload(step, state = {}, overrides = {}) {
|
||||
const flowId = resolveFlowId(state);
|
||||
const flowBuilder = getFlowBuilder(flowId);
|
||||
@@ -35,9 +50,26 @@
|
||||
return flowBuilder.buildVerificationPollPayload(step, state, overrides);
|
||||
}
|
||||
|
||||
function buildVerificationPollPayloadForNode(nodeId, state = {}, overrides = {}) {
|
||||
const flowId = resolveFlowId(state);
|
||||
const flowBuilder = getFlowBuilder(flowId);
|
||||
if (!flowBuilder) {
|
||||
throw new Error(`未找到 flow=${flowId} 的邮件轮询规则构造器。`);
|
||||
}
|
||||
if (typeof flowBuilder.buildVerificationPollPayloadForNode === 'function') {
|
||||
return flowBuilder.buildVerificationPollPayloadForNode(nodeId, state, overrides);
|
||||
}
|
||||
if (typeof flowBuilder.buildVerificationPollPayload === 'function') {
|
||||
return flowBuilder.buildVerificationPollPayload({ nodeId }, state, overrides);
|
||||
}
|
||||
throw new Error(`未找到 flow=${flowId} 的邮件轮询规则构造器。`);
|
||||
}
|
||||
|
||||
return {
|
||||
buildVerificationPollPayload,
|
||||
buildVerificationPollPayloadForNode,
|
||||
getVerificationMailRule,
|
||||
getVerificationMailRuleForNode,
|
||||
resolveFlowId,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user