Built motion from commit (unavailable).|2.5.26
[motion2.git] / server / api / integrationReport / integrationReport.controller.js
index 9f6dad4..b0e6451 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb69b=['apply','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','length','options','find','create','update','body','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range'];(function(_0x11bf1b,_0x50581b){var _0x387d1c=function(_0x54e22f){while(--_0x54e22f){_0x11bf1b['push'](_0x11bf1b['shift']());}};_0x387d1c(++_0x50581b);}(_0xb69b,0x1a6));var _0xbb69=function(_0x23b8de,_0x1bb429){_0x23b8de=_0x23b8de-0x0;var _0x388484=_0xb69b[_0x23b8de];return _0x388484;};'use strict';var pdf=require(_0xbb69('0x0'));var emlformat=require(_0xbb69('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbb69('0x2'));var rp=require(_0xbb69('0x3'));var moment=require(_0xbb69('0x4'));var BPromise=require(_0xbb69('0x5'));var Mustache=require(_0xbb69('0x6'));var util=require(_0xbb69('0x7'));var path=require(_0xbb69('0x8'));var sox=require('sox');var csv=require(_0xbb69('0x9'));var ejs=require(_0xbb69('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbb69('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb69('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbb69('0x9'));var querystring=require(_0xbb69('0xd'));var Papa=require(_0xbb69('0xe'));var Redis=require(_0xbb69('0xf'));var authService=require(_0xbb69('0x10'));var qs=require(_0xbb69('0x11'));var as=require(_0xbb69('0x12'));var hardwareService=require(_0xbb69('0x13'));var logger=require(_0xbb69('0x14'))(_0xbb69('0x15'));var utils=require(_0xbb69('0x16'));var config=require(_0xbb69('0x17'));var licenseUtil=require(_0xbb69('0x18'));var db=require(_0xbb69('0x19'))['db'];function respondWithStatusCode(_0x37b3da,_0x2fa959){_0x2fa959=_0x2fa959||0xcc;return function(_0x1c7c9d){if(_0x1c7c9d){return _0x37b3da[_0xbb69('0x1a')](_0x2fa959);}return _0x37b3da['status'](_0x2fa959)[_0xbb69('0x1b')]();};}function respondWithResult(_0x476f6f,_0x5e961a){_0x5e961a=_0x5e961a||0xc8;return function(_0x75b3b8){if(_0x75b3b8){return _0x476f6f[_0xbb69('0x1c')](_0x5e961a)[_0xbb69('0x1d')](_0x75b3b8);}};}function respondWithFilteredResult(_0xaca9f9,_0x28a557){return function(_0x1a250d){if(_0x1a250d){var _0x296244=_0x1a250d[_0xbb69('0x1e')],_0x544e63=_0x28a557[_0xbb69('0x1f')],_0x45d34b=_0x28a557[_0xbb69('0x1f')]+_0x28a557['limit'],_0xbd4fec;if(_0x45d34b>=_0x296244){_0x45d34b=_0x296244;_0xbd4fec=0xc8;}else{_0xbd4fec=0xce;}_0xaca9f9[_0xbb69('0x1c')](_0xbd4fec);return _0xaca9f9[_0xbb69('0x20')](_0xbb69('0x21'),_0x544e63+'-'+_0x45d34b+'/'+_0x296244)['json'](_0x1a250d);}return null;};}function patchUpdates(_0x5b3e2c){return function(_0x9548c2){try{jsonpatch[_0xbb69('0x22')](_0x9548c2,_0x5b3e2c,!![]);}catch(_0x3b4b98){return BPromise['reject'](_0x3b4b98);}return _0x9548c2['save']();};}function saveUpdates(_0x4c02e4,_0x385ac4){return function(_0x1e0259){if(_0x1e0259){return _0x1e0259['update'](_0x4c02e4)[_0xbb69('0x23')](function(_0x572203){return _0x572203;});}return null;};}function removeEntity(_0x4e86a7,_0x396b21){return function(_0x5831a3){if(_0x5831a3){return _0x5831a3[_0xbb69('0x24')]()[_0xbb69('0x23')](function(){_0x4e86a7[_0xbb69('0x1c')](0xcc)[_0xbb69('0x1b')]();});}};}function handleEntityNotFound(_0x4ed446,_0x57d2c3){return function(_0x31e600){if(!_0x31e600){_0x4ed446[_0xbb69('0x1a')](0x194);}return _0x31e600;};}function handleError(_0xab0d7c,_0x4803b3){_0x4803b3=_0x4803b3||0x1f4;return function(_0x524f0c){logger[_0xbb69('0x25')](_0x524f0c[_0xbb69('0x26')]);if(_0x524f0c[_0xbb69('0x27')]){delete _0x524f0c['name'];}_0xab0d7c[_0xbb69('0x1c')](_0x4803b3)['send'](_0x524f0c);};}exports[_0xbb69('0x28')]=function(_0x529713,_0x3f046c){var _0x5d15e6={},_0x124168={},_0x425c6f={'count':0x0,'rows':[]};var _0x572d0c=_[_0xbb69('0x29')](db[_0xbb69('0x2a')][_0xbb69('0x2b')],function(_0x4c5741){return{'name':_0x4c5741[_0xbb69('0x2c')],'type':_0x4c5741[_0xbb69('0x2d')][_0xbb69('0x2e')]};});_0x124168[_0xbb69('0x2f')]=_[_0xbb69('0x29')](_0x572d0c,'name');_0x124168['query']=_[_0xbb69('0x30')](_0x529713[_0xbb69('0x31')]);_0x124168[_0xbb69('0x32')]=_['intersection'](_0x124168[_0xbb69('0x2f')],_0x124168['query']);_0x5d15e6['attributes']=_[_0xbb69('0x33')](_0x124168[_0xbb69('0x2f')],qs[_0xbb69('0x34')](_0x529713[_0xbb69('0x31')][_0xbb69('0x34')]));_0x5d15e6[_0xbb69('0x35')]=_0x5d15e6['attributes']['length']?_0x5d15e6[_0xbb69('0x35')]:_0x124168[_0xbb69('0x2f')];if(!_0x529713[_0xbb69('0x31')][_0xbb69('0x36')](_0xbb69('0x37'))){_0x5d15e6[_0xbb69('0x38')]=qs['limit'](_0x529713[_0xbb69('0x31')][_0xbb69('0x38')]);_0x5d15e6[_0xbb69('0x1f')]=qs[_0xbb69('0x1f')](_0x529713['query']['offset']);}_0x5d15e6[_0xbb69('0x39')]=qs[_0xbb69('0x3a')](_0x529713[_0xbb69('0x31')][_0xbb69('0x3a')]);_0x5d15e6['where']=qs[_0xbb69('0x32')](_[_0xbb69('0x3b')](_0x529713[_0xbb69('0x31')],_0x124168[_0xbb69('0x32')]),_0x572d0c);if(_0x529713['query'][_0xbb69('0x3c')]){_0x5d15e6[_0xbb69('0x3d')]=_[_0xbb69('0x3e')](_0x5d15e6['where'],{'$or':_[_0xbb69('0x29')](_0x572d0c,function(_0x54c422){if(_0x54c422[_0xbb69('0x2d')]!==_0xbb69('0x3f')){var _0x3a5abc={};_0x3a5abc[_0x54c422[_0xbb69('0x27')]]={'$like':'%'+_0x529713['query']['filter']+'%'};return _0x3a5abc;}})});}_0x5d15e6=_['merge']({},_0x5d15e6,_0x529713['options']);var _0x4be622={'where':_0x5d15e6[_0xbb69('0x3d')]};return db[_0xbb69('0x2a')][_0xbb69('0x1e')](_0x4be622)[_0xbb69('0x23')](function(_0x5eacd5){_0x425c6f[_0xbb69('0x1e')]=_0x5eacd5;if(_0x529713['query'][_0xbb69('0x40')]){_0x5d15e6[_0xbb69('0x41')]=[{'all':!![]}];}return db[_0xbb69('0x2a')][_0xbb69('0x42')](_0x5d15e6);})['then'](function(_0x17e7ca){_0x425c6f['rows']=_0x17e7ca;return _0x425c6f;})[_0xbb69('0x23')](respondWithFilteredResult(_0x3f046c,_0x5d15e6))[_0xbb69('0x43')](handleError(_0x3f046c,null));};exports['show']=function(_0x3343f1,_0x2d903){var _0x44cafc={'raw':![],'where':{'id':_0x3343f1['params']['id']}},_0x565145={};_0x565145[_0xbb69('0x2f')]=_['keys'](db[_0xbb69('0x2a')]['rawAttributes']);_0x565145[_0xbb69('0x31')]=_[_0xbb69('0x30')](_0x3343f1[_0xbb69('0x31')]);_0x565145[_0xbb69('0x32')]=_[_0xbb69('0x33')](_0x565145[_0xbb69('0x2f')],_0x565145['query']);_0x44cafc[_0xbb69('0x35')]=_[_0xbb69('0x33')](_0x565145[_0xbb69('0x2f')],qs[_0xbb69('0x34')](_0x3343f1['query'][_0xbb69('0x34')]));_0x44cafc[_0xbb69('0x35')]=_0x44cafc[_0xbb69('0x35')][_0xbb69('0x44')]?_0x44cafc[_0xbb69('0x35')]:_0x565145[_0xbb69('0x2f')];if(_0x3343f1[_0xbb69('0x31')][_0xbb69('0x40')]){_0x44cafc[_0xbb69('0x41')]=[{'all':!![]}];}_0x44cafc=_[_0xbb69('0x3e')]({},_0x44cafc,_0x3343f1[_0xbb69('0x45')]);return db[_0xbb69('0x2a')][_0xbb69('0x46')](_0x44cafc)[_0xbb69('0x23')](handleEntityNotFound(_0x2d903,null))[_0xbb69('0x23')](respondWithResult(_0x2d903,null))[_0xbb69('0x43')](handleError(_0x2d903,null));};exports['create']=function(_0x29539a,_0x34b341){return db[_0xbb69('0x2a')][_0xbb69('0x47')](_0x29539a['body'],{})['then'](respondWithResult(_0x34b341,0xc9))[_0xbb69('0x43')](handleError(_0x34b341,null));};exports[_0xbb69('0x48')]=function(_0xfbf639,_0x455cfb){if(_0xfbf639[_0xbb69('0x49')]['id']){delete _0xfbf639[_0xbb69('0x49')]['id'];}return db[_0xbb69('0x2a')][_0xbb69('0x46')]({'where':{'id':_0xfbf639[_0xbb69('0x4a')]['id']}})['then'](handleEntityNotFound(_0x455cfb,null))[_0xbb69('0x23')](saveUpdates(_0xfbf639[_0xbb69('0x49')],null))['then'](respondWithResult(_0x455cfb,null))['catch'](handleError(_0x455cfb,null));};exports['destroy']=function(_0x6aa505,_0x30990a){return db[_0xbb69('0x2a')]['find']({'where':{'id':_0x6aa505[_0xbb69('0x4a')]['id']}})[_0xbb69('0x23')](handleEntityNotFound(_0x30990a,null))['then'](removeEntity(_0x30990a,null))[_0xbb69('0x43')](handleError(_0x30990a,null));};exports[_0xbb69('0x4b')]=function(_0x2a9958,_0x7d37be){return db[_0xbb69('0x2a')]['describe']()[_0xbb69('0x23')](respondWithResult(_0x7d37be,null))[_0xbb69('0x43')](handleError(_0x7d37be,null));};
\ No newline at end of file
+var _0x7f47=['rows','catch','rawAttributes','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','save','update','then','destroy','error','name','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','IntegrationReport'];(function(_0x321248,_0x1bf881){var _0x32db83=function(_0x2321fc){while(--_0x2321fc){_0x321248['push'](_0x321248['shift']());}};_0x32db83(++_0x1bf881);}(_0x7f47,0x12e));var _0x77f4=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0x7f47[_0x1d3791];return _0x40fbf5;};'use strict';var emlformat=require(_0x77f4('0x0'));var rimraf=require(_0x77f4('0x1'));var zipdir=require(_0x77f4('0x2'));var jsonpatch=require(_0x77f4('0x3'));var rp=require(_0x77f4('0x4'));var moment=require(_0x77f4('0x5'));var BPromise=require(_0x77f4('0x6'));var Mustache=require(_0x77f4('0x7'));var util=require('util');var path=require(_0x77f4('0x8'));var sox=require(_0x77f4('0x9'));var csv=require(_0x77f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77f4('0xb'));var _=require('lodash');var squel=require(_0x77f4('0xc'));var crypto=require(_0x77f4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x77f4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x77f4('0xf'));var Papa=require(_0x77f4('0x10'));var Redis=require('ioredis');var authService=require(_0x77f4('0x11'));var qs=require(_0x77f4('0x12'));var as=require(_0x77f4('0x13'));var hardwareService=require(_0x77f4('0x14'));var logger=require('../../config/logger')(_0x77f4('0x15'));var utils=require(_0x77f4('0x16'));var config=require(_0x77f4('0x17'));var licenseUtil=require(_0x77f4('0x18'));var db=require(_0x77f4('0x19'))['db'];function respondWithStatusCode(_0x2a0243,_0x47428a){_0x47428a=_0x47428a||0xcc;return function(_0x15cce6){if(_0x15cce6){return _0x2a0243[_0x77f4('0x1a')](_0x47428a);}return _0x2a0243['status'](_0x47428a)[_0x77f4('0x1b')]();};}function respondWithResult(_0xd23097,_0x15a137){_0x15a137=_0x15a137||0xc8;return function(_0x2fadaf){if(_0x2fadaf){return _0xd23097['status'](_0x15a137)['json'](_0x2fadaf);}};}function respondWithFilteredResult(_0x2d2dbb,_0x18848d){return function(_0x249237){if(_0x249237){var _0x395bb1=_0x249237[_0x77f4('0x1c')],_0x5a8a43=_0x18848d[_0x77f4('0x1d')],_0x310435=_0x18848d[_0x77f4('0x1d')]+_0x18848d[_0x77f4('0x1e')],_0x9ed030;if(_0x310435>=_0x395bb1){_0x310435=_0x395bb1;_0x9ed030=0xc8;}else{_0x9ed030=0xce;}_0x2d2dbb[_0x77f4('0x1f')](_0x9ed030);return _0x2d2dbb['set'](_0x77f4('0x20'),_0x5a8a43+'-'+_0x310435+'/'+_0x395bb1)[_0x77f4('0x21')](_0x249237);}return null;};}function patchUpdates(_0xdf6582){return function(_0x3773a5){try{jsonpatch[_0x77f4('0x22')](_0x3773a5,_0xdf6582,!![]);}catch(_0x39e15c){return BPromise[_0x77f4('0x23')](_0x39e15c);}return _0x3773a5[_0x77f4('0x24')]();};}function saveUpdates(_0x49a688,_0x46ac19){return function(_0x2c7faa){if(_0x2c7faa){return _0x2c7faa[_0x77f4('0x25')](_0x49a688)[_0x77f4('0x26')](function(_0x4067a4){return _0x4067a4;});}return null;};}function removeEntity(_0x20cd71,_0x4ad47b){return function(_0x5ea739){if(_0x5ea739){return _0x5ea739[_0x77f4('0x27')]()[_0x77f4('0x26')](function(){_0x20cd71[_0x77f4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12c3d5,_0x4a3e98){return function(_0x508076){if(!_0x508076){_0x12c3d5[_0x77f4('0x1a')](0x194);}return _0x508076;};}function handleError(_0x20519d,_0x560213){_0x560213=_0x560213||0x1f4;return function(_0x16c4a6){logger[_0x77f4('0x28')](_0x16c4a6['stack']);if(_0x16c4a6['name']){delete _0x16c4a6[_0x77f4('0x29')];}_0x20519d[_0x77f4('0x1f')](_0x560213)['send'](_0x16c4a6);};}exports['index']=function(_0x98b961,_0x3d487c){var _0x22a69d={},_0x4bef97={},_0x3f45a1={'count':0x0,'rows':[]};var _0x1542c8=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x5c6c27){return{'name':_0x5c6c27['fieldName'],'type':_0x5c6c27[_0x77f4('0x2a')][_0x77f4('0x2b')]};});_0x4bef97[_0x77f4('0x2c')]=_[_0x77f4('0x2d')](_0x1542c8,_0x77f4('0x29'));_0x4bef97[_0x77f4('0x2e')]=_[_0x77f4('0x2f')](_0x98b961[_0x77f4('0x2e')]);_0x4bef97[_0x77f4('0x30')]=_[_0x77f4('0x31')](_0x4bef97[_0x77f4('0x2c')],_0x4bef97['query']);_0x22a69d[_0x77f4('0x32')]=_['intersection'](_0x4bef97[_0x77f4('0x2c')],qs[_0x77f4('0x33')](_0x98b961[_0x77f4('0x2e')][_0x77f4('0x33')]));_0x22a69d[_0x77f4('0x32')]=_0x22a69d[_0x77f4('0x32')][_0x77f4('0x34')]?_0x22a69d[_0x77f4('0x32')]:_0x4bef97['model'];if(!_0x98b961[_0x77f4('0x2e')][_0x77f4('0x35')](_0x77f4('0x36'))){_0x22a69d[_0x77f4('0x1e')]=qs['limit'](_0x98b961[_0x77f4('0x2e')][_0x77f4('0x1e')]);_0x22a69d[_0x77f4('0x1d')]=qs['offset'](_0x98b961[_0x77f4('0x2e')][_0x77f4('0x1d')]);}_0x22a69d['order']=qs[_0x77f4('0x37')](_0x98b961[_0x77f4('0x2e')][_0x77f4('0x37')]);_0x22a69d['where']=qs['filters'](_[_0x77f4('0x38')](_0x98b961[_0x77f4('0x2e')],_0x4bef97['filters']),_0x1542c8);if(_0x98b961[_0x77f4('0x2e')]['filter']){_0x22a69d[_0x77f4('0x39')]=_[_0x77f4('0x3a')](_0x22a69d[_0x77f4('0x39')],{'$or':_[_0x77f4('0x2d')](_0x1542c8,function(_0x4390e3){if(_0x4390e3['type']!==_0x77f4('0x3b')){var _0x398369={};_0x398369[_0x4390e3[_0x77f4('0x29')]]={'$like':'%'+_0x98b961['query'][_0x77f4('0x3c')]+'%'};return _0x398369;}})});}_0x22a69d=_[_0x77f4('0x3a')]({},_0x22a69d,_0x98b961[_0x77f4('0x3d')]);var _0x4be843={'where':_0x22a69d['where']};return db['IntegrationReport'][_0x77f4('0x1c')](_0x4be843)[_0x77f4('0x26')](function(_0x1ab721){_0x3f45a1[_0x77f4('0x1c')]=_0x1ab721;if(_0x98b961['query']['includeAll']){_0x22a69d['include']=[{'all':!![]}];}return db[_0x77f4('0x3e')]['findAll'](_0x22a69d);})['then'](function(_0x4b098a){_0x3f45a1[_0x77f4('0x3f')]=_0x4b098a;return _0x3f45a1;})[_0x77f4('0x26')](respondWithFilteredResult(_0x3d487c,_0x22a69d))[_0x77f4('0x40')](handleError(_0x3d487c,null));};exports['show']=function(_0x26fed3,_0x372618){var _0x4ed9c9={'raw':![],'where':{'id':_0x26fed3['params']['id']}},_0x56d0d8={};_0x56d0d8[_0x77f4('0x2c')]=_['keys'](db[_0x77f4('0x3e')][_0x77f4('0x41')]);_0x56d0d8['query']=_[_0x77f4('0x2f')](_0x26fed3[_0x77f4('0x2e')]);_0x56d0d8[_0x77f4('0x30')]=_[_0x77f4('0x31')](_0x56d0d8[_0x77f4('0x2c')],_0x56d0d8['query']);_0x4ed9c9['attributes']=_[_0x77f4('0x31')](_0x56d0d8[_0x77f4('0x2c')],qs[_0x77f4('0x33')](_0x26fed3[_0x77f4('0x2e')][_0x77f4('0x33')]));_0x4ed9c9[_0x77f4('0x32')]=_0x4ed9c9[_0x77f4('0x32')][_0x77f4('0x34')]?_0x4ed9c9[_0x77f4('0x32')]:_0x56d0d8[_0x77f4('0x2c')];if(_0x26fed3[_0x77f4('0x2e')][_0x77f4('0x42')]){_0x4ed9c9[_0x77f4('0x43')]=[{'all':!![]}];}_0x4ed9c9=_[_0x77f4('0x3a')]({},_0x4ed9c9,_0x26fed3[_0x77f4('0x3d')]);return db[_0x77f4('0x3e')][_0x77f4('0x44')](_0x4ed9c9)['then'](handleEntityNotFound(_0x372618,null))[_0x77f4('0x26')](respondWithResult(_0x372618,null))[_0x77f4('0x40')](handleError(_0x372618,null));};exports[_0x77f4('0x45')]=function(_0x5d4d06,_0x251dfe){return db[_0x77f4('0x3e')][_0x77f4('0x45')](_0x5d4d06['body'],{})[_0x77f4('0x26')](respondWithResult(_0x251dfe,0xc9))[_0x77f4('0x40')](handleError(_0x251dfe,null));};exports['update']=function(_0x39d7bb,_0x186bb8){if(_0x39d7bb[_0x77f4('0x46')]['id']){delete _0x39d7bb['body']['id'];}return db[_0x77f4('0x3e')][_0x77f4('0x44')]({'where':{'id':_0x39d7bb[_0x77f4('0x47')]['id']}})['then'](handleEntityNotFound(_0x186bb8,null))[_0x77f4('0x26')](saveUpdates(_0x39d7bb[_0x77f4('0x46')],null))[_0x77f4('0x26')](respondWithResult(_0x186bb8,null))[_0x77f4('0x40')](handleError(_0x186bb8,null));};exports['destroy']=function(_0x456f19,_0x92f207){return db[_0x77f4('0x3e')]['find']({'where':{'id':_0x456f19['params']['id']}})[_0x77f4('0x26')](handleEntityNotFound(_0x92f207,null))[_0x77f4('0x26')](removeEntity(_0x92f207,null))[_0x77f4('0x40')](handleError(_0x92f207,null));};exports[_0x77f4('0x48')]=function(_0xbb2a3a,_0x158e1c){return db[_0x77f4('0x3e')][_0x77f4('0x48')]()[_0x77f4('0x26')](respondWithResult(_0x158e1c,null))[_0x77f4('0x40')](handleError(_0x158e1c,null));};
\ No newline at end of file