Built motion from commit fe909640.|2.6.8
[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 _0x1725=['rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x153bbd,_0x2bdeaa){var _0x15176b=function(_0x1ebd9d){while(--_0x1ebd9d){_0x153bbd['push'](_0x153bbd['shift']());}};_0x15176b(++_0x2bdeaa);}(_0x1725,0xf5));var _0x5172=function(_0x1e57dc,_0x646ed7){_0x1e57dc=_0x1e57dc-0x0;var _0x3f78ff=_0x1725[_0x1e57dc];return _0x3f78ff;};'use strict';var _=require(_0x5172('0x0'));var util=require(_0x5172('0x1'));var moment=require(_0x5172('0x2'));var BPromise=require(_0x5172('0x3'));var rs=require(_0x5172('0x4'));var fs=require('fs');var Redis=require(_0x5172('0x5'));var db=require(_0x5172('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5172('0x7'))(_0x5172('0x8'));var config=require(_0x5172('0x9'));var jayson=require(_0x5172('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x5172('0xb')]=_['defaults'](config[_0x5172('0xb')],{'host':_0x5172('0xc'),'port':0x18eb});var socket=require(_0x5172('0xd'))(new Redis(config[_0x5172('0xb')]));require(_0x5172('0xe'))[_0x5172('0xf')](socket);function respondWithRpcPromise(_0x390c4b,_0x30c218,_0x312231){return new BPromise(function(_0x2bac6a,_0x2c126a){return client['request'](_0x390c4b,_0x312231)['then'](function(_0x4f568b){logger['info'](_0x5172('0x10'),_0x30c218,_0x5172('0x11'));logger[_0x5172('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x30c218,_0x5172('0x11'),JSON[_0x5172('0x13')](_0x4f568b));if(_0x4f568b[_0x5172('0x14')]){if(_0x4f568b[_0x5172('0x14')]['code']===0x1f4){logger[_0x5172('0x14')](_0x5172('0x10'),_0x30c218,_0x4f568b['error'][_0x5172('0x15')]);return _0x2c126a(_0x4f568b[_0x5172('0x14')][_0x5172('0x15')]);}logger[_0x5172('0x14')](_0x5172('0x10'),_0x30c218,_0x4f568b[_0x5172('0x14')][_0x5172('0x15')]);return _0x2bac6a(_0x4f568b['error'][_0x5172('0x15')]);}else{logger['info'](_0x5172('0x10'),_0x30c218,_0x5172('0x11'));_0x2bac6a(_0x4f568b['result'][_0x5172('0x15')]);}})[_0x5172('0x16')](function(_0x45f3f5){logger[_0x5172('0x14')](_0x5172('0x10'),_0x30c218,_0x45f3f5);_0x2c126a(_0x45f3f5);});});}