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

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 (57) 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.d.ts +1 -1
  38. package/dist/constants/types.js +2 -1
  39. package/dist/fetch-client/helper.js +24 -11
  40. package/dist/fetch-client/index.js +61 -52
  41. package/dist/index.js +321 -254
  42. package/dist/main/end-recording.js +56 -53
  43. package/dist/main/init-transaction.js +36 -27
  44. package/dist/main/pause-recording.js +17 -18
  45. package/dist/main/poll-output-summary.js +21 -7
  46. package/dist/main/resume-recording.js +13 -14
  47. package/dist/main/retry-upload-recording.js +39 -30
  48. package/dist/main/start-recording.js +34 -26
  49. package/dist/main/upload-full-audio-with-presigned-url.js +84 -69
  50. package/dist/shared-worker/s3-file-upload.js +88 -79
  51. package/dist/shared-worker/s3-file-upload.ts +1 -1
  52. package/dist/store/store.js +3 -1
  53. package/dist/utils/compress-mp3-audio.d.ts +1 -1
  54. package/dist/utils/compress-mp3-audio.js +6 -4
  55. package/dist/utils/get-worker-url.js +12 -7
  56. package/dist/utils/search-past-sessions.js +23 -9
  57. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,40 +1,52 @@
1
+ "use strict";
1
2
  // ekascribe main Class having all the methods - Entry point
