@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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./exception.decorator"), exports);
|
|
18
|
+
__exportStar(require("./throws.decorator"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/exceptions/metadata/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,qDAAmC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Throws = void 0;
|
|
4
|
+
const logging_1 = require("@rsdk/logging");
|
|
5
|
+
const exceptions_registry_1 = require("../exceptions.registry");
|
|
6
|
+
const logger = logging_1.LoggerFactory.create('ExceptionsRegistry');
|
|
7
|
+
const Throws = (...ex) => {
|
|
8
|
+
return function (ctor, methodName) {
|
|
9
|
+
logger.debug(`Method ${ctor.constructor.name}.${methodName.toString()} throws: ${ex
|
|
10
|
+
.map((x) => x.name)
|
|
11
|
+
.join(', ')}`);
|
|
12
|
+
exceptions_registry_1.ExceptionsRegistry.getInstance().register({
|
|
13
|
+
class: ctor.constructor,
|
|
14
|
+
exceptions: ex,
|
|
15
|
+
method: methodName.toString(),
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.Throws = Throws;
|
|
20
|
+
//# sourceMappingURL=throws.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throws.decorator.js","sourceRoot":"","sources":["../../../../src/exceptions/metadata/decorators/throws.decorator.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAG9C,gEAA4D;AAE5D,MAAM,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAEnD,MAAM,MAAM,GAAG,CACpB,GAAG,EAAoC,EACtB,EAAE;IACnB,OAAO,UAAU,IAAY,EAAE,UAA2B;QACxD,MAAM,CAAC,KAAK,CACV,UAAU,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE;aACnE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;aAClB,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;QAEF,wCAAkB,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;YACxC,KAAK,EAAE,IAAI,CAAC,WAAW;YACvB,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE;SAC9B,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,MAAM,UAgBjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Constructor } from '@rsdk/common';
|
|
2
|
+
import type { PipelineException } from '../base';
|
|
3
|
+
export interface ExceptionMetadata {
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ThrowsMetadata {
|
|
7
|
+
class: Function;
|
|
8
|
+
method: string;
|
|
9
|
+
exceptions: Constructor<PipelineException>[];
|
|
10
|
+
}
|
|
11
|
+
export declare class ExceptionsRegistry {
|
|
12
|
+
private static _instance;
|
|
13
|
+
private exceptions;
|
|
14
|
+
private throws;
|
|
15
|
+
private constructor();
|
|
16
|
+
static getInstance(): ExceptionsRegistry;
|
|
17
|
+
register(meta: ThrowsMetadata): void;
|
|
18
|
+
register(meta: ExceptionMetadata): void;
|
|
19
|
+
getAll(): {
|
|
20
|
+
exceptions: ExceptionMetadata[];
|
|
21
|
+
throws: ThrowsMetadata[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExceptionsRegistry = void 0;
|
|
4
|
+
const isExceptionMeta = (arg) => !!arg.description;
|
|
5
|
+
class ExceptionsRegistry {
|
|
6
|
+
static _instance;
|
|
7
|
+
exceptions = [];
|
|
8
|
+
throws = [];
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
10
|
+
constructor() { }
|
|
11
|
+
static getInstance() {
|
|
12
|
+
if (!this._instance) {
|
|
13
|
+
this._instance = new ExceptionsRegistry();
|
|
14
|
+
}
|
|
15
|
+
return this._instance;
|
|
16
|
+
}
|
|
17
|
+
register(meta) {
|
|
18
|
+
if (isExceptionMeta(meta)) {
|
|
19
|
+
this.exceptions.push(meta);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.throws.push(meta);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
getAll() {
|
|
26
|
+
return { exceptions: this.exceptions, throws: this.throws };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ExceptionsRegistry = ExceptionsRegistry;
|
|
30
|
+
//# sourceMappingURL=exceptions.registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.registry.js","sourceRoot":"","sources":["../../../src/exceptions/metadata/exceptions.registry.ts"],"names":[],"mappings":";;;AAeA,MAAM,eAAe,GAAG,CACtB,GAAuC,EACb,EAAE,CAAC,CAAC,CAAE,GAAW,CAAC,WAAW,CAAC;AAE1D,MAAa,kBAAkB;IACrB,MAAM,CAAC,SAAS,CAAqB;IAErC,UAAU,GAAwB,EAAE,CAAC;IACrC,MAAM,GAAqB,EAAE,CAAC;IAEtC,gEAAgE;IAChE,gBAAuB,CAAC;IAExB,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,kBAAkB,EAAE,CAAC;SAC3C;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAID,QAAQ,CAAC,IAAwC;QAC/C,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;YACzB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC5B;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACxB;IACH,CAAC;IAED,MAAM;QACJ,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC9D,CAAC;CACF;AA9BD,gDA8BC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./decorators"), exports);
|
|
18
|
+
__exportStar(require("./exceptions.registry"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exceptions/metadata/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,wDAAsC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kind helps exception handlers to map exception
|
|
3
|
+
* to transport-specific one. For example InputException
|
|
4
|
+
* probably will result 400 HTTP status, while InternalException
|
|
5
|
+
* - 500
|
|
6
|
+
*/
|
|
7
|
+
export declare enum ExceptionKind {
|
|
8
|
+
INPUT = 0,
|
|
9
|
+
CONFLICT = 1,
|
|
10
|
+
DUPLICATION = 2,
|
|
11
|
+
AUTHENTICATION = 3,
|
|
12
|
+
NOT_ALLOWED = 4,
|
|
13
|
+
NOT_FOUND = 5,
|
|
14
|
+
INTERNAL = 6,
|
|
15
|
+
TIMEOUT = 7,
|
|
16
|
+
UNAVAILABLE = 8,
|
|
17
|
+
UNKNOWN = 9
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExceptionKind = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Kind helps exception handlers to map exception
|
|
6
|
+
* to transport-specific one. For example InputException
|
|
7
|
+
* probably will result 400 HTTP status, while InternalException
|
|
8
|
+
* - 500
|
|
9
|
+
*/
|
|
10
|
+
var ExceptionKind;
|
|
11
|
+
(function (ExceptionKind) {
|
|
12
|
+
ExceptionKind[ExceptionKind["INPUT"] = 0] = "INPUT";
|
|
13
|
+
ExceptionKind[ExceptionKind["CONFLICT"] = 1] = "CONFLICT";
|
|
14
|
+
ExceptionKind[ExceptionKind["DUPLICATION"] = 2] = "DUPLICATION";
|
|
15
|
+
ExceptionKind[ExceptionKind["AUTHENTICATION"] = 3] = "AUTHENTICATION";
|
|
16
|
+
ExceptionKind[ExceptionKind["NOT_ALLOWED"] = 4] = "NOT_ALLOWED";
|
|
17
|
+
ExceptionKind[ExceptionKind["NOT_FOUND"] = 5] = "NOT_FOUND";
|
|
18
|
+
ExceptionKind[ExceptionKind["INTERNAL"] = 6] = "INTERNAL";
|
|
19
|
+
ExceptionKind[ExceptionKind["TIMEOUT"] = 7] = "TIMEOUT";
|
|
20
|
+
ExceptionKind[ExceptionKind["UNAVAILABLE"] = 8] = "UNAVAILABLE";
|
|
21
|
+
ExceptionKind[ExceptionKind["UNKNOWN"] = 9] = "UNKNOWN";
|
|
22
|
+
})(ExceptionKind = exports.ExceptionKind || (exports.ExceptionKind = {}));
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/exceptions/types.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,aAWX;AAXD,WAAY,aAAa;IACvB,mDAAS,CAAA;IACT,yDAAY,CAAA;IACZ,+DAAe,CAAA;IACf,qEAAkB,CAAA;IAClB,+DAAe,CAAA;IACf,2DAAa,CAAA;IACb,yDAAY,CAAA;IACZ,uDAAW,CAAA;IACX,+DAAe,CAAA;IACf,uDAAW,CAAA;AACb,CAAC,EAXW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAWxB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidateException = void 0;
|
|
4
|
+
const implementations_1 = require("../implementations");
|
|
5
|
+
class ValidateException extends implementations_1.InputException {
|
|
6
|
+
constructor(details) {
|
|
7
|
+
super('Validation failed', {
|
|
8
|
+
details,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.ValidateException = ValidateException;
|
|
13
|
+
//# sourceMappingURL=exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../../../src/exceptions/validation/exception.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AAEpD,MAAa,iBAAkB,SAAQ,gCAAc;IACnD,YAAY,OAAgB;QAC1B,KAAK,CAAC,mBAAmB,EAAE;YACzB,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF;AAND,8CAMC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SENDERS = exports.TRANSFORMERS = exports.FORMATTERS = void 0;
|
|
4
|
+
exports.FORMATTERS = Symbol('FORMATTERS_TOKEN');
|
|
5
|
+
exports.TRANSFORMERS = Symbol('TRANSFORMERS_TOKEN');
|
|
6
|
+
exports.SENDERS = Symbol('SENDERS_TOKEN');
|
|
7
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/exceptions.handling/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AACxC,QAAA,YAAY,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAC5C,QAAA,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GlobalExceptionsConfig = void 0;
|
|
13
|
+
const common_1 = require("@rsdk/common");
|
|
14
|
+
const config_1 = require("../config");
|
|
15
|
+
let GlobalExceptionsConfig = class GlobalExceptionsConfig extends config_1.Config {
|
|
16
|
+
verbose;
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, config_1.Property)('VERBOSE_ERRORS', new config_1.BoolParser(), {
|
|
20
|
+
defaultValue: true,
|
|
21
|
+
description: (0, common_1.text) `
|
|
22
|
+
If set "true" all exception messages will be returned to client.
|
|
23
|
+
If false, only 4XX will contain messages, others - just status codes.
|
|
24
|
+
`,
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Boolean)
|
|
27
|
+
], GlobalExceptionsConfig.prototype, "verbose", void 0);
|
|
28
|
+
GlobalExceptionsConfig = __decorate([
|
|
29
|
+
(0, config_1.ConfigSection)()
|
|
30
|
+
], GlobalExceptionsConfig);
|
|
31
|
+
exports.GlobalExceptionsConfig = GlobalExceptionsConfig;
|
|
32
|
+
//# sourceMappingURL=global-exceptions.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-exceptions.config.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AAEpC,sCAAwE;AAGjE,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,eAAM;IAQvC,OAAO,CAAW;CAC5B,CAAA;AARC;IAAC,IAAA,iBAAQ,EAAC,gBAAgB,EAAE,IAAI,mBAAU,EAAE,EAAE;QAC5C,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,IAAA,aAAI,EAAA;;;KAGhB;KACF,CAAC;;uDACyB;AARhB,sBAAsB;IADlC,IAAA,sBAAa,GAAE;GACH,sBAAsB,CASlC;AATY,wDAAsB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ArgumentsHost, ExceptionFilter } from '@nestjs/common';
|
|
2
|
+
import { ILogger } from '@rsdk/logging';
|
|
3
|
+
import type { Observable } from 'rxjs';
|
|
4
|
+
import { GlobalExceptionsConfig } from './global-exceptions.config';
|
|
5
|
+
import type { IErrorsFormatter, IErrorsSender, IErrorsTransformer } from './types';
|
|
6
|
+
export declare class GlobalExceptionsFilter implements ExceptionFilter {
|
|
7
|
+
private readonly formatters;
|
|
8
|
+
private readonly transformers;
|
|
9
|
+
private readonly senders;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
private readonly config;
|
|
12
|
+
constructor(formatters: IErrorsFormatter[], transformers: IErrorsTransformer[], senders: IErrorsSender[], logger: ILogger, config: GlobalExceptionsConfig);
|
|
13
|
+
catch(ex: any, host: ArgumentsHost): Observable<any>;
|
|
14
|
+
private transform;
|
|
15
|
+
private format;
|
|
16
|
+
private send;
|
|
17
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var GlobalExceptionsFilter_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.GlobalExceptionsFilter = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const common_2 = require("@rsdk/common");
|
|
19
|
+
const rxjs_1 = require("rxjs");
|
|
20
|
+
const exceptions_1 = require("../exceptions");
|
|
21
|
+
const logging_1 = require("../logging");
|
|
22
|
+
const constants_1 = require("./constants");
|
|
23
|
+
const global_exceptions_config_1 = require("./global-exceptions.config");
|
|
24
|
+
let GlobalExceptionsFilter = GlobalExceptionsFilter_1 = class GlobalExceptionsFilter {
|
|
25
|
+
formatters;
|
|
26
|
+
transformers;
|
|
27
|
+
senders;
|
|
28
|
+
logger;
|
|
29
|
+
config;
|
|
30
|
+
constructor(formatters, transformers, senders, logger, config) {
|
|
31
|
+
this.formatters = formatters;
|
|
32
|
+
this.transformers = transformers;
|
|
33
|
+
this.senders = senders;
|
|
34
|
+
this.logger = logger;
|
|
35
|
+
this.config = config;
|
|
36
|
+
}
|
|
37
|
+
catch(ex, host) {
|
|
38
|
+
const transformed = ex instanceof exceptions_1.PipelineException ? ex : this.transform(ex);
|
|
39
|
+
// Error is transformed to standard PipelineException
|
|
40
|
+
this.logger.error(transformed);
|
|
41
|
+
const formatted = this.format(host, transformed);
|
|
42
|
+
return this.send(host, formatted);
|
|
43
|
+
}
|
|
44
|
+
transform(ex) {
|
|
45
|
+
const transformer = this.transformers.find((x) => x.match(ex));
|
|
46
|
+
if (transformer) {
|
|
47
|
+
return transformer.transform(ex);
|
|
48
|
+
}
|
|
49
|
+
const err = new exceptions_1.InternalException(ex.message ?? 'UNKNOWN ERROR', ex);
|
|
50
|
+
err.stack = ex.stack;
|
|
51
|
+
return err;
|
|
52
|
+
}
|
|
53
|
+
format(host, ex) {
|
|
54
|
+
const formatter = this.formatters.find((x) => x.match(host, ex));
|
|
55
|
+
if (formatter) {
|
|
56
|
+
this.logger.trace(`Found formatter: ${formatter.constructor.name}`);
|
|
57
|
+
return formatter.format(ex, this.config.verbose);
|
|
58
|
+
}
|
|
59
|
+
this.logger.trace('No formatter for error!');
|
|
60
|
+
if (this.config.verbose) {
|
|
61
|
+
return (0, common_2.normalizer)()(ex, {
|
|
62
|
+
// This means stacktrace will never be sent to user
|
|
63
|
+
filterKeys: ['stack'],
|
|
64
|
+
sortKeys: common_2.sortErrorKeys,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return { message: 'NO FORMATTER' };
|
|
68
|
+
}
|
|
69
|
+
send(host, ex) {
|
|
70
|
+
const sender = this.senders.find((x) => x.match(host));
|
|
71
|
+
return sender?.send(host, ex) ?? (0, rxjs_1.throwError)(() => ex);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
GlobalExceptionsFilter = GlobalExceptionsFilter_1 = __decorate([
|
|
75
|
+
(0, common_1.Catch)(),
|
|
76
|
+
__param(0, (0, common_1.Inject)(constants_1.FORMATTERS)),
|
|
77
|
+
__param(1, (0, common_1.Inject)(constants_1.TRANSFORMERS)),
|
|
78
|
+
__param(2, (0, common_1.Inject)(constants_1.SENDERS)),
|
|
79
|
+
__param(3, (0, logging_1.InjectLogger)(GlobalExceptionsFilter_1)),
|
|
80
|
+
__metadata("design:paramtypes", [Array, Array, Array, Object, global_exceptions_config_1.GlobalExceptionsConfig])
|
|
81
|
+
], GlobalExceptionsFilter);
|
|
82
|
+
exports.GlobalExceptionsFilter = GlobalExceptionsFilter;
|
|
83
|
+
//# sourceMappingURL=global-exceptions.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-exceptions.filter.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,2CAA+C;AAC/C,yCAAyD;AAGzD,+BAAkC;AAElC,8CAAqE;AACrE,wCAA0C;AAE1C,2CAAgE;AAChE,yEAAoE;AAQ7D,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAEM;IACE;IACL;IAEjB;IACA;IANnB,YACuC,UAA8B,EAC5B,YAAkC,EACvC,OAAwB,EAEzC,MAAe,EACf,MAA8B;QALV,eAAU,GAAV,UAAU,CAAoB;QAC5B,iBAAY,GAAZ,YAAY,CAAsB;QACvC,YAAO,GAAP,OAAO,CAAiB;QAEzC,WAAM,GAAN,MAAM,CAAS;QACf,WAAM,GAAN,MAAM,CAAwB;IAC9C,CAAC;IAEJ,KAAK,CAAC,EAAO,EAAE,IAAmB;QAChC,MAAM,WAAW,GACf,EAAE,YAAY,8BAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAE5D,qDAAqD;QACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE/B,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAEjD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpC,CAAC;IAEO,SAAS,CAAC,EAAO;QACvB,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/D,IAAI,WAAW,EAAE;YACf,OAAO,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SAClC;QAED,MAAM,GAAG,GAAG,IAAI,8BAAiB,CAAC,EAAE,CAAC,OAAO,IAAI,eAAe,EAAE,EAAE,CAAC,CAAC;QAErE,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;QAErB,OAAO,GAAG,CAAC;IACb,CAAC;IAEO,MAAM,CAAC,IAAmB,EAAE,EAAW;QAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;YAEpE,OAAO,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SAClD;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAE7C,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACvB,OAAO,IAAA,mBAAU,GAAE,CAAC,EAAE,EAAE;gBACtB,mDAAmD;gBACnD,UAAU,EAAE,CAAC,OAAO,CAAC;gBACrB,QAAQ,EAAE,sBAAa;aACxB,CAAW,CAAC;SACd;QAED,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACrC,CAAC;IAEO,IAAI,CAAC,IAAmB,EAAE,EAAO;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAEvD,OAAO,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AA7DY,sBAAsB;IADlC,IAAA,cAAK,GAAE;IAGH,WAAA,IAAA,eAAM,EAAC,sBAAU,CAAC,CAAA;IAClB,WAAA,IAAA,eAAM,EAAC,wBAAY,CAAC,CAAA;IACpB,WAAA,IAAA,eAAM,EAAC,mBAAO,CAAC,CAAA;IACf,WAAA,IAAA,sBAAY,EAAC,wBAAsB,CAAC,CAAA;kEAEZ,iDAAsB;GAPtC,sBAAsB,CA6DlC;AA7DY,wDAAsB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import type { IErrorsFormatter, IErrorsSender, IErrorsTransformer } from './types';
|
|
3
|
+
export interface GlobalExceptionModuleOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Formatters are used to transform exceptions to transport specific
|
|
6
|
+
* final implementations. Usually formatter expects transport agnostic
|
|
7
|
+
* subclasses of BaseException.
|
|
8
|
+
*/
|
|
9
|
+
formatters: IErrorsFormatter[];
|
|
10
|
+
/**
|
|
11
|
+
* Senders are used to actually respond to client (algorithm
|
|
12
|
+
* is transport specific)
|
|
13
|
+
*/
|
|
14
|
+
senders: IErrorsSender[];
|
|
15
|
+
/**
|
|
16
|
+
* Sometimes application throws a lot of unconventional
|
|
17
|
+
* (not inheriting BaseExceptions). Usually they are throw by
|
|
18
|
+
* libraries: typeorm, axios, etc. Transformers are used to
|
|
19
|
+
* catch them and convert to any subtype of BaseException which
|
|
20
|
+
* will be processed further by transport specific formatters.
|
|
21
|
+
*/
|
|
22
|
+
transformers?: IErrorsTransformer[];
|
|
23
|
+
}
|
|
24
|
+
export declare class GlobalExceptionsModule {
|
|
25
|
+
static forRoot(options: GlobalExceptionModuleOptions): DynamicModule;
|
|
26
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var GlobalExceptionsModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.GlobalExceptionsModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const core_1 = require("@nestjs/core");
|
|
13
|
+
const config_1 = require("../config");
|
|
14
|
+
const constants_1 = require("./constants");
|
|
15
|
+
const global_exceptions_config_1 = require("./global-exceptions.config");
|
|
16
|
+
const global_exceptions_filter_1 = require("./global-exceptions.filter");
|
|
17
|
+
let GlobalExceptionsModule = GlobalExceptionsModule_1 = class GlobalExceptionsModule {
|
|
18
|
+
static forRoot(options) {
|
|
19
|
+
return {
|
|
20
|
+
module: GlobalExceptionsModule_1,
|
|
21
|
+
imports: [config_1.PlatformConfigModule.forFeature(global_exceptions_config_1.GlobalExceptionsConfig)],
|
|
22
|
+
providers: [
|
|
23
|
+
{
|
|
24
|
+
provide: core_1.APP_FILTER,
|
|
25
|
+
useClass: global_exceptions_filter_1.GlobalExceptionsFilter,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
provide: constants_1.FORMATTERS,
|
|
29
|
+
useValue: options.formatters,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
provide: constants_1.SENDERS,
|
|
33
|
+
useValue: options.senders,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
provide: constants_1.TRANSFORMERS,
|
|
37
|
+
useValue: options.transformers || [],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
GlobalExceptionsModule = GlobalExceptionsModule_1 = __decorate([
|
|
44
|
+
(0, common_1.Module)({})
|
|
45
|
+
], GlobalExceptionsModule);
|
|
46
|
+
exports.GlobalExceptionsModule = GlobalExceptionsModule;
|
|
47
|
+
//# sourceMappingURL=global-exceptions.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-exceptions.module.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.module.ts"],"names":[],"mappings":";;;;;;;;;;AACA,2CAAwC;AACxC,uCAA0C;AAE1C,sCAAiD;AAEjD,2CAAgE;AAChE,yEAAoE;AACpE,yEAAoE;AAgC7D,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IACjC,MAAM,CAAC,OAAO,CAAC,OAAqC;QAClD,OAAO;YACL,MAAM,EAAE,wBAAsB;YAE9B,OAAO,EAAE,CAAC,6BAAoB,CAAC,UAAU,CAAC,iDAAsB,CAAC,CAAC;YAClE,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,iBAAU;oBACnB,QAAQ,EAAE,iDAAsB;iBACjC;gBACD;oBACE,OAAO,EAAE,sBAAU;oBACnB,QAAQ,EAAE,OAAO,CAAC,UAAU;iBAC7B;gBACD;oBACE,OAAO,EAAE,mBAAO;oBAChB,QAAQ,EAAE,OAAO,CAAC,OAAO;iBAC1B;gBACD;oBACE,OAAO,EAAE,wBAAY;oBACrB,QAAQ,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;iBACrC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA1BY,sBAAsB;IADlC,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,sBAAsB,CA0BlC;AA1BY,wDAAsB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./global-exceptions.module"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions.handling/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,0CAAwB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ArgumentsHost } from '@nestjs/common';
|
|
2
|
+
import type { EMPTY, Observable } from 'rxjs';
|
|
3
|
+
import type { PipelineException } from '../exceptions/base';
|
|
4
|
+
/**
|
|
5
|
+
* Errors formatter is used to map transport-agnostic
|
|
6
|
+
* buisiness exception to transport-specific on (with appropriate
|
|
7
|
+
* status code and other attributes)
|
|
8
|
+
*
|
|
9
|
+
* @implementme Implement this interface if you need to create a
|
|
10
|
+
* custom transport.
|
|
11
|
+
*/
|
|
12
|
+
export interface IErrorsFormatter {
|
|
13
|
+
/**
|
|
14
|
+
* Matcher returns true if exception should be processed with
|
|
15
|
+
* this formatter. Most common use is match by context type.
|
|
16
|
+
*
|
|
17
|
+
* @param host ArgumentsHost - nest.js wrapper over request context
|
|
18
|
+
* @param exception Exception itself
|
|
19
|
+
*/
|
|
20
|
+
match(host: ArgumentsHost, exception?: unknown): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Formatting algorithm that should match received exception with
|
|
23
|
+
* transport-specific one and map one into another.
|
|
24
|
+
*
|
|
25
|
+
* @param exception Exception itself
|
|
26
|
+
* @param verbose True - means that all exception data can be exposed
|
|
27
|
+
* in response. False - indicates that service is probably working in
|
|
28
|
+
* production and all extra data shouldn't be sent back to client.
|
|
29
|
+
*/
|
|
30
|
+
format(exception: unknown, verbose: boolean): unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Different transports need to return errors in different ways.
|
|
34
|
+
*
|
|
35
|
+
* @implementme
|
|
36
|
+
*/
|
|
37
|
+
export interface IErrorsSender {
|
|
38
|
+
/**
|
|
39
|
+
* Matcher returns true if exception should be processed with
|
|
40
|
+
* this formatter. Most common use is match by context type.
|
|
41
|
+
*
|
|
42
|
+
* @param host ArgumentsHost - nest.js wrapper over request context
|
|
43
|
+
*/
|
|
44
|
+
match(host: ArgumentsHost): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Implementation of sending error back to the client
|
|
47
|
+
*
|
|
48
|
+
* @param host ArgumentsHost - nest.js wrapper over request context
|
|
49
|
+
* @param exception Exception itself
|
|
50
|
+
*/
|
|
51
|
+
send(host: ArgumentsHost, ex: unknown): Observable<any> | typeof EMPTY;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Not all exceptions that can be thrown when handling request
|
|
55
|
+
* are created in application code. And library authors have no
|
|
56
|
+
* idea about PipelineExceptions and our conventions. Hence they
|
|
57
|
+
* throw their own errors of any possible type.
|
|
58
|
+
*
|
|
59
|
+
* Aim of transformers is to catch those "unconventional" errors and
|
|
60
|
+
* map them into instances of PipelineException which then will be
|
|
61
|
+
* mapped correctly to responses.
|
|
62
|
+
*
|
|
63
|
+
* @implementme Implement this interface if you use some library that
|
|
64
|
+
* can throw (let's say axios) and don't want to wrap each call of this
|
|
65
|
+
* library into try/catch block
|
|
66
|
+
*/
|
|
67
|
+
export interface IErrorsTransformer {
|
|
68
|
+
/**
|
|
69
|
+
* Matcher returns true if exception should be processed with
|
|
70
|
+
* this transformer
|
|
71
|
+
*
|
|
72
|
+
* @param ex Exception to transform
|
|
73
|
+
*/
|
|
74
|
+
match(ex: any): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Transformating algorithm
|
|
77
|
+
*
|
|
78
|
+
* @param ex Exception itself
|
|
79
|
+
*/
|
|
80
|
+
transform(ex: any): PipelineException;
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/exceptions.handling/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HealthCheckException = void 0;
|
|
13
|
+
const exceptions_1 = require("../../exceptions");
|
|
14
|
+
let HealthCheckException = class HealthCheckException extends exceptions_1.PipelineException {
|
|
15
|
+
constructor(details) {
|
|
16
|
+
super(exceptions_1.ExceptionKind.UNAVAILABLE, 'Health check failed!', { details });
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
HealthCheckException = __decorate([
|
|
20
|
+
(0, exceptions_1.Exception)({ description: 'Service is unavailable' }),
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
22
|
+
], HealthCheckException);
|
|
23
|
+
exports.HealthCheckException = HealthCheckException;
|
|
24
|
+
//# sourceMappingURL=health-check.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-check.exception.js","sourceRoot":"","sources":["../../../src/health/exceptions/health-check.exception.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+E;AAIxE,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,8BAAiB;IACzD,YAAY,OAAoC;QAC9C,KAAK,CAAC,0BAAa,CAAC,WAAW,EAAE,sBAAsB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;CACF,CAAA;AAJY,oBAAoB;IADhC,IAAA,sBAAS,EAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;;GACxC,oBAAoB,CAIhC;AAJY,oDAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './health-check.exception';
|