Built motion from commit (unavailable).|2.5.6
[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 _0x3621=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','randomstring','ioredis'];(function(_0x5c4585,_0x3d0eab){var _0x21dede=function(_0x5c3d6a){while(--_0x5c3d6a){_0x5c4585['push'](_0x5c4585['shift']());}};_0x21dede(++_0x3d0eab);}(_0x3621,0xe3));var _0x1362=function(_0x1534a2,_0x3dea19){_0x1534a2=_0x1534a2-0x0;var _0x42b620=_0x3621[_0x1534a2];return _0x42b620;};'use strict';var _=require(_0x1362('0x0'));var util=require(_0x1362('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1362('0x2'));var fs=require('fs');var Redis=require(_0x1362('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1362('0x4'))(_0x1362('0x5'));var config=require(_0x1362('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1362('0x7')][_0x1362('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c9fe9,_0x3cbcf7,_0x4886e4){return new BPromise(function(_0x19d7f7,_0x2bd47b){return client[_0x1362('0x9')](_0x2c9fe9,_0x4886e4)[_0x1362('0xa')](function(_0x1e941b){logger[_0x1362('0xb')](_0x1362('0xc'),_0x3cbcf7,_0x1362('0xd'));logger[_0x1362('0xe')](_0x1362('0xf'),_0x3cbcf7,_0x1362('0xd'),JSON[_0x1362('0x10')](_0x1e941b));if(_0x1e941b[_0x1362('0x11')]){if(_0x1e941b['error'][_0x1362('0x12')]===0x1f4){logger[_0x1362('0x11')](_0x1362('0xc'),_0x3cbcf7,_0x1e941b[_0x1362('0x11')][_0x1362('0x13')]);return _0x2bd47b(_0x1e941b[_0x1362('0x11')][_0x1362('0x13')]);}logger[_0x1362('0x11')](_0x1362('0xc'),_0x3cbcf7,_0x1e941b['error'][_0x1362('0x13')]);return _0x19d7f7(_0x1e941b[_0x1362('0x11')][_0x1362('0x13')]);}else{logger[_0x1362('0xb')](_0x1362('0xc'),_0x3cbcf7,_0x1362('0xd'));_0x19d7f7(_0x1e941b[_0x1362('0x14')]['message']);}})[_0x1362('0x15')](function(_0x535061){logger[_0x1362('0x11')](_0x1362('0xc'),_0x3cbcf7,_0x535061);_0x2bd47b(_0x535061);});});}exports[_0x1362('0x16')]=function(_0x30e14c){var _0x3374a9=this;return new Promise(function(_0x1a7cf2,_0x4c57d5){return db[_0x1362('0x17')][_0x1362('0x18')]({'raw':_0x30e14c[_0x1362('0x19')]?_0x30e14c[_0x1362('0x19')][_0x1362('0x1a')]===undefined?!![]:![]:!![],'where':_0x30e14c[_0x1362('0x19')]?_0x30e14c[_0x1362('0x19')][_0x1362('0x1b')]||null:null,'attributes':_0x30e14c[_0x1362('0x19')]?_0x30e14c[_0x1362('0x19')]['attributes']||null:null,'limit':_0x30e14c[_0x1362('0x19')]?_0x30e14c[_0x1362('0x19')][_0x1362('0x1c')]||null:null,'include':_0x30e14c['options']?_0x30e14c[_0x1362('0x19')][_0x1362('0x1d')]?_[_0x1362('0x1e')](_0x30e14c['options']['include'],function(_0x5685f){return{'model':db[_0x5685f[_0x1362('0x1f')]],'as':_0x5685f['as'],'attributes':_0x5685f[_0x1362('0x20')],'include':_0x5685f[_0x1362('0x1d')]?_[_0x1362('0x1e')](_0x5685f[_0x1362('0x1d')],function(_0xfe970c){return{'model':db[_0xfe970c[_0x1362('0x1f')]],'as':_0xfe970c['as'],'attributes':_0xfe970c[_0x1362('0x20')],'include':_0xfe970c[_0x1362('0x1d')]?_[_0x1362('0x1e')](_0xfe970c[_0x1362('0x1d')],function(_0x9dbbca){return{'model':db[_0x9dbbca[_0x1362('0x1f')]],'as':_0x9dbbca['as'],'attributes':_0x9dbbca[_0x1362('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1362('0xa')](function(_0x534d14){logger[_0x1362('0xb')](_0x1362('0x16'),_0x30e14c);logger[_0x1362('0xe')](_0x1362('0x16'),_0x30e14c,JSON[_0x1362('0x10')](_0x534d14));_0x1a7cf2(_0x534d14);})[_0x1362('0x15')](function(_0x2fadd4){logger[_0x1362('0x11')](_0x1362('0x16'),_0x2fadd4['message'],_0x30e14c);_0x4c57d5(_0x3374a9[_0x1362('0x11')](0x1f4,_0x2fadd4[_0x1362('0x13')]));});});};