@nsshunt/stsconfig 1.25.157 → 1.25.159
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/stsconfig.mjs +70 -1
- package/dist/stsconfig.mjs.map +1 -1
- package/dist/stsconfig.umd.js +70 -1
- package/dist/stsconfig.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/agentManager.d.ts +1 -0
- package/types/agentManager.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/stsAxiosConfig.d.ts +10 -0
- package/types/stsAxiosConfig.d.ts.map +1 -0
package/dist/stsconfig.mjs
CHANGED
|
@@ -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;
|
|
16
|
+
var _options, _httpAgent, _httpsAgent, _agentResetInterval, _requestCount, _SetupResetInterval, _GetAgentOptions, _url, _method, _headers, _data, _agentManager;
|
|
17
17
|
import * as fs from "node:fs";
|
|
18
18
|
import * as dotenv from "dotenv";
|
|
19
19
|
import http from "node:http";
|
|
@@ -1721,6 +1721,12 @@ class AgentManager {
|
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
1723
|
}
|
|
1724
|
+
IsHttps(protocol) {
|
|
1725
|
+
if (protocol.toLowerCase().startsWith("https:")) {
|
|
1726
|
+
return true;
|
|
1727
|
+
}
|
|
1728
|
+
return false;
|
|
1729
|
+
}
|
|
1724
1730
|
GetAgent(protocol) {
|
|
1725
1731
|
if (protocol.toLowerCase().startsWith("https:")) {
|
|
1726
1732
|
if (__privateGet(this, _httpsAgent) === null) {
|
|
@@ -1740,6 +1746,23 @@ class AgentManager {
|
|
|
1740
1746
|
__privateSet(this, _httpAgent, null);
|
|
1741
1747
|
__privateSet(this, _httpsAgent, null);
|
|
1742
1748
|
}
|
|
1749
|
+
/*
|
|
1750
|
+
url
|
|
1751
|
+
,method: 'post'
|
|
1752
|
+
,data: payload
|
|
1753
|
+
,headers: headers
|
|
1754
|
+
,httpsAgent: this.#agentManager.GetAgent(url)
|
|
1755
|
+
*/
|
|
1756
|
+
/*
|
|
1757
|
+
postgresContainer = await new GenericContainer("postgres")
|
|
1758
|
+
.withExposedPorts(5432)
|
|
1759
|
+
.withEnvironment({
|
|
1760
|
+
POSTGRES_PASSWORD: "postgres",
|
|
1761
|
+
//UV_THREADPOOL_SIZE: "64"
|
|
1762
|
+
})
|
|
1763
|
+
.withCommand(['-c', 'max_connections=20'])
|
|
1764
|
+
.start();
|
|
1765
|
+
*/
|
|
1743
1766
|
Terminate() {
|
|
1744
1767
|
if (__privateGet(this, _agentResetInterval)) {
|
|
1745
1768
|
clearTimeout(__privateGet(this, _agentResetInterval));
|
|
@@ -1762,10 +1785,56 @@ _agentResetInterval = new WeakMap();
|
|
|
1762
1785
|
_requestCount = new WeakMap();
|
|
1763
1786
|
_SetupResetInterval = new WeakMap();
|
|
1764
1787
|
_GetAgentOptions = new WeakMap();
|
|
1788
|
+
class STSAxiosConfig {
|
|
1789
|
+
constructor(url, method, headers) {
|
|
1790
|
+
__privateAdd(this, _url);
|
|
1791
|
+
__privateAdd(this, _method);
|
|
1792
|
+
__privateAdd(this, _headers);
|
|
1793
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1794
|
+
__privateAdd(this, _data);
|
|
1795
|
+
__privateAdd(this, _agentManager);
|
|
1796
|
+
__privateSet(this, _url, url);
|
|
1797
|
+
__privateSet(this, _method, method);
|
|
1798
|
+
__privateSet(this, _headers, headers);
|
|
1799
|
+
}
|
|
1800
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1801
|
+
withData(data) {
|
|
1802
|
+
__privateSet(this, _data, data);
|
|
1803
|
+
return this;
|
|
1804
|
+
}
|
|
1805
|
+
withAgentManager(agentManager) {
|
|
1806
|
+
__privateSet(this, _agentManager, agentManager);
|
|
1807
|
+
return this;
|
|
1808
|
+
}
|
|
1809
|
+
get config() {
|
|
1810
|
+
const retVal = {
|
|
1811
|
+
url: __privateGet(this, _url),
|
|
1812
|
+
method: __privateGet(this, _method),
|
|
1813
|
+
headers: __privateGet(this, _headers)
|
|
1814
|
+
};
|
|
1815
|
+
if (__privateGet(this, _agentManager) !== void 0) {
|
|
1816
|
+
if (__privateGet(this, _agentManager).IsHttps(__privateGet(this, _url))) {
|
|
1817
|
+
retVal.httpsAgent = __privateGet(this, _agentManager).GetAgent(__privateGet(this, _url));
|
|
1818
|
+
} else {
|
|
1819
|
+
retVal.httpAgent = __privateGet(this, _agentManager).GetAgent(__privateGet(this, _url));
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
if (__privateGet(this, _data) !== void 0) {
|
|
1823
|
+
retVal.data = __privateGet(this, _data);
|
|
1824
|
+
}
|
|
1825
|
+
return retVal;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
_url = new WeakMap();
|
|
1829
|
+
_method = new WeakMap();
|
|
1830
|
+
_headers = new WeakMap();
|
|
1831
|
+
_data = new WeakMap();
|
|
1832
|
+
_agentManager = new WeakMap();
|
|
1765
1833
|
export {
|
|
1766
1834
|
$ResetOptions,
|
|
1767
1835
|
$ResetOptionsEx,
|
|
1768
1836
|
AgentManager,
|
|
1837
|
+
STSAxiosConfig,
|
|
1769
1838
|
goptions
|
|
1770
1839
|
};
|
|
1771
1840
|
//# sourceMappingURL=stsconfig.mjs.map
|