@nsshunt/stsfhirclient 1.0.20 → 1.0.21
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/stsfhirclient.mjs
CHANGED
|
@@ -3691,6 +3691,13 @@ _requestCount = /* @__PURE__ */ new WeakMap();
|
|
|
3691
3691
|
_SetupResetInterval = /* @__PURE__ */ new WeakMap();
|
|
3692
3692
|
_GetAgentOptions = /* @__PURE__ */ new WeakMap();
|
|
3693
3693
|
class STSAxiosConfig {
|
|
3694
|
+
/*
|
|
3695
|
+
headers = {
|
|
3696
|
+
'Content-Type': 'application/json',
|
|
3697
|
+
'Authorization': 'Bearer ' + accesss_token,
|
|
3698
|
+
'x-sts_user_id': DUMMY_USER
|
|
3699
|
+
}
|
|
3700
|
+
*/
|
|
3694
3701
|
constructor(url, method, headers, timeout) {
|
|
3695
3702
|
__privateAdd2(this, _url);
|
|
3696
3703
|
__privateAdd2(this, _method);
|
|
@@ -3714,6 +3721,16 @@ class STSAxiosConfig {
|
|
|
3714
3721
|
return this;
|
|
3715
3722
|
}
|
|
3716
3723
|
// 'Content-Type': 'application/json'
|
|
3724
|
+
withAuthHeaders(accesssToken, stsUserId) {
|
|
3725
|
+
__privateSet2(this, _headers, {
|
|
3726
|
+
"Content-Type": "application/json",
|
|
3727
|
+
"Authorization": "Bearer " + accesssToken
|
|
3728
|
+
});
|
|
3729
|
+
if (stsUserId) {
|
|
3730
|
+
__privateGet2(this, _headers)["x-sts_user_id"] = stsUserId;
|
|
3731
|
+
}
|
|
3732
|
+
return this;
|
|
3733
|
+
}
|
|
3717
3734
|
withHeaders(headers) {
|
|
3718
3735
|
__privateSet2(this, _headers, headers);
|
|
3719
3736
|
return this;
|
|
@@ -3908,11 +3925,7 @@ class FhirClient {
|
|
|
3908
3925
|
}
|
|
3909
3926
|
}
|
|
3910
3927
|
const accessToken = await __privateGet(this, _options2).GetAccessToken();
|
|
3911
|
-
const requestConfig = new STSAxiosConfig(url, httpVerb).
|
|
3912
|
-
"Content-Type": "application/json",
|
|
3913
|
-
"Authorization": `Bearer ${accessToken}`,
|
|
3914
|
-
"x-sts_user_id": __privateGet(this, _DUMMY_USER)
|
|
3915
|
-
}).withData(filters ? filters : domainResource ? domainResource : void 0);
|
|
3928
|
+
const requestConfig = new STSAxiosConfig(url, httpVerb).withAuthHeaders(accessToken, __privateGet(this, _DUMMY_USER)).withData(filters ? filters : domainResource ? domainResource : void 0);
|
|
3916
3929
|
if (isNode && __privateGet(this, _agentManager2)) {
|
|
3917
3930
|
requestConfig.withAgentManager(__privateGet(this, _agentManager2));
|
|
3918
3931
|
}
|
|
@@ -4012,9 +4025,7 @@ class FhirClient {
|
|
|
4012
4025
|
__publicField(this, "GetLatency", async () => {
|
|
4013
4026
|
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/latency`;
|
|
4014
4027
|
try {
|
|
4015
|
-
const requestConfig = new STSAxiosConfig(url, "get"
|
|
4016
|
-
"Content-Type": "application/json"
|
|
4017
|
-
});
|
|
4028
|
+
const requestConfig = new STSAxiosConfig(url, "get").withDefaultHeaders();
|
|
4018
4029
|
if (isNode && __privateGet(this, _agentManager2)) {
|
|
4019
4030
|
requestConfig.withAgentManager(__privateGet(this, _agentManager2));
|
|
4020
4031
|
}
|