@eka-care/ekascribe-ts-sdk 1.4.53 → 1.4.55
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/transaction/post-transaction-init.d.ts +1 -1
- package/dist/api/transaction/post-transaction-init.js +2 -1
- package/dist/api/upload-audio-with-presigned-url.d.ts +2 -1
- package/dist/api/upload-audio-with-presigned-url.js +2 -2
- package/dist/constants/types.d.ts +2 -0
- package/dist/main/upload-full-audio-with-presigned-url.d.ts +1 -1
- package/dist/main/upload-full-audio-with-presigned-url.js +3 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TPostTransactionInitRequest, TPostTransactionResponse } from '../../constants/types';
|
|
2
|
-
declare function postTransactionInit({ mode, txn_id, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, patient_details, model_type, version, flavour, batch_s3_url, }: TPostTransactionInitRequest): Promise<TPostTransactionResponse>;
|
|
2
|
+
declare function postTransactionInit({ mode, txn_id, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, patient_details, model_type, version, flavour, batch_s3_url, audio_file_names, }: TPostTransactionInitRequest): Promise<TPostTransactionResponse>;
|
|
3
3
|
export default postTransactionInit;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
2
|
import fetchWrapper from '../../fetch-client';
|
|
3
3
|
import { GET_EKA_VOICE_HOST_V2 } from '../../fetch-client/helper';
|
|
4
|
-
async function postTransactionInit({ mode, txn_id, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, patient_details, model_type, version, flavour, batch_s3_url, }) {
|
|
4
|
+
async function postTransactionInit({ mode, txn_id, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, patient_details, model_type, version, flavour, batch_s3_url, audio_file_names, }) {
|
|
5
5
|
try {
|
|
6
6
|
const headers = new Headers();
|
|
7
7
|
headers.append('Content-Type', 'application/json');
|
|
@@ -21,6 +21,7 @@ async function postTransactionInit({ mode, txn_id, s3Url, input_language, output
|
|
|
21
21
|
model_type,
|
|
22
22
|
version,
|
|
23
23
|
batch_s3_url,
|
|
24
|
+
...(audio_file_names ? { client_generated_files: audio_file_names } : {}),
|
|
24
25
|
};
|
|
25
26
|
const options = {
|
|
26
27
|
method: 'POST',
|
|
@@ -3,8 +3,9 @@ type TUploadFilesResponse = {
|
|
|
3
3
|
code: number;
|
|
4
4
|
message: string;
|
|
5
5
|
};
|
|
6
|
-
declare function uploadFilesWithPresignedUrl({ audioFiles, presignedUrlResponse, }: {
|
|
6
|
+
declare function uploadFilesWithPresignedUrl({ audioFiles, audioFileNames, presignedUrlResponse, }: {
|
|
7
7
|
audioFiles: File[] | Blob[];
|
|
8
|
+
audioFileNames: string[];
|
|
8
9
|
presignedUrlResponse: TPostV1FileUploadResponse;
|
|
9
10
|
}): Promise<TUploadFilesResponse>;
|
|
10
11
|
export default uploadFilesWithPresignedUrl;
|
|
@@ -35,10 +35,10 @@ async function uploadSingleFile(uploadData, folderPath, file, fileName) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
async function uploadFilesWithPresignedUrl({ audioFiles, presignedUrlResponse, }) {
|
|
38
|
+
async function uploadFilesWithPresignedUrl({ audioFiles, audioFileNames, presignedUrlResponse, }) {
|
|
39
39
|
try {
|
|
40
40
|
const uploadPromises = audioFiles.map((file, index) => {
|
|
41
|
-
const fileName =
|
|
41
|
+
const fileName = audioFileNames[index];
|
|
42
42
|
return uploadSingleFile({ ...presignedUrlResponse.uploadData }, presignedUrlResponse.folderPath, file, fileName);
|
|
43
43
|
});
|
|
44
44
|
const results = await Promise.all(uploadPromises);
|
|
@@ -124,10 +124,12 @@ export type TPostTransactionInitRequest = {
|
|
|
124
124
|
version?: string;
|
|
125
125
|
flavour?: string;
|
|
126
126
|
batch_s3_url?: string;
|
|
127
|
+
audio_file_names?: string[];
|
|
127
128
|
};
|
|
128
129
|
export interface TPostV1UploadAudioFilesRequest extends TPostTransactionInitRequest {
|
|
129
130
|
action: string;
|
|
130
131
|
audioFiles: File[] | Blob[];
|
|
132
|
+
audioFileNames: string[];
|
|
131
133
|
}
|
|
132
134
|
export type TPostTransactionCommitRequest = {
|
|
133
135
|
audioFiles: string[];
|
|
@@ -5,4 +5,4 @@ export type TFullAudioUploadResponse = {
|
|
|
5
5
|
status_code: number;
|
|
6
6
|
message: string;
|
|
7
7
|
};
|
|
8
|
-
export declare function postV1UploadAudioFiles({ audioFiles, txn_id, action, transfer, mode, input_language, output_format_template, model_training_consent, auto_download, system_info, patient_details, model_type, version, flavour, }: TPostV1UploadAudioFilesRequest): Promise<TFullAudioUploadResponse>;
|
|
8
|
+
export declare function postV1UploadAudioFiles({ audioFiles, audioFileNames, txn_id, action, transfer, mode, input_language, output_format_template, model_training_consent, auto_download, system_info, patient_details, model_type, version, flavour, }: TPostV1UploadAudioFilesRequest): Promise<TFullAudioUploadResponse>;
|
|
@@ -3,7 +3,7 @@ import postTransactionInit from '../api/transaction/post-transaction-init';
|
|
|
3
3
|
import uploadFilesWithPresignedUrl from '../api/upload-audio-with-presigned-url';
|
|
4
4
|
import { SDK_STATUS_CODE } from '../constants/constant';
|
|
5
5
|
import { ERROR_CODE } from '../constants/enums';
|
|
6
|
-
export async function postV1UploadAudioFiles({ audioFiles, txn_id, action, transfer, mode, input_language, output_format_template, model_training_consent, auto_download, system_info, patient_details, model_type, version, flavour, }) {
|
|
6
|
+
export async function postV1UploadAudioFiles({ audioFiles, audioFileNames, txn_id, action, transfer, mode, input_language, output_format_template, model_training_consent, auto_download, system_info, patient_details, model_type, version, flavour, }) {
|
|
7
7
|
try {
|
|
8
8
|
// Step 1: Get presigned URL
|
|
9
9
|
const presignedUrlResponse = await postV1FileUpload({ txn_id, action });
|
|
@@ -18,6 +18,7 @@ export async function postV1UploadAudioFiles({ audioFiles, txn_id, action, trans
|
|
|
18
18
|
// Step 2: Upload files using the presigned URL
|
|
19
19
|
const uploadResponse = await uploadFilesWithPresignedUrl({
|
|
20
20
|
audioFiles,
|
|
21
|
+
audioFileNames,
|
|
21
22
|
presignedUrlResponse,
|
|
22
23
|
});
|
|
23
24
|
console.log('upload full audio -> uploadResponse ', uploadResponse);
|
|
@@ -43,6 +44,7 @@ export async function postV1UploadAudioFiles({ audioFiles, txn_id, action, trans
|
|
|
43
44
|
version,
|
|
44
45
|
flavour,
|
|
45
46
|
batch_s3_url,
|
|
47
|
+
audio_file_names: audioFileNames,
|
|
46
48
|
});
|
|
47
49
|
console.log('upload full audio -> initTransactionResponse ', initTransactionResponse);
|
|
48
50
|
if (initTransactionResponse.code >= 400) {
|