@morojs/moro 1.5.17 → 1.6.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.
Files changed (138) hide show
  1. package/README.md +48 -65
  2. package/dist/core/auth/morojs-adapter.js +12 -16
  3. package/dist/core/auth/morojs-adapter.js.map +1 -1
  4. package/dist/core/config/file-loader.d.ts +5 -0
  5. package/dist/core/config/file-loader.js +171 -0
  6. package/dist/core/config/file-loader.js.map +1 -1
  7. package/dist/core/config/index.d.ts +10 -39
  8. package/dist/core/config/index.js +29 -66
  9. package/dist/core/config/index.js.map +1 -1
  10. package/dist/core/config/loader.d.ts +7 -0
  11. package/dist/core/config/loader.js +269 -0
  12. package/dist/core/config/loader.js.map +1 -0
  13. package/dist/core/config/schema.js +31 -41
  14. package/dist/core/config/schema.js.map +1 -1
  15. package/dist/core/config/utils.d.ts +2 -9
  16. package/dist/core/config/utils.js +32 -19
  17. package/dist/core/config/utils.js.map +1 -1
  18. package/dist/core/config/validation.d.ts +17 -0
  19. package/dist/core/config/validation.js +131 -0
  20. package/dist/core/config/validation.js.map +1 -0
  21. package/dist/core/database/adapters/mongodb.d.ts +0 -10
  22. package/dist/core/database/adapters/mongodb.js +2 -23
  23. package/dist/core/database/adapters/mongodb.js.map +1 -1
  24. package/dist/core/database/adapters/mysql.d.ts +0 -11
  25. package/dist/core/database/adapters/mysql.js +0 -1
  26. package/dist/core/database/adapters/mysql.js.map +1 -1
  27. package/dist/core/database/adapters/postgresql.d.ts +1 -9
  28. package/dist/core/database/adapters/postgresql.js +1 -1
  29. package/dist/core/database/adapters/postgresql.js.map +1 -1
  30. package/dist/core/database/adapters/redis.d.ts +0 -9
  31. package/dist/core/database/adapters/redis.js +4 -14
  32. package/dist/core/database/adapters/redis.js.map +1 -1
  33. package/dist/core/framework.d.ts +7 -6
  34. package/dist/core/framework.js +16 -131
  35. package/dist/core/framework.js.map +1 -1
  36. package/dist/core/http/http-server.d.ts +0 -12
  37. package/dist/core/http/http-server.js +23 -151
  38. package/dist/core/http/http-server.js.map +1 -1
  39. package/dist/core/http/router.d.ts +0 -12
  40. package/dist/core/http/router.js +36 -114
  41. package/dist/core/http/router.js.map +1 -1
  42. package/dist/core/logger/filters.js +4 -12
  43. package/dist/core/logger/filters.js.map +1 -1
  44. package/dist/core/logger/index.d.ts +1 -1
  45. package/dist/core/logger/index.js +1 -2
  46. package/dist/core/logger/index.js.map +1 -1
  47. package/dist/core/logger/logger.d.ts +13 -29
  48. package/dist/core/logger/logger.js +203 -380
  49. package/dist/core/logger/logger.js.map +1 -1
  50. package/dist/core/logger/outputs.js +2 -0
  51. package/dist/core/logger/outputs.js.map +1 -1
  52. package/dist/core/middleware/built-in/auth.js +17 -88
  53. package/dist/core/middleware/built-in/auth.js.map +1 -1
  54. package/dist/core/middleware/built-in/cache.js +1 -3
  55. package/dist/core/middleware/built-in/cache.js.map +1 -1
  56. package/dist/core/middleware/built-in/index.d.ts +0 -1
  57. package/dist/core/middleware/built-in/index.js +1 -6
  58. package/dist/core/middleware/built-in/index.js.map +1 -1
  59. package/dist/core/middleware/built-in/request-logger.js +2 -3
  60. package/dist/core/middleware/built-in/request-logger.js.map +1 -1
  61. package/dist/core/middleware/built-in/sse.js +7 -9
  62. package/dist/core/middleware/built-in/sse.js.map +1 -1
  63. package/dist/core/modules/auto-discovery.d.ts +0 -17
  64. package/dist/core/modules/auto-discovery.js +12 -367
  65. package/dist/core/modules/auto-discovery.js.map +1 -1
  66. package/dist/core/modules/modules.js +2 -12
  67. package/dist/core/modules/modules.js.map +1 -1
  68. package/dist/core/networking/adapters/ws-adapter.d.ts +1 -1
  69. package/dist/core/networking/adapters/ws-adapter.js +2 -2
  70. package/dist/core/networking/adapters/ws-adapter.js.map +1 -1
  71. package/dist/core/networking/service-discovery.js +7 -7
  72. package/dist/core/networking/service-discovery.js.map +1 -1
  73. package/dist/core/routing/index.d.ts +0 -20
  74. package/dist/core/routing/index.js +13 -178
  75. package/dist/core/routing/index.js.map +1 -1
  76. package/dist/core/runtime/node-adapter.js +6 -12
  77. package/dist/core/runtime/node-adapter.js.map +1 -1
  78. package/dist/moro.d.ts +0 -48
  79. package/dist/moro.js +148 -456
  80. package/dist/moro.js.map +1 -1
  81. package/dist/types/config.d.ts +2 -58
  82. package/dist/types/core.d.ts +40 -34
  83. package/dist/types/http.d.ts +1 -16
  84. package/dist/types/logger.d.ts +0 -7
  85. package/dist/types/module.d.ts +0 -11
  86. package/package.json +2 -2
  87. package/src/core/auth/morojs-adapter.ts +13 -18
  88. package/src/core/config/file-loader.ts +233 -0
  89. package/src/core/config/index.ts +32 -77
  90. package/src/core/config/loader.ts +633 -0
  91. package/src/core/config/schema.ts +31 -41
  92. package/src/core/config/utils.ts +29 -22
  93. package/src/core/config/validation.ts +140 -0
  94. package/src/core/database/README.md +16 -26
  95. package/src/core/database/adapters/mongodb.ts +2 -30
  96. package/src/core/database/adapters/mysql.ts +0 -14
  97. package/src/core/database/adapters/postgresql.ts +2 -12
  98. package/src/core/database/adapters/redis.ts +4 -27
  99. package/src/core/framework.ts +23 -163
  100. package/src/core/http/http-server.ts +36 -176
  101. package/src/core/http/router.ts +38 -127
  102. package/src/core/logger/filters.ts +4 -12
  103. package/src/core/logger/index.ts +0 -1
  104. package/src/core/logger/logger.ts +216 -427
  105. package/src/core/logger/outputs.ts +2 -0
  106. package/src/core/middleware/built-in/auth.ts +17 -98
  107. package/src/core/middleware/built-in/cache.ts +1 -3
  108. package/src/core/middleware/built-in/index.ts +0 -8
  109. package/src/core/middleware/built-in/request-logger.ts +1 -3
  110. package/src/core/middleware/built-in/sse.ts +7 -9
  111. package/src/core/modules/auto-discovery.ts +13 -476
  112. package/src/core/modules/modules.ts +9 -20
  113. package/src/core/networking/adapters/ws-adapter.ts +5 -2
  114. package/src/core/networking/service-discovery.ts +7 -6
  115. package/src/core/routing/index.ts +14 -198
  116. package/src/core/runtime/node-adapter.ts +6 -12
  117. package/src/moro.ts +166 -554
  118. package/src/types/config.ts +2 -59
  119. package/src/types/core.ts +45 -47
  120. package/src/types/http.ts +1 -23
  121. package/src/types/logger.ts +0 -9
  122. package/src/types/module.ts +0 -12
  123. package/dist/core/config/config-manager.d.ts +0 -44
  124. package/dist/core/config/config-manager.js +0 -114
  125. package/dist/core/config/config-manager.js.map +0 -1
  126. package/dist/core/config/config-sources.d.ts +0 -21
  127. package/dist/core/config/config-sources.js +0 -502
  128. package/dist/core/config/config-sources.js.map +0 -1
  129. package/dist/core/config/config-validator.d.ts +0 -21
  130. package/dist/core/config/config-validator.js +0 -765
  131. package/dist/core/config/config-validator.js.map +0 -1
  132. package/dist/core/middleware/built-in/jwt-helpers.d.ts +0 -118
  133. package/dist/core/middleware/built-in/jwt-helpers.js +0 -221
  134. package/dist/core/middleware/built-in/jwt-helpers.js.map +0 -1
  135. package/src/core/config/config-manager.ts +0 -133
  136. package/src/core/config/config-sources.ts +0 -596
  137. package/src/core/config/config-validator.ts +0 -1078
  138. package/src/core/middleware/built-in/jwt-helpers.ts +0 -240
