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