Built motion from commit 497d3d92.|2.5.43
[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 _0x1f9d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','util','moment','bluebird'];(function(_0x402927,_0x38396b){var _0x1f4500=function(_0x3c3d34){while(--_0x3c3d34){_0x402927['push'](_0x402927['shift']());}};_0x1f4500(++_0x38396b);}(_0x1f9d,0x9d));var _0xd1f9=function(_0x367054,_0x3ae59c){_0x367054=_0x367054-0x0;var _0x54fbd8=_0x1f9d[_0x367054];return _0x54fbd8;};'use strict';var _=require('lodash');var util=require(_0xd1f9('0x0'));var moment=require(_0xd1f9('0x1'));var BPromise=require(_0xd1f9('0x2'));var rs=require(_0xd1f9('0x3'));var fs=require('fs');var Redis=require(_0xd1f9('0x4'));var db=require(_0xd1f9('0x5'))['db'];var utils=require(_0xd1f9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd1f9('0x7'));var jayson=require(_0xd1f9('0x8'));var client=jayson[_0xd1f9('0x9')][_0xd1f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d124e,_0x3f45c0,_0x1674a7){return new BPromise(function(_0x2f75e6,_0x1de350){return client[_0xd1f9('0xb')](_0x1d124e,_0x1674a7)[_0xd1f9('0xc')](function(_0x9a7f9b){logger[_0xd1f9('0xd')](_0xd1f9('0xe'),_0x3f45c0,_0xd1f9('0xf'));logger[_0xd1f9('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x3f45c0,_0xd1f9('0xf'),JSON['stringify'](_0x9a7f9b));if(_0x9a7f9b['error']){if(_0x9a7f9b[_0xd1f9('0x11')]['code']===0x1f4){logger['error'](_0xd1f9('0xe'),_0x3f45c0,_0x9a7f9b[_0xd1f9('0x11')][_0xd1f9('0x12')]);return _0x1de350(_0x9a7f9b[_0xd1f9('0x11')][_0xd1f9('0x12')]);}logger[_0xd1f9('0x11')](_0xd1f9('0xe'),_0x3f45c0,_0x9a7f9b[_0xd1f9('0x11')]['message']);return _0x2f75e6(_0x9a7f9b[_0xd1f9('0x11')]['message']);}else{logger[_0xd1f9('0xd')](_0xd1f9('0xe'),_0x3f45c0,_0xd1f9('0xf'));_0x2f75e6(_0x9a7f9b['result'][_0xd1f9('0x12')]);}})[_0xd1f9('0x13')](function(_0x388343){logger[_0xd1f9('0x11')](_0xd1f9('0xe'),_0x3f45c0,_0x388343);_0x1de350(_0x388343);});});}