@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.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,
|