ecdafe0e04c91541b162ab0e6fe1240a986d28be
[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 _0x09d1=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','code','CmCustomField,\x20%s,\x20%s','error','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug'];(function(_0x19c76f,_0x1272ee){var _0x4e33fb=function(_0x4d0632){while(--_0x4d0632){_0x19c76f['push'](_0x19c76f['shift']());}};_0x4e33fb(++_0x1272ee);}(_0x09d1,0xba));var _0x109d=function(_0x305272,_0x19a527){_0x305272=_0x305272-0x0;var _0x43fdf1=_0x09d1[_0x305272];return _0x43fdf1;};'use strict';var _=require(_0x109d('0x0'));var util=require(_0x109d('0x1'));var moment=require('moment');var BPromise=require(_0x109d('0x2'));var rs=require(_0x109d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x109d('0x4'));var logger=require(_0x109d('0x5'))(_0x109d('0x6'));var config=require(_0x109d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x109d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eb7f2,_0x2a2a41,_0x1234ae){return new BPromise(function(_0x235202,_0x3b066e){return client[_0x109d('0x9')](_0x2eb7f2,_0x1234ae)[_0x109d('0xa')](function(_0x26e8a2){logger[_0x109d('0xb')]('CmCustomField,\x20%s,\x20%s',_0x2a2a41,_0x109d('0xc'));logger[_0x109d('0xd')](_0x109d('0xe'),_0x2a2a41,_0x109d('0xc'),JSON[_0x109d('0xf')](_0x26e8a2));if(_0x26e8a2['error']){if(_0x26e8a2['error'][_0x109d('0x10')]===0x1f4){logger['error'](_0x109d('0x11'),_0x2a2a41,_0x26e8a2[_0x109d('0x12')][_0x109d('0x13')]);return _0x3b066e(_0x26e8a2[_0x109d('0x12')]['message']);}logger[_0x109d('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2a2a41,_0x26e8a2['error'][_0x109d('0x13')]);return _0x235202(_0x26e8a2[_0x109d('0x12')][_0x109d('0x13')]);}else{logger[_0x109d('0xb')](_0x109d('0x11'),_0x2a2a41,_0x109d('0xc'));_0x235202(_0x26e8a2['result'][_0x109d('0x13')]);}})['catch'](function(_0x1ddda5){logger[_0x109d('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2a2a41,_0x1ddda5);_0x3b066e(_0x1ddda5);});});}