@eka-care/ekascribe-ts-sdk 2.0.44 → 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 +1 -0
- package/dist/index.mjs +41 -40
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -54203,76 +54203,77 @@ const decodeApiResponse = (i) => {
|
|
|
54203
54203
|
}
|
|
54204
54204
|
}, pollOutputSummary = async ({
|
|
54205
54205
|
txn_id: i,
|
|
54206
|
-
max_polling_time: a = 120 * 1e3
|
|
54206
|
+
max_polling_time: a = 120 * 1e3,
|
|
54207
|
+
is_ongoing_session: s
|
|
54207
54208
|
}) => {
|
|
54208
|
-
const
|
|
54209
|
-
const
|
|
54210
|
-
response:
|
|
54211
|
-
status_code:
|
|
54212
|
-
errorMessage:
|
|
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
|
|
54213
54214
|
};
|
|
54214
|
-
return
|
|
54215
|
+
return n?.({
|
|
54215
54216
|
txn_id: i,
|
|
54216
|
-
response:
|
|
54217
|
-
status_code:
|
|
54218
|
-
message:
|
|
54219
|
-
poll_status:
|
|
54220
|
-
}),
|
|
54217
|
+
response: u ?? null,
|
|
54218
|
+
status_code: c,
|
|
54219
|
+
message: m,
|
|
54220
|
+
poll_status: y
|
|
54221
|
+
}), l;
|
|
54221
54222
|
};
|
|
54222
54223
|
try {
|
|
54223
|
-
const
|
|
54224
|
-
let
|
|
54225
|
-
|
|
54224
|
+
const u = (/* @__PURE__ */ new Date()).getTime() + a;
|
|
54225
|
+
let m = 0;
|
|
54226
|
+
n?.({
|
|
54226
54227
|
txn_id: i,
|
|
54227
54228
|
response: null,
|
|
54228
54229
|
status_code: 202,
|
|
54229
54230
|
message: "Polling for session output summary started",
|
|
54230
54231
|
poll_status: "in-progress"
|
|
54231
54232
|
});
|
|
54232
|
-
const
|
|
54233
|
+
const y = async (l) => {
|
|
54233
54234
|
try {
|
|
54234
|
-
const
|
|
54235
|
-
if ((/* @__PURE__ */ new Date()).getTime() >=
|
|
54236
|
-
return
|
|
54237
|
-
if (
|
|
54238
|
-
return
|
|
54239
|
-
if (
|
|
54240
|
-
if (
|
|
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?.({
|
|
54241
54242
|
txn_id: i,
|
|
54242
|
-
response:
|
|
54243
|
-
status_code:
|
|
54243
|
+
response: e,
|
|
54244
|
+
status_code: t,
|
|
54244
54245
|
message: "Partial result received",
|
|
54245
54246
|
poll_status: "in-progress"
|
|
54246
|
-
}),
|
|
54247
|
-
if (
|
|
54248
|
-
const
|
|
54249
|
-
return
|
|
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");
|
|
54250
54251
|
}
|
|
54251
54252
|
} else
|
|
54252
|
-
|
|
54253
|
-
return
|
|
54253
|
+
m = 0;
|
|
54254
|
+
return y();
|
|
54254
54255
|
}
|
|
54255
|
-
return
|
|
54256
|
-
p,
|
|
54256
|
+
return r(
|
|
54257
54257
|
t,
|
|
54258
|
+
e,
|
|
54258
54259
|
"Template results generated successfully. Polling for this session is complete.",
|
|
54259
54260
|
"success"
|
|
54260
54261
|
);
|
|
54261
|
-
} catch (
|
|
54262
|
-
return
|
|
54262
|
+
} catch (p) {
|
|
54263
|
+
return r(
|
|
54263
54264
|
-1,
|
|
54264
54265
|
null,
|
|
54265
|
-
`Something went wrong from inside catch block. ${
|
|
54266
|
+
`Something went wrong from inside catch block. ${p}`,
|
|
54266
54267
|
"failed"
|
|
54267
54268
|
);
|
|
54268
54269
|
}
|
|
54269
54270
|
};
|
|
54270
|
-
return
|
|
54271
|
-
} catch (
|
|
54272
|
-
return
|
|
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(
|
|
54273
54274
|
-1,
|
|
54274
54275
|
null,
|
|
54275
|
-
`Something went wrong from outer catch block, ${
|
|
54276
|
+
`Something went wrong from outer catch block, ${c}`,
|
|
54276
54277
|
"failed"
|
|
54277
54278
|
);
|
|
54278
54279
|
}
|