Built motion from commit (unavailable).|2.5.21
[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 _0x9721=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','../../mysqldb'];(function(_0x18f4a7,_0x9c2845){var _0x5ece40=function(_0x25cce4){while(--_0x25cce4){_0x18f4a7['push'](_0x18f4a7['shift']());}};_0x5ece40(++_0x9c2845);}(_0x9721,0x15b));var _0x1972=function(_0x57678d,_0x4fd14d){_0x57678d=_0x57678d-0x0;var _0x18f257=_0x9721[_0x57678d];return _0x18f257;};'use strict';var _=require('lodash');var util=require(_0x1972('0x0'));var moment=require(_0x1972('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1972('0x2'))['db'];var utils=require(_0x1972('0x3'));var logger=require(_0x1972('0x4'))(_0x1972('0x5'));var config=require(_0x1972('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1972('0x7')][_0x1972('0x8')]({'port':0x232a});config[_0x1972('0x9')]=_['defaults'](config[_0x1972('0x9')],{'host':_0x1972('0xa'),'port':0x18eb});var socket=require(_0x1972('0xb'))(new Redis(config['redis']));require(_0x1972('0xc'))[_0x1972('0xd')](socket);function respondWithRpcPromise(_0x5dd90c,_0x30db24,_0x19f64e){return new BPromise(function(_0x30fb02,_0x1b7a8d){return client[_0x1972('0xe')](_0x5dd90c,_0x19f64e)[_0x1972('0xf')](function(_0x52311f){logger[_0x1972('0x10')](_0x1972('0x11'),_0x30db24,_0x1972('0x12'));logger[_0x1972('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x30db24,_0x1972('0x12'),JSON[_0x1972('0x14')](_0x52311f));if(_0x52311f[_0x1972('0x15')]){if(_0x52311f[_0x1972('0x15')][_0x1972('0x16')]===0x1f4){logger[_0x1972('0x15')](_0x1972('0x11'),_0x30db24,_0x52311f[_0x1972('0x15')]['message']);return _0x1b7a8d(_0x52311f[_0x1972('0x15')][_0x1972('0x17')]);}logger[_0x1972('0x15')](_0x1972('0x11'),_0x30db24,_0x52311f[_0x1972('0x15')]['message']);return _0x30fb02(_0x52311f[_0x1972('0x15')][_0x1972('0x17')]);}else{logger[_0x1972('0x10')]('DashboardItem,\x20%s,\x20%s',_0x30db24,'request\x20sent');_0x30fb02(_0x52311f[_0x1972('0x18')][_0x1972('0x17')]);}})['catch'](function(_0x2d43c8){logger[_0x1972('0x15')](_0x1972('0x11'),_0x30db24,_0x2d43c8);_0x1b7a8d(_0x2d43c8);});});}