@eik/service 2.0.164 → 2.1.1
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 +14 -0
- package/lib/main.js +13 -7
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [2.1.1](https://github.com/eik-lib/service/compare/v2.1.0...v2.1.1) (2024-08-01)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* don't overwrite `sink` with SinkFileSystem ([22355ff](https://github.com/eik-lib/service/commit/22355ffff0f4a56a60af6df9a918b7c12451e92e))
|
7
|
+
|
8
|
+
# [2.1.0](https://github.com/eik-lib/service/compare/v2.0.164...v2.1.0) (2024-07-31)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* allow passing in a pino instance ([#577](https://github.com/eik-lib/service/issues/577)) ([2161f83](https://github.com/eik-lib/service/commit/2161f833dd63b4321fe54b27e3926011eb2886e2))
|
14
|
+
|
1
15
|
## [2.0.164](https://github.com/eik-lib/service/compare/v2.0.163...v2.0.164) (2024-07-31)
|
2
16
|
|
3
17
|
|
package/lib/main.js
CHANGED
@@ -15,6 +15,7 @@ import * as utils from './utils.js';
|
|
15
15
|
/**
|
16
16
|
* @typedef {object} EikServiceOptions
|
17
17
|
* @property {import('@eik/sink').default} [sink]
|
18
|
+
* @property {import('pino').Logger} [logger]
|
18
19
|
* @property {import('@eik/sink').default} [customSink] [Deprecated] Use sink instead
|
19
20
|
* @property {string} [aliasCacheControl]
|
20
21
|
* @property {string} [notFoundCacheControl="public, max-age=5"]
|
@@ -25,20 +26,25 @@ const EikService = class EikService {
|
|
25
26
|
* @param {EikServiceOptions} [options={}]
|
26
27
|
*/
|
27
28
|
constructor(options = {}) {
|
28
|
-
let { sink } = options;
|
29
|
+
let { sink, logger } = options;
|
29
30
|
const {
|
30
31
|
customSink,
|
31
32
|
notFoundCacheControl,
|
32
33
|
aliasCacheControl,
|
33
34
|
} = options;
|
34
35
|
this._notFoundCacheControl = notFoundCacheControl || 'public, max-age=5';
|
35
|
-
const logger = pino({
|
36
|
-
// @ts-ignore
|
37
|
-
level: config.get('log.level'),
|
38
|
-
name: config.get('name'),
|
39
|
-
});
|
40
36
|
|
41
|
-
if (
|
37
|
+
if (!logger) {
|
38
|
+
logger = pino({
|
39
|
+
// @ts-ignore
|
40
|
+
level: config.get('log.level'),
|
41
|
+
name: config.get('name'),
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
if (sink) {
|
46
|
+
logger.info(`Using the provided sink ${sink.constructor.name}`);
|
47
|
+
} else if (customSink) {
|
42
48
|
logger.warn('The `customSink` option is deprecated and will be removed at a later stage. Use `sink` to remove this warning.');
|
43
49
|
sink = customSink;
|
44
50
|
} else if (config.get('sink.type') === 'mem') {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eik/service",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.1.1",
|
4
4
|
"description": "Eik REST API as a standalone HTTP service",
|
5
5
|
"type": "module",
|
6
6
|
"main": "./lib/main.js",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"pino": "8.21.0"
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
|
-
"@babel/eslint-parser": "7.
|
50
|
+
"@babel/eslint-parser": "7.25.1",
|
51
51
|
"@semantic-release/changelog": "6.0.3",
|
52
52
|
"@semantic-release/git": "10.0.1",
|
53
53
|
"cross-env": "^7.0.3",
|
@@ -55,13 +55,13 @@
|
|
55
55
|
"eslint-config-airbnb-base": "15.0.0",
|
56
56
|
"eslint-config-prettier": "9.1.0",
|
57
57
|
"eslint-plugin-import": "2.29.1",
|
58
|
-
"eslint-plugin-prettier": "5.1
|
58
|
+
"eslint-plugin-prettier": "5.2.1",
|
59
59
|
"form-data": "4.0.0",
|
60
60
|
"node-fetch": "3.3.1",
|
61
61
|
"pino-pretty": "10.3.1",
|
62
|
-
"prettier": "3.
|
62
|
+
"prettier": "3.3.3",
|
63
63
|
"semantic-release": "23.1.1",
|
64
|
-
"tap": "18.
|
64
|
+
"tap": "18.8.0",
|
65
65
|
"unique-slug": "4.0.0"
|
66
66
|
}
|
67
67
|
}
|