@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,706 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Memory Store for ExpressoTS In-Memory Database
|
|
4
|
+
*
|
|
5
|
+
* High-performance in-memory storage with secondary indexes.
|
|
6
|
+
*
|
|
7
|
+
* @module db-in-memory/storage
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MemoryStore = exports.IdGenerator = exports.EntityAlreadyExistsError = exports.EntityNotFoundError = exports.UniqueConstraintError = exports.IndexManager = void 0;
|
|
11
|
+
const node_crypto_1 = require("node:crypto");
|
|
12
|
+
const decorators_js_1 = require("../schema/decorators.js");
|
|
13
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
14
|
+
// INDEX MANAGER
|
|
15
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
16
|
+
/**
|
|
17
|
+
* Manages secondary indexes for a table.
|
|
18
|
+
* Provides O(1) lookups for indexed fields.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
class IndexManager {
|
|
22
|
+
constructor() {
|
|
23
|
+
/** Map of field name -> value -> Set of entity IDs */
|
|
24
|
+
this.indexes = new Map();
|
|
25
|
+
/** Set of indexed field names */
|
|
26
|
+
this.indexedFields = new Set();
|
|
27
|
+
/** Set of unique field names */
|
|
28
|
+
this.uniqueFields = new Set();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create an index for a field.
|
|
32
|
+
* @param field - Field name to index
|
|
33
|
+
*/
|
|
34
|
+
createIndex(field) {
|
|
35
|
+
if (!this.indexes.has(field)) {
|
|
36
|
+
this.indexes.set(field, new Map());
|
|
37
|
+
this.indexedFields.add(field);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Mark a field as unique.
|
|
42
|
+
* @param field - Field name
|
|
43
|
+
*/
|
|
44
|
+
markUnique(field) {
|
|
45
|
+
this.uniqueFields.add(field);
|
|
46
|
+
// Unique fields are automatically indexed
|
|
47
|
+
this.createIndex(field);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if a field is indexed.
|
|
51
|
+
* @param field - Field name
|
|
52
|
+
* @returns True if field is indexed
|
|
53
|
+
*/
|
|
54
|
+
hasIndex(field) {
|
|
55
|
+
return this.indexedFields.has(field);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check if a field is unique.
|
|
59
|
+
* @param field - Field name
|
|
60
|
+
* @returns True if field is unique
|
|
61
|
+
*/
|
|
62
|
+
isUnique(field) {
|
|
63
|
+
return this.uniqueFields.has(field);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Add an entity to all indexes.
|
|
67
|
+
* @param entity - Entity to index
|
|
68
|
+
* @throws Error if unique constraint is violated
|
|
69
|
+
*/
|
|
70
|
+
indexEntity(entity) {
|
|
71
|
+
const id = entity.id;
|
|
72
|
+
for (const field of this.indexedFields) {
|
|
73
|
+
const value = entity[field];
|
|
74
|
+
if (value === undefined)
|
|
75
|
+
continue;
|
|
76
|
+
const fieldIndex = this.indexes.get(field);
|
|
77
|
+
// Check unique constraint
|
|
78
|
+
if (this.uniqueFields.has(field)) {
|
|
79
|
+
const existing = fieldIndex.get(value);
|
|
80
|
+
if (existing && existing.size > 0) {
|
|
81
|
+
const existingId = Array.from(existing)[0];
|
|
82
|
+
if (existingId !== id) {
|
|
83
|
+
throw new UniqueConstraintError(field, value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Add to index
|
|
88
|
+
if (!fieldIndex.has(value)) {
|
|
89
|
+
fieldIndex.set(value, new Set());
|
|
90
|
+
}
|
|
91
|
+
fieldIndex.get(value).add(id);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Remove an entity from all indexes.
|
|
96
|
+
* @param entity - Entity to remove from indexes
|
|
97
|
+
*/
|
|
98
|
+
removeFromIndex(entity) {
|
|
99
|
+
const id = entity.id;
|
|
100
|
+
for (const field of this.indexedFields) {
|
|
101
|
+
const value = entity[field];
|
|
102
|
+
if (value === undefined)
|
|
103
|
+
continue;
|
|
104
|
+
const fieldIndex = this.indexes.get(field);
|
|
105
|
+
if (fieldIndex) {
|
|
106
|
+
const ids = fieldIndex.get(value);
|
|
107
|
+
if (ids) {
|
|
108
|
+
ids.delete(id);
|
|
109
|
+
if (ids.size === 0) {
|
|
110
|
+
fieldIndex.delete(value);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Update an entity in all indexes.
|
|
118
|
+
* @param oldEntity - Previous entity state
|
|
119
|
+
* @param newEntity - New entity state
|
|
120
|
+
*/
|
|
121
|
+
updateIndex(oldEntity, newEntity) {
|
|
122
|
+
this.removeFromIndex(oldEntity);
|
|
123
|
+
this.indexEntity(newEntity);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Find entity IDs by indexed field value.
|
|
127
|
+
* @param field - Field name
|
|
128
|
+
* @param value - Value to find
|
|
129
|
+
* @returns Set of matching entity IDs or undefined if not indexed
|
|
130
|
+
*/
|
|
131
|
+
findByIndex(field, value) {
|
|
132
|
+
const fieldIndex = this.indexes.get(field);
|
|
133
|
+
if (!fieldIndex)
|
|
134
|
+
return undefined;
|
|
135
|
+
return fieldIndex.get(value);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get all values for an indexed field.
|
|
139
|
+
* @param field - Field name
|
|
140
|
+
* @returns Array of unique values
|
|
141
|
+
*/
|
|
142
|
+
getIndexValues(field) {
|
|
143
|
+
const fieldIndex = this.indexes.get(field);
|
|
144
|
+
if (!fieldIndex)
|
|
145
|
+
return [];
|
|
146
|
+
return Array.from(fieldIndex.keys());
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Clear all indexes.
|
|
150
|
+
*/
|
|
151
|
+
clear() {
|
|
152
|
+
for (const fieldIndex of this.indexes.values()) {
|
|
153
|
+
fieldIndex.clear();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get index statistics.
|
|
158
|
+
*/
|
|
159
|
+
getStats() {
|
|
160
|
+
return Array.from(this.indexedFields).map((field) => ({
|
|
161
|
+
field,
|
|
162
|
+
size: this.indexes.get(field)?.size || 0,
|
|
163
|
+
unique: this.uniqueFields.has(field),
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.IndexManager = IndexManager;
|
|
168
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
169
|
+
// ERRORS
|
|
170
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
171
|
+
/**
|
|
172
|
+
* Error thrown when a unique constraint is violated.
|
|
173
|
+
* @public API
|
|
174
|
+
*/
|
|
175
|
+
class UniqueConstraintError extends Error {
|
|
176
|
+
constructor(field, value) {
|
|
177
|
+
super(`Unique constraint failed on field '${field}' with value '${value}'`);
|
|
178
|
+
this.name = "UniqueConstraintError";
|
|
179
|
+
this.field = field;
|
|
180
|
+
this.value = value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.UniqueConstraintError = UniqueConstraintError;
|
|
184
|
+
/**
|
|
185
|
+
* Error thrown when an entity is not found.
|
|
186
|
+
* @public API
|
|
187
|
+
*/
|
|
188
|
+
class EntityNotFoundError extends Error {
|
|
189
|
+
constructor(entityName, id) {
|
|
190
|
+
super(`${entityName} with ID '${id}' not found`);
|
|
191
|
+
this.name = "EntityNotFoundError";
|
|
192
|
+
this.entityName = entityName;
|
|
193
|
+
this.id = id;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.EntityNotFoundError = EntityNotFoundError;
|
|
197
|
+
/**
|
|
198
|
+
* Error thrown when an entity already exists.
|
|
199
|
+
* @public API
|
|
200
|
+
*/
|
|
201
|
+
class EntityAlreadyExistsError extends Error {
|
|
202
|
+
constructor(entityName, id) {
|
|
203
|
+
super(`${entityName} with ID '${id}' already exists`);
|
|
204
|
+
this.name = "EntityAlreadyExistsError";
|
|
205
|
+
this.entityName = entityName;
|
|
206
|
+
this.id = id;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.EntityAlreadyExistsError = EntityAlreadyExistsError;
|
|
210
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
211
|
+
// ID GENERATION
|
|
212
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
213
|
+
/**
|
|
214
|
+
* ID Generator utility.
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
class IdGenerator {
|
|
218
|
+
/**
|
|
219
|
+
* Generate an ID based on the strategy.
|
|
220
|
+
* @param strategy - Generation strategy
|
|
221
|
+
* @param tableName - Table name (for increment strategy)
|
|
222
|
+
* @returns Generated ID
|
|
223
|
+
*/
|
|
224
|
+
static generate(strategy, tableName) {
|
|
225
|
+
switch (strategy) {
|
|
226
|
+
case "uuid":
|
|
227
|
+
return (0, node_crypto_1.randomUUID)();
|
|
228
|
+
case "cuid":
|
|
229
|
+
return this.generateCuid();
|
|
230
|
+
case "ulid":
|
|
231
|
+
return this.generateUlid();
|
|
232
|
+
case "increment":
|
|
233
|
+
return this.generateIncrement(tableName);
|
|
234
|
+
default:
|
|
235
|
+
return (0, node_crypto_1.randomUUID)();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
static generateCuid() {
|
|
239
|
+
// Simple CUID-like implementation
|
|
240
|
+
const timestamp = Date.now().toString(36);
|
|
241
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
242
|
+
const counter = (this.incrementCounter.get("cuid") || 0) + 1;
|
|
243
|
+
this.incrementCounter.set("cuid", counter);
|
|
244
|
+
return `c${timestamp}${random}${counter.toString(36)}`;
|
|
245
|
+
}
|
|
246
|
+
static generateUlid() {
|
|
247
|
+
// Simple ULID-like implementation
|
|
248
|
+
const timestamp = Date.now().toString(36).padStart(10, "0");
|
|
249
|
+
const random = Array.from({ length: 16 }, () => Math.floor(Math.random() * 36).toString(36)).join("");
|
|
250
|
+
return `${timestamp}${random}`.toUpperCase();
|
|
251
|
+
}
|
|
252
|
+
static generateIncrement(tableName) {
|
|
253
|
+
const current = this.incrementCounter.get(tableName) || 0;
|
|
254
|
+
const next = current + 1;
|
|
255
|
+
this.incrementCounter.set(tableName, next);
|
|
256
|
+
return next.toString();
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Reset increment counters (useful for testing).
|
|
260
|
+
*/
|
|
261
|
+
static reset() {
|
|
262
|
+
this.incrementCounter.clear();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.IdGenerator = IdGenerator;
|
|
266
|
+
IdGenerator.incrementCounter = new Map();
|
|
267
|
+
/**
|
|
268
|
+
* High-performance in-memory storage for a single table/collection.
|
|
269
|
+
* Features:
|
|
270
|
+
* - O(1) lookups by ID
|
|
271
|
+
* - O(1) lookups by indexed fields
|
|
272
|
+
* - Automatic ID generation
|
|
273
|
+
* - Timestamp management
|
|
274
|
+
* - Soft delete support
|
|
275
|
+
* - Transaction snapshots
|
|
276
|
+
*
|
|
277
|
+
* @public API
|
|
278
|
+
*/
|
|
279
|
+
class MemoryStore {
|
|
280
|
+
constructor(tableName, options = {}) {
|
|
281
|
+
/** Primary storage: ID -> Entity */
|
|
282
|
+
this.data = new Map();
|
|
283
|
+
/** Index manager for secondary indexes */
|
|
284
|
+
this.indexManager = new IndexManager();
|
|
285
|
+
/** Transaction snapshot stack */
|
|
286
|
+
this.transactionStack = [];
|
|
287
|
+
/** Auto-generate configuration */
|
|
288
|
+
this.autoGenerateFields = {};
|
|
289
|
+
/** Default values */
|
|
290
|
+
this.defaultValues = {};
|
|
291
|
+
this.tableName = tableName;
|
|
292
|
+
this.entityClass = options.entityClass;
|
|
293
|
+
this.timestamps = options.timestamps ?? true;
|
|
294
|
+
this.softDelete = options.softDelete ?? false;
|
|
295
|
+
// Load schema metadata if entity class is provided
|
|
296
|
+
if (this.entityClass) {
|
|
297
|
+
this.loadSchemaMetadata();
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
// Default: index on id
|
|
301
|
+
this.indexManager.createIndex("id");
|
|
302
|
+
this.indexManager.markUnique("id");
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Load schema metadata from decorators.
|
|
307
|
+
* @private
|
|
308
|
+
*/
|
|
309
|
+
loadSchemaMetadata() {
|
|
310
|
+
if (!this.entityClass)
|
|
311
|
+
return;
|
|
312
|
+
// Get indexes
|
|
313
|
+
const indexes = decorators_js_1.SchemaRegistry.getIndexes(this.entityClass);
|
|
314
|
+
for (const index of indexes) {
|
|
315
|
+
this.indexManager.createIndex(String(index.field));
|
|
316
|
+
}
|
|
317
|
+
// Get unique fields
|
|
318
|
+
const uniqueFields = decorators_js_1.SchemaRegistry.getUniqueFields(this.entityClass);
|
|
319
|
+
for (const field of uniqueFields) {
|
|
320
|
+
this.indexManager.markUnique(String(field));
|
|
321
|
+
}
|
|
322
|
+
// Always index and mark id as unique
|
|
323
|
+
this.indexManager.createIndex("id");
|
|
324
|
+
this.indexManager.markUnique("id");
|
|
325
|
+
// Get auto-generate fields
|
|
326
|
+
this.autoGenerateFields = decorators_js_1.SchemaRegistry.getAutoGenerateFields(this.entityClass);
|
|
327
|
+
// Get default values
|
|
328
|
+
this.defaultValues = decorators_js_1.SchemaRegistry.getDefaults(this.entityClass);
|
|
329
|
+
// Get entity metadata for timestamps/softDelete settings
|
|
330
|
+
const entityMeta = decorators_js_1.SchemaRegistry.getMetadata(this.entityClass);
|
|
331
|
+
if (entityMeta) {
|
|
332
|
+
this.timestamps = entityMeta.timestamps;
|
|
333
|
+
this.softDelete = entityMeta.softDelete;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Apply auto-generation and defaults to entity.
|
|
338
|
+
* @private
|
|
339
|
+
*/
|
|
340
|
+
applyDefaults(entity) {
|
|
341
|
+
const result = { ...entity };
|
|
342
|
+
// Apply auto-generate fields
|
|
343
|
+
for (const [field, strategy] of Object.entries(this.autoGenerateFields)) {
|
|
344
|
+
if (result[field] === undefined) {
|
|
345
|
+
result[field] = IdGenerator.generate(strategy, this.tableName);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
// Generate ID if not provided
|
|
349
|
+
if (!result.id) {
|
|
350
|
+
result.id = (0, node_crypto_1.randomUUID)();
|
|
351
|
+
}
|
|
352
|
+
// Apply default values
|
|
353
|
+
for (const [field, value] of Object.entries(this.defaultValues)) {
|
|
354
|
+
if (result[field] === undefined) {
|
|
355
|
+
result[field] = typeof value === "function" ? value() : value;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// Apply timestamps
|
|
359
|
+
if (this.timestamps) {
|
|
360
|
+
const now = new Date();
|
|
361
|
+
if (result.createdAt === undefined) {
|
|
362
|
+
result.createdAt = now;
|
|
363
|
+
}
|
|
364
|
+
result.updatedAt = now;
|
|
365
|
+
}
|
|
366
|
+
return result;
|
|
367
|
+
}
|
|
368
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
369
|
+
// CRUD OPERATIONS
|
|
370
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
371
|
+
/**
|
|
372
|
+
* Insert a new entity.
|
|
373
|
+
* @param entity - Entity to insert
|
|
374
|
+
* @returns Inserted entity with generated fields
|
|
375
|
+
* @throws EntityAlreadyExistsError if ID already exists
|
|
376
|
+
* @throws UniqueConstraintError if unique constraint is violated
|
|
377
|
+
*/
|
|
378
|
+
insert(entity) {
|
|
379
|
+
const prepared = this.applyDefaults(entity);
|
|
380
|
+
if (this.data.has(prepared.id)) {
|
|
381
|
+
throw new EntityAlreadyExistsError(this.tableName, prepared.id);
|
|
382
|
+
}
|
|
383
|
+
// Index first (will throw if unique constraint violated)
|
|
384
|
+
this.indexManager.indexEntity(prepared);
|
|
385
|
+
// Then store
|
|
386
|
+
this.data.set(prepared.id, prepared);
|
|
387
|
+
return prepared;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Insert multiple entities.
|
|
391
|
+
* @param entities - Entities to insert
|
|
392
|
+
* @param skipDuplicates - Skip entities with duplicate keys
|
|
393
|
+
* @returns Array of inserted entities
|
|
394
|
+
*/
|
|
395
|
+
insertMany(entities, skipDuplicates = false) {
|
|
396
|
+
const results = [];
|
|
397
|
+
for (const entity of entities) {
|
|
398
|
+
try {
|
|
399
|
+
results.push(this.insert(entity));
|
|
400
|
+
}
|
|
401
|
+
catch (error) {
|
|
402
|
+
if (skipDuplicates &&
|
|
403
|
+
(error instanceof EntityAlreadyExistsError ||
|
|
404
|
+
error instanceof UniqueConstraintError)) {
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
throw error;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return results;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Update an entity by ID.
|
|
414
|
+
* @param id - Entity ID
|
|
415
|
+
* @param data - Update data
|
|
416
|
+
* @returns Updated entity
|
|
417
|
+
* @throws EntityNotFoundError if entity not found
|
|
418
|
+
*/
|
|
419
|
+
update(id, data) {
|
|
420
|
+
const existing = this.data.get(id);
|
|
421
|
+
if (!existing) {
|
|
422
|
+
throw new EntityNotFoundError(this.tableName, id);
|
|
423
|
+
}
|
|
424
|
+
const updated = { ...existing, ...data, id };
|
|
425
|
+
// Apply updated timestamp
|
|
426
|
+
if (this.timestamps) {
|
|
427
|
+
updated.updatedAt = new Date();
|
|
428
|
+
}
|
|
429
|
+
// Update indexes
|
|
430
|
+
this.indexManager.updateIndex(existing, updated);
|
|
431
|
+
// Store updated entity
|
|
432
|
+
this.data.set(id, updated);
|
|
433
|
+
return updated;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Update multiple entities matching a predicate.
|
|
437
|
+
* @param predicate - Filter function
|
|
438
|
+
* @param data - Update data
|
|
439
|
+
* @returns Number of updated entities
|
|
440
|
+
*/
|
|
441
|
+
updateMany(predicate, data) {
|
|
442
|
+
let count = 0;
|
|
443
|
+
for (const [id, entity] of this.data) {
|
|
444
|
+
if (predicate(entity)) {
|
|
445
|
+
this.update(id, data);
|
|
446
|
+
count++;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return count;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Delete an entity by ID.
|
|
453
|
+
* @param id - Entity ID
|
|
454
|
+
* @returns Deleted entity
|
|
455
|
+
* @throws EntityNotFoundError if entity not found
|
|
456
|
+
*/
|
|
457
|
+
delete(id) {
|
|
458
|
+
const entity = this.data.get(id);
|
|
459
|
+
if (!entity) {
|
|
460
|
+
throw new EntityNotFoundError(this.tableName, id);
|
|
461
|
+
}
|
|
462
|
+
if (this.softDelete) {
|
|
463
|
+
// Soft delete
|
|
464
|
+
return this.update(id, {
|
|
465
|
+
deletedAt: new Date(),
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
// Hard delete
|
|
469
|
+
this.indexManager.removeFromIndex(entity);
|
|
470
|
+
this.data.delete(id);
|
|
471
|
+
return entity;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Delete multiple entities matching a predicate.
|
|
475
|
+
* @param predicate - Filter function
|
|
476
|
+
* @returns Number of deleted entities
|
|
477
|
+
*/
|
|
478
|
+
deleteMany(predicate) {
|
|
479
|
+
if (!predicate) {
|
|
480
|
+
const count = this.data.size;
|
|
481
|
+
this.clear();
|
|
482
|
+
return count;
|
|
483
|
+
}
|
|
484
|
+
let count = 0;
|
|
485
|
+
const toDelete = [];
|
|
486
|
+
for (const [id, entity] of this.data) {
|
|
487
|
+
if (predicate(entity)) {
|
|
488
|
+
toDelete.push(id);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
for (const id of toDelete) {
|
|
492
|
+
this.delete(id);
|
|
493
|
+
count++;
|
|
494
|
+
}
|
|
495
|
+
return count;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Find an entity by ID.
|
|
499
|
+
* @param id - Entity ID
|
|
500
|
+
* @returns Entity or undefined
|
|
501
|
+
*/
|
|
502
|
+
findById(id) {
|
|
503
|
+
const entity = this.data.get(id);
|
|
504
|
+
// Filter out soft-deleted entities
|
|
505
|
+
if (entity && this.softDelete) {
|
|
506
|
+
const deletedAt = entity.deletedAt;
|
|
507
|
+
if (deletedAt)
|
|
508
|
+
return undefined;
|
|
509
|
+
}
|
|
510
|
+
return entity;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Find entities by indexed field value (O(1) lookup).
|
|
514
|
+
* @param field - Field name
|
|
515
|
+
* @param value - Value to find
|
|
516
|
+
* @returns Array of matching entities
|
|
517
|
+
*/
|
|
518
|
+
findByIndex(field, value) {
|
|
519
|
+
const ids = this.indexManager.findByIndex(field, value);
|
|
520
|
+
if (!ids) {
|
|
521
|
+
// Fall back to scan if not indexed
|
|
522
|
+
return this.findAll().filter((e) => e[field] === value);
|
|
523
|
+
}
|
|
524
|
+
return Array.from(ids)
|
|
525
|
+
.map((id) => this.data.get(id))
|
|
526
|
+
.filter((e) => {
|
|
527
|
+
if (!e)
|
|
528
|
+
return false;
|
|
529
|
+
if (this.softDelete) {
|
|
530
|
+
return !e.deletedAt;
|
|
531
|
+
}
|
|
532
|
+
return true;
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Find all entities.
|
|
537
|
+
* @returns Array of all entities
|
|
538
|
+
*/
|
|
539
|
+
findAll() {
|
|
540
|
+
const entities = Array.from(this.data.values());
|
|
541
|
+
if (this.softDelete) {
|
|
542
|
+
return entities.filter((e) => !e.deletedAt);
|
|
543
|
+
}
|
|
544
|
+
return entities;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Find entities matching a predicate.
|
|
548
|
+
* @param predicate - Filter function
|
|
549
|
+
* @returns Array of matching entities
|
|
550
|
+
*/
|
|
551
|
+
find(predicate) {
|
|
552
|
+
return this.findAll().filter(predicate);
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Find the first entity matching a predicate.
|
|
556
|
+
* @param predicate - Filter function
|
|
557
|
+
* @returns First matching entity or undefined
|
|
558
|
+
*/
|
|
559
|
+
findFirst(predicate) {
|
|
560
|
+
for (const entity of this.data.values()) {
|
|
561
|
+
if (this.softDelete && entity.deletedAt) {
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
if (predicate(entity)) {
|
|
565
|
+
return entity;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return undefined;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Count entities.
|
|
572
|
+
* @param predicate - Optional filter function
|
|
573
|
+
* @returns Number of entities
|
|
574
|
+
*/
|
|
575
|
+
count(predicate) {
|
|
576
|
+
if (!predicate) {
|
|
577
|
+
if (this.softDelete) {
|
|
578
|
+
return this.findAll().length;
|
|
579
|
+
}
|
|
580
|
+
return this.data.size;
|
|
581
|
+
}
|
|
582
|
+
return this.find(predicate).length;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Check if an entity exists.
|
|
586
|
+
* @param id - Entity ID
|
|
587
|
+
* @returns True if entity exists
|
|
588
|
+
*/
|
|
589
|
+
exists(id) {
|
|
590
|
+
return this.findById(id) !== undefined;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Clear all entities.
|
|
594
|
+
*/
|
|
595
|
+
clear() {
|
|
596
|
+
this.data.clear();
|
|
597
|
+
this.indexManager.clear();
|
|
598
|
+
IdGenerator.reset();
|
|
599
|
+
}
|
|
600
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
601
|
+
// TRANSACTIONS
|
|
602
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
603
|
+
/**
|
|
604
|
+
* Begin a transaction (creates a snapshot).
|
|
605
|
+
*/
|
|
606
|
+
beginTransaction() {
|
|
607
|
+
const snapshot = new Map(this.data);
|
|
608
|
+
this.transactionStack.push(snapshot);
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Commit the current transaction.
|
|
612
|
+
*/
|
|
613
|
+
commitTransaction() {
|
|
614
|
+
this.transactionStack.pop();
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Rollback the current transaction.
|
|
618
|
+
* @throws Error if no transaction is active
|
|
619
|
+
*/
|
|
620
|
+
rollbackTransaction() {
|
|
621
|
+
const snapshot = this.transactionStack.pop();
|
|
622
|
+
if (!snapshot) {
|
|
623
|
+
throw new Error("No active transaction to rollback");
|
|
624
|
+
}
|
|
625
|
+
this.data = snapshot;
|
|
626
|
+
// Rebuild indexes
|
|
627
|
+
this.indexManager.clear();
|
|
628
|
+
for (const entity of this.data.values()) {
|
|
629
|
+
this.indexManager.indexEntity(entity);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Execute a function within a transaction.
|
|
634
|
+
* @param fn - Function to execute
|
|
635
|
+
* @returns Result of the function
|
|
636
|
+
*/
|
|
637
|
+
async transaction(fn) {
|
|
638
|
+
this.beginTransaction();
|
|
639
|
+
try {
|
|
640
|
+
const result = await fn();
|
|
641
|
+
this.commitTransaction();
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
catch (error) {
|
|
645
|
+
this.rollbackTransaction();
|
|
646
|
+
throw error;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
650
|
+
// PERSISTENCE
|
|
651
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
652
|
+
/**
|
|
653
|
+
* Export all data as JSON.
|
|
654
|
+
* @returns JSON string of all data
|
|
655
|
+
*/
|
|
656
|
+
toJSON() {
|
|
657
|
+
const entries = Array.from(this.data.entries());
|
|
658
|
+
return JSON.stringify(entries, (_, value) => {
|
|
659
|
+
if (value instanceof Date) {
|
|
660
|
+
return { __type: "Date", value: value.toISOString() };
|
|
661
|
+
}
|
|
662
|
+
return value;
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Import data from JSON.
|
|
667
|
+
* @param json - JSON string to import
|
|
668
|
+
*/
|
|
669
|
+
fromJSON(json) {
|
|
670
|
+
this.clear();
|
|
671
|
+
const entries = JSON.parse(json, (_, value) => {
|
|
672
|
+
if (value && typeof value === "object" && value.__type === "Date") {
|
|
673
|
+
return new Date(value.value);
|
|
674
|
+
}
|
|
675
|
+
return value;
|
|
676
|
+
});
|
|
677
|
+
for (const [id, entity] of entries) {
|
|
678
|
+
this.data.set(id, entity);
|
|
679
|
+
this.indexManager.indexEntity(entity);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
683
|
+
// STATISTICS
|
|
684
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
685
|
+
/**
|
|
686
|
+
* Get store statistics.
|
|
687
|
+
* @returns Statistics object
|
|
688
|
+
*/
|
|
689
|
+
getStats() {
|
|
690
|
+
return {
|
|
691
|
+
tableName: this.tableName,
|
|
692
|
+
recordCount: this.data.size,
|
|
693
|
+
indexes: this.indexManager.getStats(),
|
|
694
|
+
memoryEstimate: this.estimateMemory(),
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Estimate memory usage in bytes.
|
|
699
|
+
* @private
|
|
700
|
+
*/
|
|
701
|
+
estimateMemory() {
|
|
702
|
+
// Rough estimate: JSON string length * 2 (UTF-16)
|
|
703
|
+
return this.toJSON().length * 2;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
exports.MemoryStore = MemoryStore;
|