17ee496d879b402a7749cd4aa3b4d0c05ead7a4e
[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 _0x61fc=['catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x61fc,0x1d5));var _0xc61f=function(_0x20a1bd,_0x1e84f5){_0x20a1bd=_0x20a1bd-0x0;var _0x2b9b44=_0x61fc[_0x20a1bd];return _0x2b9b44;};'use strict';var _=require('lodash');var util=require(_0xc61f('0x0'));var moment=require('moment');var BPromise=require(_0xc61f('0x1'));var rs=require(_0xc61f('0x2'));var fs=require('fs');var Redis=require(_0xc61f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc61f('0x4'));var logger=require('../../config/logger')(_0xc61f('0x5'));var config=require(_0xc61f('0x6'));var jayson=require(_0xc61f('0x7'));var client=jayson[_0xc61f('0x8')][_0xc61f('0x9')]({'port':0x232a});config[_0xc61f('0xa')]=_['defaults'](config[_0xc61f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc61f('0xb'))(new Redis(config[_0xc61f('0xa')]));require(_0xc61f('0xc'))[_0xc61f('0xd')](socket);function respondWithRpcPromise(_0x26d1e2,_0x277a03,_0x5671a3){return new BPromise(function(_0x25a5c4,_0x1a3727){return client[_0xc61f('0xe')](_0x26d1e2,_0x5671a3)[_0xc61f('0xf')](function(_0x531ba5){logger[_0xc61f('0x10')](_0xc61f('0x11'),_0x277a03,_0xc61f('0x12'));logger['debug'](_0xc61f('0x13'),_0x277a03,_0xc61f('0x12'),JSON[_0xc61f('0x14')](_0x531ba5));if(_0x531ba5[_0xc61f('0x15')]){if(_0x531ba5[_0xc61f('0x15')][_0xc61f('0x16')]===0x1f4){logger[_0xc61f('0x15')](_0xc61f('0x11'),_0x277a03,_0x531ba5[_0xc61f('0x15')][_0xc61f('0x17')]);return _0x1a3727(_0x531ba5[_0xc61f('0x15')][_0xc61f('0x17')]);}logger[_0xc61f('0x15')](_0xc61f('0x11'),_0x277a03,_0x531ba5['error'][_0xc61f('0x17')]);return _0x25a5c4(_0x531ba5['error'][_0xc61f('0x17')]);}else{logger[_0xc61f('0x10')](_0xc61f('0x11'),_0x277a03,'request\x20sent');_0x25a5c4(_0x531ba5[_0xc61f('0x18')][_0xc61f('0x17')]);}})[_0xc61f('0x19')](function(_0x2c98fc){logger['error']('DashboardItem,\x20%s,\x20%s',_0x277a03,_0x2c98fc);_0x1a3727(_0x2c98fc);});});}