{ "kind": "open-flow-workflow", "version": 1, "name": "Read Cockpit Collection Entries", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_85cfbdef7be33ec9": { "name": "Read a collection", "kind": "start", "inputDefs": [] }, "n_53956a7374a912e0": { "inputs": { "baseUrl": { "kind": "value", "value": "https://YOUR_COCKPIT_HOST" }, "collection": { "kind": "value", "value": "samplecollection" } }, "name": "Choose the collection", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "baseUrl" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "collection" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" } ], "name": "Choose the collection", "moduleId": "n_cc58135cf5e6405f", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_7d1519bda71761ed": { "inputs": { "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_53956a7374a912e0", "output": "url" } ] }, "body": { "kind": "value", "value": { "limit": 100, "simple": true } }, "auth.token": { "kind": "unset" } }, "name": "Read collection entries", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.token" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Read collection entries", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "authentication": { "type": "apiKey", "name": "token", "in": "query" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_528c2c88af6c6acf": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7d1519bda71761ed", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7d1519bda71761ed", "output": "statusCode" } ] } }, "name": "Collect entries", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "entries" } ], "name": "Collect entries", "moduleId": "n_5a1bd1b9fe0fb9df", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_8bc8f0b8d295d950": { "name": "Collection entries", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "entries" } ], "outputMappings": { "entries": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_528c2c88af6c6acf", "output": "entries" } ] } } } }, "edges": [ { "source": "n_85cfbdef7be33ec9", "target": "n_53956a7374a912e0" }, { "source": "n_53956a7374a912e0", "target": "n_7d1519bda71761ed" }, { "source": "n_7d1519bda71761ed", "target": "n_528c2c88af6c6acf" }, { "source": "n_528c2c88af6c6acf", "target": "n_8bc8f0b8d295d950" } ] } }, "modules": { "n_cc58135cf5e6405f": { "name": "Choose the collection", "imports": [], "source": "export default function prepare({baseUrl,collection}){let url;try{url=new URL(baseUrl)}catch{throw Error('Configure the Cockpit URL')}if(url.protocol!=='https:'||url.username||url.password||url.search||url.hash||!collection||collection.includes('/'))throw Error('Configure an HTTPS Cockpit URL and collection name');return{url:url.toString().replace(/\\/$/,'')+'/api/collections/get/'+encodeURIComponent(collection)}}\n" }, "n_5a1bd1b9fe0fb9df": { "name": "Collect entries", "imports": [], "source": "export default function check({body,statusCode,bodyEncoding}){if(statusCode!==200||bodyEncoding||!Array.isArray(body))throw Error('Cockpit did not return a collection');return{entries:body}}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }