Built motion from commit 0555bc41.|2.5.41
[motion2.git] / server / api / cmCustomField / cmCustomField.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 _0x5ac7=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x26ec1c,_0x274d1b){var _0x3759c0=function(_0x27f626){while(--_0x27f626){_0x26ec1c['push'](_0x26ec1c['shift']());}};_0x3759c0(++_0x274d1b);}(_0x5ac7,0xf8));var _0x75ac=function(_0x1d819e,_0x14c4d0){_0x1d819e=_0x1d819e-0x0;var _0x43bd3f=_0x5ac7[_0x1d819e];return _0x43bd3f;};'use strict';var _=require(_0x75ac('0x0'));var util=require('util');var moment=require(_0x75ac('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75ac('0x2'));var db=require(_0x75ac('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x75ac('0x4'))(_0x75ac('0x5'));var config=require(_0x75ac('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19f748,_0x50be57,_0x41af65){return new BPromise(function(_0x3ef321,_0x15363b){return client['request'](_0x19f748,_0x41af65)['then'](function(_0x567b69){logger[_0x75ac('0x7')](_0x75ac('0x8'),_0x50be57,_0x75ac('0x9'));logger[_0x75ac('0xa')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x50be57,_0x75ac('0x9'),JSON['stringify'](_0x567b69));if(_0x567b69[_0x75ac('0xb')]){if(_0x567b69[_0x75ac('0xb')][_0x75ac('0xc')]===0x1f4){logger[_0x75ac('0xb')]('CmCustomField,\x20%s,\x20%s',_0x50be57,_0x567b69['error'][_0x75ac('0xd')]);return _0x15363b(_0x567b69[_0x75ac('0xb')][_0x75ac('0xd')]);}logger['error'](_0x75ac('0x8'),_0x50be57,_0x567b69[_0x75ac('0xb')][_0x75ac('0xd')]);return _0x3ef321(_0x567b69[_0x75ac('0xb')]['message']);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x50be57,_0x75ac('0x9'));_0x3ef321(_0x567b69[_0x75ac('0xe')][_0x75ac('0xd')]);}})['catch'](function(_0x32978c){logger[_0x75ac('0xb')](_0x75ac('0x8'),_0x50be57,_0x32978c);_0x15363b(_0x32978c);});});}