@eka-care/ekascribe-ts-sdk 2.0.43 → 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 +29 -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 ({
|
|
@@ -54228,45 +54229,45 @@ const decodeApiResponse = (i) => {
|
|
|
54228
54229
|
message: "Polling for session output summary started",
|
|
54229
54230
|
poll_status: "in-progress"
|
|
54230
54231
|
});
|
|
54231
|
-
const m = async () => {
|
|
54232
|
+
const m = async (y) => {
|
|
54232
54233
|
try {
|
|
54233
|
-
const
|
|
54234
|
+
const l = await getVoiceApiV3Status({ txnId: i, queryParams: y }), { status_code: p, response: t } = l;
|
|
54234
54235
|
if ((/* @__PURE__ */ new Date()).getTime() >= c)
|
|
54235
54236
|
return n(500, null, "We encountered an error while fetching analysis results due to timeout. Please try again.", "timeout");
|
|
54236
|
-
if (
|
|
54237
|
-
return n(
|
|
54238
|
-
if (
|
|
54239
|
-
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?.({
|
|
54240
54241
|
txn_id: i,
|
|
54241
|
-
response:
|
|
54242
|
-
status_code:
|
|
54242
|
+
response: t,
|
|
54243
|
+
status_code: p,
|
|
54243
54244
|
message: "Partial result received",
|
|
54244
54245
|
poll_status: "in-progress"
|
|
54245
|
-
}),
|
|
54246
|
+
}), p >= 400) {
|
|
54246
54247
|
if (u++, u >= 3) {
|
|
54247
|
-
const
|
|
54248
|
-
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");
|
|
54249
54250
|
}
|
|
54250
54251
|
} else
|
|
54251
54252
|
u = 0;
|
|
54252
54253
|
return m();
|
|
54253
54254
|
}
|
|
54254
54255
|
return n(
|
|
54255
|
-
l,
|
|
54256
54256
|
p,
|
|
54257
|
+
t,
|
|
54257
54258
|
"Template results generated successfully. Polling for this session is complete.",
|
|
54258
54259
|
"success"
|
|
54259
54260
|
);
|
|
54260
|
-
} catch (
|
|
54261
|
+
} catch (l) {
|
|
54261
54262
|
return n(
|
|
54262
54263
|
-1,
|
|
54263
54264
|
null,
|
|
54264
|
-
`Something went wrong from inside catch block. ${
|
|
54265
|
+
`Something went wrong from inside catch block. ${l}`,
|
|
54265
54266
|
"failed"
|
|
54266
54267
|
);
|
|
54267
54268
|
}
|
|
54268
54269
|
};
|
|
54269
|
-
return m();
|
|
54270
|
+
return m("template_id=transcript");
|
|
54270
54271
|
} catch (r) {
|
|
54271
54272
|
return r instanceof Error && r.name === "AbortError" ? n(-1, null, "Request was aborted due to timeout.", "timeout") : n(
|
|
54272
54273
|
-1,
|