feat(workflow): implement trigger-aware debug path branching for clock, webhook, datalink and flowform
This commit is contained in:
1 parent
c74fdda7da
commit
c8d9e409c6
6 files changed
+523
-57
No files matched your search
@@ -658,23 +658,28 @@ export async function runWorkflowDebugTest(
|
||||
client: import("ky").KyInstance,
|
||||
pipelineId: string,
|
||||
options: {
|
||||
flowCodeOrId: string;
|
||||
flowCodeOrId?: string;
|
||||
data?: Record<string, any>;
|
||||
triggerCategory?: import("./types.js").WorkflowTriggerCategory;
|
||||
triggerType?: string;
|
||||
triggerLabel?: string;
|
||||
autoPublish?: boolean;
|
||||
timeoutMs?: number;
|
||||
pollIntervalMs?: number;
|
||||
}
|
||||
} = {}
|
||||
): Promise<import("./types.js").WorkflowTestReport> {
|
||||
let targetEntityId = options.flowCodeOrId;
|
||||
const isDirectCode = options.flowCodeOrId.includes("-") || options.flowCodeOrId.startsWith("ID01");
|
||||
if (!isDirectCode) {
|
||||
let targetEntityId = options.flowCodeOrId ?? "";
|
||||
const code = options.flowCodeOrId;
|
||||
const isDirectCode = !code || code.includes("-") || code.startsWith("ID01");
|
||||
if (code && !isDirectCode) {
|
||||
try {
|
||||
const source = await api.getWorkflowDebugSource(client, pipelineId, {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
keywords: options.flowCodeOrId,
|
||||
keywords: code,
|
||||
});
|
||||
const matched = source.items.find(
|
||||
(item) => item.id === options.flowCodeOrId || item.title.includes(options.flowCodeOrId)
|
||||
(item) => item.id === code || (item as any).code === code || item.title?.includes(code) || (item as any).name?.includes(code)
|
||||
);
|
||||
if (matched) {
|
||||
targetEntityId = matched.id;
|
||||
@@ -685,7 +690,8 @@ export async function runWorkflowDebugTest(
|
||||
}
|
||||
|
||||
const jobId = await api.triggerWorkflowDebug(client, pipelineId, {
|
||||
entityId: targetEntityId,
|
||||
entityId: targetEntityId || undefined,
|
||||
data: options.data,
|
||||
autoPublish: options.autoPublish ?? false,
|
||||
});
|
||||
|
||||
@@ -734,6 +740,9 @@ export async function runWorkflowDebugTest(
|
||||
runType: finalJob.runType || "DEBUG",
|
||||
durationTime: typeof (finalJob as any).durationTime === "number" ? (finalJob as any).durationTime : undefined,
|
||||
targetEntityId,
|
||||
triggerCategory: options.triggerCategory,
|
||||
triggerType: options.triggerType,
|
||||
triggerLabel: options.triggerLabel,
|
||||
executionTree: tree,
|
||||
failedExecutions: rawFailed,
|
||||
conditionDiagnoses,
|
||||
@@ -746,3 +755,8 @@ export {
|
||||
type ConditionRuleExplanation,
|
||||
} from "./workflow-branch.js";
|
||||
|
||||
export {
|
||||
classifyWorkflowTrigger,
|
||||
type WorkflowTriggerCategory,
|
||||
} from "./types.js";
|
||||
|
||||
Reference in new issue
Block a user