Built motion from commit efa66e19.|2.6.22
[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 _0xf8fa=['../../config/environment','client','request','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x550ae0,_0x394e05){var _0x1271d1=function(_0x2a267e){while(--_0x2a267e){_0x550ae0['push'](_0x550ae0['shift']());}};_0x1271d1(++_0x394e05);}(_0xf8fa,0x176));var _0xaf8f=function(_0x28053c,_0x30d230){_0x28053c=_0x28053c-0x0;var _0x34dfef=_0xf8fa[_0x28053c];return _0x34dfef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaf8f('0x0'));var BPromise=require(_0xaf8f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf8f('0x2'));var db=require(_0xaf8f('0x3'))['db'];var utils=require(_0xaf8f('0x4'));var logger=require(_0xaf8f('0x5'))('rpc');var config=require(_0xaf8f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaf8f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x254238,_0x599b64,_0x4709f1){return new BPromise(function(_0x296884,_0x67d7e){return client[_0xaf8f('0x8')](_0x254238,_0x4709f1)['then'](function(_0x523923){logger['info'](_0xaf8f('0x9'),_0x599b64,'request\x20sent');logger[_0xaf8f('0xa')](_0xaf8f('0xb'),_0x599b64,'request\x20sent',JSON[_0xaf8f('0xc')](_0x523923));if(_0x523923['error']){if(_0x523923[_0xaf8f('0xd')][_0xaf8f('0xe')]===0x1f4){logger[_0xaf8f('0xd')](_0xaf8f('0x9'),_0x599b64,_0x523923[_0xaf8f('0xd')]['message']);return _0x67d7e(_0x523923[_0xaf8f('0xd')][_0xaf8f('0xf')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x599b64,_0x523923[_0xaf8f('0xd')][_0xaf8f('0xf')]);return _0x296884(_0x523923[_0xaf8f('0xd')][_0xaf8f('0xf')]);}else{logger[_0xaf8f('0x10')](_0xaf8f('0x9'),_0x599b64,_0xaf8f('0x11'));_0x296884(_0x523923[_0xaf8f('0x12')][_0xaf8f('0xf')]);}})[_0xaf8f('0x13')](function(_0x426263){logger[_0xaf8f('0xd')]('CmCustomField,\x20%s,\x20%s',_0x599b64,_0x426263);_0x67d7e(_0x426263);});});}