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 _0x8138=['jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8138,0x1da));var _0x8813=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x8138[_0x5e8eae];return _0xdd09cd;};'use strict';var _=require(_0x8813('0x0'));var util=require('util');var moment=require(_0x8813('0x1'));var BPromise=require(_0x8813('0x2'));var rs=require(_0x8813('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8813('0x4'))['db'];var utils=require(_0x8813('0x5'));var logger=require(_0x8813('0x6'))(_0x8813('0x7'));var config=require(_0x8813('0x8'));var jayson=require(_0x8813('0x9'));var client=jayson[_0x8813('0xa')][_0x8813('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x461647,_0x180537,_0x1e57c3){return new BPromise(function(_0x1a3056,_0x3a77c9){return client[_0x8813('0xc')](_0x461647,_0x1e57c3)[_0x8813('0xd')](function(_0x172250){logger[_0x8813('0xe')](_0x8813('0xf'),_0x180537,'request\x20sent');logger[_0x8813('0x10')](_0x8813('0x11'),_0x180537,'request\x20sent',JSON['stringify'](_0x172250));if(_0x172250[_0x8813('0x12')]){if(_0x172250['error']['code']===0x1f4){logger[_0x8813('0x12')]('CmCustomField,\x20%s,\x20%s',_0x180537,_0x172250[_0x8813('0x12')][_0x8813('0x13')]);return _0x3a77c9(_0x172250[_0x8813('0x12')]['message']);}logger[_0x8813('0x12')](_0x8813('0xf'),_0x180537,_0x172250[_0x8813('0x12')][_0x8813('0x13')]);return _0x1a3056(_0x172250['error'][_0x8813('0x13')]);}else{logger[_0x8813('0xe')](_0x8813('0xf'),_0x180537,_0x8813('0x14'));_0x1a3056(_0x172250[_0x8813('0x15')]['message']);}})[_0x8813('0x16')](function(_0x2435c9){logger[_0x8813('0x12')](_0x8813('0xf'),_0x180537,_0x2435c9);_0x3a77c9(_0x2435c9);});});}