Built motion from commit da617fac.|2.6.6
[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 _0x7adb=['result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x27ef37,_0x52cb2f){var _0x5d8bd8=function(_0x11027d){while(--_0x11027d){_0x27ef37['push'](_0x27ef37['shift']());}};_0x5d8bd8(++_0x52cb2f);}(_0x7adb,0x7f));var _0xb7ad=function(_0x1c05c8,_0x1b93ee){_0x1c05c8=_0x1c05c8-0x0;var _0x10789b=_0x7adb[_0x1c05c8];return _0x10789b;};'use strict';var _=require('lodash');var util=require(_0xb7ad('0x0'));var moment=require(_0xb7ad('0x1'));var BPromise=require('bluebird');var rs=require(_0xb7ad('0x2'));var fs=require('fs');var Redis=require(_0xb7ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7ad('0x4'));var logger=require(_0xb7ad('0x5'))(_0xb7ad('0x6'));var config=require('../../config/environment');var jayson=require(_0xb7ad('0x7'));var client=jayson['client'][_0xb7ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ad4a5,_0x5057cb,_0x40ea6e){return new BPromise(function(_0x59c3c4,_0x30dad8){return client[_0xb7ad('0x9')](_0x5ad4a5,_0x40ea6e)[_0xb7ad('0xa')](function(_0x4238e1){logger[_0xb7ad('0xb')](_0xb7ad('0xc'),_0x5057cb,_0xb7ad('0xd'));logger[_0xb7ad('0xe')](_0xb7ad('0xf'),_0x5057cb,_0xb7ad('0xd'),JSON[_0xb7ad('0x10')](_0x4238e1));if(_0x4238e1['error']){if(_0x4238e1[_0xb7ad('0x11')][_0xb7ad('0x12')]===0x1f4){logger[_0xb7ad('0x11')]('CmCustomField,\x20%s,\x20%s',_0x5057cb,_0x4238e1[_0xb7ad('0x11')][_0xb7ad('0x13')]);return _0x30dad8(_0x4238e1[_0xb7ad('0x11')]['message']);}logger['error'](_0xb7ad('0xc'),_0x5057cb,_0x4238e1['error'][_0xb7ad('0x13')]);return _0x59c3c4(_0x4238e1[_0xb7ad('0x11')][_0xb7ad('0x13')]);}else{logger[_0xb7ad('0xb')]('CmCustomField,\x20%s,\x20%s',_0x5057cb,'request\x20sent');_0x59c3c4(_0x4238e1[_0xb7ad('0x14')][_0xb7ad('0x13')]);}})['catch'](function(_0x1a017b){logger[_0xb7ad('0x11')]('CmCustomField,\x20%s,\x20%s',_0x5057cb,_0x1a017b);_0x30dad8(_0x1a017b);});});}