Built motion from commit (unavailable).|2.3.1
[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 _0xfc03=['request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http'];(function(_0x52c1f6,_0x4eda0b){var _0x4df981=function(_0x71aa7){while(--_0x71aa7){_0x52c1f6['push'](_0x52c1f6['shift']());}};_0x4df981(++_0x4eda0b);}(_0xfc03,0xde));var _0x3fc0=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xfc03[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x3fc0('0x0'));var util=require(_0x3fc0('0x1'));var moment=require(_0x3fc0('0x2'));var BPromise=require('bluebird');var rs=require(_0x3fc0('0x3'));var fs=require('fs');var Redis=require(_0x3fc0('0x4'));var db=require(_0x3fc0('0x5'))['db'];var utils=require(_0x3fc0('0x6'));var logger=require('../../config/logger')(_0x3fc0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3fc0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4434ba,_0x3c3c33,_0x3aa2f4){return new BPromise(function(_0x3fb1a3,_0x5d9c6b){return client[_0x3fc0('0x9')](_0x4434ba,_0x3aa2f4)[_0x3fc0('0xa')](function(_0x1e2e4e){logger[_0x3fc0('0xb')](_0x3fc0('0xc'),_0x3c3c33,_0x3fc0('0xd'));logger[_0x3fc0('0xe')](_0x3fc0('0xf'),_0x3c3c33,_0x3fc0('0xd'),JSON['stringify'](_0x1e2e4e));if(_0x1e2e4e['error']){if(_0x1e2e4e['error'][_0x3fc0('0x10')]===0x1f4){logger[_0x3fc0('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3c3c33,_0x1e2e4e['error'][_0x3fc0('0x12')]);return _0x5d9c6b(_0x1e2e4e[_0x3fc0('0x11')][_0x3fc0('0x12')]);}logger[_0x3fc0('0x11')](_0x3fc0('0xc'),_0x3c3c33,_0x1e2e4e['error']['message']);return _0x3fb1a3(_0x1e2e4e[_0x3fc0('0x11')][_0x3fc0('0x12')]);}else{logger[_0x3fc0('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3c3c33,_0x3fc0('0xd'));_0x3fb1a3(_0x1e2e4e[_0x3fc0('0x13')][_0x3fc0('0x12')]);}})[_0x3fc0('0x14')](function(_0x1c65f2){logger[_0x3fc0('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3c3c33,_0x1c65f2);_0x5d9c6b(_0x1c65f2);});});}exports[_0x3fc0('0x15')]=function(_0x21f739){var _0x11e96c=this;return new Promise(function(_0x4954ea,_0x294a40){return db[_0x3fc0('0x16')][_0x3fc0('0x17')]({'raw':_0x21f739[_0x3fc0('0x18')]?_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x19')]===undefined?!![]:![]:!![],'where':_0x21f739[_0x3fc0('0x18')]?_0x21f739['options'][_0x3fc0('0x1a')]||null:null,'attributes':_0x21f739[_0x3fc0('0x18')]?_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x1b')]||null:null,'limit':_0x21f739[_0x3fc0('0x18')]?_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x1c')]||null:null,'include':_0x21f739[_0x3fc0('0x18')]?_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x1d')]?_[_0x3fc0('0x1e')](_0x21f739[_0x3fc0('0x18')][_0x3fc0('0x1d')],function(_0x918011){return{'model':db[_0x918011[_0x3fc0('0x1f')]],'as':_0x918011['as'],'attributes':_0x918011['attributes'],'include':_0x918011[_0x3fc0('0x1d')]?_[_0x3fc0('0x1e')](_0x918011[_0x3fc0('0x1d')],function(_0x5dbb6f){return{'model':db[_0x5dbb6f[_0x3fc0('0x1f')]],'as':_0x5dbb6f['as'],'attributes':_0x5dbb6f[_0x3fc0('0x1b')],'include':_0x5dbb6f[_0x3fc0('0x1d')]?_[_0x3fc0('0x1e')](_0x5dbb6f['include'],function(_0xaf7f5f){return{'model':db[_0xaf7f5f['model']],'as':_0xaf7f5f['as'],'attributes':_0xaf7f5f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4404b7){logger['info'](_0x3fc0('0x15'),_0x21f739);logger[_0x3fc0('0xe')](_0x3fc0('0x15'),_0x21f739,JSON[_0x3fc0('0x20')](_0x4404b7));_0x4954ea(_0x4404b7);})[_0x3fc0('0x14')](function(_0x2eff72){logger[_0x3fc0('0x11')]('GetMailServerIn',_0x2eff72[_0x3fc0('0x12')],_0x21f739);_0x294a40(_0x11e96c[_0x3fc0('0x11')](0x1f4,_0x2eff72[_0x3fc0('0x12')]));});});};