2689bc239b2d58f9a597301302b94b8614674889
[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 _0x2f03=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x2a49e5,_0x36872a){var _0x2798be=function(_0x4b95a3){while(--_0x4b95a3){_0x2a49e5['push'](_0x2a49e5['shift']());}};_0x2798be(++_0x36872a);}(_0x2f03,0x77));var _0x32f0=function(_0xabb781,_0x3293ae){_0xabb781=_0xabb781-0x0;var _0x2870b9=_0x2f03[_0xabb781];return _0x2870b9;};'use strict';var _=require(_0x32f0('0x0'));var util=require(_0x32f0('0x1'));var moment=require(_0x32f0('0x2'));var BPromise=require(_0x32f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32f0('0x4'));var db=require(_0x32f0('0x5'))['db'];var utils=require(_0x32f0('0x6'));var logger=require(_0x32f0('0x7'))(_0x32f0('0x8'));var config=require(_0x32f0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x32f0('0xa')][_0x32f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31ee76,_0x4d8a3a,_0x58361d){return new BPromise(function(_0x487020,_0x25905b){return client[_0x32f0('0xc')](_0x31ee76,_0x58361d)[_0x32f0('0xd')](function(_0x154960){logger[_0x32f0('0xe')]('CmCustomField,\x20%s,\x20%s',_0x4d8a3a,_0x32f0('0xf'));logger[_0x32f0('0x10')](_0x32f0('0x11'),_0x4d8a3a,_0x32f0('0xf'),JSON['stringify'](_0x154960));if(_0x154960[_0x32f0('0x12')]){if(_0x154960[_0x32f0('0x12')][_0x32f0('0x13')]===0x1f4){logger[_0x32f0('0x12')](_0x32f0('0x14'),_0x4d8a3a,_0x154960[_0x32f0('0x12')][_0x32f0('0x15')]);return _0x25905b(_0x154960['error'][_0x32f0('0x15')]);}logger[_0x32f0('0x12')](_0x32f0('0x14'),_0x4d8a3a,_0x154960[_0x32f0('0x12')][_0x32f0('0x15')]);return _0x487020(_0x154960['error'][_0x32f0('0x15')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x4d8a3a,_0x32f0('0xf'));_0x487020(_0x154960[_0x32f0('0x16')][_0x32f0('0x15')]);}})[_0x32f0('0x17')](function(_0x5a2572){logger['error'](_0x32f0('0x14'),_0x4d8a3a,_0x5a2572);_0x25905b(_0x5a2572);});});}