a8aab1c72cf407becc4abe19bf2bab21da30273e
[motion2.git] / server / api / setting / setting.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 _0xb698=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x466d5d,_0x318469){var _0x566846=function(_0x2817e2){while(--_0x2817e2){_0x466d5d['push'](_0x466d5d['shift']());}};_0x566846(++_0x318469);}(_0xb698,0x110));var _0x8b69=function(_0x480d18,_0x1b3568){_0x480d18=_0x480d18-0x0;var _0x238d50=_0xb698[_0x480d18];return _0x238d50;};'use strict';var _=require(_0x8b69('0x0'));var util=require(_0x8b69('0x1'));var moment=require(_0x8b69('0x2'));var BPromise=require(_0x8b69('0x3'));var rs=require(_0x8b69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b69('0x5'))['db'];var utils=require(_0x8b69('0x6'));var logger=require(_0x8b69('0x7'))(_0x8b69('0x8'));var config=require(_0x8b69('0x9'));var jayson=require(_0x8b69('0xa'));var client=jayson['client'][_0x8b69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7a772c,_0x38a13d,_0x4ccd80){return new BPromise(function(_0x133035,_0xde37d3){return client['request'](_0x7a772c,_0x4ccd80)[_0x8b69('0xc')](function(_0x4e7ab9){logger[_0x8b69('0xd')]('Setting,\x20%s,\x20%s',_0x38a13d,_0x8b69('0xe'));logger[_0x8b69('0xf')](_0x8b69('0x10'),_0x38a13d,'request\x20sent',JSON[_0x8b69('0x11')](_0x4e7ab9));if(_0x4e7ab9[_0x8b69('0x12')]){if(_0x4e7ab9['error'][_0x8b69('0x13')]===0x1f4){logger[_0x8b69('0x12')](_0x8b69('0x14'),_0x38a13d,_0x4e7ab9[_0x8b69('0x12')][_0x8b69('0x15')]);return _0xde37d3(_0x4e7ab9['error'][_0x8b69('0x15')]);}logger[_0x8b69('0x12')](_0x8b69('0x14'),_0x38a13d,_0x4e7ab9[_0x8b69('0x12')]['message']);return _0x133035(_0x4e7ab9[_0x8b69('0x12')][_0x8b69('0x15')]);}else{logger[_0x8b69('0xd')](_0x8b69('0x14'),_0x38a13d,'request\x20sent');_0x133035(_0x4e7ab9[_0x8b69('0x16')][_0x8b69('0x15')]);}})['catch'](function(_0x2feef4){logger[_0x8b69('0x12')](_0x8b69('0x14'),_0x38a13d,_0x2feef4);_0xde37d3(_0x2feef4);});});}