ae11b589ee5373763e830f393bcbfdd09732ff13
[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 _0x1ab9=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1ab9,0xde));var _0x91ab=function(_0x8956db,_0x565a5f){_0x8956db=_0x8956db-0x0;var _0x175a41=_0x1ab9[_0x8956db];return _0x175a41;};'use strict';var _=require(_0x91ab('0x0'));var util=require(_0x91ab('0x1'));var moment=require(_0x91ab('0x2'));var BPromise=require(_0x91ab('0x3'));var rs=require(_0x91ab('0x4'));var fs=require('fs');var Redis=require(_0x91ab('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91ab('0x6'));var logger=require(_0x91ab('0x7'))(_0x91ab('0x8'));var config=require(_0x91ab('0x9'));var jayson=require(_0x91ab('0xa'));var client=jayson[_0x91ab('0xb')][_0x91ab('0xc')]({'port':0x232a});config[_0x91ab('0xd')]=_[_0x91ab('0xe')](config[_0x91ab('0xd')],{'host':_0x91ab('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91ab('0xd')]));require(_0x91ab('0x10'))[_0x91ab('0x11')](socket);function respondWithRpcPromise(_0x13858c,_0xd3b891,_0xf054ca){return new BPromise(function(_0x4882dc,_0x46083e){return client['request'](_0x13858c,_0xf054ca)[_0x91ab('0x12')](function(_0x2e83c1){logger[_0x91ab('0x13')](_0x91ab('0x14'),_0xd3b891,'request\x20sent');logger[_0x91ab('0x15')](_0x91ab('0x16'),_0xd3b891,_0x91ab('0x17'),JSON['stringify'](_0x2e83c1));if(_0x2e83c1[_0x91ab('0x18')]){if(_0x2e83c1[_0x91ab('0x18')][_0x91ab('0x19')]===0x1f4){logger[_0x91ab('0x18')](_0x91ab('0x14'),_0xd3b891,_0x2e83c1[_0x91ab('0x18')][_0x91ab('0x1a')]);return _0x46083e(_0x2e83c1[_0x91ab('0x18')]['message']);}logger[_0x91ab('0x18')](_0x91ab('0x14'),_0xd3b891,_0x2e83c1[_0x91ab('0x18')][_0x91ab('0x1a')]);return _0x4882dc(_0x2e83c1['error']['message']);}else{logger[_0x91ab('0x13')](_0x91ab('0x14'),_0xd3b891,'request\x20sent');_0x4882dc(_0x2e83c1['result'][_0x91ab('0x1a')]);}})[_0x91ab('0x1b')](function(_0x4c021e){logger[_0x91ab('0x18')]('DashboardItem,\x20%s,\x20%s',_0xd3b891,_0x4c021e);_0x46083e(_0x4c021e);});});}