@nsshunt/stsconfig 1.25.160 → 1.25.162

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.
@@ -13,7 +13,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
13
13
  return __privateGet(obj, member, getter);
14
14
  }
15
15
  });
16
- var _options, _httpAgent, _httpsAgent, _agentResetInterval, _requestCount, _SetupResetInterval, _GetAgentOptions, _url, _method, _headers, _data, _agentManager, _timeout;
16
+ var _options, _httpAgent, _httpsAgent, _agentResetInterval, _requestCount, _SetupResetInterval, _GetAgentOptions, _url, _method, _headers, _data, _agentManager, _timeout, _withCredentials;
17
17
  import * as fs from "node:fs";
18
18
  import * as dotenv from "dotenv";
19
19
  import http from "node:http";
@@ -1674,10 +1674,12 @@ class AgentManager {
1674
1674
  __privateAdd(this, _agentResetInterval, null);
1675
1675
  __privateAdd(this, _requestCount, 0);
1676
1676
  __privateAdd(this, _SetupResetInterval, () => {
1677
- __privateSet(this, _agentResetInterval, setTimeout(() => {
1678
- this.ResetAgent();
1679
- __privateGet(this, _SetupResetInterval).call(this);
1680
- }, __privateGet(this, _options).agentResetInterval).unref());
1677
+ if (__privateGet(this, _options).agentResetInterval && __privateGet(this, _options).agentResetInterval > 0) {
1678
+ __privateSet(this, _agentResetInterval, setTimeout(() => {
1679
+ this.ResetAgent();
1680
+ __privateGet(this, _SetupResetInterval).call(this);
1681
+ }, __privateGet(this, _options).agentResetInterval).unref());
1682
+ }
1681
1683
  });
1682
1684
  __privateAdd(this, _GetAgentOptions, (https2) => {
1683
1685
  let options;
@@ -1713,6 +1715,22 @@ class AgentManager {
1713
1715
  __privateGet(this, _SetupResetInterval).call(this);
1714
1716
  }
1715
1717
  }
1718
+ get agentResetInterval() {
1719
+ return __privateGet(this, _options).agentResetInterval;
1720
+ }
1721
+ set agentResetInterval(val) {
1722
+ if (__privateGet(this, _agentResetInterval)) {
1723
+ clearTimeout(__privateGet(this, _agentResetInterval));
1724
+ }
1725
+ __privateGet(this, _options).agentResetInterval = val;
1726
+ __privateGet(this, _SetupResetInterval).call(this);
1727
+ }
1728
+ get agentResetCount() {
1729
+ return __privateGet(this, _options).agentResetCount;
1730
+ }
1731
+ set agentResetCount(val) {
1732
+ __privateGet(this, _options).agentResetCount = val;
1733
+ }
1716
1734
  IncRequestCount() {
1717
1735
  __privateWrapper(this, _requestCount)._++;
1718
1736
  if (__privateGet(this, _options).agentResetCount) {
@@ -1794,9 +1812,12 @@ class STSAxiosConfig {
1794
1812
  __privateAdd(this, _data);
1795
1813
  __privateAdd(this, _agentManager);
1796
1814
  __privateAdd(this, _timeout);
1815
+ __privateAdd(this, _withCredentials);
1797
1816
  __privateSet(this, _url, url);
1798
1817
  __privateSet(this, _method, method);
1799
- __privateSet(this, _headers, headers);
1818
+ if (headers !== void 0) {
1819
+ __privateSet(this, _headers, headers);
1820
+ }
1800
1821
  if (timeout !== void 0) {
1801
1822
  __privateSet(this, _timeout, timeout);
1802
1823
  }
@@ -1806,6 +1827,21 @@ class STSAxiosConfig {
1806
1827
  __privateSet(this, _data, data);
1807
1828
  return this;
1808
1829
  }
1830
+ // 'Content-Type': 'application/json'
1831
+ withHeaders(headers) {
1832
+ __privateSet(this, _headers, headers);
1833
+ return this;
1834
+ }
1835
+ withDefaultHeaders() {
1836
+ __privateSet(this, _headers, {
1837
+ "Content-Type": "application/json"
1838
+ });
1839
+ return this;
1840
+ }
1841
+ withCredentials() {
1842
+ __privateSet(this, _withCredentials, true);
1843
+ return this;
1844
+ }
1809
1845
  withTimeout(timeout) {
1810
1846
  __privateSet(this, _timeout, timeout);
1811
1847
  return this;
@@ -1817,9 +1853,11 @@ class STSAxiosConfig {
1817
1853
  get config() {
1818
1854
  const retVal = {
1819
1855
  url: __privateGet(this, _url),
1820
- method: __privateGet(this, _method),
1821
- headers: __privateGet(this, _headers)
1856
+ method: __privateGet(this, _method)
1822
1857
  };
1858
+ if (__privateGet(this, _headers)) {
1859
+ retVal.headers = __privateGet(this, _headers);
1860
+ }
1823
1861
  if (__privateGet(this, _agentManager) !== void 0) {
1824
1862
  if (__privateGet(this, _agentManager).IsHttps(__privateGet(this, _url))) {
1825
1863
  retVal.httpsAgent = __privateGet(this, _agentManager).GetAgent(__privateGet(this, _url));
@@ -1833,6 +1871,9 @@ class STSAxiosConfig {
1833
1871
  if (__privateGet(this, _timeout) !== void 0) {
1834
1872
  retVal.timeout = __privateGet(this, _timeout);
1835
1873
  }
1874
+ if (__privateGet(this, _withCredentials) !== void 0 && __privateGet(this, _withCredentials) === true) {
1875
+ retVal.withCredentials = true;
1876
+ }
1836
1877
  return retVal;
1837
1878
  }
1838
1879
  }
@@ -1842,6 +1883,7 @@ _headers = new WeakMap();
1842
1883
  _data = new WeakMap();
1843
1884
  _agentManager = new WeakMap();
1844
1885
  _timeout = new WeakMap();
1886
+ _withCredentials = new WeakMap();
1845
1887
  export {
1846
1888
  $ResetOptions,
1847
1889
  $ResetOptionsEx,