3573d444093b5ab2fab1e08315d3ed8ed929373f
[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 _0x674f=['../../config/environment','jayson/promise','client','http','redis','localhost','./dashboardItem.socket','register','request','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x26c8cc,_0x475a8f){var _0x31c937=function(_0xb38919){while(--_0xb38919){_0x26c8cc['push'](_0x26c8cc['shift']());}};_0x31c937(++_0x475a8f);}(_0x674f,0x171));var _0xf674=function(_0x45cd36,_0x4ef4bd){_0x45cd36=_0x45cd36-0x0;var _0x1e84ac=_0x674f[_0x45cd36];return _0x1e84ac;};'use strict';var _=require(_0xf674('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf674('0x1'));var rs=require(_0xf674('0x2'));var fs=require('fs');var Redis=require(_0xf674('0x3'));var db=require(_0xf674('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf674('0x5'));var config=require(_0xf674('0x6'));var jayson=require(_0xf674('0x7'));var client=jayson[_0xf674('0x8')][_0xf674('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf674('0xa')],{'host':_0xf674('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf674('0xc'))[_0xf674('0xd')](socket);function respondWithRpcPromise(_0x2c8fb8,_0x8b78e9,_0x4fe54c){return new BPromise(function(_0x2f94b7,_0x4b2dc2){return client[_0xf674('0xe')](_0x2c8fb8,_0x4fe54c)['then'](function(_0xf8d522){logger[_0xf674('0xf')]('DashboardItem,\x20%s,\x20%s',_0x8b78e9,_0xf674('0x10'));logger[_0xf674('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x8b78e9,_0xf674('0x10'),JSON[_0xf674('0x12')](_0xf8d522));if(_0xf8d522[_0xf674('0x13')]){if(_0xf8d522['error'][_0xf674('0x14')]===0x1f4){logger[_0xf674('0x13')](_0xf674('0x15'),_0x8b78e9,_0xf8d522[_0xf674('0x13')][_0xf674('0x16')]);return _0x4b2dc2(_0xf8d522['error'][_0xf674('0x16')]);}logger[_0xf674('0x13')](_0xf674('0x15'),_0x8b78e9,_0xf8d522[_0xf674('0x13')][_0xf674('0x16')]);return _0x2f94b7(_0xf8d522[_0xf674('0x13')][_0xf674('0x16')]);}else{logger['info'](_0xf674('0x15'),_0x8b78e9,'request\x20sent');_0x2f94b7(_0xf8d522[_0xf674('0x17')][_0xf674('0x16')]);}})[_0xf674('0x18')](function(_0x5434f5){logger[_0xf674('0x13')](_0xf674('0x15'),_0x8b78e9,_0x5434f5);_0x4b2dc2(_0x5434f5);});});}