@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.
- package/dist/index.mjs +36 -28
- 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
|
|
11335
|
-
|
|
11336
|
-
const
|
|
11335
|
+
const s = new Headers();
|
|
11336
|
+
s.append("Content-Type", "application/json");
|
|
11337
|
+
const n = {
|
|
11337
11338
|
method: "GET",
|
|
11338
|
-
headers:
|
|
11339
|
-
},
|
|
11340
|
-
`${GET_EKA_VOICE_HOST_V3()}/status/${i}`,
|
|
11341
|
-
|
|
11339
|
+
headers: s
|
|
11340
|
+
}, r = await fetchWrapper(
|
|
11341
|
+
`${GET_EKA_VOICE_HOST_V3()}/status/${i}${a ? `?${a}` : ""}`,
|
|
11342
|
+
n,
|
|
11342
11343
|
16e3
|
|
11343
|
-
),
|
|
11344
|
+
), c = await r.json();
|
|
11344
11345
|
return {
|
|
11345
|
-
response: decodeApiResponse$1(
|
|
11346
|
-
status_code:
|
|
11346
|
+
response: decodeApiResponse$1(c),
|
|
11347
|
+
status_code: r.status
|
|
11347
11348
|
};
|
|
11348
|
-
} catch (
|
|
11349
|
+
} catch (s) {
|
|
11349
11350
|
return {
|
|
11350
11351
|
status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
11351
|
-
message: `Something went wrong! ${
|
|
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
|
-
|
|
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
|
|
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 (
|
|
54230
|
-
return n(
|
|
54231
|
-
if (
|
|
54232
|
-
if (
|
|
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:
|
|
54235
|
-
status_code:
|
|
54242
|
+
response: t,
|
|
54243
|
+
status_code: p,
|
|
54236
54244
|
message: "Partial result received",
|
|
54237
54245
|
poll_status: "in-progress"
|
|
54238
|
-
}),
|
|
54246
|
+
}), p >= 400) {
|
|
54239
54247
|
if (u++, u >= 3) {
|
|
54240
|
-
const
|
|
54241
|
-
return n(
|
|
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 (
|
|
54261
|
+
} catch (l) {
|
|
54254
54262
|
return n(
|
|
54255
54263
|
-1,
|
|
54256
54264
|
null,
|
|
54257
|
-
`Something went wrong from inside catch block. ${
|
|
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,
|