dc0359740ecf8447a0c5611fc97218340e7a43c0
[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 _0x1e56=['request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x4f2280,_0x5b5ba4){var _0x2a2ee3=function(_0x471205){while(--_0x471205){_0x4f2280['push'](_0x4f2280['shift']());}};_0x2a2ee3(++_0x5b5ba4);}(_0x1e56,0xed));var _0x61e5=function(_0x4ae379,_0xf4a3ea){_0x4ae379=_0x4ae379-0x0;var _0x5dc59a=_0x1e56[_0x4ae379];return _0x5dc59a;};'use strict';var _=require('lodash');var util=require(_0x61e5('0x0'));var moment=require(_0x61e5('0x1'));var BPromise=require(_0x61e5('0x2'));var rs=require(_0x61e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x61e5('0x4'));var logger=require('../../config/logger')(_0x61e5('0x5'));var config=require(_0x61e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x61e5('0x7')][_0x61e5('0x8')]({'port':0x232a});config[_0x61e5('0x9')]=_['defaults'](config[_0x61e5('0x9')],{'host':_0x61e5('0xa'),'port':0x18eb});var socket=require(_0x61e5('0xb'))(new Redis(config['redis']));require(_0x61e5('0xc'))['register'](socket);function respondWithRpcPromise(_0x19d73b,_0x16161a,_0x4e734b){return new BPromise(function(_0xfb720b,_0x434506){return client[_0x61e5('0xd')](_0x19d73b,_0x4e734b)[_0x61e5('0xe')](function(_0x583e32){logger[_0x61e5('0xf')](_0x61e5('0x10'),_0x16161a,_0x61e5('0x11'));logger[_0x61e5('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x16161a,_0x61e5('0x11'),JSON[_0x61e5('0x13')](_0x583e32));if(_0x583e32['error']){if(_0x583e32['error'][_0x61e5('0x14')]===0x1f4){logger[_0x61e5('0x15')](_0x61e5('0x10'),_0x16161a,_0x583e32['error'][_0x61e5('0x16')]);return _0x434506(_0x583e32['error'][_0x61e5('0x16')]);}logger[_0x61e5('0x15')](_0x61e5('0x10'),_0x16161a,_0x583e32[_0x61e5('0x15')][_0x61e5('0x16')]);return _0xfb720b(_0x583e32[_0x61e5('0x15')][_0x61e5('0x16')]);}else{logger[_0x61e5('0xf')](_0x61e5('0x10'),_0x16161a,_0x61e5('0x11'));_0xfb720b(_0x583e32[_0x61e5('0x17')][_0x61e5('0x16')]);}})[_0x61e5('0x18')](function(_0x3946f2){logger[_0x61e5('0x15')](_0x61e5('0x10'),_0x16161a,_0x3946f2);_0x434506(_0x3946f2);});});}