ff55bae85ecf6ffdf0ec8b4a34a791d1b567fb5d
[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 _0x5370=['../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x56d2c3,_0x507ad0){var _0x4783d9=function(_0x5e9dc0){while(--_0x5e9dc0){_0x56d2c3['push'](_0x56d2c3['shift']());}};_0x4783d9(++_0x507ad0);}(_0x5370,0x1dd));var _0x0537=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5370[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0537('0x0'));var util=require(_0x0537('0x1'));var moment=require(_0x0537('0x2'));var BPromise=require(_0x0537('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0537('0x4'));var db=require(_0x0537('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0537('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0537('0x7'));var client=jayson[_0x0537('0x8')][_0x0537('0x9')]({'port':0x232a});config[_0x0537('0xa')]=_['defaults'](config[_0x0537('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0537('0xb'))(new Redis(config['redis']));require(_0x0537('0xc'))[_0x0537('0xd')](socket);function respondWithRpcPromise(_0x7b9b10,_0x4f2ac2,_0x3ff3df){return new BPromise(function(_0x403054,_0x1f7a03){return client[_0x0537('0xe')](_0x7b9b10,_0x3ff3df)[_0x0537('0xf')](function(_0xe1aeb2){logger[_0x0537('0x10')](_0x0537('0x11'),_0x4f2ac2,_0x0537('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4f2ac2,_0x0537('0x12'),JSON[_0x0537('0x13')](_0xe1aeb2));if(_0xe1aeb2['error']){if(_0xe1aeb2['error'][_0x0537('0x14')]===0x1f4){logger['error'](_0x0537('0x11'),_0x4f2ac2,_0xe1aeb2['error'][_0x0537('0x15')]);return _0x1f7a03(_0xe1aeb2[_0x0537('0x16')]['message']);}logger[_0x0537('0x16')]('DashboardItem,\x20%s,\x20%s',_0x4f2ac2,_0xe1aeb2[_0x0537('0x16')][_0x0537('0x15')]);return _0x403054(_0xe1aeb2[_0x0537('0x16')][_0x0537('0x15')]);}else{logger[_0x0537('0x10')]('DashboardItem,\x20%s,\x20%s',_0x4f2ac2,'request\x20sent');_0x403054(_0xe1aeb2['result'][_0x0537('0x15')]);}})['catch'](function(_0x41fb62){logger[_0x0537('0x16')](_0x0537('0x11'),_0x4f2ac2,_0x41fb62);_0x1f7a03(_0x41fb62);});});}