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