@eka-care/ekascribe-ts-sdk 2.0.42 → 2.0.44

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 (2) hide show
  1. package/dist/index.mjs +36 -28
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -11328,27 +11328,28 @@ const getConfigV2 = async () => {
11328
11328
  }
11329
11329
  };
11330
11330
  }, getVoiceApiV3Status = async ({
11331
- txnId: i
11331
+ txnId: i,
11332
+ queryParams: a
11332
11333
  }) => {
11333
11334
  try {
11334
- const a = new Headers();
11335
- a.append("Content-Type", "application/json");
11336
- const s = {
11335
+ const s = new Headers();
11336
+ s.append("Content-Type", "application/json");
11337
+ const n = {
11337
11338
  method: "GET",
11338
- headers: a
11339
- }, n = await fetchWrapper(
11340
- `${GET_EKA_VOICE_HOST_V3()}/status/${i}`,
11341
- s,
11339
+ headers: s
11340
+ }, r = await fetchWrapper(
11341
+ `${GET_EKA_VOICE_HOST_V3()}/status/${i}${a ? `?${a}` : ""}`,
11342
+ n,
11342
11343
  16e3
11343
- ), r = await n.json();
11344
+ ), c = await r.json();
11344
11345
  return {
11345
- response: decodeApiResponse$1(r),
11346
- status_code: n.status
11346
+ response: decodeApiResponse$1(c),
11347
+ status_code: r.status
11347
11348
  };
11348
- } catch (a) {
11349
+ } catch (s) {
11349
11350
  return {
11350
11351
  status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
11351
- message: `Something went wrong! ${a}`
11352
+ message: `Something went wrong! ${s}`
11352
11353
  };
11353
11354
  }
11354
11355
  }, patchTransactionStatus = async ({
@@ -54221,45 +54222,52 @@ const decodeApiResponse = (i) => {
54221
54222
  try {
54222
54223
  const c = (/* @__PURE__ */ new Date()).getTime() + a;
54223
54224
  let u = 0;
54224
- const m = async () => {
54225
+ s?.({
54226
+ txn_id: i,
54227
+ response: null,
54228
+ status_code: 202,
54229
+ message: "Polling for session output summary started",
54230
+ poll_status: "in-progress"
54231
+ });
54232
+ const m = async (y) => {
54225
54233
  try {
54226
- const y = await getVoiceApiV3Status({ txnId: i }), { status_code: l, response: p } = y;
54234
+ const l = await getVoiceApiV3Status({ txnId: i, queryParams: y }), { status_code: p, response: t } = l;
54227
54235
  if ((/* @__PURE__ */ new Date()).getTime() >= c)
54228
54236
  return n(500, null, "We encountered an error while fetching analysis results due to timeout. Please try again.", "timeout");
54229
- if (l === 401 || l === 403)
54230
- return n(l, p, "Unauthorized or Forbidden", "failed");
54231
- if (l === 202 || l === 400 || l >= 500) {
54232
- if (l === 202 && p && s?.({
54237
+ if (p === 401 || p === 403)
54238
+ return n(p, t, "Unauthorized or Forbidden", "failed");
54239
+ if (p === 202 || p === 400 || p >= 500) {
54240
+ if (p === 202 && t && s?.({
54233
54241
  txn_id: i,
54234
- response: p,
54235
- status_code: l,
54242
+ response: t,
54243
+ status_code: p,
54236
54244
  message: "Partial result received",
54237
54245
  poll_status: "in-progress"
54238
- }), l >= 400) {
54246
+ }), p >= 400) {
54239
54247
  if (u++, u >= 3) {
54240
- const e = p?.error?.msg || "We encountered a backend error while fetching results. Please try again.";
54241
- return n(l, null, e, "failed");
54248
+ const o = t?.error?.msg || "We encountered a backend error while fetching results. Please try again.";
54249
+ return n(p, null, o, "failed");
54242
54250
  }
54243
54251
  } else
54244
54252
  u = 0;
54245
54253
  return m();
54246
54254
  }
54247
54255
  return n(
54248
- l,
54249
54256
  p,
54257
+ t,
54250
54258
  "Template results generated successfully. Polling for this session is complete.",
54251
54259
  "success"
54252
54260
  );
54253
- } catch (y) {
54261
+ } catch (l) {
54254
54262
  return n(
54255
54263
  -1,
54256
54264
  null,
54257
- `Something went wrong from inside catch block. ${y}`,
54265
+ `Something went wrong from inside catch block. ${l}`,
54258
54266
  "failed"
54259
54267
  );
54260
54268
  }
54261
54269
  };
54262
- return m();
54270
+ return m("template_id=transcript");
54263
54271
  } catch (r) {
54264
54272
  return r instanceof Error && r.name === "AbortError" ? n(-1, null, "Request was aborted due to timeout.", "timeout") : n(
54265
54273
  -1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "2.0.42",
3
+ "version": "2.0.44",
4
4
  "description": "EkaScribe TypeScript SDK - Modern ES2020 build",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",