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