@pawells/nestjs-shared 1.0.0-dev.4c8c698

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 (286) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +802 -0
  3. package/build/LICENSE +21 -0
  4. package/build/README.md +802 -0
  5. package/build/common/common.module.d.ts +49 -0
  6. package/build/common/common.module.d.ts.map +1 -0
  7. package/build/common/common.module.js +178 -0
  8. package/build/common/common.module.js.map +1 -0
  9. package/build/common/constants/histogram-buckets.constants.d.ts +12 -0
  10. package/build/common/constants/histogram-buckets.constants.d.ts.map +1 -0
  11. package/build/common/constants/histogram-buckets.constants.js +51 -0
  12. package/build/common/constants/histogram-buckets.constants.js.map +1 -0
  13. package/build/common/constants/http-status.constants.d.ts +27 -0
  14. package/build/common/constants/http-status.constants.d.ts.map +1 -0
  15. package/build/common/constants/http-status.constants.js +27 -0
  16. package/build/common/constants/http-status.constants.js.map +1 -0
  17. package/build/common/constants/timeout.constants.d.ts +29 -0
  18. package/build/common/constants/timeout.constants.d.ts.map +1 -0
  19. package/build/common/constants/timeout.constants.js +45 -0
  20. package/build/common/constants/timeout.constants.js.map +1 -0
  21. package/build/common/controllers/metrics.controller.d.ts +23 -0
  22. package/build/common/controllers/metrics.controller.d.ts.map +1 -0
  23. package/build/common/controllers/metrics.controller.js +66 -0
  24. package/build/common/controllers/metrics.controller.js.map +1 -0
  25. package/build/common/decorators/common-decorators.d.ts +90 -0
  26. package/build/common/decorators/common-decorators.d.ts.map +1 -0
  27. package/build/common/decorators/common-decorators.js +101 -0
  28. package/build/common/decorators/common-decorators.js.map +1 -0
  29. package/build/common/decorators/decorator-factory.d.ts +108 -0
  30. package/build/common/decorators/decorator-factory.d.ts.map +1 -0
  31. package/build/common/decorators/decorator-factory.js +104 -0
  32. package/build/common/decorators/decorator-factory.js.map +1 -0
  33. package/build/common/decorators/guard.decorators.d.ts +48 -0
  34. package/build/common/decorators/guard.decorators.d.ts.map +1 -0
  35. package/build/common/decorators/guard.decorators.js +49 -0
  36. package/build/common/decorators/guard.decorators.js.map +1 -0
  37. package/build/common/decorators/index.d.ts +10 -0
  38. package/build/common/decorators/index.d.ts.map +1 -0
  39. package/build/common/decorators/index.js +11 -0
  40. package/build/common/decorators/index.js.map +1 -0
  41. package/build/common/decorators/instrument.decorator.d.ts +128 -0
  42. package/build/common/decorators/instrument.decorator.d.ts.map +1 -0
  43. package/build/common/decorators/instrument.decorator.js +165 -0
  44. package/build/common/decorators/instrument.decorator.js.map +1 -0
  45. package/build/common/decorators/metric.decorators.d.ts +42 -0
  46. package/build/common/decorators/metric.decorators.d.ts.map +1 -0
  47. package/build/common/decorators/metric.decorators.js +85 -0
  48. package/build/common/decorators/metric.decorators.js.map +1 -0
  49. package/build/common/decorators/request-property.decorator.d.ts +65 -0
  50. package/build/common/decorators/request-property.decorator.d.ts.map +1 -0
  51. package/build/common/decorators/request-property.decorator.js +102 -0
  52. package/build/common/decorators/request-property.decorator.js.map +1 -0
  53. package/build/common/errors/base-application-error.d.ts +98 -0
  54. package/build/common/errors/base-application-error.d.ts.map +1 -0
  55. package/build/common/errors/base-application-error.js +133 -0
  56. package/build/common/errors/base-application-error.js.map +1 -0
  57. package/build/common/errors/error-factory.d.ts +93 -0
  58. package/build/common/errors/error-factory.d.ts.map +1 -0
  59. package/build/common/errors/error-factory.js +105 -0
  60. package/build/common/errors/error-factory.js.map +1 -0
  61. package/build/common/errors/index.d.ts +13 -0
  62. package/build/common/errors/index.d.ts.map +1 -0
  63. package/build/common/errors/index.js +15 -0
  64. package/build/common/errors/index.js.map +1 -0
  65. package/build/common/factories/index.d.ts +5 -0
  66. package/build/common/factories/index.d.ts.map +1 -0
  67. package/build/common/factories/index.js +3 -0
  68. package/build/common/factories/index.js.map +1 -0
  69. package/build/common/factories/module-factory.d.ts +178 -0
  70. package/build/common/factories/module-factory.d.ts.map +1 -0
  71. package/build/common/factories/module-factory.js +253 -0
  72. package/build/common/factories/module-factory.js.map +1 -0
  73. package/build/common/factories/rate-limit-config.factory.d.ts +79 -0
  74. package/build/common/factories/rate-limit-config.factory.d.ts.map +1 -0
  75. package/build/common/factories/rate-limit-config.factory.js +115 -0
  76. package/build/common/factories/rate-limit-config.factory.js.map +1 -0
  77. package/build/common/factories/security-bootstrap.factory.d.ts +77 -0
  78. package/build/common/factories/security-bootstrap.factory.d.ts.map +1 -0
  79. package/build/common/factories/security-bootstrap.factory.js +222 -0
  80. package/build/common/factories/security-bootstrap.factory.js.map +1 -0
  81. package/build/common/filters/global-exception.filter.d.ts +78 -0
  82. package/build/common/filters/global-exception.filter.d.ts.map +1 -0
  83. package/build/common/filters/global-exception.filter.js +192 -0
  84. package/build/common/filters/global-exception.filter.js.map +1 -0
  85. package/build/common/filters/http-exception.filter.d.ts +37 -0
  86. package/build/common/filters/http-exception.filter.d.ts.map +1 -0
  87. package/build/common/filters/http-exception.filter.js +91 -0
  88. package/build/common/filters/http-exception.filter.js.map +1 -0
  89. package/build/common/guards/csrf.guard.d.ts +53 -0
  90. package/build/common/guards/csrf.guard.d.ts.map +1 -0
  91. package/build/common/guards/csrf.guard.js +109 -0
  92. package/build/common/guards/csrf.guard.js.map +1 -0
  93. package/build/common/guards/metrics.guard.d.ts +42 -0
  94. package/build/common/guards/metrics.guard.d.ts.map +1 -0
  95. package/build/common/guards/metrics.guard.js +124 -0
  96. package/build/common/guards/metrics.guard.js.map +1 -0
  97. package/build/common/index.d.ts +43 -0
  98. package/build/common/index.d.ts.map +1 -0
  99. package/build/common/index.js +50 -0
  100. package/build/common/index.js.map +1 -0
  101. package/build/common/interceptors/http-client.interceptor.d.ts +11 -0
  102. package/build/common/interceptors/http-client.interceptor.d.ts.map +1 -0
  103. package/build/common/interceptors/http-client.interceptor.js +69 -0
  104. package/build/common/interceptors/http-client.interceptor.js.map +1 -0
  105. package/build/common/interceptors/http-instrumentation.interceptor.d.ts +64 -0
  106. package/build/common/interceptors/http-instrumentation.interceptor.d.ts.map +1 -0
  107. package/build/common/interceptors/http-instrumentation.interceptor.js +148 -0
  108. package/build/common/interceptors/http-instrumentation.interceptor.js.map +1 -0
  109. package/build/common/interceptors/http-metrics.interceptor.d.ts +46 -0
  110. package/build/common/interceptors/http-metrics.interceptor.d.ts.map +1 -0
  111. package/build/common/interceptors/http-metrics.interceptor.js +120 -0
  112. package/build/common/interceptors/http-metrics.interceptor.js.map +1 -0
  113. package/build/common/interceptors/logging.interceptor.d.ts +22 -0
  114. package/build/common/interceptors/logging.interceptor.d.ts.map +1 -0
  115. package/build/common/interceptors/logging.interceptor.js +67 -0
  116. package/build/common/interceptors/logging.interceptor.js.map +1 -0
  117. package/build/common/interfaces/cache-provider.interface.d.ts +54 -0
  118. package/build/common/interfaces/cache-provider.interface.d.ts.map +1 -0
  119. package/build/common/interfaces/cache-provider.interface.js +6 -0
  120. package/build/common/interfaces/cache-provider.interface.js.map +1 -0
  121. package/build/common/interfaces/index.d.ts +7 -0
  122. package/build/common/interfaces/index.d.ts.map +1 -0
  123. package/build/common/interfaces/index.js +3 -0
  124. package/build/common/interfaces/index.js.map +1 -0
  125. package/build/common/interfaces/log-context.interface.d.ts +77 -0
  126. package/build/common/interfaces/log-context.interface.d.ts.map +1 -0
  127. package/build/common/interfaces/log-context.interface.js +2 -0
  128. package/build/common/interfaces/log-context.interface.js.map +1 -0
  129. package/build/common/interfaces/log-entry.interface.d.ts +26 -0
  130. package/build/common/interfaces/log-entry.interface.d.ts.map +1 -0
  131. package/build/common/interfaces/log-entry.interface.js +33 -0
  132. package/build/common/interfaces/log-entry.interface.js.map +1 -0
  133. package/build/common/interfaces/logger.interface.d.ts +62 -0
  134. package/build/common/interfaces/logger.interface.d.ts.map +1 -0
  135. package/build/common/interfaces/logger.interface.js +2 -0
  136. package/build/common/interfaces/logger.interface.js.map +1 -0
  137. package/build/common/interfaces/metrics-exporter.interface.d.ts +275 -0
  138. package/build/common/interfaces/metrics-exporter.interface.d.ts.map +1 -0
  139. package/build/common/interfaces/metrics-exporter.interface.js +8 -0
  140. package/build/common/interfaces/metrics-exporter.interface.js.map +1 -0
  141. package/build/common/metrics/base-metrics-collector.d.ts +81 -0
  142. package/build/common/metrics/base-metrics-collector.d.ts.map +1 -0
  143. package/build/common/metrics/base-metrics-collector.js +88 -0
  144. package/build/common/metrics/base-metrics-collector.js.map +1 -0
  145. package/build/common/metrics/index.d.ts +2 -0
  146. package/build/common/metrics/index.d.ts.map +1 -0
  147. package/build/common/metrics/index.js +2 -0
  148. package/build/common/metrics/index.js.map +1 -0
  149. package/build/common/metrics.module.d.ts +50 -0
  150. package/build/common/metrics.module.d.ts.map +1 -0
  151. package/build/common/metrics.module.js +77 -0
  152. package/build/common/metrics.module.js.map +1 -0
  153. package/build/common/modules/throttler.module.d.ts +69 -0
  154. package/build/common/modules/throttler.module.d.ts.map +1 -0
  155. package/build/common/modules/throttler.module.js +117 -0
  156. package/build/common/modules/throttler.module.js.map +1 -0
  157. package/build/common/pipes/base-validation.pipe.d.ts +67 -0
  158. package/build/common/pipes/base-validation.pipe.d.ts.map +1 -0
  159. package/build/common/pipes/base-validation.pipe.js +95 -0
  160. package/build/common/pipes/base-validation.pipe.js.map +1 -0
  161. package/build/common/pipes/validation.pipe.d.ts +32 -0
  162. package/build/common/pipes/validation.pipe.d.ts.map +1 -0
  163. package/build/common/pipes/validation.pipe.js +60 -0
  164. package/build/common/pipes/validation.pipe.js.map +1 -0
  165. package/build/common/registry/instrumentation-registry.d.ts +227 -0
  166. package/build/common/registry/instrumentation-registry.d.ts.map +1 -0
  167. package/build/common/registry/instrumentation-registry.js +414 -0
  168. package/build/common/registry/instrumentation-registry.js.map +1 -0
  169. package/build/common/services/audit-logger.service.d.ts +91 -0
  170. package/build/common/services/audit-logger.service.d.ts.map +1 -0
  171. package/build/common/services/audit-logger.service.js +180 -0
  172. package/build/common/services/audit-logger.service.js.map +1 -0
  173. package/build/common/services/csrf.service.d.ts +202 -0
  174. package/build/common/services/csrf.service.d.ts.map +1 -0
  175. package/build/common/services/csrf.service.js +478 -0
  176. package/build/common/services/csrf.service.js.map +1 -0
  177. package/build/common/services/error-categorizer.service.d.ts +82 -0
  178. package/build/common/services/error-categorizer.service.d.ts.map +1 -0
  179. package/build/common/services/error-categorizer.service.js +339 -0
  180. package/build/common/services/error-categorizer.service.js.map +1 -0
  181. package/build/common/services/error-sanitizer.service.d.ts +146 -0
  182. package/build/common/services/error-sanitizer.service.d.ts.map +1 -0
  183. package/build/common/services/error-sanitizer.service.js +287 -0
  184. package/build/common/services/error-sanitizer.service.js.map +1 -0
  185. package/build/common/services/health-check.service.d.ts +86 -0
  186. package/build/common/services/health-check.service.d.ts.map +1 -0
  187. package/build/common/services/health-check.service.js +132 -0
  188. package/build/common/services/health-check.service.js.map +1 -0
  189. package/build/common/services/http-client.service.d.ts +113 -0
  190. package/build/common/services/http-client.service.d.ts.map +1 -0
  191. package/build/common/services/http-client.service.js +294 -0
  192. package/build/common/services/http-client.service.js.map +1 -0
  193. package/build/common/services/logger.service.d.ts +189 -0
  194. package/build/common/services/logger.service.d.ts.map +1 -0
  195. package/build/common/services/logger.service.js +423 -0
  196. package/build/common/services/logger.service.js.map +1 -0
  197. package/build/common/services/metrics-registry.service.d.ts +98 -0
  198. package/build/common/services/metrics-registry.service.d.ts.map +1 -0
  199. package/build/common/services/metrics-registry.service.js +262 -0
  200. package/build/common/services/metrics-registry.service.js.map +1 -0
  201. package/build/common/services/nest-logger-adapter.service.d.ts +62 -0
  202. package/build/common/services/nest-logger-adapter.service.d.ts.map +1 -0
  203. package/build/common/services/nest-logger-adapter.service.js +120 -0
  204. package/build/common/services/nest-logger-adapter.service.js.map +1 -0
  205. package/build/common/utils/error.utils.d.ts +16 -0
  206. package/build/common/utils/error.utils.d.ts.map +1 -0
  207. package/build/common/utils/error.utils.js +26 -0
  208. package/build/common/utils/error.utils.js.map +1 -0
  209. package/build/common/utils/lazy-getter.types.d.ts +190 -0
  210. package/build/common/utils/lazy-getter.types.d.ts.map +1 -0
  211. package/build/common/utils/lazy-getter.types.js +114 -0
  212. package/build/common/utils/lazy-getter.types.js.map +1 -0
  213. package/build/common/utils/module.utils.d.ts +33 -0
  214. package/build/common/utils/module.utils.d.ts.map +1 -0
  215. package/build/common/utils/module.utils.js +48 -0
  216. package/build/common/utils/module.utils.js.map +1 -0
  217. package/build/common/utils/sanitization.utils.d.ts +69 -0
  218. package/build/common/utils/sanitization.utils.d.ts.map +1 -0
  219. package/build/common/utils/sanitization.utils.js +141 -0
  220. package/build/common/utils/sanitization.utils.js.map +1 -0
  221. package/build/config/config.module.d.ts +30 -0
  222. package/build/config/config.module.d.ts.map +1 -0
  223. package/build/config/config.module.js +49 -0
  224. package/build/config/config.module.js.map +1 -0
  225. package/build/config/config.service.d.ts +74 -0
  226. package/build/config/config.service.d.ts.map +1 -0
  227. package/build/config/config.service.js +145 -0
  228. package/build/config/config.service.js.map +1 -0
  229. package/build/config/config.types.d.ts +143 -0
  230. package/build/config/config.types.d.ts.map +1 -0
  231. package/build/config/config.types.js +2 -0
  232. package/build/config/config.types.js.map +1 -0
  233. package/build/config/decorators/config.decorators.d.ts +43 -0
  234. package/build/config/decorators/config.decorators.d.ts.map +1 -0
  235. package/build/config/decorators/config.decorators.js +68 -0
  236. package/build/config/decorators/config.decorators.js.map +1 -0
  237. package/build/config/decorators/index.d.ts +2 -0
  238. package/build/config/decorators/index.d.ts.map +1 -0
  239. package/build/config/decorators/index.js +2 -0
  240. package/build/config/decorators/index.js.map +1 -0
  241. package/build/config/index.d.ts +7 -0
  242. package/build/config/index.d.ts.map +1 -0
  243. package/build/config/index.js +9 -0
  244. package/build/config/index.js.map +1 -0
  245. package/build/config/validation.utils.d.ts +136 -0
  246. package/build/config/validation.utils.d.ts.map +1 -0
  247. package/build/config/validation.utils.js +263 -0
  248. package/build/config/validation.utils.js.map +1 -0
  249. package/build/errors/index.d.ts +9 -0
  250. package/build/errors/index.d.ts.map +1 -0
  251. package/build/errors/index.js +12 -0
  252. package/build/errors/index.js.map +1 -0
  253. package/build/guards/custom-throttle.guard.d.ts +28 -0
  254. package/build/guards/custom-throttle.guard.d.ts.map +1 -0
  255. package/build/guards/custom-throttle.guard.js +52 -0
  256. package/build/guards/custom-throttle.guard.js.map +1 -0
  257. package/build/guards/index.d.ts +2 -0
  258. package/build/guards/index.d.ts.map +1 -0
  259. package/build/guards/index.js +2 -0
  260. package/build/guards/index.js.map +1 -0
  261. package/build/index.d.ts +53 -0
  262. package/build/index.d.ts.map +1 -0
  263. package/build/index.js +61 -0
  264. package/build/index.js.map +1 -0
  265. package/build/logging/index.d.ts +7 -0
  266. package/build/logging/index.d.ts.map +1 -0
  267. package/build/logging/index.js +7 -0
  268. package/build/logging/index.js.map +1 -0
  269. package/build/metrics/index.d.ts +6 -0
  270. package/build/metrics/index.d.ts.map +1 -0
  271. package/build/metrics/index.js +11 -0
  272. package/build/metrics/index.js.map +1 -0
  273. package/build/package.json +72 -0
  274. package/build/security/index.d.ts +8 -0
  275. package/build/security/index.d.ts.map +1 -0
  276. package/build/security/index.js +11 -0
  277. package/build/security/index.js.map +1 -0
  278. package/build/test-setup.d.ts +2 -0
  279. package/build/test-setup.d.ts.map +1 -0
  280. package/build/test-setup.js +40 -0
  281. package/build/test-setup.js.map +1 -0
  282. package/build/validation/index.d.ts +6 -0
  283. package/build/validation/index.d.ts.map +1 -0
  284. package/build/validation/index.js +8 -0
  285. package/build/validation/index.js.map +1 -0
  286. package/package.json +71 -0
