Built motion from commit (unavailable).|2.5.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 _0x0e96=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0e96,0xfa));var _0x60e9=function(_0x13cec3,_0x241765){_0x13cec3=_0x13cec3-0x0;var _0x4cd015=_0x0e96[_0x13cec3];return _0x4cd015;};'use strict';var _=require(_0x60e9('0x0'));var util=require(_0x60e9('0x1'));var moment=require(_0x60e9('0x2'));var BPromise=require(_0x60e9('0x3'));var rs=require(_0x60e9('0x4'));var fs=require('fs');var Redis=require(_0x60e9('0x5'));var db=require(_0x60e9('0x6'))['db'];var utils=require(_0x60e9('0x7'));var logger=require(_0x60e9('0x8'))('rpc');var config=require(_0x60e9('0x9'));var jayson=require(_0x60e9('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x60e9('0xb')]=_[_0x60e9('0xc')](config['redis'],{'host':_0x60e9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60e9('0xb')]));require(_0x60e9('0xe'))[_0x60e9('0xf')](socket);function respondWithRpcPromise(_0x372427,_0x4da707,_0x178af5){return new BPromise(function(_0x25f74b,_0x567836){return client[_0x60e9('0x10')](_0x372427,_0x178af5)[_0x60e9('0x11')](function(_0x106996){logger[_0x60e9('0x12')](_0x60e9('0x13'),_0x4da707,'request\x20sent');logger[_0x60e9('0x14')](_0x60e9('0x15'),_0x4da707,_0x60e9('0x16'),JSON[_0x60e9('0x17')](_0x106996));if(_0x106996[_0x60e9('0x18')]){if(_0x106996['error']['code']===0x1f4){logger[_0x60e9('0x18')]('DashboardItem,\x20%s,\x20%s',_0x4da707,_0x106996[_0x60e9('0x18')]['message']);return _0x567836(_0x106996[_0x60e9('0x18')][_0x60e9('0x19')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x4da707,_0x106996['error']['message']);return _0x25f74b(_0x106996[_0x60e9('0x18')][_0x60e9('0x19')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x4da707,_0x60e9('0x16'));_0x25f74b(_0x106996[_0x60e9('0x1a')][_0x60e9('0x19')]);}})[_0x60e9('0x1b')](function(_0x159b6a){logger['error'](_0x60e9('0x13'),_0x4da707,_0x159b6a);_0x567836(_0x159b6a);});});}