b3f047dfe2a140a9ed7fa7e3c8cc0a86f139e2f0
[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 _0x3515=['defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x37dbe8,_0x10e968){var _0x2416b6=function(_0xd39957){while(--_0xd39957){_0x37dbe8['push'](_0x37dbe8['shift']());}};_0x2416b6(++_0x10e968);}(_0x3515,0x1e2));var _0x5351=function(_0x1c1bee,_0x27451f){_0x1c1bee=_0x1c1bee-0x0;var _0x3ed968=_0x3515[_0x1c1bee];return _0x3ed968;};'use strict';var _=require(_0x5351('0x0'));var util=require(_0x5351('0x1'));var moment=require(_0x5351('0x2'));var BPromise=require(_0x5351('0x3'));var rs=require(_0x5351('0x4'));var fs=require('fs');var Redis=require(_0x5351('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5351('0x6'));var logger=require(_0x5351('0x7'))(_0x5351('0x8'));var config=require(_0x5351('0x9'));var jayson=require(_0x5351('0xa'));var client=jayson[_0x5351('0xb')][_0x5351('0xc')]({'port':0x232a});config[_0x5351('0xd')]=_[_0x5351('0xe')](config[_0x5351('0xd')],{'host':_0x5351('0xf'),'port':0x18eb});var socket=require(_0x5351('0x10'))(new Redis(config[_0x5351('0xd')]));require(_0x5351('0x11'))[_0x5351('0x12')](socket);function respondWithRpcPromise(_0x48c4a1,_0x4b13e1,_0x380735){return new BPromise(function(_0x34904d,_0x2c657f){return client[_0x5351('0x13')](_0x48c4a1,_0x380735)[_0x5351('0x14')](function(_0xec7377){logger[_0x5351('0x15')]('DashboardItem,\x20%s,\x20%s',_0x4b13e1,_0x5351('0x16'));logger[_0x5351('0x17')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4b13e1,'request\x20sent',JSON[_0x5351('0x18')](_0xec7377));if(_0xec7377[_0x5351('0x19')]){if(_0xec7377['error'][_0x5351('0x1a')]===0x1f4){logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0xec7377['error'][_0x5351('0x1c')]);return _0x2c657f(_0xec7377['error'][_0x5351('0x1c')]);}logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0xec7377[_0x5351('0x19')][_0x5351('0x1c')]);return _0x34904d(_0xec7377[_0x5351('0x19')]['message']);}else{logger[_0x5351('0x15')](_0x5351('0x1b'),_0x4b13e1,_0x5351('0x16'));_0x34904d(_0xec7377[_0x5351('0x1d')][_0x5351('0x1c')]);}})[_0x5351('0x1e')](function(_0x64fdb8){logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0x64fdb8);_0x2c657f(_0x64fdb8);});});}