@catbee/utils 1.1.0 → 2.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +27 -27
  3. package/array/array.utils.d.ts +191 -0
  4. package/array/index.cjs +246 -0
  5. package/array/index.d.ts +25 -0
  6. package/array/index.mjs +228 -0
  7. package/async/async.utils.d.ts +296 -0
  8. package/async/index.cjs +428 -0
  9. package/async/index.d.ts +25 -0
  10. package/async/index.mjs +407 -0
  11. package/cache/cache.utils.d.ts +176 -0
  12. package/cache/index.cjs +292 -0
  13. package/cache/index.d.ts +25 -0
  14. package/cache/index.mjs +290 -0
  15. package/config/config.d.ts +57 -0
  16. package/config/index.cjs +136 -0
  17. package/config/index.d.ts +26 -0
  18. package/config/index.mjs +131 -0
  19. package/context-store/context-store.utils.d.ts +212 -0
  20. package/context-store/index.cjs +267 -0
  21. package/context-store/index.d.ts +25 -0
  22. package/context-store/index.mjs +261 -0
  23. package/crypto/crypto.utils.d.ts +183 -0
  24. package/crypto/index.cjs +182 -0
  25. package/crypto/index.d.ts +25 -0
  26. package/crypto/index.mjs +166 -0
  27. package/date/date.utils.d.ts +190 -0
  28. package/date/index.cjs +295 -0
  29. package/date/index.d.ts +25 -0
  30. package/date/index.mjs +283 -0
  31. package/decorators/decorators.utils.d.ts +705 -0
  32. package/decorators/index.cjs +913 -0
  33. package/decorators/index.d.ts +25 -0
  34. package/decorators/index.mjs +872 -0
  35. package/dir/dir.utils.d.ts +216 -0
  36. package/dir/index.cjs +416 -0
  37. package/dir/index.d.ts +25 -0
  38. package/dir/index.mjs +389 -0
  39. package/env/env.utils.d.ts +400 -0
  40. package/env/index.cjs +761 -0
  41. package/env/index.d.ts +25 -0
  42. package/env/index.mjs +758 -0
  43. package/exception/exception.utils.d.ts +253 -0
  44. package/exception/index.cjs +362 -0
  45. package/exception/index.d.ts +25 -0
  46. package/exception/index.mjs +338 -0
  47. package/fs/fs.utils.d.ts +196 -0
  48. package/fs/index.cjs +253 -0
  49. package/fs/index.d.ts +25 -0
  50. package/fs/index.mjs +228 -0
  51. package/http-status-codes/http-status-codes.d.ts +289 -0
  52. package/http-status-codes/index.cjs +96 -0
  53. package/http-status-codes/index.d.ts +25 -0
  54. package/http-status-codes/index.mjs +94 -0
  55. package/id/id.utils.d.ts +59 -0
  56. package/id/index.cjs +62 -0
  57. package/id/index.d.ts +25 -0
  58. package/id/index.mjs +56 -0
  59. package/index.cjs +218 -0
  60. package/index.d.ts +51 -0
  61. package/index.mjs +51 -0
  62. package/logger/index.cjs +334 -0
  63. package/logger/index.d.ts +25 -0
  64. package/logger/index.mjs +313 -0
  65. package/logger/logger.utils.d.ts +210 -0
  66. package/middleware/index.cjs +177 -0
  67. package/middleware/index.d.ts +25 -0
  68. package/middleware/index.mjs +170 -0
  69. package/middleware/middleware.utils.d.ts +123 -0
  70. package/obj/index.cjs +317 -0
  71. package/obj/index.d.ts +25 -0
  72. package/obj/index.mjs +301 -0
  73. package/obj/obj.utils.d.ts +156 -0
  74. package/package.json +171 -19
  75. package/performance/index.cjs +231 -0
  76. package/performance/index.d.ts +25 -0
  77. package/performance/index.mjs +225 -0
  78. package/performance/performance.utils.d.ts +159 -0
  79. package/request/index.cjs +202 -0
  80. package/request/index.d.ts +26 -0
  81. package/request/index.mjs +194 -0
  82. package/request/request.utils.d.ts +109 -0
  83. package/response/index.cjs +234 -0
  84. package/response/index.d.ts +26 -0
  85. package/response/index.mjs +222 -0
  86. package/response/response.utils.d.ts +186 -0
  87. package/server/index.cjs +1627 -0
  88. package/server/index.d.ts +28 -0
  89. package/server/index.mjs +1617 -0
  90. package/server/server.builder.d.ts +531 -0
  91. package/server/server.d.ts +303 -0
  92. package/stream/index.cjs +151 -0
  93. package/stream/index.d.ts +25 -0
  94. package/stream/index.mjs +144 -0
  95. package/stream/stream.utils.d.ts +111 -0
  96. package/string/index.cjs +109 -0
  97. package/string/index.d.ts +25 -0
  98. package/string/index.mjs +95 -0
  99. package/string/string.utils.d.ts +124 -0
  100. package/type/index.cjs +129 -0
  101. package/type/index.d.ts +25 -0
  102. package/type/index.mjs +119 -0
  103. package/type/type.utils.d.ts +129 -0
  104. package/types/api-response.d.ts +175 -0
  105. package/types/common.d.ts +148 -0
  106. package/types/config.d.ts +88 -0
  107. package/types/index.cjs +34 -0
  108. package/types/index.d.ts +28 -0
  109. package/types/index.mjs +32 -0
  110. package/types/server.d.ts +291 -0
  111. package/url/index.cjs +201 -0
  112. package/url/index.d.ts +25 -0
  113. package/url/index.mjs +189 -0
  114. package/url/url.utils.d.ts +164 -0
  115. package/validate/index.cjs +212 -0
  116. package/validate/index.d.ts +25 -0
  117. package/validate/index.mjs +188 -0
  118. package/validate/validate.utils.d.ts +200 -0
  119. package/build/index.cjs +0 -7694
  120. package/build/index.d.ts +0 -5792
  121. package/build/index.mjs +0 -7386
