59df7474e3aa5484cd1318dedff09e474dbda790
[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 _0xa5dd=['code','error','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa5dd,0x177));var _0xda5d=function(_0x138173,_0x3e81bd){_0x138173=_0x138173-0x0;var _0x1e6b05=_0xa5dd[_0x138173];return _0x1e6b05;};'use strict';var _=require(_0xda5d('0x0'));var util=require(_0xda5d('0x1'));var moment=require('moment');var BPromise=require(_0xda5d('0x2'));var rs=require(_0xda5d('0x3'));var fs=require('fs');var Redis=require(_0xda5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xda5d('0x5'));var logger=require(_0xda5d('0x6'))(_0xda5d('0x7'));var config=require(_0xda5d('0x8'));var jayson=require(_0xda5d('0x9'));var client=jayson['client'][_0xda5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5651b2,_0x3724bb,_0x1d9c0f){return new BPromise(function(_0x53ca5f,_0x547373){return client['request'](_0x5651b2,_0x1d9c0f)[_0xda5d('0xb')](function(_0x58346b){logger['info'](_0xda5d('0xc'),_0x3724bb,'request\x20sent');logger[_0xda5d('0xd')](_0xda5d('0xe'),_0x3724bb,'request\x20sent',JSON[_0xda5d('0xf')](_0x58346b));if(_0x58346b['error']){if(_0x58346b['error'][_0xda5d('0x10')]===0x1f4){logger['error'](_0xda5d('0xc'),_0x3724bb,_0x58346b[_0xda5d('0x11')][_0xda5d('0x12')]);return _0x547373(_0x58346b[_0xda5d('0x11')][_0xda5d('0x12')]);}logger[_0xda5d('0x11')](_0xda5d('0xc'),_0x3724bb,_0x58346b[_0xda5d('0x11')]['message']);return _0x53ca5f(_0x58346b['error'][_0xda5d('0x12')]);}else{logger[_0xda5d('0x13')](_0xda5d('0xc'),_0x3724bb,_0xda5d('0x14'));_0x53ca5f(_0x58346b[_0xda5d('0x15')][_0xda5d('0x12')]);}})[_0xda5d('0x16')](function(_0x4adcde){logger[_0xda5d('0x11')](_0xda5d('0xc'),_0x3724bb,_0x4adcde);_0x547373(_0x4adcde);});});}