090ab1e3311dcad1ab8c534e4d32ea2f88e9a779
[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 _0x68b2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x26c1fd,_0x31a36b){var _0x13a179=function(_0x4f6cf4){while(--_0x4f6cf4){_0x26c1fd['push'](_0x26c1fd['shift']());}};_0x13a179(++_0x31a36b);}(_0x68b2,0xab));var _0x268b=function(_0xe3f0b0,_0x43edc9){_0xe3f0b0=_0xe3f0b0-0x0;var _0x3a839e=_0x68b2[_0xe3f0b0];return _0x3a839e;};'use strict';var _=require(_0x268b('0x0'));var util=require(_0x268b('0x1'));var moment=require(_0x268b('0x2'));var BPromise=require(_0x268b('0x3'));var rs=require(_0x268b('0x4'));var fs=require('fs');var Redis=require(_0x268b('0x5'));var db=require(_0x268b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x268b('0x7'))(_0x268b('0x8'));var config=require(_0x268b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x268b('0xa')]['http']({'port':0x232a});config['redis']=_[_0x268b('0xb')](config[_0x268b('0xc')],{'host':_0x268b('0xd'),'port':0x18eb});var socket=require(_0x268b('0xe'))(new Redis(config[_0x268b('0xc')]));require(_0x268b('0xf'))[_0x268b('0x10')](socket);function respondWithRpcPromise(_0x52f65c,_0x1403fb,_0x2848c9){return new BPromise(function(_0x51224c,_0x13c226){return client[_0x268b('0x11')](_0x52f65c,_0x2848c9)[_0x268b('0x12')](function(_0x585238){logger[_0x268b('0x13')]('DashboardItem,\x20%s,\x20%s',_0x1403fb,_0x268b('0x14'));logger['debug'](_0x268b('0x15'),_0x1403fb,'request\x20sent',JSON[_0x268b('0x16')](_0x585238));if(_0x585238['error']){if(_0x585238['error'][_0x268b('0x17')]===0x1f4){logger[_0x268b('0x18')]('DashboardItem,\x20%s,\x20%s',_0x1403fb,_0x585238[_0x268b('0x18')][_0x268b('0x19')]);return _0x13c226(_0x585238[_0x268b('0x18')]['message']);}logger[_0x268b('0x18')](_0x268b('0x1a'),_0x1403fb,_0x585238[_0x268b('0x18')][_0x268b('0x19')]);return _0x51224c(_0x585238['error']['message']);}else{logger['info'](_0x268b('0x1a'),_0x1403fb,_0x268b('0x14'));_0x51224c(_0x585238[_0x268b('0x1b')][_0x268b('0x19')]);}})[_0x268b('0x1c')](function(_0x56fda3){logger['error'](_0x268b('0x1a'),_0x1403fb,_0x56fda3);_0x13c226(_0x56fda3);});});}