@catbee/utils 1.0.2 → 1.0.3
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 +1 -2
- package/build/index.cjs +21 -3
- package/build/index.d.ts +18 -0
- package/build/index.mjs +21 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -20,9 +20,8 @@ A modular, production-grade utility toolkit for Node.js and TypeScript, designed
|
|
|
20
20
|
<img src="https://img.shields.io/npm/v/@catbee/utils/next" alt="NPM Next Version" /> -->
|
|
21
21
|
<img src="https://img.shields.io/npm/dt/@catbee/utils" alt="NPM Downloads" />
|
|
22
22
|
<img src="https://img.shields.io/npm/types/@catbee/utils" alt="TypeScript Types" />
|
|
23
|
-
<img src="https://img.shields.io/librariesio/release/npm/@catbee%2Futils" alt="Dependencies" />
|
|
24
23
|
<img src="https://img.shields.io/maintenance/yes/2025" alt="Maintenance" />
|
|
25
|
-
<img src="https://snyk.io/test/github
|
|
24
|
+
<img src="https://snyk.io/test/github/catbee-technologies/catbee-utils/badge.svg" alt="Snyk Vulnerabilities" />
|
|
26
25
|
<img src="https://sonarcloud.io/api/project_badges/measure?project=catbee-technologies_catbee-utils&metric=alert_status&token=93da835f2d48d37b41fa628cc7fc764c873bd700" alt="Quality Gate Status" />
|
|
27
26
|
<img src="https://sonarcloud.io/api/project_badges/measure?project=catbee-technologies_catbee-utils&metric=ncloc&token=93da835f2d48d37b41fa628cc7fc764c873bd700" alt="Lines of Code" />
|
|
28
27
|
<img src="https://sonarcloud.io/api/project_badges/measure?project=catbee-technologies_catbee-utils&metric=security_rating&token=93da835f2d48d37b41fa628cc7fc764c873bd700" alt="Security Rating" />
|
package/build/index.cjs
CHANGED
|
@@ -1073,6 +1073,10 @@ var config = {
|
|
|
1073
1073
|
*/
|
|
1074
1074
|
pretty: Env.getBoolean("LOGGER_PRETTY", true),
|
|
1075
1075
|
/**
|
|
1076
|
+
* Enables colorized output for pretty-print (default: true)
|
|
1077
|
+
*/
|
|
1078
|
+
colorize: Env.getBoolean("LOGGER_PRETTY_COLORIZE", true),
|
|
1079
|
+
/**
|
|
1076
1080
|
* Single line output for pretty-print (default: false)
|
|
1077
1081
|
*/
|
|
1078
1082
|
singleLine: Env.getBoolean("LOGGER_PRETTY_SINGLE_LINE", false)
|
|
@@ -1082,6 +1086,20 @@ var config = {
|
|
|
1082
1086
|
* Default TTL (time to live) for cache entries in seconds
|
|
1083
1087
|
*/
|
|
1084
1088
|
defaultTtl: Env.getNumber("CACHE_DEFAULT_TTL_SECONDS", 3600) * 1e3
|
|
1089
|
+
},
|
|
1090
|
+
server: {
|
|
1091
|
+
/**
|
|
1092
|
+
* Skip healthz endpoint even if health checks are configured
|
|
1093
|
+
* Default: false
|
|
1094
|
+
* Set to true to return 200 OK for /healthz without checks
|
|
1095
|
+
* Useful in environments where a simple liveness probe is needed
|
|
1096
|
+
* without performing actual health checks
|
|
1097
|
+
* Example: Kubernetes liveness probe
|
|
1098
|
+
* Note: This does not disable the health check functionality itself
|
|
1099
|
+
* Health checks can still be performed programmatically
|
|
1100
|
+
* or via other endpoints if needed
|
|
1101
|
+
*/
|
|
1102
|
+
skipHealthz: Env.getBoolean("SERVER_SKIP_HEALTHZ", false)
|
|
1085
1103
|
}
|
|
1086
1104
|
};
|
|
1087
1105
|
var defaultServerConfig = {
|
|
@@ -1685,10 +1703,10 @@ function setupLogger(isGlobal = true) {
|
|
|
1685
1703
|
},
|
|
1686
1704
|
timestamp: pino.stdTimeFunctions.isoTime
|
|
1687
1705
|
};
|
|
1688
|
-
const logger2 = config.logger.pretty
|
|
1706
|
+
const logger2 = config.logger.pretty ? pino__default.default(logParams, pino__default.default.transport({
|
|
1689
1707
|
target: "pino-pretty",
|
|
1690
1708
|
options: {
|
|
1691
|
-
colorize:
|
|
1709
|
+
colorize: config.logger.colorize,
|
|
1692
1710
|
translateTime: "SYS:standard",
|
|
1693
1711
|
ignore: "pid,hostname",
|
|
1694
1712
|
singleLine: config.logger.singleLine,
|
|
@@ -6800,7 +6818,7 @@ var ExpressServer = class _ExpressServer {
|
|
|
6800
6818
|
const healthCheckPath = this.normalizePath(this.config.healthCheck?.path || "/healthz", this.config.healthCheck?.withGlobalPrefix);
|
|
6801
6819
|
this.app.get(healthCheckPath, async (_req, res) => {
|
|
6802
6820
|
try {
|
|
6803
|
-
if (!this.healthChecks.length) {
|
|
6821
|
+
if (!this.healthChecks.length || config.server.skipHealthz) {
|
|
6804
6822
|
return res.status(HttpStatusCodes.OK).json(new SuccessResponse("OK"));
|
|
6805
6823
|
}
|
|
6806
6824
|
const checkResults = await Promise.allSettled(this.healthChecks.map(async ({ name, check }) => {
|
package/build/index.d.ts
CHANGED
|
@@ -229,6 +229,10 @@ declare let config: {
|
|
|
229
229
|
* Has no effect in production.
|
|
230
230
|
*/
|
|
231
231
|
pretty: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Enables colorized output for pretty-print (default: true)
|
|
234
|
+
*/
|
|
235
|
+
colorize: boolean;
|
|
232
236
|
/**
|
|
233
237
|
* Single line output for pretty-print (default: false)
|
|
234
238
|
*/
|
|
@@ -240,6 +244,20 @@ declare let config: {
|
|
|
240
244
|
*/
|
|
241
245
|
defaultTtl: number;
|
|
242
246
|
};
|
|
247
|
+
server: {
|
|
248
|
+
/**
|
|
249
|
+
* Skip healthz endpoint even if health checks are configured
|
|
250
|
+
* Default: false
|
|
251
|
+
* Set to true to return 200 OK for /healthz without checks
|
|
252
|
+
* Useful in environments where a simple liveness probe is needed
|
|
253
|
+
* without performing actual health checks
|
|
254
|
+
* Example: Kubernetes liveness probe
|
|
255
|
+
* Note: This does not disable the health check functionality itself
|
|
256
|
+
* Health checks can still be performed programmatically
|
|
257
|
+
* or via other endpoints if needed
|
|
258
|
+
*/
|
|
259
|
+
skipHealthz: boolean;
|
|
260
|
+
};
|
|
243
261
|
};
|
|
244
262
|
/**
|
|
245
263
|
* Update the @catbee/utils configuration.
|
package/build/index.mjs
CHANGED
|
@@ -1061,6 +1061,10 @@ var config = {
|
|
|
1061
1061
|
*/
|
|
1062
1062
|
pretty: Env.getBoolean("LOGGER_PRETTY", true),
|
|
1063
1063
|
/**
|
|
1064
|
+
* Enables colorized output for pretty-print (default: true)
|
|
1065
|
+
*/
|
|
1066
|
+
colorize: Env.getBoolean("LOGGER_PRETTY_COLORIZE", true),
|
|
1067
|
+
/**
|
|
1064
1068
|
* Single line output for pretty-print (default: false)
|
|
1065
1069
|
*/
|
|
1066
1070
|
singleLine: Env.getBoolean("LOGGER_PRETTY_SINGLE_LINE", false)
|
|
@@ -1070,6 +1074,20 @@ var config = {
|
|
|
1070
1074
|
* Default TTL (time to live) for cache entries in seconds
|
|
1071
1075
|
*/
|
|
1072
1076
|
defaultTtl: Env.getNumber("CACHE_DEFAULT_TTL_SECONDS", 3600) * 1e3
|
|
1077
|
+
},
|
|
1078
|
+
server: {
|
|
1079
|
+
/**
|
|
1080
|
+
* Skip healthz endpoint even if health checks are configured
|
|
1081
|
+
* Default: false
|
|
1082
|
+
* Set to true to return 200 OK for /healthz without checks
|
|
1083
|
+
* Useful in environments where a simple liveness probe is needed
|
|
1084
|
+
* without performing actual health checks
|
|
1085
|
+
* Example: Kubernetes liveness probe
|
|
1086
|
+
* Note: This does not disable the health check functionality itself
|
|
1087
|
+
* Health checks can still be performed programmatically
|
|
1088
|
+
* or via other endpoints if needed
|
|
1089
|
+
*/
|
|
1090
|
+
skipHealthz: Env.getBoolean("SERVER_SKIP_HEALTHZ", false)
|
|
1073
1091
|
}
|
|
1074
1092
|
};
|
|
1075
1093
|
var defaultServerConfig = {
|
|
@@ -1673,10 +1691,10 @@ function setupLogger(isGlobal = true) {
|
|
|
1673
1691
|
},
|
|
1674
1692
|
timestamp: stdTimeFunctions.isoTime
|
|
1675
1693
|
};
|
|
1676
|
-
const logger2 = config.logger.pretty
|
|
1694
|
+
const logger2 = config.logger.pretty ? pino(logParams, pino.transport({
|
|
1677
1695
|
target: "pino-pretty",
|
|
1678
1696
|
options: {
|
|
1679
|
-
colorize:
|
|
1697
|
+
colorize: config.logger.colorize,
|
|
1680
1698
|
translateTime: "SYS:standard",
|
|
1681
1699
|
ignore: "pid,hostname",
|
|
1682
1700
|
singleLine: config.logger.singleLine,
|
|
@@ -6788,7 +6806,7 @@ var ExpressServer = class _ExpressServer {
|
|
|
6788
6806
|
const healthCheckPath = this.normalizePath(this.config.healthCheck?.path || "/healthz", this.config.healthCheck?.withGlobalPrefix);
|
|
6789
6807
|
this.app.get(healthCheckPath, async (_req, res) => {
|
|
6790
6808
|
try {
|
|
6791
|
-
if (!this.healthChecks.length) {
|
|
6809
|
+
if (!this.healthChecks.length || config.server.skipHealthz) {
|
|
6792
6810
|
return res.status(HttpStatusCodes.OK).json(new SuccessResponse("OK"));
|
|
6793
6811
|
}
|
|
6794
6812
|
const checkResults = await Promise.allSettled(this.healthChecks.map(async ({ name, check }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catbee/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A modular, production-grade utility toolkit for Node.js and TypeScript, designed for robust, scalable applications (including Express-based services). All utilities are tree-shakable and can be imported independently.",
|
|
5
5
|
"main": "build/index.cjs",
|
|
6
6
|
"module": "build/index.mjs",
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"optionalDependencies": {
|
|
17
|
-
"@scalar/express-api-reference": "^0.8.
|
|
17
|
+
"@scalar/express-api-reference": "^0.8.20",
|
|
18
18
|
"abort-controller": "^3.0.0",
|
|
19
19
|
"compression": "^1.8.1",
|
|
20
20
|
"cookie-parser": "^1.4.7",
|
|
21
21
|
"cors": "^2.8.5",
|
|
22
22
|
"express-rate-limit": "^8.1.0",
|
|
23
23
|
"helmet": "^8.1.0",
|
|
24
|
-
"pino": "^
|
|
24
|
+
"pino": "^10.0.0",
|
|
25
25
|
"pino-pretty": "^13.1.1",
|
|
26
26
|
"prom-client": "^15.1.3"
|
|
27
27
|
},
|