@catbee/utils 0.0.8-rc.1 → 0.0.8-rc.3
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/build/{esnext → cjs}/config.d.ts +0 -1
- package/build/{src → cjs}/config.js +0 -1
- package/build/{esnext → cjs}/index.d.ts +0 -1
- package/build/{src → cjs}/index.js +0 -1
- package/build/{esnext → cjs}/servers/server.builder.d.ts +0 -1
- package/build/{src → cjs}/servers/server.builder.js +10 -13
- package/build/{src → cjs}/servers/server.d.ts +0 -1
- package/build/{src → cjs}/servers/server.js +83 -75
- package/build/{src → cjs}/types/api-response.d.ts +0 -1
- package/build/{src → cjs}/types/api-response.js +0 -1
- package/build/{src → cjs}/types/index.d.ts +0 -1
- package/build/{src → cjs}/types/index.js +0 -1
- package/build/{src → cjs}/types/server.d.ts +0 -1
- package/build/{src → cjs}/types/server.js +0 -1
- package/build/{src → cjs}/utils/array.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/array.utils.js +0 -1
- package/build/{src → cjs}/utils/async.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/async.utils.js +2 -3
- package/build/{esnext → cjs}/utils/cache.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/cache.utils.js +7 -6
- package/build/{esnext → cjs}/utils/context-store.utils.d.ts +1 -2
- package/build/{src → cjs}/utils/context-store.utils.js +10 -9
- package/build/{esnext → cjs}/utils/crypto.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/crypto.utils.js +5 -3
- package/build/{src → cjs}/utils/date.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/date.utils.js +1 -2
- package/build/{src → cjs}/utils/decorators.utils.d.ts +30 -27
- package/build/{src → cjs}/utils/decorators.utils.js +169 -30
- package/build/{esnext → cjs}/utils/dir.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/dir.utils.js +6 -7
- package/build/{esnext → cjs}/utils/env.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/env.utils.js +5 -8
- package/build/{src → cjs}/utils/exception.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/exception.utils.js +2 -1
- package/build/{src → cjs}/utils/fs.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/fs.utils.js +12 -13
- package/build/{esnext → cjs}/utils/http-status-codes.d.ts +0 -1
- package/build/{src → cjs}/utils/http-status-codes.js +0 -1
- package/build/{esnext → cjs}/utils/id.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/id.utils.js +0 -1
- package/build/{src → cjs}/utils/logger.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/logger.utils.js +10 -6
- package/build/{esnext → cjs}/utils/middleware.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/middleware.utils.js +16 -17
- package/build/{esnext → cjs}/utils/obj.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/obj.utils.js +1 -2
- package/build/{src → cjs}/utils/performance.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/performance.utils.js +6 -4
- package/build/{esnext → cjs}/utils/request.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/request.utils.js +7 -3
- package/build/{esnext → cjs}/utils/response.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/response.utils.js +42 -28
- package/build/{esnext → cjs}/utils/stream.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/stream.utils.js +0 -1
- package/build/{esnext → cjs}/utils/string.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/string.utils.js +0 -1
- package/build/{src → cjs}/utils/type.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/type.utils.js +2 -3
- package/build/{src → cjs}/utils/url.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/url.utils.js +8 -9
- package/build/{src → cjs}/utils/validate.utils.d.ts +0 -1
- package/build/{src → cjs}/utils/validate.utils.js +2 -3
- package/build/esm/config.d.ts +0 -1
- package/build/esm/config.js +6 -7
- package/build/esm/index.d.ts +0 -1
- package/build/esm/index.js +0 -1
- package/build/esm/servers/server.builder.d.ts +0 -1
- package/build/esm/servers/server.builder.js +99 -147
- package/build/esm/servers/server.d.ts +0 -1
- package/build/esm/servers/server.js +591 -876
- package/build/esm/types/api-response.d.ts +0 -1
- package/build/esm/types/api-response.js +0 -1
- package/build/esm/types/index.d.ts +0 -1
- package/build/esm/types/index.js +0 -1
- package/build/esm/types/server.d.ts +0 -1
- package/build/esm/types/server.js +0 -1
- package/build/esm/utils/array.utils.d.ts +0 -1
- package/build/esm/utils/array.utils.js +48 -86
- package/build/esm/utils/async.utils.d.ts +0 -1
- package/build/esm/utils/async.utils.js +247 -524
- package/build/esm/utils/cache.utils.d.ts +0 -1
- package/build/esm/utils/cache.utils.js +96 -301
- package/build/esm/utils/context-store.utils.d.ts +1 -2
- package/build/esm/utils/context-store.utils.js +62 -79
- package/build/esm/utils/crypto.utils.d.ts +0 -1
- package/build/esm/utils/crypto.utils.js +78 -175
- package/build/esm/utils/date.utils.d.ts +0 -1
- package/build/esm/utils/date.utils.js +47 -53
- package/build/esm/utils/decorators.utils.d.ts +30 -27
- package/build/esm/utils/decorators.utils.js +417 -461
- package/build/esm/utils/dir.utils.d.ts +0 -1
- package/build/esm/utils/dir.utils.js +264 -786
- package/build/esm/utils/env.utils.d.ts +0 -1
- package/build/esm/utils/env.utils.js +180 -271
- package/build/esm/utils/exception.utils.d.ts +0 -1
- package/build/esm/utils/exception.utils.js +112 -289
- package/build/esm/utils/fs.utils.d.ts +0 -1
- package/build/esm/utils/fs.utils.js +169 -401
- package/build/esm/utils/http-status-codes.d.ts +0 -1
- package/build/esm/utils/http-status-codes.js +0 -1
- package/build/esm/utils/id.utils.d.ts +0 -1
- package/build/esm/utils/id.utils.js +5 -9
- package/build/esm/utils/logger.utils.d.ts +0 -1
- package/build/esm/utils/logger.utils.js +34 -71
- package/build/esm/utils/middleware.utils.d.ts +0 -1
- package/build/esm/utils/middleware.utils.js +65 -155
- package/build/esm/utils/obj.utils.d.ts +0 -1
- package/build/esm/utils/obj.utils.js +69 -176
- package/build/esm/utils/performance.utils.d.ts +0 -1
- package/build/esm/utils/performance.utils.js +92 -195
- package/build/esm/utils/request.utils.d.ts +0 -1
- package/build/esm/utils/request.utils.js +41 -74
- package/build/esm/utils/response.utils.d.ts +0 -1
- package/build/esm/utils/response.utils.js +84 -107
- package/build/esm/utils/stream.utils.d.ts +0 -1
- package/build/esm/utils/stream.utils.js +38 -113
- package/build/esm/utils/string.utils.d.ts +0 -1
- package/build/esm/utils/string.utils.js +6 -11
- package/build/esm/utils/type.utils.d.ts +0 -1
- package/build/esm/utils/type.utils.js +8 -12
- package/build/esm/utils/url.utils.d.ts +0 -1
- package/build/esm/utils/url.utils.js +49 -127
- package/build/esm/utils/validate.utils.d.ts +0 -1
- package/build/esm/utils/validate.utils.js +23 -40
- package/package.json +288 -63
- package/build/esm/config.js.map +0 -1
- package/build/esm/index.js.map +0 -1
- package/build/esm/servers/server.builder.js.map +0 -1
- package/build/esm/servers/server.js.map +0 -1
- package/build/esm/types/api-response.js.map +0 -1
- package/build/esm/types/index.js.map +0 -1
- package/build/esm/types/server.js.map +0 -1
- package/build/esm/utils/array.utils.js.map +0 -1
- package/build/esm/utils/async.utils.js.map +0 -1
- package/build/esm/utils/cache.utils.js.map +0 -1
- package/build/esm/utils/context-store.utils.js.map +0 -1
- package/build/esm/utils/crypto.utils.js.map +0 -1
- package/build/esm/utils/date.utils.js.map +0 -1
- package/build/esm/utils/decorators.utils.js.map +0 -1
- package/build/esm/utils/dir.utils.js.map +0 -1
- package/build/esm/utils/env.utils.js.map +0 -1
- package/build/esm/utils/exception.utils.js.map +0 -1
- package/build/esm/utils/fs.utils.js.map +0 -1
- package/build/esm/utils/http-status-codes.js.map +0 -1
- package/build/esm/utils/id.utils.js.map +0 -1
- package/build/esm/utils/logger.utils.js.map +0 -1
- package/build/esm/utils/middleware.utils.js.map +0 -1
- package/build/esm/utils/obj.utils.js.map +0 -1
- package/build/esm/utils/performance.utils.js.map +0 -1
- package/build/esm/utils/request.utils.js.map +0 -1
- package/build/esm/utils/response.utils.js.map +0 -1
- package/build/esm/utils/stream.utils.js.map +0 -1
- package/build/esm/utils/string.utils.js.map +0 -1
- package/build/esm/utils/type.utils.js.map +0 -1
- package/build/esm/utils/url.utils.js.map +0 -1
- package/build/esm/utils/validate.utils.js.map +0 -1
- package/build/esnext/config.js +0 -133
- package/build/esnext/config.js.map +0 -1
- package/build/esnext/index.js +0 -50
- package/build/esnext/index.js.map +0 -1
- package/build/esnext/servers/server.builder.js +0 -657
- package/build/esnext/servers/server.builder.js.map +0 -1
- package/build/esnext/servers/server.d.ts +0 -256
- package/build/esnext/servers/server.js +0 -955
- package/build/esnext/servers/server.js.map +0 -1
- package/build/esnext/types/api-response.d.ts +0 -152
- package/build/esnext/types/api-response.js +0 -34
- package/build/esnext/types/api-response.js.map +0 -1
- package/build/esnext/types/index.d.ts +0 -125
- package/build/esnext/types/index.js +0 -25
- package/build/esnext/types/index.js.map +0 -1
- package/build/esnext/types/server.d.ts +0 -268
- package/build/esnext/types/server.js +0 -25
- package/build/esnext/types/server.js.map +0 -1
- package/build/esnext/utils/array.utils.d.ts +0 -168
- package/build/esnext/utils/array.utils.js +0 -345
- package/build/esnext/utils/array.utils.js.map +0 -1
- package/build/esnext/utils/async.utils.d.ts +0 -265
- package/build/esnext/utils/async.utils.js +0 -620
- package/build/esnext/utils/async.utils.js.map +0 -1
- package/build/esnext/utils/cache.utils.js +0 -293
- package/build/esnext/utils/cache.utils.js.map +0 -1
- package/build/esnext/utils/context-store.utils.js +0 -289
- package/build/esnext/utils/context-store.utils.js.map +0 -1
- package/build/esnext/utils/crypto.utils.js +0 -276
- package/build/esnext/utils/crypto.utils.js.map +0 -1
- package/build/esnext/utils/date.utils.d.ts +0 -159
- package/build/esnext/utils/date.utils.js +0 -384
- package/build/esnext/utils/date.utils.js.map +0 -1
- package/build/esnext/utils/decorators.utils.d.ts +0 -508
- package/build/esnext/utils/decorators.utils.js +0 -877
- package/build/esnext/utils/decorators.utils.js.map +0 -1
- package/build/esnext/utils/dir.utils.js +0 -477
- package/build/esnext/utils/dir.utils.js.map +0 -1
- package/build/esnext/utils/env.utils.js +0 -785
- package/build/esnext/utils/env.utils.js.map +0 -1
- package/build/esnext/utils/exception.utils.d.ts +0 -230
- package/build/esnext/utils/exception.utils.js +0 -381
- package/build/esnext/utils/exception.utils.js.map +0 -1
- package/build/esnext/utils/fs.utils.d.ts +0 -164
- package/build/esnext/utils/fs.utils.js +0 -349
- package/build/esnext/utils/fs.utils.js.map +0 -1
- package/build/esnext/utils/http-status-codes.js +0 -295
- package/build/esnext/utils/http-status-codes.js.map +0 -1
- package/build/esnext/utils/id.utils.js +0 -84
- package/build/esnext/utils/id.utils.js.map +0 -1
- package/build/esnext/utils/logger.utils.d.ts +0 -160
- package/build/esnext/utils/logger.utils.js +0 -300
- package/build/esnext/utils/logger.utils.js.map +0 -1
- package/build/esnext/utils/middleware.utils.js +0 -236
- package/build/esnext/utils/middleware.utils.js.map +0 -1
- package/build/esnext/utils/obj.utils.js +0 -413
- package/build/esnext/utils/obj.utils.js.map +0 -1
- package/build/esnext/utils/performance.utils.d.ts +0 -136
- package/build/esnext/utils/performance.utils.js +0 -271
- package/build/esnext/utils/performance.utils.js.map +0 -1
- package/build/esnext/utils/request.utils.js +0 -186
- package/build/esnext/utils/request.utils.js.map +0 -1
- package/build/esnext/utils/response.utils.js +0 -247
- package/build/esnext/utils/response.utils.js.map +0 -1
- package/build/esnext/utils/stream.utils.js +0 -210
- package/build/esnext/utils/stream.utils.js.map +0 -1
- package/build/esnext/utils/string.utils.js +0 -165
- package/build/esnext/utils/string.utils.js.map +0 -1
- package/build/esnext/utils/type.utils.d.ts +0 -90
- package/build/esnext/utils/type.utils.js +0 -187
- package/build/esnext/utils/type.utils.js.map +0 -1
- package/build/esnext/utils/url.utils.d.ts +0 -141
- package/build/esnext/utils/url.utils.js +0 -304
- package/build/esnext/utils/url.utils.js.map +0 -1
- package/build/esnext/utils/validate.utils.d.ts +0 -177
- package/build/esnext/utils/validate.utils.js +0 -320
- package/build/esnext/utils/validate.utils.js.map +0 -1
- package/build/src/config.d.ts +0 -122
- package/build/src/config.js.map +0 -1
- package/build/src/index.d.ts +0 -27
- package/build/src/index.js.map +0 -1
- package/build/src/servers/server.builder.d.ts +0 -508
- package/build/src/servers/server.builder.js.map +0 -1
- package/build/src/servers/server.js.map +0 -1
- package/build/src/types/api-response.js.map +0 -1
- package/build/src/types/index.js.map +0 -1
- package/build/src/types/server.js.map +0 -1
- package/build/src/utils/array.utils.js.map +0 -1
- package/build/src/utils/async.utils.js.map +0 -1
- package/build/src/utils/cache.utils.d.ts +0 -153
- package/build/src/utils/cache.utils.js.map +0 -1
- package/build/src/utils/context-store.utils.d.ts +0 -189
- package/build/src/utils/context-store.utils.js.map +0 -1
- package/build/src/utils/crypto.utils.d.ts +0 -160
- package/build/src/utils/crypto.utils.js.map +0 -1
- package/build/src/utils/date.utils.js.map +0 -1
- package/build/src/utils/decorators.utils.js.map +0 -1
- package/build/src/utils/dir.utils.d.ts +0 -196
- package/build/src/utils/dir.utils.js.map +0 -1
- package/build/src/utils/env.utils.d.ts +0 -377
- package/build/src/utils/env.utils.js.map +0 -1
- package/build/src/utils/exception.utils.js.map +0 -1
- package/build/src/utils/fs.utils.js.map +0 -1
- package/build/src/utils/http-status-codes.d.ts +0 -266
- package/build/src/utils/http-status-codes.js.map +0 -1
- package/build/src/utils/id.utils.d.ts +0 -36
- package/build/src/utils/id.utils.js.map +0 -1
- package/build/src/utils/logger.utils.js.map +0 -1
- package/build/src/utils/middleware.utils.d.ts +0 -100
- package/build/src/utils/middleware.utils.js.map +0 -1
- package/build/src/utils/obj.utils.d.ts +0 -124
- package/build/src/utils/obj.utils.js.map +0 -1
- package/build/src/utils/performance.utils.js.map +0 -1
- package/build/src/utils/request.utils.d.ts +0 -86
- package/build/src/utils/request.utils.js.map +0 -1
- package/build/src/utils/response.utils.d.ts +0 -163
- package/build/src/utils/response.utils.js.map +0 -1
- package/build/src/utils/stream.utils.d.ts +0 -88
- package/build/src/utils/stream.utils.js.map +0 -1
- package/build/src/utils/string.utils.d.ts +0 -93
- package/build/src/utils/string.utils.js.map +0 -1
- package/build/src/utils/type.utils.js.map +0 -1
- package/build/src/utils/url.utils.js.map +0 -1
- package/build/src/utils/validate.utils.js.map +0 -1
|
@@ -45,9 +45,7 @@ const validate_utils_1 = require("../utils/validate.utils");
|
|
|
45
45
|
*/
|
|
46
46
|
exports.BUILD_MARKER = Symbol.for('catbee.express.server.build');
|
|
47
47
|
class ServerConfigBuilder {
|
|
48
|
-
|
|
49
|
-
this.config = {};
|
|
50
|
-
}
|
|
48
|
+
config = {};
|
|
51
49
|
/**
|
|
52
50
|
* Validates that a port number is valid and usable.
|
|
53
51
|
*
|
|
@@ -368,7 +366,7 @@ class ServerConfigBuilder {
|
|
|
368
366
|
* @returns The builder instance for chaining
|
|
369
367
|
*/
|
|
370
368
|
enableOpenApi(filePath, opts = {}) {
|
|
371
|
-
this.setEnabled('openApi', true,
|
|
369
|
+
this.setEnabled('openApi', true, { filePath, ...opts });
|
|
372
370
|
return this;
|
|
373
371
|
}
|
|
374
372
|
/**
|
|
@@ -498,8 +496,7 @@ class ServerConfigBuilder {
|
|
|
498
496
|
* ```
|
|
499
497
|
*/
|
|
500
498
|
withBodyParser(opts) {
|
|
501
|
-
|
|
502
|
-
this.config.bodyParser = (0, obj_utils_1.deepObjMerge)({}, (_a = this.config.bodyParser) !== null && _a !== void 0 ? _a : {}, opts);
|
|
499
|
+
this.config.bodyParser = (0, obj_utils_1.deepObjMerge)({}, this.config.bodyParser ?? {}, opts);
|
|
503
500
|
return this;
|
|
504
501
|
}
|
|
505
502
|
/**
|
|
@@ -541,10 +538,9 @@ class ServerConfigBuilder {
|
|
|
541
538
|
* ```
|
|
542
539
|
*/
|
|
543
540
|
withStaticFolder(folder) {
|
|
544
|
-
var _a;
|
|
545
541
|
if (!folder.path)
|
|
546
542
|
throw new Error('Static folder requires a path');
|
|
547
|
-
const folders = [...(
|
|
543
|
+
const folders = [...(this.config.staticFolders ?? []), folder];
|
|
548
544
|
this.config.staticFolders = Array.from(new Map(folders.map(f => [f.path, f])).values());
|
|
549
545
|
return this;
|
|
550
546
|
}
|
|
@@ -638,13 +634,15 @@ class ServerConfigBuilder {
|
|
|
638
634
|
* ```
|
|
639
635
|
*/
|
|
640
636
|
build() {
|
|
641
|
-
var _a;
|
|
642
637
|
const config = (0, obj_utils_1.deepObjMerge)({}, config_1.defaultServerConfig, this.config);
|
|
643
638
|
// Common validation
|
|
644
|
-
if (
|
|
639
|
+
if (config.openApi?.enable && !config.openApi.filePath) {
|
|
645
640
|
throw new Error('OpenAPI is enabled but no filePath is specified');
|
|
646
641
|
}
|
|
647
|
-
return Object.freeze(
|
|
642
|
+
return Object.freeze({
|
|
643
|
+
...config,
|
|
644
|
+
[exports.BUILD_MARKER]: true
|
|
645
|
+
});
|
|
648
646
|
}
|
|
649
647
|
mergeConfig(key, value) {
|
|
650
648
|
const current = typeof this.config[key] === 'object' && this.config[key] !== null
|
|
@@ -653,9 +651,8 @@ class ServerConfigBuilder {
|
|
|
653
651
|
this.config[key] = (0, obj_utils_1.deepObjMerge)({}, current, value);
|
|
654
652
|
}
|
|
655
653
|
setEnabled(key, enable, overrides = {}) {
|
|
656
|
-
this.mergeConfig(key,
|
|
654
|
+
this.mergeConfig(key, { ...overrides, enable });
|
|
657
655
|
return this;
|
|
658
656
|
}
|
|
659
657
|
}
|
|
660
658
|
exports.ServerConfigBuilder = ServerConfigBuilder;
|
|
661
|
-
//# sourceMappingURL=server.builder.js.map
|
|
@@ -57,6 +57,38 @@ const validate_utils_1 = require("../utils/validate.utils");
|
|
|
57
57
|
* Includes K8s readiness probes and zero-downtime support.
|
|
58
58
|
*/
|
|
59
59
|
class ExpressServer {
|
|
60
|
+
/** Prometheus client registry for metrics collection */
|
|
61
|
+
register = null;
|
|
62
|
+
/** HTTP server instance (null when not running) */
|
|
63
|
+
server = null;
|
|
64
|
+
/** Merged configuration with defaults applied */
|
|
65
|
+
config;
|
|
66
|
+
/** User-defined lifecycle hooks */
|
|
67
|
+
hooks;
|
|
68
|
+
/** Global API prefix (from config) */
|
|
69
|
+
globalPrefix;
|
|
70
|
+
/** Internal fallback router */
|
|
71
|
+
rootRouter;
|
|
72
|
+
/** User-supplied router */
|
|
73
|
+
externalRouter;
|
|
74
|
+
/** Internal Express app instance */
|
|
75
|
+
app;
|
|
76
|
+
/** Set of active WebSocket connections */
|
|
77
|
+
connections = new Set();
|
|
78
|
+
/** Flag indicating if the server is shutting down */
|
|
79
|
+
isShuttingDown = false;
|
|
80
|
+
/**
|
|
81
|
+
* Collection of registered health check functions.
|
|
82
|
+
* These are executed when the health check endpoint is accessed.
|
|
83
|
+
*/
|
|
84
|
+
healthChecks = [];
|
|
85
|
+
/** Prometheus metrics for monitoring */
|
|
86
|
+
requestCounter;
|
|
87
|
+
routeTimings;
|
|
88
|
+
requestSizes;
|
|
89
|
+
clientIPs;
|
|
90
|
+
/** Promise that resolves when initialization (middleware + routes) is complete */
|
|
91
|
+
initPromise;
|
|
60
92
|
/**
|
|
61
93
|
* Initializes server with intelligent defaults and security best practices.
|
|
62
94
|
* All settings can be customized via config and hooks.
|
|
@@ -75,20 +107,6 @@ class ExpressServer {
|
|
|
75
107
|
* - Request tracing
|
|
76
108
|
*/
|
|
77
109
|
constructor(config, hooks = {}) {
|
|
78
|
-
var _a, _b, _c;
|
|
79
|
-
/** Prometheus client registry for metrics collection */
|
|
80
|
-
this.register = null;
|
|
81
|
-
/** HTTP server instance (null when not running) */
|
|
82
|
-
this.server = null;
|
|
83
|
-
/** Set of active WebSocket connections */
|
|
84
|
-
this.connections = new Set();
|
|
85
|
-
/** Flag indicating if the server is shutting down */
|
|
86
|
-
this.isShuttingDown = false;
|
|
87
|
-
/**
|
|
88
|
-
* Collection of registered health check functions.
|
|
89
|
-
* These are executed when the health check endpoint is accessed.
|
|
90
|
-
*/
|
|
91
|
-
this.healthChecks = [];
|
|
92
110
|
if (ExpressServer.isBuiltServerConfig(config)) {
|
|
93
111
|
this.config = config;
|
|
94
112
|
}
|
|
@@ -102,7 +120,7 @@ class ExpressServer {
|
|
|
102
120
|
}
|
|
103
121
|
// Sanitize app name for metrics (replace invalid characters with underscore)
|
|
104
122
|
const safeAppName = (this.config.appName || 'express_app').toLowerCase().replace(/[^a-z0-9_]/g, '_');
|
|
105
|
-
if (
|
|
123
|
+
if (this.config.metrics?.enable) {
|
|
106
124
|
const client = ExpressServer.optionalRequire('prom-client');
|
|
107
125
|
if (!client) {
|
|
108
126
|
(0, logger_utils_1.getLogger)().error({ command: 'npm install prom-client' }, 'prom-client is required for metrics but not installed. Please add it to your dependencies');
|
|
@@ -143,11 +161,11 @@ class ExpressServer {
|
|
|
143
161
|
});
|
|
144
162
|
}
|
|
145
163
|
// Health checks
|
|
146
|
-
if (
|
|
164
|
+
if (config.healthCheck?.checks) {
|
|
147
165
|
this.healthChecks.push(...config.healthCheck.checks);
|
|
148
166
|
}
|
|
149
167
|
// Set global prefix (normalize to empty string or "/prefix" without trailing slash)
|
|
150
|
-
this.globalPrefix = this.normalizePath(
|
|
168
|
+
this.globalPrefix = this.normalizePath(this.config.globalPrefix ?? '', false);
|
|
151
169
|
this.hooks = hooks;
|
|
152
170
|
this.app = (0, express_1.default)();
|
|
153
171
|
this.rootRouter = express_1.default.Router();
|
|
@@ -202,7 +220,6 @@ class ExpressServer {
|
|
|
202
220
|
* 14. Custom response hooks
|
|
203
221
|
*/
|
|
204
222
|
async setupMiddleware() {
|
|
205
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
206
223
|
if (this.config.https) {
|
|
207
224
|
await this.validateHttpsFiles();
|
|
208
225
|
}
|
|
@@ -213,13 +230,13 @@ class ExpressServer {
|
|
|
213
230
|
}
|
|
214
231
|
// Request ID generation - must be first for proper tracing
|
|
215
232
|
this.app.use((0, middleware_utils_1.requestId)({
|
|
216
|
-
headerName:
|
|
217
|
-
exposeHeader:
|
|
218
|
-
generator:
|
|
233
|
+
headerName: this.config.requestId?.headerName,
|
|
234
|
+
exposeHeader: this.config.requestId?.exposeHeader,
|
|
235
|
+
generator: this.config.requestId?.generator
|
|
219
236
|
}));
|
|
220
237
|
// Request context setup for logging correlation
|
|
221
238
|
this.app.use((0, middleware_utils_1.setupRequestContext)({
|
|
222
|
-
headerName:
|
|
239
|
+
headerName: this.config.requestId?.headerName,
|
|
223
240
|
autoLog: false
|
|
224
241
|
}));
|
|
225
242
|
// Early shutdown-awareness middleware (lets load balancers drain connections gracefully)
|
|
@@ -258,7 +275,6 @@ class ExpressServer {
|
|
|
258
275
|
}
|
|
259
276
|
// Global headers
|
|
260
277
|
this.app.use((_req, res, next) => {
|
|
261
|
-
var _a, _b, _c, _d;
|
|
262
278
|
if (this.config.globalHeaders) {
|
|
263
279
|
for (const key in this.config.globalHeaders) {
|
|
264
280
|
const value = this.config.globalHeaders[key];
|
|
@@ -268,11 +284,11 @@ class ExpressServer {
|
|
|
268
284
|
if (this.config.isMicroservice) {
|
|
269
285
|
res.setHeader('X-Microservice', this.config.appName || 'express_app');
|
|
270
286
|
}
|
|
271
|
-
if (
|
|
272
|
-
const version = typeof
|
|
287
|
+
if (this.config.serviceVersion?.enable) {
|
|
288
|
+
const version = typeof this.config.serviceVersion?.version === 'function'
|
|
273
289
|
? this.config.serviceVersion.version()
|
|
274
|
-
:
|
|
275
|
-
res.setHeader(
|
|
290
|
+
: this.config.serviceVersion?.version;
|
|
291
|
+
res.setHeader(this.config.serviceVersion?.headerName || 'x-service-version', version || '0.0.0');
|
|
276
292
|
}
|
|
277
293
|
next();
|
|
278
294
|
});
|
|
@@ -281,43 +297,41 @@ class ExpressServer {
|
|
|
281
297
|
this.app.use((0, middleware_utils_1.timeout)(this.config.requestTimeout));
|
|
282
298
|
}
|
|
283
299
|
// Response time tracking for performance monitoring
|
|
284
|
-
if (
|
|
300
|
+
if (this.config.responseTime?.enable) {
|
|
285
301
|
this.app.use((0, middleware_utils_1.responseTime)({
|
|
286
302
|
addHeader: this.config.responseTime.addHeader,
|
|
287
303
|
logOnComplete: this.config.responseTime.logOnComplete
|
|
288
304
|
}));
|
|
289
305
|
}
|
|
290
306
|
// Rate limiting should be early to prevent unnecessary processing
|
|
291
|
-
if (
|
|
307
|
+
if (this.config.rateLimit?.enable) {
|
|
292
308
|
const rateLimit = ExpressServer.optionalRequire('express-rate-limit');
|
|
293
309
|
if (!rateLimit) {
|
|
294
310
|
(0, logger_utils_1.getLogger)().error({ command: 'npm install express-rate-limit' }, 'express-rate-limit is required but not installed. Please add it to your dependencies');
|
|
295
311
|
process.exit(1);
|
|
296
312
|
}
|
|
297
313
|
this.app.use(rateLimit({
|
|
298
|
-
windowMs:
|
|
299
|
-
max:
|
|
314
|
+
windowMs: this.config.rateLimit.windowMs ?? 15 * 60 * 1000,
|
|
315
|
+
max: this.config.rateLimit.max ?? 100,
|
|
300
316
|
handler: (req, res) => {
|
|
301
|
-
var _a;
|
|
302
317
|
const status = http_status_codes_1.HttpStatusCodes.TOO_MANY_REQUESTS;
|
|
303
|
-
const response = (0, response_utils_1.createFinalErrorResponse)(req, status,
|
|
318
|
+
const response = (0, response_utils_1.createFinalErrorResponse)(req, status, this.config.rateLimit?.message || 'Too many requests');
|
|
304
319
|
res.status(status).json(response);
|
|
305
320
|
},
|
|
306
|
-
standardHeaders:
|
|
307
|
-
legacyHeaders:
|
|
321
|
+
standardHeaders: this.config.rateLimit.standardHeaders ?? true,
|
|
322
|
+
legacyHeaders: this.config.rateLimit.legacyHeaders ?? false
|
|
308
323
|
}));
|
|
309
324
|
}
|
|
310
325
|
// Request logging with filtering
|
|
311
|
-
if (
|
|
326
|
+
if (this.config.requestLogging?.enable) {
|
|
312
327
|
this.app.use((req, res, next) => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const skip = (_c = (_b = this.config.requestLogging) === null || _b === void 0 ? void 0 : _b.ignorePaths) === null || _c === void 0 ? void 0 : _c.call(_b, req, res);
|
|
328
|
+
if (typeof this.config.requestLogging?.ignorePaths === 'function') {
|
|
329
|
+
const skip = this.config.requestLogging?.ignorePaths?.(req, res);
|
|
316
330
|
if (skip)
|
|
317
331
|
return next();
|
|
318
332
|
}
|
|
319
|
-
else if (Array.isArray(
|
|
320
|
-
const skip =
|
|
333
|
+
else if (Array.isArray(this.config.requestLogging?.ignorePaths)) {
|
|
334
|
+
const skip = this.config.requestLogging?.ignorePaths?.includes(req.path);
|
|
321
335
|
if (skip)
|
|
322
336
|
return next();
|
|
323
337
|
}
|
|
@@ -353,8 +367,7 @@ class ExpressServer {
|
|
|
353
367
|
// Static file serving (do NOT normalize filesystem path; only normalize route)
|
|
354
368
|
if (this.config.staticFolders) {
|
|
355
369
|
this.config.staticFolders.forEach(folder => {
|
|
356
|
-
|
|
357
|
-
this.app.use(this.normalizePath((_a = folder.path) !== null && _a !== void 0 ? _a : '/'), express_1.default.static(folder.directory, {
|
|
370
|
+
this.app.use(this.normalizePath(folder.path ?? '/'), express_1.default.static(folder.directory, {
|
|
358
371
|
maxAge: folder.maxAge || 0,
|
|
359
372
|
etag: folder.etag !== false,
|
|
360
373
|
immutable: folder.immutable === true,
|
|
@@ -388,9 +401,9 @@ class ExpressServer {
|
|
|
388
401
|
}
|
|
389
402
|
}
|
|
390
403
|
// OpenAPI docs via @scalar/express-api-reference
|
|
391
|
-
if (
|
|
404
|
+
if (this.config.openApi?.enable) {
|
|
392
405
|
try {
|
|
393
|
-
const openApiMountPath = this.normalizePath(
|
|
406
|
+
const openApiMountPath = this.normalizePath(this.config.openApi.mountPath ?? '/docs', this.config.openApi.withGlobalPrefix);
|
|
394
407
|
const openApiFilePath = this.config.openApi.filePath;
|
|
395
408
|
if (!openApiFilePath) {
|
|
396
409
|
(0, logger_utils_1.getLogger)().error('OpenAPI file path is required');
|
|
@@ -401,7 +414,7 @@ class ExpressServer {
|
|
|
401
414
|
(0, logger_utils_1.getLogger)().error(`OpenAPI spec file not found at ${openApiFilePath}`);
|
|
402
415
|
process.exit(1);
|
|
403
416
|
}
|
|
404
|
-
if (
|
|
417
|
+
if (this.config.openApi?.verbose) {
|
|
405
418
|
(0, logger_utils_1.getLogger)().info(`Mounting OpenAPI docs at ${openApiMountPath}`);
|
|
406
419
|
(0, logger_utils_1.getLogger)().info(`Using OpenAPI spec file at ${openApiFilePath}`);
|
|
407
420
|
}
|
|
@@ -415,7 +428,7 @@ class ExpressServer {
|
|
|
415
428
|
content: await fs_1.default.promises.readFile(openApiFilePath, 'utf8')
|
|
416
429
|
}
|
|
417
430
|
}));
|
|
418
|
-
if (
|
|
431
|
+
if (this.config.openApi?.verbose) {
|
|
419
432
|
(0, logger_utils_1.getLogger)().info(`Mounted OpenAPI docs at ${openApiMountPath}`);
|
|
420
433
|
}
|
|
421
434
|
}
|
|
@@ -427,32 +440,30 @@ class ExpressServer {
|
|
|
427
440
|
if (this.hooks.onResponse) {
|
|
428
441
|
this.app.use(this.globalPrefix, this.hooks.onResponse);
|
|
429
442
|
}
|
|
430
|
-
if (
|
|
443
|
+
if (this.config.metrics?.enable) {
|
|
431
444
|
// Add metrics tracking middleware
|
|
432
445
|
this.app.use((req, res, next) => {
|
|
433
|
-
var _a, _b;
|
|
434
446
|
const start = process.hrtime();
|
|
435
447
|
// Track client IPs
|
|
436
|
-
|
|
448
|
+
this.clientIPs?.inc({ ip: req.ip, method: req.method });
|
|
437
449
|
// Track request sizes (parse safely)
|
|
438
450
|
const cl = req.headers['content-length'];
|
|
439
451
|
if (cl) {
|
|
440
452
|
const size = Number(cl);
|
|
441
453
|
if (!Number.isNaN(size) && size >= 0) {
|
|
442
454
|
const route = this.normalizeRouteForMetrics(req, res);
|
|
443
|
-
|
|
455
|
+
this.requestSizes?.observe({ method: req.method, route }, size);
|
|
444
456
|
}
|
|
445
457
|
}
|
|
446
458
|
res.once('finish', () => {
|
|
447
|
-
var _a, _b;
|
|
448
459
|
const [seconds, nanoseconds] = process.hrtime(start);
|
|
449
460
|
const finalRoute = this.normalizeRouteForMetrics(req, res);
|
|
450
|
-
|
|
461
|
+
this.requestCounter?.inc({
|
|
451
462
|
method: req.method,
|
|
452
463
|
route: finalRoute,
|
|
453
464
|
status: res.statusCode.toString()
|
|
454
465
|
});
|
|
455
|
-
|
|
466
|
+
this.routeTimings?.observe({
|
|
456
467
|
method: req.method,
|
|
457
468
|
route: finalRoute,
|
|
458
469
|
status: res.statusCode.toString()
|
|
@@ -472,11 +483,9 @@ class ExpressServer {
|
|
|
472
483
|
* 4. Error handler
|
|
473
484
|
*/
|
|
474
485
|
async setupRoutes() {
|
|
475
|
-
var _a, _b, _c, _d, _e;
|
|
476
486
|
// Health check endpoint
|
|
477
|
-
const healthCheckPath = this.normalizePath(
|
|
487
|
+
const healthCheckPath = this.normalizePath(this.config.healthCheck?.path || '/healthz', this.config.healthCheck?.withGlobalPrefix);
|
|
478
488
|
this.app.get(healthCheckPath, async (_req, res) => {
|
|
479
|
-
var _a;
|
|
480
489
|
try {
|
|
481
490
|
if (!this.healthChecks.length) {
|
|
482
491
|
return res.status(http_status_codes_1.HttpStatusCodes.OK).json(new response_utils_1.SuccessResponse('OK'));
|
|
@@ -500,19 +509,19 @@ class ExpressServer {
|
|
|
500
509
|
const response = new response_utils_1.SuccessResponse(allOk ? 'OK' : 'Service unavailable');
|
|
501
510
|
if (!allOk)
|
|
502
511
|
response.error = true;
|
|
503
|
-
if (
|
|
512
|
+
if (this.config.healthCheck?.detailed)
|
|
504
513
|
response.data = { checks: results };
|
|
505
514
|
return res.status(status).json(response);
|
|
506
515
|
}
|
|
507
|
-
catch
|
|
516
|
+
catch {
|
|
508
517
|
return res
|
|
509
518
|
.status(http_status_codes_1.HttpStatusCodes.INTERNAL_SERVER_ERROR)
|
|
510
519
|
.json(new exception_utils_1.InternalServerErrorException('Health check failed'));
|
|
511
520
|
}
|
|
512
521
|
});
|
|
513
522
|
// Metrics endpoint
|
|
514
|
-
if (
|
|
515
|
-
const metricsPath = this.normalizePath(
|
|
523
|
+
if (this.config.metrics?.enable) {
|
|
524
|
+
const metricsPath = this.normalizePath(this.config.metrics.path ?? '/metrics', this.config.metrics?.withGlobalPrefix);
|
|
516
525
|
this.app.get(metricsPath, async (_req, res) => {
|
|
517
526
|
res.set('Content-Type', this.register.contentType);
|
|
518
527
|
res.end(await this.register.metrics());
|
|
@@ -529,12 +538,11 @@ class ExpressServer {
|
|
|
529
538
|
});
|
|
530
539
|
// Global error handler (must be the last middleware)
|
|
531
540
|
this.app.use((err, req, res, next) => {
|
|
532
|
-
var _a;
|
|
533
541
|
// Check if this is a 404 error that should be handled with special logging rules
|
|
534
542
|
const isNotFoundError = err instanceof exception_utils_2.NotFoundException;
|
|
535
543
|
const shouldSkipLogging = !this.hooks.onError &&
|
|
536
544
|
isNotFoundError &&
|
|
537
|
-
|
|
545
|
+
this.config.requestLogging?.enable &&
|
|
538
546
|
this.config.requestLogging.skipNotFoundRoutes === true;
|
|
539
547
|
if (this.hooks.onError) {
|
|
540
548
|
// Use custom error handler if provided
|
|
@@ -612,17 +620,16 @@ class ExpressServer {
|
|
|
612
620
|
this.config.port,
|
|
613
621
|
this.config.host,
|
|
614
622
|
async () => {
|
|
615
|
-
var _a, _b, _c;
|
|
616
623
|
const protocol = this.config.https ? 'https' : 'http';
|
|
617
624
|
const url = `${protocol}://${this.config.host}:${this.config.port}`;
|
|
618
625
|
(0, logger_utils_1.getLogger)().info(`Server running on ${url}`);
|
|
619
|
-
if (
|
|
626
|
+
if (this.config.healthCheck?.path) {
|
|
620
627
|
(0, logger_utils_1.getLogger)().info(`Health check available at ${url}${this.normalizePath(this.config.healthCheck.path, this.config.healthCheck.withGlobalPrefix)}`);
|
|
621
628
|
}
|
|
622
|
-
if (
|
|
629
|
+
if (this.config.metrics?.enable && this.config.metrics.path) {
|
|
623
630
|
(0, logger_utils_1.getLogger)().info(`Metrics available at ${url}${this.normalizePath(this.config.metrics.path, this.config.metrics.withGlobalPrefix)}`);
|
|
624
631
|
}
|
|
625
|
-
if (
|
|
632
|
+
if (this.config.openApi?.enable) {
|
|
626
633
|
(0, logger_utils_1.getLogger)().info(`API docs available at ${url}${this.normalizePath(this.config.openApi.mountPath, this.config.openApi.withGlobalPrefix)}`);
|
|
627
634
|
}
|
|
628
635
|
if (this.server)
|
|
@@ -631,7 +638,11 @@ class ExpressServer {
|
|
|
631
638
|
}
|
|
632
639
|
];
|
|
633
640
|
if (this.config.https) {
|
|
634
|
-
const httpsOptions =
|
|
641
|
+
const httpsOptions = {
|
|
642
|
+
...this.config.https,
|
|
643
|
+
key: fs_1.default.readFileSync(this.config.https.key),
|
|
644
|
+
cert: fs_1.default.readFileSync(this.config.https.cert)
|
|
645
|
+
};
|
|
635
646
|
if (this.config.https.ca) {
|
|
636
647
|
httpsOptions.ca = fs_1.default.readFileSync(this.config.https.ca);
|
|
637
648
|
}
|
|
@@ -687,7 +698,7 @@ class ExpressServer {
|
|
|
687
698
|
}
|
|
688
699
|
this.isShuttingDown = true;
|
|
689
700
|
await this.runHook('beforeStop', this.server);
|
|
690
|
-
const shutdownTimeout =
|
|
701
|
+
const shutdownTimeout = 10_000; // 10s max wait
|
|
691
702
|
const serverClosePromise = new Promise((resolve, reject) => {
|
|
692
703
|
this.server.close(async (err) => {
|
|
693
704
|
if (err) {
|
|
@@ -847,8 +858,7 @@ class ExpressServer {
|
|
|
847
858
|
* @return {*} {client.Registry}
|
|
848
859
|
*/
|
|
849
860
|
getMetricsRegistry() {
|
|
850
|
-
|
|
851
|
-
if (!((_a = this.config.metrics) === null || _a === void 0 ? void 0 : _a.enable)) {
|
|
861
|
+
if (!this.config.metrics?.enable) {
|
|
852
862
|
throw new Error('Metrics are not enabled in the server configuration');
|
|
853
863
|
}
|
|
854
864
|
return this.register;
|
|
@@ -886,9 +896,8 @@ class ExpressServer {
|
|
|
886
896
|
return sanitize(prefix + '/' + path);
|
|
887
897
|
}
|
|
888
898
|
normalizeRouteForMetrics(req, res) {
|
|
889
|
-
var _a;
|
|
890
899
|
// Prevent high cardinality metrics by normalizing routes
|
|
891
|
-
if (
|
|
900
|
+
if (req?.route?.path) {
|
|
892
901
|
// Use Express route pattern instead of actual URL
|
|
893
902
|
return req.route.path;
|
|
894
903
|
}
|
|
@@ -953,10 +962,9 @@ class ExpressServer {
|
|
|
953
962
|
try {
|
|
954
963
|
return require(name);
|
|
955
964
|
}
|
|
956
|
-
catch
|
|
965
|
+
catch {
|
|
957
966
|
return null;
|
|
958
967
|
}
|
|
959
968
|
}
|
|
960
969
|
}
|
|
961
970
|
exports.ExpressServer = ExpressServer;
|
|
962
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -165,4 +165,3 @@ export declare function compact<T>(array: T[]): NonNullable<T>[];
|
|
|
165
165
|
* @returns {Record<string, number>} Object with counts by key.
|
|
166
166
|
*/
|
|
167
167
|
export declare function countBy<T>(array: T[], keyFn: (item: T) => string | number | symbol): Record<string, number>;
|
|
168
|
-
//# sourceMappingURL=array.utils.d.ts.map
|
|
@@ -580,7 +580,7 @@ async function runWithConcurrency(tasks, options = {}) {
|
|
|
580
580
|
if (totalTasks === 0)
|
|
581
581
|
return results;
|
|
582
582
|
// Check if execution is already aborted
|
|
583
|
-
if (signal
|
|
583
|
+
if (signal?.aborted) {
|
|
584
584
|
throw new Error('Aborted');
|
|
585
585
|
}
|
|
586
586
|
return new Promise((resolve, reject) => {
|
|
@@ -596,7 +596,7 @@ async function runWithConcurrency(tasks, options = {}) {
|
|
|
596
596
|
// Run the task
|
|
597
597
|
const result = await tasks[currentTaskIndex]();
|
|
598
598
|
// Check if aborted during task execution
|
|
599
|
-
if (signal
|
|
599
|
+
if (signal?.aborted) {
|
|
600
600
|
reject(new Error('Aborted'));
|
|
601
601
|
return;
|
|
602
602
|
}
|
|
@@ -638,4 +638,3 @@ async function runWithConcurrency(tasks, options = {}) {
|
|
|
638
638
|
}
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
|
-
//# sourceMappingURL=async.utils.js.map
|
|
@@ -37,13 +37,15 @@ const config_1 = require("../config");
|
|
|
37
37
|
* const value = cache.get("x"); // 123
|
|
38
38
|
*/
|
|
39
39
|
class TTLCache {
|
|
40
|
+
cache = new Map();
|
|
41
|
+
ttlMs;
|
|
42
|
+
maxSize;
|
|
43
|
+
cleanupInterval;
|
|
40
44
|
/**
|
|
41
45
|
* @param options - Configuration options for the cache
|
|
42
46
|
*/
|
|
43
47
|
constructor(options = {}) {
|
|
44
|
-
|
|
45
|
-
this.cache = new Map();
|
|
46
|
-
this.ttlMs = (_a = options.ttlMs) !== null && _a !== void 0 ? _a : config_1.config.cache.defaultTtl;
|
|
48
|
+
this.ttlMs = options.ttlMs ?? config_1.config.cache.defaultTtl;
|
|
47
49
|
this.maxSize = options.maxSize;
|
|
48
50
|
// Setup auto-cleanup if enabled
|
|
49
51
|
const autoCleanupMs = options.autoCleanupMs;
|
|
@@ -115,7 +117,7 @@ class TTLCache {
|
|
|
115
117
|
if (value !== undefined)
|
|
116
118
|
return value;
|
|
117
119
|
const newValue = await producer();
|
|
118
|
-
this.setWithTTL(key, newValue, ttlMs
|
|
120
|
+
this.setWithTTL(key, newValue, ttlMs ?? this.ttlMs);
|
|
119
121
|
return newValue;
|
|
120
122
|
}
|
|
121
123
|
/**
|
|
@@ -237,7 +239,7 @@ class TTLCache {
|
|
|
237
239
|
this.cache.delete(key);
|
|
238
240
|
return false;
|
|
239
241
|
}
|
|
240
|
-
entry.expiresAt = now + (ttlMs
|
|
242
|
+
entry.expiresAt = now + (ttlMs ?? this.ttlMs);
|
|
241
243
|
entry.lastAccessed = now;
|
|
242
244
|
return true;
|
|
243
245
|
}
|
|
@@ -294,4 +296,3 @@ class TTLCache {
|
|
|
294
296
|
}
|
|
295
297
|
}
|
|
296
298
|
exports.TTLCache = TTLCache;
|
|
297
|
-
//# sourceMappingURL=cache.utils.js.map
|
|
@@ -144,7 +144,7 @@ export declare class ContextStore {
|
|
|
144
144
|
* @param {(req: any) => Partial<Record<symbol, unknown>>} initialValuesFactory - Function that returns initial context values.
|
|
145
145
|
* @returns Express middleware function.
|
|
146
146
|
*/
|
|
147
|
-
static createExpressMiddleware(initialValuesFactory?: (req: any) => Partial<Record<symbol, unknown>>): (req: any,
|
|
147
|
+
static createExpressMiddleware(initialValuesFactory?: (req: any) => Partial<Record<symbol, unknown>>): (req: any, _res: any, next: any) => void;
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Type-safe wrapper for accessing and modifying context values with specific types.
|
|
@@ -186,4 +186,3 @@ export declare class TypedContextKey<T> {
|
|
|
186
186
|
*/
|
|
187
187
|
delete(): boolean;
|
|
188
188
|
}
|
|
189
|
-
//# sourceMappingURL=context-store.utils.d.ts.map
|