1c35ae6269a57a7b0c45bd7c86ee3fc546fdac6a
[motion2.git] / server / api / jscriptyProject / jscriptyProject.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 _0x0158=['rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','../../config/logger'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x0158,0x74));var _0x8015=function(_0x19df17,_0x1fdc60){_0x19df17=_0x19df17-0x0;var _0x5a5531=_0x0158[_0x19df17];return _0x5a5531;};'use strict';var _=require(_0x8015('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8015('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8015('0x2'))(_0x8015('0x3'));var config=require(_0x8015('0x4'));var jayson=require(_0x8015('0x5'));var client=jayson['client'][_0x8015('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x494717,_0x2ee7e6,_0xa4aa22){return new BPromise(function(_0x3e24d2,_0x42f29d){return client[_0x8015('0x7')](_0x494717,_0xa4aa22)[_0x8015('0x8')](function(_0x2bc55c){logger[_0x8015('0x9')](_0x8015('0xa'),_0x2ee7e6,_0x8015('0xb'));logger[_0x8015('0xc')](_0x8015('0xd'),_0x2ee7e6,_0x8015('0xb'),JSON['stringify'](_0x2bc55c));if(_0x2bc55c[_0x8015('0xe')]){if(_0x2bc55c[_0x8015('0xe')][_0x8015('0xf')]===0x1f4){logger[_0x8015('0xe')](_0x8015('0xa'),_0x2ee7e6,_0x2bc55c[_0x8015('0xe')]['message']);return _0x42f29d(_0x2bc55c[_0x8015('0xe')][_0x8015('0x10')]);}logger[_0x8015('0xe')](_0x8015('0xa'),_0x2ee7e6,_0x2bc55c[_0x8015('0xe')][_0x8015('0x10')]);return _0x3e24d2(_0x2bc55c[_0x8015('0xe')]['message']);}else{logger['info'](_0x8015('0xa'),_0x2ee7e6,_0x8015('0xb'));_0x3e24d2(_0x2bc55c['result'][_0x8015('0x10')]);}})['catch'](function(_0x3c74c4){logger[_0x8015('0xe')](_0x8015('0xa'),_0x2ee7e6,_0x3c74c4);_0x42f29d(_0x3c74c4);});});}