@dyanet/nestjs-config-aws 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1183 -0
- package/dist/cjs/config.module.js +178 -0
- package/dist/cjs/config.module.js.map +1 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/integration/index.js +23 -0
- package/dist/cjs/integration/index.js.map +1 -0
- package/dist/cjs/integration/interfaces/configuration-factory.interface.js +3 -0
- package/dist/cjs/integration/interfaces/configuration-factory.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/configuration-source.interface.js +3 -0
- package/dist/cjs/integration/interfaces/configuration-source.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/index.js +26 -0
- package/dist/cjs/integration/interfaces/index.js.map +1 -0
- package/dist/cjs/integration/interfaces/integration-options.interface.js +3 -0
- package/dist/cjs/integration/interfaces/integration-options.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/integration-state.interface.js +3 -0
- package/dist/cjs/integration/interfaces/integration-state.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/nestjs-config-compatibility.interface.js +73 -0
- package/dist/cjs/integration/interfaces/nestjs-config-compatibility.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/nestjs-config-integration.interface.js +3 -0
- package/dist/cjs/integration/interfaces/nestjs-config-integration.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/typed-configuration.interface.js +4 -0
- package/dist/cjs/integration/interfaces/typed-configuration.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/utility-types.interface.js +52 -0
- package/dist/cjs/integration/interfaces/utility-types.interface.js.map +1 -0
- package/dist/cjs/integration/nestjs-config-integration.module.js +124 -0
- package/dist/cjs/integration/nestjs-config-integration.module.js.map +1 -0
- package/dist/cjs/integration/providers/aws-configuration-loader.service.js +591 -0
- package/dist/cjs/integration/providers/aws-configuration-loader.service.js.map +1 -0
- package/dist/cjs/integration/providers/configuration-factory.provider.js +383 -0
- package/dist/cjs/integration/providers/configuration-factory.provider.js.map +1 -0
- package/dist/cjs/integration/providers/index.js +20 -0
- package/dist/cjs/integration/providers/index.js.map +1 -0
- package/dist/cjs/integration/services/async-config-helper.service.js +356 -0
- package/dist/cjs/integration/services/async-config-helper.service.js.map +1 -0
- package/dist/cjs/integration/services/error-handler.service.js +265 -0
- package/dist/cjs/integration/services/error-handler.service.js.map +1 -0
- package/dist/cjs/integration/services/factory-registration.service.js +512 -0
- package/dist/cjs/integration/services/factory-registration.service.js.map +1 -0
- package/dist/cjs/integration/services/index.js +26 -0
- package/dist/cjs/integration/services/index.js.map +1 -0
- package/dist/cjs/integration/services/integration-state.service.js +83 -0
- package/dist/cjs/integration/services/integration-state.service.js.map +1 -0
- package/dist/cjs/integration/services/namespace-handler.service.js +467 -0
- package/dist/cjs/integration/services/namespace-handler.service.js.map +1 -0
- package/dist/cjs/integration/services/nestjs-config-integration.service.js +316 -0
- package/dist/cjs/integration/services/nestjs-config-integration.service.js.map +1 -0
- package/dist/cjs/integration/services/precedence-handler.service.js +294 -0
- package/dist/cjs/integration/services/precedence-handler.service.js.map +1 -0
- package/dist/cjs/integration/services/validation-integration.service.js +591 -0
- package/dist/cjs/integration/services/validation-integration.service.js.map +1 -0
- package/dist/cjs/integration/utils/config-integration.util.js +283 -0
- package/dist/cjs/integration/utils/config-integration.util.js.map +1 -0
- package/dist/cjs/integration/utils/index.js +19 -0
- package/dist/cjs/integration/utils/index.js.map +1 -0
- package/dist/cjs/interfaces/config-loader.interface.js +3 -0
- package/dist/cjs/interfaces/config-loader.interface.js.map +1 -0
- package/dist/cjs/interfaces/config-service.interface.js +11 -0
- package/dist/cjs/interfaces/config-service.interface.js.map +1 -0
- package/dist/cjs/interfaces/default-schema.interface.js +63 -0
- package/dist/cjs/interfaces/default-schema.interface.js.map +1 -0
- package/dist/cjs/interfaces/errors.interface.js +77 -0
- package/dist/cjs/interfaces/errors.interface.js.map +1 -0
- package/dist/cjs/interfaces/index.js +25 -0
- package/dist/cjs/interfaces/index.js.map +1 -0
- package/dist/cjs/interfaces/module-options.interface.js +3 -0
- package/dist/cjs/interfaces/module-options.interface.js.map +1 -0
- package/dist/cjs/loaders/environment.loader.js +59 -0
- package/dist/cjs/loaders/environment.loader.js.map +1 -0
- package/dist/cjs/loaders/secrets-manager.loader.js +122 -0
- package/dist/cjs/loaders/secrets-manager.loader.js.map +1 -0
- package/dist/cjs/loaders/ssm-parameter-store.loader.js +146 -0
- package/dist/cjs/loaders/ssm-parameter-store.loader.js.map +1 -0
- package/dist/cjs/services/config.service.js +297 -0
- package/dist/cjs/services/config.service.js.map +1 -0
- package/dist/cjs/utils/validation.util.js +114 -0
- package/dist/cjs/utils/validation.util.js.map +1 -0
- package/dist/esm/config.module.js +175 -0
- package/dist/esm/config.module.js.map +1 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/integration/index.js +7 -0
- package/dist/esm/integration/index.js.map +1 -0
- package/dist/esm/integration/interfaces/configuration-factory.interface.js +2 -0
- package/dist/esm/integration/interfaces/configuration-factory.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/configuration-source.interface.js +2 -0
- package/dist/esm/integration/interfaces/configuration-source.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/index.js +10 -0
- package/dist/esm/integration/interfaces/index.js.map +1 -0
- package/dist/esm/integration/interfaces/integration-options.interface.js +2 -0
- package/dist/esm/integration/interfaces/integration-options.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/integration-state.interface.js +2 -0
- package/dist/esm/integration/interfaces/integration-state.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/nestjs-config-compatibility.interface.js +64 -0
- package/dist/esm/integration/interfaces/nestjs-config-compatibility.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/nestjs-config-integration.interface.js +2 -0
- package/dist/esm/integration/interfaces/nestjs-config-integration.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/typed-configuration.interface.js +3 -0
- package/dist/esm/integration/interfaces/typed-configuration.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/utility-types.interface.js +44 -0
- package/dist/esm/integration/interfaces/utility-types.interface.js.map +1 -0
- package/dist/esm/integration/nestjs-config-integration.module.js +121 -0
- package/dist/esm/integration/nestjs-config-integration.module.js.map +1 -0
- package/dist/esm/integration/providers/aws-configuration-loader.service.js +588 -0
- package/dist/esm/integration/providers/aws-configuration-loader.service.js.map +1 -0
- package/dist/esm/integration/providers/configuration-factory.provider.js +380 -0
- package/dist/esm/integration/providers/configuration-factory.provider.js.map +1 -0
- package/dist/esm/integration/providers/index.js +4 -0
- package/dist/esm/integration/providers/index.js.map +1 -0
- package/dist/esm/integration/services/async-config-helper.service.js +353 -0
- package/dist/esm/integration/services/async-config-helper.service.js.map +1 -0
- package/dist/esm/integration/services/error-handler.service.js +262 -0
- package/dist/esm/integration/services/error-handler.service.js.map +1 -0
- package/dist/esm/integration/services/factory-registration.service.js +509 -0
- package/dist/esm/integration/services/factory-registration.service.js.map +1 -0
- package/dist/esm/integration/services/index.js +10 -0
- package/dist/esm/integration/services/index.js.map +1 -0
- package/dist/esm/integration/services/integration-state.service.js +80 -0
- package/dist/esm/integration/services/integration-state.service.js.map +1 -0
- package/dist/esm/integration/services/namespace-handler.service.js +464 -0
- package/dist/esm/integration/services/namespace-handler.service.js.map +1 -0
- package/dist/esm/integration/services/nestjs-config-integration.service.js +313 -0
- package/dist/esm/integration/services/nestjs-config-integration.service.js.map +1 -0
- package/dist/esm/integration/services/precedence-handler.service.js +291 -0
- package/dist/esm/integration/services/precedence-handler.service.js.map +1 -0
- package/dist/esm/integration/services/validation-integration.service.js +585 -0
- package/dist/esm/integration/services/validation-integration.service.js.map +1 -0
- package/dist/esm/integration/utils/config-integration.util.js +240 -0
- package/dist/esm/integration/utils/config-integration.util.js.map +1 -0
- package/dist/esm/integration/utils/index.js +3 -0
- package/dist/esm/integration/utils/index.js.map +1 -0
- package/dist/esm/interfaces/config-loader.interface.js +2 -0
- package/dist/esm/interfaces/config-loader.interface.js.map +1 -0
- package/dist/esm/interfaces/config-service.interface.js +7 -0
- package/dist/esm/interfaces/config-service.interface.js.map +1 -0
- package/dist/esm/interfaces/default-schema.interface.js +59 -0
- package/dist/esm/interfaces/default-schema.interface.js.map +1 -0
- package/dist/esm/interfaces/errors.interface.js +69 -0
- package/dist/esm/interfaces/errors.interface.js.map +1 -0
- package/dist/esm/interfaces/index.js +9 -0
- package/dist/esm/interfaces/index.js.map +1 -0
- package/dist/esm/interfaces/module-options.interface.js +2 -0
- package/dist/esm/interfaces/module-options.interface.js.map +1 -0
- package/dist/esm/loaders/environment.loader.js +55 -0
- package/dist/esm/loaders/environment.loader.js.map +1 -0
- package/dist/esm/loaders/secrets-manager.loader.js +118 -0
- package/dist/esm/loaders/secrets-manager.loader.js.map +1 -0
- package/dist/esm/loaders/ssm-parameter-store.loader.js +142 -0
- package/dist/esm/loaders/ssm-parameter-store.loader.js.map +1 -0
- package/dist/esm/services/config.service.js +261 -0
- package/dist/esm/services/config.service.js.map +1 -0
- package/dist/esm/utils/validation.util.js +110 -0
- package/dist/esm/utils/validation.util.js.map +1 -0
- package/dist/types/config.module.d.ts +46 -0
- package/dist/types/config.module.d.ts.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/integration/index.d.ts +6 -0
- package/dist/types/integration/index.d.ts.map +1 -0
- package/dist/types/integration/interfaces/configuration-factory.interface.d.ts +71 -0
- package/dist/types/integration/interfaces/configuration-factory.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/configuration-source.interface.d.ts +24 -0
- package/dist/types/integration/interfaces/configuration-source.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/index.d.ts +9 -0
- package/dist/types/integration/interfaces/index.d.ts.map +1 -0
- package/dist/types/integration/interfaces/integration-options.interface.d.ts +66 -0
- package/dist/types/integration/interfaces/integration-options.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/integration-state.interface.d.ts +17 -0
- package/dist/types/integration/interfaces/integration-state.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/nestjs-config-compatibility.interface.d.ts +332 -0
- package/dist/types/integration/interfaces/nestjs-config-compatibility.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/nestjs-config-integration.interface.d.ts +259 -0
- package/dist/types/integration/interfaces/nestjs-config-integration.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/typed-configuration.interface.d.ts +209 -0
- package/dist/types/integration/interfaces/typed-configuration.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/utility-types.interface.d.ts +249 -0
- package/dist/types/integration/interfaces/utility-types.interface.d.ts.map +1 -0
- package/dist/types/integration/nestjs-config-integration.module.d.ts +36 -0
- package/dist/types/integration/nestjs-config-integration.module.d.ts.map +1 -0
- package/dist/types/integration/providers/aws-configuration-loader.service.d.ts +134 -0
- package/dist/types/integration/providers/aws-configuration-loader.service.d.ts.map +1 -0
- package/dist/types/integration/providers/configuration-factory.provider.d.ts +119 -0
- package/dist/types/integration/providers/configuration-factory.provider.d.ts.map +1 -0
- package/dist/types/integration/providers/index.d.ts +3 -0
- package/dist/types/integration/providers/index.d.ts.map +1 -0
- package/dist/types/integration/services/async-config-helper.service.d.ts +84 -0
- package/dist/types/integration/services/async-config-helper.service.d.ts.map +1 -0
- package/dist/types/integration/services/error-handler.service.d.ts +84 -0
- package/dist/types/integration/services/error-handler.service.d.ts.map +1 -0
- package/dist/types/integration/services/factory-registration.service.d.ts +158 -0
- package/dist/types/integration/services/factory-registration.service.d.ts.map +1 -0
- package/dist/types/integration/services/index.d.ts +9 -0
- package/dist/types/integration/services/index.d.ts.map +1 -0
- package/dist/types/integration/services/integration-state.service.d.ts +41 -0
- package/dist/types/integration/services/integration-state.service.d.ts.map +1 -0
- package/dist/types/integration/services/namespace-handler.service.d.ts +192 -0
- package/dist/types/integration/services/namespace-handler.service.d.ts.map +1 -0
- package/dist/types/integration/services/nestjs-config-integration.service.d.ts +87 -0
- package/dist/types/integration/services/nestjs-config-integration.service.d.ts.map +1 -0
- package/dist/types/integration/services/precedence-handler.service.d.ts +103 -0
- package/dist/types/integration/services/precedence-handler.service.d.ts.map +1 -0
- package/dist/types/integration/services/validation-integration.service.d.ts +222 -0
- package/dist/types/integration/services/validation-integration.service.d.ts.map +1 -0
- package/dist/types/integration/utils/config-integration.util.d.ts +81 -0
- package/dist/types/integration/utils/config-integration.util.d.ts.map +1 -0
- package/dist/types/integration/utils/index.d.ts +2 -0
- package/dist/types/integration/utils/index.d.ts.map +1 -0
- package/dist/types/interfaces/config-loader.interface.d.ts +22 -0
- package/dist/types/interfaces/config-loader.interface.d.ts.map +1 -0
- package/dist/types/interfaces/config-service.interface.d.ts +23 -0
- package/dist/types/interfaces/config-service.interface.d.ts.map +1 -0
- package/dist/types/interfaces/default-schema.interface.d.ts +195 -0
- package/dist/types/interfaces/default-schema.interface.d.ts.map +1 -0
- package/dist/types/interfaces/errors.interface.d.ts +38 -0
- package/dist/types/interfaces/errors.interface.d.ts.map +1 -0
- package/dist/types/interfaces/index.d.ts +6 -0
- package/dist/types/interfaces/index.d.ts.map +1 -0
- package/dist/types/interfaces/module-options.interface.d.ts +64 -0
- package/dist/types/interfaces/module-options.interface.d.ts.map +1 -0
- package/dist/types/loaders/environment.loader.d.ts +26 -0
- package/dist/types/loaders/environment.loader.d.ts.map +1 -0
- package/dist/types/loaders/secrets-manager.loader.d.ts +52 -0
- package/dist/types/loaders/secrets-manager.loader.d.ts.map +1 -0
- package/dist/types/loaders/ssm-parameter-store.loader.d.ts +68 -0
- package/dist/types/loaders/ssm-parameter-store.loader.d.ts.map +1 -0
- package/dist/types/services/config.service.d.ts +94 -0
- package/dist/types/services/config.service.d.ts.map +1 -0
- package/dist/types/utils/validation.util.d.ts +53 -0
- package/dist/types/utils/validation.util.d.ts.map +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { IntegrationOptions } from '../interfaces/integration-options.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Service for handling errors and implementing graceful degradation strategies
|
|
4
|
+
* in the AWS configuration integration.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ErrorHandlerService {
|
|
7
|
+
private readonly options;
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private readonly errorHandling;
|
|
10
|
+
constructor(options: IntegrationOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Handle AWS service unavailability.
|
|
13
|
+
* @param serviceName - Name of the AWS service that's unavailable
|
|
14
|
+
* @param error - The error that occurred
|
|
15
|
+
* @returns Whether to continue processing
|
|
16
|
+
*/
|
|
17
|
+
handleAwsUnavailable(serviceName: string, error?: Error): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Handle configuration loading errors.
|
|
20
|
+
* @param source - Name of the configuration source
|
|
21
|
+
* @param error - The error that occurred
|
|
22
|
+
* @returns Whether to continue processing
|
|
23
|
+
*/
|
|
24
|
+
handleConfigurationError(source: string, error: Error): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Handle validation errors.
|
|
27
|
+
* @param field - The field that failed validation
|
|
28
|
+
* @param error - The validation error
|
|
29
|
+
* @returns Whether to continue processing
|
|
30
|
+
*/
|
|
31
|
+
handleValidationError(field: string, error: Error): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Handle network connectivity issues.
|
|
34
|
+
* @param service - The service experiencing connectivity issues
|
|
35
|
+
* @param error - The network error
|
|
36
|
+
* @returns Whether to retry or continue
|
|
37
|
+
*/
|
|
38
|
+
handleNetworkError(service: string, error: Error): {
|
|
39
|
+
shouldRetry: boolean;
|
|
40
|
+
shouldContinue: boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Handle permission denied errors.
|
|
44
|
+
* @param service - The service that denied access
|
|
45
|
+
* @param resource - The resource that was accessed
|
|
46
|
+
* @param error - The permission error
|
|
47
|
+
* @returns Whether to continue processing
|
|
48
|
+
*/
|
|
49
|
+
handlePermissionError(service: string, resource: string, error: Error): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Handle resource not found errors.
|
|
52
|
+
* @param service - The service where the resource was not found
|
|
53
|
+
* @param resource - The resource that was not found
|
|
54
|
+
* @param error - The not found error
|
|
55
|
+
* @returns Whether to continue processing
|
|
56
|
+
*/
|
|
57
|
+
handleResourceNotFound(service: string, resource: string, error?: Error): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Log detailed error information for troubleshooting.
|
|
60
|
+
* @param context - The context where the error occurred
|
|
61
|
+
* @param error - The error to log
|
|
62
|
+
* @param additionalInfo - Additional information to include
|
|
63
|
+
*/
|
|
64
|
+
logDetailedError(context: string, error: Error, additionalInfo?: Record<string, any>): void;
|
|
65
|
+
/**
|
|
66
|
+
* Create a fallback configuration when AWS sources fail.
|
|
67
|
+
* @param namespace - Optional namespace for the fallback config
|
|
68
|
+
* @returns Fallback configuration object
|
|
69
|
+
*/
|
|
70
|
+
createFallbackConfiguration(namespace?: string): Record<string, any>;
|
|
71
|
+
/**
|
|
72
|
+
* Check if an error is retryable.
|
|
73
|
+
* @param error - The error to check
|
|
74
|
+
* @returns Whether the error is retryable
|
|
75
|
+
*/
|
|
76
|
+
isRetryableError(error: Error): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Get retry delay for retryable errors.
|
|
79
|
+
* @param attemptNumber - The current attempt number (1-based)
|
|
80
|
+
* @returns Delay in milliseconds
|
|
81
|
+
*/
|
|
82
|
+
getRetryDelay(attemptNumber: number): number;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=error-handler.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.service.d.ts","sourceRoot":"","sources":["../../../../src/integration/services/error-handler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAyB,MAAM,6CAA6C,CAAC;AAGxG;;;GAGG;AACH,qBACa,mBAAmB;IAIlB,OAAO,CAAC,QAAQ,CAAC,O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1
|
+
import { ConfigFactory } from '@nestjs/config';
|
|
2
|
+
import { ConfigurationFactoryProviderImpl } from '../providers/configuration-factory.provider';
|
|
3
|
+
import { AwsConfigurationLoaderService } from '../providers/aws-configuration-loader.service';
|
|
4
|
+
import { IntegrationOptions } from '../interfaces/integration-options.interface';
|
|
5
|
+
import { NamespaceHandlerService } from './namespace-handler.service';
|
|
6
|
+
import { ValidationIntegrationService } from './validation-integration.service';
|
|
7
|
+
/**
|
|
8
|
+
* Service responsible for registering configuration factories with @nestjs/config.
|
|
9
|
+
* This service creates and manages the bridge between AWS-loaded configuration
|
|
10
|
+
* and the standard @nestjs/config module.
|
|
11
|
+
*/
|
|
12
|
+
export declare class FactoryRegistrationService {
|
|
13
|
+
private readonly configurationFactoryProvider;
|
|
14
|
+
private readonly awsConfigurationLoader;
|
|
15
|
+
private readonly namespaceHandler;
|
|
16
|
+
private readonly validationService;
|
|
17
|
+
private readonly options;
|
|
18
|
+
private readonly logger;
|
|
19
|
+
private readonly registeredFactories;
|
|
20
|
+
private isInitialized;
|
|
21
|
+
constructor(configurationFactoryProvider: ConfigurationFactoryProviderImpl, awsConfigurationLoader: AwsConfigurationLoaderService, namespaceHandler: NamespaceHandlerService, validationService: ValidationIntegrationService, options?: IntegrationOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Register configuration factories with @nestjs/config based on AWS-loaded configuration.
|
|
24
|
+
* This method loads configuration from AWS sources and creates factories that can be
|
|
25
|
+
* consumed by @nestjs/config.
|
|
26
|
+
*
|
|
27
|
+
* @returns Promise resolving to array of registered configuration factories
|
|
28
|
+
*/
|
|
29
|
+
registerFactories(): Promise<ConfigFactory[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Register configuration factories asynchronously.
|
|
32
|
+
* This method is designed to work with @nestjs/config's forRootAsync pattern.
|
|
33
|
+
*
|
|
34
|
+
* @returns Promise resolving to array of configuration factories
|
|
35
|
+
*/
|
|
36
|
+
registerFactoriesAsync(): Promise<ConfigFactory[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Create a single configuration factory for immediate use.
|
|
39
|
+
* This method can be used for synchronous factory creation.
|
|
40
|
+
*
|
|
41
|
+
* @param namespace - Optional namespace for the factory
|
|
42
|
+
* @param config - Configuration data to use for the factory
|
|
43
|
+
* @returns Configuration factory
|
|
44
|
+
*/
|
|
45
|
+
createSyncFactory(namespace?: string, config?: Record<string, any>): ConfigFactory;
|
|
46
|
+
/**
|
|
47
|
+
* Register factories for specific namespaces.
|
|
48
|
+
* This method allows selective registration of configuration for specific namespaces.
|
|
49
|
+
*
|
|
50
|
+
* @param namespaces - Array of namespace names to register
|
|
51
|
+
* @returns Promise resolving to array of namespace-specific factories
|
|
52
|
+
*/
|
|
53
|
+
registerNamespacedFactories(namespaces: string[]): Promise<ConfigFactory[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Get all registered factories.
|
|
56
|
+
* @returns Map of factory names to configuration factories
|
|
57
|
+
*/
|
|
58
|
+
getRegisteredFactories(): Map<string, ConfigFactory>;
|
|
59
|
+
/**
|
|
60
|
+
* Get a specific registered factory by name.
|
|
61
|
+
* @param name - Name of the factory to retrieve
|
|
62
|
+
* @returns Configuration factory or undefined if not found
|
|
63
|
+
*/
|
|
64
|
+
getFactory(name: string): ConfigFactory | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Check if factories have been initialized.
|
|
67
|
+
* @returns Whether factories have been registered
|
|
68
|
+
*/
|
|
69
|
+
isFactoriesInitialized(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Register validated namespace factories with schema validation.
|
|
72
|
+
* This method creates factories that validate configuration using Joi, class-validator, or custom functions.
|
|
73
|
+
*
|
|
74
|
+
* @param namespaces - Array of namespace names to register
|
|
75
|
+
* @param validationSchemas - Validation schemas for each namespace
|
|
76
|
+
* @param validationType - Type of validation to use
|
|
77
|
+
* @returns Promise resolving to array of validated namespace factories
|
|
78
|
+
*/
|
|
79
|
+
registerValidatedNamespaceFactories(namespaces: string[], validationSchemas: Record<string, any>, validationType?: 'joi' | 'class-validator' | 'custom'): Promise<ConfigFactory[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Create enhanced namespace factories using the namespace handler service.
|
|
82
|
+
* This method provides improved namespace support with better configuration extraction.
|
|
83
|
+
*
|
|
84
|
+
* @param namespaces - Array of namespace names to create factories for
|
|
85
|
+
* @returns Promise resolving to array of enhanced namespace factories
|
|
86
|
+
*/
|
|
87
|
+
createEnhancedNamespaceFactories(namespaces: string[]): Promise<ConfigFactory[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Get validation recommendations for current configuration.
|
|
90
|
+
* This method analyzes the loaded configuration and provides validation recommendations.
|
|
91
|
+
*
|
|
92
|
+
* @returns Promise resolving to validation recommendations
|
|
93
|
+
*/
|
|
94
|
+
getValidationRecommendations(): Promise<Record<string, any>>;
|
|
95
|
+
/**
|
|
96
|
+
* Validate namespace access patterns for current configuration.
|
|
97
|
+
* This method checks if namespace configurations are properly structured for @nestjs/config access.
|
|
98
|
+
*
|
|
99
|
+
* @param namespaces - Namespaces to validate
|
|
100
|
+
* @returns Promise resolving to validation results
|
|
101
|
+
*/
|
|
102
|
+
validateNamespaceAccess(namespaces: string[]): Promise<Record<string, any>>;
|
|
103
|
+
/**
|
|
104
|
+
* Reset the factory registration state.
|
|
105
|
+
* This method clears all registered factories and resets the initialization state.
|
|
106
|
+
*/
|
|
107
|
+
reset(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Load configuration from AWS sources with error handling.
|
|
110
|
+
* @returns Promise resolving to AWS configuration data
|
|
111
|
+
*/
|
|
112
|
+
private loadAwsConfiguration;
|
|
113
|
+
/**
|
|
114
|
+
* Create configuration factories based on loaded AWS configuration.
|
|
115
|
+
* @param awsConfig - Configuration data loaded from AWS
|
|
116
|
+
* @returns Promise resolving to array of configuration factories
|
|
117
|
+
*/
|
|
118
|
+
private createConfigurationFactories;
|
|
119
|
+
/**
|
|
120
|
+
* Create namespaced factories from configuration data.
|
|
121
|
+
* @param config - Configuration data organized by namespace
|
|
122
|
+
* @param sources - Configuration sources metadata
|
|
123
|
+
* @returns Array of namespaced configuration factories
|
|
124
|
+
*/
|
|
125
|
+
private createNamespacedFactoriesFromConfig;
|
|
126
|
+
/**
|
|
127
|
+
* Create a single factory from all configuration data.
|
|
128
|
+
* @param config - All configuration data
|
|
129
|
+
* @param sources - Configuration sources metadata
|
|
130
|
+
* @returns Single configuration factory or null if no valid configuration
|
|
131
|
+
*/
|
|
132
|
+
private createSingleFactoryFromConfig;
|
|
133
|
+
/**
|
|
134
|
+
* Register factories internally and track them.
|
|
135
|
+
* @param factories - Array of factories to register
|
|
136
|
+
*/
|
|
137
|
+
private registerFactoriesInternal;
|
|
138
|
+
/**
|
|
139
|
+
* Get a unique key for a factory for tracking purposes.
|
|
140
|
+
* @param factory - Configuration factory
|
|
141
|
+
* @returns Unique key for the factory
|
|
142
|
+
*/
|
|
143
|
+
private getFactoryKey;
|
|
144
|
+
/**
|
|
145
|
+
* Generate a simple hash for factory identification.
|
|
146
|
+
* @param str - String to hash
|
|
147
|
+
* @returns Simple hash value
|
|
148
|
+
*/
|
|
149
|
+
private simpleHash;
|
|
150
|
+
/**
|
|
151
|
+
* Validate if a namespace configuration is valid.
|
|
152
|
+
* @param namespace - The namespace name
|
|
153
|
+
* @param config - The configuration data
|
|
154
|
+
* @returns True if valid, false otherwise
|
|
155
|
+
*/
|
|
156
|
+
private isValidNamespaceConfig;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=factory-registration.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-registration.service.d.ts","sourceRoot":"","sources":["../../../../src/integration/services/factory-registration.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,kBAA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AAmC,CACvC,UAAU,EAAE,MAAM,EAAE,EACpB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACtC,cAAc,GAAE,KAAK,GAAG,iBAAiB,GAAG,QAAmB,GAC9D,OAAO,CAAC,aAAa,EAAE,CAAC;IAgE3B;;;;;;OAMG;IACG,gCAAgC,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAoCtF;;;;;OAKG;IACG,4BAA4B,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAclE;;;;;;OAMG;IACG,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAgBjF;;;OAGG;IACH,KAAK,IAAI,IAAI;IAMb;;;OAGG;YACW,oBAAoB;IAiClC;;;;OAIG;YACW,4BAA4B;IA2B1C;;;;;OAKG;IACH,OAAO,CAAC,mCAAmC;IA2B3C;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAyBrC;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAYjC;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAarB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAUlB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;CAQ/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './integration-state.service';
|
|
2
|
+
export * from './error-handler.service';
|
|
3
|
+
export * from './precedence-handler.service';
|
|
4
|
+
export * from './factory-registration.service';
|
|
5
|
+
export * from './nestjs-config-integration.service';
|
|
6
|
+
export * from './async-config-helper.service';
|
|
7
|
+
export * from './namespace-handler.service';
|
|
8
|
+
export * from './validation-integration.service';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integration/services/index.ts"],"names":[],"mappings":"AACA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IntegrationState } from '../interfaces/integration-state.interface';
|
|
2
|
+
import { ConfigurationSource } from '../interfaces/configuration-source.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Service for managing the state of the integration module.
|
|
5
|
+
*/
|
|
6
|
+
export declare class IntegrationStateService {
|
|
7
|
+
private state;
|
|
8
|
+
/**
|
|
9
|
+
* Get the current integration state.
|
|
10
|
+
*/
|
|
11
|
+
getState(): IntegrationState;
|
|
12
|
+
/**
|
|
13
|
+
* Mark the integration as initialized.
|
|
14
|
+
*/
|
|
15
|
+
setInitialized(initialized: boolean): void;
|
|
16
|
+
/**
|
|
17
|
+
* Set AWS availability status.
|
|
18
|
+
*/
|
|
19
|
+
setAwsAvailable(available: boolean): void;
|
|
20
|
+
/**
|
|
21
|
+
* Add a loaded configuration source.
|
|
22
|
+
*/
|
|
23
|
+
addLoadedSource(source: ConfigurationSource): void;
|
|
24
|
+
/**
|
|
25
|
+
* Add a registered factory name.
|
|
26
|
+
*/
|
|
27
|
+
addRegisteredFactory(factoryName: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Add an error to the state.
|
|
30
|
+
*/
|
|
31
|
+
addError(error: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Clear all errors.
|
|
34
|
+
*/
|
|
35
|
+
clearErrors(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Reset the integration state.
|
|
38
|
+
*/
|
|
39
|
+
reset(): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=integration-state.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-state.service.d.ts","sourceRoot":"","sources":["../../../../src/integration/services/integration-state.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF;;GAEG;AACH,qBACa,uBAAuB;IAClC,OAAO,CAAC,KAAK,CAMX;IAEF;;OAEG;IACH,QAAQ,IAAI,gBAAgB;IAI5B;;OAEG;IACH,cAAc,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI;IAI1C;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAIzC;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;IAIlD;;OAEG;IACH,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAI/C;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;OAEG;IACH,KAAK,IAAI,IAAI;CASd"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { ConfigFactory } from '@nestjs/config';
|
|
2
|
+
import { ConfigurationSource } from '../interfaces/configuration-source.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Service for handling namespace-aware configuration loading and factory creation.
|
|
5
|
+
* Provides enhanced namespace support for @nestjs/config integration.
|
|
6
|
+
*/
|
|
7
|
+
export declare class NamespaceHandlerService {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
/**
|
|
10
|
+
* Create a registerAs factory for a specific namespace.
|
|
11
|
+
* This method creates a factory that can be used with @nestjs/config's registerAs pattern.
|
|
12
|
+
*
|
|
13
|
+
* @param namespace - The namespace for the configuration
|
|
14
|
+
* @param config - The configuration data for the namespace
|
|
15
|
+
* @param sources - Optional configuration sources metadata
|
|
16
|
+
* @returns A registerAs factory for the namespace
|
|
17
|
+
*/
|
|
18
|
+
createNamespaceFactory(namespace: string, config: Record<string, any>, sources?: ConfigurationSource[]): ConfigFactory;
|
|
19
|
+
/**
|
|
20
|
+
* Create multiple namespace factories from configuration data.
|
|
21
|
+
*
|
|
22
|
+
* @param namespacedConfig - Configuration data organized by namespace
|
|
23
|
+
* @param sources - Optional configuration sources metadata
|
|
24
|
+
* @returns Array of namespace factories
|
|
25
|
+
*/
|
|
26
|
+
createMultipleNamespaceFactories(namespacedConfig: Record<string, Record<string, any>>, sources?: ConfigurationSource[]): ConfigFactory[];
|
|
27
|
+
/**
|
|
28
|
+
* Extract namespace configuration from flat configuration using various strategies.
|
|
29
|
+
*
|
|
30
|
+
* @param config - Flat configuration object
|
|
31
|
+
* @param namespace - Target namespace
|
|
32
|
+
* @returns Configuration for the namespace
|
|
33
|
+
*/
|
|
34
|
+
extractNamespaceConfig(config: Record<string, any>, namespace: string): Record<string, any>;
|
|
35
|
+
/**
|
|
36
|
+
* Organize flat configuration into namespaces based on patterns.
|
|
37
|
+
*
|
|
38
|
+
* @param config - Flat configuration object
|
|
39
|
+
* @param namespaces - List of target namespaces
|
|
40
|
+
* @returns Configuration organized by namespace
|
|
41
|
+
*/
|
|
42
|
+
organizeConfigByNamespaces(config: Record<string, any>, namespaces: string[]): Record<string, Record<string, any>>;
|
|
43
|
+
/**
|
|
44
|
+
* Validate namespace access patterns for @nestjs/config compatibility.
|
|
45
|
+
*
|
|
46
|
+
* @param namespace - Namespace to validate
|
|
47
|
+
* @param config - Configuration for the namespace
|
|
48
|
+
* @returns Validation result with suggestions
|
|
49
|
+
*/
|
|
50
|
+
validateNamespaceAccess(namespace: string, config: Record<string, any>): {
|
|
51
|
+
isValid: boolean;
|
|
52
|
+
issues: string[];
|
|
53
|
+
suggestions: string[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Generate access patterns documentation for a namespace.
|
|
57
|
+
*
|
|
58
|
+
* @param namespace - Namespace name
|
|
59
|
+
* @param config - Configuration for the namespace
|
|
60
|
+
* @returns Access patterns documentation
|
|
61
|
+
*/
|
|
62
|
+
generateAccessPatterns(namespace: string, config: Record<string, any>): {
|
|
63
|
+
namespace: string;
|
|
64
|
+
patterns: {
|
|
65
|
+
injection: string;
|
|
66
|
+
service: string;
|
|
67
|
+
direct: string;
|
|
68
|
+
};
|
|
69
|
+
examples: string[];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Process namespace configuration with validation and transformation.
|
|
73
|
+
*
|
|
74
|
+
* @param config - Raw configuration for the namespace
|
|
75
|
+
* @param namespace - Namespace name
|
|
76
|
+
* @returns Processed configuration
|
|
77
|
+
*/
|
|
78
|
+
private processNamespaceConfig;
|
|
79
|
+
/**
|
|
80
|
+
* Extract configuration using prefix patterns.
|
|
81
|
+
*
|
|
82
|
+
* @param config - Source configuration
|
|
83
|
+
* @param namespace - Target namespace
|
|
84
|
+
* @returns Prefixed configuration
|
|
85
|
+
*/
|
|
86
|
+
private extractPrefixedConfig;
|
|
87
|
+
/**
|
|
88
|
+
* Extract configuration using path patterns.
|
|
89
|
+
*
|
|
90
|
+
* @param config - Source configuration
|
|
91
|
+
* @param namespace - Target namespace
|
|
92
|
+
* @returns Path-based configuration
|
|
93
|
+
*/
|
|
94
|
+
private extractPathBasedConfig;
|
|
95
|
+
/**
|
|
96
|
+
* Extract configuration that doesn't belong to any namespace.
|
|
97
|
+
*
|
|
98
|
+
* @param config - Source configuration
|
|
99
|
+
* @param namespaces - Known namespaces
|
|
100
|
+
* @returns Remaining configuration
|
|
101
|
+
*/
|
|
102
|
+
private extractRemainingConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Add metadata to a factory for introspection.
|
|
105
|
+
*
|
|
106
|
+
* @param factory - Configuration factory
|
|
107
|
+
* @param namespace - Namespace name
|
|
108
|
+
* @param config - Configuration data
|
|
109
|
+
* @param sources - Configuration sources
|
|
110
|
+
*/
|
|
111
|
+
private addFactoryMetadata;
|
|
112
|
+
/**
|
|
113
|
+
* Transform configuration values (type conversion, etc.).
|
|
114
|
+
*
|
|
115
|
+
* @param config - Configuration to transform
|
|
116
|
+
*/
|
|
117
|
+
private transformConfigValues;
|
|
118
|
+
/**
|
|
119
|
+
* Convert string values to appropriate types.
|
|
120
|
+
*
|
|
121
|
+
* @param value - String value to convert
|
|
122
|
+
* @returns Converted value
|
|
123
|
+
*/
|
|
124
|
+
private convertStringValue;
|
|
125
|
+
/**
|
|
126
|
+
* Validate processed configuration.
|
|
127
|
+
*
|
|
128
|
+
* @param config - Configuration to validate
|
|
129
|
+
* @param namespace - Namespace name
|
|
130
|
+
*/
|
|
131
|
+
private validateProcessedConfig;
|
|
132
|
+
/**
|
|
133
|
+
* Convert snake_case or kebab-case to camelCase.
|
|
134
|
+
*
|
|
135
|
+
* @param str - String to convert
|
|
136
|
+
* @returns camelCase string
|
|
137
|
+
*/
|
|
138
|
+
private toCamelCase;
|
|
139
|
+
/**
|
|
140
|
+
* Convert path segments to nested key structure.
|
|
141
|
+
*
|
|
142
|
+
* @param path - Path string
|
|
143
|
+
* @returns Nested key structure
|
|
144
|
+
*/
|
|
145
|
+
private pathToNestedKey;
|
|
146
|
+
/**
|
|
147
|
+
* Set a nested value in an object using dot notation.
|
|
148
|
+
*
|
|
149
|
+
* @param obj - Target object
|
|
150
|
+
* @param path - Dot notation path
|
|
151
|
+
* @param value - Value to set
|
|
152
|
+
*/
|
|
153
|
+
private setNestedValue;
|
|
154
|
+
/**
|
|
155
|
+
* Validate namespace name.
|
|
156
|
+
*
|
|
157
|
+
* @param namespace - Namespace to validate
|
|
158
|
+
* @returns Whether namespace is valid
|
|
159
|
+
*/
|
|
160
|
+
private isValidNamespace;
|
|
161
|
+
/**
|
|
162
|
+
* Check if namespace is reserved.
|
|
163
|
+
*
|
|
164
|
+
* @param namespace - Namespace to check
|
|
165
|
+
* @returns Whether namespace is reserved
|
|
166
|
+
*/
|
|
167
|
+
private isReservedNamespace;
|
|
168
|
+
/**
|
|
169
|
+
* Validate namespace configuration.
|
|
170
|
+
*
|
|
171
|
+
* @param namespace - Namespace name
|
|
172
|
+
* @param config - Configuration data
|
|
173
|
+
* @returns Whether configuration is valid
|
|
174
|
+
*/
|
|
175
|
+
private isValidNamespaceConfig;
|
|
176
|
+
/**
|
|
177
|
+
* Find key conflicts in configuration.
|
|
178
|
+
*
|
|
179
|
+
* @param config - Configuration to check
|
|
180
|
+
* @returns Array of conflicting keys
|
|
181
|
+
*/
|
|
182
|
+
private findKeyConflicts;
|
|
183
|
+
/**
|
|
184
|
+
* Generate usage examples for a namespace.
|
|
185
|
+
*
|
|
186
|
+
* @param namespace - Namespace name
|
|
187
|
+
* @param config - Configuration data
|
|
188
|
+
* @returns Array of usage examples
|
|
189
|
+
*/
|
|
190
|
+
private generateUsageExamples;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=namespace-handler.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-handler.service.d.ts","sourceRoot":"","sources":["../../../../src/integration/services/namespace-handler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAc,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF;;;GAGG;AACH,qBACa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE;;;;;;;;OAQG;IACH,sBAAsB,CACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,CAAC,EAAE,mBAAmB,EAAE,GAC9B,aAAa;IA4BhB;;;;;;OAMG;IACH,gCAAgC,CAC9B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EACrD,OAAO,CAAC,EAAE,mBAAmB,EAAE,GAC9B,aAAa,EAAE;IA6BlB;;;;;;OAMG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAA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;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAOvB;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAoBtB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAK3B;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;CAoB9B"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ConfigFactory, ConfigModuleOptions } from '@nestjs/config';
|
|
2
|
+
import { DynamicModule } from '@nestjs/common';
|
|
3
|
+
import { FactoryRegistrationService } from './factory-registration.service';
|
|
4
|
+
import { IntegrationOptions } from '../interfaces/integration-options.interface';
|
|
5
|
+
/**
|
|
6
|
+
* Service that provides integration utilities for working with @nestjs/config.
|
|
7
|
+
* This service creates ConfigModule configurations that include AWS-sourced factories.
|
|
8
|
+
*/
|
|
9
|
+
export declare class NestjsConfigIntegrationService {
|
|
10
|
+
private readonly factoryRegistrationService;
|
|
11
|
+
private readonly options;
|
|
12
|
+
private readonly logger;
|
|
13
|
+
constructor(factoryRegistrationService: FactoryRegistrationService, options?: IntegrationOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Create a ConfigModule configuration with AWS-sourced factories.
|
|
16
|
+
* This method can be used to enhance existing @nestjs/config setups.
|
|
17
|
+
*
|
|
18
|
+
* @param baseOptions - Base ConfigModule options to enhance
|
|
19
|
+
* @returns Promise resolving to enhanced ConfigModule options
|
|
20
|
+
*/
|
|
21
|
+
createConfigModuleOptions(baseOptions?: ConfigModuleOptions): Promise<ConfigModuleOptions>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a ConfigModule configuration for async setup.
|
|
24
|
+
* This method works with ConfigModule.forRootAsync() pattern.
|
|
25
|
+
*
|
|
26
|
+
* @param baseOptions - Base async ConfigModule options to enhance
|
|
27
|
+
* @returns Promise resolving to enhanced async ConfigModule options
|
|
28
|
+
*/
|
|
29
|
+
createAsyncConfigModuleOptions(baseOptions?: any): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a complete ConfigModule with AWS integration.
|
|
32
|
+
* This method returns a ready-to-use DynamicModule.
|
|
33
|
+
*
|
|
34
|
+
* @param baseOptions - Base ConfigModule options
|
|
35
|
+
* @returns Promise resolving to DynamicModule with AWS integration
|
|
36
|
+
*/
|
|
37
|
+
createIntegratedConfigModule(baseOptions?: ConfigModuleOptions): Promise<DynamicModule>;
|
|
38
|
+
/**
|
|
39
|
+
* Create an async integrated ConfigModule.
|
|
40
|
+
* This method returns a ready-to-use async DynamicModule.
|
|
41
|
+
*
|
|
42
|
+
* @param baseOptions - Base async ConfigModule options
|
|
43
|
+
* @returns Promise resolving to DynamicModule with async AWS integration
|
|
44
|
+
*/
|
|
45
|
+
createAsyncIntegratedConfigModule(baseOptions?: ConfigModuleOptions): Promise<DynamicModule>;
|
|
46
|
+
/**
|
|
47
|
+
* Get configuration factories for manual registration.
|
|
48
|
+
* This method allows developers to manually register AWS factories with their own ConfigModule setup.
|
|
49
|
+
*
|
|
50
|
+
* @returns Promise resolving to array of configuration factories
|
|
51
|
+
*/
|
|
52
|
+
getConfigurationFactories(): Promise<ConfigFactory[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Get namespaced configuration factories.
|
|
55
|
+
* This method returns factories for specific namespaces only.
|
|
56
|
+
*
|
|
57
|
+
* @param namespaces - Array of namespace names to get factories for
|
|
58
|
+
* @returns Promise resolving to array of namespaced configuration factories
|
|
59
|
+
*/
|
|
60
|
+
getNamespacedFactories(namespaces: string[]): Promise<ConfigFactory[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Create a configuration factory for immediate use.
|
|
63
|
+
* This method creates a single factory that can be used directly with @nestjs/config.
|
|
64
|
+
*
|
|
65
|
+
* @param namespace - Optional namespace for the factory
|
|
66
|
+
* @param config - Optional configuration data to use
|
|
67
|
+
* @returns Configuration factory
|
|
68
|
+
*/
|
|
69
|
+
createImmediateFactory(namespace?: string, config?: Record<string, any>): ConfigFactory;
|
|
70
|
+
/**
|
|
71
|
+
* Check if AWS integration is available and working.
|
|
72
|
+
* This method can be used to verify the integration status.
|
|
73
|
+
*
|
|
74
|
+
* @returns Promise resolving to integration status
|
|
75
|
+
*/
|
|
76
|
+
checkIntegrationStatus(): Promise<{
|
|
77
|
+
isAvailable: boolean;
|
|
78
|
+
factoriesRegistered: number;
|
|
79
|
+
errors: string[];
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Reset the integration state.
|
|
83
|
+
* This method clears all registered factories and resets the integration.
|
|
84
|
+
*/
|
|
85
|
+
resetIntegration(): void;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=nestjs-config-integration.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nestjs-config-integration.service.d.ts","sourceRoot":"","sources":["../../../../src/integration/services/nestjs-config-integration.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAgB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAGjF;;;GAGG;AACH,qBACa,8BAA8B;IAIvC,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAE3C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmD;gBAGvD,0BAA0B,EAAE,0BAA0B,EAEtD,OAAO,GAAE,kBAAuB;IAGnD;;;;;;OAMG;IACG,yBAAyB,CAAC,WAAW,GAAE,mBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA0CpG;;;;;;OAMG;IACG,8BAA8B,CAAC,WAAW,GAAE,GAAQ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