@catbee/utils 0.0.6 → 0.0.8-next.0

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.
Files changed (249) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +77 -1107
  3. package/build/index.cjs +6888 -0
  4. package/build/index.d.ts +5242 -0
  5. package/build/index.mjs +6615 -0
  6. package/package.json +26 -95
  7. package/build/esm/config.d.ts +0 -130
  8. package/build/esm/config.js +0 -145
  9. package/build/esm/config.js.map +0 -1
  10. package/build/esm/index.d.ts +0 -27
  11. package/build/esm/index.js +0 -50
  12. package/build/esm/index.js.map +0 -1
  13. package/build/esm/servers/server.builder.d.ts +0 -625
  14. package/build/esm/servers/server.builder.js +0 -722
  15. package/build/esm/servers/server.builder.js.map +0 -1
  16. package/build/esm/servers/server.d.ts +0 -256
  17. package/build/esm/servers/server.js +0 -1211
  18. package/build/esm/servers/server.js.map +0 -1
  19. package/build/esm/types/api-response.d.ts +0 -124
  20. package/build/esm/types/api-response.js +0 -25
  21. package/build/esm/types/api-response.js.map +0 -1
  22. package/build/esm/types/index.d.ts +0 -125
  23. package/build/esm/types/index.js +0 -25
  24. package/build/esm/types/index.js.map +0 -1
  25. package/build/esm/types/server.d.ts +0 -285
  26. package/build/esm/types/server.js +0 -25
  27. package/build/esm/types/server.js.map +0 -1
  28. package/build/esm/utils/array.utils.d.ts +0 -168
  29. package/build/esm/utils/array.utils.js +0 -382
  30. package/build/esm/utils/array.utils.js.map +0 -1
  31. package/build/esm/utils/async.utils.d.ts +0 -174
  32. package/build/esm/utils/async.utils.js +0 -652
  33. package/build/esm/utils/async.utils.js.map +0 -1
  34. package/build/esm/utils/cache.utils.d.ts +0 -153
  35. package/build/esm/utils/cache.utils.js +0 -499
  36. package/build/esm/utils/cache.utils.js.map +0 -1
  37. package/build/esm/utils/context-store.utils.d.ts +0 -186
  38. package/build/esm/utils/context-store.utils.js +0 -304
  39. package/build/esm/utils/context-store.utils.js.map +0 -1
  40. package/build/esm/utils/crypto.utils.d.ts +0 -160
  41. package/build/esm/utils/crypto.utils.js +0 -375
  42. package/build/esm/utils/crypto.utils.js.map +0 -1
  43. package/build/esm/utils/decorators.utils.d.ts +0 -315
  44. package/build/esm/utils/decorators.utils.js +0 -666
  45. package/build/esm/utils/decorators.utils.js.map +0 -1
  46. package/build/esm/utils/dir.utils.d.ts +0 -196
  47. package/build/esm/utils/dir.utils.js +0 -998
  48. package/build/esm/utils/dir.utils.js.map +0 -1
  49. package/build/esm/utils/env.utils.d.ts +0 -377
  50. package/build/esm/utils/env.utils.js +0 -873
  51. package/build/esm/utils/env.utils.js.map +0 -1
  52. package/build/esm/utils/exception.utils.d.ts +0 -230
  53. package/build/esm/utils/exception.utils.js +0 -559
  54. package/build/esm/utils/exception.utils.js.map +0 -1
  55. package/build/esm/utils/fs.utils.d.ts +0 -164
  56. package/build/esm/utils/fs.utils.js +0 -580
  57. package/build/esm/utils/fs.utils.js.map +0 -1
  58. package/build/esm/utils/http-status-codes.d.ts +0 -266
  59. package/build/esm/utils/http-status-codes.js +0 -295
  60. package/build/esm/utils/http-status-codes.js.map +0 -1
  61. package/build/esm/utils/id.utils.d.ts +0 -36
  62. package/build/esm/utils/id.utils.js +0 -87
  63. package/build/esm/utils/id.utils.js.map +0 -1
  64. package/build/esm/utils/logger.utils.d.ts +0 -166
  65. package/build/esm/utils/logger.utils.js +0 -347
  66. package/build/esm/utils/logger.utils.js.map +0 -1
  67. package/build/esm/utils/middleware.utils.d.ts +0 -83
  68. package/build/esm/utils/middleware.utils.js +0 -205
  69. package/build/esm/utils/middleware.utils.js.map +0 -1
  70. package/build/esm/utils/obj.utils.d.ts +0 -124
  71. package/build/esm/utils/obj.utils.js +0 -519
  72. package/build/esm/utils/obj.utils.js.map +0 -1
  73. package/build/esm/utils/request.utils.d.ts +0 -77
  74. package/build/esm/utils/request.utils.js +0 -196
  75. package/build/esm/utils/request.utils.js.map +0 -1
  76. package/build/esm/utils/response.utils.d.ts +0 -163
  77. package/build/esm/utils/response.utils.js +0 -284
  78. package/build/esm/utils/response.utils.js.map +0 -1
  79. package/build/esm/utils/string.utils.d.ts +0 -93
  80. package/build/esm/utils/string.utils.js +0 -169
  81. package/build/esm/utils/string.utils.js.map +0 -1
  82. package/build/esm/utils/url.utils.d.ts +0 -141
  83. package/build/esm/utils/url.utils.js +0 -381
  84. package/build/esm/utils/url.utils.js.map +0 -1
  85. package/build/esm/utils/validate.utils.d.ts +0 -177
  86. package/build/esm/utils/validate.utils.js +0 -336
  87. package/build/esm/utils/validate.utils.js.map +0 -1
  88. package/build/esnext/config.d.ts +0 -130
  89. package/build/esnext/config.js +0 -145
  90. package/build/esnext/config.js.map +0 -1
  91. package/build/esnext/index.d.ts +0 -27
  92. package/build/esnext/index.js +0 -50
  93. package/build/esnext/index.js.map +0 -1
  94. package/build/esnext/servers/server.builder.d.ts +0 -625
  95. package/build/esnext/servers/server.builder.js +0 -677
  96. package/build/esnext/servers/server.builder.js.map +0 -1
  97. package/build/esnext/servers/server.d.ts +0 -256
  98. package/build/esnext/servers/server.js +0 -918
  99. package/build/esnext/servers/server.js.map +0 -1
  100. package/build/esnext/types/api-response.d.ts +0 -124
  101. package/build/esnext/types/api-response.js +0 -25
  102. package/build/esnext/types/api-response.js.map +0 -1
  103. package/build/esnext/types/index.d.ts +0 -125
  104. package/build/esnext/types/index.js +0 -25
  105. package/build/esnext/types/index.js.map +0 -1
  106. package/build/esnext/types/server.d.ts +0 -285
  107. package/build/esnext/types/server.js +0 -25
  108. package/build/esnext/types/server.js.map +0 -1
  109. package/build/esnext/utils/array.utils.d.ts +0 -168
  110. package/build/esnext/utils/array.utils.js +0 -345
  111. package/build/esnext/utils/array.utils.js.map +0 -1
  112. package/build/esnext/utils/async.utils.d.ts +0 -174
  113. package/build/esnext/utils/async.utils.js +0 -430
  114. package/build/esnext/utils/async.utils.js.map +0 -1
  115. package/build/esnext/utils/cache.utils.d.ts +0 -153
  116. package/build/esnext/utils/cache.utils.js +0 -293
  117. package/build/esnext/utils/cache.utils.js.map +0 -1
  118. package/build/esnext/utils/context-store.utils.d.ts +0 -186
  119. package/build/esnext/utils/context-store.utils.js +0 -286
  120. package/build/esnext/utils/context-store.utils.js.map +0 -1
  121. package/build/esnext/utils/crypto.utils.d.ts +0 -160
  122. package/build/esnext/utils/crypto.utils.js +0 -276
  123. package/build/esnext/utils/crypto.utils.js.map +0 -1
  124. package/build/esnext/utils/decorators.utils.d.ts +0 -315
  125. package/build/esnext/utils/decorators.utils.js +0 -504
  126. package/build/esnext/utils/decorators.utils.js.map +0 -1
  127. package/build/esnext/utils/dir.utils.d.ts +0 -196
  128. package/build/esnext/utils/dir.utils.js +0 -477
  129. package/build/esnext/utils/dir.utils.js.map +0 -1
  130. package/build/esnext/utils/env.utils.d.ts +0 -377
  131. package/build/esnext/utils/env.utils.js +0 -785
  132. package/build/esnext/utils/env.utils.js.map +0 -1
  133. package/build/esnext/utils/exception.utils.d.ts +0 -230
  134. package/build/esnext/utils/exception.utils.js +0 -381
  135. package/build/esnext/utils/exception.utils.js.map +0 -1
  136. package/build/esnext/utils/fs.utils.d.ts +0 -164
  137. package/build/esnext/utils/fs.utils.js +0 -349
  138. package/build/esnext/utils/fs.utils.js.map +0 -1
  139. package/build/esnext/utils/http-status-codes.d.ts +0 -266
  140. package/build/esnext/utils/http-status-codes.js +0 -295
  141. package/build/esnext/utils/http-status-codes.js.map +0 -1
  142. package/build/esnext/utils/id.utils.d.ts +0 -36
  143. package/build/esnext/utils/id.utils.js +0 -84
  144. package/build/esnext/utils/id.utils.js.map +0 -1
  145. package/build/esnext/utils/logger.utils.d.ts +0 -166
  146. package/build/esnext/utils/logger.utils.js +0 -306
  147. package/build/esnext/utils/logger.utils.js.map +0 -1
  148. package/build/esnext/utils/middleware.utils.d.ts +0 -83
  149. package/build/esnext/utils/middleware.utils.js +0 -198
  150. package/build/esnext/utils/middleware.utils.js.map +0 -1
  151. package/build/esnext/utils/obj.utils.d.ts +0 -124
  152. package/build/esnext/utils/obj.utils.js +0 -413
  153. package/build/esnext/utils/obj.utils.js.map +0 -1
  154. package/build/esnext/utils/request.utils.d.ts +0 -77
  155. package/build/esnext/utils/request.utils.js +0 -168
  156. package/build/esnext/utils/request.utils.js.map +0 -1
  157. package/build/esnext/utils/response.utils.d.ts +0 -163
  158. package/build/esnext/utils/response.utils.js +0 -247
  159. package/build/esnext/utils/response.utils.js.map +0 -1
  160. package/build/esnext/utils/string.utils.d.ts +0 -93
  161. package/build/esnext/utils/string.utils.js +0 -165
  162. package/build/esnext/utils/string.utils.js.map +0 -1
  163. package/build/esnext/utils/url.utils.d.ts +0 -141
  164. package/build/esnext/utils/url.utils.js +0 -304
  165. package/build/esnext/utils/url.utils.js.map +0 -1
  166. package/build/esnext/utils/validate.utils.d.ts +0 -177
  167. package/build/esnext/utils/validate.utils.js +0 -320
  168. package/build/esnext/utils/validate.utils.js.map +0 -1
  169. package/build/src/config.d.ts +0 -130
  170. package/build/src/config.js +0 -150
  171. package/build/src/config.js.map +0 -1
  172. package/build/src/index.d.ts +0 -27
  173. package/build/src/index.js +0 -69
  174. package/build/src/index.js.map +0 -1
  175. package/build/src/servers/server.builder.d.ts +0 -625
  176. package/build/src/servers/server.builder.js +0 -681
  177. package/build/src/servers/server.builder.js.map +0 -1
  178. package/build/src/servers/server.d.ts +0 -256
  179. package/build/src/servers/server.js +0 -958
  180. package/build/src/servers/server.js.map +0 -1
  181. package/build/src/types/api-response.d.ts +0 -124
  182. package/build/src/types/api-response.js +0 -26
  183. package/build/src/types/api-response.js.map +0 -1
  184. package/build/src/types/index.d.ts +0 -125
  185. package/build/src/types/index.js +0 -26
  186. package/build/src/types/index.js.map +0 -1
  187. package/build/src/types/server.d.ts +0 -285
  188. package/build/src/types/server.js +0 -26
  189. package/build/src/types/server.js.map +0 -1
  190. package/build/src/utils/array.utils.d.ts +0 -168
  191. package/build/src/utils/array.utils.js +0 -364
  192. package/build/src/utils/array.utils.js.map +0 -1
  193. package/build/src/utils/async.utils.d.ts +0 -174
  194. package/build/src/utils/async.utils.js +0 -447
  195. package/build/src/utils/async.utils.js.map +0 -1
  196. package/build/src/utils/cache.utils.d.ts +0 -153
  197. package/build/src/utils/cache.utils.js +0 -297
  198. package/build/src/utils/cache.utils.js.map +0 -1
  199. package/build/src/utils/context-store.utils.d.ts +0 -186
  200. package/build/src/utils/context-store.utils.js +0 -293
  201. package/build/src/utils/context-store.utils.js.map +0 -1
  202. package/build/src/utils/crypto.utils.d.ts +0 -160
  203. package/build/src/utils/crypto.utils.js +0 -293
  204. package/build/src/utils/crypto.utils.js.map +0 -1
  205. package/build/src/utils/decorators.utils.d.ts +0 -315
  206. package/build/src/utils/decorators.utils.js +0 -516
  207. package/build/src/utils/decorators.utils.js.map +0 -1
  208. package/build/src/utils/dir.utils.d.ts +0 -196
  209. package/build/src/utils/dir.utils.js +0 -501
  210. package/build/src/utils/dir.utils.js.map +0 -1
  211. package/build/src/utils/env.utils.d.ts +0 -377
  212. package/build/src/utils/env.utils.js +0 -789
  213. package/build/src/utils/env.utils.js.map +0 -1
  214. package/build/src/utils/exception.utils.d.ts +0 -230
  215. package/build/src/utils/exception.utils.js +0 -407
  216. package/build/src/utils/exception.utils.js.map +0 -1
  217. package/build/src/utils/fs.utils.d.ts +0 -164
  218. package/build/src/utils/fs.utils.js +0 -372
  219. package/build/src/utils/fs.utils.js.map +0 -1
  220. package/build/src/utils/http-status-codes.d.ts +0 -266
  221. package/build/src/utils/http-status-codes.js +0 -298
  222. package/build/src/utils/http-status-codes.js.map +0 -1
  223. package/build/src/utils/id.utils.d.ts +0 -36
  224. package/build/src/utils/id.utils.js +0 -91
  225. package/build/src/utils/id.utils.js.map +0 -1
  226. package/build/src/utils/logger.utils.d.ts +0 -166
  227. package/build/src/utils/logger.utils.js +0 -352
  228. package/build/src/utils/logger.utils.js.map +0 -1
  229. package/build/src/utils/middleware.utils.d.ts +0 -83
  230. package/build/src/utils/middleware.utils.js +0 -205
  231. package/build/src/utils/middleware.utils.js.map +0 -1
  232. package/build/src/utils/obj.utils.d.ts +0 -124
  233. package/build/src/utils/obj.utils.js +0 -429
  234. package/build/src/utils/obj.utils.js.map +0 -1
  235. package/build/src/utils/request.utils.d.ts +0 -77
  236. package/build/src/utils/request.utils.js +0 -175
  237. package/build/src/utils/request.utils.js.map +0 -1
  238. package/build/src/utils/response.utils.d.ts +0 -163
  239. package/build/src/utils/response.utils.js +0 -260
  240. package/build/src/utils/response.utils.js.map +0 -1
  241. package/build/src/utils/string.utils.d.ts +0 -93
  242. package/build/src/utils/string.utils.js +0 -179
  243. package/build/src/utils/string.utils.js.map +0 -1
  244. package/build/src/utils/url.utils.d.ts +0 -141
  245. package/build/src/utils/url.utils.js +0 -317
  246. package/build/src/utils/url.utils.js.map +0 -1
  247. package/build/src/utils/validate.utils.d.ts +0 -177
  248. package/build/src/utils/validate.utils.js +0 -345
  249. package/build/src/utils/validate.utils.js.map +0 -1
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@catbee/utils",
3
- "version": "0.0.6",
3
+ "version": "0.0.8-next.0",
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
- "main": "build/src/index.js",
6
- "module": "build/esm/index.js",
7
- "esnext": "build/esnext/index.js",
8
- "types": "build/src/index.d.ts",
5
+ "main": "build/index.cjs",
6
+ "module": "build/index.mjs",
7
+ "types": "build/index.d.ts",
9
8
  "publishConfig": {
10
9
  "access": "public"
11
10
  },
