325eb8bb69be0d93bfff77e783d70b3128bf2482
[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 _0x3bf8=['client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','DashboardItem,\x20%s,\x20%s','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x41e705,_0x512a8){var _0x40a658=function(_0xd14f71){while(--_0xd14f71){_0x41e705['push'](_0x41e705['shift']());}};_0x40a658(++_0x512a8);}(_0x3bf8,0xf3));var _0x83bf=function(_0x379e78,_0xd86ac3){_0x379e78=_0x379e78-0x0;var _0x26065d=_0x3bf8[_0x379e78];return _0x26065d;};'use strict';var _=require(_0x83bf('0x0'));var util=require(_0x83bf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83bf('0x2'));var db=require(_0x83bf('0x3'))['db'];var utils=require(_0x83bf('0x4'));var logger=require(_0x83bf('0x5'))(_0x83bf('0x6'));var config=require(_0x83bf('0x7'));var jayson=require(_0x83bf('0x8'));var client=jayson[_0x83bf('0x9')][_0x83bf('0xa')]({'port':0x232a});config[_0x83bf('0xb')]=_[_0x83bf('0xc')](config[_0x83bf('0xb')],{'host':_0x83bf('0xd'),'port':0x18eb});var socket=require(_0x83bf('0xe'))(new Redis(config[_0x83bf('0xb')]));require(_0x83bf('0xf'))[_0x83bf('0x10')](socket);function respondWithRpcPromise(_0xd60561,_0x8995d6,_0x558c2a){return new BPromise(function(_0x2c4681,_0x33b699){return client[_0x83bf('0x11')](_0xd60561,_0x558c2a)[_0x83bf('0x12')](function(_0x27f6fe){logger[_0x83bf('0x13')]('DashboardItem,\x20%s,\x20%s',_0x8995d6,_0x83bf('0x14'));logger[_0x83bf('0x15')](_0x83bf('0x16'),_0x8995d6,_0x83bf('0x14'),JSON[_0x83bf('0x17')](_0x27f6fe));if(_0x27f6fe[_0x83bf('0x18')]){if(_0x27f6fe['error']['code']===0x1f4){logger[_0x83bf('0x18')]('DashboardItem,\x20%s,\x20%s',_0x8995d6,_0x27f6fe[_0x83bf('0x18')][_0x83bf('0x19')]);return _0x33b699(_0x27f6fe[_0x83bf('0x18')][_0x83bf('0x19')]);}logger[_0x83bf('0x18')](_0x83bf('0x1a'),_0x8995d6,_0x27f6fe[_0x83bf('0x18')][_0x83bf('0x19')]);return _0x2c4681(_0x27f6fe[_0x83bf('0x18')][_0x83bf('0x19')]);}else{logger[_0x83bf('0x13')](_0x83bf('0x1a'),_0x8995d6,_0x83bf('0x14'));_0x2c4681(_0x27f6fe['result'][_0x83bf('0x19')]);}})[_0x83bf('0x1b')](function(_0x198bd4){logger['error'](_0x83bf('0x1a'),_0x8995d6,_0x198bd4);_0x33b699(_0x198bd4);});});}