{ "kind": "open-flow-workflow", "version": 1, "name": "Affinity Organization Creator", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_2d84c151a38f5630": { "name": "Enter organization details", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "name" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "domain" } ] }, "n_57c382a6150b25cf": { "inputs": { "name": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2d84c151a38f5630", "output": "name" } ] }, "domain": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2d84c151a38f5630", "output": "domain" } ] } }, "name": "Prepare Affinity organization", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "name" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "domain" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "body" } ], "name": "Prepare Affinity organization", "moduleId": "n_309b8fc378ba5e89", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_38a9390b8fd6eeec": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_57c382a6150b25cf", "output": "endpoint" } ] }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_57c382a6150b25cf", "output": "body" } ] } }, "name": "Create Affinity organization", "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 Affinity organization", "executor": { "providerId": "affinity", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } }, "n_238d64a5d6954bc6": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_38a9390b8fd6eeec", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_38a9390b8fd6eeec", "output": "statusCode" } ] }, "bodyEncoding": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_38a9390b8fd6eeec", "output": "bodyEncoding" } ] } }, "name": "Confirm created organization", "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": "organization" } ], "name": "Confirm created organization", "moduleId": "n_b565475c562a4673", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_f7f2eec9e0ee18d3": { "name": "Created organization record", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer", "minimum": 1 }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": true }, "nullable": false, "handle": "organization" } ], "outputMappings": { "organization": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_238d64a5d6954bc6", "output": "organization" } ] } } } }, "edges": [ { "source": "n_2d84c151a38f5630", "target": "n_57c382a6150b25cf" }, { "source": "n_57c382a6150b25cf", "target": "n_38a9390b8fd6eeec" }, { "source": "n_38a9390b8fd6eeec", "target": "n_238d64a5d6954bc6" }, { "source": "n_238d64a5d6954bc6", "target": "n_f7f2eec9e0ee18d3" } ] } }, "modules": { "n_309b8fc378ba5e89": { "name": "Prepare Affinity organization", "imports": [], "source": "export default function organizationRequest({ name, domain }) {\n if (typeof name !== 'string' || !name || typeof domain !== 'string' || !domain) throw new Error('Configure the organization name and domain');\n return { endpoint: '/organizations', body: { name, domain } };\n}\n" }, "n_b565475c562a4673": { "name": "Confirm created organization", "imports": [], "source": "export default function organizationResult({ body, statusCode, bodyEncoding }) {\n if (![200, 201].includes(statusCode)) throw new Error('Affinity did not return a completed organization creation response');\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('Affinity returned an invalid organization record');\n return { organization: body };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }