f0cfebe54cac5bc99e05953f26b9855c5e01b4b1
[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 _0xf822=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x37d3f3,_0xca010f){var _0x185c9c=function(_0x5e2bf2){while(--_0x5e2bf2){_0x37d3f3['push'](_0x37d3f3['shift']());}};_0x185c9c(++_0xca010f);}(_0xf822,0x199));var _0x2f82=function(_0x2ee206,_0x581e6f){_0x2ee206=_0x2ee206-0x0;var _0x31361e=_0xf822[_0x2ee206];return _0x31361e;};'use strict';var _=require(_0x2f82('0x0'));var util=require(_0x2f82('0x1'));var moment=require(_0x2f82('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f82('0x3'));var db=require(_0x2f82('0x4'))['db'];var utils=require(_0x2f82('0x5'));var logger=require(_0x2f82('0x6'))(_0x2f82('0x7'));var config=require(_0x2f82('0x8'));var jayson=require(_0x2f82('0x9'));var client=jayson[_0x2f82('0xa')][_0x2f82('0xb')]({'port':0x232a});config[_0x2f82('0xc')]=_['defaults'](config[_0x2f82('0xc')],{'host':_0x2f82('0xd'),'port':0x18eb});var socket=require(_0x2f82('0xe'))(new Redis(config[_0x2f82('0xc')]));require('./dashboardItem.socket')[_0x2f82('0xf')](socket);function respondWithRpcPromise(_0x54ccdc,_0x492331,_0x3edb99){return new BPromise(function(_0x163cff,_0x2c2e88){return client['request'](_0x54ccdc,_0x3edb99)[_0x2f82('0x10')](function(_0x2bade3){logger[_0x2f82('0x11')](_0x2f82('0x12'),_0x492331,_0x2f82('0x13'));logger[_0x2f82('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x492331,'request\x20sent',JSON[_0x2f82('0x15')](_0x2bade3));if(_0x2bade3[_0x2f82('0x16')]){if(_0x2bade3[_0x2f82('0x16')]['code']===0x1f4){logger[_0x2f82('0x16')]('DashboardItem,\x20%s,\x20%s',_0x492331,_0x2bade3['error'][_0x2f82('0x17')]);return _0x2c2e88(_0x2bade3[_0x2f82('0x16')][_0x2f82('0x17')]);}logger[_0x2f82('0x16')](_0x2f82('0x12'),_0x492331,_0x2bade3[_0x2f82('0x16')][_0x2f82('0x17')]);return _0x163cff(_0x2bade3[_0x2f82('0x16')][_0x2f82('0x17')]);}else{logger[_0x2f82('0x11')](_0x2f82('0x12'),_0x492331,_0x2f82('0x13'));_0x163cff(_0x2bade3[_0x2f82('0x18')][_0x2f82('0x17')]);}})[_0x2f82('0x19')](function(_0x44ca09){logger[_0x2f82('0x16')](_0x2f82('0x12'),_0x492331,_0x44ca09);_0x2c2e88(_0x44ca09);});});}