@rsdk/core 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +4 -0
- package/.eslintrc.js +4 -0
- package/.prettierignore +1 -0
- package/.prettierrc.json +1 -0
- package/dist/app/platform.app.d.ts +28 -0
- package/dist/app/platform.app.js +49 -0
- package/dist/app/platform.app.js.map +1 -0
- package/dist/app-metadata/app-metadata.const.d.ts +3 -0
- package/dist/app-metadata/app-metadata.const.js +7 -0
- package/dist/app-metadata/app-metadata.const.js.map +1 -0
- package/dist/app-metadata/app-metadata.module.d.ts +5 -0
- package/dist/app-metadata/app-metadata.module.js +41 -0
- package/dist/app-metadata/app-metadata.module.js.map +1 -0
- package/dist/app-metadata/app-name.const.d.ts +1 -0
- package/dist/app-metadata/app-name.const.js +5 -0
- package/dist/app-metadata/app-name.const.js.map +1 -0
- package/dist/app-metadata/app-name.validator.d.ts +2 -0
- package/dist/app-metadata/app-name.validator.js +14 -0
- package/dist/app-metadata/app-name.validator.js.map +1 -0
- package/dist/app-metadata/decorators/app-name.decorator.d.ts +1 -0
- package/dist/app-metadata/decorators/app-name.decorator.js +8 -0
- package/dist/app-metadata/decorators/app-name.decorator.js.map +1 -0
- package/dist/app-metadata/decorators/index.d.ts +1 -0
- package/dist/app-metadata/decorators/index.js +18 -0
- package/dist/app-metadata/decorators/index.js.map +1 -0
- package/dist/app-metadata/exceptions/app-name-validation.exception.d.ts +4 -0
- package/dist/app-metadata/exceptions/app-name-validation.exception.js +38 -0
- package/dist/app-metadata/exceptions/app-name-validation.exception.js.map +1 -0
- package/dist/app-metadata/exceptions/index.d.ts +1 -0
- package/dist/app-metadata/exceptions/index.js +18 -0
- package/dist/app-metadata/exceptions/index.js.map +1 -0
- package/dist/app-metadata/index.d.ts +2 -0
- package/dist/app-metadata/index.js +19 -0
- package/dist/app-metadata/index.js.map +1 -0
- package/dist/config/additional-source/additional-source.initializer.d.ts +38 -0
- package/dist/config/additional-source/additional-source.initializer.js +130 -0
- package/dist/config/additional-source/additional-source.initializer.js.map +1 -0
- package/dist/config/additional-source/additional-source.module.d.ts +24 -0
- package/dist/config/additional-source/additional-source.module.js +32 -0
- package/dist/config/additional-source/additional-source.module.js.map +1 -0
- package/dist/config/config-reload.indicator.d.ts +8 -0
- package/dist/config/config-reload.indicator.js +42 -0
- package/dist/config/config-reload.indicator.js.map +1 -0
- package/dist/config/config.abstract.d.ts +19 -0
- package/dist/config/config.abstract.js +57 -0
- package/dist/config/config.abstract.js.map +1 -0
- package/dist/config/config.module.d.ts +121 -0
- package/dist/config/config.module.js +271 -0
- package/dist/config/config.module.js.map +1 -0
- package/dist/config/exceptions/config-not-bootstrapped.exception.d.ts +4 -0
- package/dist/config/exceptions/config-not-bootstrapped.exception.js +30 -0
- package/dist/config/exceptions/config-not-bootstrapped.exception.js.map +1 -0
- package/dist/config/exceptions/config-property-metadata-not-found.d.ts +4 -0
- package/dist/config/exceptions/config-property-metadata-not-found.js +13 -0
- package/dist/config/exceptions/config-property-metadata-not-found.js.map +1 -0
- package/dist/config/exceptions/index.d.ts +3 -0
- package/dist/config/exceptions/index.js +22 -0
- package/dist/config/exceptions/index.js.map +1 -0
- package/dist/config/exceptions/property.exception.d.ts +5 -0
- package/dist/config/exceptions/property.exception.js +18 -0
- package/dist/config/exceptions/property.exception.js.map +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.js +29 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/metadata/config-metadata.registry.d.ts +17 -0
- package/dist/config/metadata/config-metadata.registry.js +46 -0
- package/dist/config/metadata/config-metadata.registry.js.map +1 -0
- package/dist/config/metadata/decorators/config-section.decorator.d.ts +10 -0
- package/dist/config/metadata/decorators/config-section.decorator.js +19 -0
- package/dist/config/metadata/decorators/config-section.decorator.js.map +1 -0
- package/dist/config/metadata/decorators/declare-property.decorator.d.ts +17 -0
- package/dist/config/metadata/decorators/declare-property.decorator.js +37 -0
- package/dist/config/metadata/decorators/declare-property.decorator.js.map +1 -0
- package/dist/config/metadata/decorators/index.d.ts +4 -0
- package/dist/config/metadata/decorators/index.js +21 -0
- package/dist/config/metadata/decorators/index.js.map +1 -0
- package/dist/config/metadata/decorators/inject-property.decorator.d.ts +19 -0
- package/dist/config/metadata/decorators/inject-property.decorator.js +26 -0
- package/dist/config/metadata/decorators/inject-property.decorator.js.map +1 -0
- package/dist/config/metadata/decorators/property.decorator.d.ts +12 -0
- package/dist/config/metadata/decorators/property.decorator.js +27 -0
- package/dist/config/metadata/decorators/property.decorator.js.map +1 -0
- package/dist/config/metadata/exceptions/duplicate-property.exception.d.ts +4 -0
- package/dist/config/metadata/exceptions/duplicate-property.exception.js +27 -0
- package/dist/config/metadata/exceptions/duplicate-property.exception.js.map +1 -0
- package/dist/config/metadata/exceptions/duplicate-section.exception.d.ts +6 -0
- package/dist/config/metadata/exceptions/duplicate-section.exception.js +27 -0
- package/dist/config/metadata/exceptions/duplicate-section.exception.js.map +1 -0
- package/dist/config/metadata/exceptions/duplicate-source.exception.d.ts +6 -0
- package/dist/config/metadata/exceptions/duplicate-source.exception.js +27 -0
- package/dist/config/metadata/exceptions/duplicate-source.exception.js.map +1 -0
- package/dist/config/metadata/exceptions/index.d.ts +3 -0
- package/dist/config/metadata/exceptions/index.js +20 -0
- package/dist/config/metadata/exceptions/index.js.map +1 -0
- package/dist/config/metadata/index.d.ts +2 -0
- package/dist/config/metadata/index.js +19 -0
- package/dist/config/metadata/index.js.map +1 -0
- package/dist/config/parsers/array.parser.d.ts +11 -0
- package/dist/config/parsers/array.parser.js +33 -0
- package/dist/config/parsers/array.parser.js.map +1 -0
- package/dist/config/parsers/boolean/bool.parser.d.ts +6 -0
- package/dist/config/parsers/boolean/bool.parser.js +20 -0
- package/dist/config/parsers/boolean/bool.parser.js.map +1 -0
- package/dist/config/parsers/boolean/index.d.ts +1 -0
- package/dist/config/parsers/boolean/index.js +18 -0
- package/dist/config/parsers/boolean/index.js.map +1 -0
- package/dist/config/parsers/enum/enum.parser.d.ts +9 -0
- package/dist/config/parsers/enum/enum.parser.js +24 -0
- package/dist/config/parsers/enum/enum.parser.js.map +1 -0
- package/dist/config/parsers/enum/index.d.ts +1 -0
- package/dist/config/parsers/enum/index.js +18 -0
- package/dist/config/parsers/enum/index.js.map +1 -0
- package/dist/config/parsers/index.d.ts +10 -0
- package/dist/config/parsers/index.js +27 -0
- package/dist/config/parsers/index.js.map +1 -0
- package/dist/config/parsers/int/index.d.ts +1 -0
- package/dist/config/parsers/int/index.js +18 -0
- package/dist/config/parsers/int/index.js.map +1 -0
- package/dist/config/parsers/int/int.parser.d.ts +6 -0
- package/dist/config/parsers/int/int.parser.js +20 -0
- package/dist/config/parsers/int/int.parser.js.map +1 -0
- package/dist/config/parsers/number/index.d.ts +1 -0
- package/dist/config/parsers/number/index.js +18 -0
- package/dist/config/parsers/number/index.js.map +1 -0
- package/dist/config/parsers/number/number.parser.d.ts +6 -0
- package/dist/config/parsers/number/number.parser.js +23 -0
- package/dist/config/parsers/number/number.parser.js.map +1 -0
- package/dist/config/parsers/path/fspath.parser.d.ts +8 -0
- package/dist/config/parsers/path/fspath.parser.js +56 -0
- package/dist/config/parsers/path/fspath.parser.js.map +1 -0
- package/dist/config/parsers/path/index.d.ts +1 -0
- package/dist/config/parsers/path/index.js +18 -0
- package/dist/config/parsers/path/index.js.map +1 -0
- package/dist/config/parsers/size/index.d.ts +1 -0
- package/dist/config/parsers/size/index.js +18 -0
- package/dist/config/parsers/size/index.js.map +1 -0
- package/dist/config/parsers/size/size.parser.d.ts +7 -0
- package/dist/config/parsers/size/size.parser.js +21 -0
- package/dist/config/parsers/size/size.parser.js.map +1 -0
- package/dist/config/parsers/string/index.d.ts +1 -0
- package/dist/config/parsers/string/index.js +18 -0
- package/dist/config/parsers/string/index.js.map +1 -0
- package/dist/config/parsers/string/string.parser.d.ts +6 -0
- package/dist/config/parsers/string/string.parser.js +18 -0
- package/dist/config/parsers/string/string.parser.js.map +1 -0
- package/dist/config/parsers/timespan/index.d.ts +1 -0
- package/dist/config/parsers/timespan/index.js +18 -0
- package/dist/config/parsers/timespan/index.js.map +1 -0
- package/dist/config/parsers/timespan/timespan.parser.d.ts +7 -0
- package/dist/config/parsers/timespan/timespan.parser.js +21 -0
- package/dist/config/parsers/timespan/timespan.parser.js.map +1 -0
- package/dist/config/parsers/url/index.d.ts +1 -0
- package/dist/config/parsers/url/index.js +18 -0
- package/dist/config/parsers/url/index.js.map +1 -0
- package/dist/config/parsers/url/url.parser.d.ts +6 -0
- package/dist/config/parsers/url/url.parser.js +18 -0
- package/dist/config/parsers/url/url.parser.js.map +1 -0
- package/dist/config/reload/config-reload.events.d.ts +22 -0
- package/dist/config/reload/config-reload.events.js +19 -0
- package/dist/config/reload/config-reload.events.js.map +1 -0
- package/dist/config/reload/index.d.ts +1 -0
- package/dist/config/reload/index.js +18 -0
- package/dist/config/reload/index.js.map +1 -0
- package/dist/config/sources/base/config-source.abstract.d.ts +23 -0
- package/dist/config/sources/base/config-source.abstract.js +73 -0
- package/dist/config/sources/base/config-source.abstract.js.map +1 -0
- package/dist/config/sources/base/index.d.ts +2 -0
- package/dist/config/sources/base/index.js +19 -0
- package/dist/config/sources/base/index.js.map +1 -0
- package/dist/config/sources/base/reloadable-config-source.abstract.d.ts +12 -0
- package/dist/config/sources/base/reloadable-config-source.abstract.js +30 -0
- package/dist/config/sources/base/reloadable-config-source.abstract.js.map +1 -0
- package/dist/config/sources/config-source.decorator.d.ts +12 -0
- package/dist/config/sources/config-source.decorator.js +22 -0
- package/dist/config/sources/config-source.decorator.js.map +1 -0
- package/dist/config/sources/exceptions/config-source-di.exception.d.ts +6 -0
- package/dist/config/sources/exceptions/config-source-di.exception.js +34 -0
- package/dist/config/sources/exceptions/config-source-di.exception.js.map +1 -0
- package/dist/config/sources/exceptions/config-source.exception.d.ts +4 -0
- package/dist/config/sources/exceptions/config-source.exception.js +11 -0
- package/dist/config/sources/exceptions/config-source.exception.js.map +1 -0
- package/dist/config/sources/exceptions/index.d.ts +2 -0
- package/dist/config/sources/exceptions/index.js +19 -0
- package/dist/config/sources/exceptions/index.js.map +1 -0
- package/dist/config/sources/implementations/json-file.source.d.ts +9 -0
- package/dist/config/sources/implementations/json-file.source.js +46 -0
- package/dist/config/sources/implementations/json-file.source.js.map +1 -0
- package/dist/config/sources/implementations/relodable-json-file.source.d.ts +8 -0
- package/dist/config/sources/implementations/relodable-json-file.source.js +55 -0
- package/dist/config/sources/implementations/relodable-json-file.source.js.map +1 -0
- package/dist/config/sources/index.d.ts +3 -0
- package/dist/config/sources/index.js +20 -0
- package/dist/config/sources/index.js.map +1 -0
- package/dist/config/types.d.ts +65 -0
- package/dist/config/types.js +3 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/vars.class.d.ts +19 -0
- package/dist/config/vars.class.js +79 -0
- package/dist/config/vars.class.js.map +1 -0
- package/dist/exceptions/base/bootstrap-exception.abstract.d.ts +15 -0
- package/dist/exceptions/base/bootstrap-exception.abstract.js +22 -0
- package/dist/exceptions/base/bootstrap-exception.abstract.js.map +1 -0
- package/dist/exceptions/base/index.d.ts +3 -0
- package/dist/exceptions/base/index.js +20 -0
- package/dist/exceptions/base/index.js.map +1 -0
- package/dist/exceptions/base/pipeline-exception.abstract.d.ts +21 -0
- package/dist/exceptions/base/pipeline-exception.abstract.js +29 -0
- package/dist/exceptions/base/pipeline-exception.abstract.js.map +1 -0
- package/dist/exceptions/base/platform-exception.absract.d.ts +48 -0
- package/dist/exceptions/base/platform-exception.absract.js +49 -0
- package/dist/exceptions/base/platform-exception.absract.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/double-init.exception.d.ts +4 -0
- package/dist/exceptions/implementations/bootstrap/double-init.exception.js +35 -0
- package/dist/exceptions/implementations/bootstrap/double-init.exception.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/duplicate-protocol.exception.d.ts +4 -0
- package/dist/exceptions/implementations/bootstrap/duplicate-protocol.exception.js +34 -0
- package/dist/exceptions/implementations/bootstrap/duplicate-protocol.exception.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/index.d.ts +8 -0
- package/dist/exceptions/implementations/bootstrap/index.js +25 -0
- package/dist/exceptions/implementations/bootstrap/index.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/no-http.exception.d.ts +4 -0
- package/dist/exceptions/implementations/bootstrap/no-http.exception.js +36 -0
- package/dist/exceptions/implementations/bootstrap/no-http.exception.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/no-init.exception.d.ts +4 -0
- package/dist/exceptions/implementations/bootstrap/no-init.exception.js +35 -0
- package/dist/exceptions/implementations/bootstrap/no-init.exception.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/no-matching-transport.exception.d.ts +5 -0
- package/dist/exceptions/implementations/bootstrap/no-matching-transport.exception.js +37 -0
- package/dist/exceptions/implementations/bootstrap/no-matching-transport.exception.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/sequence.exception.d.ts +4 -0
- package/dist/exceptions/implementations/bootstrap/sequence.exception.js +31 -0
- package/dist/exceptions/implementations/bootstrap/sequence.exception.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/symbol-key-decoration.exception.d.ts +4 -0
- package/dist/exceptions/implementations/bootstrap/symbol-key-decoration.exception.js +30 -0
- package/dist/exceptions/implementations/bootstrap/symbol-key-decoration.exception.js.map +1 -0
- package/dist/exceptions/implementations/bootstrap/unknown-bootstrap.exception.d.ts +4 -0
- package/dist/exceptions/implementations/bootstrap/unknown-bootstrap.exception.js +27 -0
- package/dist/exceptions/implementations/bootstrap/unknown-bootstrap.exception.js.map +1 -0
- package/dist/exceptions/implementations/index.d.ts +2 -0
- package/dist/exceptions/implementations/index.js +19 -0
- package/dist/exceptions/implementations/index.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/authentication.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/authentication.exception.js +35 -0
- package/dist/exceptions/implementations/pipeline/authentication.exception.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/conflict.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/conflict.exception.js +36 -0
- package/dist/exceptions/implementations/pipeline/conflict.exception.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/duplicate-entity.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/duplicate-entity.exception.js +35 -0
- package/dist/exceptions/implementations/pipeline/duplicate-entity.exception.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/index.d.ts +9 -0
- package/dist/exceptions/implementations/pipeline/index.js +26 -0
- package/dist/exceptions/implementations/pipeline/index.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/input.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/input.exception.js +35 -0
- package/dist/exceptions/implementations/pipeline/input.exception.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/internal.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/internal.exception.js +35 -0
- package/dist/exceptions/implementations/pipeline/internal.exception.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/not-allowed.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/not-allowed.exception.js +35 -0
- package/dist/exceptions/implementations/pipeline/not-allowed.exception.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/not-found.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/not-found.exception.js +35 -0
- package/dist/exceptions/implementations/pipeline/not-found.exception.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/timeout.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/timeout.exception.js +34 -0
- package/dist/exceptions/implementations/pipeline/timeout.exception.js.map +1 -0
- package/dist/exceptions/implementations/pipeline/validation.exception.d.ts +4 -0
- package/dist/exceptions/implementations/pipeline/validation.exception.js +13 -0
- package/dist/exceptions/implementations/pipeline/validation.exception.js.map +1 -0
- package/dist/exceptions/index.d.ts +5 -0
- package/dist/exceptions/index.js +24 -0
- package/dist/exceptions/index.js.map +1 -0
- package/dist/exceptions/metadata/decorators/exception.decorator.d.ts +2 -0
- package/dist/exceptions/metadata/decorators/exception.decorator.js +13 -0
- package/dist/exceptions/metadata/decorators/exception.decorator.js.map +1 -0
- package/dist/exceptions/metadata/decorators/index.d.ts +2 -0
- package/dist/exceptions/metadata/decorators/index.js +19 -0
- package/dist/exceptions/metadata/decorators/index.js.map +1 -0
- package/dist/exceptions/metadata/decorators/throws.decorator.d.ts +3 -0
- package/dist/exceptions/metadata/decorators/throws.decorator.js +20 -0
- package/dist/exceptions/metadata/decorators/throws.decorator.js.map +1 -0
- package/dist/exceptions/metadata/exceptions.registry.d.ts +23 -0
- package/dist/exceptions/metadata/exceptions.registry.js +30 -0
- package/dist/exceptions/metadata/exceptions.registry.js.map +1 -0
- package/dist/exceptions/metadata/index.d.ts +2 -0
- package/dist/exceptions/metadata/index.js +19 -0
- package/dist/exceptions/metadata/index.js.map +1 -0
- package/dist/exceptions/types.d.ts +18 -0
- package/dist/exceptions/types.js +23 -0
- package/dist/exceptions/types.js.map +1 -0
- package/dist/exceptions/validation/exception.d.ts +4 -0
- package/dist/exceptions/validation/exception.js +13 -0
- package/dist/exceptions/validation/exception.js.map +1 -0
- package/dist/exceptions.handling/constants.d.ts +3 -0
- package/dist/exceptions.handling/constants.js +7 -0
- package/dist/exceptions.handling/constants.js.map +1 -0
- package/dist/exceptions.handling/global-exceptions.config.d.ts +4 -0
- package/dist/exceptions.handling/global-exceptions.config.js +32 -0
- package/dist/exceptions.handling/global-exceptions.config.js.map +1 -0
- package/dist/exceptions.handling/global-exceptions.filter.d.ts +17 -0
- package/dist/exceptions.handling/global-exceptions.filter.js +83 -0
- package/dist/exceptions.handling/global-exceptions.filter.js.map +1 -0
- package/dist/exceptions.handling/global-exceptions.module.d.ts +26 -0
- package/dist/exceptions.handling/global-exceptions.module.js +47 -0
- package/dist/exceptions.handling/global-exceptions.module.js.map +1 -0
- package/dist/exceptions.handling/index.d.ts +2 -0
- package/dist/exceptions.handling/index.js +19 -0
- package/dist/exceptions.handling/index.js.map +1 -0
- package/dist/exceptions.handling/types.d.ts +81 -0
- package/dist/exceptions.handling/types.js +3 -0
- package/dist/exceptions.handling/types.js.map +1 -0
- package/dist/health/exceptions/health-check.exception.d.ts +5 -0
- package/dist/health/exceptions/health-check.exception.js +24 -0
- package/dist/health/exceptions/health-check.exception.js.map +1 -0
- package/dist/health/exceptions/index.d.ts +1 -0
- package/dist/health/exceptions/index.js +18 -0
- package/dist/health/exceptions/index.js.map +1 -0
- package/dist/health/health.const.d.ts +2 -0
- package/dist/health/health.const.js +6 -0
- package/dist/health/health.const.js.map +1 -0
- package/dist/health/health.module.d.ts +5 -0
- package/dist/health/health.module.js +33 -0
- package/dist/health/health.module.js.map +1 -0
- package/dist/health/health.service.d.ts +14 -0
- package/dist/health/health.service.js +118 -0
- package/dist/health/health.service.js.map +1 -0
- package/dist/health/helpers/check-result.class.d.ts +37 -0
- package/dist/health/helpers/check-result.class.js +49 -0
- package/dist/health/helpers/check-result.class.js.map +1 -0
- package/dist/health/helpers/index.d.ts +1 -0
- package/dist/health/helpers/index.js +18 -0
- package/dist/health/helpers/index.js.map +1 -0
- package/dist/health/index.d.ts +6 -0
- package/dist/health/index.js +23 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/indicators.abstract/fs-access.indicator.d.ts +27 -0
- package/dist/health/indicators.abstract/fs-access.indicator.js +36 -0
- package/dist/health/indicators.abstract/fs-access.indicator.js.map +1 -0
- package/dist/health/indicators.abstract/index.d.ts +2 -0
- package/dist/health/indicators.abstract/index.js +19 -0
- package/dist/health/indicators.abstract/index.js.map +1 -0
- package/dist/health/indicators.abstract/ping.indicator.d.ts +21 -0
- package/dist/health/indicators.abstract/ping.indicator.js +28 -0
- package/dist/health/indicators.abstract/ping.indicator.js.map +1 -0
- package/dist/health/metadata/index.d.ts +2 -0
- package/dist/health/metadata/index.js +19 -0
- package/dist/health/metadata/index.js.map +1 -0
- package/dist/health/metadata/indicator.decorator.d.ts +5 -0
- package/dist/health/metadata/indicator.decorator.js +16 -0
- package/dist/health/metadata/indicator.decorator.js.map +1 -0
- package/dist/health/metadata/indicators.registry.d.ts +12 -0
- package/dist/health/metadata/indicators.registry.js +26 -0
- package/dist/health/metadata/indicators.registry.js.map +1 -0
- package/dist/health/types.d.ts +45 -0
- package/dist/health/types.js +3 -0
- package/dist/health/types.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/adapters/index.d.ts +1 -0
- package/dist/logging/adapters/index.js +18 -0
- package/dist/logging/adapters/index.js.map +1 -0
- package/dist/logging/adapters/nest-logger.adapter.d.ts +11 -0
- package/dist/logging/adapters/nest-logger.adapter.js +27 -0
- package/dist/logging/adapters/nest-logger.adapter.js.map +1 -0
- package/dist/logging/decorators/index.d.ts +1 -0
- package/dist/logging/decorators/index.js +18 -0
- package/dist/logging/decorators/index.js.map +1 -0
- package/dist/logging/decorators/inject-logger.decorator.d.ts +2 -0
- package/dist/logging/decorators/inject-logger.decorator.js +13 -0
- package/dist/logging/decorators/inject-logger.decorator.js.map +1 -0
- package/dist/logging/helpers.d.ts +2 -0
- package/dist/logging/helpers.js +7 -0
- package/dist/logging/helpers.js.map +1 -0
- package/dist/logging/index.d.ts +4 -0
- package/dist/logging/index.js +21 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logging.config.d.ts +6 -0
- package/dist/logging/logging.config.js +38 -0
- package/dist/logging/logging.config.js.map +1 -0
- package/dist/logging/logging.module.d.ts +10 -0
- package/dist/logging/logging.module.js +54 -0
- package/dist/logging/logging.module.js.map +1 -0
- package/dist/logging/types.d.ts +2 -0
- package/dist/logging/types.js +3 -0
- package/dist/logging/types.js.map +1 -0
- package/dist/manifest/manifest.d.ts +7 -0
- package/dist/manifest/manifest.js +23 -0
- package/dist/manifest/manifest.js.map +1 -0
- package/dist/metrics/index.d.ts +4 -0
- package/dist/metrics/index.js +27 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/metadata/decorators/index.d.ts +1 -0
- package/dist/metrics/metadata/decorators/index.js +18 -0
- package/dist/metrics/metadata/decorators/index.js.map +1 -0
- package/dist/metrics/metadata/decorators/metric.decorator.d.ts +13 -0
- package/dist/metrics/metadata/decorators/metric.decorator.js +11 -0
- package/dist/metrics/metadata/decorators/metric.decorator.js.map +1 -0
- package/dist/metrics/metadata/index.d.ts +2 -0
- package/dist/metrics/metadata/index.js +19 -0
- package/dist/metrics/metadata/index.js.map +1 -0
- package/dist/metrics/metadata/metrics.registry.d.ts +8 -0
- package/dist/metrics/metadata/metrics.registry.js +26 -0
- package/dist/metrics/metadata/metrics.registry.js.map +1 -0
- package/dist/metrics/metrics.config.d.ts +5 -0
- package/dist/metrics/metrics.config.js +36 -0
- package/dist/metrics/metrics.config.js.map +1 -0
- package/dist/metrics/metrics.module.d.ts +35 -0
- package/dist/metrics/metrics.module.js +98 -0
- package/dist/metrics/metrics.module.js.map +1 -0
- package/dist/metrics/types.d.ts +21 -0
- package/dist/metrics/types.js +12 -0
- package/dist/metrics/types.js.map +1 -0
- package/dist/noop.http-adapter.d.ts +32 -0
- package/dist/noop.http-adapter.js +100 -0
- package/dist/noop.http-adapter.js.map +1 -0
- package/dist/platform.context.d.ts +55 -0
- package/dist/platform.context.js +162 -0
- package/dist/platform.context.js.map +1 -0
- package/dist/platform.module.d.ts +8 -0
- package/dist/platform.module.js +61 -0
- package/dist/platform.module.js.map +1 -0
- package/dist/plugin/plugin.module.d.ts +5 -0
- package/dist/plugin/plugin.module.js +22 -0
- package/dist/plugin/plugin.module.js.map +1 -0
- package/dist/tracing/auto-instrumentations.config.d.ts +1 -0
- package/dist/tracing/auto-instrumentations.config.js +35 -0
- package/dist/tracing/auto-instrumentations.config.js.map +1 -0
- package/dist/tracing/constants.d.ts +5 -0
- package/dist/tracing/constants.js +10 -0
- package/dist/tracing/constants.js.map +1 -0
- package/dist/tracing/decorators/index.d.ts +2 -0
- package/dist/tracing/decorators/index.js +19 -0
- package/dist/tracing/decorators/index.js.map +1 -0
- package/dist/tracing/decorators/no-span.decorator.d.ts +5 -0
- package/dist/tracing/decorators/no-span.decorator.js +12 -0
- package/dist/tracing/decorators/no-span.decorator.js.map +1 -0
- package/dist/tracing/decorators/span.decorator.d.ts +6 -0
- package/dist/tracing/decorators/span.decorator.js +18 -0
- package/dist/tracing/decorators/span.decorator.js.map +1 -0
- package/dist/tracing/index.d.ts +1 -0
- package/dist/tracing/index.js +18 -0
- package/dist/tracing/index.js.map +1 -0
- package/dist/tracing/services/index.d.ts +3 -0
- package/dist/tracing/services/index.js +20 -0
- package/dist/tracing/services/index.js.map +1 -0
- package/dist/tracing/services/instrumentation.service.d.ts +10 -0
- package/dist/tracing/services/instrumentation.service.js +138 -0
- package/dist/tracing/services/instrumentation.service.js.map +1 -0
- package/dist/tracing/services/metadata.scanner.d.ts +11 -0
- package/dist/tracing/services/metadata.scanner.js +50 -0
- package/dist/tracing/services/metadata.scanner.js.map +1 -0
- package/dist/tracing/services/trace.injector.d.ts +12 -0
- package/dist/tracing/services/trace.injector.js +119 -0
- package/dist/tracing/services/trace.injector.js.map +1 -0
- package/dist/tracing/tracing.config.d.ts +5 -0
- package/dist/tracing/tracing.config.js +36 -0
- package/dist/tracing/tracing.config.js.map +1 -0
- package/dist/tracing/tracing.module.d.ts +22 -0
- package/dist/tracing/tracing.module.js +118 -0
- package/dist/tracing/tracing.module.js.map +1 -0
- package/dist/transport/transport.module.d.ts +8 -0
- package/dist/transport/transport.module.js +55 -0
- package/dist/transport/transport.module.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/metadata.d.ts +38 -0
- package/dist/types/metadata.js +30 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/options.d.ts +68 -0
- package/dist/types/options.js +3 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/plugins.d.ts +51 -0
- package/dist/types/plugins.js +6 -0
- package/dist/types/plugins.js.map +1 -0
- package/dist/types/transports.d.ts +85 -0
- package/dist/types/transports.js +11 -0
- package/dist/types/transports.js.map +1 -0
- package/package.json +53 -0
- package/src/app/platform.app.ts +52 -0
- package/src/app-metadata/app-metadata.const.ts +3 -0
- package/src/app-metadata/app-metadata.module.ts +34 -0
- package/src/app-metadata/app-name.const.ts +1 -0
- package/src/app-metadata/app-name.validator.ts +11 -0
- package/src/app-metadata/decorators/app-name.decorator.ts +5 -0
- package/src/app-metadata/decorators/index.ts +1 -0
- package/src/app-metadata/exceptions/app-name-validation.exception.ts +23 -0
- package/src/app-metadata/exceptions/index.ts +1 -0
- package/src/app-metadata/index.ts +2 -0
- package/src/config/additional-source/additional-source.initializer.ts +165 -0
- package/src/config/additional-source/additional-source.module.ts +48 -0
- package/src/config/config-reload.indicator.ts +36 -0
- package/src/config/config.abstract.ts +70 -0
- package/src/config/config.module.ts +330 -0
- package/src/config/exceptions/config-not-bootstrapped.exception.ts +15 -0
- package/src/config/exceptions/config-property-metadata-not-found.ts +9 -0
- package/src/config/exceptions/index.ts +3 -0
- package/src/config/exceptions/property.exception.ts +15 -0
- package/src/config/index.ts +10 -0
- package/src/config/metadata/config-metadata.registry.ts +76 -0
- package/src/config/metadata/decorators/config-section.decorator.ts +30 -0
- package/src/config/metadata/decorators/declare-property.decorator.ts +37 -0
- package/src/config/metadata/decorators/index.ts +4 -0
- package/src/config/metadata/decorators/inject-property.decorator.ts +29 -0
- package/src/config/metadata/decorators/property.decorator.ts +42 -0
- package/src/config/metadata/exceptions/duplicate-property.exception.ts +12 -0
- package/src/config/metadata/exceptions/duplicate-section.exception.ts +13 -0
- package/src/config/metadata/exceptions/duplicate-source.exception.ts +13 -0
- package/src/config/metadata/exceptions/index.ts +3 -0
- package/src/config/metadata/index.ts +2 -0
- package/src/config/parsers/array.parser.ts +40 -0
- package/src/config/parsers/boolean/bool.parser.ts +20 -0
- package/src/config/parsers/boolean/bool.spec.ts +4 -0
- package/src/config/parsers/boolean/index.ts +1 -0
- package/src/config/parsers/enum/enum.parser.ts +23 -0
- package/src/config/parsers/enum/enum.spec.ts +5 -0
- package/src/config/parsers/enum/index.ts +1 -0
- package/src/config/parsers/index.ts +10 -0
- package/src/config/parsers/int/index.ts +1 -0
- package/src/config/parsers/int/int.parser.ts +20 -0
- package/src/config/parsers/int/int.spec.ts +5 -0
- package/src/config/parsers/number/index.ts +1 -0
- package/src/config/parsers/number/number.parser.ts +23 -0
- package/src/config/parsers/number/number.spec.ts +5 -0
- package/src/config/parsers/path/fspath.parser.ts +65 -0
- package/src/config/parsers/path/index.ts +1 -0
- package/src/config/parsers/size/index.ts +1 -0
- package/src/config/parsers/size/size.parser.ts +22 -0
- package/src/config/parsers/size/size.spec.ts +4 -0
- package/src/config/parsers/string/index.ts +1 -0
- package/src/config/parsers/string/string.parser.ts +19 -0
- package/src/config/parsers/timespan/index.ts +1 -0
- package/src/config/parsers/timespan/timespan.parser.ts +27 -0
- package/src/config/parsers/timespan/timespan.spec.ts +4 -0
- package/src/config/parsers/url/index.ts +1 -0
- package/src/config/parsers/url/url.parser.ts +19 -0
- package/src/config/reload/config-reload.events.ts +43 -0
- package/src/config/reload/index.ts +1 -0
- package/src/config/sources/base/config-source.abstract.ts +90 -0
- package/src/config/sources/base/index.ts +2 -0
- package/src/config/sources/base/reloadable-config-source.abstract.ts +39 -0
- package/src/config/sources/config-source.decorator.ts +37 -0
- package/src/config/sources/exceptions/config-source-di.exception.ts +20 -0
- package/src/config/sources/exceptions/config-source.exception.ts +7 -0
- package/src/config/sources/exceptions/index.ts +2 -0
- package/src/config/sources/implementations/json-file.source.ts +29 -0
- package/src/config/sources/implementations/relodable-json-file.source.ts +39 -0
- package/src/config/sources/index.ts +3 -0
- package/src/config/types.ts +87 -0
- package/src/config/vars.class.ts +103 -0
- package/src/exceptions/base/bootstrap-exception.abstract.ts +20 -0
- package/src/exceptions/base/index.ts +3 -0
- package/src/exceptions/base/pipeline-exception.abstract.ts +29 -0
- package/src/exceptions/base/platform-exception.absract.ts +72 -0
- package/src/exceptions/implementations/bootstrap/double-init.exception.ts +21 -0
- package/src/exceptions/implementations/bootstrap/duplicate-protocol.exception.ts +19 -0
- package/src/exceptions/implementations/bootstrap/index.ts +8 -0
- package/src/exceptions/implementations/bootstrap/no-http.exception.ts +21 -0
- package/src/exceptions/implementations/bootstrap/no-init.exception.ts +21 -0
- package/src/exceptions/implementations/bootstrap/no-matching-transport.exception.ts +24 -0
- package/src/exceptions/implementations/bootstrap/sequence.exception.ts +16 -0
- package/src/exceptions/implementations/bootstrap/symbol-key-decoration.exception.ts +15 -0
- package/src/exceptions/implementations/bootstrap/unknown-bootstrap.exception.ts +11 -0
- package/src/exceptions/implementations/index.ts +2 -0
- package/src/exceptions/implementations/pipeline/authentication.exception.ts +20 -0
- package/src/exceptions/implementations/pipeline/conflict.exception.ts +21 -0
- package/src/exceptions/implementations/pipeline/duplicate-entity.exception.ts +20 -0
- package/src/exceptions/implementations/pipeline/index.ts +9 -0
- package/src/exceptions/implementations/pipeline/input.exception.ts +20 -0
- package/src/exceptions/implementations/pipeline/internal.exception.ts +20 -0
- package/src/exceptions/implementations/pipeline/not-allowed.exception.ts +20 -0
- package/src/exceptions/implementations/pipeline/not-found.exception.ts +20 -0
- package/src/exceptions/implementations/pipeline/timeout.exception.ts +19 -0
- package/src/exceptions/implementations/pipeline/validation.exception.ts +9 -0
- package/src/exceptions/index.ts +5 -0
- package/src/exceptions/metadata/decorators/exception.decorator.ts +10 -0
- package/src/exceptions/metadata/decorators/index.ts +2 -0
- package/src/exceptions/metadata/decorators/throws.decorator.ts +25 -0
- package/src/exceptions/metadata/exceptions.registry.ts +50 -0
- package/src/exceptions/metadata/index.ts +2 -0
- package/src/exceptions/types.ts +18 -0
- package/src/exceptions/validation/exception.ts +9 -0
- package/src/exceptions.handling/constants.ts +3 -0
- package/src/exceptions.handling/global-exceptions.config.ts +15 -0
- package/src/exceptions.handling/global-exceptions.filter.ts +81 -0
- package/src/exceptions.handling/global-exceptions.module.ts +67 -0
- package/src/exceptions.handling/index.ts +2 -0
- package/src/exceptions.handling/types.ts +88 -0
- package/src/health/exceptions/health-check.exception.ts +9 -0
- package/src/health/exceptions/index.ts +1 -0
- package/src/health/health.const.ts +2 -0
- package/src/health/health.module.ts +23 -0
- package/src/health/health.service.ts +125 -0
- package/src/health/helpers/check-result.class.ts +52 -0
- package/src/health/helpers/index.ts +1 -0
- package/src/health/index.ts +6 -0
- package/src/health/indicators.abstract/fs-access.indicator.ts +47 -0
- package/src/health/indicators.abstract/index.ts +2 -0
- package/src/health/indicators.abstract/ping.indicator.ts +36 -0
- package/src/health/metadata/index.ts +2 -0
- package/src/health/metadata/indicator.decorator.ts +25 -0
- package/src/health/metadata/indicators.registry.ts +38 -0
- package/src/health/types.ts +50 -0
- package/src/index.ts +32 -0
- package/src/logging/adapters/index.ts +1 -0
- package/src/logging/adapters/nest-logger.adapter.ts +32 -0
- package/src/logging/decorators/index.ts +1 -0
- package/src/logging/decorators/inject-logger.decorator.ts +15 -0
- package/src/logging/helpers.ts +5 -0
- package/src/logging/index.ts +4 -0
- package/src/logging/logging.config.ts +26 -0
- package/src/logging/logging.module.ts +48 -0
- package/src/logging/types.ts +3 -0
- package/src/manifest/manifest.ts +23 -0
- package/src/metrics/index.ts +4 -0
- package/src/metrics/metadata/decorators/index.ts +1 -0
- package/src/metrics/metadata/decorators/metric.decorator.ts +45 -0
- package/src/metrics/metadata/index.ts +2 -0
- package/src/metrics/metadata/metrics.registry.ts +35 -0
- package/src/metrics/metrics.config.ts +16 -0
- package/src/metrics/metrics.module.ts +100 -0
- package/src/metrics/types.ts +39 -0
- package/src/noop.http-adapter.ts +126 -0
- package/src/platform.context.ts +214 -0
- package/src/platform.module.ts +65 -0
- package/src/plugin/plugin.module.ts +24 -0
- package/src/tracing/auto-instrumentations.config.ts +35 -0
- package/src/tracing/constants.ts +6 -0
- package/src/tracing/decorators/index.ts +2 -0
- package/src/tracing/decorators/no-span.decorator.ts +10 -0
- package/src/tracing/decorators/span.decorator.ts +20 -0
- package/src/tracing/index.ts +1 -0
- package/src/tracing/services/index.ts +3 -0
- package/src/tracing/services/instrumentation.service.ts +145 -0
- package/src/tracing/services/metadata.scanner.ts +40 -0
- package/src/tracing/services/trace.injector.ts +147 -0
- package/src/tracing/tracing.config.ts +22 -0
- package/src/tracing/tracing.module.ts +120 -0
- package/src/transport/transport.module.ts +64 -0
- package/src/types/index.ts +4 -0
- package/src/types/metadata.ts +88 -0
- package/src/types/options.ts +83 -0
- package/src/types/plugins.ts +68 -0
- package/src/types/transports.ts +110 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable sort-keys */
|
|
2
|
+
|
|
3
|
+
import type { DynamicModule, Provider } from '@nestjs/common';
|
|
4
|
+
import { Module } from '@nestjs/common';
|
|
5
|
+
import type { Constructor } from '@rsdk/common';
|
|
6
|
+
import { LoggerFactory } from '@rsdk/logging';
|
|
7
|
+
|
|
8
|
+
import { PlatformConfigModule } from '../config';
|
|
9
|
+
|
|
10
|
+
import { LoggingConfig } from './logging.config';
|
|
11
|
+
|
|
12
|
+
@Module({})
|
|
13
|
+
export class LoggingModule {
|
|
14
|
+
private static providers = new Map<string, Provider>();
|
|
15
|
+
private static logger = LoggerFactory.create('LoggingModule');
|
|
16
|
+
|
|
17
|
+
constructor(config: LoggingConfig) {
|
|
18
|
+
const cfg = (): void => {
|
|
19
|
+
LoggingModule.logger.info(`Setting log level: <${config.level}>`, {
|
|
20
|
+
logLevel: config.level,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
LoggerFactory.reconfigure(config);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
config.onUpdate(cfg);
|
|
27
|
+
cfg();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static register(context: string | Constructor, token: string): void {
|
|
31
|
+
this.providers.set(token, {
|
|
32
|
+
provide: token,
|
|
33
|
+
useValue: LoggerFactory.create(context),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static forRoot(): DynamicModule {
|
|
38
|
+
const providers = [...this.providers.values()];
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
module: LoggingModule,
|
|
42
|
+
imports: [PlatformConfigModule.forFeature(LoggingConfig)],
|
|
43
|
+
exports: providers,
|
|
44
|
+
providers: providers,
|
|
45
|
+
global: true,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { cwd } from 'process';
|
|
3
|
+
|
|
4
|
+
import { assertAppName } from '../app-metadata';
|
|
5
|
+
import type { ManifestData } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Утилитарный класс для вывода данных из `package.json`
|
|
9
|
+
*/
|
|
10
|
+
export class Manifest {
|
|
11
|
+
static getData(manifestPath?: string): ManifestData {
|
|
12
|
+
/**
|
|
13
|
+
* Reading and validating metadata from package.json
|
|
14
|
+
*/
|
|
15
|
+
const path = manifestPath || join(cwd(), 'package.json');
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
+
const { name, description, version } = require(path) as ManifestData;
|
|
19
|
+
|
|
20
|
+
assertAppName(name);
|
|
21
|
+
return { name, description, version };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './metric.decorator';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
import type { Constructor } from '@rsdk/common';
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
CounterMetadata,
|
|
6
|
+
GaugeMetadata,
|
|
7
|
+
HistogramMetadata,
|
|
8
|
+
MetricMetadata,
|
|
9
|
+
OmitType,
|
|
10
|
+
SummaryMetadata,
|
|
11
|
+
} from '../../types';
|
|
12
|
+
import { MetricsRegistry } from '../metrics.registry';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Registers metric's metadata, which allows
|
|
16
|
+
* MetricsModule to instantiate it and export as
|
|
17
|
+
* a provider
|
|
18
|
+
*
|
|
19
|
+
* @param type type of metric
|
|
20
|
+
* @param metadata respective metadata
|
|
21
|
+
*/
|
|
22
|
+
export function Metric(
|
|
23
|
+
type: 'counter',
|
|
24
|
+
metadata: OmitType<CounterMetadata>,
|
|
25
|
+
): ClassDecorator;
|
|
26
|
+
export function Metric(
|
|
27
|
+
type: 'gauge',
|
|
28
|
+
metadata: OmitType<GaugeMetadata>,
|
|
29
|
+
): ClassDecorator;
|
|
30
|
+
export function Metric(
|
|
31
|
+
type: 'histogram',
|
|
32
|
+
metadata: OmitType<HistogramMetadata>,
|
|
33
|
+
): ClassDecorator;
|
|
34
|
+
export function Metric(
|
|
35
|
+
type: 'summary',
|
|
36
|
+
metadata: OmitType<SummaryMetadata>,
|
|
37
|
+
): ClassDecorator;
|
|
38
|
+
export function Metric(
|
|
39
|
+
type: 'counter' | 'gauge' | 'histogram' | 'summary',
|
|
40
|
+
metadata: OmitType<MetricMetadata>,
|
|
41
|
+
): ClassDecorator {
|
|
42
|
+
return function (target: Function): void {
|
|
43
|
+
MetricsRegistry.register(target as Constructor, { ...metadata, type });
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Constructor } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import { DoubleInitException, NoInitException } from '../../exceptions';
|
|
4
|
+
import type { AnyMetric, MetricMetadata } from '../types';
|
|
5
|
+
|
|
6
|
+
// separate class because we don't want to expose this
|
|
7
|
+
export class MetricsRegistry {
|
|
8
|
+
private static metadata = new Map<Constructor<AnyMetric>, MetricMetadata>();
|
|
9
|
+
|
|
10
|
+
static register(
|
|
11
|
+
target: Constructor<AnyMetric>,
|
|
12
|
+
metric: MetricMetadata,
|
|
13
|
+
): void {
|
|
14
|
+
if (this.metadata.has(target)) {
|
|
15
|
+
throw new DoubleInitException('Metric', target.name);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
this.metadata.set(target, metric);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static getOne(ctor: Constructor<AnyMetric>): Readonly<MetricMetadata> {
|
|
22
|
+
const metadata = this.metadata.get(ctor);
|
|
23
|
+
if (!metadata) {
|
|
24
|
+
throw new NoInitException('Metric', ctor.name);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return metadata;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getAll(): Readonly<Map<Constructor<AnyMetric>, MetricMetadata>> {
|
|
31
|
+
return this.metadata;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// TODO Metadata for autodoc
|
|
35
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BoolParser, Config, ConfigSection, Property } from '../config';
|
|
2
|
+
|
|
3
|
+
@ConfigSection({ name: 'Metrics configuration' })
|
|
4
|
+
export class MetricsModuleConfig extends Config {
|
|
5
|
+
@Property('METRICS_ENABLED', new BoolParser(), {
|
|
6
|
+
defaultValue: true,
|
|
7
|
+
description: 'Enables or disables metrics all together',
|
|
8
|
+
})
|
|
9
|
+
isEnabled!: boolean;
|
|
10
|
+
|
|
11
|
+
@Property('METRICS_INCLUDE_DEFAULT', new BoolParser(), {
|
|
12
|
+
defaultValue: true,
|
|
13
|
+
description: 'Indicates that default Node.js metrics should be included',
|
|
14
|
+
})
|
|
15
|
+
includeDefault!: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DynamicModule,
|
|
3
|
+
OnApplicationBootstrap,
|
|
4
|
+
Provider,
|
|
5
|
+
} from '@nestjs/common';
|
|
6
|
+
import { Module } from '@nestjs/common';
|
|
7
|
+
import type { Constructor } from '@rsdk/common';
|
|
8
|
+
import client from 'prom-client';
|
|
9
|
+
|
|
10
|
+
import { PlatformConfigModule } from '../config';
|
|
11
|
+
|
|
12
|
+
import { MetricsRegistry } from './metadata';
|
|
13
|
+
import { MetricsModuleConfig } from './metrics.config';
|
|
14
|
+
import type { AnyMetric, MetricsModuleOptions } from './types';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Metrics module exposes metrics interface (depending on transport)
|
|
18
|
+
* and gives convenient ways to register and inject custom prom-client
|
|
19
|
+
* metrics.
|
|
20
|
+
*
|
|
21
|
+
* @willsoto/nestjs-prometheus was an alternative, but it didn't really
|
|
22
|
+
* fit
|
|
23
|
+
*/
|
|
24
|
+
@Module({
|
|
25
|
+
imports: [PlatformConfigModule.forFeature(MetricsModuleConfig)],
|
|
26
|
+
})
|
|
27
|
+
export class MetricsModule implements OnApplicationBootstrap {
|
|
28
|
+
private static isBootstrapped = false;
|
|
29
|
+
private static metrics = new Map<Constructor<AnyMetric>, Provider>();
|
|
30
|
+
|
|
31
|
+
constructor(private readonly config: MetricsModuleConfig) {}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Adds metrics controller provided as options
|
|
35
|
+
*
|
|
36
|
+
* @returns dynamic module
|
|
37
|
+
*/
|
|
38
|
+
static forRoot(options: MetricsModuleOptions): DynamicModule {
|
|
39
|
+
return {
|
|
40
|
+
controllers: [...options.controllers],
|
|
41
|
+
module: MetricsModule,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Use this to inject specified metric into target module
|
|
47
|
+
*
|
|
48
|
+
* @param other Not empty List of metric classes
|
|
49
|
+
* @returns dynamic module
|
|
50
|
+
*/
|
|
51
|
+
static forFeature(
|
|
52
|
+
first: Constructor<AnyMetric>,
|
|
53
|
+
...other: Constructor<AnyMetric>[]
|
|
54
|
+
): DynamicModule {
|
|
55
|
+
const providers: Provider[] = [];
|
|
56
|
+
|
|
57
|
+
for (const ctor of [first, ...other]) {
|
|
58
|
+
const existing = this.metrics.get(ctor);
|
|
59
|
+
|
|
60
|
+
if (existing) {
|
|
61
|
+
providers.push(existing);
|
|
62
|
+
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const metadata = MetricsRegistry.getOne(ctor);
|
|
67
|
+
|
|
68
|
+
providers.push({
|
|
69
|
+
provide: ctor,
|
|
70
|
+
useValue: new ctor(metadata),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
module: MetricsModule,
|
|
76
|
+
|
|
77
|
+
exports: providers,
|
|
78
|
+
providers,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Configures prom-client
|
|
84
|
+
*/
|
|
85
|
+
onApplicationBootstrap(): void {
|
|
86
|
+
/**
|
|
87
|
+
* This module initializes many times: forRoot, forFeature
|
|
88
|
+
* but real prom-client should occur only once.
|
|
89
|
+
*/
|
|
90
|
+
if (MetricsModule.isBootstrapped) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (this.config.includeDefault) {
|
|
95
|
+
client.collectDefaultMetrics();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
MetricsModule.isBootstrapped = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Controller } from '@nestjs/common/interfaces';
|
|
2
|
+
import type { Constructor } from '@rsdk/common';
|
|
3
|
+
import type {
|
|
4
|
+
CounterConfiguration,
|
|
5
|
+
GaugeConfiguration,
|
|
6
|
+
HistogramConfiguration,
|
|
7
|
+
SummaryConfiguration,
|
|
8
|
+
} from 'prom-client';
|
|
9
|
+
|
|
10
|
+
export { Metric as AnyMetric } from 'prom-client';
|
|
11
|
+
|
|
12
|
+
export interface MetricsModuleOptions {
|
|
13
|
+
controllers: Constructor<Controller>[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface MetricMetadata {
|
|
17
|
+
name: string;
|
|
18
|
+
type: 'counter' | 'gauge' | 'histogram' | 'summary';
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type OmitType<T extends MetricMetadata> = Omit<T, 'type'>;
|
|
23
|
+
|
|
24
|
+
export type CounterMetadata = CounterConfiguration<string> & MetricMetadata;
|
|
25
|
+
export const isCounterMetadata = (x: MetricMetadata): x is CounterMetadata =>
|
|
26
|
+
x.type === 'counter';
|
|
27
|
+
|
|
28
|
+
export type GaugeMetadata = GaugeConfiguration<string> & MetricMetadata;
|
|
29
|
+
export const isGaugeMetadata = (x: MetricMetadata): x is GaugeMetadata =>
|
|
30
|
+
x.type === 'gauge';
|
|
31
|
+
|
|
32
|
+
export type HistogramMetadata = HistogramConfiguration<string> & MetricMetadata;
|
|
33
|
+
export const isHistogramMetadata = (
|
|
34
|
+
x: MetricMetadata,
|
|
35
|
+
): x is HistogramMetadata => x.type === 'histogram';
|
|
36
|
+
|
|
37
|
+
export type SummaryMetadata = SummaryConfiguration<string> & MetricMetadata;
|
|
38
|
+
export const isSummaryMetadata = (x: MetricMetadata): x is SummaryMetadata =>
|
|
39
|
+
x.type === 'summary';
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
import { AbstractHttpAdapter } from '@nestjs/core';
|
|
3
|
+
|
|
4
|
+
import { NoHttpException } from './exceptions';
|
|
5
|
+
|
|
6
|
+
// Just do nothing
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
8
|
+
const noop = (): void => {};
|
|
9
|
+
|
|
10
|
+
export class NoopHttpAdapter<T> extends AbstractHttpAdapter<T> {
|
|
11
|
+
override get(): void {
|
|
12
|
+
throw new NoHttpException();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override post(): void {
|
|
16
|
+
throw new NoHttpException();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override put(): void {
|
|
20
|
+
throw new NoHttpException();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override patch(): void {
|
|
24
|
+
throw new NoHttpException();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override head(): void {
|
|
28
|
+
throw new NoHttpException();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override delete(): void {
|
|
32
|
+
throw new NoHttpException();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override all(): void {
|
|
36
|
+
throw new NoHttpException();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override use(): void {
|
|
40
|
+
throw new NoHttpException();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
close(): any {
|
|
44
|
+
noop();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
initHttpServer(): any {
|
|
48
|
+
noop();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
useStaticAssets(): any {
|
|
52
|
+
noop();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setViewEngine(): any {
|
|
56
|
+
noop();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getRequestHostname(): any {
|
|
60
|
+
noop();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getRequestMethod(): any {
|
|
64
|
+
noop();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
getRequestUrl(): any {
|
|
68
|
+
noop();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
status(): any {
|
|
72
|
+
noop();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
reply(): any {
|
|
76
|
+
noop();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
end(): any {
|
|
80
|
+
noop();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
render(): any {
|
|
84
|
+
noop();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
redirect(): any {
|
|
88
|
+
noop();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
setErrorHandler(): any {
|
|
92
|
+
noop();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
setNotFoundHandler(): any {
|
|
96
|
+
noop();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
isHeadersSent(): any {
|
|
100
|
+
noop();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setHeader(): any {
|
|
104
|
+
noop();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
registerParserMiddleware(): any {
|
|
108
|
+
noop();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
enableCors(): any {
|
|
112
|
+
noop();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
createMiddlewareFactory(): (path: string, callback: Function) => any {
|
|
116
|
+
return noop;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
getType(): string {
|
|
120
|
+
return 'noop';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
applyVersionFilter(): (req: any, res: any, next: () => void) => Function {
|
|
124
|
+
return () => noop;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import type { DynamicModule, INestMicroservice } from '@nestjs/common';
|
|
2
|
+
import type { INestApplication } from '@nestjs/common/interfaces';
|
|
3
|
+
import type { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
|
|
4
|
+
import type { AbstractHttpAdapter } from '@nestjs/core';
|
|
5
|
+
import { LoggerFactory } from '@rsdk/logging';
|
|
6
|
+
import { groupBy, intersection } from 'lodash';
|
|
7
|
+
|
|
8
|
+
import { Manifest } from './manifest/manifest';
|
|
9
|
+
import { ConfigMetadataRegistry, PlatformConfigModule } from './config';
|
|
10
|
+
import {
|
|
11
|
+
DuplicateProtocolException,
|
|
12
|
+
NoMatchingTransportException,
|
|
13
|
+
} from './exceptions';
|
|
14
|
+
import { NestLoggerAdapter } from './logging';
|
|
15
|
+
import { NoopHttpAdapter } from './noop.http-adapter';
|
|
16
|
+
import { PlatformModule } from './platform.module';
|
|
17
|
+
import type {
|
|
18
|
+
IHttpTransport,
|
|
19
|
+
IMicroserviceTransport,
|
|
20
|
+
PlatformAppMetadata,
|
|
21
|
+
PlatformExtendedOptions,
|
|
22
|
+
PlatformOptions,
|
|
23
|
+
} from './types';
|
|
24
|
+
import {
|
|
25
|
+
hasSpecifiedTransports,
|
|
26
|
+
isHttpTransport,
|
|
27
|
+
isMicroserviceTransport,
|
|
28
|
+
serializePropertyMetadata,
|
|
29
|
+
transformSectionMetadata,
|
|
30
|
+
} from './types';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Агрегат для хранения опций приложения, а также методы для конфигурации и запуска приложения
|
|
34
|
+
*/
|
|
35
|
+
export class PlatformContext {
|
|
36
|
+
readonly logger = LoggerFactory.create('App');
|
|
37
|
+
readonly root: DynamicModule;
|
|
38
|
+
|
|
39
|
+
private microservices: Map<INestMicroservice, IMicroserviceTransport>;
|
|
40
|
+
private readonly httpTransport: IHttpTransport | undefined;
|
|
41
|
+
private readonly httpAdapter: AbstractHttpAdapter;
|
|
42
|
+
private readonly extendedOptions: PlatformExtendedOptions;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Создаёт контекст проводя базовые проверки
|
|
46
|
+
* - все транспорты совместимы между собой
|
|
47
|
+
* - подключенные плагины могут работать с таким набором транспортов
|
|
48
|
+
*
|
|
49
|
+
* А также инициализирует конфигурацию согласно требованиям платформы
|
|
50
|
+
* @param options
|
|
51
|
+
*/
|
|
52
|
+
constructor(readonly options: PlatformOptions) {
|
|
53
|
+
PlatformContext.assertTransportCompatability(options);
|
|
54
|
+
PlatformContext.assertPluginCompatability(options);
|
|
55
|
+
|
|
56
|
+
const { name, description, version } = Manifest.getData(
|
|
57
|
+
options.manifestPath,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const extendedOptions: PlatformExtendedOptions = {
|
|
61
|
+
description,
|
|
62
|
+
name,
|
|
63
|
+
version,
|
|
64
|
+
...options,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
this.extendedOptions = extendedOptions;
|
|
68
|
+
|
|
69
|
+
PlatformConfigModule.bootstrap({
|
|
70
|
+
...(extendedOptions.config ?? {}),
|
|
71
|
+
appName: extendedOptions.name,
|
|
72
|
+
});
|
|
73
|
+
this.httpTransport = options.transports?.find?.(isHttpTransport);
|
|
74
|
+
this.httpAdapter =
|
|
75
|
+
this.httpTransport?.getAdapter() ?? new NoopHttpAdapter();
|
|
76
|
+
|
|
77
|
+
this.root = PlatformModule.forRoot(this.extendedOptions);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private static assertPluginCompatability(options: PlatformOptions): void {
|
|
81
|
+
if (!options.plugins) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const protocols = (options.transports ?? []).map((x) => x.getProtocol());
|
|
85
|
+
|
|
86
|
+
for (const plugin of options.plugins) {
|
|
87
|
+
if (!hasSpecifiedTransports(plugin)) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (intersection(plugin.forTransports(), protocols).length === 0) {
|
|
92
|
+
throw new NoMatchingTransportException(plugin);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private static assertTransportCompatability(options: PlatformOptions): void {
|
|
98
|
+
const grouped = groupBy(options.transports, (x) => x.getProtocol());
|
|
99
|
+
|
|
100
|
+
for (const [protocol, implementations] of Object.entries(grouped)) {
|
|
101
|
+
if (implementations.length > 1) {
|
|
102
|
+
throw new DuplicateProtocolException(protocol, implementations.length);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get all important information about PlatformApp instance
|
|
109
|
+
* @returns Readonly metadata
|
|
110
|
+
*/
|
|
111
|
+
getMetadata(): Readonly<PlatformAppMetadata> {
|
|
112
|
+
const confMetadata = ConfigMetadataRegistry.getMetadata();
|
|
113
|
+
const options = this.extendedOptions;
|
|
114
|
+
const protocols = (options?.transports ?? []).map((x) => x.getProtocol());
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
name: options.name,
|
|
118
|
+
|
|
119
|
+
description: options.description,
|
|
120
|
+
protocols: protocols,
|
|
121
|
+
|
|
122
|
+
config: {
|
|
123
|
+
prefix: options.name,
|
|
124
|
+
sections: [...confMetadata.sections.values()].map(
|
|
125
|
+
transformSectionMetadata,
|
|
126
|
+
),
|
|
127
|
+
sources: [...confMetadata.sources.values()],
|
|
128
|
+
|
|
129
|
+
properties: [...confMetadata.properties.values()].map(
|
|
130
|
+
serializePropertyMetadata,
|
|
131
|
+
),
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Сделано прежде всего для совместимости с тестами.
|
|
138
|
+
* Производит все необходимые проверки и инициализации транспортов, не запускает приложение
|
|
139
|
+
*/
|
|
140
|
+
async configureApp(app: INestApplication): Promise<void> {
|
|
141
|
+
const awaiter = this.httpTransport?.configure(app);
|
|
142
|
+
if (awaiter instanceof Promise) {
|
|
143
|
+
await awaiter;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
app.enableShutdownHooks();
|
|
147
|
+
|
|
148
|
+
this.microservices = new Map<INestMicroservice, IMicroserviceTransport>();
|
|
149
|
+
|
|
150
|
+
const transports = this.options.transports ?? ([] as any[]);
|
|
151
|
+
|
|
152
|
+
for (const transport of transports.filter(isMicroserviceTransport)) {
|
|
153
|
+
transport.init();
|
|
154
|
+
|
|
155
|
+
const options = transport.createMicroserviceOptions();
|
|
156
|
+
const microservice = app.connectMicroservice(options, {
|
|
157
|
+
inheritAppConfig: true,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
this.microservices.set(microservice, transport);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Сделано прежде всего для совместимости с тестами
|
|
166
|
+
* @param app просто запускает приложение (не применяет никакую конфигурацию)
|
|
167
|
+
*/
|
|
168
|
+
async runConfiguredApplication(app: INestApplication): Promise<void> {
|
|
169
|
+
try {
|
|
170
|
+
this.logger.info('Mapping controllers...');
|
|
171
|
+
if (this.httpTransport) {
|
|
172
|
+
const { host, port } = this.httpTransport.createHttpOptions();
|
|
173
|
+
|
|
174
|
+
await app.listen(port, host, () =>
|
|
175
|
+
this.logger.info(`Http server started on ${host}:${port}`),
|
|
176
|
+
);
|
|
177
|
+
} else {
|
|
178
|
+
await app.init();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (this.microservices.size > 0) {
|
|
182
|
+
for (const [microservice, transport] of this.microservices) {
|
|
183
|
+
await microservice.listen();
|
|
184
|
+
transport.onStart();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} catch (err) {
|
|
188
|
+
this.logger.fatal(err as Error);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Возвращает аргументы для `createNestApplication`.
|
|
195
|
+
* Немедленно возникает вопрос, а почему бы не просто `createNestApplication`
|
|
196
|
+
* Ответ: Потому что как минимум в тестах приложение создаётся хитрым способом не поддающемуся логике с точки зрения последовательности решений
|
|
197
|
+
*
|
|
198
|
+
* testingModuleRef.createApplication(...context.getNestFactoryCreateOptions())
|
|
199
|
+
* NestFactory.create(context.root, ...context.getNestFactoryCreateOptions())
|
|
200
|
+
*/
|
|
201
|
+
getNestFactoryCreateOptions(): [
|
|
202
|
+
httpAdapter: AbstractHttpAdapter,
|
|
203
|
+
options?: NestApplicationOptions,
|
|
204
|
+
] {
|
|
205
|
+
return [
|
|
206
|
+
this.httpAdapter,
|
|
207
|
+
{
|
|
208
|
+
// Leave body parser configuration to httpTransport implementation
|
|
209
|
+
bodyParser: false,
|
|
210
|
+
logger: new NestLoggerAdapter(this.logger),
|
|
211
|
+
},
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
}
|