Built motion from commit ff78e754.|2.6.29
[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 _0x5e71=['socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e71,0x95));var _0x15e7=function(_0x47ff32,_0x1274d0){_0x47ff32=_0x47ff32-0x0;var _0x44e5e5=_0x5e71[_0x47ff32];return _0x44e5e5;};'use strict';var _=require(_0x15e7('0x0'));var util=require(_0x15e7('0x1'));var moment=require(_0x15e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x15e7('0x3'));var fs=require('fs');var Redis=require(_0x15e7('0x4'));var db=require(_0x15e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x15e7('0x6'));var config=require(_0x15e7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x15e7('0x8')][_0x15e7('0x9')]({'port':0x232a});config[_0x15e7('0xa')]=_[_0x15e7('0xb')](config['redis'],{'host':_0x15e7('0xc'),'port':0x18eb});var socket=require(_0x15e7('0xd'))(new Redis(config[_0x15e7('0xa')]));require(_0x15e7('0xe'))[_0x15e7('0xf')](socket);function respondWithRpcPromise(_0x3d4c86,_0x236f4f,_0xa10b83){return new BPromise(function(_0x3b8508,_0x195b13){return client[_0x15e7('0x10')](_0x3d4c86,_0xa10b83)[_0x15e7('0x11')](function(_0x2adb24){logger['info'](_0x15e7('0x12'),_0x236f4f,'request\x20sent');logger[_0x15e7('0x13')](_0x15e7('0x14'),_0x236f4f,_0x15e7('0x15'),JSON['stringify'](_0x2adb24));if(_0x2adb24[_0x15e7('0x16')]){if(_0x2adb24['error'][_0x15e7('0x17')]===0x1f4){logger['error'](_0x15e7('0x12'),_0x236f4f,_0x2adb24[_0x15e7('0x16')][_0x15e7('0x18')]);return _0x195b13(_0x2adb24[_0x15e7('0x16')]['message']);}logger[_0x15e7('0x16')]('DashboardItem,\x20%s,\x20%s',_0x236f4f,_0x2adb24[_0x15e7('0x16')][_0x15e7('0x18')]);return _0x3b8508(_0x2adb24[_0x15e7('0x16')]['message']);}else{logger[_0x15e7('0x19')](_0x15e7('0x12'),_0x236f4f,'request\x20sent');_0x3b8508(_0x2adb24['result'][_0x15e7('0x18')]);}})[_0x15e7('0x1a')](function(_0x3f5d55){logger['error'](_0x15e7('0x12'),_0x236f4f,_0x3f5d55);_0x195b13(_0x3f5d55);});});}