@@ -14,106 +13,38 @@
14
13
  "email": "hprasath.dev@gmail.com"
15
14
  },
16
15
  "license": "MIT",
17
- "scripts": {
18
- "start": "node build/src/index.js",
19
- "prepack": "npm run compile",
20
- "compile": "npm run clean && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
21
- "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
22
- "lint": "eslint src tests",
23
- "lint:fix": "eslint --fix src tests",
24
- "preversion": "npm run check-license && npm run lint && npm run test && npm run compile",
25
- "pretest": "npm run compile",
26
- "dryrun": "npm pack --dry-run",
27
- "test": "cross-env LOGGER_LEVEL=silent jest",
28
- "test:coverage": "cross-env LOGGER_LEVEL=silent jest --coverage",
29
- "coverage": "npm run test:coverage",
30
- "test:debug": "cross-env LOGGER_LEVEL=info jest",
31
- "add-license": "npx license-check-and-add add -f file-banner-lic.json && npm run lint:fix",
32
- "check-license": "npx license-check-and-add check -f file-banner-lic.json"
33
- },
34
- "keywords": [
35
- "utils",
36
- "utility",
37
- "helpers",
38
- "typescript",
39
- "nodejs",
40
- "env",
41
- "config",
42
- "logger",
43
- "pino",
44
- "context",
45
- "context-store",
46
- "async",
47
- "validation",
48
- "filesystem",
49
- "object",
50
- "string",
51
- "array",
52
- "crypto",
53
- "catbee",
54
- "express",
55
- "http",
56
- "middleware",
57
- "metrics",
58
- "monitoring",
59
- "decorators",
60
- "functional",
61
- "tools"
62
- ],
63
- "dependencies": {
64
- "pino": "^9.7.0",
65
- "pino-pretty": "^13.1.1"
66
- },
67
- "devDependencies": {
68
- "@scalar/express-api-reference": "^0.8.15",
69
- "@types/compression": "^1.8.1",
70
- "@types/cookie-parser": "^1.4.9",
71
- "@types/cors": "^2.8.19",
72
- "@types/express": "^5.0.3",
73
- "@types/express-rate-limit": "^6.0.2",
74
- "@types/helmet": "^0.0.48",
75
- "@types/jest": "^30.0.0",
76
- "@types/node": "^24.2.0",
77
- "@types/supertest": "^6.0.3",
78
- "@typescript-eslint/eslint-plugin": "^8.39.0",
79
- "@typescript-eslint/parser": "^8.39.0",
16
+ "optionalDependencies": {
17
+ "@scalar/express-api-reference": "^0.8.18",
80
18
  "abort-controller": "^3.0.0",
81
19
  "compression": "^1.8.1",
82
20
  "cookie-parser": "^1.4.7",
83
21
  "cors": "^2.8.5",
84
- "cross-env": "^10.0.0",
85
- "eslint": "^9.32.0",
86
- "eslint-config-prettier": "^10.1.8",
87
- "eslint-plugin-n": "^17.21.3",
88
- "eslint-plugin-node": "^11.1.0",
89
- "eslint-plugin-prettier": "^5.5.3",
90
- "express": "^5.1.0",
22
+ "express-rate-limit": "^8.1.0",
91
23
  "helmet": "^8.1.0",
92
- "jest": "^30.0.5",
93
- "jest-junit": "^16.0.0",
94
- "jest-sonar-reporter": "^2.0.0",
95
- "prettier": "^3.6.2",
96
- "prom-client": "^15.1.3",
97
- "reflect-metadata": "^0.2.2",
98
- "supertest": "^7.1.4",
99
- "ts-jest": "^29.4.1",
100
- "typescript": "^5.9.2",
101
- "typescript-eslint": "^8.39.0"
24
+ "pino": "^9.10.0",
25
+ "pino-pretty": "^13.1.1",
26
+ "prom-client": "^15.1.3"
27
+ },
28
+ "peerDependencies": {
29
+ "express": "^5.1.0",
30
+ "reflect-metadata": "^0.2.2"
31
+ },
32
+ "peerDependenciesMeta": {
33
+ "express": {
34
+ "optional": true
35
+ },
36
+ "reflect-metadata": {
37
+ "optional": true
38
+ }
102
39
  },
103
40
  "engines": {
104
41
  "node": ">=18.4"
105
42
  },
106
43
  "files": [
107
- "build/esm/**/*.js",
108
- "build/esm/**/*.js.map",
109
- "build/esm/**/*.d.ts",
110
- "build/esnext/**/*.js",
111
- "build/esnext/**/*.js.map",
112
- "build/esnext/**/*.d.ts",
113
- "build/src/**/*.js",
114
- "build/src/**/*.js.map",
115
- "build/src/**/*.d.ts",
44
+ "build/**/*.mjs",
45
+ "build/**/*.cjs",
46
+ "build/**/*.d.ts",
116
47
  "LICENSE",
117
48
  "README.md"
118
49
  ]
119
- }
50
+ }
@@ -1,130 +0,0 @@
1
- import { LoggerLevels } from './utils/logger.utils';
2
- /**
3
- * Extends Express Request interface to add request ID tracking.
4
- * Added by requestId middleware during request processing.
5
- */
6
- declare global {
7
- namespace Express {
8
- interface Request {
9
- /** Unique request identifier (set by middleware) */
10
- id?: string;
11
- }
12
- }
13
- }
14
- /**
15
- * Application runtime configuration loaded from environment variables.
16
- */
17
- export declare let config: {
18
- logger: {
19
- /**
20
- * Logging level (e.g., 'info', 'debug', 'warn', 'error').
21
- */
22
- level: LoggerLevels;
23
- /**
24
- * Name of the logger instance (defaults to npm package name).
25
- */
26
- name: string;
27
- /**
28
- * Enables pretty-print logging in development.
29
- * Has no effect in production.
30
- */
31
- pretty: boolean;
32
- /**
33
- * Single line output for pretty-print (default: false)
34
- */
35
- singleLine: boolean;
36
- };
37
- http: {
38
- /**
39
- * Timeout for HTTP requests in milliseconds
40
- */
41
- timeout: number;
42
- };
43
- cache: {
44
- /**
45
- * Default TTL (time to live) for cache entries in seconds
46
- */
47
- defaultTtl: number;
48
- };
49
- };
50
- export declare const defaultServerConfig: {
51
- port: number;
52
- host: string;
53
- cors: false;
54
- helmet: false;
55
- compression: false;
56
- bodyParser: {
57
- json: {
58
- limit: string;
59
- };
60
- urlencoded: {
61
- extended: true;
62
- limit: string;
63
- };
64
- };
65
- cookieParser: false;
66
- isMicroservice: false;
67
- appName: string;
68
- globalHeaders: {};
69
- rateLimit: {
70
- enable: false;
71
- windowMs: number;
72
- max: number;
73
- message: string;
74
- standardHeaders: true;
75
- legacyHeaders: false;
76
- };
77
- requestLogging: {
78
- enable: boolean;
79
- ignorePaths: (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, _res: import("express").Response<any, Record<string, any>>) => boolean;
80
- skipNotFoundRoutes: false;
81
- };
82
- openApi: {
83
- enable: false;
84
- mountPath: string;
85
- verbose: false;
86
- withGlobalPrefix: false;
87
- };
88
- healthCheck: {
89
- path: string;
90
- detailed: true;
91
- };
92
- requestTimeout: number;
93
- responseTime: {
94
- enable: false;
95
- addHeader: true;
96
- logOnComplete: false;
97
- };
98
- requestId: {
99
- headerName: string;
100
- exposeHeader: true;
101
- generator: () => string;
102
- };
103
- logger: {
104
- name: string;
105
- level: LoggerLevels;
106
- prettyPrint: false;
107
- singleLine: false;
108
- };
109
- metrics: {
110
- enable: false;
111
- path: string;
112
- withGlobalPrefix: false;
113
- };
114
- serviceVersion: {
115
- enable: false;
116
- headerName: string;
117
- version: string;
118
- };
119
- };
120
- /**
121
- * Update the @catbee/utils configuration.
122
- * @param value Partial configuration object.
123
- */
124
- export declare function setConfig(value: Partial<typeof config>): void;
125
- /**
126
- * Get the current @catbee/utils configuration.
127
- * @returns The current configuration object.
128
- */
129
- export declare function getConfig(): typeof config;
130
- //# sourceMappingURL=config.d.ts.map
@@ -1,145 +0,0 @@
1
- /*
2
- * The MIT License
3
- *
4
- * Copyright (c) 2025 Catbee Technologies
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
- import { Env } from './utils/env.utils';
25
- import { uuid } from './utils/id.utils';
26
- import { deepObjMerge } from './utils/obj.utils';
27
- /**
28
- * Application runtime configuration loaded from environment variables.
29
- */
30
- export var config = {
31
- logger: {
32
- /**
33
- * Logging level (e.g., 'info', 'debug', 'warn', 'error').
34
- */
35
- level: Env.get('LOGGER_LEVEL', 'info'),
36
- /**
37
- * Name of the logger instance (defaults to npm package name).
38
- */
39
- name: Env.get('LOGGER_NAME', Env.get('npm_package_name', '@catbee/utils')),
40
- /**
41
- * Enables pretty-print logging in development.
42
- * Has no effect in production.
43
- */
44
- pretty: Env.getBoolean('LOGGER_PRETTY', true),
45
- /**
46
- * Single line output for pretty-print (default: false)
47
- */
48
- singleLine: Env.getBoolean('LOGGER_PRETTY_SINGLE_LINE', false)
49
- },
50
- http: {
51
- /**
52
- * Timeout for HTTP requests in milliseconds
53
- */
54
- timeout: Env.getNumber('HTTP_TIMEOUT', 30000)
55
- },
56
- cache: {
57
- /**
58
- * Default TTL (time to live) for cache entries in seconds
59
- */
60
- defaultTtl: Env.getNumber('CACHE_DEFAULT_TTL_SECONDS', 3600) * 1000
61
- }
62
- };
63
- export var defaultServerConfig = {
64
- port: 3000,
65
- host: '0.0.0.0',
66
- cors: false,
67
- helmet: false,
68
- compression: false,
69
- bodyParser: {
70
- json: { limit: '1mb' },
71
- urlencoded: { extended: true, limit: '1mb' }
72
- },
73
- cookieParser: false,
74
- isMicroservice: false,
75
- appName: 'express_app',
76
- globalHeaders: {},
77
- rateLimit: {
78
- enable: false,
79
- windowMs: 15 * 60 * 1000,
80
- max: 100,
81
- message: 'Too many requests',
82
- standardHeaders: true,
83
- legacyHeaders: false
84
- },
85
- requestLogging: {
86
- enable: Env.isDev(),
87
- ignorePaths: function (req, _res) {
88
- var skipPaths = ['/healthz', '/favicon.ico', '/metrics', '/docs', '/.well-known'];
89
- return skipPaths.some(function (path) { return req.path.startsWith(path); });
90
- },
91
- skipNotFoundRoutes: false
92
- },
93
- openApi: {
94
- enable: false,
95
- mountPath: '/docs',
96
- verbose: false,
97
- withGlobalPrefix: false
98
- },
99
- healthCheck: {
100
- path: '/healthz',
101
- detailed: true
102
- },
103
- requestTimeout: 30000,
104
- responseTime: {
105
- enable: false,
106
- addHeader: true,
107
- logOnComplete: false
108
- },
109
- requestId: {
110
- headerName: 'x-request-id',
111
- exposeHeader: true,
112
- generator: function () { return uuid(); }
113
- },
114
- logger: {
115
- name: 'express_app',
116
- level: 'info',
117
- prettyPrint: false,
118
- singleLine: false
119
- },
120
- metrics: {
121
- enable: false,
122
- path: '/metrics',
123
- withGlobalPrefix: false
124
- },
125
- serviceVersion: {
126
- enable: false,
127
- headerName: 'x-service-version',
128
- version: '0.0.0'
129
- }
130
- };
131
- /**
132
- * Update the @catbee/utils configuration.
133
- * @param value Partial configuration object.
134
- */
135
- export function setConfig(value) {
136
- deepObjMerge(config, value);
137
- }
138
- /**
139
- * Get the current @catbee/utils configuration.
140
- * @returns The current configuration object.
141
- */
142
- export function getConfig() {
143
- return config;
144
- }
145
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"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","sourcesContent":["/*\n * The MIT License\n *\n * Copyright (c) 2025 Catbee Technologies\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { ServerConfig } from './types/server';\nimport { Env } from './utils/env.utils';\nimport { uuid } from './utils/id.utils';\nimport { LoggerLevels } from './utils/logger.utils';\nimport { deepObjMerge } from './utils/obj.utils';\n\n/**\n * Extends Express Request interface to add request ID tracking.\n * Added by requestId middleware during request processing.\n */\ndeclare global {\n namespace Express {\n interface Request {\n /** Unique request identifier (set by middleware) */\n id?: string;\n }\n }\n}\n\n/**\n * Application runtime configuration loaded from environment variables.\n */\nexport let config = {\n logger: {\n /**\n * Logging level (e.g., 'info', 'debug', 'warn', 'error').\n */\n level: Env.get('LOGGER_LEVEL', 'info') as LoggerLevels,\n\n /**\n * Name of the logger instance (defaults to npm package name).\n */\n name: Env.get('LOGGER_NAME', Env.get('npm_package_name', '@catbee/utils')),\n\n /**\n * Enables pretty-print logging in development.\n * Has no effect in production.\n */\n pretty: Env.getBoolean('LOGGER_PRETTY', true),\n /**\n * Single line output for pretty-print (default: false)\n */\n singleLine: Env.getBoolean('LOGGER_PRETTY_SINGLE_LINE', false)\n },\n\n http: {\n /**\n * Timeout for HTTP requests in milliseconds\n */\n timeout: Env.getNumber('HTTP_TIMEOUT', 30000)\n },\n\n cache: {\n /**\n * Default TTL (time to live) for cache entries in seconds\n */\n defaultTtl: Env.getNumber('CACHE_DEFAULT_TTL_SECONDS', 3600) * 1000\n }\n};\n\nexport const defaultServerConfig = {\n port: 3000,\n host: '0.0.0.0',\n cors: false,\n helmet: false,\n compression: false,\n bodyParser: {\n json: { limit: '1mb' },\n urlencoded: { extended: true, limit: '1mb' }\n },\n cookieParser: false,\n isMicroservice: false,\n appName: 'express_app',\n globalHeaders: {},\n rateLimit: {\n enable: false,\n windowMs: 15 * 60 * 1000,\n max: 100,\n message: 'Too many requests',\n standardHeaders: true,\n legacyHeaders: false\n },\n requestLogging: {\n enable: Env.isDev(),\n ignorePaths: (req, _res) => {\n const skipPaths = ['/healthz', '/favicon.ico', '/metrics', '/docs', '/.well-known'];\n return skipPaths.some(path => req.path.startsWith(path));\n },\n skipNotFoundRoutes: false\n },\n openApi: {\n enable: false,\n mountPath: '/docs',\n verbose: false,\n withGlobalPrefix: false\n },\n healthCheck: {\n path: '/healthz',\n detailed: true\n },\n requestTimeout: 30000,\n responseTime: {\n enable: false,\n addHeader: true,\n logOnComplete: false\n },\n requestId: {\n headerName: 'x-request-id',\n exposeHeader: true,\n generator: () => uuid()\n },\n logger: {\n name: 'express_app',\n level: 'info' as LoggerLevels,\n prettyPrint: false,\n singleLine: false\n },\n metrics: {\n enable: false,\n path: '/metrics',\n withGlobalPrefix: false\n },\n serviceVersion: {\n enable: false,\n headerName: 'x-service-version',\n version: '0.0.0'\n }\n} satisfies ServerConfig;\n\n/**\n * Update the @catbee/utils configuration.\n * @param value Partial configuration object.\n */\nexport function setConfig(value: Partial<typeof config>): void {\n deepObjMerge(config, value);\n}\n\n/**\n * Get the current @catbee/utils configuration.\n * @returns The current configuration object.\n */\nexport function getConfig(): typeof config {\n return config;\n}\n"]}
@@ -1,27 +0,0 @@
1
- export { setConfig, getConfig } from './config';
2
- export * from './utils/array.utils';
3
- export * from './utils/async.utils';
4
- export * from './utils/cache.utils';
5
- export * from './utils/context-store.utils';
6
- export * from './utils/crypto.utils';
7
- export * from './utils/decorators.utils';
8
- export * from './utils/dir.utils';
9
- export * from './utils/env.utils';
10
- export * from './utils/exception.utils';
11
- export * from './utils/fs.utils';
12
- export * from './utils/http-status-codes';
13
- export * from './utils/id.utils';
14
- export * from './utils/logger.utils';
15
- export * from './utils/middleware.utils';
16
- export * from './utils/obj.utils';
17
- export * from './utils/request.utils';
18
- export * from './utils/response.utils';
19
- export * from './utils/string.utils';
20
- export * from './utils/url.utils';
21
- export * from './utils/validate.utils';
22
- export * from './types/index';
23
- export * from './types/server';
24
- export * from './types/api-response';
25
- export * from './servers/server';
26
- export * from './servers/server.builder';
27
- //# sourceMappingURL=index.d.ts.map
@@ -1,50 +0,0 @@
1
- /*
2
- * The MIT License
3
- *
4
- * Copyright (c) 2025 Catbee Technologies
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
- export { setConfig, getConfig } from './config';
25
- export * from './utils/array.utils';
26
- export * from './utils/async.utils';
27
- export * from './utils/cache.utils';
28
- export * from './utils/context-store.utils';
29
- export * from './utils/crypto.utils';
30
- export * from './utils/decorators.utils';
31
- export * from './utils/dir.utils';
32
- export * from './utils/env.utils';
33
- export * from './utils/exception.utils';
34
- export * from './utils/fs.utils';
35
- export * from './utils/http-status-codes';
36
- export * from './utils/id.utils';
37
- export * from './utils/logger.utils';
38
- export * from './utils/middleware.utils';
39
- export * from './utils/obj.utils';
40
- export * from './utils/request.utils';
41
- export * from './utils/response.utils';
42
- export * from './utils/string.utils';
43
- export * from './utils/url.utils';
44
- export * from './utils/validate.utils';
45
- export * from './types/index';
46
- export * from './types/server';
47
- export * from './types/api-response';
48
- export * from './servers/server';
49
- export * from './servers/server.builder';
50
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEhD,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AAErC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC","sourcesContent":["/*\n * The MIT License\n *\n * Copyright (c) 2025 Catbee Technologies\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport { setConfig, getConfig } from './config';\n\nexport * from './utils/array.utils';\nexport * from './utils/async.utils';\nexport * from './utils/cache.utils';\nexport * from './utils/context-store.utils';\nexport * from './utils/crypto.utils';\nexport * from './utils/decorators.utils';\nexport * from './utils/dir.utils';\nexport * from './utils/env.utils';\nexport * from './utils/exception.utils';\nexport * from './utils/fs.utils';\nexport * from './utils/http-status-codes';\nexport * from './utils/id.utils';\nexport * from './utils/logger.utils';\nexport * from './utils/middleware.utils';\nexport * from './utils/obj.utils';\nexport * from './utils/request.utils';\nexport * from './utils/response.utils';\nexport * from './utils/string.utils';\nexport * from './utils/url.utils';\nexport * from './utils/validate.utils';\n\nexport * from './types/index';\nexport * from './types/server';\nexport * from './types/api-response';\n\nexport * from './servers/server';\nexport * from './servers/server.builder';\n"]}