Built motion from commit b5996064.|2.6.21
[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 _0x4b0f=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xba60f1,_0x3b111b){var _0x120520=function(_0x53334a){while(--_0x53334a){_0xba60f1['push'](_0xba60f1['shift']());}};_0x120520(++_0x3b111b);}(_0x4b0f,0xba));var _0xf4b0=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0x4b0f[_0x4c06ac];return _0x2333cb;};'use strict';var _=require(_0xf4b0('0x0'));var util=require(_0xf4b0('0x1'));var moment=require(_0xf4b0('0x2'));var BPromise=require(_0xf4b0('0x3'));var rs=require(_0xf4b0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4b0('0x6'));var config=require(_0xf4b0('0x7'));var jayson=require(_0xf4b0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b2409,_0xa507e7,_0x3502aa){return new BPromise(function(_0x475834,_0x37c47a){return client[_0xf4b0('0x9')](_0x2b2409,_0x3502aa)[_0xf4b0('0xa')](function(_0x231c40){logger['info'](_0xf4b0('0xb'),_0xa507e7,_0xf4b0('0xc'));logger[_0xf4b0('0xd')](_0xf4b0('0xe'),_0xa507e7,_0xf4b0('0xc'),JSON[_0xf4b0('0xf')](_0x231c40));if(_0x231c40[_0xf4b0('0x10')]){if(_0x231c40[_0xf4b0('0x10')]['code']===0x1f4){logger['error'](_0xf4b0('0xb'),_0xa507e7,_0x231c40['error'][_0xf4b0('0x11')]);return _0x37c47a(_0x231c40[_0xf4b0('0x10')][_0xf4b0('0x11')]);}logger[_0xf4b0('0x10')](_0xf4b0('0xb'),_0xa507e7,_0x231c40[_0xf4b0('0x10')][_0xf4b0('0x11')]);return _0x475834(_0x231c40[_0xf4b0('0x10')][_0xf4b0('0x11')]);}else{logger[_0xf4b0('0x12')]('CmCustomField,\x20%s,\x20%s',_0xa507e7,'request\x20sent');_0x475834(_0x231c40[_0xf4b0('0x13')]['message']);}})['catch'](function(_0x4d99fe){logger[_0xf4b0('0x10')](_0xf4b0('0xb'),_0xa507e7,_0x4d99fe);_0x37c47a(_0x4d99fe);});});}