Built motion from commit b7e79837.|2.6.29
[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 _0xfc47=['client','redis','./dashboardItem.socket','register','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x30932b,_0xe42956){var _0x471379=function(_0x4047b6){while(--_0x4047b6){_0x30932b['push'](_0x30932b['shift']());}};_0x471379(++_0xe42956);}(_0xfc47,0x12f));var _0x7fc4=function(_0x3c083b,_0x549e68){_0x3c083b=_0x3c083b-0x0;var _0x1c4f50=_0xfc47[_0x3c083b];return _0x1c4f50;};'use strict';var _=require(_0x7fc4('0x0'));var util=require('util');var moment=require(_0x7fc4('0x1'));var BPromise=require(_0x7fc4('0x2'));var rs=require(_0x7fc4('0x3'));var fs=require('fs');var Redis=require(_0x7fc4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7fc4('0x5'));var logger=require(_0x7fc4('0x6'))('rpc');var config=require(_0x7fc4('0x7'));var jayson=require(_0x7fc4('0x8'));var client=jayson[_0x7fc4('0x9')]['http']({'port':0x232a});config[_0x7fc4('0xa')]=_['defaults'](config[_0x7fc4('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fc4('0xa')]));require(_0x7fc4('0xb'))[_0x7fc4('0xc')](socket);function respondWithRpcPromise(_0x4ed2c4,_0x56fc5b,_0x2514bf){return new BPromise(function(_0x332b25,_0x4f474f){return client[_0x7fc4('0xd')](_0x4ed2c4,_0x2514bf)['then'](function(_0x187ad5){logger[_0x7fc4('0xe')]('DashboardItem,\x20%s,\x20%s',_0x56fc5b,'request\x20sent');logger[_0x7fc4('0xf')](_0x7fc4('0x10'),_0x56fc5b,_0x7fc4('0x11'),JSON[_0x7fc4('0x12')](_0x187ad5));if(_0x187ad5[_0x7fc4('0x13')]){if(_0x187ad5['error'][_0x7fc4('0x14')]===0x1f4){logger[_0x7fc4('0x13')](_0x7fc4('0x15'),_0x56fc5b,_0x187ad5[_0x7fc4('0x13')][_0x7fc4('0x16')]);return _0x4f474f(_0x187ad5[_0x7fc4('0x13')][_0x7fc4('0x16')]);}logger[_0x7fc4('0x13')](_0x7fc4('0x15'),_0x56fc5b,_0x187ad5['error'][_0x7fc4('0x16')]);return _0x332b25(_0x187ad5[_0x7fc4('0x13')][_0x7fc4('0x16')]);}else{logger['info'](_0x7fc4('0x15'),_0x56fc5b,_0x7fc4('0x11'));_0x332b25(_0x187ad5['result'][_0x7fc4('0x16')]);}})[_0x7fc4('0x17')](function(_0x2a7707){logger[_0x7fc4('0x13')]('DashboardItem,\x20%s,\x20%s',_0x56fc5b,_0x2a7707);_0x4f474f(_0x2a7707);});});}