3dc8c0d71b2ff1864e63efe3e86abc9e3aa51fa9
[motion2.git] / server / api / cmCustomField / cmCustomField.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 _0x0570=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result'];(function(_0x56ebd0,_0x41689d){var _0x147469=function(_0x26162c){while(--_0x26162c){_0x56ebd0['push'](_0x56ebd0['shift']());}};_0x147469(++_0x41689d);}(_0x0570,0x115));var _0x0057=function(_0xa4dbe9,_0x514594){_0xa4dbe9=_0xa4dbe9-0x0;var _0x340919=_0x0570[_0xa4dbe9];return _0x340919;};'use strict';var _=require(_0x0057('0x0'));var util=require(_0x0057('0x1'));var moment=require(_0x0057('0x2'));var BPromise=require('bluebird');var rs=require(_0x0057('0x3'));var fs=require('fs');var Redis=require(_0x0057('0x4'));var db=require(_0x0057('0x5'))['db'];var utils=require(_0x0057('0x6'));var logger=require('../../config/logger')(_0x0057('0x7'));var config=require('../../config/environment');var jayson=require(_0x0057('0x8'));var client=jayson[_0x0057('0x9')][_0x0057('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45da9d,_0x254fb2,_0x32929d){return new BPromise(function(_0x540350,_0x30beb4){return client[_0x0057('0xb')](_0x45da9d,_0x32929d)['then'](function(_0x327450){logger[_0x0057('0xc')]('CmCustomField,\x20%s,\x20%s',_0x254fb2,_0x0057('0xd'));logger[_0x0057('0xe')](_0x0057('0xf'),_0x254fb2,_0x0057('0xd'),JSON[_0x0057('0x10')](_0x327450));if(_0x327450[_0x0057('0x11')]){if(_0x327450['error'][_0x0057('0x12')]===0x1f4){logger['error'](_0x0057('0x13'),_0x254fb2,_0x327450[_0x0057('0x11')]['message']);return _0x30beb4(_0x327450[_0x0057('0x11')]['message']);}logger['error'](_0x0057('0x13'),_0x254fb2,_0x327450[_0x0057('0x11')][_0x0057('0x14')]);return _0x540350(_0x327450[_0x0057('0x11')]['message']);}else{logger[_0x0057('0xc')](_0x0057('0x13'),_0x254fb2,_0x0057('0xd'));_0x540350(_0x327450[_0x0057('0x15')][_0x0057('0x14')]);}})[_0x0057('0x16')](function(_0x1c791c){logger[_0x0057('0x11')]('CmCustomField,\x20%s,\x20%s',_0x254fb2,_0x1c791c);_0x30beb4(_0x1c791c);});});}