Built motion from commit ffdca78c.|2.6.24
[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 _0x96b0=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c03c3,_0x1c7bc1){var _0x5925e1=function(_0x7a2283){while(--_0x7a2283){_0x4c03c3['push'](_0x4c03c3['shift']());}};_0x5925e1(++_0x1c7bc1);}(_0x96b0,0x18c));var _0x096b=function(_0x40bfb0,_0xf09937){_0x40bfb0=_0x40bfb0-0x0;var _0x26d010=_0x96b0[_0x40bfb0];return _0x26d010;};'use strict';var _=require(_0x096b('0x0'));var util=require(_0x096b('0x1'));var moment=require(_0x096b('0x2'));var BPromise=require('bluebird');var rs=require(_0x096b('0x3'));var fs=require('fs');var Redis=require(_0x096b('0x4'));var db=require(_0x096b('0x5'))['db'];var utils=require(_0x096b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x096b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x462e66,_0x3d9427,_0x4843f4){return new BPromise(function(_0x32592b,_0x3814c4){return client['request'](_0x462e66,_0x4843f4)['then'](function(_0x5b8133){logger[_0x096b('0x8')](_0x096b('0x9'),_0x3d9427,_0x096b('0xa'));logger[_0x096b('0xb')](_0x096b('0xc'),_0x3d9427,_0x096b('0xa'),JSON[_0x096b('0xd')](_0x5b8133));if(_0x5b8133[_0x096b('0xe')]){if(_0x5b8133[_0x096b('0xe')]['code']===0x1f4){logger[_0x096b('0xe')](_0x096b('0x9'),_0x3d9427,_0x5b8133[_0x096b('0xe')][_0x096b('0xf')]);return _0x3814c4(_0x5b8133[_0x096b('0xe')][_0x096b('0xf')]);}logger['error'](_0x096b('0x9'),_0x3d9427,_0x5b8133[_0x096b('0xe')][_0x096b('0xf')]);return _0x32592b(_0x5b8133[_0x096b('0xe')][_0x096b('0xf')]);}else{logger[_0x096b('0x8')](_0x096b('0x9'),_0x3d9427,_0x096b('0xa'));_0x32592b(_0x5b8133[_0x096b('0x10')][_0x096b('0xf')]);}})['catch'](function(_0x45b102){logger[_0x096b('0xe')]('CmCustomField,\x20%s,\x20%s',_0x3d9427,_0x45b102);_0x3814c4(_0x45b102);});});}