Built motion from commit (unavailable).|2.3.4
[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 _0x99c9=['message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x99c9,0x93));var _0x999c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x99c9[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x999c('0x0'));var moment=require(_0x999c('0x1'));var BPromise=require(_0x999c('0x2'));var rs=require(_0x999c('0x3'));var fs=require('fs');var Redis=require(_0x999c('0x4'));var db=require(_0x999c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x999c('0x6'));var config=require(_0x999c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999c('0x8')]['http']({'port':0x232a});config[_0x999c('0x9')]=_[_0x999c('0xa')](config[_0x999c('0x9')],{'host':_0x999c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x999c('0x9')]));require(_0x999c('0xc'))[_0x999c('0xd')](socket);function respondWithRpcPromise(_0x3fac40,_0x4b67e4,_0x10afcf){return new BPromise(function(_0xb57758,_0x2a60f6){return client[_0x999c('0xe')](_0x3fac40,_0x10afcf)['then'](function(_0x1dc72a){logger['info'](_0x999c('0xf'),_0x4b67e4,'request\x20sent');logger[_0x999c('0x10')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4b67e4,_0x999c('0x11'),JSON[_0x999c('0x12')](_0x1dc72a));if(_0x1dc72a[_0x999c('0x13')]){if(_0x1dc72a[_0x999c('0x13')][_0x999c('0x14')]===0x1f4){logger['error'](_0x999c('0xf'),_0x4b67e4,_0x1dc72a[_0x999c('0x13')][_0x999c('0x15')]);return _0x2a60f6(_0x1dc72a['error']['message']);}logger[_0x999c('0x13')](_0x999c('0xf'),_0x4b67e4,_0x1dc72a['error'][_0x999c('0x15')]);return _0xb57758(_0x1dc72a[_0x999c('0x13')][_0x999c('0x15')]);}else{logger[_0x999c('0x16')](_0x999c('0xf'),_0x4b67e4,_0x999c('0x11'));_0xb57758(_0x1dc72a['result']['message']);}})[_0x999c('0x17')](function(_0x34e33c){logger[_0x999c('0x13')](_0x999c('0xf'),_0x4b67e4,_0x34e33c);_0x2a60f6(_0x34e33c);});});}