Built motion from commit e6806ed6.|2.6.0
[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 _0xff7a=['localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x219f1b,_0x52b269){var _0x2940e1=function(_0x402e4c){while(--_0x402e4c){_0x219f1b['push'](_0x219f1b['shift']());}};_0x2940e1(++_0x52b269);}(_0xff7a,0x1c0));var _0xaff7=function(_0x105816,_0x8c81ff){_0x105816=_0x105816-0x0;var _0x3e27e2=_0xff7a[_0x105816];return _0x3e27e2;};'use strict';var _=require(_0xaff7('0x0'));var util=require(_0xaff7('0x1'));var moment=require(_0xaff7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaff7('0x3'));var db=require(_0xaff7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaff7('0x5'));var config=require('../../config/environment');var jayson=require(_0xaff7('0x6'));var client=jayson[_0xaff7('0x7')][_0xaff7('0x8')]({'port':0x232a});config[_0xaff7('0x9')]=_[_0xaff7('0xa')](config[_0xaff7('0x9')],{'host':_0xaff7('0xb'),'port':0x18eb});var socket=require(_0xaff7('0xc'))(new Redis(config[_0xaff7('0x9')]));require(_0xaff7('0xd'))[_0xaff7('0xe')](socket);function respondWithRpcPromise(_0x411ec0,_0x4ca568,_0x286266){return new BPromise(function(_0x176eca,_0x2a563c){return client['request'](_0x411ec0,_0x286266)[_0xaff7('0xf')](function(_0x467ffe){logger[_0xaff7('0x10')](_0xaff7('0x11'),_0x4ca568,_0xaff7('0x12'));logger[_0xaff7('0x13')](_0xaff7('0x14'),_0x4ca568,'request\x20sent',JSON[_0xaff7('0x15')](_0x467ffe));if(_0x467ffe[_0xaff7('0x16')]){if(_0x467ffe['error'][_0xaff7('0x17')]===0x1f4){logger['error'](_0xaff7('0x11'),_0x4ca568,_0x467ffe[_0xaff7('0x16')][_0xaff7('0x18')]);return _0x2a563c(_0x467ffe[_0xaff7('0x16')][_0xaff7('0x18')]);}logger[_0xaff7('0x16')]('DashboardItem,\x20%s,\x20%s',_0x4ca568,_0x467ffe[_0xaff7('0x16')][_0xaff7('0x18')]);return _0x176eca(_0x467ffe[_0xaff7('0x16')][_0xaff7('0x18')]);}else{logger['info'](_0xaff7('0x11'),_0x4ca568,_0xaff7('0x12'));_0x176eca(_0x467ffe[_0xaff7('0x19')][_0xaff7('0x18')]);}})[_0xaff7('0x1a')](function(_0x29b158){logger[_0xaff7('0x16')](_0xaff7('0x11'),_0x4ca568,_0x29b158);_0x2a563c(_0x29b158);});});}