e7f4ec777189959ffd5ae6910e0e55472a428628
[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 _0x5285=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x2383ad,_0x1e8690){var _0x33f526=function(_0x3a75c2){while(--_0x3a75c2){_0x2383ad['push'](_0x2383ad['shift']());}};_0x33f526(++_0x1e8690);}(_0x5285,0x74));var _0x5528=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x5285[_0x55d58f];return _0x1ad6e6;};'use strict';var _=require(_0x5528('0x0'));var util=require('util');var moment=require(_0x5528('0x1'));var BPromise=require(_0x5528('0x2'));var rs=require(_0x5528('0x3'));var fs=require('fs');var Redis=require(_0x5528('0x4'));var db=require(_0x5528('0x5'))['db'];var utils=require(_0x5528('0x6'));var logger=require(_0x5528('0x7'))(_0x5528('0x8'));var config=require(_0x5528('0x9'));var jayson=require(_0x5528('0xa'));var client=jayson[_0x5528('0xb')][_0x5528('0xc')]({'port':0x232a});config[_0x5528('0xd')]=_['defaults'](config[_0x5528('0xd')],{'host':_0x5528('0xe'),'port':0x18eb});var socket=require(_0x5528('0xf'))(new Redis(config['redis']));require(_0x5528('0x10'))['register'](socket);function respondWithRpcPromise(_0x321676,_0x3f009f,_0x5ec5c0){return new BPromise(function(_0x1a7b8d,_0x9fc9b0){return client[_0x5528('0x11')](_0x321676,_0x5ec5c0)[_0x5528('0x12')](function(_0x4c1e32){logger['info'](_0x5528('0x13'),_0x3f009f,_0x5528('0x14'));logger[_0x5528('0x15')](_0x5528('0x16'),_0x3f009f,_0x5528('0x14'),JSON[_0x5528('0x17')](_0x4c1e32));if(_0x4c1e32[_0x5528('0x18')]){if(_0x4c1e32[_0x5528('0x18')][_0x5528('0x19')]===0x1f4){logger['error'](_0x5528('0x13'),_0x3f009f,_0x4c1e32[_0x5528('0x18')]['message']);return _0x9fc9b0(_0x4c1e32['error'][_0x5528('0x1a')]);}logger[_0x5528('0x18')](_0x5528('0x13'),_0x3f009f,_0x4c1e32['error'][_0x5528('0x1a')]);return _0x1a7b8d(_0x4c1e32[_0x5528('0x18')][_0x5528('0x1a')]);}else{logger[_0x5528('0x1b')](_0x5528('0x13'),_0x3f009f,_0x5528('0x14'));_0x1a7b8d(_0x4c1e32['result'][_0x5528('0x1a')]);}})[_0x5528('0x1c')](function(_0x3d9dee){logger[_0x5528('0x18')](_0x5528('0x13'),_0x3f009f,_0x3d9dee);_0x9fc9b0(_0x3d9dee);});});}