Built motion from commit 9efc8423.|2.6.31
[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 _0x354c=['request\x20sent','debug','stringify','error','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x354c,0x1e4));var _0xc354=function(_0x515475,_0x579748){_0x515475=_0x515475-0x0;var _0x2b4abc=_0x354c[_0x515475];return _0x2b4abc;};'use strict';var _=require(_0xc354('0x0'));var util=require(_0xc354('0x1'));var moment=require(_0xc354('0x2'));var BPromise=require(_0xc354('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc354('0x4'));var db=require(_0xc354('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc354('0x6'))(_0xc354('0x7'));var config=require(_0xc354('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc354('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x140fa1,_0x53759b,_0x1f6d98){return new BPromise(function(_0x56dfe0,_0x110b52){return client[_0xc354('0xa')](_0x140fa1,_0x1f6d98)['then'](function(_0x585bbd){logger[_0xc354('0xb')]('MailServerIn,\x20%s,\x20%s',_0x53759b,_0xc354('0xc'));logger[_0xc354('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x53759b,_0xc354('0xc'),JSON[_0xc354('0xe')](_0x585bbd));if(_0x585bbd['error']){if(_0x585bbd[_0xc354('0xf')]['code']===0x1f4){logger[_0xc354('0xf')](_0xc354('0x10'),_0x53759b,_0x585bbd['error']['message']);return _0x110b52(_0x585bbd[_0xc354('0xf')][_0xc354('0x11')]);}logger[_0xc354('0xf')]('MailServerIn,\x20%s,\x20%s',_0x53759b,_0x585bbd[_0xc354('0xf')]['message']);return _0x56dfe0(_0x585bbd[_0xc354('0xf')][_0xc354('0x11')]);}else{logger[_0xc354('0xb')](_0xc354('0x10'),_0x53759b,_0xc354('0xc'));_0x56dfe0(_0x585bbd['result'][_0xc354('0x11')]);}})[_0xc354('0x12')](function(_0x313f36){logger['error']('MailServerIn,\x20%s,\x20%s',_0x53759b,_0x313f36);_0x110b52(_0x313f36);});});}exports[_0xc354('0x13')]=function(_0x44f962){var _0x162a72=this;return new Promise(function(_0x1bc99e,_0x522d4c){return db[_0xc354('0x14')][_0xc354('0x15')]({'raw':_0x44f962[_0xc354('0x16')]?_0x44f962[_0xc354('0x16')][_0xc354('0x17')]===undefined?!![]:![]:!![],'where':_0x44f962[_0xc354('0x16')]?_0x44f962['options'][_0xc354('0x18')]||null:null,'attributes':_0x44f962[_0xc354('0x16')]?_0x44f962[_0xc354('0x16')][_0xc354('0x19')]||null:null,'limit':_0x44f962['options']?_0x44f962[_0xc354('0x16')][_0xc354('0x1a')]||null:null,'include':_0x44f962[_0xc354('0x16')]?_0x44f962['options'][_0xc354('0x1b')]?_[_0xc354('0x1c')](_0x44f962['options']['include'],function(_0x11f2bf){return{'model':db[_0x11f2bf[_0xc354('0x1d')]],'as':_0x11f2bf['as'],'attributes':_0x11f2bf[_0xc354('0x19')],'include':_0x11f2bf[_0xc354('0x1b')]?_[_0xc354('0x1c')](_0x11f2bf['include'],function(_0x1bafa5){return{'model':db[_0x1bafa5[_0xc354('0x1d')]],'as':_0x1bafa5['as'],'attributes':_0x1bafa5['attributes'],'include':_0x1bafa5[_0xc354('0x1b')]?_['map'](_0x1bafa5['include'],function(_0x5e1657){return{'model':db[_0x5e1657['model']],'as':_0x5e1657['as'],'attributes':_0x5e1657[_0xc354('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc354('0x1e')](function(_0x2dd22b){logger[_0xc354('0xb')]('GetMailServerIn',_0x44f962);logger[_0xc354('0xd')](_0xc354('0x13'),_0x44f962,JSON['stringify'](_0x2dd22b));_0x1bc99e(_0x2dd22b);})['catch'](function(_0x20cdd2){logger[_0xc354('0xf')](_0xc354('0x13'),_0x20cdd2[_0xc354('0x11')],_0x44f962);_0x522d4c(_0x162a72['error'](0x1f4,_0x20cdd2[_0xc354('0x11')]));});});};