b3d8a8de58d09e4b647a04901a43f32a6c18bf22
[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 _0x32c0=['CmCustomField,\x20%s,\x20%s','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x387022,_0x30888c){var _0x414c5c=function(_0xbd6f1d){while(--_0xbd6f1d){_0x387022['push'](_0x387022['shift']());}};_0x414c5c(++_0x30888c);}(_0x32c0,0x1bb));var _0x032c=function(_0xae8224,_0x5add83){_0xae8224=_0xae8224-0x0;var _0x49dc36=_0x32c0[_0xae8224];return _0x49dc36;};'use strict';var _=require('lodash');var util=require(_0x032c('0x0'));var moment=require(_0x032c('0x1'));var BPromise=require(_0x032c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x032c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x032c('0x4'))('rpc');var config=require(_0x032c('0x5'));var jayson=require(_0x032c('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7eb6,_0x356705,_0x53507b){return new BPromise(function(_0x3c4cd2,_0x3e2bd7){return client[_0x032c('0x7')](_0x3a7eb6,_0x53507b)[_0x032c('0x8')](function(_0x218310){logger[_0x032c('0x9')]('CmCustomField,\x20%s,\x20%s',_0x356705,_0x032c('0xa'));logger[_0x032c('0xb')](_0x032c('0xc'),_0x356705,'request\x20sent',JSON[_0x032c('0xd')](_0x218310));if(_0x218310['error']){if(_0x218310[_0x032c('0xe')][_0x032c('0xf')]===0x1f4){logger[_0x032c('0xe')]('CmCustomField,\x20%s,\x20%s',_0x356705,_0x218310[_0x032c('0xe')][_0x032c('0x10')]);return _0x3e2bd7(_0x218310[_0x032c('0xe')][_0x032c('0x10')]);}logger['error'](_0x032c('0x11'),_0x356705,_0x218310[_0x032c('0xe')][_0x032c('0x10')]);return _0x3c4cd2(_0x218310[_0x032c('0xe')][_0x032c('0x10')]);}else{logger[_0x032c('0x9')](_0x032c('0x11'),_0x356705,_0x032c('0xa'));_0x3c4cd2(_0x218310[_0x032c('0x12')][_0x032c('0x10')]);}})[_0x032c('0x13')](function(_0x38975f){logger[_0x032c('0xe')](_0x032c('0x11'),_0x356705,_0x38975f);_0x3e2bd7(_0x38975f);});});}