5726f6cd3de3f06bdf28d37477c794328fb11a7d
[motion2.git] / server / api / dashboardItem / dashboardItem.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x696e=['client','http','redis','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1c8abc,_0x4e4fdb){var _0x4beee5=function(_0x1158d4){while(--_0x1158d4){_0x1c8abc['push'](_0x1c8abc['shift']());}};_0x4beee5(++_0x4e4fdb);}(_0x696e,0x1a6));var _0xe696=function(_0x3c9dad,_0x361159){_0x3c9dad=_0x3c9dad-0x0;var _0x26ebd3=_0x696e[_0x3c9dad];return _0x26ebd3;};'use strict';var _=require('lodash');var util=require(_0xe696('0x0'));var moment=require(_0xe696('0x1'));var BPromise=require(_0xe696('0x2'));var rs=require(_0xe696('0x3'));var fs=require('fs');var Redis=require(_0xe696('0x4'));var db=require(_0xe696('0x5'))['db'];var utils=require(_0xe696('0x6'));var logger=require('../../config/logger')(_0xe696('0x7'));var config=require(_0xe696('0x8'));var jayson=require(_0xe696('0x9'));var client=jayson[_0xe696('0xa')][_0xe696('0xb')]({'port':0x232a});config[_0xe696('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe696('0xc')]));require('./dashboardItem.socket')[_0xe696('0xd')](socket);function respondWithRpcPromise(_0x3a5aac,_0x5cf30c,_0x284dba){return new BPromise(function(_0x30e05b,_0x432c18){return client[_0xe696('0xe')](_0x3a5aac,_0x284dba)[_0xe696('0xf')](function(_0x1c5585){logger['info'](_0xe696('0x10'),_0x5cf30c,_0xe696('0x11'));logger[_0xe696('0x12')](_0xe696('0x13'),_0x5cf30c,_0xe696('0x11'),JSON[_0xe696('0x14')](_0x1c5585));if(_0x1c5585[_0xe696('0x15')]){if(_0x1c5585[_0xe696('0x15')][_0xe696('0x16')]===0x1f4){logger[_0xe696('0x15')](_0xe696('0x10'),_0x5cf30c,_0x1c5585[_0xe696('0x15')]['message']);return _0x432c18(_0x1c5585['error'][_0xe696('0x17')]);}logger[_0xe696('0x15')](_0xe696('0x10'),_0x5cf30c,_0x1c5585[_0xe696('0x15')][_0xe696('0x17')]);return _0x30e05b(_0x1c5585['error'][_0xe696('0x17')]);}else{logger[_0xe696('0x18')](_0xe696('0x10'),_0x5cf30c,_0xe696('0x11'));_0x30e05b(_0x1c5585[_0xe696('0x19')][_0xe696('0x17')]);}})[_0xe696('0x1a')](function(_0x2fd56e){logger['error']('DashboardItem,\x20%s,\x20%s',_0x5cf30c,_0x2fd56e);_0x432c18(_0x2fd56e);});});}