@nsshunt/stsutils 1.19.83 → 1.19.85
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 +58 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +58 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/types/stsAxiosConfig.d.ts +58 -0
- package/types/stsAxiosConfig.d.ts.map +1 -1
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,
|