7880988b0aa5cf1f0b6bee1553493a70f9285af8
[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 _0x74ce=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x74ce,0x108));var _0xe74c=function(_0xf2c873,_0x24a4f0){_0xf2c873=_0xf2c873-0x0;var _0x7f2be=_0x74ce[_0xf2c873];return _0x7f2be;};'use strict';var _=require('lodash');var util=require(_0xe74c('0x0'));var moment=require(_0xe74c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe74c('0x2'));var fs=require('fs');var Redis=require(_0xe74c('0x3'));var db=require(_0xe74c('0x4'))['db'];var utils=require(_0xe74c('0x5'));var logger=require('../../config/logger')(_0xe74c('0x6'));var config=require(_0xe74c('0x7'));var jayson=require(_0xe74c('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xe74c('0x9')]=_[_0xe74c('0xa')](config[_0xe74c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe74c('0x9')]));require(_0xe74c('0xb'))[_0xe74c('0xc')](socket);function respondWithRpcPromise(_0x8e4deb,_0x13139b,_0x7223d7){return new BPromise(function(_0x4f185c,_0x1b394c){return client[_0xe74c('0xd')](_0x8e4deb,_0x7223d7)[_0xe74c('0xe')](function(_0xa5e4e6){logger[_0xe74c('0xf')](_0xe74c('0x10'),_0x13139b,_0xe74c('0x11'));logger['debug'](_0xe74c('0x12'),_0x13139b,_0xe74c('0x11'),JSON[_0xe74c('0x13')](_0xa5e4e6));if(_0xa5e4e6['error']){if(_0xa5e4e6[_0xe74c('0x14')][_0xe74c('0x15')]===0x1f4){logger[_0xe74c('0x14')](_0xe74c('0x10'),_0x13139b,_0xa5e4e6[_0xe74c('0x14')]['message']);return _0x1b394c(_0xa5e4e6[_0xe74c('0x14')][_0xe74c('0x16')]);}logger[_0xe74c('0x14')](_0xe74c('0x10'),_0x13139b,_0xa5e4e6[_0xe74c('0x14')][_0xe74c('0x16')]);return _0x4f185c(_0xa5e4e6[_0xe74c('0x14')]['message']);}else{logger[_0xe74c('0xf')](_0xe74c('0x10'),_0x13139b,_0xe74c('0x11'));_0x4f185c(_0xa5e4e6['result'][_0xe74c('0x16')]);}})[_0xe74c('0x17')](function(_0x11cb32){logger[_0xe74c('0x14')](_0xe74c('0x10'),_0x13139b,_0x11cb32);_0x1b394c(_0x11cb32);});});}