Built motion from commit (unavailable).|2.0.78
[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 _0x9a04=['info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x9a04,0x1af));var _0x49a0=function(_0x277e0b,_0x503be3){_0x277e0b=_0x277e0b-0x0;var _0x4f8094=_0x9a04[_0x277e0b];return _0x4f8094;};'use strict';var _=require('lodash');var util=require(_0x49a0('0x0'));var moment=require(_0x49a0('0x1'));var BPromise=require(_0x49a0('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x49a0('0x3'))(_0x49a0('0x4'));var config=require(_0x49a0('0x5'));var jayson=require(_0x49a0('0x6'));var client=jayson['client'][_0x49a0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40740b,_0x541341,_0x3f9850){return new BPromise(function(_0xc51fc4,_0x415060){return client[_0x49a0('0x8')](_0x40740b,_0x3f9850)[_0x49a0('0x9')](function(_0x5d2545){logger[_0x49a0('0xa')]('CmCustomField,\x20%s,\x20%s',_0x541341,_0x49a0('0xb'));logger[_0x49a0('0xc')](_0x49a0('0xd'),_0x541341,_0x49a0('0xb'),JSON[_0x49a0('0xe')](_0x5d2545));if(_0x5d2545[_0x49a0('0xf')]){if(_0x5d2545[_0x49a0('0xf')][_0x49a0('0x10')]===0x1f4){logger[_0x49a0('0xf')]('CmCustomField,\x20%s,\x20%s',_0x541341,_0x5d2545[_0x49a0('0xf')][_0x49a0('0x11')]);return _0x415060(_0x5d2545[_0x49a0('0xf')][_0x49a0('0x11')]);}logger[_0x49a0('0xf')](_0x49a0('0x12'),_0x541341,_0x5d2545[_0x49a0('0xf')]['message']);return _0xc51fc4(_0x5d2545[_0x49a0('0xf')][_0x49a0('0x11')]);}else{logger[_0x49a0('0xa')](_0x49a0('0x12'),_0x541341,'request\x20sent');_0xc51fc4(_0x5d2545[_0x49a0('0x13')][_0x49a0('0x11')]);}})[_0x49a0('0x14')](function(_0x176148){logger[_0x49a0('0xf')](_0x49a0('0x12'),_0x541341,_0x176148);_0x415060(_0x176148);});});}