Built motion from commit f7863d46.|2.5.41
[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 _0xe147=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2ee447,_0x5ba35f){var _0x407ce9=function(_0x33120c){while(--_0x33120c){_0x2ee447['push'](_0x2ee447['shift']());}};_0x407ce9(++_0x5ba35f);}(_0xe147,0xeb));var _0x7e14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe147[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7e14('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e14('0x1'));var rs=require(_0x7e14('0x2'));var fs=require('fs');var Redis=require(_0x7e14('0x3'));var db=require(_0x7e14('0x4'))['db'];var utils=require(_0x7e14('0x5'));var logger=require(_0x7e14('0x6'))(_0x7e14('0x7'));var config=require(_0x7e14('0x8'));var jayson=require(_0x7e14('0x9'));var client=jayson[_0x7e14('0xa')][_0x7e14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4642d8,_0x191544,_0x5c0b4a){return new BPromise(function(_0x562b6e,_0x2db548){return client[_0x7e14('0xc')](_0x4642d8,_0x5c0b4a)[_0x7e14('0xd')](function(_0x284a21){logger[_0x7e14('0xe')](_0x7e14('0xf'),_0x191544,_0x7e14('0x10'));logger[_0x7e14('0x11')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x191544,_0x7e14('0x10'),JSON['stringify'](_0x284a21));if(_0x284a21[_0x7e14('0x12')]){if(_0x284a21[_0x7e14('0x12')]['code']===0x1f4){logger[_0x7e14('0x12')](_0x7e14('0xf'),_0x191544,_0x284a21[_0x7e14('0x12')][_0x7e14('0x13')]);return _0x2db548(_0x284a21[_0x7e14('0x12')][_0x7e14('0x13')]);}logger[_0x7e14('0x12')](_0x7e14('0xf'),_0x191544,_0x284a21[_0x7e14('0x12')][_0x7e14('0x13')]);return _0x562b6e(_0x284a21['error']['message']);}else{logger['info'](_0x7e14('0xf'),_0x191544,_0x7e14('0x10'));_0x562b6e(_0x284a21[_0x7e14('0x14')][_0x7e14('0x13')]);}})[_0x7e14('0x15')](function(_0x276acc){logger['error'](_0x7e14('0xf'),_0x191544,_0x276acc);_0x2db548(_0x276acc);});});}