@nsshunt/stsfhirclient 1.0.20 → 1.0.22

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.
@@ -3708,20 +3708,39 @@ class STSAxiosConfig {
3708
3708
  __privateSet2(this, _timeout, timeout);
3709
3709
  }
3710
3710
  }
3711
+ withCookies(cookies) {
3712
+ if (!__privateGet2(this, _headers)) {
3713
+ __privateSet2(this, _headers, {});
3714
+ }
3715
+ __privateGet2(this, _headers)["Cookie"] = cookies.join("; ");
3716
+ return this;
3717
+ }
3711
3718
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3712
3719
  withData(data) {
3713
3720
  __privateSet2(this, _data, data);
3714
3721
  return this;
3715
3722
  }
3716
3723
  // 'Content-Type': 'application/json'
3724
+ withAuthHeaders(accesssToken, stsUserId) {
3725
+ if (!__privateGet2(this, _headers)) {
3726
+ __privateSet2(this, _headers, {});
3727
+ }
3728
+ __privateGet2(this, _headers)["Content-Type"] = "application/json";
3729
+ __privateGet2(this, _headers)["Authorization"] = "Bearer " + accesssToken;
3730
+ if (stsUserId) {
3731
+ __privateGet2(this, _headers)["x-sts_user_id"] = stsUserId;
3732
+ }
3733
+ return this;
3734
+ }
3717
3735
  withHeaders(headers) {
3718
3736
  __privateSet2(this, _headers, headers);
3719
3737
  return this;
3720
3738
  }
3721
3739
  withDefaultHeaders() {
3722
- __privateSet2(this, _headers, {
3723
- "Content-Type": "application/json"
3724
- });
3740
+ if (!__privateGet2(this, _headers)) {
3741
+ __privateSet2(this, _headers, {});
3742
+ }
3743
+ __privateGet2(this, _headers)["Content-Type"] = "application/json";
3725
3744
  return this;
3726
3745
  }
3727
3746
  withCredentials() {
@@ -3908,11 +3927,7 @@ class FhirClient {
3908
3927
  }
3909
3928
  }
3910
3929
  const accessToken = await __privateGet(this, _options2).GetAccessToken();
3911
- const requestConfig = new STSAxiosConfig(url, httpVerb).withHeaders({
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);
3930
+ const requestConfig = new STSAxiosConfig(url, httpVerb).withAuthHeaders(accessToken, __privateGet(this, _DUMMY_USER)).withData(filters ? filters : domainResource ? domainResource : void 0);
3916
3931
  if (isNode && __privateGet(this, _agentManager2)) {
3917
3932
  requestConfig.withAgentManager(__privateGet(this, _agentManager2));
3918
3933
  }
@@ -4012,9 +4027,7 @@ class FhirClient {
4012
4027
  __publicField(this, "GetLatency", async () => {
4013
4028
  const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/latency`;
4014
4029
  try {
4015
- const requestConfig = new STSAxiosConfig(url, "get", {
4016
- "Content-Type": "application/json"
4017
- });
4030
+ const requestConfig = new STSAxiosConfig(url, "get").withDefaultHeaders();
4018
4031
  if (isNode && __privateGet(this, _agentManager2)) {
4019
4032
  requestConfig.withAgentManager(__privateGet(this, _agentManager2));
4020
4033
  }