@nsshunt/stsutils 1.19.84 → 1.19.89

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.cjs CHANGED
@@ -1683,6 +1683,11 @@ class STSAxiosConfig {
1683
1683
  this.#timeout = timeout;
1684
1684
  }
1685
1685
  }
1686
+ /**
1687
+ *
1688
+ * @param cookies this.#headers['Cookie'] = cookies.join('; ')
1689
+ * @returns
1690
+ */
1686
1691
  withCookies(cookies) {
1687
1692
  if (!this.#headers) {
1688
1693
  this.#headers = {};
@@ -1690,12 +1695,23 @@ class STSAxiosConfig {
1690
1695
  this.#headers["Cookie"] = cookies.join("; ");
1691
1696
  return this;
1692
1697
  }
1698
+ /**
1699
+ *
1700
+ * @param data Add data to the body
1701
+ * @returns
1702
+ */
1693
1703
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1694
1704
  withData(data) {
1695
1705
  this.#data = data;
1696
1706
  return this;
1697
1707
  }
1698
1708
  // 'Content-Type': 'application/json'
1709
+ /**
1710
+ *
1711
+ * @param accesssToken
1712
+ * @param stsUserId
1713
+ * @returns this.#headers['Authorization'] = 'Bearer ' + accesssToken; and this.#headers['x-sts_user_id'] = stsUserId;
1714
+ */
1699
1715
  withAuthHeaders(accesssToken, stsUserId) {
1700
1716
  if (!this.#headers) {
1701
1717
  this.#headers = {};
@@ -1706,6 +1722,11 @@ class STSAxiosConfig {
1706
1722
  }
1707
1723
  return this;
1708
1724
  }
1725
+ /**
1726
+ *
1727
+ * @param headers Add headers to the existing header
1728
+ * @returns
1729
+ */
1709
1730
  withHeaders(headers) {
1710
1731
  this.#headers = {
1711
1732
  ...this.#headers ?? {},
@@ -1713,6 +1734,10 @@ class STSAxiosConfig {
1713
1734
  };
1714
1735
  return this;
1715
1736
  }
1737
+ /**
1738
+ *
1739
+ * @returns this.#headers['Content-Type'] = 'application/fhir+json';
1740
+ */
1716
1741
  withApplicationFhirAndJsonContentTypeHeaders() {
1717
1742
  if (!this.#headers) {
1718
1743
  this.#headers = {};
@@ -1720,6 +1745,10 @@ class STSAxiosConfig {
1720
1745
  this.#headers["Content-Type"] = "application/fhir+json";
1721
1746
  return this;
1722
1747
  }
1748
+ /**
1749
+ *
1750
+ * @returns this.#headers['Content-Type'] = 'application/merge-patch+json';
1751
+ */
1723
1752
  withApplicationMergePatchAndJsonContentTypeHeaders() {
1724
1753
  if (!this.#headers) {
1725
1754
  this.#headers = {};
@@ -1727,6 +1756,10 @@ class STSAxiosConfig {
1727
1756
  this.#headers["Content-Type"] = "application/merge-patch+json";
1728
1757
  return this;
1729
1758
  }
1759
+ /**
1760
+ *
1761
+ * @returns this.#headers['Content-Type'] = 'application/json-patch+json';
1762
+ */
1730
1763
  withApplicationJsonPatchAndJsonContentTypeHeaders() {
1731
1764
  if (!this.#headers) {
1732
1765
  this.#headers = {};
@@ -1734,6 +1767,10 @@ class STSAxiosConfig {
1734
1767
  this.#headers["Content-Type"] = "application/json-patch+json";
1735
1768
  return this;
1736
1769
  }
1770
+ /**
1771
+ *
1772
+ * @returns this.#headers['Content-Type'] = 'application/json';
1773
+ */
1737
1774
  withApplicationJsonContentTypeHeaders() {
1738
1775
  if (!this.#headers) {
1739
1776
  this.#headers = {};
@@ -1741,6 +1778,10 @@ class STSAxiosConfig {
1741
1778
  this.#headers["Content-Type"] = "application/json";
1742
1779
  return this;
1743
1780
  }
1781
+ /**
1782
+ *
1783
+ * @returns this.#headers['Content-Type'] = 'application/json';
1784
+ */
1744
1785
  withDefaultHeaders() {
1745
1786
  if (!this.#headers) {
1746
1787
  this.#headers = {};
@@ -1748,18 +1789,35 @@ class STSAxiosConfig {
1748
1789
  this.#headers["Content-Type"] = "application/json";
1749
1790
  return this;
1750
1791
  }
1792
+ /**
1793
+ *
1794
+ * @returns
1795
+ */
1751
1796
  withCredentials() {
1752
1797
  this.#withCredentials = true;
1753
1798
  return this;
1754
1799
  }
1800
+ /**
1801
+ *
1802
+ * @param timeout Add a connection timeout
1803
+ * @returns
1804
+ */
1755
1805
  withTimeout(timeout) {
1756
1806
  this.#timeout = timeout;
1757
1807
  return this;
1758
1808
  }
1809
+ /**
1810
+ *
1811
+ * @param agentManager Add the agent manager for each rest call. Only for nodejs not browser.
1812
+ * @returns
1813
+ */
1759
1814
  withAgentManager(agentManager) {
1760
1815
  this.#agentManager = agentManager;
1761
1816
  return this;
1762
1817
  }
1818
+ /**
1819
+ * @returns Returns axios config object
1820
+ */
1763
1821
  get config() {
1764
1822
  const retVal = {
1765
1823
  url: this.#url,
@@ -1787,13 +1845,14 @@ class STSAxiosConfig {
1787
1845
  return retVal;
1788
1846
  }
1789
1847
  }
1848
+ function createAgentManager(agentManagerOptions) {
1849
+ return new AgentManager(agentManagerOptions);
1850
+ }
1790
1851
  class AgentManager {
1791
1852
  #options;
1792
1853
  #agentResetInterval = null;
1793
1854
  #requestCount = 0;
1794
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1795
1855
  #httpAgent = void 0;
1796
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1797
1856
  #httpsAgent = void 0;
1798
1857
  constructor(agentManagerOptions) {
1799
1858
  this.#options = agentManagerOptions;
@@ -1804,7 +1863,7 @@ class AgentManager {
1804
1863
  get agentResetInterval() {
1805
1864
  return this.#options.agentResetInterval;
1806
1865
  }
1807
- set agentResetInterval(val) {
1866
+ UpdateAgentResetInterval(val) {
1808
1867
  if (this.#agentResetInterval) {
1809
1868
  clearTimeout(this.#agentResetInterval);
1810
1869
  }
@@ -1814,7 +1873,7 @@ class AgentManager {
1814
1873
  get agentResetCount() {
1815
1874
  return this.#options.agentResetCount;
1816
1875
  }
1817
- set agentResetCount(val) {
1876
+ UpdateAgentResetCount(val) {
1818
1877
  this.#options.agentResetCount = val;
1819
1878
  }
1820
1879
  #SetupResetInterval = () => {
@@ -1900,7 +1959,6 @@ class AgentManager {
1900
1959
  }
1901
1960
  }
1902
1961
  exports.AddSchema = AddSchema;
1903
- exports.AgentManager = AgentManager;
1904
1962
  exports.CheckValidChar = CheckValidChar;
1905
1963
  exports.GetErrorPayload = GetErrorPayload;
1906
1964
  exports.JestSleep = JestSleep;
@@ -1914,6 +1972,7 @@ exports.STSOptionsBase = STSOptionsBase;
1914
1972
  exports.Sleep = Sleep;
1915
1973
  exports.Validate = Validate;
1916
1974
  exports.compareParameterTypes = compareParameterTypes;
1975
+ exports.createAgentManager = createAgentManager;
1917
1976
  exports.defaultLogger = defaultLogger;
1918
1977
  exports.edbaction = edbaction;
1919
1978
  exports.emptyLogger = emptyLogger;