@eka-care/ekascribe-ts-sdk 3.0.17 → 3.0.18
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 +84 -73
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4734,7 +4734,7 @@ class Mc {
|
|
|
4734
4734
|
});
|
|
4735
4735
|
}
|
|
4736
4736
|
}
|
|
4737
|
-
const
|
|
4737
|
+
const _ = {
|
|
4738
4738
|
AUDIO_ERROR: 1001,
|
|
4739
4739
|
SUCCESS: 200,
|
|
4740
4740
|
TXN_ERROR: 1003,
|
|
@@ -4744,14 +4744,14 @@ const g = {
|
|
|
4744
4744
|
FORBIDDEN: 403
|
|
4745
4745
|
};
|
|
4746
4746
|
var Pc = /* @__PURE__ */ ((e) => (e.NOT_INITIALIZED = "na", e.INIT = "init", e.STOP = "stop", e.COMMIT = "commit", e))(Pc || {}), Uc = /* @__PURE__ */ ((e) => (e.START = "start", e.PAUSE = "pause", e.RESUME = "resume", e.STOP = "stop", e))(Uc || {}), Lc = /* @__PURE__ */ ((e) => (e.EKA_EMR_TEMPLATE = "eka_emr_template", e.CLINICAL_NOTE_TEMPLATE = "clinical_notes_template", e.TRANSCRIPT_TEMPLATE = "transcript_template", e.EKA_EMR_TO_FHIR_TEMPLATE = "eka_emr_to_fhir_template", e.NIC_TEMPLATE = "nic_template", e))(Lc || {}), Hc = /* @__PURE__ */ ((e) => (e.SUCCESS = "success", e.FAILURE = "failure", e.PARTIAL_COMPLETE = "partial_complete", e.IN_PROGRESS = "in-progress", e))(Hc || {}), y = /* @__PURE__ */ ((e) => (e.MICROPHONE = "microphone", e.TXN_INIT_FAILED = "txn_init_failed", e.TXN_LIMIT_EXCEEDED = "txn_limit_exceeded", e.INTERNAL_SERVER_ERROR = "internal_server_error", e.END_RECORDING_FAILED = "end_recording_failed", e.AUDIO_UPLOAD_FAILED = "audio_upload_failed", e.TXN_COMMIT_FAILED = "txn_commit_failed", e.TXN_STATUS_MISMATCH = "txn_status_mismatch", e.NETWORK_ERROR = "network_error", e.UNKNOWN_ERROR = "unknown_error", e.UNAUTHORIZED = "unauthorized", e.FORBIDDEN = "forbidden", e))(y || {}), Bc = /* @__PURE__ */ ((e) => (e.SUCCESS = "success", e.IN_PROGRESS = "in-progress", e.FAILED = "failed", e.CANCELLED = "cancelled", e))(Bc || {}), br = /* @__PURE__ */ ((e) => (e.AWS_CONFIGURE_STATUS = "aws_configure_status", e.FILE_UPLOAD_STATUS = "file_upload_status", e.TRANSACTION_STATUS = "transaction_status", e.TEMPLATE_OPERATION_STATUS = "template_operation_status", e.AUTHENTICATION_STATUS = "authentication_status", e.NETWORK_STATUS = "network_status", e.STORAGE_STATUS = "storage_status", e))(br || {}), vt = /* @__PURE__ */ ((e) => (e.JSON = "json", e.TRANSCRIPT = "transcript", e.MARKDOWN = "markdown", e))(vt || {}), W = /* @__PURE__ */ ((e) => (e.INTERNET_CONNECTIVITY = "INTERNET_CONNECTIVITY", e.SYSTEM_INFO = "SYSTEM_INFO", e.MICROPHONE = "MICROPHONE", e.SHARED_WORKER = "SHARED_WORKER", e.NETWORK_API = "NETWORK_API", e))(W || {}), b = /* @__PURE__ */ ((e) => (e.SUCCESS = "success", e.ERROR = "error", e.WARNING = "warning", e))(b || {});
|
|
4747
|
-
function
|
|
4747
|
+
function g(e, t) {
|
|
4748
4748
|
return e instanceof F ? e.status === 401 ? {
|
|
4749
4749
|
error_code: y.UNAUTHORIZED,
|
|
4750
|
-
status_code:
|
|
4750
|
+
status_code: _.UNAUTHORIZED,
|
|
4751
4751
|
message: "Authentication failed. Token may be expired."
|
|
4752
4752
|
} : e.status === 403 ? {
|
|
4753
4753
|
error_code: y.FORBIDDEN,
|
|
4754
|
-
status_code:
|
|
4754
|
+
status_code: _.FORBIDDEN,
|
|
4755
4755
|
message: "Access forbidden."
|
|
4756
4756
|
} : e.status === 408 ? {
|
|
4757
4757
|
error_code: y.NETWORK_ERROR,
|
|
@@ -4763,15 +4763,15 @@ function _(e, t) {
|
|
|
4763
4763
|
message: `${t} ${e.message}`
|
|
4764
4764
|
} : e instanceof DOMException && e.name === "AbortError" ? {
|
|
4765
4765
|
error_code: y.NETWORK_ERROR,
|
|
4766
|
-
status_code:
|
|
4766
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
4767
4767
|
message: `${t} Request aborted (timeout).`
|
|
4768
4768
|
} : e instanceof TypeError && (e.message.includes("fetch") || e.message.includes("network")) ? {
|
|
4769
4769
|
error_code: y.NETWORK_ERROR,
|
|
4770
|
-
status_code:
|
|
4770
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
4771
4771
|
message: `${t} Network error.`
|
|
4772
4772
|
} : {
|
|
4773
4773
|
error_code: y.INTERNAL_SERVER_ERROR,
|
|
4774
|
-
status_code:
|
|
4774
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
4775
4775
|
message: `${t} ${e}`
|
|
4776
4776
|
};
|
|
4777
4777
|
}
|
|
@@ -4788,7 +4788,7 @@ class jc {
|
|
|
4788
4788
|
});
|
|
4789
4789
|
return { ...t.data, status_code: t.status };
|
|
4790
4790
|
} catch (t) {
|
|
4791
|
-
return { status_code:
|
|
4791
|
+
return { status_code: g(t, "Failed to fetch templates,").status_code, items: [] };
|
|
4792
4792
|
}
|
|
4793
4793
|
}
|
|
4794
4794
|
async createTemplate({
|
|
@@ -4804,7 +4804,7 @@ class jc {
|
|
|
4804
4804
|
});
|
|
4805
4805
|
return { ...s.data, status_code: s.status };
|
|
4806
4806
|
} catch (s) {
|
|
4807
|
-
const o =
|
|
4807
|
+
const o = g(s, "Failed to create template,");
|
|
4808
4808
|
return {
|
|
4809
4809
|
status_code: o.status_code,
|
|
4810
4810
|
message: o.message
|
|
@@ -4825,7 +4825,7 @@ class jc {
|
|
|
4825
4825
|
});
|
|
4826
4826
|
return { ...o.data, status_code: o.status };
|
|
4827
4827
|
} catch (o) {
|
|
4828
|
-
const i =
|
|
4828
|
+
const i = g(o, "Failed to update template,");
|
|
4829
4829
|
return { status_code: i.status_code, msg: i.message };
|
|
4830
4830
|
}
|
|
4831
4831
|
}
|
|
@@ -4837,7 +4837,7 @@ class jc {
|
|
|
4837
4837
|
});
|
|
4838
4838
|
return { ...n.data, status_code: n.status };
|
|
4839
4839
|
} catch (n) {
|
|
4840
|
-
const r =
|
|
4840
|
+
const r = g(n, "Failed to delete template,");
|
|
4841
4841
|
return { status_code: r.status_code, msg: r.message };
|
|
4842
4842
|
}
|
|
4843
4843
|
}
|
|
@@ -4852,7 +4852,7 @@ class jc {
|
|
|
4852
4852
|
});
|
|
4853
4853
|
return { ...n.data, status_code: n.status };
|
|
4854
4854
|
} catch (n) {
|
|
4855
|
-
const r =
|
|
4855
|
+
const r = g(n, "Failed to AI generate template,");
|
|
4856
4856
|
return {
|
|
4857
4857
|
status_code: r.status_code,
|
|
4858
4858
|
message: r.message
|
|
@@ -4884,7 +4884,7 @@ class jc {
|
|
|
4884
4884
|
});
|
|
4885
4885
|
return { ...o.data, status_code: o.status };
|
|
4886
4886
|
} catch (o) {
|
|
4887
|
-
const i =
|
|
4887
|
+
const i = g(o, "Failed to convert transcription to template,");
|
|
4888
4888
|
return {
|
|
4889
4889
|
status_code: i.status_code,
|
|
4890
4890
|
message: i.message
|
|
@@ -4900,7 +4900,7 @@ class jc {
|
|
|
4900
4900
|
});
|
|
4901
4901
|
return { ...t.data, status_code: t.status };
|
|
4902
4902
|
} catch (t) {
|
|
4903
|
-
return { status_code:
|
|
4903
|
+
return { status_code: g(t, "Failed to fetch template sections,").status_code, items: [] };
|
|
4904
4904
|
}
|
|
4905
4905
|
}
|
|
4906
4906
|
async createTemplateSection({
|
|
@@ -4917,7 +4917,7 @@ class jc {
|
|
|
4917
4917
|
});
|
|
4918
4918
|
return { ...o.data, status_code: o.status };
|
|
4919
4919
|
} catch (o) {
|
|
4920
|
-
const i =
|
|
4920
|
+
const i = g(o, "Failed to create template section,");
|
|
4921
4921
|
return {
|
|
4922
4922
|
status_code: i.status_code,
|
|
4923
4923
|
msg: i.message,
|
|
@@ -4940,7 +4940,7 @@ class jc {
|
|
|
4940
4940
|
});
|
|
4941
4941
|
return { ...i.data, status_code: i.status };
|
|
4942
4942
|
} catch (i) {
|
|
4943
|
-
const a =
|
|
4943
|
+
const a = g(i, "Failed to update template section,");
|
|
4944
4944
|
return {
|
|
4945
4945
|
status_code: a.status_code,
|
|
4946
4946
|
msg: a.message,
|
|
@@ -4957,7 +4957,7 @@ class jc {
|
|
|
4957
4957
|
});
|
|
4958
4958
|
return { ...n.data, status_code: n.status };
|
|
4959
4959
|
} catch (n) {
|
|
4960
|
-
const r =
|
|
4960
|
+
const r = g(n, "Failed to delete template section,");
|
|
4961
4961
|
return {
|
|
4962
4962
|
status_code: r.status_code,
|
|
4963
4963
|
msg: r.message
|
|
@@ -4973,7 +4973,7 @@ class jc {
|
|
|
4973
4973
|
});
|
|
4974
4974
|
return { ...n.data, status_code: n.status };
|
|
4975
4975
|
} catch (n) {
|
|
4976
|
-
return { status_code:
|
|
4976
|
+
return { status_code: g(n, "Failed to fetch document,").status_code };
|
|
4977
4977
|
}
|
|
4978
4978
|
}
|
|
4979
4979
|
async createDocument({
|
|
@@ -4997,7 +4997,7 @@ class jc {
|
|
|
4997
4997
|
});
|
|
4998
4998
|
return { ...i.data, status_code: i.status };
|
|
4999
4999
|
} catch (i) {
|
|
5000
|
-
const a =
|
|
5000
|
+
const a = g(i, "Failed to create document,");
|
|
5001
5001
|
return {
|
|
5002
5002
|
status_code: a.status_code,
|
|
5003
5003
|
message: a.message
|
|
@@ -5025,7 +5025,7 @@ class jc {
|
|
|
5025
5025
|
});
|
|
5026
5026
|
return { ...i.data, status_code: i.status };
|
|
5027
5027
|
} catch (i) {
|
|
5028
|
-
const a =
|
|
5028
|
+
const a = g(i, "Failed to update document,");
|
|
5029
5029
|
return {
|
|
5030
5030
|
status_code: a.status_code,
|
|
5031
5031
|
message: a.message
|
|
@@ -5040,7 +5040,7 @@ class jc {
|
|
|
5040
5040
|
});
|
|
5041
5041
|
return { ...n.data, status_code: n.status };
|
|
5042
5042
|
} catch (n) {
|
|
5043
|
-
const r =
|
|
5043
|
+
const r = g(n, "Failed to delete document,");
|
|
5044
5044
|
return {
|
|
5045
5045
|
status_code: r.status_code,
|
|
5046
5046
|
message: r.message
|
|
@@ -5059,7 +5059,7 @@ class jc {
|
|
|
5059
5059
|
});
|
|
5060
5060
|
return { ...r.data, status_code: r.status };
|
|
5061
5061
|
} catch (r) {
|
|
5062
|
-
const s =
|
|
5062
|
+
const s = g(r, "Failed to publish document,");
|
|
5063
5063
|
return {
|
|
5064
5064
|
status_code: s.status_code,
|
|
5065
5065
|
message: s.message
|
|
@@ -5088,7 +5088,7 @@ class Vc {
|
|
|
5088
5088
|
message: `Past ${t} transactions fetched successfully.`
|
|
5089
5089
|
};
|
|
5090
5090
|
} catch (r) {
|
|
5091
|
-
const s =
|
|
5091
|
+
const s = g(r, "Failed to fetch transactions,");
|
|
5092
5092
|
return { status_code: s.status_code, message: s.message };
|
|
5093
5093
|
}
|
|
5094
5094
|
}
|
|
@@ -5100,7 +5100,7 @@ class Vc {
|
|
|
5100
5100
|
});
|
|
5101
5101
|
return { ...n.data, status_code: n.status };
|
|
5102
5102
|
} catch (n) {
|
|
5103
|
-
const r =
|
|
5103
|
+
const r = g(n, "Failed to delete transaction,");
|
|
5104
5104
|
return { status_code: r.status_code, message: r.message };
|
|
5105
5105
|
}
|
|
5106
5106
|
}
|
|
@@ -5118,7 +5118,7 @@ class Vc {
|
|
|
5118
5118
|
});
|
|
5119
5119
|
return { ...r.data, status_code: r.status };
|
|
5120
5120
|
} catch (r) {
|
|
5121
|
-
const s =
|
|
5121
|
+
const s = g(r, "Failed to fetch session details,");
|
|
5122
5122
|
return {
|
|
5123
5123
|
status_code: s.status_code,
|
|
5124
5124
|
message: s.message
|
|
@@ -5133,7 +5133,7 @@ class Vc {
|
|
|
5133
5133
|
});
|
|
5134
5134
|
return { ...n.data, status_code: n.status };
|
|
5135
5135
|
} catch (n) {
|
|
5136
|
-
const r =
|
|
5136
|
+
const r = g(n, "Failed to fetch suggested medications,");
|
|
5137
5137
|
return {
|
|
5138
5138
|
status_code: r.status_code,
|
|
5139
5139
|
message: r.message
|
|
@@ -5152,7 +5152,7 @@ class Vc {
|
|
|
5152
5152
|
});
|
|
5153
5153
|
return { ...r.data, status_code: r.status };
|
|
5154
5154
|
} catch (r) {
|
|
5155
|
-
const s =
|
|
5155
|
+
const s = g(r, "Failed to add session context,");
|
|
5156
5156
|
return {
|
|
5157
5157
|
status_code: s.status_code,
|
|
5158
5158
|
message: s.message
|
|
@@ -5171,7 +5171,7 @@ class Vc {
|
|
|
5171
5171
|
});
|
|
5172
5172
|
return { ...r.data, status_code: r.status };
|
|
5173
5173
|
} catch (r) {
|
|
5174
|
-
const s =
|
|
5174
|
+
const s = g(r, "Failed to remove session context,");
|
|
5175
5175
|
return {
|
|
5176
5176
|
status_code: s.status_code,
|
|
5177
5177
|
message: s.message
|
|
@@ -5192,7 +5192,7 @@ class Vc {
|
|
|
5192
5192
|
});
|
|
5193
5193
|
return { ...r.data, status_code: r.status };
|
|
5194
5194
|
} catch (r) {
|
|
5195
|
-
const s =
|
|
5195
|
+
const s = g(r, "Failed to update result summary,");
|
|
5196
5196
|
return {
|
|
5197
5197
|
status_code: s.status_code,
|
|
5198
5198
|
message: s.message
|
|
@@ -5208,7 +5208,7 @@ class Vc {
|
|
|
5208
5208
|
});
|
|
5209
5209
|
return { ...t.data, status_code: t.status };
|
|
5210
5210
|
} catch (t) {
|
|
5211
|
-
const n =
|
|
5211
|
+
const n = g(t, "Failed to fetch configurations,");
|
|
5212
5212
|
return { status_code: n.status_code, message: n.message };
|
|
5213
5213
|
}
|
|
5214
5214
|
}
|
|
@@ -5220,7 +5220,7 @@ class Vc {
|
|
|
5220
5220
|
});
|
|
5221
5221
|
return { ...t.data, status_code: t.status };
|
|
5222
5222
|
} catch (t) {
|
|
5223
|
-
const n =
|
|
5223
|
+
const n = g(t, "Failed to fetch configurations,");
|
|
5224
5224
|
return { status_code: n.status_code, message: n.message };
|
|
5225
5225
|
}
|
|
5226
5226
|
}
|
|
@@ -5233,7 +5233,7 @@ class Vc {
|
|
|
5233
5233
|
});
|
|
5234
5234
|
return { ...r.data, status_code: r.status };
|
|
5235
5235
|
} catch (n) {
|
|
5236
|
-
const r =
|
|
5236
|
+
const r = g(n, "Failed to update config,");
|
|
5237
5237
|
return {
|
|
5238
5238
|
status_code: r.status_code,
|
|
5239
5239
|
msg: r.message
|
|
@@ -5282,7 +5282,7 @@ class Vc {
|
|
|
5282
5282
|
status_code: r.status
|
|
5283
5283
|
};
|
|
5284
5284
|
} catch (r) {
|
|
5285
|
-
const s =
|
|
5285
|
+
const s = g(r, "Failed to fetch doctor header/footer,");
|
|
5286
5286
|
return {
|
|
5287
5287
|
data: this.getDefaultHeaderFooterInfo(),
|
|
5288
5288
|
status_code: s.status_code,
|
|
@@ -5317,7 +5317,7 @@ class Vc {
|
|
|
5317
5317
|
status_code: n.status
|
|
5318
5318
|
};
|
|
5319
5319
|
} catch (n) {
|
|
5320
|
-
const r =
|
|
5320
|
+
const r = g(n, "Failed to fetch doctor clinics,");
|
|
5321
5321
|
return { data: null, status_code: r.status_code, message: r.message };
|
|
5322
5322
|
}
|
|
5323
5323
|
}
|
|
@@ -5427,20 +5427,20 @@ class zc {
|
|
|
5427
5427
|
);
|
|
5428
5428
|
return r.success ? (this.storedSession = r.data, this.txnID = r.data.session_id, this.tracker.setTransactionId(this.txnID), this.tracker.captureEvent("Session started", {
|
|
5429
5429
|
txn_id: this.txnID,
|
|
5430
|
-
status_code:
|
|
5430
|
+
status_code: r.httpStatus ?? _.SUCCESS
|
|
5431
5431
|
}), {
|
|
5432
|
-
status_code:
|
|
5432
|
+
status_code: r.httpStatus ?? _.SUCCESS,
|
|
5433
5433
|
message: "Transaction initialized successfully.",
|
|
5434
5434
|
txn_id: r.data.session_id
|
|
5435
5435
|
}) : {
|
|
5436
5436
|
error_code: r.error.code === "rate_limit_exceeded" ? y.TXN_LIMIT_EXCEEDED : y.TXN_INIT_FAILED,
|
|
5437
|
-
status_code: r.error.httpStatus ??
|
|
5437
|
+
status_code: r.error.httpStatus ?? _.INTERNAL_SERVER_ERROR,
|
|
5438
5438
|
message: r.error.message || "Transaction initialization failed."
|
|
5439
5439
|
};
|
|
5440
5440
|
} catch (n) {
|
|
5441
5441
|
return {
|
|
5442
5442
|
error_code: y.TXN_INIT_FAILED,
|
|
5443
|
-
status_code:
|
|
5443
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
5444
5444
|
message: `Failed to initialize transaction. ${n}`
|
|
5445
5445
|
};
|
|
5446
5446
|
}
|
|
@@ -5451,7 +5451,7 @@ class zc {
|
|
|
5451
5451
|
if (!this.storedSession)
|
|
5452
5452
|
return {
|
|
5453
5453
|
error_code: y.TXN_STATUS_MISMATCH,
|
|
5454
|
-
status_code:
|
|
5454
|
+
status_code: _.TXN_ERROR,
|
|
5455
5455
|
message: "Transaction not initialized. Call initTransaction() first."
|
|
5456
5456
|
};
|
|
5457
5457
|
const n = await this.allianceClient.startRecordingWithSession(
|
|
@@ -5462,18 +5462,18 @@ class zc {
|
|
|
5462
5462
|
}
|
|
5463
5463
|
);
|
|
5464
5464
|
return n.success ? {
|
|
5465
|
-
status_code:
|
|
5465
|
+
status_code: n.httpStatus ?? _.SUCCESS,
|
|
5466
5466
|
message: "Recording started successfully.",
|
|
5467
5467
|
txn_id: this.txnID
|
|
5468
5468
|
} : {
|
|
5469
5469
|
error_code: y.MICROPHONE,
|
|
5470
|
-
status_code: n.error.httpStatus ??
|
|
5470
|
+
status_code: n.error.httpStatus ?? _.INTERNAL_SERVER_ERROR,
|
|
5471
5471
|
message: n.error.message || "Failed to start recording."
|
|
5472
5472
|
};
|
|
5473
5473
|
} catch (n) {
|
|
5474
5474
|
return {
|
|
5475
5475
|
error_code: y.INTERNAL_SERVER_ERROR,
|
|
5476
|
-
status_code:
|
|
5476
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
5477
5477
|
message: `Failed to start recording. ${n}`
|
|
5478
5478
|
};
|
|
5479
5479
|
}
|
|
@@ -5495,18 +5495,18 @@ class zc {
|
|
|
5495
5495
|
}
|
|
5496
5496
|
);
|
|
5497
5497
|
return r.success ? (this.storedSession = n, this.txnID = t.txn_id, this.tracker.setTransactionId(this.txnID), {
|
|
5498
|
-
status_code:
|
|
5498
|
+
status_code: r.httpStatus ?? _.SUCCESS,
|
|
5499
5499
|
message: "Recording started for existing session.",
|
|
5500
5500
|
txn_id: this.txnID
|
|
5501
5501
|
}) : {
|
|
5502
5502
|
error_code: y.MICROPHONE,
|
|
5503
|
-
status_code: r.error.httpStatus ??
|
|
5503
|
+
status_code: r.error.httpStatus ?? _.INTERNAL_SERVER_ERROR,
|
|
5504
5504
|
message: r.error.message || "Failed to start recording for existing session."
|
|
5505
5505
|
};
|
|
5506
5506
|
} catch (n) {
|
|
5507
5507
|
return {
|
|
5508
5508
|
error_code: y.INTERNAL_SERVER_ERROR,
|
|
5509
|
-
status_code:
|
|
5509
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
5510
5510
|
message: `Failed to start recording for existing session. ${n}`
|
|
5511
5511
|
};
|
|
5512
5512
|
}
|
|
@@ -5514,14 +5514,14 @@ class zc {
|
|
|
5514
5514
|
pauseRecording() {
|
|
5515
5515
|
try {
|
|
5516
5516
|
return this.allianceClient.pauseRecording(), {
|
|
5517
|
-
status_code:
|
|
5517
|
+
status_code: _.SUCCESS,
|
|
5518
5518
|
message: "Recording paused.",
|
|
5519
5519
|
is_paused: !0
|
|
5520
5520
|
};
|
|
5521
5521
|
} catch (t) {
|
|
5522
5522
|
return {
|
|
5523
5523
|
error_code: y.INTERNAL_SERVER_ERROR,
|
|
5524
|
-
status_code:
|
|
5524
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
5525
5525
|
message: `Failed to pause recording. ${t}`
|
|
5526
5526
|
};
|
|
5527
5527
|
}
|
|
@@ -5529,14 +5529,14 @@ class zc {
|
|
|
5529
5529
|
resumeRecording() {
|
|
5530
5530
|
try {
|
|
5531
5531
|
return this.allianceClient.resumeRecording(), {
|
|
5532
|
-
status_code:
|
|
5532
|
+
status_code: _.SUCCESS,
|
|
5533
5533
|
message: "Recording resumed.",
|
|
5534
5534
|
is_paused: !1
|
|
5535
5535
|
};
|
|
5536
5536
|
} catch (t) {
|
|
5537
5537
|
return {
|
|
5538
5538
|
error_code: y.INTERNAL_SERVER_ERROR,
|
|
5539
|
-
status_code:
|
|
5539
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
5540
5540
|
message: `Failed to resume recording. ${t}`
|
|
5541
5541
|
};
|
|
5542
5542
|
}
|
|
@@ -5550,7 +5550,7 @@ class zc {
|
|
|
5550
5550
|
total_files: t.data.totalFiles,
|
|
5551
5551
|
failed_files: t.data.failedUploads.length
|
|
5552
5552
|
}), this.storedSession = null, {
|
|
5553
|
-
status_code:
|
|
5553
|
+
status_code: t.httpStatus ?? _.SUCCESS,
|
|
5554
5554
|
message: "Recording ended successfully.",
|
|
5555
5555
|
failed_files: t.data.failedUploads,
|
|
5556
5556
|
total_audio_files: t.data.endSessionResponse?.audio_files
|
|
@@ -5559,43 +5559,50 @@ class zc {
|
|
|
5559
5559
|
error: t.error.message
|
|
5560
5560
|
}), {
|
|
5561
5561
|
error_code: y.END_RECORDING_FAILED,
|
|
5562
|
-
status_code: t.error.httpStatus ??
|
|
5562
|
+
status_code: t.error.httpStatus ?? _.INTERNAL_SERVER_ERROR,
|
|
5563
5563
|
message: t.error.message || "Failed to end recording."
|
|
5564
5564
|
});
|
|
5565
5565
|
} catch (t) {
|
|
5566
5566
|
return {
|
|
5567
5567
|
error_code: y.INTERNAL_SERVER_ERROR,
|
|
5568
|
-
status_code:
|
|
5568
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
5569
5569
|
message: `Failed to end recording. ${t}`
|
|
5570
5570
|
};
|
|
5571
5571
|
}
|
|
5572
5572
|
}
|
|
5573
5573
|
async getSessionStatus(t, n) {
|
|
5574
5574
|
const r = t || this.txnID;
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5575
|
+
if (!r)
|
|
5576
|
+
return {
|
|
5577
|
+
success: !1,
|
|
5578
|
+
status_code: _.TXN_ERROR,
|
|
5579
|
+
error: new Ne(
|
|
5580
|
+
"No session ID available. Call initTransaction() first or pass a sessionId.",
|
|
5581
|
+
y.TXN_STATUS_MISMATCH
|
|
5582
|
+
)
|
|
5583
|
+
};
|
|
5584
|
+
const s = await this.allianceClient.getSessionStatus(r, n);
|
|
5585
|
+
return {
|
|
5586
|
+
...s,
|
|
5587
|
+
status_code: s.success ? s.httpStatus ?? _.SUCCESS : s.error.httpStatus ?? _.INTERNAL_SERVER_ERROR
|
|
5581
5588
|
};
|
|
5582
5589
|
}
|
|
5583
5590
|
async retryUploadRecording() {
|
|
5584
5591
|
try {
|
|
5585
5592
|
const t = await this.allianceClient.retryFailedUploads();
|
|
5586
5593
|
return t.success ? {
|
|
5587
|
-
status_code:
|
|
5594
|
+
status_code: t.httpStatus ?? _.SUCCESS,
|
|
5588
5595
|
message: `Retried ${t.data.retried} files. ${t.data.succeeded} succeeded.`,
|
|
5589
5596
|
failed_files: t.data.stillFailed
|
|
5590
5597
|
} : {
|
|
5591
5598
|
error_code: y.AUDIO_UPLOAD_FAILED,
|
|
5592
|
-
status_code: t.error.httpStatus ??
|
|
5599
|
+
status_code: t.error.httpStatus ?? _.INTERNAL_SERVER_ERROR,
|
|
5593
5600
|
message: t.error.message || "Retry upload failed."
|
|
5594
5601
|
};
|
|
5595
5602
|
} catch (t) {
|
|
5596
5603
|
return {
|
|
5597
5604
|
error_code: y.INTERNAL_SERVER_ERROR,
|
|
5598
|
-
status_code:
|
|
5605
|
+
status_code: _.INTERNAL_SERVER_ERROR,
|
|
5599
5606
|
message: `Failed to retry upload. ${t}`
|
|
5600
5607
|
};
|
|
5601
5608
|
}
|
|
@@ -5605,6 +5612,7 @@ class zc {
|
|
|
5605
5612
|
if (!n)
|
|
5606
5613
|
return {
|
|
5607
5614
|
success: !1,
|
|
5615
|
+
status_code: _.TXN_ERROR,
|
|
5608
5616
|
error: new Ne(
|
|
5609
5617
|
"No session ID available. Call initTransaction() first or pass a sessionId.",
|
|
5610
5618
|
y.TXN_STATUS_MISMATCH
|
|
@@ -5616,7 +5624,10 @@ class zc {
|
|
|
5616
5624
|
status: "info",
|
|
5617
5625
|
message: `Session cancelled: ${r.success ? "success" : r.error.message}`,
|
|
5618
5626
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
5619
|
-
}),
|
|
5627
|
+
}), {
|
|
5628
|
+
...r,
|
|
5629
|
+
status_code: r.success ? r.httpStatus ?? _.SUCCESS : r.error.httpStatus ?? _.INTERNAL_SERVER_ERROR
|
|
5630
|
+
};
|
|
5620
5631
|
}
|
|
5621
5632
|
async processPreRecordedAudio({
|
|
5622
5633
|
uploadUrl: t,
|
|
@@ -5634,11 +5645,11 @@ class zc {
|
|
|
5634
5645
|
status_code: s.status,
|
|
5635
5646
|
message: `Audio upload failed with status: ${s.status}`
|
|
5636
5647
|
} : {
|
|
5637
|
-
status_code:
|
|
5648
|
+
status_code: _.SUCCESS,
|
|
5638
5649
|
message: "Audio file uploaded successfully."
|
|
5639
5650
|
};
|
|
5640
5651
|
} catch (r) {
|
|
5641
|
-
const s =
|
|
5652
|
+
const s = g(r, "Audio upload failed:");
|
|
5642
5653
|
return {
|
|
5643
5654
|
error_code: s.error_code,
|
|
5644
5655
|
status_code: s.status_code,
|
|
@@ -5652,7 +5663,7 @@ class zc {
|
|
|
5652
5663
|
if (!this.txnID)
|
|
5653
5664
|
return {
|
|
5654
5665
|
error_code: y.TXN_STATUS_MISMATCH,
|
|
5655
|
-
status_code:
|
|
5666
|
+
status_code: _.TXN_ERROR,
|
|
5656
5667
|
message: "Transaction not initialized."
|
|
5657
5668
|
};
|
|
5658
5669
|
const t = await this.transport.request({
|
|
@@ -5665,11 +5676,11 @@ class zc {
|
|
|
5665
5676
|
status_code: t.status,
|
|
5666
5677
|
message: t.data.message || "Transaction commit failed."
|
|
5667
5678
|
} : {
|
|
5668
|
-
status_code:
|
|
5679
|
+
status_code: _.SUCCESS,
|
|
5669
5680
|
message: t.data.message || "Transaction committed successfully."
|
|
5670
5681
|
};
|
|
5671
5682
|
} catch (t) {
|
|
5672
|
-
const n =
|
|
5683
|
+
const n = g(t, "Failed to commit transaction,");
|
|
5673
5684
|
return {
|
|
5674
5685
|
error_code: n.error_code,
|
|
5675
5686
|
status_code: n.status_code,
|
|
@@ -5683,7 +5694,7 @@ class zc {
|
|
|
5683
5694
|
if (!this.txnID)
|
|
5684
5695
|
return {
|
|
5685
5696
|
error_code: y.TXN_STATUS_MISMATCH,
|
|
5686
|
-
status_code:
|
|
5697
|
+
status_code: _.TXN_ERROR,
|
|
5687
5698
|
message: "Transaction not initialized."
|
|
5688
5699
|
};
|
|
5689
5700
|
const t = await this.transport.request({
|
|
@@ -5696,7 +5707,7 @@ class zc {
|
|
|
5696
5707
|
message: t.data.message || "Transaction stopped."
|
|
5697
5708
|
};
|
|
5698
5709
|
} catch (t) {
|
|
5699
|
-
const n =
|
|
5710
|
+
const n = g(t, "Failed to stop transaction,");
|
|
5700
5711
|
return {
|
|
5701
5712
|
error_code: n.error_code,
|
|
5702
5713
|
status_code: n.status_code,
|
|
@@ -5750,7 +5761,7 @@ class Gc {
|
|
|
5750
5761
|
try {
|
|
5751
5762
|
return await this.fetchV3Status(t);
|
|
5752
5763
|
} catch (n) {
|
|
5753
|
-
const r =
|
|
5764
|
+
const r = g(n, "Failed to fetch output templates,");
|
|
5754
5765
|
return { status_code: r.status_code, message: r.message };
|
|
5755
5766
|
}
|
|
5756
5767
|
}
|
|
@@ -5758,7 +5769,7 @@ class Gc {
|
|
|
5758
5769
|
try {
|
|
5759
5770
|
return await this.fetchV3Status(t, "transcript=true", 15e3);
|
|
5760
5771
|
} catch (n) {
|
|
5761
|
-
const r =
|
|
5772
|
+
const r = g(n, "Failed to fetch output transcription,");
|
|
5762
5773
|
return { status_code: r.status_code, message: r.message };
|
|
5763
5774
|
}
|
|
5764
5775
|
}
|
|
@@ -5771,7 +5782,7 @@ class Gc {
|
|
|
5771
5782
|
});
|
|
5772
5783
|
return r.status >= 400 ? { success: !1, error: r.data?.error?.code ?? y.UNKNOWN_ERROR } : { success: !0, data: r.data };
|
|
5773
5784
|
} catch (r) {
|
|
5774
|
-
return { success: !1, error:
|
|
5785
|
+
return { success: !1, error: g(r, "Failed to fetch chunk transcript,").error_code };
|
|
5775
5786
|
}
|
|
5776
5787
|
}
|
|
5777
5788
|
async pollSessionOutput(t) {
|
|
@@ -5864,7 +5875,7 @@ class Gc {
|
|
|
5864
5875
|
status_code: o.status
|
|
5865
5876
|
};
|
|
5866
5877
|
} catch (s) {
|
|
5867
|
-
const o =
|
|
5878
|
+
const o = g(s, "Failed to fetch status,");
|
|
5868
5879
|
return { status_code: o.status_code, message: o.message };
|
|
5869
5880
|
}
|
|
5870
5881
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eka-care/ekascribe-ts-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.18",
|
|
4
4
|
"description": "EkaScribe TypeScript SDK - Modern ES2020 build",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"README.md"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"med-scribe-alliance-ts-sdk": "2.0.
|
|
40
|
+
"med-scribe-alliance-ts-sdk": "2.0.20"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"vite-bundle-analyzer": "^1.3.6"
|