@eka-care/ekascribe-ts-sdk 2.0.43 → 2.0.45

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/index.d.ts CHANGED
@@ -55,6 +55,7 @@ declare class EkaScribe {
55
55
  pollSessionOutput(request: {
56
56
  txn_id: string;
57
57
  max_polling_time?: number;
58
+ is_ongoing_session?: boolean;
58
59
  }): Promise<TPollingResponse>;
59
60
  getSessionHistory({ txn_count }: {
60
61
  txn_count: number;
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 ({
@@ -54202,76 +54203,77 @@ const decodeApiResponse = (i) => {
54202
54203
  }
54203
54204
  }, pollOutputSummary = async ({
54204
54205
  txn_id: i,
54205
- max_polling_time: a = 120 * 1e3
54206
+ max_polling_time: a = 120 * 1e3,
54207
+ is_ongoing_session: s
54206
54208
  }) => {
54207
- const s = EkaScribeStore$1.partialResultCallback, n = (r, c, u, m) => {
54208
- const y = {
54209
- response: c ?? null,
54210
- status_code: r,
54211
- errorMessage: m === "success" || m === "in-progress" ? void 0 : u
54209
+ const n = EkaScribeStore$1.partialResultCallback, r = (c, u, m, y) => {
54210
+ const l = {
54211
+ response: u ?? null,
54212
+ status_code: c,
54213
+ errorMessage: y === "success" || y === "in-progress" ? void 0 : m
54212
54214
  };
54213
- return s?.({
54215
+ return n?.({
54214
54216
  txn_id: i,
54215
- response: c ?? null,
54216
- status_code: r,
54217
- message: u,
54218
- poll_status: m
54219
- }), y;
54217
+ response: u ?? null,
54218
+ status_code: c,
54219
+ message: m,
54220
+ poll_status: y
54221
+ }), l;
54220
54222
  };
54221
54223
  try {
54222
- const c = (/* @__PURE__ */ new Date()).getTime() + a;
54223
- let u = 0;
54224
- s?.({
54224
+ const u = (/* @__PURE__ */ new Date()).getTime() + a;
54225
+ let m = 0;
54226
+ n?.({
54225
54227
  txn_id: i,
54226
54228
  response: null,
54227
54229
  status_code: 202,
54228
54230
  message: "Polling for session output summary started",
54229
54231
  poll_status: "in-progress"
54230
54232
  });
54231
- const m = async () => {
54233
+ const y = async (l) => {
54232
54234
  try {
54233
- const y = await getVoiceApiV3Status({ txnId: i }), { status_code: l, response: p } = y;
54234
- if ((/* @__PURE__ */ new Date()).getTime() >= c)
54235
- return n(500, null, "We encountered an error while fetching analysis results due to timeout. Please try again.", "timeout");
54236
- if (l === 401 || l === 403)
54237
- return n(l, p, "Unauthorized or Forbidden", "failed");
54238
- if (l === 202 || l === 400 || l >= 500) {
54239
- if (l === 202 && p && s?.({
54235
+ const p = await getVoiceApiV3Status({ txnId: i, queryParams: l }), { status_code: t, response: e } = p;
54236
+ if ((/* @__PURE__ */ new Date()).getTime() >= u)
54237
+ return r(500, null, "We encountered an error while fetching analysis results due to timeout. Please try again.", "timeout");
54238
+ if (t === 401 || t === 403)
54239
+ return r(t, e, "Unauthorized or Forbidden", "failed");
54240
+ if (t === 202 || t === 400 || t >= 500) {
54241
+ if (t === 202 && e && n?.({
54240
54242
  txn_id: i,
54241
- response: p,
54242
- status_code: l,
54243
+ response: e,
54244
+ status_code: t,
54243
54245
  message: "Partial result received",
54244
54246
  poll_status: "in-progress"
54245
- }), l >= 400) {
54246
- if (u++, u >= 3) {
54247
- const e = p?.error?.msg || "We encountered a backend error while fetching results. Please try again.";
54248
- return n(l, null, e, "failed");
54247
+ }), t >= 400) {
54248
+ if (m++, m >= 3) {
54249
+ const d = e?.error?.msg || "We encountered a backend error while fetching results. Please try again.";
54250
+ return r(t, null, d, "failed");
54249
54251
  }
54250
54252
  } else
54251
- u = 0;
54252
- return m();
54253
+ m = 0;
54254
+ return y();
54253
54255
  }
54254
- return n(
54255
- l,
54256
- p,
54256
+ return r(
54257
+ t,
54258
+ e,
54257
54259
  "Template results generated successfully. Polling for this session is complete.",
54258
54260
  "success"
54259
54261
  );
54260
- } catch (y) {
54261
- return n(
54262
+ } catch (p) {
54263
+ return r(
54262
54264
  -1,
54263
54265
  null,
54264
- `Something went wrong from inside catch block. ${y}`,
54266
+ `Something went wrong from inside catch block. ${p}`,
54265
54267
  "failed"
54266
54268
  );
54267
54269
  }
54268
54270
  };
54269
- return m();
54270
- } catch (r) {
54271
- return r instanceof Error && r.name === "AbortError" ? n(-1, null, "Request was aborted due to timeout.", "timeout") : n(
54271
+ return y(s ? "template_id=transcript" : "");
54272
+ } catch (c) {
54273
+ return c instanceof Error && c.name === "AbortError" ? r(-1, null, "Request was aborted due to timeout.", "timeout") : r(
54272
54274
  -1,
54273
54275
  null,
54274
- `Something went wrong from outer catch block, ${r}`,
54276
+ `Something went wrong from outer catch block, ${c}`,
54275
54277
  "failed"
54276
54278
  );
54277
54279
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "2.0.43",
3
+ "version": "2.0.45",
4
4
  "description": "EkaScribe TypeScript SDK - Modern ES2020 build",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",