@@ -0,0 +1,531 @@
1
+ /*
2
+ * The MIT License
3
+ *
4
+ * Copyright (c) 2025 Catbee Technologies. https://catbee.in/license
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import type { ServerConfig } from '@catbee/utils/types';
26
+ export declare const BUILD_MARKER: unique symbol;
27
+ /**
28
+ * Builder class for creating and configuring an Express server configuration.
29
+ *
30
+ * This class provides a fluent interface to configure all aspects of the Express server
31
+ * including security settings, middleware, routing, and more.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const serverConfig = new ServerConfigBuilder()
36
+ * .withPort(3000)
37
+ * .withHost('localhost')
38
+ * .enableCors()
39
+ * .enableHelmet()
40
+ * .build();
41
+ * ```
42
+ */
43
+ export declare class ServerConfigBuilder {
44
+ private config;
45
+ /**
46
+ * Validates that a port number is valid and usable.
47
+ *
48
+ * @private
49
+ * @param port - The port number to validate
50
+ * @throws {Error} If port is not an integer or is outside the valid range (1-65535)
51
+ */
52
+ private validatePort;
53
+ /**
54
+ * Sets the port the server will listen on.
55
+ *
56
+ * @param port - The port number (1-65535)
57
+ * @returns The builder instance for chaining
58
+ * @throws {Error} If port is invalid
59
+ * @default 3000 (can be overridden via PORT env variable)
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * builder.withPort(3000)
64
+ * ```
65
+ */
66
+ withPort(port: number): this;
67
+ /**
68
+ * Sets the hostname the server will bind to.
69
+ *
70
+ * @param host - The hostname (e.g., 'localhost', '0.0.0.0', '127.0.0.1')
71
+ * @returns The builder instance for chaining
72
+ * @default '0.0.0.0' (can be overridden via HOST env variable)
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * builder.withHost('0.0.0.0') // Listen on all interfaces
77
+ * ```
78
+ */
79
+ withHost(host: string): this;
80
+ /**
81
+ * Configures Cross-Origin Resource Sharing (CORS) for the server.
82
+ *
83
+ * @param opts - CORS options object or boolean (true to enable with defaults, false to disable)
84
+ * @returns The builder instance for chaining
85
+ * @default false (CORS is disabled by default)
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * // Enable CORS with default options
90
+ * builder.withCors(true)
91
+ *
92
+ * // Configure CORS with specific options
93
+ * builder.withCors({
94
+ * origin: ['https://example.com'],
95
+ * methods: ['GET', 'POST']
96
+ * })
97
+ * ```
98
+ */
99
+ withCors(opts: ServerConfig['cors']): this;
100
+ /**
101
+ * Enables CORS with default settings
102
+ *
103
+ * @returns The builder instance for chaining
104
+ */
105
+ enableCors(): this;
106
+ /**
107
+ * Disables CORS
108
+ *
109
+ * @returns The builder instance for chaining
110
+ */
111
+ disableCors(): this;
112
+ /**
113
+ * Configures the Helmet middleware for setting HTTP security headers.
114
+ *
115
+ * @param opts - Helmet options object or boolean (true to enable with defaults, false to disable)
116
+ * @returns The builder instance for chaining
117
+ * @default false (Helmet is disabled by default)
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * // Enable Helmet with default settings
122
+ * builder.withHelmet(true)
123
+ *
124
+ * // Configure Helmet with specific options
125
+ * builder.withHelmet({
126
+ * contentSecurityPolicy: false,
127
+ * xssFilter: true
128
+ * })
129
+ * ```
130
+ */
131
+ withHelmet(opts: ServerConfig['helmet']): this;
132
+ /**
133
+ * Enables Helmet with default settings
134
+ *
135
+ * @returns The builder instance for chaining
136
+ */
137
+ enableHelmet(): this;
138
+ /**
139
+ * Disables Helmet
140
+ *
141
+ * @returns The builder instance for chaining
142
+ */
143
+ disableHelmet(): this;
144
+ /**
145
+ * Configures response compression middleware.
146
+ *
147
+ * @param opts - Compression options object or boolean (true to enable with defaults, false to disable)
148
+ * @returns The builder instance for chaining
149
+ * @default false (Compression is disabled by default)
150
+ *
151
+ * @example
152
+ * ```typescript
153
+ * // Enable compression with default settings
154
+ * builder.withCompression(true)
155
+ *
156
+ * // Configure compression with specific options
157
+ * builder.withCompression({
158
+ * level: 6,
159
+ * threshold: 1024
160
+ * })
161
+ * ```
162
+ */
163
+ withCompression(opts: ServerConfig['compression']): this;
164
+ /**
165
+ * Enables compression with default settings
166
+ *
167
+ * @returns The builder instance for chaining
168
+ */
169
+ enableCompression(): this;
170
+ /**
171
+ * Disables compression
172
+ *
173
+ * @returns The builder instance for chaining
174
+ */
175
+ disableCompression(): this;
176
+ /**
177
+ * Configures rate limiting to protect against brute-force attacks.
178
+ *
179
+ * @param opts - Rate limit configuration options
180
+ * @returns The builder instance for chaining
181
+ * @default - { enable: false, windowMs: 15 * 60 * 1000, max: 100, message: 'Too many requests', standardHeaders: true, legacyHeaders: false }
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * builder.withRateLimit({
186
+ * enable: true,
187
+ * windowMs: 15 * 60 * 1000, // 15 minutes
188
+ * max: 100 // limit each IP to 100 requests per windowMs
189
+ * })
190
+ * ```
191
+ */
192
+ withRateLimit(opts: Partial<ServerConfig['rateLimit']>): this;
193
+ /**
194
+ * Enables rate limiting with default or custom settings
195
+ *
196
+ * @param opts - Optional rate limit configuration (max requests, window, etc.)
197
+ * @returns The builder instance for chaining
198
+ */
199
+ enableRateLimit(opts?: Omit<Partial<NonNullable<ServerConfig['rateLimit']>>, 'enable'>): this;
200
+ /**
201
+ * Disables rate limiting
202
+ *
203
+ * @returns The builder instance for chaining
204
+ */
205
+ disableRateLimit(): this;
206
+ /**
207
+ * Configures HTTP request logging middleware.
208
+ *
209
+ * @param opts - Request logging configuration options
210
+ * @returns The builder instance for chaining
211
+ * @default - { enable: true in dev/false in prod, ignorePaths: ['/healthz', '/favicon.ico', '/metrics', '/docs', '/.well-known'], skipNotFoundRoutes: false }
212
+ *
213
+ * @example
214
+ * ```typescript
215
+ * builder.withRequestLogging({
216
+ * enable: true,
217
+ * ignorePaths: ['/health', '/metrics'],
218
+ * skipNotFoundRoutes: true
219
+ * })
220
+ * ```
221
+ */
222
+ withRequestLogging(opts: Partial<NonNullable<ServerConfig['requestLogging']>>): this;
223
+ /**
224
+ * Enables request logging with default or custom settings
225
+ *
226
+ * @param opts - Optional request logging configuration
227
+ * @returns The builder instance for chaining
228
+ */
229
+ enableRequestLogging(opts?: Omit<Partial<NonNullable<ServerConfig['requestLogging']>>, 'enable'>): this;
230
+ /**
231
+ * Disables request logging
232
+ *
233
+ * @returns The builder instance for chaining
234
+ */
235
+ disableRequestLogging(): this;
236
+ /**
237
+ * Configures server metrics collection and endpoints.
238
+ *
239
+ * @param opts - Metrics configuration options
240
+ * @returns The builder instance for chaining
241
+ * @default - { enable: false, path: '/metrics', withGlobalPrefix: false }
242
+ *
243
+ * @example
244
+ * ```typescript
245
+ * builder.withMetrics({
246
+ * enable: true,
247
+ * path: '/metrics'
248
+ * })
249
+ * ```
250
+ */
251
+ withMetrics(opts: Partial<NonNullable<ServerConfig['metrics']>>): this;
252
+ /**
253
+ * Enables Prometheus metrics collection and endpoint
254
+ *
255
+ * @param opts - Optional metrics configuration
256
+ * @returns The builder instance for chaining
257
+ */
258
+ enableMetrics(opts?: Omit<Partial<NonNullable<ServerConfig['metrics']>>, 'enable'>): this;
259
+ /**
260
+ * Disables Prometheus metrics
261
+ *
262
+ * @returns The builder instance for chaining
263
+ */
264
+ disableMetrics(): this;
265
+ /**
266
+ * Configures server health check endpoint.
267
+ *
268
+ * @param opts - Health check configuration options
269
+ * @returns The builder instance for chaining
270
+ * @default - { path: '/healthz', detailed: true, withGlobalPrefix: false }
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * builder.withHealthCheck({
275
+ * path: '/health',
276
+ * detailed: true
277
+ * })
278
+ * ```
279
+ */
280
+ withHealthCheck(opts: Partial<NonNullable<ServerConfig['healthCheck']>>): this;
281
+ /**
282
+ * Configures OpenAPI/Swagger documentation for the API.
283
+ *
284
+ * @param opts - OpenAPI configuration options
285
+ * @returns The builder instance for chaining
286
+ * @default - { enable: false, mountPath: '/docs', verbose: false, withGlobalPrefix: false }
287
+ *
288
+ * @example
289
+ * ```typescript
290
+ * builder.withOpenApi({
291
+ * enable: true,
292
+ * path: '/api-docs',
293
+ * filePath: './openapi.yaml'
294
+ * })
295
+ * ```
296
+ */
297
+ withOpenApi(opts: Partial<NonNullable<ServerConfig['openApi']>>): this;
298
+ /**
299
+ * Enables OpenAPI documentation with required file path
300
+ *
301
+ * @param filePath - Path to OpenAPI specification file (required)
302
+ * @param opts - Optional OpenAPI configuration
303
+ * @returns The builder instance for chaining
304
+ */
305
+ enableOpenApi(filePath: string, opts?: Omit<Partial<NonNullable<ServerConfig['openApi']>>, 'enable' | 'filePath'>): this;
306
+ /**
307
+ * Disables OpenAPI documentation
308
+ *
309
+ * @returns The builder instance for chaining
310
+ */
311
+ disableOpenApi(): this;
312
+ /**
313
+ * Configures the server as a microservice with versioning.
314
+ *
315
+ * @param opts - Microservice configuration options including app name and service version
316
+ * @returns The builder instance for chaining
317
+ * @default - { isMicroservice: false, appName: 'express_app' }
318
+ *
319
+ * @example
320
+ * ```typescript
321
+ * builder.withMicroService({
322
+ * appName: 'user-service',
323
+ * serviceVersion: {
324
+ * enable: true,
325
+ * version: '1.2.3'
326
+ * }
327
+ * })
328
+ * ```
329
+ */
330
+ withMicroService(opts: {
331
+ appName: NonNullable<ServerConfig['appName']>;
332
+ serviceVersion: Partial<NonNullable<ServerConfig['serviceVersion']>>;
333
+ }): this;
334
+ /**
335
+ * Configures the trust proxy settings to determine if X-Forwarded-* headers should be trusted.
336
+ *
337
+ * @param opts - Trust proxy configuration options
338
+ * @returns The builder instance for chaining
339
+ * @default false
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * // Trust proxy headers (useful when behind a load balancer)
344
+ * builder.withTrustProxy(true)
345
+ * ```
346
+ */
347
+ withTrustProxy(opts: NonNullable<ServerConfig['trustProxy']>): this;
348
+ /**
349
+ * Configures the request ID middleware for tracing requests across services.
350
+ *
351
+ * @param opts - Request ID configuration options
352
+ * @returns The builder instance for chaining
353
+ * @default - { headerName: 'x-request-id', exposeHeader: true }
354
+ *
355
+ * @example
356
+ * ```typescript
357
+ * builder.withRequestId({
358
+ * headerName: 'X-Request-Id',
359
+ * generator: () => crypto.randomUUID()
360
+ * })
361
+ * ```
362
+ */
363
+ withRequestId(opts: Partial<NonNullable<ServerConfig['requestId']>>): this;
364
+ /**
365
+ * Configures the response time middleware for measuring request processing times.
366
+ *
367
+ * @param opts - Response time configuration options
368
+ * @returns The builder instance for chaining
369
+ * @default - { enable: false, addHeader: true, logOnComplete: false }
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * builder.withResponseTime({
374
+ * enable: true,
375
+ * addHeader: true,
376
+ * logOnComplete: true
377
+ * })
378
+ * ```
379
+ */
380
+ withResponseTime(opts: Partial<NonNullable<ServerConfig['responseTime']>>): this;
381
+ /**
382
+ * Enables response time tracking with default or custom settings
383
+ *
384
+ * @param opts - Optional response time configuration
385
+ * @returns The builder instance for chaining
386
+ */
387
+ enableResponseTime(opts?: Omit<Partial<NonNullable<ServerConfig['responseTime']>>, 'enable'>): this;
388
+ /**
389
+ * Disables response time tracking
390
+ *
391
+ * @returns The builder instance for chaining
392
+ */
393
+ disableResponseTime(): this;
394
+ /**
395
+ * Configures the body parser middleware options for parsing request bodies.
396
+ *
397
+ * @param opts - Body parser configuration options
398
+ * @returns The builder instance for chaining
399
+ * @default - { json: { limit: '1mb' }, urlencoded: { extended: true, limit: '1mb' } }
400
+ *
401
+ * @example
402
+ * ```typescript
403
+ * builder.withBodyParser({
404
+ * json: {
405
+ * limit: '1mb'
406
+ * },
407
+ * urlencoded: {
408
+ * extended: true,
409
+ * limit: '1mb'
410
+ * }
411
+ * })
412
+ * ```
413
+ */
414
+ withBodyParser(opts: NonNullable<ServerConfig['bodyParser']>): this;
415
+ /**
416
+ * Configures cookie parsing middleware.
417
+ *
418
+ * @param opts - Cookie parser options or boolean (true to enable with defaults, false to disable)
419
+ * @returns The builder instance for chaining
420
+ * @default false
421
+ *
422
+ * @example
423
+ * ```typescript
424
+ * // Enable cookie parsing with default options
425
+ * builder.withCookies(true)
426
+ *
427
+ * // Enable cookie parsing with specific options
428
+ * builder.withCookies({
429
+ * secret: 'your-secret-key',
430
+ * secure: true
431
+ * })
432
+ * ```
433
+ */
434
+ withCookies(opts: ServerConfig['cookieParser']): this;
435
+ /**
436
+ * Adds a static folder to serve files from.
437
+ *
438
+ * @param folder - Static folder configuration
439
+ * @returns The builder instance for chaining
440
+ *
441
+ * @example
442
+ * ```typescript
443
+ * builder.withStaticFolder({
444
+ * path: '/assets',
445
+ * directory: './public',
446
+ * options: { maxAge: '1d' }
447
+ * })
448
+ * ```
449
+ */
450
+ withStaticFolder(folder: NonNullable<ServerConfig['staticFolders']>[number]): this;
451
+ /**
452
+ * Sets global headers to be included in all responses.
453
+ *
454
+ * @param headers - Object containing header name/value pairs or functions that return values
455
+ * @returns The builder instance for chaining
456
+ * @default - {}
457
+ *
458
+ * @example
459
+ * ```typescript
460
+ * builder.withGlobalHeaders({
461
+ * 'X-Powered-By': 'Catbee',
462
+ * 'Server-Time': () => new Date().toISOString()
463
+ * })
464
+ * ```
465
+ */
466
+ withGlobalHeaders(headers: NonNullable<ServerConfig['globalHeaders']>): this;
467
+ /**
468
+ * Sets a global prefix for all routes.
469
+ *
470
+ * @param prefix - The prefix to prepend to all routes (e.g., '/api/v1')
471
+ * @returns The builder instance for chaining
472
+ * @default '/'
473
+ *
474
+ * @example
475
+ * ```typescript
476
+ * builder.withGlobalPrefix('/api/v1')
477
+ * ```
478
+ */
479
+ withGlobalPrefix(prefix: string): this;
480
+ /**
481
+ * Applies custom configuration overrides directly.
482
+ *
483
+ * @param overrides - Custom configuration options to merge
484
+ * @returns The builder instance for chaining
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * builder.withCustom({
489
+ * port: 8080,
490
+ * customMiddleware: myMiddlewareFunction
491
+ * })
492
+ * ```
493
+ */
494
+ withCustom(overrides: Partial<ServerConfig>): this;
495
+ /**
496
+ * Configures HTTPS server options.
497
+ *
498
+ * @param opts - HTTPS configuration (key, cert, ca, passphrase, etc.)
499
+ * @returns The builder instance for chaining
500
+ *
501
+ * @example
502
+ * ```typescript
503
+ * builder.withHttps({
504
+ * key: './localhost-key.pem',
505
+ * cert: './localhost-cert.pem'
506
+ * })
507
+ * ```
508
+ */
509
+ withHttps(opts: NonNullable<ServerConfig['https']>): this;
510
+ /**
511
+ * Builds and returns the final server configuration.
512
+ *
513
+ * This method merges the user-specified configuration with default values,
514
+ * ensures all sections with 'enable' flags are properly structured, and
515
+ * produces the final configuration to be used by the server.
516
+ *
517
+ * @returns The complete ServerConfig object
518
+ *
519
+ * @example
520
+ * ```typescript
521
+ * const config = new ServerConfigBuilder()
522
+ * .withPort(3000)
523
+ * .withHost('localhost')
524
+ * .withCors(true)
525
+ * .build();
526
+ * ```
527
+ */
528
+ build(): Readonly<ServerConfig>;
529
+ private mergeConfig;
530
+ private setEnabled;
531
+ }