import { catchError, catchWarning } from "./printCatch"; export function emptyXML(key, name) { return ` `; } export async function createNewDiagram(modeler, newXml, settings) { try { const timestamp = Date.now(); const { processId, processName } = settings || {}; const newId = processId ? processId : `Process_${timestamp}`; const newName = processName || `业务流程_${timestamp}`; const xmlString = newXml || emptyXML(newId, newName); const { warnings } = await modeler.importXML(xmlString); if (warnings && warnings.length) { warnings.forEach(catchWarning); } } catch (e) { catchError(e); } }