5656b419e49165e19a4f892ff657965055c6a75a
[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 _0x2d17=['CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x300d0e,_0x4fcd1b){var _0x1903cb=function(_0x1d4721){while(--_0x1d4721){_0x300d0e['push'](_0x300d0e['shift']());}};_0x1903cb(++_0x4fcd1b);}(_0x2d17,0x17e));var _0x72d1=function(_0x5b0444,_0x39b165){_0x5b0444=_0x5b0444-0x0;var _0x194091=_0x2d17[_0x5b0444];return _0x194091;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('CmCustomField,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});}