{ "kind": "open-flow-workflow", "version": 1, "name": "Xero Invoice Reader", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_e18da3684343b222": { "name": "Choose Xero organization", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "format": "uuid" }, "nullable": false, "handle": "tenantId" } ] }, "n_4128e623b1d0bed2": { "inputs": { "endpoint": { "kind": "value", "value": "/api.xro/2.0/Invoices" }, "header.Xero-tenant-id": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_e18da3684343b222", "output": "tenantId" } ] }, "header.Accept": { "kind": "value", "value": "application/json" } }, "name": "Read Xero invoice records", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "header.Xero-tenant-id" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "header.Accept" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "name": "Read Xero invoice records", "executor": { "providerId": "xero", "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [ "Xero-tenant-id", "Accept" ] }, "bodyFormat": "none", "kind": "connector-proxy" } } }, "n_11015fd338a6f8eb": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4128e623b1d0bed2", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4128e623b1d0bed2", "output": "statusCode" } ] }, "bodyEncoding": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4128e623b1d0bed2", "output": "bodyEncoding" } ] } }, "name": "Take first 100 invoice records", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "invoices" } ], "name": "Take first 100 invoice records", "moduleId": "n_9522994d3566bbbd", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_ee2ae4220da7001e": { "name": "Xero invoices", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "invoices" } ], "outputMappings": { "invoices": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_11015fd338a6f8eb", "output": "invoices" } ] } } } }, "edges": [ { "source": "n_e18da3684343b222", "target": "n_4128e623b1d0bed2" }, { "source": "n_4128e623b1d0bed2", "target": "n_11015fd338a6f8eb" }, { "source": "n_11015fd338a6f8eb", "target": "n_ee2ae4220da7001e" } ] } }, "modules": { "n_9522994d3566bbbd": { "name": "Take first 100 invoice records", "imports": [], "source": "export default function ({ body, statusCode, bodyEncoding }) {\n if (statusCode !== 200 || bodyEncoding === 'base64' || !body || typeof body !== 'object' || Array.isArray(body) || !Array.isArray(body.Invoices) || body.Invoices.some((item) => !item || typeof item !== 'object' || Array.isArray(item))) throw new Error('Xero did not return an invoice collection');\n return { invoices: body.Invoices.slice(0, 100) };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }