@eka-care/ekascribe-ts-sdk 1.5.87 → 1.5.88

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.
Files changed (54) hide show
  1. package/dist/api/config/get-voice-api-v2-config-my-templates.js +22 -12
  2. package/dist/api/config/get-voice-api-v2-config.js +22 -12
  3. package/dist/api/config/patch-voice-api-v2-config.js +21 -13
  4. package/dist/api/post-cog-init.js +28 -15
  5. package/dist/api/post-v1-file-upload.js +38 -28
  6. package/dist/api/template-sections/delete-v1-template-section.js +37 -27
  7. package/dist/api/template-sections/get-v1-template-sections.js +37 -27
  8. package/dist/api/template-sections/patch-v1-template-section.js +46 -36
  9. package/dist/api/template-sections/post-v1-template-section.js +45 -35
  10. package/dist/api/templates/cook-v1-medai-ai-create-template.js +35 -25
  11. package/dist/api/templates/delete-v1-template.js +37 -27
  12. package/dist/api/templates/get-v1-templates.js +37 -27
  13. package/dist/api/templates/patch-v1-template.js +44 -33
  14. package/dist/api/templates/post-convert-transcription-to-template.js +41 -31
  15. package/dist/api/templates/post-transaction-convert-to-template.js +38 -28
  16. package/dist/api/templates/post-v1-template.js +43 -33
  17. package/dist/api/transaction/get-transaction-history.js +20 -9
  18. package/dist/api/transaction/get-voice-api-v3-status-transcript.js +21 -8
  19. package/dist/api/transaction/get-voice-api-v3-status.js +21 -8
  20. package/dist/api/transaction/patch-transaction-status.js +23 -14
  21. package/dist/api/transaction/patch-voice-api-v3-status.js +22 -12
  22. package/dist/api/transaction/post-transaction-commit.js +41 -31
  23. package/dist/api/transaction/post-transaction-init.js +52 -47
  24. package/dist/api/transaction/post-transaction-stop.js +41 -31
  25. package/dist/api/upload-audio-with-presigned-url.js +67 -55
  26. package/dist/audio-chunker/audio-buffer-manager.js +5 -3
  27. package/dist/audio-chunker/audio-file-manager.js +353 -350
  28. package/dist/audio-chunker/vad-web.js +116 -97
  29. package/dist/aws-services/configure-aws.js +5 -2
  30. package/dist/aws-services/get-files-s3.js +20 -7
  31. package/dist/aws-services/s3-retry-wrapper.js +44 -31
  32. package/dist/aws-services/translate-text-to-target-language.js +28 -15
  33. package/dist/aws-services/upload-file-to-s3.js +17 -6
  34. package/dist/constants/constant.js +22 -19
  35. package/dist/constants/enums.js +15 -12
  36. package/dist/constants/setup-config.js +10 -7
  37. package/dist/constants/types.js +2 -1
  38. package/dist/fetch-client/helper.js +24 -11
  39. package/dist/fetch-client/index.js +61 -52
  40. package/dist/index.js +321 -254
  41. package/dist/main/end-recording.js +56 -53
  42. package/dist/main/init-transaction.js +36 -27
  43. package/dist/main/pause-recording.js +17 -18
  44. package/dist/main/poll-output-summary.js +21 -7
  45. package/dist/main/resume-recording.js +13 -14
  46. package/dist/main/retry-upload-recording.js +39 -30
  47. package/dist/main/start-recording.js +34 -26
  48. package/dist/main/upload-full-audio-with-presigned-url.js +84 -69
  49. package/dist/shared-worker/s3-file-upload.js +88 -79
  50. package/dist/store/store.js +3 -1
  51. package/dist/utils/compress-mp3-audio.js +6 -4
  52. package/dist/utils/get-worker-url.js +12 -7
  53. package/dist/utils/search-past-sessions.js +23 -9
  54. package/package.json +1 -1
