Built motion from commit 10af8726.|2.6.34
[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 _0xde8a=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x52b591,_0x4a0e5f){var _0x2c9dd7=function(_0x2fd2d0){while(--_0x2fd2d0){_0x52b591['push'](_0x52b591['shift']());}};_0x2c9dd7(++_0x4a0e5f);}(_0xde8a,0x107));var _0xade8=function(_0x36e693,_0x52a283){_0x36e693=_0x36e693-0x0;var _0x45c2ea=_0xde8a[_0x36e693];return _0x45c2ea;};'use strict';var _=require('lodash');var util=require(_0xade8('0x0'));var moment=require(_0xade8('0x1'));var BPromise=require(_0xade8('0x2'));var rs=require(_0xade8('0x3'));var fs=require('fs');var Redis=require(_0xade8('0x4'));var db=require(_0xade8('0x5'))['db'];var utils=require(_0xade8('0x6'));var logger=require('../../config/logger')(_0xade8('0x7'));var config=require(_0xade8('0x8'));var jayson=require(_0xade8('0x9'));var client=jayson[_0xade8('0xa')][_0xade8('0xb')]({'port':0x232a});config[_0xade8('0xc')]=_[_0xade8('0xd')](config['redis'],{'host':_0xade8('0xe'),'port':0x18eb});var socket=require(_0xade8('0xf'))(new Redis(config['redis']));require(_0xade8('0x10'))[_0xade8('0x11')](socket);function respondWithRpcPromise(_0xc5e106,_0x5a43d9,_0x583344){return new BPromise(function(_0x21b193,_0x1f56f9){return client[_0xade8('0x12')](_0xc5e106,_0x583344)[_0xade8('0x13')](function(_0x1a60fb){logger[_0xade8('0x14')](_0xade8('0x15'),_0x5a43d9,_0xade8('0x16'));logger[_0xade8('0x17')](_0xade8('0x18'),_0x5a43d9,_0xade8('0x16'),JSON[_0xade8('0x19')](_0x1a60fb));if(_0x1a60fb[_0xade8('0x1a')]){if(_0x1a60fb[_0xade8('0x1a')]['code']===0x1f4){logger[_0xade8('0x1a')]('Dashboard,\x20%s,\x20%s',_0x5a43d9,_0x1a60fb[_0xade8('0x1a')]['message']);return _0x1f56f9(_0x1a60fb[_0xade8('0x1a')]['message']);}logger['error'](_0xade8('0x15'),_0x5a43d9,_0x1a60fb[_0xade8('0x1a')]['message']);return _0x21b193(_0x1a60fb['error'][_0xade8('0x1b')]);}else{logger[_0xade8('0x14')](_0xade8('0x15'),_0x5a43d9,'request\x20sent');_0x21b193(_0x1a60fb[_0xade8('0x1c')]['message']);}})['catch'](function(_0x141602){logger[_0xade8('0x1a')](_0xade8('0x15'),_0x5a43d9,_0x141602);_0x1f56f9(_0x141602);});});}