@eka-care/ekascribe-ts-sdk 2.0.41 → 2.0.42
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 +2 -2
- package/dist/index.mjs +55 -54
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -340,10 +340,10 @@ declare type TOutputSummary = {
|
|
|
340
340
|
|
|
341
341
|
declare type TPartialResultCallback = (data: {
|
|
342
342
|
txn_id: string;
|
|
343
|
-
response: TGetStatusApiResponse;
|
|
343
|
+
response: TGetStatusApiResponse | null;
|
|
344
344
|
status_code: number;
|
|
345
345
|
message: string;
|
|
346
|
-
poll_status: 'in-progress' | '
|
|
346
|
+
poll_status: 'in-progress' | 'success' | 'failed' | 'timeout';
|
|
347
347
|
}) => void;
|
|
348
348
|
|
|
349
349
|
declare type TPatchTransactionError = {
|
package/dist/index.mjs
CHANGED
|
@@ -54204,68 +54204,69 @@ const decodeApiResponse = (i) => {
|
|
|
54204
54204
|
txn_id: i,
|
|
54205
54205
|
max_polling_time: a = 120 * 1e3
|
|
54206
54206
|
}) => {
|
|
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
|
|
54212
|
+
};
|
|
54213
|
+
return s?.({
|
|
54214
|
+
txn_id: i,
|
|
54215
|
+
response: c ?? null,
|
|
54216
|
+
status_code: r,
|
|
54217
|
+
message: u,
|
|
54218
|
+
poll_status: m
|
|
54219
|
+
}), y;
|
|
54220
|
+
};
|
|
54207
54221
|
try {
|
|
54208
|
-
const
|
|
54209
|
-
let
|
|
54210
|
-
const
|
|
54222
|
+
const c = (/* @__PURE__ */ new Date()).getTime() + a;
|
|
54223
|
+
let u = 0;
|
|
54224
|
+
const m = async () => {
|
|
54211
54225
|
try {
|
|
54212
|
-
const
|
|
54213
|
-
if ((/* @__PURE__ */ new Date()).getTime() >=
|
|
54214
|
-
return
|
|
54215
|
-
|
|
54216
|
-
|
|
54217
|
-
|
|
54218
|
-
|
|
54219
|
-
return {
|
|
54220
|
-
response: l,
|
|
54221
|
-
status_code: y,
|
|
54222
|
-
errorMessage: "Unauthorized or Forbidden"
|
|
54223
|
-
};
|
|
54224
|
-
if (y === 202 || y === 400 || y >= 500) {
|
|
54225
|
-
if (y === 202 && l && r?.({
|
|
54226
|
+
const y = await getVoiceApiV3Status({ txnId: i }), { status_code: l, response: p } = y;
|
|
54227
|
+
if ((/* @__PURE__ */ new Date()).getTime() >= c)
|
|
54228
|
+
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?.({
|
|
54226
54233
|
txn_id: i,
|
|
54227
|
-
response:
|
|
54228
|
-
status_code:
|
|
54234
|
+
response: p,
|
|
54235
|
+
status_code: l,
|
|
54229
54236
|
message: "Partial result received",
|
|
54230
54237
|
poll_status: "in-progress"
|
|
54231
|
-
}),
|
|
54232
|
-
if (
|
|
54233
|
-
|
|
54234
|
-
|
|
54235
|
-
|
|
54236
|
-
errorMessage: l?.error?.msg || "We encountered a backend error while fetching results. Please try again."
|
|
54237
|
-
};
|
|
54238
|
+
}), l >= 400) {
|
|
54239
|
+
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");
|
|
54242
|
+
}
|
|
54238
54243
|
} else
|
|
54239
|
-
|
|
54240
|
-
return
|
|
54241
|
-
}
|
|
54242
|
-
return
|
|
54243
|
-
|
|
54244
|
-
|
|
54245
|
-
|
|
54246
|
-
|
|
54247
|
-
|
|
54248
|
-
|
|
54249
|
-
|
|
54250
|
-
|
|
54251
|
-
|
|
54252
|
-
|
|
54253
|
-
|
|
54254
|
-
|
|
54255
|
-
// -1: non-https status_code to distinguish backend's 500 status_code
|
|
54256
|
-
errorMessage: `Something went wrong from inside catch block. ${m}`
|
|
54257
|
-
};
|
|
54244
|
+
u = 0;
|
|
54245
|
+
return m();
|
|
54246
|
+
}
|
|
54247
|
+
return n(
|
|
54248
|
+
l,
|
|
54249
|
+
p,
|
|
54250
|
+
"Template results generated successfully. Polling for this session is complete.",
|
|
54251
|
+
"success"
|
|
54252
|
+
);
|
|
54253
|
+
} catch (y) {
|
|
54254
|
+
return n(
|
|
54255
|
+
-1,
|
|
54256
|
+
null,
|
|
54257
|
+
`Something went wrong from inside catch block. ${y}`,
|
|
54258
|
+
"failed"
|
|
54259
|
+
);
|
|
54258
54260
|
}
|
|
54259
54261
|
};
|
|
54260
|
-
return
|
|
54261
|
-
} catch (
|
|
54262
|
-
return
|
|
54263
|
-
|
|
54264
|
-
|
|
54265
|
-
|
|
54266
|
-
|
|
54267
|
-
|
|
54268
|
-
};
|
|
54262
|
+
return m();
|
|
54263
|
+
} catch (r) {
|
|
54264
|
+
return r instanceof Error && r.name === "AbortError" ? n(-1, null, "Request was aborted due to timeout.", "timeout") : n(
|
|
54265
|
+
-1,
|
|
54266
|
+
null,
|
|
54267
|
+
`Something went wrong from outer catch block, ${r}`,
|
|
54268
|
+
"failed"
|
|
54269
|
+
);
|
|
54269
54270
|
}
|
|
54270
54271
|
};
|
|
54271
54272
|
function getSharedWorkerUrl() {
|