@eka-care/ekascribe-ts-sdk 2.0.41 → 2.0.43
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 +62 -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,76 @@ 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
|
-
|
|
54222
|
+
const c = (/* @__PURE__ */ new Date()).getTime() + a;
|
|
54223
|
+
let u = 0;
|
|
54224
|
+
s?.({
|
|
54225
|
+
txn_id: i,
|
|
54226
|
+
response: null,
|
|
54227
|
+
status_code: 202,
|
|
54228
|
+
message: "Polling for session output summary started",
|
|
54229
|
+
poll_status: "in-progress"
|
|
54230
|
+
});
|
|
54231
|
+
const m = async () => {
|
|
54211
54232
|
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?.({
|
|
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?.({
|
|
54226
54240
|
txn_id: i,
|
|
54227
|
-
response:
|
|
54228
|
-
status_code:
|
|
54241
|
+
response: p,
|
|
54242
|
+
status_code: l,
|
|
54229
54243
|
message: "Partial result received",
|
|
54230
54244
|
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
|
-
};
|
|
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");
|
|
54249
|
+
}
|
|
54238
54250
|
} 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
|
-
};
|
|
54251
|
+
u = 0;
|
|
54252
|
+
return m();
|
|
54253
|
+
}
|
|
54254
|
+
return n(
|
|
54255
|
+
l,
|
|
54256
|
+
p,
|
|
54257
|
+
"Template results generated successfully. Polling for this session is complete.",
|
|
54258
|
+
"success"
|
|
54259
|
+
);
|
|
54260
|
+
} catch (y) {
|
|
54261
|
+
return n(
|
|
54262
|
+
-1,
|
|
54263
|
+
null,
|
|
54264
|
+
`Something went wrong from inside catch block. ${y}`,
|
|
54265
|
+
"failed"
|
|
54266
|
+
);
|
|
54258
54267
|
}
|
|
54259
54268
|
};
|
|
54260
|
-
return
|
|
54261
|
-
} catch (
|
|
54262
|
-
return
|
|
54263
|
-
|
|
54264
|
-
|
|
54265
|
-
|
|
54266
|
-
|
|
54267
|
-
|
|
54268
|
-
};
|
|
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(
|
|
54272
|
+
-1,
|
|
54273
|
+
null,
|
|
54274
|
+
`Something went wrong from outer catch block, ${r}`,
|
|
54275
|
+
"failed"
|
|
54276
|
+
);
|
|
54269
54277
|
}
|
|
54270
54278
|
};
|
|
54271
54279
|
function getSharedWorkerUrl() {
|