maests
Version:
An executable compiler for creating Maestro's yaml-flows with typescript.
30 lines (29 loc) • 624 B
JavaScript
import { handleNest, addOut } from "../out.mjs";
const envAppId = process.env.appId, initFlow = ({
appId,
onFlowStart
} = {}) => {
let commands = `appId: ${appId ?? envAppId}
`;
if (onFlowStart) {
const flowCommand = `onFlowStart:
${handleNest(onFlowStart).replaceAll(/\n/g, `
`)}`;
commands += flowCommand;
}
commands += `---
`, addOut(commands);
}, launchApp = ({ appId } = {}) => {
addOut(`- launchApp:
appId: "${appId ?? envAppId}"
`);
}, clearState = ({ appId } = {}) => {
addOut(appId ? `- clearState: ${appId}
` : `- clearState
`);
};
export {
clearState,
initFlow,
launchApp
};