Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / squareRecording / squareRecording.controller.js
index 599b5b3..aec2275 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2fc9=['to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','render','merge','body','message','agent','interaction','index','map','SquareRecording','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','download','uniqueid','savePath','filename','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0xea6bb,_0x599cc1){var _0x55f140=function(_0x283f33){while(--_0x283f33){_0xea6bb['push'](_0xea6bb['shift']());}};_0x55f140(++_0x599cc1);}(_0x2fc9,0xc2));var _0x92fc=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x2fc9[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92fc('0x0'));var zipdir=require(_0x92fc('0x1'));var jsonpatch=require(_0x92fc('0x2'));var rp=require(_0x92fc('0x3'));var moment=require(_0x92fc('0x4'));var BPromise=require(_0x92fc('0x5'));var Mustache=require(_0x92fc('0x6'));var util=require(_0x92fc('0x7'));var path=require(_0x92fc('0x8'));var sox=require(_0x92fc('0x9'));var csv=require(_0x92fc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x92fc('0xb'));var crypto=require(_0x92fc('0xc'));var jsforce=require(_0x92fc('0xd'));var deskjs=require(_0x92fc('0xe'));var toCsv=require(_0x92fc('0xa'));var querystring=require(_0x92fc('0xf'));var Papa=require(_0x92fc('0x10'));var Redis=require('ioredis');var authService=require(_0x92fc('0x11'));var qs=require(_0x92fc('0x12'));var as=require(_0x92fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92fc('0x14'))(_0x92fc('0x15'));var utils=require(_0x92fc('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x92fc('0x17'))['db'];function respondWithStatusCode(_0x2aff0d,_0x5d5d23){_0x5d5d23=_0x5d5d23||0xcc;return function(_0x403b10){if(_0x403b10){return _0x2aff0d[_0x92fc('0x18')](_0x5d5d23);}return _0x2aff0d[_0x92fc('0x19')](_0x5d5d23)[_0x92fc('0x1a')]();};}function respondWithResult(_0xf88abf,_0x5a2ecc){_0x5a2ecc=_0x5a2ecc||0xc8;return function(_0x4007c8){if(_0x4007c8){return _0xf88abf[_0x92fc('0x19')](_0x5a2ecc)[_0x92fc('0x1b')](_0x4007c8);}};}function respondWithFilteredResult(_0x23a9ad,_0x5b3fba){return function(_0x4c45f3){if(_0x4c45f3){var _0x111f42=typeof _0x5b3fba[_0x92fc('0x1c')]==='undefined'&&typeof _0x5b3fba[_0x92fc('0x1d')]===_0x92fc('0x1e');var _0x90f874=_0x4c45f3['count'];var _0x2b0229=_0x111f42?0x0:_0x5b3fba[_0x92fc('0x1c')];var _0x3a1071=_0x111f42?_0x4c45f3[_0x92fc('0x1f')]:_0x5b3fba[_0x92fc('0x1c')]+_0x5b3fba[_0x92fc('0x1d')];var _0x207bde;if(_0x3a1071>=_0x90f874){_0x3a1071=_0x90f874;_0x207bde=0xc8;}else{_0x207bde=0xce;}_0x23a9ad[_0x92fc('0x19')](_0x207bde);return _0x23a9ad['set'](_0x92fc('0x20'),_0x2b0229+'-'+_0x3a1071+'/'+_0x90f874)['json'](_0x4c45f3);}return null;};}function patchUpdates(_0x1e3bb1){return function(_0x2cc51d){try{jsonpatch[_0x92fc('0x21')](_0x2cc51d,_0x1e3bb1,!![]);}catch(_0xb7751c){return BPromise[_0x92fc('0x22')](_0xb7751c);}return _0x2cc51d[_0x92fc('0x23')]();};}function saveUpdates(_0x2848f0,_0x5d5c29){return function(_0x22763f){if(_0x22763f){return _0x22763f[_0x92fc('0x24')](_0x2848f0)[_0x92fc('0x25')](function(_0x4c89eb){return _0x4c89eb;});}return null;};}function removeEntity(_0x29e986,_0x442576){return function(_0x3d06d5){if(_0x3d06d5){return _0x3d06d5['destroy']()[_0x92fc('0x25')](function(){_0x29e986[_0x92fc('0x19')](0xcc)[_0x92fc('0x1a')]();});}};}function handleEntityNotFound(_0x4052d5,_0x131546){return function(_0x366bd4){if(!_0x366bd4){_0x4052d5[_0x92fc('0x18')](0x194);}return _0x366bd4;};}function handleError(_0x27346a,_0x186d35){_0x186d35=_0x186d35||0x1f4;return function(_0x19ff2b){logger[_0x92fc('0x26')](_0x19ff2b[_0x92fc('0x27')]);if(_0x19ff2b[_0x92fc('0x28')]){delete _0x19ff2b['name'];}_0x27346a[_0x92fc('0x19')](_0x186d35)[_0x92fc('0x29')](_0x19ff2b);};}function getMustacheRender(_0x217cf3,_0x391c71){return Mustache[_0x92fc('0x2a')](_0x217cf3,_[_0x92fc('0x2b')](_0x391c71[_0x92fc('0x2c')],{'contact':_0x391c71['contact'],'message':_0x391c71[_0x92fc('0x2d')],'agent':_0x391c71[_0x92fc('0x2e')],'interaction':_0x391c71[_0x92fc('0x2f')],'account':_0x391c71['account']}))||'';}exports[_0x92fc('0x30')]=function(_0x1607ab,_0x416dfe){var _0x265b38={},_0x44e0cb={},_0x583353={'count':0x0,'rows':[]};var _0x57a00a=_[_0x92fc('0x31')](db[_0x92fc('0x32')]['rawAttributes'],function(_0xb207e){return{'name':_0xb207e[_0x92fc('0x33')],'type':_0xb207e[_0x92fc('0x34')][_0x92fc('0x35')]};});_0x44e0cb[_0x92fc('0x36')]=_['map'](_0x57a00a,_0x92fc('0x28'));_0x44e0cb[_0x92fc('0x37')]=_[_0x92fc('0x38')](_0x1607ab[_0x92fc('0x37')]);_0x44e0cb['filters']=_[_0x92fc('0x39')](_0x44e0cb['model'],_0x44e0cb['query']);_0x265b38[_0x92fc('0x3a')]=_[_0x92fc('0x39')](_0x44e0cb[_0x92fc('0x36')],qs[_0x92fc('0x3b')](_0x1607ab[_0x92fc('0x37')]['fields']));_0x265b38[_0x92fc('0x3a')]=_0x265b38[_0x92fc('0x3a')][_0x92fc('0x3c')]?_0x265b38[_0x92fc('0x3a')]:_0x44e0cb['model'];if(!_0x1607ab[_0x92fc('0x37')][_0x92fc('0x3d')](_0x92fc('0x3e'))){_0x265b38[_0x92fc('0x1d')]=qs[_0x92fc('0x1d')](_0x1607ab[_0x92fc('0x37')][_0x92fc('0x1d')]);_0x265b38['offset']=qs['offset'](_0x1607ab['query'][_0x92fc('0x1c')]);}_0x265b38[_0x92fc('0x3f')]=qs[_0x92fc('0x40')](_0x1607ab['query'][_0x92fc('0x40')]);_0x265b38[_0x92fc('0x41')]=qs[_0x92fc('0x42')](_[_0x92fc('0x43')](_0x1607ab['query'],_0x44e0cb[_0x92fc('0x42')]),_0x57a00a);if(_0x1607ab[_0x92fc('0x37')]['filter']){_0x265b38['where']=_['merge'](_0x265b38[_0x92fc('0x41')],{'$or':_[_0x92fc('0x31')](_0x57a00a,function(_0x4624ae){if(_0x4624ae['type']!==_0x92fc('0x44')){var _0x5aa811={};_0x5aa811[_0x4624ae[_0x92fc('0x28')]]={'$like':'%'+_0x1607ab[_0x92fc('0x37')][_0x92fc('0x45')]+'%'};return _0x5aa811;}})});}_0x265b38=_[_0x92fc('0x2b')]({},_0x265b38,_0x1607ab['options']);var _0x1d8b90={'where':_0x265b38[_0x92fc('0x41')]};return db[_0x92fc('0x32')][_0x92fc('0x1f')](_0x1d8b90)['then'](function(_0x166398){_0x583353['count']=_0x166398;if(_0x1607ab[_0x92fc('0x37')][_0x92fc('0x46')]){_0x265b38['include']=[{'all':!![]}];}return db[_0x92fc('0x32')][_0x92fc('0x47')](_0x265b38);})[_0x92fc('0x25')](function(_0x185402){_0x583353[_0x92fc('0x48')]=_0x185402;return _0x583353;})[_0x92fc('0x25')](respondWithFilteredResult(_0x416dfe,_0x265b38))[_0x92fc('0x49')](handleError(_0x416dfe,null));};exports[_0x92fc('0x4a')]=function(_0x4bf144,_0x2c93f0){var _0xecf38c={'raw':!![],'where':{'id':_0x4bf144[_0x92fc('0x4b')]['id']}},_0x58060c={};_0x58060c[_0x92fc('0x36')]=_[_0x92fc('0x38')](db[_0x92fc('0x32')][_0x92fc('0x4c')]);_0x58060c[_0x92fc('0x37')]=_['keys'](_0x4bf144['query']);_0x58060c[_0x92fc('0x42')]=_[_0x92fc('0x39')](_0x58060c[_0x92fc('0x36')],_0x58060c[_0x92fc('0x37')]);_0xecf38c[_0x92fc('0x3a')]=_[_0x92fc('0x39')](_0x58060c[_0x92fc('0x36')],qs['fields'](_0x4bf144[_0x92fc('0x37')][_0x92fc('0x3b')]));_0xecf38c[_0x92fc('0x3a')]=_0xecf38c[_0x92fc('0x3a')]['length']?_0xecf38c[_0x92fc('0x3a')]:_0x58060c[_0x92fc('0x36')];if(_0x4bf144[_0x92fc('0x37')][_0x92fc('0x46')]){_0xecf38c['include']=[{'all':!![]}];}_0xecf38c=_['merge']({},_0xecf38c,_0x4bf144[_0x92fc('0x4d')]);return db['SquareRecording'][_0x92fc('0x4e')](_0xecf38c)[_0x92fc('0x25')](handleEntityNotFound(_0x2c93f0,null))[_0x92fc('0x25')](respondWithResult(_0x2c93f0,null))[_0x92fc('0x49')](handleError(_0x2c93f0,null));};exports[_0x92fc('0x4f')]=function(_0xa2ce94,_0x9e5cc5){return db['SquareRecording'][_0x92fc('0x4f')](_0xa2ce94[_0x92fc('0x2c')],{})['then'](respondWithResult(_0x9e5cc5,0xc9))[_0x92fc('0x49')](handleError(_0x9e5cc5,null));};exports['update']=function(_0x2777db,_0x4f3e0){if(_0x2777db['body']['id']){delete _0x2777db['body']['id'];}return db[_0x92fc('0x32')][_0x92fc('0x4e')]({'where':{'id':_0x2777db[_0x92fc('0x4b')]['id']}})[_0x92fc('0x25')](handleEntityNotFound(_0x4f3e0,null))['then'](saveUpdates(_0x2777db[_0x92fc('0x2c')],null))[_0x92fc('0x25')](respondWithResult(_0x4f3e0,null))[_0x92fc('0x49')](handleError(_0x4f3e0,null));};exports[_0x92fc('0x50')]=function(_0x16b371,_0xa67dc3,_0x4794f5){var _0x5f3cf1=require('../../components/encryptor');var _0xbe500a=![];var _0x88cfd4={};if(_0x16b371['query'][_0x92fc('0x34')]&&_0x16b371['query']['type']===_0x92fc('0x51')){_0x88cfd4[_0x92fc('0x51')]=_0x16b371[_0x92fc('0x4b')]['id'];}else{_0x88cfd4['id']=_0x16b371[_0x92fc('0x4b')]['id'];}return db[_0x92fc('0x32')][_0x92fc('0x4e')]({'where':_0x88cfd4,'attributes':['id',_0x92fc('0x52'),_0x92fc('0x53')],'raw':!![]})[_0x92fc('0x25')](handleEntityNotFound(_0xa67dc3,null))['then'](function(_0x4feee1){if(_0x4feee1){var _0x2dc2bd=_0x4feee1[_0x92fc('0x52')];var _0x3a5e72=util['format'](_0x92fc('0x54'),_0x2dc2bd);if(fs['existsSync'](_0x3a5e72)){_0xbe500a=!![];return _0x5f3cf1[_0x92fc('0x55')](_0x3a5e72,_0x2dc2bd,config[_0x92fc('0x56')][_0x92fc('0x57')])['then'](function(){return _0x4feee1;});}return _0x4feee1;}})['then'](function(_0x529c43){if(_0x529c43){var _0x31e5cc=_0x529c43['savePath'];if(!fs[_0x92fc('0x58')](_0x31e5cc)){throw new db[(_0x92fc('0x59'))]['ValidationError'](_0x92fc('0x5a'));}if(_0x529c43[_0x92fc('0x53')]){return _0xa67dc3[_0x92fc('0x50')](_0x31e5cc,_0x529c43[_0x92fc('0x53')]+path[_0x92fc('0x5b')](_0x31e5cc),function(){if(_0xbe500a){fs[_0x92fc('0x5c')](_0x31e5cc);}});}else{return _0xa67dc3[_0x92fc('0x50')](_0x31e5cc,function(_0x448797){if(_0xbe500a){fs[_0x92fc('0x5c')](_0x31e5cc);}});}}})[_0x92fc('0x49')](function(_0x658e68){if(_0x658e68[_0x92fc('0x2d')]===_0x92fc('0x5a')){_0xa67dc3['status'](0x194)[_0x92fc('0x29')]('Not\x20found');}else{return handleError(_0xa67dc3,null);}});};exports[_0x92fc('0x5d')]=function(_0x536f83,_0x5d2165){return db[_0x92fc('0x32')]['find']({'where':{'id':_0x536f83[_0x92fc('0x4b')]['id']}})['then'](function(_0x55da06){if(_[_0x92fc('0x5e')](_0x55da06)){throw new ReferenceError(_0x92fc('0x5f'));}return _0x55da06;})[_0x92fc('0x25')](function(_0x125f4a){var _0x24085a=_0x125f4a[_0x92fc('0x52')];logger[_0x92fc('0x60')](_0x92fc('0x61'),_0x24085a);if(!_['isNil'](_0x125f4a['savePath'])&&fs[_0x92fc('0x58')](_0x24085a)){logger[_0x92fc('0x60')](_0x92fc('0x62')+_0x24085a+_0x92fc('0x63'));fs[_0x92fc('0x64')](_0x24085a);}_0x24085a=_0x24085a+_0x92fc('0x65');if(!_[_0x92fc('0x5e')](_0x125f4a['savePath'])&&fs['existsSync'](_0x24085a)){logger[_0x92fc('0x60')](_0x92fc('0x62')+_0x24085a+_0x92fc('0x63'));fs[_0x92fc('0x64')](_0x24085a);}return _0x125f4a;})[_0x92fc('0x25')](function(_0x18e0de){if(!_0x18e0de)throw new InternalError();return _0x18e0de[_0x92fc('0x5d')]();})[_0x92fc('0x25')](function(){_0x5d2165[_0x92fc('0x19')](0xcc)[_0x92fc('0x1a')]();})[_0x92fc('0x49')](handleError(_0x5d2165,null));};
\ No newline at end of file
+var _0x0f97=['%s.cypher','existsSync','decryptFile','secrets','recording','savePath','Sequelize','ValidationError','extname','SquareRecording\x20not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','update','then','error','stack','name','send','render','merge','body','agent','interaction','account','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','SquareRecording','include','findAll','catch','show','params','keys','includeAll','options','find','create','download','uniqueid','filename','format'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x0f97,0x196));var _0x70f9=function(_0x49bb91,_0x86ecf3){_0x49bb91=_0x49bb91-0x0;var _0x2b4339=_0x0f97[_0x49bb91];return _0x2b4339;};'use strict';var emlformat=require(_0x70f9('0x0'));var rimraf=require(_0x70f9('0x1'));var zipdir=require(_0x70f9('0x2'));var jsonpatch=require(_0x70f9('0x3'));var rp=require(_0x70f9('0x4'));var moment=require(_0x70f9('0x5'));var BPromise=require(_0x70f9('0x6'));var Mustache=require(_0x70f9('0x7'));var util=require(_0x70f9('0x8'));var path=require(_0x70f9('0x9'));var sox=require(_0x70f9('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70f9('0xb'));var _=require(_0x70f9('0xc'));var squel=require(_0x70f9('0xd'));var crypto=require(_0x70f9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x70f9('0xf'));var querystring=require(_0x70f9('0x10'));var Papa=require(_0x70f9('0x11'));var Redis=require(_0x70f9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x70f9('0x13'))(_0x70f9('0x14'));var utils=require(_0x70f9('0x15'));var config=require(_0x70f9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x70f9('0x17'))['db'];function respondWithStatusCode(_0x2ae8f0,_0x27d5cd){_0x27d5cd=_0x27d5cd||0xcc;return function(_0xf959ad){if(_0xf959ad){return _0x2ae8f0[_0x70f9('0x18')](_0x27d5cd);}return _0x2ae8f0['status'](_0x27d5cd)[_0x70f9('0x19')]();};}function respondWithResult(_0x5186dd,_0x57f942){_0x57f942=_0x57f942||0xc8;return function(_0x4879b4){if(_0x4879b4){return _0x5186dd['status'](_0x57f942)[_0x70f9('0x1a')](_0x4879b4);}};}function respondWithFilteredResult(_0x4d1deb,_0x2a86bb){return function(_0x36044f){if(_0x36044f){var _0x138a8e=typeof _0x2a86bb[_0x70f9('0x1b')]===_0x70f9('0x1c')&&typeof _0x2a86bb[_0x70f9('0x1d')]===_0x70f9('0x1c');var _0x344590=_0x36044f[_0x70f9('0x1e')];var _0x4b6e93=_0x138a8e?0x0:_0x2a86bb[_0x70f9('0x1b')];var _0x459ce9=_0x138a8e?_0x36044f['count']:_0x2a86bb[_0x70f9('0x1b')]+_0x2a86bb[_0x70f9('0x1d')];var _0x1cc58c;if(_0x459ce9>=_0x344590){_0x459ce9=_0x344590;_0x1cc58c=0xc8;}else{_0x1cc58c=0xce;}_0x4d1deb[_0x70f9('0x1f')](_0x1cc58c);return _0x4d1deb['set']('Content-Range',_0x4b6e93+'-'+_0x459ce9+'/'+_0x344590)[_0x70f9('0x1a')](_0x36044f);}return null;};}function patchUpdates(_0x24a7f1){return function(_0x34e740){try{jsonpatch[_0x70f9('0x20')](_0x34e740,_0x24a7f1,!![]);}catch(_0x4b87c8){return BPromise[_0x70f9('0x21')](_0x4b87c8);}return _0x34e740['save']();};}function saveUpdates(_0x454339,_0x309afd){return function(_0x3ce965){if(_0x3ce965){return _0x3ce965[_0x70f9('0x22')](_0x454339)[_0x70f9('0x23')](function(_0x4ae0c9){return _0x4ae0c9;});}return null;};}function removeEntity(_0x440f34,_0x38479d){return function(_0x388f13){if(_0x388f13){return _0x388f13['destroy']()[_0x70f9('0x23')](function(){_0x440f34[_0x70f9('0x1f')](0xcc)[_0x70f9('0x19')]();});}};}function handleEntityNotFound(_0x3c3051,_0x2a9c4b){return function(_0x49337a){if(!_0x49337a){_0x3c3051[_0x70f9('0x18')](0x194);}return _0x49337a;};}function handleError(_0x74b33c,_0x1139e7){_0x1139e7=_0x1139e7||0x1f4;return function(_0x386ded){logger[_0x70f9('0x24')](_0x386ded[_0x70f9('0x25')]);if(_0x386ded['name']){delete _0x386ded[_0x70f9('0x26')];}_0x74b33c[_0x70f9('0x1f')](_0x1139e7)[_0x70f9('0x27')](_0x386ded);};}function getMustacheRender(_0x2ddf21,_0x35d452){return Mustache[_0x70f9('0x28')](_0x2ddf21,_[_0x70f9('0x29')](_0x35d452[_0x70f9('0x2a')],{'contact':_0x35d452['contact'],'message':_0x35d452['message'],'agent':_0x35d452[_0x70f9('0x2b')],'interaction':_0x35d452[_0x70f9('0x2c')],'account':_0x35d452[_0x70f9('0x2d')]}))||'';}exports['index']=function(_0x562f5e,_0x40496a){var _0xe9d41f={},_0x4d0f9e={},_0x55696d={'count':0x0,'rows':[]};var _0x1b0b19=_[_0x70f9('0x2e')](db['SquareRecording'][_0x70f9('0x2f')],function(_0x227845){return{'name':_0x227845['fieldName'],'type':_0x227845[_0x70f9('0x30')][_0x70f9('0x31')]};});_0x4d0f9e[_0x70f9('0x32')]=_['map'](_0x1b0b19,_0x70f9('0x26'));_0x4d0f9e[_0x70f9('0x33')]=_['keys'](_0x562f5e[_0x70f9('0x33')]);_0x4d0f9e[_0x70f9('0x34')]=_['intersection'](_0x4d0f9e[_0x70f9('0x32')],_0x4d0f9e[_0x70f9('0x33')]);_0xe9d41f[_0x70f9('0x35')]=_[_0x70f9('0x36')](_0x4d0f9e[_0x70f9('0x32')],qs[_0x70f9('0x37')](_0x562f5e[_0x70f9('0x33')]['fields']));_0xe9d41f[_0x70f9('0x35')]=_0xe9d41f[_0x70f9('0x35')][_0x70f9('0x38')]?_0xe9d41f[_0x70f9('0x35')]:_0x4d0f9e[_0x70f9('0x32')];if(!_0x562f5e[_0x70f9('0x33')]['hasOwnProperty'](_0x70f9('0x39'))){_0xe9d41f[_0x70f9('0x1d')]=qs['limit'](_0x562f5e[_0x70f9('0x33')]['limit']);_0xe9d41f[_0x70f9('0x1b')]=qs['offset'](_0x562f5e[_0x70f9('0x33')][_0x70f9('0x1b')]);}_0xe9d41f[_0x70f9('0x3a')]=qs[_0x70f9('0x3b')](_0x562f5e[_0x70f9('0x33')][_0x70f9('0x3b')]);_0xe9d41f[_0x70f9('0x3c')]=qs[_0x70f9('0x34')](_[_0x70f9('0x3d')](_0x562f5e[_0x70f9('0x33')],_0x4d0f9e['filters']),_0x1b0b19);if(_0x562f5e[_0x70f9('0x33')][_0x70f9('0x3e')]){_0xe9d41f[_0x70f9('0x3c')]=_[_0x70f9('0x29')](_0xe9d41f[_0x70f9('0x3c')],{'$or':_[_0x70f9('0x2e')](_0x1b0b19,function(_0x4dcd1d){if(_0x4dcd1d[_0x70f9('0x30')]!==_0x70f9('0x3f')){var _0x1e7e55={};_0x1e7e55[_0x4dcd1d[_0x70f9('0x26')]]={'$like':'%'+_0x562f5e[_0x70f9('0x33')]['filter']+'%'};return _0x1e7e55;}})});}_0xe9d41f=_[_0x70f9('0x29')]({},_0xe9d41f,_0x562f5e['options']);var _0x8ca1a6={'where':_0xe9d41f['where']};return db[_0x70f9('0x40')]['count'](_0x8ca1a6)[_0x70f9('0x23')](function(_0x4f1ec6){_0x55696d['count']=_0x4f1ec6;if(_0x562f5e[_0x70f9('0x33')]['includeAll']){_0xe9d41f[_0x70f9('0x41')]=[{'all':!![]}];}return db['SquareRecording'][_0x70f9('0x42')](_0xe9d41f);})[_0x70f9('0x23')](function(_0x1153b6){_0x55696d['rows']=_0x1153b6;return _0x55696d;})['then'](respondWithFilteredResult(_0x40496a,_0xe9d41f))[_0x70f9('0x43')](handleError(_0x40496a,null));};exports[_0x70f9('0x44')]=function(_0x59cf74,_0x29d827){var _0x265a08={'raw':!![],'where':{'id':_0x59cf74[_0x70f9('0x45')]['id']}},_0x1e89d2={};_0x1e89d2[_0x70f9('0x32')]=_[_0x70f9('0x46')](db[_0x70f9('0x40')]['rawAttributes']);_0x1e89d2[_0x70f9('0x33')]=_[_0x70f9('0x46')](_0x59cf74[_0x70f9('0x33')]);_0x1e89d2[_0x70f9('0x34')]=_['intersection'](_0x1e89d2[_0x70f9('0x32')],_0x1e89d2[_0x70f9('0x33')]);_0x265a08[_0x70f9('0x35')]=_[_0x70f9('0x36')](_0x1e89d2[_0x70f9('0x32')],qs[_0x70f9('0x37')](_0x59cf74['query'][_0x70f9('0x37')]));_0x265a08[_0x70f9('0x35')]=_0x265a08[_0x70f9('0x35')][_0x70f9('0x38')]?_0x265a08['attributes']:_0x1e89d2[_0x70f9('0x32')];if(_0x59cf74['query'][_0x70f9('0x47')]){_0x265a08['include']=[{'all':!![]}];}_0x265a08=_[_0x70f9('0x29')]({},_0x265a08,_0x59cf74[_0x70f9('0x48')]);return db[_0x70f9('0x40')][_0x70f9('0x49')](_0x265a08)[_0x70f9('0x23')](handleEntityNotFound(_0x29d827,null))['then'](respondWithResult(_0x29d827,null))[_0x70f9('0x43')](handleError(_0x29d827,null));};exports['create']=function(_0x3fc59d,_0x15b17e){return db[_0x70f9('0x40')][_0x70f9('0x4a')](_0x3fc59d[_0x70f9('0x2a')],{})['then'](respondWithResult(_0x15b17e,0xc9))[_0x70f9('0x43')](handleError(_0x15b17e,null));};exports['update']=function(_0x58fd12,_0x36c5bf){if(_0x58fd12[_0x70f9('0x2a')]['id']){delete _0x58fd12['body']['id'];}return db[_0x70f9('0x40')][_0x70f9('0x49')]({'where':{'id':_0x58fd12[_0x70f9('0x45')]['id']}})[_0x70f9('0x23')](handleEntityNotFound(_0x36c5bf,null))[_0x70f9('0x23')](saveUpdates(_0x58fd12[_0x70f9('0x2a')],null))[_0x70f9('0x23')](respondWithResult(_0x36c5bf,null))[_0x70f9('0x43')](handleError(_0x36c5bf,null));};exports[_0x70f9('0x4b')]=function(_0x1adb3d,_0x56af34,_0x19e081){var _0x17f85f=require('../../components/encryptor');var _0x7a1a50=![];var _0x28b50e={};if(_0x1adb3d[_0x70f9('0x33')][_0x70f9('0x30')]&&_0x1adb3d['query'][_0x70f9('0x30')]==='uniqueid'){_0x28b50e[_0x70f9('0x4c')]=_0x1adb3d[_0x70f9('0x45')]['id'];}else{_0x28b50e['id']=_0x1adb3d[_0x70f9('0x45')]['id'];}return db[_0x70f9('0x40')]['find']({'where':_0x28b50e,'attributes':['id','savePath',_0x70f9('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x56af34,null))[_0x70f9('0x23')](function(_0xeab778){if(_0xeab778){var _0x77eab4=_0xeab778['savePath'];var _0x2ed80c=util[_0x70f9('0x4e')](_0x70f9('0x4f'),_0x77eab4);if(fs[_0x70f9('0x50')](_0x2ed80c)){_0x7a1a50=!![];return _0x17f85f[_0x70f9('0x51')](_0x2ed80c,_0x77eab4,config[_0x70f9('0x52')][_0x70f9('0x53')])[_0x70f9('0x23')](function(){return _0xeab778;});}return _0xeab778;}})[_0x70f9('0x23')](function(_0x2c2dd5){if(_0x2c2dd5){var _0x1f7197=_0x2c2dd5[_0x70f9('0x54')];if(!fs['existsSync'](_0x1f7197)){throw new db[(_0x70f9('0x55'))][(_0x70f9('0x56'))]('SquareRecording\x20not\x20found');}if(_0x2c2dd5[_0x70f9('0x4d')]){return _0x56af34[_0x70f9('0x4b')](_0x1f7197,_0x2c2dd5[_0x70f9('0x4d')]+path[_0x70f9('0x57')](_0x1f7197),function(){if(_0x7a1a50){fs['unlink'](_0x1f7197);}});}else{return _0x56af34[_0x70f9('0x4b')](_0x1f7197,function(_0x5aeb81){if(_0x7a1a50){fs['unlink'](_0x1f7197);}});}}})['catch'](function(_0x1681b2){if(_0x1681b2['message']===_0x70f9('0x58')){_0x56af34[_0x70f9('0x1f')](0x194)[_0x70f9('0x27')]('Not\x20found');}else{return handleError(_0x56af34,null);}});};exports[_0x70f9('0x59')]=function(_0x258add,_0x3a3987){return db[_0x70f9('0x40')][_0x70f9('0x49')]({'where':{'id':_0x258add[_0x70f9('0x45')]['id']}})[_0x70f9('0x23')](function(_0x4adec7){if(_[_0x70f9('0x5a')](_0x4adec7)){throw new ReferenceError(_0x70f9('0x5b'));}return _0x4adec7;})[_0x70f9('0x23')](function(_0x45a8e6){var _0xd094c7=_0x45a8e6['savePath'];logger[_0x70f9('0x5c')](_0x70f9('0x5d'),_0xd094c7);if(!_[_0x70f9('0x5a')](_0x45a8e6['savePath'])&&fs[_0x70f9('0x50')](_0xd094c7)){logger[_0x70f9('0x5c')](_0x70f9('0x5e')+_0xd094c7+_0x70f9('0x5f'));fs[_0x70f9('0x60')](_0xd094c7);}_0xd094c7=_0xd094c7+'.cypher';if(!_[_0x70f9('0x5a')](_0x45a8e6[_0x70f9('0x54')])&&fs[_0x70f9('0x50')](_0xd094c7)){logger[_0x70f9('0x5c')](_0x70f9('0x5e')+_0xd094c7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x70f9('0x60')](_0xd094c7);}return _0x45a8e6;})['then'](function(_0x174bfc){if(!_0x174bfc)throw new InternalError();return _0x174bfc[_0x70f9('0x59')]();})[_0x70f9('0x23')](function(){_0x3a3987[_0x70f9('0x1f')](0xcc)[_0x70f9('0x19')]();})[_0x70f9('0x43')](handleError(_0x3a3987,null));};
\ No newline at end of file