Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / dashboard / dashboard.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 _0xad1b=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xad1b,0x164));var _0xbad1=function(_0x539422,_0x394efd){_0x539422=_0x539422-0x0;var _0x25129f=_0xad1b[_0x539422];return _0x25129f;};'use strict';var _=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var moment=require('moment');var BPromise=require(_0xbad1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbad1('0x3'));var db=require(_0xbad1('0x4'))['db'];var utils=require(_0xbad1('0x5'));var logger=require('../../config/logger')(_0xbad1('0x6'));var config=require(_0xbad1('0x7'));var jayson=require(_0xbad1('0x8'));var client=jayson[_0xbad1('0x9')][_0xbad1('0xa')]({'port':0x232a});config[_0xbad1('0xb')]=_[_0xbad1('0xc')](config[_0xbad1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbad1('0xd'))(new Redis(config['redis']));require(_0xbad1('0xe'))[_0xbad1('0xf')](socket);function respondWithRpcPromise(_0x310ffc,_0xb71e78,_0x34c5bc){return new BPromise(function(_0x15cafb,_0xf70661){return client[_0xbad1('0x10')](_0x310ffc,_0x34c5bc)[_0xbad1('0x11')](function(_0x18df7a){logger[_0xbad1('0x12')]('Dashboard,\x20%s,\x20%s',_0xb71e78,'request\x20sent');logger[_0xbad1('0x13')](_0xbad1('0x14'),_0xb71e78,_0xbad1('0x15'),JSON[_0xbad1('0x16')](_0x18df7a));if(_0x18df7a[_0xbad1('0x17')]){if(_0x18df7a[_0xbad1('0x17')]['code']===0x1f4){logger[_0xbad1('0x17')]('Dashboard,\x20%s,\x20%s',_0xb71e78,_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);return _0xf70661(_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);}logger[_0xbad1('0x17')](_0xbad1('0x19'),_0xb71e78,_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);return _0x15cafb(_0x18df7a[_0xbad1('0x17')][_0xbad1('0x18')]);}else{logger[_0xbad1('0x12')](_0xbad1('0x19'),_0xb71e78,_0xbad1('0x15'));_0x15cafb(_0x18df7a[_0xbad1('0x1a')]['message']);}})[_0xbad1('0x1b')](function(_0x5c242b){logger[_0xbad1('0x17')](_0xbad1('0x19'),_0xb71e78,_0x5c242b);_0xf70661(_0x5c242b);});});}