Built motion from commit 97153652.|2.6.26
[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 _0x873f=['defaults','redis','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0x873f,0x196));var _0xf873=function(_0x114254,_0x2de3b7){_0x114254=_0x114254-0x0;var _0x430032=_0x873f[_0x114254];return _0x430032;};'use strict';var _=require(_0xf873('0x0'));var util=require(_0xf873('0x1'));var moment=require(_0xf873('0x2'));var BPromise=require(_0xf873('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf873('0x4'));var db=require(_0xf873('0x5'))['db'];var utils=require(_0xf873('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf873('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf873('0x8')][_0xf873('0x9')]({'port':0x232a});config['redis']=_[_0xf873('0xa')](config[_0xf873('0xb')],{'host':_0xf873('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf873('0xd'))[_0xf873('0xe')](socket);function respondWithRpcPromise(_0xb7ed4e,_0x44d1a0,_0x3ade6a){return new BPromise(function(_0x44f9b5,_0x4cf032){return client[_0xf873('0xf')](_0xb7ed4e,_0x3ade6a)[_0xf873('0x10')](function(_0x3471d6){logger[_0xf873('0x11')](_0xf873('0x12'),_0x44d1a0,_0xf873('0x13'));logger[_0xf873('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x44d1a0,_0xf873('0x13'),JSON['stringify'](_0x3471d6));if(_0x3471d6['error']){if(_0x3471d6[_0xf873('0x15')][_0xf873('0x16')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x44d1a0,_0x3471d6[_0xf873('0x15')]['message']);return _0x4cf032(_0x3471d6['error'][_0xf873('0x17')]);}logger[_0xf873('0x15')](_0xf873('0x12'),_0x44d1a0,_0x3471d6[_0xf873('0x15')]['message']);return _0x44f9b5(_0x3471d6[_0xf873('0x15')][_0xf873('0x17')]);}else{logger[_0xf873('0x11')](_0xf873('0x12'),_0x44d1a0,_0xf873('0x13'));_0x44f9b5(_0x3471d6[_0xf873('0x18')]['message']);}})[_0xf873('0x19')](function(_0x437016){logger[_0xf873('0x15')](_0xf873('0x12'),_0x44d1a0,_0x437016);_0x4cf032(_0x437016);});});}