@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.
- package/dist/api/config/get-voice-api-v2-config-my-templates.js +22 -12
- package/dist/api/config/get-voice-api-v2-config.js +22 -12
- package/dist/api/config/patch-voice-api-v2-config.js +21 -13
- package/dist/api/post-cog-init.js +28 -15
- package/dist/api/post-v1-file-upload.js +38 -28
- package/dist/api/template-sections/delete-v1-template-section.js +37 -27
- package/dist/api/template-sections/get-v1-template-sections.js +37 -27
- package/dist/api/template-sections/patch-v1-template-section.js +46 -36
- package/dist/api/template-sections/post-v1-template-section.js +45 -35
- package/dist/api/templates/cook-v1-medai-ai-create-template.js +35 -25
- package/dist/api/templates/delete-v1-template.js +37 -27
- package/dist/api/templates/get-v1-templates.js +37 -27
- package/dist/api/templates/patch-v1-template.js +44 -33
- package/dist/api/templates/post-convert-transcription-to-template.js +41 -31
- package/dist/api/templates/post-transaction-convert-to-template.js +38 -28
- package/dist/api/templates/post-v1-template.js +43 -33
- package/dist/api/transaction/get-transaction-history.js +20 -9
- package/dist/api/transaction/get-voice-api-v3-status-transcript.js +21 -8
- package/dist/api/transaction/get-voice-api-v3-status.js +21 -8
- package/dist/api/transaction/patch-transaction-status.js +23 -14
- package/dist/api/transaction/patch-voice-api-v3-status.js +22 -12
- package/dist/api/transaction/post-transaction-commit.js +41 -31
- package/dist/api/transaction/post-transaction-init.js +52 -47
- package/dist/api/transaction/post-transaction-stop.js +41 -31
- package/dist/api/upload-audio-with-presigned-url.js +67 -55
- package/dist/audio-chunker/audio-buffer-manager.js +5 -3
- package/dist/audio-chunker/audio-file-manager.js +353 -350
- package/dist/audio-chunker/vad-web.js +116 -97
- package/dist/aws-services/configure-aws.js +5 -2
- package/dist/aws-services/get-files-s3.js +20 -7
- package/dist/aws-services/s3-retry-wrapper.js +44 -31
- package/dist/aws-services/translate-text-to-target-language.js +28 -15
- package/dist/aws-services/upload-file-to-s3.js +17 -6
- package/dist/constants/constant.js +22 -19
- package/dist/constants/enums.js +15 -12
- package/dist/constants/setup-config.js +10 -7
- package/dist/constants/types.js +2 -1
- package/dist/fetch-client/helper.js +24 -11
- package/dist/fetch-client/index.js +61 -52
- package/dist/index.js +321 -254
- package/dist/main/end-recording.js +56 -53
- package/dist/main/init-transaction.js +36 -27
- package/dist/main/pause-recording.js +17 -18
- package/dist/main/poll-output-summary.js +21 -7
- package/dist/main/resume-recording.js +13 -14
- package/dist/main/retry-upload-recording.js +39 -30
- package/dist/main/start-recording.js +34 -26
- package/dist/main/upload-full-audio-with-presigned-url.js +84 -69
- package/dist/shared-worker/s3-file-upload.js +88 -79
- package/dist/store/store.js +3 -1
- package/dist/utils/compress-mp3-audio.js +6 -4
- package/dist/utils/get-worker-url.js +12 -7
- package/dist/utils/search-past-sessions.js +23 -9
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
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
|
-
|
|
23
|
+
exports.CONSULTATION_MODES = [
|
|
21
24
|
{
|
|
22
25
|
id: 'consultation',
|
|
23
26
|
name: 'Consultation',
|
package/dist/constants/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
newHeaders.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
newHeaders.
|
|
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
|
-
|
|
22
|
-
|
|
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
|
|
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: '
|
|
62
|
+
response: 'Error body: ' + JSON.stringify(error),
|
|
37
63
|
},
|
|
38
64
|
});
|
|
39
65
|
}
|
|
40
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
timeoutId = null;
|
|
68
|
+
finally {
|
|
69
|
+
if (timeoutId) {
|
|
70
|
+
clearTimeout(timeoutId);
|
|
71
|
+
timeoutId = null;
|
|
72
|
+
}
|
|
64
73
|
}
|
|
65
|
-
}
|
|
74
|
+
});
|
|
66
75
|
}
|