2
- import { getConfigV2 } from './api/config/get-voice-api-v2-config';
3
- import { getVoiceApiV3Status } from './api/transaction/get-voice-api-v3-status';
4
- import patchTransactionStatus from './api/transaction/patch-transaction-status';
5
- import postTransactionCommit from './api/transaction/post-transaction-commit';
6
- import AudioBufferManager from './audio-chunker/audio-buffer-manager';
7
- import AudioFileManager from './audio-chunker/audio-file-manager';
8
- import VadWebClient from './audio-chunker/vad-web';
9
- import { AUDIO_BUFFER_SIZE_IN_S, DESP_CHUNK_LENGTH, FRAME_RATE, MAX_CHUNK_LENGTH, PREF_CHUNK_LENGTH, SAMPLING_RATE, SDK_STATUS_CODE, } from './constants/constant';
10
- import { CALLBACK_TYPE, ERROR_CODE } from './constants/enums';
11
- import setEnv from './fetch-client/helper';
12
- import endVoiceRecording from './main/end-recording';
13
- import pauseVoiceRecording from './main/pause-recording';
14
- import resumeVoiceRecording from './main/resume-recording';
15
- import retryUploadFailedFiles from './main/retry-upload-recording';
16
- import startVoiceRecording from './main/start-recording';
17
- import EkaScribeStore from './store/store';
18
- import initialiseTransaction from './main/init-transaction';
19
- import getTransactionHistory from './api/transaction/get-transaction-history';
20
- import getV1Templates from './api/templates/get-v1-templates';
21
- import postV1Template from './api/templates/post-v1-template';
22
- import patchV1Template from './api/templates/patch-v1-template';
23
- import deleteV1Template from './api/templates/delete-v1-template';
24
- import getV1TemplateSections from './api/template-sections/get-v1-template-sections';
25
- import postV1TemplateSection from './api/template-sections/post-v1-template-section';
26
- import patchV1TemplateSection from './api/template-sections/patch-v1-template-section';
27
- import deleteV1TemplateSection from './api/template-sections/delete-v1-template-section';
28
- import cookV1MediaAiCreateTemplate from './api/templates/cook-v1-medai-ai-create-template';
29
- import postV1ConvertToTemplate from './api/templates/post-transaction-convert-to-template';
30
- import { postV1UploadAudioFiles } from './main/upload-full-audio-with-presigned-url';
31
- import { patchVoiceApiV3Status } from './api/transaction/patch-voice-api-v3-status';
32
- import searchSessions, { searchSessionsByPatient, searchSessionsBySessionId, } from './utils/search-past-sessions';
33
- import { getConfigV2MyTemplates } from './api/config/get-voice-api-v2-config-my-templates';
34
- import putVoiceApiV2Config from './api/config/patch-voice-api-v2-config';
35
- import postConvertTranscriptionToTemplate from './api/templates/post-convert-transcription-to-template';
36
- import { getVoiceApiV3StatusTranscript } from './api/transaction/get-voice-api-v3-status-transcript';
37
- import { pollOutputSummary } from './main/poll-output-summary';
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.getEkaScribeInstance = void 0;
14
+ const get_voice_api_v2_config_1 = require("./api/config/get-voice-api-v2-config");
15
+ const get_voice_api_v3_status_1 = require("./api/transaction/get-voice-api-v3-status");
16
+ const patch_transaction_status_1 = require("./api/transaction/patch-transaction-status");
17
+ const post_transaction_commit_1 = require("./api/transaction/post-transaction-commit");
18
+ const audio_buffer_manager_1 = require("./audio-chunker/audio-buffer-manager");
19
+ const audio_file_manager_1 = require("./audio-chunker/audio-file-manager");
20
+ const vad_web_1 = require("./audio-chunker/vad-web");
21
+ const constant_1 = require("./constants/constant");
22
+ const enums_1 = require("./constants/enums");
23
+ const helper_1 = require("./fetch-client/helper");
24
+ const end_recording_1 = require("./main/end-recording");
25
+ const pause_recording_1 = require("./main/pause-recording");
26
+ const resume_recording_1 = require("./main/resume-recording");
27
+ const retry_upload_recording_1 = require("./main/retry-upload-recording");
28
+ const start_recording_1 = require("./main/start-recording");
29
+ const store_1 = require("./store/store");
30
+ const init_transaction_1 = require("./main/init-transaction");
31
+ const get_transaction_history_1 = require("./api/transaction/get-transaction-history");
32
+ const get_v1_templates_1 = require("./api/templates/get-v1-templates");
33
+ const post_v1_template_1 = require("./api/templates/post-v1-template");
34
+ const patch_v1_template_1 = require("./api/templates/patch-v1-template");
35
+ const delete_v1_template_1 = require("./api/templates/delete-v1-template");
36
+ const get_v1_template_sections_1 = require("./api/template-sections/get-v1-template-sections");
37
+ const post_v1_template_section_1 = require("./api/template-sections/post-v1-template-section");
38
+ const patch_v1_template_section_1 = require("./api/template-sections/patch-v1-template-section");
39
+ const delete_v1_template_section_1 = require("./api/template-sections/delete-v1-template-section");
40
+ const cook_v1_medai_ai_create_template_1 = require("./api/templates/cook-v1-medai-ai-create-template");
41
+ const post_transaction_convert_to_template_1 = require("./api/templates/post-transaction-convert-to-template");
42
+ const upload_full_audio_with_presigned_url_1 = require("./main/upload-full-audio-with-presigned-url");
43
+ const patch_voice_api_v3_status_1 = require("./api/transaction/patch-voice-api-v3-status");
44
+ const search_past_sessions_1 = require("./utils/search-past-sessions");
45
+ const get_voice_api_v2_config_my_templates_1 = require("./api/config/get-voice-api-v2-config-my-templates");
46
+ const patch_voice_api_v2_config_1 = require("./api/config/patch-voice-api-v2-config");
47
+ const post_convert_transcription_to_template_1 = require("./api/templates/post-convert-transcription-to-template");
48
+ const get_voice_api_v3_status_transcript_1 = require("./api/transaction/get-voice-api-v3-status-transcript");
49
+ const poll_output_summary_1 = require("./main/poll-output-summary");
38
50
  class EkaScribe {
39
51
  // Private constructor to prevent direct instantiation
40
52
  constructor() {
@@ -56,21 +68,17 @@ class EkaScribe {
56
68
  writable: true,
57
69
  value: void 0
58
70
  });
59
- this.audioFileManagerInstance = new AudioFileManager();
60
- EkaScribeStore.audioFileManagerInstance = this.audioFileManagerInstance;
61
- this.audioBufferInstance = new AudioBufferManager(SAMPLING_RATE, AUDIO_BUFFER_SIZE_IN_S);
62
- EkaScribeStore.audioBufferInstance = this.audioBufferInstance;
63
- this.vadInstance = new VadWebClient(PREF_CHUNK_LENGTH, DESP_CHUNK_LENGTH, MAX_CHUNK_LENGTH, FRAME_RATE);
64
- EkaScribeStore.vadInstance = this.vadInstance;
71
+ this.audioFileManagerInstance = new audio_file_manager_1.default();
72
+ store_1.default.audioFileManagerInstance = this.audioFileManagerInstance;
73
+ this.audioBufferInstance = new audio_buffer_manager_1.default(constant_1.SAMPLING_RATE, constant_1.AUDIO_BUFFER_SIZE_IN_S);
74
+ store_1.default.audioBufferInstance = this.audioBufferInstance;
75
+ this.vadInstance = new vad_web_1.default(constant_1.PREF_CHUNK_LENGTH, constant_1.DESP_CHUNK_LENGTH, constant_1.MAX_CHUNK_LENGTH, constant_1.FRAME_RATE);
76
+ store_1.default.vadInstance = this.vadInstance;
65
77
  console.log('Initialising SDK: ', this.audioFileManagerInstance, this.audioBufferInstance, this.vadInstance);
66
78
  }
