{ "kind": "open-flow-workflow", "version": 1, "name": "List Contentful Entry Fields", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_f161fa3be24bd54c": { "name": "List entries", "kind": "start", "inputDefs": [] }, "n_16a352e7d91b54d3": { "inputs": { "spaceId": { "kind": "value", "value": "YOUR_SPACE_ID" }, "environment": { "kind": "value", "value": "master" }, "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16a352e7d91b54d3", "output": "state" } ] }, "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3909f683e7f8db99", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3909f683e7f8db99", "output": "statusCode" } ] } }, "name": "Collect entry pages", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "spaceId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "environment" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" }, { "jsonSchema": {}, "nullable": true, "handle": "response" }, { "jsonSchema": { "type": "integer" }, "nullable": true, "handle": "statusCode" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "fields" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" } ], "name": "Collect entry pages", "moduleId": "n_6bc48711ac3be2c3", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_762d9c77261eaada": { "inputs": {}, "name": "Another page?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_16a352e7d91b54d3", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_3909f683e7f8db99": { "inputs": { "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16a352e7d91b54d3", "output": "url" } ] }, "auth.token": { "kind": "unset" } }, "name": "Read entries", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "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 entries", "executor": { "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "authentication": { "type": "bearer" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_1d3c735d3d3384a2": { "name": "Entry fields", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "fields" } ], "outputMappings": { "fields": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16a352e7d91b54d3", "output": "fields" } ] } } } }, "edges": [ { "source": "n_f161fa3be24bd54c", "target": "n_16a352e7d91b54d3" }, { "source": "n_16a352e7d91b54d3", "target": "n_762d9c77261eaada" }, { "source": "n_762d9c77261eaada", "target": "n_3909f683e7f8db99", "sourceHandle": "yes" }, { "source": "n_3909f683e7f8db99", "target": "n_16a352e7d91b54d3" }, { "source": "n_762d9c77261eaada", "target": "n_1d3c735d3d3384a2", "sourceHandle": "otherwise" } ] } }, "modules": { "n_6bc48711ac3be2c3": { "name": "Collect entry pages", "imports": [], "source": "export default function pages({spaceId,environment,previousState,response,statusCode}){if(!spaceId||spaceId.startsWith('YOUR_')||!environment)throw Error('Configure space and environment');let s=previousState??{fields:[],skip:0};if(!Array.isArray(s.fields)||!Number.isSafeInteger(s.skip))throw Error('Invalid page state');let more=true;if(response!=null){if(statusCode!==200||!Array.isArray(response.items)||!Number.isSafeInteger(response.total)||response.total<0||response.skip!==s.skip||response.items.some(x=>!x||!x.fields||typeof x.fields!=='object'||Array.isArray(x.fields)))throw Error('Invalid Contentful page');const skip=s.skip+response.items.length;if(skipx.fields)),skip};more=skip