c035ad8691631b83dd9b1316736ac6be37ea9369
[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 _0x0a44=['request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','register','request','then','DashboardItem,\x20%s,\x20%s'];(function(_0x1c1c7d,_0x542705){var _0x3da448=function(_0x522cc5){while(--_0x522cc5){_0x1c1c7d['push'](_0x1c1c7d['shift']());}};_0x3da448(++_0x542705);}(_0x0a44,0xf2));var _0x40a4=function(_0x3e2305,_0x3dd756){_0x3e2305=_0x3e2305-0x0;var _0x109b47=_0x0a44[_0x3e2305];return _0x109b47;};'use strict';var _=require(_0x40a4('0x0'));var util=require(_0x40a4('0x1'));var moment=require(_0x40a4('0x2'));var BPromise=require(_0x40a4('0x3'));var rs=require(_0x40a4('0x4'));var fs=require('fs');var Redis=require(_0x40a4('0x5'));var db=require(_0x40a4('0x6'))['db'];var utils=require(_0x40a4('0x7'));var logger=require(_0x40a4('0x8'))(_0x40a4('0x9'));var config=require(_0x40a4('0xa'));var jayson=require(_0x40a4('0xb'));var client=jayson[_0x40a4('0xc')]['http']({'port':0x232a});config[_0x40a4('0xd')]=_[_0x40a4('0xe')](config[_0x40a4('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40a4('0xd')]));require('./dashboardItem.socket')[_0x40a4('0xf')](socket);function respondWithRpcPromise(_0x3e6e8e,_0x3b2369,_0x38951d){return new BPromise(function(_0x582f9e,_0x548e4c){return client[_0x40a4('0x10')](_0x3e6e8e,_0x38951d)[_0x40a4('0x11')](function(_0x376601){logger['info'](_0x40a4('0x12'),_0x3b2369,_0x40a4('0x13'));logger[_0x40a4('0x14')](_0x40a4('0x15'),_0x3b2369,_0x40a4('0x13'),JSON[_0x40a4('0x16')](_0x376601));if(_0x376601['error']){if(_0x376601[_0x40a4('0x17')][_0x40a4('0x18')]===0x1f4){logger[_0x40a4('0x17')](_0x40a4('0x12'),_0x3b2369,_0x376601['error']['message']);return _0x548e4c(_0x376601['error'][_0x40a4('0x19')]);}logger[_0x40a4('0x17')](_0x40a4('0x12'),_0x3b2369,_0x376601[_0x40a4('0x17')]['message']);return _0x582f9e(_0x376601[_0x40a4('0x17')][_0x40a4('0x19')]);}else{logger[_0x40a4('0x1a')]('DashboardItem,\x20%s,\x20%s',_0x3b2369,_0x40a4('0x13'));_0x582f9e(_0x376601[_0x40a4('0x1b')]['message']);}})[_0x40a4('0x1c')](function(_0x54b09f){logger[_0x40a4('0x17')](_0x40a4('0x12'),_0x3b2369,_0x54b09f);_0x548e4c(_0x54b09f);});});}