@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,10 @@
|
|
|
1
|
+
export * from './parsers';
|
|
2
|
+
export * from './config.module';
|
|
3
|
+
export * from './sources';
|
|
4
|
+
export * from './config.abstract';
|
|
5
|
+
export * from './metadata';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export * from './reload';
|
|
8
|
+
export { AdditionalSourceModule } from './additional-source/additional-source.module';
|
|
9
|
+
export { AdditionalSourceOptions } from './additional-source/additional-source.module';
|
|
10
|
+
export { ConfigPropertyMetadataNotFound } from './exceptions';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Constructor } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import { IndicatorsRegistry } from '../../health/metadata';
|
|
4
|
+
import type { Config } from '../config.abstract';
|
|
5
|
+
import { ConfigReloadIndicator } from '../config-reload.indicator';
|
|
6
|
+
import type { ConfigSource } from '../sources';
|
|
7
|
+
import type {
|
|
8
|
+
PropertyMetadata,
|
|
9
|
+
SectionMetadata,
|
|
10
|
+
SourceMetadata,
|
|
11
|
+
} from '../types';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
DuplicatePropertyException,
|
|
15
|
+
DuplicateSectionException,
|
|
16
|
+
DuplicateSourceException,
|
|
17
|
+
} from './exceptions';
|
|
18
|
+
|
|
19
|
+
export class ConfigMetadataRegistry {
|
|
20
|
+
private static properties = new Map<string, PropertyMetadata>();
|
|
21
|
+
private static sources = new Map<Constructor<ConfigSource>, SourceMetadata>();
|
|
22
|
+
private static sections = new Map<Constructor<Config>, SectionMetadata>();
|
|
23
|
+
|
|
24
|
+
static registerSource(
|
|
25
|
+
target: Constructor<ConfigSource>,
|
|
26
|
+
metadata: SourceMetadata,
|
|
27
|
+
): void {
|
|
28
|
+
if (this.sources.has(target)) {
|
|
29
|
+
throw new DuplicateSourceException(target);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (
|
|
33
|
+
metadata.type === 'reloadable' &&
|
|
34
|
+
!IndicatorsRegistry.isRegistered(ConfigReloadIndicator)
|
|
35
|
+
) {
|
|
36
|
+
IndicatorsRegistry.register(ConfigReloadIndicator, {
|
|
37
|
+
description: 'Will be "down" if there are problems with config reload',
|
|
38
|
+
key: 'config-reload',
|
|
39
|
+
scope: 'common',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this.sources.set(target, metadata);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static registerSection(
|
|
47
|
+
target: Constructor<Config>,
|
|
48
|
+
metadata: SectionMetadata,
|
|
49
|
+
): void {
|
|
50
|
+
if (this.sections.has(target)) {
|
|
51
|
+
throw new DuplicateSectionException(target);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.sections.set(target, metadata);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static registerProperty(alias: string, metadata: PropertyMetadata): void {
|
|
58
|
+
if (this.properties.has(alias)) {
|
|
59
|
+
throw new DuplicatePropertyException(alias);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.properties.set(alias, metadata);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static getMetadata(): Readonly<{
|
|
66
|
+
sources: Map<Constructor<ConfigSource>, SourceMetadata>;
|
|
67
|
+
sections: Map<Constructor<Config>, SectionMetadata>;
|
|
68
|
+
properties: Map<string, PropertyMetadata>;
|
|
69
|
+
}> {
|
|
70
|
+
return {
|
|
71
|
+
properties: this.properties,
|
|
72
|
+
sections: this.sections,
|
|
73
|
+
sources: this.sources,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
import type { Constructor } from '@rsdk/common';
|
|
3
|
+
|
|
4
|
+
import type { SectionMetadata } from '../../types';
|
|
5
|
+
import { ConfigMetadataRegistry } from '../config-metadata.registry';
|
|
6
|
+
|
|
7
|
+
import { CONFIG_METADATA_KEY } from './property.decorator';
|
|
8
|
+
|
|
9
|
+
export interface ConfigSectionOptions {
|
|
10
|
+
name?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Sets metadata for Config class
|
|
16
|
+
* @param options ConfigSectionOptions
|
|
17
|
+
* @returns ClassDecorator
|
|
18
|
+
*/
|
|
19
|
+
export const ConfigSection = (options?: ConfigSectionOptions): ClassDecorator =>
|
|
20
|
+
function (target: Function): void {
|
|
21
|
+
const metadata = Reflect.getMetadata(
|
|
22
|
+
CONFIG_METADATA_KEY,
|
|
23
|
+
target,
|
|
24
|
+
) as SectionMetadata;
|
|
25
|
+
|
|
26
|
+
ConfigMetadataRegistry.registerSection(target as Constructor, {
|
|
27
|
+
...metadata,
|
|
28
|
+
...(options || {}),
|
|
29
|
+
});
|
|
30
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ConfigValue, PropertyOptions, PropertyParser } from '../../types';
|
|
2
|
+
import { ConfigMetadataRegistry } from '../config-metadata.registry';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Declares standalone property. Properties declared in this way,
|
|
6
|
+
* can be injected with @InjectProperty() decorator.
|
|
7
|
+
*
|
|
8
|
+
* Main usecase is custom ConfigSources. They are constructed outside of
|
|
9
|
+
* Nest.js context, so common DI is not available. But @InjectProperty()
|
|
10
|
+
* works.
|
|
11
|
+
*
|
|
12
|
+
* @param alias Property key.
|
|
13
|
+
* @param parser Class that gets value from config storate
|
|
14
|
+
* and validates it in some way. Ex: IntParser, BoolParser etc.
|
|
15
|
+
* @param options Property options, in particular description and
|
|
16
|
+
* default value if exists
|
|
17
|
+
* @returns ClassDecorator
|
|
18
|
+
*/
|
|
19
|
+
export const DeclareProperty = <T extends ConfigValue>(
|
|
20
|
+
/**
|
|
21
|
+
* Alias is used not only to declare, but also to inject
|
|
22
|
+
* properties. That's why this string is saved as is, while
|
|
23
|
+
* key is the same string converted to upper snake case.
|
|
24
|
+
*/
|
|
25
|
+
alias: string,
|
|
26
|
+
parser: PropertyParser<T>,
|
|
27
|
+
options: PropertyOptions<T>,
|
|
28
|
+
): ClassDecorator => {
|
|
29
|
+
return function (): void {
|
|
30
|
+
ConfigMetadataRegistry.registerProperty(alias, {
|
|
31
|
+
expectedInEnv: true,
|
|
32
|
+
...options,
|
|
33
|
+
key: alias,
|
|
34
|
+
parser,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Inject } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
const TOKEN_PREFIX = 'STANDALONE_CONFIG_PROPERTY_';
|
|
4
|
+
|
|
5
|
+
export type PropertyToken = `${typeof TOKEN_PREFIX}${string}`;
|
|
6
|
+
|
|
7
|
+
export const getPropertyToken = (name: string): PropertyToken =>
|
|
8
|
+
`${TOKEN_PREFIX}${name}`;
|
|
9
|
+
|
|
10
|
+
export const isPropertyToken = (x: unknown): x is PropertyToken =>
|
|
11
|
+
typeof x === 'string' && x.startsWith(TOKEN_PREFIX);
|
|
12
|
+
|
|
13
|
+
export const trimPrefix = (token: PropertyToken): string =>
|
|
14
|
+
token.slice(TOKEN_PREFIX.length - 1);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Decorator is used for 2 scenarios:
|
|
18
|
+
*
|
|
19
|
+
* 1. To inject properties into ConfigSource constructors. In this case
|
|
20
|
+
* one should add @DeclareProperty() to ConfigSource constructor first.
|
|
21
|
+
*
|
|
22
|
+
* 2. To create and inject dynamic properties (ex: @rsdk/grpc-clients).
|
|
23
|
+
* In this case they should be registered manually using
|
|
24
|
+
* ConfigMetadataRegistry.registerProperty() method.
|
|
25
|
+
*
|
|
26
|
+
* NOTE: don't use it in application code! Only in libraries!
|
|
27
|
+
*/
|
|
28
|
+
export const InjectProperty = (name: string): ParameterDecorator =>
|
|
29
|
+
Inject(getPropertyToken(name));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConfigValue,
|
|
3
|
+
PropertyOptions,
|
|
4
|
+
PropertyParser,
|
|
5
|
+
SectionMetadata,
|
|
6
|
+
} from '../../types';
|
|
7
|
+
|
|
8
|
+
export const CONFIG_METADATA_KEY = 'CONFIG_METADATA';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Sets metadata that will be used to populate the field
|
|
12
|
+
* during configuration module bootstrap
|
|
13
|
+
*
|
|
14
|
+
* @param key Key of property (with prefix or not)
|
|
15
|
+
* @param parser Extraction and validation algorithm
|
|
16
|
+
* @param options Additional options (default value, description etc.)
|
|
17
|
+
* @returns PropertyDecorator
|
|
18
|
+
*/
|
|
19
|
+
export const Property = <T extends ConfigValue>(
|
|
20
|
+
key: string,
|
|
21
|
+
parser: PropertyParser<T>,
|
|
22
|
+
options: PropertyOptions<T>,
|
|
23
|
+
): PropertyDecorator =>
|
|
24
|
+
function (target: object, propertyKey: string | symbol): void {
|
|
25
|
+
const ctor = target.constructor;
|
|
26
|
+
|
|
27
|
+
const metadata = (Reflect.getMetadata(
|
|
28
|
+
CONFIG_METADATA_KEY,
|
|
29
|
+
ctor,
|
|
30
|
+
) as SectionMetadata) || { properties: {} };
|
|
31
|
+
|
|
32
|
+
metadata.properties[propertyKey] = {
|
|
33
|
+
expectedInEnv: false,
|
|
34
|
+
key,
|
|
35
|
+
parser,
|
|
36
|
+
...options,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
Reflect.defineMetadata(CONFIG_METADATA_KEY, metadata, ctor);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// https://stackoverflow.com/questions/42281045/can-typescript-property-decorators-set-metadata-for-the-class
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { text } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import { BootstrapException, Exception } from '../../../exceptions';
|
|
4
|
+
|
|
5
|
+
@Exception({
|
|
6
|
+
description: text`Duplicate ConfigProperty`,
|
|
7
|
+
})
|
|
8
|
+
export class DuplicatePropertyException extends BootstrapException {
|
|
9
|
+
constructor(alias: string) {
|
|
10
|
+
super(`Standalone property with alias ${alias} is already registered`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Constructor, text } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import { BootstrapException, Exception } from '../../../exceptions';
|
|
4
|
+
import type { Config } from '../../config.abstract';
|
|
5
|
+
|
|
6
|
+
@Exception({
|
|
7
|
+
description: text`Duplicate @ConfigSection with same class name`,
|
|
8
|
+
})
|
|
9
|
+
export class DuplicateSectionException extends BootstrapException {
|
|
10
|
+
constructor(section: Constructor<Config>) {
|
|
11
|
+
super(`Config section ${section} is already registered`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Constructor, text } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import { BootstrapException, Exception } from '../../../exceptions';
|
|
4
|
+
import type { ConfigSource } from '../../sources';
|
|
5
|
+
|
|
6
|
+
@Exception({
|
|
7
|
+
description: text`Duplicate configuration source`,
|
|
8
|
+
})
|
|
9
|
+
export class DuplicateSourceException extends BootstrapException {
|
|
10
|
+
constructor(source: Constructor<ConfigSource>) {
|
|
11
|
+
super(`Config source ${source.name} is already registered`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Assert, text } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
PropertyParser,
|
|
5
|
+
RawConfigValue,
|
|
6
|
+
SingleConfigValue,
|
|
7
|
+
} from '../types';
|
|
8
|
+
|
|
9
|
+
export class ArrayParser<T extends SingleConfigValue>
|
|
10
|
+
implements PropertyParser<T[]>
|
|
11
|
+
{
|
|
12
|
+
constructor(
|
|
13
|
+
private readonly singleValueParser: PropertyParser<T>,
|
|
14
|
+
private readonly options = { separator: ',' },
|
|
15
|
+
) {}
|
|
16
|
+
|
|
17
|
+
type(): string {
|
|
18
|
+
return `(array)${this.singleValueParser.type()}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
description(): string {
|
|
22
|
+
return text`
|
|
23
|
+
Extracts array of values. If raw value is a string
|
|
24
|
+
<${this.options.separator}> will used as separator. Each value:
|
|
25
|
+
${this.singleValueParser.description()}
|
|
26
|
+
`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
parse(value: RawConfigValue): T[] {
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
return value.map((x) => this.singleValueParser.parse(x));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Assert.isString(value);
|
|
35
|
+
|
|
36
|
+
return value
|
|
37
|
+
.split(this.options.separator)
|
|
38
|
+
.map((x) => this.singleValueParser.parse(x));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Convert, text } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
4
|
+
|
|
5
|
+
export class BoolParser implements PropertyParser<boolean> {
|
|
6
|
+
type(): string {
|
|
7
|
+
return 'boolean';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
description(): string {
|
|
11
|
+
return text`
|
|
12
|
+
Extracts boolean value. Any boolean value or strings
|
|
13
|
+
'true' and 'false' will pass.
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
parse(value: RawConfigValue): boolean {
|
|
18
|
+
return Convert.boolean(value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './bool.parser';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EnumLike, EnumValue } from '@rsdk/common';
|
|
2
|
+
import { Convert, Enum, text } from '@rsdk/common';
|
|
3
|
+
|
|
4
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
5
|
+
|
|
6
|
+
export class EnumParser<E extends EnumValue> implements PropertyParser<E> {
|
|
7
|
+
constructor(private readonly enumeration: EnumLike) {}
|
|
8
|
+
|
|
9
|
+
type(): string {
|
|
10
|
+
return `string|number(enum_value)`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
description(): string {
|
|
14
|
+
return text`
|
|
15
|
+
Extracts strings or numbers and ensures it is one of:
|
|
16
|
+
${Enum.values(this.enumeration).join(', ')}
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
parse(value: RawConfigValue): E {
|
|
21
|
+
return Convert.enum<E>(value, this.enumeration);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enum.parser';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './boolean';
|
|
2
|
+
export * from './enum';
|
|
3
|
+
export * from './int';
|
|
4
|
+
export * from './number';
|
|
5
|
+
export * from './path';
|
|
6
|
+
export * from './size';
|
|
7
|
+
export * from './string';
|
|
8
|
+
export * from './timespan';
|
|
9
|
+
export * from './url';
|
|
10
|
+
export * from './array.parser';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './int.parser';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Convert, text } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
4
|
+
|
|
5
|
+
export class IntParser implements PropertyParser<number> {
|
|
6
|
+
type(): string {
|
|
7
|
+
return 'number(int)';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
description(): string {
|
|
11
|
+
return text`
|
|
12
|
+
Extracts valid integer (uses parseInt under the hood).
|
|
13
|
+
Floating point numbers, NaN, Infinity will be rejected.
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
parse(value: RawConfigValue): number {
|
|
18
|
+
return Convert.int(value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './number.parser';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Convert, text } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
4
|
+
|
|
5
|
+
export class NumberParser implements PropertyParser<number> {
|
|
6
|
+
type(): string {
|
|
7
|
+
return 'number';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
description(): string {
|
|
11
|
+
return text`
|
|
12
|
+
Extracts numeric value (uses parseFloat under the hood).
|
|
13
|
+
NaN and Infinity will be rejected.
|
|
14
|
+
|
|
15
|
+
NOTE: Use correct decimal delimiter according to locale. See
|
|
16
|
+
https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Intl
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
parse(value: RawConfigValue): number {
|
|
21
|
+
return Convert.number(value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { accessSync, existsSync, lstatSync } from 'fs';
|
|
2
|
+
import { isAbsolute, join } from 'path';
|
|
3
|
+
import { cwd } from 'process';
|
|
4
|
+
|
|
5
|
+
import { Assert, text } from '@rsdk/common';
|
|
6
|
+
|
|
7
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
8
|
+
|
|
9
|
+
export class FsPathParser implements PropertyParser<string> {
|
|
10
|
+
constructor(private readonly objectType: 'file' | 'dir') {}
|
|
11
|
+
|
|
12
|
+
type(): string {
|
|
13
|
+
return 'string(fs_path)';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
description(): string {
|
|
17
|
+
return text`
|
|
18
|
+
Extracts path to file or directory. Checks that object exists on
|
|
19
|
+
file system and that application has access to it.
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
parse(value: RawConfigValue): string {
|
|
24
|
+
Assert.isString(value);
|
|
25
|
+
|
|
26
|
+
const wasRelative = !isAbsolute(value);
|
|
27
|
+
const absolutePath = wasRelative ? join(cwd(), value) : value;
|
|
28
|
+
|
|
29
|
+
if (!existsSync(absolutePath)) {
|
|
30
|
+
const warning = wasRelative
|
|
31
|
+
? ' Since you have used relative path, check you current working directory is repos root.'
|
|
32
|
+
: '';
|
|
33
|
+
|
|
34
|
+
throw new Error(
|
|
35
|
+
`File or directory <${absolutePath}> not found!${warning}`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
accessSync(absolutePath);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
throw new Error(`Can't access <${absolutePath}>!`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const stat = lstatSync(absolutePath);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Otherwise we'll have problems with IsNotDirectoryException
|
|
49
|
+
* when using symlinks.
|
|
50
|
+
*/
|
|
51
|
+
if (stat.isSymbolicLink()) {
|
|
52
|
+
return absolutePath;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (this.objectType === 'dir' && !stat.isDirectory()) {
|
|
56
|
+
throw new Error(`<${absolutePath}> is not a directory!`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (this.objectType === 'file' && !stat.isFile()) {
|
|
60
|
+
throw new Error(`<${absolutePath}> is not a file!`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return absolutePath;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fspath.parser';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './size.parser';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Assert, Size, SIZE_STRING_PATTERN, text } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
4
|
+
|
|
5
|
+
export class SizeParser implements PropertyParser<Size> {
|
|
6
|
+
type(): string {
|
|
7
|
+
return 'Timespan';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
description(): string {
|
|
11
|
+
return text`
|
|
12
|
+
Parses string in size format into Timespan instance.
|
|
13
|
+
Format is: ${SIZE_STRING_PATTERN}. For example: 8b, 10kb, 2gb.
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
parse(value: RawConfigValue): Size {
|
|
18
|
+
Assert.isString(value);
|
|
19
|
+
|
|
20
|
+
return Size.parse(value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './string.parser';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Assert } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
4
|
+
|
|
5
|
+
export class StringParser implements PropertyParser<string> {
|
|
6
|
+
type(): string {
|
|
7
|
+
return 'string';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
description(): string {
|
|
11
|
+
return 'Extract arbitrary string.';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
parse(value: RawConfigValue): string {
|
|
15
|
+
Assert.isString(value);
|
|
16
|
+
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './timespan.parser';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Assert,
|
|
3
|
+
text,
|
|
4
|
+
Timespan,
|
|
5
|
+
TIMESPAN_STRING_PATTERN,
|
|
6
|
+
} from '@rsdk/common';
|
|
7
|
+
|
|
8
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
9
|
+
|
|
10
|
+
export class TimespanParser implements PropertyParser<Timespan> {
|
|
11
|
+
type(): string {
|
|
12
|
+
return 'Timespan';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
description(): string {
|
|
16
|
+
return text`
|
|
17
|
+
Parses string in timespan format into Timespan instance.
|
|
18
|
+
Format is: ${TIMESPAN_STRING_PATTERN}. For example: 1s, 2h, 4d.
|
|
19
|
+
`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
parse(value: RawConfigValue): Timespan {
|
|
23
|
+
Assert.isString(value);
|
|
24
|
+
|
|
25
|
+
return Timespan.parse(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './url.parser';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Assert } from '@rsdk/common';
|
|
2
|
+
|
|
3
|
+
import type { PropertyParser, RawConfigValue } from '../../types';
|
|
4
|
+
|
|
5
|
+
export class UrlParser implements PropertyParser<URL> {
|
|
6
|
+
type(): string {
|
|
7
|
+
return 'URL';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
description(): string {
|
|
11
|
+
return 'Parses string into instance of URL';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
parse(value: RawConfigValue): URL {
|
|
15
|
+
Assert.isString(value);
|
|
16
|
+
|
|
17
|
+
return new URL(value);
|
|
18
|
+
}
|
|
19
|
+
}
|