@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,88 @@
|
|
|
1
|
+
import type { ArgumentsHost } from '@nestjs/common';
|
|
2
|
+
import type { EMPTY, Observable } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
import type { PipelineException } from '../exceptions/base';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Errors formatter is used to map transport-agnostic
|
|
8
|
+
* buisiness exception to transport-specific on (with appropriate
|
|
9
|
+
* status code and other attributes)
|
|
10
|
+
*
|
|
11
|
+
* @implementme Implement this interface if you need to create a
|
|
12
|
+
* custom transport.
|
|
13
|
+
*/
|
|
14
|
+
export interface IErrorsFormatter {
|
|
15
|
+
/**
|
|
16
|
+
* Matcher returns true if exception should be processed with
|
|
17
|
+
* this formatter. Most common use is match by context type.
|
|
18
|
+
*
|
|
19
|
+
* @param host ArgumentsHost - nest.js wrapper over request context
|
|
20
|
+
* @param exception Exception itself
|
|
21
|
+
*/
|
|
22
|
+
match(host: ArgumentsHost, exception?: unknown): boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Formatting algorithm that should match received exception with
|
|
26
|
+
* transport-specific one and map one into another.
|
|
27
|
+
*
|
|
28
|
+
* @param exception Exception itself
|
|
29
|
+
* @param verbose True - means that all exception data can be exposed
|
|
30
|
+
* in response. False - indicates that service is probably working in
|
|
31
|
+
* production and all extra data shouldn't be sent back to client.
|
|
32
|
+
*/
|
|
33
|
+
format(exception: unknown, verbose: boolean): unknown;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Different transports need to return errors in different ways.
|
|
38
|
+
*
|
|
39
|
+
* @implementme
|
|
40
|
+
*/
|
|
41
|
+
export interface IErrorsSender {
|
|
42
|
+
/**
|
|
43
|
+
* Matcher returns true if exception should be processed with
|
|
44
|
+
* this formatter. Most common use is match by context type.
|
|
45
|
+
*
|
|
46
|
+
* @param host ArgumentsHost - nest.js wrapper over request context
|
|
47
|
+
*/
|
|
48
|
+
match(host: ArgumentsHost): boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Implementation of sending error back to the client
|
|
52
|
+
*
|
|
53
|
+
* @param host ArgumentsHost - nest.js wrapper over request context
|
|
54
|
+
* @param exception Exception itself
|
|
55
|
+
*/
|
|
56
|
+
send(host: ArgumentsHost, ex: unknown): Observable<any> | typeof EMPTY;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Not all exceptions that can be thrown when handling request
|
|
61
|
+
* are created in application code. And library authors have no
|
|
62
|
+
* idea about PipelineExceptions and our conventions. Hence they
|
|
63
|
+
* throw their own errors of any possible type.
|
|
64
|
+
*
|
|
65
|
+
* Aim of transformers is to catch those "unconventional" errors and
|
|
66
|
+
* map them into instances of PipelineException which then will be
|
|
67
|
+
* mapped correctly to responses.
|
|
68
|
+
*
|
|
69
|
+
* @implementme Implement this interface if you use some library that
|
|
70
|
+
* can throw (let's say axios) and don't want to wrap each call of this
|
|
71
|
+
* library into try/catch block
|
|
72
|
+
*/
|
|
73
|
+
export interface IErrorsTransformer {
|
|
74
|
+
/**
|
|
75
|
+
* Matcher returns true if exception should be processed with
|
|
76
|
+
* this transformer
|
|
77
|
+
*
|
|
78
|
+
* @param ex Exception to transform
|
|
79
|
+
*/
|
|
80
|
+
match(ex: any): boolean;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Transformating algorithm
|
|
84
|
+
*
|
|
85
|
+
* @param ex Exception itself
|
|
86
|
+
*/
|
|
87
|
+
transform(ex: any): PipelineException;
|
|
88
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exception, ExceptionKind, PipelineException } from '../../exceptions';
|
|
2
|
+
import type { CheckResult } from '../helpers';
|
|
3
|
+
|
|
4
|
+
@Exception({ description: 'Service is unavailable' })
|
|
5
|
+
export class HealthCheckException extends PipelineException {
|
|
6
|
+
constructor(details: Record<string, CheckResult>) {
|
|
7
|
+
super(ExceptionKind.UNAVAILABLE, 'Health check failed!', { details });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './health-check.exception';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { Module } from '@nestjs/common';
|
|
3
|
+
|
|
4
|
+
import { MODULE_OPTIONS } from './health.const';
|
|
5
|
+
import { HealthChecksService } from './health.service';
|
|
6
|
+
import type { HealthModuleOptions } from './types';
|
|
7
|
+
|
|
8
|
+
@Module({})
|
|
9
|
+
export class HealthModule {
|
|
10
|
+
static forRoot(options: HealthModuleOptions): DynamicModule {
|
|
11
|
+
return {
|
|
12
|
+
controllers: [...options.controllers],
|
|
13
|
+
module: HealthModule,
|
|
14
|
+
providers: [
|
|
15
|
+
HealthChecksService,
|
|
16
|
+
{
|
|
17
|
+
provide: MODULE_OPTIONS,
|
|
18
|
+
useValue: options,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { ModuleRef } from '@nestjs/core';
|
|
3
|
+
import type { Constructor } from '@rsdk/common';
|
|
4
|
+
import { LogTime } from '@rsdk/decorators';
|
|
5
|
+
import { ILogger } from '@rsdk/logging';
|
|
6
|
+
|
|
7
|
+
import { InjectLogger } from '../logging';
|
|
8
|
+
|
|
9
|
+
import { HealthCheckException } from './exceptions';
|
|
10
|
+
import { IndicatorsRegistry } from './metadata';
|
|
11
|
+
import type {
|
|
12
|
+
CheckSummary,
|
|
13
|
+
HealthIndicator,
|
|
14
|
+
ResolvedIndicators,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
@Injectable()
|
|
18
|
+
export class HealthChecksService {
|
|
19
|
+
private readonly indicators: ResolvedIndicators = { common: [] };
|
|
20
|
+
private readonly indicatorNames = new Map<HealthIndicator, string>();
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
@InjectLogger(HealthChecksService) private readonly logger: ILogger,
|
|
24
|
+
private readonly moduleRef: ModuleRef,
|
|
25
|
+
) {}
|
|
26
|
+
|
|
27
|
+
@LogTime()
|
|
28
|
+
async check(filter?: '*' | string): Promise<CheckSummary> {
|
|
29
|
+
this.logger.info('Checking health', { filter });
|
|
30
|
+
|
|
31
|
+
const indicators = this.filterIndicators(filter);
|
|
32
|
+
|
|
33
|
+
let success = true;
|
|
34
|
+
const summary: CheckSummary = { details: {}, status: 'up' };
|
|
35
|
+
|
|
36
|
+
await Promise.all(
|
|
37
|
+
indicators.map(async (indicator) => {
|
|
38
|
+
const name = this.indicatorNames.get(indicator);
|
|
39
|
+
if (!name) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Indicator [${indicator.constructor.name}] - name not found`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const result = await indicator.check();
|
|
47
|
+
if (result.isError) {
|
|
48
|
+
success = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
summary.details[name] = result;
|
|
52
|
+
} catch (err) {
|
|
53
|
+
success = false;
|
|
54
|
+
summary.details[name] = err as any;
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (!success) {
|
|
60
|
+
throw new HealthCheckException(summary.details);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return summary;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async onModuleInit(): Promise<void> {
|
|
67
|
+
this.logger.debug('Initializing indicators...');
|
|
68
|
+
|
|
69
|
+
for (const [ctor, { key, scope }] of IndicatorsRegistry.entries()) {
|
|
70
|
+
if (!this.indicators[scope]) {
|
|
71
|
+
this.indicators[scope] = [];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const [instance] = this.resolve([ctor]);
|
|
75
|
+
|
|
76
|
+
this.indicatorNames.set(instance, key);
|
|
77
|
+
this.indicators[scope].push(instance);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.logger.info(`Indicators initialized!`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private filterIndicators(filter: '*' | string = ''): HealthIndicator[] {
|
|
84
|
+
switch (filter) {
|
|
85
|
+
/**
|
|
86
|
+
* This means readiness healthcheck which means that server itself is up,
|
|
87
|
+
* but doesn't guarantee that it is ready to serve.
|
|
88
|
+
*/
|
|
89
|
+
case '':
|
|
90
|
+
return [];
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* This means - "perform all checks you have"
|
|
94
|
+
*/
|
|
95
|
+
case '*':
|
|
96
|
+
return [...this.indicators.common];
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Matching exact filter. If no specific checks
|
|
100
|
+
* found - common checks will be performed
|
|
101
|
+
*/
|
|
102
|
+
default: {
|
|
103
|
+
const specific = this.indicators[filter];
|
|
104
|
+
|
|
105
|
+
if (!specific || specific.length === 0) {
|
|
106
|
+
this.logger.warn(`Unsupported healthcheck filter: ${filter}`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return [...this.indicators.common, ...(specific || [])];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private resolve(
|
|
115
|
+
indicators: Readonly<Constructor<HealthIndicator>[]>,
|
|
116
|
+
): HealthIndicator[] {
|
|
117
|
+
return indicators.map((x) => {
|
|
118
|
+
if (typeof x !== 'function') {
|
|
119
|
+
return x;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return this.moduleRef.get(x, { strict: false });
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type CheckStatus = 'up' | 'down';
|
|
2
|
+
export type CheckDetails = Record<string, unknown>;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Check result is an outcome for a check. It is
|
|
6
|
+
* a little specialized version of classical Result
|
|
7
|
+
* abstraction with error and data
|
|
8
|
+
*/
|
|
9
|
+
export class CheckResult {
|
|
10
|
+
/**
|
|
11
|
+
* Check status
|
|
12
|
+
*/
|
|
13
|
+
readonly status: CheckStatus;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @optional Custom attributes (key value) Will
|
|
17
|
+
* be returned to check caller or/and logged
|
|
18
|
+
*/
|
|
19
|
+
readonly details?: CheckDetails;
|
|
20
|
+
|
|
21
|
+
private constructor(status: CheckStatus, details: CheckDetails) {
|
|
22
|
+
this.status = status;
|
|
23
|
+
this.details = details;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Indicated that check was not successful
|
|
28
|
+
*/
|
|
29
|
+
get isError(): boolean {
|
|
30
|
+
return this.status === 'down';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates successful CheckResult
|
|
35
|
+
*
|
|
36
|
+
* @param details Any custom attributes
|
|
37
|
+
* @returns CheckResult
|
|
38
|
+
*/
|
|
39
|
+
static up(details: CheckDetails): CheckResult {
|
|
40
|
+
return new CheckResult('up', details);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates failed CheckResult
|
|
45
|
+
*
|
|
46
|
+
* @param details Any custom attributes
|
|
47
|
+
* @returns CheckResult
|
|
48
|
+
*/
|
|
49
|
+
static down(details: CheckDetails): CheckResult {
|
|
50
|
+
return new CheckResult('down', details);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './check-result.class';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { access } from 'fs';
|
|
2
|
+
|
|
3
|
+
import { CheckResult } from '../helpers';
|
|
4
|
+
import type { HealthIndicator } from '../types';
|
|
5
|
+
|
|
6
|
+
export interface FileSystemCheckOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Absolute path to file or directory
|
|
9
|
+
*/
|
|
10
|
+
path: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Access mode (see fs.access docs on nodejs website)
|
|
14
|
+
*/
|
|
15
|
+
mode?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* FileSystemIndicator checks if specified file or directory
|
|
20
|
+
* exists and is accessible to the application
|
|
21
|
+
*
|
|
22
|
+
* TODO: Need to be tested! Especially modes.
|
|
23
|
+
*/
|
|
24
|
+
export abstract class FileSystemIndicator implements HealthIndicator {
|
|
25
|
+
private path: string;
|
|
26
|
+
private mode: number | undefined;
|
|
27
|
+
|
|
28
|
+
constructor(options: FileSystemCheckOptions) {
|
|
29
|
+
this.path = options.path;
|
|
30
|
+
this.mode = options.mode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Проверяет, существует ли файл и есть ли к нему доступ
|
|
35
|
+
*/
|
|
36
|
+
check(): Promise<CheckResult> {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
access(this.path, this.mode, (error) => {
|
|
39
|
+
if (!error) {
|
|
40
|
+
resolve(CheckResult.up({ path: this.path }));
|
|
41
|
+
} else {
|
|
42
|
+
reject({ error });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ILogger } from '@rsdk/logging';
|
|
2
|
+
|
|
3
|
+
import { InternalException } from '../../exceptions';
|
|
4
|
+
import type { CheckResult } from '../helpers';
|
|
5
|
+
import type { HealthIndicator } from '../types';
|
|
6
|
+
|
|
7
|
+
export interface PingCheckOptions {
|
|
8
|
+
/**
|
|
9
|
+
* URI of external resource
|
|
10
|
+
*/
|
|
11
|
+
url: URL;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* PingIndicator is meant to check access to some network
|
|
16
|
+
* resource.
|
|
17
|
+
*
|
|
18
|
+
* @attention NOT IMPLEMENTED
|
|
19
|
+
*/
|
|
20
|
+
export abstract class PingIndicator implements HealthIndicator {
|
|
21
|
+
private readonly url: URL;
|
|
22
|
+
|
|
23
|
+
constructor(protected logger: ILogger, options: PingCheckOptions) {
|
|
24
|
+
this.url = options.url;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async check(): Promise<CheckResult> {
|
|
28
|
+
this.logger.info('Url to be checked', { url: this.url });
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* TODO: Implement this. How? Probably caller should
|
|
32
|
+
* specify strategy protocol to use
|
|
33
|
+
*/
|
|
34
|
+
throw new InternalException('Ping check is yet to be implemented!');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
|
|
3
|
+
import type { Constructor } from '@rsdk/common';
|
|
4
|
+
|
|
5
|
+
import type { HealthIndicator } from '../types';
|
|
6
|
+
|
|
7
|
+
import { IndicatorsRegistry } from './indicators.registry';
|
|
8
|
+
|
|
9
|
+
export interface IndicatorOptions {
|
|
10
|
+
description?: string;
|
|
11
|
+
scope?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Indicator = (
|
|
15
|
+
key: string,
|
|
16
|
+
options: IndicatorOptions = {},
|
|
17
|
+
): ClassDecorator => {
|
|
18
|
+
return function (target: Function): void {
|
|
19
|
+
IndicatorsRegistry.register(target as Constructor<HealthIndicator>, {
|
|
20
|
+
key,
|
|
21
|
+
scope: 'common',
|
|
22
|
+
...options,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Constructor } from '@rsdk/common';
|
|
2
|
+
import { LoggerFactory } from '@rsdk/logging';
|
|
3
|
+
|
|
4
|
+
import { DoubleInitException } from '../../exceptions';
|
|
5
|
+
import type { HealthIndicator, IndicatorMetadata } from '../types';
|
|
6
|
+
|
|
7
|
+
export class IndicatorsRegistry {
|
|
8
|
+
private static logger = LoggerFactory.create('IndicatorsRegistry');
|
|
9
|
+
private static indicators = new Map<
|
|
10
|
+
Constructor<HealthIndicator>,
|
|
11
|
+
IndicatorMetadata
|
|
12
|
+
>();
|
|
13
|
+
|
|
14
|
+
static isRegistered(ctor: Constructor<HealthIndicator>): boolean {
|
|
15
|
+
return this.indicators.has(ctor);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static register(
|
|
19
|
+
target: Constructor<HealthIndicator>,
|
|
20
|
+
options: IndicatorMetadata,
|
|
21
|
+
): void {
|
|
22
|
+
if (this.indicators.has(target)) {
|
|
23
|
+
throw new DoubleInitException('Health indicator', target.name);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.logger.info(`Registering indicator: ${target.name}`, {
|
|
27
|
+
indicator: target.name,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
this.indicators.set(target, options);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static entries(): Iterable<
|
|
34
|
+
[Constructor<HealthIndicator>, IndicatorMetadata]
|
|
35
|
+
> {
|
|
36
|
+
return this.indicators.entries();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Controller } from '@nestjs/common/interfaces';
|
|
2
|
+
import type { Constructor } from '@rsdk/common';
|
|
3
|
+
|
|
4
|
+
import type { CheckResult } from './helpers';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Summary for a number of **successful** checks
|
|
8
|
+
*/
|
|
9
|
+
export interface CheckSummary {
|
|
10
|
+
/**
|
|
11
|
+
* Overral check status
|
|
12
|
+
*
|
|
13
|
+
* NOTE: If some checks fail an exception will be thrown.
|
|
14
|
+
* So 'down' will never be returned.
|
|
15
|
+
*/
|
|
16
|
+
status: 'up';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @keys indicator keys
|
|
20
|
+
* @values check result for respective indicator
|
|
21
|
+
*/
|
|
22
|
+
details: Record<string, CheckResult>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* To create indicator with any custom logic
|
|
27
|
+
* just implement this interface
|
|
28
|
+
*/
|
|
29
|
+
export interface HealthIndicator {
|
|
30
|
+
/**
|
|
31
|
+
* Actual check method.
|
|
32
|
+
*
|
|
33
|
+
* @returns CheckResult
|
|
34
|
+
*/
|
|
35
|
+
check(): Promise<CheckResult>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ResolvedIndicators = {
|
|
39
|
+
[key: string]: HealthIndicator[];
|
|
40
|
+
} & { common: HealthIndicator[] };
|
|
41
|
+
|
|
42
|
+
export interface HealthModuleOptions {
|
|
43
|
+
controllers: Constructor<Controller>[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface IndicatorMetadata {
|
|
47
|
+
key: string;
|
|
48
|
+
scope: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { PlatformContext } from './platform.context';
|
|
2
|
+
|
|
3
|
+
export * from './config';
|
|
4
|
+
export * from './exceptions';
|
|
5
|
+
export * from './exceptions.handling';
|
|
6
|
+
export {
|
|
7
|
+
// TODO: Продолжить документирование отсюда
|
|
8
|
+
HealthIndicator,
|
|
9
|
+
FileSystemIndicator,
|
|
10
|
+
FileSystemCheckOptions,
|
|
11
|
+
PingIndicator,
|
|
12
|
+
PingCheckOptions,
|
|
13
|
+
HealthChecksService,
|
|
14
|
+
CheckSummary,
|
|
15
|
+
Indicator,
|
|
16
|
+
CheckResult,
|
|
17
|
+
} from './health';
|
|
18
|
+
export { InjectLogger } from './logging';
|
|
19
|
+
export {
|
|
20
|
+
AnyMetric,
|
|
21
|
+
Counter,
|
|
22
|
+
Gauge,
|
|
23
|
+
Histogram,
|
|
24
|
+
Summary,
|
|
25
|
+
Metric,
|
|
26
|
+
MetricsModule,
|
|
27
|
+
register,
|
|
28
|
+
} from './metrics';
|
|
29
|
+
export { PlatformApp } from './app/platform.app';
|
|
30
|
+
export * from './types';
|
|
31
|
+
export * from './app-metadata/decorators';
|
|
32
|
+
export * from './app-metadata/app-metadata.const';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './nest-logger.adapter';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
|
|
3
|
+
import type { LoggerService } from '@nestjs/common';
|
|
4
|
+
import type { ILogger } from '@rsdk/logging';
|
|
5
|
+
|
|
6
|
+
export class NestLoggerAdapter implements LoggerService {
|
|
7
|
+
constructor(private readonly logger: ILogger) {}
|
|
8
|
+
|
|
9
|
+
error(message: unknown, trace?: string, _context?: string): void {
|
|
10
|
+
this.logger.error(Object.assign(new Error(message as string), { trace }));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
log(message: unknown, _context?: string): void {
|
|
14
|
+
this.logger.info(message as string);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
warn(message: unknown, _context?: string): void {
|
|
18
|
+
this.logger.warn(message as string);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
debug(message: unknown, _context?: string): void {
|
|
22
|
+
this.logger.debug(message as string);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
verbose(message: unknown, _context?: string): void {
|
|
26
|
+
this.logger.trace(message as string);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// private parseMessage (message: unknown): string {
|
|
30
|
+
// return typeof message === 'string' ? message : stringifyObject(message);
|
|
31
|
+
// }
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './inject-logger.decorator';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Inject } from '@nestjs/common';
|
|
2
|
+
import type { Constructor } from '@rsdk/common';
|
|
3
|
+
|
|
4
|
+
import { getLoggerToken } from '../helpers';
|
|
5
|
+
import { LoggingModule } from '../logging.module';
|
|
6
|
+
|
|
7
|
+
export const InjectLogger = (
|
|
8
|
+
context: string | Constructor,
|
|
9
|
+
): ParameterDecorator => {
|
|
10
|
+
const token = getLoggerToken(context);
|
|
11
|
+
|
|
12
|
+
LoggingModule.register(context, token);
|
|
13
|
+
|
|
14
|
+
return Inject(token);
|
|
15
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LogLevel } from '@rsdk/logging';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ArrayParser,
|
|
5
|
+
Config,
|
|
6
|
+
ConfigSection,
|
|
7
|
+
EnumParser,
|
|
8
|
+
Property,
|
|
9
|
+
StringParser,
|
|
10
|
+
} from '../config';
|
|
11
|
+
|
|
12
|
+
@ConfigSection()
|
|
13
|
+
export class LoggingConfig extends Config {
|
|
14
|
+
@Property('LOG_LEVEL', new EnumParser(LogLevel), {
|
|
15
|
+
// TODO: Can pass anything instead of enum value. Need to handle this!
|
|
16
|
+
defaultValue: LogLevel.debug,
|
|
17
|
+
description: 'Log level',
|
|
18
|
+
})
|
|
19
|
+
readonly level!: LogLevel;
|
|
20
|
+
|
|
21
|
+
@Property('LOG_REDACT', new ArrayParser(new StringParser()), {
|
|
22
|
+
defaultValue: [],
|
|
23
|
+
description: 'Log level',
|
|
24
|
+
})
|
|
25
|
+
readonly redact!: string[];
|
|
26
|
+
}
|