Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / api / voiceRecording / voiceRecording.controller.js
index aab8640..4b51886 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd94b=['TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','download','uniqueid','value','%s.cypher','decryptFile','recording','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','push','$and','existsSync','secrets','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xd94b,0xbf));var _0xbd94=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0xd94b[_0x56fb33];return _0x435ee4;};'use strict';var pdf=require(_0xbd94('0x0'));var emlformat=require(_0xbd94('0x1'));var rimraf=require(_0xbd94('0x2'));var zipdir=require(_0xbd94('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd94('0x4'));var moment=require(_0xbd94('0x5'));var BPromise=require(_0xbd94('0x6'));var Mustache=require(_0xbd94('0x7'));var util=require('util');var path=require(_0xbd94('0x8'));var sox=require(_0xbd94('0x9'));var csv=require(_0xbd94('0xa'));var ejs=require(_0xbd94('0xb'));var fs=require('fs');var _=require(_0xbd94('0xc'));var squel=require(_0xbd94('0xd'));var crypto=require(_0xbd94('0xe'));var jsforce=require(_0xbd94('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbd94('0xa'));var querystring=require(_0xbd94('0x10'));var Papa=require(_0xbd94('0x11'));var AWS=require(_0xbd94('0x12'));var uuidv4=require(_0xbd94('0x13'));var Redis=require(_0xbd94('0x14'));var authService=require(_0xbd94('0x15'));var qs=require(_0xbd94('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd94('0x17'));var logger=require(_0xbd94('0x18'))('api');var utils=require(_0xbd94('0x19'));var config=require(_0xbd94('0x1a'));var licenseUtil=require(_0xbd94('0x1b'));var db=require(_0xbd94('0x1c'))['db'];function respondWithStatusCode(_0x3fe88c,_0x1fcd1c){_0x1fcd1c=_0x1fcd1c||0xcc;return function(_0x42faa3){if(_0x42faa3){return _0x3fe88c[_0xbd94('0x1d')](_0x1fcd1c);}return _0x3fe88c[_0xbd94('0x1e')](_0x1fcd1c)[_0xbd94('0x1f')]();};}function respondWithResult(_0x3c159a,_0x2bb7ad){_0x2bb7ad=_0x2bb7ad||0xc8;return function(_0xe7d81b){if(_0xe7d81b){return _0x3c159a['status'](_0x2bb7ad)[_0xbd94('0x20')](_0xe7d81b);}};}function respondWithFilteredResult(_0x365b0b,_0x26b981){return function(_0x3715e5){if(_0x3715e5){var _0x5707c4=_0x3715e5[_0xbd94('0x21')],_0xdb778e=_0x26b981[_0xbd94('0x22')],_0x9f5e75=_0x26b981[_0xbd94('0x22')]+_0x26b981['limit'],_0x210725;if(_0x9f5e75>=_0x5707c4){_0x9f5e75=_0x5707c4;_0x210725=0xc8;}else{_0x210725=0xce;}_0x365b0b[_0xbd94('0x1e')](_0x210725);return _0x365b0b[_0xbd94('0x23')](_0xbd94('0x24'),_0xdb778e+'-'+_0x9f5e75+'/'+_0x5707c4)[_0xbd94('0x20')](_0x3715e5);}return null;};}function patchUpdates(_0x365ebb){return function(_0x4b1d0e){try{jsonpatch[_0xbd94('0x25')](_0x4b1d0e,_0x365ebb,!![]);}catch(_0x52270f){return BPromise[_0xbd94('0x26')](_0x52270f);}return _0x4b1d0e[_0xbd94('0x27')]();};}function saveUpdates(_0x1fbe9a,_0x5641a4){return function(_0x45b664){if(_0x45b664){return _0x45b664[_0xbd94('0x28')](_0x1fbe9a)['then'](function(_0xece059){return _0xece059;});}return null;};}function removeEntity(_0x469489,_0x2a8958){return function(_0x48e29a){if(_0x48e29a){return _0x48e29a['destroy']()[_0xbd94('0x29')](function(){_0x469489[_0xbd94('0x1e')](0xcc)[_0xbd94('0x1f')]();});}};}function handleEntityNotFound(_0x39ee6d,_0xd8b68d){return function(_0x509738){if(!_0x509738){_0x39ee6d[_0xbd94('0x1d')](0x194);}return _0x509738;};}function handleError(_0x1388e9,_0x3c46e6){_0x3c46e6=_0x3c46e6||0x1f4;return function(_0x31ac23){logger[_0xbd94('0x2a')](_0x31ac23[_0xbd94('0x2b')]);if(_0x31ac23[_0xbd94('0x2c')]){delete _0x31ac23['name'];}_0x1388e9[_0xbd94('0x1e')](_0x3c46e6)[_0xbd94('0x2d')](_0x31ac23);};}exports[_0xbd94('0x2e')]=function(_0x3ad5e6,_0x189a1e){var _0x3bf653={},_0x4fbf36={},_0x36335b={'count':0x0,'rows':[]};var _0x259c20=_[_0xbd94('0x2f')](db[_0xbd94('0x30')][_0xbd94('0x31')],function(_0x298bd0){return{'name':_0x298bd0[_0xbd94('0x32')],'type':_0x298bd0[_0xbd94('0x33')]['key']};});_0x4fbf36[_0xbd94('0x34')]=_[_0xbd94('0x35')](_[_0xbd94('0x2f')](_0x259c20,_0xbd94('0x2c')),[_0xbd94('0x36')]);_0x4fbf36[_0xbd94('0x37')]=_[_0xbd94('0x38')](_0x3ad5e6[_0xbd94('0x37')]);_0x4fbf36['filters']=_[_0xbd94('0x39')](_0x4fbf36['model'],_0x4fbf36[_0xbd94('0x37')]);_0x3bf653['attributes']=_[_0xbd94('0x39')](_0x4fbf36[_0xbd94('0x34')],qs[_0xbd94('0x3a')](_0x3ad5e6[_0xbd94('0x37')][_0xbd94('0x3a')]));_0x3bf653[_0xbd94('0x3b')]=_0x3bf653['attributes'][_0xbd94('0x3c')]?_0x3bf653[_0xbd94('0x3b')]:_0x4fbf36[_0xbd94('0x34')];if(!_0x3ad5e6[_0xbd94('0x37')][_0xbd94('0x3d')](_0xbd94('0x3e'))){_0x3bf653[_0xbd94('0x3f')]=qs[_0xbd94('0x3f')](_0x3ad5e6[_0xbd94('0x37')][_0xbd94('0x3f')]);_0x3bf653[_0xbd94('0x22')]=qs[_0xbd94('0x22')](_0x3ad5e6[_0xbd94('0x37')][_0xbd94('0x22')]);}_0x3bf653[_0xbd94('0x40')]=qs[_0xbd94('0x41')](_0x3ad5e6[_0xbd94('0x37')][_0xbd94('0x41')]);_0x3bf653[_0xbd94('0x42')]=qs[_0xbd94('0x43')](_[_0xbd94('0x44')](_0x3ad5e6[_0xbd94('0x37')],_0x4fbf36[_0xbd94('0x43')]),_0x259c20);if(_0x3ad5e6['query'][_0xbd94('0x45')]){_0x3bf653[_0xbd94('0x42')]=_['merge'](_0x3bf653['where'],{'$or':_[_0xbd94('0x2f')](_0x259c20,function(_0x65b1c1){if(_0x65b1c1[_0xbd94('0x33')]!==_0xbd94('0x46')){var _0x34eb56={};_0x34eb56[_0x65b1c1[_0xbd94('0x2c')]]={'$like':'%'+_0x3ad5e6[_0xbd94('0x37')]['filter']+'%'};return _0x34eb56;}})});}_0x3bf653=_[_0xbd94('0x47')]({},_0x3bf653,_0x3ad5e6[_0xbd94('0x48')]);var _0x5deb3b={'where':_0x3bf653['where']};return db[_0xbd94('0x30')]['count'](_0x5deb3b)[_0xbd94('0x29')](function(_0x40adc0){_0x36335b[_0xbd94('0x21')]=_0x40adc0;if(_0x3ad5e6[_0xbd94('0x37')][_0xbd94('0x49')]){_0x3bf653[_0xbd94('0x4a')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x3bf653);})[_0xbd94('0x29')](function(_0xe0cf68){_0x36335b[_0xbd94('0x4b')]=_0xe0cf68;return _0x36335b;})[_0xbd94('0x29')](respondWithFilteredResult(_0x189a1e,_0x3bf653))[_0xbd94('0x4c')](handleError(_0x189a1e,null));};exports[_0xbd94('0x4d')]=function(_0x299b23,_0x3ee198){var _0x4a7799={'raw':![],'where':{'id':_0x299b23[_0xbd94('0x4e')]['id']}},_0x5eadc0={};_0x5eadc0[_0xbd94('0x34')]=_[_0xbd94('0x38')](db[_0xbd94('0x30')][_0xbd94('0x31')]);_0x5eadc0['query']=_[_0xbd94('0x38')](_0x299b23['query']);_0x5eadc0[_0xbd94('0x43')]=_[_0xbd94('0x39')](_0x5eadc0[_0xbd94('0x34')],_0x5eadc0['query']);_0x4a7799['attributes']=_['intersection'](_0x5eadc0[_0xbd94('0x34')],qs[_0xbd94('0x3a')](_0x299b23[_0xbd94('0x37')][_0xbd94('0x3a')]));_0x4a7799[_0xbd94('0x3b')]=_0x4a7799[_0xbd94('0x3b')][_0xbd94('0x3c')]?_0x4a7799['attributes']:_0x5eadc0[_0xbd94('0x34')];if(_0x299b23['query'][_0xbd94('0x49')]){_0x4a7799[_0xbd94('0x4a')]=[{'all':!![]}];}_0x4a7799=_[_0xbd94('0x47')]({},_0x4a7799,_0x299b23['options']);return db[_0xbd94('0x30')][_0xbd94('0x4f')](_0x4a7799)[_0xbd94('0x29')](handleEntityNotFound(_0x3ee198,null))[_0xbd94('0x29')](respondWithResult(_0x3ee198,null))[_0xbd94('0x4c')](handleError(_0x3ee198,null));};exports[_0xbd94('0x50')]=function(_0x29d6e0,_0x5a14ee){return db[_0xbd94('0x30')]['create'](_0x29d6e0[_0xbd94('0x51')],{})[_0xbd94('0x29')](respondWithResult(_0x5a14ee,0xc9))[_0xbd94('0x4c')](handleError(_0x5a14ee,null));};exports[_0xbd94('0x28')]=function(_0x18235b,_0xb6d727){if(_0x18235b[_0xbd94('0x51')]['id']){delete _0x18235b[_0xbd94('0x51')]['id'];}return db['VoiceRecording'][_0xbd94('0x4f')]({'where':{'id':_0x18235b[_0xbd94('0x4e')]['id']}})[_0xbd94('0x29')](handleEntityNotFound(_0xb6d727,null))[_0xbd94('0x29')](saveUpdates(_0x18235b[_0xbd94('0x51')],null))[_0xbd94('0x29')](respondWithResult(_0xb6d727,null))['catch'](handleError(_0xb6d727,null));};exports[_0xbd94('0x52')]=function(_0x91bfc3,_0x397a59){return db[_0xbd94('0x30')][_0xbd94('0x52')]()[_0xbd94('0x29')](respondWithResult(_0x397a59,null))[_0xbd94('0x4c')](handleError(_0x397a59,null));};exports[_0xbd94('0x53')]=function(_0xf9e694,_0x40b4c2,_0x3c4c43){var _0xaea4c0=require('../../components/encryptor');var _0x586838=![];var _0xca0d49={};if(_0xf9e694[_0xbd94('0x37')][_0xbd94('0x33')]&&_0xf9e694['query'][_0xbd94('0x33')]===_0xbd94('0x54')){_0xca0d49[_0xbd94('0x54')]=_0xf9e694['params']['id'];}else{_0xca0d49['id']=_0xf9e694['params']['id'];}return db[_0xbd94('0x30')][_0xbd94('0x4f')]({'where':_0xca0d49,'attributes':['id',_0xbd94('0x55')],'raw':!![]})[_0xbd94('0x29')](handleEntityNotFound(_0x40b4c2,null))['then'](function(_0x2d5fea){if(_0x2d5fea){var _0x8fe896=_0x2d5fea[_0xbd94('0x55')];var _0x3f3bb8=util[_0xbd94('0x36')](_0xbd94('0x56'),_0x8fe896);if(fs['existsSync'](_0x3f3bb8)){_0x586838=!![];return _0xaea4c0[_0xbd94('0x57')](_0x3f3bb8,_0x8fe896,config['secrets'][_0xbd94('0x58')])['then'](function(){return _0x2d5fea;});}return _0x2d5fea;}})[_0xbd94('0x29')](function(_0x2e2d0e){if(_0x2e2d0e){var _0x1b212d=_0x2e2d0e[_0xbd94('0x55')];if(!fs['existsSync'](_0x1b212d)){throw new db['Sequelize'][(_0xbd94('0x59'))](_0xbd94('0x5a'));}if(_0x2e2d0e['filename']){return _0x40b4c2[_0xbd94('0x53')](_0x1b212d,_0x2e2d0e['filename']+path[_0xbd94('0x5b')](_0x1b212d),function(){if(_0x586838){fs[_0xbd94('0x5c')](_0x1b212d);}});}else{return _0x40b4c2[_0xbd94('0x53')](_0x1b212d,function(_0x4be3b2){if(_0x586838){fs[_0xbd94('0x5c')](_0x1b212d);}});}}})[_0xbd94('0x4c')](function(_0x8fdf7c){if(_0x8fdf7c[_0xbd94('0x5d')]===_0xbd94('0x5a')){_0x40b4c2[_0xbd94('0x1e')](0x194)[_0xbd94('0x2d')](_0xbd94('0x5e'));}else{return handleError(_0x40b4c2,null);}});};exports['downloads']=function(_0x9fdf77,_0x5026dc,_0x428af3){var _0x55f390=require(_0xbd94('0x5f'));var _0x3d3d47=![];var _0x51ee98={'$and':[db[_0xbd94('0x60')][_0xbd94('0x42')](db['sequelize']['fn'](_0xbd94('0x61'),db['sequelize'][_0xbd94('0x62')](_0xbd94('0x54'))),_0x9fdf77[_0xbd94('0x37')][_0xbd94('0x63')])]};if(_0x9fdf77[_0xbd94('0x37')]['type']&&_0x9fdf77[_0xbd94('0x37')][_0xbd94('0x33')]===_0xbd94('0x54')){_0x51ee98['$and'][_0xbd94('0x64')]({'uniqueid':_0x9fdf77['params']['id']});}else{_0x51ee98[_0xbd94('0x65')]['push']({'id':_0x9fdf77['params']['id']});}return db[_0xbd94('0x30')][_0xbd94('0x4f')]({'where':_0x51ee98,'attributes':['id',_0xbd94('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x5026dc,null))[_0xbd94('0x29')](function(_0x20a39b){if(_0x20a39b){var _0x2e2ef0=util[_0xbd94('0x36')](_0xbd94('0x56'),_0x20a39b[_0xbd94('0x55')]);if(fs[_0xbd94('0x66')](_0x2e2ef0)){_0x3d3d47=!![];return _0x55f390['decryptFile'](_0x2e2ef0,_0x20a39b[_0xbd94('0x55')],config[_0xbd94('0x67')][_0xbd94('0x58')])[_0xbd94('0x29')](function(){return _0x20a39b;});}return _0x20a39b;}})[_0xbd94('0x29')](function(_0x9e9353){if(_0x9e9353){if(!fs[_0xbd94('0x66')](_0x9e9353['value'])){throw new db['Sequelize'][(_0xbd94('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x9e9353['filename']){return _0x5026dc[_0xbd94('0x53')](_0x9e9353[_0xbd94('0x55')],_0x9e9353['filename']+path['extname'](_0x9e9353[_0xbd94('0x55')]),function(){if(_0x3d3d47){fs[_0xbd94('0x5c')](_0x9e9353['value']);}});}else{return _0x5026dc[_0xbd94('0x53')](_0x9e9353[_0xbd94('0x55')],function(_0x68f78c){if(_0x3d3d47){fs[_0xbd94('0x5c')](_0x9e9353[_0xbd94('0x55')]);}});}}})[_0xbd94('0x4c')](handleError(_0x5026dc,null));};exports[_0xbd94('0x68')]=function(_0x3120aa,_0x1bfa6b){return db[_0xbd94('0x30')][_0xbd94('0x4f')]({'where':{'id':_0x3120aa['params']['id']}})[_0xbd94('0x29')](function(_0x5988cd){if(!_0x5988cd)throw new ReferenceError(_0xbd94('0x69'));return _0x5988cd;})[_0xbd94('0x29')](function(_0x2bf55c){var _0x43a61c=_0x2bf55c[_0xbd94('0x55')];logger[_0xbd94('0x6a')](_0xbd94('0x6b'),_0x43a61c);if(!_[_0xbd94('0x6c')](_0x2bf55c['value'])&&fs[_0xbd94('0x66')](_0x43a61c)){logger[_0xbd94('0x6a')](_0xbd94('0x6d')+_0x43a61c+_0xbd94('0x6e'));fs[_0xbd94('0x6f')](_0x43a61c);}_0x43a61c=_0x43a61c+'.cypher';if(!_[_0xbd94('0x6c')](_0x2bf55c[_0xbd94('0x55')])&&fs['existsSync'](_0x43a61c)){logger[_0xbd94('0x6a')](_0xbd94('0x6d')+_0x43a61c+_0xbd94('0x6e'));fs[_0xbd94('0x6f')](_0x43a61c);}return _0x2bf55c;})['then'](function(_0x33a7de){if(!_0x33a7de)throw new InternalError();return _0x33a7de[_0xbd94('0x68')]();})['then'](function(){_0x1bfa6b[_0xbd94('0x1e')](0xcc)['end']();})['catch'](handleError(_0x1bfa6b,null));};function getBucketslist(_0xb6759e,_0x253edf,_0x124d6b){return new Promise(function(_0x5be6f8,_0x190f0b){var _0x302332=new AWS['S3']({'accessKeyId':_0x253edf,'secretAccessKey':_0xb6759e,'region':_0x124d6b});_0x302332['listBuckets']({},function(_0x5ceb2e,_0x5e7211){if(_0x5ceb2e){return _0x190f0b(_0x5ceb2e);}else{return _0x5be6f8(_0x5e7211);}});});}function createBucket(_0x276626,_0x183c6d,_0x170a6b,_0x412eb9){return new Promise(function(_0x4c32a5,_0x507f14){var _0x219ea5=new AWS['S3']({'accessKeyId':_0x183c6d,'secretAccessKey':_0x276626,'region':_0x170a6b});_0x219ea5[_0xbd94('0x70')]({'Bucket':_0x412eb9},function(_0x2dc36b,_0x1f1982){if(_0x2dc36b){return _0x507f14(_0x2dc36b);}else{return _0x4c32a5(_0x1f1982);}});});}function uploadFile(_0x15daf1,_0x34a5d5,_0x1afc31,_0x109b9b,_0x24bd4e,_0x1d3da8){return new Promise(function(_0x305d4a,_0x2f3b1d){var _0x27227a=new AWS['S3']({'accessKeyId':_0x34a5d5,'secretAccessKey':_0x15daf1,'region':_0x1afc31});_0x27227a[_0xbd94('0x71')]({'Bucket':_0x109b9b,'Key':_0x24bd4e,'Body':_0x1d3da8},function(_0x23352b,_0x54360d){if(_0x23352b){return _0x2f3b1d(_0x23352b);}else{return _0x305d4a(_0x54360d);}});});}function startTranscribe(_0x2ecc40,_0x5237c1,_0x41d956,_0x57e776,_0x236496,_0x115e86){return new Promise(function(_0x4c2548,_0x7ba422){var _0x416d09=new AWS[(_0xbd94('0x72'))]({'accessKeyId':_0x5237c1,'secretAccessKey':_0x2ecc40,'region':_0x41d956});_0x416d09[_0xbd94('0x73')]({'TranscriptionJobName':_0x57e776,'LanguageCode':_0x236496,'Media':{'MediaFileUri':_0x115e86}},function(_0xf9c73c,_0x292ff6){if(_0xf9c73c){return _0x7ba422(_0xf9c73c);}else{return _0x4c2548(_0x292ff6);}});});}function transcribe(_0x3bf4bb,_0x2a56f4,_0x518394,_0x17bc61,_0x5b4862,_0x5be7b2,_0xe618b){return new Promise(function(_0x2f885f,_0x304f9d){var _0x34859d={};logger[_0xbd94('0x6a')](util[_0xbd94('0x36')](_0xbd94('0x74'),_0x3bf4bb,_0x5b4862));return uploadFile(_0x2a56f4,_0x518394,_0x17bc61,_0x5b4862,path[_0xbd94('0x75')](_0x5be7b2),fs[_0xbd94('0x76')](_0x5be7b2))[_0xbd94('0x29')](function(_0x14ae10){logger[_0xbd94('0x6a')](util['format'](_0xbd94('0x77'),_0x3bf4bb,_0x5b4862,_0x14ae10['Location']));_0x34859d[_0xbd94('0x78')]=_0x14ae10['Bucket'];_0x34859d[_0xbd94('0x79')]=_0x14ae10['Location'];logger['info'](util[_0xbd94('0x36')](_0xbd94('0x7a'),_0x3bf4bb));return startTranscribe(_0x2a56f4,_0x518394,_0x17bc61,uuidv4(),_0xe618b,_0x14ae10[_0xbd94('0x7b')]);})[_0xbd94('0x29')](function(_0x2cfa01){logger[_0xbd94('0x6a')](util['format'](_0xbd94('0x7c'),_0x3bf4bb,_0x2cfa01[_0xbd94('0x7d')][_0xbd94('0x7e')]));_0x34859d[_0xbd94('0x7f')]=_0x2cfa01[_0xbd94('0x7d')][_0xbd94('0x7e')];_0x34859d[_0xbd94('0x80')]=_0x2cfa01[_0xbd94('0x7d')][_0xbd94('0x81')];return _0x2f885f(_0x34859d);})[_0xbd94('0x4c')](function(_0x2306b6){return _0x304f9d(_0x2306b6);});});}exports[_0xbd94('0x82')]=function(_0x483af6,_0x5e3845,_0x157dc4){var _0x2a9370;var _0x2f60e5;var _0x343aa1;var _0x23dcf1=require(_0xbd94('0x5f'));return db[_0xbd94('0x30')][_0xbd94('0x83')]({'where':{'id':_0x483af6[_0xbd94('0x4e')]['id']}})['then'](function(_0x1bd2c3){if(_0x1bd2c3){var _0x547659=util['format']('%s.cypher',_0x1bd2c3['value']);if(fs[_0xbd94('0x66')](_0x547659)){cypher=!![];return _0x23dcf1[_0xbd94('0x57')](_0x547659,_0x1bd2c3[_0xbd94('0x55')],config['secrets'][_0xbd94('0x58')])[_0xbd94('0x29')](function(){return _0x1bd2c3;});}return _0x1bd2c3;}})[_0xbd94('0x29')](function(_0x1847b0){if(!_0x1847b0){throw new db[(_0xbd94('0x84'))][(_0xbd94('0x59'))](_0xbd94('0x85'));}_0x2f60e5=_0x1847b0;return db[_0xbd94('0x86')][_0xbd94('0x83')]({'where':{'id':0x1}});})[_0xbd94('0x29')](handleEntityNotFound(_0x5e3845,null))['then'](function(_0x2c458c){if(_0x2c458c){_0x2a9370=_0x2c458c;if(!_0x2a9370['transcribe']||!_0x2a9370[_0xbd94('0x87')]||!_0x2a9370[_0xbd94('0x88')]||!_0x2a9370['language']||!_0x2a9370['bucket']){throw new db[(_0xbd94('0x84'))][(_0xbd94('0x59'))](_0xbd94('0x89'));}if(_0x483af6[_0xbd94('0x51')][_0xbd94('0x8a')]&&(!_0x2a9370['sentiment']||!_0x2a9370[_0xbd94('0x8b')]||!_0x2a9370['sentimentRegion']||!_0x2a9370[_0xbd94('0x8c')]||!_0x2a9370[_0xbd94('0x78')])){throw new db[(_0xbd94('0x84'))][(_0xbd94('0x59'))](_0xbd94('0x8d'));}return db[_0xbd94('0x8e')][_0xbd94('0x83')]({'where':{'id':_0x2a9370[_0xbd94('0x87')]}});}})[_0xbd94('0x29')](function(_0x222395){if(!_0x222395){throw new db[(_0xbd94('0x84'))][(_0xbd94('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x222395[_0xbd94('0x8f')]||!_0x222395[_0xbd94('0x90')]){throw new db['Sequelize'][(_0xbd94('0x59'))](_0xbd94('0x91'));}_0x343aa1=_0x222395;return getBucketslist(_0x343aa1[_0xbd94('0x8f')],_0x343aa1[_0xbd94('0x90')],_0x2a9370[_0xbd94('0x88')]);})['then'](function(_0x45f2f3){if(_0x45f2f3&&_0x45f2f3[_0xbd94('0x92')]){var _0x4a46c6=_['find'](_0x45f2f3[_0xbd94('0x92')],function(_0x15b598){return _0x15b598[_0xbd94('0x93')]===_0x2a9370[_0xbd94('0x78')];});if(!_0x4a46c6){logger[_0xbd94('0x6a')](util['format'](_0xbd94('0x94'),_0x483af6['params']['id'],_0x2a9370[_0xbd94('0x78')]));return createBucket(_0x343aa1[_0xbd94('0x8f')],_0x343aa1['data2'],_0x2a9370['transcribeRegion'],_0x2a9370[_0xbd94('0x78')]);}logger['info'](util[_0xbd94('0x36')](_0xbd94('0x95'),_0x483af6['params']['id'],_0x2a9370['bucket']));return;}})[_0xbd94('0x29')](function(_0x3875bf){if(_0x2f60e5[_0xbd94('0x80')]==='NEW'){return transcribe(_0x483af6['params']['id'],_0x343aa1[_0xbd94('0x8f')],_0x343aa1[_0xbd94('0x90')],_0x2a9370['transcribeRegion'],_0x2a9370['bucket'],_0x2f60e5[_0xbd94('0x55')],_0x2a9370[_0xbd94('0x8c')]);}else{logger[_0xbd94('0x6a')](util[_0xbd94('0x36')](_0xbd94('0x96'),_0x483af6['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xbd94('0x29')](function(_0x46188){if(_0x46188){_0x46188['tempSentiment']=_0x483af6['body']['runSentiment'];return _0x2f60e5[_0xbd94('0x97')](_0x46188);}})['then'](respondWithResult(_0x5e3845,null))[_0xbd94('0x4c')](handleError(_0x5e3845,null));};function writeFile(_0xaf164f,_0x1f665c){return new Promise(function(_0x2fef96,_0x2d60a6){fs[_0xbd94('0x98')](_0x1f665c,_0xaf164f,function(_0x35e7bd,_0x10ba95){if(_0x35e7bd){return _0x2d60a6(_0x35e7bd);}else{return _0x2fef96(_0x10ba95);}});});}exports[_0xbd94('0x99')]=function(_0x33c247,_0xd8cde5,_0x25afcc){return db[_0xbd94('0x30')][_0xbd94('0x83')]({'where':{'id':_0x33c247[_0xbd94('0x4e')]['id']}})[_0xbd94('0x29')](handleEntityNotFound(_0xd8cde5))[_0xbd94('0x29')](function(_0x10e171){if(_0x10e171&&_0x10e171[_0xbd94('0x9a')]){var _0x27048e=_0x10e171[_0xbd94('0x9a')];var _0x1e523d=config[_0xbd94('0x9b')]+_0xbd94('0x9c')+_0x10e171['id']+'.txt';if(fs[_0xbd94('0x66')](_0x1e523d)){return _0x1e523d;}return writeFile(_0x27048e,_0x1e523d)[_0xbd94('0x29')](function(){return _0x1e523d;});}else{throw new db['Sequelize'][(_0xbd94('0x59'))](_0xbd94('0x9d'));}})[_0xbd94('0x29')](function(_0x460959){return _0xd8cde5[_0xbd94('0x53')](_0x460959);})['catch'](handleError(_0xd8cde5));};
\ No newline at end of file
+var _0xfc21=['transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','count','include','rows','catch','show','params','model','includeAll','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','sequelize','MD5','col','push','$and','secrets','extname','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xfc21,0x1c8));var _0x1fc2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfc21[_0x3b380d];return _0x54502b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1fc2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fc2('0x1'));var jsonpatch=require(_0x1fc2('0x2'));var rp=require(_0x1fc2('0x3'));var moment=require(_0x1fc2('0x4'));var BPromise=require(_0x1fc2('0x5'));var Mustache=require(_0x1fc2('0x6'));var util=require(_0x1fc2('0x7'));var path=require(_0x1fc2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1fc2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1fc2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1fc2('0xb'));var toCsv=require(_0x1fc2('0xc'));var querystring=require(_0x1fc2('0xd'));var Papa=require(_0x1fc2('0xe'));var AWS=require(_0x1fc2('0xf'));var uuidv4=require(_0x1fc2('0x10'));var Redis=require('ioredis');var authService=require(_0x1fc2('0x11'));var qs=require(_0x1fc2('0x12'));var as=require(_0x1fc2('0x13'));var hardwareService=require(_0x1fc2('0x14'));var logger=require(_0x1fc2('0x15'))(_0x1fc2('0x16'));var utils=require(_0x1fc2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1fc2('0x18'));var db=require(_0x1fc2('0x19'))['db'];function respondWithStatusCode(_0x42d898,_0x330dec){_0x330dec=_0x330dec||0xcc;return function(_0x2305e5){if(_0x2305e5){return _0x42d898['sendStatus'](_0x330dec);}return _0x42d898['status'](_0x330dec)[_0x1fc2('0x1a')]();};}function respondWithResult(_0x357bb5,_0x1027de){_0x1027de=_0x1027de||0xc8;return function(_0x3ed2a4){if(_0x3ed2a4){return _0x357bb5[_0x1fc2('0x1b')](_0x1027de)[_0x1fc2('0x1c')](_0x3ed2a4);}};}function respondWithFilteredResult(_0x2dc6d2,_0x2b2b56){return function(_0x37772f){if(_0x37772f){var _0x92eea8=_0x37772f['count'],_0x161f64=_0x2b2b56[_0x1fc2('0x1d')],_0x3415cd=_0x2b2b56[_0x1fc2('0x1d')]+_0x2b2b56[_0x1fc2('0x1e')],_0x29044f;if(_0x3415cd>=_0x92eea8){_0x3415cd=_0x92eea8;_0x29044f=0xc8;}else{_0x29044f=0xce;}_0x2dc6d2[_0x1fc2('0x1b')](_0x29044f);return _0x2dc6d2['set'](_0x1fc2('0x1f'),_0x161f64+'-'+_0x3415cd+'/'+_0x92eea8)[_0x1fc2('0x1c')](_0x37772f);}return null;};}function patchUpdates(_0x6fd59){return function(_0x5b059c){try{jsonpatch[_0x1fc2('0x20')](_0x5b059c,_0x6fd59,!![]);}catch(_0x53c926){return BPromise[_0x1fc2('0x21')](_0x53c926);}return _0x5b059c[_0x1fc2('0x22')]();};}function saveUpdates(_0x587e8e,_0x2290c6){return function(_0x4b3e3f){if(_0x4b3e3f){return _0x4b3e3f['update'](_0x587e8e)['then'](function(_0x5eb6a4){return _0x5eb6a4;});}return null;};}function removeEntity(_0x493937,_0xd99402){return function(_0x224efd){if(_0x224efd){return _0x224efd[_0x1fc2('0x23')]()[_0x1fc2('0x24')](function(){_0x493937[_0x1fc2('0x1b')](0xcc)[_0x1fc2('0x1a')]();});}};}function handleEntityNotFound(_0x2c432b,_0x228691){return function(_0x156e27){if(!_0x156e27){_0x2c432b['sendStatus'](0x194);}return _0x156e27;};}function handleError(_0x2e60b9,_0x5c35c7){_0x5c35c7=_0x5c35c7||0x1f4;return function(_0x242463){logger[_0x1fc2('0x25')](_0x242463[_0x1fc2('0x26')]);if(_0x242463['name']){delete _0x242463[_0x1fc2('0x27')];}_0x2e60b9['status'](_0x5c35c7)[_0x1fc2('0x28')](_0x242463);};}exports['index']=function(_0x5a2025,_0x36c7f1){var _0xe32b14={},_0x2114a1={},_0x17635f={'count':0x0,'rows':[]};var _0x4b7332=_[_0x1fc2('0x29')](db[_0x1fc2('0x2a')][_0x1fc2('0x2b')],function(_0x201371){return{'name':_0x201371[_0x1fc2('0x2c')],'type':_0x201371[_0x1fc2('0x2d')][_0x1fc2('0x2e')]};});_0x2114a1['model']=_[_0x1fc2('0x2f')](_[_0x1fc2('0x29')](_0x4b7332,_0x1fc2('0x27')),[_0x1fc2('0x30')]);_0x2114a1[_0x1fc2('0x31')]=_[_0x1fc2('0x32')](_0x5a2025[_0x1fc2('0x31')]);_0x2114a1[_0x1fc2('0x33')]=_[_0x1fc2('0x34')](_0x2114a1['model'],_0x2114a1[_0x1fc2('0x31')]);_0xe32b14[_0x1fc2('0x35')]=_[_0x1fc2('0x34')](_0x2114a1['model'],qs[_0x1fc2('0x36')](_0x5a2025[_0x1fc2('0x31')][_0x1fc2('0x36')]));_0xe32b14[_0x1fc2('0x35')]=_0xe32b14[_0x1fc2('0x35')][_0x1fc2('0x37')]?_0xe32b14[_0x1fc2('0x35')]:_0x2114a1['model'];if(!_0x5a2025[_0x1fc2('0x31')][_0x1fc2('0x38')](_0x1fc2('0x39'))){_0xe32b14[_0x1fc2('0x1e')]=qs[_0x1fc2('0x1e')](_0x5a2025[_0x1fc2('0x31')][_0x1fc2('0x1e')]);_0xe32b14[_0x1fc2('0x1d')]=qs[_0x1fc2('0x1d')](_0x5a2025[_0x1fc2('0x31')]['offset']);}_0xe32b14['order']=qs[_0x1fc2('0x3a')](_0x5a2025['query'][_0x1fc2('0x3a')]);_0xe32b14['where']=qs[_0x1fc2('0x33')](_['pick'](_0x5a2025[_0x1fc2('0x31')],_0x2114a1[_0x1fc2('0x33')]),_0x4b7332);if(_0x5a2025['query'][_0x1fc2('0x3b')]){_0xe32b14['where']=_['merge'](_0xe32b14[_0x1fc2('0x3c')],{'$or':_['map'](_0x4b7332,function(_0x4d20a1){if(_0x4d20a1[_0x1fc2('0x2d')]!==_0x1fc2('0x3d')){var _0xd8a9c1={};_0xd8a9c1[_0x4d20a1[_0x1fc2('0x27')]]={'$like':'%'+_0x5a2025['query'][_0x1fc2('0x3b')]+'%'};return _0xd8a9c1;}})});}_0xe32b14=_[_0x1fc2('0x3e')]({},_0xe32b14,_0x5a2025[_0x1fc2('0x3f')]);var _0x2b9d2e={'where':_0xe32b14[_0x1fc2('0x3c')]};return db[_0x1fc2('0x2a')][_0x1fc2('0x40')](_0x2b9d2e)[_0x1fc2('0x24')](function(_0x441bfd){_0x17635f[_0x1fc2('0x40')]=_0x441bfd;if(_0x5a2025['query']['includeAll']){_0xe32b14[_0x1fc2('0x41')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0xe32b14);})[_0x1fc2('0x24')](function(_0x356685){_0x17635f[_0x1fc2('0x42')]=_0x356685;return _0x17635f;})['then'](respondWithFilteredResult(_0x36c7f1,_0xe32b14))[_0x1fc2('0x43')](handleError(_0x36c7f1,null));};exports[_0x1fc2('0x44')]=function(_0x14a7ed,_0x177664){var _0x165d4d={'raw':![],'where':{'id':_0x14a7ed[_0x1fc2('0x45')]['id']}},_0x5bc826={};_0x5bc826[_0x1fc2('0x46')]=_['keys'](db[_0x1fc2('0x2a')][_0x1fc2('0x2b')]);_0x5bc826[_0x1fc2('0x31')]=_[_0x1fc2('0x32')](_0x14a7ed['query']);_0x5bc826[_0x1fc2('0x33')]=_[_0x1fc2('0x34')](_0x5bc826[_0x1fc2('0x46')],_0x5bc826[_0x1fc2('0x31')]);_0x165d4d[_0x1fc2('0x35')]=_[_0x1fc2('0x34')](_0x5bc826['model'],qs[_0x1fc2('0x36')](_0x14a7ed[_0x1fc2('0x31')][_0x1fc2('0x36')]));_0x165d4d[_0x1fc2('0x35')]=_0x165d4d['attributes']['length']?_0x165d4d[_0x1fc2('0x35')]:_0x5bc826[_0x1fc2('0x46')];if(_0x14a7ed[_0x1fc2('0x31')][_0x1fc2('0x47')]){_0x165d4d[_0x1fc2('0x41')]=[{'all':!![]}];}_0x165d4d=_[_0x1fc2('0x3e')]({},_0x165d4d,_0x14a7ed[_0x1fc2('0x3f')]);return db['VoiceRecording'][_0x1fc2('0x48')](_0x165d4d)['then'](handleEntityNotFound(_0x177664,null))[_0x1fc2('0x24')](respondWithResult(_0x177664,null))[_0x1fc2('0x43')](handleError(_0x177664,null));};exports['create']=function(_0x34b7bf,_0x3fbb76){return db['VoiceRecording'][_0x1fc2('0x49')](_0x34b7bf[_0x1fc2('0x4a')],{})[_0x1fc2('0x24')](respondWithResult(_0x3fbb76,0xc9))[_0x1fc2('0x43')](handleError(_0x3fbb76,null));};exports[_0x1fc2('0x4b')]=function(_0x1add6f,_0x2678c3){if(_0x1add6f[_0x1fc2('0x4a')]['id']){delete _0x1add6f['body']['id'];}return db[_0x1fc2('0x2a')][_0x1fc2('0x48')]({'where':{'id':_0x1add6f[_0x1fc2('0x45')]['id']}})['then'](handleEntityNotFound(_0x2678c3,null))[_0x1fc2('0x24')](saveUpdates(_0x1add6f[_0x1fc2('0x4a')],null))[_0x1fc2('0x24')](respondWithResult(_0x2678c3,null))[_0x1fc2('0x43')](handleError(_0x2678c3,null));};exports[_0x1fc2('0x4c')]=function(_0x14c449,_0x3a3719){return db[_0x1fc2('0x2a')]['describe']()[_0x1fc2('0x24')](respondWithResult(_0x3a3719,null))[_0x1fc2('0x43')](handleError(_0x3a3719,null));};exports[_0x1fc2('0x4d')]=function(_0x3a2b19,_0x59d511,_0x41f040){var _0x2daf78=require(_0x1fc2('0x4e'));var _0x19dd9f=![];var _0x5bdbf5={};if(_0x3a2b19[_0x1fc2('0x31')]['type']&&_0x3a2b19['query'][_0x1fc2('0x2d')]==='uniqueid'){_0x5bdbf5[_0x1fc2('0x4f')]=_0x3a2b19[_0x1fc2('0x45')]['id'];}else{_0x5bdbf5['id']=_0x3a2b19[_0x1fc2('0x45')]['id'];}return db[_0x1fc2('0x2a')]['find']({'where':_0x5bdbf5,'attributes':['id',_0x1fc2('0x50')],'raw':!![]})[_0x1fc2('0x24')](handleEntityNotFound(_0x59d511,null))[_0x1fc2('0x24')](function(_0x6aad40){if(_0x6aad40){var _0x50e6b5=_0x6aad40[_0x1fc2('0x50')];var _0x2c8fd8=util[_0x1fc2('0x30')](_0x1fc2('0x51'),_0x50e6b5);if(fs[_0x1fc2('0x52')](_0x2c8fd8)){_0x19dd9f=!![];return _0x2daf78[_0x1fc2('0x53')](_0x2c8fd8,_0x50e6b5,config['secrets'][_0x1fc2('0x54')])[_0x1fc2('0x24')](function(){return _0x6aad40;});}return _0x6aad40;}})[_0x1fc2('0x24')](function(_0x5a0a74){if(_0x5a0a74){var _0x51c275=_0x5a0a74[_0x1fc2('0x50')];if(!fs['existsSync'](_0x51c275)){throw new db[(_0x1fc2('0x55'))][(_0x1fc2('0x56'))](_0x1fc2('0x57'));}if(_0x5a0a74[_0x1fc2('0x58')]){return _0x59d511['download'](_0x51c275,_0x5a0a74[_0x1fc2('0x58')]+path['extname'](_0x51c275),function(){if(_0x19dd9f){fs[_0x1fc2('0x59')](_0x51c275);}});}else{return _0x59d511['download'](_0x51c275,function(_0x57cd95){if(_0x19dd9f){fs[_0x1fc2('0x59')](_0x51c275);}});}}})[_0x1fc2('0x43')](function(_0x108196){if(_0x108196['message']===_0x1fc2('0x57')){_0x59d511['status'](0x194)['send'](_0x1fc2('0x5a'));}else{return handleError(_0x59d511,null);}});};exports['downloads']=function(_0x3ee21f,_0x45d50b,_0x2b506f){var _0x11a3e1=require(_0x1fc2('0x4e'));var _0x317e3d=![];var _0x1c9f88={'$and':[db[_0x1fc2('0x5b')][_0x1fc2('0x3c')](db[_0x1fc2('0x5b')]['fn'](_0x1fc2('0x5c'),db['sequelize'][_0x1fc2('0x5d')]('uniqueid')),_0x3ee21f[_0x1fc2('0x31')]['token'])]};if(_0x3ee21f[_0x1fc2('0x31')][_0x1fc2('0x2d')]&&_0x3ee21f[_0x1fc2('0x31')][_0x1fc2('0x2d')]===_0x1fc2('0x4f')){_0x1c9f88['$and'][_0x1fc2('0x5e')]({'uniqueid':_0x3ee21f[_0x1fc2('0x45')]['id']});}else{_0x1c9f88[_0x1fc2('0x5f')][_0x1fc2('0x5e')]({'id':_0x3ee21f[_0x1fc2('0x45')]['id']});}return db[_0x1fc2('0x2a')][_0x1fc2('0x48')]({'where':_0x1c9f88,'attributes':['id',_0x1fc2('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x45d50b,null))[_0x1fc2('0x24')](function(_0xa3fe24){if(_0xa3fe24){var _0x30a904=util[_0x1fc2('0x30')]('%s.cypher',_0xa3fe24[_0x1fc2('0x50')]);if(fs['existsSync'](_0x30a904)){_0x317e3d=!![];return _0x11a3e1['decryptFile'](_0x30a904,_0xa3fe24['value'],config[_0x1fc2('0x60')][_0x1fc2('0x54')])[_0x1fc2('0x24')](function(){return _0xa3fe24;});}return _0xa3fe24;}})[_0x1fc2('0x24')](function(_0x34aaf7){if(_0x34aaf7){if(!fs[_0x1fc2('0x52')](_0x34aaf7[_0x1fc2('0x50')])){throw new db[(_0x1fc2('0x55'))][(_0x1fc2('0x56'))](_0x1fc2('0x57'));}if(_0x34aaf7[_0x1fc2('0x58')]){return _0x45d50b['download'](_0x34aaf7[_0x1fc2('0x50')],_0x34aaf7[_0x1fc2('0x58')]+path[_0x1fc2('0x61')](_0x34aaf7[_0x1fc2('0x50')]),function(){if(_0x317e3d){fs[_0x1fc2('0x59')](_0x34aaf7[_0x1fc2('0x50')]);}});}else{return _0x45d50b[_0x1fc2('0x4d')](_0x34aaf7['value'],function(_0x4b3a3b){if(_0x317e3d){fs['unlink'](_0x34aaf7[_0x1fc2('0x50')]);}});}}})['catch'](handleError(_0x45d50b,null));};exports[_0x1fc2('0x23')]=function(_0x2e0d86,_0x5319ea){return db[_0x1fc2('0x2a')][_0x1fc2('0x48')]({'where':{'id':_0x2e0d86['params']['id']}})[_0x1fc2('0x24')](function(_0x1dfc1b){if(!_0x1dfc1b)throw new ReferenceError(_0x1fc2('0x62'));return _0x1dfc1b;})[_0x1fc2('0x24')](function(_0x2e3c82){var _0x5c9840=_0x2e3c82[_0x1fc2('0x50')];logger['info'](_0x1fc2('0x63'),_0x5c9840);if(!_['isNil'](_0x2e3c82[_0x1fc2('0x50')])&&fs[_0x1fc2('0x52')](_0x5c9840)){logger[_0x1fc2('0x64')](_0x1fc2('0x65')+_0x5c9840+_0x1fc2('0x66'));fs[_0x1fc2('0x67')](_0x5c9840);}_0x5c9840=_0x5c9840+_0x1fc2('0x68');if(!_['isNil'](_0x2e3c82[_0x1fc2('0x50')])&&fs['existsSync'](_0x5c9840)){logger['info']('File:\x20\x22'+_0x5c9840+_0x1fc2('0x66'));fs['unlinkSync'](_0x5c9840);}return _0x2e3c82;})[_0x1fc2('0x24')](function(_0x5d3ebf){if(!_0x5d3ebf)throw new InternalError();return _0x5d3ebf[_0x1fc2('0x23')]();})[_0x1fc2('0x24')](function(){_0x5319ea[_0x1fc2('0x1b')](0xcc)['end']();})[_0x1fc2('0x43')](handleError(_0x5319ea,null));};function getBucketslist(_0x190dd9,_0x18ab1a,_0x297b28){return new Promise(function(_0xf32ef6,_0x33436e){var _0x4f3c7=new AWS['S3']({'accessKeyId':_0x18ab1a,'secretAccessKey':_0x190dd9,'region':_0x297b28});_0x4f3c7[_0x1fc2('0x69')]({},function(_0x5887e6,_0x33ae99){if(_0x5887e6){return _0x33436e(_0x5887e6);}else{return _0xf32ef6(_0x33ae99);}});});}function createBucket(_0x35e32c,_0x24a6ff,_0x1b1d24,_0x3aeb63){return new Promise(function(_0x56685d,_0xeffc1a){var _0x2312b2=new AWS['S3']({'accessKeyId':_0x24a6ff,'secretAccessKey':_0x35e32c,'region':_0x1b1d24});_0x2312b2['createBucket']({'Bucket':_0x3aeb63},function(_0x28f3a7,_0x3014ac){if(_0x28f3a7){return _0xeffc1a(_0x28f3a7);}else{return _0x56685d(_0x3014ac);}});});}function uploadFile(_0x3df819,_0x2da61d,_0x4f0f86,_0x2e9357,_0x51897c,_0x23af6d){return new Promise(function(_0x49f13d,_0x5ada5b){var _0x3d8a12=new AWS['S3']({'accessKeyId':_0x2da61d,'secretAccessKey':_0x3df819,'region':_0x4f0f86});_0x3d8a12['upload']({'Bucket':_0x2e9357,'Key':_0x51897c,'Body':_0x23af6d},function(_0x48006a,_0x3ef37c){if(_0x48006a){return _0x5ada5b(_0x48006a);}else{return _0x49f13d(_0x3ef37c);}});});}function startTranscribe(_0x32c064,_0x394b33,_0x48ec37,_0x3e2e7d,_0x2ff573,_0x1a9866){return new Promise(function(_0x38f141,_0x3e9c49){var _0x35fa7c=new AWS[(_0x1fc2('0x6a'))]({'accessKeyId':_0x394b33,'secretAccessKey':_0x32c064,'region':_0x48ec37});_0x35fa7c['startTranscriptionJob']({'TranscriptionJobName':_0x3e2e7d,'LanguageCode':_0x2ff573,'Media':{'MediaFileUri':_0x1a9866}},function(_0x5679b5,_0x23ba77){if(_0x5679b5){return _0x3e9c49(_0x5679b5);}else{return _0x38f141(_0x23ba77);}});});}function transcribe(_0x1ee1c3,_0x19ac89,_0x525e17,_0x3ee5f9,_0xe785c3,_0x1961fc,_0x5cde00){return new Promise(function(_0x31c415,_0x5b5056){var _0x4475e3={};logger[_0x1fc2('0x64')](util[_0x1fc2('0x30')](_0x1fc2('0x6b'),_0x1ee1c3,_0xe785c3));return uploadFile(_0x19ac89,_0x525e17,_0x3ee5f9,_0xe785c3,path[_0x1fc2('0x6c')](_0x1961fc),fs[_0x1fc2('0x6d')](_0x1961fc))[_0x1fc2('0x24')](function(_0x186217){logger[_0x1fc2('0x64')](util[_0x1fc2('0x30')](_0x1fc2('0x6e'),_0x1ee1c3,_0xe785c3,_0x186217[_0x1fc2('0x6f')]));_0x4475e3['bucket']=_0x186217['Bucket'];_0x4475e3[_0x1fc2('0x70')]=_0x186217[_0x1fc2('0x6f')];logger[_0x1fc2('0x64')](util[_0x1fc2('0x30')](_0x1fc2('0x71'),_0x1ee1c3));return startTranscribe(_0x19ac89,_0x525e17,_0x3ee5f9,uuidv4(),_0x5cde00,_0x186217[_0x1fc2('0x6f')]);})[_0x1fc2('0x24')](function(_0x8c7279){logger[_0x1fc2('0x64')](util[_0x1fc2('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1ee1c3,_0x8c7279[_0x1fc2('0x72')][_0x1fc2('0x73')]));_0x4475e3[_0x1fc2('0x74')]=_0x8c7279[_0x1fc2('0x72')]['TranscriptionJobName'];_0x4475e3['transcribeStatus']=_0x8c7279[_0x1fc2('0x72')][_0x1fc2('0x75')];return _0x31c415(_0x4475e3);})['catch'](function(_0x4abea1){return _0x5b5056(_0x4abea1);});});}exports[_0x1fc2('0x76')]=function(_0x425ca6,_0x3defa,_0x151ca4){var _0x2a8b61;var _0x2cf0c2;var _0x5699c5;var _0x2ab9bf=require(_0x1fc2('0x4e'));return db[_0x1fc2('0x2a')][_0x1fc2('0x77')]({'where':{'id':_0x425ca6[_0x1fc2('0x45')]['id']}})[_0x1fc2('0x24')](function(_0x46989e){if(_0x46989e){var _0x5e50f9=util[_0x1fc2('0x30')](_0x1fc2('0x51'),_0x46989e[_0x1fc2('0x50')]);if(fs['existsSync'](_0x5e50f9)){cypher=!![];return _0x2ab9bf['decryptFile'](_0x5e50f9,_0x46989e[_0x1fc2('0x50')],config[_0x1fc2('0x60')][_0x1fc2('0x54')])[_0x1fc2('0x24')](function(){return _0x46989e;});}return _0x46989e;}})['then'](function(_0x4bab7d){if(!_0x4bab7d){throw new db['Sequelize'][(_0x1fc2('0x56'))]('Voice\x20Recording\x20not\x20found');}_0x2cf0c2=_0x4bab7d;return db[_0x1fc2('0x78')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x3defa,null))[_0x1fc2('0x24')](function(_0x747a0d){if(_0x747a0d){_0x2a8b61=_0x747a0d;if(!_0x2a8b61[_0x1fc2('0x79')]||!_0x2a8b61[_0x1fc2('0x7a')]||!_0x2a8b61[_0x1fc2('0x7b')]||!_0x2a8b61['language']||!_0x2a8b61[_0x1fc2('0x7c')]){throw new db[(_0x1fc2('0x55'))][(_0x1fc2('0x56'))]('Transcribe\x20not\x20configured');}if(_0x425ca6[_0x1fc2('0x4a')]['runSentiment']&&(!_0x2a8b61[_0x1fc2('0x7d')]||!_0x2a8b61[_0x1fc2('0x7e')]||!_0x2a8b61['sentimentRegion']||!_0x2a8b61[_0x1fc2('0x7f')]||!_0x2a8b61[_0x1fc2('0x7c')])){throw new db['Sequelize'][(_0x1fc2('0x56'))](_0x1fc2('0x80'));}return db[_0x1fc2('0x81')][_0x1fc2('0x77')]({'where':{'id':_0x2a8b61['transcribeAccountId']}});}})[_0x1fc2('0x24')](function(_0x3c131b){if(!_0x3c131b){throw new db[(_0x1fc2('0x55'))][(_0x1fc2('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3c131b[_0x1fc2('0x82')]||!_0x3c131b[_0x1fc2('0x83')]){throw new db['Sequelize'][(_0x1fc2('0x56'))](_0x1fc2('0x84'));}_0x5699c5=_0x3c131b;return getBucketslist(_0x5699c5[_0x1fc2('0x82')],_0x5699c5['data2'],_0x2a8b61['transcribeRegion']);})[_0x1fc2('0x24')](function(_0x3e6978){if(_0x3e6978&&_0x3e6978[_0x1fc2('0x85')]){var _0x50545f=_[_0x1fc2('0x48')](_0x3e6978[_0x1fc2('0x85')],function(_0x11873b){return _0x11873b['Name']===_0x2a8b61[_0x1fc2('0x7c')];});if(!_0x50545f){logger[_0x1fc2('0x64')](util[_0x1fc2('0x30')](_0x1fc2('0x86'),_0x425ca6[_0x1fc2('0x45')]['id'],_0x2a8b61[_0x1fc2('0x7c')]));return createBucket(_0x5699c5[_0x1fc2('0x82')],_0x5699c5['data2'],_0x2a8b61['transcribeRegion'],_0x2a8b61['bucket']);}logger[_0x1fc2('0x64')](util[_0x1fc2('0x30')](_0x1fc2('0x87'),_0x425ca6['params']['id'],_0x2a8b61[_0x1fc2('0x7c')]));return;}})[_0x1fc2('0x24')](function(_0x494ce5){if(_0x2cf0c2[_0x1fc2('0x88')]===_0x1fc2('0x89')){return transcribe(_0x425ca6[_0x1fc2('0x45')]['id'],_0x5699c5['data1'],_0x5699c5[_0x1fc2('0x83')],_0x2a8b61['transcribeRegion'],_0x2a8b61[_0x1fc2('0x7c')],_0x2cf0c2[_0x1fc2('0x50')],_0x2a8b61[_0x1fc2('0x7f')]);}else{logger[_0x1fc2('0x64')](util['format'](_0x1fc2('0x8a'),_0x425ca6['params']['id']));return{'transcribeStatus':_0x1fc2('0x8b')};}})[_0x1fc2('0x24')](function(_0xad9a71){if(_0xad9a71){_0xad9a71['tempSentiment']=_0x425ca6[_0x1fc2('0x4a')][_0x1fc2('0x8c')];return _0x2cf0c2['updateAttributes'](_0xad9a71);}})[_0x1fc2('0x24')](respondWithResult(_0x3defa,null))[_0x1fc2('0x43')](handleError(_0x3defa,null));};function writeFile(_0xdd8cfe,_0x1220d1){return new Promise(function(_0x389285,_0x4ff745){fs[_0x1fc2('0x8d')](_0x1220d1,_0xdd8cfe,function(_0x30d199,_0x526c40){if(_0x30d199){return _0x4ff745(_0x30d199);}else{return _0x389285(_0x526c40);}});});}exports[_0x1fc2('0x8e')]=function(_0x56173a,_0x32f523,_0x484ad9){return db['VoiceRecording'][_0x1fc2('0x77')]({'where':{'id':_0x56173a['params']['id']}})[_0x1fc2('0x24')](handleEntityNotFound(_0x32f523))[_0x1fc2('0x24')](function(_0x4d1c38){if(_0x4d1c38&&_0x4d1c38['fileText']){var _0x547351=_0x4d1c38[_0x1fc2('0x8f')];var _0x1e5905=config[_0x1fc2('0x90')]+_0x1fc2('0x91')+_0x4d1c38['id']+_0x1fc2('0x92');if(fs['existsSync'](_0x1e5905)){return _0x1e5905;}return writeFile(_0x547351,_0x1e5905)[_0x1fc2('0x24')](function(){return _0x1e5905;});}else{throw new db[(_0x1fc2('0x55'))]['ValidationError'](_0x1fc2('0x93'));}})['then'](function(_0x7cac6c){return _0x32f523['download'](_0x7cac6c);})['catch'](handleError(_0x32f523));};
\ No newline at end of file