@nsshunt/stsfhirclient 1.0.33 → 1.0.35

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.
@@ -8,7 +8,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
8
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
- var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _stsfhirapiroot, _LogDebugMessage, _LogErrorMessage, _HandleError, _InvokeResourceAPI, _TestMode, ___InvokeResourceAPI;
11
+ var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _stsfhirapiroot, _LogDebugMessage, _LogErrorMessage, _HandleError, _InvokeResourceAPI, _TestMode, ___InvokeResourceAPI, _BuildQueryString;
12
12
  import axios from "axios";
13
13
  import { Sleep, STSAxiosConfig } from "@nsshunt/stsutils";
14
14
  const byteToHex = [];
@@ -1611,7 +1611,7 @@ class FhirClient {
1611
1611
  }
1612
1612
  return responseCode;
1613
1613
  });
1614
- __privateAdd(this, _InvokeResourceAPI, async (url, httpVerb, domainResource, filters, errorCb) => {
1614
+ __privateAdd(this, _InvokeResourceAPI, async (url, httpVerb, domainResource, filters, searchParams, errorCb) => {
1615
1615
  const id = v4();
1616
1616
  __privateGet(this, _invokeMethods)[id] = {
1617
1617
  id,
@@ -1621,6 +1621,7 @@ class FhirClient {
1621
1621
  httpVerb,
1622
1622
  domainResource,
1623
1623
  filters,
1624
+ searchParams,
1624
1625
  errorCb
1625
1626
  };
1626
1627
  const InvokeAPI = async (id2) => {
@@ -1711,16 +1712,25 @@ class FhirClient {
1711
1712
  });
1712
1713
  __publicField(this, "GetResource", async (resource, id, filters, errorCb) => {
1713
1714
  const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
1714
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, errorCb);
1715
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, null, errorCb);
1715
1716
  if (response) {
1716
1717
  return response.data;
1717
1718
  } else {
1718
1719
  return null;
1719
1720
  }
1720
1721
  });
1721
- __publicField(this, "GetResources", async (resource, filters, errorCb) => {
1722
- const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1723
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, errorCb);
1722
+ __privateAdd(this, _BuildQueryString, (baseUrl, queryParams) => {
1723
+ const url = new URL(baseUrl);
1724
+ const searchParams = new URLSearchParams(queryParams);
1725
+ url.search = searchParams.toString();
1726
+ return url.toString();
1727
+ });
1728
+ __publicField(this, "GetResources", async (resource, filters, searchParams, errorCb) => {
1729
+ let url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1730
+ if (searchParams) {
1731
+ url = __privateGet(this, _BuildQueryString).call(this, url, searchParams);
1732
+ }
1733
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, searchParams, errorCb);
1724
1734
  if (response) {
1725
1735
  return response.data;
1726
1736
  } else {
@@ -1729,7 +1739,7 @@ class FhirClient {
1729
1739
  });
1730
1740
  __publicField(this, "CreateResource", async (resource, domainResource, errorCb) => {
1731
1741
  const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1732
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "post", domainResource, null, errorCb);
1742
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "post", domainResource, null, null, errorCb);
1733
1743
  if (response) {
1734
1744
  if (response.status === StatusCodes.CREATED) {
1735
1745
  return response.data;
@@ -1743,7 +1753,7 @@ class FhirClient {
1743
1753
  });
1744
1754
  __publicField(this, "UpdateResource", async (resource, domainResource, errorCb) => {
1745
1755
  const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
1746
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResource, null, errorCb);
1756
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResource, null, null, errorCb);
1747
1757
  if (response) {
1748
1758
  return response.data;
1749
1759
  } else {
@@ -1752,7 +1762,7 @@ class FhirClient {
1752
1762
  });
1753
1763
  __publicField(this, "UpdateResources", async (resource, domainResources, errorCb) => {
1754
1764
  const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1755
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResources, null, errorCb);
1765
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResources, null, null, errorCb);
1756
1766
  if (response) {
1757
1767
  return response.data;
1758
1768
  } else {
@@ -1761,7 +1771,7 @@ class FhirClient {
1761
1771
  });
1762
1772
  __publicField(this, "PatchResource", async (resource, domainResource, errorCb) => {
1763
1773
  const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
1764
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResource, null, errorCb);
1774
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResource, null, null, errorCb);
1765
1775
  if (response) {
1766
1776
  return response.data;
1767
1777
  } else {
@@ -1770,7 +1780,7 @@ class FhirClient {
1770
1780
  });
1771
1781
  __publicField(this, "PatchResources", async (resource, domainResources, errorCb) => {
1772
1782
  const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1773
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResources, null, errorCb);
1783
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResources, null, null, errorCb);
1774
1784
  if (response) {
1775
1785
  return response.data;
1776
1786
  } else {
@@ -1779,7 +1789,7 @@ class FhirClient {
1779
1789
  });
1780
1790
  __publicField(this, "DeleteResource", async (resource, id, errorCb) => {
1781
1791
  const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
1782
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", null, null, errorCb);
1792
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", null, null, null, errorCb);
1783
1793
  if (response) {
1784
1794
  return response.data;
1785
1795
  } else {
@@ -1788,7 +1798,7 @@ class FhirClient {
1788
1798
  });
1789
1799
  __publicField(this, "DeleteResources", async (resource, domainResources, errorCb) => {
1790
1800
  const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1791
- const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", domainResources, null, errorCb);
1801
+ const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", domainResources, null, null, errorCb);
1792
1802
  if (response) {
1793
1803
  return response.data;
1794
1804
  } else {
@@ -1829,6 +1839,7 @@ _HandleError = new WeakMap();
1829
1839
  _InvokeResourceAPI = new WeakMap();
1830
1840
  _TestMode = new WeakMap();
1831
1841
  ___InvokeResourceAPI = new WeakMap();
1842
+ _BuildQueryString = new WeakMap();
1832
1843
  export {
1833
1844
  FhirClient
1834
1845
  };