@autofleet/node-common 1.1.5 → 1.1.7
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/README.md +21 -1
- package/consts/index.js +5 -0
- package/network/index.js +1 -1
- package/package.json +6 -2
- package/settings/index.test.js +1 -1
package/README.md
CHANGED
|
@@ -7,10 +7,21 @@ Make sure you have:
|
|
|
7
7
|
* Tests
|
|
8
8
|
* Docs
|
|
9
9
|
|
|
10
|
+
## Consts
|
|
11
|
+
|
|
12
|
+
Currently we suppurt:
|
|
13
|
+
```
|
|
14
|
+
{
|
|
15
|
+
'OK'
|
|
16
|
+
'ERROR'
|
|
17
|
+
'FAIL'
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
10
21
|
## Network
|
|
11
22
|
Server 2 Servers communication.
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
Implemented:
|
|
14
25
|
* Retriving service urls from environment
|
|
15
26
|
* Retry - Using https://github.com/softonic/axios-retry
|
|
16
27
|
* Caching - TBD
|
|
@@ -36,7 +47,16 @@ RIDE_SERVICE_HOST=jsonplaceholder.typicode.com
|
|
|
36
47
|
|
|
37
48
|
To learn more [click here](https://blog.risingstack.com/designing-microservices-architecture-for-failure/).
|
|
38
49
|
|
|
50
|
+
## Settings
|
|
51
|
+
|
|
52
|
+
See example.
|
|
53
|
+
|
|
54
|
+
## DeLorean
|
|
55
|
+
|
|
56
|
+
Use this model to mock time on server - more info TBD.
|
|
57
|
+
|
|
39
58
|
## Publish package
|
|
59
|
+
|
|
40
60
|
bump the version number in package.json
|
|
41
61
|
and run
|
|
42
62
|
```
|
package/consts/index.js
ADDED
package/network/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const HTTPMethods = [
|
|
|
25
25
|
const defaultSettings = {
|
|
26
26
|
timeout: 2500,
|
|
27
27
|
headers: { 'X-AF-AUTH': 'ANYONE' },
|
|
28
|
-
paramsSerializer: params => qs.stringify(params),
|
|
28
|
+
paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
module.exports = class Network {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/node-common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"coverage": "jest --coverage --forceExit --runInBand",
|
|
@@ -26,9 +26,13 @@
|
|
|
26
26
|
"axios-retry": "^3.1.0",
|
|
27
27
|
"dotenv": "^5.0.1",
|
|
28
28
|
"jest": "^22.4.3",
|
|
29
|
+
"mock-socket": "^7.1.0",
|
|
29
30
|
"node-cache": "^4.2.0",
|
|
31
|
+
"portfinder": "^1.0.13",
|
|
30
32
|
"qs": "^6.5.2",
|
|
31
|
-
"winston": "^3.0.0-rc4"
|
|
33
|
+
"winston": "^3.0.0-rc4",
|
|
34
|
+
"ws": "^5.2.0",
|
|
35
|
+
"timekeeper": "^2.1.2"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
38
|
"eslint": "^4.19.1",
|
package/settings/index.test.js
CHANGED
|
@@ -4,7 +4,7 @@ const Settings = require('./index');
|
|
|
4
4
|
const serviceUrl = 'http://localhost:8085';
|
|
5
5
|
|
|
6
6
|
const mockSetting = (key, value, labels, response = 200) => nock(serviceUrl)
|
|
7
|
-
.get(`/api/v1/
|
|
7
|
+
.get(`/api/v1/settings/get-setting/${key}`)
|
|
8
8
|
.query(labels ? { labels } : undefined)
|
|
9
9
|
.reply(response, { value });
|
|
10
10
|
|