67
79
  // Static method to get the singleton instance with optional initialization
68
80
  static getInstance({ access_token, env, clientId, }) {
69
- setEnv({
70
- ...(access_token ? { auth_token: access_token } : {}),
71
- ...(env ? { env } : {}),
72
- ...(clientId ? { clientId } : {}),
73
- });
81
+ (0, helper_1.default)(Object.assign(Object.assign(Object.assign({}, (access_token ? { auth_token: access_token } : {})), (env ? { env } : {})), (clientId ? { clientId } : {})));
74
82
  if (!EkaScribe.instance) {
75
83
  EkaScribe.instance = new EkaScribe();
76
84
  }
@@ -80,24 +88,30 @@ class EkaScribe {
80
88
  static resetInstance() {
81
89
  EkaScribe.instance = null;
82
90
  }
83
- async getEkascribeConfig() {
84
- const response = await getConfigV2();
85
- return response;
91
+ getEkascribeConfig() {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const response = yield (0, get_voice_api_v2_config_1.getConfigV2)();
94
+ return response;
95
+ });
86
96
  }
87
97
  updateAuthTokens({ access_token }) {
88
- setEnv({
98
+ (0, helper_1.default)({
89
99
  auth_token: access_token,
90
100
  });
91
101
  }
92
- async initTransaction(request) {
93
- const initTransactionResponse = await initialiseTransaction(request);
94
- console.log(initTransactionResponse, 'initTransactionResponse');
95
- return initTransactionResponse;
102
+ initTransaction(request) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ const initTransactionResponse = yield (0, init_transaction_1.default)(request);
105
+ console.log(initTransactionResponse, 'initTransactionResponse');
106
+ return initTransactionResponse;
107
+ });
96
108
  }
97
- async startRecording() {
98
- const startResponse = await startVoiceRecording();
99
- console.log('%c Line:110 🍓 startResponse', 'color:#465975', startResponse);
100
- return startResponse;
109
+ startRecording() {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ const startResponse = yield (0, start_recording_1.default)();
112
+ console.log('%c Line:110 🍓 startResponse', 'color:#465975', startResponse);
113
+ return startResponse;
114
+ });
101
115
  }
102
116
  reinitializeVad() {
103
117
  this.vadInstance.reinitializeVad();
@@ -109,166 +123,182 @@ class EkaScribe {
109
123
  this.vadInstance.pauseVad();
110
124
  }
111
125
  pauseRecording() {
112
- const pauseRecordingResponse = pauseVoiceRecording();
126
+ const pauseRecordingResponse = (0, pause_recording_1.default)();
113
127
  console.log('%c Line:117 🍌 pauseRecordingResponse', 'color:#6ec1c2', pauseRecordingResponse);
114
128
  return pauseRecordingResponse;
115
129
  }
116
130
  resumeRecording() {
117
- const resumeRecordingResponse = resumeVoiceRecording();
131
+ const resumeRecordingResponse = (0, resume_recording_1.default)();
118
132
  console.log('%c Line:124 🌶 resumeRecordingResponse', 'color:#33a5ff', resumeRecordingResponse);
119
133
  return resumeRecordingResponse;
120
134
  }
121
- async endRecording() {
122
- const endRecordingResponse = await endVoiceRecording();
123
- console.log('%c Line:131 🍅 endRecordingResponse', 'color:#e41a6a', endRecordingResponse);
124
- return endRecordingResponse;
125
- }
126
- async retryUploadRecording({ force_commit }) {
127
- const retryUploadResponse = await retryUploadFailedFiles({ force_commit });
128
- console.log('%c Line:138 🍖 retryUploadResponse', 'color:#3f7cff', retryUploadResponse);
129
- return retryUploadResponse;
130
- }
131
- async patchSessionStatus({ sessionId, processing_status, processing_error, }) {
132
- try {
133
- const onEventCallback = EkaScribeStore.eventCallback;
134
- console.log('mic vad', this.vadInstance.getMicVad());
135
- this.vadInstance.pauseVad();
136
- console.log('mic vad paused', this.vadInstance.getMicVad());
137
- const patchTransactionResponse = await patchTransactionStatus({
138
- sessionId,
139
- processing_status,
140
- processing_error,
141
- });
142
- if (onEventCallback) {
143
- onEventCallback({
144
- callback_type: CALLBACK_TYPE.TRANSACTION_STATUS,
145
- status: 'info',
146
- message: `Transaction cancel status: ${patchTransactionResponse.code}`,
147
- timestamp: new Date().toISOString(),
148
- });
149
- }
150
- this.resetEkaScribe();
151
- return patchTransactionResponse;
152
- }
153
- catch (error) {
154
- return {
155
- code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
156
- message: `Failed to cancel recording session, ${error}`,
157
- };
158
- }
135
+ endRecording() {
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ const endRecordingResponse = yield (0, end_recording_1.default)();
138
+ console.log('%c Line:131 🍅 endRecordingResponse', 'color:#e41a6a', endRecordingResponse);
139
+ return endRecordingResponse;
140
+ });
159
141
  }
