@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eka-care/ekascribe-ts-sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.83",
|
|
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>",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "tsc &&
|
|
18
|
+
"build": "tsc && node esbuild.worker.mjs",
|
|
19
19
|
"lint": "eslint . --ext .ts",
|
|
20
20
|
"start": "ts-node ./eka-sdk/ekascribe-v2rx/index.ts",
|
|
21
21
|
"prepare": "yarn build"
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@types/node": "^22.14.1",
|
|
31
31
|
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
32
32
|
"@typescript-eslint/parser": "^8.30.1",
|
|
33
|
+
"esbuild": "^0.27.0",
|
|
33
34
|
"eslint": "^9.25.0",
|
|
34
35
|
"ts-node": "^10.9.2",
|
|
35
36
|
"typescript": "^5.8.3"
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
|
-
import fetchWrapper from '../fetch-client';
|
|
3
|
-
import { GET_EKA_V2RX_HOST_V2 } from '../fetch-client/helper';
|
|
4
|
-
// TODO: pagination changes
|
|
5
|
-
const getTransactionHistory = async ({ txn_count, }) => {
|
|
6
|
-
try {
|
|
7
|
-
const headers = new Headers();
|
|
8
|
-
headers.append('Content-Type', 'application/json');
|
|
9
|
-
const options = {
|
|
10
|
-
method: 'GET',
|
|
11
|
-
headers,
|
|
12
|
-
};
|
|
13
|
-
const responseJson = await fetchWrapper(`${GET_EKA_V2RX_HOST_V2()}/transaction/history?count=${txn_count}`, options);
|
|
14
|
-
const response = await responseJson.json();
|
|
15
|
-
return {
|
|
16
|
-
data: response.data,
|
|
17
|
-
status_code: responseJson.status,
|
|
18
|
-
message: `Past ${txn_count} transactions fetched successfully.`,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
return {
|
|
23
|
-
status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
24
|
-
message: `Something went wrong in fetching transactions. ${error}`,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
export default getTransactionHistory;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
|
-
import fetchWrapper from '../fetch-client';
|
|
3
|
-
import { GET_EKA_V2RX_HOST_V2 } from '../fetch-client/helper';
|
|
4
|
-
export const getConfigV2 = async () => {
|
|
5
|
-
try {
|
|
6
|
-
const options = {
|
|
7
|
-
method: 'GET',
|
|
8
|
-
headers: {
|
|
9
|
-
'Content-Type': 'application/json',
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
const response = await fetchWrapper(`${GET_EKA_V2RX_HOST_V2()}/config/`, options);
|
|
13
|
-
const res = await response.json();
|
|
14
|
-
return {
|
|
15
|
-
...res,
|
|
16
|
-
code: response.status,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
console.log('Error in getConfigV2 api: ', error);
|
|
21
|
-
return {
|
|
22
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
|
-
message: `Failed to fetch initial configurations, ${error}`,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export type TTemplateMessage = {
|
|
2
|
-
type: 'warning' | 'error';
|
|
3
|
-
code?: string;
|
|
4
|
-
msg: string;
|
|
5
|
-
};
|
|
6
|
-
export type TOutputSummary = {
|
|
7
|
-
template_id: string;
|
|
8
|
-
value?: string | null;
|
|
9
|
-
type: string;
|
|
10
|
-
name: string;
|
|
11
|
-
status: TTemplateStatus;
|
|
12
|
-
errors?: TTemplateMessage[];
|
|
13
|
-
warnings?: TTemplateMessage[];
|
|
14
|
-
};
|
|
15
|
-
export type TTemplateStatus = 'success' | 'partial_success' | 'failure';
|
|
16
|
-
type TAdditionalData = {
|
|
17
|
-
doctor: {
|
|
18
|
-
_id: string;
|
|
19
|
-
profile: {
|
|
20
|
-
personal: {
|
|
21
|
-
name: {
|
|
22
|
-
l: string;
|
|
23
|
-
f: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
type TApiResponse = {
|
|
30
|
-
data: {
|
|
31
|
-
output?: TOutputSummary[];
|
|
32
|
-
additional_data?: TAdditionalData;
|
|
33
|
-
meta_data?: {
|
|
34
|
-
total_resources?: number;
|
|
35
|
-
total_parsed_resources?: number;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
error?: {
|
|
39
|
-
code: string;
|
|
40
|
-
msg: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export type TGetStatusResponse = {
|
|
44
|
-
response?: TApiResponse | null;
|
|
45
|
-
code: number;
|
|
46
|
-
message?: string;
|
|
47
|
-
};
|
|
48
|
-
export declare const getVoiceApiV2Status: ({ txnId, }: {
|
|
49
|
-
txnId: string;
|
|
50
|
-
}) => Promise<TGetStatusResponse>;
|
|
51
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
|
-
import fetchWrapper from '../fetch-client';
|
|
3
|
-
import { GET_EKA_V2RX_HOST_V3 } from '../fetch-client/helper';
|
|
4
|
-
export const getVoiceApiV2Status = async ({ txnId, }) => {
|
|
5
|
-
try {
|
|
6
|
-
const headers = new Headers();
|
|
7
|
-
headers.append('Content-Type', 'application/json');
|
|
8
|
-
const options = {
|
|
9
|
-
method: 'GET',
|
|
10
|
-
headers,
|
|
11
|
-
};
|
|
12
|
-
const getResponse = await fetchWrapper(`${GET_EKA_V2RX_HOST_V3()}/status/${txnId}`, options);
|
|
13
|
-
const response = await getResponse.json();
|
|
14
|
-
return {
|
|
15
|
-
response,
|
|
16
|
-
code: getResponse.status,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
return {
|
|
21
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
22
|
-
message: `Something went wrong! ${error}`,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export type TTemplateMessage = {
|
|
2
|
-
type: 'warning' | 'error';
|
|
3
|
-
code?: string;
|
|
4
|
-
msg: string;
|
|
5
|
-
};
|
|
6
|
-
export type TOutputSummary = {
|
|
7
|
-
template_id: string;
|
|
8
|
-
value?: string | null;
|
|
9
|
-
type: string;
|
|
10
|
-
name: string;
|
|
11
|
-
status: TTemplateStatus;
|
|
12
|
-
errors?: TTemplateMessage[];
|
|
13
|
-
warnings?: TTemplateMessage[];
|
|
14
|
-
};
|
|
15
|
-
export type TTemplateStatus = 'success' | 'partial_success' | 'failure';
|
|
16
|
-
type TAdditionalData = {
|
|
17
|
-
doctor: {
|
|
18
|
-
_id: string;
|
|
19
|
-
profile: {
|
|
20
|
-
personal: {
|
|
21
|
-
name: {
|
|
22
|
-
l: string;
|
|
23
|
-
f: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
type TApiResponse = {
|
|
30
|
-
data: {
|
|
31
|
-
output?: TOutputSummary[];
|
|
32
|
-
additional_data?: TAdditionalData;
|
|
33
|
-
meta_data?: {
|
|
34
|
-
total_resources?: number;
|
|
35
|
-
total_parsed_resources?: number;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
error?: {
|
|
39
|
-
code: string;
|
|
40
|
-
msg: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export type TGetStatusResponse = {
|
|
44
|
-
response?: TApiResponse | null;
|
|
45
|
-
status_code: number;
|
|
46
|
-
message?: string;
|
|
47
|
-
};
|
|
48
|
-
export declare const getVoiceApiV3Status: ({ txnId, }: {
|
|
49
|
-
txnId: string;
|
|
50
|
-
}) => Promise<TGetStatusResponse>;
|
|
51
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
|
-
import fetchWrapper from '../fetch-client';
|
|
3
|
-
import { GET_EKA_V2RX_HOST_V3 } from '../fetch-client/helper';
|
|
4
|
-
export const getVoiceApiV3Status = async ({ txnId, }) => {
|
|
5
|
-
try {
|
|
6
|
-
const headers = new Headers();
|
|
7
|
-
headers.append('Content-Type', 'application/json');
|
|
8
|
-
const options = {
|
|
9
|
-
method: 'GET',
|
|
10
|
-
headers,
|
|
11
|
-
};
|
|
12
|
-
// Use custom timeout for this API (16 seconds instead of default 5 seconds)
|
|
13
|
-
const getResponse = await fetchWrapper(`${GET_EKA_V2RX_HOST_V3()}/status/${txnId}`, options, 16000);
|
|
14
|
-
const response = await getResponse.json();
|
|
15
|
-
return {
|
|
16
|
-
response,
|
|
17
|
-
status_code: getResponse.status,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return {
|
|
22
|
-
status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
|
-
message: `Something went wrong! ${error}`,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TPatchTransactionError, TPatchTransactionRequest, TPostTransactionResponse } from '../constants/types';
|
|
2
|
-
export declare const processingError: TPatchTransactionError;
|
|
3
|
-
declare const patchTransactionStatus: ({ sessionId, processing_status, processing_error, }: TPatchTransactionRequest) => Promise<TPostTransactionResponse>;
|
|
4
|
-
export default patchTransactionStatus;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
|
-
import fetchWrapper from '../fetch-client';
|
|
3
|
-
import { GET_EKA_V2RX_HOST_V2 } from '../fetch-client/helper';
|
|
4
|
-
export const processingError = {
|
|
5
|
-
error: {
|
|
6
|
-
type: '',
|
|
7
|
-
code: 'cancelled_by_user',
|
|
8
|
-
msg: 'Cancelled_by_user',
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
const patchTransactionStatus = async ({ sessionId, processing_status, processing_error, }) => {
|
|
12
|
-
try {
|
|
13
|
-
const headers = new Headers();
|
|
14
|
-
headers.append('Content-Type', 'application/json');
|
|
15
|
-
const raw = {
|
|
16
|
-
processing_status,
|
|
17
|
-
processing_error,
|
|
18
|
-
};
|
|
19
|
-
const options = {
|
|
20
|
-
method: 'PATCH',
|
|
21
|
-
headers,
|
|
22
|
-
body: JSON.stringify(raw),
|
|
23
|
-
};
|
|
24
|
-
const response = await fetchWrapper(`${GET_EKA_V2RX_HOST_V2()}/transaction/${sessionId}`, options);
|
|
25
|
-
if (!response.ok) {
|
|
26
|
-
throw new Error(`Error: ${response.statusText}`);
|
|
27
|
-
}
|
|
28
|
-
let res = await response.json();
|
|
29
|
-
res = {
|
|
30
|
-
...res,
|
|
31
|
-
code: response.status,
|
|
32
|
-
};
|
|
33
|
-
return res;
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
console.error('Patch transaction status api failed', error);
|
|
37
|
-
return {
|
|
38
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
39
|
-
message: `Something went wrong! ${error}`,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
export default patchTransactionStatus;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
|
-
import fetchWrapper from '../fetch-client';
|
|
3
|
-
import { GET_EKA_V2RX_HOST_V2 } from '../fetch-client/helper';
|
|
4
|
-
async function postTransactionCommit({ audioFiles, txnId, }) {
|
|
5
|
-
try {
|
|
6
|
-
const headers = new Headers();
|
|
7
|
-
headers.append('Content-Type', 'application/json');
|
|
8
|
-
const raw = {
|
|
9
|
-
audio_files: audioFiles,
|
|
10
|
-
};
|
|
11
|
-
const options = {
|
|
12
|
-
method: 'POST',
|
|
13
|
-
headers,
|
|
14
|
-
body: JSON.stringify(raw),
|
|
15
|
-
};
|
|
16
|
-
const response = await fetchWrapper(`${GET_EKA_V2RX_HOST_V2()}/transaction/commit/${txnId}`, options);
|
|
17
|
-
let res = await response.json();
|
|
18
|
-
res = {
|
|
19
|
-
...res,
|
|
20
|
-
code: response.status,
|
|
21
|
-
};
|
|
22
|
-
return res;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.log('%c Line:52 🥖 postTransactionInit -> error', 'color:#f5ce50', error);
|
|
26
|
-
return {
|
|
27
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
28
|
-
message: `Something went wrong! ${error}`,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export default postTransactionCommit;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TPostTransactionInitRequest, TPostTransactionResponse } from '../constants/types';
|
|
2
|
-
declare function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, model_type, }: TPostTransactionInitRequest): Promise<TPostTransactionResponse>;
|
|
3
|
-
export default postTransactionInit;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
|
-
import fetchWrapper from '../fetch-client';
|
|
3
|
-
import { GET_EKA_V2RX_HOST_V2 } from '../fetch-client/helper';
|
|
4
|
-
async function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, model_type, }) {
|
|
5
|
-
try {
|
|
6
|
-
const headers = new Headers();
|
|
7
|
-
headers.append('Content-Type', 'application/json');
|
|
8
|
-
const raw = {
|
|
9
|
-
mode,
|
|
10
|
-
s3_url: s3Url,
|
|
11
|
-
input_language,
|
|
12
|
-
output_format_template,
|
|
13
|
-
model_training_consent,
|
|
14
|
-
auto_download,
|
|
15
|
-
transfer,
|
|
16
|
-
system_info,
|
|
17
|
-
model_type,
|
|
18
|
-
};
|
|
19
|
-
const options = {
|
|
20
|
-
method: 'POST',
|
|
21
|
-
headers,
|
|
22
|
-
body: JSON.stringify(raw),
|
|
23
|
-
};
|
|
24
|
-
const response = await fetchWrapper(`${GET_EKA_V2RX_HOST_V2()}/transaction/init/${txnId}`, options);
|
|
25
|
-
let res = await response.json();
|
|
26
|
-
res = {
|
|
27
|
-
...res,
|
|
28
|
-
code: response.status,
|
|
29
|
-
};
|
|
30
|
-
return res;
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
console.log('%c Line:52 🥖 postTransactionInit -> error', 'color:#f5ce50', error);
|
|
34
|
-
return {
|
|
35
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
36
|
-
message: `Something went wrong! ${error}`,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export default postTransactionInit;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
2
|
-
import fetchWrapper from '../fetch-client';
|
|
3
|
-
import { GET_EKA_V2RX_HOST_V2 } from '../fetch-client/helper';
|
|
4
|
-
async function postTransactionStop({ txnId, audioFiles, }) {
|
|
5
|
-
try {
|
|
6
|
-
const headers = new Headers();
|
|
7
|
-
headers.append('Content-Type', 'application/json');
|
|
8
|
-
const raw = {
|
|
9
|
-
audio_files: audioFiles,
|
|
10
|
-
};
|
|
11
|
-
const options = {
|
|
12
|
-
method: 'POST',
|
|
13
|
-
headers,
|
|
14
|
-
body: JSON.stringify(raw),
|
|
15
|
-
};
|
|
16
|
-
const response = await fetchWrapper(`${GET_EKA_V2RX_HOST_V2()}/transaction/stop/${txnId}`, options);
|
|
17
|
-
let res = await response.json();
|
|
18
|
-
res = {
|
|
19
|
-
...res,
|
|
20
|
-
code: response.status,
|
|
21
|
-
};
|
|
22
|
-
return res;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.log('%c Line:52 🥖 postTransactionInit -> error', 'color:#f5ce50', error);
|
|
26
|
-
return {
|
|
27
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
28
|
-
message: `Something went wrong! ${error}`,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export default postTransactionStop;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TPostV1ConvertToTemplateRequest, TPostV1ConvertToTemplateResponse } from '../../constants/types';
|
|
2
|
-
declare function postConvertTransactionToTemplate({ txn_id, template_id, transcript, }: TPostV1ConvertToTemplateRequest): Promise<TPostV1ConvertToTemplateResponse>;
|
|
3
|
-
export default postConvertTransactionToTemplate;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
-
import fetchWrapper from '../../fetch-client';
|
|
3
|
-
import { GET_EKA_VOICE_HOST_V1 } from '../../fetch-client/helper';
|
|
4
|
-
async function postConvertTransactionToTemplate({ txn_id, template_id, transcript, }) {
|
|
5
|
-
try {
|
|
6
|
-
const headers = new Headers();
|
|
7
|
-
headers.append('Content-Type', 'application/json');
|
|
8
|
-
const options = {
|
|
9
|
-
method: 'POST',
|
|
10
|
-
headers,
|
|
11
|
-
body: JSON.stringify({
|
|
12
|
-
transcript,
|
|
13
|
-
template_id,
|
|
14
|
-
}),
|
|
15
|
-
};
|
|
16
|
-
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/transaction/${txn_id}/convert-to-template`, options, 60000);
|
|
17
|
-
let res = await response.json();
|
|
18
|
-
res = {
|
|
19
|
-
...res,
|
|
20
|
-
code: response.status,
|
|
21
|
-
};
|
|
22
|
-
return res;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.log('%c postV1ConvertToTemplate -> error', 'color:#f5ce50', error);
|
|
26
|
-
return {
|
|
27
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
28
|
-
message: `Something went wrong! ${error}`,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export default postConvertTransactionToTemplate;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
-
import fetchWrapper from '../../fetch-client';
|
|
3
|
-
import { GET_EKA_VOICE_HOST_V2 } from '../../fetch-client/helper';
|
|
4
|
-
export const getConfigV2 = async () => {
|
|
5
|
-
try {
|
|
6
|
-
const options = {
|
|
7
|
-
method: 'GET',
|
|
8
|
-
headers: {
|
|
9
|
-
'Content-Type': 'application/json',
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/config/`, options);
|
|
13
|
-
const res = await response.json();
|
|
14
|
-
return {
|
|
15
|
-
...res,
|
|
16
|
-
code: response.status,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
console.log('Error in getConfigV2 api: ', error);
|
|
21
|
-
return {
|
|
22
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
|
-
message: `Failed to fetch initial configurations, ${error}`,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export type TTemplateMessage = {
|
|
2
|
-
type: 'warning' | 'error';
|
|
3
|
-
code?: string;
|
|
4
|
-
msg: string;
|
|
5
|
-
};
|
|
6
|
-
export type TOutputSummary = {
|
|
7
|
-
template_id: string;
|
|
8
|
-
value?: string | null;
|
|
9
|
-
type: string;
|
|
10
|
-
name: string;
|
|
11
|
-
lang?: string;
|
|
12
|
-
status: TTemplateStatus;
|
|
13
|
-
errors?: TTemplateMessage[];
|
|
14
|
-
warnings?: TTemplateMessage[];
|
|
15
|
-
};
|
|
16
|
-
export type TTemplateStatus = 'success' | 'partial_success' | 'failure';
|
|
17
|
-
type TAdditionalData = {
|
|
18
|
-
doctor: {
|
|
19
|
-
_id: string;
|
|
20
|
-
profile: {
|
|
21
|
-
personal: {
|
|
22
|
-
name: {
|
|
23
|
-
l: string;
|
|
24
|
-
f: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
type TApiResponse = {
|
|
31
|
-
data: {
|
|
32
|
-
output: TOutputSummary[];
|
|
33
|
-
audio_matrix?: {
|
|
34
|
-
quality: string;
|
|
35
|
-
};
|
|
36
|
-
additional_data?: TAdditionalData;
|
|
37
|
-
meta_data?: {
|
|
38
|
-
total_resources?: number;
|
|
39
|
-
total_parsed_resources?: number;
|
|
40
|
-
};
|
|
41
|
-
created_at?: string;
|
|
42
|
-
template_results: {
|
|
43
|
-
integration: TOutputSummary[];
|
|
44
|
-
custom: TOutputSummary[];
|
|
45
|
-
transcript: TOutputSummary[];
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
error?: {
|
|
49
|
-
code: string;
|
|
50
|
-
msg: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
export type TGetStatusResponse = {
|
|
54
|
-
response?: TApiResponse | null;
|
|
55
|
-
status_code: number;
|
|
56
|
-
message?: string;
|
|
57
|
-
};
|
|
58
|
-
export declare const getVoiceApiV3StatusTranscription: ({ txnId, }: {
|
|
59
|
-
txnId: string;
|
|
60
|
-
}) => Promise<TGetStatusResponse>;
|
|
61
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
-
import fetchWrapper from '../../fetch-client';
|
|
3
|
-
import { GET_EKA_VOICE_HOST_V3 } from '../../fetch-client/helper';
|
|
4
|
-
export const getVoiceApiV3StatusTranscription = async ({ txnId, }) => {
|
|
5
|
-
try {
|
|
6
|
-
const headers = new Headers();
|
|
7
|
-
headers.append('Content-Type', 'application/json');
|
|
8
|
-
const options = {
|
|
9
|
-
method: 'GET',
|
|
10
|
-
headers,
|
|
11
|
-
};
|
|
12
|
-
// Use custom timeout for this API (16 seconds instead of default 5 seconds)
|
|
13
|
-
const getResponse = await fetchWrapper(`${GET_EKA_VOICE_HOST_V3()}/status/transcription/${txnId}`, options, 16000);
|
|
14
|
-
const response = await getResponse.json();
|
|
15
|
-
return {
|
|
16
|
-
response,
|
|
17
|
-
status_code: getResponse.status,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return {
|
|
22
|
-
status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
|
-
message: `Something went wrong! ${error}`,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|