Built motion from commit (unavailable).|2.5.22
[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 _0xd5d1=['localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x3fd1a3,_0x53a973){var _0x1f5256=function(_0x5ae675){while(--_0x5ae675){_0x3fd1a3['push'](_0x3fd1a3['shift']());}};_0x1f5256(++_0x53a973);}(_0xd5d1,0x12d));var _0x1d5d=function(_0x2fd0a9,_0x19f19a){_0x2fd0a9=_0x2fd0a9-0x0;var _0x5eaca1=_0xd5d1[_0x2fd0a9];return _0x5eaca1;};'use strict';var _=require(_0x1d5d('0x0'));var util=require(_0x1d5d('0x1'));var moment=require(_0x1d5d('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d5d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d5d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d5d('0x5'))(_0x1d5d('0x6'));var config=require('../../config/environment');var jayson=require(_0x1d5d('0x7'));var client=jayson[_0x1d5d('0x8')][_0x1d5d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1d5d('0xa')],{'host':_0x1d5d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d5d('0xa')]));require(_0x1d5d('0xc'))[_0x1d5d('0xd')](socket);function respondWithRpcPromise(_0x28b98b,_0x93e957,_0x54a4a8){return new BPromise(function(_0x44f39a,_0x5d0c47){return client[_0x1d5d('0xe')](_0x28b98b,_0x54a4a8)[_0x1d5d('0xf')](function(_0x33e205){logger[_0x1d5d('0x10')](_0x1d5d('0x11'),_0x93e957,_0x1d5d('0x12'));logger[_0x1d5d('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x93e957,'request\x20sent',JSON[_0x1d5d('0x14')](_0x33e205));if(_0x33e205[_0x1d5d('0x15')]){if(_0x33e205['error']['code']===0x1f4){logger[_0x1d5d('0x15')](_0x1d5d('0x11'),_0x93e957,_0x33e205[_0x1d5d('0x15')][_0x1d5d('0x16')]);return _0x5d0c47(_0x33e205[_0x1d5d('0x15')]['message']);}logger[_0x1d5d('0x15')](_0x1d5d('0x11'),_0x93e957,_0x33e205[_0x1d5d('0x15')][_0x1d5d('0x16')]);return _0x44f39a(_0x33e205['error'][_0x1d5d('0x16')]);}else{logger[_0x1d5d('0x10')](_0x1d5d('0x11'),_0x93e957,_0x1d5d('0x12'));_0x44f39a(_0x33e205[_0x1d5d('0x17')][_0x1d5d('0x16')]);}})['catch'](function(_0x28b82a){logger[_0x1d5d('0x15')](_0x1d5d('0x11'),_0x93e957,_0x28b82a);_0x5d0c47(_0x28b82a);});});}