@@ -1,54 +1,62 @@
1
- import { SDK_STATUS_CODE } from '../constants/constant';
2
- import { ERROR_CODE } from '../constants/enums';
3
- import EkaScribeStore from '../store/store';
4
- const startVoiceRecording = async () => {
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const constant_1 = require("../constants/constant");
13
+ const enums_1 = require("../constants/enums");
14
+ const store_1 = require("../store/store");
15
+ const startVoiceRecording = () => __awaiter(void 0, void 0, void 0, function* () {
5
16
  try {
6
- const vadInstance = EkaScribeStore.vadInstance;
7
- const navigatorPermissionResponse = await navigator.permissions.query({
17
+ const vadInstance = store_1.default.vadInstance;
18
+ const navigatorPermissionResponse = yield navigator.permissions.query({
8
19
  name: 'microphone',
9
20
  });
10
21
  if (navigatorPermissionResponse.state !== 'granted') {
11
22
  return {
12
- error_code: ERROR_CODE.MICROPHONE,
13
- status_code: SDK_STATUS_CODE.FORBIDDEN,
23
+ error_code: enums_1.ERROR_CODE.MICROPHONE,
24
+ status_code: constant_1.SDK_STATUS_CODE.FORBIDDEN,
14
25
  message: 'Microphone access is required to start recording. Please recheck access.',
15
26
  };
16
27
  }
17
- await vadInstance?.initVad();
18
- const micVad = vadInstance?.getMicVad();
19
- const isVadLoading = vadInstance?.isVadLoading();
28
+ yield (vadInstance === null || vadInstance === void 0 ? void 0 : vadInstance.initVad());
29
+ const micVad = vadInstance === null || vadInstance === void 0 ? void 0 : vadInstance.getMicVad();
30
+ const isVadLoading = vadInstance === null || vadInstance === void 0 ? void 0 : vadInstance.isVadLoading();
20
31
  if (isVadLoading || !micVad || Object.keys(micVad).length === 0) {
21
32
  // retry initiating vad once and if still is in loading return error
22
- const reinitializeVadResponse = await vadInstance?.reinitializeVad();
33
+ const reinitializeVadResponse = yield (vadInstance === null || vadInstance === void 0 ? void 0 : vadInstance.reinitializeVad());
23
34
  if (reinitializeVadResponse) {
24
35
  return {
25
- error_code: ERROR_CODE.VAD_NOT_INITIALIZED,
26
- status_code: SDK_STATUS_CODE.FORBIDDEN,
36
+ error_code: enums_1.ERROR_CODE.VAD_NOT_INITIALIZED,
37
+ status_code: constant_1.SDK_STATUS_CODE.FORBIDDEN,
27
38
  message: 'VAD instance is not initialized. Please try again later.',
28
39
  };
29
40
  }
30
41
  }
31
- vadInstance?.startVad();
32
- const txn_id = EkaScribeStore.txnID;
33
- EkaScribeStore.sessionStatus[txn_id] = {
34
- ...EkaScribeStore.sessionStatus[txn_id],
35
- vad: {
42
+ vadInstance === null || vadInstance === void 0 ? void 0 : vadInstance.startVad();
43
+ const txn_id = store_1.default.txnID;
44
+ store_1.default.sessionStatus[txn_id] = Object.assign(Object.assign({}, store_1.default.sessionStatus[txn_id]), { vad: {
36
45
  status: 'start',
37
- },
38
- };
46
+ } });
39
47
  return {
40
48
  message: 'Recording started successfully.',
41
- status_code: SDK_STATUS_CODE.SUCCESS,
49
+ status_code: constant_1.SDK_STATUS_CODE.SUCCESS,
42
50
  txn_id,
43
51
  };
44
52
  }
45
53
  catch (err) {
46
54
  console.log('%c Line:102 🍇 startRecording err', 'color:#b03734', err);
47
55
  return {
48
- error_code: ERROR_CODE.INTERNAL_SERVER_ERROR,
49
- status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
56
+ error_code: enums_1.ERROR_CODE.INTERNAL_SERVER_ERROR,
57
+ status_code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
50
58
  message: `An error occurred while starting the recording: ${err}`,
51
59
  };
52
60
  }
53
- };
54
- export default startVoiceRecording;
61
+ });
62
+ exports.default = startVoiceRecording;
@@ -1,76 +1,91 @@
1
- import postV1FileUpload from '../api/post-v1-file-upload';
2
- import postTransactionInit from '../api/transaction/post-transaction-init';
3
- import uploadFilesWithPresignedUrl from '../api/upload-audio-with-presigned-url';
4
- import { SDK_STATUS_CODE } from '../constants/constant';
5
- import { ERROR_CODE } from '../constants/enums';
6
- export async function postV1UploadAudioFiles({ audioFiles, audioFileNames, txn_id, action, transfer, mode, input_language, output_language, output_format_template, model_training_consent, auto_download, system_info, patient_details, model_type, version, flavour, }) {
7
- try {
8
- // Step 1: Get presigned URL
9
- const presignedUrlResponse = await postV1FileUpload({ txn_id, action });
10
- if (presignedUrlResponse.code !== 200) {
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.postV1UploadAudioFiles = postV1UploadAudioFiles;
13
+ const post_v1_file_upload_1 = require("../api/post-v1-file-upload");
14
+ const post_transaction_init_1 = require("../api/transaction/post-transaction-init");
15
+ const upload_audio_with_presigned_url_1 = require("../api/upload-audio-with-presigned-url");
16
+ const constant_1 = require("../constants/constant");
17
+ const enums_1 = require("../constants/enums");
18
+ function postV1UploadAudioFiles(_a) {
19
+ return __awaiter(this, arguments, void 0, function* ({ audioFiles, audioFileNames, txn_id, action, transfer, mode, input_language, output_language, output_format_template, model_training_consent, auto_download, system_info, patient_details, model_type, version, flavour, }) {
20
+ var _b;
21
+ try {
22
+ // Step 1: Get presigned URL
23
+ const presignedUrlResponse = yield (0, post_v1_file_upload_1.default)({ txn_id, action });
24
+ if (presignedUrlResponse.code !== 200) {
25
+ return {
26
+ error_code: enums_1.ERROR_CODE.GET_PRESIGNED_URL_FAILED,
27
+ status_code: presignedUrlResponse.code || constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
28
+ message: presignedUrlResponse.message || 'Get presigned URL failed',
29
+ };
30
+ }
31
+ // Step 2: Upload files using the presigned URL
32
+ const uploadResponse = yield (0, upload_audio_with_presigned_url_1.default)({
33
+ audioFiles,
34
+ audioFileNames,
35
+ presignedUrlResponse,
36
+ });
37
+ if (uploadResponse.code !== 200) {
38
+ return {
39
+ error_code: enums_1.ERROR_CODE.AUDIO_UPLOAD_FAILED,
40
+ status_code: uploadResponse.code || constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
41
+ message: uploadResponse.message || 'File uploaded.',
42
+ };
43
+ }
44
+ const batch_s3_url = presignedUrlResponse.uploadData.url + presignedUrlResponse.folderPath;
45
+ const initTransactionResponse = yield (0, post_transaction_init_1.default)({
46
+ mode,
47
+ txn_id,
48
+ input_language,
49
+ output_language,
50
+ output_format_template,
51
+ model_training_consent,
52
+ auto_download,
53
+ transfer,
54
+ system_info,
55
+ patient_details,
56
+ model_type,
57
+ version,
58
+ flavour,
59
+ batch_s3_url,
60
+ audio_file_names: audioFileNames,
61
+ });
62
+ if (initTransactionResponse.code === 400 &&
63
+ ((_b = initTransactionResponse.error) === null || _b === void 0 ? void 0 : _b.code) === enums_1.ERROR_CODE.TXN_LIMIT_EXCEEDED) {
64
+ return {
65
+ error_code: enums_1.ERROR_CODE.TXN_LIMIT_EXCEEDED,
66
+ status_code: initTransactionResponse.code,
67
+ message: initTransactionResponse.message || 'Transaction limit exceeded.',
68
+ };
69
+ }
70
+ if (initTransactionResponse.code >= 400) {
71
+ return {
72
+ error_code: enums_1.ERROR_CODE.TXN_INIT_FAILED,
73
+ status_code: initTransactionResponse.code || constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
74
+ message: initTransactionResponse.message || 'Transaction initialization failed.',
75
+ };
76
+ }
11
77
  return {
12
- error_code: ERROR_CODE.GET_PRESIGNED_URL_FAILED,
13
- status_code: presignedUrlResponse.code || SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
14
- message: presignedUrlResponse.message || 'Get presigned URL failed',
78
+ status_code: constant_1.SDK_STATUS_CODE.SUCCESS,
79
+ message: 'Recording uploaded successfully.',
15
80
  };
16
81
  }
17
- // Step 2: Upload files using the presigned URL
18
- const uploadResponse = await uploadFilesWithPresignedUrl({
19
- audioFiles,
20
- audioFileNames,
21
- presignedUrlResponse,
22
- });
23
- if (uploadResponse.code !== 200) {
82
+ catch (error) {
83
+ console.error('getPresignedUrlAndUploadFiles error:', error);
24
84
  return {
25
- error_code: ERROR_CODE.AUDIO_UPLOAD_FAILED,
26
- status_code: uploadResponse.code || SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
27
- message: uploadResponse.message || 'File uploaded.',
85
+ error_code: enums_1.ERROR_CODE.INTERNAL_SERVER_ERROR,
86
+ status_code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
87
+ message: `Recording upload failed: ${error}`,
28
88
  };
29
89
  }
30
- const batch_s3_url = presignedUrlResponse.uploadData.url + presignedUrlResponse.folderPath;
31
- const initTransactionResponse = await postTransactionInit({
32
- mode,
33
- txn_id,
34
- input_language,
35
- output_language,
36
- output_format_template,
37
- model_training_consent,
38
- auto_download,
39
- transfer,
40
- system_info,
41
- patient_details,
42
- model_type,
43
- version,
44
- flavour,
45
- batch_s3_url,
46
- audio_file_names: audioFileNames,
47
- });
48
- if (initTransactionResponse.code === 400 &&
49
- initTransactionResponse.error?.code === ERROR_CODE.TXN_LIMIT_EXCEEDED) {
50
- return {
51
- error_code: ERROR_CODE.TXN_LIMIT_EXCEEDED,
52
- status_code: initTransactionResponse.code,
53
- message: initTransactionResponse.message || 'Transaction limit exceeded.',
54
- };
55
- }
56
- if (initTransactionResponse.code >= 400) {
57
- return {
58
- error_code: ERROR_CODE.TXN_INIT_FAILED,
59
- status_code: initTransactionResponse.code || SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
60
- message: initTransactionResponse.message || 'Transaction initialization failed.',
61
- };
62
- }
63
- return {
64
- status_code: SDK_STATUS_CODE.SUCCESS,
65
- message: 'Recording uploaded successfully.',
66
- };
67
- }
68
- catch (error) {
69
- console.error('getPresignedUrlAndUploadFiles error:', error);
70
- return {
71
- error_code: ERROR_CODE.INTERNAL_SERVER_ERROR,
72
- status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
73
- message: `Recording upload failed: ${error}`,
74
- };
75
- }
90
+ });
76
91
  }
@@ -1,12 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
1
12
  // window is undefined in sharedWorker so it is needed to decode the XML AWS error
2
13
  if (typeof window === 'undefined') {
3
14
  self.window = self;
4
15
  }
5
- import { configureAWS } from '../aws-services/configure-aws';
6
- import pushFileToS3 from '../aws-services/upload-file-to-s3';
7
- import { AUDIO_EXTENSION_TYPE_MAP, OUTPUT_FORMAT } from '../constants/constant';
8
- import { SHARED_WORKER_ACTION } from '../constants/enums';
9
- import compressAudioToMp3 from '../utils/compress-mp3-audio';
16
+ const configure_aws_1 = require("../aws-services/configure-aws");
17
+ const upload_file_to_s3_1 = require("../aws-services/upload-file-to-s3");
18
+ const constant_1 = require("../constants/constant");
19
+ const enums_1 = require("../constants/enums");
20
+ const compress_mp3_audio_1 = require("../utils/compress-mp3-audio");
10
21
  // onconnect - to establish communication channel with the main thread
11
22
  // eslint-disable-next-line
12
23
  // @ts-ignore
@@ -16,75 +27,81 @@ onconnect = function (event) {
16
27
  let uploadRequestReceived = 0;
17
28
  let uploadRequestCompleted = 0;
18
29
  // onmessage - to handle messages from the main thread
19
- workerPort.onmessage = async function (event) {
20
- const workerData = event.data;
21
- switch (workerData.action) {
22
- case SHARED_WORKER_ACTION.CONFIGURE_AWS: {
23
- try {
24
- const { accessKeyId, secretKey, sessionToken } = workerData.payload;
25
- configureAWS({
26
- accessKeyId,
27
- secretKey,
28
- sessionToken,
29
- });
30
- workerPort.postMessage({
31
- action: SHARED_WORKER_ACTION.CONFIGURE_AWS_SUCCESS,
32
- message: 'AWS configured successfully',
33
- });
34
- }
35
- catch (error) {
36
- workerPort.postMessage({
37
- action: SHARED_WORKER_ACTION.CONFIGURE_AWS_ERROR,
38
- error: error || 'Failed to configure AWS',
39
- });
40
- }
41
- return;
42
- }
43
- case SHARED_WORKER_ACTION.UPLOAD_FILE_WITH_WORKER: {
44
- const { fileName, audioFrames, txnID, businessID, fileBlob, s3BucketName } = workerData.payload;
45
- uploadRequestReceived++;
46
- let audioBlob;
47
- let compressedAudioBuffer;
48
- if (fileBlob) {
49
- audioBlob = fileBlob;
30
+ workerPort.onmessage = function (event) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const workerData = event.data;
33
+ switch (workerData.action) {
34
+ case enums_1.SHARED_WORKER_ACTION.CONFIGURE_AWS: {
35
+ try {
36
+ const { accessKeyId, secretKey, sessionToken } = workerData.payload;
37
+ (0, configure_aws_1.configureAWS)({
38
+ accessKeyId,
39
+ secretKey,
40
+ sessionToken,
41
+ });
42
+ workerPort.postMessage({
43
+ action: enums_1.SHARED_WORKER_ACTION.CONFIGURE_AWS_SUCCESS,
44
+ message: 'AWS configured successfully',
45
+ });
46
+ }
47
+ catch (error) {
48
+ workerPort.postMessage({
49
+ action: enums_1.SHARED_WORKER_ACTION.CONFIGURE_AWS_ERROR,
50
+ error: error || 'Failed to configure AWS',
51
+ });
52
+ }
53
+ return;
50
54
  }
51
- else {
52
- compressedAudioBuffer = compressAudioToMp3(audioFrames);
53
- audioBlob = new Blob(compressedAudioBuffer, {
54
- type: AUDIO_EXTENSION_TYPE_MAP[OUTPUT_FORMAT],
55
+ case enums_1.SHARED_WORKER_ACTION.UPLOAD_FILE_WITH_WORKER: {
56
+ const { fileName, audioFrames, txnID, businessID, fileBlob, s3BucketName } = workerData.payload;
57
+ uploadRequestReceived++;
58
+ let audioBlob;
59
+ let compressedAudioBuffer;
60
+ if (fileBlob) {
61
+ audioBlob = fileBlob;
62
+ }
63
+ else {
64
+ compressedAudioBuffer = (0, compress_mp3_audio_1.default)(audioFrames);
65
+ audioBlob = new Blob(compressedAudioBuffer, {
66
+ type: constant_1.AUDIO_EXTENSION_TYPE_MAP[constant_1.OUTPUT_FORMAT],
67
+ });
68
+ }
69
+ yield (0, upload_file_to_s3_1.default)({
70
+ s3BucketName,
71
+ fileBlob: audioBlob,
72
+ fileName,
73
+ txnID,
74
+ businessID,
75
+ is_shared_worker: true,
76
+ })
77
+ .then((response) => {
78
+ uploadRequestCompleted++;
79
+ // postMessage - to send messages back to the main thread
80
+ workerPort.postMessage({
81
+ action: enums_1.SHARED_WORKER_ACTION.UPLOAD_FILE_WITH_WORKER_SUCCESS,
82
+ response,
83
+ requestBody: Object.assign(Object.assign({}, workerData.payload), { fileBlob: audioBlob, compressedAudioBuffer }),
84
+ });
85
+ })
86
+ .catch((error) => {
87
+ console.log(error, 'shared worker - file upload');
88
+ uploadRequestCompleted++;
55
89
  });
90
+ return;
56
91
  }
57
- await pushFileToS3({
58
- s3BucketName,
59
- fileBlob: audioBlob,
60
- fileName,
61
- txnID,
62
- businessID,
63
- is_shared_worker: true,
64
- })
65
- .then((response) => {
66
- uploadRequestCompleted++;
67
- // postMessage - to send messages back to the main thread
68
- workerPort.postMessage({
69
- action: SHARED_WORKER_ACTION.UPLOAD_FILE_WITH_WORKER_SUCCESS,
70
- response,
71
- requestBody: {
72
- ...workerData.payload,
73
- fileBlob: audioBlob,
74
- compressedAudioBuffer,
75
- },
76
- });
77
- })
78
- .catch((error) => {
79
- console.log(error, 'shared worker - file upload');
80
- uploadRequestCompleted++;
81
- });
82
- return;
83
- }
84
- case SHARED_WORKER_ACTION.WAIT_FOR_ALL_UPLOADS: {
85
- if (uploadRequestReceived === uploadRequestCompleted) {
92
+ case enums_1.SHARED_WORKER_ACTION.WAIT_FOR_ALL_UPLOADS: {
93
+ if (uploadRequestReceived === uploadRequestCompleted) {
94
+ workerPort.postMessage({
95
+ action: enums_1.SHARED_WORKER_ACTION.WAIT_FOR_ALL_UPLOADS_SUCCESS,
96
+ response: {
97
+ uploadRequestReceived,
98
+ uploadRequestCompleted,
99
+ },
100
+ });
101
+ return;
102
+ }
86
103
  workerPort.postMessage({
87
- action: SHARED_WORKER_ACTION.WAIT_FOR_ALL_UPLOADS_SUCCESS,
104
+ action: enums_1.SHARED_WORKER_ACTION.WAIT_FOR_ALL_UPLOADS_ERROR,
88
105
  response: {
89
106
  uploadRequestReceived,
90
107
  uploadRequestCompleted,
@@ -92,16 +109,8 @@ onconnect = function (event) {
92
109
  });
93
110
  return;
94
111
  }
95
- workerPort.postMessage({
96
- action: SHARED_WORKER_ACTION.WAIT_FOR_ALL_UPLOADS_ERROR,
97
- response: {
98
- uploadRequestReceived,
99
- uploadRequestCompleted,
100
- },
101
- });
102
- return;
103
112
  }
104
- }
113
+ });
105
114
  };
106
115
  workerPort.postMessage(`[WORKER] Web worker onmessage established ${JSON.stringify(workerPort)}`);
107
116
  // start the worker port to listen for messages
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
1
3
  class EkaScribeStore {
2
4
  constructor() {
3
5
  Object.defineProperty(this, "_txnID", {
@@ -149,4 +151,4 @@ class EkaScribeStore {
149
151
  this._vadFrameProcessedCallback = null;
150
152
  }
151
153
  }
152
- export default EkaScribeStore.getInstance();
154
+ exports.default = EkaScribeStore.getInstance();
@@ -1,8 +1,10 @@
1
- import * as lamejs from '@breezystack/lamejs';
2
- import { BITRATE, SAMPLING_RATE } from '../constants/constant';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lamejs = require("@breezystack/lamejs");
4
+ const constant_1 = require("../constants/constant");
3
5
  const compressAudioToMp3 = (audio) => {
4
6
  try {
5
- const audioEncoder = new lamejs.Mp3Encoder(1, SAMPLING_RATE, BITRATE);
7
+ const audioEncoder = new lamejs.Mp3Encoder(1, constant_1.SAMPLING_RATE, constant_1.BITRATE);
6
8
  // convert Float32Array to Int16Array
7
9
  const samples = new Int16Array(audio.length);
8
10
  for (let i = 0; i < audio.length; i++) {
@@ -21,4 +23,4 @@ const compressAudioToMp3 = (audio) => {
21
23
  return [];
22
24
  }
23
25
  };
24
- export default compressAudioToMp3;
26
+ exports.default = compressAudioToMp3;
@@ -1,19 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSharedWorkerUrl = getSharedWorkerUrl;
1
4
  /**
2
5
  * Get the URL for the shared worker file
3
6
  * This function handles both bundled and unbundled scenarios
4
7
  */
5
- export function getSharedWorkerUrl() {
8
+ function getSharedWorkerUrl() {
6
9
  // Allow consumers to override the worker URL via global config
7
10
  if (typeof window !== 'undefined' && window.__EKA_SDK_WORKER_URL__) {
8
11
  return window.__EKA_SDK_WORKER_URL__;
9
12
  }
10
- // Try to use import.meta.url if available (ESM, unbundled)
11
- if (typeof import.meta !== 'undefined' && import.meta.url) {
13
+ // Try to use document.currentScript for browser environments (CommonJS/UMD)
14
+ if (typeof document !== 'undefined' && document.currentScript) {
12
15
  try {
13
- const baseUrl = import.meta.url;
14
- // If baseUrl is a string, use it to construct the worker URL
15
- if (typeof baseUrl === 'string') {
16
- return new URL('../shared-worker/s3-file-upload.js', baseUrl).href;
16
+ const script = document.currentScript;
17
+ if (script.src) {
18
+ const baseUrl = script.src.substring(0, script.src.lastIndexOf('/'));
19
+ // Construct path to shared worker relative to current script
20
+ const workerPath = baseUrl + '/shared-worker/s3-file-upload.js';
21
+ return workerPath;
17
22
  }
18
23
  }
19
24
  catch (e) {
@@ -1,3 +1,15 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.searchSessionsBySessionId = exports.searchSessionsByPatient = void 0;
1
13
  // Generic debounce utility function
2
14
  function debounce(func, delay) {
3
15
  let timeoutId;
@@ -17,7 +29,8 @@ const searchByPatientName = (sessions, patientName) => {
17
29
  }
18
30
  const searchTerm = patientName.toLowerCase().trim();
19
31
  return sessions.filter((session) => {
20
- if (!session.patient_details?.username)
32
+ var _a;
33
+ if (!((_a = session.patient_details) === null || _a === void 0 ? void 0 : _a.username))
21
34
  return false;
22
35
  return session.patient_details.username.toLowerCase().includes(searchTerm);
23
36
  });
@@ -51,20 +64,21 @@ const performSearch = (sessions, searchCriteria) => {
51
64
  // Debounced search function
52
65
  const debouncedSearch = debounce(performSearch, 300);
53
66
  // Main search function
54
- const searchSessions = async ({ sessions, searchCriteria, }) => {
67
+ const searchSessions = (_a) => __awaiter(void 0, [_a], void 0, function* ({ sessions, searchCriteria, }) {
55
68
  return debouncedSearch(sessions, searchCriteria);
56
- };
57
- const searchSessionsByPatient = async ({ sessions, patientName, }) => {
69
+ });
70
+ const searchSessionsByPatient = (_a) => __awaiter(void 0, [_a], void 0, function* ({ sessions, patientName, }) {
58
71
  return searchSessions({
59
72
  sessions,
60
73
  searchCriteria: { patientName },
61
74
  });
62
- };
63
- const searchSessionsBySessionId = async ({ sessions, sessionId, }) => {
75
+ });
76
+ exports.searchSessionsByPatient = searchSessionsByPatient;
77
+ const searchSessionsBySessionId = (_a) => __awaiter(void 0, [_a], void 0, function* ({ sessions, sessionId, }) {
64
78
  return searchSessions({
65
79
  sessions,
66
80
  searchCriteria: { sessionId },
67
81
  });
68
- };
69
- export default searchSessions;
70
- export { searchSessionsByPatient, searchSessionsBySessionId };
82
+ });
83
+ exports.searchSessionsBySessionId = searchSessionsBySessionId;
84
+ exports.default = searchSessions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "1.5.87",
3
+ "version": "1.5.88",
4
4
  "main": "dist/index.js",
5
5
  "repository": "git@github.com:eka-care/eka-js-sdk.git",
6
6
  "author": "Sanikagoyal28 <sanikagoyal9@gmail.com>",