Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / voiceRecording / voiceRecording.controller.js
index 107948d..74469cd 100644 (file)
@@ -1 +1 @@
-const a771_0x513f=['Cloud\x20Provider\x20not\x20configured','../../mysqldb','TranscriptionJob','find','merge','unlinkSync','rawAttributes','keys','uniqueid','key','info','data2','filename','sendStatus','end','Voice\x20Recording\x20not\x20found','extname','push','filter','transcribe','../../components/encryptor','MD5','pick','model','path','secrets','update','show','type','existsSync','Cloud\x20Provider\x20not\x20available','like','api','intersection','offset','Not\x20found','length','lodash','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','bucket','sequelize','query','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','IN_PROGRESS','root','error','name','Sentiment\x20Analysis\x20not\x20configured','transcribeName','and','include','destroy','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','params','$and','fieldName','count','status','body','TranscribeService','filters','catch','Buckets','create','transcribeAccountId','data1','runSentiment','map','decryptFile','value','unlink','writeFile','options','aws-sdk','../../components/parsers/qs','download','fields','location','findOne','message','where','Entity\x20not\x20found','limit','token','attributes','uuid','TranscriptionJobStatus','sentimentRegion','VoiceRecording','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','differenceBy','transcribeRegion','then','upload','format','startTranscriptionJob','findAll','stack','includeAll','sentimentAccountId','recording','language','%s.cypher','.txt','describe','readFileSync','CloudProvider','transcribeStatus','Setting','Content-Range','Transcript\x20not\x20available','.cypher','fileText','runTranscribe','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','downloadTranscribe','index','sort','downloads','cancellazione\x20fisica\x20documento\x20%s','createBucket','set','order','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','json','basename','Location'];(function(_0x25f70e,_0x513f34){const _0x184e98=function(_0x523a45){while(--_0x523a45){_0x25f70e['push'](_0x25f70e['shift']());}};_0x184e98(++_0x513f34);}(a771_0x513f,0x98));const a771_0x184e=function(_0x25f70e,_0x513f34){_0x25f70e=_0x25f70e-0x0;let _0x184e98=a771_0x513f[_0x25f70e];return _0x184e98;};const _0x449752=a771_0x184e;'use strict';const util=require('util'),path=require(_0x449752('0x0')),fs=require('fs'),_=require(_0x449752('0xd')),AWS=require(_0x449752('0x31')),{v4:uuidv4}=require(_0x449752('0x3d')),qs=require(_0x449752('0x32')),logger=require('../../config/logger')(_0x449752('0x8')),config=require('../../config/environment'),db=require(_0x449752('0x69'))['db'],{Op,fn,col,ValidationError}=require(_0x449752('0x10')),{InternalError}=require('error-middleware/errors');function respondWithResult(_0x523a45,_0x1829bd){return _0x1829bd=_0x1829bd||0xc8,function(_0x28fc22){const _0x2cb370=a771_0x184e;if(_0x28fc22)return _0x523a45[_0x2cb370('0x21')](_0x1829bd)['json'](_0x28fc22);};}function respondWithFilteredResult(_0x4a3633,_0x311b73){return function(_0x4ffcbe){const _0x672c77=a771_0x184e;if(_0x4ffcbe){const _0x15d604=_0x4ffcbe[_0x672c77('0x20')],_0x48426c=_0x311b73['offset'];let _0x18ab86=_0x311b73[_0x672c77('0xa')]+_0x311b73[_0x672c77('0x3a')],_0x240738;return _0x18ab86>=_0x15d604?(_0x18ab86=_0x15d604,_0x240738=0xc8):_0x240738=0xce,_0x4a3633['status'](_0x240738),_0x4a3633[_0x672c77('0x62')](_0x672c77('0x56'),_0x48426c+'-'+_0x18ab86+'/'+_0x15d604)[_0x672c77('0x65')](_0x4ffcbe);}return null;};}function saveUpdates(_0x545d75){return function(_0xf84fa0){const _0x4b0a6f=a771_0x184e;if(_0xf84fa0)return _0xf84fa0[_0x4b0a6f('0x2')](_0x545d75)[_0x4b0a6f('0x45')](function(_0x162aad){return _0x162aad;});return null;};}function handleEntityNotFound(_0x15ec04){return function(_0x3430f8){const _0x4ea9aa=a771_0x184e;return!_0x3430f8&&_0x15ec04[_0x4ea9aa('0x75')](0x194),_0x3430f8;};}function handleError(_0x5db7cc,_0x37633f){return _0x37633f=_0x37633f||0x1f4,function(_0x904f77){const _0x32245f=a771_0x184e;logger[_0x32245f('0x15')](_0x904f77[_0x32245f('0x4a')]),_0x904f77[_0x32245f('0x16')]&&delete _0x904f77['name'],_0x5db7cc[_0x32245f('0x21')](_0x37633f)['send'](_0x904f77);};}exports[_0x449752('0x5d')]=function(_0x2276f8,_0x152f27){const _0x11fec7=_0x449752;let _0xd1b77e={};const _0x557945={},_0x51016e={'count':0x0,'rows':[]},_0xb8eed1=_[_0x11fec7('0x2b')](db['VoiceRecording']['rawAttributes'],function(_0x1dec83){const _0x30d8b1=_0x11fec7;return{'name':_0x1dec83[_0x30d8b1('0x1f')],'type':_0x1dec83['type'][_0x30d8b1('0x71')]};});_0x557945[_0x11fec7('0x7f')]=_[_0x11fec7('0x43')](_['map'](_0xb8eed1,_0x11fec7('0x16')),[_0x11fec7('0x47')]),_0x557945[_0x11fec7('0x11')]=_[_0x11fec7('0x6f')](_0x2276f8[_0x11fec7('0x11')]),_0x557945[_0x11fec7('0x24')]=_[_0x11fec7('0x9')](_0x557945[_0x11fec7('0x7f')],_0x557945[_0x11fec7('0x11')]),_0xd1b77e[_0x11fec7('0x3c')]=_[_0x11fec7('0x9')](_0x557945['model'],qs[_0x11fec7('0x34')](_0x2276f8[_0x11fec7('0x11')][_0x11fec7('0x34')])),_0xd1b77e[_0x11fec7('0x3c')]=_0xd1b77e['attributes'][_0x11fec7('0xc')]?_0xd1b77e[_0x11fec7('0x3c')]:_0x557945[_0x11fec7('0x7f')];typeof _0x2276f8['query']['nolimit']==='undefined'&&(_0xd1b77e[_0x11fec7('0x3a')]=qs[_0x11fec7('0x3a')](_0x2276f8[_0x11fec7('0x11')]['limit']),_0xd1b77e[_0x11fec7('0xa')]=qs[_0x11fec7('0xa')](_0x2276f8[_0x11fec7('0x11')]['offset']));_0xd1b77e[_0x11fec7('0x63')]=qs[_0x11fec7('0x5e')](_0x2276f8[_0x11fec7('0x11')][_0x11fec7('0x5e')]),_0xd1b77e[_0x11fec7('0x38')]=qs[_0x11fec7('0x24')](_[_0x11fec7('0x7e')](_0x2276f8[_0x11fec7('0x11')],_0x557945['filters']),_0xb8eed1);_0x2276f8['query'][_0x11fec7('0x7a')]&&(_0xd1b77e['where']=_[_0x11fec7('0x6c')](_0xd1b77e[_0x11fec7('0x38')],{[Op['or']]:_[_0x11fec7('0x2b')](_0xb8eed1,function(_0x55e5a7){const _0x3f41f8=_0x11fec7;if(_0x55e5a7[_0x3f41f8('0x4')]!=='VIRTUAL'){const _0x11fff1={};return _0x11fff1[_0x55e5a7[_0x3f41f8('0x16')]]={[Op[_0x3f41f8('0x7')]]:'%'+_0x2276f8['query'][_0x3f41f8('0x7a')]+'%'},_0x11fff1;}})}));_0xd1b77e=_[_0x11fec7('0x6c')]({},_0xd1b77e,_0x2276f8[_0x11fec7('0x30')]);const _0x2c4415={'where':_0xd1b77e[_0x11fec7('0x38')]};return db[_0x11fec7('0x40')][_0x11fec7('0x20')](_0x2c4415)['then'](function(_0x2b2fb8){const _0x989cd2=_0x11fec7;return _0x51016e[_0x989cd2('0x20')]=_0x2b2fb8,_0x2276f8[_0x989cd2('0x11')][_0x989cd2('0x4b')]&&(_0xd1b77e[_0x989cd2('0x1a')]=[{'all':!![]}]),db[_0x989cd2('0x40')][_0x989cd2('0x49')](_0xd1b77e);})[_0x11fec7('0x45')](function(_0x554838){return _0x51016e['rows']=_0x554838,_0x51016e;})['then'](respondWithFilteredResult(_0x152f27,_0xd1b77e))[_0x11fec7('0x25')](handleError(_0x152f27,null));},exports[_0x449752('0x3')]=function(_0x24cdbd,_0x3ed85a){const _0x47941f=_0x449752;let _0x35ebad={'raw':![],'where':{'id':_0x24cdbd[_0x47941f('0x1d')]['id']}};const _0x11d5e0={};return _0x11d5e0[_0x47941f('0x7f')]=_[_0x47941f('0x6f')](db[_0x47941f('0x40')][_0x47941f('0x6e')]),_0x11d5e0[_0x47941f('0x11')]=_[_0x47941f('0x6f')](_0x24cdbd[_0x47941f('0x11')]),_0x11d5e0[_0x47941f('0x24')]=_['intersection'](_0x11d5e0['model'],_0x11d5e0[_0x47941f('0x11')]),_0x35ebad[_0x47941f('0x3c')]=_[_0x47941f('0x9')](_0x11d5e0[_0x47941f('0x7f')],qs['fields'](_0x24cdbd[_0x47941f('0x11')]['fields'])),_0x35ebad['attributes']=_0x35ebad[_0x47941f('0x3c')][_0x47941f('0xc')]?_0x35ebad[_0x47941f('0x3c')]:_0x11d5e0['model'],_0x24cdbd[_0x47941f('0x11')]['includeAll']&&(_0x35ebad[_0x47941f('0x1a')]=[{'all':!![]}]),_0x35ebad=_[_0x47941f('0x6c')]({},_0x35ebad,_0x24cdbd[_0x47941f('0x30')]),db[_0x47941f('0x40')]['findOne'](_0x35ebad)[_0x47941f('0x45')](handleEntityNotFound(_0x3ed85a,null))[_0x47941f('0x45')](respondWithResult(_0x3ed85a,null))[_0x47941f('0x25')](handleError(_0x3ed85a,null));},exports[_0x449752('0x27')]=function(_0x33db22,_0xdea129){const _0x256d78=_0x449752;return db['VoiceRecording']['create'](_0x33db22[_0x256d78('0x22')],{})[_0x256d78('0x45')](respondWithResult(_0xdea129,0xc9))[_0x256d78('0x25')](handleError(_0xdea129,null));},exports[_0x449752('0x2')]=function(_0x4f4f11,_0x58afc5){const _0x557d65=_0x449752;return _0x4f4f11[_0x557d65('0x22')]['id']&&delete _0x4f4f11['body']['id'],db[_0x557d65('0x40')][_0x557d65('0x36')]({'where':{'id':_0x4f4f11[_0x557d65('0x1d')]['id']}})['then'](handleEntityNotFound(_0x58afc5,null))['then'](saveUpdates(_0x4f4f11[_0x557d65('0x22')],null))[_0x557d65('0x45')](respondWithResult(_0x58afc5,null))[_0x557d65('0x25')](handleError(_0x58afc5,null));},exports[_0x449752('0x51')]=function(_0x480ba6,_0x56aeef){const _0x161fa8=_0x449752;return db[_0x161fa8('0x40')][_0x161fa8('0x51')]()[_0x161fa8('0x45')](respondWithResult(_0x56aeef,null))[_0x161fa8('0x25')](handleError(_0x56aeef,null));},exports[_0x449752('0x33')]=function(_0x4ae7be,_0x4f566e){const _0x2fb390=_0x449752,_0x5bf9c9=require(_0x2fb390('0x7c'));let _0x13c046=![];const _0x16d9d2={};return _0x4ae7be[_0x2fb390('0x11')][_0x2fb390('0x4')]&&_0x4ae7be[_0x2fb390('0x11')][_0x2fb390('0x4')]==='uniqueid'?_0x16d9d2[_0x2fb390('0x70')]=_0x4ae7be[_0x2fb390('0x1d')]['id']:_0x16d9d2['id']=_0x4ae7be[_0x2fb390('0x1d')]['id'],db['VoiceRecording'][_0x2fb390('0x36')]({'where':_0x16d9d2,'attributes':['id',_0x2fb390('0x2d')],'raw':!![]})['then'](handleEntityNotFound(_0x4f566e,null))[_0x2fb390('0x45')](function(_0x380de7){const _0x44ff61=_0x2fb390;if(_0x380de7){const _0x44bf03=_0x380de7['value'],_0x553dee=util['format'](_0x44ff61('0x4f'),_0x44bf03);if(fs[_0x44ff61('0x5')](_0x553dee))return _0x13c046=!![],_0x5bf9c9['decryptFile'](_0x553dee,_0x44bf03,config[_0x44ff61('0x1')][_0x44ff61('0x4d')])[_0x44ff61('0x45')](function(){return _0x380de7;});return _0x380de7;}})[_0x2fb390('0x45')](function(_0x4b1756){const _0x486a4b=_0x2fb390;if(_0x4b1756){const _0x37e205=_0x4b1756['value'];if(!fs[_0x486a4b('0x5')](_0x37e205))throw new ValidationError('VoiceRecording\x20not\x20found');return _0x4b1756[_0x486a4b('0x74')]?_0x4f566e[_0x486a4b('0x33')](_0x37e205,_0x4b1756[_0x486a4b('0x74')]+path['extname'](_0x37e205),function(){_0x13c046&&fs['unlink'](_0x37e205);}):_0x4f566e[_0x486a4b('0x33')](_0x37e205,function(){const _0x1e9fa9=_0x486a4b;_0x13c046&&fs[_0x1e9fa9('0x2e')](_0x37e205);});}})[_0x2fb390('0x25')](function(_0x390b57){const _0x460b69=_0x2fb390;if(_0x390b57[_0x460b69('0x37')]==='VoiceRecording\x20not\x20found')_0x4f566e[_0x460b69('0x21')](0x194)['send'](_0x460b69('0xb'));else return handleError(_0x4f566e,null);});},exports[_0x449752('0x5f')]=function(_0x325734,_0x24f781){const _0x2c157f=_0x449752,_0xd34b9a=require(_0x2c157f('0x7c'));let _0x4acbd4=![];const _0x308277={[Op[_0x2c157f('0x19')]]:[_0x308277(fn(_0x2c157f('0x7d'),col(_0x2c157f('0x70'))),_0x325734[_0x2c157f('0x11')][_0x2c157f('0x3b')])]};return _0x325734['query'][_0x2c157f('0x4')]&&_0x325734['query'][_0x2c157f('0x4')]==='uniqueid'?_0x308277[_0x2c157f('0x1e')][_0x2c157f('0x79')]({'uniqueid':_0x325734[_0x2c157f('0x1d')]['id']}):_0x308277[_0x2c157f('0x1e')][_0x2c157f('0x79')]({'id':_0x325734['params']['id']}),db[_0x2c157f('0x40')][_0x2c157f('0x36')]({'where':_0x308277,'attributes':['id','value'],'raw':!![]})[_0x2c157f('0x45')](handleEntityNotFound(_0x24f781,null))[_0x2c157f('0x45')](function(_0x5ca553){const _0x3fb327=_0x2c157f;if(_0x5ca553){const _0x42cf51=util[_0x3fb327('0x47')]('%s.cypher',_0x5ca553[_0x3fb327('0x2d')]);if(fs[_0x3fb327('0x5')](_0x42cf51))return _0x4acbd4=!![],_0xd34b9a[_0x3fb327('0x2c')](_0x42cf51,_0x5ca553[_0x3fb327('0x2d')],config['secrets'][_0x3fb327('0x4d')])[_0x3fb327('0x45')](function(){return _0x5ca553;});return _0x5ca553;}})['then'](function(_0x4f96d8){const _0x521d08=_0x2c157f;if(_0x4f96d8){if(!fs[_0x521d08('0x5')](_0x4f96d8['value']))throw new ValidationError('VoiceRecording\x20not\x20found');return _0x4f96d8[_0x521d08('0x74')]?_0x24f781[_0x521d08('0x33')](_0x4f96d8[_0x521d08('0x2d')],_0x4f96d8[_0x521d08('0x74')]+path[_0x521d08('0x78')](_0x4f96d8[_0x521d08('0x2d')]),function(){const _0x330e83=_0x521d08;_0x4acbd4&&fs[_0x330e83('0x2e')](_0x4f96d8[_0x330e83('0x2d')]);}):_0x24f781[_0x521d08('0x33')](_0x4f96d8[_0x521d08('0x2d')],function(){const _0x5dc891=_0x521d08;_0x4acbd4&&fs['unlink'](_0x4f96d8[_0x5dc891('0x2d')]);});}})['catch'](handleError(_0x24f781,null));},exports[_0x449752('0x1b')]=function(_0xed960a,_0x5dbf51){const _0x35992c=_0x449752;return db[_0x35992c('0x40')][_0x35992c('0x36')]({'where':{'id':_0xed960a['params']['id']}})['then'](function(_0x4de3b2){const _0x3b2029=_0x35992c;if(!_0x4de3b2)throw new ReferenceError(_0x3b2029('0x39'));return _0x4de3b2;})[_0x35992c('0x45')](function(_0x274635){const _0x40f0c6=_0x35992c;let _0x2b8f5e=_0x274635[_0x40f0c6('0x2d')];return logger[_0x40f0c6('0x72')](_0x40f0c6('0x60'),_0x2b8f5e),!_['isNil'](_0x274635[_0x40f0c6('0x2d')])&&fs[_0x40f0c6('0x5')](_0x2b8f5e)&&(logger[_0x40f0c6('0x72')]('File:\x20\x22'+_0x2b8f5e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione'),fs['unlinkSync'](_0x2b8f5e)),_0x2b8f5e=_0x2b8f5e+_0x40f0c6('0x58'),!_['isNil'](_0x274635[_0x40f0c6('0x2d')])&&fs[_0x40f0c6('0x5')](_0x2b8f5e)&&(logger[_0x40f0c6('0x72')]('File:\x20\x22'+_0x2b8f5e+_0x40f0c6('0x1c')),fs[_0x40f0c6('0x6d')](_0x2b8f5e)),_0x274635;})['then'](function(_0x424469){const _0x4e4bda=_0x35992c;if(!_0x424469)throw new InternalError();return _0x424469[_0x4e4bda('0x1b')]();})[_0x35992c('0x45')](function(){const _0x3371aa=_0x35992c;_0x5dbf51[_0x3371aa('0x21')](0xcc)[_0x3371aa('0x76')]();})['catch'](handleError(_0x5dbf51,null));};function getBucketslist(_0x218a39,_0x44100,_0x43bad2){return new Promise(function(_0x1ccb02,_0x4511b2){const _0x24f9a0=new AWS['S3']({'accessKeyId':_0x44100,'secretAccessKey':_0x218a39,'region':_0x43bad2});_0x24f9a0['listBuckets']({},function(_0x3a61c3,_0x489f35){return _0x3a61c3?_0x4511b2(_0x3a61c3):_0x1ccb02(_0x489f35);});});}function createBucket(_0x139eaf,_0x2df710,_0x2d4c88,_0x390199){return new Promise(function(_0x1b65d4,_0x4dc931){const _0xa9bf7f=a771_0x184e,_0x5ce3ee=new AWS['S3']({'accessKeyId':_0x2df710,'secretAccessKey':_0x139eaf,'region':_0x2d4c88});_0x5ce3ee[_0xa9bf7f('0x61')]({'Bucket':_0x390199},function(_0x33f9a8,_0x543e4b){return _0x33f9a8?_0x4dc931(_0x33f9a8):_0x1b65d4(_0x543e4b);});});}function uploadFile(_0x22853a,_0x1bd477,_0x167f18,_0x1862b0,_0x508024,_0x2feaae){return new Promise(function(_0x2726a0,_0x2f5eb1){const _0x2848a6=a771_0x184e,_0x151d03=new AWS['S3']({'accessKeyId':_0x1bd477,'secretAccessKey':_0x22853a,'region':_0x167f18});_0x151d03[_0x2848a6('0x46')]({'Bucket':_0x1862b0,'Key':_0x508024,'Body':_0x2feaae},function(_0x39de1e,_0x14cb2c){return _0x39de1e?_0x2f5eb1(_0x39de1e):_0x2726a0(_0x14cb2c);});});}function startTranscribe(_0x1b218e,_0x1a6a99,_0x346e4e,_0x228d7f,_0x260055,_0x508df4){return new Promise(function(_0x267567,_0x5a6b5a){const _0x27af83=a771_0x184e,_0x492df2=new AWS[(_0x27af83('0x23'))]({'accessKeyId':_0x1a6a99,'secretAccessKey':_0x1b218e,'region':_0x346e4e});_0x492df2[_0x27af83('0x48')]({'TranscriptionJobName':_0x228d7f,'LanguageCode':_0x260055,'Media':{'MediaFileUri':_0x508df4}},function(_0x128466,_0x270de2){return _0x128466?_0x5a6b5a(_0x128466):_0x267567(_0x270de2);});});}function transcribe(_0x1485f3,_0x3d575a,_0x307dfa,_0x47fcc9,_0x398134,_0x4bda2b,_0xa2b949){return new Promise(function(_0x232fcc,_0x26ad75){const _0x398f97=a771_0x184e,_0x1ef839={};return logger[_0x398f97('0x72')](util[_0x398f97('0x47')](_0x398f97('0x64'),_0x1485f3,_0x398134)),uploadFile(_0x3d575a,_0x307dfa,_0x47fcc9,_0x398134,path[_0x398f97('0x66')](_0x4bda2b),fs[_0x398f97('0x52')](_0x4bda2b))[_0x398f97('0x45')](function(_0x150e93){const _0x3750ca=_0x398f97;return logger[_0x3750ca('0x72')](util[_0x3750ca('0x47')](_0x3750ca('0x5b'),_0x1485f3,_0x398134,_0x150e93[_0x3750ca('0x67')])),_0x1ef839['bucket']=_0x150e93['Bucket'],_0x1ef839[_0x3750ca('0x35')]=_0x150e93[_0x3750ca('0x67')],logger[_0x3750ca('0x72')](util[_0x3750ca('0x47')](_0x3750ca('0x41'),_0x1485f3)),startTranscribe(_0x3d575a,_0x307dfa,_0x47fcc9,uuidv4(),_0xa2b949,_0x150e93[_0x3750ca('0x67')]);})['then'](function(_0x3d95c7){const _0x2f10a9=_0x398f97;return logger[_0x2f10a9('0x72')](util[_0x2f10a9('0x47')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1485f3,_0x3d95c7[_0x2f10a9('0x6a')][_0x2f10a9('0x42')])),_0x1ef839[_0x2f10a9('0x18')]=_0x3d95c7['TranscriptionJob'][_0x2f10a9('0x42')],_0x1ef839[_0x2f10a9('0x54')]=_0x3d95c7[_0x2f10a9('0x6a')][_0x2f10a9('0x3e')],_0x232fcc(_0x1ef839);})[_0x398f97('0x25')](function(_0x537b32){return _0x26ad75(_0x537b32);});});}exports[_0x449752('0x5a')]=function(_0x1dc91f,_0x49631f){const _0x404f76=_0x449752;let _0x308a32,_0x17cefb,_0x2920c2;const _0x3fe397=require(_0x404f76('0x7c'));return db['VoiceRecording'][_0x404f76('0x36')]({'where':{'id':_0x1dc91f[_0x404f76('0x1d')]['id']}})['then'](function(_0x5a764f){const _0x36c9c4=_0x404f76;if(_0x5a764f){const _0x478bd6=util['format'](_0x36c9c4('0x4f'),_0x5a764f[_0x36c9c4('0x2d')]);if(fs[_0x36c9c4('0x5')](_0x478bd6))return _0x3fe397[_0x36c9c4('0x2c')](_0x478bd6,_0x5a764f[_0x36c9c4('0x2d')],config[_0x36c9c4('0x1')][_0x36c9c4('0x4d')])[_0x36c9c4('0x45')](function(){return _0x5a764f;});return _0x5a764f;}})[_0x404f76('0x45')](function(_0x3433b5){const _0x9da354=_0x404f76;if(!_0x3433b5)throw new ValidationError(_0x9da354('0x77'));return _0x17cefb=_0x3433b5,db[_0x9da354('0x55')][_0x9da354('0x36')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x49631f,null))[_0x404f76('0x45')](function(_0x1c3f84){const _0x305b3d=_0x404f76;if(_0x1c3f84){_0x308a32=_0x1c3f84;if(!_0x308a32[_0x305b3d('0x7b')]||!_0x308a32['transcribeAccountId']||!_0x308a32[_0x305b3d('0x44')]||!_0x308a32[_0x305b3d('0x4e')]||!_0x308a32[_0x305b3d('0xf')])throw new ValidationError('Transcribe\x20not\x20configured');if(_0x1dc91f[_0x305b3d('0x22')][_0x305b3d('0x2a')]&&(!_0x308a32['sentiment']||!_0x308a32[_0x305b3d('0x4c')]||!_0x308a32[_0x305b3d('0x3f')]||!_0x308a32[_0x305b3d('0x4e')]||!_0x308a32[_0x305b3d('0xf')]))throw new ValidationError(_0x305b3d('0x17'));return db[_0x305b3d('0x53')]['findOne']({'where':{'id':_0x308a32[_0x305b3d('0x28')]}});}})[_0x404f76('0x45')](function(_0x19ea4c){const _0x326042=_0x404f76;if(!_0x19ea4c)throw new ValidationError(_0x326042('0x6'));if(!_0x19ea4c[_0x326042('0x29')]||!_0x19ea4c['data2'])throw new ValidationError(_0x326042('0x68'));return _0x2920c2=_0x19ea4c,getBucketslist(_0x2920c2[_0x326042('0x29')],_0x2920c2[_0x326042('0x73')],_0x308a32[_0x326042('0x44')]);})[_0x404f76('0x45')](function(_0x35c2c2){const _0x28ecbd=_0x404f76;if(_0x35c2c2&&_0x35c2c2[_0x28ecbd('0x26')]){const _0x46bc65=_[_0x28ecbd('0x6b')](_0x35c2c2[_0x28ecbd('0x26')],function(_0x2b09d8){return _0x2b09d8['Name']===_0x308a32['bucket'];});if(!_0x46bc65)return logger['info'](util[_0x28ecbd('0x47')](_0x28ecbd('0x12'),_0x1dc91f[_0x28ecbd('0x1d')]['id'],_0x308a32[_0x28ecbd('0xf')])),createBucket(_0x2920c2['data1'],_0x2920c2['data2'],_0x308a32[_0x28ecbd('0x44')],_0x308a32['bucket']);logger[_0x28ecbd('0x72')](util[_0x28ecbd('0x47')](_0x28ecbd('0xe'),_0x1dc91f[_0x28ecbd('0x1d')]['id'],_0x308a32[_0x28ecbd('0xf')]));return;}})['then'](function(){const _0x513867=_0x404f76;return _0x17cefb[_0x513867('0x54')]==='NEW'?transcribe(_0x1dc91f['params']['id'],_0x2920c2['data1'],_0x2920c2[_0x513867('0x73')],_0x308a32[_0x513867('0x44')],_0x308a32[_0x513867('0xf')],_0x17cefb[_0x513867('0x2d')],_0x308a32[_0x513867('0x4e')]):(logger[_0x513867('0x72')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1dc91f[_0x513867('0x1d')]['id'])),{'transcribeStatus':_0x513867('0x13')});})['then'](function(_0x32f241){const _0x24b81d=_0x404f76;if(_0x32f241)return _0x32f241['tempSentiment']=_0x1dc91f[_0x24b81d('0x22')]['runSentiment'],_0x17cefb['update'](_0x32f241);})['then'](respondWithResult(_0x49631f,null))['catch'](handleError(_0x49631f,null));};function writeFile(_0x386f01,_0x4f352b){return new Promise(function(_0x14c073,_0x4bda7f){const _0x497e52=a771_0x184e;fs[_0x497e52('0x2f')](_0x4f352b,_0x386f01,function(_0x443a03,_0x27a2d9){return _0x443a03?_0x4bda7f(_0x443a03):_0x14c073(_0x27a2d9);});});}exports[_0x449752('0x5c')]=function(_0x47bbfe,_0x4ea022){const _0x270165=_0x449752;return db[_0x270165('0x40')][_0x270165('0x36')]({'where':{'id':_0x47bbfe[_0x270165('0x1d')]['id']}})['then'](handleEntityNotFound(_0x4ea022))[_0x270165('0x45')](function(_0x2b0189){const _0x32ef7e=_0x270165;if(_0x2b0189&&_0x2b0189[_0x32ef7e('0x59')]){const _0x57744d=_0x2b0189['fileText'],_0x7b076f=config[_0x32ef7e('0x14')]+'/server/files/transcribes/transcribe_'+_0x2b0189['id']+_0x32ef7e('0x50');if(fs[_0x32ef7e('0x5')](_0x7b076f))return _0x7b076f;return writeFile(_0x57744d,_0x7b076f)[_0x32ef7e('0x45')](function(){return _0x7b076f;});}else throw new ValidationError(_0x32ef7e('0x57'));})['then'](function(_0x5a1b5a){const _0x34e569=_0x270165;return _0x4ea022[_0x34e569('0x33')](_0x5a1b5a);})[_0x270165('0x25')](handleError(_0x4ea022));};
\ No newline at end of file
+const a771_0x5ad4=['fileText','rawAttributes','findOne','map','.txt','type','unlink','json','isNil','location','MD5','Bucket','catch','error','key','transcribeRegion','TranscriptionJob','show','cancellazione\x20fisica\x20documento\x20%s','create','VoiceRecording\x20not\x20found','filters','includeAll','transcribeAccountId','uniqueid','.cypher','downloadTranscribe','root','uuid','basename','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','keys','merge','query','undefined','%s.cypher','writeFile','CloudProvider','info','and','sentimentAccountId','lodash','sequelize','language','Location','destroy','Setting','update','VoiceRecording','runTranscribe','Cloud\x20Provider\x20not\x20configured','filename','params','where','findAll','send','../../config/logger','bucket','../../mysqldb','stack','Cloud\x20Provider\x20not\x20available','error-middleware/errors','order','runSentiment','model','include','fieldName','filter','recording','set','data1','Transcript\x20not\x20available','data2','fields','decryptFile','Voice\x20Recording\x20not\x20found','format','sentiment','listBuckets','../../components/encryptor','count','message','transcribe','$and','secrets','existsSync','sentimentRegion','upload','describe','readFileSync','../../components/parsers/qs','File:\x20\x22','TranscriptionJobStatus','transcribeStatus','tempSentiment','token','pick','intersection','startTranscriptionJob','Content-Range','sendStatus','createBucket','length','aws-sdk','Entity\x20not\x20found','Sentiment\x20Analysis\x20not\x20configured','status','end','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','body','index','options','TranscribeService','util','unlinkSync','VIRTUAL','limit','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','attributes','find','../../config/environment','download','then','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','name','differenceBy','value','/server/files/transcribes/transcribe_','sort','api','path','TranscriptionJobName','offset'];(function(_0x3053a4,_0x5ad439){const _0xf381a8=function(_0x4fc9a2){while(--_0x4fc9a2){_0x3053a4['push'](_0x3053a4['shift']());}};_0xf381a8(++_0x5ad439);}(a771_0x5ad4,0x1bd));const a771_0xf381=function(_0x3053a4,_0x5ad439){_0x3053a4=_0x3053a4-0x0;let _0xf381a8=a771_0x5ad4[_0x3053a4];return _0xf381a8;};const _0x21d352=a771_0xf381;'use strict';const util=require(_0x21d352('0x49')),path=require(_0x21d352('0x5c')),fs=require('fs'),_=require(_0x21d352('0x1')),AWS=require(_0x21d352('0x3f')),{v4:uuidv4}=require(_0x21d352('0x7b')),qs=require(_0x21d352('0x32')),logger=require(_0x21d352('0x10'))(_0x21d352('0x5b')),config=require(_0x21d352('0x52')),db=require(_0x21d352('0x12'))['db'],{Op,fn,col,ValidationError}=require(_0x21d352('0x2')),{InternalError}=require(_0x21d352('0x15'));function respondWithResult(_0x4fc9a2,_0x5c5c24){return _0x5c5c24=_0x5c5c24||0xc8,function(_0x58bc32){if(_0x58bc32)return _0x4fc9a2['status'](_0x5c5c24)['json'](_0x58bc32);};}function respondWithFilteredResult(_0x479d02,_0xba988e){return function(_0x876004){const _0x2dce3a=a771_0xf381;if(_0x876004){const _0x37b274=_0x876004[_0x2dce3a('0x28')],_0x2fe137=_0xba988e[_0x2dce3a('0x5e')];let _0x2d05ed=_0xba988e[_0x2dce3a('0x5e')]+_0xba988e[_0x2dce3a('0x4c')],_0x534ac6;return _0x2d05ed>=_0x37b274?(_0x2d05ed=_0x37b274,_0x534ac6=0xc8):_0x534ac6=0xce,_0x479d02[_0x2dce3a('0x42')](_0x534ac6),_0x479d02[_0x2dce3a('0x1d')](_0x2dce3a('0x3b'),_0x2fe137+'-'+_0x2d05ed+'/'+_0x37b274)[_0x2dce3a('0x66')](_0x876004);}return null;};}function saveUpdates(_0x40cbee){return function(_0x35d3a2){const _0x31e8a4=a771_0xf381;if(_0x35d3a2)return _0x35d3a2[_0x31e8a4('0x7')](_0x40cbee)[_0x31e8a4('0x54')](function(_0xb8c0e3){return _0xb8c0e3;});return null;};}function handleEntityNotFound(_0x37d6f9){return function(_0xe868d6){const _0x8e9395=a771_0xf381;return!_0xe868d6&&_0x37d6f9[_0x8e9395('0x3c')](0x194),_0xe868d6;};}function handleError(_0xacc9e0,_0x267b40){return _0x267b40=_0x267b40||0x1f4,function(_0x4d311e){const _0x16a52d=a771_0xf381;logger[_0x16a52d('0x6c')](_0x4d311e[_0x16a52d('0x13')]),_0x4d311e[_0x16a52d('0x56')]&&delete _0x4d311e['name'],_0xacc9e0[_0x16a52d('0x42')](_0x267b40)[_0x16a52d('0xf')](_0x4d311e);};}exports[_0x21d352('0x46')]=function(_0x5865f7,_0x3559b2){const _0x3aa95b=_0x21d352;let _0x4d369b={};const _0x5a765d={},_0x68f448={'count':0x0,'rows':[]},_0x2116a6=_[_0x3aa95b('0x62')](db[_0x3aa95b('0x8')][_0x3aa95b('0x60')],function(_0x416dc9){const _0x5c5371=_0x3aa95b;return{'name':_0x416dc9[_0x5c5371('0x1a')],'type':_0x416dc9['type'][_0x5c5371('0x6d')]};});_0x5a765d[_0x3aa95b('0x18')]=_[_0x3aa95b('0x57')](_[_0x3aa95b('0x62')](_0x2116a6,'name'),['format']),_0x5a765d['query']=_[_0x3aa95b('0x7e')](_0x5865f7[_0x3aa95b('0x80')]),_0x5a765d[_0x3aa95b('0x74')]=_['intersection'](_0x5a765d['model'],_0x5a765d[_0x3aa95b('0x80')]),_0x4d369b[_0x3aa95b('0x50')]=_[_0x3aa95b('0x39')](_0x5a765d[_0x3aa95b('0x18')],qs[_0x3aa95b('0x21')](_0x5865f7['query']['fields'])),_0x4d369b[_0x3aa95b('0x50')]=_0x4d369b[_0x3aa95b('0x50')][_0x3aa95b('0x3e')]?_0x4d369b['attributes']:_0x5a765d[_0x3aa95b('0x18')];typeof _0x5865f7[_0x3aa95b('0x80')]['nolimit']===_0x3aa95b('0x81')&&(_0x4d369b['limit']=qs[_0x3aa95b('0x4c')](_0x5865f7[_0x3aa95b('0x80')][_0x3aa95b('0x4c')]),_0x4d369b['offset']=qs[_0x3aa95b('0x5e')](_0x5865f7[_0x3aa95b('0x80')][_0x3aa95b('0x5e')]));_0x4d369b[_0x3aa95b('0x16')]=qs[_0x3aa95b('0x5a')](_0x5865f7[_0x3aa95b('0x80')][_0x3aa95b('0x5a')]),_0x4d369b['where']=qs[_0x3aa95b('0x74')](_[_0x3aa95b('0x38')](_0x5865f7['query'],_0x5a765d[_0x3aa95b('0x74')]),_0x2116a6);_0x5865f7['query'][_0x3aa95b('0x1b')]&&(_0x4d369b[_0x3aa95b('0xd')]=_[_0x3aa95b('0x7f')](_0x4d369b['where'],{[Op['or']]:_['map'](_0x2116a6,function(_0x2f7ab2){const _0x3daa39=_0x3aa95b;if(_0x2f7ab2[_0x3daa39('0x64')]!==_0x3daa39('0x4b')){const _0xb59d4e={};return _0xb59d4e[_0x2f7ab2[_0x3daa39('0x56')]]={[Op['like']]:'%'+_0x5865f7[_0x3daa39('0x80')][_0x3daa39('0x1b')]+'%'},_0xb59d4e;}})}));_0x4d369b=_[_0x3aa95b('0x7f')]({},_0x4d369b,_0x5865f7[_0x3aa95b('0x47')]);const _0x11e885={'where':_0x4d369b[_0x3aa95b('0xd')]};return db[_0x3aa95b('0x8')][_0x3aa95b('0x28')](_0x11e885)[_0x3aa95b('0x54')](function(_0x5bf66a){const _0x2b7bd5=_0x3aa95b;return _0x68f448[_0x2b7bd5('0x28')]=_0x5bf66a,_0x5865f7['query'][_0x2b7bd5('0x75')]&&(_0x4d369b['include']=[{'all':!![]}]),db[_0x2b7bd5('0x8')][_0x2b7bd5('0xe')](_0x4d369b);})['then'](function(_0x371246){return _0x68f448['rows']=_0x371246,_0x68f448;})[_0x3aa95b('0x54')](respondWithFilteredResult(_0x3559b2,_0x4d369b))[_0x3aa95b('0x6b')](handleError(_0x3559b2,null));},exports[_0x21d352('0x70')]=function(_0x331cd4,_0x2c93dd){const _0x4ed168=_0x21d352;let _0x31a647={'raw':![],'where':{'id':_0x331cd4[_0x4ed168('0xc')]['id']}};const _0xd35f0c={};return _0xd35f0c[_0x4ed168('0x18')]=_['keys'](db[_0x4ed168('0x8')][_0x4ed168('0x60')]),_0xd35f0c[_0x4ed168('0x80')]=_[_0x4ed168('0x7e')](_0x331cd4[_0x4ed168('0x80')]),_0xd35f0c[_0x4ed168('0x74')]=_[_0x4ed168('0x39')](_0xd35f0c['model'],_0xd35f0c[_0x4ed168('0x80')]),_0x31a647['attributes']=_[_0x4ed168('0x39')](_0xd35f0c[_0x4ed168('0x18')],qs[_0x4ed168('0x21')](_0x331cd4[_0x4ed168('0x80')][_0x4ed168('0x21')])),_0x31a647[_0x4ed168('0x50')]=_0x31a647[_0x4ed168('0x50')]['length']?_0x31a647[_0x4ed168('0x50')]:_0xd35f0c[_0x4ed168('0x18')],_0x331cd4[_0x4ed168('0x80')][_0x4ed168('0x75')]&&(_0x31a647[_0x4ed168('0x19')]=[{'all':!![]}]),_0x31a647=_[_0x4ed168('0x7f')]({},_0x31a647,_0x331cd4[_0x4ed168('0x47')]),db[_0x4ed168('0x8')]['findOne'](_0x31a647)[_0x4ed168('0x54')](handleEntityNotFound(_0x2c93dd,null))[_0x4ed168('0x54')](respondWithResult(_0x2c93dd,null))[_0x4ed168('0x6b')](handleError(_0x2c93dd,null));},exports[_0x21d352('0x72')]=function(_0x3b8f63,_0x26c664){const _0x34ab52=_0x21d352;return db[_0x34ab52('0x8')][_0x34ab52('0x72')](_0x3b8f63['body'],{})[_0x34ab52('0x54')](respondWithResult(_0x26c664,0xc9))[_0x34ab52('0x6b')](handleError(_0x26c664,null));},exports[_0x21d352('0x7')]=function(_0x380060,_0x42db0d){const _0xf752b9=_0x21d352;return _0x380060[_0xf752b9('0x45')]['id']&&delete _0x380060[_0xf752b9('0x45')]['id'],db['VoiceRecording']['findOne']({'where':{'id':_0x380060['params']['id']}})[_0xf752b9('0x54')](handleEntityNotFound(_0x42db0d,null))[_0xf752b9('0x54')](saveUpdates(_0x380060[_0xf752b9('0x45')],null))[_0xf752b9('0x54')](respondWithResult(_0x42db0d,null))[_0xf752b9('0x6b')](handleError(_0x42db0d,null));},exports[_0x21d352('0x30')]=function(_0x5da84f,_0x994b3a){const _0x3092ca=_0x21d352;return db[_0x3092ca('0x8')][_0x3092ca('0x30')]()[_0x3092ca('0x54')](respondWithResult(_0x994b3a,null))[_0x3092ca('0x6b')](handleError(_0x994b3a,null));},exports[_0x21d352('0x53')]=function(_0x370352,_0x2f27af){const _0x55b38f=_0x21d352,_0x1d3caf=require(_0x55b38f('0x27'));let _0x73d032=![];const _0x53b5c9={};return _0x370352[_0x55b38f('0x80')][_0x55b38f('0x64')]&&_0x370352['query'][_0x55b38f('0x64')]===_0x55b38f('0x77')?_0x53b5c9[_0x55b38f('0x77')]=_0x370352[_0x55b38f('0xc')]['id']:_0x53b5c9['id']=_0x370352[_0x55b38f('0xc')]['id'],db[_0x55b38f('0x8')][_0x55b38f('0x61')]({'where':_0x53b5c9,'attributes':['id',_0x55b38f('0x58')],'raw':!![]})[_0x55b38f('0x54')](handleEntityNotFound(_0x2f27af,null))[_0x55b38f('0x54')](function(_0x5adb5e){const _0x57e1a2=_0x55b38f;if(_0x5adb5e){const _0x1a0a60=_0x5adb5e[_0x57e1a2('0x58')],_0x26fe6c=util[_0x57e1a2('0x24')](_0x57e1a2('0x82'),_0x1a0a60);if(fs[_0x57e1a2('0x2d')](_0x26fe6c))return _0x73d032=!![],_0x1d3caf['decryptFile'](_0x26fe6c,_0x1a0a60,config[_0x57e1a2('0x2c')][_0x57e1a2('0x1c')])['then'](function(){return _0x5adb5e;});return _0x5adb5e;}})['then'](function(_0x2043bb){const _0x459579=_0x55b38f;if(_0x2043bb){const _0x50b68b=_0x2043bb[_0x459579('0x58')];if(!fs[_0x459579('0x2d')](_0x50b68b))throw new ValidationError('VoiceRecording\x20not\x20found');return _0x2043bb[_0x459579('0xb')]?_0x2f27af[_0x459579('0x53')](_0x50b68b,_0x2043bb['filename']+path['extname'](_0x50b68b),function(){const _0x4a44a4=_0x459579;_0x73d032&&fs[_0x4a44a4('0x65')](_0x50b68b);}):_0x2f27af[_0x459579('0x53')](_0x50b68b,function(){const _0x599beb=_0x459579;_0x73d032&&fs[_0x599beb('0x65')](_0x50b68b);});}})[_0x55b38f('0x6b')](function(_0x433b3b){const _0x40538=_0x55b38f;if(_0x433b3b[_0x40538('0x29')]===_0x40538('0x73'))_0x2f27af[_0x40538('0x42')](0x194)[_0x40538('0xf')]('Not\x20found');else return handleError(_0x2f27af,null);});},exports['downloads']=function(_0x2ce62b,_0x1eb68){const _0x287033=_0x21d352,_0x182d73=require(_0x287033('0x27'));let _0x4e9218=![];const _0x4714b9={[Op[_0x287033('0x86')]]:[_0x4714b9(fn(_0x287033('0x69'),col('uniqueid')),_0x2ce62b[_0x287033('0x80')][_0x287033('0x37')])]};return _0x2ce62b['query'][_0x287033('0x64')]&&_0x2ce62b['query'][_0x287033('0x64')]==='uniqueid'?_0x4714b9[_0x287033('0x2b')]['push']({'uniqueid':_0x2ce62b[_0x287033('0xc')]['id']}):_0x4714b9[_0x287033('0x2b')]['push']({'id':_0x2ce62b[_0x287033('0xc')]['id']}),db[_0x287033('0x8')][_0x287033('0x61')]({'where':_0x4714b9,'attributes':['id',_0x287033('0x58')],'raw':!![]})[_0x287033('0x54')](handleEntityNotFound(_0x1eb68,null))[_0x287033('0x54')](function(_0xd77859){const _0x38764e=_0x287033;if(_0xd77859){const _0x13609f=util['format'](_0x38764e('0x82'),_0xd77859['value']);if(fs['existsSync'](_0x13609f))return _0x4e9218=!![],_0x182d73[_0x38764e('0x22')](_0x13609f,_0xd77859['value'],config[_0x38764e('0x2c')][_0x38764e('0x1c')])[_0x38764e('0x54')](function(){return _0xd77859;});return _0xd77859;}})[_0x287033('0x54')](function(_0xcd72a4){const _0x2bdd94=_0x287033;if(_0xcd72a4){if(!fs[_0x2bdd94('0x2d')](_0xcd72a4[_0x2bdd94('0x58')]))throw new ValidationError(_0x2bdd94('0x73'));return _0xcd72a4[_0x2bdd94('0xb')]?_0x1eb68[_0x2bdd94('0x53')](_0xcd72a4['value'],_0xcd72a4[_0x2bdd94('0xb')]+path['extname'](_0xcd72a4[_0x2bdd94('0x58')]),function(){const _0xb8cba7=_0x2bdd94;_0x4e9218&&fs['unlink'](_0xcd72a4[_0xb8cba7('0x58')]);}):_0x1eb68['download'](_0xcd72a4['value'],function(){const _0x59bb7e=_0x2bdd94;_0x4e9218&&fs[_0x59bb7e('0x65')](_0xcd72a4[_0x59bb7e('0x58')]);});}})[_0x287033('0x6b')](handleError(_0x1eb68,null));},exports[_0x21d352('0x5')]=function(_0x1e5fe9,_0x510ba9){const _0x16450=_0x21d352;return db[_0x16450('0x8')][_0x16450('0x61')]({'where':{'id':_0x1e5fe9[_0x16450('0xc')]['id']}})[_0x16450('0x54')](function(_0x39b484){const _0x1f5a1f=_0x16450;if(!_0x39b484)throw new ReferenceError(_0x1f5a1f('0x40'));return _0x39b484;})['then'](function(_0x1c4bc3){const _0x589201=_0x16450;let _0x39fb4e=_0x1c4bc3[_0x589201('0x58')];return logger[_0x589201('0x85')](_0x589201('0x71'),_0x39fb4e),!_[_0x589201('0x67')](_0x1c4bc3[_0x589201('0x58')])&&fs[_0x589201('0x2d')](_0x39fb4e)&&(logger[_0x589201('0x85')](_0x589201('0x33')+_0x39fb4e+_0x589201('0x4e')),fs[_0x589201('0x4a')](_0x39fb4e)),_0x39fb4e=_0x39fb4e+_0x589201('0x78'),!_['isNil'](_0x1c4bc3[_0x589201('0x58')])&&fs['existsSync'](_0x39fb4e)&&(logger[_0x589201('0x85')](_0x589201('0x33')+_0x39fb4e+_0x589201('0x4e')),fs[_0x589201('0x4a')](_0x39fb4e)),_0x1c4bc3;})[_0x16450('0x54')](function(_0x5c128b){const _0x1c20c9=_0x16450;if(!_0x5c128b)throw new InternalError();return _0x5c128b[_0x1c20c9('0x5')]();})[_0x16450('0x54')](function(){const _0x48f446=_0x16450;_0x510ba9[_0x48f446('0x42')](0xcc)[_0x48f446('0x43')]();})['catch'](handleError(_0x510ba9,null));};function getBucketslist(_0x174977,_0xea8985,_0x15046a){return new Promise(function(_0xb1fea9,_0x5acaf6){const _0x511849=a771_0xf381,_0x22fca=new AWS['S3']({'accessKeyId':_0xea8985,'secretAccessKey':_0x174977,'region':_0x15046a});_0x22fca[_0x511849('0x26')]({},function(_0x286d73,_0x452f21){return _0x286d73?_0x5acaf6(_0x286d73):_0xb1fea9(_0x452f21);});});}function createBucket(_0x2d994e,_0xa74edd,_0x5a5edf,_0x28a8aa){return new Promise(function(_0x1df914,_0xc80eeb){const _0x260601=a771_0xf381,_0x278f95=new AWS['S3']({'accessKeyId':_0xa74edd,'secretAccessKey':_0x2d994e,'region':_0x5a5edf});_0x278f95[_0x260601('0x3d')]({'Bucket':_0x28a8aa},function(_0x54d1ba,_0x26bdaa){return _0x54d1ba?_0xc80eeb(_0x54d1ba):_0x1df914(_0x26bdaa);});});}function uploadFile(_0x511313,_0x2f4f24,_0x2cbc5d,_0x4b58df,_0x62d1fc,_0x463546){return new Promise(function(_0x3b0a1a,_0x12233f){const _0xb09e63=a771_0xf381,_0x3e52c7=new AWS['S3']({'accessKeyId':_0x2f4f24,'secretAccessKey':_0x511313,'region':_0x2cbc5d});_0x3e52c7[_0xb09e63('0x2f')]({'Bucket':_0x4b58df,'Key':_0x62d1fc,'Body':_0x463546},function(_0x180293,_0x15f399){return _0x180293?_0x12233f(_0x180293):_0x3b0a1a(_0x15f399);});});}function startTranscribe(_0x44d6d5,_0x17332b,_0x4b7a3b,_0x87088e,_0x18ab82,_0x2859bc){return new Promise(function(_0x4a860b,_0xf29b8){const _0x9d0628=a771_0xf381,_0x313fd3=new AWS[(_0x9d0628('0x48'))]({'accessKeyId':_0x17332b,'secretAccessKey':_0x44d6d5,'region':_0x4b7a3b});_0x313fd3[_0x9d0628('0x3a')]({'TranscriptionJobName':_0x87088e,'LanguageCode':_0x18ab82,'Media':{'MediaFileUri':_0x2859bc}},function(_0x252181,_0x5b5930){return _0x252181?_0xf29b8(_0x252181):_0x4a860b(_0x5b5930);});});}function transcribe(_0x1d24e4,_0x364437,_0x3b2977,_0xdced15,_0x45afa9,_0x28fe2f,_0x4a1eb8){return new Promise(function(_0xbe3fbf,_0xa8334e){const _0x282ae4=a771_0xf381,_0x5ed279={};return logger['info'](util[_0x282ae4('0x24')](_0x282ae4('0x7d'),_0x1d24e4,_0x45afa9)),uploadFile(_0x364437,_0x3b2977,_0xdced15,_0x45afa9,path[_0x282ae4('0x7c')](_0x28fe2f),fs[_0x282ae4('0x31')](_0x28fe2f))['then'](function(_0x216ff0){const _0x24ec43=_0x282ae4;return logger[_0x24ec43('0x85')](util[_0x24ec43('0x24')](_0x24ec43('0x44'),_0x1d24e4,_0x45afa9,_0x216ff0[_0x24ec43('0x4')])),_0x5ed279[_0x24ec43('0x11')]=_0x216ff0[_0x24ec43('0x6a')],_0x5ed279[_0x24ec43('0x68')]=_0x216ff0[_0x24ec43('0x4')],logger[_0x24ec43('0x85')](util['format'](_0x24ec43('0x4d'),_0x1d24e4)),startTranscribe(_0x364437,_0x3b2977,_0xdced15,uuidv4(),_0x4a1eb8,_0x216ff0[_0x24ec43('0x4')]);})['then'](function(_0x13e4ee){const _0x52663d=_0x282ae4;return logger[_0x52663d('0x85')](util[_0x52663d('0x24')](_0x52663d('0x55'),_0x1d24e4,_0x13e4ee[_0x52663d('0x6f')][_0x52663d('0x5d')])),_0x5ed279['transcribeName']=_0x13e4ee[_0x52663d('0x6f')][_0x52663d('0x5d')],_0x5ed279[_0x52663d('0x35')]=_0x13e4ee[_0x52663d('0x6f')][_0x52663d('0x34')],_0xbe3fbf(_0x5ed279);})['catch'](function(_0x364408){return _0xa8334e(_0x364408);});});}exports[_0x21d352('0x9')]=function(_0x4ee923,_0x25c90c){const _0x417c64=_0x21d352;let _0x40f0e8,_0x2cea1e,_0x118e4f;const _0x427913=require(_0x417c64('0x27'));return db[_0x417c64('0x8')][_0x417c64('0x61')]({'where':{'id':_0x4ee923['params']['id']}})['then'](function(_0x3a717c){const _0x4f170f=_0x417c64;if(_0x3a717c){const _0x5a36e6=util[_0x4f170f('0x24')](_0x4f170f('0x82'),_0x3a717c[_0x4f170f('0x58')]);if(fs[_0x4f170f('0x2d')](_0x5a36e6))return _0x427913[_0x4f170f('0x22')](_0x5a36e6,_0x3a717c['value'],config[_0x4f170f('0x2c')][_0x4f170f('0x1c')])[_0x4f170f('0x54')](function(){return _0x3a717c;});return _0x3a717c;}})[_0x417c64('0x54')](function(_0x1069de){const _0x955044=_0x417c64;if(!_0x1069de)throw new ValidationError(_0x955044('0x23'));return _0x2cea1e=_0x1069de,db[_0x955044('0x6')][_0x955044('0x61')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x25c90c,null))[_0x417c64('0x54')](function(_0x4ea862){const _0x4bae46=_0x417c64;if(_0x4ea862){_0x40f0e8=_0x4ea862;if(!_0x40f0e8[_0x4bae46('0x2a')]||!_0x40f0e8[_0x4bae46('0x76')]||!_0x40f0e8[_0x4bae46('0x6e')]||!_0x40f0e8[_0x4bae46('0x3')]||!_0x40f0e8[_0x4bae46('0x11')])throw new ValidationError('Transcribe\x20not\x20configured');if(_0x4ee923[_0x4bae46('0x45')][_0x4bae46('0x17')]&&(!_0x40f0e8[_0x4bae46('0x25')]||!_0x40f0e8[_0x4bae46('0x0')]||!_0x40f0e8[_0x4bae46('0x2e')]||!_0x40f0e8[_0x4bae46('0x3')]||!_0x40f0e8[_0x4bae46('0x11')]))throw new ValidationError(_0x4bae46('0x41'));return db[_0x4bae46('0x84')][_0x4bae46('0x61')]({'where':{'id':_0x40f0e8[_0x4bae46('0x76')]}});}})['then'](function(_0x4d9e60){const _0x52e646=_0x417c64;if(!_0x4d9e60)throw new ValidationError(_0x52e646('0x14'));if(!_0x4d9e60[_0x52e646('0x1e')]||!_0x4d9e60[_0x52e646('0x20')])throw new ValidationError(_0x52e646('0xa'));return _0x118e4f=_0x4d9e60,getBucketslist(_0x118e4f[_0x52e646('0x1e')],_0x118e4f[_0x52e646('0x20')],_0x40f0e8[_0x52e646('0x6e')]);})['then'](function(_0x245899){const _0x1c6cef=_0x417c64;if(_0x245899&&_0x245899['Buckets']){const _0x32e2f2=_[_0x1c6cef('0x51')](_0x245899['Buckets'],function(_0x11325f){const _0x1aabe5=_0x1c6cef;return _0x11325f['Name']===_0x40f0e8[_0x1aabe5('0x11')];});if(!_0x32e2f2)return logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4ee923[_0x1c6cef('0xc')]['id'],_0x40f0e8[_0x1c6cef('0x11')])),createBucket(_0x118e4f['data1'],_0x118e4f[_0x1c6cef('0x20')],_0x40f0e8[_0x1c6cef('0x6e')],_0x40f0e8[_0x1c6cef('0x11')]);logger[_0x1c6cef('0x85')](util[_0x1c6cef('0x24')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4ee923[_0x1c6cef('0xc')]['id'],_0x40f0e8[_0x1c6cef('0x11')]));return;}})[_0x417c64('0x54')](function(){const _0x41293e=_0x417c64;return _0x2cea1e['transcribeStatus']==='NEW'?transcribe(_0x4ee923[_0x41293e('0xc')]['id'],_0x118e4f[_0x41293e('0x1e')],_0x118e4f[_0x41293e('0x20')],_0x40f0e8[_0x41293e('0x6e')],_0x40f0e8[_0x41293e('0x11')],_0x2cea1e[_0x41293e('0x58')],_0x40f0e8['language']):(logger['info'](util['format'](_0x41293e('0x4f'),_0x4ee923[_0x41293e('0xc')]['id'])),{'transcribeStatus':'IN_PROGRESS'});})[_0x417c64('0x54')](function(_0x4cab98){const _0x17eebc=_0x417c64;if(_0x4cab98)return _0x4cab98[_0x17eebc('0x36')]=_0x4ee923[_0x17eebc('0x45')][_0x17eebc('0x17')],_0x2cea1e['update'](_0x4cab98);})[_0x417c64('0x54')](respondWithResult(_0x25c90c,null))['catch'](handleError(_0x25c90c,null));};function writeFile(_0x1312f0,_0x167919){return new Promise(function(_0x385d66,_0x33bddc){const _0x11b8d0=a771_0xf381;fs[_0x11b8d0('0x83')](_0x167919,_0x1312f0,function(_0x39dfba,_0x376ed5){return _0x39dfba?_0x33bddc(_0x39dfba):_0x385d66(_0x376ed5);});});}exports[_0x21d352('0x79')]=function(_0xba70ea,_0x120667){const _0x46ddc2=_0x21d352;return db[_0x46ddc2('0x8')]['findOne']({'where':{'id':_0xba70ea[_0x46ddc2('0xc')]['id']}})[_0x46ddc2('0x54')](handleEntityNotFound(_0x120667))[_0x46ddc2('0x54')](function(_0x44566c){const _0x403929=_0x46ddc2;if(_0x44566c&&_0x44566c[_0x403929('0x5f')]){const _0x120c6a=_0x44566c[_0x403929('0x5f')],_0x506e55=config[_0x403929('0x7a')]+_0x403929('0x59')+_0x44566c['id']+_0x403929('0x63');if(fs['existsSync'](_0x506e55))return _0x506e55;return writeFile(_0x120c6a,_0x506e55)['then'](function(){return _0x506e55;});}else throw new ValidationError(_0x403929('0x1f'));})[_0x46ddc2('0x54')](function(_0x24b685){const _0x560e6b=_0x46ddc2;return _0x120667[_0x560e6b('0x53')](_0x24b685);})['catch'](handleError(_0x120667));};
\ No newline at end of file