UNPKG

sfdx-hardis

Version:

Swiss-army-knife Toolbox for Salesforce. Allows you to define a complete CD/CD Pipeline. Orchestrate base commands and assist users with interactive wizards

43 lines 2.08 kB
import { XMLBuilder, XMLParser } from "fast-xml-parser"; import { DocBuilderRoot } from "./docBuilderRoot.js"; import * as path from "path"; import { prettifyFieldName } from "../utils/flowVisualiser/nodeFormatUtils.js"; import { mdTableCell } from "../gitProvider/utilsMarkdown.js"; import fs from "fs"; export class DocBuilderFlow extends DocBuilderRoot { docType = "Flow"; promptKey = "PROMPT_DESCRIBE_FLOW"; placeholder = "<!-- Flow description -->"; xmlRootKey = "Flow"; static buildIndexTable(prefix, flowDescriptions, outputMarkdownRoot, filterObject = null) { const filteredFlows = filterObject ? flowDescriptions.filter(flow => flow.object === filterObject || flow.impactedObjects.includes(filterObject)) : flowDescriptions; if (filteredFlows.length === 0) { return []; } const lines = []; lines.push(...[ filterObject ? "## Related Flows" : "## Flows", "", "| Object | Name | Type | Description |", "| :---- | :-------- | :--: | :---------- | " ]); for (const flow of filteredFlows) { const outputFlowHistoryMdFile = path.join(outputMarkdownRoot, "flows", flow.name + "-history.md"); const flowNameCell = fs.existsSync(outputFlowHistoryMdFile) ? `[${flow.name}](${prefix}${flow.name}.md) [🕒](${prefix}${flow.name}-history.md)` : `[${flow.name}](${prefix}${flow.name}.md)`; lines.push(...[ `| ${flow.object || "💻"} | ${flowNameCell} | ${prettifyFieldName(flow.type)} | ${mdTableCell(flow.description)} |` ]); } lines.push(""); return lines; } async stripXmlForAi() { const xmlStringStripped = this.metadataXml.replace(/<locationX>.*?<\/locationX>\s*|<locationY>.*?<\/locationY>\s*/g, ''); const xmlObj = new XMLParser().parse(xmlStringStripped); const xmlStripped = new XMLBuilder().build(xmlObj); return xmlStripped; } } //# sourceMappingURL=docBuilderFlow.js.map