@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,5 +1,8 @@
1
- import { TEMPLATE_ID } from './enums';
2
- export const SUPPORTED_LANGUAGES = [
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONSULTATION_MODES = exports.SUPPORTED_OUTPUT_FORMATS = exports.SUPPORTED_LANGUAGES = void 0;
4
+ const enums_1 = require("./enums");
5
+ exports.SUPPORTED_LANGUAGES = [
3
6
  { id: 'en-IN', name: 'English (India)' },
4
7
  { id: 'en-US', name: 'English (United States)' },
5
8
  { id: 'hi', name: 'Hindi' },
@@ -12,12 +15,12 @@ export const SUPPORTED_LANGUAGES = [
12
15
  { id: 'mr', name: 'Marathi' },
13
16
  { id: 'pa', name: 'Punjabi' },
14
17
  ];
15
- export const SUPPORTED_OUTPUT_FORMATS = [
16
- { id: TEMPLATE_ID.EKA_EMR_TEMPLATE, name: 'Eka EMR Format' },
17
- { id: TEMPLATE_ID.CLINICAL_NOTE_TEMPLATE, name: 'Clinical Notes' },
18
- { id: TEMPLATE_ID.TRANSCRIPT_TEMPLATE, name: 'Transcription' },
18
+ exports.SUPPORTED_OUTPUT_FORMATS = [
19
+ { id: enums_1.TEMPLATE_ID.EKA_EMR_TEMPLATE, name: 'Eka EMR Format' },
20
+ { id: enums_1.TEMPLATE_ID.CLINICAL_NOTE_TEMPLATE, name: 'Clinical Notes' },
21
+ { id: enums_1.TEMPLATE_ID.TRANSCRIPT_TEMPLATE, name: 'Transcription' },
19
22
  ];
20
- export const CONSULTATION_MODES = [
23
+ exports.CONSULTATION_MODES = [
21
24
  {
22
25
  id: 'consultation',
23
26
  name: 'Consultation',
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET_CURRENT_ENV = exports.GET_EKA_HOST = exports.GET_COG_HOST = exports.GET_COOK_HOST_V1 = exports.GET_EKA_VOICE_HOST_V3 = exports.GET_EKA_VOICE_HOST_V2 = exports.GET_EKA_VOICE_HOST_V1 = exports.GET_AUTH_TOKEN = exports.GET_CLIENT_ID = exports.GET_S3_BUCKET_NAME = void 0;
1
4
  const DEV = {
2
5
  COG_HOST: 'https://cog.dev.eka.care',
3
6
  EKA_VOICE_HOST_V1: 'https://api.dev.eka.care/voice/api/v1',
@@ -30,14 +33,24 @@ const setEnv = ({ env, clientId, auth_token, }) => {
30
33
  auth = auth_token;
31
34
  }
32
35
  };
33
- export const GET_S3_BUCKET_NAME = () => envVar.S3_BUCKET_NAME;
34
- export const GET_CLIENT_ID = () => client_id;
35
- export const GET_AUTH_TOKEN = () => auth;
36
- export const GET_EKA_VOICE_HOST_V1 = () => envVar.EKA_VOICE_HOST_V1;
37
- export const GET_EKA_VOICE_HOST_V2 = () => envVar.EKA_VOICE_HOST_V2;
38
- export const GET_EKA_VOICE_HOST_V3 = () => envVar.EKA_VOICE_HOST_V3;
39
- export const GET_COOK_HOST_V1 = () => envVar.COOK_V1;
40
- export const GET_COG_HOST = () => envVar.COG_HOST;
41
- export const GET_EKA_HOST = () => envVar.EKA_HOST;
42
- export const GET_CURRENT_ENV = () => (envVar === PROD ? 'PROD' : 'DEV');
43
- export default setEnv;
36
+ const GET_S3_BUCKET_NAME = () => envVar.S3_BUCKET_NAME;
37
+ exports.GET_S3_BUCKET_NAME = GET_S3_BUCKET_NAME;
38
+ const GET_CLIENT_ID = () => client_id;
39
+ exports.GET_CLIENT_ID = GET_CLIENT_ID;
40
+ const GET_AUTH_TOKEN = () => auth;
41
+ exports.GET_AUTH_TOKEN = GET_AUTH_TOKEN;
42
+ const GET_EKA_VOICE_HOST_V1 = () => envVar.EKA_VOICE_HOST_V1;
43
+ exports.GET_EKA_VOICE_HOST_V1 = GET_EKA_VOICE_HOST_V1;
44
+ const GET_EKA_VOICE_HOST_V2 = () => envVar.EKA_VOICE_HOST_V2;
45
+ exports.GET_EKA_VOICE_HOST_V2 = GET_EKA_VOICE_HOST_V2;
46
+ const GET_EKA_VOICE_HOST_V3 = () => envVar.EKA_VOICE_HOST_V3;
47
+ exports.GET_EKA_VOICE_HOST_V3 = GET_EKA_VOICE_HOST_V3;
48
+ const GET_COOK_HOST_V1 = () => envVar.COOK_V1;
49
+ exports.GET_COOK_HOST_V1 = GET_COOK_HOST_V1;
50
+ const GET_COG_HOST = () => envVar.COG_HOST;
51
+ exports.GET_COG_HOST = GET_COG_HOST;
52
+ const GET_EKA_HOST = () => envVar.EKA_HOST;
53
+ exports.GET_EKA_HOST = GET_EKA_HOST;
54
+ const GET_CURRENT_ENV = () => (envVar === PROD ? 'PROD' : 'DEV');
55
+ exports.GET_CURRENT_ENV = GET_CURRENT_ENV;
56
+ exports.default = setEnv;
@@ -1,66 +1,75 @@
1
- import { GET_CLIENT_ID, GET_AUTH_TOKEN } from './helper';
2
- import EkaScribeStore from '../store/store';
3
- import { CALLBACK_TYPE } from '../constants/enums';
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.default = fetchWrapper;
13
+ const helper_1 = require("./helper");
14
+ const store_1 = require("../store/store");
15
+ const enums_1 = require("../constants/enums");
4
16
  const API_TIMEOUT_MS = 10000;
5
- export default async function fetchWrapper(url, options = {}, timeoutMs = API_TIMEOUT_MS) {
6
- const onEventCallback = EkaScribeStore.eventCallback;
7
- const controller = new AbortController();
8
- let timeoutId = null;
9
- try {
10
- // Set up timeout
11
- timeoutId = setTimeout(() => {
12
- controller.abort();
13
- }, timeoutMs);
14
- const newHeaders = new Headers(options.headers);
15
- if (!newHeaders.get('client-id')) {
16
- newHeaders.set('client-id', GET_CLIENT_ID());
17
- }
18
- if (!newHeaders.get('auth') && GET_AUTH_TOKEN()) {
19
- newHeaders.set('auth', GET_AUTH_TOKEN());
17
+ function fetchWrapper(url_1) {
18
+ return __awaiter(this, arguments, void 0, function* (url, options = {}, timeoutMs = API_TIMEOUT_MS) {
19
+ const onEventCallback = store_1.default.eventCallback;
20
+ const controller = new AbortController();
21
+ let timeoutId = null;
22
+ try {
23
+ // Set up timeout
24
+ timeoutId = setTimeout(() => {
25
+ controller.abort();
26
+ }, timeoutMs);
27
+ const newHeaders = new Headers(options.headers);
28
+ if (!newHeaders.get('client-id')) {
29
+ newHeaders.set('client-id', (0, helper_1.GET_CLIENT_ID)());
30
+ }
31
+ if (!newHeaders.get('auth') && (0, helper_1.GET_AUTH_TOKEN)()) {
32
+ newHeaders.set('auth', (0, helper_1.GET_AUTH_TOKEN)());
33
+ }
34
+ const response = yield fetch(url, Object.assign(Object.assign({}, options), { headers: newHeaders, signal: controller.signal, credentials: 'include' }));
35
+ if (!response.ok) {
36
+ if (onEventCallback) {
37
+ onEventCallback({
38
+ callback_type: enums_1.CALLBACK_TYPE.AUTHENTICATION_STATUS,
39
+ status: 'error',
40
+ message: 'Fetch wrapper error: ' + response.ok + response.status,
41
+ timestamp: new Date().toISOString(),
42
+ data: {
43
+ request: 'Request body: ' + JSON.stringify(options.body),
44
+ response: 'Response body: ' + JSON.stringify(response),
45
+ },
46
+ });
47
+ }
48
+ // throw new Error('Fetch wrapper error: ' + response.ok + response.status);
49
+ }
50
+ return response;
20
51
  }
21
- const response = await fetch(url, {
22
- ...options,
23
- headers: newHeaders,
24
- signal: controller.signal,
25
- credentials: 'include',
26
- });
27
- if (!response.ok) {
52
+ catch (error) {
53
+ console.error(error, 'error in fetch wrapper - SDK');
28
54
  if (onEventCallback) {
29
55
  onEventCallback({
30
- callback_type: CALLBACK_TYPE.AUTHENTICATION_STATUS,
56
+ callback_type: enums_1.CALLBACK_TYPE.AUTHENTICATION_STATUS,
31
57
  status: 'error',
32
- message: 'Fetch wrapper error: ' + response.ok + response.status,
58
+ message: 'Fetch wrapper response: ' + error,
33
59
  timestamp: new Date().toISOString(),
34
60
  data: {
35
61
  request: 'Request body: ' + JSON.stringify(options.body),
36
- response: 'Response body: ' + JSON.stringify(response),
62
+ response: 'Error body: ' + JSON.stringify(error),
37
63
  },
38
64
  });
39
65
  }
40
- // throw new Error('Fetch wrapper error: ' + response.ok + response.status);
41
- }
42
- return response;
43
- }
44
- catch (error) {
45
- console.error(error, 'error in fetch wrapper - SDK');
46
- if (onEventCallback) {
47
- onEventCallback({
48
- callback_type: CALLBACK_TYPE.AUTHENTICATION_STATUS,
49
- status: 'error',
50
- message: 'Fetch wrapper response: ' + error,
51
- timestamp: new Date().toISOString(),
52
- data: {
53
- request: 'Request body: ' + JSON.stringify(options.body),
54
- response: 'Error body: ' + JSON.stringify(error),
55
- },
56
- });
66
+ throw error;
57
67
  }
58
- throw error;
59
- }
60
- finally {
61
- if (timeoutId) {
62
- clearTimeout(timeoutId);
63
- timeoutId = null;
68
+ finally {
69
+ if (timeoutId) {
70
+ clearTimeout(timeoutId);
71
+ timeoutId = null;
72
+ }
64
73
  }
65
- }
74
+ });
66
75
  }