@autofleet/network 1.1.4 → 1.1.5
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/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/modules.xml +8 -0
- package/.idea/node-network.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +39 -0
- package/index.js +9 -1
- package/package.json +3 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/node-network.iml" filepath="$PROJECT_DIR$/.idea/node-network.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/vcs.xml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="c9b06cbe-e458-4222-bee7-0a0a4a87b698" name="Default Changelist" comment="" />
|
|
5
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
6
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
7
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
8
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
9
|
+
</component>
|
|
10
|
+
<component name="Git.Settings">
|
|
11
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="ProjectId" id="1jEMqtTkeCk8LQVT9N5AwHrKvGz" />
|
|
14
|
+
<component name="ProjectViewState">
|
|
15
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
16
|
+
<option name="showLibraryContents" value="true" />
|
|
17
|
+
</component>
|
|
18
|
+
<component name="PropertiesComponent">
|
|
19
|
+
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
20
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
21
|
+
<property name="nodejs_package_manager_path" value="npm" />
|
|
22
|
+
<property name="vue.rearranger.settings.migration" value="true" />
|
|
23
|
+
</component>
|
|
24
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
25
|
+
<component name="TaskManager">
|
|
26
|
+
<task active="true" id="Default" summary="Default task">
|
|
27
|
+
<changelist id="c9b06cbe-e458-4222-bee7-0a0a4a87b698" name="Default Changelist" comment="" />
|
|
28
|
+
<created>1603364991643</created>
|
|
29
|
+
<option name="number" value="Default" />
|
|
30
|
+
<option name="presentableId" value="Default" />
|
|
31
|
+
<updated>1603364991643</updated>
|
|
32
|
+
<workItem from="1603364992701" duration="1057000" />
|
|
33
|
+
</task>
|
|
34
|
+
<servers />
|
|
35
|
+
</component>
|
|
36
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
37
|
+
<option name="version" value="3" />
|
|
38
|
+
</component>
|
|
39
|
+
</project>
|
package/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const https = require('https');
|
|
2
4
|
const axiosRetry = require('axios-retry');
|
|
3
5
|
const { Logger } = require('@autofleet/node-common');
|
|
4
6
|
const qs = require('qs');
|
|
@@ -37,6 +39,11 @@ const defaultSettings = {
|
|
|
37
39
|
module.exports = class Network {
|
|
38
40
|
constructor(settings = {}) {
|
|
39
41
|
this.settings = merge(defaultSettings, settings);
|
|
42
|
+
if (this.settings.keepAlive) {
|
|
43
|
+
this.settings.httpAgent = new http.Agent({ keepAlive: true});
|
|
44
|
+
this.settings.httpsAgent = new https.Agent({ keepAlive: true });
|
|
45
|
+
delete this.settings.keepAlive;
|
|
46
|
+
}
|
|
40
47
|
this.createBaseUrl();
|
|
41
48
|
|
|
42
49
|
if(settings.cache) {
|
|
@@ -94,7 +101,8 @@ module.exports = class Network {
|
|
|
94
101
|
settings.baseURL = settings.serviceUrl;
|
|
95
102
|
} else if (settings.serviceName) {
|
|
96
103
|
const envServiceHostName = `${settings.serviceName}_SERVICE_HOST`;
|
|
97
|
-
|
|
104
|
+
const dashedServiceName = settings.serviceName.split('_').join('-');
|
|
105
|
+
settings.baseURL = `http://${(process.env[envServiceHostName] || dashedServiceName)}`;
|
|
98
106
|
if (!settings.baseURL) {
|
|
99
107
|
throw new Error(`Missing environment variable: ${envServiceHostName}`);
|
|
100
108
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/network",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
"axios-retry": "^3.1.1",
|
|
18
18
|
"deepmerge": "^3.0.0",
|
|
19
19
|
"dotenv": "^6.0.0",
|
|
20
|
+
"http": "0.0.1-security",
|
|
21
|
+
"https": "^1.0.0",
|
|
20
22
|
"qs": "^6.5.2"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|