{"version":3,"file":"flows.cjs","names":[],"sources":["../../../../src/rest/commands/utils/flows.ts"],"sourcesContent":["import type { RestCommand } from '../../types.js';\n\n// TODO better options for ouput typing\n\n/**\n * Trigger a flow\n * @param method\n * @param id\n * @param data\n * @returns Result of the flow, if any.\n */\nexport const triggerFlow =\n\t<Schema>(method: 'GET' | 'POST', id: string, data?: Record<string, string>): RestCommand<unknown, Schema> =>\n\t() => {\n\t\tif (method === 'GET') {\n\t\t\treturn {\n\t\t\t\tpath: `/flows/trigger/${id}`,\n\t\t\t\tparams: data ?? {},\n\t\t\t\tmethod: 'GET',\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tpath: `/flows/trigger/${id}`,\n\t\t\tbody: JSON.stringify(data ?? {}),\n\t\t\tmethod: 'POST',\n\t\t};\n\t};\n"],"mappings":"AAWA,MAAa,GACH,EAAwB,EAAY,QAExC,IAAW,MACP,CACN,KAAM,kBAAkB,IACxB,OAAQ,GAAQ,EAAE,CAClB,OAAQ,MACR,CAGK,CACN,KAAM,kBAAkB,IACxB,KAAM,KAAK,UAAU,GAAQ,EAAE,CAAC,CAChC,OAAQ,OACR"}