{ "kind": "open-flow-workflow", "version": 1, "name": "List Zotero Collection Items", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_73d6d88676aeab55": { "name": "Start manually", "kind": "start", "inputDefs": [] }, "n_91d9f46c98360c01": { "inputs": { "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_91d9f46c98360c01", "output": "state" } ] }, "items": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c5dac371deca3afd", "output": "items" } ] }, "nextStart": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c5dac371deca3afd", "output": "nextStart" } ] }, "totalResults": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c5dac371deca3afd", "output": "totalResults" } ] } }, "name": "Collect collection pages", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": true, "handle": "items" }, { "jsonSchema": { "type": [ "integer", "null" ] }, "nullable": true, "handle": "nextStart" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": true, "handle": "totalResults" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "start" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "items" } ], "name": "Collect collection pages", "moduleId": "n_8ac92395d73cbac0", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b542a366cc3cb2c4": { "inputs": {}, "name": "More pages?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "read", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_91d9f46c98360c01", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_c5dac371deca3afd": { "inputs": { "libraryType": { "kind": "value", "value": "user" }, "collectionKey": { "kind": "value", "value": "YOUR_KEY" }, "limit": { "kind": "value", "value": 100 }, "start": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_91d9f46c98360c01", "output": "start" } ] } }, "name": "Read collection items", "kind": "task", "task": { "inputs": [ { "description": "The Zotero library type. Omit it to use the connected user's library.", "jsonSchema": { "type": "string", "enum": [ "user", "group" ], "description": "The Zotero library type. Omit it to use the connected user's library." }, "nullable": true, "handle": "libraryType", "value": null }, { "description": "The numeric Zotero user or group library ID. User libraries default to the connected user's ID.", "jsonSchema": { "type": "integer", "exclusiveMinimum": 0, "description": "The numeric Zotero user or group library ID. User libraries default to the connected user's ID." }, "nullable": true, "handle": "libraryId", "value": null }, { "description": "The maximum number of objects to return, from 1 through 100.", "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 100, "description": "The maximum number of objects to return, from 1 through 100." }, "nullable": true, "handle": "limit", "value": null }, { "description": "The zero-based index of the first object to return.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "The zero-based index of the first object to return." }, "nullable": true, "handle": "start", "value": null }, { "description": "The collection whose items should be returned.", "jsonSchema": { "type": "string", "minLength": 8, "maxLength": 8, "description": "The collection whose items should be returned." }, "nullable": true, "handle": "collectionKey", "value": null }, { "description": "Whether to return only top-level items and omit child notes or attachments.", "jsonSchema": { "type": "boolean", "description": "Whether to return only top-level items and omit child notes or attachments." }, "nullable": true, "handle": "topLevelOnly", "value": null }, { "description": "The Zotero quick-search phrase.", "jsonSchema": { "type": "string", "minLength": 1, "pattern": "\\S", "description": "The Zotero quick-search phrase." }, "nullable": true, "handle": "q", "value": null }, { "description": "The Zotero quick-search mode.", "jsonSchema": { "type": "string", "enum": [ "titleCreatorYear", "everything" ], "description": "The Zotero quick-search mode." }, "nullable": true, "handle": "qmode", "value": null }, { "description": "The Zotero item-type search expression.", "jsonSchema": { "type": "string", "minLength": 1, "pattern": "\\S", "description": "The Zotero item-type search expression." }, "nullable": true, "handle": "itemType", "value": null }, { "description": "The Zotero tag search expression.", "jsonSchema": { "type": "string", "minLength": 1, "pattern": "\\S", "description": "The Zotero tag search expression." }, "nullable": true, "handle": "tag", "value": null }, { "description": "Return only items modified after this Zotero library version.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "Return only items modified after this Zotero library version." }, "nullable": true, "handle": "since", "value": null }, { "description": "Whether to include matching items in the trash.", "jsonSchema": { "type": "boolean", "description": "Whether to include matching items in the trash." }, "nullable": true, "handle": "includeTrashed", "value": null }, { "description": "The Zotero item field used to sort the result list.", "jsonSchema": { "type": "string", "enum": [ "dateAdded", "dateModified", "title", "creator", "itemType", "date", "publisher", "publicationTitle", "journalAbbreviation", "language", "accessDate", "libraryCatalog", "callNumber", "rights", "addedBy" ], "description": "The Zotero item field used to sort the result list." }, "nullable": true, "handle": "sort", "value": null }, { "description": "The Zotero item sort direction.", "jsonSchema": { "type": "string", "enum": [ "asc", "desc" ], "description": "The Zotero item sort direction." }, "nullable": true, "handle": "direction", "value": null } ], "outputs": [ { "description": "The matching Zotero items.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string", "minLength": 8, "maxLength": 8, "description": "The Zotero item key." }, "version": { "type": "integer", "minimum": 0, "description": "The current Zotero item version." }, "library": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "user", "group" ], "description": "The type of Zotero library." }, "id": { "type": "integer", "exclusiveMinimum": 0, "description": "The numeric Zotero library ID." }, "name": { "type": "string", "description": "The display name of the Zotero library." } }, "required": [ "type", "id", "name" ], "additionalProperties": true, "description": "The Zotero library metadata attached to an item or collection." }, "links": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The links returned for the Zotero item." }, "meta": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The computed metadata returned for the Zotero item." }, "data": { "type": "object", "properties": { "key": { "type": "string", "minLength": 8, "maxLength": 8, "description": "The Zotero item key." }, "version": { "type": "integer", "minimum": 0, "description": "The current Zotero item version." }, "itemType": { "type": "string", "minLength": 1, "description": "The Zotero item type." } }, "required": [ "key", "version", "itemType" ], "additionalProperties": true, "description": "The editable Zotero item data." } }, "required": [ "key", "version", "data" ], "additionalProperties": true, "description": "A Zotero item resource with stable identity fields and provider-defined metadata." }, "description": "The matching Zotero items." }, "nullable": false, "handle": "items" }, { "description": "The total number of matching Zotero items.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "The total number of matching Zotero items." }, "nullable": false, "handle": "totalResults" }, { "description": "The start index for the next page, or null at the end.", "jsonSchema": { "type": [ "integer", "null" ], "description": "The start index for the next page, or null at the end." }, "nullable": true, "handle": "nextStart" }, { "description": "The Zotero library version returned for this page, or null when absent.", "jsonSchema": { "type": [ "integer", "null" ], "description": "The Zotero library version returned for this page, or null when absent." }, "nullable": true, "handle": "libraryVersion" } ], "name": "Read collection items", "executor": { "kind": "connector", "action": "zotero.list_items" } } }, "n_7497e0217f62f9b0": { "name": "Collection items", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "items" } ], "outputMappings": { "items": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_91d9f46c98360c01", "output": "items" } ] } } } }, "edges": [ { "source": "n_73d6d88676aeab55", "target": "n_91d9f46c98360c01" }, { "source": "n_91d9f46c98360c01", "target": "n_b542a366cc3cb2c4" }, { "source": "n_b542a366cc3cb2c4", "target": "n_c5dac371deca3afd", "sourceHandle": "read" }, { "source": "n_c5dac371deca3afd", "target": "n_91d9f46c98360c01" }, { "source": "n_b542a366cc3cb2c4", "target": "n_7497e0217f62f9b0", "sourceHandle": "otherwise" } ] } }, "modules": { "n_8ac92395d73cbac0": { "name": "Collect collection pages", "imports": [], "source": "export default function collect({previousState,items,nextStart,totalResults}){\n const p=previousState??{start:0,pages:0,items:[]};\n if(p.pages===0&&items==null)return {state:{...p,pages:-1},more:true,start:0,items:[]};\n if(!Array.isArray(items)||!Number.isInteger(totalResults)||totalResults<0)throw Error('Invalid Zotero page');\n const rows=[...p.items,...items];if(rows.length>10000)throw Error('Zotero collection exceeds 10,000 items');\n if(nextStart!=null&&(!Number.isInteger(nextStart)||nextStart<=p.start||p.pages>=98))throw Error('Invalid or excessive Zotero pagination');\n const projected=rows.map(x=>{if(!x||typeof x.key!=='string'||!x.key)throw Error('Missing Zotero item key');return{key:x.key,title:typeof x.data?.title==='string'?x.data.title:'',creatorSummary:typeof x.meta?.creatorSummary==='string'?x.meta.creatorSummary:''}});\n return {state:{start:nextStart??p.start,pages:p.pages+1,items:rows},more:nextStart!=null,start:nextStart??0,items:projected};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }