Built motion from commit (unavailable).|2.5.3
[motion2.git] / server / api / mailServerOut / mailServerOut.controller.js
index b205be8..178d093 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbfd=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','MailServerOut'];(function(_0x3bd6cd,_0xfdc4da){var _0x287d61=function(_0x43e97b){while(--_0x43e97b){_0x3bd6cd['push'](_0x3bd6cd['shift']());}};_0x287d61(++_0xfdc4da);}(_0xbbfd,0x1df));var _0xdbbf=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xbbfd[_0x487b0c];return _0x1adbdc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xdbbf('0x0'));var zipdir=require(_0xdbbf('0x1'));var jsonpatch=require(_0xdbbf('0x2'));var rp=require(_0xdbbf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdbbf('0x4'));var util=require(_0xdbbf('0x5'));var path=require(_0xdbbf('0x6'));var sox=require(_0xdbbf('0x7'));var csv=require(_0xdbbf('0x8'));var ejs=require(_0xdbbf('0x9'));var fs=require('fs');var _=require(_0xdbbf('0xa'));var squel=require(_0xdbbf('0xb'));var crypto=require(_0xdbbf('0xc'));var jsforce=require(_0xdbbf('0xd'));var deskjs=require(_0xdbbf('0xe'));var toCsv=require(_0xdbbf('0x8'));var querystring=require(_0xdbbf('0xf'));var Papa=require(_0xdbbf('0x10'));var Redis=require(_0xdbbf('0x11'));var authService=require(_0xdbbf('0x12'));var qs=require(_0xdbbf('0x13'));var as=require(_0xdbbf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbbf('0x15'))(_0xdbbf('0x16'));var utils=require(_0xdbbf('0x17'));var config=require(_0xdbbf('0x18'));var db=require(_0xdbbf('0x19'))['db'];function respondWithStatusCode(_0x51b6fa,_0x3546ed){_0x3546ed=_0x3546ed||0xcc;return function(_0x50e97f){if(_0x50e97f){return _0x51b6fa[_0xdbbf('0x1a')](_0x3546ed);}return _0x51b6fa[_0xdbbf('0x1b')](_0x3546ed)[_0xdbbf('0x1c')]();};}function respondWithResult(_0x220ffb,_0x205954){_0x205954=_0x205954||0xc8;return function(_0x4239cd){if(_0x4239cd){return _0x220ffb[_0xdbbf('0x1b')](_0x205954)['json'](_0x4239cd);}};}function respondWithFilteredResult(_0x2809d0,_0x40a914){return function(_0x582efd){if(_0x582efd){var _0x390ea2=_0x582efd[_0xdbbf('0x1d')],_0x314ee1=_0x40a914[_0xdbbf('0x1e')],_0x323951=_0x40a914[_0xdbbf('0x1e')]+_0x40a914['limit'],_0x4de339;if(_0x323951>=_0x390ea2){_0x323951=_0x390ea2;_0x4de339=0xc8;}else{_0x4de339=0xce;}_0x2809d0[_0xdbbf('0x1b')](_0x4de339);return _0x2809d0[_0xdbbf('0x1f')](_0xdbbf('0x20'),_0x314ee1+'-'+_0x323951+'/'+_0x390ea2)[_0xdbbf('0x21')](_0x582efd);}return null;};}function patchUpdates(_0x16be41){return function(_0x460d17){try{jsonpatch[_0xdbbf('0x22')](_0x460d17,_0x16be41,!![]);}catch(_0x35ce24){return BPromise[_0xdbbf('0x23')](_0x35ce24);}return _0x460d17[_0xdbbf('0x24')]();};}function saveUpdates(_0x5b16c2,_0x5c5829){return function(_0x887be0){if(_0x887be0){return _0x887be0[_0xdbbf('0x25')](_0x5b16c2)['then'](function(_0xf13bf4){return _0xf13bf4;});}return null;};}function removeEntity(_0x28c14f,_0x52d144){return function(_0x172492){if(_0x172492){return _0x172492[_0xdbbf('0x26')]()[_0xdbbf('0x27')](function(){_0x28c14f[_0xdbbf('0x1b')](0xcc)[_0xdbbf('0x1c')]();});}};}function handleEntityNotFound(_0xbed48e,_0x2bfc1c){return function(_0x10f038){if(!_0x10f038){_0xbed48e['sendStatus'](0x194);}return _0x10f038;};}function handleError(_0x14c6ce,_0x20687b){_0x20687b=_0x20687b||0x1f4;return function(_0x3b3d04){logger['error'](_0x3b3d04[_0xdbbf('0x28')]);if(_0x3b3d04['name']){delete _0x3b3d04[_0xdbbf('0x29')];}_0x14c6ce[_0xdbbf('0x1b')](_0x20687b)[_0xdbbf('0x2a')](_0x3b3d04);};}exports[_0xdbbf('0x2b')]=function(_0x10cdda,_0x167039){var _0x43536e={},_0x4f9e4f={},_0x3a4ea2={'count':0x0,'rows':[]};var _0x3ac612=_[_0xdbbf('0x2c')](db[_0xdbbf('0x2d')]['rawAttributes'],function(_0x10b52a){return{'name':_0x10b52a['fieldName'],'type':_0x10b52a[_0xdbbf('0x2e')][_0xdbbf('0x2f')]};});_0x4f9e4f[_0xdbbf('0x30')]=_[_0xdbbf('0x2c')](_0x3ac612,'name');_0x4f9e4f[_0xdbbf('0x31')]=_[_0xdbbf('0x32')](_0x10cdda[_0xdbbf('0x31')]);_0x4f9e4f[_0xdbbf('0x33')]=_[_0xdbbf('0x34')](_0x4f9e4f[_0xdbbf('0x30')],_0x4f9e4f[_0xdbbf('0x31')]);_0x43536e[_0xdbbf('0x35')]=_['intersection'](_0x4f9e4f[_0xdbbf('0x30')],qs[_0xdbbf('0x36')](_0x10cdda[_0xdbbf('0x31')][_0xdbbf('0x36')]));_0x43536e['attributes']=_0x43536e[_0xdbbf('0x35')][_0xdbbf('0x37')]?_0x43536e[_0xdbbf('0x35')]:_0x4f9e4f[_0xdbbf('0x30')];if(!_0x10cdda[_0xdbbf('0x31')][_0xdbbf('0x38')](_0xdbbf('0x39'))){_0x43536e[_0xdbbf('0x3a')]=qs['limit'](_0x10cdda[_0xdbbf('0x31')][_0xdbbf('0x3a')]);_0x43536e['offset']=qs[_0xdbbf('0x1e')](_0x10cdda[_0xdbbf('0x31')][_0xdbbf('0x1e')]);}_0x43536e[_0xdbbf('0x3b')]=qs[_0xdbbf('0x3c')](_0x10cdda[_0xdbbf('0x31')][_0xdbbf('0x3c')]);_0x43536e['where']=qs['filters'](_['pick'](_0x10cdda[_0xdbbf('0x31')],_0x4f9e4f[_0xdbbf('0x33')]),_0x3ac612);if(_0x10cdda[_0xdbbf('0x31')][_0xdbbf('0x3d')]){_0x43536e[_0xdbbf('0x3e')]=_['merge'](_0x43536e[_0xdbbf('0x3e')],{'$or':_[_0xdbbf('0x2c')](_0x3ac612,function(_0x49dd42){if(_0x49dd42['type']!=='VIRTUAL'){var _0x287584={};_0x287584[_0x49dd42[_0xdbbf('0x29')]]={'$like':'%'+_0x10cdda['query'][_0xdbbf('0x3d')]+'%'};return _0x287584;}})});}_0x43536e=_[_0xdbbf('0x3f')]({},_0x43536e,_0x10cdda[_0xdbbf('0x40')]);var _0x3114ee={'where':_0x43536e[_0xdbbf('0x3e')]};return db[_0xdbbf('0x2d')][_0xdbbf('0x1d')](_0x3114ee)[_0xdbbf('0x27')](function(_0x329386){_0x3a4ea2[_0xdbbf('0x1d')]=_0x329386;if(_0x10cdda[_0xdbbf('0x31')][_0xdbbf('0x41')]){_0x43536e[_0xdbbf('0x42')]=[{'all':!![]}];}return db[_0xdbbf('0x2d')][_0xdbbf('0x43')](_0x43536e);})['then'](function(_0x16255a){_0x3a4ea2['rows']=_0x16255a;return _0x3a4ea2;})['then'](respondWithFilteredResult(_0x167039,_0x43536e))[_0xdbbf('0x44')](handleError(_0x167039,null));};exports[_0xdbbf('0x45')]=function(_0x27ea3d,_0x43c922){var _0x144ba9={'raw':!![],'where':{'id':_0x27ea3d[_0xdbbf('0x46')]['id']}},_0x406787={};_0x406787[_0xdbbf('0x30')]=_[_0xdbbf('0x32')](db['MailServerOut'][_0xdbbf('0x47')]);_0x406787[_0xdbbf('0x31')]=_[_0xdbbf('0x32')](_0x27ea3d[_0xdbbf('0x31')]);_0x406787[_0xdbbf('0x33')]=_[_0xdbbf('0x34')](_0x406787[_0xdbbf('0x30')],_0x406787[_0xdbbf('0x31')]);_0x144ba9['attributes']=_[_0xdbbf('0x34')](_0x406787[_0xdbbf('0x30')],qs[_0xdbbf('0x36')](_0x27ea3d[_0xdbbf('0x31')][_0xdbbf('0x36')]));_0x144ba9[_0xdbbf('0x35')]=_0x144ba9[_0xdbbf('0x35')][_0xdbbf('0x37')]?_0x144ba9[_0xdbbf('0x35')]:_0x406787[_0xdbbf('0x30')];if(_0x27ea3d['query'][_0xdbbf('0x41')]){_0x144ba9['include']=[{'all':!![]}];}_0x144ba9=_[_0xdbbf('0x3f')]({},_0x144ba9,_0x27ea3d[_0xdbbf('0x40')]);return db['MailServerOut']['find'](_0x144ba9)['then'](handleEntityNotFound(_0x43c922,null))[_0xdbbf('0x27')](respondWithResult(_0x43c922,null))[_0xdbbf('0x44')](handleError(_0x43c922,null));};exports[_0xdbbf('0x48')]=function(_0x5f41a9,_0x183ce5){return db[_0xdbbf('0x2d')][_0xdbbf('0x48')](_0x5f41a9[_0xdbbf('0x49')],{})[_0xdbbf('0x27')](respondWithResult(_0x183ce5,0xc9))[_0xdbbf('0x44')](handleError(_0x183ce5,null));};exports[_0xdbbf('0x25')]=function(_0x127675,_0x3f25ce){if(_0x127675[_0xdbbf('0x49')]['id']){delete _0x127675[_0xdbbf('0x49')]['id'];}return db['MailServerOut'][_0xdbbf('0x4a')]({'where':{'id':_0x127675[_0xdbbf('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f25ce,null))[_0xdbbf('0x27')](saveUpdates(_0x127675['body'],null))[_0xdbbf('0x27')](respondWithResult(_0x3f25ce,null))[_0xdbbf('0x44')](handleError(_0x3f25ce,null));};exports[_0xdbbf('0x26')]=function(_0x14638a,_0x5254de){return db[_0xdbbf('0x2d')]['find']({'where':{'id':_0x14638a[_0xdbbf('0x46')]['id']}})[_0xdbbf('0x27')](handleEntityNotFound(_0x5254de,null))['then'](removeEntity(_0x5254de,null))[_0xdbbf('0x44')](handleError(_0x5254de,null));};
\ No newline at end of file
+var _0x75f3=['body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','MailServerOut','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','findAll','catch','show','params','keys','rawAttributes','includeAll','include','find','create','update'];(function(_0x2666e3,_0x3ab570){var _0x3af69d=function(_0x408066){while(--_0x408066){_0x2666e3['push'](_0x2666e3['shift']());}};_0x3af69d(++_0x3ab570);}(_0x75f3,0x125));var _0x375f=function(_0x104cfc,_0x39f419){_0x104cfc=_0x104cfc-0x0;var _0x451ad5=_0x75f3[_0x104cfc];return _0x451ad5;};'use strict';var pdf=require(_0x375f('0x0'));var emlformat=require(_0x375f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x375f('0x2'));var jsonpatch=require(_0x375f('0x3'));var rp=require(_0x375f('0x4'));var moment=require(_0x375f('0x5'));var BPromise=require(_0x375f('0x6'));var Mustache=require(_0x375f('0x7'));var util=require(_0x375f('0x8'));var path=require('path');var sox=require(_0x375f('0x9'));var csv=require('to-csv');var ejs=require(_0x375f('0xa'));var fs=require('fs');var _=require(_0x375f('0xb'));var squel=require('squel');var crypto=require(_0x375f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x375f('0xd'));var toCsv=require(_0x375f('0xe'));var querystring=require(_0x375f('0xf'));var Papa=require('papaparse');var Redis=require(_0x375f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x375f('0x11'));var hardwareService=require(_0x375f('0x12'));var logger=require(_0x375f('0x13'))(_0x375f('0x14'));var utils=require('../../config/utils');var config=require(_0x375f('0x15'));var db=require(_0x375f('0x16'))['db'];function respondWithStatusCode(_0x164470,_0x5e025c){_0x5e025c=_0x5e025c||0xcc;return function(_0x2a81d0){if(_0x2a81d0){return _0x164470[_0x375f('0x17')](_0x5e025c);}return _0x164470[_0x375f('0x18')](_0x5e025c)[_0x375f('0x19')]();};}function respondWithResult(_0x43c5f0,_0x43f4a1){_0x43f4a1=_0x43f4a1||0xc8;return function(_0x2edd4c){if(_0x2edd4c){return _0x43c5f0[_0x375f('0x18')](_0x43f4a1)[_0x375f('0x1a')](_0x2edd4c);}};}function respondWithFilteredResult(_0x2fa612,_0xe11e65){return function(_0x57c6ba){if(_0x57c6ba){var _0x56f9a8=_0x57c6ba[_0x375f('0x1b')],_0x3b073f=_0xe11e65[_0x375f('0x1c')],_0x4a7c6d=_0xe11e65[_0x375f('0x1c')]+_0xe11e65['limit'],_0x209cbd;if(_0x4a7c6d>=_0x56f9a8){_0x4a7c6d=_0x56f9a8;_0x209cbd=0xc8;}else{_0x209cbd=0xce;}_0x2fa612['status'](_0x209cbd);return _0x2fa612[_0x375f('0x1d')](_0x375f('0x1e'),_0x3b073f+'-'+_0x4a7c6d+'/'+_0x56f9a8)[_0x375f('0x1a')](_0x57c6ba);}return null;};}function patchUpdates(_0x40a75d){return function(_0xb906c1){try{jsonpatch[_0x375f('0x1f')](_0xb906c1,_0x40a75d,!![]);}catch(_0x8e8df6){return BPromise[_0x375f('0x20')](_0x8e8df6);}return _0xb906c1[_0x375f('0x21')]();};}function saveUpdates(_0x3ecf3a,_0x21260c){return function(_0x302138){if(_0x302138){return _0x302138['update'](_0x3ecf3a)[_0x375f('0x22')](function(_0x36f5c5){return _0x36f5c5;});}return null;};}function removeEntity(_0x5393e9,_0x3e0512){return function(_0x48dd51){if(_0x48dd51){return _0x48dd51[_0x375f('0x23')]()[_0x375f('0x22')](function(){_0x5393e9['status'](0xcc)[_0x375f('0x19')]();});}};}function handleEntityNotFound(_0x5266a5,_0x4c3e8b){return function(_0x44df99){if(!_0x44df99){_0x5266a5[_0x375f('0x17')](0x194);}return _0x44df99;};}function handleError(_0x1daf05,_0x46a9b1){_0x46a9b1=_0x46a9b1||0x1f4;return function(_0x133954){logger['error'](_0x133954[_0x375f('0x24')]);if(_0x133954[_0x375f('0x25')]){delete _0x133954['name'];}_0x1daf05[_0x375f('0x18')](_0x46a9b1)[_0x375f('0x26')](_0x133954);};}exports[_0x375f('0x27')]=function(_0x31c714,_0x5d773b){var _0x5e49c3={},_0x1be491={},_0x275072={'count':0x0,'rows':[]};var _0x29b7f0=_[_0x375f('0x28')](db[_0x375f('0x29')]['rawAttributes'],function(_0x4b760d){return{'name':_0x4b760d[_0x375f('0x2a')],'type':_0x4b760d[_0x375f('0x2b')][_0x375f('0x2c')]};});_0x1be491['model']=_[_0x375f('0x28')](_0x29b7f0,_0x375f('0x25'));_0x1be491[_0x375f('0x2d')]=_['keys'](_0x31c714[_0x375f('0x2d')]);_0x1be491[_0x375f('0x2e')]=_[_0x375f('0x2f')](_0x1be491[_0x375f('0x30')],_0x1be491[_0x375f('0x2d')]);_0x5e49c3['attributes']=_[_0x375f('0x2f')](_0x1be491[_0x375f('0x30')],qs['fields'](_0x31c714[_0x375f('0x2d')][_0x375f('0x31')]));_0x5e49c3['attributes']=_0x5e49c3[_0x375f('0x32')][_0x375f('0x33')]?_0x5e49c3[_0x375f('0x32')]:_0x1be491[_0x375f('0x30')];if(!_0x31c714['query'][_0x375f('0x34')](_0x375f('0x35'))){_0x5e49c3[_0x375f('0x36')]=qs[_0x375f('0x36')](_0x31c714[_0x375f('0x2d')][_0x375f('0x36')]);_0x5e49c3[_0x375f('0x1c')]=qs[_0x375f('0x1c')](_0x31c714['query']['offset']);}_0x5e49c3[_0x375f('0x37')]=qs[_0x375f('0x38')](_0x31c714[_0x375f('0x2d')][_0x375f('0x38')]);_0x5e49c3[_0x375f('0x39')]=qs[_0x375f('0x2e')](_[_0x375f('0x3a')](_0x31c714[_0x375f('0x2d')],_0x1be491['filters']),_0x29b7f0);if(_0x31c714[_0x375f('0x2d')]['filter']){_0x5e49c3[_0x375f('0x39')]=_[_0x375f('0x3b')](_0x5e49c3[_0x375f('0x39')],{'$or':_['map'](_0x29b7f0,function(_0xeabb6){if(_0xeabb6[_0x375f('0x2b')]!=='VIRTUAL'){var _0x485fb9={};_0x485fb9[_0xeabb6['name']]={'$like':'%'+_0x31c714[_0x375f('0x2d')]['filter']+'%'};return _0x485fb9;}})});}_0x5e49c3=_[_0x375f('0x3b')]({},_0x5e49c3,_0x31c714[_0x375f('0x3c')]);var _0x24949c={'where':_0x5e49c3['where']};return db['MailServerOut'][_0x375f('0x1b')](_0x24949c)[_0x375f('0x22')](function(_0x1c3d12){_0x275072['count']=_0x1c3d12;if(_0x31c714[_0x375f('0x2d')]['includeAll']){_0x5e49c3['include']=[{'all':!![]}];}return db[_0x375f('0x29')][_0x375f('0x3d')](_0x5e49c3);})[_0x375f('0x22')](function(_0xeb55c3){_0x275072['rows']=_0xeb55c3;return _0x275072;})[_0x375f('0x22')](respondWithFilteredResult(_0x5d773b,_0x5e49c3))[_0x375f('0x3e')](handleError(_0x5d773b,null));};exports[_0x375f('0x3f')]=function(_0x32e89c,_0x4c3991){var _0x363267={'raw':!![],'where':{'id':_0x32e89c[_0x375f('0x40')]['id']}},_0x52b470={};_0x52b470[_0x375f('0x30')]=_[_0x375f('0x41')](db[_0x375f('0x29')][_0x375f('0x42')]);_0x52b470[_0x375f('0x2d')]=_[_0x375f('0x41')](_0x32e89c['query']);_0x52b470[_0x375f('0x2e')]=_[_0x375f('0x2f')](_0x52b470[_0x375f('0x30')],_0x52b470[_0x375f('0x2d')]);_0x363267[_0x375f('0x32')]=_[_0x375f('0x2f')](_0x52b470[_0x375f('0x30')],qs[_0x375f('0x31')](_0x32e89c[_0x375f('0x2d')][_0x375f('0x31')]));_0x363267[_0x375f('0x32')]=_0x363267[_0x375f('0x32')][_0x375f('0x33')]?_0x363267[_0x375f('0x32')]:_0x52b470[_0x375f('0x30')];if(_0x32e89c['query'][_0x375f('0x43')]){_0x363267[_0x375f('0x44')]=[{'all':!![]}];}_0x363267=_['merge']({},_0x363267,_0x32e89c[_0x375f('0x3c')]);return db['MailServerOut'][_0x375f('0x45')](_0x363267)[_0x375f('0x22')](handleEntityNotFound(_0x4c3991,null))[_0x375f('0x22')](respondWithResult(_0x4c3991,null))[_0x375f('0x3e')](handleError(_0x4c3991,null));};exports['create']=function(_0x23a46b,_0x3d6d23){return db[_0x375f('0x29')][_0x375f('0x46')](_0x23a46b['body'],{})[_0x375f('0x22')](respondWithResult(_0x3d6d23,0xc9))[_0x375f('0x3e')](handleError(_0x3d6d23,null));};exports[_0x375f('0x47')]=function(_0x1cabbc,_0x24cff4){if(_0x1cabbc[_0x375f('0x48')]['id']){delete _0x1cabbc[_0x375f('0x48')]['id'];}return db[_0x375f('0x29')][_0x375f('0x45')]({'where':{'id':_0x1cabbc['params']['id']}})[_0x375f('0x22')](handleEntityNotFound(_0x24cff4,null))[_0x375f('0x22')](saveUpdates(_0x1cabbc[_0x375f('0x48')],null))['then'](respondWithResult(_0x24cff4,null))[_0x375f('0x3e')](handleError(_0x24cff4,null));};exports[_0x375f('0x23')]=function(_0x43e797,_0x59443e){return db['MailServerOut'][_0x375f('0x45')]({'where':{'id':_0x43e797[_0x375f('0x40')]['id']}})['then'](handleEntityNotFound(_0x59443e,null))[_0x375f('0x22')](removeEntity(_0x59443e,null))['catch'](handleError(_0x59443e,null));};
\ No newline at end of file