Built motion from commit 0c5f406c.|2.6.29
[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 _0xc8eb=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc8eb,0xa5));var _0xbc8e=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0xc8eb[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0xbc8e('0x0'));var util=require(_0xbc8e('0x1'));var moment=require(_0xbc8e('0x2'));var BPromise=require(_0xbc8e('0x3'));var rs=require(_0xbc8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbc8e('0x6'));var jayson=require(_0xbc8e('0x7'));var client=jayson[_0xbc8e('0x8')][_0xbc8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17f15d,_0x1d92af,_0x1e4130){return new BPromise(function(_0x4805db,_0x143727){return client[_0xbc8e('0xa')](_0x17f15d,_0x1e4130)[_0xbc8e('0xb')](function(_0x3cc88c){logger['info'](_0xbc8e('0xc'),_0x1d92af,_0xbc8e('0xd'));logger[_0xbc8e('0xe')](_0xbc8e('0xf'),_0x1d92af,_0xbc8e('0xd'),JSON[_0xbc8e('0x10')](_0x3cc88c));if(_0x3cc88c[_0xbc8e('0x11')]){if(_0x3cc88c[_0xbc8e('0x11')][_0xbc8e('0x12')]===0x1f4){logger['error'](_0xbc8e('0xc'),_0x1d92af,_0x3cc88c[_0xbc8e('0x11')][_0xbc8e('0x13')]);return _0x143727(_0x3cc88c['error']['message']);}logger[_0xbc8e('0x11')](_0xbc8e('0xc'),_0x1d92af,_0x3cc88c[_0xbc8e('0x11')][_0xbc8e('0x13')]);return _0x4805db(_0x3cc88c[_0xbc8e('0x11')]['message']);}else{logger['info'](_0xbc8e('0xc'),_0x1d92af,_0xbc8e('0xd'));_0x4805db(_0x3cc88c['result'][_0xbc8e('0x13')]);}})['catch'](function(_0x1f8fe5){logger[_0xbc8e('0x11')]('VtigerField,\x20%s,\x20%s',_0x1d92af,_0x1f8fe5);_0x143727(_0x1f8fe5);});});}