Built motion from commit 994c64e1.|2.6.1
[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 _0x242a=['rpc','../../config/environment','jayson/promise','client','http','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','VtigerField,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0x242a,0x181));var _0xa242=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x242a[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0xa242('0x0'));var util=require(_0xa242('0x1'));var moment=require('moment');var BPromise=require(_0xa242('0x2'));var rs=require(_0xa242('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa242('0x4'))['db'];var utils=require(_0xa242('0x5'));var logger=require('../../config/logger')(_0xa242('0x6'));var config=require(_0xa242('0x7'));var jayson=require(_0xa242('0x8'));var client=jayson[_0xa242('0x9')][_0xa242('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c071f,_0x444070,_0x4f30fc){return new BPromise(function(_0x574993,_0x2f10ce){return client['request'](_0x4c071f,_0x4f30fc)['then'](function(_0x63dc75){logger['info']('VtigerField,\x20%s,\x20%s',_0x444070,_0xa242('0xb'));logger['debug'](_0xa242('0xc'),_0x444070,'request\x20sent',JSON['stringify'](_0x63dc75));if(_0x63dc75['error']){if(_0x63dc75[_0xa242('0xd')]['code']===0x1f4){logger[_0xa242('0xd')](_0xa242('0xe'),_0x444070,_0x63dc75[_0xa242('0xd')]['message']);return _0x2f10ce(_0x63dc75['error']['message']);}logger[_0xa242('0xd')](_0xa242('0xe'),_0x444070,_0x63dc75[_0xa242('0xd')][_0xa242('0xf')]);return _0x574993(_0x63dc75[_0xa242('0xd')]['message']);}else{logger[_0xa242('0x10')]('VtigerField,\x20%s,\x20%s',_0x444070,_0xa242('0xb'));_0x574993(_0x63dc75['result'][_0xa242('0xf')]);}})['catch'](function(_0x39d9db){logger['error']('VtigerField,\x20%s,\x20%s',_0x444070,_0x39d9db);_0x2f10ce(_0x39d9db);});});}