219bcfa1dd082b71cf71f4411c9743299389b669
[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 _0x29d4=['request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s'];(function(_0x2492b5,_0x54f734){var _0xcdb1d7=function(_0xbb0540){while(--_0xbb0540){_0x2492b5['push'](_0x2492b5['shift']());}};_0xcdb1d7(++_0x54f734);}(_0x29d4,0x1a1));var _0x429d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x29d4[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var moment=require(_0x429d('0x1'));var BPromise=require(_0x429d('0x2'));var rs=require(_0x429d('0x3'));var fs=require('fs');var Redis=require(_0x429d('0x4'));var db=require(_0x429d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x429d('0x6'))(_0x429d('0x7'));var config=require(_0x429d('0x8'));var jayson=require(_0x429d('0x9'));var client=jayson[_0x429d('0xa')][_0x429d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56aa2f,_0x1ede3f,_0x4befb9){return new BPromise(function(_0x9fc337,_0x47cb29){return client[_0x429d('0xc')](_0x56aa2f,_0x4befb9)[_0x429d('0xd')](function(_0xe6f5b4){logger['info'](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));logger['debug'](_0x429d('0x10'),_0x1ede3f,_0x429d('0xf'),JSON[_0x429d('0x11')](_0xe6f5b4));if(_0xe6f5b4['error']){if(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x13')]===0x1f4){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4['error'][_0x429d('0x14')]);return _0x47cb29(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}logger['error'](_0x429d('0xe'),_0x1ede3f,_0xe6f5b4[_0x429d('0x12')]['message']);return _0x9fc337(_0xe6f5b4[_0x429d('0x12')][_0x429d('0x14')]);}else{logger[_0x429d('0x15')](_0x429d('0xe'),_0x1ede3f,_0x429d('0xf'));_0x9fc337(_0xe6f5b4[_0x429d('0x16')]['message']);}})[_0x429d('0x17')](function(_0x53d19d){logger[_0x429d('0x12')](_0x429d('0xe'),_0x1ede3f,_0x53d19d);_0x47cb29(_0x53d19d);});});}