9069c546f53a7bfa7d026ef107dcc1e91fb93549
[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 _0x97a3=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x53dd9b,_0x24d9e9){var _0x42f82b=function(_0x1adbbc){while(--_0x1adbbc){_0x53dd9b['push'](_0x53dd9b['shift']());}};_0x42f82b(++_0x24d9e9);}(_0x97a3,0x1a9));var _0x397a=function(_0xf65a2e,_0xd245b){_0xf65a2e=_0xf65a2e-0x0;var _0x51ca8c=_0x97a3[_0xf65a2e];return _0x51ca8c;};'use strict';var _=require(_0x397a('0x0'));var util=require('util');var moment=require(_0x397a('0x1'));var BPromise=require(_0x397a('0x2'));var rs=require(_0x397a('0x3'));var fs=require('fs');var Redis=require(_0x397a('0x4'));var db=require(_0x397a('0x5'))['db'];var utils=require(_0x397a('0x6'));var logger=require(_0x397a('0x7'))(_0x397a('0x8'));var config=require(_0x397a('0x9'));var jayson=require(_0x397a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x146782,_0x34e1bb,_0x3b4f43){return new BPromise(function(_0x4d8309,_0x29fa6a){return client[_0x397a('0xb')](_0x146782,_0x3b4f43)[_0x397a('0xc')](function(_0x22a8a5){logger[_0x397a('0xd')]('Setting,\x20%s,\x20%s',_0x34e1bb,_0x397a('0xe'));logger['debug'](_0x397a('0xf'),_0x34e1bb,_0x397a('0xe'),JSON[_0x397a('0x10')](_0x22a8a5));if(_0x22a8a5['error']){if(_0x22a8a5['error']['code']===0x1f4){logger[_0x397a('0x11')]('Setting,\x20%s,\x20%s',_0x34e1bb,_0x22a8a5['error']['message']);return _0x29fa6a(_0x22a8a5[_0x397a('0x11')][_0x397a('0x12')]);}logger['error'](_0x397a('0x13'),_0x34e1bb,_0x22a8a5[_0x397a('0x11')][_0x397a('0x12')]);return _0x4d8309(_0x22a8a5['error'][_0x397a('0x12')]);}else{logger[_0x397a('0xd')](_0x397a('0x13'),_0x34e1bb,_0x397a('0xe'));_0x4d8309(_0x22a8a5[_0x397a('0x14')][_0x397a('0x12')]);}})[_0x397a('0x15')](function(_0x422f8b){logger['error']('Setting,\x20%s,\x20%s',_0x34e1bb,_0x422f8b);_0x29fa6a(_0x422f8b);});});}