@eka-care/ekascribe-ts-sdk 1.5.81 → 1.5.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audio-chunker/audio-file-manager.js +11 -26
- package/dist/shared-worker/s3-file-upload.js +60 -110
- package/dist/shared-worker/worker-code.generated.d.ts +1 -0
- package/dist/shared-worker/worker-code.generated.js +4 -0
- package/package.json +3 -2
- package/dist/api/get-transaction-history.d.ts +0 -5
- package/dist/api/get-transaction-history.js +0 -28
- package/dist/api/get-voice-api-v2-config.d.ts +0 -2
- package/dist/api/get-voice-api-v2-config.js +0 -26
- package/dist/api/get-voice-api-v2-status.d.ts +0 -51
- package/dist/api/get-voice-api-v2-status.js +0 -25
- package/dist/api/get-voice-api-v3-status.d.ts +0 -51
- package/dist/api/get-voice-api-v3-status.js +0 -26
- package/dist/api/patch-transaction-status.d.ts +0 -4
- package/dist/api/patch-transaction-status.js +0 -43
- package/dist/api/post-transaction-commit.d.ts +0 -3
- package/dist/api/post-transaction-commit.js +0 -32
- package/dist/api/post-transaction-init.d.ts +0 -3
- package/dist/api/post-transaction-init.js +0 -40
- package/dist/api/post-transaction-stop.d.ts +0 -3
- package/dist/api/post-transaction-stop.js +0 -32
- package/dist/api/templates/post-convert-transaction-to-template.d.ts +0 -3
- package/dist/api/templates/post-convert-transaction-to-template.js +0 -32
- package/dist/api/transaction/get-voice-api-v2-config.d.ts +0 -2
- package/dist/api/transaction/get-voice-api-v2-config.js +0 -26
- package/dist/api/transaction/get-voice-api-v3-status-transcription.d.ts +0 -61
- package/dist/api/transaction/get-voice-api-v3-status-transcription.js +0 -26
- package/dist/audio-chunker/__tests__/audio-file-manager.test.d.ts +0 -1
- package/dist/audio-chunker/__tests__/audio-file-manager.test.js +0 -5
- package/dist/shared-worker/s3-file-upload.ts +0 -128
- package/dist/utils/search-sessions-by-patient-name.d.ts +0 -7
- package/dist/utils/search-sessions-by-patient-name.js +0 -27
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { AUDIO_EXTENSION_TYPE_MAP, OUTPUT_FORMAT } from '../constants/constant';
|
|
2
|
-
import pushFileToS3 from '../aws-services/upload-file-to-s3';
|
|
3
1
|
import postCogInit from '../api/post-cog-init';
|
|
4
2
|
import { configureAWS } from '../aws-services/configure-aws';
|
|
3
|
+
import pushFileToS3 from '../aws-services/upload-file-to-s3';
|
|
4
|
+
import { AUDIO_EXTENSION_TYPE_MAP, OUTPUT_FORMAT } from '../constants/constant';
|
|
5
5
|
import { CALLBACK_TYPE, SHARED_WORKER_ACTION } from '../constants/enums';
|
|
6
|
-
import compressAudioToMp3 from '../utils/compress-mp3-audio';
|
|
7
|
-
import EkaScribeStore from '../store/store';
|
|
8
6
|
import { GET_S3_BUCKET_NAME } from '../fetch-client/helper';
|
|
7
|
+
import { SHARED_WORKER_CODE } from '../shared-worker/worker-code.generated';
|
|
8
|
+
import EkaScribeStore from '../store/store';
|
|
9
|
+
import compressAudioToMp3 from '../utils/compress-mp3-audio';
|
|
9
10
|
class AudioFileManager {
|
|
10
11
|
initialiseClassInstance() {
|
|
11
12
|
this.audioChunks = [];
|
|
@@ -133,8 +134,10 @@ class AudioFileManager {
|
|
|
133
134
|
}
|
|
134
135
|
createSharedWorkerInstance() {
|
|
135
136
|
try {
|
|
136
|
-
//
|
|
137
|
-
const
|
|
137
|
+
// Create a Blob URL from the inline worker code to avoid cross-origin issues
|
|
138
|
+
const blob = new Blob([SHARED_WORKER_CODE], { type: 'application/javascript' });
|
|
139
|
+
const workerUrl = URL.createObjectURL(blob);
|
|
140
|
+
const worker = new SharedWorker(workerUrl);
|
|
138
141
|
this.sharedWorkerInstance = worker;
|
|
139
142
|
const onEventCallback = EkaScribeStore.eventCallback;
|
|
140
143
|
this.sharedWorkerInstance.port.onmessage = async (event) => {
|
|
@@ -246,16 +249,7 @@ class AudioFileManager {
|
|
|
246
249
|
return true;
|
|
247
250
|
}
|
|
248
251
|
catch (error) {
|
|
249
|
-
|
|
250
|
-
if (errorMessage.includes('SecurityError') || errorMessage.includes('Failed to construct')) {
|
|
251
|
-
console.error('Error creating shared worker instance: CORS/Same-origin policy violation. ' +
|
|
252
|
-
'The SharedWorker script must be served from the same origin as your application, ' +
|
|
253
|
-
'or the server must allow cross-origin access with proper CORS headers. ' +
|
|
254
|
-
'Falling back to non-worker upload method.', error);
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
console.error('Error creating shared worker instance:', error);
|
|
258
|
-
}
|
|
252
|
+
console.error('Error creating shared worker instance:', error);
|
|
259
253
|
return false;
|
|
260
254
|
}
|
|
261
255
|
}
|
|
@@ -437,14 +431,7 @@ class AudioFileManager {
|
|
|
437
431
|
// Shared Workers are supported
|
|
438
432
|
console.log('Shared Workers are supported in this browser.');
|
|
439
433
|
if (!this.sharedWorkerInstance) {
|
|
440
|
-
|
|
441
|
-
if (!workerCreated) {
|
|
442
|
-
// SharedWorker creation failed (likely due to CORS/same-origin policy)
|
|
443
|
-
// Fall back to non-worker upload
|
|
444
|
-
console.warn('Failed to create SharedWorker instance. Falling back to non-worker upload method.');
|
|
445
|
-
await this.uploadAudioToS3WithoutWorker({ audioFrames, fileName, chunkIndex });
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
434
|
+
this.createSharedWorkerInstance();
|
|
448
435
|
}
|
|
449
436
|
await this.uploadAudioToS3WithWorker({ audioFrames, fileName, chunkIndex });
|
|
450
437
|
}
|
|
@@ -463,8 +450,6 @@ class AudioFileManager {
|
|
|
463
450
|
}
|
|
464
451
|
catch (error) {
|
|
465
452
|
console.error('Error uploading audio to S3: uploadAudioToS3WithWorker: ', error);
|
|
466
|
-
// Fall back to non-worker upload if worker fails
|
|
467
|
-
await this.uploadAudioToS3WithoutWorker({ audioFrames, fileName, chunkIndex });
|
|
468
453
|
}
|
|
469
454
|
}
|
|
470
455
|
async uploadAudioToS3WithoutWorker({ audioFrames, fileName, chunkIndex, }) {
|