Built motion from commit b0a9a629.|2.6.33
[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 _0xc89d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x58cd64,_0x38840a){var _0x4786fe=function(_0x31dd0f){while(--_0x31dd0f){_0x58cd64['push'](_0x58cd64['shift']());}};_0x4786fe(++_0x38840a);}(_0xc89d,0x105));var _0xdc89=function(_0x4c3a3d,_0x3768a2){_0x4c3a3d=_0x4c3a3d-0x0;var _0x20bca4=_0xc89d[_0x4c3a3d];return _0x20bca4;};'use strict';var _=require(_0xdc89('0x0'));var util=require(_0xdc89('0x1'));var moment=require(_0xdc89('0x2'));var BPromise=require(_0xdc89('0x3'));var rs=require(_0xdc89('0x4'));var fs=require('fs');var Redis=require(_0xdc89('0x5'));var db=require(_0xdc89('0x6'))['db'];var utils=require(_0xdc89('0x7'));var logger=require('../../config/logger')(_0xdc89('0x8'));var config=require(_0xdc89('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdc89('0xa')][_0xdc89('0xb')]({'port':0x232a});config[_0xdc89('0xc')]=_['defaults'](config[_0xdc89('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc89('0xd'))(new Redis(config[_0xdc89('0xc')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x3a73c1,_0x42a727,_0x31a694){return new BPromise(function(_0x3e430c,_0x2bf29e){return client[_0xdc89('0xe')](_0x3a73c1,_0x31a694)['then'](function(_0x4ade37){logger[_0xdc89('0xf')](_0xdc89('0x10'),_0x42a727,_0xdc89('0x11'));logger['debug'](_0xdc89('0x12'),_0x42a727,'request\x20sent',JSON[_0xdc89('0x13')](_0x4ade37));if(_0x4ade37[_0xdc89('0x14')]){if(_0x4ade37['error'][_0xdc89('0x15')]===0x1f4){logger['error'](_0xdc89('0x10'),_0x42a727,_0x4ade37[_0xdc89('0x14')][_0xdc89('0x16')]);return _0x2bf29e(_0x4ade37[_0xdc89('0x14')][_0xdc89('0x16')]);}logger[_0xdc89('0x14')](_0xdc89('0x10'),_0x42a727,_0x4ade37[_0xdc89('0x14')][_0xdc89('0x16')]);return _0x3e430c(_0x4ade37[_0xdc89('0x14')]['message']);}else{logger[_0xdc89('0xf')](_0xdc89('0x10'),_0x42a727,'request\x20sent');_0x3e430c(_0x4ade37[_0xdc89('0x17')][_0xdc89('0x16')]);}})['catch'](function(_0x3569e8){logger[_0xdc89('0x14')](_0xdc89('0x10'),_0x42a727,_0x3569e8);_0x2bf29e(_0x3569e8);});});}