e8d59d75d783d7077926555b67b3004cdf15dee3
[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 _0x5ad3=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x5e1fb7,_0x32b7e8){var _0x129899=function(_0x30b015){while(--_0x30b015){_0x5e1fb7['push'](_0x5e1fb7['shift']());}};_0x129899(++_0x32b7e8);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x5ad3[_0x47e7dd];return _0x38501f;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var BPromise=require(_0x35ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];var utils=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var jayson=require(_0x35ad('0xa'));var client=jayson[_0x35ad('0xb')][_0x35ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31cc6a,_0x4edc59,_0x292521){return new BPromise(function(_0x3cec3e,_0x3f1f55){return client['request'](_0x31cc6a,_0x292521)[_0x35ad('0xd')](function(_0x487107){logger['info'](_0x35ad('0xe'),_0x4edc59,_0x35ad('0xf'));logger['debug'](_0x35ad('0x10'),_0x4edc59,_0x35ad('0xf'),JSON['stringify'](_0x487107));if(_0x487107['error']){if(_0x487107[_0x35ad('0x11')][_0x35ad('0x12')]===0x1f4){logger['error'](_0x35ad('0xe'),_0x4edc59,_0x487107[_0x35ad('0x11')]['message']);return _0x3f1f55(_0x487107['error'][_0x35ad('0x13')]);}logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x487107['error'][_0x35ad('0x13')]);return _0x3cec3e(_0x487107[_0x35ad('0x11')]['message']);}else{logger[_0x35ad('0x14')]('CmCustomField,\x20%s,\x20%s',_0x4edc59,'request\x20sent');_0x3cec3e(_0x487107[_0x35ad('0x15')][_0x35ad('0x13')]);}})[_0x35ad('0x16')](function(_0x56cb8e){logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x56cb8e);_0x3f1f55(_0x56cb8e);});});}