Built motion from commit (unavailable).|2.5.13
[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 _0x61d0=['http','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x141c42,_0x211401){var _0x3553d0=function(_0x52c33b){while(--_0x52c33b){_0x141c42['push'](_0x141c42['shift']());}};_0x3553d0(++_0x211401);}(_0x61d0,0x187));var _0x061d=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0x61d0[_0x38987f];return _0x4cb697;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var moment=require(_0x061d('0x1'));var BPromise=require(_0x061d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x061d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x061d('0x4'));var logger=require(_0x061d('0x5'))('rpc');var config=require(_0x061d('0x6'));var jayson=require(_0x061d('0x7'));var client=jayson[_0x061d('0x8')][_0x061d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1edb0c,_0x476cbf,_0x362bdd){return new BPromise(function(_0x572b0e,_0x4b6606){return client['request'](_0x1edb0c,_0x362bdd)[_0x061d('0xa')](function(_0x5d5a4b){logger[_0x061d('0xb')](_0x061d('0xc'),_0x476cbf,'request\x20sent');logger[_0x061d('0xd')](_0x061d('0xe'),_0x476cbf,_0x061d('0xf'),JSON[_0x061d('0x10')](_0x5d5a4b));if(_0x5d5a4b[_0x061d('0x11')]){if(_0x5d5a4b[_0x061d('0x11')][_0x061d('0x12')]===0x1f4){logger['error'](_0x061d('0xc'),_0x476cbf,_0x5d5a4b[_0x061d('0x11')][_0x061d('0x13')]);return _0x4b6606(_0x5d5a4b[_0x061d('0x11')][_0x061d('0x13')]);}logger[_0x061d('0x11')](_0x061d('0xc'),_0x476cbf,_0x5d5a4b[_0x061d('0x11')][_0x061d('0x13')]);return _0x572b0e(_0x5d5a4b[_0x061d('0x11')]['message']);}else{logger[_0x061d('0xb')](_0x061d('0xc'),_0x476cbf,_0x061d('0xf'));_0x572b0e(_0x5d5a4b['result'][_0x061d('0x13')]);}})['catch'](function(_0x571fa8){logger[_0x061d('0x11')](_0x061d('0xc'),_0x476cbf,_0x571fa8);_0x4b6606(_0x571fa8);});});}