@pawells/nestjs-shared 1.0.0-dev.3052c75
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/LICENSE +21 -0
- package/README.md +802 -0
- package/build/LICENSE +21 -0
- package/build/README.md +802 -0
- package/build/common/common.module.d.ts +49 -0
- package/build/common/common.module.d.ts.map +1 -0
- package/build/common/common.module.js +178 -0
- package/build/common/common.module.js.map +1 -0
- package/build/common/constants/histogram-buckets.constants.d.ts +12 -0
- package/build/common/constants/histogram-buckets.constants.d.ts.map +1 -0
- package/build/common/constants/histogram-buckets.constants.js +51 -0
- package/build/common/constants/histogram-buckets.constants.js.map +1 -0
- package/build/common/constants/http-status.constants.d.ts +27 -0
- package/build/common/constants/http-status.constants.d.ts.map +1 -0
- package/build/common/constants/http-status.constants.js +27 -0
- package/build/common/constants/http-status.constants.js.map +1 -0
- package/build/common/constants/timeout.constants.d.ts +29 -0
- package/build/common/constants/timeout.constants.d.ts.map +1 -0
- package/build/common/constants/timeout.constants.js +45 -0
- package/build/common/constants/timeout.constants.js.map +1 -0
- package/build/common/controllers/metrics.controller.d.ts +23 -0
- package/build/common/controllers/metrics.controller.d.ts.map +1 -0
- package/build/common/controllers/metrics.controller.js +66 -0
- package/build/common/controllers/metrics.controller.js.map +1 -0
- package/build/common/decorators/common-decorators.d.ts +90 -0
- package/build/common/decorators/common-decorators.d.ts.map +1 -0
- package/build/common/decorators/common-decorators.js +101 -0
- package/build/common/decorators/common-decorators.js.map +1 -0
- package/build/common/decorators/decorator-factory.d.ts +108 -0
- package/build/common/decorators/decorator-factory.d.ts.map +1 -0
- package/build/common/decorators/decorator-factory.js +104 -0
- package/build/common/decorators/decorator-factory.js.map +1 -0
- package/build/common/decorators/guard.decorators.d.ts +48 -0
- package/build/common/decorators/guard.decorators.d.ts.map +1 -0
- package/build/common/decorators/guard.decorators.js +49 -0
- package/build/common/decorators/guard.decorators.js.map +1 -0
- package/build/common/decorators/index.d.ts +10 -0
- package/build/common/decorators/index.d.ts.map +1 -0
- package/build/common/decorators/index.js +11 -0
- package/build/common/decorators/index.js.map +1 -0
- package/build/common/decorators/instrument.decorator.d.ts +128 -0
- package/build/common/decorators/instrument.decorator.d.ts.map +1 -0
- package/build/common/decorators/instrument.decorator.js +165 -0
- package/build/common/decorators/instrument.decorator.js.map +1 -0
- package/build/common/decorators/metric.decorators.d.ts +42 -0
- package/build/common/decorators/metric.decorators.d.ts.map +1 -0
- package/build/common/decorators/metric.decorators.js +85 -0
- package/build/common/decorators/metric.decorators.js.map +1 -0
- package/build/common/decorators/request-property.decorator.d.ts +65 -0
- package/build/common/decorators/request-property.decorator.d.ts.map +1 -0
- package/build/common/decorators/request-property.decorator.js +102 -0
- package/build/common/decorators/request-property.decorator.js.map +1 -0
- package/build/common/errors/base-application-error.d.ts +98 -0
- package/build/common/errors/base-application-error.d.ts.map +1 -0
- package/build/common/errors/base-application-error.js +133 -0
- package/build/common/errors/base-application-error.js.map +1 -0
- package/build/common/errors/error-factory.d.ts +93 -0
- package/build/common/errors/error-factory.d.ts.map +1 -0
- package/build/common/errors/error-factory.js +105 -0
- package/build/common/errors/error-factory.js.map +1 -0
- package/build/common/errors/index.d.ts +13 -0
- package/build/common/errors/index.d.ts.map +1 -0
- package/build/common/errors/index.js +15 -0
- package/build/common/errors/index.js.map +1 -0
- package/build/common/factories/index.d.ts +5 -0
- package/build/common/factories/index.d.ts.map +1 -0
- package/build/common/factories/index.js +3 -0
- package/build/common/factories/index.js.map +1 -0
- package/build/common/factories/module-factory.d.ts +178 -0
- package/build/common/factories/module-factory.d.ts.map +1 -0
- package/build/common/factories/module-factory.js +253 -0
- package/build/common/factories/module-factory.js.map +1 -0
- package/build/common/factories/rate-limit-config.factory.d.ts +79 -0
- package/build/common/factories/rate-limit-config.factory.d.ts.map +1 -0
- package/build/common/factories/rate-limit-config.factory.js +115 -0
- package/build/common/factories/rate-limit-config.factory.js.map +1 -0
- package/build/common/factories/security-bootstrap.factory.d.ts +77 -0
- package/build/common/factories/security-bootstrap.factory.d.ts.map +1 -0
- package/build/common/factories/security-bootstrap.factory.js +222 -0
- package/build/common/factories/security-bootstrap.factory.js.map +1 -0
- package/build/common/filters/global-exception.filter.d.ts +78 -0
- package/build/common/filters/global-exception.filter.d.ts.map +1 -0
- package/build/common/filters/global-exception.filter.js +192 -0
- package/build/common/filters/global-exception.filter.js.map +1 -0
- package/build/common/filters/http-exception.filter.d.ts +37 -0
- package/build/common/filters/http-exception.filter.d.ts.map +1 -0
- package/build/common/filters/http-exception.filter.js +91 -0
- package/build/common/filters/http-exception.filter.js.map +1 -0
- package/build/common/guards/csrf.guard.d.ts +53 -0
- package/build/common/guards/csrf.guard.d.ts.map +1 -0
- package/build/common/guards/csrf.guard.js +109 -0
- package/build/common/guards/csrf.guard.js.map +1 -0
- package/build/common/guards/metrics.guard.d.ts +42 -0
- package/build/common/guards/metrics.guard.d.ts.map +1 -0
- package/build/common/guards/metrics.guard.js +124 -0
- package/build/common/guards/metrics.guard.js.map +1 -0
- package/build/common/index.d.ts +43 -0
- package/build/common/index.d.ts.map +1 -0
- package/build/common/index.js +50 -0
- package/build/common/index.js.map +1 -0
- package/build/common/interceptors/http-client.interceptor.d.ts +11 -0
- package/build/common/interceptors/http-client.interceptor.d.ts.map +1 -0
- package/build/common/interceptors/http-client.interceptor.js +69 -0
- package/build/common/interceptors/http-client.interceptor.js.map +1 -0
- package/build/common/interceptors/http-instrumentation.interceptor.d.ts +64 -0
- package/build/common/interceptors/http-instrumentation.interceptor.d.ts.map +1 -0
- package/build/common/interceptors/http-instrumentation.interceptor.js +148 -0
- package/build/common/interceptors/http-instrumentation.interceptor.js.map +1 -0
- package/build/common/interceptors/http-metrics.interceptor.d.ts +46 -0
- package/build/common/interceptors/http-metrics.interceptor.d.ts.map +1 -0
- package/build/common/interceptors/http-metrics.interceptor.js +120 -0
- package/build/common/interceptors/http-metrics.interceptor.js.map +1 -0
- package/build/common/interceptors/logging.interceptor.d.ts +22 -0
- package/build/common/interceptors/logging.interceptor.d.ts.map +1 -0
- package/build/common/interceptors/logging.interceptor.js +67 -0
- package/build/common/interceptors/logging.interceptor.js.map +1 -0
- package/build/common/interfaces/cache-provider.interface.d.ts +54 -0
- package/build/common/interfaces/cache-provider.interface.d.ts.map +1 -0
- package/build/common/interfaces/cache-provider.interface.js +6 -0
- package/build/common/interfaces/cache-provider.interface.js.map +1 -0
- package/build/common/interfaces/index.d.ts +7 -0
- package/build/common/interfaces/index.d.ts.map +1 -0
- package/build/common/interfaces/index.js +3 -0
- package/build/common/interfaces/index.js.map +1 -0
- package/build/common/interfaces/log-context.interface.d.ts +77 -0
- package/build/common/interfaces/log-context.interface.d.ts.map +1 -0
- package/build/common/interfaces/log-context.interface.js +2 -0
- package/build/common/interfaces/log-context.interface.js.map +1 -0
- package/build/common/interfaces/log-entry.interface.d.ts +26 -0
- package/build/common/interfaces/log-entry.interface.d.ts.map +1 -0
- package/build/common/interfaces/log-entry.interface.js +33 -0
- package/build/common/interfaces/log-entry.interface.js.map +1 -0
- package/build/common/interfaces/logger.interface.d.ts +62 -0
- package/build/common/interfaces/logger.interface.d.ts.map +1 -0
- package/build/common/interfaces/logger.interface.js +2 -0
- package/build/common/interfaces/logger.interface.js.map +1 -0
- package/build/common/interfaces/metrics-exporter.interface.d.ts +275 -0
- package/build/common/interfaces/metrics-exporter.interface.d.ts.map +1 -0
- package/build/common/interfaces/metrics-exporter.interface.js +8 -0
- package/build/common/interfaces/metrics-exporter.interface.js.map +1 -0
- package/build/common/metrics/base-metrics-collector.d.ts +81 -0
- package/build/common/metrics/base-metrics-collector.d.ts.map +1 -0
- package/build/common/metrics/base-metrics-collector.js +88 -0
- package/build/common/metrics/base-metrics-collector.js.map +1 -0
- package/build/common/metrics/index.d.ts +2 -0
- package/build/common/metrics/index.d.ts.map +1 -0
- package/build/common/metrics/index.js +2 -0
- package/build/common/metrics/index.js.map +1 -0
- package/build/common/metrics.module.d.ts +50 -0
- package/build/common/metrics.module.d.ts.map +1 -0
- package/build/common/metrics.module.js +77 -0
- package/build/common/metrics.module.js.map +1 -0
- package/build/common/modules/throttler.module.d.ts +69 -0
- package/build/common/modules/throttler.module.d.ts.map +1 -0
- package/build/common/modules/throttler.module.js +117 -0
- package/build/common/modules/throttler.module.js.map +1 -0
- package/build/common/pipes/base-validation.pipe.d.ts +67 -0
- package/build/common/pipes/base-validation.pipe.d.ts.map +1 -0
- package/build/common/pipes/base-validation.pipe.js +95 -0
- package/build/common/pipes/base-validation.pipe.js.map +1 -0
- package/build/common/pipes/validation.pipe.d.ts +32 -0
- package/build/common/pipes/validation.pipe.d.ts.map +1 -0
- package/build/common/pipes/validation.pipe.js +60 -0
- package/build/common/pipes/validation.pipe.js.map +1 -0
- package/build/common/registry/instrumentation-registry.d.ts +227 -0
- package/build/common/registry/instrumentation-registry.d.ts.map +1 -0
- package/build/common/registry/instrumentation-registry.js +414 -0
- package/build/common/registry/instrumentation-registry.js.map +1 -0
- package/build/common/services/audit-logger.service.d.ts +91 -0
- package/build/common/services/audit-logger.service.d.ts.map +1 -0
- package/build/common/services/audit-logger.service.js +180 -0
- package/build/common/services/audit-logger.service.js.map +1 -0
- package/build/common/services/csrf.service.d.ts +202 -0
- package/build/common/services/csrf.service.d.ts.map +1 -0
- package/build/common/services/csrf.service.js +478 -0
- package/build/common/services/csrf.service.js.map +1 -0
- package/build/common/services/error-categorizer.service.d.ts +82 -0
- package/build/common/services/error-categorizer.service.d.ts.map +1 -0
- package/build/common/services/error-categorizer.service.js +339 -0
- package/build/common/services/error-categorizer.service.js.map +1 -0
- package/build/common/services/error-sanitizer.service.d.ts +146 -0
- package/build/common/services/error-sanitizer.service.d.ts.map +1 -0
- package/build/common/services/error-sanitizer.service.js +287 -0
- package/build/common/services/error-sanitizer.service.js.map +1 -0
- package/build/common/services/health-check.service.d.ts +86 -0
- package/build/common/services/health-check.service.d.ts.map +1 -0
- package/build/common/services/health-check.service.js +132 -0
- package/build/common/services/health-check.service.js.map +1 -0
- package/build/common/services/http-client.service.d.ts +113 -0
- package/build/common/services/http-client.service.d.ts.map +1 -0
- package/build/common/services/http-client.service.js +294 -0
- package/build/common/services/http-client.service.js.map +1 -0
- package/build/common/services/logger.service.d.ts +189 -0
- package/build/common/services/logger.service.d.ts.map +1 -0
- package/build/common/services/logger.service.js +423 -0
- package/build/common/services/logger.service.js.map +1 -0
- package/build/common/services/metrics-registry.service.d.ts +98 -0
- package/build/common/services/metrics-registry.service.d.ts.map +1 -0
- package/build/common/services/metrics-registry.service.js +262 -0
- package/build/common/services/metrics-registry.service.js.map +1 -0
- package/build/common/services/nest-logger-adapter.service.d.ts +62 -0
- package/build/common/services/nest-logger-adapter.service.d.ts.map +1 -0
- package/build/common/services/nest-logger-adapter.service.js +120 -0
- package/build/common/services/nest-logger-adapter.service.js.map +1 -0
- package/build/common/utils/error.utils.d.ts +16 -0
- package/build/common/utils/error.utils.d.ts.map +1 -0
- package/build/common/utils/error.utils.js +26 -0
- package/build/common/utils/error.utils.js.map +1 -0
- package/build/common/utils/lazy-getter.types.d.ts +190 -0
- package/build/common/utils/lazy-getter.types.d.ts.map +1 -0
- package/build/common/utils/lazy-getter.types.js +114 -0
- package/build/common/utils/lazy-getter.types.js.map +1 -0
- package/build/common/utils/module.utils.d.ts +33 -0
- package/build/common/utils/module.utils.d.ts.map +1 -0
- package/build/common/utils/module.utils.js +48 -0
- package/build/common/utils/module.utils.js.map +1 -0
- package/build/common/utils/sanitization.utils.d.ts +69 -0
- package/build/common/utils/sanitization.utils.d.ts.map +1 -0
- package/build/common/utils/sanitization.utils.js +141 -0
- package/build/common/utils/sanitization.utils.js.map +1 -0
- package/build/config/config.module.d.ts +30 -0
- package/build/config/config.module.d.ts.map +1 -0
- package/build/config/config.module.js +49 -0
- package/build/config/config.module.js.map +1 -0
- package/build/config/config.service.d.ts +74 -0
- package/build/config/config.service.d.ts.map +1 -0
- package/build/config/config.service.js +145 -0
- package/build/config/config.service.js.map +1 -0
- package/build/config/config.types.d.ts +143 -0
- package/build/config/config.types.d.ts.map +1 -0
- package/build/config/config.types.js +2 -0
- package/build/config/config.types.js.map +1 -0
- package/build/config/decorators/config.decorators.d.ts +43 -0
- package/build/config/decorators/config.decorators.d.ts.map +1 -0
- package/build/config/decorators/config.decorators.js +68 -0
- package/build/config/decorators/config.decorators.js.map +1 -0
- package/build/config/decorators/index.d.ts +2 -0
- package/build/config/decorators/index.d.ts.map +1 -0
- package/build/config/decorators/index.js +2 -0
- package/build/config/decorators/index.js.map +1 -0
- package/build/config/index.d.ts +7 -0
- package/build/config/index.d.ts.map +1 -0
- package/build/config/index.js +9 -0
- package/build/config/index.js.map +1 -0
- package/build/config/validation.utils.d.ts +136 -0
- package/build/config/validation.utils.d.ts.map +1 -0
- package/build/config/validation.utils.js +263 -0
- package/build/config/validation.utils.js.map +1 -0
- package/build/errors/index.d.ts +9 -0
- package/build/errors/index.d.ts.map +1 -0
- package/build/errors/index.js +12 -0
- package/build/errors/index.js.map +1 -0
- package/build/guards/custom-throttle.guard.d.ts +28 -0
- package/build/guards/custom-throttle.guard.d.ts.map +1 -0
- package/build/guards/custom-throttle.guard.js +52 -0
- package/build/guards/custom-throttle.guard.js.map +1 -0
- package/build/guards/index.d.ts +2 -0
- package/build/guards/index.d.ts.map +1 -0
- package/build/guards/index.js +2 -0
- package/build/guards/index.js.map +1 -0
- package/build/index.d.ts +53 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +61 -0
- package/build/index.js.map +1 -0
- package/build/logging/index.d.ts +7 -0
- package/build/logging/index.d.ts.map +1 -0
- package/build/logging/index.js +7 -0
- package/build/logging/index.js.map +1 -0
- package/build/metrics/index.d.ts +6 -0
- package/build/metrics/index.d.ts.map +1 -0
- package/build/metrics/index.js +11 -0
- package/build/metrics/index.js.map +1 -0
- package/build/package.json +72 -0
- package/build/security/index.d.ts +8 -0
- package/build/security/index.d.ts.map +1 -0
- package/build/security/index.js +11 -0
- package/build/security/index.js.map +1 -0
- package/build/test-setup.d.ts +2 -0
- package/build/test-setup.d.ts.map +1 -0
- package/build/test-setup.js +40 -0
- package/build/test-setup.js.map +1 -0
- package/build/validation/index.d.ts +6 -0
- package/build/validation/index.d.ts.map +1 -0
- package/build/validation/index.js +8 -0
- package/build/validation/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ModuleRef } from '@nestjs/core';
|
|
2
|
+
import Joi from 'joi';
|
|
3
|
+
import type { ConfigSchema, ValidationResult } from './config.types.js';
|
|
4
|
+
import { LazyModuleRefService } from '../common/utils/lazy-getter.types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration Validation Service
|
|
7
|
+
* Provides validation utilities with logging
|
|
8
|
+
*/
|
|
9
|
+
export declare class ValidationService implements LazyModuleRefService {
|
|
10
|
+
private _contextualLogger;
|
|
11
|
+
readonly Module: ModuleRef;
|
|
12
|
+
constructor(module: ModuleRef);
|
|
13
|
+
private get logger();
|
|
14
|
+
/**
|
|
15
|
+
* Create a validation schema for environment variables.
|
|
16
|
+
* @param schema - Joi schema definition object with validation rules
|
|
17
|
+
* @returns Compiled Joi ObjectSchema ready for validation
|
|
18
|
+
*/
|
|
19
|
+
createValidationSchema(schema: ConfigSchema): Joi.ObjectSchema;
|
|
20
|
+
/**
|
|
21
|
+
* Validate configuration against a schema.
|
|
22
|
+
* @param config - Configuration object to validate
|
|
23
|
+
* @param schema - Joi validation schema
|
|
24
|
+
* @returns ValidationResult with isValid flag and optional errors array
|
|
25
|
+
*/
|
|
26
|
+
validateConfig(config: any, schema: Joi.ObjectSchema): ValidationResult;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a validation schema for environment variables.
|
|
30
|
+
* Utility function to compile a configuration object into a Joi validation schema.
|
|
31
|
+
* @param schema - Joi schema definition object with validation rules
|
|
32
|
+
* @returns Compiled Joi ObjectSchema ready for validation
|
|
33
|
+
*/
|
|
34
|
+
export declare function CreateValidationSchema(schema: ConfigSchema): Joi.ObjectSchema;
|
|
35
|
+
/**
|
|
36
|
+
* Validate configuration against a schema.
|
|
37
|
+
* Utility function to validate a configuration object using a Joi schema.
|
|
38
|
+
* @param config - Configuration object to validate
|
|
39
|
+
* @param schema - Joi validation schema
|
|
40
|
+
* @returns ValidationResult with isValid flag and optional errors array
|
|
41
|
+
*/
|
|
42
|
+
export declare function ValidateConfig(config: any, schema: Joi.ObjectSchema): ValidationResult;
|
|
43
|
+
/**
|
|
44
|
+
* Create a string validation schema with common patterns.
|
|
45
|
+
* Utility to build Joi string schemas with min/max length, pattern matching, and defaults.
|
|
46
|
+
* @param options - String schema options
|
|
47
|
+
* @param options.min - Minimum string length
|
|
48
|
+
* @param options.max - Maximum string length
|
|
49
|
+
* @param options.required - Whether the field is required
|
|
50
|
+
* @param options.pattern - Regular expression pattern to match
|
|
51
|
+
* @param options.default - Default value if not provided
|
|
52
|
+
* @param options.description - Human-readable description
|
|
53
|
+
* @returns Configured Joi StringSchema
|
|
54
|
+
*/
|
|
55
|
+
export declare function CreateStringSchema(options?: {
|
|
56
|
+
min?: number;
|
|
57
|
+
max?: number;
|
|
58
|
+
required?: boolean;
|
|
59
|
+
pattern?: RegExp;
|
|
60
|
+
default?: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
}): Joi.StringSchema;
|
|
63
|
+
/**
|
|
64
|
+
* Create a number validation schema with common patterns.
|
|
65
|
+
* Utility to build Joi number schemas with min/max bounds, integer constraint, and defaults.
|
|
66
|
+
* @param options - Number schema options
|
|
67
|
+
* @param options.min - Minimum numeric value
|
|
68
|
+
* @param options.max - Maximum numeric value
|
|
69
|
+
* @param options.integer - Whether value must be an integer
|
|
70
|
+
* @param options.required - Whether the field is required
|
|
71
|
+
* @param options.default - Default value if not provided
|
|
72
|
+
* @param options.description - Human-readable description
|
|
73
|
+
* @returns Configured Joi NumberSchema
|
|
74
|
+
*/
|
|
75
|
+
export declare function CreateNumberSchema(options?: {
|
|
76
|
+
min?: number;
|
|
77
|
+
max?: number;
|
|
78
|
+
integer?: boolean;
|
|
79
|
+
required?: boolean;
|
|
80
|
+
default?: number;
|
|
81
|
+
description?: string;
|
|
82
|
+
}): Joi.NumberSchema;
|
|
83
|
+
/**
|
|
84
|
+
* Create a boolean validation schema.
|
|
85
|
+
* Utility to build Joi boolean schemas with required flag and defaults.
|
|
86
|
+
* @param options - Boolean schema options
|
|
87
|
+
* @param options.required - Whether the field is required
|
|
88
|
+
* @param options.default - Default value if not provided
|
|
89
|
+
* @param options.description - Human-readable description
|
|
90
|
+
* @returns Configured Joi BooleanSchema
|
|
91
|
+
*/
|
|
92
|
+
export declare function CreateBooleanSchema(options?: {
|
|
93
|
+
required?: boolean;
|
|
94
|
+
default?: boolean;
|
|
95
|
+
description?: string;
|
|
96
|
+
}): Joi.BooleanSchema;
|
|
97
|
+
/**
|
|
98
|
+
* Create a URI validation schema.
|
|
99
|
+
* Utility to build Joi string schemas that validate RFC 3986 URIs.
|
|
100
|
+
* @param options - URI schema options
|
|
101
|
+
* @param options.required - Whether the field is required
|
|
102
|
+
* @param options.default - Default value if not provided
|
|
103
|
+
* @param options.description - Human-readable description
|
|
104
|
+
* @returns Configured Joi StringSchema with URI validation
|
|
105
|
+
*/
|
|
106
|
+
export declare function CreateUriSchema(options?: {
|
|
107
|
+
required?: boolean;
|
|
108
|
+
default?: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
}): Joi.StringSchema;
|
|
111
|
+
/**
|
|
112
|
+
* Create validation schema for port numbers.
|
|
113
|
+
* Utility to build Joi number schemas for TCP/UDP port validation (1-65535).
|
|
114
|
+
* @param defaultValue - Default port number (default: 3000)
|
|
115
|
+
* @param description - Human-readable description
|
|
116
|
+
* @returns Configured Joi NumberSchema for port validation
|
|
117
|
+
*/
|
|
118
|
+
export declare function CreatePortSchema(defaultValue?: number, description?: string): Joi.NumberSchema;
|
|
119
|
+
/**
|
|
120
|
+
* Create validation schema for environment variables.
|
|
121
|
+
* Utility to build Joi string schemas that restrict values to a whitelist of environments.
|
|
122
|
+
* @param allowedValues - Array of allowed environment values (default: development, production, test)
|
|
123
|
+
* @param defaultValue - Default environment value (default: development)
|
|
124
|
+
* @param description - Human-readable description
|
|
125
|
+
* @returns Configured Joi StringSchema with environment validation
|
|
126
|
+
*/
|
|
127
|
+
export declare function CreateEnvironmentSchema(allowedValues?: string[], defaultValue?: string, description?: string): Joi.StringSchema;
|
|
128
|
+
/**
|
|
129
|
+
* Create validation schema for JWT expiration times.
|
|
130
|
+
* Utility to build Joi string schemas that validate JWT expiration duration format (e.g., 15m, 1h, 7d).
|
|
131
|
+
* @param defaultValue - Default expiration time (default: 15m)
|
|
132
|
+
* @param description - Human-readable description
|
|
133
|
+
* @returns Configured Joi StringSchema with JWT expiration validation
|
|
134
|
+
*/
|
|
135
|
+
export declare function CreateJwtExpirationSchema(defaultValue?: string, description?: string): Joi.StringSchema;
|
|
136
|
+
//# sourceMappingURL=validation.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.utils.d.ts","sourceRoot":"","sources":["../../src/config/validation.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E;;;GAGG;AACH,qBACa,iBAAkB,YAAW,oBAAoB;IAC7D,OAAO,CAAC,iBAAiB,CAAwB;IAEjD,SAAgB,MAAM,EAAE,SAAS,CAAC;gBAEtB,MAAM,EAAE,SAAS;IAI7B,OAAO,KAAK,MAAM,GAMjB;IAED;;;;OAIG;IACI,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,YAAY;IAOrE;;;;;OAKG;IACI,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,YAAY,GAAG,gBAA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;CAChB,GAAG,GAAG,CAAC,YAAY,CAgBxB;AAED;;;;;;GAMG;AAEH,wBAAgB,gBAAgB,CAAC,YAAY,GAAE,MAAa,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,YAAY,CAQpG;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACtC,aAAa,GAAE,MAAM,EAA0C,EAC/D,YAAY,GAAE,MAAsB,EACpC,WAAW,CAAC,EAAE,MAAM,GAClB,GAAG,CAAC,YAAY,CAMlB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACxC,YAAY,GAAE,MAAc,EAC5B,WAAW,CAAC,EAAE,MAAM,GAClB,GAAG,CAAC,YAAY,CAMlB"}
|
|
@@ -0,0 +1,263 @@
|
|
|
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 ValidationService_1;
|
|
11
|
+
import { Injectable } from '@nestjs/common';
|
|
12
|
+
import { ModuleRef } from '@nestjs/core';
|
|
13
|
+
import Joi from 'joi';
|
|
14
|
+
import { AppLogger } from '../common/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* Configuration Validation Service
|
|
17
|
+
* Provides validation utilities with logging
|
|
18
|
+
*/
|
|
19
|
+
let ValidationService = ValidationService_1 = class ValidationService {
|
|
20
|
+
_contextualLogger;
|
|
21
|
+
Module;
|
|
22
|
+
constructor(module) {
|
|
23
|
+
this.Module = module;
|
|
24
|
+
}
|
|
25
|
+
get logger() {
|
|
26
|
+
if (!this._contextualLogger) {
|
|
27
|
+
const baseLogger = this.Module.get(AppLogger, { strict: false });
|
|
28
|
+
this._contextualLogger = baseLogger.createContextualLogger(ValidationService_1.name);
|
|
29
|
+
}
|
|
30
|
+
return this._contextualLogger;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a validation schema for environment variables.
|
|
34
|
+
* @param schema - Joi schema definition object with validation rules
|
|
35
|
+
* @returns Compiled Joi ObjectSchema ready for validation
|
|
36
|
+
*/
|
|
37
|
+
createValidationSchema(schema) {
|
|
38
|
+
this.logger.debug('Creating validation schema');
|
|
39
|
+
const joiSchema = Joi.object(schema);
|
|
40
|
+
this.logger.debug('Validation schema created successfully');
|
|
41
|
+
return joiSchema;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Validate configuration against a schema.
|
|
45
|
+
* @param config - Configuration object to validate
|
|
46
|
+
* @param schema - Joi validation schema
|
|
47
|
+
* @returns ValidationResult with isValid flag and optional errors array
|
|
48
|
+
*/
|
|
49
|
+
validateConfig(config, schema) {
|
|
50
|
+
this.logger.debug('Starting configuration validation');
|
|
51
|
+
const { error } = schema.validate(config, {
|
|
52
|
+
allowUnknown: true,
|
|
53
|
+
stripUnknown: false,
|
|
54
|
+
});
|
|
55
|
+
if (error) {
|
|
56
|
+
this.logger.error(`Configuration validation failed with ${error.details.length} errors`);
|
|
57
|
+
this.logger.debug(`Validation errors: ${error.details.map(detail => detail.message).join(', ')}`);
|
|
58
|
+
return {
|
|
59
|
+
isValid: false,
|
|
60
|
+
errors: error.details.map(detail => detail.message),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
this.logger.info('Configuration validation passed');
|
|
64
|
+
return {
|
|
65
|
+
isValid: true,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
ValidationService = ValidationService_1 = __decorate([
|
|
70
|
+
Injectable(),
|
|
71
|
+
__metadata("design:paramtypes", [ModuleRef])
|
|
72
|
+
], ValidationService);
|
|
73
|
+
export { ValidationService };
|
|
74
|
+
/**
|
|
75
|
+
* Create a validation schema for environment variables.
|
|
76
|
+
* Utility function to compile a configuration object into a Joi validation schema.
|
|
77
|
+
* @param schema - Joi schema definition object with validation rules
|
|
78
|
+
* @returns Compiled Joi ObjectSchema ready for validation
|
|
79
|
+
*/
|
|
80
|
+
export function CreateValidationSchema(schema) {
|
|
81
|
+
return Joi.object(schema);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validate configuration against a schema.
|
|
85
|
+
* Utility function to validate a configuration object using a Joi schema.
|
|
86
|
+
* @param config - Configuration object to validate
|
|
87
|
+
* @param schema - Joi validation schema
|
|
88
|
+
* @returns ValidationResult with isValid flag and optional errors array
|
|
89
|
+
*/
|
|
90
|
+
export function ValidateConfig(config, schema) {
|
|
91
|
+
const { error } = schema.validate(config, {
|
|
92
|
+
allowUnknown: true,
|
|
93
|
+
stripUnknown: false,
|
|
94
|
+
});
|
|
95
|
+
if (error) {
|
|
96
|
+
return {
|
|
97
|
+
isValid: false,
|
|
98
|
+
errors: error.details.map(detail => detail.message),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
isValid: true,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create a string validation schema with common patterns.
|
|
107
|
+
* Utility to build Joi string schemas with min/max length, pattern matching, and defaults.
|
|
108
|
+
* @param options - String schema options
|
|
109
|
+
* @param options.min - Minimum string length
|
|
110
|
+
* @param options.max - Maximum string length
|
|
111
|
+
* @param options.required - Whether the field is required
|
|
112
|
+
* @param options.pattern - Regular expression pattern to match
|
|
113
|
+
* @param options.default - Default value if not provided
|
|
114
|
+
* @param options.description - Human-readable description
|
|
115
|
+
* @returns Configured Joi StringSchema
|
|
116
|
+
*/
|
|
117
|
+
export function CreateStringSchema(options = {}) {
|
|
118
|
+
let schema = Joi.string();
|
|
119
|
+
if (options.min !== undefined) {
|
|
120
|
+
schema = schema.min(options.min);
|
|
121
|
+
}
|
|
122
|
+
if (options.max !== undefined) {
|
|
123
|
+
schema = schema.max(options.max);
|
|
124
|
+
}
|
|
125
|
+
if (options.pattern) {
|
|
126
|
+
schema = schema.pattern(options.pattern);
|
|
127
|
+
}
|
|
128
|
+
if (options.required) {
|
|
129
|
+
schema = schema.required();
|
|
130
|
+
}
|
|
131
|
+
if (options.default !== undefined) {
|
|
132
|
+
schema = schema.default(options.default);
|
|
133
|
+
}
|
|
134
|
+
if (options.description) {
|
|
135
|
+
schema = schema.description(options.description);
|
|
136
|
+
}
|
|
137
|
+
return schema;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Create a number validation schema with common patterns.
|
|
141
|
+
* Utility to build Joi number schemas with min/max bounds, integer constraint, and defaults.
|
|
142
|
+
* @param options - Number schema options
|
|
143
|
+
* @param options.min - Minimum numeric value
|
|
144
|
+
* @param options.max - Maximum numeric value
|
|
145
|
+
* @param options.integer - Whether value must be an integer
|
|
146
|
+
* @param options.required - Whether the field is required
|
|
147
|
+
* @param options.default - Default value if not provided
|
|
148
|
+
* @param options.description - Human-readable description
|
|
149
|
+
* @returns Configured Joi NumberSchema
|
|
150
|
+
*/
|
|
151
|
+
export function CreateNumberSchema(options = {}) {
|
|
152
|
+
let schema = Joi.number();
|
|
153
|
+
if (options.integer) {
|
|
154
|
+
schema = schema.integer();
|
|
155
|
+
}
|
|
156
|
+
if (options.min !== undefined) {
|
|
157
|
+
schema = schema.min(options.min);
|
|
158
|
+
}
|
|
159
|
+
if (options.max !== undefined) {
|
|
160
|
+
schema = schema.max(options.max);
|
|
161
|
+
}
|
|
162
|
+
if (options.required) {
|
|
163
|
+
schema = schema.required();
|
|
164
|
+
}
|
|
165
|
+
if (options.default !== undefined) {
|
|
166
|
+
schema = schema.default(options.default);
|
|
167
|
+
}
|
|
168
|
+
if (options.description) {
|
|
169
|
+
schema = schema.description(options.description);
|
|
170
|
+
}
|
|
171
|
+
return schema;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Create a boolean validation schema.
|
|
175
|
+
* Utility to build Joi boolean schemas with required flag and defaults.
|
|
176
|
+
* @param options - Boolean schema options
|
|
177
|
+
* @param options.required - Whether the field is required
|
|
178
|
+
* @param options.default - Default value if not provided
|
|
179
|
+
* @param options.description - Human-readable description
|
|
180
|
+
* @returns Configured Joi BooleanSchema
|
|
181
|
+
*/
|
|
182
|
+
export function CreateBooleanSchema(options = {}) {
|
|
183
|
+
let schema = Joi.boolean();
|
|
184
|
+
if (options.required) {
|
|
185
|
+
schema = schema.required();
|
|
186
|
+
}
|
|
187
|
+
if (options.default !== undefined) {
|
|
188
|
+
schema = schema.default(options.default);
|
|
189
|
+
}
|
|
190
|
+
if (options.description) {
|
|
191
|
+
schema = schema.description(options.description);
|
|
192
|
+
}
|
|
193
|
+
return schema;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Create a URI validation schema.
|
|
197
|
+
* Utility to build Joi string schemas that validate RFC 3986 URIs.
|
|
198
|
+
* @param options - URI schema options
|
|
199
|
+
* @param options.required - Whether the field is required
|
|
200
|
+
* @param options.default - Default value if not provided
|
|
201
|
+
* @param options.description - Human-readable description
|
|
202
|
+
* @returns Configured Joi StringSchema with URI validation
|
|
203
|
+
*/
|
|
204
|
+
export function CreateUriSchema(options = {}) {
|
|
205
|
+
let schema = Joi.string().uri();
|
|
206
|
+
if (options.required) {
|
|
207
|
+
schema = schema.required();
|
|
208
|
+
}
|
|
209
|
+
if (options.default !== undefined) {
|
|
210
|
+
schema = schema.default(options.default);
|
|
211
|
+
}
|
|
212
|
+
if (options.description) {
|
|
213
|
+
schema = schema.description(options.description);
|
|
214
|
+
}
|
|
215
|
+
return schema;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Create validation schema for port numbers.
|
|
219
|
+
* Utility to build Joi number schemas for TCP/UDP port validation (1-65535).
|
|
220
|
+
* @param defaultValue - Default port number (default: 3000)
|
|
221
|
+
* @param description - Human-readable description
|
|
222
|
+
* @returns Configured Joi NumberSchema for port validation
|
|
223
|
+
*/
|
|
224
|
+
// eslint-disable-next-line no-magic-numbers
|
|
225
|
+
export function CreatePortSchema(defaultValue = 3000, description) {
|
|
226
|
+
return CreateNumberSchema({
|
|
227
|
+
min: 1,
|
|
228
|
+
max: 65535,
|
|
229
|
+
integer: true,
|
|
230
|
+
default: defaultValue,
|
|
231
|
+
description: description ?? 'Port number',
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Create validation schema for environment variables.
|
|
236
|
+
* Utility to build Joi string schemas that restrict values to a whitelist of environments.
|
|
237
|
+
* @param allowedValues - Array of allowed environment values (default: development, production, test)
|
|
238
|
+
* @param defaultValue - Default environment value (default: development)
|
|
239
|
+
* @param description - Human-readable description
|
|
240
|
+
* @returns Configured Joi StringSchema with environment validation
|
|
241
|
+
*/
|
|
242
|
+
export function CreateEnvironmentSchema(allowedValues = ['development', 'production', 'test'], defaultValue = 'development', description) {
|
|
243
|
+
return CreateStringSchema({
|
|
244
|
+
required: false,
|
|
245
|
+
default: defaultValue,
|
|
246
|
+
description: description ?? 'Environment',
|
|
247
|
+
}).valid(...allowedValues);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Create validation schema for JWT expiration times.
|
|
251
|
+
* Utility to build Joi string schemas that validate JWT expiration duration format (e.g., 15m, 1h, 7d).
|
|
252
|
+
* @param defaultValue - Default expiration time (default: 15m)
|
|
253
|
+
* @param description - Human-readable description
|
|
254
|
+
* @returns Configured Joi StringSchema with JWT expiration validation
|
|
255
|
+
*/
|
|
256
|
+
export function CreateJwtExpirationSchema(defaultValue = '15m', description) {
|
|
257
|
+
return CreateStringSchema({
|
|
258
|
+
pattern: /^\d+[smhd]$/,
|
|
259
|
+
default: defaultValue,
|
|
260
|
+
description: description ?? 'JWT expiration time (e.g., 15m, 1h, 7d)',
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=validation.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.utils.js","sourceRoot":"","sources":["../../src/config/validation.utils.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C;;;GAGG;AAEI,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IACrB,iBAAiB,CAAwB;IAEjC,MAAM,CAAY;IAElC,YAAY,MAAiB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,IAAY,MAAM;QACjB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YACjE,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC,sBAAsB,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACI,sBAAsB,CAAC,MAAoB;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,OAAO,SAAS,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ACzC,CAAC,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACxC,eAAuB,KAAK,EAC5B,WAAoB;IAEpB,OAAO,kBAAkB,CAAC;QACzB,OAAO,EAAE,aAAa;QACtB,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,WAAW,IAAI,yCAAyC;KACrE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { BaseApplicationError, createError } from '../common/errors/index.js';
|
|
2
|
+
export { ERROR_CONFIGS } from '../common/errors/index.js';
|
|
3
|
+
export type { ErrorConfig, ErrorType } from '../common/errors/index.js';
|
|
4
|
+
export { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, InternalServerError, BadGatewayError, ServiceUnavailableError, GatewayTimeoutError, } from '../common/errors/index.js';
|
|
5
|
+
export { ErrorSanitizerService } from '../common/services/error-sanitizer.service.js';
|
|
6
|
+
export { ErrorCategorizerService } from '../common/services/error-categorizer.service.js';
|
|
7
|
+
export { GlobalExceptionFilter } from '../common/filters/global-exception.filter.js';
|
|
8
|
+
export { HttpExceptionFilter } from '../common/filters/http-exception.filter.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGxE,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAG1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Error base classes and factories
|
|
2
|
+
export { BaseApplicationError, createError } from '../common/errors/index.js';
|
|
3
|
+
export { ERROR_CONFIGS } from '../common/errors/index.js';
|
|
4
|
+
// Typed HTTP error classes
|
|
5
|
+
export { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, UnprocessableEntityError, InternalServerError, BadGatewayError, ServiceUnavailableError, GatewayTimeoutError, } from '../common/errors/index.js';
|
|
6
|
+
// Error handling services
|
|
7
|
+
export { ErrorSanitizerService } from '../common/services/error-sanitizer.service.js';
|
|
8
|
+
export { ErrorCategorizerService } from '../common/services/error-categorizer.service.js';
|
|
9
|
+
// Exception filters
|
|
10
|
+
export { GlobalExceptionFilter } from '../common/filters/global-exception.filter.js';
|
|
11
|
+
export { HttpExceptionFilter } from '../common/filters/http-exception.filter.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,2BAA2B;AAC3B,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,2BAA2B,CAAC;AAEnC,0BAA0B;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAE1F,oBAAoB;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ThrottlerGuard } from '@nestjs/throttler';
|
|
2
|
+
/**
|
|
3
|
+
* Custom throttle guard that uses IP address for tracking
|
|
4
|
+
* Provides IP-based rate limiting for HTTP requests
|
|
5
|
+
*
|
|
6
|
+
* IMPORTANT: Proxy Configuration
|
|
7
|
+
* This guard prefers the direct TCP connection address (req.socket.remoteAddress)
|
|
8
|
+
* which is not spoofable via HTTP headers. If your application is behind a
|
|
9
|
+
* reverse proxy (Nginx, HAProxy, AWS ELB, etc.), ensure the proxy is correctly
|
|
10
|
+
* configured as trusted in Express:
|
|
11
|
+
*
|
|
12
|
+
* - Express: app.set('trust proxy', 'loopback') or app.set('trust proxy', 1)
|
|
13
|
+
* - Only then will req.ip correctly reflect the client IP through the proxy
|
|
14
|
+
*
|
|
15
|
+
* If req.socket.remoteAddress is unavailable (e.g., in test environments),
|
|
16
|
+
* falls back to req.ip, which may be influenced by X-Forwarded-For headers.
|
|
17
|
+
*/
|
|
18
|
+
export declare class CustomThrottleGuard extends ThrottlerGuard {
|
|
19
|
+
/**
|
|
20
|
+
* Get tracker identifier from request
|
|
21
|
+
* Prefers the direct socket address (not spoofable via headers),
|
|
22
|
+
* falls back to req.ip when unavailable
|
|
23
|
+
* @param req Request object
|
|
24
|
+
* @returns Tracker string (IP address)
|
|
25
|
+
*/
|
|
26
|
+
protected getTracker(req: Record<string, unknown>): Promise<string>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=custom-throttle.guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-throttle.guard.d.ts","sourceRoot":"","sources":["../../src/guards/custom-throttle.guard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;;;;GAeG;AACH,qBACa,mBAAoB,SAAQ,cAAc;IACtD;;;;;;OAMG;cAEsB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAelF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { Injectable } from '@nestjs/common';
|
|
8
|
+
import { ThrottlerGuard } from '@nestjs/throttler';
|
|
9
|
+
/**
|
|
10
|
+
* Custom throttle guard that uses IP address for tracking
|
|
11
|
+
* Provides IP-based rate limiting for HTTP requests
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: Proxy Configuration
|
|
14
|
+
* This guard prefers the direct TCP connection address (req.socket.remoteAddress)
|
|
15
|
+
* which is not spoofable via HTTP headers. If your application is behind a
|
|
16
|
+
* reverse proxy (Nginx, HAProxy, AWS ELB, etc.), ensure the proxy is correctly
|
|
17
|
+
* configured as trusted in Express:
|
|
18
|
+
*
|
|
19
|
+
* - Express: app.set('trust proxy', 'loopback') or app.set('trust proxy', 1)
|
|
20
|
+
* - Only then will req.ip correctly reflect the client IP through the proxy
|
|
21
|
+
*
|
|
22
|
+
* If req.socket.remoteAddress is unavailable (e.g., in test environments),
|
|
23
|
+
* falls back to req.ip, which may be influenced by X-Forwarded-For headers.
|
|
24
|
+
*/
|
|
25
|
+
let CustomThrottleGuard = class CustomThrottleGuard extends ThrottlerGuard {
|
|
26
|
+
/**
|
|
27
|
+
* Get tracker identifier from request
|
|
28
|
+
* Prefers the direct socket address (not spoofable via headers),
|
|
29
|
+
* falls back to req.ip when unavailable
|
|
30
|
+
* @param req Request object
|
|
31
|
+
* @returns Tracker string (IP address)
|
|
32
|
+
*/
|
|
33
|
+
// eslint-disable-next-line require-await
|
|
34
|
+
async getTracker(req) {
|
|
35
|
+
// Prefer the direct TCP connection address (not spoofable via headers)
|
|
36
|
+
// req.socket.remoteAddress is the actual connecting IP regardless of proxies
|
|
37
|
+
const directIp = req['socket']?.remoteAddress ??
|
|
38
|
+
req['connection']?.remoteAddress;
|
|
39
|
+
if (directIp)
|
|
40
|
+
return directIp;
|
|
41
|
+
// Fall back to req.ip only when direct address is unavailable (e.g., test environment)
|
|
42
|
+
// NOTE: req.ip may be influenced by X-Forwarded-For in proxy setups.
|
|
43
|
+
// Ensure express trust proxy is configured correctly if behind a trusted reverse proxy.
|
|
44
|
+
const ip = req['ip'];
|
|
45
|
+
return ip ?? 'unknown';
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
CustomThrottleGuard = __decorate([
|
|
49
|
+
Injectable()
|
|
50
|
+
], CustomThrottleGuard);
|
|
51
|
+
export { CustomThrottleGuard };
|
|
52
|
+
//# sourceMappingURL=custom-throttle.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-throttle.guard.js","sourceRoot":"","sources":["../../src/guards/custom-throttle.guard.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,cAAc;IACtD;;;;;;OAMG;IACH,yCAAyC;IACtB,KAAK,CAAC,UAAU,CAAC,GAA4B;QAC/D,uEAAuE;QACvE,6EAA6E;QAC7E,MAAM,QAAQ,GACZ,GAAG,CAAC,QAAQ,CAA4C,EAAE,aAAa;YACvE,GAAG,CAAC,YAAY,CAA4C,EAAE,aAAa,CAAC;QAE9E,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,uFAAuF;QACvF,qEAAqE;QACrE,wFAAwF;QACxF,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAuB,CAAC;QAC3C,OAAO,EAAE,IAAI,SAAS,CAAC;IACxB,CAAC;CACD,CAAA;AAxBY,mBAAmB;IAD/B,UAAU,EAAE;GACA,mBAAmB,CAwB/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Foundational NestJS infrastructure library providing essential utilities for building secure, observable, and maintainable applications.
|
|
5
|
+
*
|
|
6
|
+
* ## Key Features
|
|
7
|
+
*
|
|
8
|
+
* - **Error Handling**: Structured error responses with categorization (transient/permanent) and automatic sanitization
|
|
9
|
+
* - **Logging**: Centralized, structured logging with automatic redaction of sensitive data
|
|
10
|
+
* - **Metrics**: Prometheus metrics with automatic HTTP request tracking and custom metric support
|
|
11
|
+
* - **Validation**: Automatic DTO validation and transformation with comprehensive error formatting
|
|
12
|
+
* - **CSRF Protection**: Double-Submit Cookie pattern with per-IP rate limiting
|
|
13
|
+
* - **Security**: Global filters, guards, and interceptors for standardized protection
|
|
14
|
+
* - **Configuration**: Type-safe environment variable access with Joi validation
|
|
15
|
+
* - **Lazy Loading**: Defer dependency resolution to avoid circular dependencies
|
|
16
|
+
* - **Audit Logging**: Security event logging for compliance and forensics
|
|
17
|
+
* - **Health Checks**: Kubernetes-ready liveness, readiness, and general health probes
|
|
18
|
+
* - **HTTP Client**: Robust HTTP client with timeout, SSL/TLS, and sensitive data redaction
|
|
19
|
+
*
|
|
20
|
+
* ## Quick Start
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { Module } from '@nestjs/common';
|
|
25
|
+
* import { ConfigModule, CommonModule } from '@pawells/nestjs-shared';
|
|
26
|
+
*
|
|
27
|
+
* @Module({
|
|
28
|
+
* imports: [
|
|
29
|
+
* ConfigModule, // MUST come first
|
|
30
|
+
* CommonModule, // Depends on ConfigModule
|
|
31
|
+
* ],
|
|
32
|
+
* })
|
|
33
|
+
* export class AppModule {}
|
|
34
|
+
*
|
|
35
|
+
* async function bootstrap() {
|
|
36
|
+
* const app = await NestFactory.create(AppModule);
|
|
37
|
+
* const port = process.env['PORT'] ?? 3000;
|
|
38
|
+
* await app.listen(port);
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* ## Modules
|
|
43
|
+
*
|
|
44
|
+
* - **ConfigModule**: Environment configuration with validation (must be imported first)
|
|
45
|
+
* - **CommonModule**: Global infrastructure (filters, interceptors, pipes, services)
|
|
46
|
+
* - **MetricsModule**: Prometheus metrics endpoint and collection
|
|
47
|
+
*/
|
|
48
|
+
export type { IMetricsExporter, MetricDescriptor, MetricValue, MetricType } from './common/interfaces/metrics-exporter.interface.js';
|
|
49
|
+
export { InstrumentationRegistry } from './common/registry/instrumentation-registry.js';
|
|
50
|
+
export { GlobalExceptionFilter, HttpExceptionFilter, LoggingInterceptor, HTTPMetricsInterceptor, BaseValidationPipe, ValidationPipe, RequestProperty, getNestedProperty, getRequestFromContext, createRequestPropertyDecorator, createConditionalDecorator, createValidatingDecorator, createTransformingDecorator, BaseDecoratorOptions, ConditionalDecoratorOptions, ValidatingDecoratorOptions, TransformingDecoratorOptions, Query, Params, Body, Headers, Cookies, LogContext, GRAFANA_TIMEOUT, LOKI_TIMEOUT, PROMETHEUS_TIMEOUT, HTTP_CLIENT_TIMEOUT, CONFIG_VALIDATION_TIMEOUT, LogEntry, LogLevel, LogMetadata, LOG_LEVEL_STRINGS, ILogger, IContextualLogger, AppLogger, NestLoggerAdapter, AuditLoggerService, ErrorSanitizerService, ErrorCategorizerService, HttpClientService, CSRFService, MetricsRegistryService, HealthCheckService, HealthStatus, BaseMetricsCollector, MetricsController, CSRFGuard, MetricsGuard, CommonModule, MetricsModule, SharedThrottlerModule, type SharedThrottlerConfig, BaseApplicationError, createError, ERROR_CONFIGS, ErrorConfig, ErrorType, BadRequestError as CommonBadRequestError, UnauthorizedError as CommonUnauthorizedError, ForbiddenError as CommonForbiddenError, NotFoundError as CommonNotFoundError, ConflictError as CommonConflictError, UnprocessableEntityError as CommonUnprocessableEntityError, InternalServerError as CommonInternalServerError, BadGatewayError as CommonBadGatewayError, ServiceUnavailableError as CommonServiceUnavailableError, GatewayTimeoutError as CommonGatewayTimeoutError, ApplySecurityMiddleware, SecurityBootstrapOptions, CreateRateLimitConfig, RateLimitConfig, RateLimitDescriptor, LazyGetter, OptionalLazyGetter, TokenLazyGetter, LazyModuleRefService, LazyGetterDependencies, OptionalGetterConfig, CreateMemoizedLazyGetter as createMemoizedLazyGetter, CreateOptionalLazyGetter as createOptionalLazyGetter, IsLazyModuleRefService as isLazyModuleRefService, LazyGetterNamingConventions, type IHealthCheck, getErrorStack, getErrorMessage, AsyncModuleOptions, createAsyncOptionsProvider, createAsyncProviders, } from './common/index.js';
|
|
51
|
+
export { ConfigService, ValidationService, ConfigModule, AppConfig, DatabaseConfig, CacheConfig as ConfigCacheConfig, AuthConfig, ValidationResult, ConfigSchema, EnvironmentOptions, CreateValidationSchema, ValidateConfig, CreateStringSchema, CreateNumberSchema, CreateBooleanSchema, CreateUriSchema, CreatePortSchema, CreateEnvironmentSchema, CreateJwtExpirationSchema, } from './config/index.js';
|
|
52
|
+
export { CustomThrottleGuard } from './guards/index.js';
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAKH,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AACrI,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAKxF,OAAO,EACN,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,8BAA8B,EAC9B,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,KAAK,EACL,MAAM,EACN,IAAI,EACJ,OAAO,EACP,OAAO,EACP,UAAU,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,EAC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