Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / server / api / mailApplication / mailApplication.controller.js
index 75bbe7b..808db06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x815c=['then','sendStatus','name','send','show','params','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','MailApplication','find','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','end','status','json','offset','set','Content-Range','reject','save','update'];(function(_0x47b125,_0x13a098){var _0x966a94=function(_0x4c25e7){while(--_0x4c25e7){_0x47b125['push'](_0x47b125['shift']());}};_0x966a94(++_0x13a098);}(_0x815c,0x19d));var _0xc815=function(_0x19e013,_0x5c74e0){_0x19e013=_0x19e013-0x0;var _0x58c128=_0x815c[_0x19e013];return _0x58c128;};'use strict';var pdf=require(_0xc815('0x0'));var emlformat=require(_0xc815('0x1'));var rimraf=require(_0xc815('0x2'));var zipdir=require(_0xc815('0x3'));var jsonpatch=require(_0xc815('0x4'));var rp=require(_0xc815('0x5'));var moment=require(_0xc815('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc815('0x7'));var util=require(_0xc815('0x8'));var path=require(_0xc815('0x9'));var sox=require(_0xc815('0xa'));var csv=require('to-csv');var ejs=require(_0xc815('0xb'));var fs=require('fs');var _=require(_0xc815('0xc'));var squel=require('squel');var crypto=require(_0xc815('0xd'));var jsforce=require(_0xc815('0xe'));var deskjs=require(_0xc815('0xf'));var toCsv=require(_0xc815('0x10'));var querystring=require(_0xc815('0x11'));var Papa=require(_0xc815('0x12'));var Redis=require(_0xc815('0x13'));var authService=require(_0xc815('0x14'));var qs=require(_0xc815('0x15'));var as=require(_0xc815('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc815('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xc815('0x18'));var licenseUtil=require(_0xc815('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508bd1,_0x4227d7){_0x4227d7=_0x4227d7||0xcc;return function(_0x3ccf1a){if(_0x3ccf1a){return _0x508bd1['sendStatus'](_0x4227d7);}return _0x508bd1['status'](_0x4227d7)[_0xc815('0x1a')]();};}function respondWithResult(_0x40ffc3,_0x1ef9cf){_0x1ef9cf=_0x1ef9cf||0xc8;return function(_0x72bb2a){if(_0x72bb2a){return _0x40ffc3[_0xc815('0x1b')](_0x1ef9cf)[_0xc815('0x1c')](_0x72bb2a);}};}function respondWithFilteredResult(_0x35bdbd,_0xb3e819){return function(_0x30aa98){if(_0x30aa98){var _0x1d19a9=_0x30aa98['count'],_0x57f9a2=_0xb3e819[_0xc815('0x1d')],_0x24187f=_0xb3e819[_0xc815('0x1d')]+_0xb3e819['limit'],_0x3e6145;if(_0x24187f>=_0x1d19a9){_0x24187f=_0x1d19a9;_0x3e6145=0xc8;}else{_0x3e6145=0xce;}_0x35bdbd[_0xc815('0x1b')](_0x3e6145);return _0x35bdbd[_0xc815('0x1e')](_0xc815('0x1f'),_0x57f9a2+'-'+_0x24187f+'/'+_0x1d19a9)[_0xc815('0x1c')](_0x30aa98);}return null;};}function patchUpdates(_0x13b60d){return function(_0x201042){try{jsonpatch['apply'](_0x201042,_0x13b60d,!![]);}catch(_0x2c482d){return BPromise[_0xc815('0x20')](_0x2c482d);}return _0x201042[_0xc815('0x21')]();};}function saveUpdates(_0x3933f2,_0x557a6d){return function(_0x26fa30){if(_0x26fa30){return _0x26fa30[_0xc815('0x22')](_0x3933f2)[_0xc815('0x23')](function(_0x1cbf69){return _0x1cbf69;});}return null;};}function removeEntity(_0x45a411,_0x126502){return function(_0x50ccf3){if(_0x50ccf3){return _0x50ccf3['destroy']()['then'](function(){_0x45a411['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf07be0,_0x4ef43c){return function(_0x401ef3){if(!_0x401ef3){_0xf07be0[_0xc815('0x24')](0x194);}return _0x401ef3;};}function handleError(_0x2bb2c0,_0x39e4d5){_0x39e4d5=_0x39e4d5||0x1f4;return function(_0x50b224){logger['error'](_0x50b224['stack']);if(_0x50b224[_0xc815('0x25')]){delete _0x50b224['name'];}_0x2bb2c0[_0xc815('0x1b')](_0x39e4d5)[_0xc815('0x26')](_0x50b224);};}exports[_0xc815('0x27')]=function(_0x2524b2,_0x63ce44){var _0x36549e={'raw':!![],'where':{'id':_0x2524b2[_0xc815('0x28')]['id']}},_0x38bdbd={};_0x38bdbd['model']=_['keys'](db['MailApplication']['rawAttributes']);_0x38bdbd[_0xc815('0x29')]=_['keys'](_0x2524b2[_0xc815('0x29')]);_0x38bdbd[_0xc815('0x2a')]=_[_0xc815('0x2b')](_0x38bdbd['model'],_0x38bdbd[_0xc815('0x29')]);_0x36549e[_0xc815('0x2c')]=_['intersection'](_0x38bdbd[_0xc815('0x2d')],qs[_0xc815('0x2e')](_0x2524b2[_0xc815('0x29')][_0xc815('0x2e')]));_0x36549e[_0xc815('0x2c')]=_0x36549e['attributes'][_0xc815('0x2f')]?_0x36549e['attributes']:_0x38bdbd[_0xc815('0x2d')];if(_0x2524b2['query'][_0xc815('0x30')]){_0x36549e[_0xc815('0x31')]=[{'all':!![]}];}_0x36549e=_[_0xc815('0x32')]({},_0x36549e,_0x2524b2[_0xc815('0x33')]);return db[_0xc815('0x34')][_0xc815('0x35')](_0x36549e)['then'](handleEntityNotFound(_0x63ce44,null))['then'](respondWithResult(_0x63ce44,null))['catch'](handleError(_0x63ce44,null));};exports[_0xc815('0x22')]=function(_0x31baa7,_0x53a684){if(_0x31baa7[_0xc815('0x36')]['id']){delete _0x31baa7[_0xc815('0x36')]['id'];}return db[_0xc815('0x34')]['find']({'where':{'id':_0x31baa7['params']['id']}})[_0xc815('0x23')](handleEntityNotFound(_0x53a684,null))[_0xc815('0x23')](saveUpdates(_0x31baa7[_0xc815('0x36')],null))[_0xc815('0x23')](respondWithResult(_0x53a684,null))[_0xc815('0x37')](handleError(_0x53a684,null));};exports['destroy']=function(_0x1727ef,_0x2257f2){return db['MailApplication'][_0xc815('0x35')]({'where':{'id':_0x1727ef['params']['id']}})[_0xc815('0x23')](handleEntityNotFound(_0x2257f2,null))[_0xc815('0x23')](removeEntity(_0x2257f2,null))[_0xc815('0x37')](handleError(_0x2257f2,null));};
\ No newline at end of file
+var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x155d18,_0x5b4da9){var _0x3cfdc6=function(_0x15e47a){while(--_0x15e47a){_0x155d18['push'](_0x155d18['shift']());}};_0x3cfdc6(++_0x5b4da9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x58dea6,_0xbd27e9){_0x58dea6=_0x58dea6-0x0;var _0x11f25c=_0xf4eb[_0x58dea6];return _0x11f25c;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));};
\ No newline at end of file