{ "kind": "open-flow-workflow", "version": 1, "name": "Harvest Client Creator", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_52921a029e99c3e8": { "name": "Start client creation", "kind": "start", "inputDefs": [] }, "n_8f7103fcc065f430": { "inputs": { "name": { "kind": "value", "value": "YOUR_CLIENT_NAME" } }, "name": "Set client name", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "name" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "body" } ], "name": "Set client name", "moduleId": "n_504ebc26e49a45bb", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_97942c9cef95dff2": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_8f7103fcc065f430", "output": "endpoint" } ] }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_8f7103fcc065f430", "output": "body" } ] } }, "name": "Create Harvest client", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "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": "Create Harvest client", "executor": { "providerId": "harvest", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } }, "n_75975e37692ca3f8": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_97942c9cef95dff2", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_97942c9cef95dff2", "output": "statusCode" } ] }, "bodyEncoding": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_97942c9cef95dff2", "output": "bodyEncoding" } ] } }, "name": "Confirm client creation", "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": "object", "properties": { "id": { "type": "integer", "minimum": 1 }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": true }, "nullable": false, "handle": "client" } ], "name": "Confirm client creation", "moduleId": "n_b1b43aa59c466505", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_9010fd57e6c0460e": { "name": "Created client", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "minimum": 1 }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": true }, "nullable": false, "handle": "client" } ], "outputMappings": { "client": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_75975e37692ca3f8", "output": "client" } ] } } } }, "edges": [ { "source": "n_52921a029e99c3e8", "target": "n_8f7103fcc065f430" }, { "source": "n_8f7103fcc065f430", "target": "n_97942c9cef95dff2" }, { "source": "n_97942c9cef95dff2", "target": "n_75975e37692ca3f8" }, { "source": "n_75975e37692ca3f8", "target": "n_9010fd57e6c0460e" } ] } }, "modules": { "n_504ebc26e49a45bb": { "name": "Set client name", "imports": [], "source": "export default function clientRequest({ name }) {\n if (typeof name !== 'string' || !name.trim()) throw new Error('Configure a nonempty client name');\n return { endpoint: '/v2/clients', body: { name } };\n}\n" }, "n_b1b43aa59c466505": { "name": "Confirm client creation", "imports": [], "source": "export default function clientResult({ body, statusCode, bodyEncoding }) {\n if (statusCode !== 201) throw new Error('Harvest did not confirm client creation with HTTP 201');\n if (bodyEncoding != null || !body || typeof body !== 'object' || Array.isArray(body) || !Number.isSafeInteger(body.id) || body.id <= 0 || typeof body.name !== 'string') throw new Error('Harvest returned an invalid client record');\n return { client: body };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }