Built motion from commit (unavailable).|2.5.26
[motion2.git] / server / api / voiceRecording / voiceRecording.controller.js
index b24d8ab..af662a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb841=['bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','params','length','includeAll','include','find','catch','create','body','update','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','ValidationError','extname','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','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)','Location','bucket','Bucket','location','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xb841,0x1c8));var _0x1b84=function(_0x4785f3,_0x3fc6f5){_0x4785f3=_0x4785f3-0x0;var _0x1d7318=_0xb841[_0x4785f3];return _0x1d7318;};'use strict';var pdf=require(_0x1b84('0x0'));var emlformat=require(_0x1b84('0x1'));var rimraf=require(_0x1b84('0x2'));var zipdir=require(_0x1b84('0x3'));var jsonpatch=require(_0x1b84('0x4'));var rp=require(_0x1b84('0x5'));var moment=require('moment');var BPromise=require(_0x1b84('0x6'));var Mustache=require(_0x1b84('0x7'));var util=require(_0x1b84('0x8'));var path=require('path');var sox=require(_0x1b84('0x9'));var csv=require('to-csv');var ejs=require(_0x1b84('0xa'));var fs=require('fs');var _=require(_0x1b84('0xb'));var squel=require(_0x1b84('0xc'));var crypto=require(_0x1b84('0xd'));var jsforce=require(_0x1b84('0xe'));var deskjs=require(_0x1b84('0xf'));var toCsv=require(_0x1b84('0x10'));var querystring=require(_0x1b84('0x11'));var Papa=require(_0x1b84('0x12'));var AWS=require(_0x1b84('0x13'));var uuidv4=require(_0x1b84('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1b84('0x15'));var hardwareService=require(_0x1b84('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1b84('0x17'));var config=require(_0x1b84('0x18'));var licenseUtil=require(_0x1b84('0x19'));var db=require(_0x1b84('0x1a'))['db'];function respondWithStatusCode(_0x4bc3ec,_0x4b8008){_0x4b8008=_0x4b8008||0xcc;return function(_0x143abd){if(_0x143abd){return _0x4bc3ec['sendStatus'](_0x4b8008);}return _0x4bc3ec[_0x1b84('0x1b')](_0x4b8008)[_0x1b84('0x1c')]();};}function respondWithResult(_0x209a3b,_0x571cc5){_0x571cc5=_0x571cc5||0xc8;return function(_0x582d4f){if(_0x582d4f){return _0x209a3b['status'](_0x571cc5)['json'](_0x582d4f);}};}function respondWithFilteredResult(_0x3fa9d4,_0x32b21e){return function(_0x425468){if(_0x425468){var _0x3299b5=_0x425468[_0x1b84('0x1d')],_0x52a5d9=_0x32b21e[_0x1b84('0x1e')],_0x79d25d=_0x32b21e[_0x1b84('0x1e')]+_0x32b21e[_0x1b84('0x1f')],_0x28c3a4;if(_0x79d25d>=_0x3299b5){_0x79d25d=_0x3299b5;_0x28c3a4=0xc8;}else{_0x28c3a4=0xce;}_0x3fa9d4['status'](_0x28c3a4);return _0x3fa9d4['set'](_0x1b84('0x20'),_0x52a5d9+'-'+_0x79d25d+'/'+_0x3299b5)[_0x1b84('0x21')](_0x425468);}return null;};}function patchUpdates(_0x2a2cab){return function(_0x5bb0b3){try{jsonpatch[_0x1b84('0x22')](_0x5bb0b3,_0x2a2cab,!![]);}catch(_0x4384db){return BPromise[_0x1b84('0x23')](_0x4384db);}return _0x5bb0b3['save']();};}function saveUpdates(_0x40a213,_0x16fb83){return function(_0x3a5bcf){if(_0x3a5bcf){return _0x3a5bcf['update'](_0x40a213)[_0x1b84('0x24')](function(_0x50440d){return _0x50440d;});}return null;};}function removeEntity(_0x27e2db,_0xca0dcf){return function(_0x2eebdc){if(_0x2eebdc){return _0x2eebdc[_0x1b84('0x25')]()['then'](function(){_0x27e2db[_0x1b84('0x1b')](0xcc)[_0x1b84('0x1c')]();});}};}function handleEntityNotFound(_0x4c2201,_0x10b444){return function(_0x2876a3){if(!_0x2876a3){_0x4c2201[_0x1b84('0x26')](0x194);}return _0x2876a3;};}function handleError(_0x5f0883,_0x58d075){_0x58d075=_0x58d075||0x1f4;return function(_0x4bf2c1){logger[_0x1b84('0x27')](_0x4bf2c1[_0x1b84('0x28')]);if(_0x4bf2c1[_0x1b84('0x29')]){delete _0x4bf2c1['name'];}_0x5f0883['status'](_0x58d075)[_0x1b84('0x2a')](_0x4bf2c1);};}exports[_0x1b84('0x2b')]=function(_0x2704a9,_0x160749){var _0x3f3123={},_0x3749bf={},_0x238b5c={'count':0x0,'rows':[]};var _0x3337d3=_['map'](db[_0x1b84('0x2c')][_0x1b84('0x2d')],function(_0x24825c){return{'name':_0x24825c[_0x1b84('0x2e')],'type':_0x24825c[_0x1b84('0x2f')][_0x1b84('0x30')]};});_0x3749bf[_0x1b84('0x31')]=_[_0x1b84('0x32')](_['map'](_0x3337d3,'name'),[_0x1b84('0x33')]);_0x3749bf[_0x1b84('0x34')]=_[_0x1b84('0x35')](_0x2704a9[_0x1b84('0x34')]);_0x3749bf[_0x1b84('0x36')]=_[_0x1b84('0x37')](_0x3749bf['model'],_0x3749bf[_0x1b84('0x34')]);_0x3f3123[_0x1b84('0x38')]=_['intersection'](_0x3749bf[_0x1b84('0x31')],qs[_0x1b84('0x39')](_0x2704a9[_0x1b84('0x34')][_0x1b84('0x39')]));_0x3f3123[_0x1b84('0x38')]=_0x3f3123[_0x1b84('0x38')]['length']?_0x3f3123[_0x1b84('0x38')]:_0x3749bf['model'];if(!_0x2704a9['query'][_0x1b84('0x3a')](_0x1b84('0x3b'))){_0x3f3123[_0x1b84('0x1f')]=qs[_0x1b84('0x1f')](_0x2704a9['query'][_0x1b84('0x1f')]);_0x3f3123['offset']=qs[_0x1b84('0x1e')](_0x2704a9[_0x1b84('0x34')]['offset']);}_0x3f3123[_0x1b84('0x3c')]=qs[_0x1b84('0x3d')](_0x2704a9['query'][_0x1b84('0x3d')]);_0x3f3123[_0x1b84('0x3e')]=qs[_0x1b84('0x36')](_[_0x1b84('0x3f')](_0x2704a9[_0x1b84('0x34')],_0x3749bf['filters']),_0x3337d3);if(_0x2704a9[_0x1b84('0x34')][_0x1b84('0x40')]){_0x3f3123[_0x1b84('0x3e')]=_[_0x1b84('0x41')](_0x3f3123[_0x1b84('0x3e')],{'$or':_['map'](_0x3337d3,function(_0x56e9bd){if(_0x56e9bd[_0x1b84('0x2f')]!==_0x1b84('0x42')){var _0x5cfd25={};_0x5cfd25[_0x56e9bd[_0x1b84('0x29')]]={'$like':'%'+_0x2704a9['query']['filter']+'%'};return _0x5cfd25;}})});}_0x3f3123=_[_0x1b84('0x41')]({},_0x3f3123,_0x2704a9[_0x1b84('0x43')]);var _0x381c1c={'where':_0x3f3123[_0x1b84('0x3e')]};return db[_0x1b84('0x2c')][_0x1b84('0x1d')](_0x381c1c)[_0x1b84('0x24')](function(_0x3ffb20){_0x238b5c[_0x1b84('0x1d')]=_0x3ffb20;if(_0x2704a9[_0x1b84('0x34')]['includeAll']){_0x3f3123['include']=[{'all':!![]}];}return db[_0x1b84('0x2c')][_0x1b84('0x44')](_0x3f3123);})[_0x1b84('0x24')](function(_0x1793c4){_0x238b5c['rows']=_0x1793c4;return _0x238b5c;})[_0x1b84('0x24')](respondWithFilteredResult(_0x160749,_0x3f3123))['catch'](handleError(_0x160749,null));};exports[_0x1b84('0x45')]=function(_0x447c05,_0x7d5544){var _0x352f4e={'raw':![],'where':{'id':_0x447c05[_0x1b84('0x46')]['id']}},_0x40c448={};_0x40c448['model']=_['keys'](db[_0x1b84('0x2c')][_0x1b84('0x2d')]);_0x40c448[_0x1b84('0x34')]=_[_0x1b84('0x35')](_0x447c05['query']);_0x40c448[_0x1b84('0x36')]=_[_0x1b84('0x37')](_0x40c448['model'],_0x40c448['query']);_0x352f4e[_0x1b84('0x38')]=_['intersection'](_0x40c448[_0x1b84('0x31')],qs[_0x1b84('0x39')](_0x447c05[_0x1b84('0x34')][_0x1b84('0x39')]));_0x352f4e[_0x1b84('0x38')]=_0x352f4e[_0x1b84('0x38')][_0x1b84('0x47')]?_0x352f4e[_0x1b84('0x38')]:_0x40c448[_0x1b84('0x31')];if(_0x447c05[_0x1b84('0x34')][_0x1b84('0x48')]){_0x352f4e[_0x1b84('0x49')]=[{'all':!![]}];}_0x352f4e=_['merge']({},_0x352f4e,_0x447c05[_0x1b84('0x43')]);return db[_0x1b84('0x2c')][_0x1b84('0x4a')](_0x352f4e)[_0x1b84('0x24')](handleEntityNotFound(_0x7d5544,null))['then'](respondWithResult(_0x7d5544,null))[_0x1b84('0x4b')](handleError(_0x7d5544,null));};exports['create']=function(_0x5cf350,_0x572e55){return db[_0x1b84('0x2c')][_0x1b84('0x4c')](_0x5cf350[_0x1b84('0x4d')],{})[_0x1b84('0x24')](respondWithResult(_0x572e55,0xc9))[_0x1b84('0x4b')](handleError(_0x572e55,null));};exports[_0x1b84('0x4e')]=function(_0x269f6c,_0x3b2df0){if(_0x269f6c['body']['id']){delete _0x269f6c[_0x1b84('0x4d')]['id'];}return db[_0x1b84('0x2c')][_0x1b84('0x4a')]({'where':{'id':_0x269f6c[_0x1b84('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b2df0,null))[_0x1b84('0x24')](saveUpdates(_0x269f6c['body'],null))['then'](respondWithResult(_0x3b2df0,null))[_0x1b84('0x4b')](handleError(_0x3b2df0,null));};exports['describe']=function(_0x26a519,_0x3478dc){return db[_0x1b84('0x2c')][_0x1b84('0x4f')]()[_0x1b84('0x24')](respondWithResult(_0x3478dc,null))[_0x1b84('0x4b')](handleError(_0x3478dc,null));};exports['download']=function(_0xe2bff9,_0x12592f,_0x33cfb4){var _0x2b184d=require(_0x1b84('0x50'));var _0x372e29=![];var _0x40c527={};if(_0xe2bff9[_0x1b84('0x34')][_0x1b84('0x2f')]&&_0xe2bff9['query']['type']===_0x1b84('0x51')){_0x40c527['uniqueid']=_0xe2bff9[_0x1b84('0x46')]['id'];}else{_0x40c527['id']=_0xe2bff9[_0x1b84('0x46')]['id'];}return db['VoiceRecording'][_0x1b84('0x4a')]({'where':_0x40c527,'attributes':['id','value'],'raw':!![]})[_0x1b84('0x24')](handleEntityNotFound(_0x12592f,null))[_0x1b84('0x24')](function(_0x2c5057){if(_0x2c5057){var _0x37dc25=_0x2c5057[_0x1b84('0x52')];var _0x9b36c6=util['format'](_0x1b84('0x53'),_0x37dc25);if(fs[_0x1b84('0x54')](_0x9b36c6)){_0x372e29=!![];return _0x2b184d[_0x1b84('0x55')](_0x9b36c6,_0x37dc25,config[_0x1b84('0x56')][_0x1b84('0x57')])[_0x1b84('0x24')](function(){return _0x2c5057;});}return _0x2c5057;}})[_0x1b84('0x24')](function(_0x17866d){if(_0x17866d){var _0x5cfe15=_0x17866d[_0x1b84('0x52')];if(!fs['existsSync'](_0x5cfe15)){throw new db[(_0x1b84('0x58'))]['ValidationError'](_0x1b84('0x59'));}if(_0x17866d[_0x1b84('0x5a')]){return _0x12592f[_0x1b84('0x5b')](_0x5cfe15,_0x17866d[_0x1b84('0x5a')]+path['extname'](_0x5cfe15),function(){if(_0x372e29){fs[_0x1b84('0x5c')](_0x5cfe15);}});}else{return _0x12592f[_0x1b84('0x5b')](_0x5cfe15,function(_0x52b7a6){if(_0x372e29){fs[_0x1b84('0x5c')](_0x5cfe15);}});}}})['catch'](function(_0x1d456e){if(_0x1d456e[_0x1b84('0x5d')]===_0x1b84('0x59')){_0x12592f[_0x1b84('0x1b')](0x194)['send'](_0x1b84('0x5e'));}else{return handleError(_0x12592f,null);}});};exports[_0x1b84('0x5f')]=function(_0x4f9c12,_0x577bf2,_0x18d5e2){var _0x3db479=require(_0x1b84('0x50'));var _0x1af382=![];var _0x39b904={'$and':[db['sequelize'][_0x1b84('0x3e')](db[_0x1b84('0x60')]['fn'](_0x1b84('0x61'),db[_0x1b84('0x60')][_0x1b84('0x62')](_0x1b84('0x51'))),_0x4f9c12['query'][_0x1b84('0x63')])]};if(_0x4f9c12[_0x1b84('0x34')][_0x1b84('0x2f')]&&_0x4f9c12[_0x1b84('0x34')][_0x1b84('0x2f')]===_0x1b84('0x51')){_0x39b904[_0x1b84('0x64')][_0x1b84('0x65')]({'uniqueid':_0x4f9c12[_0x1b84('0x46')]['id']});}else{_0x39b904[_0x1b84('0x64')][_0x1b84('0x65')]({'id':_0x4f9c12[_0x1b84('0x46')]['id']});}return db[_0x1b84('0x2c')][_0x1b84('0x4a')]({'where':_0x39b904,'attributes':['id',_0x1b84('0x52')],'raw':!![]})[_0x1b84('0x24')](handleEntityNotFound(_0x577bf2,null))['then'](function(_0x2182c1){if(_0x2182c1){var _0xcaac5e=util[_0x1b84('0x33')](_0x1b84('0x53'),_0x2182c1[_0x1b84('0x52')]);if(fs[_0x1b84('0x54')](_0xcaac5e)){_0x1af382=!![];return _0x3db479[_0x1b84('0x55')](_0xcaac5e,_0x2182c1[_0x1b84('0x52')],config[_0x1b84('0x56')][_0x1b84('0x57')])[_0x1b84('0x24')](function(){return _0x2182c1;});}return _0x2182c1;}})[_0x1b84('0x24')](function(_0x3c62ac){if(_0x3c62ac){if(!fs[_0x1b84('0x54')](_0x3c62ac['value'])){throw new db[(_0x1b84('0x58'))][(_0x1b84('0x66'))]('VoiceRecording\x20not\x20found');}if(_0x3c62ac[_0x1b84('0x5a')]){return _0x577bf2[_0x1b84('0x5b')](_0x3c62ac[_0x1b84('0x52')],_0x3c62ac[_0x1b84('0x5a')]+path[_0x1b84('0x67')](_0x3c62ac[_0x1b84('0x52')]),function(){if(_0x1af382){fs[_0x1b84('0x5c')](_0x3c62ac['value']);}});}else{return _0x577bf2[_0x1b84('0x5b')](_0x3c62ac[_0x1b84('0x52')],function(_0x496d6f){if(_0x1af382){fs[_0x1b84('0x5c')](_0x3c62ac[_0x1b84('0x52')]);}});}}})[_0x1b84('0x4b')](handleError(_0x577bf2,null));};exports['destroy']=function(_0xe4058e,_0x1251b6){return db['VoiceRecording'][_0x1b84('0x4a')]({'where':{'id':_0xe4058e['params']['id']}})[_0x1b84('0x24')](function(_0x3675cd){if(!_0x3675cd)throw new ReferenceError('Entity\x20not\x20found');return _0x3675cd;})[_0x1b84('0x24')](function(_0x1658b1){var _0x4e30b7=_0x1658b1['value'];logger[_0x1b84('0x68')](_0x1b84('0x69'),_0x4e30b7);if(!_[_0x1b84('0x6a')](_0x1658b1[_0x1b84('0x52')])&&fs[_0x1b84('0x54')](_0x4e30b7)){logger[_0x1b84('0x68')](_0x1b84('0x6b')+_0x4e30b7+_0x1b84('0x6c'));fs['unlinkSync'](_0x4e30b7);}_0x4e30b7=_0x4e30b7+_0x1b84('0x6d');if(!_['isNil'](_0x1658b1[_0x1b84('0x52')])&&fs[_0x1b84('0x54')](_0x4e30b7)){logger[_0x1b84('0x68')](_0x1b84('0x6b')+_0x4e30b7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1b84('0x6e')](_0x4e30b7);}return _0x1658b1;})['then'](function(_0x1fbda9){if(!_0x1fbda9)throw new InternalError();return _0x1fbda9[_0x1b84('0x25')]();})[_0x1b84('0x24')](function(){_0x1251b6[_0x1b84('0x1b')](0xcc)[_0x1b84('0x1c')]();})['catch'](handleError(_0x1251b6,null));};function getBucketslist(_0x186d59,_0x2b6cbe,_0x56c376){return new Promise(function(_0x5600c5,_0x12aa78){var _0x4fcc7b=new AWS['S3']({'accessKeyId':_0x2b6cbe,'secretAccessKey':_0x186d59,'region':_0x56c376});_0x4fcc7b[_0x1b84('0x6f')]({},function(_0x42aad6,_0x49f7bd){if(_0x42aad6){return _0x12aa78(_0x42aad6);}else{return _0x5600c5(_0x49f7bd);}});});}function createBucket(_0x5a5eb2,_0xb5044c,_0x48a5fa,_0x410e9d){return new Promise(function(_0x4037ca,_0x77b2ae){var _0xc7b4bd=new AWS['S3']({'accessKeyId':_0xb5044c,'secretAccessKey':_0x5a5eb2,'region':_0x48a5fa});_0xc7b4bd[_0x1b84('0x70')]({'Bucket':_0x410e9d},function(_0x4d4f57,_0x1e97b6){if(_0x4d4f57){return _0x77b2ae(_0x4d4f57);}else{return _0x4037ca(_0x1e97b6);}});});}function uploadFile(_0x355b9e,_0x3d7ebe,_0x270310,_0x9ae001,_0x5d50ab,_0x268991){return new Promise(function(_0x3b1d04,_0x14a7b1){var _0xe00ff2=new AWS['S3']({'accessKeyId':_0x3d7ebe,'secretAccessKey':_0x355b9e,'region':_0x270310});_0xe00ff2[_0x1b84('0x71')]({'Bucket':_0x9ae001,'Key':_0x5d50ab,'Body':_0x268991},function(_0x42d165,_0x15b1ce){if(_0x42d165){return _0x14a7b1(_0x42d165);}else{return _0x3b1d04(_0x15b1ce);}});});}function startTranscribe(_0x60d57e,_0x2f5374,_0x526576,_0x5431b9,_0x15ed0a,_0x32b870){return new Promise(function(_0x34aaf5,_0x28c058){var _0x2f86cc=new AWS[(_0x1b84('0x72'))]({'accessKeyId':_0x2f5374,'secretAccessKey':_0x60d57e,'region':_0x526576});_0x2f86cc[_0x1b84('0x73')]({'TranscriptionJobName':_0x5431b9,'LanguageCode':_0x15ed0a,'Media':{'MediaFileUri':_0x32b870}},function(_0xf845dc,_0x58eac4){if(_0xf845dc){return _0x28c058(_0xf845dc);}else{return _0x34aaf5(_0x58eac4);}});});}function transcribe(_0x1faad6,_0xb7aa3,_0x357721,_0x5673c9,_0x2ba232,_0x120921,_0x454b30){return new Promise(function(_0x36b941,_0x4a7189){var _0x362f56={};logger[_0x1b84('0x68')](util[_0x1b84('0x33')](_0x1b84('0x74'),_0x1faad6,_0x2ba232));return uploadFile(_0xb7aa3,_0x357721,_0x5673c9,_0x2ba232,path[_0x1b84('0x75')](_0x120921),fs[_0x1b84('0x76')](_0x120921))['then'](function(_0x759a49){logger['info'](util[_0x1b84('0x33')](_0x1b84('0x77'),_0x1faad6,_0x2ba232,_0x759a49[_0x1b84('0x78')]));_0x362f56[_0x1b84('0x79')]=_0x759a49[_0x1b84('0x7a')];_0x362f56[_0x1b84('0x7b')]=_0x759a49[_0x1b84('0x78')];logger[_0x1b84('0x68')](util[_0x1b84('0x33')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1faad6));return startTranscribe(_0xb7aa3,_0x357721,_0x5673c9,uuidv4(),_0x454b30,_0x759a49[_0x1b84('0x78')]);})[_0x1b84('0x24')](function(_0x382139){logger[_0x1b84('0x68')](util[_0x1b84('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1faad6,_0x382139['TranscriptionJob'][_0x1b84('0x7c')]));_0x362f56['transcribeName']=_0x382139[_0x1b84('0x7d')][_0x1b84('0x7c')];_0x362f56[_0x1b84('0x7e')]=_0x382139[_0x1b84('0x7d')][_0x1b84('0x7f')];return _0x36b941(_0x362f56);})[_0x1b84('0x4b')](function(_0x45556c){return _0x4a7189(_0x45556c);});});}exports['runTranscribe']=function(_0xb273ee,_0x248a71,_0x5a7757){var _0x3adcb6;var _0x420d30;var _0x56b321;var _0x240f86=require('../../components/encryptor');return db['VoiceRecording']['findOne']({'where':{'id':_0xb273ee[_0x1b84('0x46')]['id']}})[_0x1b84('0x24')](function(_0x3d709a){if(_0x3d709a){var _0x1b9336=util[_0x1b84('0x33')]('%s.cypher',_0x3d709a['value']);if(fs['existsSync'](_0x1b9336)){cypher=!![];return _0x240f86[_0x1b84('0x55')](_0x1b9336,_0x3d709a[_0x1b84('0x52')],config[_0x1b84('0x56')][_0x1b84('0x57')])['then'](function(){return _0x3d709a;});}return _0x3d709a;}})[_0x1b84('0x24')](function(_0x76453c){if(!_0x76453c){throw new db[(_0x1b84('0x58'))]['ValidationError'](_0x1b84('0x80'));}_0x420d30=_0x76453c;return db[_0x1b84('0x81')][_0x1b84('0x82')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x248a71,null))['then'](function(_0x3a99b9){if(_0x3a99b9){_0x3adcb6=_0x3a99b9;if(!_0x3adcb6[_0x1b84('0x83')]||!_0x3adcb6[_0x1b84('0x84')]||!_0x3adcb6[_0x1b84('0x85')]||!_0x3adcb6[_0x1b84('0x86')]||!_0x3adcb6[_0x1b84('0x79')]){throw new db[(_0x1b84('0x58'))][(_0x1b84('0x66'))]('Transcribe\x20not\x20configured');}if(_0xb273ee[_0x1b84('0x4d')][_0x1b84('0x87')]&&(!_0x3adcb6[_0x1b84('0x88')]||!_0x3adcb6[_0x1b84('0x89')]||!_0x3adcb6[_0x1b84('0x8a')]||!_0x3adcb6[_0x1b84('0x86')]||!_0x3adcb6[_0x1b84('0x79')])){throw new db[(_0x1b84('0x58'))][(_0x1b84('0x66'))](_0x1b84('0x8b'));}return db[_0x1b84('0x8c')][_0x1b84('0x82')]({'where':{'id':_0x3adcb6[_0x1b84('0x84')]}});}})[_0x1b84('0x24')](function(_0x1c7ffa){if(!_0x1c7ffa){throw new db[(_0x1b84('0x58'))][(_0x1b84('0x66'))](_0x1b84('0x8d'));}if(!_0x1c7ffa[_0x1b84('0x8e')]||!_0x1c7ffa[_0x1b84('0x8f')]){throw new db[(_0x1b84('0x58'))][(_0x1b84('0x66'))](_0x1b84('0x90'));}_0x56b321=_0x1c7ffa;return getBucketslist(_0x56b321[_0x1b84('0x8e')],_0x56b321[_0x1b84('0x8f')],_0x3adcb6['transcribeRegion']);})[_0x1b84('0x24')](function(_0x369655){if(_0x369655&&_0x369655['Buckets']){var _0x232847=_[_0x1b84('0x4a')](_0x369655['Buckets'],function(_0x20aa3d){return _0x20aa3d[_0x1b84('0x91')]===_0x3adcb6[_0x1b84('0x79')];});if(!_0x232847){logger[_0x1b84('0x68')](util[_0x1b84('0x33')](_0x1b84('0x92'),_0xb273ee[_0x1b84('0x46')]['id'],_0x3adcb6[_0x1b84('0x79')]));return createBucket(_0x56b321['data1'],_0x56b321[_0x1b84('0x8f')],_0x3adcb6['transcribeRegion'],_0x3adcb6[_0x1b84('0x79')]);}logger['info'](util[_0x1b84('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0xb273ee[_0x1b84('0x46')]['id'],_0x3adcb6[_0x1b84('0x79')]));return;}})[_0x1b84('0x24')](function(_0x31726e){if(_0x420d30[_0x1b84('0x7e')]===_0x1b84('0x93')){return transcribe(_0xb273ee[_0x1b84('0x46')]['id'],_0x56b321[_0x1b84('0x8e')],_0x56b321[_0x1b84('0x8f')],_0x3adcb6[_0x1b84('0x85')],_0x3adcb6['bucket'],_0x420d30[_0x1b84('0x52')],_0x3adcb6[_0x1b84('0x86')]);}else{logger[_0x1b84('0x68')](util['format'](_0x1b84('0x94'),_0xb273ee['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x80853c){if(_0x80853c){_0x80853c[_0x1b84('0x95')]=_0xb273ee[_0x1b84('0x4d')][_0x1b84('0x87')];return _0x420d30['updateAttributes'](_0x80853c);}})['then'](respondWithResult(_0x248a71,null))[_0x1b84('0x4b')](handleError(_0x248a71,null));};function writeFile(_0x5f421f,_0x357966){return new Promise(function(_0x55b76f,_0x2b92c8){fs[_0x1b84('0x96')](_0x357966,_0x5f421f,function(_0x56423f,_0x38ca21){if(_0x56423f){return _0x2b92c8(_0x56423f);}else{return _0x55b76f(_0x38ca21);}});});}exports[_0x1b84('0x97')]=function(_0x5c29d2,_0x4a9b1f,_0x420dc5){return db[_0x1b84('0x2c')][_0x1b84('0x82')]({'where':{'id':_0x5c29d2[_0x1b84('0x46')]['id']}})[_0x1b84('0x24')](handleEntityNotFound(_0x4a9b1f))[_0x1b84('0x24')](function(_0x5abfa7){if(_0x5abfa7&&_0x5abfa7[_0x1b84('0x98')]){var _0x5edbd3=_0x5abfa7[_0x1b84('0x98')];var _0x5d8c9f=config['root']+_0x1b84('0x99')+_0x5abfa7['id']+'.txt';if(fs['existsSync'](_0x5d8c9f)){return _0x5d8c9f;}return writeFile(_0x5edbd3,_0x5d8c9f)[_0x1b84('0x24')](function(){return _0x5d8c9f;});}else{throw new db[(_0x1b84('0x58'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x1b84('0x24')](function(_0x311728){return _0x4a9b1f[_0x1b84('0x5b')](_0x311728);})[_0x1b84('0x4b')](handleError(_0x4a9b1f));};
\ No newline at end of file
+var _0xbf4c=['include','findAll','rows','catch','params','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','filename','extname','unlink','message','downloads','sequelize','col','token','$and','push','recording','VoiceRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','includeAll'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xbf4c,0xf2));var _0xcbf4=function(_0x3c302e,_0x2a353c){_0x3c302e=_0x3c302e-0x0;var _0x7bf43c=_0xbf4c[_0x3c302e];return _0x7bf43c;};'use strict';var emlformat=require(_0xcbf4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcbf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbf4('0x2'));var moment=require(_0xcbf4('0x3'));var BPromise=require(_0xcbf4('0x4'));var Mustache=require(_0xcbf4('0x5'));var util=require('util');var path=require('path');var sox=require(_0xcbf4('0x6'));var csv=require(_0xcbf4('0x7'));var ejs=require(_0xcbf4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbf4('0x9'));var squel=require(_0xcbf4('0xa'));var crypto=require(_0xcbf4('0xb'));var jsforce=require(_0xcbf4('0xc'));var deskjs=require(_0xcbf4('0xd'));var toCsv=require(_0xcbf4('0x7'));var querystring=require('querystring');var Papa=require(_0xcbf4('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0xcbf4('0xf'));var Redis=require('ioredis');var authService=require(_0xcbf4('0x10'));var qs=require(_0xcbf4('0x11'));var as=require(_0xcbf4('0x12'));var hardwareService=require(_0xcbf4('0x13'));var logger=require(_0xcbf4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xcbf4('0x15'));var licenseUtil=require(_0xcbf4('0x16'));var db=require(_0xcbf4('0x17'))['db'];function respondWithStatusCode(_0x26657b,_0x194271){_0x194271=_0x194271||0xcc;return function(_0x4811c6){if(_0x4811c6){return _0x26657b[_0xcbf4('0x18')](_0x194271);}return _0x26657b[_0xcbf4('0x19')](_0x194271)[_0xcbf4('0x1a')]();};}function respondWithResult(_0xbdba3c,_0x18b0ac){_0x18b0ac=_0x18b0ac||0xc8;return function(_0x486b12){if(_0x486b12){return _0xbdba3c[_0xcbf4('0x19')](_0x18b0ac)[_0xcbf4('0x1b')](_0x486b12);}};}function respondWithFilteredResult(_0x2a444a,_0x3aed83){return function(_0x2e2d8e){if(_0x2e2d8e){var _0x37a013=_0x2e2d8e[_0xcbf4('0x1c')],_0x1eeb04=_0x3aed83[_0xcbf4('0x1d')],_0x544b9c=_0x3aed83[_0xcbf4('0x1d')]+_0x3aed83[_0xcbf4('0x1e')],_0x3a4642;if(_0x544b9c>=_0x37a013){_0x544b9c=_0x37a013;_0x3a4642=0xc8;}else{_0x3a4642=0xce;}_0x2a444a[_0xcbf4('0x19')](_0x3a4642);return _0x2a444a['set'](_0xcbf4('0x1f'),_0x1eeb04+'-'+_0x544b9c+'/'+_0x37a013)[_0xcbf4('0x1b')](_0x2e2d8e);}return null;};}function patchUpdates(_0x8c371d){return function(_0x574a64){try{jsonpatch[_0xcbf4('0x20')](_0x574a64,_0x8c371d,!![]);}catch(_0x5081ee){return BPromise[_0xcbf4('0x21')](_0x5081ee);}return _0x574a64[_0xcbf4('0x22')]();};}function saveUpdates(_0x2de2de,_0x43eb6d){return function(_0x1f6d57){if(_0x1f6d57){return _0x1f6d57[_0xcbf4('0x23')](_0x2de2de)['then'](function(_0x24874a){return _0x24874a;});}return null;};}function removeEntity(_0x4ffe7e,_0x1dfc13){return function(_0x11ab4e){if(_0x11ab4e){return _0x11ab4e[_0xcbf4('0x24')]()[_0xcbf4('0x25')](function(){_0x4ffe7e[_0xcbf4('0x19')](0xcc)[_0xcbf4('0x1a')]();});}};}function handleEntityNotFound(_0x578190,_0x20bf7c){return function(_0xdf68e5){if(!_0xdf68e5){_0x578190[_0xcbf4('0x18')](0x194);}return _0xdf68e5;};}function handleError(_0x4b6bf4,_0x222a53){_0x222a53=_0x222a53||0x1f4;return function(_0x36a76f){logger[_0xcbf4('0x26')](_0x36a76f[_0xcbf4('0x27')]);if(_0x36a76f[_0xcbf4('0x28')]){delete _0x36a76f[_0xcbf4('0x28')];}_0x4b6bf4[_0xcbf4('0x19')](_0x222a53)[_0xcbf4('0x29')](_0x36a76f);};}exports['index']=function(_0x561d05,_0x47ad3b){var _0x5add34={},_0x18292b={},_0x1cc7f2={'count':0x0,'rows':[]};var _0x389747=_[_0xcbf4('0x2a')](db[_0xcbf4('0x2b')][_0xcbf4('0x2c')],function(_0x18de87){return{'name':_0x18de87[_0xcbf4('0x2d')],'type':_0x18de87[_0xcbf4('0x2e')][_0xcbf4('0x2f')]};});_0x18292b[_0xcbf4('0x30')]=_[_0xcbf4('0x31')](_['map'](_0x389747,_0xcbf4('0x28')),[_0xcbf4('0x32')]);_0x18292b[_0xcbf4('0x33')]=_[_0xcbf4('0x34')](_0x561d05[_0xcbf4('0x33')]);_0x18292b[_0xcbf4('0x35')]=_[_0xcbf4('0x36')](_0x18292b[_0xcbf4('0x30')],_0x18292b[_0xcbf4('0x33')]);_0x5add34[_0xcbf4('0x37')]=_[_0xcbf4('0x36')](_0x18292b[_0xcbf4('0x30')],qs[_0xcbf4('0x38')](_0x561d05['query'][_0xcbf4('0x38')]));_0x5add34[_0xcbf4('0x37')]=_0x5add34['attributes'][_0xcbf4('0x39')]?_0x5add34[_0xcbf4('0x37')]:_0x18292b[_0xcbf4('0x30')];if(!_0x561d05[_0xcbf4('0x33')]['hasOwnProperty']('nolimit')){_0x5add34[_0xcbf4('0x1e')]=qs['limit'](_0x561d05[_0xcbf4('0x33')]['limit']);_0x5add34[_0xcbf4('0x1d')]=qs['offset'](_0x561d05[_0xcbf4('0x33')][_0xcbf4('0x1d')]);}_0x5add34[_0xcbf4('0x3a')]=qs[_0xcbf4('0x3b')](_0x561d05[_0xcbf4('0x33')]['sort']);_0x5add34[_0xcbf4('0x3c')]=qs[_0xcbf4('0x35')](_[_0xcbf4('0x3d')](_0x561d05['query'],_0x18292b[_0xcbf4('0x35')]),_0x389747);if(_0x561d05['query'][_0xcbf4('0x3e')]){_0x5add34['where']=_['merge'](_0x5add34['where'],{'$or':_[_0xcbf4('0x2a')](_0x389747,function(_0x5c0b83){if(_0x5c0b83['type']!==_0xcbf4('0x3f')){var _0x3585eb={};_0x3585eb[_0x5c0b83[_0xcbf4('0x28')]]={'$like':'%'+_0x561d05['query']['filter']+'%'};return _0x3585eb;}})});}_0x5add34=_[_0xcbf4('0x40')]({},_0x5add34,_0x561d05['options']);var _0x25b4d8={'where':_0x5add34[_0xcbf4('0x3c')]};return db[_0xcbf4('0x2b')]['count'](_0x25b4d8)[_0xcbf4('0x25')](function(_0x68937a){_0x1cc7f2[_0xcbf4('0x1c')]=_0x68937a;if(_0x561d05[_0xcbf4('0x33')][_0xcbf4('0x41')]){_0x5add34[_0xcbf4('0x42')]=[{'all':!![]}];}return db[_0xcbf4('0x2b')][_0xcbf4('0x43')](_0x5add34);})[_0xcbf4('0x25')](function(_0x59f882){_0x1cc7f2[_0xcbf4('0x44')]=_0x59f882;return _0x1cc7f2;})[_0xcbf4('0x25')](respondWithFilteredResult(_0x47ad3b,_0x5add34))[_0xcbf4('0x45')](handleError(_0x47ad3b,null));};exports['show']=function(_0x53879d,_0x54b19b){var _0x4a4d3a={'raw':![],'where':{'id':_0x53879d[_0xcbf4('0x46')]['id']}},_0x9fb395={};_0x9fb395[_0xcbf4('0x30')]=_[_0xcbf4('0x34')](db[_0xcbf4('0x2b')]['rawAttributes']);_0x9fb395[_0xcbf4('0x33')]=_[_0xcbf4('0x34')](_0x53879d['query']);_0x9fb395[_0xcbf4('0x35')]=_[_0xcbf4('0x36')](_0x9fb395['model'],_0x9fb395['query']);_0x4a4d3a[_0xcbf4('0x37')]=_[_0xcbf4('0x36')](_0x9fb395[_0xcbf4('0x30')],qs[_0xcbf4('0x38')](_0x53879d[_0xcbf4('0x33')][_0xcbf4('0x38')]));_0x4a4d3a[_0xcbf4('0x37')]=_0x4a4d3a['attributes']['length']?_0x4a4d3a[_0xcbf4('0x37')]:_0x9fb395[_0xcbf4('0x30')];if(_0x53879d['query'][_0xcbf4('0x41')]){_0x4a4d3a['include']=[{'all':!![]}];}_0x4a4d3a=_[_0xcbf4('0x40')]({},_0x4a4d3a,_0x53879d[_0xcbf4('0x47')]);return db[_0xcbf4('0x2b')][_0xcbf4('0x48')](_0x4a4d3a)['then'](handleEntityNotFound(_0x54b19b,null))[_0xcbf4('0x25')](respondWithResult(_0x54b19b,null))[_0xcbf4('0x45')](handleError(_0x54b19b,null));};exports[_0xcbf4('0x49')]=function(_0x59b514,_0xffbf10){return db[_0xcbf4('0x2b')][_0xcbf4('0x49')](_0x59b514[_0xcbf4('0x4a')],{})['then'](respondWithResult(_0xffbf10,0xc9))[_0xcbf4('0x45')](handleError(_0xffbf10,null));};exports['update']=function(_0x10a5bd,_0x57d460){if(_0x10a5bd[_0xcbf4('0x4a')]['id']){delete _0x10a5bd[_0xcbf4('0x4a')]['id'];}return db[_0xcbf4('0x2b')][_0xcbf4('0x48')]({'where':{'id':_0x10a5bd[_0xcbf4('0x46')]['id']}})['then'](handleEntityNotFound(_0x57d460,null))[_0xcbf4('0x25')](saveUpdates(_0x10a5bd[_0xcbf4('0x4a')],null))[_0xcbf4('0x25')](respondWithResult(_0x57d460,null))[_0xcbf4('0x45')](handleError(_0x57d460,null));};exports[_0xcbf4('0x4b')]=function(_0x17107d,_0x4fb4ee){return db[_0xcbf4('0x2b')][_0xcbf4('0x4b')]()[_0xcbf4('0x25')](respondWithResult(_0x4fb4ee,null))[_0xcbf4('0x45')](handleError(_0x4fb4ee,null));};exports[_0xcbf4('0x4c')]=function(_0x24236e,_0x5d9220,_0x47f619){var _0xc4c60a=require(_0xcbf4('0x4d'));var _0x498f2f=![];var _0x31707a={};if(_0x24236e[_0xcbf4('0x33')][_0xcbf4('0x2e')]&&_0x24236e['query'][_0xcbf4('0x2e')]===_0xcbf4('0x4e')){_0x31707a['uniqueid']=_0x24236e[_0xcbf4('0x46')]['id'];}else{_0x31707a['id']=_0x24236e['params']['id'];}return db[_0xcbf4('0x2b')][_0xcbf4('0x48')]({'where':_0x31707a,'attributes':['id',_0xcbf4('0x4f')],'raw':!![]})[_0xcbf4('0x25')](handleEntityNotFound(_0x5d9220,null))[_0xcbf4('0x25')](function(_0x3660a9){if(_0x3660a9){var _0x5ab494=_0x3660a9['value'];var _0x27ca12=util[_0xcbf4('0x32')](_0xcbf4('0x50'),_0x5ab494);if(fs[_0xcbf4('0x51')](_0x27ca12)){_0x498f2f=!![];return _0xc4c60a[_0xcbf4('0x52')](_0x27ca12,_0x5ab494,config[_0xcbf4('0x53')]['recording'])[_0xcbf4('0x25')](function(){return _0x3660a9;});}return _0x3660a9;}})[_0xcbf4('0x25')](function(_0xc428e0){if(_0xc428e0){var _0x10da1b=_0xc428e0['value'];if(!fs[_0xcbf4('0x51')](_0x10da1b)){throw new db[(_0xcbf4('0x54'))][(_0xcbf4('0x55'))]('VoiceRecording\x20not\x20found');}if(_0xc428e0[_0xcbf4('0x56')]){return _0x5d9220[_0xcbf4('0x4c')](_0x10da1b,_0xc428e0['filename']+path[_0xcbf4('0x57')](_0x10da1b),function(){if(_0x498f2f){fs[_0xcbf4('0x58')](_0x10da1b);}});}else{return _0x5d9220[_0xcbf4('0x4c')](_0x10da1b,function(_0x54638a){if(_0x498f2f){fs['unlink'](_0x10da1b);}});}}})['catch'](function(_0x409549){if(_0x409549[_0xcbf4('0x59')]==='VoiceRecording\x20not\x20found'){_0x5d9220['status'](0x194)[_0xcbf4('0x29')]('Not\x20found');}else{return handleError(_0x5d9220,null);}});};exports[_0xcbf4('0x5a')]=function(_0x5885d6,_0x5d0d2f,_0x1525d7){var _0x388e36=require(_0xcbf4('0x4d'));var _0x37636a=![];var _0x3a95e2={'$and':[db[_0xcbf4('0x5b')][_0xcbf4('0x3c')](db[_0xcbf4('0x5b')]['fn']('MD5',db[_0xcbf4('0x5b')][_0xcbf4('0x5c')](_0xcbf4('0x4e'))),_0x5885d6[_0xcbf4('0x33')][_0xcbf4('0x5d')])]};if(_0x5885d6[_0xcbf4('0x33')][_0xcbf4('0x2e')]&&_0x5885d6[_0xcbf4('0x33')]['type']==='uniqueid'){_0x3a95e2[_0xcbf4('0x5e')][_0xcbf4('0x5f')]({'uniqueid':_0x5885d6[_0xcbf4('0x46')]['id']});}else{_0x3a95e2[_0xcbf4('0x5e')]['push']({'id':_0x5885d6[_0xcbf4('0x46')]['id']});}return db[_0xcbf4('0x2b')]['find']({'where':_0x3a95e2,'attributes':['id','value'],'raw':!![]})[_0xcbf4('0x25')](handleEntityNotFound(_0x5d0d2f,null))[_0xcbf4('0x25')](function(_0x107fcd){if(_0x107fcd){var _0x52797b=util['format'](_0xcbf4('0x50'),_0x107fcd[_0xcbf4('0x4f')]);if(fs[_0xcbf4('0x51')](_0x52797b)){_0x37636a=!![];return _0x388e36['decryptFile'](_0x52797b,_0x107fcd[_0xcbf4('0x4f')],config[_0xcbf4('0x53')][_0xcbf4('0x60')])['then'](function(){return _0x107fcd;});}return _0x107fcd;}})['then'](function(_0x595dd1){if(_0x595dd1){if(!fs[_0xcbf4('0x51')](_0x595dd1['value'])){throw new db[(_0xcbf4('0x54'))][(_0xcbf4('0x55'))](_0xcbf4('0x61'));}if(_0x595dd1[_0xcbf4('0x56')]){return _0x5d0d2f[_0xcbf4('0x4c')](_0x595dd1[_0xcbf4('0x4f')],_0x595dd1[_0xcbf4('0x56')]+path[_0xcbf4('0x57')](_0x595dd1[_0xcbf4('0x4f')]),function(){if(_0x37636a){fs[_0xcbf4('0x58')](_0x595dd1[_0xcbf4('0x4f')]);}});}else{return _0x5d0d2f[_0xcbf4('0x4c')](_0x595dd1[_0xcbf4('0x4f')],function(_0x206758){if(_0x37636a){fs['unlink'](_0x595dd1[_0xcbf4('0x4f')]);}});}}})['catch'](handleError(_0x5d0d2f,null));};exports[_0xcbf4('0x24')]=function(_0x4ddc87,_0x47f295){return db['VoiceRecording'][_0xcbf4('0x48')]({'where':{'id':_0x4ddc87[_0xcbf4('0x46')]['id']}})[_0xcbf4('0x25')](function(_0x395308){if(!_0x395308)throw new ReferenceError(_0xcbf4('0x62'));return _0x395308;})['then'](function(_0x5c2f83){var _0x37d0ff=_0x5c2f83[_0xcbf4('0x4f')];logger[_0xcbf4('0x63')](_0xcbf4('0x64'),_0x37d0ff);if(!_[_0xcbf4('0x65')](_0x5c2f83['value'])&&fs[_0xcbf4('0x51')](_0x37d0ff)){logger[_0xcbf4('0x63')](_0xcbf4('0x66')+_0x37d0ff+_0xcbf4('0x67'));fs['unlinkSync'](_0x37d0ff);}_0x37d0ff=_0x37d0ff+_0xcbf4('0x68');if(!_[_0xcbf4('0x65')](_0x5c2f83[_0xcbf4('0x4f')])&&fs[_0xcbf4('0x51')](_0x37d0ff)){logger[_0xcbf4('0x63')]('File:\x20\x22'+_0x37d0ff+_0xcbf4('0x67'));fs[_0xcbf4('0x69')](_0x37d0ff);}return _0x5c2f83;})['then'](function(_0x2d756d){if(!_0x2d756d)throw new InternalError();return _0x2d756d['destroy']();})[_0xcbf4('0x25')](function(){_0x47f295[_0xcbf4('0x19')](0xcc)[_0xcbf4('0x1a')]();})[_0xcbf4('0x45')](handleError(_0x47f295,null));};function getBucketslist(_0x21be4d,_0x2ce763,_0x40d6b8){return new Promise(function(_0x8d50a9,_0x56ca39){var _0x238b3e=new AWS['S3']({'accessKeyId':_0x2ce763,'secretAccessKey':_0x21be4d,'region':_0x40d6b8});_0x238b3e[_0xcbf4('0x6a')]({},function(_0x5b6f86,_0x570868){if(_0x5b6f86){return _0x56ca39(_0x5b6f86);}else{return _0x8d50a9(_0x570868);}});});}function createBucket(_0x42127c,_0x50e543,_0x30dae1,_0x22e0fb){return new Promise(function(_0x3f9eaa,_0x583334){var _0x463d55=new AWS['S3']({'accessKeyId':_0x50e543,'secretAccessKey':_0x42127c,'region':_0x30dae1});_0x463d55[_0xcbf4('0x6b')]({'Bucket':_0x22e0fb},function(_0x16ac30,_0x470384){if(_0x16ac30){return _0x583334(_0x16ac30);}else{return _0x3f9eaa(_0x470384);}});});}function uploadFile(_0x5e9f1b,_0x4f2673,_0xa4d101,_0x2d31be,_0x46ee12,_0x26be43){return new Promise(function(_0x44e450,_0x1ed488){var _0x360d00=new AWS['S3']({'accessKeyId':_0x4f2673,'secretAccessKey':_0x5e9f1b,'region':_0xa4d101});_0x360d00[_0xcbf4('0x6c')]({'Bucket':_0x2d31be,'Key':_0x46ee12,'Body':_0x26be43},function(_0xf50fd4,_0xdd68a3){if(_0xf50fd4){return _0x1ed488(_0xf50fd4);}else{return _0x44e450(_0xdd68a3);}});});}function startTranscribe(_0x52168e,_0x1ae7c6,_0x481cf1,_0x5bfb3f,_0x302eea,_0x20ee75){return new Promise(function(_0x2e5dee,_0x54cb52){var _0x468b96=new AWS[(_0xcbf4('0x6d'))]({'accessKeyId':_0x1ae7c6,'secretAccessKey':_0x52168e,'region':_0x481cf1});_0x468b96[_0xcbf4('0x6e')]({'TranscriptionJobName':_0x5bfb3f,'LanguageCode':_0x302eea,'Media':{'MediaFileUri':_0x20ee75}},function(_0x15876b,_0x6b8239){if(_0x15876b){return _0x54cb52(_0x15876b);}else{return _0x2e5dee(_0x6b8239);}});});}function transcribe(_0x4c9d31,_0x20e034,_0x591b51,_0x2d9d1f,_0x545a1c,_0x50c39c,_0x20d315){return new Promise(function(_0x4b557a,_0x122be3){var _0xe14235={};logger[_0xcbf4('0x63')](util[_0xcbf4('0x32')](_0xcbf4('0x6f'),_0x4c9d31,_0x545a1c));return uploadFile(_0x20e034,_0x591b51,_0x2d9d1f,_0x545a1c,path['basename'](_0x50c39c),fs[_0xcbf4('0x70')](_0x50c39c))['then'](function(_0x156f7c){logger[_0xcbf4('0x63')](util[_0xcbf4('0x32')](_0xcbf4('0x71'),_0x4c9d31,_0x545a1c,_0x156f7c[_0xcbf4('0x72')]));_0xe14235[_0xcbf4('0x73')]=_0x156f7c[_0xcbf4('0x74')];_0xe14235[_0xcbf4('0x75')]=_0x156f7c[_0xcbf4('0x72')];logger[_0xcbf4('0x63')](util[_0xcbf4('0x32')](_0xcbf4('0x76'),_0x4c9d31));return startTranscribe(_0x20e034,_0x591b51,_0x2d9d1f,uuidv4(),_0x20d315,_0x156f7c[_0xcbf4('0x72')]);})[_0xcbf4('0x25')](function(_0x42dc64){logger[_0xcbf4('0x63')](util[_0xcbf4('0x32')](_0xcbf4('0x77'),_0x4c9d31,_0x42dc64[_0xcbf4('0x78')][_0xcbf4('0x79')]));_0xe14235[_0xcbf4('0x7a')]=_0x42dc64[_0xcbf4('0x78')][_0xcbf4('0x79')];_0xe14235['transcribeStatus']=_0x42dc64[_0xcbf4('0x78')]['TranscriptionJobStatus'];return _0x4b557a(_0xe14235);})[_0xcbf4('0x45')](function(_0x32c2ea){return _0x122be3(_0x32c2ea);});});}exports[_0xcbf4('0x7b')]=function(_0xb9a7a2,_0x55f7fb,_0x309c60){var _0x197351;var _0x3fd6b7;var _0x52b8fd;var _0x5249fd=require('../../components/encryptor');return db[_0xcbf4('0x2b')][_0xcbf4('0x7c')]({'where':{'id':_0xb9a7a2['params']['id']}})[_0xcbf4('0x25')](function(_0x228af4){if(_0x228af4){var _0xcc5c1d=util['format'](_0xcbf4('0x50'),_0x228af4[_0xcbf4('0x4f')]);if(fs[_0xcbf4('0x51')](_0xcc5c1d)){cypher=!![];return _0x5249fd[_0xcbf4('0x52')](_0xcc5c1d,_0x228af4[_0xcbf4('0x4f')],config[_0xcbf4('0x53')][_0xcbf4('0x60')])['then'](function(){return _0x228af4;});}return _0x228af4;}})['then'](function(_0x19fd3b){if(!_0x19fd3b){throw new db[(_0xcbf4('0x54'))][(_0xcbf4('0x55'))](_0xcbf4('0x7d'));}_0x3fd6b7=_0x19fd3b;return db[_0xcbf4('0x7e')][_0xcbf4('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x55f7fb,null))[_0xcbf4('0x25')](function(_0x46e599){if(_0x46e599){_0x197351=_0x46e599;if(!_0x197351[_0xcbf4('0x7f')]||!_0x197351[_0xcbf4('0x80')]||!_0x197351['transcribeRegion']||!_0x197351['language']||!_0x197351[_0xcbf4('0x73')]){throw new db[(_0xcbf4('0x54'))][(_0xcbf4('0x55'))](_0xcbf4('0x81'));}if(_0xb9a7a2[_0xcbf4('0x4a')]['runSentiment']&&(!_0x197351['sentiment']||!_0x197351[_0xcbf4('0x82')]||!_0x197351[_0xcbf4('0x83')]||!_0x197351[_0xcbf4('0x84')]||!_0x197351['bucket'])){throw new db[(_0xcbf4('0x54'))][(_0xcbf4('0x55'))](_0xcbf4('0x85'));}return db[_0xcbf4('0x86')][_0xcbf4('0x7c')]({'where':{'id':_0x197351[_0xcbf4('0x80')]}});}})[_0xcbf4('0x25')](function(_0x17d69e){if(!_0x17d69e){throw new db[(_0xcbf4('0x54'))][(_0xcbf4('0x55'))](_0xcbf4('0x87'));}if(!_0x17d69e['data1']||!_0x17d69e[_0xcbf4('0x88')]){throw new db[(_0xcbf4('0x54'))][(_0xcbf4('0x55'))](_0xcbf4('0x89'));}_0x52b8fd=_0x17d69e;return getBucketslist(_0x52b8fd[_0xcbf4('0x8a')],_0x52b8fd['data2'],_0x197351[_0xcbf4('0x8b')]);})[_0xcbf4('0x25')](function(_0x34fd3e){if(_0x34fd3e&&_0x34fd3e['Buckets']){var _0x2f92b5=_[_0xcbf4('0x48')](_0x34fd3e[_0xcbf4('0x8c')],function(_0x4cec2c){return _0x4cec2c[_0xcbf4('0x8d')]===_0x197351[_0xcbf4('0x73')];});if(!_0x2f92b5){logger[_0xcbf4('0x63')](util[_0xcbf4('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0xb9a7a2[_0xcbf4('0x46')]['id'],_0x197351[_0xcbf4('0x73')]));return createBucket(_0x52b8fd['data1'],_0x52b8fd[_0xcbf4('0x88')],_0x197351['transcribeRegion'],_0x197351[_0xcbf4('0x73')]);}logger[_0xcbf4('0x63')](util['format'](_0xcbf4('0x8e'),_0xb9a7a2['params']['id'],_0x197351[_0xcbf4('0x73')]));return;}})[_0xcbf4('0x25')](function(_0x102822){if(_0x3fd6b7[_0xcbf4('0x8f')]===_0xcbf4('0x90')){return transcribe(_0xb9a7a2['params']['id'],_0x52b8fd[_0xcbf4('0x8a')],_0x52b8fd[_0xcbf4('0x88')],_0x197351[_0xcbf4('0x8b')],_0x197351['bucket'],_0x3fd6b7[_0xcbf4('0x4f')],_0x197351[_0xcbf4('0x84')]);}else{logger[_0xcbf4('0x63')](util['format'](_0xcbf4('0x91'),_0xb9a7a2[_0xcbf4('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xcbf4('0x25')](function(_0x17f196){if(_0x17f196){_0x17f196[_0xcbf4('0x92')]=_0xb9a7a2[_0xcbf4('0x4a')]['runSentiment'];return _0x3fd6b7[_0xcbf4('0x93')](_0x17f196);}})[_0xcbf4('0x25')](respondWithResult(_0x55f7fb,null))[_0xcbf4('0x45')](handleError(_0x55f7fb,null));};function writeFile(_0x1bcd7d,_0x13e563){return new Promise(function(_0x4f1c04,_0x3632c4){fs[_0xcbf4('0x94')](_0x13e563,_0x1bcd7d,function(_0x247072,_0x220542){if(_0x247072){return _0x3632c4(_0x247072);}else{return _0x4f1c04(_0x220542);}});});}exports[_0xcbf4('0x95')]=function(_0x46d1e8,_0x3a930e,_0x541e7a){return db[_0xcbf4('0x2b')][_0xcbf4('0x7c')]({'where':{'id':_0x46d1e8[_0xcbf4('0x46')]['id']}})[_0xcbf4('0x25')](handleEntityNotFound(_0x3a930e))[_0xcbf4('0x25')](function(_0x2cce43){if(_0x2cce43&&_0x2cce43['fileText']){var _0xc48f0b=_0x2cce43[_0xcbf4('0x96')];var _0x878564=config['root']+_0xcbf4('0x97')+_0x2cce43['id']+_0xcbf4('0x98');if(fs[_0xcbf4('0x51')](_0x878564)){return _0x878564;}return writeFile(_0xc48f0b,_0x878564)['then'](function(){return _0x878564;});}else{throw new db[(_0xcbf4('0x54'))][(_0xcbf4('0x55'))](_0xcbf4('0x99'));}})[_0xcbf4('0x25')](function(_0x2c0519){return _0x3a930e[_0xcbf4('0x4c')](_0x2c0519);})[_0xcbf4('0x45')](handleError(_0x3a930e));};
\ No newline at end of file