@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.
Files changed (57) 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.d.ts +1 -1
  38. package/dist/constants/types.js +2 -1
  39. package/dist/fetch-client/helper.js +24 -11
  40. package/dist/fetch-client/index.js +61 -52
  41. package/dist/index.js +321 -254
  42. package/dist/main/end-recording.js +56 -53
  43. package/dist/main/init-transaction.js +36 -27
  44. package/dist/main/pause-recording.js +17 -18
  45. package/dist/main/poll-output-summary.js +21 -7
  46. package/dist/main/resume-recording.js +13 -14
  47. package/dist/main/retry-upload-recording.js +39 -30
  48. package/dist/main/start-recording.js +34 -26
  49. package/dist/main/upload-full-audio-with-presigned-url.js +84 -69
  50. package/dist/shared-worker/s3-file-upload.js +88 -79
  51. package/dist/shared-worker/s3-file-upload.ts +1 -1
  52. package/dist/store/store.js +3 -1
  53. package/dist/utils/compress-mp3-audio.d.ts +1 -1
  54. package/dist/utils/compress-mp3-audio.js +6 -4
  55. package/dist/utils/get-worker-url.js +12 -7
  56. package/dist/utils/search-past-sessions.js +23 -9
  57. package/package.json +1 -1
@@ -1,7 +1,19 @@
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 getConfigV2MyTemplates = async () => {
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 = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/config/?my_templates=true`, options);
13
- const res = await response.json();
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
- 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 () => {
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 = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/config/`, options);
13
- const res = await response.json();
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
- 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
- const putVoiceApiV2Config = async (request) => {
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 = await fetchWrapper(`${GET_EKA_VOICE_HOST_V2()}/config/`, options);
14
- const res = await response.json();
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
- export default putVoiceApiV2Config;
35
+ });
36
+ exports.default = putVoiceApiV2Config;
@@ -1,16 +1,29 @@
1
- import fetchWrapper from '../fetch-client';
2
- import { GET_EKA_VOICE_HOST_V1 } from '../fetch-client/helper';
3
- async function postCogInit() {
4
- try {
5
- const options = {
6
- method: 'GET',
7
- };
8
- const respJson = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/s3-token/`, options);
9
- const resp = await respJson.json();
10
- return resp;
11
- }
12
- catch (error) {
13
- throw error;
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
- export default postCogInit;
29
+ exports.default = postCogInit;
@@ -1,29 +1,39 @@
1
- import { SDK_STATUS_CODE } from '../constants/constant';
2
- import fetchWrapper from '../fetch-client';
3
- import { GET_EKA_HOST } from '../fetch-client/helper';
4
- async function postV1FileUpload({ txn_id, action, }) {
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
- };
13
- const response = await fetchWrapper(`${GET_EKA_HOST()}/v1/file-upload?txn_id=${txn_id}&action=${action}`, options);
14
- let res = await response.json();
15
- res = {
16
- ...res,
17
- code: response.status,
18
- };
19
- return res;
20
- }
21
- catch (error) {
22
- console.log('%c getPresignedUrl -> error', 'color:#f5ce50', error);
23
- return {
24
- code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
25
- message: `Something went wrong! ${error}`,
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
- export default postV1FileUpload;
39
+ exports.default = postV1FileUpload;
@@ -1,28 +1,38 @@
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 deleteV1TemplateSection(section_id) {
5
- try {
6
- const headers = new Headers();
7
- headers.append('Content-Type', 'application/json');
8
- const options = {
9
- method: 'DELETE',
10
- headers,
11
- };
12
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section/${section_id}`, options);
13
- let res = await response.json();
14
- res = {
15
- ...res,
16
- code: response.status,
17
- };
18
- return res;
19
- }
20
- catch (error) {
21
- console.log('%c deleteV1TemplateSection -> error', 'color:#f5ce50', error);
22
- return {
23
- code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
24
- msg: `Something went wrong! ${error}`,
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
- export default deleteV1TemplateSection;
38
+ exports.default = deleteV1TemplateSection;
@@ -1,28 +1,38 @@
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 getV1TemplateSections() {
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 response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section`, options);
13
- let res = await response.json();
14
- res = {
15
- ...res,
16
- code: response.status,
17
- };
18
- return res;
19
- }
20
- catch (error) {
21
- console.log('%c getV1TemplateSections -> error', 'color:#f5ce50', error);
22
- return {
23
- code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
24
- items: [],
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
- export default getV1TemplateSections;
38
+ exports.default = getV1TemplateSections;
@@ -1,37 +1,47 @@
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 patchV1TemplateSection({ section_id, title, desc, format, example, }) {
5
- try {
6
- const headers = new Headers();
7
- headers.append('Content-Type', 'application/json');
8
- const raw = {
9
- title,
10
- desc,
11
- format,
12
- example,
13
- };
14
- const options = {
15
- method: 'PATCH',
16
- headers,
17
- body: JSON.stringify(raw),
18
- };
19
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section/${section_id}`, options);
20
- let res = await response.json();
21
- res = {
22
- ...res,
23
- code: response.status,
24
- };
25
- return res;
26
- }
27
- catch (error) {
28
- console.log('%c patchV1TemplateSection -> error', 'color:#f5ce50', error);
29
- return {
30
- code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
31
- msg: `Something went wrong! ${error}`,
32
- section_id: '',
33
- action: 'updated',
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
- export default patchV1TemplateSection;
47
+ exports.default = patchV1TemplateSection;
@@ -1,36 +1,46 @@
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 postV1TemplateSection({ title, desc, format, example, }) {
5
- try {
6
- const headers = new Headers();
7
- headers.append('Content-Type', 'application/json');
8
- const raw = {
9
- title,
10
- desc,
11
- format,
12
- example,
13
- };
14
- const options = {
15
- method: 'POST',
16
- headers,
17
- body: JSON.stringify(raw),
18
- };
19
- const response = await fetchWrapper(`${GET_EKA_VOICE_HOST_V1()}/template/section`, options);
20
- let res = await response.json();
21
- res = {
22
- ...res,
23
- code: response.status,
24
- };
25
- return res;
26
- }
27
- catch (error) {
28
- console.log('%c postV1TemplateSection -> error', 'color:#f5ce50', error);
29
- return {
30
- code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
31
- msg: `Something went wrong! ${error}`,
32
- section_id: '',
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
- export default postV1TemplateSection;
46
+ exports.default = postV1TemplateSection;
@@ -1,26 +1,36 @@
1
- import { SDK_STATUS_CODE } from '../../constants/constant';
2
- import fetchWrapper from '../../fetch-client';
3
- import { GET_COOK_HOST_V1 } from '../../fetch-client/helper';
4
- async function cookV1MediaAiCreateTemplate(formData) {
5
- try {
6
- const options = {
7
- method: 'POST',
8
- body: formData,
9
- };
10
- const response = await fetchWrapper(`${GET_COOK_HOST_V1()}/medai/ai-create-template`, options, 60000);
11
- let res = await response.json();
12
- res = {
13
- ...res,
14
- code: response.status,
15
- };
16
- return res;
17
- }
18
- catch (error) {
19
- console.log('%c postV1Template -> error', 'color:#f5ce50', error);
20
- return {
21
- code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
22
- message: `Something went wrong! ${error}`,
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
- export default cookV1MediaAiCreateTemplate;
36
+ exports.default = cookV1MediaAiCreateTemplate;