25b0e109aae4002cca691b08099d30e25ef6671f
[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 _0xf8ab=['message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x16ec8b,_0x3c1964){var _0x2255fd=function(_0x3aa548){while(--_0x3aa548){_0x16ec8b['push'](_0x16ec8b['shift']());}};_0x2255fd(++_0x3c1964);}(_0xf8ab,0xc6));var _0xbf8a=function(_0x928573,_0x2616e6){_0x928573=_0x928573-0x0;var _0x154f56=_0xf8ab[_0x928573];return _0x154f56;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf8a('0x0'));var BPromise=require(_0xbf8a('0x1'));var rs=require(_0xbf8a('0x2'));var fs=require('fs');var Redis=require(_0xbf8a('0x3'));var db=require(_0xbf8a('0x4'))['db'];var utils=require(_0xbf8a('0x5'));var logger=require('../../config/logger')(_0xbf8a('0x6'));var config=require(_0xbf8a('0x7'));var jayson=require(_0xbf8a('0x8'));var client=jayson[_0xbf8a('0x9')][_0xbf8a('0xa')]({'port':0x232a});config[_0xbf8a('0xb')]=_[_0xbf8a('0xc')](config['redis'],{'host':_0xbf8a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf8a('0xb')]));require(_0xbf8a('0xe'))[_0xbf8a('0xf')](socket);function respondWithRpcPromise(_0x9aef84,_0x16c807,_0x302a2b){return new BPromise(function(_0x1a26b0,_0x376dc1){return client[_0xbf8a('0x10')](_0x9aef84,_0x302a2b)[_0xbf8a('0x11')](function(_0x4a3474){logger[_0xbf8a('0x12')](_0xbf8a('0x13'),_0x16c807,_0xbf8a('0x14'));logger[_0xbf8a('0x15')](_0xbf8a('0x16'),_0x16c807,_0xbf8a('0x14'),JSON[_0xbf8a('0x17')](_0x4a3474));if(_0x4a3474[_0xbf8a('0x18')]){if(_0x4a3474[_0xbf8a('0x18')][_0xbf8a('0x19')]===0x1f4){logger[_0xbf8a('0x18')](_0xbf8a('0x13'),_0x16c807,_0x4a3474[_0xbf8a('0x18')]['message']);return _0x376dc1(_0x4a3474[_0xbf8a('0x18')]['message']);}logger[_0xbf8a('0x18')](_0xbf8a('0x13'),_0x16c807,_0x4a3474[_0xbf8a('0x18')][_0xbf8a('0x1a')]);return _0x1a26b0(_0x4a3474[_0xbf8a('0x18')]['message']);}else{logger[_0xbf8a('0x12')](_0xbf8a('0x13'),_0x16c807,_0xbf8a('0x14'));_0x1a26b0(_0x4a3474['result'][_0xbf8a('0x1a')]);}})[_0xbf8a('0x1b')](function(_0x493320){logger[_0xbf8a('0x18')](_0xbf8a('0x13'),_0x16c807,_0x493320);_0x376dc1(_0x493320);});});}