@eik/service 2.0.4 → 2.0.8
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/CHANGELOG.md +28 -0
- package/lib/main.js +11 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [2.0.8](https://github.com/eik-lib/service/compare/v2.0.7...v2.0.8) (2021-10-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency convict to v6.2.1 ([48e8f12](https://github.com/eik-lib/service/commit/48e8f12884d53068d78606ede876fde0eaf01fa3))
|
|
7
|
+
|
|
8
|
+
## [2.0.7](https://github.com/eik-lib/service/compare/v2.0.6...v2.0.7) (2021-10-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* default cache header of 404 objects to 5 seconds ([#307](https://github.com/eik-lib/service/issues/307)) ([0e01035](https://github.com/eik-lib/service/commit/0e01035ec84bf3ef188f579f23490d5dae7ac6c9))
|
|
14
|
+
|
|
15
|
+
## [2.0.6](https://github.com/eik-lib/service/compare/v2.0.5...v2.0.6) (2021-10-20)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* Allow to override alias get ([#239](https://github.com/eik-lib/service/issues/239)) ([51fce59](https://github.com/eik-lib/service/commit/51fce598c9da29f96739147bc19962e6ffef2ed5))
|
|
21
|
+
|
|
22
|
+
## [2.0.5](https://github.com/eik-lib/service/compare/v2.0.4...v2.0.5) (2021-10-19)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **deps:** update dependency pino to v7.0.3 ([14dd67f](https://github.com/eik-lib/service/commit/14dd67fbbfb60ac6d83338f8c1b872d9a20aec40))
|
|
28
|
+
|
|
1
29
|
## [2.0.4](https://github.com/eik-lib/service/compare/v2.0.3...v2.0.4) (2021-10-19)
|
|
2
30
|
|
|
3
31
|
|
package/lib/main.js
CHANGED
|
@@ -13,7 +13,10 @@ import * as utils from './utils.js';
|
|
|
13
13
|
const EikService = class EikService {
|
|
14
14
|
constructor({
|
|
15
15
|
customSink,
|
|
16
|
+
notFoundCacheControl,
|
|
17
|
+
aliasCacheControl,
|
|
16
18
|
} = {}) {
|
|
19
|
+
this._notFoundCacheControl = notFoundCacheControl || 'public, max-age=5';
|
|
17
20
|
const logger = pino({
|
|
18
21
|
level: config.get('log.level'),
|
|
19
22
|
name: config.get('name'),
|
|
@@ -36,7 +39,7 @@ const EikService = class EikService {
|
|
|
36
39
|
this._versionsGet = new eik.http.VersionsGet({ organizations, sink, logger });
|
|
37
40
|
this._aliasPost = new eik.http.AliasPost({ organizations, sink, logger });
|
|
38
41
|
this._aliasDel = new eik.http.AliasDel({ organizations, sink, logger });
|
|
39
|
-
this._aliasGet = new eik.http.AliasGet({ organizations, sink, logger });
|
|
42
|
+
this._aliasGet = new eik.http.AliasGet({ organizations, sink, logger, cacheControl: aliasCacheControl });
|
|
40
43
|
this._aliasPut = new eik.http.AliasPut({ organizations, sink, logger });
|
|
41
44
|
this._authPost = new eik.http.AuthPost({ organizations, logger, authKey: config.get('basicAuth.key') });
|
|
42
45
|
this._pkgLog = new eik.http.PkgLog({ organizations, sink, logger });
|
|
@@ -163,7 +166,7 @@ const EikService = class EikService {
|
|
|
163
166
|
|
|
164
167
|
// 404 handling
|
|
165
168
|
app.setNotFoundHandler((request, reply) => {
|
|
166
|
-
reply.header('cache-control',
|
|
169
|
+
reply.header('cache-control', this._notFoundCacheControl);
|
|
167
170
|
reply.type('text/plain');
|
|
168
171
|
reply.code(404);
|
|
169
172
|
reply.send('Not found');
|
|
@@ -175,6 +178,12 @@ const EikService = class EikService {
|
|
|
175
178
|
this.logger.trace(error);
|
|
176
179
|
reply.header('cache-control', 'no-store');
|
|
177
180
|
if (error.statusCode) {
|
|
181
|
+
if (error.statusCode === 404) {
|
|
182
|
+
reply.header(
|
|
183
|
+
'cache-control',
|
|
184
|
+
this._notFoundCacheControl,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
178
187
|
reply.send(error);
|
|
179
188
|
return;
|
|
180
189
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eik/service",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Eik REST API as a standalone HTTP service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/main.js",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"homepage": "https://github.com/eik-lib/service#readme",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@eik/core": "1.2.25",
|
|
37
|
-
"convict": "6.2.
|
|
37
|
+
"convict": "6.2.1",
|
|
38
38
|
"fastify": "3.22.1",
|
|
39
39
|
"fastify-compress": "3.6.1",
|
|
40
40
|
"fastify-cors": "6.0.2",
|
|
41
41
|
"fastify-jwt": "3.2.1",
|
|
42
42
|
"http-errors": "1.8.0",
|
|
43
43
|
"js-yaml": "4.1.0",
|
|
44
|
-
"pino": "7.0.
|
|
44
|
+
"pino": "7.0.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/eslint-parser": "7.15.8",
|