28c108271fa7ce38281c0f4d812b32c42b1c292b
[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 _0x481a=['GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0x481a,0xbb));var _0xa481=function(_0x157895,_0x112954){_0x157895=_0x157895-0x0;var _0x102e78=_0x481a[_0x157895];return _0x102e78;};'use strict';var _=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var moment=require(_0xa481('0x2'));var BPromise=require(_0xa481('0x3'));var rs=require(_0xa481('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa481('0x5'))['db'];var utils=require(_0xa481('0x6'));var logger=require(_0xa481('0x7'))(_0xa481('0x8'));var config=require(_0xa481('0x9'));var jayson=require(_0xa481('0xa'));var client=jayson['client'][_0xa481('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea134,_0x3c6e8c,_0x321203){return new BPromise(function(_0x267f0b,_0x2848a7){return client[_0xa481('0xc')](_0xea134,_0x321203)[_0xa481('0xd')](function(_0x4a5c98){logger[_0xa481('0xe')](_0xa481('0xf'),_0x3c6e8c,_0xa481('0x10'));logger['debug'](_0xa481('0x11'),_0x3c6e8c,_0xa481('0x10'),JSON[_0xa481('0x12')](_0x4a5c98));if(_0x4a5c98[_0xa481('0x13')]){if(_0x4a5c98[_0xa481('0x13')][_0xa481('0x14')]===0x1f4){logger[_0xa481('0x13')](_0xa481('0xf'),_0x3c6e8c,_0x4a5c98[_0xa481('0x13')]['message']);return _0x2848a7(_0x4a5c98[_0xa481('0x13')]['message']);}logger[_0xa481('0x13')](_0xa481('0xf'),_0x3c6e8c,_0x4a5c98[_0xa481('0x13')][_0xa481('0x15')]);return _0x267f0b(_0x4a5c98[_0xa481('0x13')]['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x3c6e8c,_0xa481('0x10'));_0x267f0b(_0x4a5c98[_0xa481('0x16')][_0xa481('0x15')]);}})['catch'](function(_0x1ba2cf){logger['error'](_0xa481('0xf'),_0x3c6e8c,_0x1ba2cf);_0x2848a7(_0x1ba2cf);});});}exports[_0xa481('0x17')]=function(_0x2d220d){var _0x53765a=this;return new Promise(function(_0xd3b8f0,_0x148776){return db[_0xa481('0x18')][_0xa481('0x19')]({'raw':_0x2d220d['options']?_0x2d220d[_0xa481('0x1a')][_0xa481('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d220d[_0xa481('0x1a')]?_0x2d220d[_0xa481('0x1a')][_0xa481('0x1c')]||null:null,'attributes':_0x2d220d[_0xa481('0x1a')]?_0x2d220d['options'][_0xa481('0x1d')]||null:null,'limit':_0x2d220d[_0xa481('0x1a')]?_0x2d220d[_0xa481('0x1a')][_0xa481('0x1e')]||null:null,'include':_0x2d220d[_0xa481('0x1a')]?_0x2d220d['options'][_0xa481('0x1f')]?_[_0xa481('0x20')](_0x2d220d['options'][_0xa481('0x1f')],function(_0x6170ad){return{'model':db[_0x6170ad['model']],'as':_0x6170ad['as'],'attributes':_0x6170ad[_0xa481('0x1d')],'include':_0x6170ad[_0xa481('0x1f')]?_[_0xa481('0x20')](_0x6170ad[_0xa481('0x1f')],function(_0x4c9dfc){return{'model':db[_0x4c9dfc[_0xa481('0x21')]],'as':_0x4c9dfc['as'],'attributes':_0x4c9dfc[_0xa481('0x1d')],'include':_0x4c9dfc[_0xa481('0x1f')]?_[_0xa481('0x20')](_0x4c9dfc[_0xa481('0x1f')],function(_0x5405f1){return{'model':db[_0x5405f1[_0xa481('0x21')]],'as':_0x5405f1['as'],'attributes':_0x5405f1[_0xa481('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa481('0xd')](function(_0x3bb01d){logger['info'](_0xa481('0x17'),_0x2d220d);logger['debug'](_0xa481('0x17'),_0x2d220d,JSON['stringify'](_0x3bb01d));_0xd3b8f0(_0x3bb01d);})[_0xa481('0x22')](function(_0x4e6840){logger[_0xa481('0x13')]('GetMailServerIn',_0x4e6840['message'],_0x2d220d);_0x148776(_0x53765a[_0xa481('0x13')](0x1f4,_0x4e6840['message']));});});};