160
- async commitTransactionCall() {
161
- try {
162
- const txnID = EkaScribeStore.txnID;
163
- const onEventCallback = EkaScribeStore.eventCallback;
164
- let txnCommitMsg = '';
165
- if (EkaScribeStore.sessionStatus[txnID].api?.status === 'stop' ||
166
- EkaScribeStore.sessionStatus[txnID].api?.status === 'commit') {
167
- const audioInfo = this.audioFileManagerInstance?.audioChunks;
168
- const audioFiles = audioInfo.map((audio) => audio.fileName);
169
- const { message, code: txnCommitStatusCode } = await postTransactionCommit({
170
- audioFiles,
171
- txnId: EkaScribeStore.txnID,
142
+ retryUploadRecording(_a) {
143
+ return __awaiter(this, arguments, void 0, function* ({ force_commit }) {
144
+ const retryUploadResponse = yield (0, retry_upload_recording_1.default)({ force_commit });
145
+ console.log('%c Line:138 🍖 retryUploadResponse', 'color:#3f7cff', retryUploadResponse);
146
+ return retryUploadResponse;
147
+ });
148
+ }
149
+ patchSessionStatus(_a) {
150
+ return __awaiter(this, arguments, void 0, function* ({ sessionId, processing_status, processing_error, }) {
151
+ try {
152
+ const onEventCallback = store_1.default.eventCallback;
153
+ console.log('mic vad', this.vadInstance.getMicVad());
154
+ this.vadInstance.pauseVad();
155
+ console.log('mic vad paused', this.vadInstance.getMicVad());
156
+ const patchTransactionResponse = yield (0, patch_transaction_status_1.default)({
157
+ sessionId,
158
+ processing_status,
159
+ processing_error,
172
160
  });
173
- txnCommitMsg = message;
174
161
  if (onEventCallback) {
175
162
  onEventCallback({
176
- callback_type: CALLBACK_TYPE.TRANSACTION_STATUS,
163
+ callback_type: enums_1.CALLBACK_TYPE.TRANSACTION_STATUS,
177
164
  status: 'info',
178
- message: `Transaction commit status: ${txnCommitStatusCode}`,
165
+ message: `Transaction cancel status: ${patchTransactionResponse.code}`,
179
166
  timestamp: new Date().toISOString(),
180
- data: {
181
- request: audioFiles,
182
- },
183
167
  });
184
168
  }
185
- if (txnCommitStatusCode != 200) {
169
+ this.resetEkaScribe();
170
+ return patchTransactionResponse;
171
+ }
172
+ catch (error) {
173
+ return {
174
+ code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
175
+ message: `Failed to cancel recording session, ${error}`,
176
+ };
177
+ }
178
+ });
179
+ }
180
+ commitTransactionCall() {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ var _a, _b, _c;
183
+ try {
184
+ const txnID = store_1.default.txnID;
185
+ const onEventCallback = store_1.default.eventCallback;
186
+ let txnCommitMsg = '';
187
+ if (((_a = store_1.default.sessionStatus[txnID].api) === null || _a === void 0 ? void 0 : _a.status) === 'stop' ||
188
+ ((_b = store_1.default.sessionStatus[txnID].api) === null || _b === void 0 ? void 0 : _b.status) === 'commit') {
189
+ const audioInfo = (_c = this.audioFileManagerInstance) === null || _c === void 0 ? void 0 : _c.audioChunks;
190
+ const audioFiles = audioInfo.map((audio) => audio.fileName);
191
+ const { message, code: txnCommitStatusCode } = yield (0, post_transaction_commit_1.default)({
192
+ audioFiles,
193
+ txnId: store_1.default.txnID,
194
+ });
195
+ txnCommitMsg = message;
196
+ if (onEventCallback) {
197
+ onEventCallback({
198
+ callback_type: enums_1.CALLBACK_TYPE.TRANSACTION_STATUS,
199
+ status: 'info',
200
+ message: `Transaction commit status: ${txnCommitStatusCode}`,
201
+ timestamp: new Date().toISOString(),
202
+ data: {
203
+ request: audioFiles,
204
+ },
205
+ });
206
+ }
207
+ if (txnCommitStatusCode != 200) {
208
+ return {
209
+ error_code: enums_1.ERROR_CODE.TXN_COMMIT_FAILED,
210
+ status_code: txnCommitStatusCode,
211
+ message: txnCommitMsg || 'Transaction commit failed.',
212
+ };
213
+ }
214
+ store_1.default.sessionStatus[txnID] = Object.assign(Object.assign({}, store_1.default.sessionStatus[txnID]), { api: {
215
+ status: 'commit',
216
+ code: txnCommitStatusCode,
217
+ response: txnCommitMsg,
218
+ } });
219
+ }
220
+ else {
221
+ // transaction is not stopped or committed
186
222
  return {
187
- error_code: ERROR_CODE.TXN_COMMIT_FAILED,
188
- status_code: txnCommitStatusCode,
189
- message: txnCommitMsg || 'Transaction commit failed.',
223
+ error_code: enums_1.ERROR_CODE.TXN_STATUS_MISMATCH,
224
+ status_code: constant_1.SDK_STATUS_CODE.TXN_ERROR,
225
+ message: 'Transaction is not initialised or stopped. Cannot end recording.',
190
226
  };
191
227
  }
192
- EkaScribeStore.sessionStatus[txnID] = {
193
- ...EkaScribeStore.sessionStatus[txnID],
194
- api: {
195
- status: 'commit',
196
- code: txnCommitStatusCode,
197
- response: txnCommitMsg,
198
- },
228
+ return {
229
+ status_code: constant_1.SDK_STATUS_CODE.SUCCESS,
230
+ message: txnCommitMsg || 'Transaction committed successfully.',
199
231
  };
200
232
  }
201
- else {
202
- // transaction is not stopped or committed
233
+ catch (error) {
203
234
  return {
204
- error_code: ERROR_CODE.TXN_STATUS_MISMATCH,
205
- status_code: SDK_STATUS_CODE.TXN_ERROR,
206
- message: 'Transaction is not initialised or stopped. Cannot end recording.',
235
+ error_code: enums_1.ERROR_CODE.INTERNAL_SERVER_ERROR,
236
+ status_code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
237
+ message: `Failed to cancel recording session, ${error}`,
207
238
  };
208
239
  }
209
- return {
210
- status_code: SDK_STATUS_CODE.SUCCESS,
211
- message: txnCommitMsg || 'Transaction committed successfully.',
212
- };
213
- }
214
- catch (error) {
215
- return {
216
- error_code: ERROR_CODE.INTERNAL_SERVER_ERROR,
217
- status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
218
- message: `Failed to cancel recording session, ${error}`,
219
- };
220
- }
240
+ });
221
241
  }
222
- async stopTransactionCall() {
223
- // call endRecording method since all the steps are same
224
- const endRecordingResponse = await endVoiceRecording();
225
- return endRecordingResponse;
226
- }
227
- async getTemplateOutput({ txn_id }) {
228
- try {
229
- const getStatusResponse = await getVoiceApiV3Status({
230
- txnId: txn_id,
231
- });
232
- return getStatusResponse;
233
- }
234
- catch (error) {
235
- return {
236
- status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
237
- message: `Failed to fetch output templates, ${error}`,
238
- };
239
- }
242
+ stopTransactionCall() {
243
+ return __awaiter(this, void 0, void 0, function* () {
244
+ // call endRecording method since all the steps are same
245
+ const endRecordingResponse = yield (0, end_recording_1.default)();
246
+ return endRecordingResponse;
247
+ });
240
248
  }
241
- async getOutputTranscription({ txn_id }) {
242
- try {
243
- const getStatusResponse = await getVoiceApiV3StatusTranscript({
244
- txnId: txn_id,
245
- });
246
- return getStatusResponse;
247
- }
248
- catch (error) {
249
- return {
250
- status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
251
- message: `Failed to fetch output templates, ${error}`,
252
- };
253
- }
249
+ getTemplateOutput(_a) {
250
+ return __awaiter(this, arguments, void 0, function* ({ txn_id }) {
251
+ try {
252
+ const getStatusResponse = yield (0, get_voice_api_v3_status_1.getVoiceApiV3Status)({
253
+ txnId: txn_id,
254
+ });
255
+ return getStatusResponse;
256
+ }
257
+ catch (error) {
258
+ return {
259
+ status_code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
260
+ message: `Failed to fetch output templates, ${error}`,
261
+ };
262
+ }
263
+ });
254
264
  }
255
- async pollSessionOutput(request) {
256
- const pollingResponse = await pollOutputSummary(request);
257
- return pollingResponse;
265
+ getOutputTranscription(_a) {
266
+ return __awaiter(this, arguments, void 0, function* ({ txn_id }) {
267
+ try {
268
+ const getStatusResponse = yield (0, get_voice_api_v3_status_transcript_1.getVoiceApiV3StatusTranscript)({
269
+ txnId: txn_id,
270
+ });
271
+ return getStatusResponse;
272
+ }
273
+ catch (error) {
274
+ return {
275
+ status_code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
276
+ message: `Failed to fetch output templates, ${error}`,
277
+ };
278
+ }
279
+ });
258
280
  }
259
- async getSessionHistory({ txn_count }) {
260
- try {
261
- const transactionsResponse = await getTransactionHistory({
262
- txn_count,
263
- });
264
- return transactionsResponse;
265
- }
266
- catch (error) {
267
- return {
268
- status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
269
- message: `Failed to fetch previous transactions, ${error}`,
270
- };
271
- }
281
+ pollSessionOutput(request) {
282
+ return __awaiter(this, void 0, void 0, function* () {
283
+ const pollingResponse = yield (0, poll_output_summary_1.pollOutputSummary)(request);
284
+ return pollingResponse;
285
+ });
286
+ }
287
+ getSessionHistory(_a) {
288
+ return __awaiter(this, arguments, void 0, function* ({ txn_count }) {
289
+ try {
290
+ const transactionsResponse = yield (0, get_transaction_history_1.default)({
291
+ txn_count,
292
+ });
293
+ return transactionsResponse;
294
+ }
295
+ catch (error) {
296
+ return {
297
+ status_code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
298
+ message: `Failed to fetch previous transactions, ${error}`,
299
+ };
300
+ }
301
+ });
272
302
  }
273
303
  getSuccessFiles() {
274
304
  return this.audioFileManagerInstance.getSuccessfulUploads();
@@ -280,25 +310,25 @@ class EkaScribe {
280
310
  return this.audioFileManagerInstance.getTotalAudioChunks();
281
311
  }
282
312
  resetEkaScribe() {
283
- console.log(this.audioFileManagerInstance, this.audioBufferInstance, this.vadInstance, EkaScribeStore, 'before reset ekascribe');
313
+ console.log(this.audioFileManagerInstance, this.audioBufferInstance, this.vadInstance, store_1.default, 'before reset ekascribe');
284
314
  this.audioFileManagerInstance.resetFileManagerInstance();
285
315
  this.audioBufferInstance.resetBufferManagerInstance();
286
316
  this.vadInstance.resetVadWebInstance();
287
- EkaScribeStore.resetStore();
288
- console.log(this.audioFileManagerInstance, this.audioBufferInstance, this.vadInstance, EkaScribeStore, 'after reset ekascribe');
317
+ store_1.default.resetStore();
318
+ console.log(this.audioFileManagerInstance, this.audioBufferInstance, this.vadInstance, store_1.default, 'after reset ekascribe');
289
319
  }
290
320
  onUserSpeechCallback(callback) {
291
- EkaScribeStore.userSpeechCallback = callback;
321
+ store_1.default.userSpeechCallback = callback;
292
322
  }
293
323
  onEventCallback(callback) {
294
- EkaScribeStore.eventCallback = callback;
324
+ store_1.default.eventCallback = callback;
295
325
  // this.audioFileManagerInstance.setProgressCallback(callback);
296
326
  }
297
327
  onVadFramesCallback(callback) {
298
- EkaScribeStore.vadFramesCallback = callback;
328
+ store_1.default.vadFramesCallback = callback;
299
329
  }
300
330
  onVadFrameProcessedCallback(callback) {
301
- EkaScribeStore.vadFrameProcessedCallback = callback;
331
+ store_1.default.vadFrameProcessedCallback = callback;
302
332
  }
303
333
  configureVadConstants({ pref_length, desp_length, max_length, sr, frame_size, pre_speech_pad_frames, short_thsld, long_thsld, }) {
304
334
  return this.vadInstance.configureVadConstants({
@@ -313,78 +343,114 @@ class EkaScribe {
313
343
  });
314
344
  }
315
345
  // Template SDK methods
316
- async getAllTemplates() {
317
- const templatesResponse = await getV1Templates();
318
- return templatesResponse;
346
+ getAllTemplates() {
347
+ return __awaiter(this, void 0, void 0, function* () {
348
+ const templatesResponse = yield (0, get_v1_templates_1.default)();
349
+ return templatesResponse;
350
+ });
319
351
  }
320
- async createTemplate(template) {
321
- const templatesResponse = await postV1Template(template);
322
- return templatesResponse;
352
+ createTemplate(template) {
353
+ return __awaiter(this, void 0, void 0, function* () {
354
+ const templatesResponse = yield (0, post_v1_template_1.default)(template);
355
+ return templatesResponse;
356
+ });
323
357
  }
324
- async updateTemplate(template) {
325
- const templatesResponse = await patchV1Template(template);
326
- return templatesResponse;
358
+ updateTemplate(template) {
359
+ return __awaiter(this, void 0, void 0, function* () {
360
+ const templatesResponse = yield (0, patch_v1_template_1.default)(template);
361
+ return templatesResponse;
362
+ });
327
363
  }
328
- async deleteTemplate(template_id) {
329
- const templatesResponse = await deleteV1Template(template_id);
330
- return templatesResponse;
364
+ deleteTemplate(template_id) {
365
+ return __awaiter(this, void 0, void 0, function* () {
366
+ const templatesResponse = yield (0, delete_v1_template_1.default)(template_id);
367
+ return templatesResponse;
368
+ });
331
369
  }
332
- async aiGenerateTemplate(formData) {
333
- const templatesResponse = await cookV1MediaAiCreateTemplate(formData);
334
- return templatesResponse;
370
+ aiGenerateTemplate(formData) {
371
+ return __awaiter(this, void 0, void 0, function* () {
372
+ const templatesResponse = yield (0, cook_v1_medai_ai_create_template_1.default)(formData);
373
+ return templatesResponse;
374
+ });
335
375
  }
336
- async updateConfig(request) {
337
- const configResponse = await putVoiceApiV2Config(request);
338
- return configResponse;
376
+ updateConfig(request) {
377
+ return __awaiter(this, void 0, void 0, function* () {
378
+ const configResponse = yield (0, patch_voice_api_v2_config_1.default)(request);
379
+ return configResponse;
380
+ });
339
381
  }
340
382
  // Template Section SDK methods
341
- async getAllTemplateSections() {
342
- const templateSectionsResponse = await getV1TemplateSections();
343
- return templateSectionsResponse;
383
+ getAllTemplateSections() {
384
+ return __awaiter(this, void 0, void 0, function* () {
385
+ const templateSectionsResponse = yield (0, get_v1_template_sections_1.default)();
386
+ return templateSectionsResponse;
387
+ });
344
388
  }
345
- async createTemplateSection(templateSection) {
346
- const templateSectionsResponse = await postV1TemplateSection(templateSection);
347
- return templateSectionsResponse;
389
+ createTemplateSection(templateSection) {
390
+ return __awaiter(this, void 0, void 0, function* () {
391
+ const templateSectionsResponse = yield (0, post_v1_template_section_1.default)(templateSection);
392
+ return templateSectionsResponse;
393
+ });
348
394
  }
349
- async updateTemplateSection(templateSection) {
350
- const templateSectionsResponse = await patchV1TemplateSection(templateSection);
351
- return templateSectionsResponse;
395
+ updateTemplateSection(templateSection) {
396
+ return __awaiter(this, void 0, void 0, function* () {
397
+ const templateSectionsResponse = yield (0, patch_v1_template_section_1.default)(templateSection);
398
+ return templateSectionsResponse;
399
+ });
352
400
  }
353
- async deleteTemplateSection(section_id) {
354
- const templateSectionsResponse = await deleteV1TemplateSection(section_id);
355
- return templateSectionsResponse;
401
+ deleteTemplateSection(section_id) {
402
+ return __awaiter(this, void 0, void 0, function* () {
403
+ const templateSectionsResponse = yield (0, delete_v1_template_section_1.default)(section_id);
404
+ return templateSectionsResponse;
405
+ });
356
406
  }
357
- async postTransactionConvertToTemplate({ txn_id, template_id }) {
358
- const convertToTemplateResponse = await postV1ConvertToTemplate({ txn_id, template_id });
359
- return convertToTemplateResponse;
407
+ postTransactionConvertToTemplate(_a) {
408
+ return __awaiter(this, arguments, void 0, function* ({ txn_id, template_id }) {
409
+ const convertToTemplateResponse = yield (0, post_transaction_convert_to_template_1.default)({ txn_id, template_id });
410
+ return convertToTemplateResponse;
411
+ });
360
412
  }
361
- async convertTranscriptionToTemplate(request) {
362
- const convertToTemplateResponse = await postConvertTranscriptionToTemplate(request);
363
- return convertToTemplateResponse;
413
+ convertTranscriptionToTemplate(request) {
414
+ return __awaiter(this, void 0, void 0, function* () {
415
+ const convertToTemplateResponse = yield (0, post_convert_transcription_to_template_1.default)(request);
416
+ return convertToTemplateResponse;
417
+ });
364
418
  }
365
- async searchPastSessions(request) {
366
- const searchSessionsResponse = await searchSessions(request);
367
- return searchSessionsResponse;
419
+ searchPastSessions(request) {
420
+ return __awaiter(this, void 0, void 0, function* () {
421
+ const searchSessionsResponse = yield (0, search_past_sessions_1.default)(request);
422
+ return searchSessionsResponse;
423
+ });
368
424
  }
369
- async searchSessionsByPatientName(request) {
370
- const searchSessionsByPatientNameResponse = await searchSessionsByPatient(request);
371
- return searchSessionsByPatientNameResponse;
425
+ searchSessionsByPatientName(request) {
426
+ return __awaiter(this, void 0, void 0, function* () {
427
+ const searchSessionsByPatientNameResponse = yield (0, search_past_sessions_1.searchSessionsByPatient)(request);
428
+ return searchSessionsByPatientNameResponse;
429
+ });
372
430
  }
373
- async searchSessionsBySessionId(request) {
374
- const searchSessionsBySessionIdResponse = await searchSessionsBySessionId(request);
375
- return searchSessionsBySessionIdResponse;
431
+ searchSessionsBySessionId(request) {
432
+ return __awaiter(this, void 0, void 0, function* () {
433
+ const searchSessionsBySessionIdResponse = yield (0, search_past_sessions_1.searchSessionsBySessionId)(request);
434
+ return searchSessionsBySessionIdResponse;
435
+ });
376
436
  }
377
- async uploadAudioWithPresignedUrl(request) {
378
- const uploadAudioFilesResponse = await postV1UploadAudioFiles(request);
379
- return uploadAudioFilesResponse;
437
+ uploadAudioWithPresignedUrl(request) {
438
+ return __awaiter(this, void 0, void 0, function* () {
439
+ const uploadAudioFilesResponse = yield (0, upload_full_audio_with_presigned_url_1.postV1UploadAudioFiles)(request);
440
+ return uploadAudioFilesResponse;
441
+ });
380
442
  }
381
- async updateResultSummary(request) {
382
- const updateResultSummaryResponse = await patchVoiceApiV3Status(request);
383
- return updateResultSummaryResponse;
443
+ updateResultSummary(request) {
444
+ return __awaiter(this, void 0, void 0, function* () {
445
+ const updateResultSummaryResponse = yield (0, patch_voice_api_v3_status_1.patchVoiceApiV3Status)(request);
446
+ return updateResultSummaryResponse;
447
+ });
384
448
  }
385
- async getConfigMyTemplates() {
386
- const configMyTemplatesResponse = await getConfigV2MyTemplates();
387
- return configMyTemplatesResponse;
449
+ getConfigMyTemplates() {
450
+ return __awaiter(this, void 0, void 0, function* () {
451
+ const configMyTemplatesResponse = yield (0, get_voice_api_v2_config_my_templates_1.getConfigV2MyTemplates)();
452
+ return configMyTemplatesResponse;
453
+ });
388
454
  }
389
455
  }
390
456
  Object.defineProperty(EkaScribe, "instance", {
@@ -394,4 +460,5 @@ Object.defineProperty(EkaScribe, "instance", {
394
460
  value: null
395
461
  });
396
462
  // Export the singleton instance getter with optional initialization
397
- export const getEkaScribeInstance = ({ access_token, env, clientId, }) => EkaScribe.getInstance({ access_token, env, clientId });
463
+ const getEkaScribeInstance = ({ access_token, env, clientId, }) => EkaScribe.getInstance({ access_token, env, clientId });
464
+ exports.getEkaScribeInstance = getEkaScribeInstance;