Built motion from commit 616d3211.|2.6.4
[motion2.git] / server / api / intVtigerField / intVtigerField.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 _0x9072=['lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x2dbda1,_0x4f2cc2){var _0x2f0076=function(_0x385329){while(--_0x385329){_0x2dbda1['push'](_0x2dbda1['shift']());}};_0x2f0076(++_0x4f2cc2);}(_0x9072,0x187));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2907('0x0'));var util=require('util');var moment=require(_0x2907('0x1'));var BPromise=require(_0x2907('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2907('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2907('0x4'));var logger=require(_0x2907('0x5'))(_0x2907('0x6'));var config=require(_0x2907('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2907('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b2c0e,_0x5ab2ee,_0x5b31ad){return new BPromise(function(_0x1a01bf,_0x514c96){return client['request'](_0x4b2c0e,_0x5b31ad)['then'](function(_0x112cc3){logger[_0x2907('0x9')](_0x2907('0xa'),_0x5ab2ee,_0x2907('0xb'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x5ab2ee,_0x2907('0xb'),JSON['stringify'](_0x112cc3));if(_0x112cc3[_0x2907('0xc')]){if(_0x112cc3[_0x2907('0xc')][_0x2907('0xd')]===0x1f4){logger['error'](_0x2907('0xa'),_0x5ab2ee,_0x112cc3[_0x2907('0xc')][_0x2907('0xe')]);return _0x514c96(_0x112cc3[_0x2907('0xc')]['message']);}logger['error'](_0x2907('0xa'),_0x5ab2ee,_0x112cc3[_0x2907('0xc')][_0x2907('0xe')]);return _0x1a01bf(_0x112cc3['error'][_0x2907('0xe')]);}else{logger[_0x2907('0x9')](_0x2907('0xa'),_0x5ab2ee,_0x2907('0xb'));_0x1a01bf(_0x112cc3[_0x2907('0xf')][_0x2907('0xe')]);}})[_0x2907('0x10')](function(_0x1cbdbf){logger['error']('VtigerField,\x20%s,\x20%s',_0x5ab2ee,_0x1cbdbf);_0x514c96(_0x1cbdbf);});});}