Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / voiceRecording / voiceRecording.controller.js
index e48b8f5..cdfa8bd 100644 (file)
@@ -1 +1 @@
-const a924_0x1164=['length','downloadTranscribe','download','sentimentRegion','lodash','Buckets','root','VoiceRecording\x20not\x20found','order','keys','fields','extname','TranscribeService','update','data2','tempSentiment','aws-sdk','runSentiment','differenceBy','undefined','filters','path','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','push','value','Transcribe\x20not\x20configured','transcribeAccountId','status','../../config/logger','where','name','model','startTranscriptionJob','set','create','findAll','listBuckets','../../components/encryptor','transcribeRegion','TranscriptionJob','Setting','send','Not\x20found','sentimentAccountId','TranscriptionJobName','/server/files/transcribes/transcribe_','unlink','api','transcribeName','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','fieldName','like','runTranscribe','../../config/environment','end','Entity\x20not\x20found','params','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','intersection','upload','merge','Location','json','include','Cloud\x20Provider\x20not\x20available','destroy','body','VoiceRecording','Voice\x20Recording\x20not\x20found','Sentiment\x20Analysis\x20not\x20configured','rawAttributes','info','find','filename','attributes','fileText','../../mysqldb','location','.cypher','$and','includeAll','util','basename','sort','bucket','uniqueid','error-middleware/errors','catch','language','offset','limit','and','rows','Content-Range','then','sequelize','map','index','cancellazione\x20fisica\x20documento\x20%s','decryptFile','transcribe','data1','findOne','show','Cloud\x20Provider\x20not\x20configured','VIRTUAL','count','isNil','describe','secrets','existsSync','options','CloudProvider','nolimit','File:\x20\x22','createBucket','filter','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','query','sendStatus','sentiment','format','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','downloads','Name','unlinkSync','type','Transcript\x20not\x20available','recording','transcribeStatus','message'];(function(_0x2274b7,_0x160894){const _0x11645b=function(_0x5c95da){while(--_0x5c95da){_0x2274b7['push'](_0x2274b7['shift']());}};_0x11645b(++_0x160894);}(a924_0x1164,0x14c));const a924_0x5c95=function(_0x2274b7,_0x160894){_0x2274b7=_0x2274b7-0x127;let _0x11645b=a924_0x1164[_0x2274b7];return _0x11645b;};const a924_0x33ff8b=a924_0x5c95;'use strict';const util=require(a924_0x33ff8b(0x132)),path=require(a924_0x33ff8b(0x179)),fs=require('fs'),_=require(a924_0x33ff8b(0x168)),AWS=require(a924_0x33ff8b(0x174)),{v4:uuidv4}=require('uuid'),qs=require('../../components/parsers/qs'),logger=require(a924_0x33ff8b(0x180))(a924_0x33ff8b(0x193)),config=require(a924_0x33ff8b(0x199)),{db}=require(a924_0x33ff8b(0x12d)),{Op,fn,col,ValidationError}=require(a924_0x33ff8b(0x140)),{InternalError}=require(a924_0x33ff8b(0x137));function respondWithResult(_0x2d9dd3,_0x2ca55a){return _0x2ca55a=_0x2ca55a||0xc8,function(_0x17c8de){const _0x473685=a924_0x5c95;if(_0x17c8de)return _0x2d9dd3[_0x473685(0x17f)](_0x2ca55a)[_0x473685(0x1a2)](_0x17c8de);};}function respondWithFilteredResult(_0x41409c,_0x1f39f2){return function(_0x23a122){const _0x1c8684=a924_0x5c95;if(_0x23a122){const _0x3427f3=_0x23a122[_0x1c8684(0x14b)],_0x88777e=_0x1f39f2[_0x1c8684(0x13a)];let _0x419481=_0x1f39f2[_0x1c8684(0x13a)]+_0x1f39f2[_0x1c8684(0x13b)],_0x1a7a97;return _0x419481>=_0x3427f3?(_0x419481=_0x3427f3,_0x1a7a97=0xc8):_0x1a7a97=0xce,_0x41409c[_0x1c8684(0x17f)](_0x1a7a97),_0x41409c[_0x1c8684(0x185)](_0x1c8684(0x13e),_0x88777e+'-'+_0x419481+'/'+_0x3427f3)[_0x1c8684(0x1a2)](_0x23a122);}return null;};}function saveUpdates(_0x317dd0){return function(_0x3fb56a){const _0x3c9e19=a924_0x5c95;if(_0x3fb56a)return _0x3fb56a[_0x3c9e19(0x171)](_0x317dd0)[_0x3c9e19(0x13f)](function(_0x31163a){return _0x31163a;});return null;};}function handleEntityNotFound(_0x2b8c45){return function(_0x2bab1b){const _0x152466=a924_0x5c95;return!_0x2bab1b&&_0x2b8c45[_0x152466(0x158)](0x194),_0x2bab1b;};}function handleError(_0x279d1c,_0x459b0a){return _0x459b0a=_0x459b0a||0x1f4,function(_0x235b35){const _0x53795f=a924_0x5c95;logger['error'](_0x235b35['stack']),_0x235b35['name']&&delete _0x235b35[_0x53795f(0x182)],_0x279d1c['status'](_0x459b0a)['send'](_0x235b35);};}exports[a924_0x33ff8b(0x142)]=function(_0x229667,_0x38a964){const _0x5bfa16=a924_0x33ff8b;let _0x4889f9={};const _0x56e984={},_0x2c6cee={'count':0x0,'rows':[]},_0x5089c9=_['map'](db[_0x5bfa16(0x1a7)][_0x5bfa16(0x127)],function(_0x4f9086){const _0x3ca3fd=_0x5bfa16;return{'name':_0x4f9086[_0x3ca3fd(0x196)],'type':_0x4f9086[_0x3ca3fd(0x15f)]['key']};});_0x56e984[_0x5bfa16(0x183)]=_[_0x5bfa16(0x176)](_[_0x5bfa16(0x141)](_0x5089c9,_0x5bfa16(0x182)),[_0x5bfa16(0x15a)]),_0x56e984[_0x5bfa16(0x157)]=_[_0x5bfa16(0x16d)](_0x229667[_0x5bfa16(0x157)]),_0x56e984[_0x5bfa16(0x178)]=_['intersection'](_0x56e984['model'],_0x56e984[_0x5bfa16(0x157)]),_0x4889f9[_0x5bfa16(0x12b)]=_[_0x5bfa16(0x19e)](_0x56e984[_0x5bfa16(0x183)],qs[_0x5bfa16(0x16e)](_0x229667[_0x5bfa16(0x157)][_0x5bfa16(0x16e)])),_0x4889f9[_0x5bfa16(0x12b)]=_0x4889f9[_0x5bfa16(0x12b)][_0x5bfa16(0x164)]?_0x4889f9[_0x5bfa16(0x12b)]:_0x56e984[_0x5bfa16(0x183)];typeof _0x229667['query'][_0x5bfa16(0x152)]===_0x5bfa16(0x177)&&(_0x4889f9[_0x5bfa16(0x13b)]=qs[_0x5bfa16(0x13b)](_0x229667[_0x5bfa16(0x157)]['limit']),_0x4889f9[_0x5bfa16(0x13a)]=qs[_0x5bfa16(0x13a)](_0x229667[_0x5bfa16(0x157)]['offset']));_0x4889f9[_0x5bfa16(0x16c)]=qs[_0x5bfa16(0x134)](_0x229667['query'][_0x5bfa16(0x134)]),_0x4889f9[_0x5bfa16(0x181)]=qs[_0x5bfa16(0x178)](_['pick'](_0x229667[_0x5bfa16(0x157)],_0x56e984['filters']),_0x5089c9);_0x229667[_0x5bfa16(0x157)][_0x5bfa16(0x155)]&&(_0x4889f9[_0x5bfa16(0x181)]=_[_0x5bfa16(0x1a0)](_0x4889f9['where'],{[Op['or']]:_[_0x5bfa16(0x141)](_0x5089c9,function(_0x550ab7){const _0x1b29f9=_0x5bfa16;if(_0x550ab7['type']!==_0x1b29f9(0x14a)){const _0x392852={};return _0x392852[_0x550ab7[_0x1b29f9(0x182)]]={[Op[_0x1b29f9(0x197)]]:'%'+_0x229667[_0x1b29f9(0x157)]['filter']+'%'},_0x392852;}})}));_0x4889f9=_[_0x5bfa16(0x1a0)]({},_0x4889f9,_0x229667['options']);const _0x4d4c7a={'where':_0x4889f9[_0x5bfa16(0x181)]};return db[_0x5bfa16(0x1a7)][_0x5bfa16(0x14b)](_0x4d4c7a)[_0x5bfa16(0x13f)](function(_0x5d4cc3){const _0xbb9da=_0x5bfa16;return _0x2c6cee['count']=_0x5d4cc3,_0x229667[_0xbb9da(0x157)][_0xbb9da(0x131)]&&(_0x4889f9[_0xbb9da(0x1a3)]=[{'all':!![]}]),db[_0xbb9da(0x1a7)][_0xbb9da(0x187)](_0x4889f9);})[_0x5bfa16(0x13f)](function(_0x72a790){const _0x456de9=_0x5bfa16;return _0x2c6cee[_0x456de9(0x13d)]=_0x72a790,_0x2c6cee;})[_0x5bfa16(0x13f)](respondWithFilteredResult(_0x38a964,_0x4889f9))['catch'](handleError(_0x38a964,null));},exports[a924_0x33ff8b(0x148)]=function(_0x6666,_0x38a42a){const _0xf8c88=a924_0x33ff8b;let _0xc74eb6={'raw':![],'where':{'id':_0x6666[_0xf8c88(0x19c)]['id']}};const _0xfa0be8={};return _0xfa0be8[_0xf8c88(0x183)]=_[_0xf8c88(0x16d)](db[_0xf8c88(0x1a7)][_0xf8c88(0x127)]),_0xfa0be8[_0xf8c88(0x157)]=_[_0xf8c88(0x16d)](_0x6666[_0xf8c88(0x157)]),_0xfa0be8['filters']=_[_0xf8c88(0x19e)](_0xfa0be8[_0xf8c88(0x183)],_0xfa0be8[_0xf8c88(0x157)]),_0xc74eb6['attributes']=_[_0xf8c88(0x19e)](_0xfa0be8[_0xf8c88(0x183)],qs[_0xf8c88(0x16e)](_0x6666[_0xf8c88(0x157)][_0xf8c88(0x16e)])),_0xc74eb6[_0xf8c88(0x12b)]=_0xc74eb6[_0xf8c88(0x12b)][_0xf8c88(0x164)]?_0xc74eb6[_0xf8c88(0x12b)]:_0xfa0be8['model'],_0x6666['query']['includeAll']&&(_0xc74eb6[_0xf8c88(0x1a3)]=[{'all':!![]}]),_0xc74eb6=_[_0xf8c88(0x1a0)]({},_0xc74eb6,_0x6666[_0xf8c88(0x150)]),db['VoiceRecording']['findOne'](_0xc74eb6)[_0xf8c88(0x13f)](handleEntityNotFound(_0x38a42a,null))[_0xf8c88(0x13f)](respondWithResult(_0x38a42a,null))[_0xf8c88(0x138)](handleError(_0x38a42a,null));},exports[a924_0x33ff8b(0x186)]=function(_0x50820d,_0x65bbff){const _0x501a13=a924_0x33ff8b;return db[_0x501a13(0x1a7)]['create'](_0x50820d[_0x501a13(0x1a6)],{})[_0x501a13(0x13f)](respondWithResult(_0x65bbff,0xc9))[_0x501a13(0x138)](handleError(_0x65bbff,null));},exports[a924_0x33ff8b(0x171)]=function(_0x1f9c0d,_0x2daf7d){const _0x167c29=a924_0x33ff8b;return _0x1f9c0d[_0x167c29(0x1a6)]['id']&&delete _0x1f9c0d[_0x167c29(0x1a6)]['id'],db['VoiceRecording']['findOne']({'where':{'id':_0x1f9c0d[_0x167c29(0x19c)]['id']}})[_0x167c29(0x13f)](handleEntityNotFound(_0x2daf7d,null))['then'](saveUpdates(_0x1f9c0d[_0x167c29(0x1a6)],null))[_0x167c29(0x13f)](respondWithResult(_0x2daf7d,null))[_0x167c29(0x138)](handleError(_0x2daf7d,null));},exports[a924_0x33ff8b(0x14d)]=function(_0x24e5da,_0x3d5949){const _0x151f42=a924_0x33ff8b;return db[_0x151f42(0x1a7)][_0x151f42(0x14d)]()[_0x151f42(0x13f)](respondWithResult(_0x3d5949,null))[_0x151f42(0x138)](handleError(_0x3d5949,null));},exports['download']=function(_0x4fd075,_0x48b85e){const _0x4a0049=a924_0x33ff8b,_0x44547f=require(_0x4a0049(0x189));let _0x5970f8=![];const _0x121077={};return _0x4fd075['query'][_0x4a0049(0x15f)]&&_0x4fd075[_0x4a0049(0x157)]['type']===_0x4a0049(0x136)?_0x121077[_0x4a0049(0x136)]=_0x4fd075[_0x4a0049(0x19c)]['id']:_0x121077['id']=_0x4fd075[_0x4a0049(0x19c)]['id'],db['VoiceRecording']['findOne']({'where':_0x121077,'attributes':['id',_0x4a0049(0x17c)],'raw':!![]})[_0x4a0049(0x13f)](handleEntityNotFound(_0x48b85e,null))['then'](function(_0x45d627){const _0x39eec5=_0x4a0049;if(_0x45d627){const _0x1369cb=_0x45d627['value'],_0x4bbac6=util[_0x39eec5(0x15a)]('%s.cypher',_0x1369cb);if(fs[_0x39eec5(0x14f)](_0x4bbac6))return _0x5970f8=!![],_0x44547f['decryptFile'](_0x4bbac6,_0x1369cb,config[_0x39eec5(0x14e)][_0x39eec5(0x161)])[_0x39eec5(0x13f)](function(){return _0x45d627;});return _0x45d627;}})[_0x4a0049(0x13f)](function(_0x5e6222){const _0x53aee0=_0x4a0049;if(_0x5e6222){const _0x26b92f=_0x5e6222[_0x53aee0(0x17c)];if(!fs[_0x53aee0(0x14f)](_0x26b92f))throw new ValidationError('VoiceRecording\x20not\x20found');return _0x5e6222['filename']?_0x48b85e[_0x53aee0(0x166)](_0x26b92f,_0x5e6222['filename']+path['extname'](_0x26b92f),function(){_0x5970f8&&fs['unlink'](_0x26b92f);}):_0x48b85e[_0x53aee0(0x166)](_0x26b92f,function(){const _0x4e7b09=_0x53aee0;_0x5970f8&&fs[_0x4e7b09(0x192)](_0x26b92f);});}})[_0x4a0049(0x138)](function(_0x50d11f){const _0x46c403=_0x4a0049;if(_0x50d11f[_0x46c403(0x163)]===_0x46c403(0x16b))_0x48b85e[_0x46c403(0x17f)](0x194)[_0x46c403(0x18d)](_0x46c403(0x18e));else return handleError(_0x48b85e,null);});},exports[a924_0x33ff8b(0x15c)]=function(_0x8883da,_0x54f458){const _0x56d811=a924_0x33ff8b,_0x285f43=require(_0x56d811(0x189));let _0x1f8534=![];const _0x87364e={[Op[_0x56d811(0x13c)]]:[_0x87364e(fn('MD5',col(_0x56d811(0x136))),_0x8883da[_0x56d811(0x157)]['token'])]};return _0x8883da[_0x56d811(0x157)][_0x56d811(0x15f)]&&_0x8883da[_0x56d811(0x157)][_0x56d811(0x15f)]===_0x56d811(0x136)?_0x87364e[_0x56d811(0x130)][_0x56d811(0x17b)]({'uniqueid':_0x8883da[_0x56d811(0x19c)]['id']}):_0x87364e[_0x56d811(0x130)][_0x56d811(0x17b)]({'id':_0x8883da[_0x56d811(0x19c)]['id']}),db[_0x56d811(0x1a7)][_0x56d811(0x147)]({'where':_0x87364e,'attributes':['id','value'],'raw':!![]})[_0x56d811(0x13f)](handleEntityNotFound(_0x54f458,null))[_0x56d811(0x13f)](function(_0x3c8f00){const _0xfc43e2=_0x56d811;if(_0x3c8f00){const _0x4ca7a8=util[_0xfc43e2(0x15a)]('%s.cypher',_0x3c8f00[_0xfc43e2(0x17c)]);if(fs[_0xfc43e2(0x14f)](_0x4ca7a8))return _0x1f8534=!![],_0x285f43[_0xfc43e2(0x144)](_0x4ca7a8,_0x3c8f00['value'],config[_0xfc43e2(0x14e)][_0xfc43e2(0x161)])['then'](function(){return _0x3c8f00;});return _0x3c8f00;}})['then'](function(_0x839e3){const _0x17561a=_0x56d811;if(_0x839e3){if(!fs['existsSync'](_0x839e3[_0x17561a(0x17c)]))throw new ValidationError(_0x17561a(0x16b));return _0x839e3['filename']?_0x54f458[_0x17561a(0x166)](_0x839e3['value'],_0x839e3[_0x17561a(0x12a)]+path[_0x17561a(0x16f)](_0x839e3[_0x17561a(0x17c)]),function(){const _0x581a1e=_0x17561a;_0x1f8534&&fs[_0x581a1e(0x192)](_0x839e3['value']);}):_0x54f458['download'](_0x839e3[_0x17561a(0x17c)],function(){const _0x2d0435=_0x17561a;_0x1f8534&&fs[_0x2d0435(0x192)](_0x839e3[_0x2d0435(0x17c)]);});}})[_0x56d811(0x138)](handleError(_0x54f458,null));},exports['destroy']=function(_0xbde101,_0x4dac83){const _0x4b1f4d=a924_0x33ff8b;return db['VoiceRecording'][_0x4b1f4d(0x147)]({'where':{'id':_0xbde101[_0x4b1f4d(0x19c)]['id']}})[_0x4b1f4d(0x13f)](function(_0x3ed80f){const _0x395102=_0x4b1f4d;if(!_0x3ed80f)throw new ReferenceError(_0x395102(0x19b));return _0x3ed80f;})[_0x4b1f4d(0x13f)](function(_0x114a43){const _0x5c376e=_0x4b1f4d;let _0x7503d1=_0x114a43['value'];return logger['info'](_0x5c376e(0x143),_0x7503d1),!_[_0x5c376e(0x14c)](_0x114a43[_0x5c376e(0x17c)])&&fs[_0x5c376e(0x14f)](_0x7503d1)&&(logger['info'](_0x5c376e(0x153)+_0x7503d1+_0x5c376e(0x19d)),fs[_0x5c376e(0x15e)](_0x7503d1)),_0x7503d1=_0x7503d1+_0x5c376e(0x12f),!_[_0x5c376e(0x14c)](_0x114a43[_0x5c376e(0x17c)])&&fs['existsSync'](_0x7503d1)&&(logger['info'](_0x5c376e(0x153)+_0x7503d1+_0x5c376e(0x19d)),fs[_0x5c376e(0x15e)](_0x7503d1)),_0x114a43;})[_0x4b1f4d(0x13f)](function(_0x580e18){const _0x3f2644=_0x4b1f4d;if(!_0x580e18)throw new InternalError();return _0x580e18[_0x3f2644(0x1a5)]();})[_0x4b1f4d(0x13f)](function(){const _0x5d9423=_0x4b1f4d;_0x4dac83[_0x5d9423(0x17f)](0xcc)[_0x5d9423(0x19a)]();})[_0x4b1f4d(0x138)](handleError(_0x4dac83,null));};function getBucketslist(_0x30d807,_0x32d160,_0x772aae){return new Promise(function(_0x13aa8f,_0x2a750b){const _0x35046f=a924_0x5c95,_0x38dac0=new AWS['S3']({'accessKeyId':_0x32d160,'secretAccessKey':_0x30d807,'region':_0x772aae});_0x38dac0[_0x35046f(0x188)]({},function(_0xaeb414,_0x11e587){return _0xaeb414?_0x2a750b(_0xaeb414):_0x13aa8f(_0x11e587);});});}function createBucket(_0xce9e73,_0x2814c6,_0x173818,_0x5d7a9c){return new Promise(function(_0x1b9155,_0x4d72a6){const _0x279fcb=a924_0x5c95,_0x404bba=new AWS['S3']({'accessKeyId':_0x2814c6,'secretAccessKey':_0xce9e73,'region':_0x173818});_0x404bba[_0x279fcb(0x154)]({'Bucket':_0x5d7a9c},function(_0x15c350,_0x5d684a){return _0x15c350?_0x4d72a6(_0x15c350):_0x1b9155(_0x5d684a);});});}function uploadFile(_0x86efb2,_0x36b212,_0x46ce39,_0x2b43a1,_0x3464a5,_0x450899){return new Promise(function(_0x513e4f,_0x5335f5){const _0x5a10cf=a924_0x5c95,_0x2c8fb7=new AWS['S3']({'accessKeyId':_0x36b212,'secretAccessKey':_0x86efb2,'region':_0x46ce39});_0x2c8fb7[_0x5a10cf(0x19f)]({'Bucket':_0x2b43a1,'Key':_0x3464a5,'Body':_0x450899},function(_0x2cb33e,_0x4b273d){return _0x2cb33e?_0x5335f5(_0x2cb33e):_0x513e4f(_0x4b273d);});});}function startTranscribe(_0x485027,_0x489b83,_0x374399,_0x406fc7,_0x4b46d3,_0x4bb1b3){return new Promise(function(_0x4be5fd,_0x57f1ee){const _0x2f712f=a924_0x5c95,_0x308839=new AWS[(_0x2f712f(0x170))]({'accessKeyId':_0x489b83,'secretAccessKey':_0x485027,'region':_0x374399});_0x308839[_0x2f712f(0x184)]({'TranscriptionJobName':_0x406fc7,'LanguageCode':_0x4b46d3,'Media':{'MediaFileUri':_0x4bb1b3}},function(_0x596dd0,_0x1c1d94){return _0x596dd0?_0x57f1ee(_0x596dd0):_0x4be5fd(_0x1c1d94);});});}function transcribe(_0x18cab5,_0x27c9c3,_0x3b75ab,_0x5a4c01,_0x4d7b64,_0x38fbaa,_0x1a6b76){return new Promise(function(_0x3f11d2,_0x1cbb7c){const _0x45c38a=a924_0x5c95,_0x4f738c={};return logger[_0x45c38a(0x128)](util[_0x45c38a(0x15a)](_0x45c38a(0x195),_0x18cab5,_0x4d7b64)),uploadFile(_0x27c9c3,_0x3b75ab,_0x5a4c01,_0x4d7b64,path[_0x45c38a(0x133)](_0x38fbaa),fs['readFileSync'](_0x38fbaa))[_0x45c38a(0x13f)](function(_0x55deb6){const _0x5b5fca=_0x45c38a;return logger['info'](util[_0x5b5fca(0x15a)]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x18cab5,_0x4d7b64,_0x55deb6['Location'])),_0x4f738c['bucket']=_0x55deb6['Bucket'],_0x4f738c[_0x5b5fca(0x12e)]=_0x55deb6['Location'],logger[_0x5b5fca(0x128)](util[_0x5b5fca(0x15a)](_0x5b5fca(0x17a),_0x18cab5)),startTranscribe(_0x27c9c3,_0x3b75ab,_0x5a4c01,uuidv4(),_0x1a6b76,_0x55deb6[_0x5b5fca(0x1a1)]);})[_0x45c38a(0x13f)](function(_0x25393c){const _0x58ccb3=_0x45c38a;return logger[_0x58ccb3(0x128)](util[_0x58ccb3(0x15a)](_0x58ccb3(0x156),_0x18cab5,_0x25393c[_0x58ccb3(0x18b)]['TranscriptionJobName'])),_0x4f738c[_0x58ccb3(0x194)]=_0x25393c[_0x58ccb3(0x18b)][_0x58ccb3(0x190)],_0x4f738c[_0x58ccb3(0x162)]=_0x25393c[_0x58ccb3(0x18b)]['TranscriptionJobStatus'],_0x3f11d2(_0x4f738c);})[_0x45c38a(0x138)](function(_0xe481ee){return _0x1cbb7c(_0xe481ee);});});}exports[a924_0x33ff8b(0x198)]=function(_0x19676c,_0x102ac8){const _0x195869=a924_0x33ff8b;let _0x3eff42,_0x268d1f,_0x407844;const _0x184194=require(_0x195869(0x189));return db[_0x195869(0x1a7)][_0x195869(0x147)]({'where':{'id':_0x19676c[_0x195869(0x19c)]['id']}})[_0x195869(0x13f)](function(_0x5b57dd){const _0x4984f9=_0x195869;if(_0x5b57dd){const _0x5f9bcb=util[_0x4984f9(0x15a)]('%s.cypher',_0x5b57dd[_0x4984f9(0x17c)]);if(fs['existsSync'](_0x5f9bcb))return _0x184194[_0x4984f9(0x144)](_0x5f9bcb,_0x5b57dd[_0x4984f9(0x17c)],config['secrets'][_0x4984f9(0x161)])['then'](function(){return _0x5b57dd;});return _0x5b57dd;}})[_0x195869(0x13f)](function(_0x2b9703){const _0x10bc7c=_0x195869;if(!_0x2b9703)throw new ValidationError(_0x10bc7c(0x1a8));return _0x268d1f=_0x2b9703,db[_0x10bc7c(0x18c)][_0x10bc7c(0x147)]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x102ac8,null))['then'](function(_0x288f64){const _0x17696d=_0x195869;if(_0x288f64){_0x3eff42=_0x288f64;if(!_0x3eff42[_0x17696d(0x145)]||!_0x3eff42[_0x17696d(0x17e)]||!_0x3eff42[_0x17696d(0x18a)]||!_0x3eff42[_0x17696d(0x139)]||!_0x3eff42['bucket'])throw new ValidationError(_0x17696d(0x17d));if(_0x19676c[_0x17696d(0x1a6)]['runSentiment']&&(!_0x3eff42[_0x17696d(0x159)]||!_0x3eff42[_0x17696d(0x18f)]||!_0x3eff42[_0x17696d(0x167)]||!_0x3eff42[_0x17696d(0x139)]||!_0x3eff42[_0x17696d(0x135)]))throw new ValidationError(_0x17696d(0x1a9));return db[_0x17696d(0x151)][_0x17696d(0x147)]({'where':{'id':_0x3eff42[_0x17696d(0x17e)]}});}})[_0x195869(0x13f)](function(_0x6579de){const _0x46c3de=_0x195869;if(!_0x6579de)throw new ValidationError(_0x46c3de(0x1a4));if(!_0x6579de[_0x46c3de(0x146)]||!_0x6579de[_0x46c3de(0x172)])throw new ValidationError(_0x46c3de(0x149));return _0x407844=_0x6579de,getBucketslist(_0x407844[_0x46c3de(0x146)],_0x407844['data2'],_0x3eff42[_0x46c3de(0x18a)]);})['then'](function(_0x2c4260){const _0x188f8a=_0x195869;if(_0x2c4260&&_0x2c4260[_0x188f8a(0x169)]){const _0x5cf306=_[_0x188f8a(0x129)](_0x2c4260[_0x188f8a(0x169)],function(_0x539fb3){const _0x180a0f=_0x188f8a;return _0x539fb3[_0x180a0f(0x15d)]===_0x3eff42['bucket'];});if(!_0x5cf306)return logger[_0x188f8a(0x128)](util[_0x188f8a(0x15a)]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x19676c['params']['id'],_0x3eff42[_0x188f8a(0x135)])),createBucket(_0x407844[_0x188f8a(0x146)],_0x407844[_0x188f8a(0x172)],_0x3eff42['transcribeRegion'],_0x3eff42[_0x188f8a(0x135)]);logger[_0x188f8a(0x128)](util[_0x188f8a(0x15a)](_0x188f8a(0x15b),_0x19676c[_0x188f8a(0x19c)]['id'],_0x3eff42['bucket']));return;}})[_0x195869(0x13f)](function(){const _0x3ae1f2=_0x195869;return _0x268d1f[_0x3ae1f2(0x162)]==='NEW'?transcribe(_0x19676c[_0x3ae1f2(0x19c)]['id'],_0x407844['data1'],_0x407844[_0x3ae1f2(0x172)],_0x3eff42[_0x3ae1f2(0x18a)],_0x3eff42[_0x3ae1f2(0x135)],_0x268d1f[_0x3ae1f2(0x17c)],_0x3eff42[_0x3ae1f2(0x139)]):(logger['info'](util[_0x3ae1f2(0x15a)]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x19676c[_0x3ae1f2(0x19c)]['id'])),{'transcribeStatus':'IN_PROGRESS'});})[_0x195869(0x13f)](function(_0x63b544){const _0x3c1615=_0x195869;if(_0x63b544)return _0x63b544[_0x3c1615(0x173)]=_0x19676c['body'][_0x3c1615(0x175)],_0x268d1f['update'](_0x63b544);})[_0x195869(0x13f)](respondWithResult(_0x102ac8,null))[_0x195869(0x138)](handleError(_0x102ac8,null));};function writeFile(_0x3e6b62,_0x5f22b6){return new Promise(function(_0x31dd8b,_0x3d9c27){fs['writeFile'](_0x5f22b6,_0x3e6b62,function(_0x159145,_0xc76c81){return _0x159145?_0x3d9c27(_0x159145):_0x31dd8b(_0xc76c81);});});}exports[a924_0x33ff8b(0x165)]=function(_0xe180fb,_0x241b3f){const _0x5d2055=a924_0x33ff8b;return db['VoiceRecording'][_0x5d2055(0x147)]({'where':{'id':_0xe180fb[_0x5d2055(0x19c)]['id']}})[_0x5d2055(0x13f)](handleEntityNotFound(_0x241b3f))[_0x5d2055(0x13f)](function(_0x12b845){const _0x47f319=_0x5d2055;if(_0x12b845&&_0x12b845[_0x47f319(0x12c)]){const _0xed9c36=_0x12b845[_0x47f319(0x12c)],_0x2cb864=config[_0x47f319(0x16a)]+_0x47f319(0x191)+_0x12b845['id']+'.txt';if(fs['existsSync'](_0x2cb864))return _0x2cb864;return writeFile(_0xed9c36,_0x2cb864)[_0x47f319(0x13f)](function(){return _0x2cb864;});}else throw new ValidationError(_0x47f319(0x160));})[_0x5d2055(0x13f)](function(_0x3a7798){const _0x11d988=_0x5d2055;return _0x241b3f[_0x11d988(0x166)](_0x3a7798);})[_0x5d2055(0x138)](handleError(_0x241b3f));};
\ No newline at end of file
+const a924_0x5d23=['destroy','upload','Content-Range','describe','uniqueid','key','status','Setting','Transcribe\x20not\x20configured','../../mysqldb','rows','differenceBy','lodash','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','Bucket','params','type','TranscriptionJobStatus','.cypher','%s.cypher','offset','../../components/parsers/qs','Not\x20found','order','transcribeName','limit','message','MD5','and','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','Entity\x20not\x20found','value','send','.txt','error-middleware/errors','format','model','set','VIRTUAL','find','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','download','map','path','create','/server/files/transcribes/transcribe_','bucket','recording','VoiceRecording','nolimit','count','findOne','readFileSync','transcribeAccountId','decryptFile','sort','File:\x20\x22','TranscribeService','Voice\x20Recording\x20not\x20found','data2','tempSentiment','IN_PROGRESS','merge','query','downloadTranscribe','aws-sdk','attributes','unlinkSync','Location','listBuckets','startTranscriptionJob','Cloud\x20Provider\x20not\x20available','keys','include','cancellazione\x20fisica\x20documento\x20%s','Transcript\x20not\x20available','createBucket','fields','api','Sentiment\x20Analysis\x20not\x20configured','body','TranscriptionJobName','data1','NEW','info','sequelize','TranscriptionJob','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','filename','sentimentRegion','then','../../config/environment','like','includeAll','CloudProvider','existsSync','../../config/logger','fieldName','intersection','location','push','transcribeRegion','name','fileText','secrets','length','runTranscribe','json','writeFile','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','end','language','$and','update','options','downloads','catch','../../components/encryptor','rawAttributes','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','Buckets','VoiceRecording\x20not\x20found','show','isNil','sendStatus','filter','sentimentAccountId','unlink','transcribeStatus','where','token','index','filters'];(function(_0x599cb3,_0x40e65a){const _0x5d2374=function(_0x3795a8){while(--_0x3795a8){_0x599cb3['push'](_0x599cb3['shift']());}};_0x5d2374(++_0x40e65a);}(a924_0x5d23,0x6e));const a924_0x3795=function(_0x599cb3,_0x40e65a){_0x599cb3=_0x599cb3-0x169;let _0x5d2374=a924_0x5d23[_0x599cb3];return _0x5d2374;};const a924_0x481391=a924_0x3795;'use strict';const util=require('util'),path=require(a924_0x481391(0x1ab)),fs=require('fs'),_=require(a924_0x481391(0x18c)),AWS=require(a924_0x481391(0x1c1)),{v4:uuidv4}=require('uuid'),qs=require(a924_0x481391(0x195)),logger=require(a924_0x481391(0x1e0))(a924_0x481391(0x1ce)),config=require(a924_0x481391(0x1db)),{db}=require(a924_0x481391(0x189)),{Op,fn,col,ValidationError}=require(a924_0x481391(0x1d5)),{InternalError}=require(a924_0x481391(0x1a2));function respondWithResult(_0x3069dd,_0x39397f){return _0x39397f=_0x39397f||0xc8,function(_0xb6eb8b){const _0xe45406=a924_0x3795;if(_0xb6eb8b)return _0x3069dd[_0xe45406(0x186)](_0x39397f)[_0xe45406(0x1eb)](_0xb6eb8b);};}function respondWithFilteredResult(_0x43d640,_0x56d846){return function(_0x40f8e9){const _0x1bd300=a924_0x3795;if(_0x40f8e9){const _0x306fbb=_0x40f8e9[_0x1bd300(0x1b2)],_0x556031=_0x56d846[_0x1bd300(0x194)];let _0xd2851f=_0x56d846[_0x1bd300(0x194)]+_0x56d846[_0x1bd300(0x199)],_0x15ad9d;return _0xd2851f>=_0x306fbb?(_0xd2851f=_0x306fbb,_0x15ad9d=0xc8):_0x15ad9d=0xce,_0x43d640[_0x1bd300(0x186)](_0x15ad9d),_0x43d640[_0x1bd300(0x1a5)](_0x1bd300(0x182),_0x556031+'-'+_0xd2851f+'/'+_0x306fbb)[_0x1bd300(0x1eb)](_0x40f8e9);}return null;};}function saveUpdates(_0x4b0953){return function(_0x305548){const _0x5a60d0=a924_0x3795;if(_0x305548)return _0x305548[_0x5a60d0(0x16c)](_0x4b0953)[_0x5a60d0(0x1da)](function(_0x4e296d){return _0x4e296d;});return null;};}function handleEntityNotFound(_0x1ec291){return function(_0x4f0bd6){const _0x4c1788=a924_0x3795;return!_0x4f0bd6&&_0x1ec291[_0x4c1788(0x177)](0x194),_0x4f0bd6;};}function handleError(_0x53dd69,_0xa1203c){return _0xa1203c=_0xa1203c||0x1f4,function(_0x4d6b57){const _0x295427=a924_0x3795;logger['error'](_0x4d6b57['stack']),_0x4d6b57[_0x295427(0x1e6)]&&delete _0x4d6b57['name'],_0x53dd69['status'](_0xa1203c)[_0x295427(0x1a0)](_0x4d6b57);};}exports[a924_0x481391(0x17e)]=function(_0x1c5551,_0x3ee2a0){const _0x5cdf1a=a924_0x481391;let _0x565d4a={};const _0x113936={},_0x528708={'count':0x0,'rows':[]},_0x48cc58=_[_0x5cdf1a(0x1aa)](db[_0x5cdf1a(0x1b0)]['rawAttributes'],function(_0x45c1c3){const _0x2a2cf5=_0x5cdf1a;return{'name':_0x45c1c3[_0x2a2cf5(0x1e1)],'type':_0x45c1c3['type'][_0x2a2cf5(0x185)]};});_0x113936[_0x5cdf1a(0x1a4)]=_[_0x5cdf1a(0x18b)](_[_0x5cdf1a(0x1aa)](_0x48cc58,'name'),[_0x5cdf1a(0x1a3)]),_0x113936[_0x5cdf1a(0x1bf)]=_['keys'](_0x1c5551[_0x5cdf1a(0x1bf)]),_0x113936[_0x5cdf1a(0x17f)]=_[_0x5cdf1a(0x1e2)](_0x113936[_0x5cdf1a(0x1a4)],_0x113936['query']),_0x565d4a[_0x5cdf1a(0x1c2)]=_[_0x5cdf1a(0x1e2)](_0x113936[_0x5cdf1a(0x1a4)],qs[_0x5cdf1a(0x1cd)](_0x1c5551[_0x5cdf1a(0x1bf)][_0x5cdf1a(0x1cd)])),_0x565d4a[_0x5cdf1a(0x1c2)]=_0x565d4a[_0x5cdf1a(0x1c2)][_0x5cdf1a(0x1e9)]?_0x565d4a[_0x5cdf1a(0x1c2)]:_0x113936['model'];typeof _0x1c5551['query'][_0x5cdf1a(0x1b1)]==='undefined'&&(_0x565d4a[_0x5cdf1a(0x199)]=qs[_0x5cdf1a(0x199)](_0x1c5551['query'][_0x5cdf1a(0x199)]),_0x565d4a[_0x5cdf1a(0x194)]=qs['offset'](_0x1c5551['query']['offset']));_0x565d4a[_0x5cdf1a(0x197)]=qs[_0x5cdf1a(0x1b7)](_0x1c5551[_0x5cdf1a(0x1bf)][_0x5cdf1a(0x1b7)]),_0x565d4a[_0x5cdf1a(0x17c)]=qs[_0x5cdf1a(0x17f)](_['pick'](_0x1c5551['query'],_0x113936['filters']),_0x48cc58);_0x1c5551[_0x5cdf1a(0x1bf)][_0x5cdf1a(0x178)]&&(_0x565d4a[_0x5cdf1a(0x17c)]=_[_0x5cdf1a(0x1be)](_0x565d4a[_0x5cdf1a(0x17c)],{[Op['or']]:_['map'](_0x48cc58,function(_0x2b2040){const _0x17acd9=_0x5cdf1a;if(_0x2b2040[_0x17acd9(0x190)]!==_0x17acd9(0x1a6)){const _0x29a0d9={};return _0x29a0d9[_0x2b2040[_0x17acd9(0x1e6)]]={[Op[_0x17acd9(0x1dc)]]:'%'+_0x1c5551['query'][_0x17acd9(0x178)]+'%'},_0x29a0d9;}})}));_0x565d4a=_['merge']({},_0x565d4a,_0x1c5551[_0x5cdf1a(0x16d)]);const _0x3e8398={'where':_0x565d4a[_0x5cdf1a(0x17c)]};return db[_0x5cdf1a(0x1b0)][_0x5cdf1a(0x1b2)](_0x3e8398)[_0x5cdf1a(0x1da)](function(_0xaf59b0){const _0x283078=_0x5cdf1a;return _0x528708[_0x283078(0x1b2)]=_0xaf59b0,_0x1c5551[_0x283078(0x1bf)][_0x283078(0x1dd)]&&(_0x565d4a['include']=[{'all':!![]}]),db[_0x283078(0x1b0)]['findAll'](_0x565d4a);})['then'](function(_0x12cf25){const _0x391467=_0x5cdf1a;return _0x528708[_0x391467(0x18a)]=_0x12cf25,_0x528708;})[_0x5cdf1a(0x1da)](respondWithFilteredResult(_0x3ee2a0,_0x565d4a))[_0x5cdf1a(0x16f)](handleError(_0x3ee2a0,null));},exports[a924_0x481391(0x175)]=function(_0x31cd8d,_0x58385e){const _0xd0612f=a924_0x481391;let _0x1fba73={'raw':![],'where':{'id':_0x31cd8d[_0xd0612f(0x18f)]['id']}};const _0x57fa53={};return _0x57fa53[_0xd0612f(0x1a4)]=_[_0xd0612f(0x1c8)](db[_0xd0612f(0x1b0)][_0xd0612f(0x171)]),_0x57fa53['query']=_[_0xd0612f(0x1c8)](_0x31cd8d[_0xd0612f(0x1bf)]),_0x57fa53[_0xd0612f(0x17f)]=_['intersection'](_0x57fa53[_0xd0612f(0x1a4)],_0x57fa53[_0xd0612f(0x1bf)]),_0x1fba73[_0xd0612f(0x1c2)]=_[_0xd0612f(0x1e2)](_0x57fa53[_0xd0612f(0x1a4)],qs['fields'](_0x31cd8d[_0xd0612f(0x1bf)]['fields'])),_0x1fba73[_0xd0612f(0x1c2)]=_0x1fba73[_0xd0612f(0x1c2)][_0xd0612f(0x1e9)]?_0x1fba73[_0xd0612f(0x1c2)]:_0x57fa53['model'],_0x31cd8d[_0xd0612f(0x1bf)][_0xd0612f(0x1dd)]&&(_0x1fba73[_0xd0612f(0x1c9)]=[{'all':!![]}]),_0x1fba73=_['merge']({},_0x1fba73,_0x31cd8d[_0xd0612f(0x16d)]),db[_0xd0612f(0x1b0)][_0xd0612f(0x1b3)](_0x1fba73)[_0xd0612f(0x1da)](handleEntityNotFound(_0x58385e,null))[_0xd0612f(0x1da)](respondWithResult(_0x58385e,null))['catch'](handleError(_0x58385e,null));},exports[a924_0x481391(0x1ac)]=function(_0x22489e,_0x2b4576){const _0x2b2adb=a924_0x481391;return db[_0x2b2adb(0x1b0)][_0x2b2adb(0x1ac)](_0x22489e[_0x2b2adb(0x1d0)],{})['then'](respondWithResult(_0x2b4576,0xc9))[_0x2b2adb(0x16f)](handleError(_0x2b4576,null));},exports[a924_0x481391(0x16c)]=function(_0x4f04f4,_0x80a781){const _0x5b7ca8=a924_0x481391;return _0x4f04f4[_0x5b7ca8(0x1d0)]['id']&&delete _0x4f04f4[_0x5b7ca8(0x1d0)]['id'],db[_0x5b7ca8(0x1b0)][_0x5b7ca8(0x1b3)]({'where':{'id':_0x4f04f4[_0x5b7ca8(0x18f)]['id']}})[_0x5b7ca8(0x1da)](handleEntityNotFound(_0x80a781,null))[_0x5b7ca8(0x1da)](saveUpdates(_0x4f04f4[_0x5b7ca8(0x1d0)],null))[_0x5b7ca8(0x1da)](respondWithResult(_0x80a781,null))[_0x5b7ca8(0x16f)](handleError(_0x80a781,null));},exports[a924_0x481391(0x183)]=function(_0x236121,_0x3ccdd8){const _0x194a9d=a924_0x481391;return db[_0x194a9d(0x1b0)][_0x194a9d(0x183)]()[_0x194a9d(0x1da)](respondWithResult(_0x3ccdd8,null))[_0x194a9d(0x16f)](handleError(_0x3ccdd8,null));},exports[a924_0x481391(0x1a9)]=function(_0x167850,_0x20027a){const _0x4da46b=a924_0x481391,_0xec0e6=require('../../components/encryptor');let _0x310b9e=![];const _0x4e34b3={};return _0x167850[_0x4da46b(0x1bf)]['type']&&_0x167850[_0x4da46b(0x1bf)][_0x4da46b(0x190)]===_0x4da46b(0x184)?_0x4e34b3[_0x4da46b(0x184)]=_0x167850[_0x4da46b(0x18f)]['id']:_0x4e34b3['id']=_0x167850['params']['id'],db[_0x4da46b(0x1b0)][_0x4da46b(0x1b3)]({'where':_0x4e34b3,'attributes':['id',_0x4da46b(0x19f)],'raw':!![]})['then'](handleEntityNotFound(_0x20027a,null))['then'](function(_0xbc25d){const _0x227b61=_0x4da46b;if(_0xbc25d){const _0x14a32f=_0xbc25d['value'],_0x3304b6=util['format'](_0x227b61(0x193),_0x14a32f);if(fs[_0x227b61(0x1df)](_0x3304b6))return _0x310b9e=!![],_0xec0e6[_0x227b61(0x1b6)](_0x3304b6,_0x14a32f,config[_0x227b61(0x1e8)][_0x227b61(0x1af)])['then'](function(){return _0xbc25d;});return _0xbc25d;}})[_0x4da46b(0x1da)](function(_0xa9b669){const _0x323f93=_0x4da46b;if(_0xa9b669){const _0x4b8881=_0xa9b669['value'];if(!fs[_0x323f93(0x1df)](_0x4b8881))throw new ValidationError('VoiceRecording\x20not\x20found');return _0xa9b669[_0x323f93(0x1d8)]?_0x20027a[_0x323f93(0x1a9)](_0x4b8881,_0xa9b669[_0x323f93(0x1d8)]+path['extname'](_0x4b8881),function(){const _0x181943=_0x323f93;_0x310b9e&&fs[_0x181943(0x17a)](_0x4b8881);}):_0x20027a[_0x323f93(0x1a9)](_0x4b8881,function(){const _0x1e7387=_0x323f93;_0x310b9e&&fs[_0x1e7387(0x17a)](_0x4b8881);});}})[_0x4da46b(0x16f)](function(_0x2793f2){const _0x547b11=_0x4da46b;if(_0x2793f2[_0x547b11(0x19a)]===_0x547b11(0x174))_0x20027a[_0x547b11(0x186)](0x194)[_0x547b11(0x1a0)](_0x547b11(0x196));else return handleError(_0x20027a,null);});},exports[a924_0x481391(0x16e)]=function(_0xfbf72c,_0xc65650){const _0x4a250d=a924_0x481391,_0x4ab179=require(_0x4a250d(0x170));let _0x511e0c=![];const _0x5e8ee1={[Op[_0x4a250d(0x19c)]]:[_0x5e8ee1(fn(_0x4a250d(0x19b),col(_0x4a250d(0x184))),_0xfbf72c[_0x4a250d(0x1bf)][_0x4a250d(0x17d)])]};return _0xfbf72c[_0x4a250d(0x1bf)][_0x4a250d(0x190)]&&_0xfbf72c[_0x4a250d(0x1bf)]['type']===_0x4a250d(0x184)?_0x5e8ee1[_0x4a250d(0x16b)][_0x4a250d(0x1e4)]({'uniqueid':_0xfbf72c['params']['id']}):_0x5e8ee1['$and']['push']({'id':_0xfbf72c[_0x4a250d(0x18f)]['id']}),db[_0x4a250d(0x1b0)][_0x4a250d(0x1b3)]({'where':_0x5e8ee1,'attributes':['id',_0x4a250d(0x19f)],'raw':!![]})[_0x4a250d(0x1da)](handleEntityNotFound(_0xc65650,null))[_0x4a250d(0x1da)](function(_0x395f76){const _0x307305=_0x4a250d;if(_0x395f76){const _0x2667f0=util[_0x307305(0x1a3)](_0x307305(0x193),_0x395f76[_0x307305(0x19f)]);if(fs['existsSync'](_0x2667f0))return _0x511e0c=!![],_0x4ab179['decryptFile'](_0x2667f0,_0x395f76['value'],config['secrets']['recording'])[_0x307305(0x1da)](function(){return _0x395f76;});return _0x395f76;}})['then'](function(_0x264435){const _0x525589=_0x4a250d;if(_0x264435){if(!fs['existsSync'](_0x264435[_0x525589(0x19f)]))throw new ValidationError('VoiceRecording\x20not\x20found');return _0x264435['filename']?_0xc65650[_0x525589(0x1a9)](_0x264435[_0x525589(0x19f)],_0x264435[_0x525589(0x1d8)]+path['extname'](_0x264435[_0x525589(0x19f)]),function(){const _0x456519=_0x525589;_0x511e0c&&fs[_0x456519(0x17a)](_0x264435[_0x456519(0x19f)]);}):_0xc65650['download'](_0x264435[_0x525589(0x19f)],function(){const _0xb9d10d=_0x525589;_0x511e0c&&fs[_0xb9d10d(0x17a)](_0x264435[_0xb9d10d(0x19f)]);});}})[_0x4a250d(0x16f)](handleError(_0xc65650,null));},exports['destroy']=function(_0x210b7c,_0x20eddb){const _0xf325e8=a924_0x481391;return db[_0xf325e8(0x1b0)][_0xf325e8(0x1b3)]({'where':{'id':_0x210b7c['params']['id']}})[_0xf325e8(0x1da)](function(_0x3e2011){const _0x1fb2d2=_0xf325e8;if(!_0x3e2011)throw new ReferenceError(_0x1fb2d2(0x19e));return _0x3e2011;})[_0xf325e8(0x1da)](function(_0xf5baf9){const _0x34b096=_0xf325e8;let _0x54e3ff=_0xf5baf9[_0x34b096(0x19f)];return logger[_0x34b096(0x1d4)](_0x34b096(0x1ca),_0x54e3ff),!_[_0x34b096(0x176)](_0xf5baf9['value'])&&fs[_0x34b096(0x1df)](_0x54e3ff)&&(logger[_0x34b096(0x1d4)](_0x34b096(0x1b8)+_0x54e3ff+_0x34b096(0x172)),fs[_0x34b096(0x1c3)](_0x54e3ff)),_0x54e3ff=_0x54e3ff+_0x34b096(0x192),!_[_0x34b096(0x176)](_0xf5baf9[_0x34b096(0x19f)])&&fs[_0x34b096(0x1df)](_0x54e3ff)&&(logger[_0x34b096(0x1d4)](_0x34b096(0x1b8)+_0x54e3ff+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione'),fs['unlinkSync'](_0x54e3ff)),_0xf5baf9;})[_0xf325e8(0x1da)](function(_0x17efac){const _0x5d9229=_0xf325e8;if(!_0x17efac)throw new InternalError();return _0x17efac[_0x5d9229(0x180)]();})[_0xf325e8(0x1da)](function(){const _0xee5df8=_0xf325e8;_0x20eddb['status'](0xcc)[_0xee5df8(0x169)]();})[_0xf325e8(0x16f)](handleError(_0x20eddb,null));};function getBucketslist(_0x5ce116,_0x21bdf6,_0x42693b){return new Promise(function(_0xfcf7e2,_0x40922e){const _0x2cc083=a924_0x3795,_0x4ca14a=new AWS['S3']({'accessKeyId':_0x21bdf6,'secretAccessKey':_0x5ce116,'region':_0x42693b});_0x4ca14a[_0x2cc083(0x1c5)]({},function(_0x28d174,_0x1954f4){return _0x28d174?_0x40922e(_0x28d174):_0xfcf7e2(_0x1954f4);});});}function createBucket(_0x227027,_0x467856,_0x27f431,_0x13672d){return new Promise(function(_0x15f3a2,_0xb3d737){const _0x13c393=a924_0x3795,_0x36059c=new AWS['S3']({'accessKeyId':_0x467856,'secretAccessKey':_0x227027,'region':_0x27f431});_0x36059c[_0x13c393(0x1cc)]({'Bucket':_0x13672d},function(_0x36e3cc,_0x447b73){return _0x36e3cc?_0xb3d737(_0x36e3cc):_0x15f3a2(_0x447b73);});});}function uploadFile(_0x2439db,_0x2861ec,_0x3a893f,_0x3ef76b,_0x619b3c,_0x9f39fb){return new Promise(function(_0x4dbbc5,_0x27c065){const _0x52f40e=a924_0x3795,_0x545680=new AWS['S3']({'accessKeyId':_0x2861ec,'secretAccessKey':_0x2439db,'region':_0x3a893f});_0x545680[_0x52f40e(0x181)]({'Bucket':_0x3ef76b,'Key':_0x619b3c,'Body':_0x9f39fb},function(_0x3da6e0,_0x3545b2){return _0x3da6e0?_0x27c065(_0x3da6e0):_0x4dbbc5(_0x3545b2);});});}function startTranscribe(_0x2aa8f8,_0x3f95c3,_0x208664,_0x215b0b,_0x11b53e,_0x3d132a){return new Promise(function(_0x17a938,_0x37e078){const _0x457700=a924_0x3795,_0x5648c5=new AWS[(_0x457700(0x1b9))]({'accessKeyId':_0x3f95c3,'secretAccessKey':_0x2aa8f8,'region':_0x208664});_0x5648c5[_0x457700(0x1c6)]({'TranscriptionJobName':_0x215b0b,'LanguageCode':_0x11b53e,'Media':{'MediaFileUri':_0x3d132a}},function(_0x3959a6,_0xd21a2c){return _0x3959a6?_0x37e078(_0x3959a6):_0x17a938(_0xd21a2c);});});}function transcribe(_0x321332,_0x22f14c,_0x511d15,_0x4ae5fc,_0xb5d732,_0x201003,_0x115767){return new Promise(function(_0x823a4f,_0x4b12dc){const _0x1fe3e5=a924_0x3795,_0x15bf67={};return logger[_0x1fe3e5(0x1d4)](util[_0x1fe3e5(0x1a3)](_0x1fe3e5(0x18d),_0x321332,_0xb5d732)),uploadFile(_0x22f14c,_0x511d15,_0x4ae5fc,_0xb5d732,path['basename'](_0x201003),fs[_0x1fe3e5(0x1b4)](_0x201003))[_0x1fe3e5(0x1da)](function(_0x50acdc){const _0x996d23=_0x1fe3e5;return logger[_0x996d23(0x1d4)](util[_0x996d23(0x1a3)](_0x996d23(0x1ed),_0x321332,_0xb5d732,_0x50acdc[_0x996d23(0x1c4)])),_0x15bf67[_0x996d23(0x1ae)]=_0x50acdc[_0x996d23(0x18e)],_0x15bf67[_0x996d23(0x1e3)]=_0x50acdc[_0x996d23(0x1c4)],logger[_0x996d23(0x1d4)](util[_0x996d23(0x1a3)](_0x996d23(0x1a8),_0x321332)),startTranscribe(_0x22f14c,_0x511d15,_0x4ae5fc,uuidv4(),_0x115767,_0x50acdc[_0x996d23(0x1c4)]);})[_0x1fe3e5(0x1da)](function(_0x4021d0){const _0x3d8f92=_0x1fe3e5;return logger[_0x3d8f92(0x1d4)](util[_0x3d8f92(0x1a3)](_0x3d8f92(0x19d),_0x321332,_0x4021d0[_0x3d8f92(0x1d6)]['TranscriptionJobName'])),_0x15bf67[_0x3d8f92(0x198)]=_0x4021d0[_0x3d8f92(0x1d6)][_0x3d8f92(0x1d1)],_0x15bf67[_0x3d8f92(0x17b)]=_0x4021d0['TranscriptionJob'][_0x3d8f92(0x191)],_0x823a4f(_0x15bf67);})[_0x1fe3e5(0x16f)](function(_0x143a38){return _0x4b12dc(_0x143a38);});});}exports[a924_0x481391(0x1ea)]=function(_0x36d467,_0x1dd7c6){const _0x1898b5=a924_0x481391;let _0x51cd71,_0xd0ea3b,_0x4801a9;const _0x5baa02=require(_0x1898b5(0x170));return db[_0x1898b5(0x1b0)][_0x1898b5(0x1b3)]({'where':{'id':_0x36d467[_0x1898b5(0x18f)]['id']}})['then'](function(_0x3b497d){const _0x30e445=_0x1898b5;if(_0x3b497d){const _0x23adc6=util[_0x30e445(0x1a3)]('%s.cypher',_0x3b497d[_0x30e445(0x19f)]);if(fs[_0x30e445(0x1df)](_0x23adc6))return _0x5baa02[_0x30e445(0x1b6)](_0x23adc6,_0x3b497d[_0x30e445(0x19f)],config[_0x30e445(0x1e8)]['recording'])[_0x30e445(0x1da)](function(){return _0x3b497d;});return _0x3b497d;}})[_0x1898b5(0x1da)](function(_0xcce2f){const _0x59df42=_0x1898b5;if(!_0xcce2f)throw new ValidationError(_0x59df42(0x1ba));return _0xd0ea3b=_0xcce2f,db[_0x59df42(0x187)][_0x59df42(0x1b3)]({'where':{'id':0x1}});})[_0x1898b5(0x1da)](handleEntityNotFound(_0x1dd7c6,null))[_0x1898b5(0x1da)](function(_0x16b451){const _0x5a0ca8=_0x1898b5;if(_0x16b451){_0x51cd71=_0x16b451;if(!_0x51cd71['transcribe']||!_0x51cd71[_0x5a0ca8(0x1b5)]||!_0x51cd71[_0x5a0ca8(0x1e5)]||!_0x51cd71[_0x5a0ca8(0x16a)]||!_0x51cd71[_0x5a0ca8(0x1ae)])throw new ValidationError(_0x5a0ca8(0x188));if(_0x36d467['body']['runSentiment']&&(!_0x51cd71['sentiment']||!_0x51cd71[_0x5a0ca8(0x179)]||!_0x51cd71[_0x5a0ca8(0x1d9)]||!_0x51cd71[_0x5a0ca8(0x16a)]||!_0x51cd71['bucket']))throw new ValidationError(_0x5a0ca8(0x1cf));return db[_0x5a0ca8(0x1de)][_0x5a0ca8(0x1b3)]({'where':{'id':_0x51cd71[_0x5a0ca8(0x1b5)]}});}})['then'](function(_0x58f78d){const _0x478801=_0x1898b5;if(!_0x58f78d)throw new ValidationError(_0x478801(0x1c7));if(!_0x58f78d['data1']||!_0x58f78d[_0x478801(0x1bb)])throw new ValidationError('Cloud\x20Provider\x20not\x20configured');return _0x4801a9=_0x58f78d,getBucketslist(_0x4801a9[_0x478801(0x1d2)],_0x4801a9[_0x478801(0x1bb)],_0x51cd71[_0x478801(0x1e5)]);})[_0x1898b5(0x1da)](function(_0x2c66d0){const _0x4bf129=_0x1898b5;if(_0x2c66d0&&_0x2c66d0[_0x4bf129(0x173)]){const _0x5cb9d0=_[_0x4bf129(0x1a7)](_0x2c66d0[_0x4bf129(0x173)],function(_0x25aed3){return _0x25aed3['Name']===_0x51cd71['bucket'];});if(!_0x5cb9d0)return logger[_0x4bf129(0x1d4)](util[_0x4bf129(0x1a3)]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x36d467['params']['id'],_0x51cd71[_0x4bf129(0x1ae)])),createBucket(_0x4801a9['data1'],_0x4801a9[_0x4bf129(0x1bb)],_0x51cd71[_0x4bf129(0x1e5)],_0x51cd71[_0x4bf129(0x1ae)]);logger[_0x4bf129(0x1d4)](util[_0x4bf129(0x1a3)]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x36d467[_0x4bf129(0x18f)]['id'],_0x51cd71[_0x4bf129(0x1ae)]));return;}})[_0x1898b5(0x1da)](function(){const _0x23de0b=_0x1898b5;return _0xd0ea3b['transcribeStatus']===_0x23de0b(0x1d3)?transcribe(_0x36d467[_0x23de0b(0x18f)]['id'],_0x4801a9[_0x23de0b(0x1d2)],_0x4801a9[_0x23de0b(0x1bb)],_0x51cd71[_0x23de0b(0x1e5)],_0x51cd71[_0x23de0b(0x1ae)],_0xd0ea3b[_0x23de0b(0x19f)],_0x51cd71['language']):(logger[_0x23de0b(0x1d4)](util[_0x23de0b(0x1a3)](_0x23de0b(0x1d7),_0x36d467['params']['id'])),{'transcribeStatus':_0x23de0b(0x1bd)});})[_0x1898b5(0x1da)](function(_0x2962a7){const _0x440797=_0x1898b5;if(_0x2962a7)return _0x2962a7[_0x440797(0x1bc)]=_0x36d467[_0x440797(0x1d0)]['runSentiment'],_0xd0ea3b[_0x440797(0x16c)](_0x2962a7);})['then'](respondWithResult(_0x1dd7c6,null))['catch'](handleError(_0x1dd7c6,null));};function writeFile(_0x4522bc,_0x20867f){return new Promise(function(_0x546be2,_0x14b147){const _0x2abb3e=a924_0x3795;fs[_0x2abb3e(0x1ec)](_0x20867f,_0x4522bc,function(_0x2247b9,_0x541623){return _0x2247b9?_0x14b147(_0x2247b9):_0x546be2(_0x541623);});});}exports[a924_0x481391(0x1c0)]=function(_0x443d35,_0x431af5){const _0x317bda=a924_0x481391;return db[_0x317bda(0x1b0)][_0x317bda(0x1b3)]({'where':{'id':_0x443d35[_0x317bda(0x18f)]['id']}})[_0x317bda(0x1da)](handleEntityNotFound(_0x431af5))['then'](function(_0x19bedf){const _0x9d47a=_0x317bda;if(_0x19bedf&&_0x19bedf[_0x9d47a(0x1e7)]){const _0x576cbd=_0x19bedf[_0x9d47a(0x1e7)],_0x42986f=config['root']+_0x9d47a(0x1ad)+_0x19bedf['id']+_0x9d47a(0x1a1);if(fs['existsSync'](_0x42986f))return _0x42986f;return writeFile(_0x576cbd,_0x42986f)[_0x9d47a(0x1da)](function(){return _0x42986f;});}else throw new ValidationError(_0x9d47a(0x1cb));})[_0x317bda(0x1da)](function(_0x1e9f65){const _0x281313=_0x317bda;return _0x431af5[_0x281313(0x1a9)](_0x1e9f65);})[_0x317bda(0x16f)](handleError(_0x431af5));};
\ No newline at end of file