UNPKG

@workflow-manager/runner

Version:

CLI runner for in-memory and markdown workflow orchestration using ATEP-like envelopes

26 lines (25 loc) 861 B
function asRecord(value) { return value && typeof value === "object" ? value : {}; } const previousOutputTextKeys = ["output", "storyMarkdown", "chapterMarkdown", "stdout"]; export function previousOutputTextSections(value) { const record = asRecord(value); const sections = []; for (const key of previousOutputTextKeys) { const text = record[key]; if (typeof text === "string" && text.trim()) { sections.push(text); } } if (sections.length > 0) { return sections; } for (const [key, value] of Object.entries(record)) { if (["stepKey", "attempt", "adapter", "command", "exitStatus", "mockResult"].includes(key)) continue; if (typeof value === "string" && value.trim()) { sections.push(`${key}: ${value}`); } } return sections; }