Built motion from commit (unavailable).|2.3.9
[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 _0xdc9e=['client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x5a5083,_0x1f786d){var _0x474f36=function(_0x375ba6){while(--_0x375ba6){_0x5a5083['push'](_0x5a5083['shift']());}};_0x474f36(++_0x1f786d);}(_0xdc9e,0x1db));var _0xedc9=function(_0x235b58,_0x21a9f5){_0x235b58=_0x235b58-0x0;var _0x4c2849=_0xdc9e[_0x235b58];return _0x4c2849;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xedc9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedc9('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xedc9('0x2'))(_0xedc9('0x3'));var config=require(_0xedc9('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xedc9('0x5')][_0xedc9('0x6')]({'port':0x232a});config['redis']=_[_0xedc9('0x7')](config[_0xedc9('0x8')],{'host':_0xedc9('0x9'),'port':0x18eb});var socket=require(_0xedc9('0xa'))(new Redis(config[_0xedc9('0x8')]));require(_0xedc9('0xb'))[_0xedc9('0xc')](socket);function respondWithRpcPromise(_0x5b7435,_0x18c72b,_0x314702){return new BPromise(function(_0x1eb92f,_0xad26b2){return client[_0xedc9('0xd')](_0x5b7435,_0x314702)[_0xedc9('0xe')](function(_0x4dcb77){logger[_0xedc9('0xf')](_0xedc9('0x10'),_0x18c72b,_0xedc9('0x11'));logger['debug'](_0xedc9('0x12'),_0x18c72b,_0xedc9('0x11'),JSON['stringify'](_0x4dcb77));if(_0x4dcb77[_0xedc9('0x13')]){if(_0x4dcb77['error'][_0xedc9('0x14')]===0x1f4){logger[_0xedc9('0x13')](_0xedc9('0x10'),_0x18c72b,_0x4dcb77[_0xedc9('0x13')]['message']);return _0xad26b2(_0x4dcb77[_0xedc9('0x13')][_0xedc9('0x15')]);}logger[_0xedc9('0x13')](_0xedc9('0x10'),_0x18c72b,_0x4dcb77['error']['message']);return _0x1eb92f(_0x4dcb77[_0xedc9('0x13')][_0xedc9('0x15')]);}else{logger['info'](_0xedc9('0x10'),_0x18c72b,'request\x20sent');_0x1eb92f(_0x4dcb77[_0xedc9('0x16')][_0xedc9('0x15')]);}})[_0xedc9('0x17')](function(_0x3ee7ff){logger[_0xedc9('0x13')](_0xedc9('0x10'),_0x18c72b,_0x3ee7ff);_0xad26b2(_0x3ee7ff);});});}