5cd467fcd74e9ff5218b7b24a584385b668c104b
[motion2.git] / server / api / mailServerIn / mailServerIn.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 _0x98fc=['http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','findAll','options','raw','limit','map','include','model','attributes','then','GetMailServerIn','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x34bf20,_0x292acb){var _0xc1ba1b=function(_0x2519bc){while(--_0x2519bc){_0x34bf20['push'](_0x34bf20['shift']());}};_0xc1ba1b(++_0x292acb);}(_0x98fc,0x156));var _0xc98f=function(_0x625a73,_0x50ae08){_0x625a73=_0x625a73-0x0;var _0x3eceb5=_0x98fc[_0x625a73];return _0x3eceb5;};'use strict';var _=require(_0xc98f('0x0'));var util=require(_0xc98f('0x1'));var moment=require(_0xc98f('0x2'));var BPromise=require(_0xc98f('0x3'));var rs=require(_0xc98f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc98f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc98f('0x6'))('rpc');var config=require(_0xc98f('0x7'));var jayson=require(_0xc98f('0x8'));var client=jayson[_0xc98f('0x9')][_0xc98f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3237e1,_0x1a8812,_0x28f276){return new BPromise(function(_0x191b3f,_0x12bdba){return client[_0xc98f('0xb')](_0x3237e1,_0x28f276)['then'](function(_0xb21d1a){logger['info'](_0xc98f('0xc'),_0x1a8812,_0xc98f('0xd'));logger[_0xc98f('0xe')](_0xc98f('0xf'),_0x1a8812,_0xc98f('0xd'),JSON['stringify'](_0xb21d1a));if(_0xb21d1a['error']){if(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x11')]===0x1f4){logger[_0xc98f('0x10')](_0xc98f('0xc'),_0x1a8812,_0xb21d1a[_0xc98f('0x10')]['message']);return _0x12bdba(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);}logger['error'](_0xc98f('0xc'),_0x1a8812,_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);return _0x191b3f(_0xb21d1a[_0xc98f('0x10')][_0xc98f('0x12')]);}else{logger[_0xc98f('0x13')]('MailServerIn,\x20%s,\x20%s',_0x1a8812,_0xc98f('0xd'));_0x191b3f(_0xb21d1a[_0xc98f('0x14')]['message']);}})[_0xc98f('0x15')](function(_0x5ef39c){logger[_0xc98f('0x10')](_0xc98f('0xc'),_0x1a8812,_0x5ef39c);_0x12bdba(_0x5ef39c);});});}exports['GetMailServerIn']=function(_0xbed285){var _0x838572=this;return new Promise(function(_0x19e873,_0x53b2e5){return db['MailServerIn'][_0xc98f('0x16')]({'raw':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')][_0xc98f('0x18')]===undefined?!![]:![]:!![],'where':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')]['where']||null:null,'attributes':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')]['attributes']||null:null,'limit':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')][_0xc98f('0x19')]||null:null,'include':_0xbed285[_0xc98f('0x17')]?_0xbed285[_0xc98f('0x17')]['include']?_[_0xc98f('0x1a')](_0xbed285[_0xc98f('0x17')][_0xc98f('0x1b')],function(_0x433576){return{'model':db[_0x433576[_0xc98f('0x1c')]],'as':_0x433576['as'],'attributes':_0x433576[_0xc98f('0x1d')],'include':_0x433576[_0xc98f('0x1b')]?_[_0xc98f('0x1a')](_0x433576[_0xc98f('0x1b')],function(_0x13c9c9){return{'model':db[_0x13c9c9[_0xc98f('0x1c')]],'as':_0x13c9c9['as'],'attributes':_0x13c9c9['attributes'],'include':_0x13c9c9[_0xc98f('0x1b')]?_[_0xc98f('0x1a')](_0x13c9c9[_0xc98f('0x1b')],function(_0x13f9e0){return{'model':db[_0x13f9e0[_0xc98f('0x1c')]],'as':_0x13f9e0['as'],'attributes':_0x13f9e0[_0xc98f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc98f('0x1e')](function(_0x297429){logger['info'](_0xc98f('0x1f'),_0xbed285);logger[_0xc98f('0xe')](_0xc98f('0x1f'),_0xbed285,JSON['stringify'](_0x297429));_0x19e873(_0x297429);})[_0xc98f('0x15')](function(_0x202500){logger[_0xc98f('0x10')](_0xc98f('0x1f'),_0x202500['message'],_0xbed285);_0x53b2e5(_0x838572[_0xc98f('0x10')](0x1f4,_0x202500['message']));});});};