Built motion from commit ddca4d0d.|2.5.47
[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 _0xa204=['jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x227ce6,_0x5f0ac6){var _0x59bd69=function(_0x2cf889){while(--_0x2cf889){_0x227ce6['push'](_0x227ce6['shift']());}};_0x59bd69(++_0x5f0ac6);}(_0xa204,0x1db));var _0x4a20=function(_0x2fc4ac,_0x9d882d){_0x2fc4ac=_0x2fc4ac-0x0;var _0x3b77af=_0xa204[_0x2fc4ac];return _0x3b77af;};'use strict';var _=require('lodash');var util=require(_0x4a20('0x0'));var moment=require(_0x4a20('0x1'));var BPromise=require(_0x4a20('0x2'));var rs=require(_0x4a20('0x3'));var fs=require('fs');var Redis=require(_0x4a20('0x4'));var db=require(_0x4a20('0x5'))['db'];var utils=require(_0x4a20('0x6'));var logger=require(_0x4a20('0x7'))(_0x4a20('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a20('0x9'));var client=jayson[_0x4a20('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x764e3a,_0x3f5f51,_0x498483){return new BPromise(function(_0xe143a6,_0x11aecc){return client[_0x4a20('0xb')](_0x764e3a,_0x498483)[_0x4a20('0xc')](function(_0x571311){logger[_0x4a20('0xd')](_0x4a20('0xe'),_0x3f5f51,_0x4a20('0xf'));logger['debug'](_0x4a20('0x10'),_0x3f5f51,_0x4a20('0xf'),JSON[_0x4a20('0x11')](_0x571311));if(_0x571311[_0x4a20('0x12')]){if(_0x571311[_0x4a20('0x12')]['code']===0x1f4){logger['error'](_0x4a20('0xe'),_0x3f5f51,_0x571311['error']['message']);return _0x11aecc(_0x571311[_0x4a20('0x12')]['message']);}logger[_0x4a20('0x12')](_0x4a20('0xe'),_0x3f5f51,_0x571311[_0x4a20('0x12')]['message']);return _0xe143a6(_0x571311[_0x4a20('0x12')][_0x4a20('0x13')]);}else{logger[_0x4a20('0xd')](_0x4a20('0xe'),_0x3f5f51,_0x4a20('0xf'));_0xe143a6(_0x571311[_0x4a20('0x14')][_0x4a20('0x13')]);}})[_0x4a20('0x15')](function(_0x19921b){logger['error'](_0x4a20('0xe'),_0x3f5f51,_0x19921b);_0x11aecc(_0x19921b);});});}