{
"kind": "open-flow-workflow",
"version": 1,
"name": "Random Cocktail as XML",
"content": {
"modelVersion": 14,
"document": {
"bindings": {},
"graph": {
"nodes": {
"n_2481dbe5e127f861": {
"name": "Get a random cocktail",
"kind": "start",
"inputDefs": []
},
"n_85913a55148c70e3": {
"inputs": {
"url": {
"kind": "value",
"value": "https://www.thecocktaildb.com/api/json/v1/1/random.php"
}
},
"name": "Fetch a random cocktail",
"kind": "task",
"task": {
"inputs": [
{
"jsonSchema": {
"type": "string"
},
"nullable": false,
"handle": "url"
}
],
"outputs": [
{
"jsonSchema": {},
"nullable": true,
"handle": "body"
},
{
"jsonSchema": {
"type": "integer"
},
"nullable": false,
"handle": "statusCode"
},
{
"jsonSchema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nullable": false,
"handle": "headers"
}
],
"name": "Fetch a random cocktail",
"executor": {
"method": "GET",
"query": {
"mode": "fields",
"names": []
},
"headers": {
"mode": "fields",
"names": []
},
"bodyFormat": "none",
"authentication": {
"type": "none"
},
"responseFormat": "json",
"statusPolicy": "success",
"kind": "http-request"
}
}
},
"n_42496c7d3f935861": {
"inputs": {
"body": {
"kind": "sources",
"sources": [
{
"kind": "node",
"nodeId": "n_85913a55148c70e3",
"output": "body"
}
]
}
},
"name": "Convert the recipe to XML",
"kind": "task",
"task": {
"inputs": [
{
"jsonSchema": {},
"nullable": true,
"handle": "body"
}
],
"outputs": [
{
"jsonSchema": {
"type": "string"
},
"nullable": false,
"handle": "data"
}
],
"name": "Convert the recipe to XML",
"moduleId": "n_4472013a1195d9ea",
"capabilities": [
{
"kind": "connector",
"mode": "independent",
"actions": []
}
]
}
},
"n_1069787ddfb08e85": {
"name": "XML recipe",
"kind": "outputs",
"outputDefs": [
{
"jsonSchema": {
"type": "string"
},
"nullable": false,
"handle": "data"
}
],
"outputMappings": {
"data": {
"kind": "sources",
"sources": [
{
"kind": "node",
"nodeId": "n_42496c7d3f935861",
"output": "data"
}
]
}
}
}
},
"edges": [
{
"source": "n_2481dbe5e127f861",
"target": "n_85913a55148c70e3"
},
{
"source": "n_85913a55148c70e3",
"target": "n_42496c7d3f935861"
},
{
"source": "n_42496c7d3f935861",
"target": "n_1069787ddfb08e85"
}
]
}
},
"modules": {
"n_4472013a1195d9ea": {
"name": "Convert the recipe to XML",
"imports": [],
"source": "export default function cocktailXml({body}) {\n if(!body||typeof body!=='object'||Array.isArray(body)||Object.keys(body).length!==1||!Object.hasOwn(body,'drinks')||!(body.drinks===null||Array.isArray(body.drinks)))throw Error('Expected a CocktailDB drinks response');\n const values=body.drinks??[],lines=[];\n for(const drink of values){if(!drink||typeof drink!=='object'||Array.isArray(drink))throw Error('Invalid drink');for(const [name,value] of Object.entries(drink)){\n if(!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(name)||!(value===null||['string','number','boolean'].includes(typeof value)))throw Error('Unsupported cocktail field');\n const text=value===null?'':String(value);if(/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\ufffe\\uffff]/.test(text)||/[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?/g,'>').replace(/\\r/g,'
');lines.push(escaped?' <'+name+'>'+escaped+''+name+'>':' <'+name+'/>');\n }}\n return {data:'\\n'+(lines.length?'\\n'+lines.join('\\n')+'\\n':'')};\n}\n"
}
}
},
"presentation": {
"designer": {
"version": 1,
"flow": {
"direction": "vertical"
}
}
}
}