-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflows.json
1 lines (1 loc) · 17.4 KB
/
flows.json
1
{"migrations":["1.05","1.03","1.02","2.01","3.01","4.11926f6d.95c3e1","5.11926f6d.95c3e1","6.11926f6d.95c3e1","6.2c9dd332.05334c","6.tabs","7.11926f6d.95c3e1","7.2c9dd332.05334c","7.tabs","8.11926f6d.95c3e1","8.2c9dd332.05334c","8.tabs","9.11926f6d.95c3e1","9.2c9dd332.05334c","9.tabs","10.11926f6d.95c3e1","10.2c9dd332.05334c","10.tabs","11.11926f6d.95c3e1","11.2c9dd332.05334c","11.tabs","12.11926f6d.95c3e1","12.2c9dd332.05334c","12.tabs","13.11926f6d.95c3e1","13.2c9dd332.05334c","13.tabs","14.11926f6d.95c3e1","14.2c9dd332.05334c","14.tabs"],"noderedusers":[{"username":"admin","password":"$2a$10$uS9tRbCPWT1B6wscWz/0e.PCfQR8ukJC2A4ijSwx855RxW.07.7gG","isActive":true,"permissions":"*"},{"username":"admin","password":"$2a$10$W77ndGUQbGu3zSpY.1x2rusiY/amEZ48PsIrmZhJP5xKpf7si5djC","isActive":true,"permissions":"*"}],"noderedstorages":[{"path":"11926f6d.95c3e1","type":"flows","meta":{},"body":[{"id":"f71e4f8.f819fb","type":"http in","z":"11926f6d.95c3e1","name":"events","url":"/events","method":"get","upload":false,"swaggerDoc":"","x":120,"y":217.5,"wires":[["12e2a4a.b20b25b"]]},{"id":"12e2a4a.b20b25b","type":"function","z":"11926f6d.95c3e1","name":"transform params","func":"\nconst factories = global.get('factories');\nconst _ = global.get('_');\n\n\nmsg.payload = _.chain(factories.sm)\n .values()\n .map(value => \n _.chain(value).get('abi')\n .filter({type: 'event'})\n .value()\n )\n .flattenDeep()\n .map(ev=>ev.name)\n .uniq()\n .value();\n\nreturn msg;","outputs":1,"noerr":0,"x":322.500003814697,"y":217.499998092651,"wires":[["c49a5649.c046a8"]]},{"id":"c49a5649.c046a8","type":"http response","z":"11926f6d.95c3e1","name":"","statusCode":"","x":547.500015258789,"y":216.25000333786,"wires":[]},{"id":"5a97720b.d0cc1c","type":"http in","z":"11926f6d.95c3e1","name":"get event","url":"/events/:event","method":"get","upload":false,"swaggerDoc":"","x":135,"y":401.25,"wires":[["b1cd37e5.74a048"]]},{"id":"26896dec.5a53d2","type":"function","z":"11926f6d.95c3e1","name":"transform params","func":"\nmsg.payload = {\n model: msg.req.params.event, \n request: msg.payload.criteria\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":537.5,"y":401.25,"wires":[["5b0b9e21.6451c"]]},{"id":"2858f1ab.675c5e","type":"http response","z":"11926f6d.95c3e1","name":"","statusCode":"","x":956.5,"y":400,"wires":[]},{"id":"b1cd37e5.74a048","type":"query-to-mongo","z":"11926f6d.95c3e1","request_type":"0","name":"query-to-mongo","x":311,"y":402,"wires":[["26896dec.5a53d2"]]},{"id":"5b0b9e21.6451c","type":"mongo","z":"11926f6d.95c3e1","model":"","request":"{}","name":"mongo","mode":"1","requestType":"0","x":757,"y":401,"wires":[["2858f1ab.675c5e"]]},{"id":"5410ef0.54afe1","type":"http response","z":"11926f6d.95c3e1","name":"","statusCode":"","x":777,"y":592,"wires":[]},{"id":"555b9a3a.231ad4","type":"function","z":"11926f6d.95c3e1","name":"transform","func":"\nlet factories = global.get(\"factories\"); \n\nlet error = msg.error.message;\ntry {\n error = JSON.parse(error);\n}catch(e){}\n\nmsg.payload = error;\n\n\nmsg.payload = factories.messages.generic.fail;\n\nif (msg.statusCode == '401')\n msg.payload = factories.messages.generic.failAuth;\nif (msg.error._error)\n msg.payload = msg.error._error;\n\nreturn msg;","outputs":1,"noerr":0,"x":561,"y":591,"wires":[["5410ef0.54afe1"]]},{"id":"8823b89d.26e0f8","type":"http in","z":"11926f6d.95c3e1","name":"","url":"/secret","method":"get","upload":false,"swaggerDoc":"","x":130,"y":120,"wires":[["24d020ef.619d2"]]},{"id":"8373b105.48b5d","type":"function","z":"11926f6d.95c3e1","name":"","func":"msg.payload = msg.addresses;\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":120,"wires":[["94e2ed5d.3216e","eeca077d.32cfa8"]]},{"id":"24d020ef.619d2","type":"laborx_auth","z":"11926f6d.95c3e1","name":"laborx_auth","configprovider":"1","providerpath":"http://localhost:3001","x":310,"y":120,"wires":[["8373b105.48b5d","eeca077d.32cfa8"]]},{"id":"94e2ed5d.3216e","type":"http response","z":"11926f6d.95c3e1","name":"","statusCode":"","headers":{},"x":650,"y":120,"wires":[]},{"id":"24961ab5.8f5146","type":"catch","z":"11926f6d.95c3e1","name":"","scope":null,"x":320,"y":600,"wires":[["555b9a3a.231ad4"]]},{"id":"eeca077d.32cfa8","type":"debug","z":"11926f6d.95c3e1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":790,"y":180,"wires":[]}]},{"path":"2c9dd332.05334c","type":"flows","meta":{},"body":[{"id":"8910ae06.71de7","type":"amqp out","z":"2c9dd332.05334c","name":"","topic":"","iotype":"4","ioname":"sender","server":"","servermode":"1","x":570,"y":260,"wires":[]},{"id":"10b747ac.8c6a08","type":"amqp in","z":"2c9dd332.05334c","name":"","topic":"","iotype":"4","ioname":"receiver","noack":"0","durablequeue":"0","durableexchange":"0","server":"","servermode":"1","x":945,"y":254,"wires":[["54529b69.d24544"]]},{"id":"54529b69.d24544","type":"debug","z":"2c9dd332.05334c","name":"","active":true,"console":"fasle","complete":"false","x":1230,"y":258,"wires":[]},{"id":"5a35929d.0a716c","type":"http in","z":"2c9dd332.05334c","name":"create addr","url":"/addr","method":"post","upload":false,"swaggerDoc":"","x":150,"y":180,"wires":[["6d052eef.a0912"]]},{"id":"e4822e75.693fd","type":"http response","z":"2c9dd332.05334c","name":"","statusCode":"","x":1350,"y":180,"wires":[]},{"id":"27b27b8e.9827a4","type":"mongo","z":"2c9dd332.05334c","model":"TestAccount","request":"{}","name":"mongo create addr","mode":"1","requestType":"1","x":650,"y":180,"wires":[["8ab75856.970bb8"]]},{"id":"8ab75856.970bb8","type":"function","z":"2c9dd332.05334c","name":"transform output","func":"\nlet factories = global.get(\"factories\"); \n\nif(msg.payload.error){\n msg.payload = msg.payload.error.code === 11000 ? \n factories.messages.address.existAddress :\n factories.messages.generic.fail;\n return msg;\n}\n \n \nmsg.payload = factories.messages.generic.success;\nreturn msg;","outputs":1,"noerr":0,"x":1115,"y":183,"wires":[["e4822e75.693fd"]]},{"id":"6d052eef.a0912","type":"function","z":"2c9dd332.05334c","name":"transform params","func":"\nconst _ = global.get('_');\n\nlet erc20token = _.chain(msg.payload.erc20tokens)\n .transform((acc, addr) => {\n acc[addr.toLowerCase()] = 0;\n }, {})\n .value();\n\n\nmsg.payload = {\n model: 'EthAccount', \n request: {\n address: msg.payload.address.toLowerCase(),\n erc20token: erc20token,\n nem: msg.payload.nem\n }\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":180,"wires":[["27b27b8e.9827a4","8910ae06.71de7"]]},{"id":"65927d71.4e8c44","type":"http in","z":"2c9dd332.05334c","name":"remove addr","url":"/addr","method":"delete","upload":false,"swaggerDoc":"","x":150,"y":340,"wires":[["316484c0.63001c"]]},{"id":"d0426981.27e8a8","type":"http response","z":"2c9dd332.05334c","name":"","statusCode":"","x":1050,"y":340,"wires":[]},{"id":"7c68e0a0.c140d","type":"mongo","z":"2c9dd332.05334c","model":"TestAccount","request":"{}","name":"mongo","mode":"1","requestType":"3","x":610,"y":340,"wires":[["cdd0bdcd.24b59"]]},{"id":"cdd0bdcd.24b59","type":"function","z":"2c9dd332.05334c","name":"transform output","func":"\nlet factories = global.get(\"factories\"); \n\nif(msg.payload.error){\n msg.payload = factories.messages.generic.fail;\n return msg;\n}\n \n \nmsg.payload = factories.messages.generic.success;\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":340,"wires":[["d0426981.27e8a8"]]},{"id":"316484c0.63001c","type":"function","z":"2c9dd332.05334c","name":"transform params","func":"\nmsg.payload = {\n model: 'TestAccount', \n request: {\n address: msg.payload.address.toLowerCase()\n }\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":340,"wires":[["7c68e0a0.c140d"]]},{"id":"564cd86a.7d34d8","type":"http in","z":"2c9dd332.05334c","name":"add erc20","url":"/addr/:addr/token","method":"post","upload":false,"swaggerDoc":"","x":60,"y":500,"wires":[["4ce9b6d1.fbf3f8","57d1ce3.87e913"]]},{"id":"d8755eab.f3e54","type":"http response","z":"2c9dd332.05334c","name":"","statusCode":"","x":1411,"y":500,"wires":[]},{"id":"aa22bc0a.a85cf","type":"mongo","z":"2c9dd332.05334c","model":"TestAccount","request":"{}","name":"mongo","mode":"1","requestType":"2","x":1045,"y":464,"wires":[["48b8b6ef.8ac958"]]},{"id":"48b8b6ef.8ac958","type":"function","z":"2c9dd332.05334c","name":"transform output","func":"\nlet factories = global.get(\"factories\"); \n\nif(msg.payload.error){\n msg.payload = factories.messages.generic.fail;\n return msg;\n}\n \n \nmsg.payload = factories.messages.generic.success;\nreturn msg;","outputs":1,"noerr":0,"x":1223,"y":464,"wires":[["d8755eab.f3e54"]]},{"id":"4ce9b6d1.fbf3f8","type":"function","z":"2c9dd332.05334c","name":"transform params","func":"\n\nmsg.payload = {\n model: 'TestAccount', \n request: {\n address: msg.req.params.addr\n }\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":259,"y":444,"wires":[["3a688a79.929cb6"]]},{"id":"e164e510.1bd768","type":"join","z":"2c9dd332.05334c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","x":584,"y":498,"wires":[["788b81cd.854b9"]]},{"id":"3a688a79.929cb6","type":"mongo","z":"2c9dd332.05334c","model":"TestAccount","request":"{}","name":"mongo","mode":"1","requestType":"0","x":465,"y":444,"wires":[["e164e510.1bd768"]]},{"id":"57d1ce3.87e913","type":"function","z":"2c9dd332.05334c","name":"query","func":"\n\nmsg.payload = [{\n address: msg.req.params.addr,\n erc20tokens: msg.payload.erc20tokens\n}];\n\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":501,"wires":[["e164e510.1bd768"]]},{"id":"3b167e6c.86e5e2","type":"function","z":"2c9dd332.05334c","name":"","func":"\nlet _ = global.get('_');\n\nlet user = msg.payload[1][0];\nlet query = msg.payload[0][0];\n\n const toAdd = _.chain(query.erc20tokens)\n .map(addr=>addr.toLowerCase())\n .reject(val => _.has(user.erc20token, val))\n .transform((acc, addr) => {\n acc[`erc20token.${addr}`] = 0;\n }, {})\n .value();\n\n\nmsg.payload = {\n model: 'EthAccount', \n request: [{address: user.address}, {$set: toAdd}]\n \n};\n\nreturn msg;","outputs":1,"noerr":0,"x":897,"y":465,"wires":[["aa22bc0a.a85cf"]]},{"id":"788b81cd.854b9","type":"switch","z":"2c9dd332.05334c","name":"","property":"payload[1][0]","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","outputs":2,"x":739,"y":499,"wires":[["3b167e6c.86e5e2"],["fb5fada6.0738e"]]},{"id":"fb5fada6.0738e","type":"function","z":"2c9dd332.05334c","name":"transform output","func":"\nlet factories = global.get(\"factories\"); \n\n \nmsg.payload = factories.messages.generic.fail;\nreturn msg;","outputs":1,"noerr":0,"x":1147,"y":608,"wires":[["d8755eab.f3e54"]]},{"id":"ab703d2f.3a52f","type":"http in","z":"2c9dd332.05334c","name":"remove erc20","url":"/addr/:addr/token","method":"delete","upload":false,"swaggerDoc":"","x":75,"y":922.5,"wires":[["7b1a621c.9f0d5c","96bcd2ae.c0006"]]},{"id":"6738b594.b1247c","type":"http response","z":"2c9dd332.05334c","name":"","statusCode":"","x":1416,"y":922.5,"wires":[]},{"id":"89650827.b33e98","type":"mongo","z":"2c9dd332.05334c","model":"TestAccount","request":"{}","name":"mongo","mode":"1","requestType":"2","x":1050,"y":886.5,"wires":[["15bc7bed.f70844"]]},{"id":"15bc7bed.f70844","type":"function","z":"2c9dd332.05334c","name":"transform output","func":"\nlet factories = global.get(\"factories\"); \n\nif(msg.payload.error){\n msg.payload = factories.messages.generic.fail;\n return msg;\n}\n \n \nmsg.payload = factories.messages.generic.success;\nreturn msg;","outputs":1,"noerr":0,"x":1228,"y":886.5,"wires":[["6738b594.b1247c"]]},{"id":"7b1a621c.9f0d5c","type":"function","z":"2c9dd332.05334c","name":"transform params","func":"\nmsg.payload = {\n model: 'TestAccount', \n request: {\n address: msg.req.params.addr\n }\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":264,"y":866.5,"wires":[["67c7ccc.0094834"]]},{"id":"191feca2.b31993","type":"join","z":"2c9dd332.05334c","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","x":589,"y":920.5,"wires":[["70c0d489.250b1c"]]},{"id":"67c7ccc.0094834","type":"mongo","z":"2c9dd332.05334c","model":"TestAccount","request":"{}","name":"mongo","mode":"1","requestType":"0","x":470,"y":866.5,"wires":[["191feca2.b31993"]]},{"id":"96bcd2ae.c0006","type":"function","z":"2c9dd332.05334c","name":"query","func":"\n\nmsg.payload = [{\n address: msg.req.params.addr,\n erc20tokens: msg.payload.erc20tokens\n}];\n\nreturn msg;","outputs":1,"noerr":0,"x":335,"y":923.5,"wires":[["191feca2.b31993"]]},{"id":"3a6a58b4.444e28","type":"function","z":"2c9dd332.05334c","name":"","func":"\nlet _ = global.get('_');\n\nlet user = msg.payload[1][0];\nlet query = msg.payload[0][0];\n\n const toRemove = _.chain(query.erc20tokens)\n .map(addr=>addr.toLowerCase())\n .filter(val => _.has(user.erc20token, val))\n .transform((acc, addr) => {\n acc[`erc20token.${addr}`] = 1;\n }, {})\n .value();\n\n\nmsg.payload = {\n model: 'EthAccount', \n request: [{address: user.address}, {$unset: toRemove}]\n \n};\n\nreturn msg;","outputs":1,"noerr":0,"x":902,"y":887.5,"wires":[["89650827.b33e98"]]},{"id":"70c0d489.250b1c","type":"switch","z":"2c9dd332.05334c","name":"","property":"payload[1][0]","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","outputs":2,"x":744,"y":921.5,"wires":[["3a6a58b4.444e28"],["3e8c8bed.c94f44"]]},{"id":"3e8c8bed.c94f44","type":"function","z":"2c9dd332.05334c","name":"transform output","func":"\nlet factories = global.get(\"factories\"); \n\n \nmsg.payload = factories.messages.generic.fail;\nreturn msg;","outputs":1,"noerr":0,"x":1152,"y":1030.5,"wires":[["6738b594.b1247c"]]},{"id":"468de3dc.eb162c","type":"http in","z":"2c9dd332.05334c","name":"balance","url":"/addr/:addr/balance","method":"get","upload":false,"swaggerDoc":"","x":126.250003814697,"y":1343.75002098084,"wires":[["6731d0f7.68fb4"]]},{"id":"6731d0f7.68fb4","type":"function","z":"2c9dd332.05334c","name":"transform params","func":"\nmsg.payload = {\n model: 'EthAccount', \n request: {\n address: msg.req.params.addr\n }\n};\n\nreturn msg;","outputs":1,"noerr":0,"x":328.750007629395,"y":1343.75001907349,"wires":[["a66b89d5.08b868"]]},{"id":"a66b89d5.08b868","type":"mongo","z":"2c9dd332.05334c","model":"TestAccount","request":"{}","name":"mongo","mode":"1","requestType":"0","x":518.750007629395,"y":1345.00002002716,"wires":[["36a27ede.06cd52"]]},{"id":"36a27ede.06cd52","type":"function","z":"2c9dd332.05334c","name":"transform output","func":"\nconst _ = global.get('_');\n\nmsg.payload = {\n balance: _.get(msg.payload, '0.balance', 0),\n erc20token: _.get(msg.payload, '0.erc20token', {})\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":712.500011444092,"y":1345.00002002716,"wires":[["6e227f25.b210e"]]},{"id":"6e227f25.b210e","type":"http response","z":"2c9dd332.05334c","name":"","statusCode":"","x":947.500011444092,"y":1343.75002002716,"wires":[]},{"id":"e859d127.685df","type":"catch","z":"2c9dd332.05334c","name":"","scope":["564cd86a.7d34d8","468de3dc.eb162c","edc524a.f0b1ed8","5a35929d.0a716c","3a6a58b4.444e28","3b167e6c.86e5e2","d0426981.27e8a8","2e2f80ee.29994","e4822e75.693fd","6e227f25.b210e","6738b594.b1247c","d8755eab.f3e54","e164e510.1bd768","191feca2.b31993","aa22bc0a.a85cf","3a688a79.929cb6","7c68e0a0.c140d","67c7ccc.0094834","a66b89d5.08b868","89650827.b33e98","232cf783.a96748","dee6708f.9e557","b09ea136.52855","96bcd2ae.c0006","57d1ce3.87e913","65927d71.4e8c44","ab703d2f.3a52f","788b81cd.854b9","70c0d489.250b1c","d47923c.db3aae","cdd0bdcd.24b59","fb5fada6.0738e","36a27ede.06cd52","15bc7bed.f70844","3e8c8bed.c94f44","8ab75856.970bb8","48b8b6ef.8ac958","7b1a621c.9f0d5c","6d052eef.a0912","4ce9b6d1.fbf3f8","316484c0.63001c","6731d0f7.68fb4"],"x":137,"y":1612,"wires":[["d47923c.db3aae"]]},{"id":"2e2f80ee.29994","type":"http response","z":"2c9dd332.05334c","name":"","statusCode":"","x":594,"y":1613,"wires":[]},{"id":"d47923c.db3aae","type":"function","z":"2c9dd332.05334c","name":"transform","func":"\nlet factories = global.get(\"factories\"); \nlet error = msg.error.message;\ntry {\n error = JSON.parse(error);\n}catch(e){}\n\nmsg.payload = error;\n\nmsg.payload = msg.payload.error.code === 11000 ? \n factories.messages.address.existAddress :\n factories.messages.generic.fail;\n\n\n \nreturn msg;","outputs":1,"noerr":0,"x":378,"y":1612,"wires":[["2e2f80ee.29994"]]},{"id":"edc524a.f0b1ed8","type":"catch","z":"2c9dd332.05334c","name":"","scope":["27b27b8e.9827a4"],"x":460,"y":80,"wires":[["46a7901e.31b49"]]},{"id":"46a7901e.31b49","type":"function","z":"2c9dd332.05334c","name":"transform","func":"\nlet factories = global.get(\"factories\"); \nlet error = msg.error.message;\ntry {\n error = JSON.parse(error);\n}catch(e){}\n\nif(error.code !== 11000)\nthrow new Error();\n\nmsg.payload = {\n model: 'EthAccount', \n request: [\n {address: msg.payload.request.address}, \n {$set:{ nem: msg.payload.request.nem}}\n ]\n \n};\n\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":80,"wires":[["8eb922da.30d21"]]},{"id":"8eb922da.30d21","type":"mongo","z":"2c9dd332.05334c","model":"TestAccount","request":"{}","name":"mongo","mode":"1","requestType":"2","x":870,"y":80,"wires":[["8ab75856.970bb8"]]}]},{"path":"tabs","type":"flows","meta":{},"body":[{"id":"2c9dd332.05334c","type":"tab","label":"address","disabled":false,"info":""},{"id":"11926f6d.95c3e1","type":"tab","label":"events","disabled":false,"info":""}]}]}