@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.
- 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.d.ts +1 -1
- 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/shared-worker/s3-file-upload.ts +1 -1
- package/dist/store/store.js +3 -1
- package/dist/utils/compress-mp3-audio.d.ts +1 -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,7 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.getConfigV2MyTemplates = void 0;
|
|
13
|
+
const constant_1 = require("../../constants/constant");
|
|
14
|
+
const fetch_client_1 = require("../../fetch-client");
|
|
15
|
+
const helper_1 = require("../../fetch-client/helper");
|
|
16
|
+
const getConfigV2MyTemplates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
17
|
try {
|
|
6
18
|
const options = {
|
|
7
19
|
method: 'GET',
|
|
@@ -9,18 +21,16 @@ export const getConfigV2MyTemplates = async () => {
|
|
|
9
21
|
'Content-Type': 'application/json',
|
|
10
22
|
},
|
|
11
23
|
};
|
|
12
|
-
const response =
|
|
13
|
-
const res =
|
|
14
|
-
return {
|
|
15
|
-
...res,
|
|
16
|
-
code: response.status,
|
|
17
|
-
};
|
|
24
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_VOICE_HOST_V2)()}/config/?my_templates=true`, options);
|
|
25
|
+
const res = yield response.json();
|
|
26
|
+
return Object.assign(Object.assign({}, res), { code: response.status });
|
|
18
27
|
}
|
|
19
28
|
catch (error) {
|
|
20
29
|
console.log('Error in getConfigV2MyTemplates api: ', error);
|
|
21
30
|
return {
|
|
22
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
31
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
32
|
message: `Failed to fetch initial configurations, ${error}`,
|
|
24
33
|
};
|
|
25
34
|
}
|
|
26
|
-
};
|
|
35
|
+
});
|
|
36
|
+
exports.getConfigV2MyTemplates = getConfigV2MyTemplates;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.getConfigV2 = void 0;
|
|
13
|
+
const constant_1 = require("../../constants/constant");
|
|
14
|
+
const fetch_client_1 = require("../../fetch-client");
|
|
15
|
+
const helper_1 = require("../../fetch-client/helper");
|
|
16
|
+
const getConfigV2 = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
17
|
try {
|
|
6
18
|
const options = {
|
|
7
19
|
method: 'GET',
|
|
@@ -9,18 +21,16 @@ export const getConfigV2 = async () => {
|
|
|
9
21
|
'Content-Type': 'application/json',
|
|
10
22
|
},
|
|
11
23
|
};
|
|
12
|
-
const response =
|
|
13
|
-
const res =
|
|
14
|
-
return {
|
|
15
|
-
...res,
|
|
16
|
-
code: response.status,
|
|
17
|
-
};
|
|
24
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_VOICE_HOST_V2)()}/config/`, options);
|
|
25
|
+
const res = yield response.json();
|
|
26
|
+
return Object.assign(Object.assign({}, res), { code: response.status });
|
|
18
27
|
}
|
|
19
28
|
catch (error) {
|
|
20
29
|
console.log('Error in getConfigV2 api: ', error);
|
|
21
30
|
return {
|
|
22
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
31
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
32
|
message: `Failed to fetch initial configurations, ${error}`,
|
|
24
33
|
};
|
|
25
34
|
}
|
|
26
|
-
};
|
|
35
|
+
});
|
|
36
|
+
exports.getConfigV2 = getConfigV2;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
const constant_1 = require("../../constants/constant");
|
|
13
|
+
const fetch_client_1 = require("../../fetch-client");
|
|
14
|
+
const helper_1 = require("../../fetch-client/helper");
|
|
15
|
+
const putVoiceApiV2Config = (request) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
16
|
try {
|
|
6
17
|
const options = {
|
|
7
18
|
method: 'PUT',
|
|
@@ -10,19 +21,16 @@ const putVoiceApiV2Config = async (request) => {
|
|
|
10
21
|
},
|
|
11
22
|
body: JSON.stringify(request),
|
|
12
23
|
};
|
|
13
|
-
const response =
|
|
14
|
-
const res =
|
|
15
|
-
return {
|
|
16
|
-
...res,
|
|
17
|
-
code: response.status,
|
|
18
|
-
};
|
|
24
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_VOICE_HOST_V2)()}/config/`, options);
|
|
25
|
+
const res = yield response.json();
|
|
26
|
+
return Object.assign(Object.assign({}, res), { code: response.status });
|
|
19
27
|
}
|
|
20
28
|
catch (error) {
|
|
21
29
|
console.log('Error in getConfigV2 api: ', error);
|
|
22
30
|
return {
|
|
23
|
-
code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
31
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
24
32
|
msg: `Failed to fetch initial configurations, ${error}`,
|
|
25
33
|
};
|
|
26
34
|
}
|
|
27
|
-
};
|
|
28
|
-
|
|
35
|
+
});
|
|
36
|
+
exports.default = putVoiceApiV2Config;
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
const fetch_client_1 = require("../fetch-client");
|
|
13
|
+
const helper_1 = require("../fetch-client/helper");
|
|
14
|
+
function postCogInit() {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
const options = {
|
|
18
|
+
method: 'GET',
|
|
19
|
+
};
|
|
20
|
+
const respJson = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_VOICE_HOST_V1)()}/s3-token/`, options);
|
|
21
|
+
const resp = yield respJson.json();
|
|
22
|
+
return resp;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
15
28
|
}
|
|
16
|
-
|
|
29
|
+
exports.default = postCogInit;
|
|
@@ -1,29 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
+
const constant_1 = require("../constants/constant");
|
|
13
|
+
const fetch_client_1 = require("../fetch-client");
|
|
14
|
+
const helper_1 = require("../fetch-client/helper");
|
|
15
|
+
function postV1FileUpload(_a) {
|
|
16
|
+
return __awaiter(this, arguments, void 0, function* ({ txn_id, action, }) {
|
|
17
|
+
try {
|
|
18
|
+
const headers = new Headers();
|
|
19
|
+
headers.append('Content-Type', 'application/json');
|
|
20
|
+
const options = {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
headers,
|
|
23
|
+
body: JSON.stringify({}),
|
|
24
|
+
};
|
|
25
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_HOST)()}/v1/file-upload?txn_id=${txn_id}&action=${action}`, options);
|
|
26
|
+
let res = yield response.json();
|
|
27
|
+
res = Object.assign(Object.assign({}, res), { code: response.status });
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.log('%c getPresignedUrl -> error', 'color:#f5ce50', error);
|
|
32
|
+
return {
|
|
33
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
34
|
+
message: `Something went wrong! ${error}`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
28
38
|
}
|
|
29
|
-
|
|
39
|
+
exports.default = postV1FileUpload;
|
|
@@ -1,28 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
+
const constant_1 = require("../../constants/constant");
|
|
13
|
+
const fetch_client_1 = require("../../fetch-client");
|
|
14
|
+
const helper_1 = require("../../fetch-client/helper");
|
|
15
|
+
function deleteV1TemplateSection(section_id) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
const headers = new Headers();
|
|
19
|
+
headers.append('Content-Type', 'application/json');
|
|
20
|
+
const options = {
|
|
21
|
+
method: 'DELETE',
|
|
22
|
+
headers,
|
|
23
|
+
};
|
|
24
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_VOICE_HOST_V1)()}/template/section/${section_id}`, options);
|
|
25
|
+
let res = yield response.json();
|
|
26
|
+
res = Object.assign(Object.assign({}, res), { code: response.status });
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.log('%c deleteV1TemplateSection -> error', 'color:#f5ce50', error);
|
|
31
|
+
return {
|
|
32
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
33
|
+
msg: `Something went wrong! ${error}`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
27
37
|
}
|
|
28
|
-
|
|
38
|
+
exports.default = deleteV1TemplateSection;
|
|
@@ -1,28 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
+
const constant_1 = require("../../constants/constant");
|
|
13
|
+
const fetch_client_1 = require("../../fetch-client");
|
|
14
|
+
const helper_1 = require("../../fetch-client/helper");
|
|
15
|
+
function getV1TemplateSections() {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
const headers = new Headers();
|
|
19
|
+
headers.append('Content-Type', 'application/json');
|
|
20
|
+
const options = {
|
|
21
|
+
method: 'GET',
|
|
22
|
+
headers,
|
|
23
|
+
};
|
|
24
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_VOICE_HOST_V1)()}/template/section`, options);
|
|
25
|
+
let res = yield response.json();
|
|
26
|
+
res = Object.assign(Object.assign({}, res), { code: response.status });
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.log('%c getV1TemplateSections -> error', 'color:#f5ce50', error);
|
|
31
|
+
return {
|
|
32
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
33
|
+
items: [],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
27
37
|
}
|
|
28
|
-
|
|
38
|
+
exports.default = getV1TemplateSections;
|
|
@@ -1,37 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
const constant_1 = require("../../constants/constant");
|
|
13
|
+
const fetch_client_1 = require("../../fetch-client");
|
|
14
|
+
const helper_1 = require("../../fetch-client/helper");
|
|
15
|
+
function patchV1TemplateSection(_a) {
|
|
16
|
+
return __awaiter(this, arguments, void 0, function* ({ section_id, title, desc, format, example, }) {
|
|
17
|
+
try {
|
|
18
|
+
const headers = new Headers();
|
|
19
|
+
headers.append('Content-Type', 'application/json');
|
|
20
|
+
const raw = {
|
|
21
|
+
title,
|
|
22
|
+
desc,
|
|
23
|
+
format,
|
|
24
|
+
example,
|
|
25
|
+
};
|
|
26
|
+
const options = {
|
|
27
|
+
method: 'PATCH',
|
|
28
|
+
headers,
|
|
29
|
+
body: JSON.stringify(raw),
|
|
30
|
+
};
|
|
31
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_VOICE_HOST_V1)()}/template/section/${section_id}`, options);
|
|
32
|
+
let res = yield response.json();
|
|
33
|
+
res = Object.assign(Object.assign({}, res), { code: response.status });
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.log('%c patchV1TemplateSection -> error', 'color:#f5ce50', error);
|
|
38
|
+
return {
|
|
39
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
40
|
+
msg: `Something went wrong! ${error}`,
|
|
41
|
+
section_id: '',
|
|
42
|
+
action: 'updated',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
36
46
|
}
|
|
37
|
-
|
|
47
|
+
exports.default = patchV1TemplateSection;
|
|
@@ -1,36 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
const constant_1 = require("../../constants/constant");
|
|
13
|
+
const fetch_client_1 = require("../../fetch-client");
|
|
14
|
+
const helper_1 = require("../../fetch-client/helper");
|
|
15
|
+
function postV1TemplateSection(_a) {
|
|
16
|
+
return __awaiter(this, arguments, void 0, function* ({ title, desc, format, example, }) {
|
|
17
|
+
try {
|
|
18
|
+
const headers = new Headers();
|
|
19
|
+
headers.append('Content-Type', 'application/json');
|
|
20
|
+
const raw = {
|
|
21
|
+
title,
|
|
22
|
+
desc,
|
|
23
|
+
format,
|
|
24
|
+
example,
|
|
25
|
+
};
|
|
26
|
+
const options = {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers,
|
|
29
|
+
body: JSON.stringify(raw),
|
|
30
|
+
};
|
|
31
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_EKA_VOICE_HOST_V1)()}/template/section`, options);
|
|
32
|
+
let res = yield response.json();
|
|
33
|
+
res = Object.assign(Object.assign({}, res), { code: response.status });
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.log('%c postV1TemplateSection -> error', 'color:#f5ce50', error);
|
|
38
|
+
return {
|
|
39
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
40
|
+
msg: `Something went wrong! ${error}`,
|
|
41
|
+
section_id: '',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
35
45
|
}
|
|
36
|
-
|
|
46
|
+
exports.default = postV1TemplateSection;
|
|
@@ -1,26 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
const constant_1 = require("../../constants/constant");
|
|
13
|
+
const fetch_client_1 = require("../../fetch-client");
|
|
14
|
+
const helper_1 = require("../../fetch-client/helper");
|
|
15
|
+
function cookV1MediaAiCreateTemplate(formData) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
const options = {
|
|
19
|
+
method: 'POST',
|
|
20
|
+
body: formData,
|
|
21
|
+
};
|
|
22
|
+
const response = yield (0, fetch_client_1.default)(`${(0, helper_1.GET_COOK_HOST_V1)()}/medai/ai-create-template`, options, 60000);
|
|
23
|
+
let res = yield response.json();
|
|
24
|
+
res = Object.assign(Object.assign({}, res), { code: response.status });
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.log('%c postV1Template -> error', 'color:#f5ce50', error);
|
|
29
|
+
return {
|
|
30
|
+
code: constant_1.SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
31
|
+
message: `Something went wrong! ${error}`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
25
35
|
}
|
|
26
|
-
|
|
36
|
+
exports.default = cookV1MediaAiCreateTemplate;
|