935744ffdbbcc8d9f8c5a9d7bcf15ea04a546e85
[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 _0x8d96=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x381180,_0x228a5f){var _0x67796e=function(_0x4de131){while(--_0x4de131){_0x381180['push'](_0x381180['shift']());}};_0x67796e(++_0x228a5f);}(_0x8d96,0x91));var _0x68d9=function(_0x391e9c,_0x3b4958){_0x391e9c=_0x391e9c-0x0;var _0x1807da=_0x8d96[_0x391e9c];return _0x1807da;};'use strict';var _=require(_0x68d9('0x0'));var util=require(_0x68d9('0x1'));var moment=require(_0x68d9('0x2'));var BPromise=require(_0x68d9('0x3'));var rs=require(_0x68d9('0x4'));var fs=require('fs');var Redis=require(_0x68d9('0x5'));var db=require(_0x68d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68d9('0x7'))('rpc');var config=require(_0x68d9('0x8'));var jayson=require(_0x68d9('0x9'));var client=jayson['client'][_0x68d9('0xa')]({'port':0x232a});config[_0x68d9('0xb')]=_[_0x68d9('0xc')](config[_0x68d9('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68d9('0xb')]));require(_0x68d9('0xd'))[_0x68d9('0xe')](socket);function respondWithRpcPromise(_0x21cdf5,_0x56839d,_0x7bb0ae){return new BPromise(function(_0x515c99,_0x5ea834){return client['request'](_0x21cdf5,_0x7bb0ae)[_0x68d9('0xf')](function(_0x366ec0){logger[_0x68d9('0x10')](_0x68d9('0x11'),_0x56839d,_0x68d9('0x12'));logger[_0x68d9('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x56839d,_0x68d9('0x12'),JSON[_0x68d9('0x14')](_0x366ec0));if(_0x366ec0[_0x68d9('0x15')]){if(_0x366ec0[_0x68d9('0x15')][_0x68d9('0x16')]===0x1f4){logger[_0x68d9('0x15')]('DashboardItem,\x20%s,\x20%s',_0x56839d,_0x366ec0[_0x68d9('0x15')][_0x68d9('0x17')]);return _0x5ea834(_0x366ec0[_0x68d9('0x15')][_0x68d9('0x17')]);}logger[_0x68d9('0x15')](_0x68d9('0x11'),_0x56839d,_0x366ec0[_0x68d9('0x15')][_0x68d9('0x17')]);return _0x515c99(_0x366ec0[_0x68d9('0x15')]['message']);}else{logger[_0x68d9('0x10')](_0x68d9('0x11'),_0x56839d,_0x68d9('0x12'));_0x515c99(_0x366ec0['result']['message']);}})['catch'](function(_0x3ce072){logger[_0x68d9('0x15')]('DashboardItem,\x20%s,\x20%s',_0x56839d,_0x3ce072);_0x5ea834(_0x3ce072);});});}