@@ -3,15 +3,9 @@
3
3
  export interface ServerConfig {
4
4
  port: number;
5
5
  host: string;
6
+ environment: 'development' | 'staging' | 'production';
6
7
  maxConnections: number;
7
8
  timeout: number;
8
- bodySizeLimit: string;
9
- requestTracking: {
10
- enabled: boolean;
11
- };
12
- errorBoundary: {
13
- enabled: boolean;
14
- };
15
9
  }
16
10
 
17
11
  export interface ServiceDiscoveryConfig {
@@ -25,7 +19,7 @@ export interface ServiceDiscoveryConfig {
25
19
 
26
20
  export interface DatabaseConfig {
27
21
  url?: string;
28
- redis?: {
22
+ redis: {
29
23
  url: string;
30
24
  maxRetries: number;
31
25
  retryDelay: number;
@@ -41,28 +35,6 @@ export interface DatabaseConfig {
41
35
  acquireTimeout: number;
42
36
  timeout: number;
43
37
  };
44
- postgresql?: {
45
- host: string;
46
- port: number;
47
- database?: string;
48
- user?: string;
49
- password?: string;
50
- connectionLimit: number;
51
- ssl?: boolean;
52
- };
53
- sqlite?: {
54
- filename: string;
55
- memory?: boolean;
56
- verbose?: boolean;
57
- };
58
- mongodb?: {
59
- url?: string;
60
- host?: string;
61
- port?: number;
62
- database?: string;
63
- username?: string;
64
- password?: string;
65
- };
66
38
  }
67
39
 
68
40
  export interface ModuleDefaultsConfig {
@@ -84,18 +56,6 @@ export interface ModuleDefaultsConfig {
84
56
  stripUnknown: boolean;
85
57
  abortEarly: boolean;
86
58
  };
87
- autoDiscovery: {
88
- enabled: boolean;
89
- paths: string[];
90
- patterns: string[];
91
- recursive: boolean;
92
- loadingStrategy: 'eager' | 'lazy' | 'conditional';
93
- watchForChanges: boolean;
94
- ignorePatterns: string[];
95
- loadOrder: 'alphabetical' | 'dependency' | 'custom';
96
- failOnError: boolean;
97
- maxDepth: number;
98
- };
99
59
  }
100
60
 
101
61
  export interface LoggingConfig {
@@ -181,22 +141,6 @@ export interface PerformanceConfig {
181
141
  clustering: {
182
142
  enabled: boolean;
183
143
  workers: number | 'auto';
184
- memoryPerWorkerGB?: number;
185
- };
186
- }
187
-
188
- export interface WebSocketConfig {
189
- enabled: boolean;
190
- adapter?: string | 'socket.io' | 'ws';
191
- compression?: boolean;
192
- customIdGenerator?: () => string;
193
- options?: {
194
- cors?: {
195
- origin?: string | string[];
196
- credentials?: boolean;
197
- };
198
- path?: string;
199
- maxPayloadLength?: number;
200
144
  };
201
145
  }
202
146
 
@@ -210,5 +154,4 @@ export interface AppConfig {
210
154
  security: SecurityConfig;
211
155
  external: ExternalServicesConfig;
212
156
  performance: PerformanceConfig;
213
- websocket: WebSocketConfig;
214
157
  }
package/src/types/core.ts CHANGED
@@ -1,58 +1,56 @@
1
1
  // Core Framework Types
2
2
  import { RuntimeConfig } from './runtime';
3
3
  import { LogLevel, LoggerOptions } from './logger';
4
- import { AppConfig } from './config';
5
4
 
6
5
  export interface MoroOptions {
7
- autoDiscover?:
8
- | boolean
9
- | {
10
- enabled?: boolean;
11
- paths?: string[];
12
- patterns?: string[];
13
- recursive?: boolean;
14
- loadingStrategy?: 'eager' | 'lazy' | 'conditional';
15
- watchForChanges?: boolean;
16
- ignorePatterns?: string[];
17
- loadOrder?: 'alphabetical' | 'dependency' | 'custom';
18
- failOnError?: boolean;
19
- maxDepth?: number;
20
- };
21
- modulesPath?: string; // Deprecated: use autoDiscover.paths instead
6
+ autoDiscover?: boolean;
7
+ modulesPath?: string;
22
8
  middleware?: any[];
23
-
24
- // Runtime configuration
25
- runtime?: RuntimeConfig;
26
-
27
- // HTTP/WebSocket options
28
- http2?: boolean;
29
- https?: {
30
- key: string | Buffer;
31
- cert: string | Buffer;
32
- ca?: string | Buffer;
33
- };
34
- websocket?:
35
- | {
36
- enabled?: boolean;
37
- adapter?: any;
38
- compression?: boolean;
39
- customIdGenerator?: () => string;
40
- options?: any;
41
- }
42
- | false;
43
-
44
- // Simplified config options (these map to the full config)
9
+ database?: any;
45
10
  cors?: boolean | object;
46
11
  compression?: boolean | object;
47
12
  helmet?: boolean | object;
13
+ // Runtime configuration
14
+ runtime?: RuntimeConfig;
15
+ // Logger configuration
48
16
  logger?: LoggerOptions | boolean;
49
-
50
- // Direct config overrides (partial)
51
- server?: Partial<AppConfig['server']>;
52
- database?: Partial<AppConfig['database']>;
53
- modules?: Partial<AppConfig['modules']>;
54
- logging?: Partial<AppConfig['logging']>;
55
- security?: Partial<AppConfig['security']>;
56
- external?: Partial<AppConfig['external']>;
57
- performance?: Partial<AppConfig['performance']>;
17
+ // Module configuration
18
+ modules?: {
19
+ cache?: {
20
+ enabled?: boolean;
21
+ defaultTtl?: number;
22
+ maxSize?: number;
23
+ strategy?: 'lru' | 'lfu' | 'fifo';
24
+ };
25
+ rateLimit?: {
26
+ enabled?: boolean;
27
+ defaultRequests?: number;
28
+ defaultWindow?: number;
29
+ skipSuccessfulRequests?: boolean;
30
+ skipFailedRequests?: boolean;
31
+ };
32
+ validation?: {
33
+ enabled?: boolean;
34
+ stripUnknown?: boolean;
35
+ abortEarly?: boolean;
36
+ };
37
+ };
38
+ // Performance configuration
39
+ performance?: {
40
+ clustering?: {
41
+ enabled?: boolean;
42
+ workers?: number | 'auto';
43
+ };
44
+ compression?: {
45
+ enabled?: boolean;
46
+ level?: number;
47
+ threshold?: number;
48
+ };
49
+ circuitBreaker?: {
50
+ enabled?: boolean;
51
+ failureThreshold?: number;
52
+ resetTimeout?: number;
53
+ monitoringPeriod?: number;
54
+ };
55
+ };
58
56
  }
package/src/types/http.ts CHANGED
@@ -22,20 +22,9 @@ export interface CookieOptions {
22
22
  sameSite?: 'strict' | 'lax' | 'none';
23
23
  domain?: string;
24
24
  path?: string;
25
- // Security options
26
- critical?: boolean; // Mark as critical for security (throws on late set)
27
- throwOnLateSet?: boolean; // Force throw if headers already sent
28
25
  }
29
26
 
30
- export interface ResponseState {
31
- headersSent: boolean;
32
- statusCode: number;
33
- headers: Record<string, any>;
34
- finished: boolean;
35
- writable: boolean;
36
- }
37
-
38
- export interface MoroResponseMethods {
27
+ export interface HttpResponse extends ServerResponse {
39
28
  json(data: any): void;
40
29
  status(code: number): HttpResponse;
41
30
  send(data: string | Buffer): void;
@@ -44,19 +33,8 @@ export interface MoroResponseMethods {
44
33
  redirect(url: string, status?: number): void;
45
34
  sendFile(filePath: string): Promise<void>;
46
35
  render?(template: string, data?: any): Promise<void>;
47
-
48
- // Header management utilities
49
- hasHeader(name: string): boolean;
50
- setBulkHeaders(headers: Record<string, string | number>): HttpResponse;
51
- appendHeader(name: string, value: string | string[]): HttpResponse;
52
-
53
- // Response state utilities
54
- canSetHeaders(): boolean;
55
- getResponseState(): ResponseState;
56
36
  }
57
37
 
58
- export type HttpResponse = ServerResponse & MoroResponseMethods;
59
-
60
38
  export type HttpHandler = (req: HttpRequest, res: HttpResponse) => Promise<void> | void;
61
39
  export type Middleware = (
62
40
  req: HttpRequest,
@@ -30,7 +30,6 @@ export interface LoggerOptions {
30
30
  outputs?: LogOutput[];
31
31
  filters?: LogFilter[];
32
32
  maxEntries?: number;
33
- maxBufferSize?: number;
34
33
  }
35
34
 
36
35
  export interface LogOutput {
@@ -61,17 +60,11 @@ export interface Logger {
61
60
 
62
61
  // Configuration
63
62
  setLevel(level: LogLevel): void;
64
- getLevel(): LogLevel;
65
63
  addOutput(output: LogOutput): void;
66
64
  removeOutput(name: string): void;
67
65
  addFilter(filter: LogFilter): void;
68
66
  removeFilter(name: string): void;
69
67
 
70
- // Cleanup
71
- flush(): void;
72
- flushBuffer(): void;
73
- destroy(): void;
74
-
75
68
  // Metrics and history
76
69
  getHistory(count?: number): LogEntry[];
77
70
  getMetrics(): LogMetrics;
@@ -85,7 +78,6 @@ export interface LogMetrics {
85
78
  averageLogRate: number;
86
79
  errorRate: number;
87
80
  memoryUsage: number;
88
- outputErrors?: Record<string, number>;
89
81
  }
90
82
 
91
83
  export interface ColorScheme {
@@ -98,5 +90,4 @@ export interface ColorScheme {
98
90
  context: string;
99
91
  metadata: string;
100
92
  performance: string;
101
- reset: string;
102
93
  }
@@ -7,11 +7,6 @@ export interface ModuleRoute {
7
7
  cache?: { ttl: number; key?: string };
8
8
  rateLimit?: { requests: number; window: number };
9
9
  middleware?: string[];
10
- auth?: {
11
- roles?: string[];
12
- permissions?: string[];
13
- optional?: boolean;
14
- };
15
10
  }
16
11
 
17
12
  export interface ModuleSocket {
@@ -62,13 +57,6 @@ export interface InternalRouteDefinition {
62
57
  validation?: any;
63
58
  cache?: CacheConfig;
64
59
  rateLimit?: RateLimitConfig;
65
- auth?: {
66
- roles?: string[];
67
- permissions?: string[];
68
- optional?: boolean;
69
- };
70
- // Allow additional properties for extensibility
71
- [key: string]: any;
72
60
  }
73
61
 
74
62
  export interface WebSocketDefinition {
@@ -1,44 +0,0 @@
1
- /**
2
- * Configuration Manager - Immutable Single Source of Truth
3
- *
4
- * This module provides centralized, immutable configuration state management.
5
- * Configuration is locked at createApp() initialization and cannot be changed afterward.
6
- *
7
- * Precedence: Environment Variables > createApp Options > Config File > Defaults
8
- */
9
- import { AppConfig } from '../../types/config';
10
- /**
11
- * Initialize and lock global configuration state
12
- * This should only be called once during createApp() initialization
13
- */
14
- export declare function initializeAndLockConfig(config: AppConfig): void;
15
- /**
16
- * Get the current global configuration
17
- * Throws if configuration hasn't been initialized
18
- */
19
- export declare function getGlobalConfig(): Readonly<AppConfig>;
20
- /**
21
- * Check if configuration has been initialized and locked
22
- */
23
- export declare function isConfigLocked(): boolean;
24
- /**
25
- * Reset configuration state (for testing only)
26
- * @internal - This should only be used in tests
27
- */
28
- export declare function resetConfigForTesting(): void;
29
- /**
30
- * Get a specific configuration value using dot notation
31
- * This provides a safe way to access nested config values
32
- *
33
- * @example
34
- * getConfigValue('server.port') // Returns the server port
35
- * getConfigValue('database.redis.url') // Returns the Redis URL
36
- */
37
- export declare function getConfigValue<T = any>(path: string): T | undefined;
38
- /**
39
- * Utility functions for common environment checks
40
- * These now read NODE_ENV directly for consistency with Node.js ecosystem
41
- */
42
- export declare function isDevelopment(): boolean;
43
- export declare function isProduction(): boolean;
44
- export declare function isStaging(): boolean;
@@ -1,114 +0,0 @@
1
- "use strict";
2
- /**
3
- * Configuration Manager - Immutable Single Source of Truth
4
- *
5
- * This module provides centralized, immutable configuration state management.
6
- * Configuration is locked at createApp() initialization and cannot be changed afterward.
7
- *
8
- * Precedence: Environment Variables > createApp Options > Config File > Defaults
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.initializeAndLockConfig = initializeAndLockConfig;
12
- exports.getGlobalConfig = getGlobalConfig;
13
- exports.isConfigLocked = isConfigLocked;
14
- exports.resetConfigForTesting = resetConfigForTesting;
15
- exports.getConfigValue = getConfigValue;
16
- exports.isDevelopment = isDevelopment;
17
- exports.isProduction = isProduction;
18
- exports.isStaging = isStaging;
19
- const logger_1 = require("../logger");
20
- const logger = (0, logger_1.createFrameworkLogger)('ConfigManager');
21
- /**
22
- * Global configuration state - immutable after initialization
23
- */
24
- let globalConfig = null;
25
- let isLocked = false;
26
- /**
27
- * Initialize and lock global configuration state
28
- * This should only be called once during createApp() initialization
29
- */
30
- function initializeAndLockConfig(config) {
31
- if (isLocked) {
32
- throw new Error('Configuration is already locked and cannot be changed. ' +
33
- 'Configuration can only be set once during createApp() initialization.');
34
- }
35
- // Deep freeze the configuration to make it truly immutable
36
- globalConfig = deepFreeze(config);
37
- isLocked = true;
38
- logger.info(`Configuration locked and initialized: ${process.env.NODE_ENV || 'development'}:${config.server.port}`);
39
- }
40
- /**
41
- * Get the current global configuration
42
- * Throws if configuration hasn't been initialized
43
- */
44
- function getGlobalConfig() {
45
- if (!globalConfig || !isLocked) {
46
- throw new Error('Configuration not initialized. Call createApp() to initialize the configuration system.');
47
- }
48
- return globalConfig;
49
- }
50
- /**
51
- * Check if configuration has been initialized and locked
52
- */
53
- function isConfigLocked() {
54
- return isLocked && globalConfig !== null;
55
- }
56
- /**
57
- * Reset configuration state (for testing only)
58
- * @internal - This should only be used in tests
59
- */
60
- function resetConfigForTesting() {
61
- if (process.env.NODE_ENV !== 'test' &&
62
- !process.env.MORO_ALLOW_CONFIG_RESET &&
63
- !process.env.JEST_WORKER_ID) {
64
- throw new Error('Configuration reset is only allowed in test environments. ' +
65
- 'Set MORO_ALLOW_CONFIG_RESET=true to override this check.');
66
- }
67
- globalConfig = null;
68
- isLocked = false;
69
- logger.debug('Configuration state reset for testing');
70
- }
71
- /**
72
- * Deep freeze an object to make it truly immutable
73
- * This prevents any accidental mutations to the configuration
74
- */
75
- function deepFreeze(obj) {
76
- // Get property names
77
- const propNames = Object.getOwnPropertyNames(obj);
78
- // Freeze properties before freezing self
79
- for (const name of propNames) {
80
- const value = obj[name];
81
- if (value && typeof value === 'object') {
82
- deepFreeze(value);
83
- }
84
- }
85
- return Object.freeze(obj);
86
- }
87
- /**
88
- * Get a specific configuration value using dot notation
89
- * This provides a safe way to access nested config values
90
- *
91
- * @example
92
- * getConfigValue('server.port') // Returns the server port
93
- * getConfigValue('database.redis.url') // Returns the Redis URL
94
- */
95
- function getConfigValue(path) {
96
- const config = getGlobalConfig();
97
- return path.split('.').reduce((obj, key) => {
98
- return obj && obj[key] !== undefined ? obj[key] : undefined;
99
- }, config);
100
- }
101
- /**
102
- * Utility functions for common environment checks
103
- * These now read NODE_ENV directly for consistency with Node.js ecosystem
104
- */
105
- function isDevelopment() {
106
- return process.env.NODE_ENV === 'development';
107
- }
108
- function isProduction() {
109
- return process.env.NODE_ENV === 'production';
110
- }
111
- function isStaging() {
112
- return process.env.NODE_ENV === 'staging';
113
- }
114
- //# sourceMappingURL=config-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-manager.js","sourceRoot":"","sources":["../../../src/core/config/config-manager.ts"],"names":[],"mappings":"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"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Configuration Sources - Load from Environment, Files, and Options
3
- *
4
- * This module handles loading configuration from different sources with clear precedence:
5
- * Environment Variables > createApp Options > Config File > Schema Defaults
6
- */
7
- import { AppConfig } from '../../types/config';
8
- import { MoroOptions } from '../../types/core';
9
- /**
10
- * Configuration source metadata for debugging
11
- */
12
- export interface ConfigSourceInfo {
13
- source: 'environment' | 'createApp' | 'configFile' | 'default';
14
- path: string;
15
- value: any;
16
- }
17
- /**
18
- * Load configuration from all sources with proper precedence
19
- * Returns a validated, complete configuration object
20
- */
21
- export declare function loadConfigFromAllSources(createAppOptions?: MoroOptions): AppConfig;