024fa85defafc0e51f4b186c4cdf39bab920935e
[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 _0xb515=['debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5f37a0,_0x49df0a){var _0x3671a6=function(_0x5c268e){while(--_0x5c268e){_0x5f37a0['push'](_0x5f37a0['shift']());}};_0x3671a6(++_0x49df0a);}(_0xb515,0x1b8));var _0x5b51=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xb515[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var moment=require(_0x5b51('0x1'));var BPromise=require(_0x5b51('0x2'));var rs=require(_0x5b51('0x3'));var fs=require('fs');var Redis=require(_0x5b51('0x4'));var db=require(_0x5b51('0x5'))['db'];var utils=require(_0x5b51('0x6'));var logger=require(_0x5b51('0x7'))(_0x5b51('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b51('0x9'));var client=jayson[_0x5b51('0xa')][_0x5b51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x293d82,_0x396b3f,_0x2c6d86){return new BPromise(function(_0x1d5082,_0x226e9c){return client[_0x5b51('0xc')](_0x293d82,_0x2c6d86)[_0x5b51('0xd')](function(_0x1085e6){logger[_0x5b51('0xe')]('VtigerField,\x20%s,\x20%s',_0x396b3f,_0x5b51('0xf'));logger[_0x5b51('0x10')](_0x5b51('0x11'),_0x396b3f,_0x5b51('0xf'),JSON[_0x5b51('0x12')](_0x1085e6));if(_0x1085e6[_0x5b51('0x13')]){if(_0x1085e6['error']['code']===0x1f4){logger['error'](_0x5b51('0x14'),_0x396b3f,_0x1085e6[_0x5b51('0x13')][_0x5b51('0x15')]);return _0x226e9c(_0x1085e6[_0x5b51('0x13')]['message']);}logger[_0x5b51('0x13')](_0x5b51('0x14'),_0x396b3f,_0x1085e6[_0x5b51('0x13')][_0x5b51('0x15')]);return _0x1d5082(_0x1085e6[_0x5b51('0x13')][_0x5b51('0x15')]);}else{logger[_0x5b51('0xe')](_0x5b51('0x14'),_0x396b3f,_0x5b51('0xf'));_0x1d5082(_0x1085e6[_0x5b51('0x16')][_0x5b51('0x15')]);}})[_0x5b51('0x17')](function(_0x520686){logger[_0x5b51('0x13')]('VtigerField,\x20%s,\x20%s',_0x396b3f,_0x520686);_0x226e9c(_0x520686);});});}