@expressots/core 3.0.0 → 4.0.0-preview.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/README.md +43 -95
- package/lib/CHANGELOG.md +35 -0
- package/lib/README.md +43 -95
- package/lib/cjs/application/application-container.js +467 -33
- package/lib/cjs/application/application-factory.js +105 -5
- package/lib/cjs/application/application.types.js +32 -2
- package/lib/cjs/application/bootstrap.js +812 -0
- package/lib/cjs/application/index.js +10 -7
- package/lib/cjs/authorization/authorization-config.interface.js +2 -0
- package/lib/cjs/authorization/decorators/convenience.js +80 -0
- package/lib/cjs/authorization/guard-constants.js +12 -0
- package/lib/cjs/authorization/guard-decorators.js +159 -0
- package/lib/cjs/authorization/guard-executor.js +101 -0
- package/lib/cjs/authorization/guard-registry.js +133 -0
- package/lib/cjs/authorization/guard.interface.js +75 -0
- package/lib/cjs/authorization/guards/attribute-based.guard.js +109 -0
- package/lib/cjs/authorization/guards/authenticated.guard.js +49 -0
- package/lib/cjs/authorization/guards/composition.guard.js +67 -0
- package/lib/cjs/authorization/guards/conditional.guard.js +41 -0
- package/lib/cjs/authorization/guards/index.js +24 -0
- package/lib/cjs/authorization/guards/permission.guard.js +82 -0
- package/lib/cjs/authorization/guards/resource-owner.guard.js +61 -0
- package/lib/cjs/authorization/guards/role.guard.js +64 -0
- package/lib/cjs/authorization/index.js +40 -0
- package/lib/cjs/authorization/services/guard-cache.interface.js +2 -0
- package/lib/cjs/authorization/services/guard-cache.js +56 -0
- package/lib/cjs/authorization/services/permission-hierarchy.interface.js +2 -0
- package/lib/cjs/authorization/services/permission-hierarchy.js +54 -0
- package/lib/cjs/authorization/services/permission-service.interface.js +2 -0
- package/lib/cjs/authorization/services/permission-service.js +58 -0
- package/lib/cjs/authorization/services/security-context.interface.js +2 -0
- package/lib/cjs/authorization/services/security-context.js +75 -0
- package/lib/cjs/authorization/setup.js +141 -0
- package/lib/cjs/config/config-resolver.js +719 -0
- package/lib/cjs/config/config.interfaces.js +14 -0
- package/lib/cjs/config/define-config.js +495 -0
- package/lib/cjs/config/env-field-builders.js +402 -0
- package/lib/cjs/config/index.js +83 -0
- package/lib/cjs/config/secret-value.js +201 -0
- package/lib/cjs/console/color-codes.js +4 -0
- package/lib/cjs/console/console.js +72 -9
- package/lib/cjs/console/index.js +2 -2
- package/lib/cjs/container-module/container-module.js +257 -26
- package/lib/cjs/container-module/index.js +6 -4
- package/lib/cjs/decorator/index.js +1 -1
- package/lib/cjs/decorator/scope-binding.js +307 -16
- package/lib/cjs/di/annotation/decorator_utils.js +4 -4
- package/lib/cjs/di/annotation/inject.js +3 -3
- package/lib/cjs/di/annotation/inject_base.js +5 -5
- package/lib/cjs/di/annotation/injectable.js +2 -2
- package/lib/cjs/di/annotation/multi_inject.js +3 -3
- package/lib/cjs/di/annotation/named.js +4 -4
- package/lib/cjs/di/annotation/optional.js +4 -4
- package/lib/cjs/di/annotation/post_construct.js +4 -4
- package/lib/cjs/di/annotation/pre_destroy.js +4 -4
- package/lib/cjs/di/annotation/property_event_decorator.js +2 -2
- package/lib/cjs/di/annotation/tagged.js +3 -3
- package/lib/cjs/di/annotation/target_name.js +5 -5
- package/lib/cjs/di/annotation/unmanaged.js +5 -5
- package/lib/cjs/di/binding-decorator/constants.js +3 -0
- package/lib/cjs/di/binding-decorator/decorator/fluent_provide.js +7 -7
- package/lib/cjs/di/binding-decorator/decorator/provide.js +7 -7
- package/lib/cjs/di/binding-decorator/factory/module_factory.js +23 -4
- package/lib/cjs/di/binding-decorator/index.js +11 -9
- package/lib/cjs/di/binding-decorator/syntax/provide_done_syntax.js +7 -7
- package/lib/cjs/di/binding-decorator/syntax/provide_in_syntax.js +19 -12
- package/lib/cjs/di/binding-decorator/syntax/provide_in_when_on_syntax.js +3 -0
- package/lib/cjs/di/binding-decorator/syntax/provide_on_syntax.js +4 -4
- package/lib/cjs/di/binding-decorator/syntax/provide_when_syntax.js +30 -30
- package/lib/cjs/di/binding-decorator/utils/auto_wire.js +4 -4
- package/lib/cjs/di/bindings/binding.js +5 -6
- package/lib/cjs/di/constants/error_msgs.js +6 -2
- package/lib/cjs/di/constants/literal_types.js +3 -3
- package/lib/cjs/di/container/container.js +44 -44
- package/lib/cjs/di/container/container_module.js +3 -3
- package/lib/cjs/di/container/lookup.js +3 -3
- package/lib/cjs/di/container/module_activation_store.js +3 -3
- package/lib/cjs/di/container-introspection.js +42 -0
- package/lib/cjs/di/inversify.js +85 -52
- package/lib/cjs/di/planning/context.js +2 -2
- package/lib/cjs/di/planning/metadata.js +1 -1
- package/lib/cjs/di/planning/metadata_reader.js +1 -1
- package/lib/cjs/di/planning/planner.js +37 -37
- package/lib/cjs/di/planning/reflection_utils.js +12 -12
- package/lib/cjs/di/planning/request.js +2 -2
- package/lib/cjs/di/planning/target.js +10 -10
- package/lib/cjs/di/resolution/instantiation.js +13 -13
- package/lib/cjs/di/resolution/resolver.js +22 -22
- package/lib/cjs/di/scope/scope-registry.js +115 -0
- package/lib/cjs/di/scope/scope.js +38 -8
- package/lib/cjs/di/syntax/binding_in_syntax.js +18 -8
- package/lib/cjs/di/syntax/binding_in_when_on_syntax.js +9 -6
- package/lib/cjs/di/syntax/binding_on_syntax.js +3 -3
- package/lib/cjs/di/syntax/binding_to_syntax.js +27 -27
- package/lib/cjs/di/syntax/binding_when_on_syntax.js +4 -4
- package/lib/cjs/di/syntax/binding_when_syntax.js +30 -30
- package/lib/cjs/di/syntax/constraint_helpers.js +3 -3
- package/lib/cjs/di/utils/binding_utils.js +18 -18
- package/lib/cjs/di/utils/exceptions.js +1 -1
- package/lib/cjs/di/utils/serialization.js +1 -1
- package/lib/cjs/error/app-error.js +152 -8
- package/lib/cjs/error/base-exception-filter.js +135 -0
- package/lib/cjs/error/error-handler-middleware.js +7 -7
- package/lib/cjs/error/exception-filter-constants.js +12 -0
- package/lib/cjs/error/exception-filter-decorators.js +161 -0
- package/lib/cjs/error/exception-filter-registry.js +163 -0
- package/lib/cjs/error/exception-filter.interface.js +2 -0
- package/lib/cjs/error/exception-handler-middleware.js +378 -0
- package/lib/cjs/error/filters/app-error.filter.js +31 -0
- package/lib/cjs/error/filters/global-exception.filter.js +39 -0
- package/lib/cjs/error/filters/not-found.filter.js +35 -0
- package/lib/cjs/error/filters/validation-error.filter.js +35 -0
- package/lib/cjs/error/index.js +28 -7
- package/lib/cjs/error/not-found.error.js +17 -0
- package/lib/cjs/error/report.js +104 -9
- package/lib/cjs/error/status-code.js +20 -0
- package/lib/cjs/error/utils.js +247 -33
- package/lib/cjs/error/validation.error.js +18 -0
- package/lib/cjs/event/event-decorators.js +280 -0
- package/lib/cjs/event/event-emitter.js +373 -0
- package/lib/cjs/event/event-flow-tracker.js +236 -0
- package/lib/cjs/event/event-recorder.js +289 -0
- package/lib/cjs/event/event-registry.js +207 -0
- package/lib/cjs/event/event.interfaces.js +54 -0
- package/lib/cjs/event/index.js +80 -0
- package/lib/cjs/index.js +29 -8
- package/lib/cjs/interceptor/conditional-interceptor.js +108 -0
- package/lib/cjs/interceptor/execution-context.js +66 -0
- package/lib/cjs/interceptor/index.js +64 -0
- package/lib/cjs/interceptor/interceptor-composition.js +130 -0
- package/lib/cjs/interceptor/interceptor-constants.js +20 -0
- package/lib/cjs/interceptor/interceptor-decorators.js +155 -0
- package/lib/cjs/interceptor/interceptor-executor.js +140 -0
- package/lib/cjs/interceptor/interceptor-registry.js +159 -0
- package/lib/cjs/interceptor/interceptor.interface.js +20 -0
- package/lib/cjs/interceptor/interceptors/index.js +22 -0
- package/lib/cjs/interceptor/interceptors/logging.interceptor.js +70 -0
- package/lib/cjs/interceptor/interceptors/performance.interceptor.js +251 -0
- package/lib/cjs/interceptor/interceptors/timeout.interceptor.js +66 -0
- package/lib/cjs/lazy-loading/index.js +73 -0
- package/lib/cjs/lazy-loading/lazy-load-metrics.js +355 -0
- package/lib/cjs/lazy-loading/lazy-module-loader.js +311 -0
- package/lib/cjs/lazy-loading/lazy-module-manager.js +244 -0
- package/lib/cjs/lazy-loading/lazy-module-warmup.js +294 -0
- package/lib/cjs/lazy-loading/lazy-module.js +380 -0
- package/lib/cjs/lazy-loading/lazy.interfaces.js +18 -0
- package/lib/cjs/lifecycle/index.js +15 -0
- package/lib/cjs/lifecycle/lifecycle-registry.js +301 -0
- package/lib/cjs/lifecycle/lifecycle.interface.js +37 -0
- package/lib/cjs/middleware/content-negotiation/accept-header-parser.js +110 -0
- package/lib/cjs/middleware/content-negotiation/content-negotiation-service.js +288 -0
- package/lib/cjs/middleware/content-negotiation/formatter-registry.js +168 -0
- package/lib/cjs/middleware/content-negotiation/formatters/csv-formatter.js +114 -0
- package/lib/cjs/middleware/content-negotiation/formatters/index.js +16 -0
- package/lib/cjs/middleware/content-negotiation/formatters/json-formatter.js +34 -0
- package/lib/cjs/middleware/content-negotiation/formatters/plain-text-formatter.js +44 -0
- package/lib/cjs/middleware/content-negotiation/formatters/xml-formatter.js +124 -0
- package/lib/cjs/middleware/content-negotiation/formatters/yaml-formatter.js +134 -0
- package/lib/cjs/middleware/content-negotiation/index.js +27 -0
- package/lib/cjs/middleware/index.js +59 -30
- package/lib/cjs/middleware/interfaces/content-negotiation.interface.js +7 -0
- package/lib/cjs/middleware/middleware-config.js +10 -0
- package/lib/cjs/middleware/middleware-presets.js +294 -0
- package/lib/cjs/middleware/middleware-profiler.js +310 -0
- package/lib/cjs/middleware/middleware-registry.js +160 -0
- package/lib/cjs/middleware/middleware-resolver.js +318 -57
- package/lib/cjs/middleware/middleware-service.js +1636 -308
- package/lib/cjs/middleware/middleware-utils.js +280 -0
- package/lib/cjs/middleware/upload-registry.js +91 -0
- package/lib/cjs/path-resolver/index.js +252 -0
- package/lib/cjs/provider/db-in-memory/adapter/adapter.interface.js +10 -0
- package/lib/cjs/provider/db-in-memory/adapter/in-memory.adapter.js +665 -0
- package/lib/cjs/provider/db-in-memory/adapter/index.js +10 -0
- package/lib/cjs/provider/db-in-memory/base-repo.repository.js +4 -4
- package/lib/cjs/provider/db-in-memory/db-in-memory.provider.js +14 -18
- package/lib/cjs/provider/db-in-memory/db.provider.js +402 -0
- package/lib/cjs/provider/db-in-memory/index.js +115 -9
- package/lib/cjs/provider/db-in-memory/query/index.js +24 -0
- package/lib/cjs/provider/db-in-memory/query/query-engine.js +573 -0
- package/lib/cjs/provider/db-in-memory/query/query.types.js +10 -0
- package/lib/cjs/provider/db-in-memory/schema/decorators.js +402 -0
- package/lib/cjs/provider/db-in-memory/schema/entity.interface.js +9 -0
- package/lib/cjs/provider/db-in-memory/schema/index.js +21 -0
- package/lib/cjs/provider/db-in-memory/storage/index.js +14 -0
- package/lib/cjs/provider/db-in-memory/storage/memory-store.js +706 -0
- package/lib/cjs/provider/dto-validator/dto-validator.provider.js +8 -8
- package/lib/cjs/provider/dto-validator/package-resolver.js +2 -2
- package/lib/cjs/provider/index.js +14 -10
- package/lib/cjs/provider/logger/decorators/index.js +17 -0
- package/lib/cjs/provider/logger/decorators/log-performance.decorator.js +178 -0
- package/lib/cjs/provider/logger/index.js +35 -0
- package/lib/cjs/provider/logger/logger.banner.js +473 -0
- package/lib/cjs/provider/logger/logger.config.js +22 -0
- package/lib/cjs/provider/logger/logger.context.js +341 -0
- package/lib/cjs/provider/logger/logger.flow.js +255 -0
- package/lib/cjs/provider/logger/logger.formatter.js +676 -0
- package/lib/cjs/provider/logger/logger.grouping.js +319 -0
- package/lib/cjs/provider/logger/logger.health.js +295 -0
- package/lib/cjs/provider/logger/logger.metrics-collector.js +184 -0
- package/lib/cjs/provider/logger/logger.metrics.js +91 -0
- package/lib/cjs/provider/logger/logger.performance.js +300 -0
- package/lib/cjs/provider/logger/logger.provider.js +698 -75
- package/lib/cjs/provider/logger/logger.query.js +532 -0
- package/lib/cjs/provider/logger/logger.redaction.js +456 -0
- package/lib/cjs/provider/logger/logger.suggestions.js +480 -0
- package/lib/cjs/provider/logger/transports/console.transport.js +78 -0
- package/lib/cjs/provider/logger/transports/file.transport.js +287 -0
- package/lib/cjs/provider/logger/transports/http-server.js +141 -0
- package/lib/cjs/provider/logger/transports/http.transport.js +151 -0
- package/lib/cjs/provider/logger/transports/index.js +21 -0
- package/lib/cjs/provider/logger/transports/transport.interface.js +2 -0
- package/lib/cjs/provider/logger/utils/index.js +18 -0
- package/lib/cjs/provider/logger/utils/log-entry.js +26 -0
- package/lib/cjs/provider/logger/utils/log-levels.js +106 -0
- package/lib/cjs/provider/provider-manager.js +209 -16
- package/lib/cjs/provider/provider-registry.js +414 -0
- package/lib/cjs/provider/provider.interface.js +49 -0
- package/lib/cjs/provider/validation/adapters/class-validator.adapter.js +264 -0
- package/lib/cjs/provider/validation/adapters/index.js +14 -0
- package/lib/cjs/provider/validation/helpful-error-formatter.js +228 -0
- package/lib/cjs/provider/validation/index.js +35 -0
- package/lib/cjs/provider/validation/smart-field-detector.js +543 -0
- package/lib/cjs/provider/validation/type-inference.js +192 -0
- package/lib/cjs/provider/validation/validation-registry.js +220 -0
- package/lib/cjs/provider/validation/validation.interface.js +9 -0
- package/lib/cjs/render/adapters/base-adapter.js +134 -0
- package/lib/cjs/render/adapters/ejs-adapter.js +172 -0
- package/lib/cjs/render/adapters/handlebars-adapter.js +191 -0
- package/lib/cjs/render/adapters/index.js +20 -0
- package/lib/cjs/render/adapters/pug-adapter.js +164 -0
- package/lib/cjs/render/adapters/react-adapter.js +336 -0
- package/lib/cjs/render/features/auto-detection.js +228 -0
- package/lib/cjs/render/features/hot-reload.js +155 -0
- package/lib/cjs/render/features/index.js +20 -0
- package/lib/cjs/render/features/streaming.js +106 -0
- package/lib/cjs/render/features/type-generator.js +221 -0
- package/lib/cjs/render/features/view-debugger.js +174 -0
- package/lib/cjs/render/index.js +80 -0
- package/lib/cjs/render/presets/index.js +216 -0
- package/lib/cjs/render/render-config.js +10 -0
- package/lib/cjs/render/render-interface.js +2 -0
- package/lib/cjs/render/render-registry.js +130 -0
- package/lib/cjs/render/render-service.js +418 -0
- package/lib/cjs/render/utils/cache-manager.js +199 -0
- package/lib/cjs/render/utils/index.js +20 -0
- package/lib/cjs/render/utils/package-resolver.js +121 -0
- package/lib/cjs/render/utils/view-scanner.js +208 -0
- package/lib/cjs/testing/create-test-app.js +366 -0
- package/lib/cjs/testing/create-test-database.js +416 -0
- package/lib/cjs/testing/fluent-request.js +454 -0
- package/lib/cjs/testing/index.js +142 -0
- package/lib/cjs/testing/load-test.js +484 -0
- package/lib/cjs/testing/matchers.js +444 -0
- package/lib/cjs/testing/mock-context.js +406 -0
- package/lib/cjs/testing/mock-provider.js +339 -0
- package/lib/cjs/testing/snapshot-request.js +378 -0
- package/lib/cjs/testing/testing.interfaces.js +10 -0
- package/lib/cjs/types/application/application-container.d.ts +320 -20
- package/lib/cjs/types/application/application-factory.d.ts +99 -3
- package/lib/cjs/types/application/application.types.d.ts +177 -2
- package/lib/cjs/types/application/bootstrap.d.ts +484 -0
- package/lib/cjs/types/application/index.d.ts +4 -3
- package/lib/cjs/types/authorization/authorization-config.interface.d.ts +45 -0
- package/lib/cjs/types/authorization/decorators/convenience.d.ts +64 -0
- package/lib/cjs/types/authorization/guard-constants.d.ts +9 -0
- package/lib/cjs/types/authorization/guard-decorators.d.ts +128 -0
- package/lib/cjs/types/authorization/guard-executor.d.ts +26 -0
- package/lib/cjs/types/authorization/guard-registry.d.ts +35 -0
- package/lib/cjs/types/authorization/guard.interface.d.ts +335 -0
- package/lib/cjs/types/authorization/guards/attribute-based.guard.d.ts +60 -0
- package/lib/cjs/types/authorization/guards/authenticated.guard.d.ts +26 -0
- package/lib/cjs/types/authorization/guards/composition.guard.d.ts +42 -0
- package/lib/cjs/types/authorization/guards/conditional.guard.d.ts +21 -0
- package/lib/cjs/types/authorization/guards/index.d.ts +7 -0
- package/lib/cjs/types/authorization/guards/permission.guard.d.ts +29 -0
- package/lib/cjs/types/authorization/guards/resource-owner.guard.d.ts +29 -0
- package/lib/cjs/types/authorization/guards/role.guard.d.ts +28 -0
- package/lib/cjs/types/authorization/index.d.ts +18 -0
- package/lib/cjs/types/authorization/services/guard-cache.d.ts +26 -0
- package/lib/cjs/types/authorization/services/guard-cache.interface.d.ts +29 -0
- package/lib/cjs/types/authorization/services/permission-hierarchy.d.ts +21 -0
- package/lib/cjs/types/authorization/services/permission-hierarchy.interface.d.ts +22 -0
- package/lib/cjs/types/authorization/services/permission-service.d.ts +21 -0
- package/lib/cjs/types/authorization/services/permission-service.interface.d.ts +19 -0
- package/lib/cjs/types/authorization/services/security-context.d.ts +32 -0
- package/lib/cjs/types/authorization/services/security-context.interface.d.ts +25 -0
- package/lib/cjs/types/authorization/setup.d.ts +84 -0
- package/lib/cjs/types/config/config-resolver.d.ts +40 -0
- package/lib/cjs/types/config/config.interfaces.d.ts +570 -0
- package/lib/cjs/types/config/define-config.d.ts +109 -0
- package/lib/cjs/types/config/env-field-builders.d.ts +288 -0
- package/lib/cjs/types/config/index.d.ts +61 -0
- package/lib/cjs/types/config/secret-value.d.ts +99 -0
- package/lib/cjs/types/console/color-codes.d.ts +1 -1
- package/lib/cjs/types/console/console.d.ts +65 -2
- package/lib/cjs/types/console/index.d.ts +1 -1
- package/lib/cjs/types/container-module/container-module.d.ts +215 -8
- package/lib/cjs/types/container-module/index.d.ts +1 -1
- package/lib/cjs/types/decorator/index.d.ts +1 -1
- package/lib/cjs/types/decorator/scope-binding.d.ts +339 -11
- package/lib/cjs/types/di/annotation/decorator_utils.d.ts +1 -1
- package/lib/cjs/types/di/annotation/inject.d.ts +1 -1
- package/lib/cjs/types/di/annotation/inject_base.d.ts +2 -2
- package/lib/cjs/types/di/annotation/lazy_service_identifier.d.ts +1 -1
- package/lib/cjs/types/di/annotation/multi_inject.d.ts +1 -1
- package/lib/cjs/types/di/annotation/named.d.ts +1 -1
- package/lib/cjs/types/di/annotation/target_name.d.ts +1 -1
- package/lib/cjs/types/di/annotation/unmanaged.d.ts +1 -1
- package/lib/cjs/types/di/binding-decorator/constants.d.ts +3 -0
- package/lib/cjs/types/di/binding-decorator/decorator/fluent_provide.d.ts +2 -2
- package/lib/cjs/types/di/binding-decorator/decorator/provide.d.ts +1 -1
- package/lib/cjs/types/di/binding-decorator/factory/module_factory.d.ts +20 -1
- package/lib/cjs/types/di/binding-decorator/index.d.ts +6 -4
- package/lib/cjs/types/di/binding-decorator/interfaces/interfaces.d.ts +2 -1
- package/lib/cjs/types/di/binding-decorator/syntax/provide_done_syntax.d.ts +1 -1
- package/lib/cjs/types/di/binding-decorator/syntax/provide_in_syntax.d.ts +3 -2
- package/lib/cjs/types/di/binding-decorator/syntax/provide_in_when_on_syntax.d.ts +3 -2
- package/lib/cjs/types/di/binding-decorator/syntax/provide_on_syntax.d.ts +2 -2
- package/lib/cjs/types/di/binding-decorator/syntax/provide_when_on_syntax.d.ts +2 -2
- package/lib/cjs/types/di/binding-decorator/syntax/provide_when_syntax.d.ts +2 -2
- package/lib/cjs/types/di/binding-decorator/utils/auto_wire.d.ts +1 -1
- package/lib/cjs/types/di/bindings/binding.d.ts +1 -1
- package/lib/cjs/types/di/constants/literal_types.d.ts +3 -3
- package/lib/cjs/types/di/container/container.d.ts +1 -1
- package/lib/cjs/types/di/container/container_module.d.ts +1 -1
- package/lib/cjs/types/di/container/container_snapshot.d.ts +1 -1
- package/lib/cjs/types/di/container/lookup.d.ts +1 -1
- package/lib/cjs/types/di/container/module_activation_store.d.ts +1 -1
- package/lib/cjs/types/di/container-introspection.d.ts +25 -0
- package/lib/cjs/types/di/interfaces/interfaces.d.ts +4 -3
- package/lib/cjs/types/di/inversify.d.ts +53 -24
- package/lib/cjs/types/di/planning/context.d.ts +1 -1
- package/lib/cjs/types/di/planning/metadata.d.ts +1 -1
- package/lib/cjs/types/di/planning/metadata_reader.d.ts +1 -1
- package/lib/cjs/types/di/planning/plan.d.ts +1 -1
- package/lib/cjs/types/di/planning/planner.d.ts +1 -1
- package/lib/cjs/types/di/planning/queryable_string.d.ts +1 -1
- package/lib/cjs/types/di/planning/reflection_utils.d.ts +2 -2
- package/lib/cjs/types/di/planning/request.d.ts +1 -1
- package/lib/cjs/types/di/planning/target.d.ts +2 -2
- package/lib/cjs/types/di/resolution/instantiation.d.ts +1 -1
- package/lib/cjs/types/di/resolution/resolver.d.ts +1 -1
- package/lib/cjs/types/di/scope/scope-registry.d.ts +91 -0
- package/lib/cjs/types/di/scope/scope.d.ts +1 -1
- package/lib/cjs/types/di/syntax/binding_in_syntax.d.ts +2 -1
- package/lib/cjs/types/di/syntax/binding_in_when_on_syntax.d.ts +2 -1
- package/lib/cjs/types/di/syntax/binding_on_syntax.d.ts +1 -1
- package/lib/cjs/types/di/syntax/binding_to_syntax.d.ts +2 -2
- package/lib/cjs/types/di/syntax/binding_when_on_syntax.d.ts +1 -1
- package/lib/cjs/types/di/syntax/binding_when_syntax.d.ts +1 -1
- package/lib/cjs/types/di/syntax/constraint_helpers.d.ts +1 -1
- package/lib/cjs/types/di/utils/binding_utils.d.ts +1 -1
- package/lib/cjs/types/di/utils/clonable.d.ts +1 -1
- package/lib/cjs/types/di/utils/serialization.d.ts +1 -1
- package/lib/cjs/types/error/app-error.d.ts +155 -7
- package/lib/cjs/types/error/base-exception-filter.d.ts +73 -0
- package/lib/cjs/types/error/exception-filter-constants.d.ts +9 -0
- package/lib/cjs/types/error/exception-filter-decorators.d.ts +126 -0
- package/lib/cjs/types/error/exception-filter-registry.d.ts +38 -0
- package/lib/cjs/types/error/exception-filter.interface.d.ts +82 -0
- package/lib/cjs/types/error/exception-handler-middleware.d.ts +35 -0
- package/lib/cjs/types/error/filters/app-error.filter.d.ts +10 -0
- package/lib/cjs/types/error/filters/global-exception.filter.d.ts +9 -0
- package/lib/cjs/types/error/filters/not-found.filter.d.ts +10 -0
- package/lib/cjs/types/error/filters/validation-error.filter.d.ts +10 -0
- package/lib/cjs/types/error/index.d.ts +14 -3
- package/lib/cjs/types/error/not-found.error.d.ts +7 -0
- package/lib/cjs/types/error/report.d.ts +84 -6
- package/lib/cjs/types/error/status-code.d.ts +20 -0
- package/lib/cjs/types/error/utils.d.ts +16 -0
- package/lib/cjs/types/error/validation.error.d.ts +8 -0
- package/lib/cjs/types/event/event-decorators.d.ts +199 -0
- package/lib/cjs/types/event/event-emitter.d.ts +109 -0
- package/lib/cjs/types/event/event-flow-tracker.d.ts +88 -0
- package/lib/cjs/types/event/event-recorder.d.ts +121 -0
- package/lib/cjs/types/event/event-registry.d.ts +84 -0
- package/lib/cjs/types/event/event.interfaces.d.ts +528 -0
- package/lib/cjs/types/event/index.d.ts +55 -0
- package/lib/cjs/types/index.d.ts +27 -8
- package/lib/cjs/types/interceptor/conditional-interceptor.d.ts +91 -0
- package/lib/cjs/types/interceptor/execution-context.d.ts +41 -0
- package/lib/cjs/types/interceptor/index.d.ts +41 -0
- package/lib/cjs/types/interceptor/interceptor-composition.d.ts +115 -0
- package/lib/cjs/types/interceptor/interceptor-constants.d.ts +17 -0
- package/lib/cjs/types/interceptor/interceptor-decorators.d.ts +124 -0
- package/lib/cjs/types/interceptor/interceptor-executor.d.ts +46 -0
- package/lib/cjs/types/interceptor/interceptor-registry.d.ts +65 -0
- package/lib/cjs/types/interceptor/interceptor.interface.d.ts +281 -0
- package/lib/cjs/types/interceptor/interceptors/index.d.ts +6 -0
- package/lib/cjs/types/interceptor/interceptors/logging.interceptor.d.ts +28 -0
- package/lib/cjs/types/interceptor/interceptors/performance.interceptor.d.ts +197 -0
- package/lib/cjs/types/interceptor/interceptors/timeout.interceptor.d.ts +42 -0
- package/lib/cjs/types/lazy-loading/index.d.ts +42 -0
- package/lib/cjs/types/lazy-loading/lazy-load-metrics.d.ts +139 -0
- package/lib/cjs/types/lazy-loading/lazy-module-loader.d.ts +169 -0
- package/lib/cjs/types/lazy-loading/lazy-module-manager.d.ts +148 -0
- package/lib/cjs/types/lazy-loading/lazy-module-warmup.d.ts +130 -0
- package/lib/cjs/types/lazy-loading/lazy-module.d.ts +168 -0
- package/lib/cjs/types/lazy-loading/lazy.interfaces.d.ts +480 -0
- package/lib/cjs/types/lifecycle/index.d.ts +9 -0
- package/lib/cjs/types/lifecycle/lifecycle-registry.d.ts +213 -0
- package/lib/cjs/types/lifecycle/lifecycle.interface.d.ts +191 -0
- package/lib/cjs/types/middleware/content-negotiation/accept-header-parser.d.ts +26 -0
- package/lib/cjs/types/middleware/content-negotiation/content-negotiation-service.d.ts +64 -0
- package/lib/cjs/types/middleware/content-negotiation/formatter-registry.d.ts +60 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/csv-formatter.d.ts +34 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/index.d.ts +8 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/json-formatter.d.ts +14 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/plain-text-formatter.d.ts +12 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/xml-formatter.d.ts +26 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/yaml-formatter.d.ts +26 -0
- package/lib/cjs/types/middleware/content-negotiation/index.d.ts +7 -0
- package/lib/cjs/types/middleware/index.d.ts +25 -15
- package/lib/cjs/types/middleware/interfaces/content-negotiation.interface.d.ts +142 -0
- package/lib/cjs/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +1 -1
- package/lib/cjs/types/middleware/middleware-config.d.ts +574 -0
- package/lib/cjs/types/middleware/middleware-interface.d.ts +594 -88
- package/lib/cjs/types/middleware/middleware-presets.d.ts +90 -0
- package/lib/cjs/types/middleware/middleware-profiler.d.ts +199 -0
- package/lib/cjs/types/middleware/middleware-registry.d.ts +103 -0
- package/lib/cjs/types/middleware/middleware-resolver.d.ts +156 -8
- package/lib/cjs/types/middleware/middleware-service.d.ts +634 -112
- package/lib/cjs/types/middleware/middleware-utils.d.ts +145 -0
- package/lib/cjs/types/middleware/upload-registry.d.ts +50 -0
- package/lib/cjs/types/path-resolver/index.d.ts +80 -0
- package/lib/cjs/types/provider/db-in-memory/adapter/adapter.interface.d.ts +222 -0
- package/lib/cjs/types/provider/db-in-memory/adapter/in-memory.adapter.d.ts +239 -0
- package/lib/cjs/types/provider/db-in-memory/adapter/index.d.ts +6 -0
- package/lib/cjs/types/provider/db-in-memory/base-repo.repository.d.ts +1 -1
- package/lib/cjs/types/provider/db-in-memory/db-in-memory.interface.d.ts +1 -1
- package/lib/cjs/types/provider/db-in-memory/db-in-memory.provider.d.ts +8 -2
- package/lib/cjs/types/provider/db-in-memory/db.provider.d.ts +281 -0
- package/lib/cjs/types/provider/db-in-memory/index.d.ts +63 -4
- package/lib/cjs/types/provider/db-in-memory/query/index.d.ts +6 -0
- package/lib/cjs/types/provider/db-in-memory/query/query-engine.d.ts +101 -0
- package/lib/cjs/types/provider/db-in-memory/query/query.types.d.ts +318 -0
- package/lib/cjs/types/provider/db-in-memory/schema/decorators.d.ts +314 -0
- package/lib/cjs/types/provider/db-in-memory/schema/entity.interface.d.ts +60 -0
- package/lib/cjs/types/provider/db-in-memory/schema/index.d.ts +6 -0
- package/lib/cjs/types/provider/db-in-memory/storage/index.d.ts +5 -0
- package/lib/cjs/types/provider/db-in-memory/storage/memory-store.d.ts +326 -0
- package/lib/cjs/types/provider/index.d.ts +7 -5
- package/lib/cjs/types/provider/logger/decorators/index.d.ts +1 -0
- package/lib/cjs/types/provider/logger/decorators/log-performance.decorator.d.ts +49 -0
- package/lib/cjs/types/provider/logger/index.d.ts +17 -0
- package/lib/cjs/types/provider/logger/logger.banner.d.ts +94 -0
- package/lib/cjs/types/provider/logger/logger.config.d.ts +55 -0
- package/lib/cjs/types/provider/logger/logger.context.d.ts +189 -0
- package/lib/cjs/types/provider/logger/logger.flow.d.ts +165 -0
- package/lib/cjs/types/provider/logger/logger.formatter.d.ts +44 -0
- package/lib/cjs/types/provider/logger/logger.grouping.d.ts +124 -0
- package/lib/cjs/types/provider/logger/logger.health.d.ts +123 -0
- package/lib/cjs/types/provider/logger/logger.metrics-collector.d.ts +44 -0
- package/lib/cjs/types/provider/logger/logger.metrics.d.ts +162 -0
- package/lib/cjs/types/provider/logger/logger.performance.d.ts +179 -0
- package/lib/cjs/types/provider/logger/logger.provider.d.ts +303 -30
- package/lib/cjs/types/provider/logger/logger.query.d.ts +232 -0
- package/lib/cjs/types/provider/logger/logger.redaction.d.ts +169 -0
- package/lib/cjs/types/provider/logger/logger.suggestions.d.ts +124 -0
- package/lib/cjs/types/provider/logger/transports/console.transport.d.ts +49 -0
- package/lib/cjs/types/provider/logger/transports/file.transport.d.ts +87 -0
- package/lib/cjs/types/provider/logger/transports/http-server.d.ts +88 -0
- package/lib/cjs/types/provider/logger/transports/http.transport.d.ts +74 -0
- package/lib/cjs/types/provider/logger/transports/index.d.ts +5 -0
- package/lib/cjs/types/provider/logger/transports/transport.interface.d.ts +31 -0
- package/lib/cjs/types/provider/logger/utils/index.d.ts +2 -0
- package/lib/cjs/types/provider/logger/utils/log-entry.d.ts +82 -0
- package/lib/cjs/types/provider/logger/utils/log-levels.d.ts +53 -0
- package/lib/cjs/types/provider/provider-manager.d.ts +165 -13
- package/lib/cjs/types/provider/provider-registry.d.ts +192 -0
- package/lib/cjs/types/provider/provider.interface.d.ts +337 -0
- package/lib/cjs/types/provider/validation/adapters/class-validator.adapter.d.ts +68 -0
- package/lib/cjs/types/provider/validation/adapters/index.d.ts +10 -0
- package/lib/cjs/types/provider/validation/helpful-error-formatter.d.ts +110 -0
- package/lib/cjs/types/provider/validation/index.d.ts +19 -0
- package/lib/cjs/types/provider/validation/smart-field-detector.d.ts +91 -0
- package/lib/cjs/types/provider/validation/type-inference.d.ts +81 -0
- package/lib/cjs/types/provider/validation/validation-registry.d.ts +105 -0
- package/lib/cjs/types/provider/validation/validation.interface.d.ts +178 -0
- package/lib/cjs/types/render/adapters/base-adapter.d.ts +95 -0
- package/lib/cjs/types/render/adapters/ejs-adapter.d.ts +57 -0
- package/lib/cjs/types/render/adapters/handlebars-adapter.d.ts +74 -0
- package/lib/cjs/types/render/adapters/index.d.ts +12 -0
- package/lib/cjs/types/render/adapters/pug-adapter.d.ts +57 -0
- package/lib/cjs/types/render/adapters/react-adapter.d.ts +99 -0
- package/lib/cjs/types/render/features/auto-detection.d.ts +58 -0
- package/lib/cjs/types/render/features/hot-reload.d.ts +65 -0
- package/lib/cjs/types/render/features/index.d.ts +12 -0
- package/lib/cjs/types/render/features/streaming.d.ts +39 -0
- package/lib/cjs/types/render/features/type-generator.d.ts +64 -0
- package/lib/cjs/types/render/features/view-debugger.d.ts +42 -0
- package/lib/cjs/types/render/index.d.ts +50 -0
- package/lib/cjs/types/render/presets/index.d.ts +119 -0
- package/lib/cjs/types/render/render-config.d.ts +213 -0
- package/lib/cjs/types/render/render-interface.d.ts +126 -0
- package/lib/cjs/types/render/render-registry.d.ts +86 -0
- package/lib/cjs/types/render/render-service.d.ts +157 -0
- package/lib/cjs/types/render/utils/cache-manager.d.ts +106 -0
- package/lib/cjs/types/render/utils/index.d.ts +11 -0
- package/lib/cjs/types/render/utils/package-resolver.d.ts +57 -0
- package/lib/cjs/types/render/utils/view-scanner.d.ts +74 -0
- package/lib/cjs/types/testing/create-test-app.d.ts +71 -0
- package/lib/cjs/types/testing/create-test-database.d.ts +100 -0
- package/lib/cjs/types/testing/fluent-request.d.ts +37 -0
- package/lib/cjs/types/testing/index.d.ts +93 -0
- package/lib/cjs/types/testing/load-test.d.ts +139 -0
- package/lib/cjs/types/testing/matchers.d.ts +184 -0
- package/lib/cjs/types/testing/mock-context.d.ts +117 -0
- package/lib/cjs/types/testing/mock-provider.d.ts +93 -0
- package/lib/cjs/types/testing/snapshot-request.d.ts +46 -0
- package/lib/cjs/types/testing/testing.interfaces.d.ts +948 -0
- package/lib/cjs/types/utils/node-require.d.ts +11 -0
- package/lib/cjs/utils/node-require.js +59 -0
- package/lib/esm/application/application-container.js +526 -0
- package/lib/esm/application/application-factory.js +134 -0
- package/lib/esm/application/application.types.js +41 -0
- package/lib/esm/application/bootstrap.js +805 -0
- package/lib/esm/application/index.js +4 -0
- package/lib/esm/authorization/authorization-config.interface.js +1 -0
- package/lib/esm/authorization/decorators/convenience.js +74 -0
- package/lib/esm/authorization/guard-constants.js +9 -0
- package/lib/esm/authorization/guard-decorators.js +155 -0
- package/lib/esm/authorization/guard-executor.js +101 -0
- package/lib/esm/authorization/guard-registry.js +132 -0
- package/lib/esm/authorization/guard.interface.js +73 -0
- package/lib/esm/authorization/guards/attribute-based.guard.js +106 -0
- package/lib/esm/authorization/guards/authenticated.guard.js +45 -0
- package/lib/esm/authorization/guards/composition.guard.js +63 -0
- package/lib/esm/authorization/guards/conditional.guard.js +38 -0
- package/lib/esm/authorization/guards/index.js +8 -0
- package/lib/esm/authorization/guards/permission.guard.js +80 -0
- package/lib/esm/authorization/guards/resource-owner.guard.js +58 -0
- package/lib/esm/authorization/guards/role.guard.js +61 -0
- package/lib/esm/authorization/index.js +24 -0
- package/lib/esm/authorization/services/guard-cache.interface.js +1 -0
- package/lib/esm/authorization/services/guard-cache.js +51 -0
- package/lib/esm/authorization/services/permission-hierarchy.interface.js +1 -0
- package/lib/esm/authorization/services/permission-hierarchy.js +49 -0
- package/lib/esm/authorization/services/permission-service.interface.js +1 -0
- package/lib/esm/authorization/services/permission-service.js +56 -0
- package/lib/esm/authorization/services/security-context.interface.js +1 -0
- package/lib/esm/authorization/services/security-context.js +74 -0
- package/lib/esm/authorization/setup.js +137 -0
- package/lib/esm/config/config-resolver.js +714 -0
- package/lib/esm/config/config.interfaces.js +13 -0
- package/lib/esm/config/define-config.js +492 -0
- package/lib/esm/config/env-field-builders.js +392 -0
- package/lib/esm/config/index.js +67 -0
- package/lib/esm/config/secret-value.js +175 -0
- package/lib/esm/console/color-codes.js +46 -0
- package/lib/esm/console/console.js +107 -0
- package/lib/esm/console/index.js +1 -0
- package/lib/esm/container-module/container-module.js +322 -0
- package/lib/esm/container-module/index.js +1 -0
- package/lib/esm/decorator/index.js +1 -0
- package/lib/esm/decorator/scope-binding.js +344 -0
- package/lib/esm/di/annotation/decorator_utils.js +93 -0
- package/lib/esm/di/annotation/inject.js +18 -0
- package/lib/esm/di/annotation/inject_base.js +14 -0
- package/lib/esm/di/annotation/injectable.js +19 -0
- package/lib/esm/di/annotation/lazy_service_identifier.js +9 -0
- package/lib/esm/di/annotation/multi_inject.js +4 -0
- package/lib/esm/di/annotation/named.js +9 -0
- package/lib/esm/di/annotation/optional.js +7 -0
- package/lib/esm/di/annotation/post_construct.js +5 -0
- package/lib/esm/di/annotation/pre_destroy.js +5 -0
- package/lib/esm/di/annotation/property_event_decorator.js +13 -0
- package/lib/esm/di/annotation/tagged.js +7 -0
- package/lib/esm/di/annotation/target_name.js +10 -0
- package/lib/esm/di/annotation/unmanaged.js +10 -0
- package/lib/esm/di/binding-decorator/constants.js +7 -0
- package/lib/esm/di/binding-decorator/decorator/fluent_provide.js +15 -0
- package/lib/esm/di/binding-decorator/decorator/provide.js +35 -0
- package/lib/esm/di/binding-decorator/factory/module_factory.js +34 -0
- package/lib/esm/di/binding-decorator/index.js +10 -0
- package/lib/esm/di/binding-decorator/interfaces/interfaces.js +1 -0
- package/lib/esm/di/binding-decorator/syntax/provide_done_syntax.js +41 -0
- package/lib/esm/di/binding-decorator/syntax/provide_in_syntax.js +37 -0
- package/lib/esm/di/binding-decorator/syntax/provide_in_when_on_syntax.js +68 -0
- package/lib/esm/di/binding-decorator/syntax/provide_on_syntax.js +19 -0
- package/lib/esm/di/binding-decorator/syntax/provide_when_on_syntax.js +57 -0
- package/lib/esm/di/binding-decorator/syntax/provide_when_syntax.js +86 -0
- package/lib/esm/di/binding-decorator/utils/auto_wire.js +13 -0
- package/lib/esm/di/bindings/binding.js +64 -0
- package/lib/esm/di/bindings/binding_count.js +5 -0
- package/lib/esm/di/constants/error_msgs.js +54 -0
- package/lib/esm/di/constants/literal_types.js +21 -0
- package/lib/esm/di/constants/metadata_keys.js +35 -0
- package/lib/esm/di/container/container.js +505 -0
- package/lib/esm/di/container/container_module.js +17 -0
- package/lib/esm/di/container/container_snapshot.js +17 -0
- package/lib/esm/di/container/lookup.js +108 -0
- package/lib/esm/di/container/module_activation_store.js +43 -0
- package/lib/esm/di/container-introspection.js +38 -0
- package/lib/esm/di/interfaces/interfaces.js +1 -0
- package/lib/esm/di/inversify.js +53 -0
- package/lib/esm/di/planning/context.js +18 -0
- package/lib/esm/di/planning/metadata.js +18 -0
- package/lib/esm/di/planning/metadata_reader.js +19 -0
- package/lib/esm/di/planning/plan.js +9 -0
- package/lib/esm/di/planning/planner.js +159 -0
- package/lib/esm/di/planning/queryable_string.js +25 -0
- package/lib/esm/di/planning/reflection_utils.js +150 -0
- package/lib/esm/di/planning/request.js +28 -0
- package/lib/esm/di/planning/target.js +89 -0
- package/lib/esm/di/resolution/instantiation.js +125 -0
- package/lib/esm/di/resolution/resolver.js +163 -0
- package/lib/esm/di/scope/scope-registry.js +109 -0
- package/lib/esm/di/scope/scope.js +75 -0
- package/lib/esm/di/syntax/binding_in_syntax.js +31 -0
- package/lib/esm/di/syntax/binding_in_when_on_syntax.js +79 -0
- package/lib/esm/di/syntax/binding_on_syntax.js +16 -0
- package/lib/esm/di/syntax/binding_to_syntax.js +89 -0
- package/lib/esm/di/syntax/binding_when_on_syntax.js +64 -0
- package/lib/esm/di/syntax/binding_when_syntax.js +82 -0
- package/lib/esm/di/syntax/constraint_helpers.js +39 -0
- package/lib/esm/di/utils/async.js +12 -0
- package/lib/esm/di/utils/binding_utils.js +48 -0
- package/lib/esm/di/utils/clonable.js +7 -0
- package/lib/esm/di/utils/exceptions.js +18 -0
- package/lib/esm/di/utils/factory_type.js +6 -0
- package/lib/esm/di/utils/id.js +5 -0
- package/lib/esm/di/utils/js.js +12 -0
- package/lib/esm/di/utils/serialization.js +102 -0
- package/lib/esm/error/app-error.js +209 -0
- package/lib/esm/error/base-exception-filter.js +134 -0
- package/lib/esm/error/error-handler-middleware.js +34 -0
- package/lib/esm/error/exception-filter-constants.js +9 -0
- package/lib/esm/error/exception-filter-decorators.js +157 -0
- package/lib/esm/error/exception-filter-registry.js +162 -0
- package/lib/esm/error/exception-filter.interface.js +1 -0
- package/lib/esm/error/exception-handler-middleware.js +378 -0
- package/lib/esm/error/filters/app-error.filter.js +28 -0
- package/lib/esm/error/filters/global-exception.filter.js +36 -0
- package/lib/esm/error/filters/not-found.filter.js +32 -0
- package/lib/esm/error/filters/validation-error.filter.js +32 -0
- package/lib/esm/error/index.js +13 -0
- package/lib/esm/error/not-found.error.js +13 -0
- package/lib/esm/error/report.js +153 -0
- package/lib/esm/error/status-code.js +106 -0
- package/lib/esm/error/utils.js +252 -0
- package/lib/esm/error/validation.error.js +15 -0
- package/lib/esm/event/event-decorators.js +268 -0
- package/lib/esm/event/event-emitter.js +376 -0
- package/lib/esm/event/event-flow-tracker.js +230 -0
- package/lib/esm/event/event-recorder.js +286 -0
- package/lib/esm/event/event-registry.js +201 -0
- package/lib/esm/event/event.interfaces.js +51 -0
- package/lib/esm/event/index.js +58 -0
- package/lib/esm/index.mjs +27 -0
- package/lib/esm/interceptor/conditional-interceptor.js +104 -0
- package/lib/esm/interceptor/execution-context.js +66 -0
- package/lib/esm/interceptor/index.js +48 -0
- package/lib/esm/interceptor/interceptor-composition.js +126 -0
- package/lib/esm/interceptor/interceptor-constants.js +17 -0
- package/lib/esm/interceptor/interceptor-decorators.js +151 -0
- package/lib/esm/interceptor/interceptor-executor.js +139 -0
- package/lib/esm/interceptor/interceptor-registry.js +158 -0
- package/lib/esm/interceptor/interceptor.interface.js +16 -0
- package/lib/esm/interceptor/interceptors/index.js +6 -0
- package/lib/esm/interceptor/interceptors/logging.interceptor.js +68 -0
- package/lib/esm/interceptor/interceptors/performance.interceptor.js +253 -0
- package/lib/esm/interceptor/interceptors/timeout.interceptor.js +65 -0
- package/lib/esm/lazy-loading/index.js +56 -0
- package/lib/esm/lazy-loading/lazy-load-metrics.js +352 -0
- package/lib/esm/lazy-loading/lazy-module-loader.js +305 -0
- package/lib/esm/lazy-loading/lazy-module-manager.js +241 -0
- package/lib/esm/lazy-loading/lazy-module-warmup.js +291 -0
- package/lib/esm/lazy-loading/lazy-module.js +352 -0
- package/lib/esm/lazy-loading/lazy.interfaces.js +17 -0
- package/lib/esm/lifecycle/index.js +9 -0
- package/lib/esm/lifecycle/lifecycle-registry.js +298 -0
- package/lib/esm/lifecycle/lifecycle.interface.js +33 -0
- package/lib/esm/middleware/content-negotiation/accept-header-parser.js +106 -0
- package/lib/esm/middleware/content-negotiation/content-negotiation-service.js +286 -0
- package/lib/esm/middleware/content-negotiation/formatter-registry.js +165 -0
- package/lib/esm/middleware/content-negotiation/formatters/csv-formatter.js +111 -0
- package/lib/esm/middleware/content-negotiation/formatters/index.js +8 -0
- package/lib/esm/middleware/content-negotiation/formatters/json-formatter.js +30 -0
- package/lib/esm/middleware/content-negotiation/formatters/plain-text-formatter.js +40 -0
- package/lib/esm/middleware/content-negotiation/formatters/xml-formatter.js +121 -0
- package/lib/esm/middleware/content-negotiation/formatters/yaml-formatter.js +131 -0
- package/lib/esm/middleware/content-negotiation/index.js +7 -0
- package/lib/esm/middleware/index.js +19 -0
- package/lib/esm/middleware/interfaces/body-parser.interface.js +1 -0
- package/lib/esm/middleware/interfaces/compression.interface.js +1 -0
- package/lib/esm/middleware/interfaces/content-negotiation.interface.js +6 -0
- package/lib/esm/middleware/interfaces/cookie-parser.interface.js +1 -0
- package/lib/esm/middleware/interfaces/cookie-session/cookie-session.interface.js +1 -0
- package/lib/esm/middleware/interfaces/cookie-session/keygrip.interface.js +1 -0
- package/lib/esm/middleware/interfaces/cors.interface.js +1 -0
- package/lib/esm/middleware/interfaces/express-rate-limit.interface.js +1 -0
- package/lib/esm/middleware/interfaces/express-session.interface.js +1 -0
- package/lib/esm/middleware/interfaces/helmet.interface.js +1 -0
- package/lib/esm/middleware/interfaces/morgan.interface.js +1 -0
- package/lib/esm/middleware/interfaces/multer.interface.js +1 -0
- package/lib/esm/middleware/interfaces/serve-favicon.interface.js +1 -0
- package/lib/esm/middleware/interfaces/serve-static.interface.js +1 -0
- package/lib/esm/middleware/interfaces/url-encoded.interface.js +1 -0
- package/lib/esm/middleware/middleware-config.js +9 -0
- package/lib/esm/middleware/middleware-interface.js +1 -0
- package/lib/esm/middleware/middleware-presets.js +286 -0
- package/lib/esm/middleware/middleware-profiler.js +307 -0
- package/lib/esm/middleware/middleware-registry.js +152 -0
- package/lib/esm/middleware/middleware-resolver.js +320 -0
- package/lib/esm/middleware/middleware-service.js +1797 -0
- package/lib/esm/middleware/middleware-utils.js +273 -0
- package/lib/esm/middleware/upload-registry.js +84 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/path-resolver/index.js +224 -0
- package/lib/esm/provider/db-in-memory/adapter/adapter.interface.js +9 -0
- package/lib/esm/provider/db-in-memory/adapter/in-memory.adapter.js +667 -0
- package/lib/esm/provider/db-in-memory/adapter/index.js +5 -0
- package/lib/esm/provider/db-in-memory/base-repo.repository.js +54 -0
- package/lib/esm/provider/db-in-memory/db-in-memory.interface.js +1 -0
- package/lib/esm/provider/db-in-memory/db-in-memory.provider.js +104 -0
- package/lib/esm/provider/db-in-memory/db-in-memory.types.js +20 -0
- package/lib/esm/provider/db-in-memory/db.provider.js +405 -0
- package/lib/esm/provider/db-in-memory/index.js +90 -0
- package/lib/esm/provider/db-in-memory/query/index.js +6 -0
- package/lib/esm/provider/db-in-memory/query/query-engine.js +570 -0
- package/lib/esm/provider/db-in-memory/query/query.types.js +9 -0
- package/lib/esm/provider/db-in-memory/schema/decorators.js +387 -0
- package/lib/esm/provider/db-in-memory/schema/entity.interface.js +8 -0
- package/lib/esm/provider/db-in-memory/schema/index.js +5 -0
- package/lib/esm/provider/db-in-memory/storage/index.js +5 -0
- package/lib/esm/provider/db-in-memory/storage/memory-store.js +709 -0
- package/lib/esm/provider/dto-validator/dto-validator.provider.js +49 -0
- package/lib/esm/provider/dto-validator/package-resolver.js +30 -0
- package/lib/esm/provider/index.js +7 -0
- package/lib/esm/provider/logger/decorators/index.js +1 -0
- package/lib/esm/provider/logger/decorators/log-performance.decorator.js +175 -0
- package/lib/esm/provider/logger/index.js +17 -0
- package/lib/esm/provider/logger/logger.banner.js +471 -0
- package/lib/esm/provider/logger/logger.config.js +19 -0
- package/lib/esm/provider/logger/logger.context.js +334 -0
- package/lib/esm/provider/logger/logger.flow.js +248 -0
- package/lib/esm/provider/logger/logger.formatter.js +670 -0
- package/lib/esm/provider/logger/logger.grouping.js +314 -0
- package/lib/esm/provider/logger/logger.health.js +291 -0
- package/lib/esm/provider/logger/logger.metrics-collector.js +180 -0
- package/lib/esm/provider/logger/logger.metrics.js +85 -0
- package/lib/esm/provider/logger/logger.performance.js +299 -0
- package/lib/esm/provider/logger/logger.provider.js +746 -0
- package/lib/esm/provider/logger/logger.query.js +529 -0
- package/lib/esm/provider/logger/logger.redaction.js +450 -0
- package/lib/esm/provider/logger/logger.suggestions.js +471 -0
- package/lib/esm/provider/logger/transports/console.transport.js +81 -0
- package/lib/esm/provider/logger/transports/file.transport.js +291 -0
- package/lib/esm/provider/logger/transports/http-server.js +141 -0
- package/lib/esm/provider/logger/transports/http.transport.js +157 -0
- package/lib/esm/provider/logger/transports/index.js +5 -0
- package/lib/esm/provider/logger/transports/transport.interface.js +1 -0
- package/lib/esm/provider/logger/utils/index.js +2 -0
- package/lib/esm/provider/logger/utils/log-entry.js +23 -0
- package/lib/esm/provider/logger/utils/log-levels.js +100 -0
- package/lib/esm/provider/provider-manager.js +283 -0
- package/lib/esm/provider/provider-registry.js +411 -0
- package/lib/esm/provider/provider.interface.js +44 -0
- package/lib/esm/provider/validation/adapters/class-validator.adapter.js +258 -0
- package/lib/esm/provider/validation/adapters/index.js +10 -0
- package/lib/esm/provider/validation/helpful-error-formatter.js +225 -0
- package/lib/esm/provider/validation/index.js +21 -0
- package/lib/esm/provider/validation/smart-field-detector.js +539 -0
- package/lib/esm/provider/validation/type-inference.js +183 -0
- package/lib/esm/provider/validation/validation-registry.js +214 -0
- package/lib/esm/provider/validation/validation.interface.js +8 -0
- package/lib/esm/render/adapters/base-adapter.js +131 -0
- package/lib/esm/render/adapters/ejs-adapter.js +142 -0
- package/lib/esm/render/adapters/handlebars-adapter.js +161 -0
- package/lib/esm/render/adapters/index.js +12 -0
- package/lib/esm/render/adapters/pug-adapter.js +134 -0
- package/lib/esm/render/adapters/react-adapter.js +303 -0
- package/lib/esm/render/features/auto-detection.js +202 -0
- package/lib/esm/render/features/hot-reload.js +153 -0
- package/lib/esm/render/features/index.js +12 -0
- package/lib/esm/render/features/streaming.js +103 -0
- package/lib/esm/render/features/type-generator.js +195 -0
- package/lib/esm/render/features/view-debugger.js +172 -0
- package/lib/esm/render/index.js +54 -0
- package/lib/esm/render/presets/index.js +207 -0
- package/lib/esm/render/render-config.js +9 -0
- package/lib/esm/render/render-interface.js +1 -0
- package/lib/esm/render/render-registry.js +124 -0
- package/lib/esm/render/render-service.js +394 -0
- package/lib/esm/render/utils/cache-manager.js +196 -0
- package/lib/esm/render/utils/index.js +10 -0
- package/lib/esm/render/utils/package-resolver.js +118 -0
- package/lib/esm/render/utils/view-scanner.js +178 -0
- package/lib/esm/testing/create-test-app.js +365 -0
- package/lib/esm/testing/create-test-database.js +411 -0
- package/lib/esm/testing/fluent-request.js +452 -0
- package/lib/esm/testing/index.js +102 -0
- package/lib/esm/testing/load-test.js +479 -0
- package/lib/esm/testing/matchers.js +440 -0
- package/lib/esm/testing/mock-context.js +400 -0
- package/lib/esm/testing/mock-provider.js +333 -0
- package/lib/esm/testing/snapshot-request.js +356 -0
- package/lib/esm/testing/testing.interfaces.js +9 -0
- package/lib/esm/types/application/application-container.d.ts +352 -0
- package/lib/esm/types/application/application-factory.d.ts +118 -0
- package/lib/esm/types/application/application.types.d.ts +185 -0
- package/lib/esm/types/application/bootstrap.d.ts +484 -0
- package/lib/esm/types/application/index.d.ts +4 -0
- package/lib/esm/types/authorization/authorization-config.interface.d.ts +45 -0
- package/lib/esm/types/authorization/decorators/convenience.d.ts +64 -0
- package/lib/esm/types/authorization/guard-constants.d.ts +9 -0
- package/lib/esm/types/authorization/guard-decorators.d.ts +128 -0
- package/lib/esm/types/authorization/guard-executor.d.ts +26 -0
- package/lib/esm/types/authorization/guard-registry.d.ts +35 -0
- package/lib/esm/types/authorization/guard.interface.d.ts +335 -0
- package/lib/esm/types/authorization/guards/attribute-based.guard.d.ts +60 -0
- package/lib/esm/types/authorization/guards/authenticated.guard.d.ts +26 -0
- package/lib/esm/types/authorization/guards/composition.guard.d.ts +42 -0
- package/lib/esm/types/authorization/guards/conditional.guard.d.ts +21 -0
- package/lib/esm/types/authorization/guards/index.d.ts +7 -0
- package/lib/esm/types/authorization/guards/permission.guard.d.ts +29 -0
- package/lib/esm/types/authorization/guards/resource-owner.guard.d.ts +29 -0
- package/lib/esm/types/authorization/guards/role.guard.d.ts +28 -0
- package/lib/esm/types/authorization/index.d.ts +18 -0
- package/lib/esm/types/authorization/services/guard-cache.d.ts +26 -0
- package/lib/esm/types/authorization/services/guard-cache.interface.d.ts +29 -0
- package/lib/esm/types/authorization/services/permission-hierarchy.d.ts +21 -0
- package/lib/esm/types/authorization/services/permission-hierarchy.interface.d.ts +22 -0
- package/lib/esm/types/authorization/services/permission-service.d.ts +21 -0
- package/lib/esm/types/authorization/services/permission-service.interface.d.ts +19 -0
- package/lib/esm/types/authorization/services/security-context.d.ts +32 -0
- package/lib/esm/types/authorization/services/security-context.interface.d.ts +25 -0
- package/lib/esm/types/authorization/setup.d.ts +84 -0
- package/lib/esm/types/config/config-resolver.d.ts +40 -0
- package/lib/esm/types/config/config.interfaces.d.ts +570 -0
- package/lib/esm/types/config/define-config.d.ts +109 -0
- package/lib/esm/types/config/env-field-builders.d.ts +288 -0
- package/lib/esm/types/config/index.d.ts +61 -0
- package/lib/esm/types/config/secret-value.d.ts +99 -0
- package/lib/esm/types/console/color-codes.d.ts +29 -0
- package/lib/esm/types/console/console.d.ts +83 -0
- package/lib/esm/types/console/index.d.ts +2 -0
- package/lib/esm/types/container-module/container-module.d.ts +242 -0
- package/lib/esm/types/container-module/index.d.ts +1 -0
- package/lib/esm/types/decorator/index.d.ts +1 -0
- package/lib/esm/types/decorator/scope-binding.d.ts +374 -0
- package/lib/esm/types/di/annotation/decorator_utils.d.ts +16 -0
- package/lib/esm/types/di/annotation/inject.d.ts +16 -0
- package/lib/esm/types/di/annotation/inject_base.d.ts +3 -0
- package/lib/esm/types/di/annotation/injectable.d.ts +7 -0
- package/lib/esm/types/di/annotation/lazy_service_identifier.d.ts +7 -0
- package/lib/esm/types/di/annotation/multi_inject.d.ts +2 -0
- package/lib/esm/types/di/annotation/named.d.ts +2 -0
- package/lib/esm/types/di/annotation/optional.d.ts +2 -0
- package/lib/esm/types/di/annotation/post_construct.d.ts +4 -0
- package/lib/esm/types/di/annotation/pre_destroy.d.ts +4 -0
- package/lib/esm/types/di/annotation/property_event_decorator.d.ts +4 -0
- package/lib/esm/types/di/annotation/tagged.d.ts +2 -0
- package/lib/esm/types/di/annotation/target_name.d.ts +3 -0
- package/lib/esm/types/di/annotation/unmanaged.d.ts +3 -0
- package/lib/esm/types/di/binding-decorator/constants.d.ts +7 -0
- package/lib/esm/types/di/binding-decorator/decorator/fluent_provide.d.ts +4 -0
- package/lib/esm/types/di/binding-decorator/decorator/provide.d.ts +4 -0
- package/lib/esm/types/di/binding-decorator/factory/module_factory.d.ts +23 -0
- package/lib/esm/types/di/binding-decorator/index.d.ts +10 -0
- package/lib/esm/types/di/binding-decorator/interfaces/interfaces.d.ts +40 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_done_syntax.d.ts +7 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_in_syntax.d.ts +12 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_in_when_on_syntax.d.ts +28 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_on_syntax.d.ts +10 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_when_on_syntax.d.ts +24 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_when_syntax.d.ts +23 -0
- package/lib/esm/types/di/binding-decorator/utils/auto_wire.d.ts +3 -0
- package/lib/esm/types/di/bindings/binding.d.ts +20 -0
- package/lib/esm/types/di/bindings/binding_count.d.ts +5 -0
- package/lib/esm/types/di/constants/error_msgs.d.ts +32 -0
- package/lib/esm/types/di/constants/literal_types.d.ts +5 -0
- package/lib/esm/types/di/constants/metadata_keys.d.ts +13 -0
- package/lib/esm/types/di/container/container.d.ts +73 -0
- package/lib/esm/types/di/container/container_module.d.ts +11 -0
- package/lib/esm/types/di/container/container_snapshot.d.ts +10 -0
- package/lib/esm/types/di/container/lookup.d.ts +16 -0
- package/lib/esm/types/di/container/module_activation_store.d.ts +10 -0
- package/lib/esm/types/di/container-introspection.d.ts +25 -0
- package/lib/esm/types/di/interfaces/interfaces.d.ts +300 -0
- package/lib/esm/types/di/inversify.d.ts +54 -0
- package/lib/esm/types/di/planning/context.d.ts +11 -0
- package/lib/esm/types/di/planning/metadata.d.ts +8 -0
- package/lib/esm/types/di/planning/metadata_reader.d.ts +6 -0
- package/lib/esm/types/di/planning/plan.d.ts +7 -0
- package/lib/esm/types/di/planning/planner.d.ts +5 -0
- package/lib/esm/types/di/planning/queryable_string.d.ts +11 -0
- package/lib/esm/types/di/planning/reflection_utils.d.ts +5 -0
- package/lib/esm/types/di/planning/request.d.ts +14 -0
- package/lib/esm/types/di/planning/target.d.ts +23 -0
- package/lib/esm/types/di/resolution/instantiation.d.ts +3 -0
- package/lib/esm/types/di/resolution/resolver.d.ts +3 -0
- package/lib/esm/types/di/scope/scope-registry.d.ts +91 -0
- package/lib/esm/types/di/scope/scope.d.ts +3 -0
- package/lib/esm/types/di/syntax/binding_in_syntax.d.ts +10 -0
- package/lib/esm/types/di/syntax/binding_in_when_on_syntax.d.ts +30 -0
- package/lib/esm/types/di/syntax/binding_on_syntax.d.ts +8 -0
- package/lib/esm/types/di/syntax/binding_to_syntax.d.ts +18 -0
- package/lib/esm/types/di/syntax/binding_when_on_syntax.d.ts +25 -0
- package/lib/esm/types/di/syntax/binding_when_syntax.d.ts +21 -0
- package/lib/esm/types/di/syntax/constraint_helpers.d.ts +6 -0
- package/lib/esm/types/di/utils/async.d.ts +3 -0
- package/lib/esm/types/di/utils/binding_utils.d.ts +4 -0
- package/lib/esm/types/di/utils/clonable.d.ts +3 -0
- package/lib/esm/types/di/utils/exceptions.d.ts +2 -0
- package/lib/esm/types/di/utils/factory_type.d.ts +5 -0
- package/lib/esm/types/di/utils/id.d.ts +2 -0
- package/lib/esm/types/di/utils/js.d.ts +1 -0
- package/lib/esm/types/di/utils/serialization.d.ts +10 -0
- package/lib/esm/types/error/app-error.d.ts +177 -0
- package/lib/esm/types/error/base-exception-filter.d.ts +73 -0
- package/lib/esm/types/error/error-handler-middleware.d.ts +11 -0
- package/lib/esm/types/error/exception-filter-constants.d.ts +9 -0
- package/lib/esm/types/error/exception-filter-decorators.d.ts +126 -0
- package/lib/esm/types/error/exception-filter-registry.d.ts +38 -0
- package/lib/esm/types/error/exception-filter.interface.d.ts +82 -0
- package/lib/esm/types/error/exception-handler-middleware.d.ts +35 -0
- package/lib/esm/types/error/filters/app-error.filter.d.ts +10 -0
- package/lib/esm/types/error/filters/global-exception.filter.d.ts +9 -0
- package/lib/esm/types/error/filters/not-found.filter.d.ts +10 -0
- package/lib/esm/types/error/filters/validation-error.filter.d.ts +10 -0
- package/lib/esm/types/error/index.d.ts +14 -0
- package/lib/esm/types/error/not-found.error.d.ts +7 -0
- package/lib/esm/types/error/report.d.ts +105 -0
- package/lib/esm/types/error/status-code.d.ts +156 -0
- package/lib/esm/types/error/utils.d.ts +17 -0
- package/lib/esm/types/error/validation.error.d.ts +8 -0
- package/lib/esm/types/event/event-decorators.d.ts +199 -0
- package/lib/esm/types/event/event-emitter.d.ts +109 -0
- package/lib/esm/types/event/event-flow-tracker.d.ts +88 -0
- package/lib/esm/types/event/event-recorder.d.ts +121 -0
- package/lib/esm/types/event/event-registry.d.ts +84 -0
- package/lib/esm/types/event/event.interfaces.d.ts +528 -0
- package/lib/esm/types/event/index.d.ts +55 -0
- package/lib/esm/types/index.d.ts +27 -0
- package/lib/esm/types/interceptor/conditional-interceptor.d.ts +91 -0
- package/lib/esm/types/interceptor/execution-context.d.ts +41 -0
- package/lib/esm/types/interceptor/index.d.ts +41 -0
- package/lib/esm/types/interceptor/interceptor-composition.d.ts +115 -0
- package/lib/esm/types/interceptor/interceptor-constants.d.ts +17 -0
- package/lib/esm/types/interceptor/interceptor-decorators.d.ts +124 -0
- package/lib/esm/types/interceptor/interceptor-executor.d.ts +46 -0
- package/lib/esm/types/interceptor/interceptor-registry.d.ts +65 -0
- package/lib/esm/types/interceptor/interceptor.interface.d.ts +281 -0
- package/lib/esm/types/interceptor/interceptors/index.d.ts +6 -0
- package/lib/esm/types/interceptor/interceptors/logging.interceptor.d.ts +28 -0
- package/lib/esm/types/interceptor/interceptors/performance.interceptor.d.ts +197 -0
- package/lib/esm/types/interceptor/interceptors/timeout.interceptor.d.ts +42 -0
- package/lib/esm/types/lazy-loading/index.d.ts +42 -0
- package/lib/esm/types/lazy-loading/lazy-load-metrics.d.ts +139 -0
- package/lib/esm/types/lazy-loading/lazy-module-loader.d.ts +169 -0
- package/lib/esm/types/lazy-loading/lazy-module-manager.d.ts +148 -0
- package/lib/esm/types/lazy-loading/lazy-module-warmup.d.ts +130 -0
- package/lib/esm/types/lazy-loading/lazy-module.d.ts +168 -0
- package/lib/esm/types/lazy-loading/lazy.interfaces.d.ts +480 -0
- package/lib/esm/types/lifecycle/index.d.ts +9 -0
- package/lib/esm/types/lifecycle/lifecycle-registry.d.ts +213 -0
- package/lib/esm/types/lifecycle/lifecycle.interface.d.ts +191 -0
- package/lib/esm/types/middleware/content-negotiation/accept-header-parser.d.ts +26 -0
- package/lib/esm/types/middleware/content-negotiation/content-negotiation-service.d.ts +64 -0
- package/lib/esm/types/middleware/content-negotiation/formatter-registry.d.ts +60 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/csv-formatter.d.ts +34 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/index.d.ts +8 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/json-formatter.d.ts +14 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/plain-text-formatter.d.ts +12 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/xml-formatter.d.ts +26 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/yaml-formatter.d.ts +26 -0
- package/lib/esm/types/middleware/content-negotiation/index.d.ts +7 -0
- package/lib/esm/types/middleware/index.d.ts +25 -0
- package/lib/esm/types/middleware/interfaces/body-parser.interface.d.ts +31 -0
- package/lib/esm/types/middleware/interfaces/compression.interface.d.ts +98 -0
- package/lib/esm/types/middleware/interfaces/content-negotiation.interface.d.ts +142 -0
- package/lib/esm/types/middleware/interfaces/cookie-parser.interface.d.ts +9 -0
- package/lib/esm/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +57 -0
- package/lib/esm/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts +27 -0
- package/lib/esm/types/middleware/interfaces/cors.interface.d.ts +57 -0
- package/lib/esm/types/middleware/interfaces/express-rate-limit.interface.d.ts +292 -0
- package/lib/esm/types/middleware/interfaces/express-session.interface.d.ts +207 -0
- package/lib/esm/types/middleware/interfaces/helmet.interface.d.ts +210 -0
- package/lib/esm/types/middleware/interfaces/morgan.interface.d.ts +39 -0
- package/lib/esm/types/middleware/interfaces/multer.interface.d.ts +253 -0
- package/lib/esm/types/middleware/interfaces/serve-favicon.interface.d.ts +11 -0
- package/lib/esm/types/middleware/interfaces/serve-static.interface.d.ts +69 -0
- package/lib/esm/types/middleware/interfaces/url-encoded.interface.d.ts +37 -0
- package/lib/esm/types/middleware/middleware-config.d.ts +574 -0
- package/lib/esm/types/middleware/middleware-interface.d.ts +691 -0
- package/lib/esm/types/middleware/middleware-presets.d.ts +90 -0
- package/lib/esm/types/middleware/middleware-profiler.d.ts +199 -0
- package/lib/esm/types/middleware/middleware-registry.d.ts +103 -0
- package/lib/esm/types/middleware/middleware-resolver.d.ts +159 -0
- package/lib/esm/types/middleware/middleware-service.d.ts +767 -0
- package/lib/esm/types/middleware/middleware-utils.d.ts +145 -0
- package/lib/esm/types/middleware/upload-registry.d.ts +50 -0
- package/lib/esm/types/path-resolver/index.d.ts +80 -0
- package/lib/esm/types/provider/db-in-memory/adapter/adapter.interface.d.ts +222 -0
- package/lib/esm/types/provider/db-in-memory/adapter/in-memory.adapter.d.ts +239 -0
- package/lib/esm/types/provider/db-in-memory/adapter/index.d.ts +6 -0
- package/lib/esm/types/provider/db-in-memory/base-repo.repository.d.ts +18 -0
- package/lib/esm/types/provider/db-in-memory/db-in-memory.interface.d.ts +43 -0
- package/lib/esm/types/provider/db-in-memory/db-in-memory.provider.d.ts +39 -0
- package/lib/esm/types/provider/db-in-memory/db-in-memory.types.d.ts +14 -0
- package/lib/esm/types/provider/db-in-memory/db.provider.d.ts +281 -0
- package/lib/esm/types/provider/db-in-memory/index.d.ts +63 -0
- package/lib/esm/types/provider/db-in-memory/query/index.d.ts +6 -0
- package/lib/esm/types/provider/db-in-memory/query/query-engine.d.ts +101 -0
- package/lib/esm/types/provider/db-in-memory/query/query.types.d.ts +318 -0
- package/lib/esm/types/provider/db-in-memory/schema/decorators.d.ts +314 -0
- package/lib/esm/types/provider/db-in-memory/schema/entity.interface.d.ts +60 -0
- package/lib/esm/types/provider/db-in-memory/schema/index.d.ts +6 -0
- package/lib/esm/types/provider/db-in-memory/storage/index.d.ts +5 -0
- package/lib/esm/types/provider/db-in-memory/storage/memory-store.d.ts +326 -0
- package/lib/esm/types/provider/dto-validator/dto-validator.provider.d.ts +10 -0
- package/lib/esm/types/provider/dto-validator/package-resolver.d.ts +7 -0
- package/lib/esm/types/provider/index.d.ts +7 -0
- package/lib/esm/types/provider/logger/decorators/index.d.ts +1 -0
- package/lib/esm/types/provider/logger/decorators/log-performance.decorator.d.ts +49 -0
- package/lib/esm/types/provider/logger/index.d.ts +17 -0
- package/lib/esm/types/provider/logger/logger.banner.d.ts +94 -0
- package/lib/esm/types/provider/logger/logger.config.d.ts +55 -0
- package/lib/esm/types/provider/logger/logger.context.d.ts +189 -0
- package/lib/esm/types/provider/logger/logger.flow.d.ts +165 -0
- package/lib/esm/types/provider/logger/logger.formatter.d.ts +44 -0
- package/lib/esm/types/provider/logger/logger.grouping.d.ts +124 -0
- package/lib/esm/types/provider/logger/logger.health.d.ts +123 -0
- package/lib/esm/types/provider/logger/logger.metrics-collector.d.ts +44 -0
- package/lib/esm/types/provider/logger/logger.metrics.d.ts +162 -0
- package/lib/esm/types/provider/logger/logger.performance.d.ts +179 -0
- package/lib/esm/types/provider/logger/logger.provider.d.ts +332 -0
- package/lib/esm/types/provider/logger/logger.query.d.ts +232 -0
- package/lib/esm/types/provider/logger/logger.redaction.d.ts +169 -0
- package/lib/esm/types/provider/logger/logger.suggestions.d.ts +124 -0
- package/lib/esm/types/provider/logger/transports/console.transport.d.ts +49 -0
- package/lib/esm/types/provider/logger/transports/file.transport.d.ts +87 -0
- package/lib/esm/types/provider/logger/transports/http-server.d.ts +88 -0
- package/lib/esm/types/provider/logger/transports/http.transport.d.ts +74 -0
- package/lib/esm/types/provider/logger/transports/index.d.ts +5 -0
- package/lib/esm/types/provider/logger/transports/transport.interface.d.ts +31 -0
- package/lib/esm/types/provider/logger/utils/index.d.ts +2 -0
- package/lib/esm/types/provider/logger/utils/log-entry.d.ts +82 -0
- package/lib/esm/types/provider/logger/utils/log-levels.d.ts +53 -0
- package/lib/esm/types/provider/provider-manager.d.ts +208 -0
- package/lib/esm/types/provider/provider-registry.d.ts +192 -0
- package/lib/esm/types/provider/provider.interface.d.ts +337 -0
- package/lib/esm/types/provider/validation/adapters/class-validator.adapter.d.ts +68 -0
- package/lib/esm/types/provider/validation/adapters/index.d.ts +10 -0
- package/lib/esm/types/provider/validation/helpful-error-formatter.d.ts +110 -0
- package/lib/esm/types/provider/validation/index.d.ts +19 -0
- package/lib/esm/types/provider/validation/smart-field-detector.d.ts +91 -0
- package/lib/esm/types/provider/validation/type-inference.d.ts +81 -0
- package/lib/esm/types/provider/validation/validation-registry.d.ts +105 -0
- package/lib/esm/types/provider/validation/validation.interface.d.ts +178 -0
- package/lib/esm/types/render/adapters/base-adapter.d.ts +95 -0
- package/lib/esm/types/render/adapters/ejs-adapter.d.ts +57 -0
- package/lib/esm/types/render/adapters/handlebars-adapter.d.ts +74 -0
- package/lib/esm/types/render/adapters/index.d.ts +12 -0
- package/lib/esm/types/render/adapters/pug-adapter.d.ts +57 -0
- package/lib/esm/types/render/adapters/react-adapter.d.ts +99 -0
- package/lib/esm/types/render/features/auto-detection.d.ts +58 -0
- package/lib/esm/types/render/features/hot-reload.d.ts +65 -0
- package/lib/esm/types/render/features/index.d.ts +12 -0
- package/lib/esm/types/render/features/streaming.d.ts +39 -0
- package/lib/esm/types/render/features/type-generator.d.ts +64 -0
- package/lib/esm/types/render/features/view-debugger.d.ts +42 -0
- package/lib/esm/types/render/index.d.ts +50 -0
- package/lib/esm/types/render/presets/index.d.ts +119 -0
- package/lib/esm/types/render/render-config.d.ts +213 -0
- package/lib/esm/types/render/render-interface.d.ts +126 -0
- package/lib/esm/types/render/render-registry.d.ts +86 -0
- package/lib/esm/types/render/render-service.d.ts +157 -0
- package/lib/esm/types/render/utils/cache-manager.d.ts +106 -0
- package/lib/esm/types/render/utils/index.d.ts +11 -0
- package/lib/esm/types/render/utils/package-resolver.d.ts +57 -0
- package/lib/esm/types/render/utils/view-scanner.d.ts +74 -0
- package/lib/esm/types/testing/create-test-app.d.ts +71 -0
- package/lib/esm/types/testing/create-test-database.d.ts +100 -0
- package/lib/esm/types/testing/fluent-request.d.ts +37 -0
- package/lib/esm/types/testing/index.d.ts +93 -0
- package/lib/esm/types/testing/load-test.d.ts +139 -0
- package/lib/esm/types/testing/matchers.d.ts +184 -0
- package/lib/esm/types/testing/mock-context.d.ts +117 -0
- package/lib/esm/types/testing/mock-provider.d.ts +93 -0
- package/lib/esm/types/testing/snapshot-request.d.ts +46 -0
- package/lib/esm/types/testing/testing.interfaces.d.ts +948 -0
- package/lib/esm/types/utils/node-require.d.ts +11 -0
- package/lib/esm/utils/node-require.js +56 -0
- package/lib/package.json +152 -151
- package/package.json +152 -151
- package/lib/cjs/provider/environment/env-validator.provider.js +0 -100
- package/lib/cjs/types/provider/environment/env-validator.provider.d.ts +0 -39
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
import { config, parse } from "@expressots/shared";
|
|
2
|
+
import { AppFactory } from "./application-factory.js";
|
|
3
|
+
import { Logger } from "../provider/logger/logger.provider.js";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
/**
|
|
7
|
+
* Synchronously load .env files BEFORE defineConfig() resolves.
|
|
8
|
+
*
|
|
9
|
+
* Call this at the top of your config file to ensure environment variables
|
|
10
|
+
* are available when defineConfig() runs.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Environment file configuration
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // config.ts
|
|
17
|
+
* import { defineConfig, Env, loadEnvSync } from "@expressots/core";
|
|
18
|
+
*
|
|
19
|
+
* // Load .env files first
|
|
20
|
+
* loadEnvSync({
|
|
21
|
+
* files: {
|
|
22
|
+
* development: ".env.dev",
|
|
23
|
+
* production: ".env.prod",
|
|
24
|
+
* },
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Now defineConfig() will read from loaded .env files
|
|
28
|
+
* export const appConfig = defineConfig({
|
|
29
|
+
* server: {
|
|
30
|
+
* port: Env.port("PORT", { default: 3000 }),
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @public API
|
|
36
|
+
*/
|
|
37
|
+
export function loadEnvSync(options) {
|
|
38
|
+
// Skip if already loaded (unless force reload)
|
|
39
|
+
if (process.env._EXPRESSOTS_ENV_LOADED === "true" && !options?.force) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Determine current environment
|
|
43
|
+
const currentEnvironment = process.env.NODE_ENV ?? "development";
|
|
44
|
+
// Determine the file name for current environment
|
|
45
|
+
const envFileName = options?.files?.[currentEnvironment] ?? `.env.${currentEnvironment}`;
|
|
46
|
+
// Load optional base files first (they get overridden by environment-specific file)
|
|
47
|
+
// Use override: true to ensure new values overwrite existing ones (important for hot reload)
|
|
48
|
+
const optionalFiles = [".env", ".env.local", `${envFileName}.local`];
|
|
49
|
+
for (const file of optionalFiles) {
|
|
50
|
+
try {
|
|
51
|
+
if (fs.existsSync(file)) {
|
|
52
|
+
config({ path: file, override: true });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Silently skip optional files
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Load the environment-specific file
|
|
60
|
+
if (fs.existsSync(envFileName)) {
|
|
61
|
+
config({ path: envFileName, override: true });
|
|
62
|
+
}
|
|
63
|
+
// Mark as loaded
|
|
64
|
+
process.env._EXPRESSOTS_ENV_LOADED = "true";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Cached CI environment detection result (immutable at runtime).
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
let _isCI;
|
|
71
|
+
/**
|
|
72
|
+
* Cached package.json data (immutable at runtime).
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
let _packageCache;
|
|
76
|
+
/**
|
|
77
|
+
* CI platform detection map for O(1) lookup.
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
const CI_PLATFORM_MAP = new Map([
|
|
81
|
+
["GITHUB_ACTIONS", "GitHub Actions"],
|
|
82
|
+
["GITLAB_CI", "GitLab CI"],
|
|
83
|
+
["JENKINS_URL", "Jenkins"],
|
|
84
|
+
["CIRCLECI", "CircleCI"],
|
|
85
|
+
["TRAVIS", "Travis CI"],
|
|
86
|
+
["BUILDKITE", "Buildkite"],
|
|
87
|
+
["AZURE_HTTP_USER_AGENT", "Azure DevOps"],
|
|
88
|
+
["BAMBOO_BUILDKEY", "Bamboo"],
|
|
89
|
+
["TEAMCITY_VERSION", "TeamCity"],
|
|
90
|
+
]);
|
|
91
|
+
/**
|
|
92
|
+
* Platform-specific hint generators (memoized functions).
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
const PLATFORM_HINTS = new Map([
|
|
96
|
+
[
|
|
97
|
+
"GitHub Actions",
|
|
98
|
+
(missingVars) => `
|
|
99
|
+
🔧 GitHub Actions Setup:
|
|
100
|
+
- Go to: Settings → Secrets and variables → Actions
|
|
101
|
+
- Add repository secrets for: ${missingVars}
|
|
102
|
+
- Use: \${{ secrets.VARIABLE_NAME }} in workflow files`,
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
"GitLab CI",
|
|
106
|
+
(missingVars) => `
|
|
107
|
+
🔧 GitLab CI Setup:
|
|
108
|
+
- Go to: Settings → CI/CD → Variables
|
|
109
|
+
- Add CI/CD variables for: ${missingVars}
|
|
110
|
+
- Use: $VARIABLE_NAME in .gitlab-ci.yml`,
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
"Jenkins",
|
|
114
|
+
(missingVars) => `
|
|
115
|
+
🔧 Jenkins Setup:
|
|
116
|
+
- Configure: Manage Jenkins → Credentials
|
|
117
|
+
- Add credentials for: ${missingVars}
|
|
118
|
+
- Use: env.VARIABLE_NAME in pipeline`,
|
|
119
|
+
],
|
|
120
|
+
]);
|
|
121
|
+
/**
|
|
122
|
+
* Detect if running in CI/CD environment.
|
|
123
|
+
* Result is cached since CI environment doesn't change at runtime.
|
|
124
|
+
*
|
|
125
|
+
* @returns True if running in CI/CD
|
|
126
|
+
* @private
|
|
127
|
+
* @performance Cached result for O(1) subsequent calls
|
|
128
|
+
*/
|
|
129
|
+
function isCIEnvironment() {
|
|
130
|
+
if (_isCI === undefined) {
|
|
131
|
+
_isCI = !!((process.env.CI || // Generic CI flag
|
|
132
|
+
process.env.GITHUB_ACTIONS || // GitHub Actions
|
|
133
|
+
process.env.GITLAB_CI || // GitLab CI
|
|
134
|
+
process.env.JENKINS_URL || // Jenkins
|
|
135
|
+
process.env.CIRCLECI || // CircleCI
|
|
136
|
+
process.env.TRAVIS || // Travis CI
|
|
137
|
+
process.env.BUILDKITE || // Buildkite
|
|
138
|
+
process.env.AZURE_HTTP_USER_AGENT || // Azure DevOps
|
|
139
|
+
process.env.BAMBOO_BUILDKEY || // Bamboo
|
|
140
|
+
process.env.TEAMCITY_VERSION) // TeamCity
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return _isCI;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Detect CI/CD platform name using optimized Map lookup.
|
|
147
|
+
*
|
|
148
|
+
* @returns Platform name or "CI Platform"
|
|
149
|
+
* @private
|
|
150
|
+
* @performance O(n) where n is number of platforms (typically 9), but uses Map for efficient iteration
|
|
151
|
+
*/
|
|
152
|
+
function detectCIPlatform() {
|
|
153
|
+
for (const [envKey, platformName] of CI_PLATFORM_MAP) {
|
|
154
|
+
if (process.env[envKey]) {
|
|
155
|
+
return platformName;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return "CI Platform";
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get platform-specific setup hints using memoized functions.
|
|
162
|
+
*
|
|
163
|
+
* @param platform - CI platform name
|
|
164
|
+
* @param missing - Missing variable names
|
|
165
|
+
* @returns Setup hint string
|
|
166
|
+
* @private
|
|
167
|
+
* @performance Uses pre-constructed Map for O(1) lookup
|
|
168
|
+
*/
|
|
169
|
+
function getPlatformHint(platform, missing) {
|
|
170
|
+
const missingVars = missing.join(", ");
|
|
171
|
+
const hintFn = PLATFORM_HINTS.get(platform);
|
|
172
|
+
return (hintFn?.(missingVars) ||
|
|
173
|
+
`Configure secrets in your CI/CD platform for: ${missingVars}`);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Custom error for missing environment file.
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
class EnvFileNotFoundError extends Error {
|
|
180
|
+
constructor(fileName, environment) {
|
|
181
|
+
const template = getEnvTemplate(environment);
|
|
182
|
+
super(`
|
|
183
|
+
❌ Missing required environment file: ${fileName}
|
|
184
|
+
|
|
185
|
+
💡 Create ${fileName} with:
|
|
186
|
+
${template}
|
|
187
|
+
|
|
188
|
+
📖 Docs: https://expresso-ts.com/docs/env
|
|
189
|
+
🔍 Check existing files: ls -la .env*
|
|
190
|
+
`.trim());
|
|
191
|
+
this.name = "EnvFileNotFoundError";
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Custom error for CI/CD environment validation.
|
|
196
|
+
* @private
|
|
197
|
+
*/
|
|
198
|
+
class CIEnvValidationError extends Error {
|
|
199
|
+
constructor(missing, environment) {
|
|
200
|
+
const ciPlatform = detectCIPlatform();
|
|
201
|
+
const platformHint = getPlatformHint(ciPlatform, missing);
|
|
202
|
+
super(`
|
|
203
|
+
❌ CI/CD Environment Validation Failed
|
|
204
|
+
|
|
205
|
+
Missing required environment variables in ${environment}:
|
|
206
|
+
${missing.map((key) => ` • ${key}`).join("\n")}
|
|
207
|
+
|
|
208
|
+
${platformHint}
|
|
209
|
+
|
|
210
|
+
💡 Action Required:
|
|
211
|
+
1. Add missing variables to your CI/CD platform secrets
|
|
212
|
+
2. Ensure variables are available in ${environment} environment
|
|
213
|
+
3. Check variable names match exactly (case-sensitive)
|
|
214
|
+
|
|
215
|
+
📖 Docs: https://expresso-ts.com/docs/ci-cd
|
|
216
|
+
`.trim());
|
|
217
|
+
this.name = "CIEnvValidationError";
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Custom error for environment variable validation.
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
class EnvValidationError extends Error {
|
|
225
|
+
constructor(missing, fileName) {
|
|
226
|
+
super(`
|
|
227
|
+
❌ Environment validation failed
|
|
228
|
+
|
|
229
|
+
Missing values in ${fileName}:
|
|
230
|
+
${missing.map((key) => ` • ${key} (required but empty)`).join("\n")}
|
|
231
|
+
|
|
232
|
+
💡 Add values to ${fileName}:
|
|
233
|
+
${missing.map((key) => ` ${key}=your-value-here`).join("\n")}
|
|
234
|
+
|
|
235
|
+
📖 Docs: https://expresso-ts.com/docs/env
|
|
236
|
+
`.trim());
|
|
237
|
+
this.name = "EnvValidationError";
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Get environment template content.
|
|
242
|
+
* @param environment - Environment name
|
|
243
|
+
* @returns Template string
|
|
244
|
+
* @private
|
|
245
|
+
*/
|
|
246
|
+
function getEnvTemplate(environment) {
|
|
247
|
+
return `PORT=3000
|
|
248
|
+
NODE_ENV=${environment}
|
|
249
|
+
# Add your environment variables here`;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Create environment file template.
|
|
253
|
+
* @param fileName - File name to create
|
|
254
|
+
* @param environment - Environment name (e.g., "development", "production")
|
|
255
|
+
* @param required - Required variable names
|
|
256
|
+
* @private
|
|
257
|
+
*/
|
|
258
|
+
async function createEnvTemplate(fileName, environment, required) {
|
|
259
|
+
const commonVars = [
|
|
260
|
+
"PORT=3000",
|
|
261
|
+
`NODE_ENV=${environment}`,
|
|
262
|
+
"# Add your environment variables below",
|
|
263
|
+
];
|
|
264
|
+
const requiredVars = required?.map((key) => `${key}=`) || [];
|
|
265
|
+
const template = [...commonVars, ...requiredVars].join("\n");
|
|
266
|
+
await fs.promises.writeFile(fileName, template, "utf-8");
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Validate environment variables from process.env.
|
|
270
|
+
* @param required - Required variable names
|
|
271
|
+
* @returns Validation result
|
|
272
|
+
* @private
|
|
273
|
+
*/
|
|
274
|
+
function validateEnvVariablesFromProcessEnv(required) {
|
|
275
|
+
const missing = [];
|
|
276
|
+
for (const key of required) {
|
|
277
|
+
const value = process.env[key];
|
|
278
|
+
if (!value || value.trim() === "") {
|
|
279
|
+
missing.push(key);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
valid: missing.length === 0,
|
|
284
|
+
missing,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Validate environment variables from file.
|
|
289
|
+
* @param fileName - Environment file name
|
|
290
|
+
* @param required - Required variable names (if empty, validates all in file)
|
|
291
|
+
* @returns Validation result
|
|
292
|
+
* @private
|
|
293
|
+
*/
|
|
294
|
+
function validateEnvVariablesFromFile(fileName, required) {
|
|
295
|
+
const missing = [];
|
|
296
|
+
if (!fs.existsSync(fileName)) {
|
|
297
|
+
return { valid: false, missing: required ? [...required] : [] };
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
const fileContent = fs.readFileSync(fileName, "utf-8");
|
|
301
|
+
const parsed = parse(fileContent);
|
|
302
|
+
if (required && required.length > 0) {
|
|
303
|
+
// Validate only required variables
|
|
304
|
+
for (const key of required) {
|
|
305
|
+
const value = process.env[key];
|
|
306
|
+
if (!value || value.trim() === "") {
|
|
307
|
+
missing.push(key);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
// Validate all variables in file
|
|
313
|
+
for (const key of Object.keys(parsed)) {
|
|
314
|
+
const value = process.env[key];
|
|
315
|
+
if (!value || value.trim() === "") {
|
|
316
|
+
missing.push(key);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
// File exists but couldn't be parsed
|
|
323
|
+
throw new Error(`Failed to parse ${fileName}: ${error}`);
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
valid: missing.length === 0,
|
|
327
|
+
missing,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Load and validate environment files with smart defaults.
|
|
332
|
+
*
|
|
333
|
+
* **Important:** This function only runs if `envFileConfig` is explicitly provided.
|
|
334
|
+
* If `envFileConfig` is `undefined`, .env file loading is skipped entirely.
|
|
335
|
+
*
|
|
336
|
+
* @param currentEnvironment - Current environment name (e.g., "development", "production")
|
|
337
|
+
* @param envFileConfig - Environment file configuration from BootstrapOptions.envFileConfig
|
|
338
|
+
* @returns Environment loading result
|
|
339
|
+
* @private
|
|
340
|
+
*/
|
|
341
|
+
async function loadAndValidateEnvironment(currentEnvironment, envFileConfig) {
|
|
342
|
+
const result = {
|
|
343
|
+
loaded: [],
|
|
344
|
+
validated: false,
|
|
345
|
+
warnings: [],
|
|
346
|
+
};
|
|
347
|
+
// 🎯 OPT-OUT: If envFileConfig is not provided, skip .env file loading entirely
|
|
348
|
+
// Templates can opt-in by providing envFileConfig in their bootstrap calls
|
|
349
|
+
if (!envFileConfig) {
|
|
350
|
+
result.validated = true;
|
|
351
|
+
process.env._EXPRESSOTS_ENV_LOADED = "true";
|
|
352
|
+
return result;
|
|
353
|
+
}
|
|
354
|
+
const isCI = envFileConfig.ciMode ?? isCIEnvironment();
|
|
355
|
+
const skipFileLoading = envFileConfig.skipFileLoading ?? false;
|
|
356
|
+
// 🎯 CI/CD: Skip file loading, use process.env directly
|
|
357
|
+
if (isCI || skipFileLoading) {
|
|
358
|
+
if (isCI) {
|
|
359
|
+
// Store CI info for logging after banner is displayed
|
|
360
|
+
result.ciDetected = true;
|
|
361
|
+
result.ciPlatform = detectCIPlatform();
|
|
362
|
+
}
|
|
363
|
+
// Support .env.vault in CI/CD
|
|
364
|
+
if (process.env.DOTENV_KEY) {
|
|
365
|
+
try {
|
|
366
|
+
config({ path: ".env.vault" });
|
|
367
|
+
result.loaded.push(".env.vault (encrypted)");
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
result.warnings.push(`Warning: Could not load .env.vault: ${error}`);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
// Validate required variables from process.env
|
|
374
|
+
const validateValues = envFileConfig.validateValues ?? true; // Always validate in CI
|
|
375
|
+
const required = (envFileConfig.required || []);
|
|
376
|
+
if (validateValues || required.length > 0) {
|
|
377
|
+
const validationResult = validateEnvVariablesFromProcessEnv(required);
|
|
378
|
+
if (!validationResult.valid) {
|
|
379
|
+
throw new CIEnvValidationError(validationResult.missing, currentEnvironment);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
result.validated = true;
|
|
383
|
+
process.env._EXPRESSOTS_ENV_LOADED = "true";
|
|
384
|
+
return result;
|
|
385
|
+
}
|
|
386
|
+
// 🎯 Local Development: Load from files
|
|
387
|
+
const validateFile = envFileConfig.validateFile ?? true;
|
|
388
|
+
const validateValues = envFileConfig.validateValues ?? currentEnvironment === "production";
|
|
389
|
+
// Only auto-create if explicitly enabled (default: false - opt-in behavior)
|
|
390
|
+
const autoCreate = envFileConfig.autoCreateTemplate ?? false;
|
|
391
|
+
// 🎯 STEP 1: Create templates for all mapped environments (if autoCreate is enabled)
|
|
392
|
+
// If files mapping is provided, create templates for ALL mapped environments
|
|
393
|
+
// This helps users set up their project with all necessary .env files
|
|
394
|
+
if (autoCreate && envFileConfig.files) {
|
|
395
|
+
const createdTemplates = [];
|
|
396
|
+
for (const [envName, fileName] of Object.entries(envFileConfig.files)) {
|
|
397
|
+
if (!fs.existsSync(fileName)) {
|
|
398
|
+
await createEnvTemplate(fileName, envName, envFileConfig.required);
|
|
399
|
+
createdTemplates.push(fileName);
|
|
400
|
+
// Load the newly created file
|
|
401
|
+
config({ path: fileName });
|
|
402
|
+
result.loaded.push(fileName);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (createdTemplates.length > 0) {
|
|
406
|
+
result.createdTemplates = createdTemplates;
|
|
407
|
+
result.createdTemplate = createdTemplates[0]; // For backward compatibility
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
// 🎯 STEP 2: Determine and load the file for the current environment
|
|
411
|
+
// Only ONE file is loaded at runtime - the file for the current environment
|
|
412
|
+
const envFileName = envFileConfig.files?.[currentEnvironment] ?? `.env.${currentEnvironment}`;
|
|
413
|
+
// Load optional files silently
|
|
414
|
+
const optionalFiles = [".env", ".env.local", `${envFileName}.local`];
|
|
415
|
+
for (const file of optionalFiles) {
|
|
416
|
+
try {
|
|
417
|
+
config({ path: file });
|
|
418
|
+
result.loaded.push(file);
|
|
419
|
+
}
|
|
420
|
+
catch {
|
|
421
|
+
// Silently skip optional files
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
// 🎯 STEP 3: Handle the required file for current environment
|
|
425
|
+
const requiredFileExists = fs.existsSync(envFileName);
|
|
426
|
+
if (!requiredFileExists) {
|
|
427
|
+
if (autoCreate) {
|
|
428
|
+
// Auto-create template file with correct environment value
|
|
429
|
+
// This handles the case where files mapping wasn't provided but autoCreate is true
|
|
430
|
+
await createEnvTemplate(envFileName, currentEnvironment, envFileConfig.required);
|
|
431
|
+
if (!result.createdTemplates) {
|
|
432
|
+
result.createdTemplates = [];
|
|
433
|
+
}
|
|
434
|
+
result.createdTemplates.push(envFileName);
|
|
435
|
+
result.createdTemplate = envFileName;
|
|
436
|
+
// Reload the newly created file
|
|
437
|
+
config({ path: envFileName });
|
|
438
|
+
result.loaded.push(envFileName);
|
|
439
|
+
}
|
|
440
|
+
else if (validateFile) {
|
|
441
|
+
// Throw helpful error - but only if autoCreate is false
|
|
442
|
+
// Provide helpful message about all missing files if files mapping exists
|
|
443
|
+
const missingFiles = envFileConfig.files
|
|
444
|
+
? Object.entries(envFileConfig.files)
|
|
445
|
+
.filter(([, fileName]) => !fs.existsSync(fileName))
|
|
446
|
+
.map(([envName, fileName]) => `${fileName} (for ${envName})`)
|
|
447
|
+
: [envFileName];
|
|
448
|
+
if (missingFiles.length > 1) {
|
|
449
|
+
throw new Error(`❌ Missing required environment files:\n${missingFiles.map((f) => ` • ${f}`).join("\n")}\n\n💡 Create these files or set autoCreateTemplate: true to auto-generate them.\n📖 Docs: https://expresso-ts.com/docs/env`);
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
throw new EnvFileNotFoundError(envFileName, currentEnvironment);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
result.warnings.push(`⚠️ ${envFileName} not found (optional)`);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
// Load the file
|
|
461
|
+
config({ path: envFileName });
|
|
462
|
+
result.loaded.push(envFileName);
|
|
463
|
+
}
|
|
464
|
+
// Validate variables have values
|
|
465
|
+
if (validateValues ||
|
|
466
|
+
(envFileConfig.required && envFileConfig.required.length > 0)) {
|
|
467
|
+
const validationResult = validateEnvVariablesFromFile(envFileName, envFileConfig.required);
|
|
468
|
+
if (!validationResult.valid) {
|
|
469
|
+
throw new EnvValidationError(validationResult.missing, envFileName);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
result.validated = true;
|
|
473
|
+
process.env._EXPRESSOTS_ENV_LOADED = "true";
|
|
474
|
+
return result;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Determine port with priority: options.port > process.env.PORT > 3000
|
|
478
|
+
* @param options - Bootstrap options
|
|
479
|
+
* @returns Port number
|
|
480
|
+
* @private
|
|
481
|
+
*/
|
|
482
|
+
function determinePort(options) {
|
|
483
|
+
// Priority: options.port > process.env.PORT > 3000
|
|
484
|
+
if (options?.port !== undefined) {
|
|
485
|
+
return options.port;
|
|
486
|
+
}
|
|
487
|
+
const envPort = process.env.PORT;
|
|
488
|
+
if (envPort) {
|
|
489
|
+
const port = parseInt(envPort, 10);
|
|
490
|
+
if (isNaN(port)) {
|
|
491
|
+
throw new Error(`Invalid PORT in .env: "${envPort}". Must be a number.`);
|
|
492
|
+
}
|
|
493
|
+
return port;
|
|
494
|
+
}
|
|
495
|
+
return 3000; // Default
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Read package.json to get app name and version.
|
|
499
|
+
* Result is cached since package.json doesn't change at runtime.
|
|
500
|
+
*
|
|
501
|
+
* @returns Package.json data
|
|
502
|
+
* @private
|
|
503
|
+
* @performance Cached result for O(1) subsequent calls after first read
|
|
504
|
+
*/
|
|
505
|
+
async function readPackageJson() {
|
|
506
|
+
if (_packageCache !== undefined) {
|
|
507
|
+
return _packageCache;
|
|
508
|
+
}
|
|
509
|
+
try {
|
|
510
|
+
const packagePath = path.resolve(process.cwd(), "package.json");
|
|
511
|
+
const packageContent = await fs.promises.readFile(packagePath, "utf-8");
|
|
512
|
+
const pkg = JSON.parse(packageContent);
|
|
513
|
+
_packageCache = {
|
|
514
|
+
name: pkg.name,
|
|
515
|
+
version: pkg.version,
|
|
516
|
+
};
|
|
517
|
+
return _packageCache;
|
|
518
|
+
}
|
|
519
|
+
catch (error) {
|
|
520
|
+
// Package.json not found or invalid - cache empty result
|
|
521
|
+
_packageCache = {};
|
|
522
|
+
return _packageCache;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Bootstrap the ExpressoTS application with zero configuration.
|
|
527
|
+
*
|
|
528
|
+
* @layer public
|
|
529
|
+
* @audience application-developers
|
|
530
|
+
* @concept bootstrap
|
|
531
|
+
* @difficulty beginner
|
|
532
|
+
*
|
|
533
|
+
* @summary Quick Start
|
|
534
|
+
* The simplest way to start your application:
|
|
535
|
+
* ```typescript
|
|
536
|
+
* await bootstrap(App);
|
|
537
|
+
* ```
|
|
538
|
+
*
|
|
539
|
+
* This function orchestrates 8 critical startup phases:
|
|
540
|
+
* 1. Environment detection (CI/CD vs local)
|
|
541
|
+
* 2. Smart .env loading with opt-in behavior
|
|
542
|
+
* 3. Port determination (priority chain)
|
|
543
|
+
* 4. Package.json metadata extraction
|
|
544
|
+
* 5. DI container initialization via AppFactory
|
|
545
|
+
* 6. Environment injection into app instance
|
|
546
|
+
* 7. API version detection from decorators
|
|
547
|
+
* 8. Server startup with graceful shutdown
|
|
548
|
+
*
|
|
549
|
+
* @param AppClass - Application class extending AppExpress
|
|
550
|
+
* @param options - Optional bootstrap configuration
|
|
551
|
+
* @returns Promise resolving to IWebServerPublic instance
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```typescript
|
|
555
|
+
* // Simplest usage - zero config (no .env file loading)
|
|
556
|
+
* await bootstrap(App);
|
|
557
|
+
*
|
|
558
|
+
* // With overrides (still no .env file loading)
|
|
559
|
+
* await bootstrap(App, {
|
|
560
|
+
* port: 4000,
|
|
561
|
+
* appName: "My API",
|
|
562
|
+
* appVersion: "2.0.0"
|
|
563
|
+
* });
|
|
564
|
+
*
|
|
565
|
+
* // Opt-in to .env file loading and auto-creation
|
|
566
|
+
* await bootstrap(App, {
|
|
567
|
+
* currentEnvironment: "development",
|
|
568
|
+
* envFileConfig: {
|
|
569
|
+
* files: {
|
|
570
|
+
* development: ".env.dev",
|
|
571
|
+
* production: ".env.prod"
|
|
572
|
+
* },
|
|
573
|
+
* required: ["DATABASE_URL", "API_KEY"],
|
|
574
|
+
* autoCreateTemplate: true, // Explicitly enable file creation
|
|
575
|
+
* validateValues: true
|
|
576
|
+
* }
|
|
577
|
+
* });
|
|
578
|
+
*
|
|
579
|
+
* // Auto-assign port (useful for testing)
|
|
580
|
+
* await bootstrap(App, { port: 0 });
|
|
581
|
+
* ```
|
|
582
|
+
*
|
|
583
|
+
* @layer internal
|
|
584
|
+
* @audience framework-developers
|
|
585
|
+
*
|
|
586
|
+
* **Internal Architecture**
|
|
587
|
+
*
|
|
588
|
+
* Bootstrap orchestrates 8 critical steps:
|
|
589
|
+
* 1. Environment detection (CI/CD vs local)
|
|
590
|
+
* 2. Smart .env loading with opt-in behavior
|
|
591
|
+
* 3. Port determination (priority chain)
|
|
592
|
+
* 4. Package.json metadata extraction
|
|
593
|
+
* 5. DI container initialization via AppFactory
|
|
594
|
+
* 6. Environment injection into app instance
|
|
595
|
+
* 7. API version detection from decorators
|
|
596
|
+
* 8. Server startup with graceful shutdown
|
|
597
|
+
*
|
|
598
|
+
* **Design Decisions**
|
|
599
|
+
* - Opt-in .env loading prevents breaking changes for containerized deployments
|
|
600
|
+
* - Port 0 support enables parallel testing without conflicts
|
|
601
|
+
* - Early validation fails fast with actionable error messages
|
|
602
|
+
* - CI/CD auto-detection provides zero-config for containerized environments
|
|
603
|
+
*
|
|
604
|
+
* **Performance Characteristics**
|
|
605
|
+
* - Startup time: ~8-25ms typical (optimized)
|
|
606
|
+
* - Environment loading: ~2-5ms (file I/O)
|
|
607
|
+
* - Package.json read: ~1-2ms first call, cached thereafter
|
|
608
|
+
* - CI detection: cached after first call
|
|
609
|
+
* - App instantiation: ~5-10ms (DI container setup)
|
|
610
|
+
* - Logger instances: lazy initialization (only created when needed)
|
|
611
|
+
*
|
|
612
|
+
* @see {@link loadAndValidateEnvironment} for environment loading logic
|
|
613
|
+
* @see {@link AppFactory.create} for DI container initialization
|
|
614
|
+
* @see {@link determinePort} for port resolution logic
|
|
615
|
+
*
|
|
616
|
+
* @layer advanced
|
|
617
|
+
* @audience power-users
|
|
618
|
+
*
|
|
619
|
+
* **Advanced Patterns**
|
|
620
|
+
*
|
|
621
|
+
* Multi-environment setup with validation:
|
|
622
|
+
* ```typescript
|
|
623
|
+
* await bootstrap(App, {
|
|
624
|
+
* currentEnvironment: process.env.NODE_ENV || "development",
|
|
625
|
+
* envFileConfig: {
|
|
626
|
+
* files: {
|
|
627
|
+
* development: ".env.dev",
|
|
628
|
+
* staging: ".env.staging",
|
|
629
|
+
* production: ".env.prod"
|
|
630
|
+
* },
|
|
631
|
+
* required: ["DATABASE_URL", "JWT_SECRET"],
|
|
632
|
+
* autoCreateTemplate: true,
|
|
633
|
+
* validateValues: process.env.NODE_ENV === "production"
|
|
634
|
+
* }
|
|
635
|
+
* });
|
|
636
|
+
* ```
|
|
637
|
+
*
|
|
638
|
+
* Containerized deployment (Docker/K8s):
|
|
639
|
+
* ```typescript
|
|
640
|
+
* await bootstrap(App, {
|
|
641
|
+
* envFileConfig: {
|
|
642
|
+
* skipFileLoading: true, // Use process.env only
|
|
643
|
+
* required: ["DATABASE_URL", "REDIS_URL"]
|
|
644
|
+
* }
|
|
645
|
+
* });
|
|
646
|
+
* ```
|
|
647
|
+
*
|
|
648
|
+
* Testing with dynamic ports:
|
|
649
|
+
* ```typescript
|
|
650
|
+
* const server = await bootstrap(App, { port: 0 });
|
|
651
|
+
* const actualPort = server.port; // Use in tests
|
|
652
|
+
* ```
|
|
653
|
+
*
|
|
654
|
+
* @troubleshooting
|
|
655
|
+
* **Common Issues**
|
|
656
|
+
* - ❌ PORT not detected → Use options.port or envFileConfig
|
|
657
|
+
* - ❌ CI validation fails → Check platform secrets configuration
|
|
658
|
+
* - ❌ Template not created → Set autoCreateTemplate: true explicitly
|
|
659
|
+
* - ❌ Port already in use → Use port: 0 for testing
|
|
660
|
+
*
|
|
661
|
+
* @performance
|
|
662
|
+
* - Async initialization: ~5-15ms (typical)
|
|
663
|
+
* - Package.json read: ~2ms first call, cached thereafter
|
|
664
|
+
* - CI detection: cached after first call
|
|
665
|
+
* - Port binding: varies by OS
|
|
666
|
+
* - Total startup: ~8-25ms (optimized with caching)
|
|
667
|
+
*
|
|
668
|
+
* @public API
|
|
669
|
+
*/
|
|
670
|
+
/**
|
|
671
|
+
* Type guard to check if argument is BootstrapConfig.
|
|
672
|
+
* Detects config objects by checking for the required structure.
|
|
673
|
+
* @internal
|
|
674
|
+
*/
|
|
675
|
+
function isBootstrapConfig(arg) {
|
|
676
|
+
if (!arg || typeof arg !== "object")
|
|
677
|
+
return false;
|
|
678
|
+
// Check if it has BootstrapOptions properties (direct options)
|
|
679
|
+
if ("appName" in arg || "port" in arg || "currentEnvironment" in arg) {
|
|
680
|
+
// If it has BootstrapOptions properties but NOT config structure, it's BootstrapOptions
|
|
681
|
+
if (!("app" in arg && "server" in arg)) {
|
|
682
|
+
return false;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
// Check for config structure
|
|
686
|
+
return ("app" in arg &&
|
|
687
|
+
"server" in arg &&
|
|
688
|
+
typeof arg.app === "object" &&
|
|
689
|
+
arg.app !== null &&
|
|
690
|
+
typeof arg.server === "object" &&
|
|
691
|
+
arg.server !== null &&
|
|
692
|
+
"name" in arg.app &&
|
|
693
|
+
"version" in arg.app &&
|
|
694
|
+
"environment" in arg.app &&
|
|
695
|
+
"port" in arg.server);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Transform BootstrapConfig to BootstrapOptions.
|
|
699
|
+
* @internal
|
|
700
|
+
*/
|
|
701
|
+
function transformConfigToOptions(config) {
|
|
702
|
+
return {
|
|
703
|
+
appName: config.app.name,
|
|
704
|
+
appVersion: config.app.version,
|
|
705
|
+
port: config.server.port,
|
|
706
|
+
currentEnvironment: config.app.environment,
|
|
707
|
+
envFileConfig: config.bootstrap?.envFileConfig,
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Implementation.
|
|
712
|
+
*/
|
|
713
|
+
export async function bootstrap(AppClass, optionsOrConfig) {
|
|
714
|
+
let logger;
|
|
715
|
+
// Note: Path resolution is auto-initialized as a side effect when
|
|
716
|
+
// @expressots/core is imported (see core/src/index.ts).
|
|
717
|
+
// This happens BEFORE bootstrap() runs, ensuring path aliases work.
|
|
718
|
+
// STEP 0: Load .env files FIRST (before config resolution)
|
|
719
|
+
// This ensures config reads from .env files when it resolves
|
|
720
|
+
let envFileConfig;
|
|
721
|
+
let currentEnvironment;
|
|
722
|
+
let envResult;
|
|
723
|
+
if (isBootstrapConfig(optionsOrConfig)) {
|
|
724
|
+
// Extract envFileConfig from config structure (static values, no resolution needed)
|
|
725
|
+
envFileConfig = optionsOrConfig.bootstrap?.envFileConfig;
|
|
726
|
+
// Determine environment: Use NODE_ENV first, then fallback to config
|
|
727
|
+
// We load .env files first to minimize impact of config resolution
|
|
728
|
+
currentEnvironment = process.env.NODE_ENV ?? "development";
|
|
729
|
+
// Load .env files BEFORE config resolution
|
|
730
|
+
envResult = await loadAndValidateEnvironment(currentEnvironment, envFileConfig);
|
|
731
|
+
// Now transform config (it will read from loaded .env files)
|
|
732
|
+
// This may trigger config resolution, but .env files are already loaded
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
// BootstrapOptions - no config to resolve
|
|
736
|
+
currentEnvironment =
|
|
737
|
+
optionsOrConfig?.currentEnvironment ??
|
|
738
|
+
process.env.NODE_ENV ??
|
|
739
|
+
"development";
|
|
740
|
+
envFileConfig = optionsOrConfig?.envFileConfig;
|
|
741
|
+
// Load .env files
|
|
742
|
+
envResult = await loadAndValidateEnvironment(currentEnvironment, envFileConfig);
|
|
743
|
+
}
|
|
744
|
+
// Transform config to BootstrapOptions if needed (after .env files are loaded)
|
|
745
|
+
const options = isBootstrapConfig(optionsOrConfig)
|
|
746
|
+
? transformConfigToOptions(optionsOrConfig)
|
|
747
|
+
: optionsOrConfig;
|
|
748
|
+
try {
|
|
749
|
+
// Show helpful feedback
|
|
750
|
+
if (envResult.createdTemplates && envResult.createdTemplates.length > 0) {
|
|
751
|
+
if (envResult.createdTemplates.length === 1) {
|
|
752
|
+
console.log(`✨ Created ${envResult.createdTemplates[0]} template file`);
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
console.log(`✨ Created ${envResult.createdTemplates.length} template files:`);
|
|
756
|
+
envResult.createdTemplates.forEach((file) => console.log(` • ${file}`));
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
else if (envResult.createdTemplate) {
|
|
760
|
+
console.log(`✨ Created ${envResult.createdTemplate} template file`);
|
|
761
|
+
}
|
|
762
|
+
if (envResult.warnings.length > 0) {
|
|
763
|
+
envResult.warnings.forEach((w) => console.warn(w));
|
|
764
|
+
}
|
|
765
|
+
// STEP 3: Determine port with priority (PORT now available from .env)
|
|
766
|
+
const port = determinePort(options);
|
|
767
|
+
// STEP 4: Read package.json for app info
|
|
768
|
+
const pkg = await readPackageJson();
|
|
769
|
+
// STEP 5: Create app instance
|
|
770
|
+
// App's globalConfiguration() will run in constructor
|
|
771
|
+
// initEnvironment() can skip if .env already loaded
|
|
772
|
+
const app = await AppFactory.create(AppClass);
|
|
773
|
+
// Set environment on app instance (for this.environment access)
|
|
774
|
+
app.environment =
|
|
775
|
+
currentEnvironment;
|
|
776
|
+
// STEP 6: Prepare app info
|
|
777
|
+
// Note: API versions will be auto-detected in displayStartupBanner()
|
|
778
|
+
// where controllers are already registered and accessible
|
|
779
|
+
const appInfo = {
|
|
780
|
+
appName: options?.appName ?? pkg.name ?? "ExpressoTS App",
|
|
781
|
+
appVersion: options?.appVersion ?? pkg.version ?? "1.0.0",
|
|
782
|
+
};
|
|
783
|
+
// STEP 8: Add CI detection info to appInfo (logged after banner, before middleware)
|
|
784
|
+
if (envResult.ciDetected) {
|
|
785
|
+
appInfo.ciDetection = {
|
|
786
|
+
detected: true,
|
|
787
|
+
platform: envResult.ciPlatform,
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
// STEP 9: Listen (supports port 0 for auto-assign)
|
|
791
|
+
// Banner will be displayed inside listen() callback with correct port
|
|
792
|
+
// CI detection will be logged after banner, before middleware logs
|
|
793
|
+
// Graceful shutdown handlers are already set up in AppExpress.listen()
|
|
794
|
+
const webServer = await app.listen(port, appInfo);
|
|
795
|
+
return webServer;
|
|
796
|
+
}
|
|
797
|
+
catch (error) {
|
|
798
|
+
// Lazy logger initialization - only create if error occurs
|
|
799
|
+
if (!logger) {
|
|
800
|
+
logger = new Logger();
|
|
801
|
+
}
|
|
802
|
+
logger.error(`Bootstrap failed: ${error instanceof Error ? error.message : String(error)}`, "bootstrap");
|
|
803
|
+
throw error;
|
|
804
|
+
}
|
|
805
|
+
}
|