@@ -0,0 +1,49 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Module } from '@nestjs/common';
8
+ import { ConfigService } from './config.service.js';
9
+ import { ValidationService } from './validation.utils.js';
10
+ /**
11
+ * Configuration Module.
12
+ * Provides configuration services with environment variable access, validation, and logging.
13
+ * MUST be imported before CommonModule in your application.
14
+ *
15
+ * Exports:
16
+ * - ConfigService: Typed configuration accessor
17
+ * - ValidationService: Configuration validation utilities
18
+ *
19
+ * @remarks
20
+ * - ConfigService is required by CommonModule and other @pawells packages
21
+ * - Initializes logging for configuration operations
22
+ * - Import order critical: ConfigModule must come BEFORE CommonModule
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * @Module({
27
+ * imports: [
28
+ * ConfigModule, // FIRST
29
+ * CommonModule, // SECOND (depends on ConfigModule)
30
+ * MetricsModule.forRoot(),
31
+ * // ... other modules
32
+ * ]
33
+ * })
34
+ * export class AppModule {}
35
+ * ```
36
+ */
37
+ let ConfigModule = class ConfigModule {
38
+ };
39
+ ConfigModule = __decorate([
40
+ Module({
41
+ providers: [
42
+ ConfigService,
43
+ ValidationService,
44
+ ],
45
+ exports: [ConfigService, ValidationService],
46
+ })
47
+ ], ConfigModule);
48
+ export { ConfigModule };
49
+ //# sourceMappingURL=config.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.module.js","sourceRoot":"","sources":["../../src/config/config.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AASI,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,YAAY;IAPxB,MAAM,CAAC;QACP,SAAS,EAAE;YACV,aAAa;YACb,iBAAiB;SACjB;QACD,OAAO,EAAE,CAAC,aAAa,EAAE,iBAAiB,CAAC;KAC3C,CAAC;GACW,YAAY,CAAG"}
@@ -0,0 +1,74 @@
1
+ import { OnModuleInit, OnModuleDestroy } from '@nestjs/common';
2
+ import { ModuleRef } from '@nestjs/core';
3
+ import { LazyModuleRefService } from '../common/utils/lazy-getter.types.js';
4
+ import { AppLogger } from '../common/index.js';
5
+ /**
6
+ * Configuration schema definition interface.
7
+ * Used for validating configuration structure.
8
+ */
9
+ export interface ConfigSchemaDefinition {
10
+ [key: string]: {
11
+ required: boolean;
12
+ [key: string]: any;
13
+ };
14
+ }
15
+ /**
16
+ * Configuration Service.
17
+ * Provides typed access to environment variables with validation and transformation.
18
+ * Extends NestJS ConfigService with additional typed accessor methods (getString, getNumber).
19
+ * Integrates with AppLogger for configuration validation logging.
20
+ *
21
+ * @remarks
22
+ * - Must be imported before CommonModule in your application
23
+ * - Validates configuration at module initialization
24
+ * - Supports type-safe getters for string and number values
25
+ * - Logs all configuration operations for audit trail
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * // Get configuration values
30
+ * const port = configService.getNumber('PORT') ?? 3000;
31
+ * const nodeEnv = configService.getString('NODE_ENV') ?? 'development';
32
+ * const dbUrl = configService.getOrThrow('DATABASE_URL');
33
+ *
34
+ * // Validate configuration
35
+ * configService.validate({
36
+ * PORT: { required: true },
37
+ * DATABASE_URL: { required: true },
38
+ * LOG_LEVEL: { required: false }
39
+ * });
40
+ * ```
41
+ */
42
+ export declare class ConfigService implements LazyModuleRefService, OnModuleInit, OnModuleDestroy {
43
+ private _contextualLogger;
44
+ readonly Module: ModuleRef;
45
+ constructor(module: ModuleRef);
46
+ onModuleInit(): void;
47
+ get Logger(): AppLogger;
48
+ private get NestConfig();
49
+ /**
50
+ * Validate configuration against schema
51
+ */
52
+ validate(schema: ConfigSchemaDefinition): void;
53
+ /**
54
+ * Get configuration value
55
+ */
56
+ get<T = any>(propertyPath: string, defaultValue?: T): T | undefined;
57
+ /**
58
+ * Get configuration value or throw
59
+ */
60
+ getOrThrow<T = any>(propertyPath: string): T;
61
+ /**
62
+ * Get configuration value as string
63
+ */
64
+ getString(propertyPath: string, defaultValue?: string): string | undefined;
65
+ /**
66
+ * Get configuration value as number
67
+ */
68
+ getNumber(propertyPath: string, defaultValue?: number): number | undefined;
69
+ /**
70
+ * Cleanup resources on module destruction
71
+ */
72
+ onModuleDestroy(): void;
73
+ }
74
+ //# sourceMappingURL=config.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.service.d.ts","sourceRoot":"","sources":["../../src/config/config.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG;QACd,QAAQ,EAAE,OAAO,CAAC;QAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACnB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBACa,aAAc,YAAW,oBAAoB,EAAE,YAAY,EAAE,eAAe;IACxF,OAAO,CAAC,iBAAiB,CAAwB;IAEjD,SAAgB,MAAM,EAAE,SAAS,CAAC;gBAEtB,MAAM,EAAE,SAAS;IAItB,YAAY,IAAI,IAAI;IAI3B,IAAW,MAAM,IAAI,SAAS,CAQ7B;IAED,OAAO,KAAK,UAAU,GAErB;IAED;;OAEG;IACI,QAAQ,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI;IAuCrD;;OAEG;IACI,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAI1E;;OAEG;IACI,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;IAInD;;OAEG;IACI,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAMjF;;OAEG;IACI,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOjF;;OAEG;IACI,eAAe,IAAI,IAAI;CAG9B"}
@@ -0,0 +1,145 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var ConfigService_1;
11
+ import { Injectable, Logger } from '@nestjs/common';
12
+ import { ModuleRef } from '@nestjs/core';
13
+ import { ConfigService as NestConfigService } from '@nestjs/config';
14
+ import { AppLogger } from '../common/index.js';
15
+ /**
16
+ * Configuration Service.
17
+ * Provides typed access to environment variables with validation and transformation.
18
+ * Extends NestJS ConfigService with additional typed accessor methods (getString, getNumber).
19
+ * Integrates with AppLogger for configuration validation logging.
20
+ *
21
+ * @remarks
22
+ * - Must be imported before CommonModule in your application
23
+ * - Validates configuration at module initialization
24
+ * - Supports type-safe getters for string and number values
25
+ * - Logs all configuration operations for audit trail
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * // Get configuration values
30
+ * const port = configService.getNumber('PORT') ?? 3000;
31
+ * const nodeEnv = configService.getString('NODE_ENV') ?? 'development';
32
+ * const dbUrl = configService.getOrThrow('DATABASE_URL');
33
+ *
34
+ * // Validate configuration
35
+ * configService.validate({
36
+ * PORT: { required: true },
37
+ * DATABASE_URL: { required: true },
38
+ * LOG_LEVEL: { required: false }
39
+ * });
40
+ * ```
41
+ */
42
+ let ConfigService = ConfigService_1 = class ConfigService {
43
+ _contextualLogger;
44
+ Module;
45
+ constructor(module) {
46
+ this.Module = module;
47
+ }
48
+ onModuleInit() {
49
+ Logger.log('Configuration service initialized', ConfigService_1.name);
50
+ }
51
+ get Logger() {
52
+ if (!this._contextualLogger) {
53
+ const baseLogger = this.Module.get(AppLogger, { strict: false });
54
+ if (baseLogger) {
55
+ this._contextualLogger = baseLogger.createContextualLogger(ConfigService_1.name);
56
+ }
57
+ }
58
+ return this._contextualLogger ?? this.Module.get(AppLogger);
59
+ }
60
+ get NestConfig() {
61
+ return this.Module.get(NestConfigService, { strict: false });
62
+ }
63
+ /**
64
+ * Validate configuration against schema
65
+ */
66
+ validate(schema) {
67
+ const startTime = Date.now();
68
+ this.Logger.debug('Starting configuration validation', {
69
+ schemaKeys: Object.keys(schema).length,
70
+ });
71
+ try {
72
+ // Basic validation - check required fields
73
+ const requiredFields = Object.keys(schema).filter(key => schema[key].required);
74
+ const optionalFields = Object.keys(schema).filter(key => !schema[key].required);
75
+ const missingFields = requiredFields.filter(field => this.get(field) === undefined);
76
+ if (missingFields.length > 0) {
77
+ const durationMs = Date.now() - startTime;
78
+ this.Logger.error('Configuration validation failed', undefined, undefined, {
79
+ missingFields,
80
+ requiredFields: requiredFields.length,
81
+ durationMs,
82
+ });
83
+ throw new Error(`Missing required configuration fields: ${missingFields.join(', ')}`);
84
+ }
85
+ const durationMs = Date.now() - startTime;
86
+ this.Logger.info('Configuration validation successful', {
87
+ validatedFields: Object.keys(schema).length,
88
+ requiredFields: requiredFields.length,
89
+ optionalFields: optionalFields.length,
90
+ durationMs,
91
+ });
92
+ }
93
+ catch (error) {
94
+ const durationMs = Date.now() - startTime;
95
+ this.Logger.error('Configuration validation error', undefined, undefined, {
96
+ error: error instanceof Error ? error.message : String(error),
97
+ durationMs,
98
+ });
99
+ throw error;
100
+ }
101
+ }
102
+ /**
103
+ * Get configuration value
104
+ */
105
+ get(propertyPath, defaultValue) {
106
+ return this.NestConfig.get(propertyPath, defaultValue);
107
+ }
108
+ /**
109
+ * Get configuration value or throw
110
+ */
111
+ getOrThrow(propertyPath) {
112
+ return this.NestConfig.getOrThrow(propertyPath);
113
+ }
114
+ /**
115
+ * Get configuration value as string
116
+ */
117
+ getString(propertyPath, defaultValue) {
118
+ const value = this.get(propertyPath, defaultValue);
119
+ if (value === undefined)
120
+ return undefined;
121
+ return String(value);
122
+ }
123
+ /**
124
+ * Get configuration value as number
125
+ */
126
+ getNumber(propertyPath, defaultValue) {
127
+ const value = this.get(propertyPath, defaultValue);
128
+ if (value === undefined)
129
+ return undefined;
130
+ const num = Number(value);
131
+ return isNaN(num) ? undefined : num;
132
+ }
133
+ /**
134
+ * Cleanup resources on module destruction
135
+ */
136
+ onModuleDestroy() {
137
+ this._contextualLogger = undefined;
138
+ }
139
+ };
140
+ ConfigService = ConfigService_1 = __decorate([
141
+ Injectable(),
142
+ __metadata("design:paramtypes", [ModuleRef])
143
+ ], ConfigService);
144
+ export { ConfigService };
145
+ //# sourceMappingURL=config.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.service.js","sourceRoot":"","sources":["../../src/config/config.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAiC,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAa/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEI,IAAM,aAAa,qBAAnB,MAAM,aAAa;I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M,CAAC,KAAK,CAAC;gBAC7D,UAAU;aACV,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED;;OAEG;IACI,GAAG,CAAU,YAAoB,EAAE,YAAgB;QACzD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACI,UAAU,CAAU,YAAoB;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,YAAoB,EAAE,YAAqB;QAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,YAAoB,EAAE,YAAqB;QAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC1C,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,eAAe;QACrB,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACpC,CAAC;CACD,CAAA;AA5GY,aAAa;IADzB,UAAU,EAAE;qCAMQ,SAAS;GALjB,aAAa,CA4GzB"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Application Configuration Interface
3
+ * Defines top-level application configuration for port, environment, CORS, file uploads, logging, and optional GraphQL settings.
4
+ */
5
+ export interface AppConfig {
6
+ /** Server port number */
7
+ port: number;
8
+ /** Node environment (development, production, test) */
9
+ nodeEnv: string;
10
+ /** CORS origin URL */
11
+ corsOrigin: string;
12
+ /** Maximum file size in bytes */
13
+ maxFileSize: number;
14
+ /** Storage path for uploads */
15
+ storagePath: string;
16
+ /** Log level (debug, info, warn, error, fatal) */
17
+ logLevel: string;
18
+ /** Optional GraphQL configuration */
19
+ graphql?: {
20
+ /** Enable GraphQL Playground */
21
+ playground: boolean;
22
+ /** Enable schema introspection */
23
+ introspection: boolean;
24
+ };
25
+ }
26
+ /**
27
+ * Database Configuration Interface
28
+ * Defines MongoDB/database connection parameters and connection pool options.
29
+ */
30
+ export interface DatabaseConfig {
31
+ /** Database connection URI */
32
+ uri: string;
33
+ /** Optional connection options */
34
+ options?: {
35
+ /** Use new URL parser */
36
+ useNewUrlParser?: boolean;
37
+ /** Use unified topology */
38
+ useUnifiedTopology?: boolean;
39
+ /** Connection pool size */
40
+ maxPoolSize?: number;
41
+ /** Server selection timeout in milliseconds */
42
+ serverSelectionTimeoutMS?: number;
43
+ /** Socket timeout in milliseconds */
44
+ socketTimeoutMS?: number;
45
+ };
46
+ }
47
+ /**
48
+ * Cache Configuration Interface
49
+ * Defines Redis cache connection parameters, timeouts, retry behavior, and performance settings.
50
+ */
51
+ export interface CacheConfig {
52
+ /** Redis host */
53
+ host: string;
54
+ /** Redis port */
55
+ port: number;
56
+ /** Optional Redis password for authentication */
57
+ password?: string;
58
+ /** Redis database number */
59
+ db: number;
60
+ /** Time-to-live (TTL) in seconds for cache entries */
61
+ ttl: number;
62
+ /** Key prefix for all cache entries */
63
+ keyPrefix: string;
64
+ /** Connection timeout in milliseconds */
65
+ connectTimeout: number;
66
+ /** Command timeout in milliseconds */
67
+ commandTimeout: number;
68
+ /** Keep-alive interval in milliseconds */
69
+ keepAlive: number;
70
+ /** Delay between connection retry attempts in milliseconds */
71
+ retryDelay: number;
72
+ /** Maximum number of connection retry attempts */
73
+ maxRetries: number;
74
+ /** Enable ready check before issuing commands */
75
+ enableReadyCheck: boolean;
76
+ /** Defer connection until first command */
77
+ lazyConnect: boolean;
78
+ /** Address family (4 for IPv4, 6 for IPv6) */
79
+ family: number;
80
+ /** Enable Redis metrics collection */
81
+ enableMetrics: boolean;
82
+ }
83
+ /**
84
+ * Authentication Configuration Interface
85
+ * Defines JWT token signing and validation parameters.
86
+ */
87
+ export interface AuthConfig {
88
+ /** JWT token configuration */
89
+ jwt: {
90
+ /** Secret key for signing tokens */
91
+ secret: string;
92
+ /** Token expiration time (e.g., '15m', '1h', '7d') */
93
+ expiresIn: string;
94
+ /** Refresh token expiration time */
95
+ refreshExpiresIn?: string;
96
+ /** Token issuer claim */
97
+ issuer?: string;
98
+ /** Token audience claim */
99
+ audience?: string;
100
+ };
101
+ }
102
+ /**
103
+ * Generic Configuration Validation Result
104
+ * Indicates validation outcome and collects any errors or warnings encountered.
105
+ */
106
+ export interface ValidationResult {
107
+ /** Whether validation passed */
108
+ isValid: boolean;
109
+ /** Array of validation error messages */
110
+ errors?: string[];
111
+ /** Array of validation warning messages */
112
+ warnings?: string[];
113
+ }
114
+ /**
115
+ * Configuration Schema Definition
116
+ * Object map defining validation rules for configuration values.
117
+ */
118
+ export interface ConfigSchema {
119
+ /** Joi schema definition for configuration keys */
120
+ [key: string]: any;
121
+ }
122
+ /**
123
+ * Environment Configuration Options
124
+ * Options for loading and validating environment variables from files and process.env.
125
+ */
126
+ export interface EnvironmentOptions {
127
+ /** Joi schema for validating environment variables */
128
+ validationSchema?: ConfigSchema;
129
+ /** Options passed to Joi schema validation */
130
+ validationOptions?: {
131
+ /** Allow unknown environment variables */
132
+ allowUnknown?: boolean;
133
+ /** Strip unknown environment variables */
134
+ stripUnknown?: boolean;
135
+ };
136
+ /** Skip loading from .env files */
137
+ ignoreEnvFile?: boolean;
138
+ /** Skip reading from process.env */
139
+ ignoreEnvVars?: boolean;
140
+ /** Path(s) to .env files to load */
141
+ envFilePath?: string | string[];
142
+ }
143
+ //# sourceMappingURL=config.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../src/config/config.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,SAAS;IACzB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,OAAO,CAAC,EAAE;QACT,gCAAgC;QAChC,UAAU,EAAE,OAAO,CAAC;QACpB,kCAAkC;QAClC,aAAa,EAAE,OAAO,CAAC;KACvB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,OAAO,CAAC,EAAE;QACT,yBAAyB;QACzB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,2BAA2B;QAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,2BAA2B;QAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,+CAA+C;QAC/C,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAClC,qCAAqC;QACrC,eAAe,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,SAAS,EAA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,CAAC,EAAE,OAAO,CAAC;QACvB,0CAA0C;QAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,mCAAmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oCAAoC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAChC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.types.js","sourceRoot":"","sources":["../../src/config/config.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Configuration Value decorator
3
+ *
4
+ * Extracts configuration values from the application config service.
5
+ * The config service must be available in the request context.
6
+ *
7
+ * @param key - Configuration key to extract
8
+ * @param defaultValue - Default value if key not found
9
+ * @returns Parameter decorator
10
+ *
11
+ * @example
12
+ * // Extract database URL
13
+ * @Get('config')
14
+ * getConfig(@ConfigValue('database.url') dbUrl: string) {}
15
+ *
16
+ * @example
17
+ * // Extract with default
18
+ * @Get('config')
19
+ * getConfig(@ConfigValue('app.port', 3000) port: number) {}
20
+ */
21
+ export declare function ConfigValue<T = any>(key: string, defaultValue?: T): any;
22
+ /**
23
+ * Environment Variable decorator
24
+ *
25
+ * Extracts environment variables from process.env.
26
+ * Provides a convenient way to inject environment variables into parameters.
27
+ *
28
+ * @param key - Environment variable name
29
+ * @param defaultValue - Default value if environment variable not set
30
+ * @returns Parameter decorator
31
+ *
32
+ * @example
33
+ * // Extract NODE_ENV
34
+ * @Get('env')
35
+ * getEnv(@EnvVar('NODE_ENV') nodeEnv: string) {}
36
+ *
37
+ * @example
38
+ * // Extract with default
39
+ * @Get('env')
40
+ * getEnv(@EnvVar('PORT', '3000') port: string) {}
41
+ */
42
+ export declare function EnvVar<T = string>(key: string, defaultValue?: T): any;
43
+ //# sourceMappingURL=config.decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.decorators.d.ts","sourceRoot":"","sources":["../../../src/config/decorators/config.decorators.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,GAAG,CAKvE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,GAAG,CAmBrE"}
@@ -0,0 +1,68 @@
1
+ import { RequestProperty } from '../../common/index.js';
2
+ /**
3
+ * Configuration Value decorator
4
+ *
5
+ * Extracts configuration values from the application config service.
6
+ * The config service must be available in the request context.
7
+ *
8
+ * @param key - Configuration key to extract
9
+ * @param defaultValue - Default value if key not found
10
+ * @returns Parameter decorator
11
+ *
12
+ * @example
13
+ * // Extract database URL
14
+ * @Get('config')
15
+ * getConfig(@ConfigValue('database.url') dbUrl: string) {}
16
+ *
17
+ * @example
18
+ * // Extract with default
19
+ * @Get('config')
20
+ * getConfig(@ConfigValue('app.port', 3000) port: number) {}
21
+ */
22
+ export function ConfigValue(key, defaultValue) {
23
+ return RequestProperty(`config.${key}`, {
24
+ defaultValue,
25
+ transform: (value) => value ?? defaultValue,
26
+ });
27
+ }
28
+ /**
29
+ * Environment Variable decorator
30
+ *
31
+ * Extracts environment variables from process.env.
32
+ * Provides a convenient way to inject environment variables into parameters.
33
+ *
34
+ * @param key - Environment variable name
35
+ * @param defaultValue - Default value if environment variable not set
36
+ * @returns Parameter decorator
37
+ *
38
+ * @example
39
+ * // Extract NODE_ENV
40
+ * @Get('env')
41
+ * getEnv(@EnvVar('NODE_ENV') nodeEnv: string) {}
42
+ *
43
+ * @example
44
+ * // Extract with default
45
+ * @Get('env')
46
+ * getEnv(@EnvVar('PORT', '3000') port: string) {}
47
+ */
48
+ export function EnvVar(key, defaultValue) {
49
+ return RequestProperty(`env.${key}`, {
50
+ defaultValue,
51
+ transform: (value) => {
52
+ // Get from process.env
53
+ const envValue = process.env[key];
54
+ if (envValue !== undefined) {
55
+ // Basic type conversion for common types
56
+ if (typeof defaultValue === 'number') {
57
+ return Number(envValue);
58
+ }
59
+ if (typeof defaultValue === 'boolean') {
60
+ return envValue.toLowerCase() === 'true';
61
+ }
62
+ return envValue;
63
+ }
64
+ return value ?? defaultValue;
65
+ },
66
+ });
67
+ }
68
+ //# sourceMappingURL=config.decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.decorators.js","sourceRoot":"","sources":["../../../src/config/decorators/config.decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CAAU,GAAW,EAAE,YAAgB;IACjE,OAAO,eAAe,CAAC,UAAU,GAAG,EAAE,EAAE;QACvC,YAAY;QACZ,SAAS,EAAE,CAAC,KAAQ,EAAE,EAAE,CAAC,KAAK,IAAI,YAAY;KAC9C,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,MAAM,CAAa,GAAW,EAAE,YAAgB;IAC/D,OAAO,eAAe,CAAC,OAAO,GAAG,EAAE,EAAE;QACpC,YAAY;QACZ,SAAS,EAAE,CAAC,KAAQ,EAAE,EAAE;YACvB,uBAAuB;YACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC5B,yCAAyC;gBACzC,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;oBACtC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACzB,CAAC;gBACD,IAAI,OAAO,YAAY,KAAK,SAAS,EAAE,CAAC;oBACvC,OAAO,QAAQ,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;gBAC1C,CAAC;gBACD,OAAO,QAAQ,CAAC;YACjB,CAAC;YACD,OAAO,KAAK,IAAI,YAAY,CAAC;QAC9B,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ConfigValue, EnvVar } from './config.decorators.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ConfigValue, EnvVar } from './config.decorators.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { ConfigService } from './config.service.js';
2
+ export { ValidationService } from './validation.utils.js';
3
+ export { ConfigModule } from './config.module.js';
4
+ export type { AppConfig, DatabaseConfig, CacheConfig, AuthConfig, ValidationResult, ConfigSchema, EnvironmentOptions, } from './config.types.js';
5
+ export { CreateValidationSchema, ValidateConfig, CreateStringSchema, CreateNumberSchema, CreateBooleanSchema, CreateUriSchema, CreatePortSchema, CreateEnvironmentSchema, CreateJwtExpirationSchema, } from './validation.utils.js';
6
+ export * from './decorators/index.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,YAAY,EACX,SAAS,EACT,cAAc,EACd,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,GAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAG/B,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,9 @@
1
+ // Main exports
2
+ export { ConfigService } from './config.service.js';
3
+ export { ValidationService } from './validation.utils.js';
4
+ export { ConfigModule } from './config.module.js';
5
+ // Validation utilities
6
+ export { CreateValidationSchema, ValidateConfig, CreateStringSchema, CreateNumberSchema, CreateBooleanSchema, CreateUriSchema, CreatePortSchema, CreateEnvironmentSchema, CreateJwtExpirationSchema, } from './validation.utils.js';
7
+ // Decorators
8
+ export * from './decorators/index.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAalD,uBAAuB;AACvB,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,aAAa;AACb,cAAc,uBAAuB,CAAC"}