Built motion from commit aab208717af8d15f4fa224cdb6a202877019af9b. Version 3.0.0...
[motion-next.git] / server / api / voiceRecording / voiceRecording.controller.js
index d71b92e..13a32ed 100644 (file)
@@ -1 +1 @@
-const a771_0x1f10=['VoiceRecording\x20not\x20found','.cypher','fields','status','key','format','runSentiment','/server/files/transcribes/transcribe_','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','isNil','undefined','%s.cypher','secrets','describe','Cloud\x20Provider\x20not\x20configured','error-middleware/errors','NEW','lodash','fileText','update','name','Transcribe\x20not\x20configured','map','File:\x20\x22','Sentiment\x20Analysis\x20not\x20configured','model','rows','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','cancellazione\x20fisica\x20documento\x20%s','../../components/parsers/qs','rawAttributes','json','attributes','query','../../config/logger','info','message','uniqueid','body','send','writeFile','intersection','token','../../components/encryptor','order','api','error','params','push','offset','Content-Range','where','limit','destroy','uuid','options','downloadTranscribe','MD5','filters','language','readFileSync','runTranscribe','data2','sentimentAccountId','decryptFile','existsSync','Bucket','Setting','downloads','unlinkSync','length','unlink','findOne','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','catch','Name','bucket','recording','sentiment','TranscriptionJob','include','sentimentRegion','../../mysqldb','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','extname','transcribeAccountId','keys','sort','find','includeAll','set','upload','then','filename','like','root','count','merge','transcribeStatus','nolimit','download','stack','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','value','Transcript\x20not\x20available','sendStatus','filter','IN_PROGRESS','Voice\x20Recording\x20not\x20found','Cloud\x20Provider\x20not\x20available','data1','Not\x20found','findAll','.txt','VoiceRecording','create','transcribeRegion','TranscriptionJobName','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','location','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','Entity\x20not\x20found','index','pick','VIRTUAL','Buckets','Location','aws-sdk','sequelize','transcribe','type'];(function(_0x44c303,_0x1f108b){const _0x2293c0=function(_0x48e9a1){while(--_0x48e9a1){_0x44c303['push'](_0x44c303['shift']());}};_0x2293c0(++_0x1f108b);}(a771_0x1f10,0x80));const a771_0x2293=function(_0x44c303,_0x1f108b){_0x44c303=_0x44c303-0x0;let _0x2293c0=a771_0x1f10[_0x44c303];return _0x2293c0;};const _0x33a013=a771_0x2293;'use strict';const util=require('util'),path=require('path'),fs=require('fs'),_=require(_0x33a013('0x16')),AWS=require(_0x33a013('0x0')),{v4:uuidv4}=require(_0x33a013('0x3b')),qs=require(_0x33a013('0x22')),logger=require(_0x33a013('0x27'))(_0x33a013('0x32')),config=require('../../config/environment'),db=require(_0x33a013('0x57'))['db'],{Op,fn,col,ValidationError}=require(_0x33a013('0x1')),{InternalError}=require(_0x33a013('0x14'));function respondWithResult(_0x48e9a1,_0x5607e1){return _0x5607e1=_0x5607e1||0xc8,function(_0x2bf790){const _0x5235e8=a771_0x2293;if(_0x2bf790)return _0x48e9a1[_0x5235e8('0x7')](_0x5607e1)['json'](_0x2bf790);};}function respondWithFilteredResult(_0x58bfa5,_0x10362f){return function(_0x4f5988){const _0xe401cf=a771_0x2293;if(_0x4f5988){const _0x4307e8=_0x4f5988[_0xe401cf('0x65')],_0x29f7b8=_0x10362f[_0xe401cf('0x36')];let _0x416674=_0x10362f[_0xe401cf('0x36')]+_0x10362f[_0xe401cf('0x39')],_0x3c092f;return _0x416674>=_0x4307e8?(_0x416674=_0x4307e8,_0x3c092f=0xc8):_0x3c092f=0xce,_0x58bfa5[_0xe401cf('0x7')](_0x3c092f),_0x58bfa5[_0xe401cf('0x5f')](_0xe401cf('0x37'),_0x29f7b8+'-'+_0x416674+'/'+_0x4307e8)[_0xe401cf('0x24')](_0x4f5988);}return null;};}function saveUpdates(_0x1339d0){return function(_0x28fb35){const _0x2ffad6=a771_0x2293;if(_0x28fb35)return _0x28fb35['update'](_0x1339d0)[_0x2ffad6('0x61')](function(_0x38c6b8){return _0x38c6b8;});return null;};}function handleEntityNotFound(_0x5efd33){return function(_0x2faadd){const _0x331e87=a771_0x2293;return!_0x2faadd&&_0x5efd33[_0x331e87('0x6e')](0x194),_0x2faadd;};}function handleError(_0x7a3369,_0xce2383){return _0xce2383=_0xce2383||0x1f4,function(_0x1c79de){const _0x3a6c84=a771_0x2293;logger[_0x3a6c84('0x33')](_0x1c79de[_0x3a6c84('0x6a')]),_0x1c79de[_0x3a6c84('0x19')]&&delete _0x1c79de[_0x3a6c84('0x19')],_0x7a3369[_0x3a6c84('0x7')](_0xce2383)['send'](_0x1c79de);};}exports[_0x33a013('0x7f')]=function(_0x470f93,_0x5b68dd){const _0x2188e2=_0x33a013;let _0x508d88={};const _0x231569={},_0x241ac8={'count':0x0,'rows':[]},_0x5eed6d=_[_0x2188e2('0x1b')](db['VoiceRecording'][_0x2188e2('0x23')],function(_0x14871e){const _0x19c9dc=_0x2188e2;return{'name':_0x14871e['fieldName'],'type':_0x14871e[_0x19c9dc('0x3')][_0x19c9dc('0x8')]};});_0x231569[_0x2188e2('0x1e')]=_['differenceBy'](_[_0x2188e2('0x1b')](_0x5eed6d,_0x2188e2('0x19')),[_0x2188e2('0x9')]),_0x231569[_0x2188e2('0x26')]=_[_0x2188e2('0x5b')](_0x470f93[_0x2188e2('0x26')]),_0x231569['filters']=_['intersection'](_0x231569[_0x2188e2('0x1e')],_0x231569[_0x2188e2('0x26')]),_0x508d88['attributes']=_['intersection'](_0x231569[_0x2188e2('0x1e')],qs[_0x2188e2('0x6')](_0x470f93[_0x2188e2('0x26')][_0x2188e2('0x6')])),_0x508d88[_0x2188e2('0x25')]=_0x508d88[_0x2188e2('0x25')][_0x2188e2('0x4b')]?_0x508d88[_0x2188e2('0x25')]:_0x231569[_0x2188e2('0x1e')];typeof _0x470f93[_0x2188e2('0x26')][_0x2188e2('0x68')]===_0x2188e2('0xf')&&(_0x508d88[_0x2188e2('0x39')]=qs['limit'](_0x470f93[_0x2188e2('0x26')]['limit']),_0x508d88[_0x2188e2('0x36')]=qs[_0x2188e2('0x36')](_0x470f93['query'][_0x2188e2('0x36')]));_0x508d88[_0x2188e2('0x31')]=qs[_0x2188e2('0x5c')](_0x470f93[_0x2188e2('0x26')]['sort']),_0x508d88[_0x2188e2('0x38')]=qs[_0x2188e2('0x3f')](_[_0x2188e2('0x80')](_0x470f93[_0x2188e2('0x26')],_0x231569['filters']),_0x5eed6d);_0x470f93[_0x2188e2('0x26')][_0x2188e2('0x6f')]&&(_0x508d88['where']=_[_0x2188e2('0x66')](_0x508d88[_0x2188e2('0x38')],{[Op['or']]:_['map'](_0x5eed6d,function(_0x72d255){const _0x1810ab=_0x2188e2;if(_0x72d255[_0x1810ab('0x3')]!==_0x1810ab('0x81')){const _0x4f6432={};return _0x4f6432[_0x72d255[_0x1810ab('0x19')]]={[Op[_0x1810ab('0x63')]]:'%'+_0x470f93['query'][_0x1810ab('0x6f')]+'%'},_0x4f6432;}})}));_0x508d88=_[_0x2188e2('0x66')]({},_0x508d88,_0x470f93['options']);const _0x1446bd={'where':_0x508d88['where']};return db[_0x2188e2('0x77')][_0x2188e2('0x65')](_0x1446bd)[_0x2188e2('0x61')](function(_0x38d6c7){const _0xd2182a=_0x2188e2;return _0x241ac8[_0xd2182a('0x65')]=_0x38d6c7,_0x470f93[_0xd2182a('0x26')][_0xd2182a('0x5e')]&&(_0x508d88[_0xd2182a('0x55')]=[{'all':!![]}]),db[_0xd2182a('0x77')][_0xd2182a('0x75')](_0x508d88);})[_0x2188e2('0x61')](function(_0x4dafd5){const _0x59b8ef=_0x2188e2;return _0x241ac8[_0x59b8ef('0x1f')]=_0x4dafd5,_0x241ac8;})[_0x2188e2('0x61')](respondWithFilteredResult(_0x5b68dd,_0x508d88))['catch'](handleError(_0x5b68dd,null));},exports['show']=function(_0x250bf2,_0x282bfa){const _0x5dcf8e=_0x33a013;let _0x3162f9={'raw':![],'where':{'id':_0x250bf2[_0x5dcf8e('0x34')]['id']}};const _0x35b844={};return _0x35b844['model']=_[_0x5dcf8e('0x5b')](db[_0x5dcf8e('0x77')]['rawAttributes']),_0x35b844['query']=_['keys'](_0x250bf2[_0x5dcf8e('0x26')]),_0x35b844['filters']=_[_0x5dcf8e('0x2e')](_0x35b844['model'],_0x35b844[_0x5dcf8e('0x26')]),_0x3162f9[_0x5dcf8e('0x25')]=_['intersection'](_0x35b844['model'],qs[_0x5dcf8e('0x6')](_0x250bf2[_0x5dcf8e('0x26')]['fields'])),_0x3162f9['attributes']=_0x3162f9[_0x5dcf8e('0x25')]['length']?_0x3162f9[_0x5dcf8e('0x25')]:_0x35b844['model'],_0x250bf2[_0x5dcf8e('0x26')][_0x5dcf8e('0x5e')]&&(_0x3162f9['include']=[{'all':!![]}]),_0x3162f9=_[_0x5dcf8e('0x66')]({},_0x3162f9,_0x250bf2[_0x5dcf8e('0x3c')]),db['VoiceRecording'][_0x5dcf8e('0x4d')](_0x3162f9)['then'](handleEntityNotFound(_0x282bfa,null))[_0x5dcf8e('0x61')](respondWithResult(_0x282bfa,null))['catch'](handleError(_0x282bfa,null));},exports[_0x33a013('0x78')]=function(_0x5d9aee,_0x19c0d4){const _0x410578=_0x33a013;return db[_0x410578('0x77')][_0x410578('0x78')](_0x5d9aee['body'],{})[_0x410578('0x61')](respondWithResult(_0x19c0d4,0xc9))['catch'](handleError(_0x19c0d4,null));},exports[_0x33a013('0x18')]=function(_0x3494e7,_0x4dbdab){const _0x5eaeac=_0x33a013;return _0x3494e7[_0x5eaeac('0x2b')]['id']&&delete _0x3494e7[_0x5eaeac('0x2b')]['id'],db[_0x5eaeac('0x77')]['findOne']({'where':{'id':_0x3494e7[_0x5eaeac('0x34')]['id']}})[_0x5eaeac('0x61')](handleEntityNotFound(_0x4dbdab,null))[_0x5eaeac('0x61')](saveUpdates(_0x3494e7[_0x5eaeac('0x2b')],null))[_0x5eaeac('0x61')](respondWithResult(_0x4dbdab,null))[_0x5eaeac('0x4f')](handleError(_0x4dbdab,null));},exports['describe']=function(_0x3d19a5,_0x2cdc4a){const _0x486b2a=_0x33a013;return db[_0x486b2a('0x77')][_0x486b2a('0x12')]()[_0x486b2a('0x61')](respondWithResult(_0x2cdc4a,null))['catch'](handleError(_0x2cdc4a,null));},exports[_0x33a013('0x69')]=function(_0x57adbc,_0x369eaf){const _0x1dd002=_0x33a013,_0x491c6e=require(_0x1dd002('0x30'));let _0x4543f4=![];const _0x3ac781={};return _0x57adbc[_0x1dd002('0x26')][_0x1dd002('0x3')]&&_0x57adbc[_0x1dd002('0x26')][_0x1dd002('0x3')]===_0x1dd002('0x2a')?_0x3ac781['uniqueid']=_0x57adbc[_0x1dd002('0x34')]['id']:_0x3ac781['id']=_0x57adbc['params']['id'],db[_0x1dd002('0x77')][_0x1dd002('0x4d')]({'where':_0x3ac781,'attributes':['id',_0x1dd002('0x6c')],'raw':!![]})[_0x1dd002('0x61')](handleEntityNotFound(_0x369eaf,null))['then'](function(_0x44ae87){const _0x2bfa73=_0x1dd002;if(_0x44ae87){const _0x577f72=_0x44ae87[_0x2bfa73('0x6c')],_0x13dce8=util['format'](_0x2bfa73('0x10'),_0x577f72);if(fs[_0x2bfa73('0x46')](_0x13dce8))return _0x4543f4=!![],_0x491c6e['decryptFile'](_0x13dce8,_0x577f72,config['secrets']['recording'])['then'](function(){return _0x44ae87;});return _0x44ae87;}})[_0x1dd002('0x61')](function(_0x3ac5a1){const _0x175ea6=_0x1dd002;if(_0x3ac5a1){const _0x2bead2=_0x3ac5a1[_0x175ea6('0x6c')];if(!fs[_0x175ea6('0x46')](_0x2bead2))throw new ValidationError('VoiceRecording\x20not\x20found');return _0x3ac5a1['filename']?_0x369eaf[_0x175ea6('0x69')](_0x2bead2,_0x3ac5a1['filename']+path[_0x175ea6('0x59')](_0x2bead2),function(){const _0x44a527=_0x175ea6;_0x4543f4&&fs[_0x44a527('0x4c')](_0x2bead2);}):_0x369eaf[_0x175ea6('0x69')](_0x2bead2,function(){const _0x59c020=_0x175ea6;_0x4543f4&&fs[_0x59c020('0x4c')](_0x2bead2);});}})[_0x1dd002('0x4f')](function(_0x1e7d48){const _0x18d407=_0x1dd002;if(_0x1e7d48[_0x18d407('0x29')]===_0x18d407('0x4'))_0x369eaf[_0x18d407('0x7')](0x194)[_0x18d407('0x2c')](_0x18d407('0x74'));else return handleError(_0x369eaf,null);});},exports[_0x33a013('0x49')]=function(_0x5e2976,_0x471264){const _0x4320ac=_0x33a013,_0x510af9=require(_0x4320ac('0x30'));let _0x190ed5=![];const _0x30ee30={[Op['and']]:[_0x30ee30(fn(_0x4320ac('0x3e'),col(_0x4320ac('0x2a'))),_0x5e2976[_0x4320ac('0x26')][_0x4320ac('0x2f')])]};return _0x5e2976['query'][_0x4320ac('0x3')]&&_0x5e2976[_0x4320ac('0x26')]['type']===_0x4320ac('0x2a')?_0x30ee30['$and']['push']({'uniqueid':_0x5e2976['params']['id']}):_0x30ee30['$and'][_0x4320ac('0x35')]({'id':_0x5e2976[_0x4320ac('0x34')]['id']}),db[_0x4320ac('0x77')]['findOne']({'where':_0x30ee30,'attributes':['id',_0x4320ac('0x6c')],'raw':!![]})[_0x4320ac('0x61')](handleEntityNotFound(_0x471264,null))[_0x4320ac('0x61')](function(_0xabda71){const _0x50727f=_0x4320ac;if(_0xabda71){const _0x302829=util[_0x50727f('0x9')](_0x50727f('0x10'),_0xabda71[_0x50727f('0x6c')]);if(fs['existsSync'](_0x302829))return _0x190ed5=!![],_0x510af9[_0x50727f('0x45')](_0x302829,_0xabda71[_0x50727f('0x6c')],config[_0x50727f('0x11')][_0x50727f('0x52')])[_0x50727f('0x61')](function(){return _0xabda71;});return _0xabda71;}})[_0x4320ac('0x61')](function(_0x2efc9f){const _0x4feaa7=_0x4320ac;if(_0x2efc9f){if(!fs[_0x4feaa7('0x46')](_0x2efc9f[_0x4feaa7('0x6c')]))throw new ValidationError(_0x4feaa7('0x4'));return _0x2efc9f['filename']?_0x471264[_0x4feaa7('0x69')](_0x2efc9f[_0x4feaa7('0x6c')],_0x2efc9f[_0x4feaa7('0x62')]+path[_0x4feaa7('0x59')](_0x2efc9f['value']),function(){const _0x4aab1b=_0x4feaa7;_0x190ed5&&fs[_0x4aab1b('0x4c')](_0x2efc9f[_0x4aab1b('0x6c')]);}):_0x471264[_0x4feaa7('0x69')](_0x2efc9f['value'],function(){const _0x13049b=_0x4feaa7;_0x190ed5&&fs[_0x13049b('0x4c')](_0x2efc9f['value']);});}})[_0x4320ac('0x4f')](handleError(_0x471264,null));},exports[_0x33a013('0x3a')]=function(_0x13d552,_0x230c0d){const _0x1cf746=_0x33a013;return db[_0x1cf746('0x77')][_0x1cf746('0x4d')]({'where':{'id':_0x13d552[_0x1cf746('0x34')]['id']}})[_0x1cf746('0x61')](function(_0x3a679a){const _0xe5afe=_0x1cf746;if(!_0x3a679a)throw new ReferenceError(_0xe5afe('0x7e'));return _0x3a679a;})[_0x1cf746('0x61')](function(_0x49c1d4){const _0xbcf0d6=_0x1cf746;let _0x25db9a=_0x49c1d4[_0xbcf0d6('0x6c')];return logger['info'](_0xbcf0d6('0x21'),_0x25db9a),!_[_0xbcf0d6('0xe')](_0x49c1d4['value'])&&fs[_0xbcf0d6('0x46')](_0x25db9a)&&(logger[_0xbcf0d6('0x28')](_0xbcf0d6('0x1c')+_0x25db9a+_0xbcf0d6('0x20')),fs[_0xbcf0d6('0x4a')](_0x25db9a)),_0x25db9a=_0x25db9a+_0xbcf0d6('0x5'),!_['isNil'](_0x49c1d4[_0xbcf0d6('0x6c')])&&fs['existsSync'](_0x25db9a)&&(logger[_0xbcf0d6('0x28')](_0xbcf0d6('0x1c')+_0x25db9a+_0xbcf0d6('0x20')),fs[_0xbcf0d6('0x4a')](_0x25db9a)),_0x49c1d4;})['then'](function(_0x1aa256){const _0x217953=_0x1cf746;if(!_0x1aa256)throw new InternalError();return _0x1aa256[_0x217953('0x3a')]();})['then'](function(){const _0x6d6ec=_0x1cf746;_0x230c0d[_0x6d6ec('0x7')](0xcc)['end']();})[_0x1cf746('0x4f')](handleError(_0x230c0d,null));};function getBucketslist(_0x324be3,_0x4b0dfb,_0x556a29){return new Promise(function(_0x4fdc6c,_0x301522){const _0x1dad78=new AWS['S3']({'accessKeyId':_0x4b0dfb,'secretAccessKey':_0x324be3,'region':_0x556a29});_0x1dad78['listBuckets']({},function(_0x123db9,_0x3bd165){return _0x123db9?_0x301522(_0x123db9):_0x4fdc6c(_0x3bd165);});});}function createBucket(_0x2e071d,_0x78ba5e,_0x35c652,_0x7a5ab3){return new Promise(function(_0x2760cd,_0x3eb580){const _0x22cf88=new AWS['S3']({'accessKeyId':_0x78ba5e,'secretAccessKey':_0x2e071d,'region':_0x35c652});_0x22cf88['createBucket']({'Bucket':_0x7a5ab3},function(_0x572efa,_0x39c977){return _0x572efa?_0x3eb580(_0x572efa):_0x2760cd(_0x39c977);});});}function uploadFile(_0x198f3d,_0x2987eb,_0x48a908,_0x59f5fb,_0x4b727e,_0x26db8c){return new Promise(function(_0x461320,_0x16c640){const _0x9870a2=a771_0x2293,_0x53b21b=new AWS['S3']({'accessKeyId':_0x2987eb,'secretAccessKey':_0x198f3d,'region':_0x48a908});_0x53b21b[_0x9870a2('0x60')]({'Bucket':_0x59f5fb,'Key':_0x4b727e,'Body':_0x26db8c},function(_0x1d9ef7,_0x50b03c){return _0x1d9ef7?_0x16c640(_0x1d9ef7):_0x461320(_0x50b03c);});});}function startTranscribe(_0x3477eb,_0x354851,_0x4e412d,_0x5bf71c,_0x392930,_0x3d1324){return new Promise(function(_0x1be623,_0x12158a){const _0x4d201c=new AWS['TranscribeService']({'accessKeyId':_0x354851,'secretAccessKey':_0x3477eb,'region':_0x4e412d});_0x4d201c['startTranscriptionJob']({'TranscriptionJobName':_0x5bf71c,'LanguageCode':_0x392930,'Media':{'MediaFileUri':_0x3d1324}},function(_0x5c7623,_0x288651){return _0x5c7623?_0x12158a(_0x5c7623):_0x1be623(_0x288651);});});}function transcribe(_0x9654cb,_0x38d71b,_0x2fe7fa,_0x49b157,_0x15fcaf,_0x5da41d,_0x5504de){return new Promise(function(_0x26463a,_0x2fdac0){const _0x1ed600=a771_0x2293,_0x4928a9={};return logger[_0x1ed600('0x28')](util[_0x1ed600('0x9')](_0x1ed600('0xc'),_0x9654cb,_0x15fcaf)),uploadFile(_0x38d71b,_0x2fe7fa,_0x49b157,_0x15fcaf,path['basename'](_0x5da41d),fs[_0x1ed600('0x41')](_0x5da41d))[_0x1ed600('0x61')](function(_0x356421){const _0xa67899=_0x1ed600;return logger[_0xa67899('0x28')](util[_0xa67899('0x9')](_0xa67899('0x7b'),_0x9654cb,_0x15fcaf,_0x356421[_0xa67899('0x83')])),_0x4928a9[_0xa67899('0x51')]=_0x356421[_0xa67899('0x47')],_0x4928a9[_0xa67899('0x7c')]=_0x356421[_0xa67899('0x83')],logger[_0xa67899('0x28')](util['format'](_0xa67899('0x4e'),_0x9654cb)),startTranscribe(_0x38d71b,_0x2fe7fa,_0x49b157,uuidv4(),_0x5504de,_0x356421[_0xa67899('0x83')]);})[_0x1ed600('0x61')](function(_0x2d1b31){const _0x436382=_0x1ed600;return logger[_0x436382('0x28')](util[_0x436382('0x9')](_0x436382('0x58'),_0x9654cb,_0x2d1b31['TranscriptionJob'][_0x436382('0x7a')])),_0x4928a9['transcribeName']=_0x2d1b31['TranscriptionJob']['TranscriptionJobName'],_0x4928a9[_0x436382('0x67')]=_0x2d1b31[_0x436382('0x54')]['TranscriptionJobStatus'],_0x26463a(_0x4928a9);})[_0x1ed600('0x4f')](function(_0x1f165d){return _0x2fdac0(_0x1f165d);});});}exports[_0x33a013('0x42')]=function(_0x1fa0b0,_0x5e55fa){const _0x189b30=_0x33a013;let _0x354573,_0xb5495b,_0x459505;const _0x2ac80a=require(_0x189b30('0x30'));return db[_0x189b30('0x77')][_0x189b30('0x4d')]({'where':{'id':_0x1fa0b0[_0x189b30('0x34')]['id']}})[_0x189b30('0x61')](function(_0x2e43c0){const _0x13531b=_0x189b30;if(_0x2e43c0){const _0x540451=util[_0x13531b('0x9')]('%s.cypher',_0x2e43c0[_0x13531b('0x6c')]);if(fs[_0x13531b('0x46')](_0x540451))return _0x2ac80a[_0x13531b('0x45')](_0x540451,_0x2e43c0[_0x13531b('0x6c')],config[_0x13531b('0x11')][_0x13531b('0x52')])[_0x13531b('0x61')](function(){return _0x2e43c0;});return _0x2e43c0;}})['then'](function(_0x365d5c){const _0x254d7c=_0x189b30;if(!_0x365d5c)throw new ValidationError(_0x254d7c('0x71'));return _0xb5495b=_0x365d5c,db[_0x254d7c('0x48')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x5e55fa,null))['then'](function(_0x140828){const _0x12d535=_0x189b30;if(_0x140828){_0x354573=_0x140828;if(!_0x354573[_0x12d535('0x2')]||!_0x354573[_0x12d535('0x5a')]||!_0x354573[_0x12d535('0x79')]||!_0x354573[_0x12d535('0x40')]||!_0x354573[_0x12d535('0x51')])throw new ValidationError(_0x12d535('0x1a'));if(_0x1fa0b0[_0x12d535('0x2b')]['runSentiment']&&(!_0x354573[_0x12d535('0x53')]||!_0x354573[_0x12d535('0x44')]||!_0x354573[_0x12d535('0x56')]||!_0x354573[_0x12d535('0x40')]||!_0x354573['bucket']))throw new ValidationError(_0x12d535('0x1d'));return db['CloudProvider'][_0x12d535('0x4d')]({'where':{'id':_0x354573['transcribeAccountId']}});}})[_0x189b30('0x61')](function(_0x2ffbd5){const _0x2c4372=_0x189b30;if(!_0x2ffbd5)throw new ValidationError(_0x2c4372('0x72'));if(!_0x2ffbd5['data1']||!_0x2ffbd5[_0x2c4372('0x43')])throw new ValidationError(_0x2c4372('0x13'));return _0x459505=_0x2ffbd5,getBucketslist(_0x459505[_0x2c4372('0x73')],_0x459505[_0x2c4372('0x43')],_0x354573['transcribeRegion']);})['then'](function(_0x5e9d75){const _0x4e0da6=_0x189b30;if(_0x5e9d75&&_0x5e9d75[_0x4e0da6('0x82')]){const _0x808317=_[_0x4e0da6('0x5d')](_0x5e9d75[_0x4e0da6('0x82')],function(_0x125a45){const _0x4b53dc=_0x4e0da6;return _0x125a45[_0x4b53dc('0x50')]===_0x354573['bucket'];});if(!_0x808317)return logger[_0x4e0da6('0x28')](util['format'](_0x4e0da6('0x6b'),_0x1fa0b0[_0x4e0da6('0x34')]['id'],_0x354573[_0x4e0da6('0x51')])),createBucket(_0x459505[_0x4e0da6('0x73')],_0x459505[_0x4e0da6('0x43')],_0x354573[_0x4e0da6('0x79')],_0x354573[_0x4e0da6('0x51')]);logger['info'](util[_0x4e0da6('0x9')](_0x4e0da6('0xd'),_0x1fa0b0[_0x4e0da6('0x34')]['id'],_0x354573[_0x4e0da6('0x51')]));return;}})[_0x189b30('0x61')](function(){const _0x1716b5=_0x189b30;return _0xb5495b[_0x1716b5('0x67')]===_0x1716b5('0x15')?transcribe(_0x1fa0b0[_0x1716b5('0x34')]['id'],_0x459505[_0x1716b5('0x73')],_0x459505[_0x1716b5('0x43')],_0x354573[_0x1716b5('0x79')],_0x354573[_0x1716b5('0x51')],_0xb5495b[_0x1716b5('0x6c')],_0x354573[_0x1716b5('0x40')]):(logger[_0x1716b5('0x28')](util[_0x1716b5('0x9')](_0x1716b5('0x7d'),_0x1fa0b0[_0x1716b5('0x34')]['id'])),{'transcribeStatus':_0x1716b5('0x70')});})[_0x189b30('0x61')](function(_0x519d4a){const _0x12eb19=_0x189b30;if(_0x519d4a)return _0x519d4a['tempSentiment']=_0x1fa0b0['body'][_0x12eb19('0xa')],_0xb5495b[_0x12eb19('0x18')](_0x519d4a);})[_0x189b30('0x61')](respondWithResult(_0x5e55fa,null))[_0x189b30('0x4f')](handleError(_0x5e55fa,null));};function writeFile(_0x38288c,_0x378f09){return new Promise(function(_0x15f6eb,_0x39fd1a){const _0x5749a2=a771_0x2293;fs[_0x5749a2('0x2d')](_0x378f09,_0x38288c,function(_0x2f3630,_0x5d784d){return _0x2f3630?_0x39fd1a(_0x2f3630):_0x15f6eb(_0x5d784d);});});}exports[_0x33a013('0x3d')]=function(_0xf4b80c,_0x24d391){const _0x53e73d=_0x33a013;return db[_0x53e73d('0x77')]['findOne']({'where':{'id':_0xf4b80c[_0x53e73d('0x34')]['id']}})['then'](handleEntityNotFound(_0x24d391))[_0x53e73d('0x61')](function(_0x5bdfdf){const _0x5bd585=_0x53e73d;if(_0x5bdfdf&&_0x5bdfdf[_0x5bd585('0x17')]){const _0x504d3b=_0x5bdfdf[_0x5bd585('0x17')],_0xdb74ed=config[_0x5bd585('0x64')]+_0x5bd585('0xb')+_0x5bdfdf['id']+_0x5bd585('0x76');if(fs[_0x5bd585('0x46')](_0xdb74ed))return _0xdb74ed;return writeFile(_0x504d3b,_0xdb74ed)[_0x5bd585('0x61')](function(){return _0xdb74ed;});}else throw new ValidationError(_0x5bd585('0x6d'));})['then'](function(_0x23e792){return _0x24d391['download'](_0x23e792);})[_0x53e73d('0x4f')](handleError(_0x24d391));};
\ No newline at end of file
+const a771_0x2e66=['end','fieldName','filename','body','sendStatus','createBucket','type','secrets','Buckets','message','Transcript\x20not\x20available','limit','fields','findOne','include','bucket','Cloud\x20Provider\x20not\x20configured','format','listBuckets','language','then','fileText','extname','intersection','CloudProvider','Content-Range','update','info','VoiceRecording\x20not\x20found','downloadTranscribe','destroy','Transcribe\x20not\x20configured','filter','path','filters','transcribeAccountId','aws-sdk','Location','pick','api','cancellazione\x20fisica\x20documento\x20%s','upload','unlinkSync','rawAttributes','writeFile','show','push','%s.cypher','transcribeRegion','query','merge','undefined','IN_PROGRESS','.txt','readFileSync','TranscribeService','lodash','$and','data2','transcribeStatus','value','offset','name','where','attributes','differenceBy','stack','Name','and','download','catch','Cloud\x20Provider\x20not\x20available','recording','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','index','uniqueid','../../components/parsers/qs','describe','../../components/encryptor','length','options','decryptFile','unlink','data1','TranscriptionJob','error-middleware/errors','rows','count','../../mysqldb','VoiceRecording','transcribe','Voice\x20Recording\x20not\x20found','status','includeAll','sequelize','File:\x20\x22','tempSentiment','root','params','sort','TranscriptionJobStatus','model','Bucket','keys','Not\x20found','token','uuid','existsSync','../../config/logger','runSentiment','.cypher','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','create','runTranscribe','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','set','map','find','send','location','isNil','TranscriptionJobName','downloads','startTranscriptionJob','Setting','sentimentAccountId'];(function(_0xa1bbff,_0x2e6636){const _0x4d5731=function(_0x22980c){while(--_0x22980c){_0xa1bbff['push'](_0xa1bbff['shift']());}};_0x4d5731(++_0x2e6636);}(a771_0x2e66,0xb7));const a771_0x4d57=function(_0xa1bbff,_0x2e6636){_0xa1bbff=_0xa1bbff-0x0;let _0x4d5731=a771_0x2e66[_0xa1bbff];return _0x4d5731;};const _0x587409=a771_0x4d57;'use strict';const util=require('util'),path=require(_0x587409('0x66')),fs=require('fs'),_=require(_0x587409('0x7d')),AWS=require(_0x587409('0x69')),{v4:uuidv4}=require(_0x587409('0x31')),qs=require(_0x587409('0x13')),logger=require(_0x587409('0x33'))(_0x587409('0x6c')),config=require('../../config/environment'),db=require(_0x587409('0x1f'))['db'],{Op,fn,col,ValidationError}=require(_0x587409('0x25')),{InternalError}=require(_0x587409('0x1c'));function respondWithResult(_0x22980c,_0x2766ae){return _0x2766ae=_0x2766ae||0xc8,function(_0x5dce1f){const _0x31976b=a771_0x4d57;if(_0x5dce1f)return _0x22980c[_0x31976b('0x23')](_0x2766ae)['json'](_0x5dce1f);};}function respondWithFilteredResult(_0x155022,_0x298073){return function(_0x4cedef){const _0x2c844a=a771_0x4d57;if(_0x4cedef){const _0x79f140=_0x4cedef[_0x2c844a('0x1e')],_0x343104=_0x298073['offset'];let _0x1f2bc3=_0x298073[_0x2c844a('0x4')]+_0x298073[_0x2c844a('0x50')],_0x150dfd;return _0x1f2bc3>=_0x79f140?(_0x1f2bc3=_0x79f140,_0x150dfd=0xc8):_0x150dfd=0xce,_0x155022[_0x2c844a('0x23')](_0x150dfd),_0x155022[_0x2c844a('0x3a')](_0x2c844a('0x5e'),_0x343104+'-'+_0x1f2bc3+'/'+_0x79f140)['json'](_0x4cedef);}return null;};}function saveUpdates(_0x3b54c2){return function(_0x1938e1){const _0x3773ff=a771_0x4d57;if(_0x1938e1)return _0x1938e1[_0x3773ff('0x5f')](_0x3b54c2)['then'](function(_0x4a1d94){return _0x4a1d94;});return null;};}function handleEntityNotFound(_0x37ea95){return function(_0x37eeef){const _0x551b8d=a771_0x4d57;return!_0x37eeef&&_0x37ea95[_0x551b8d('0x49')](0x194),_0x37eeef;};}function handleError(_0x3c4200,_0x2d8f19){return _0x2d8f19=_0x2d8f19||0x1f4,function(_0x19458c){const _0x40a39a=a771_0x4d57;logger['error'](_0x19458c[_0x40a39a('0x9')]),_0x19458c[_0x40a39a('0x5')]&&delete _0x19458c[_0x40a39a('0x5')],_0x3c4200[_0x40a39a('0x23')](_0x2d8f19)[_0x40a39a('0x3d')](_0x19458c);};}exports[_0x587409('0x11')]=function(_0x2e75bb,_0x395f4f){const _0x399299=_0x587409;let _0x3e4275={};const _0xc90da8={},_0x4d8fb6={'count':0x0,'rows':[]},_0x5705fd=_[_0x399299('0x3b')](db[_0x399299('0x20')][_0x399299('0x70')],function(_0x5596ce){const _0x562f7a=_0x399299;return{'name':_0x5596ce[_0x562f7a('0x46')],'type':_0x5596ce[_0x562f7a('0x4b')]['key']};});_0xc90da8[_0x399299('0x2c')]=_[_0x399299('0x8')](_[_0x399299('0x3b')](_0x5705fd,_0x399299('0x5')),[_0x399299('0x56')]),_0xc90da8[_0x399299('0x76')]=_[_0x399299('0x2e')](_0x2e75bb[_0x399299('0x76')]),_0xc90da8[_0x399299('0x67')]=_[_0x399299('0x5c')](_0xc90da8[_0x399299('0x2c')],_0xc90da8['query']),_0x3e4275[_0x399299('0x7')]=_[_0x399299('0x5c')](_0xc90da8[_0x399299('0x2c')],qs[_0x399299('0x51')](_0x2e75bb[_0x399299('0x76')][_0x399299('0x51')])),_0x3e4275[_0x399299('0x7')]=_0x3e4275[_0x399299('0x7')][_0x399299('0x16')]?_0x3e4275['attributes']:_0xc90da8[_0x399299('0x2c')];typeof _0x2e75bb[_0x399299('0x76')]['nolimit']===_0x399299('0x78')&&(_0x3e4275[_0x399299('0x50')]=qs[_0x399299('0x50')](_0x2e75bb[_0x399299('0x76')][_0x399299('0x50')]),_0x3e4275[_0x399299('0x4')]=qs[_0x399299('0x4')](_0x2e75bb[_0x399299('0x76')]['offset']));_0x3e4275['order']=qs[_0x399299('0x2a')](_0x2e75bb[_0x399299('0x76')][_0x399299('0x2a')]),_0x3e4275[_0x399299('0x6')]=qs[_0x399299('0x67')](_[_0x399299('0x6b')](_0x2e75bb['query'],_0xc90da8[_0x399299('0x67')]),_0x5705fd);_0x2e75bb[_0x399299('0x76')]['filter']&&(_0x3e4275[_0x399299('0x6')]=_[_0x399299('0x77')](_0x3e4275['where'],{[Op['or']]:_[_0x399299('0x3b')](_0x5705fd,function(_0x58774c){const _0x5ce9c1=_0x399299;if(_0x58774c[_0x5ce9c1('0x4b')]!=='VIRTUAL'){const _0x50c73b={};return _0x50c73b[_0x58774c['name']]={[Op['like']]:'%'+_0x2e75bb[_0x5ce9c1('0x76')][_0x5ce9c1('0x65')]+'%'},_0x50c73b;}})}));_0x3e4275=_[_0x399299('0x77')]({},_0x3e4275,_0x2e75bb[_0x399299('0x17')]);const _0x213a29={'where':_0x3e4275[_0x399299('0x6')]};return db[_0x399299('0x20')][_0x399299('0x1e')](_0x213a29)[_0x399299('0x59')](function(_0x360566){const _0x2edd49=_0x399299;return _0x4d8fb6[_0x2edd49('0x1e')]=_0x360566,_0x2e75bb['query'][_0x2edd49('0x24')]&&(_0x3e4275[_0x2edd49('0x53')]=[{'all':!![]}]),db['VoiceRecording']['findAll'](_0x3e4275);})[_0x399299('0x59')](function(_0x314e1d){const _0x1e453e=_0x399299;return _0x4d8fb6[_0x1e453e('0x1d')]=_0x314e1d,_0x4d8fb6;})[_0x399299('0x59')](respondWithFilteredResult(_0x395f4f,_0x3e4275))[_0x399299('0xd')](handleError(_0x395f4f,null));},exports[_0x587409('0x72')]=function(_0x1a3615,_0x25a968){const _0xe5ef91=_0x587409;let _0x238ce9={'raw':![],'where':{'id':_0x1a3615[_0xe5ef91('0x29')]['id']}};const _0x4d7a0f={};return _0x4d7a0f[_0xe5ef91('0x2c')]=_[_0xe5ef91('0x2e')](db[_0xe5ef91('0x20')]['rawAttributes']),_0x4d7a0f[_0xe5ef91('0x76')]=_[_0xe5ef91('0x2e')](_0x1a3615[_0xe5ef91('0x76')]),_0x4d7a0f[_0xe5ef91('0x67')]=_[_0xe5ef91('0x5c')](_0x4d7a0f[_0xe5ef91('0x2c')],_0x4d7a0f[_0xe5ef91('0x76')]),_0x238ce9['attributes']=_[_0xe5ef91('0x5c')](_0x4d7a0f[_0xe5ef91('0x2c')],qs[_0xe5ef91('0x51')](_0x1a3615['query'][_0xe5ef91('0x51')])),_0x238ce9[_0xe5ef91('0x7')]=_0x238ce9[_0xe5ef91('0x7')][_0xe5ef91('0x16')]?_0x238ce9[_0xe5ef91('0x7')]:_0x4d7a0f[_0xe5ef91('0x2c')],_0x1a3615[_0xe5ef91('0x76')][_0xe5ef91('0x24')]&&(_0x238ce9[_0xe5ef91('0x53')]=[{'all':!![]}]),_0x238ce9=_[_0xe5ef91('0x77')]({},_0x238ce9,_0x1a3615['options']),db[_0xe5ef91('0x20')]['findOne'](_0x238ce9)['then'](handleEntityNotFound(_0x25a968,null))[_0xe5ef91('0x59')](respondWithResult(_0x25a968,null))[_0xe5ef91('0xd')](handleError(_0x25a968,null));},exports[_0x587409('0x37')]=function(_0xa29819,_0x42715a){const _0x3cd6c1=_0x587409;return db[_0x3cd6c1('0x20')][_0x3cd6c1('0x37')](_0xa29819[_0x3cd6c1('0x48')],{})[_0x3cd6c1('0x59')](respondWithResult(_0x42715a,0xc9))['catch'](handleError(_0x42715a,null));},exports['update']=function(_0x4ac976,_0x4bacb5){const _0x2d278d=_0x587409;return _0x4ac976['body']['id']&&delete _0x4ac976[_0x2d278d('0x48')]['id'],db[_0x2d278d('0x20')][_0x2d278d('0x52')]({'where':{'id':_0x4ac976[_0x2d278d('0x29')]['id']}})[_0x2d278d('0x59')](handleEntityNotFound(_0x4bacb5,null))[_0x2d278d('0x59')](saveUpdates(_0x4ac976[_0x2d278d('0x48')],null))[_0x2d278d('0x59')](respondWithResult(_0x4bacb5,null))[_0x2d278d('0xd')](handleError(_0x4bacb5,null));},exports[_0x587409('0x14')]=function(_0x527496,_0x18ebbb){const _0x391559=_0x587409;return db[_0x391559('0x20')][_0x391559('0x14')]()[_0x391559('0x59')](respondWithResult(_0x18ebbb,null))[_0x391559('0xd')](handleError(_0x18ebbb,null));},exports['download']=function(_0x1daea0,_0x59c6d9){const _0xe59bd3=_0x587409,_0x4d2032=require(_0xe59bd3('0x15'));let _0xb82d49=![];const _0x1c5ee8={};return _0x1daea0[_0xe59bd3('0x76')]['type']&&_0x1daea0['query']['type']==='uniqueid'?_0x1c5ee8[_0xe59bd3('0x12')]=_0x1daea0[_0xe59bd3('0x29')]['id']:_0x1c5ee8['id']=_0x1daea0[_0xe59bd3('0x29')]['id'],db[_0xe59bd3('0x20')][_0xe59bd3('0x52')]({'where':_0x1c5ee8,'attributes':['id','value'],'raw':!![]})[_0xe59bd3('0x59')](handleEntityNotFound(_0x59c6d9,null))['then'](function(_0x2a854e){const _0x43e0c2=_0xe59bd3;if(_0x2a854e){const _0x3e515e=_0x2a854e[_0x43e0c2('0x3')],_0x1d0325=util[_0x43e0c2('0x56')](_0x43e0c2('0x74'),_0x3e515e);if(fs[_0x43e0c2('0x32')](_0x1d0325))return _0xb82d49=!![],_0x4d2032[_0x43e0c2('0x18')](_0x1d0325,_0x3e515e,config['secrets'][_0x43e0c2('0xf')])['then'](function(){return _0x2a854e;});return _0x2a854e;}})[_0xe59bd3('0x59')](function(_0x2f2438){const _0x22790a=_0xe59bd3;if(_0x2f2438){const _0x47469f=_0x2f2438[_0x22790a('0x3')];if(!fs[_0x22790a('0x32')](_0x47469f))throw new ValidationError(_0x22790a('0x61'));return _0x2f2438['filename']?_0x59c6d9[_0x22790a('0xc')](_0x47469f,_0x2f2438[_0x22790a('0x47')]+path[_0x22790a('0x5b')](_0x47469f),function(){const _0x320f21=_0x22790a;_0xb82d49&&fs[_0x320f21('0x19')](_0x47469f);}):_0x59c6d9[_0x22790a('0xc')](_0x47469f,function(){const _0x4c67ae=_0x22790a;_0xb82d49&&fs[_0x4c67ae('0x19')](_0x47469f);});}})['catch'](function(_0x65ffb7){const _0x373ad7=_0xe59bd3;if(_0x65ffb7[_0x373ad7('0x4e')]===_0x373ad7('0x61'))_0x59c6d9[_0x373ad7('0x23')](0x194)[_0x373ad7('0x3d')](_0x373ad7('0x2f'));else return handleError(_0x59c6d9,null);});},exports[_0x587409('0x41')]=function(_0x17a284,_0xcfcd6b){const _0x3e71e9=_0x587409,_0x11066b=require(_0x3e71e9('0x15'));let _0x3d9548=![];const _0x17416b={[Op[_0x3e71e9('0xb')]]:[_0x17416b(fn('MD5',col(_0x3e71e9('0x12'))),_0x17a284['query'][_0x3e71e9('0x30')])]};return _0x17a284[_0x3e71e9('0x76')][_0x3e71e9('0x4b')]&&_0x17a284[_0x3e71e9('0x76')][_0x3e71e9('0x4b')]===_0x3e71e9('0x12')?_0x17416b[_0x3e71e9('0x0')][_0x3e71e9('0x73')]({'uniqueid':_0x17a284[_0x3e71e9('0x29')]['id']}):_0x17416b[_0x3e71e9('0x0')]['push']({'id':_0x17a284[_0x3e71e9('0x29')]['id']}),db[_0x3e71e9('0x20')][_0x3e71e9('0x52')]({'where':_0x17416b,'attributes':['id','value'],'raw':!![]})[_0x3e71e9('0x59')](handleEntityNotFound(_0xcfcd6b,null))['then'](function(_0x49abed){const _0x214939=_0x3e71e9;if(_0x49abed){const _0x436ad7=util[_0x214939('0x56')](_0x214939('0x74'),_0x49abed['value']);if(fs[_0x214939('0x32')](_0x436ad7))return _0x3d9548=!![],_0x11066b[_0x214939('0x18')](_0x436ad7,_0x49abed['value'],config[_0x214939('0x4c')][_0x214939('0xf')])[_0x214939('0x59')](function(){return _0x49abed;});return _0x49abed;}})['then'](function(_0x14c5f9){const _0xb5652a=_0x3e71e9;if(_0x14c5f9){if(!fs[_0xb5652a('0x32')](_0x14c5f9[_0xb5652a('0x3')]))throw new ValidationError(_0xb5652a('0x61'));return _0x14c5f9[_0xb5652a('0x47')]?_0xcfcd6b[_0xb5652a('0xc')](_0x14c5f9[_0xb5652a('0x3')],_0x14c5f9['filename']+path[_0xb5652a('0x5b')](_0x14c5f9[_0xb5652a('0x3')]),function(){const _0x905e14=_0xb5652a;_0x3d9548&&fs['unlink'](_0x14c5f9[_0x905e14('0x3')]);}):_0xcfcd6b[_0xb5652a('0xc')](_0x14c5f9[_0xb5652a('0x3')],function(){_0x3d9548&&fs['unlink'](_0x14c5f9['value']);});}})[_0x3e71e9('0xd')](handleError(_0xcfcd6b,null));},exports['destroy']=function(_0x129612,_0x21bb69){const _0x50da06=_0x587409;return db[_0x50da06('0x20')][_0x50da06('0x52')]({'where':{'id':_0x129612[_0x50da06('0x29')]['id']}})[_0x50da06('0x59')](function(_0x183a5){if(!_0x183a5)throw new ReferenceError('Entity\x20not\x20found');return _0x183a5;})[_0x50da06('0x59')](function(_0x4140b5){const _0x367657=_0x50da06;let _0x29d213=_0x4140b5[_0x367657('0x3')];return logger[_0x367657('0x60')](_0x367657('0x6d'),_0x29d213),!_[_0x367657('0x3f')](_0x4140b5[_0x367657('0x3')])&&fs[_0x367657('0x32')](_0x29d213)&&(logger[_0x367657('0x60')]('File:\x20\x22'+_0x29d213+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione'),fs[_0x367657('0x6f')](_0x29d213)),_0x29d213=_0x29d213+_0x367657('0x35'),!_[_0x367657('0x3f')](_0x4140b5[_0x367657('0x3')])&&fs[_0x367657('0x32')](_0x29d213)&&(logger[_0x367657('0x60')](_0x367657('0x26')+_0x29d213+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione'),fs['unlinkSync'](_0x29d213)),_0x4140b5;})[_0x50da06('0x59')](function(_0x33b0eb){const _0x3b5b96=_0x50da06;if(!_0x33b0eb)throw new InternalError();return _0x33b0eb[_0x3b5b96('0x63')]();})['then'](function(){const _0x228a05=_0x50da06;_0x21bb69['status'](0xcc)[_0x228a05('0x45')]();})[_0x50da06('0xd')](handleError(_0x21bb69,null));};function getBucketslist(_0x123d90,_0x1c8f09,_0x56988b){return new Promise(function(_0x11df6f,_0x5af5b9){const _0x3d28ff=a771_0x4d57,_0x10dc1b=new AWS['S3']({'accessKeyId':_0x1c8f09,'secretAccessKey':_0x123d90,'region':_0x56988b});_0x10dc1b[_0x3d28ff('0x57')]({},function(_0x48c25f,_0x3b9faf){return _0x48c25f?_0x5af5b9(_0x48c25f):_0x11df6f(_0x3b9faf);});});}function createBucket(_0x1f8d12,_0x35a087,_0x49654a,_0x874a6b){return new Promise(function(_0x138e39,_0x3444b5){const _0x3c1608=a771_0x4d57,_0x500794=new AWS['S3']({'accessKeyId':_0x35a087,'secretAccessKey':_0x1f8d12,'region':_0x49654a});_0x500794[_0x3c1608('0x4a')]({'Bucket':_0x874a6b},function(_0xe7eae8,_0x2590c9){return _0xe7eae8?_0x3444b5(_0xe7eae8):_0x138e39(_0x2590c9);});});}function uploadFile(_0x368a7b,_0x4db50b,_0x219b96,_0xb93f9c,_0x31e544,_0x51950d){return new Promise(function(_0x42a6b1,_0x3af819){const _0x5e5696=a771_0x4d57,_0x21ad1a=new AWS['S3']({'accessKeyId':_0x4db50b,'secretAccessKey':_0x368a7b,'region':_0x219b96});_0x21ad1a[_0x5e5696('0x6e')]({'Bucket':_0xb93f9c,'Key':_0x31e544,'Body':_0x51950d},function(_0xbf2985,_0x2db588){return _0xbf2985?_0x3af819(_0xbf2985):_0x42a6b1(_0x2db588);});});}function startTranscribe(_0x3be368,_0x55ba07,_0xf91bec,_0x1704b7,_0x49661f,_0x416d70){return new Promise(function(_0x268c51,_0x4c827b){const _0x4a2094=a771_0x4d57,_0x435f1a=new AWS[(_0x4a2094('0x7c'))]({'accessKeyId':_0x55ba07,'secretAccessKey':_0x3be368,'region':_0xf91bec});_0x435f1a[_0x4a2094('0x42')]({'TranscriptionJobName':_0x1704b7,'LanguageCode':_0x49661f,'Media':{'MediaFileUri':_0x416d70}},function(_0x15dceb,_0x2af579){return _0x15dceb?_0x4c827b(_0x15dceb):_0x268c51(_0x2af579);});});}function transcribe(_0x48339a,_0x1972f8,_0x1e2b14,_0x2ec45e,_0x1faa4f,_0x3ff123,_0x4d8339){return new Promise(function(_0x17ff6d,_0x577b3c){const _0x264199=a771_0x4d57,_0x9b1396={};return logger['info'](util[_0x264199('0x56')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x48339a,_0x1faa4f)),uploadFile(_0x1972f8,_0x1e2b14,_0x2ec45e,_0x1faa4f,path['basename'](_0x3ff123),fs[_0x264199('0x7b')](_0x3ff123))[_0x264199('0x59')](function(_0x54ac2d){const _0x3ee0bb=_0x264199;return logger[_0x3ee0bb('0x60')](util[_0x3ee0bb('0x56')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x48339a,_0x1faa4f,_0x54ac2d[_0x3ee0bb('0x6a')])),_0x9b1396[_0x3ee0bb('0x54')]=_0x54ac2d[_0x3ee0bb('0x2d')],_0x9b1396[_0x3ee0bb('0x3e')]=_0x54ac2d['Location'],logger[_0x3ee0bb('0x60')](util['format'](_0x3ee0bb('0x10'),_0x48339a)),startTranscribe(_0x1972f8,_0x1e2b14,_0x2ec45e,uuidv4(),_0x4d8339,_0x54ac2d[_0x3ee0bb('0x6a')]);})[_0x264199('0x59')](function(_0x5e4d40){const _0x491542=_0x264199;return logger[_0x491542('0x60')](util[_0x491542('0x56')](_0x491542('0x39'),_0x48339a,_0x5e4d40[_0x491542('0x1b')]['TranscriptionJobName'])),_0x9b1396['transcribeName']=_0x5e4d40['TranscriptionJob'][_0x491542('0x40')],_0x9b1396[_0x491542('0x2')]=_0x5e4d40[_0x491542('0x1b')][_0x491542('0x2b')],_0x17ff6d(_0x9b1396);})[_0x264199('0xd')](function(_0x37f3cd){return _0x577b3c(_0x37f3cd);});});}exports[_0x587409('0x38')]=function(_0x108de1,_0x1098f5){const _0x73576f=_0x587409;let _0x3395f4,_0x34ab9c,_0x8b83e3;const _0x513952=require(_0x73576f('0x15'));return db[_0x73576f('0x20')][_0x73576f('0x52')]({'where':{'id':_0x108de1[_0x73576f('0x29')]['id']}})[_0x73576f('0x59')](function(_0x7a3a24){const _0x22c75f=_0x73576f;if(_0x7a3a24){const _0x3c8791=util[_0x22c75f('0x56')](_0x22c75f('0x74'),_0x7a3a24['value']);if(fs[_0x22c75f('0x32')](_0x3c8791))return _0x513952[_0x22c75f('0x18')](_0x3c8791,_0x7a3a24[_0x22c75f('0x3')],config['secrets'][_0x22c75f('0xf')])[_0x22c75f('0x59')](function(){return _0x7a3a24;});return _0x7a3a24;}})[_0x73576f('0x59')](function(_0x3fea3c){const _0x13eff8=_0x73576f;if(!_0x3fea3c)throw new ValidationError(_0x13eff8('0x22'));return _0x34ab9c=_0x3fea3c,db[_0x13eff8('0x43')][_0x13eff8('0x52')]({'where':{'id':0x1}});})[_0x73576f('0x59')](handleEntityNotFound(_0x1098f5,null))[_0x73576f('0x59')](function(_0x32b661){const _0x1f2d7a=_0x73576f;if(_0x32b661){_0x3395f4=_0x32b661;if(!_0x3395f4[_0x1f2d7a('0x21')]||!_0x3395f4[_0x1f2d7a('0x68')]||!_0x3395f4[_0x1f2d7a('0x75')]||!_0x3395f4[_0x1f2d7a('0x58')]||!_0x3395f4[_0x1f2d7a('0x54')])throw new ValidationError(_0x1f2d7a('0x64'));if(_0x108de1[_0x1f2d7a('0x48')][_0x1f2d7a('0x34')]&&(!_0x3395f4['sentiment']||!_0x3395f4[_0x1f2d7a('0x44')]||!_0x3395f4['sentimentRegion']||!_0x3395f4[_0x1f2d7a('0x58')]||!_0x3395f4[_0x1f2d7a('0x54')]))throw new ValidationError('Sentiment\x20Analysis\x20not\x20configured');return db[_0x1f2d7a('0x5d')][_0x1f2d7a('0x52')]({'where':{'id':_0x3395f4[_0x1f2d7a('0x68')]}});}})[_0x73576f('0x59')](function(_0x114266){const _0x26e05d=_0x73576f;if(!_0x114266)throw new ValidationError(_0x26e05d('0xe'));if(!_0x114266[_0x26e05d('0x1a')]||!_0x114266['data2'])throw new ValidationError(_0x26e05d('0x55'));return _0x8b83e3=_0x114266,getBucketslist(_0x8b83e3[_0x26e05d('0x1a')],_0x8b83e3[_0x26e05d('0x1')],_0x3395f4[_0x26e05d('0x75')]);})[_0x73576f('0x59')](function(_0x2eda76){const _0x44d5e1=_0x73576f;if(_0x2eda76&&_0x2eda76[_0x44d5e1('0x4d')]){const _0x3dbc9e=_[_0x44d5e1('0x3c')](_0x2eda76[_0x44d5e1('0x4d')],function(_0x10e30a){const _0x566b64=_0x44d5e1;return _0x10e30a[_0x566b64('0xa')]===_0x3395f4[_0x566b64('0x54')];});if(!_0x3dbc9e)return logger[_0x44d5e1('0x60')](util[_0x44d5e1('0x56')](_0x44d5e1('0x36'),_0x108de1[_0x44d5e1('0x29')]['id'],_0x3395f4['bucket'])),createBucket(_0x8b83e3['data1'],_0x8b83e3['data2'],_0x3395f4[_0x44d5e1('0x75')],_0x3395f4[_0x44d5e1('0x54')]);logger[_0x44d5e1('0x60')](util[_0x44d5e1('0x56')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x108de1[_0x44d5e1('0x29')]['id'],_0x3395f4[_0x44d5e1('0x54')]));return;}})['then'](function(){const _0x273f99=_0x73576f;return _0x34ab9c['transcribeStatus']==='NEW'?transcribe(_0x108de1[_0x273f99('0x29')]['id'],_0x8b83e3[_0x273f99('0x1a')],_0x8b83e3[_0x273f99('0x1')],_0x3395f4[_0x273f99('0x75')],_0x3395f4[_0x273f99('0x54')],_0x34ab9c[_0x273f99('0x3')],_0x3395f4[_0x273f99('0x58')]):(logger[_0x273f99('0x60')](util[_0x273f99('0x56')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x108de1[_0x273f99('0x29')]['id'])),{'transcribeStatus':_0x273f99('0x79')});})[_0x73576f('0x59')](function(_0x108d19){const _0x3b2ef1=_0x73576f;if(_0x108d19)return _0x108d19[_0x3b2ef1('0x27')]=_0x108de1[_0x3b2ef1('0x48')][_0x3b2ef1('0x34')],_0x34ab9c[_0x3b2ef1('0x5f')](_0x108d19);})[_0x73576f('0x59')](respondWithResult(_0x1098f5,null))[_0x73576f('0xd')](handleError(_0x1098f5,null));};function writeFile(_0x53122d,_0x37375f){return new Promise(function(_0x7d7656,_0xd1f522){const _0x110001=a771_0x4d57;fs[_0x110001('0x71')](_0x37375f,_0x53122d,function(_0x4a2b96,_0xba0104){return _0x4a2b96?_0xd1f522(_0x4a2b96):_0x7d7656(_0xba0104);});});}exports[_0x587409('0x62')]=function(_0xd08f6a,_0x2f3729){const _0x3aaa24=_0x587409;return db['VoiceRecording'][_0x3aaa24('0x52')]({'where':{'id':_0xd08f6a[_0x3aaa24('0x29')]['id']}})[_0x3aaa24('0x59')](handleEntityNotFound(_0x2f3729))[_0x3aaa24('0x59')](function(_0x2ed94b){const _0x45b25e=_0x3aaa24;if(_0x2ed94b&&_0x2ed94b[_0x45b25e('0x5a')]){const _0x494f85=_0x2ed94b['fileText'],_0x89ccd4=config[_0x45b25e('0x28')]+'/server/files/transcribes/transcribe_'+_0x2ed94b['id']+_0x45b25e('0x7a');if(fs['existsSync'](_0x89ccd4))return _0x89ccd4;return writeFile(_0x494f85,_0x89ccd4)[_0x45b25e('0x59')](function(){return _0x89ccd4;});}else throw new ValidationError(_0x45b25e('0x4f'));})['then'](function(_0x9d9a55){const _0x17502c=_0x3aaa24;return _0x2f3729[_0x17502c('0xc')](_0x9d9a55);})[_0x3aaa24('0xd')](handleError(_0x2f3729));};
\ No newline at end of file