@lakutata/core 1.0.60 → 3.0.0-beta.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/README.md +173 -23
- package/THIRD_PARTY_NOTICES.md +320 -0
- package/dist/cjs/components/ConsoleLogger.d.ts +62 -0
- package/dist/cjs/components/ConsoleLogger.js +99 -0
- package/dist/cjs/constants/DIMetadataKey.d.ts +10 -0
- package/dist/cjs/constants/DIMetadataKey.js +13 -0
- package/dist/cjs/constants/DTOMetadataKey.d.ts +5 -0
- package/dist/cjs/constants/DTOMetadataKey.js +8 -0
- package/dist/cjs/decorators/asst/After.d.ts +29 -0
- package/dist/cjs/decorators/asst/After.js +33 -0
- package/dist/cjs/decorators/asst/Before.d.ts +28 -0
- package/dist/cjs/decorators/asst/Before.js +32 -0
- package/dist/cjs/decorators/di/Autoload.d.ts +33 -0
- package/dist/cjs/decorators/di/Autoload.js +37 -0
- package/dist/cjs/decorators/di/Configurable.d.ts +51 -0
- package/dist/cjs/decorators/di/Configurable.js +60 -0
- package/dist/cjs/decorators/di/Inject.d.ts +85 -0
- package/dist/cjs/decorators/di/Inject.js +36 -0
- package/dist/cjs/decorators/di/Lifetime.d.ts +94 -0
- package/dist/cjs/decorators/di/Lifetime.js +106 -0
- package/dist/cjs/decorators/dto/Accept.d.ts +38 -0
- package/dist/cjs/decorators/dto/Accept.js +41 -0
- package/dist/cjs/decorators/dto/Expect.d.ts +38 -0
- package/dist/cjs/decorators/dto/Expect.js +41 -0
- package/dist/cjs/decorators/dto/IndexSignature.d.ts +30 -0
- package/dist/cjs/decorators/dto/IndexSignature.js +33 -0
- package/dist/cjs/decorators/dto/Return.d.ts +39 -0
- package/dist/cjs/decorators/dto/Return.js +42 -0
- package/dist/cjs/dto/PaginationResultDTO.d.ts +33 -0
- package/dist/cjs/dto/PaginationResultDTO.js +50 -0
- package/dist/cjs/dto/PaginationSearchDTO.d.ts +33 -0
- package/dist/cjs/dto/PaginationSearchDTO.js +45 -0
- package/dist/cjs/dto/Paginator.d.ts +54 -0
- package/dist/cjs/dto/Paginator.js +53 -0
- package/dist/cjs/exceptions/DestroyRuntimeContainerException.d.ts +10 -0
- package/dist/cjs/exceptions/DestroyRuntimeContainerException.js +17 -0
- package/dist/cjs/exceptions/InvalidActionPatternDepthException.d.ts +8 -0
- package/dist/cjs/exceptions/InvalidActionPatternDepthException.js +15 -0
- package/dist/cjs/exceptions/InvalidAssistantFunctionTypeException.d.ts +9 -0
- package/dist/cjs/exceptions/InvalidAssistantFunctionTypeException.js +16 -0
- package/dist/cjs/exceptions/InvalidObjectTypeException.d.ts +9 -0
- package/dist/cjs/exceptions/InvalidObjectTypeException.js +16 -0
- package/dist/cjs/exceptions/MethodNotFoundException.d.ts +8 -0
- package/dist/cjs/exceptions/MethodNotFoundException.js +15 -0
- package/dist/cjs/exceptions/ObjectDestroyedException.d.ts +9 -0
- package/dist/cjs/exceptions/ObjectDestroyedException.js +16 -0
- package/dist/cjs/exceptions/alias/AliasExistsException.d.ts +8 -0
- package/dist/cjs/exceptions/alias/AliasExistsException.js +15 -0
- package/dist/cjs/exceptions/alias/AliasNotFoundException.d.ts +8 -0
- package/dist/cjs/exceptions/alias/AliasNotFoundException.js +15 -0
- package/dist/cjs/exceptions/alias/InvalidAliasNameException.d.ts +8 -0
- package/dist/cjs/exceptions/alias/InvalidAliasNameException.js +15 -0
- package/dist/cjs/exceptions/di/DependencyInjectionException.d.ts +9 -0
- package/dist/cjs/exceptions/di/DependencyInjectionException.js +16 -0
- package/dist/cjs/exceptions/di/InvalidObjectOptionsException.d.ts +9 -0
- package/dist/cjs/exceptions/di/InvalidObjectOptionsException.js +16 -0
- package/dist/cjs/exceptions/di/LifetimeLockedException.d.ts +9 -0
- package/dist/cjs/exceptions/di/LifetimeLockedException.js +16 -0
- package/dist/cjs/exceptions/di/OverridableObjectTargetConfigNotFoundException.d.ts +9 -0
- package/dist/cjs/exceptions/di/OverridableObjectTargetConfigNotFoundException.js +16 -0
- package/dist/cjs/exceptions/dto/InvalidMethodAcceptException.d.ts +9 -0
- package/dist/cjs/exceptions/dto/InvalidMethodAcceptException.js +16 -0
- package/dist/cjs/exceptions/dto/InvalidMethodReturnException.d.ts +9 -0
- package/dist/cjs/exceptions/dto/InvalidMethodReturnException.js +16 -0
- package/dist/cjs/exceptions/dto/InvalidValueException.d.ts +11 -0
- package/dist/cjs/exceptions/dto/InvalidValueException.js +18 -0
- package/dist/cjs/exports/ASSTDecorators.d.ts +3 -0
- package/dist/cjs/exports/ASSTDecorators.js +11 -0
- package/dist/cjs/exports/Core.d.ts +93 -0
- package/dist/cjs/exports/Core.js +127 -0
- package/dist/cjs/exports/DIDecorators.d.ts +5 -0
- package/dist/cjs/exports/DIDecorators.js +18 -0
- package/dist/cjs/exports/DTODecorators.d.ts +6 -0
- package/dist/cjs/exports/DTODecorators.js +17 -0
- package/dist/cjs/exports/DTOs.d.ts +17 -0
- package/dist/cjs/exports/DTOs.js +35 -0
- package/dist/cjs/exports/LoggerComponent.d.ts +3 -0
- package/dist/cjs/exports/LoggerComponent.js +22 -0
- package/dist/cjs/interfaces/IBaseObjectConstructor.d.ts +10 -0
- package/dist/cjs/interfaces/IBaseObjectConstructor.js +2 -0
- package/dist/cjs/interfaces/IConstructor.d.ts +6 -0
- package/dist/cjs/interfaces/IConstructor.js +2 -0
- package/dist/cjs/interfaces/ILogger.d.ts +35 -0
- package/dist/cjs/interfaces/ILogger.js +2 -0
- package/dist/cjs/lib/app/Application.d.ts +346 -0
- package/dist/cjs/lib/app/Application.js +613 -0
- package/dist/cjs/lib/app/ApplicationConfigLoader.d.ts +17 -0
- package/dist/cjs/lib/app/ApplicationConfigLoader.js +30 -0
- package/dist/cjs/lib/app/MigrationCommand.d.ts +31 -0
- package/dist/cjs/lib/app/MigrationCommand.js +31 -0
- package/dist/cjs/lib/base/BaseObject.d.ts +343 -0
- package/dist/cjs/lib/base/BaseObject.js +608 -0
- package/dist/cjs/lib/base/EventEmitter.d.ts +37 -0
- package/dist/cjs/lib/base/EventEmitter.js +152 -0
- package/dist/cjs/lib/base/async-constructor/Append.d.ts +1 -0
- package/dist/cjs/lib/base/async-constructor/Append.js +21 -0
- package/dist/cjs/lib/base/async-constructor/AsyncConstructor.d.ts +3 -0
- package/dist/cjs/lib/base/async-constructor/AsyncConstructor.js +11 -0
- package/dist/cjs/lib/base/internal/ApplicationLaunch.d.ts +16 -0
- package/dist/cjs/lib/base/internal/ApplicationLaunch.js +58 -0
- package/dist/cjs/lib/base/internal/ConfigurableRecordsInjection.d.ts +47 -0
- package/dist/cjs/lib/base/internal/ConfigurableRecordsInjection.js +85 -0
- package/dist/cjs/lib/base/internal/EventEmitter2.d.ts +184 -0
- package/dist/cjs/lib/base/internal/EventEmitter2.js +715 -0
- package/dist/cjs/lib/base/internal/MemberDeclarations.d.ts +23 -0
- package/dist/cjs/lib/base/internal/MemberDeclarations.js +45 -0
- package/dist/cjs/lib/base/internal/MethodAssistantFunction.d.ts +20 -0
- package/dist/cjs/lib/base/internal/MethodAssistantFunction.js +110 -0
- package/dist/cjs/lib/base/internal/ModuleConfigLoader.d.ts +46 -0
- package/dist/cjs/lib/base/internal/ModuleConfigLoader.js +113 -0
- package/dist/cjs/lib/base/internal/ModuleInitialization.d.ts +5 -0
- package/dist/cjs/lib/base/internal/ModuleInitialization.js +8 -0
- package/dist/cjs/lib/base/internal/ObjectConfiguration.d.ts +29 -0
- package/dist/cjs/lib/base/internal/ObjectConfiguration.js +41 -0
- package/dist/cjs/lib/base/internal/ObjectContainer.d.ts +15 -0
- package/dist/cjs/lib/base/internal/ObjectContainer.js +23 -0
- package/dist/cjs/lib/base/internal/ObjectInjection.d.ts +43 -0
- package/dist/cjs/lib/base/internal/ObjectInjection.js +60 -0
- package/dist/cjs/lib/base/internal/ObjectOptionsCheck.d.ts +12 -0
- package/dist/cjs/lib/base/internal/ObjectOptionsCheck.js +70 -0
- package/dist/cjs/lib/base/internal/ObjectStartup.d.ts +31 -0
- package/dist/cjs/lib/base/internal/ObjectStartup.js +75 -0
- package/dist/cjs/lib/base/internal/ObjectType.d.ts +37 -0
- package/dist/cjs/lib/base/internal/ObjectType.js +75 -0
- package/dist/cjs/lib/core/Alias.d.ts +48 -0
- package/dist/cjs/lib/core/Alias.js +100 -0
- package/dist/cjs/lib/core/Component.d.ts +267 -0
- package/dist/cjs/lib/core/Component.js +362 -0
- package/dist/cjs/lib/core/Container.d.ts +341 -0
- package/dist/cjs/lib/core/Container.js +667 -0
- package/dist/cjs/lib/core/Module.d.ts +165 -0
- package/dist/cjs/lib/core/Module.js +268 -0
- package/dist/cjs/lib/core/Provider.d.ts +52 -0
- package/dist/cjs/lib/core/Provider.js +57 -0
- package/dist/cjs/lib/dto/CachedSchema.d.ts +7 -0
- package/dist/cjs/lib/dto/CachedSchema.js +2 -0
- package/dist/cjs/lib/dto/DTO.d.ts +278 -0
- package/dist/cjs/lib/dto/DTO.js +461 -0
- package/dist/cjs/lib/dto/DataValidator.d.ts +166 -0
- package/dist/cjs/lib/dto/DataValidator.js +247 -0
- package/dist/cjs/lib/dto/FlexibleDTO.d.ts +23 -0
- package/dist/cjs/lib/dto/FlexibleDTO.js +36 -0
- package/dist/cjs/lib/dto/MethodValidation.d.ts +44 -0
- package/dist/cjs/lib/dto/MethodValidation.js +141 -0
- package/dist/cjs/lib/dto/ObjectSchemaValidation.d.ts +86 -0
- package/dist/cjs/lib/dto/ObjectSchemaValidation.js +181 -0
- package/dist/cjs/lib/dto/internal/CronValidator.d.ts +8 -0
- package/dist/cjs/lib/dto/internal/CronValidator.js +128 -0
- package/dist/cjs/lib/foundation/BasicInfo.d.ts +46 -0
- package/dist/cjs/lib/foundation/BasicInfo.js +115 -0
- package/dist/cjs/lib/foundation/EndProcess.d.ts +14 -0
- package/dist/cjs/lib/foundation/EndProcess.js +30 -0
- package/dist/cjs/lib/foundation/Exception.d.ts +88 -0
- package/dist/cjs/lib/foundation/Exception.js +165 -0
- package/dist/cjs/lib/foundation/LifecycleErrorReporter.d.ts +26 -0
- package/dist/cjs/lib/foundation/LifecycleErrorReporter.js +64 -0
- package/dist/cjs/lib/foundation/Packaging.d.ts +29 -0
- package/dist/cjs/lib/foundation/Packaging.js +42 -0
- package/dist/cjs/lib/foundation/ThrowWarning.d.ts +6 -0
- package/dist/cjs/lib/foundation/ThrowWarning.js +16 -0
- package/dist/cjs/lib/helpers/internal/WithCause.d.ts +6 -0
- package/dist/cjs/lib/helpers/internal/WithCause.js +12 -0
- package/dist/cjs/lib/ioc/ConstructorSymbol.d.ts +3 -0
- package/dist/cjs/lib/ioc/ConstructorSymbol.js +21 -0
- package/dist/cjs/lib/ioc/DependencyInjectionContainer.d.ts +178 -0
- package/dist/cjs/lib/ioc/DependencyInjectionContainer.js +445 -0
- package/dist/cjs/lib/ioc/Errors.d.ts +59 -0
- package/dist/cjs/lib/ioc/Errors.js +115 -0
- package/dist/cjs/lib/ioc/Lifetime.d.ts +12 -0
- package/dist/cjs/lib/ioc/Lifetime.js +31 -0
- package/dist/cjs/lib/ioc/ListModules.d.ts +42 -0
- package/dist/cjs/lib/ioc/ListModules.js +104 -0
- package/dist/cjs/lib/ioc/LoadModuleNative.d.ts +1 -0
- package/dist/cjs/lib/ioc/LoadModuleNative.js +41 -0
- package/dist/cjs/lib/ioc/LoadModules.d.ts +49 -0
- package/dist/cjs/lib/ioc/LoadModules.js +167 -0
- package/dist/cjs/lib/ioc/ObjectLifetime.d.ts +22 -0
- package/dist/cjs/lib/ioc/ObjectLifetime.js +39 -0
- package/dist/cjs/lib/ioc/ObjectWeakRefs.d.ts +19 -0
- package/dist/cjs/lib/ioc/ObjectWeakRefs.js +47 -0
- package/dist/cjs/lib/ioc/Resolvers.d.ts +136 -0
- package/dist/cjs/lib/ioc/Resolvers.js +248 -0
- package/dist/cjs/lib/ioc/Utils.d.ts +33 -0
- package/dist/cjs/lib/ioc/Utils.js +73 -0
- package/dist/cjs/lib/validation/JsonSchema.d.ts +127 -0
- package/dist/cjs/lib/validation/JsonSchema.js +85 -0
- package/dist/cjs/lib/validation/VLD.d.ts +275 -0
- package/dist/cjs/lib/validation/VLD.js +216 -0
- package/dist/cjs/lib/validation/ValidationLanguage.d.ts +42 -0
- package/dist/cjs/lib/validation/ValidationLanguage.js +55 -0
- package/dist/cjs/lib/validation/ValidationMessages.d.ts +92 -0
- package/dist/cjs/lib/validation/ValidationMessages.js +192 -0
- package/dist/cjs/lib/validation/engine/address/decode.d.ts +8 -0
- package/dist/cjs/lib/validation/engine/address/decode.js +104 -0
- package/dist/cjs/lib/validation/engine/address/domain.d.ts +74 -0
- package/dist/cjs/lib/validation/engine/address/domain.js +181 -0
- package/dist/cjs/lib/validation/engine/address/email.d.ts +27 -0
- package/dist/cjs/lib/validation/engine/address/email.js +182 -0
- package/dist/cjs/lib/validation/engine/address/errors.d.ts +48 -0
- package/dist/cjs/lib/validation/engine/address/errors.js +31 -0
- package/dist/cjs/lib/validation/engine/address/index.d.ts +9 -0
- package/dist/cjs/lib/validation/engine/address/index.js +30 -0
- package/dist/cjs/lib/validation/engine/address/ip.d.ts +35 -0
- package/dist/cjs/lib/validation/engine/address/ip.js +49 -0
- package/dist/cjs/lib/validation/engine/address/uri.d.ts +55 -0
- package/dist/cjs/lib/validation/engine/address/uri.js +218 -0
- package/dist/cjs/lib/validation/engine/expression/index.d.ts +70 -0
- package/dist/cjs/lib/validation/engine/expression/index.js +356 -0
- package/dist/cjs/lib/validation/engine/json-schema/combinations.d.ts +11 -0
- package/dist/cjs/lib/validation/engine/json-schema/combinations.js +33 -0
- package/dist/cjs/lib/validation/engine/json-schema/helpers.d.ts +76 -0
- package/dist/cjs/lib/validation/engine/json-schema/helpers.js +380 -0
- package/dist/cjs/lib/validation/engine/json-schema/import.d.ts +56 -0
- package/dist/cjs/lib/validation/engine/json-schema/import.js +872 -0
- package/dist/cjs/lib/validation/engine/json-schema/index.d.ts +20 -0
- package/dist/cjs/lib/validation/engine/json-schema/index.js +45 -0
- package/dist/cjs/lib/validation/engine/json-schema/model.d.ts +124 -0
- package/dist/cjs/lib/validation/engine/json-schema/model.js +5 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/json-2020-12.d.ts +9 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/json-2020-12.js +56 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/json-draft-04.d.ts +17 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/json-draft-04.js +93 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/json-draft-2019-09.d.ts +13 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/json-draft-2019-09.js +69 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/json.d.ts +245 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/json.js +1497 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/open-api-3.1.d.ts +13 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/open-api-3.1.js +71 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/open-api.d.ts +24 -0
- package/dist/cjs/lib/validation/engine/json-schema/parsers/open-api.js +207 -0
- package/dist/cjs/lib/validation/engine/location/index.d.ts +18 -0
- package/dist/cjs/lib/validation/engine/location/index.js +23 -0
- package/dist/cjs/lib/validation/engine/schema/annotate.d.ts +13 -0
- package/dist/cjs/lib/validation/engine/schema/annotate.js +162 -0
- package/dist/cjs/lib/validation/engine/schema/assert.d.ts +25 -0
- package/dist/cjs/lib/validation/engine/schema/assert.js +66 -0
- package/dist/cjs/lib/validation/engine/schema/base.d.ts +194 -0
- package/dist/cjs/lib/validation/engine/schema/base.js +834 -0
- package/dist/cjs/lib/validation/engine/schema/cache.d.ts +41 -0
- package/dist/cjs/lib/validation/engine/schema/cache.js +131 -0
- package/dist/cjs/lib/validation/engine/schema/common.d.ts +79 -0
- package/dist/cjs/lib/validation/engine/schema/common.js +220 -0
- package/dist/cjs/lib/validation/engine/schema/compile.d.ts +81 -0
- package/dist/cjs/lib/validation/engine/schema/compile.js +242 -0
- package/dist/cjs/lib/validation/engine/schema/errors.d.ts +94 -0
- package/dist/cjs/lib/validation/engine/schema/errors.js +230 -0
- package/dist/cjs/lib/validation/engine/schema/extend.d.ts +122 -0
- package/dist/cjs/lib/validation/engine/schema/extend.js +235 -0
- package/dist/cjs/lib/validation/engine/schema/extensions/bigint.d.ts +33 -0
- package/dist/cjs/lib/validation/engine/schema/extensions/bigint.js +175 -0
- package/dist/cjs/lib/validation/engine/schema/fastpath.d.ts +35 -0
- package/dist/cjs/lib/validation/engine/schema/fastpath.js +661 -0
- package/dist/cjs/lib/validation/engine/schema/formats.d.ts +8 -0
- package/dist/cjs/lib/validation/engine/schema/formats.js +105 -0
- package/dist/cjs/lib/validation/engine/schema/index.d.ts +95 -0
- package/dist/cjs/lib/validation/engine/schema/index.js +237 -0
- package/dist/cjs/lib/validation/engine/schema/lazy.d.ts +21 -0
- package/dist/cjs/lib/validation/engine/schema/lazy.js +8 -0
- package/dist/cjs/lib/validation/engine/schema/manifest.d.ts +52 -0
- package/dist/cjs/lib/validation/engine/schema/manifest.js +364 -0
- package/dist/cjs/lib/validation/engine/schema/messages.d.ts +37 -0
- package/dist/cjs/lib/validation/engine/schema/messages.js +136 -0
- package/dist/cjs/lib/validation/engine/schema/model.d.ts +196 -0
- package/dist/cjs/lib/validation/engine/schema/model.js +2 -0
- package/dist/cjs/lib/validation/engine/schema/modify.d.ts +58 -0
- package/dist/cjs/lib/validation/engine/schema/modify.js +223 -0
- package/dist/cjs/lib/validation/engine/schema/ref.d.ts +116 -0
- package/dist/cjs/lib/validation/engine/schema/ref.js +318 -0
- package/dist/cjs/lib/validation/engine/schema/schemas.d.ts +6 -0
- package/dist/cjs/lib/validation/engine/schema/schemas.js +268 -0
- package/dist/cjs/lib/validation/engine/schema/state.d.ts +48 -0
- package/dist/cjs/lib/validation/engine/schema/state.js +148 -0
- package/dist/cjs/lib/validation/engine/schema/template.d.ts +72 -0
- package/dist/cjs/lib/validation/engine/schema/template.js +331 -0
- package/dist/cjs/lib/validation/engine/schema/trace.d.ts +121 -0
- package/dist/cjs/lib/validation/engine/schema/trace.js +280 -0
- package/dist/cjs/lib/validation/engine/schema/types/alternatives.d.ts +36 -0
- package/dist/cjs/lib/validation/engine/schema/types/alternatives.js +332 -0
- package/dist/cjs/lib/validation/engine/schema/types/any.d.ts +37 -0
- package/dist/cjs/lib/validation/engine/schema/types/any.js +198 -0
- package/dist/cjs/lib/validation/engine/schema/types/array.d.ts +46 -0
- package/dist/cjs/lib/validation/engine/schema/types/array.js +668 -0
- package/dist/cjs/lib/validation/engine/schema/types/binary.d.ts +20 -0
- package/dist/cjs/lib/validation/engine/schema/types/binary.js +116 -0
- package/dist/cjs/lib/validation/engine/schema/types/boolean.d.ts +29 -0
- package/dist/cjs/lib/validation/engine/schema/types/boolean.js +142 -0
- package/dist/cjs/lib/validation/engine/schema/types/date.d.ts +27 -0
- package/dist/cjs/lib/validation/engine/schema/types/date.js +197 -0
- package/dist/cjs/lib/validation/engine/schema/types/function.d.ts +12 -0
- package/dist/cjs/lib/validation/engine/schema/types/function.js +68 -0
- package/dist/cjs/lib/validation/engine/schema/types/keys.d.ts +119 -0
- package/dist/cjs/lib/validation/engine/schema/types/keys.js +911 -0
- package/dist/cjs/lib/validation/engine/schema/types/link.d.ts +21 -0
- package/dist/cjs/lib/validation/engine/schema/types/link.js +160 -0
- package/dist/cjs/lib/validation/engine/schema/types/number.d.ts +46 -0
- package/dist/cjs/lib/validation/engine/schema/types/number.js +385 -0
- package/dist/cjs/lib/validation/engine/schema/types/object.d.ts +10 -0
- package/dist/cjs/lib/validation/engine/schema/types/object.js +21 -0
- package/dist/cjs/lib/validation/engine/schema/types/string.d.ts +115 -0
- package/dist/cjs/lib/validation/engine/schema/types/string.js +767 -0
- package/dist/cjs/lib/validation/engine/schema/types/symbol.d.ts +23 -0
- package/dist/cjs/lib/validation/engine/schema/types/symbol.js +75 -0
- package/dist/cjs/lib/validation/engine/schema/validator.d.ts +114 -0
- package/dist/cjs/lib/validation/engine/schema/validator.js +680 -0
- package/dist/cjs/lib/validation/engine/schema/values.d.ts +51 -0
- package/dist/cjs/lib/validation/engine/schema/values.js +201 -0
- package/dist/cjs/lib/validation/engine/sorter/index.d.ts +54 -0
- package/dist/cjs/lib/validation/engine/sorter/index.js +180 -0
- package/dist/cjs/lib/validation/engine/tlds/index.d.ts +1 -0
- package/dist/cjs/lib/validation/engine/tlds/index.js +8 -0
- package/dist/cjs/lib/validation/engine/tlds/tlds.d.ts +4 -0
- package/dist/cjs/lib/validation/engine/tlds/tlds.js +1448 -0
- package/dist/cjs/lib/validation/engine/utils/applyToDefaults.d.ts +17 -0
- package/dist/cjs/lib/validation/engine/utils/applyToDefaults.js +89 -0
- package/dist/cjs/lib/validation/engine/utils/assert.d.ts +6 -0
- package/dist/cjs/lib/validation/engine/utils/assert.js +23 -0
- package/dist/cjs/lib/validation/engine/utils/assertError.d.ts +10 -0
- package/dist/cjs/lib/validation/engine/utils/assertError.js +18 -0
- package/dist/cjs/lib/validation/engine/utils/clone.d.ts +25 -0
- package/dist/cjs/lib/validation/engine/utils/clone.js +160 -0
- package/dist/cjs/lib/validation/engine/utils/deepEqual.d.ts +29 -0
- package/dist/cjs/lib/validation/engine/utils/deepEqual.js +265 -0
- package/dist/cjs/lib/validation/engine/utils/escapeHtml.d.ts +8 -0
- package/dist/cjs/lib/validation/engine/utils/escapeHtml.js +62 -0
- package/dist/cjs/lib/validation/engine/utils/escapeRegex.d.ts +8 -0
- package/dist/cjs/lib/validation/engine/utils/escapeRegex.js +13 -0
- package/dist/cjs/lib/validation/engine/utils/ignore.d.ts +8 -0
- package/dist/cjs/lib/validation/engine/utils/ignore.js +12 -0
- package/dist/cjs/lib/validation/engine/utils/index.d.ts +16 -0
- package/dist/cjs/lib/validation/engine/utils/index.js +34 -0
- package/dist/cjs/lib/validation/engine/utils/merge.d.ts +21 -0
- package/dist/cjs/lib/validation/engine/utils/merge.js +67 -0
- package/dist/cjs/lib/validation/engine/utils/reach.d.ts +30 -0
- package/dist/cjs/lib/validation/engine/utils/reach.js +62 -0
- package/dist/cjs/lib/validation/engine/utils/stringify.d.ts +8 -0
- package/dist/cjs/lib/validation/engine/utils/stringify.js +18 -0
- package/dist/cjs/lib/validation/engine/utils/types.d.ts +26 -0
- package/dist/cjs/lib/validation/engine/utils/types.js +51 -0
- package/dist/cjs/lib/validation/engine/utils/utils.d.ts +24 -0
- package/dist/cjs/lib/validation/engine/utils/utils.js +22 -0
- package/dist/cjs/lib/validation/exceptions/SchemaConversionException.d.ts +7 -0
- package/dist/cjs/lib/validation/exceptions/SchemaConversionException.js +14 -0
- package/dist/cjs/lib/validation/exceptions/SchemaDefinitionException.d.ts +7 -0
- package/dist/cjs/lib/validation/exceptions/SchemaDefinitionException.js +14 -0
- package/dist/cjs/lib/validation/exceptions/SchemaException.d.ts +6 -0
- package/dist/cjs/lib/validation/exceptions/SchemaException.js +10 -0
- package/dist/cjs/lib/validation/exceptions/SchemaValidationException.d.ts +36 -0
- package/dist/cjs/lib/validation/exceptions/SchemaValidationException.js +43 -0
- package/dist/cjs/lib/validation/interfaces/AlternativesSchema.d.ts +45 -0
- package/dist/cjs/lib/validation/interfaces/AlternativesSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/AnySchema.d.ts +399 -0
- package/dist/cjs/lib/validation/interfaces/AnySchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ArraySchema.d.ts +106 -0
- package/dist/cjs/lib/validation/interfaces/ArraySchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ArraySortOptions.d.ts +8 -0
- package/dist/cjs/lib/validation/interfaces/ArraySortOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ArrayUniqueOptions.d.ts +9 -0
- package/dist/cjs/lib/validation/interfaces/ArrayUniqueOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/Base64Options.d.ts +9 -0
- package/dist/cjs/lib/validation/interfaces/Base64Options.js +2 -0
- package/dist/cjs/lib/validation/interfaces/BaseValidationOptions.d.ts +97 -0
- package/dist/cjs/lib/validation/interfaces/BaseValidationOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/BigIntSchema.d.ts +67 -0
- package/dist/cjs/lib/validation/interfaces/BigIntSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/BinarySchema.d.ts +33 -0
- package/dist/cjs/lib/validation/interfaces/BinarySchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/BooleanSchema.d.ts +29 -0
- package/dist/cjs/lib/validation/interfaces/BooleanSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/Cache.d.ts +14 -0
- package/dist/cjs/lib/validation/interfaces/Cache.js +2 -0
- package/dist/cjs/lib/validation/interfaces/CacheConfiguration.d.ts +15 -0
- package/dist/cjs/lib/validation/interfaces/CacheConfiguration.js +2 -0
- package/dist/cjs/lib/validation/interfaces/CompileOptions.d.ts +9 -0
- package/dist/cjs/lib/validation/interfaces/CompileOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/Context.d.ts +9 -0
- package/dist/cjs/lib/validation/interfaces/Context.js +2 -0
- package/dist/cjs/lib/validation/interfaces/CustomHelpers.d.ts +15 -0
- package/dist/cjs/lib/validation/interfaces/CustomHelpers.js +2 -0
- package/dist/cjs/lib/validation/interfaces/DataUriOptions.d.ts +8 -0
- package/dist/cjs/lib/validation/interfaces/DataUriOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/DateSchema.d.ts +48 -0
- package/dist/cjs/lib/validation/interfaces/DateSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/DependencyOptions.d.ts +9 -0
- package/dist/cjs/lib/validation/interfaces/DependencyOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/Description.d.ts +20 -0
- package/dist/cjs/lib/validation/interfaces/Description.js +2 -0
- package/dist/cjs/lib/validation/interfaces/DomainOptions.d.ts +33 -0
- package/dist/cjs/lib/validation/interfaces/DomainOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/EmailOptions.d.ts +51 -0
- package/dist/cjs/lib/validation/interfaces/EmailOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ErrorFormattingOptions.d.ts +60 -0
- package/dist/cjs/lib/validation/interfaces/ErrorFormattingOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ErrorReport.d.ts +14 -0
- package/dist/cjs/lib/validation/interfaces/ErrorReport.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ErrorValidationOptions.d.ts +5 -0
- package/dist/cjs/lib/validation/interfaces/ErrorValidationOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/Extension.d.ts +100 -0
- package/dist/cjs/lib/validation/interfaces/Extension.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ExtensionFlag.d.ts +4 -0
- package/dist/cjs/lib/validation/interfaces/ExtensionFlag.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ExternalHelpers.d.ts +16 -0
- package/dist/cjs/lib/validation/interfaces/ExternalHelpers.js +2 -0
- package/dist/cjs/lib/validation/interfaces/FunctionSchema.d.ts +31 -0
- package/dist/cjs/lib/validation/interfaces/FunctionSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/GuidOptions.d.ts +6 -0
- package/dist/cjs/lib/validation/interfaces/GuidOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/HexOptions.d.ts +16 -0
- package/dist/cjs/lib/validation/interfaces/HexOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/HierarchySeparatorOptions.d.ts +7 -0
- package/dist/cjs/lib/validation/interfaces/HierarchySeparatorOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/IpOptions.d.ts +11 -0
- package/dist/cjs/lib/validation/interfaces/IpOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/LanguageMessageTemplate.d.ts +4 -0
- package/dist/cjs/lib/validation/interfaces/LanguageMessageTemplate.js +2 -0
- package/dist/cjs/lib/validation/interfaces/LinkSchema.d.ts +26 -0
- package/dist/cjs/lib/validation/interfaces/LinkSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/NumberSchema.d.ts +134 -0
- package/dist/cjs/lib/validation/interfaces/NumberSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ObjectPatternOptions.d.ts +6 -0
- package/dist/cjs/lib/validation/interfaces/ObjectPatternOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ObjectSchema.d.ts +173 -0
- package/dist/cjs/lib/validation/interfaces/ObjectSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/Reference.d.ts +38 -0
- package/dist/cjs/lib/validation/interfaces/Reference.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ReferenceOptions.d.ts +59 -0
- package/dist/cjs/lib/validation/interfaces/ReferenceOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/RenameOptions.d.ts +26 -0
- package/dist/cjs/lib/validation/interfaces/RenameOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/RuleOptions.d.ts +22 -0
- package/dist/cjs/lib/validation/interfaces/RuleOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/SchemaInternals.d.ts +103 -0
- package/dist/cjs/lib/validation/interfaces/SchemaInternals.js +2 -0
- package/dist/cjs/lib/validation/interfaces/State.d.ts +8 -0
- package/dist/cjs/lib/validation/interfaces/State.js +2 -0
- package/dist/cjs/lib/validation/interfaces/StringRegexOptions.d.ts +12 -0
- package/dist/cjs/lib/validation/interfaces/StringRegexOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/StringSchema.d.ts +220 -0
- package/dist/cjs/lib/validation/interfaces/StringSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/SwitchCases.d.ts +11 -0
- package/dist/cjs/lib/validation/interfaces/SwitchCases.js +2 -0
- package/dist/cjs/lib/validation/interfaces/SwitchDefault.d.ts +8 -0
- package/dist/cjs/lib/validation/interfaces/SwitchDefault.js +2 -0
- package/dist/cjs/lib/validation/interfaces/SymbolSchema.d.ts +16 -0
- package/dist/cjs/lib/validation/interfaces/SymbolSchema.js +2 -0
- package/dist/cjs/lib/validation/interfaces/TopLevelDomainOptions.d.ts +12 -0
- package/dist/cjs/lib/validation/interfaces/TopLevelDomainOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/UriOptions.d.ts +31 -0
- package/dist/cjs/lib/validation/interfaces/UriOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ValidationErrorItem.d.ts +7 -0
- package/dist/cjs/lib/validation/interfaces/ValidationErrorItem.js +2 -0
- package/dist/cjs/lib/validation/interfaces/ValidationOptions.d.ts +21 -0
- package/dist/cjs/lib/validation/interfaces/ValidationOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/WhenOptions.d.ts +30 -0
- package/dist/cjs/lib/validation/interfaces/WhenOptions.js +2 -0
- package/dist/cjs/lib/validation/interfaces/WhenSchemaOptions.d.ts +11 -0
- package/dist/cjs/lib/validation/interfaces/WhenSchemaOptions.js +2 -0
- package/dist/cjs/lib/validation/messages/ar.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/ar.js +145 -0
- package/dist/cjs/lib/validation/messages/de.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/de.js +145 -0
- package/dist/cjs/lib/validation/messages/es.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/es.js +145 -0
- package/dist/cjs/lib/validation/messages/fr.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/fr.js +145 -0
- package/dist/cjs/lib/validation/messages/hi.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/hi.js +145 -0
- package/dist/cjs/lib/validation/messages/id.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/id.js +145 -0
- package/dist/cjs/lib/validation/messages/it.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/it.js +145 -0
- package/dist/cjs/lib/validation/messages/ja.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/ja.js +145 -0
- package/dist/cjs/lib/validation/messages/ko.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/ko.js +145 -0
- package/dist/cjs/lib/validation/messages/nl.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/nl.js +145 -0
- package/dist/cjs/lib/validation/messages/pl.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/pl.js +145 -0
- package/dist/cjs/lib/validation/messages/pt-BR.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/pt-BR.js +145 -0
- package/dist/cjs/lib/validation/messages/ru.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/ru.js +145 -0
- package/dist/cjs/lib/validation/messages/th.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/th.js +145 -0
- package/dist/cjs/lib/validation/messages/tr.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/tr.js +145 -0
- package/dist/cjs/lib/validation/messages/uk.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/uk.js +145 -0
- package/dist/cjs/lib/validation/messages/vi.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/vi.js +145 -0
- package/dist/cjs/lib/validation/messages/zh-CN.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/zh-CN.js +145 -0
- package/dist/cjs/lib/validation/messages/zh-TW.d.ts +5 -0
- package/dist/cjs/lib/validation/messages/zh-TW.js +145 -0
- package/dist/cjs/lib/validation/types/BasicType.d.ts +4 -0
- package/dist/cjs/lib/validation/types/BasicType.js +2 -0
- package/dist/cjs/lib/validation/types/ComparatorFunction.d.ts +4 -0
- package/dist/cjs/lib/validation/types/ComparatorFunction.js +2 -0
- package/dist/cjs/lib/validation/types/CustomValidator.d.ts +9 -0
- package/dist/cjs/lib/validation/types/CustomValidator.js +2 -0
- package/dist/cjs/lib/validation/types/ExtensionBoundSchema.d.ts +2 -0
- package/dist/cjs/lib/validation/types/ExtensionBoundSchema.js +2 -0
- package/dist/cjs/lib/validation/types/ExternalValidationFunction.d.ts +8 -0
- package/dist/cjs/lib/validation/types/ExternalValidationFunction.js +2 -0
- package/dist/cjs/lib/validation/types/IsNonPrimitiveSubsetUnion.d.ts +3 -0
- package/dist/cjs/lib/validation/types/IsNonPrimitiveSubsetUnion.js +2 -0
- package/dist/cjs/lib/validation/types/IsPrimitiveSubset.d.ts +3 -0
- package/dist/cjs/lib/validation/types/IsPrimitiveSubset.js +2 -0
- package/dist/cjs/lib/validation/types/IsUnion.d.ts +1 -0
- package/dist/cjs/lib/validation/types/IsUnion.js +2 -0
- package/dist/cjs/lib/validation/types/LanguageMessages.d.ts +5 -0
- package/dist/cjs/lib/validation/types/LanguageMessages.js +2 -0
- package/dist/cjs/lib/validation/types/NoNestedArrays.d.ts +5 -0
- package/dist/cjs/lib/validation/types/NoNestedArrays.js +2 -0
- package/dist/cjs/lib/validation/types/NullableType.d.ts +1 -0
- package/dist/cjs/lib/validation/types/NullableType.js +2 -0
- package/dist/cjs/lib/validation/types/ObjectPropertiesSchema.d.ts +12 -0
- package/dist/cjs/lib/validation/types/ObjectPropertiesSchema.js +2 -0
- package/dist/cjs/lib/validation/types/PartialSchemaMap.d.ts +4 -0
- package/dist/cjs/lib/validation/types/PartialSchemaMap.js +2 -0
- package/dist/cjs/lib/validation/types/PresenceMode.d.ts +4 -0
- package/dist/cjs/lib/validation/types/PresenceMode.js +2 -0
- package/dist/cjs/lib/validation/types/Primitives.d.ts +4 -0
- package/dist/cjs/lib/validation/types/Primitives.js +2 -0
- package/dist/cjs/lib/validation/types/Schema.d.ts +17 -0
- package/dist/cjs/lib/validation/types/Schema.js +2 -0
- package/dist/cjs/lib/validation/types/SchemaFunction.d.ts +6 -0
- package/dist/cjs/lib/validation/types/SchemaFunction.js +2 -0
- package/dist/cjs/lib/validation/types/SchemaLike.d.ts +6 -0
- package/dist/cjs/lib/validation/types/SchemaLike.js +2 -0
- package/dist/cjs/lib/validation/types/SchemaLikeWithoutArray.d.ts +7 -0
- package/dist/cjs/lib/validation/types/SchemaLikeWithoutArray.js +2 -0
- package/dist/cjs/lib/validation/types/SchemaMap.d.ts +7 -0
- package/dist/cjs/lib/validation/types/SchemaMap.js +2 -0
- package/dist/cjs/lib/validation/types/StrictSchemaMap.d.ts +4 -0
- package/dist/cjs/lib/validation/types/StrictSchemaMap.js +2 -0
- package/dist/cjs/lib/validation/types/Types.d.ts +4 -0
- package/dist/cjs/lib/validation/types/Types.js +2 -0
- package/dist/cjs/lib/validation/types/UnwrapSchemaLikeWithoutArray.d.ts +5 -0
- package/dist/cjs/lib/validation/types/UnwrapSchemaLikeWithoutArray.js +2 -0
- package/dist/cjs/lib/validation/types/ValidationErrorFunction.d.ts +7 -0
- package/dist/cjs/lib/validation/types/ValidationErrorFunction.js +2 -0
- package/dist/cjs/options/ApplicationOptions.d.ts +60 -0
- package/dist/cjs/options/ApplicationOptions.js +75 -0
- package/dist/cjs/options/LoadAnonymousObjectOptions.d.ts +33 -0
- package/dist/cjs/options/LoadAnonymousObjectOptions.js +51 -0
- package/dist/cjs/options/LoadNamedObjectOptions.d.ts +29 -0
- package/dist/cjs/options/LoadNamedObjectOptions.js +42 -0
- package/dist/cjs/options/LoadObjectOptions.d.ts +30 -0
- package/dist/cjs/options/LoadObjectOptions.js +53 -0
- package/dist/cjs/options/ModuleLoadObjectsOptions.d.ts +44 -0
- package/dist/cjs/options/ModuleLoadObjectsOptions.js +61 -0
- package/dist/cjs/options/ModuleOptions.d.ts +74 -0
- package/dist/cjs/options/ModuleOptions.js +86 -0
- package/dist/cjs/options/OverridableNamedObjectOptions.d.ts +26 -0
- package/dist/cjs/options/OverridableNamedObjectOptions.js +37 -0
- package/dist/cjs/options/OverridableObjectOptions.d.ts +34 -0
- package/dist/cjs/options/OverridableObjectOptions.js +52 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types/ActionPattern.d.ts +6 -0
- package/dist/cjs/types/ActionPattern.js +2 -0
- package/dist/cjs/types/ApplicationExitReason.d.ts +13 -0
- package/dist/cjs/types/ApplicationExitReason.js +2 -0
- package/dist/cjs/types/ClassDecorator.d.ts +6 -0
- package/dist/cjs/types/ClassDecorator.js +2 -0
- package/dist/cjs/types/ComponentOptions.d.ts +20 -0
- package/dist/cjs/types/ComponentOptions.js +2 -0
- package/dist/cjs/types/CronOptions.d.ts +25 -0
- package/dist/cjs/types/CronOptions.js +2 -0
- package/dist/cjs/types/JSONSchema.d.ts +284 -0
- package/dist/cjs/types/JSONSchema.js +2 -0
- package/dist/cjs/types/MethodDecorator.d.ts +5 -0
- package/dist/cjs/types/MethodDecorator.js +2 -0
- package/dist/cjs/types/ModuleOptions.d.ts +20 -0
- package/dist/cjs/types/ModuleOptions.js +2 -0
- package/dist/cjs/types/ObjectOptions.d.ts +20 -0
- package/dist/cjs/types/ObjectOptions.js +2 -0
- package/dist/cjs/types/PaginationMeta.d.ts +21 -0
- package/dist/cjs/types/PaginationMeta.js +2 -0
- package/dist/cjs/types/ParameterDecorator.d.ts +5 -0
- package/dist/cjs/types/ParameterDecorator.js +2 -0
- package/dist/cjs/types/PropertyDecorator.d.ts +4 -0
- package/dist/cjs/types/PropertyDecorator.js +2 -0
- package/dist/cjs/types/ProviderOptions.d.ts +20 -0
- package/dist/cjs/types/ProviderOptions.js +2 -0
- package/dist/esm/components/ConsoleLogger.js +96 -0
- package/dist/esm/constants/DIMetadataKey.js +10 -0
- package/dist/esm/constants/DTOMetadataKey.js +5 -0
- package/dist/esm/decorators/asst/After.js +30 -0
- package/dist/esm/decorators/asst/Before.js +29 -0
- package/dist/esm/decorators/di/Autoload.js +34 -0
- package/dist/esm/decorators/di/Configurable.js +57 -0
- package/dist/esm/decorators/di/Inject.js +33 -0
- package/dist/esm/decorators/di/Lifetime.js +100 -0
- package/dist/esm/decorators/dto/Accept.js +38 -0
- package/dist/esm/decorators/dto/Expect.js +38 -0
- package/dist/esm/decorators/dto/IndexSignature.js +30 -0
- package/dist/esm/decorators/dto/Return.js +39 -0
- package/dist/esm/dto/PaginationResultDTO.js +46 -0
- package/dist/esm/dto/PaginationSearchDTO.js +41 -0
- package/dist/esm/dto/Paginator.js +50 -0
- package/dist/esm/exceptions/DestroyRuntimeContainerException.js +13 -0
- package/dist/esm/exceptions/InvalidActionPatternDepthException.js +11 -0
- package/dist/esm/exceptions/InvalidAssistantFunctionTypeException.js +12 -0
- package/dist/esm/exceptions/InvalidObjectTypeException.js +12 -0
- package/dist/esm/exceptions/MethodNotFoundException.js +11 -0
- package/dist/esm/exceptions/ObjectDestroyedException.js +12 -0
- package/dist/esm/exceptions/alias/AliasExistsException.js +11 -0
- package/dist/esm/exceptions/alias/AliasNotFoundException.js +11 -0
- package/dist/esm/exceptions/alias/InvalidAliasNameException.js +11 -0
- package/dist/esm/exceptions/di/DependencyInjectionException.js +12 -0
- package/dist/esm/exceptions/di/InvalidObjectOptionsException.js +12 -0
- package/dist/esm/exceptions/di/LifetimeLockedException.js +12 -0
- package/dist/esm/exceptions/di/OverridableObjectTargetConfigNotFoundException.js +12 -0
- package/dist/esm/exceptions/dto/InvalidMethodAcceptException.js +12 -0
- package/dist/esm/exceptions/dto/InvalidMethodReturnException.js +12 -0
- package/dist/esm/exceptions/dto/InvalidValueException.js +14 -0
- package/dist/esm/exports/ASSTDecorators.js +3 -0
- package/dist/esm/exports/Core.js +64 -0
- package/dist/esm/exports/DIDecorators.js +5 -0
- package/dist/esm/exports/DTODecorators.js +6 -0
- package/dist/esm/exports/DTOs.js +16 -0
- package/dist/esm/exports/LoggerComponent.js +3 -0
- package/dist/esm/interfaces/IBaseObjectConstructor.js +1 -0
- package/dist/esm/interfaces/IConstructor.js +1 -0
- package/dist/esm/interfaces/ILogger.js +1 -0
- package/dist/esm/lib/app/Application.js +606 -0
- package/dist/esm/lib/app/ApplicationConfigLoader.js +26 -0
- package/dist/esm/lib/app/MigrationCommand.js +28 -0
- package/dist/esm/lib/base/BaseObject.js +605 -0
- package/dist/esm/lib/base/EventEmitter.js +147 -0
- package/dist/esm/lib/base/async-constructor/Append.js +18 -0
- package/dist/esm/lib/base/async-constructor/AsyncConstructor.js +7 -0
- package/dist/esm/lib/base/internal/ApplicationLaunch.js +53 -0
- package/dist/esm/lib/base/internal/ConfigurableRecordsInjection.js +76 -0
- package/dist/esm/lib/base/internal/EventEmitter2.js +711 -0
- package/dist/esm/lib/base/internal/MemberDeclarations.js +40 -0
- package/dist/esm/lib/base/internal/MethodAssistantFunction.js +106 -0
- package/dist/esm/lib/base/internal/ModuleConfigLoader.js +109 -0
- package/dist/esm/lib/base/internal/ModuleInitialization.js +5 -0
- package/dist/esm/lib/base/internal/ObjectConfiguration.js +36 -0
- package/dist/esm/lib/base/internal/ObjectContainer.js +19 -0
- package/dist/esm/lib/base/internal/ObjectInjection.js +53 -0
- package/dist/esm/lib/base/internal/ObjectOptionsCheck.js +67 -0
- package/dist/esm/lib/base/internal/ObjectStartup.js +69 -0
- package/dist/esm/lib/base/internal/ObjectType.js +68 -0
- package/dist/esm/lib/core/Alias.js +93 -0
- package/dist/esm/lib/core/Component.js +359 -0
- package/dist/esm/lib/core/Container.js +629 -0
- package/dist/esm/lib/core/Module.js +265 -0
- package/dist/esm/lib/core/Provider.js +54 -0
- package/dist/esm/lib/dto/CachedSchema.js +1 -0
- package/dist/esm/lib/dto/DTO.js +458 -0
- package/dist/esm/lib/dto/DataValidator.js +243 -0
- package/dist/esm/lib/dto/FlexibleDTO.js +33 -0
- package/dist/esm/lib/dto/MethodValidation.js +136 -0
- package/dist/esm/lib/dto/ObjectSchemaValidation.js +167 -0
- package/dist/esm/lib/dto/internal/CronValidator.js +125 -0
- package/dist/esm/lib/foundation/BasicInfo.js +106 -0
- package/dist/esm/lib/foundation/EndProcess.js +26 -0
- package/dist/esm/lib/foundation/Exception.js +160 -0
- package/dist/esm/lib/foundation/LifecycleErrorReporter.js +59 -0
- package/dist/esm/lib/foundation/Packaging.js +38 -0
- package/dist/esm/lib/foundation/ThrowWarning.js +13 -0
- package/dist/esm/lib/helpers/internal/WithCause.js +9 -0
- package/dist/esm/lib/ioc/ConstructorSymbol.js +17 -0
- package/dist/esm/lib/ioc/DependencyInjectionContainer.js +409 -0
- package/dist/esm/lib/ioc/Errors.js +108 -0
- package/dist/esm/lib/ioc/Lifetime.js +27 -0
- package/dist/esm/lib/ioc/ListModules.js +68 -0
- package/dist/esm/lib/ioc/LoadModuleNative.js +5 -0
- package/dist/esm/lib/ioc/LoadModules.js +164 -0
- package/dist/esm/lib/ioc/ObjectLifetime.js +34 -0
- package/dist/esm/lib/ioc/ObjectWeakRefs.js +42 -0
- package/dist/esm/lib/ioc/Resolvers.js +242 -0
- package/dist/esm/lib/ioc/Utils.js +65 -0
- package/dist/esm/lib/validation/JsonSchema.js +81 -0
- package/dist/esm/lib/validation/VLD.js +210 -0
- package/dist/esm/lib/validation/ValidationLanguage.js +51 -0
- package/dist/esm/lib/validation/ValidationMessages.js +151 -0
- package/dist/esm/lib/validation/engine/address/decode.js +101 -0
- package/dist/esm/lib/validation/engine/address/domain.js +143 -0
- package/dist/esm/lib/validation/engine/address/email.js +145 -0
- package/dist/esm/lib/validation/engine/address/errors.js +27 -0
- package/dist/esm/lib/validation/engine/address/index.js +9 -0
- package/dist/esm/lib/validation/engine/address/ip.js +46 -0
- package/dist/esm/lib/validation/engine/address/uri.js +214 -0
- package/dist/esm/lib/validation/engine/expression/index.js +352 -0
- package/dist/esm/lib/validation/engine/json-schema/combinations.js +30 -0
- package/dist/esm/lib/validation/engine/json-schema/helpers.js +366 -0
- package/dist/esm/lib/validation/engine/json-schema/import.js +865 -0
- package/dist/esm/lib/validation/engine/json-schema/index.js +36 -0
- package/dist/esm/lib/validation/engine/json-schema/model.js +4 -0
- package/dist/esm/lib/validation/engine/json-schema/parsers/json-2020-12.js +19 -0
- package/dist/esm/lib/validation/engine/json-schema/parsers/json-draft-04.js +56 -0
- package/dist/esm/lib/validation/engine/json-schema/parsers/json-draft-2019-09.js +32 -0
- package/dist/esm/lib/validation/engine/json-schema/parsers/json.js +1460 -0
- package/dist/esm/lib/validation/engine/json-schema/parsers/open-api-3.1.js +34 -0
- package/dist/esm/lib/validation/engine/json-schema/parsers/open-api.js +169 -0
- package/dist/esm/lib/validation/engine/location/index.js +20 -0
- package/dist/esm/lib/validation/engine/schema/annotate.js +126 -0
- package/dist/esm/lib/validation/engine/schema/assert.js +60 -0
- package/dist/esm/lib/validation/engine/schema/base.js +797 -0
- package/dist/esm/lib/validation/engine/schema/cache.js +94 -0
- package/dist/esm/lib/validation/engine/schema/common.js +203 -0
- package/dist/esm/lib/validation/engine/schema/compile.js +203 -0
- package/dist/esm/lib/validation/engine/schema/errors.js +189 -0
- package/dist/esm/lib/validation/engine/schema/extend.js +199 -0
- package/dist/esm/lib/validation/engine/schema/extensions/bigint.js +170 -0
- package/dist/esm/lib/validation/engine/schema/fastpath.js +622 -0
- package/dist/esm/lib/validation/engine/schema/formats.js +102 -0
- package/dist/esm/lib/validation/engine/schema/index.js +199 -0
- package/dist/esm/lib/validation/engine/schema/lazy.js +5 -0
- package/dist/esm/lib/validation/engine/schema/manifest.js +325 -0
- package/dist/esm/lib/validation/engine/schema/messages.js +131 -0
- package/dist/esm/lib/validation/engine/schema/model.js +1 -0
- package/dist/esm/lib/validation/engine/schema/modify.js +186 -0
- package/dist/esm/lib/validation/engine/schema/ref.js +277 -0
- package/dist/esm/lib/validation/engine/schema/schemas.js +262 -0
- package/dist/esm/lib/validation/engine/schema/state.js +110 -0
- package/dist/esm/lib/validation/engine/schema/template.js +294 -0
- package/dist/esm/lib/validation/engine/schema/trace.js +240 -0
- package/dist/esm/lib/validation/engine/schema/types/alternatives.js +294 -0
- package/dist/esm/lib/validation/engine/schema/types/any.js +160 -0
- package/dist/esm/lib/validation/engine/schema/types/array.js +630 -0
- package/dist/esm/lib/validation/engine/schema/types/binary.js +78 -0
- package/dist/esm/lib/validation/engine/schema/types/boolean.js +104 -0
- package/dist/esm/lib/validation/engine/schema/types/date.js +159 -0
- package/dist/esm/lib/validation/engine/schema/types/function.js +63 -0
- package/dist/esm/lib/validation/engine/schema/types/keys.js +873 -0
- package/dist/esm/lib/validation/engine/schema/types/link.js +122 -0
- package/dist/esm/lib/validation/engine/schema/types/number.js +346 -0
- package/dist/esm/lib/validation/engine/schema/types/object.js +16 -0
- package/dist/esm/lib/validation/engine/schema/types/string.js +728 -0
- package/dist/esm/lib/validation/engine/schema/types/symbol.js +70 -0
- package/dist/esm/lib/validation/engine/schema/validator.js +638 -0
- package/dist/esm/lib/validation/engine/schema/values.js +164 -0
- package/dist/esm/lib/validation/engine/sorter/index.js +176 -0
- package/dist/esm/lib/validation/engine/tlds/index.js +5 -0
- package/dist/esm/lib/validation/engine/tlds/tlds.js +1445 -0
- package/dist/esm/lib/validation/engine/utils/applyToDefaults.js +86 -0
- package/dist/esm/lib/validation/engine/utils/assert.js +20 -0
- package/dist/esm/lib/validation/engine/utils/assertError.js +14 -0
- package/dist/esm/lib/validation/engine/utils/clone.js +157 -0
- package/dist/esm/lib/validation/engine/utils/deepEqual.js +262 -0
- package/dist/esm/lib/validation/engine/utils/escapeHtml.js +59 -0
- package/dist/esm/lib/validation/engine/utils/escapeRegex.js +10 -0
- package/dist/esm/lib/validation/engine/utils/ignore.js +9 -0
- package/dist/esm/lib/validation/engine/utils/index.js +16 -0
- package/dist/esm/lib/validation/engine/utils/merge.js +64 -0
- package/dist/esm/lib/validation/engine/utils/reach.js +59 -0
- package/dist/esm/lib/validation/engine/utils/stringify.js +15 -0
- package/dist/esm/lib/validation/engine/utils/types.js +47 -0
- package/dist/esm/lib/validation/engine/utils/utils.js +18 -0
- package/dist/esm/lib/validation/exceptions/SchemaConversionException.js +10 -0
- package/dist/esm/lib/validation/exceptions/SchemaDefinitionException.js +10 -0
- package/dist/esm/lib/validation/exceptions/SchemaException.js +6 -0
- package/dist/esm/lib/validation/exceptions/SchemaValidationException.js +39 -0
- package/dist/esm/lib/validation/interfaces/AlternativesSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/AnySchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/ArraySchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/ArraySortOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/ArrayUniqueOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/Base64Options.js +1 -0
- package/dist/esm/lib/validation/interfaces/BaseValidationOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/BigIntSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/BinarySchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/BooleanSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/Cache.js +1 -0
- package/dist/esm/lib/validation/interfaces/CacheConfiguration.js +1 -0
- package/dist/esm/lib/validation/interfaces/CompileOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/Context.js +1 -0
- package/dist/esm/lib/validation/interfaces/CustomHelpers.js +1 -0
- package/dist/esm/lib/validation/interfaces/DataUriOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/DateSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/DependencyOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/Description.js +1 -0
- package/dist/esm/lib/validation/interfaces/DomainOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/EmailOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/ErrorFormattingOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/ErrorReport.js +1 -0
- package/dist/esm/lib/validation/interfaces/ErrorValidationOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/Extension.js +1 -0
- package/dist/esm/lib/validation/interfaces/ExtensionFlag.js +1 -0
- package/dist/esm/lib/validation/interfaces/ExternalHelpers.js +1 -0
- package/dist/esm/lib/validation/interfaces/FunctionSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/GuidOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/HexOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/HierarchySeparatorOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/IpOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/LanguageMessageTemplate.js +1 -0
- package/dist/esm/lib/validation/interfaces/LinkSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/NumberSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/ObjectPatternOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/ObjectSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/Reference.js +1 -0
- package/dist/esm/lib/validation/interfaces/ReferenceOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/RenameOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/RuleOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/SchemaInternals.js +1 -0
- package/dist/esm/lib/validation/interfaces/State.js +1 -0
- package/dist/esm/lib/validation/interfaces/StringRegexOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/StringSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/SwitchCases.js +1 -0
- package/dist/esm/lib/validation/interfaces/SwitchDefault.js +1 -0
- package/dist/esm/lib/validation/interfaces/SymbolSchema.js +1 -0
- package/dist/esm/lib/validation/interfaces/TopLevelDomainOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/UriOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/ValidationErrorItem.js +1 -0
- package/dist/esm/lib/validation/interfaces/ValidationOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/WhenOptions.js +1 -0
- package/dist/esm/lib/validation/interfaces/WhenSchemaOptions.js +1 -0
- package/dist/esm/lib/validation/messages/ar.js +143 -0
- package/dist/esm/lib/validation/messages/de.js +143 -0
- package/dist/esm/lib/validation/messages/es.js +143 -0
- package/dist/esm/lib/validation/messages/fr.js +143 -0
- package/dist/esm/lib/validation/messages/hi.js +143 -0
- package/dist/esm/lib/validation/messages/id.js +143 -0
- package/dist/esm/lib/validation/messages/it.js +143 -0
- package/dist/esm/lib/validation/messages/ja.js +143 -0
- package/dist/esm/lib/validation/messages/ko.js +143 -0
- package/dist/esm/lib/validation/messages/nl.js +143 -0
- package/dist/esm/lib/validation/messages/pl.js +143 -0
- package/dist/esm/lib/validation/messages/pt-BR.js +143 -0
- package/dist/esm/lib/validation/messages/ru.js +143 -0
- package/dist/esm/lib/validation/messages/th.js +143 -0
- package/dist/esm/lib/validation/messages/tr.js +143 -0
- package/dist/esm/lib/validation/messages/uk.js +143 -0
- package/dist/esm/lib/validation/messages/vi.js +143 -0
- package/dist/esm/lib/validation/messages/zh-CN.js +143 -0
- package/dist/esm/lib/validation/messages/zh-TW.js +143 -0
- package/dist/esm/lib/validation/types/BasicType.js +1 -0
- package/dist/esm/lib/validation/types/ComparatorFunction.js +1 -0
- package/dist/esm/lib/validation/types/CustomValidator.js +1 -0
- package/dist/esm/lib/validation/types/ExtensionBoundSchema.js +1 -0
- package/dist/esm/lib/validation/types/ExternalValidationFunction.js +1 -0
- package/dist/esm/lib/validation/types/IsNonPrimitiveSubsetUnion.js +1 -0
- package/dist/esm/lib/validation/types/IsPrimitiveSubset.js +1 -0
- package/dist/esm/lib/validation/types/IsUnion.js +1 -0
- package/dist/esm/lib/validation/types/LanguageMessages.js +1 -0
- package/dist/esm/lib/validation/types/NoNestedArrays.js +1 -0
- package/dist/esm/lib/validation/types/NullableType.js +1 -0
- package/dist/esm/lib/validation/types/ObjectPropertiesSchema.js +1 -0
- package/dist/esm/lib/validation/types/PartialSchemaMap.js +1 -0
- package/dist/esm/lib/validation/types/PresenceMode.js +1 -0
- package/dist/esm/lib/validation/types/Primitives.js +1 -0
- package/dist/esm/lib/validation/types/Schema.js +1 -0
- package/dist/esm/lib/validation/types/SchemaFunction.js +1 -0
- package/dist/esm/lib/validation/types/SchemaLike.js +1 -0
- package/dist/esm/lib/validation/types/SchemaLikeWithoutArray.js +1 -0
- package/dist/esm/lib/validation/types/SchemaMap.js +1 -0
- package/dist/esm/lib/validation/types/StrictSchemaMap.js +1 -0
- package/dist/esm/lib/validation/types/Types.js +1 -0
- package/dist/esm/lib/validation/types/UnwrapSchemaLikeWithoutArray.js +1 -0
- package/dist/esm/lib/validation/types/ValidationErrorFunction.js +1 -0
- package/dist/esm/options/ApplicationOptions.js +71 -0
- package/dist/esm/options/LoadAnonymousObjectOptions.js +48 -0
- package/dist/esm/options/LoadNamedObjectOptions.js +39 -0
- package/dist/esm/options/LoadObjectOptions.js +50 -0
- package/dist/esm/options/ModuleLoadObjectsOptions.js +57 -0
- package/dist/esm/options/ModuleOptions.js +82 -0
- package/dist/esm/options/OverridableNamedObjectOptions.js +34 -0
- package/dist/esm/options/OverridableObjectOptions.js +49 -0
- package/dist/esm/types/ActionPattern.js +1 -0
- package/dist/esm/types/ApplicationExitReason.js +1 -0
- package/dist/esm/types/ClassDecorator.js +1 -0
- package/dist/esm/types/ComponentOptions.js +1 -0
- package/dist/esm/types/CronOptions.js +1 -0
- package/dist/esm/types/JSONSchema.js +1 -0
- package/dist/esm/types/MethodDecorator.js +1 -0
- package/dist/esm/types/ModuleOptions.js +1 -0
- package/dist/esm/types/ObjectOptions.js +1 -0
- package/dist/esm/types/PaginationMeta.js +1 -0
- package/dist/esm/types/ParameterDecorator.js +1 -0
- package/dist/esm/types/PropertyDecorator.js +1 -0
- package/dist/esm/types/ProviderOptions.js +1 -0
- package/dist/types/components/ConsoleLogger.d.ts +62 -0
- package/dist/types/constants/DIMetadataKey.d.ts +10 -0
- package/dist/types/constants/DTOMetadataKey.d.ts +5 -0
- package/dist/types/decorators/asst/After.d.ts +29 -0
- package/dist/types/decorators/asst/Before.d.ts +28 -0
- package/dist/types/decorators/di/Autoload.d.ts +33 -0
- package/dist/types/decorators/di/Configurable.d.ts +51 -0
- package/dist/types/decorators/di/Inject.d.ts +85 -0
- package/dist/types/decorators/di/Lifetime.d.ts +94 -0
- package/dist/types/decorators/dto/Accept.d.ts +38 -0
- package/dist/types/decorators/dto/Expect.d.ts +38 -0
- package/dist/types/decorators/dto/IndexSignature.d.ts +30 -0
- package/dist/types/decorators/dto/Return.d.ts +39 -0
- package/dist/types/dto/PaginationResultDTO.d.ts +33 -0
- package/dist/types/dto/PaginationSearchDTO.d.ts +33 -0
- package/dist/types/dto/Paginator.d.ts +54 -0
- package/dist/types/exceptions/DestroyRuntimeContainerException.d.ts +10 -0
- package/dist/types/exceptions/InvalidActionPatternDepthException.d.ts +8 -0
- package/dist/types/exceptions/InvalidAssistantFunctionTypeException.d.ts +9 -0
- package/dist/types/exceptions/InvalidObjectTypeException.d.ts +9 -0
- package/dist/types/exceptions/MethodNotFoundException.d.ts +8 -0
- package/dist/types/exceptions/ObjectDestroyedException.d.ts +9 -0
- package/dist/types/exceptions/alias/AliasExistsException.d.ts +8 -0
- package/dist/types/exceptions/alias/AliasNotFoundException.d.ts +8 -0
- package/dist/types/exceptions/alias/InvalidAliasNameException.d.ts +8 -0
- package/dist/types/exceptions/di/DependencyInjectionException.d.ts +9 -0
- package/dist/types/exceptions/di/InvalidObjectOptionsException.d.ts +9 -0
- package/dist/types/exceptions/di/LifetimeLockedException.d.ts +9 -0
- package/dist/types/exceptions/di/OverridableObjectTargetConfigNotFoundException.d.ts +9 -0
- package/dist/types/exceptions/dto/InvalidMethodAcceptException.d.ts +9 -0
- package/dist/types/exceptions/dto/InvalidMethodReturnException.d.ts +9 -0
- package/dist/types/exceptions/dto/InvalidValueException.d.ts +11 -0
- package/dist/types/exports/ASSTDecorators.d.ts +3 -0
- package/dist/types/exports/Core.d.ts +93 -0
- package/dist/types/exports/DIDecorators.d.ts +5 -0
- package/dist/types/exports/DTODecorators.d.ts +6 -0
- package/dist/types/exports/DTOs.d.ts +17 -0
- package/dist/types/exports/LoggerComponent.d.ts +3 -0
- package/dist/types/interfaces/IBaseObjectConstructor.d.ts +10 -0
- package/dist/types/interfaces/IConstructor.d.ts +6 -0
- package/dist/types/interfaces/ILogger.d.ts +35 -0
- package/dist/types/lib/app/Application.d.ts +346 -0
- package/dist/types/lib/app/ApplicationConfigLoader.d.ts +17 -0
- package/dist/types/lib/app/MigrationCommand.d.ts +31 -0
- package/dist/types/lib/base/BaseObject.d.ts +343 -0
- package/dist/types/lib/base/EventEmitter.d.ts +37 -0
- package/dist/types/lib/base/async-constructor/Append.d.ts +1 -0
- package/dist/types/lib/base/async-constructor/AsyncConstructor.d.ts +3 -0
- package/dist/types/lib/base/internal/ApplicationLaunch.d.ts +16 -0
- package/dist/types/lib/base/internal/ConfigurableRecordsInjection.d.ts +47 -0
- package/dist/types/lib/base/internal/EventEmitter2.d.ts +184 -0
- package/dist/types/lib/base/internal/MemberDeclarations.d.ts +23 -0
- package/dist/types/lib/base/internal/MethodAssistantFunction.d.ts +20 -0
- package/dist/types/lib/base/internal/ModuleConfigLoader.d.ts +46 -0
- package/dist/types/lib/base/internal/ModuleInitialization.d.ts +5 -0
- package/dist/types/lib/base/internal/ObjectConfiguration.d.ts +29 -0
- package/dist/types/lib/base/internal/ObjectContainer.d.ts +15 -0
- package/dist/types/lib/base/internal/ObjectInjection.d.ts +43 -0
- package/dist/types/lib/base/internal/ObjectOptionsCheck.d.ts +12 -0
- package/dist/types/lib/base/internal/ObjectStartup.d.ts +31 -0
- package/dist/types/lib/base/internal/ObjectType.d.ts +37 -0
- package/dist/types/lib/core/Alias.d.ts +48 -0
- package/dist/types/lib/core/Component.d.ts +267 -0
- package/dist/types/lib/core/Container.d.ts +341 -0
- package/dist/types/lib/core/Module.d.ts +165 -0
- package/dist/types/lib/core/Provider.d.ts +52 -0
- package/dist/types/lib/dto/CachedSchema.d.ts +7 -0
- package/dist/types/lib/dto/DTO.d.ts +278 -0
- package/dist/types/lib/dto/DataValidator.d.ts +166 -0
- package/dist/types/lib/dto/FlexibleDTO.d.ts +23 -0
- package/dist/types/lib/dto/MethodValidation.d.ts +44 -0
- package/dist/types/lib/dto/ObjectSchemaValidation.d.ts +86 -0
- package/dist/types/lib/dto/internal/CronValidator.d.ts +8 -0
- package/dist/types/lib/foundation/BasicInfo.d.ts +46 -0
- package/dist/types/lib/foundation/EndProcess.d.ts +14 -0
- package/dist/types/lib/foundation/Exception.d.ts +88 -0
- package/dist/types/lib/foundation/LifecycleErrorReporter.d.ts +26 -0
- package/dist/types/lib/foundation/Packaging.d.ts +29 -0
- package/dist/types/lib/foundation/ThrowWarning.d.ts +6 -0
- package/dist/types/lib/helpers/internal/WithCause.d.ts +6 -0
- package/dist/types/lib/ioc/ConstructorSymbol.d.ts +3 -0
- package/dist/types/lib/ioc/DependencyInjectionContainer.d.ts +178 -0
- package/dist/types/lib/ioc/Errors.d.ts +59 -0
- package/dist/types/lib/ioc/Lifetime.d.ts +12 -0
- package/dist/types/lib/ioc/ListModules.d.ts +42 -0
- package/dist/types/lib/ioc/LoadModuleNative.d.ts +1 -0
- package/dist/types/lib/ioc/LoadModules.d.ts +49 -0
- package/dist/types/lib/ioc/ObjectLifetime.d.ts +22 -0
- package/dist/types/lib/ioc/ObjectWeakRefs.d.ts +19 -0
- package/dist/types/lib/ioc/Resolvers.d.ts +136 -0
- package/dist/types/lib/ioc/Utils.d.ts +33 -0
- package/dist/types/lib/validation/JsonSchema.d.ts +127 -0
- package/dist/types/lib/validation/VLD.d.ts +275 -0
- package/dist/types/lib/validation/ValidationLanguage.d.ts +42 -0
- package/dist/types/lib/validation/ValidationMessages.d.ts +92 -0
- package/dist/types/lib/validation/engine/address/decode.d.ts +8 -0
- package/dist/types/lib/validation/engine/address/domain.d.ts +74 -0
- package/dist/types/lib/validation/engine/address/email.d.ts +27 -0
- package/dist/types/lib/validation/engine/address/errors.d.ts +48 -0
- package/dist/types/lib/validation/engine/address/index.d.ts +9 -0
- package/dist/types/lib/validation/engine/address/ip.d.ts +35 -0
- package/dist/types/lib/validation/engine/address/uri.d.ts +55 -0
- package/dist/types/lib/validation/engine/expression/index.d.ts +70 -0
- package/dist/types/lib/validation/engine/json-schema/combinations.d.ts +11 -0
- package/dist/types/lib/validation/engine/json-schema/helpers.d.ts +76 -0
- package/dist/types/lib/validation/engine/json-schema/import.d.ts +56 -0
- package/dist/types/lib/validation/engine/json-schema/index.d.ts +20 -0
- package/dist/types/lib/validation/engine/json-schema/model.d.ts +124 -0
- package/dist/types/lib/validation/engine/json-schema/parsers/json-2020-12.d.ts +9 -0
- package/dist/types/lib/validation/engine/json-schema/parsers/json-draft-04.d.ts +17 -0
- package/dist/types/lib/validation/engine/json-schema/parsers/json-draft-2019-09.d.ts +13 -0
- package/dist/types/lib/validation/engine/json-schema/parsers/json.d.ts +245 -0
- package/dist/types/lib/validation/engine/json-schema/parsers/open-api-3.1.d.ts +13 -0
- package/dist/types/lib/validation/engine/json-schema/parsers/open-api.d.ts +24 -0
- package/dist/types/lib/validation/engine/location/index.d.ts +18 -0
- package/dist/types/lib/validation/engine/schema/annotate.d.ts +13 -0
- package/dist/types/lib/validation/engine/schema/assert.d.ts +25 -0
- package/dist/types/lib/validation/engine/schema/base.d.ts +194 -0
- package/dist/types/lib/validation/engine/schema/cache.d.ts +41 -0
- package/dist/types/lib/validation/engine/schema/common.d.ts +79 -0
- package/dist/types/lib/validation/engine/schema/compile.d.ts +81 -0
- package/dist/types/lib/validation/engine/schema/errors.d.ts +94 -0
- package/dist/types/lib/validation/engine/schema/extend.d.ts +122 -0
- package/dist/types/lib/validation/engine/schema/extensions/bigint.d.ts +33 -0
- package/dist/types/lib/validation/engine/schema/fastpath.d.ts +35 -0
- package/dist/types/lib/validation/engine/schema/formats.d.ts +8 -0
- package/dist/types/lib/validation/engine/schema/index.d.ts +95 -0
- package/dist/types/lib/validation/engine/schema/lazy.d.ts +21 -0
- package/dist/types/lib/validation/engine/schema/manifest.d.ts +52 -0
- package/dist/types/lib/validation/engine/schema/messages.d.ts +37 -0
- package/dist/types/lib/validation/engine/schema/model.d.ts +196 -0
- package/dist/types/lib/validation/engine/schema/modify.d.ts +58 -0
- package/dist/types/lib/validation/engine/schema/ref.d.ts +116 -0
- package/dist/types/lib/validation/engine/schema/schemas.d.ts +6 -0
- package/dist/types/lib/validation/engine/schema/state.d.ts +48 -0
- package/dist/types/lib/validation/engine/schema/template.d.ts +72 -0
- package/dist/types/lib/validation/engine/schema/trace.d.ts +121 -0
- package/dist/types/lib/validation/engine/schema/types/alternatives.d.ts +36 -0
- package/dist/types/lib/validation/engine/schema/types/any.d.ts +37 -0
- package/dist/types/lib/validation/engine/schema/types/array.d.ts +46 -0
- package/dist/types/lib/validation/engine/schema/types/binary.d.ts +20 -0
- package/dist/types/lib/validation/engine/schema/types/boolean.d.ts +29 -0
- package/dist/types/lib/validation/engine/schema/types/date.d.ts +27 -0
- package/dist/types/lib/validation/engine/schema/types/function.d.ts +12 -0
- package/dist/types/lib/validation/engine/schema/types/keys.d.ts +119 -0
- package/dist/types/lib/validation/engine/schema/types/link.d.ts +21 -0
- package/dist/types/lib/validation/engine/schema/types/number.d.ts +46 -0
- package/dist/types/lib/validation/engine/schema/types/object.d.ts +10 -0
- package/dist/types/lib/validation/engine/schema/types/string.d.ts +115 -0
- package/dist/types/lib/validation/engine/schema/types/symbol.d.ts +23 -0
- package/dist/types/lib/validation/engine/schema/validator.d.ts +114 -0
- package/dist/types/lib/validation/engine/schema/values.d.ts +51 -0
- package/dist/types/lib/validation/engine/sorter/index.d.ts +54 -0
- package/dist/types/lib/validation/engine/tlds/index.d.ts +1 -0
- package/dist/types/lib/validation/engine/tlds/tlds.d.ts +4 -0
- package/dist/types/lib/validation/engine/utils/applyToDefaults.d.ts +17 -0
- package/dist/types/lib/validation/engine/utils/assert.d.ts +6 -0
- package/dist/types/lib/validation/engine/utils/assertError.d.ts +10 -0
- package/dist/types/lib/validation/engine/utils/clone.d.ts +25 -0
- package/dist/types/lib/validation/engine/utils/deepEqual.d.ts +29 -0
- package/dist/types/lib/validation/engine/utils/escapeHtml.d.ts +8 -0
- package/dist/types/lib/validation/engine/utils/escapeRegex.d.ts +8 -0
- package/dist/types/lib/validation/engine/utils/ignore.d.ts +8 -0
- package/dist/types/lib/validation/engine/utils/index.d.ts +16 -0
- package/dist/types/lib/validation/engine/utils/merge.d.ts +21 -0
- package/dist/types/lib/validation/engine/utils/reach.d.ts +30 -0
- package/dist/types/lib/validation/engine/utils/stringify.d.ts +8 -0
- package/dist/types/lib/validation/engine/utils/types.d.ts +26 -0
- package/dist/types/lib/validation/engine/utils/utils.d.ts +24 -0
- package/dist/types/lib/validation/exceptions/SchemaConversionException.d.ts +7 -0
- package/dist/types/lib/validation/exceptions/SchemaDefinitionException.d.ts +7 -0
- package/dist/types/lib/validation/exceptions/SchemaException.d.ts +6 -0
- package/dist/types/lib/validation/exceptions/SchemaValidationException.d.ts +36 -0
- package/dist/types/lib/validation/interfaces/AlternativesSchema.d.ts +45 -0
- package/dist/types/lib/validation/interfaces/AnySchema.d.ts +399 -0
- package/dist/types/lib/validation/interfaces/ArraySchema.d.ts +106 -0
- package/dist/types/lib/validation/interfaces/ArraySortOptions.d.ts +8 -0
- package/dist/types/lib/validation/interfaces/ArrayUniqueOptions.d.ts +9 -0
- package/dist/types/lib/validation/interfaces/Base64Options.d.ts +9 -0
- package/dist/types/lib/validation/interfaces/BaseValidationOptions.d.ts +97 -0
- package/dist/types/lib/validation/interfaces/BigIntSchema.d.ts +67 -0
- package/dist/types/lib/validation/interfaces/BinarySchema.d.ts +33 -0
- package/dist/types/lib/validation/interfaces/BooleanSchema.d.ts +29 -0
- package/dist/types/lib/validation/interfaces/Cache.d.ts +14 -0
- package/dist/types/lib/validation/interfaces/CacheConfiguration.d.ts +15 -0
- package/dist/types/lib/validation/interfaces/CompileOptions.d.ts +9 -0
- package/dist/types/lib/validation/interfaces/Context.d.ts +9 -0
- package/dist/types/lib/validation/interfaces/CustomHelpers.d.ts +15 -0
- package/dist/types/lib/validation/interfaces/DataUriOptions.d.ts +8 -0
- package/dist/types/lib/validation/interfaces/DateSchema.d.ts +48 -0
- package/dist/types/lib/validation/interfaces/DependencyOptions.d.ts +9 -0
- package/dist/types/lib/validation/interfaces/Description.d.ts +20 -0
- package/dist/types/lib/validation/interfaces/DomainOptions.d.ts +33 -0
- package/dist/types/lib/validation/interfaces/EmailOptions.d.ts +51 -0
- package/dist/types/lib/validation/interfaces/ErrorFormattingOptions.d.ts +60 -0
- package/dist/types/lib/validation/interfaces/ErrorReport.d.ts +14 -0
- package/dist/types/lib/validation/interfaces/ErrorValidationOptions.d.ts +5 -0
- package/dist/types/lib/validation/interfaces/Extension.d.ts +100 -0
- package/dist/types/lib/validation/interfaces/ExtensionFlag.d.ts +4 -0
- package/dist/types/lib/validation/interfaces/ExternalHelpers.d.ts +16 -0
- package/dist/types/lib/validation/interfaces/FunctionSchema.d.ts +31 -0
- package/dist/types/lib/validation/interfaces/GuidOptions.d.ts +6 -0
- package/dist/types/lib/validation/interfaces/HexOptions.d.ts +16 -0
- package/dist/types/lib/validation/interfaces/HierarchySeparatorOptions.d.ts +7 -0
- package/dist/types/lib/validation/interfaces/IpOptions.d.ts +11 -0
- package/dist/types/lib/validation/interfaces/LanguageMessageTemplate.d.ts +4 -0
- package/dist/types/lib/validation/interfaces/LinkSchema.d.ts +26 -0
- package/dist/types/lib/validation/interfaces/NumberSchema.d.ts +134 -0
- package/dist/types/lib/validation/interfaces/ObjectPatternOptions.d.ts +6 -0
- package/dist/types/lib/validation/interfaces/ObjectSchema.d.ts +173 -0
- package/dist/types/lib/validation/interfaces/Reference.d.ts +38 -0
- package/dist/types/lib/validation/interfaces/ReferenceOptions.d.ts +59 -0
- package/dist/types/lib/validation/interfaces/RenameOptions.d.ts +26 -0
- package/dist/types/lib/validation/interfaces/RuleOptions.d.ts +22 -0
- package/dist/types/lib/validation/interfaces/SchemaInternals.d.ts +103 -0
- package/dist/types/lib/validation/interfaces/State.d.ts +8 -0
- package/dist/types/lib/validation/interfaces/StringRegexOptions.d.ts +12 -0
- package/dist/types/lib/validation/interfaces/StringSchema.d.ts +220 -0
- package/dist/types/lib/validation/interfaces/SwitchCases.d.ts +11 -0
- package/dist/types/lib/validation/interfaces/SwitchDefault.d.ts +8 -0
- package/dist/types/lib/validation/interfaces/SymbolSchema.d.ts +16 -0
- package/dist/types/lib/validation/interfaces/TopLevelDomainOptions.d.ts +12 -0
- package/dist/types/lib/validation/interfaces/UriOptions.d.ts +31 -0
- package/dist/types/lib/validation/interfaces/ValidationErrorItem.d.ts +7 -0
- package/dist/types/lib/validation/interfaces/ValidationOptions.d.ts +21 -0
- package/dist/types/lib/validation/interfaces/WhenOptions.d.ts +30 -0
- package/dist/types/lib/validation/interfaces/WhenSchemaOptions.d.ts +11 -0
- package/dist/types/lib/validation/messages/ar.d.ts +5 -0
- package/dist/types/lib/validation/messages/de.d.ts +5 -0
- package/dist/types/lib/validation/messages/es.d.ts +5 -0
- package/dist/types/lib/validation/messages/fr.d.ts +5 -0
- package/dist/types/lib/validation/messages/hi.d.ts +5 -0
- package/dist/types/lib/validation/messages/id.d.ts +5 -0
- package/dist/types/lib/validation/messages/it.d.ts +5 -0
- package/dist/types/lib/validation/messages/ja.d.ts +5 -0
- package/dist/types/lib/validation/messages/ko.d.ts +5 -0
- package/dist/types/lib/validation/messages/nl.d.ts +5 -0
- package/dist/types/lib/validation/messages/pl.d.ts +5 -0
- package/dist/types/lib/validation/messages/pt-BR.d.ts +5 -0
- package/dist/types/lib/validation/messages/ru.d.ts +5 -0
- package/dist/types/lib/validation/messages/th.d.ts +5 -0
- package/dist/types/lib/validation/messages/tr.d.ts +5 -0
- package/dist/types/lib/validation/messages/uk.d.ts +5 -0
- package/dist/types/lib/validation/messages/vi.d.ts +5 -0
- package/dist/types/lib/validation/messages/zh-CN.d.ts +5 -0
- package/dist/types/lib/validation/messages/zh-TW.d.ts +5 -0
- package/dist/types/lib/validation/types/BasicType.d.ts +4 -0
- package/dist/types/lib/validation/types/ComparatorFunction.d.ts +4 -0
- package/dist/types/lib/validation/types/CustomValidator.d.ts +9 -0
- package/dist/types/lib/validation/types/ExtensionBoundSchema.d.ts +2 -0
- package/dist/types/lib/validation/types/ExternalValidationFunction.d.ts +8 -0
- package/dist/types/lib/validation/types/IsNonPrimitiveSubsetUnion.d.ts +3 -0
- package/dist/types/lib/validation/types/IsPrimitiveSubset.d.ts +3 -0
- package/dist/types/lib/validation/types/IsUnion.d.ts +1 -0
- package/dist/types/lib/validation/types/LanguageMessages.d.ts +5 -0
- package/dist/types/lib/validation/types/NoNestedArrays.d.ts +5 -0
- package/dist/types/lib/validation/types/NullableType.d.ts +1 -0
- package/dist/types/lib/validation/types/ObjectPropertiesSchema.d.ts +12 -0
- package/dist/types/lib/validation/types/PartialSchemaMap.d.ts +4 -0
- package/dist/types/lib/validation/types/PresenceMode.d.ts +4 -0
- package/dist/types/lib/validation/types/Primitives.d.ts +4 -0
- package/dist/types/lib/validation/types/Schema.d.ts +17 -0
- package/dist/types/lib/validation/types/SchemaFunction.d.ts +6 -0
- package/dist/types/lib/validation/types/SchemaLike.d.ts +6 -0
- package/dist/types/lib/validation/types/SchemaLikeWithoutArray.d.ts +7 -0
- package/dist/types/lib/validation/types/SchemaMap.d.ts +7 -0
- package/dist/types/lib/validation/types/StrictSchemaMap.d.ts +4 -0
- package/dist/types/lib/validation/types/Types.d.ts +4 -0
- package/dist/types/lib/validation/types/UnwrapSchemaLikeWithoutArray.d.ts +5 -0
- package/dist/types/lib/validation/types/ValidationErrorFunction.d.ts +7 -0
- package/dist/types/options/ApplicationOptions.d.ts +60 -0
- package/dist/types/options/LoadAnonymousObjectOptions.d.ts +33 -0
- package/dist/types/options/LoadNamedObjectOptions.d.ts +29 -0
- package/dist/types/options/LoadObjectOptions.d.ts +30 -0
- package/dist/types/options/ModuleLoadObjectsOptions.d.ts +44 -0
- package/dist/types/options/ModuleOptions.d.ts +74 -0
- package/dist/types/options/OverridableNamedObjectOptions.d.ts +26 -0
- package/dist/types/options/OverridableObjectOptions.d.ts +34 -0
- package/dist/types/types/ActionPattern.d.ts +6 -0
- package/dist/types/types/ApplicationExitReason.d.ts +13 -0
- package/dist/types/types/ClassDecorator.d.ts +6 -0
- package/dist/types/types/ComponentOptions.d.ts +20 -0
- package/dist/types/types/CronOptions.d.ts +25 -0
- package/dist/types/types/JSONSchema.d.ts +284 -0
- package/dist/types/types/MethodDecorator.d.ts +5 -0
- package/dist/types/types/ModuleOptions.d.ts +20 -0
- package/dist/types/types/ObjectOptions.d.ts +20 -0
- package/dist/types/types/PaginationMeta.d.ts +21 -0
- package/dist/types/types/ParameterDecorator.d.ts +5 -0
- package/dist/types/types/PropertyDecorator.d.ts +4 -0
- package/dist/types/types/ProviderOptions.d.ts +20 -0
- package/package.json +93 -95
- package/tsconfig.base.json +32 -0
- package/.eslintrc.json +0 -47
- package/.idea/codeStyles/Project.xml +0 -41
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -10
- package/.idea/lakutata-core.iml +0 -13
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/LICENSE +0 -21
- package/assets/lakutata-banner.png +0 -0
- package/assets/lakutata_logo.jpg +0 -0
- package/build/Application.d.ts +0 -33
- package/build/Application.js +0 -89
- package/build/Application.js.map +0 -1
- package/build/ApplicationManagement.d.ts +0 -4
- package/build/ApplicationManagement.js +0 -46
- package/build/ApplicationManagement.js.map +0 -1
- package/build/Core.d.ts +0 -46
- package/build/Core.js +0 -80
- package/build/Core.js.map +0 -1
- package/build/base/BaseObject.d.ts +0 -14
- package/build/base/BaseObject.js +0 -114
- package/build/base/BaseObject.js.map +0 -1
- package/build/base/Container.d.ts +0 -43
- package/build/base/Container.js +0 -269
- package/build/base/Container.js.map +0 -1
- package/build/base/MetadataReader.d.ts +0 -6
- package/build/base/MetadataReader.js +0 -14
- package/build/base/MetadataReader.js.map +0 -1
- package/build/base/Plugin.d.ts +0 -4
- package/build/base/Plugin.js +0 -10
- package/build/base/Plugin.js.map +0 -1
- package/build/base/ValidatorClass.d.ts +0 -305
- package/build/base/ValidatorClass.js +0 -514
- package/build/base/ValidatorClass.js.map +0 -1
- package/build/base/abstracts/Component.d.ts +0 -4
- package/build/base/abstracts/Component.js +0 -8
- package/build/base/abstracts/Component.js.map +0 -1
- package/build/base/abstracts/Exception.d.ts +0 -11
- package/build/base/abstracts/Exception.js +0 -60
- package/build/base/abstracts/Exception.js.map +0 -1
- package/build/base/abstracts/Module.d.ts +0 -88
- package/build/base/abstracts/Module.js +0 -390
- package/build/base/abstracts/Module.js.map +0 -1
- package/build/base/abstracts/Workflow.d.ts +0 -9
- package/build/base/abstracts/Workflow.js +0 -17
- package/build/base/abstracts/Workflow.js.map +0 -1
- package/build/base/process/Process.d.ts +0 -6
- package/build/base/process/Process.js +0 -15
- package/build/base/process/Process.js.map +0 -1
- package/build/base/process/ProcessManager.d.ts +0 -10
- package/build/base/process/ProcessManager.js +0 -34
- package/build/base/process/ProcessManager.js.map +0 -1
- package/build/base/thread/Thread.d.ts +0 -6
- package/build/base/thread/Thread.js +0 -14
- package/build/base/thread/Thread.js.map +0 -1
- package/build/base/thread/ThreadManager.d.ts +0 -10
- package/build/base/thread/ThreadManager.js +0 -34
- package/build/base/thread/ThreadManager.js.map +0 -1
- package/build/constants/MetadataKeys.d.ts +0 -2
- package/build/constants/MetadataKeys.js +0 -6
- package/build/constants/MetadataKeys.js.map +0 -1
- package/build/decorators/DependencyInjection.d.ts +0 -3
- package/build/decorators/DependencyInjection.js +0 -18
- package/build/decorators/DependencyInjection.js.map +0 -1
- package/build/decorators/MethodValidation.d.ts +0 -9
- package/build/decorators/MethodValidation.js +0 -75
- package/build/decorators/MethodValidation.js.map +0 -1
- package/build/exceptions/ComponentNotFoundException.d.ts +0 -6
- package/build/exceptions/ComponentNotFoundException.js +0 -17
- package/build/exceptions/ComponentNotFoundException.js.map +0 -1
- package/build/exceptions/CryptoException.d.ts +0 -5
- package/build/exceptions/CryptoException.js +0 -12
- package/build/exceptions/CryptoException.js.map +0 -1
- package/build/exceptions/FatalException.d.ts +0 -5
- package/build/exceptions/FatalException.js +0 -12
- package/build/exceptions/FatalException.js.map +0 -1
- package/build/exceptions/HttpRequestException.d.ts +0 -6
- package/build/exceptions/HttpRequestException.js +0 -20
- package/build/exceptions/HttpRequestException.js.map +0 -1
- package/build/exceptions/InvalidMethodAcceptException.d.ts +0 -5
- package/build/exceptions/InvalidMethodAcceptException.js +0 -12
- package/build/exceptions/InvalidMethodAcceptException.js.map +0 -1
- package/build/exceptions/InvalidMethodReturnException.d.ts +0 -5
- package/build/exceptions/InvalidMethodReturnException.js +0 -12
- package/build/exceptions/InvalidMethodReturnException.js.map +0 -1
- package/build/exceptions/ModuleNotFoundException.d.ts +0 -6
- package/build/exceptions/ModuleNotFoundException.js +0 -17
- package/build/exceptions/ModuleNotFoundException.js.map +0 -1
- package/build/exceptions/ProcessException.d.ts +0 -5
- package/build/exceptions/ProcessException.js +0 -12
- package/build/exceptions/ProcessException.js.map +0 -1
- package/build/exceptions/ThreadException.d.ts +0 -5
- package/build/exceptions/ThreadException.js +0 -12
- package/build/exceptions/ThreadException.js.map +0 -1
- package/build/exceptions/TimeoutException.d.ts +0 -5
- package/build/exceptions/TimeoutException.js +0 -12
- package/build/exceptions/TimeoutException.js.map +0 -1
- package/build/exceptions/ValidationException.d.ts +0 -5
- package/build/exceptions/ValidationException.js +0 -12
- package/build/exceptions/ValidationException.js.map +0 -1
- package/build/interfaces/IApplicationConfig.d.ts +0 -20
- package/build/interfaces/IApplicationConfig.js +0 -3
- package/build/interfaces/IApplicationConfig.js.map +0 -1
- package/build/interfaces/IComponentsConfig.d.ts +0 -8
- package/build/interfaces/IComponentsConfig.js +0 -3
- package/build/interfaces/IComponentsConfig.js.map +0 -1
- package/build/interfaces/IConstructor.d.ts +0 -4
- package/build/interfaces/IConstructor.js +0 -3
- package/build/interfaces/IConstructor.js.map +0 -1
- package/build/interfaces/IModulesConfig.d.ts +0 -17
- package/build/interfaces/IModulesConfig.js +0 -3
- package/build/interfaces/IModulesConfig.js.map +0 -1
- package/build/interfaces/IProcessConstructor.d.ts +0 -5
- package/build/interfaces/IProcessConstructor.js +0 -3
- package/build/interfaces/IProcessConstructor.js.map +0 -1
- package/build/interfaces/IThreadConstructor.d.ts +0 -5
- package/build/interfaces/IThreadConstructor.js +0 -3
- package/build/interfaces/IThreadConstructor.js.map +0 -1
- package/build/interfaces/ShellJsInterfaces.d.ts +0 -162
- package/build/interfaces/ShellJsInterfaces.js +0 -3
- package/build/interfaces/ShellJsInterfaces.js.map +0 -1
- package/build/lib/minified/ShellJs.d.ts +0 -2
- package/build/lib/minified/ShellJs.js +0 -3699
- package/build/lib/minified/ShellJs.js.map +0 -1
- package/build/lib/multipleRunner/constants/Channel.d.ts +0 -5
- package/build/lib/multipleRunner/constants/Channel.js +0 -9
- package/build/lib/multipleRunner/constants/Channel.js.map +0 -1
- package/build/lib/multipleRunner/constants/MetadataKey.d.ts +0 -2
- package/build/lib/multipleRunner/constants/MetadataKey.js +0 -6
- package/build/lib/multipleRunner/constants/MetadataKey.js.map +0 -1
- package/build/lib/multipleRunner/containers/ContainerVolume.d.ts +0 -4
- package/build/lib/multipleRunner/containers/ContainerVolume.js +0 -85
- package/build/lib/multipleRunner/containers/ContainerVolume.js.map +0 -1
- package/build/lib/multipleRunner/definitions/interfaces/ClassConstructor.d.ts +0 -3
- package/build/lib/multipleRunner/definitions/interfaces/ClassConstructor.js +0 -3
- package/build/lib/multipleRunner/definitions/interfaces/ClassConstructor.js.map +0 -1
- package/build/lib/multipleRunner/definitions/interfaces/MultipleRunnerBaseClassConstructor.d.ts +0 -4
- package/build/lib/multipleRunner/definitions/interfaces/MultipleRunnerBaseClassConstructor.js +0 -3
- package/build/lib/multipleRunner/definitions/interfaces/MultipleRunnerBaseClassConstructor.js.map +0 -1
- package/build/lib/multipleRunner/definitions/interfaces/ProcessClassConstructor.d.ts +0 -7
- package/build/lib/multipleRunner/definitions/interfaces/ProcessClassConstructor.js +0 -3
- package/build/lib/multipleRunner/definitions/interfaces/ProcessClassConstructor.js.map +0 -1
- package/build/lib/multipleRunner/definitions/interfaces/ProxyClass.d.ts +0 -3
- package/build/lib/multipleRunner/definitions/interfaces/ProxyClass.js +0 -3
- package/build/lib/multipleRunner/definitions/interfaces/ProxyClass.js.map +0 -1
- package/build/lib/multipleRunner/definitions/interfaces/ThreadClassConstructor.d.ts +0 -7
- package/build/lib/multipleRunner/definitions/interfaces/ThreadClassConstructor.js +0 -3
- package/build/lib/multipleRunner/definitions/interfaces/ThreadClassConstructor.js.map +0 -1
- package/build/lib/multipleRunner/lib/Process.d.ts +0 -5
- package/build/lib/multipleRunner/lib/Process.js +0 -45
- package/build/lib/multipleRunner/lib/Process.js.map +0 -1
- package/build/lib/multipleRunner/lib/Thread.d.ts +0 -5
- package/build/lib/multipleRunner/lib/Thread.js +0 -52
- package/build/lib/multipleRunner/lib/Thread.js.map +0 -1
- package/build/lib/multipleRunner/lib/bridges/BaseBridge.d.ts +0 -32
- package/build/lib/multipleRunner/lib/bridges/BaseBridge.js +0 -107
- package/build/lib/multipleRunner/lib/bridges/BaseBridge.js.map +0 -1
- package/build/lib/multipleRunner/lib/bridges/ProcessBridge.d.ts +0 -5
- package/build/lib/multipleRunner/lib/bridges/ProcessBridge.js +0 -23
- package/build/lib/multipleRunner/lib/bridges/ProcessBridge.js.map +0 -1
- package/build/lib/multipleRunner/lib/bridges/ThreadBridge.d.ts +0 -5
- package/build/lib/multipleRunner/lib/bridges/ThreadBridge.js +0 -22
- package/build/lib/multipleRunner/lib/bridges/ThreadBridge.js.map +0 -1
- package/build/lib/multipleRunner/lib/cores/GenerateExecArgv.d.ts +0 -2
- package/build/lib/multipleRunner/lib/cores/GenerateExecArgv.js +0 -35
- package/build/lib/multipleRunner/lib/cores/GenerateExecArgv.js.map +0 -1
- package/build/lib/multipleRunner/lib/cores/IsElectron.d.ts +0 -1
- package/build/lib/multipleRunner/lib/cores/IsElectron.js +0 -8
- package/build/lib/multipleRunner/lib/cores/IsElectron.js.map +0 -1
- package/build/lib/multipleRunner/lib/cores/ProcessClass.d.ts +0 -5
- package/build/lib/multipleRunner/lib/cores/ProcessClass.js +0 -12
- package/build/lib/multipleRunner/lib/cores/ProcessClass.js.map +0 -1
- package/build/lib/multipleRunner/lib/cores/ThreadClass.d.ts +0 -5
- package/build/lib/multipleRunner/lib/cores/ThreadClass.js +0 -12
- package/build/lib/multipleRunner/lib/cores/ThreadClass.js.map +0 -1
- package/build/lib/multipleRunner/lib/cores/UniParentBridgeHandler.d.ts +0 -2
- package/build/lib/multipleRunner/lib/cores/UniParentBridgeHandler.js +0 -104
- package/build/lib/multipleRunner/lib/cores/UniParentBridgeHandler.js.map +0 -1
- package/build/lib/multipleRunner/lib/prototypes/MultipleRunnerBaseClass.d.ts +0 -17
- package/build/lib/multipleRunner/lib/prototypes/MultipleRunnerBaseClass.js +0 -57
- package/build/lib/multipleRunner/lib/prototypes/MultipleRunnerBaseClass.js.map +0 -1
- package/build/plugins/Crypto.d.ts +0 -18
- package/build/plugins/Crypto.js +0 -131
- package/build/plugins/Crypto.js.map +0 -1
- package/build/plugins/Formatter.d.ts +0 -19
- package/build/plugins/Formatter.js +0 -53
- package/build/plugins/Formatter.js.map +0 -1
- package/build/plugins/HttpRequest.d.ts +0 -45
- package/build/plugins/HttpRequest.js +0 -171
- package/build/plugins/HttpRequest.js.map +0 -1
- package/build/plugins/JSON.d.ts +0 -10
- package/build/plugins/JSON.js +0 -71
- package/build/plugins/JSON.js.map +0 -1
- package/build/plugins/Logger.d.ts +0 -25
- package/build/plugins/Logger.js +0 -112
- package/build/plugins/Logger.js.map +0 -1
- package/build/plugins/MessagePack.d.ts +0 -12
- package/build/plugins/MessagePack.js +0 -20
- package/build/plugins/MessagePack.js.map +0 -1
- package/build/plugins/Security.d.ts +0 -32
- package/build/plugins/Security.js +0 -153
- package/build/plugins/Security.js.map +0 -1
- package/build/plugins/Shell.d.ts +0 -39
- package/build/plugins/Shell.js +0 -58
- package/build/plugins/Shell.js.map +0 -1
- package/build/types/TPluginsConfig.d.ts +0 -7
- package/build/types/TPluginsConfig.js +0 -3
- package/build/types/TPluginsConfig.js.map +0 -1
- package/build/types/TProcessesConfig.d.ts +0 -3
- package/build/types/TProcessesConfig.js +0 -3
- package/build/types/TProcessesConfig.js.map +0 -1
- package/build/types/TThreadsConfig.d.ts +0 -3
- package/build/types/TThreadsConfig.js +0 -3
- package/build/types/TThreadsConfig.js.map +0 -1
- package/build/types/TWorkflowsConfig.d.ts +0 -4
- package/build/types/TWorkflowsConfig.js +0 -3
- package/build/types/TWorkflowsConfig.js.map +0 -1
- package/build/utils/Delay.d.ts +0 -1
- package/build/utils/Delay.js +0 -13
- package/build/utils/Delay.js.map +0 -1
- package/build/utils/Timeout.d.ts +0 -2
- package/build/utils/Timeout.js +0 -27
- package/build/utils/Timeout.js.map +0 -1
- package/build/utils/ValidDataUrl.d.ts +0 -1
- package/build/utils/ValidDataUrl.js +0 -8
- package/build/utils/ValidDataUrl.js.map +0 -1
- package/build/utils/Validator.d.ts +0 -2
- package/build/utils/Validator.js +0 -6
- package/build/utils/Validator.js.map +0 -1
- package/docs/component.md +0 -1
- package/docs/exception.md +0 -1
- package/docs/faq.md +0 -1
- package/docs/introduction.md +0 -1
- package/docs/module.md +0 -1
- package/docs/plugin.md +0 -1
- package/docs/process.md +0 -1
- package/docs/thread.md +0 -1
- package/docs/utilities.md +0 -1
- package/docs/workflow.md +0 -1
- package/src/Application.ts +0 -178
- package/src/ApplicationManagement.ts +0 -48
- package/src/Core.ts +0 -83
- package/src/base/BaseObject.ts +0 -146
- package/src/base/Container.ts +0 -375
- package/src/base/MetadataReader.ts +0 -12
- package/src/base/Plugin.ts +0 -11
- package/src/base/ValidatorClass.ts +0 -707
- package/src/base/abstracts/Component.ts +0 -5
- package/src/base/abstracts/Exception.ts +0 -68
- package/src/base/abstracts/Module.ts +0 -528
- package/src/base/abstracts/Workflow.ts +0 -35
- package/src/base/process/Process.ts +0 -23
- package/src/base/process/ProcessManager.ts +0 -54
- package/src/base/thread/Thread.ts +0 -23
- package/src/base/thread/ThreadManager.ts +0 -54
- package/src/constants/MetadataKeys.ts +0 -2
- package/src/decorators/DependencyInjection.ts +0 -17
- package/src/decorators/MethodValidation.ts +0 -80
- package/src/exceptions/ComponentNotFoundException.ts +0 -12
- package/src/exceptions/CryptoException.ts +0 -6
- package/src/exceptions/FatalException.ts +0 -6
- package/src/exceptions/HttpRequestException.ts +0 -15
- package/src/exceptions/InvalidMethodAcceptException.ts +0 -6
- package/src/exceptions/InvalidMethodReturnException.ts +0 -6
- package/src/exceptions/ModuleNotFoundException.ts +0 -12
- package/src/exceptions/ProcessException.ts +0 -6
- package/src/exceptions/ThreadException.ts +0 -6
- package/src/exceptions/TimeoutException.ts +0 -6
- package/src/exceptions/ValidationException.ts +0 -6
- package/src/interfaces/IApplicationConfig.ts +0 -21
- package/src/interfaces/IComponentsConfig.ts +0 -9
- package/src/interfaces/IConstructor.ts +0 -5
- package/src/interfaces/IModulesConfig.ts +0 -18
- package/src/interfaces/IProcessConstructor.ts +0 -6
- package/src/interfaces/IThreadConstructor.ts +0 -6
- package/src/interfaces/ShellJsInterfaces.ts +0 -858
- package/src/lib/minified/ShellJs.js +0 -1
- package/src/lib/multipleRunner/constants/Channel.ts +0 -5
- package/src/lib/multipleRunner/constants/MetadataKey.ts +0 -2
- package/src/lib/multipleRunner/containers/ContainerVolume.ts +0 -83
- package/src/lib/multipleRunner/definitions/interfaces/ClassConstructor.ts +0 -3
- package/src/lib/multipleRunner/definitions/interfaces/MultipleRunnerBaseClassConstructor.ts +0 -5
- package/src/lib/multipleRunner/definitions/interfaces/ProcessClassConstructor.ts +0 -10
- package/src/lib/multipleRunner/definitions/interfaces/ProxyClass.ts +0 -3
- package/src/lib/multipleRunner/definitions/interfaces/ThreadClassConstructor.ts +0 -10
- package/src/lib/multipleRunner/lib/Process.ts +0 -45
- package/src/lib/multipleRunner/lib/Thread.ts +0 -52
- package/src/lib/multipleRunner/lib/bridges/BaseBridge.ts +0 -118
- package/src/lib/multipleRunner/lib/bridges/ProcessBridge.ts +0 -22
- package/src/lib/multipleRunner/lib/bridges/ThreadBridge.ts +0 -20
- package/src/lib/multipleRunner/lib/cores/GenerateExecArgv.ts +0 -28
- package/src/lib/multipleRunner/lib/cores/IsElectron.ts +0 -3
- package/src/lib/multipleRunner/lib/cores/ProcessClass.ts +0 -8
- package/src/lib/multipleRunner/lib/cores/ThreadClass.ts +0 -8
- package/src/lib/multipleRunner/lib/cores/UniParentBridgeHandler.ts +0 -97
- package/src/lib/multipleRunner/lib/prototypes/MultipleRunnerBaseClass.ts +0 -70
- package/src/plugins/Crypto.ts +0 -140
- package/src/plugins/Formatter.ts +0 -83
- package/src/plugins/HttpRequest.ts +0 -241
- package/src/plugins/JSON.ts +0 -77
- package/src/plugins/Logger.ts +0 -154
- package/src/plugins/MessagePack.ts +0 -30
- package/src/plugins/Security.ts +0 -273
- package/src/plugins/Shell.ts +0 -371
- package/src/tests/Main.spec.ts +0 -175
- package/src/tests/components/TestComponent1.ts +0 -11
- package/src/tests/exceptions/TestException.ts +0 -6
- package/src/tests/modules/Test1.ts +0 -88
- package/src/tests/modules/Test2.ts +0 -65
- package/src/tests/modules/Test3.ts +0 -54
- package/src/tests/modules/Test4.ts +0 -28
- package/src/tests/plugins/TestPlugin1.ts +0 -22
- package/src/tests/processes/TestProcess.ts +0 -11
- package/src/tests/threads/TestThread.ts +0 -13
- package/src/tests/workflows/TestWorkflow.ts +0 -7
- package/src/types/TPluginsConfig.ts +0 -5
- package/src/types/TProcessesConfig.ts +0 -4
- package/src/types/TThreadsConfig.ts +0 -4
- package/src/types/TWorkflowsConfig.ts +0 -6
- package/src/utils/Delay.ts +0 -14
- package/src/utils/Timeout.ts +0 -27
- package/src/utils/ValidDataUrl.ts +0 -8
- package/src/utils/Validator.ts +0 -3
- package/tsconfig.json +0 -35
|
@@ -0,0 +1,1460 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived from the upstream lib/parsers/json.js (see UPSTREAM.md; MIT, see THIRD_PARTY_NOTICES.md)
|
|
3
|
+
*/
|
|
4
|
+
import { escapeRegex } from '../../utils/index.js';
|
|
5
|
+
import { FLOAT_MAX, integerTypes } from '../../schema/types/number.js';
|
|
6
|
+
import { combinations } from '../combinations.js';
|
|
7
|
+
import * as _ from '../helpers.js';
|
|
8
|
+
/**
|
|
9
|
+
* Default logical operator (or/and/nand/xor/oxor) parsers
|
|
10
|
+
*/
|
|
11
|
+
const LOGICAL_OP_PARSER = {
|
|
12
|
+
or: function (schema, dependency) {
|
|
13
|
+
schema.anyOf = _.map(dependency.peers, (peer) => {
|
|
14
|
+
return { required: [peer] };
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
and: function (schema, dependency) {
|
|
18
|
+
schema.oneOf = [{ required: dependency.peers }];
|
|
19
|
+
schema.oneOf.push({
|
|
20
|
+
allOf: _.map(dependency.peers, (peer) => {
|
|
21
|
+
return { not: { required: [peer] } };
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
nand: function (schema, dependency) {
|
|
26
|
+
schema.not = { required: dependency.peers };
|
|
27
|
+
},
|
|
28
|
+
xor: function (schema, dependency) {
|
|
29
|
+
schema.if = {
|
|
30
|
+
propertyNames: { enum: dependency.peers },
|
|
31
|
+
minProperties: 2
|
|
32
|
+
};
|
|
33
|
+
schema.then = false;
|
|
34
|
+
schema.else = {
|
|
35
|
+
oneOf: _.map(dependency.peers, (peer) => {
|
|
36
|
+
return { required: [peer] };
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
oxor: function (schema, dependency) {
|
|
41
|
+
schema.oneOf = _.map(dependency.peers, (peer) => {
|
|
42
|
+
return { required: [peer] };
|
|
43
|
+
});
|
|
44
|
+
schema.oneOf.push({
|
|
45
|
+
not: {
|
|
46
|
+
oneOf: _.map(combinations(dependency.peers, 1, 2), (combination) => {
|
|
47
|
+
return { required: combination };
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
with: function (schema, dependency) {
|
|
53
|
+
schema.dependencies = schema.dependencies || {};
|
|
54
|
+
schema.dependencies[dependency.key] = dependency.peers;
|
|
55
|
+
},
|
|
56
|
+
without: function (schema, dependency) {
|
|
57
|
+
schema.if = { required: [dependency.key] };
|
|
58
|
+
schema.then = {
|
|
59
|
+
not: {
|
|
60
|
+
anyOf: _.map(dependency.peers, (peer) => {
|
|
61
|
+
return { required: [peer] };
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The rules of number schemas which require integers
|
|
69
|
+
*/
|
|
70
|
+
const INTEGER_RULES = ['integer', 'port', ...Object.keys(integerTypes)];
|
|
71
|
+
/**
|
|
72
|
+
* The rules the type setters convert, by type (the rules of the other types, and the other rules, are dropped)
|
|
73
|
+
*/
|
|
74
|
+
const CONVERTED_RULES = {
|
|
75
|
+
any: ['allOf'],
|
|
76
|
+
alternatives: ['allOf'],
|
|
77
|
+
boolean: ['allOf'],
|
|
78
|
+
number: ['allOf', 'min', 'max', 'greater', 'less', 'multiple', 'sign', 'port', 'float', 'double', 'integer', ...Object.keys(integerTypes)],
|
|
79
|
+
bigint: ['allOf', 'min', 'max', 'greater', 'less', 'multiple', 'negative', 'positive'],
|
|
80
|
+
string: ['allOf', 'min', 'max', 'length', 'format', 'email', 'hostname', 'uri', 'ip', 'pattern', 'alphanum', 'token', 'hex', 'trim', 'isoDate', 'isoDuration', 'guid', 'uuid'],
|
|
81
|
+
object: ['allOf', 'min', 'max', 'length', 'keyNames'],
|
|
82
|
+
array: ['allOf', 'min', 'max', 'length', 'unique', 'has', 'items', 'ordered']
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The schema types which no JSON value matches
|
|
86
|
+
*/
|
|
87
|
+
const NON_JSON_TYPES = ['function', 'symbol'];
|
|
88
|
+
/**
|
|
89
|
+
* The keywords which annotate a schema, without constraining the values
|
|
90
|
+
*/
|
|
91
|
+
const ANNOTATIONS = ['title', 'description', 'default', 'examples', 'example', 'deprecated', 'readOnly', 'writeOnly', '$comment'];
|
|
92
|
+
/**
|
|
93
|
+
* The keywords of a subschema, which a single schema object can only hold once
|
|
94
|
+
*/
|
|
95
|
+
const CONDITION_KEYWORDS = ['if', 'then', 'else'];
|
|
96
|
+
/**
|
|
97
|
+
* Recognize the `override` representation in `describe()` output.
|
|
98
|
+
*
|
|
99
|
+
* `override` is a Symbol that can be used in `any().valid(…)`
|
|
100
|
+
* statements, to reset the list of valid values. In `describe()` output, it
|
|
101
|
+
* turns up as an object with 1 property:
|
|
102
|
+
*
|
|
103
|
+
* ```
|
|
104
|
+
* { override: true }
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
function isOverride(e) {
|
|
108
|
+
return typeof e === 'object'
|
|
109
|
+
&& e !== null
|
|
110
|
+
&& Object.keys(e).length === 1
|
|
111
|
+
&& e.override === true;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Whether a value is a JSON value (lakutata's own)
|
|
115
|
+
* @param value
|
|
116
|
+
*/
|
|
117
|
+
function isJsonValue(value) {
|
|
118
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean')
|
|
119
|
+
return true;
|
|
120
|
+
if (typeof value === 'number')
|
|
121
|
+
return isFinite(value);
|
|
122
|
+
if (Array.isArray(value))
|
|
123
|
+
return value.every(isJsonValue);
|
|
124
|
+
if (typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype)
|
|
125
|
+
return Object.values(value).every(isJsonValue);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The literal values of a values list of a schema description (null: a reference or a template, not expressible)
|
|
130
|
+
* @param values
|
|
131
|
+
*/
|
|
132
|
+
function literals(values) {
|
|
133
|
+
const result = [];
|
|
134
|
+
for (const value of values || []) {
|
|
135
|
+
if (isOverride(value))
|
|
136
|
+
continue;
|
|
137
|
+
if (value !== null && typeof value === 'object') {
|
|
138
|
+
const keys = Object.keys(value);
|
|
139
|
+
if (keys.length === 1 && keys[0] === 'value') {
|
|
140
|
+
result.push(value.value);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
result.push(value);
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The number of a limit of a schema description (undefined: a reference, or not a safe number)
|
|
151
|
+
* @param limit
|
|
152
|
+
*/
|
|
153
|
+
function numberLimit(limit) {
|
|
154
|
+
if (typeof limit === 'number' && isFinite(limit))
|
|
155
|
+
return limit;
|
|
156
|
+
if (typeof limit === 'bigint' && limit <= BigInt(Number.MAX_SAFE_INTEGER) && limit >= BigInt(Number.MIN_SAFE_INTEGER))
|
|
157
|
+
return Number(limit);
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The tighter of a bound and a limit
|
|
162
|
+
* @param bound
|
|
163
|
+
* @param limit
|
|
164
|
+
* @param exclusive
|
|
165
|
+
* @param lower
|
|
166
|
+
*/
|
|
167
|
+
function tighter(bound, limit, exclusive, lower) {
|
|
168
|
+
const value = numberLimit(limit);
|
|
169
|
+
if (value === undefined)
|
|
170
|
+
return bound;
|
|
171
|
+
if (!bound || (lower ? value > bound.value : value < bound.value))
|
|
172
|
+
return { value, exclusive };
|
|
173
|
+
if (value === bound.value && exclusive)
|
|
174
|
+
return { value, exclusive };
|
|
175
|
+
return bound;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The pattern of a regular expression of a schema description (null: its flags have no JSON Schema equivalent, or it
|
|
179
|
+
* is not a valid Unicode regular expression, as JSON Schema patterns are)
|
|
180
|
+
* @param regex
|
|
181
|
+
*/
|
|
182
|
+
function toPattern(regex) {
|
|
183
|
+
if (typeof regex !== 'string')
|
|
184
|
+
return null;
|
|
185
|
+
const match = /^\/([\s\S]*)\/([a-z]*)$/.exec(regex);
|
|
186
|
+
if (!match)
|
|
187
|
+
return null;
|
|
188
|
+
const [, source, flags] = match;
|
|
189
|
+
if (/[imsgyv]/.test(flags))
|
|
190
|
+
return null;
|
|
191
|
+
try {
|
|
192
|
+
new RegExp(source, 'u');
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return { source, flags };
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* A pattern matching the strings of a list, case-insensitively (as the insensitive flag compares them)
|
|
201
|
+
* @param values
|
|
202
|
+
*/
|
|
203
|
+
function insensitivePattern(values) {
|
|
204
|
+
const alternatives = values.map((value) => Array.from(value).map((character) => {
|
|
205
|
+
const lower = character.toLowerCase();
|
|
206
|
+
const upper = character.toUpperCase();
|
|
207
|
+
if (lower === upper || Array.from(lower).length !== 1 || Array.from(upper).length !== 1)
|
|
208
|
+
return escapeRegex(character);
|
|
209
|
+
return `[${escapeRegex(lower)}${escapeRegex(upper)}]`;
|
|
210
|
+
}).join(''));
|
|
211
|
+
return `^(?:${alternatives.join('|')})$`;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Converts schema descriptions into JSON schemas (draft 07)
|
|
215
|
+
*/
|
|
216
|
+
export class JsonSchemaParser {
|
|
217
|
+
constructor(opts = {}) {
|
|
218
|
+
//Whether the schema being converted is exact so far: nothing of it was dropped (lakutata's own)
|
|
219
|
+
this._exact = true;
|
|
220
|
+
//The converted schemas which are not exact: they accept more values than the schemas
|
|
221
|
+
this._inexactSchemas = new WeakSet();
|
|
222
|
+
//Like upstream: false options read as no options
|
|
223
|
+
const settings = opts;
|
|
224
|
+
this.$schema = settings.$schema || 'http://json-schema.org/draft-07/schema#';
|
|
225
|
+
this.includeSchemaDialect = settings.includeSchemaDialect || false;
|
|
226
|
+
this.childrenFieldName = this._getChildrenFieldName();
|
|
227
|
+
this.optionsFieldName = this._getOptionsFieldName();
|
|
228
|
+
this.ruleArgFieldName = this._getRuleArgFieldName();
|
|
229
|
+
this.enumFieldName = this._getEnumFieldName();
|
|
230
|
+
this.allowUnknownFlagName = this._getAllowUnknownFlagName();
|
|
231
|
+
//The validation preferences the schemas are used with (lakutata's own)
|
|
232
|
+
this.inheritedPreferences = settings.preferences ? [settings.preferences] : [];
|
|
233
|
+
if (settings.logicalOpParser === false) {
|
|
234
|
+
this.logicalOpParser = {};
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
this.logicalOpParser = _.merge({}, LOGICAL_OP_PARSER, settings.logicalOpParser);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
parse(spec, definitions = {}, level = 0) {
|
|
241
|
+
const outer = this._exact;
|
|
242
|
+
this._exact = true;
|
|
243
|
+
const schema = this._parse(spec, definitions, level);
|
|
244
|
+
if (!this._exact)
|
|
245
|
+
this._inexactSchemas.add(schema);
|
|
246
|
+
this._exact = outer && this._exact;
|
|
247
|
+
return schema;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Whether a converted schema is exact: it accepts the values the schema accepts (without conversion), and only
|
|
251
|
+
* them (lakutata's own). Formats are named after the rules, and the numbers beyond the safe integers are accepted.
|
|
252
|
+
* @param schema
|
|
253
|
+
*/
|
|
254
|
+
isExact(schema) {
|
|
255
|
+
return !this._inexactSchemas.has(schema);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Marks the schema being converted as not exact: something of it has no JSON Schema equivalent and is dropped
|
|
259
|
+
*/
|
|
260
|
+
_inexact() {
|
|
261
|
+
this._exact = false;
|
|
262
|
+
}
|
|
263
|
+
_parse(spec, definitions, level) {
|
|
264
|
+
let schema = {};
|
|
265
|
+
const hasPreferences = this._pushInheritiedPreferences(spec);
|
|
266
|
+
if (this._getPresence(spec) === 'forbidden') {
|
|
267
|
+
if (hasPreferences)
|
|
268
|
+
this._popInheritiedPreferences();
|
|
269
|
+
schema.not = {};
|
|
270
|
+
return schema;
|
|
271
|
+
}
|
|
272
|
+
this._checkRules(spec);
|
|
273
|
+
this._setBasicProperties(schema, spec);
|
|
274
|
+
this._setNumberFieldProperties(schema, spec);
|
|
275
|
+
this._setBinaryFieldProperties(schema, spec);
|
|
276
|
+
this._setStringFieldProperties(schema, spec);
|
|
277
|
+
this._setDateFieldProperties(schema, spec);
|
|
278
|
+
this._setArrayFieldProperties(schema, spec, definitions, level);
|
|
279
|
+
this._setObjectProperties(schema, spec, definitions, level);
|
|
280
|
+
this._setAlternativesProperties(schema, spec, definitions, level);
|
|
281
|
+
this._setConditionProperties(schema, spec, definitions, level, 'whens');
|
|
282
|
+
this._setAllOf(schema, spec, definitions, level);
|
|
283
|
+
this._setMetaProperties(schema, spec);
|
|
284
|
+
this._setLinkFieldProperties(schema, spec);
|
|
285
|
+
this._setAnyProperties(schema);
|
|
286
|
+
this._setNonJsonProperties(schema, spec);
|
|
287
|
+
schema = this._setSingle(schema, spec);
|
|
288
|
+
schema = this._setValues(schema, spec);
|
|
289
|
+
if (!_.isEmpty(spec.shared)) {
|
|
290
|
+
_.each(spec.shared, (sharedSchema) => {
|
|
291
|
+
this.parse(sharedSchema, definitions, level);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
this._copyMetasToSchema(spec, schema);
|
|
295
|
+
//Last step to remove any unknown keys that are not in the JSON Schema specification or known meta keys
|
|
296
|
+
schema = this._retainKnownKeys(schema);
|
|
297
|
+
const schemaId = _.get(spec, 'flags.id');
|
|
298
|
+
if (schemaId) {
|
|
299
|
+
definitions[schemaId] = schema;
|
|
300
|
+
schema = {
|
|
301
|
+
$ref: `${this._getLocalSchemaBasePath()}/${schemaId}`
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
if (level === 0 && !_.isEmpty(definitions))
|
|
305
|
+
_.set(schema, `${this._getLocalSchemaBasePath().replace('#/', '').replace(/\//, '.')}`, definitions);
|
|
306
|
+
if (this.includeSchemaDialect && level === 0 && this.$schema)
|
|
307
|
+
schema.$schema = this.$schema;
|
|
308
|
+
if (hasPreferences)
|
|
309
|
+
this._popInheritiedPreferences();
|
|
310
|
+
return schema;
|
|
311
|
+
}
|
|
312
|
+
_retainKnownKeys(schema) {
|
|
313
|
+
if (!this.knownKeys)
|
|
314
|
+
return schema;
|
|
315
|
+
const knownKeys = this.knownKeys;
|
|
316
|
+
const retained = _.pickBy(schema, (value, key) => knownKeys.includes(key) || this._isKnownMetaKey(key));
|
|
317
|
+
//A dropped keyword makes the schema not exact
|
|
318
|
+
if (Object.keys(schema).some((key) => !(key in retained) && !ANNOTATIONS.includes(key)))
|
|
319
|
+
this._inexact();
|
|
320
|
+
return retained;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Marks the schemas with constructs JSON Schema cannot express as not exact (the constructs the type setters do
|
|
324
|
+
* not convert)
|
|
325
|
+
* @param spec
|
|
326
|
+
*/
|
|
327
|
+
_checkRules(spec) {
|
|
328
|
+
const converted = CONVERTED_RULES[spec.type];
|
|
329
|
+
//The types JSON has no equivalent for
|
|
330
|
+
if (!converted) {
|
|
331
|
+
if (!['any', 'alternatives', 'link', 'function', 'symbol'].includes(spec.type))
|
|
332
|
+
this._inexact();
|
|
333
|
+
if (spec.type === 'link' && _.get(spec, 'link.ref.type') !== 'local')
|
|
334
|
+
this._inexact();
|
|
335
|
+
}
|
|
336
|
+
for (const rule of spec.rules || []) {
|
|
337
|
+
if (!converted || !converted.includes(rule.name))
|
|
338
|
+
this._inexact();
|
|
339
|
+
}
|
|
340
|
+
const flags = spec.flags || {};
|
|
341
|
+
//Values made undefined, and single values as arrays
|
|
342
|
+
if (flags.empty !== undefined || flags.single)
|
|
343
|
+
this._inexact();
|
|
344
|
+
if (spec.renames || spec.externals)
|
|
345
|
+
this._inexact();
|
|
346
|
+
}
|
|
347
|
+
_pushInheritiedPreferences(spec) {
|
|
348
|
+
if (spec.preferences) {
|
|
349
|
+
this.inheritedPreferences.push(_.merge({}, this._getInheritedPreferences(), spec.preferences));
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
_popInheritiedPreferences() {
|
|
355
|
+
this.inheritedPreferences.pop();
|
|
356
|
+
}
|
|
357
|
+
_getInheritedPreferences() {
|
|
358
|
+
return this.inheritedPreferences[this.inheritedPreferences.length - 1] || {};
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* The preferences of a schema: its preferences merged with the inherited ones (upstream uses its preferences
|
|
362
|
+
* instead of the inherited ones)
|
|
363
|
+
* @param spec
|
|
364
|
+
*/
|
|
365
|
+
_getPreferences(spec) {
|
|
366
|
+
const preferences = spec[this.optionsFieldName];
|
|
367
|
+
return preferences ? { ...this._getInheritedPreferences(), ...preferences } : this._getInheritedPreferences();
|
|
368
|
+
}
|
|
369
|
+
_isIfThenElseSupported() {
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
_getChildrenFieldName() {
|
|
373
|
+
return 'keys';
|
|
374
|
+
}
|
|
375
|
+
_getOptionsFieldName() {
|
|
376
|
+
return 'preferences';
|
|
377
|
+
}
|
|
378
|
+
_getRuleArgFieldName() {
|
|
379
|
+
return 'args';
|
|
380
|
+
}
|
|
381
|
+
_getEnumFieldName() {
|
|
382
|
+
return 'allow';
|
|
383
|
+
}
|
|
384
|
+
_getAllowUnknownFlagName() {
|
|
385
|
+
return 'unknown';
|
|
386
|
+
}
|
|
387
|
+
_getLocalSchemaBasePath() {
|
|
388
|
+
return '#/$defs';
|
|
389
|
+
}
|
|
390
|
+
_getFieldDescription(fieldDefn) {
|
|
391
|
+
return _.get(fieldDefn, 'flags.description');
|
|
392
|
+
}
|
|
393
|
+
_getFieldType(fieldDefn) {
|
|
394
|
+
const type = fieldDefn.type;
|
|
395
|
+
//Any integer rule makes an integer (upstream: only a first integer rule)
|
|
396
|
+
if (type === 'number' && _.some(fieldDefn.rules, (rule) => INTEGER_RULES.includes(rule.name)))
|
|
397
|
+
return 'integer';
|
|
398
|
+
//JSON has no big integers: they are integers
|
|
399
|
+
if (type === 'bigint')
|
|
400
|
+
return 'integer';
|
|
401
|
+
//No JSON value is a function or a symbol
|
|
402
|
+
if (NON_JSON_TYPES.includes(type))
|
|
403
|
+
return undefined;
|
|
404
|
+
return type;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Makes a schema with a null type nullable (OpenAPI 3.0), and replaces the type lists where types are lists
|
|
408
|
+
* @param _fieldSchema
|
|
409
|
+
* @param _fieldDefn
|
|
410
|
+
*/
|
|
411
|
+
_addNullTypeIfNullable(_fieldSchema, _fieldDefn) {
|
|
412
|
+
//The null type is added by _setValues() (lakutata): JSON Schema has type lists
|
|
413
|
+
}
|
|
414
|
+
_getFieldExample(fieldDefn) {
|
|
415
|
+
const examples = _.get(fieldDefn, 'examples');
|
|
416
|
+
if (!Array.isArray(examples))
|
|
417
|
+
return examples;
|
|
418
|
+
const jsonExamples = examples.filter(isJsonValue);
|
|
419
|
+
return jsonExamples.length ? jsonExamples : undefined;
|
|
420
|
+
}
|
|
421
|
+
_getPresence(fieldDefn) {
|
|
422
|
+
const presence = _.get(fieldDefn, 'flags.presence');
|
|
423
|
+
if (presence !== undefined)
|
|
424
|
+
return presence;
|
|
425
|
+
const preferences = this._getPreferences(fieldDefn);
|
|
426
|
+
return _.get(preferences, 'presence');
|
|
427
|
+
}
|
|
428
|
+
_isRequired(fieldDefn) {
|
|
429
|
+
const presence = this._getPresence(fieldDefn);
|
|
430
|
+
return presence === 'required';
|
|
431
|
+
}
|
|
432
|
+
_getDefaultValue(fieldDefn) {
|
|
433
|
+
const value = _.get(fieldDefn, 'flags.default');
|
|
434
|
+
//Only JSON values: not a default computed by a function, or the deep default of objects
|
|
435
|
+
return isJsonValue(value) && !(value !== null && typeof value === 'object' && _.get(value, 'special') === 'deep') ? value : undefined;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Whether the unknown keys of an object are accepted (true), rejected (false), or must match a schema
|
|
439
|
+
* @param spec
|
|
440
|
+
*/
|
|
441
|
+
_getUnknown(spec) {
|
|
442
|
+
const allowUnknown = _.get(spec, `flags.${this.allowUnknownFlagName}`);
|
|
443
|
+
if (allowUnknown !== undefined)
|
|
444
|
+
return allowUnknown;
|
|
445
|
+
const preferences = this._getPreferences(spec);
|
|
446
|
+
if (preferences.allowUnknown)
|
|
447
|
+
return true;
|
|
448
|
+
//The stripped unknown keys are accepted (lakutata)
|
|
449
|
+
const stripUnknown = preferences.stripUnknown;
|
|
450
|
+
return stripUnknown === true || !!(stripUnknown && stripUnknown.objects);
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Whether the unknown keys of an object are stripped before its rules
|
|
454
|
+
* @param spec
|
|
455
|
+
*/
|
|
456
|
+
_stripsUnknown(spec) {
|
|
457
|
+
if (_.get(spec, `flags.${this.allowUnknownFlagName}`) !== undefined)
|
|
458
|
+
return false;
|
|
459
|
+
//Without keys, the keys are not processed
|
|
460
|
+
if (!spec[this.childrenFieldName] && !spec.patterns)
|
|
461
|
+
return false;
|
|
462
|
+
const stripUnknown = _.get(this._getPreferences(spec), 'stripUnknown');
|
|
463
|
+
return stripUnknown === true || !!(stripUnknown && stripUnknown.objects);
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Whether the items of arrays which match no item schema are stripped
|
|
467
|
+
* @param spec
|
|
468
|
+
*/
|
|
469
|
+
_stripsArrayItems(spec) {
|
|
470
|
+
const stripUnknown = _.get(this._getPreferences(spec), 'stripUnknown');
|
|
471
|
+
return !!(stripUnknown && typeof stripUnknown === 'object' && stripUnknown.arrays);
|
|
472
|
+
}
|
|
473
|
+
_setIfNotEmpty(schema, field, value) {
|
|
474
|
+
if (value !== null && value !== undefined)
|
|
475
|
+
schema[field] = value;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* The tighter of a bound and a limit (a reference limit is dropped)
|
|
479
|
+
* @param bound
|
|
480
|
+
* @param limit
|
|
481
|
+
* @param exclusive
|
|
482
|
+
* @param lower
|
|
483
|
+
*/
|
|
484
|
+
_bound(bound, limit, exclusive, lower) {
|
|
485
|
+
if (numberLimit(limit) === undefined)
|
|
486
|
+
this._inexact();
|
|
487
|
+
return tighter(bound, limit, exclusive, lower);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Adds a keyword, or a subschema of the keyword to allOf when the schema has the keyword (lakutata)
|
|
491
|
+
* @param schema
|
|
492
|
+
* @param keyword
|
|
493
|
+
* @param value
|
|
494
|
+
*/
|
|
495
|
+
_addKeyword(schema, keyword, value) {
|
|
496
|
+
if (schema[keyword] === undefined) {
|
|
497
|
+
schema[keyword] = value;
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
schema.allOf = schema.allOf || [];
|
|
501
|
+
schema.allOf.push({ [keyword]: value });
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Merges the keywords of a subschema, or adds the subschema to allOf when the keywords conflict (lakutata)
|
|
506
|
+
* @param schema
|
|
507
|
+
* @param part
|
|
508
|
+
*/
|
|
509
|
+
_mergeKeywords(schema, part) {
|
|
510
|
+
const keys = Object.keys(part);
|
|
511
|
+
if (!keys.length)
|
|
512
|
+
return;
|
|
513
|
+
const conflicts = keys.some((key) => schema[key] !== undefined) ||
|
|
514
|
+
keys.some((key) => CONDITION_KEYWORDS.includes(key)) && CONDITION_KEYWORDS.some((key) => schema[key] !== undefined);
|
|
515
|
+
if (!conflicts) {
|
|
516
|
+
Object.assign(schema, part);
|
|
517
|
+
}
|
|
518
|
+
else if (keys.length === 1 && keys[0] === 'allOf') {
|
|
519
|
+
schema.allOf = [...(schema.allOf || []), ...part.allOf];
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
schema.allOf = schema.allOf || [];
|
|
523
|
+
schema.allOf.push(part);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
_setBasicProperties(fieldSchema, fieldDefn) {
|
|
527
|
+
this._setIfNotEmpty(fieldSchema, 'type', this._getFieldType(fieldDefn));
|
|
528
|
+
this._setIfNotEmpty(fieldSchema, 'examples', this._getFieldExample(fieldDefn));
|
|
529
|
+
this._setIfNotEmpty(fieldSchema, 'description', this._getFieldDescription(fieldDefn));
|
|
530
|
+
this._setIfNotEmpty(fieldSchema, 'default', this._getDefaultValue(fieldDefn));
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* The schema of a values list (only these values)
|
|
534
|
+
* @param values
|
|
535
|
+
*/
|
|
536
|
+
_getValuesSchema(values) {
|
|
537
|
+
return values.length === 1 ? { const: values[0] } : { enum: values };
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Applies the valid and invalid values of a schema description (lakutata's own; upstream sets the enum of the
|
|
541
|
+
* valid values, and adds null to the type): the valid values of `valid()` are the only accepted values, the
|
|
542
|
+
* values of `allow()` are accepted besides the values of the schema, and the invalid values are rejected
|
|
543
|
+
* @param schema
|
|
544
|
+
* @param spec
|
|
545
|
+
*/
|
|
546
|
+
_setValues(schema, spec) {
|
|
547
|
+
const flags = spec.flags || {};
|
|
548
|
+
const allowed = literals(spec[this.enumFieldName]);
|
|
549
|
+
const invalid = literals(spec.invalid);
|
|
550
|
+
const annotations = {};
|
|
551
|
+
for (const key of Object.keys(schema)) {
|
|
552
|
+
if (ANNOTATIONS.includes(key) || key.startsWith('x-'))
|
|
553
|
+
annotations[key] = schema[key];
|
|
554
|
+
}
|
|
555
|
+
if (!allowed || !invalid)
|
|
556
|
+
this._inexact();
|
|
557
|
+
if (flags.only) {
|
|
558
|
+
//Only the valid values (the other keywords do not apply to them)
|
|
559
|
+
if (!allowed || !allowed.length)
|
|
560
|
+
return { ...annotations };
|
|
561
|
+
const values = _.uniq(allowed);
|
|
562
|
+
const strings = values.filter((value) => typeof value === 'string');
|
|
563
|
+
if (flags.insensitive && strings.length) {
|
|
564
|
+
const others = values.filter((value) => typeof value !== 'string');
|
|
565
|
+
const insensitive = { type: 'string', pattern: insensitivePattern(strings) };
|
|
566
|
+
if (!others.length)
|
|
567
|
+
return { ...annotations, ...insensitive };
|
|
568
|
+
return { ...annotations, anyOf: [insensitive, this._getValuesSchema(others)] };
|
|
569
|
+
}
|
|
570
|
+
return { ...annotations, ...this._getValuesSchema(values) };
|
|
571
|
+
}
|
|
572
|
+
if (invalid && invalid.length)
|
|
573
|
+
this._addKeyword(schema, 'not', { enum: invalid });
|
|
574
|
+
//Strings are not empty, unless allowed, or a minimum length of zero (or made undefined by empty())
|
|
575
|
+
const allowsEmpty = !!allowed && allowed.includes('') ||
|
|
576
|
+
_.some(spec.rules, (rule) => rule.name === 'min' && _.get(rule, `${this.ruleArgFieldName}.limit`) === 0);
|
|
577
|
+
if (schema.type === 'string' && spec.type === 'string' && !allowsEmpty && flags.empty === undefined && !this._rejectsEmpty(schema))
|
|
578
|
+
schema.minLength = 1;
|
|
579
|
+
//Values of references may be allowed
|
|
580
|
+
if (!allowed)
|
|
581
|
+
return { ...annotations };
|
|
582
|
+
if (!allowed.length) {
|
|
583
|
+
this._addNullTypeIfNullable(schema, spec);
|
|
584
|
+
return schema;
|
|
585
|
+
}
|
|
586
|
+
//A schema without constraints accepts the allowed values
|
|
587
|
+
if (Object.keys(schema).every((key) => annotations[key] !== undefined))
|
|
588
|
+
return schema;
|
|
589
|
+
let rest = _.uniq(allowed);
|
|
590
|
+
//The empty string is accepted by the schema without its minLength
|
|
591
|
+
if (schema.type === 'string' && rest.includes('') && this._acceptsEmpty(schema))
|
|
592
|
+
rest = rest.filter((value) => value !== '');
|
|
593
|
+
//Null is added to the type
|
|
594
|
+
if (rest.includes(null) && this._canAddType(schema)) {
|
|
595
|
+
if (Array.isArray(schema.type)) {
|
|
596
|
+
if (!schema.type.includes('null'))
|
|
597
|
+
schema.type = [...schema.type, 'null'];
|
|
598
|
+
}
|
|
599
|
+
else if (schema.type !== 'null') {
|
|
600
|
+
schema.type = [schema.type, 'null'];
|
|
601
|
+
}
|
|
602
|
+
rest = rest.filter((value) => value !== null);
|
|
603
|
+
}
|
|
604
|
+
this._addNullTypeIfNullable(schema, spec);
|
|
605
|
+
if (!rest.length)
|
|
606
|
+
return schema;
|
|
607
|
+
//The other allowed values are accepted besides the values of the schema
|
|
608
|
+
const constraints = {};
|
|
609
|
+
for (const key of Object.keys(schema)) {
|
|
610
|
+
if (annotations[key] === undefined)
|
|
611
|
+
constraints[key] = schema[key];
|
|
612
|
+
}
|
|
613
|
+
return { ...annotations, anyOf: [constraints, this._getValuesSchema(rest)] };
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Arrays accepting single values also accept a value their items accept (lakutata's own)
|
|
617
|
+
* @param schema
|
|
618
|
+
* @param spec
|
|
619
|
+
*/
|
|
620
|
+
_setSingle(schema, spec) {
|
|
621
|
+
if (spec.type !== 'array' || !_.get(spec, 'flags.single'))
|
|
622
|
+
return schema;
|
|
623
|
+
const annotations = {};
|
|
624
|
+
const constraints = {};
|
|
625
|
+
for (const key of Object.keys(schema)) {
|
|
626
|
+
if (ANNOTATIONS.includes(key) || key.startsWith('x-')) {
|
|
627
|
+
annotations[key] = schema[key];
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
constraints[key] = schema[key];
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const items = schema.prefixItems || schema.items;
|
|
634
|
+
//The single value must also make a valid array: its items schema is looser
|
|
635
|
+
const single = Array.isArray(items) ? (items.length ? { anyOf: items } : {}) : (items || {});
|
|
636
|
+
return { ...annotations, anyOf: [constraints, single] };
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Whether a string schema certainly accepts the empty string
|
|
640
|
+
* @param schema
|
|
641
|
+
*/
|
|
642
|
+
_acceptsEmpty(schema) {
|
|
643
|
+
for (const key of Object.keys(schema)) {
|
|
644
|
+
if (ANNOTATIONS.includes(key) || key.startsWith('x-') || key === 'type' || key === 'maxLength' || key === 'contentEncoding')
|
|
645
|
+
continue;
|
|
646
|
+
if (key === 'minLength' && schema.minLength < 1)
|
|
647
|
+
continue;
|
|
648
|
+
if (key === 'pattern' && new RegExp(schema.pattern, 'u').test(''))
|
|
649
|
+
continue;
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Whether a string schema certainly rejects the empty string
|
|
656
|
+
* @param schema
|
|
657
|
+
*/
|
|
658
|
+
_rejectsEmpty(schema) {
|
|
659
|
+
if (typeof schema.minLength === 'number' && schema.minLength >= 1)
|
|
660
|
+
return true;
|
|
661
|
+
if (typeof schema.pattern === 'string' && !new RegExp(schema.pattern, 'u').test(''))
|
|
662
|
+
return true;
|
|
663
|
+
return typeof schema.format === 'string' && ['date', 'time', 'date-time', 'duration', 'email', 'idn-email', 'hostname', 'ipv4', 'ipv6', 'uri', 'uuid'].includes(schema.format);
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Whether null can be accepted by adding it to the type of a schema: its keywords apply to other types
|
|
667
|
+
* @param schema
|
|
668
|
+
*/
|
|
669
|
+
_canAddType(schema) {
|
|
670
|
+
if (!schema.type)
|
|
671
|
+
return false;
|
|
672
|
+
return !['enum', 'const', 'anyOf', 'oneOf', 'allOf', 'not', 'if', '$ref'].some((key) => schema[key] !== undefined);
|
|
673
|
+
}
|
|
674
|
+
_setBinaryFieldProperties(fieldSchema, fieldDefn) {
|
|
675
|
+
if (fieldSchema.type !== 'binary')
|
|
676
|
+
return;
|
|
677
|
+
fieldSchema.type = 'string';
|
|
678
|
+
if (fieldDefn.flags && fieldDefn.flags.encoding)
|
|
679
|
+
fieldSchema.contentEncoding = fieldDefn.flags.encoding;
|
|
680
|
+
this._setIfNotEmpty(fieldSchema, 'format', this._getBinaryFormat());
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* The format of binary strings (JSON Schema has none: upstream sets binary)
|
|
684
|
+
*/
|
|
685
|
+
_getBinaryFormat() {
|
|
686
|
+
return undefined;
|
|
687
|
+
}
|
|
688
|
+
_setObjectProperties(schema, spec, definitions, level) {
|
|
689
|
+
if (schema.type !== 'object')
|
|
690
|
+
return;
|
|
691
|
+
const keys = spec[this.childrenFieldName];
|
|
692
|
+
const unknown = this._getUnknown(spec);
|
|
693
|
+
if (!keys && !spec.patterns) {
|
|
694
|
+
//Without keys, the schema accepts every key (upstream applies the unknown keys handling)
|
|
695
|
+
if (typeof unknown === 'object')
|
|
696
|
+
schema.additionalProperties = this.parse(unknown, definitions, level + 1);
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
const properties = {};
|
|
700
|
+
const required = [];
|
|
701
|
+
schema.properties = properties;
|
|
702
|
+
_.map(keys, (fieldDefn, key) => {
|
|
703
|
+
const fieldSchema = this.parse(fieldDefn, definitions, level + 1);
|
|
704
|
+
if (this._isRequired(fieldDefn))
|
|
705
|
+
required.push(key);
|
|
706
|
+
properties[key] = fieldSchema;
|
|
707
|
+
});
|
|
708
|
+
if (required.length)
|
|
709
|
+
schema.required = required;
|
|
710
|
+
const expressible = this._setPatternProperties(schema, spec, Object.keys(keys || {}), definitions, level);
|
|
711
|
+
if (!expressible || spec.renames) {
|
|
712
|
+
//Keys matched by patterns JSON Schema cannot express, and renamed keys, are accepted
|
|
713
|
+
this._inexact();
|
|
714
|
+
schema.additionalProperties = true;
|
|
715
|
+
}
|
|
716
|
+
else if (typeof unknown === 'object') {
|
|
717
|
+
schema.additionalProperties = this.parse(unknown, definitions, level + 1);
|
|
718
|
+
}
|
|
719
|
+
else {
|
|
720
|
+
schema.additionalProperties = unknown;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
_.each(spec.rules, (rule) => {
|
|
724
|
+
const args = (rule[this.ruleArgFieldName] || {});
|
|
725
|
+
const limit = numberLimit(args.limit);
|
|
726
|
+
switch (rule.name) {
|
|
727
|
+
case 'min':
|
|
728
|
+
case 'length':
|
|
729
|
+
//The keys with defaults may be added before the rules
|
|
730
|
+
if (limit !== undefined && !_.some(Object.values(keys || {}), (key) => _.get(key, 'flags.default') !== undefined)) {
|
|
731
|
+
this._addKeyword(schema, 'minProperties', limit);
|
|
732
|
+
//The stripped unknown keys are not counted
|
|
733
|
+
if (this._stripsUnknown(spec))
|
|
734
|
+
this._inexact();
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
this._inexact();
|
|
738
|
+
}
|
|
739
|
+
if (rule.name === 'min')
|
|
740
|
+
break;
|
|
741
|
+
//Falls through for length
|
|
742
|
+
case 'max':
|
|
743
|
+
//The unknown keys may be stripped before the rules
|
|
744
|
+
if (limit !== undefined && !this._stripsUnknown(spec)) {
|
|
745
|
+
this._addKeyword(schema, 'maxProperties', limit);
|
|
746
|
+
}
|
|
747
|
+
else {
|
|
748
|
+
this._inexact();
|
|
749
|
+
}
|
|
750
|
+
break;
|
|
751
|
+
case 'keyNames': {
|
|
752
|
+
const names = this.parse(args.schema, definitions, level + 1);
|
|
753
|
+
//The stripped unknown keys are not checked: only the defined keys and the keys of the patterns
|
|
754
|
+
this._setPropertyNames(schema, this._stripsUnknown(spec) ? { anyOf: [names, { not: this._knownKeys(spec) }] } : names);
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
default:
|
|
758
|
+
break;
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
this._setObjectDependencies(schema, spec);
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Sets the schema of the key names
|
|
765
|
+
* @param schema
|
|
766
|
+
* @param names
|
|
767
|
+
*/
|
|
768
|
+
_setPropertyNames(schema, names) {
|
|
769
|
+
this._addKeyword(schema, 'propertyNames', names);
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Sets the patternProperties of the patterns of an object (lakutata's own; upstream also adds each pattern as a
|
|
773
|
+
* property): like the engine, a pattern applies to the keys which are not defined keys and which no previous
|
|
774
|
+
* pattern (without fallthrough) matched. Returns false when a pattern is not expressible.
|
|
775
|
+
* @param schema
|
|
776
|
+
* @param spec
|
|
777
|
+
* @param definedKeys
|
|
778
|
+
* @param definitions
|
|
779
|
+
* @param level
|
|
780
|
+
*/
|
|
781
|
+
_setPatternProperties(schema, spec, definedKeys, definitions, level) {
|
|
782
|
+
if (!spec.patterns || !spec.patterns.length)
|
|
783
|
+
return true;
|
|
784
|
+
const patternProperties = {};
|
|
785
|
+
//The previous patterns which stop the matching of the next ones
|
|
786
|
+
const stops = [];
|
|
787
|
+
for (const patternObj of spec.patterns) {
|
|
788
|
+
if (typeof patternObj.rule !== 'object' || patternObj.regex === undefined)
|
|
789
|
+
return false;
|
|
790
|
+
if (patternObj.matches !== undefined)
|
|
791
|
+
return false;
|
|
792
|
+
const pattern = toPattern(patternObj.regex);
|
|
793
|
+
if (!pattern)
|
|
794
|
+
return false;
|
|
795
|
+
const regex = new RegExp(pattern.source, 'u');
|
|
796
|
+
const excludedKeys = definedKeys.filter((key) => regex.test(key));
|
|
797
|
+
let source = pattern.source;
|
|
798
|
+
if (excludedKeys.length || stops.length) {
|
|
799
|
+
//Backreferences would be renumbered by the groups of the other patterns
|
|
800
|
+
if ([pattern.source, ...stops].some((part) => /\\[1-9]|\\k</.test(part)))
|
|
801
|
+
return false;
|
|
802
|
+
const exclusions = excludedKeys.length ? `(?!(?:${excludedKeys.map((key) => escapeRegex(key)).join('|')})$)` : '';
|
|
803
|
+
source = `^${exclusions}${stops.map((stop) => `(?![\\s\\S]*?(?:${stop}))`).join('')}[\\s\\S]*?(?:${pattern.source})`;
|
|
804
|
+
try {
|
|
805
|
+
new RegExp(source, 'u');
|
|
806
|
+
}
|
|
807
|
+
catch {
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
const ruleSchema = this.parse(patternObj.rule, definitions, level + 1);
|
|
812
|
+
if (patternProperties[source]) {
|
|
813
|
+
patternProperties[source] = { allOf: [patternProperties[source], ruleSchema] };
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
patternProperties[source] = ruleSchema;
|
|
817
|
+
}
|
|
818
|
+
if (!patternObj.fallthrough)
|
|
819
|
+
stops.push(pattern.source);
|
|
820
|
+
}
|
|
821
|
+
schema.patternProperties = patternProperties;
|
|
822
|
+
return true;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* The schema of the key names an object processes (its defined keys and the keys its patterns match)
|
|
826
|
+
* @param spec
|
|
827
|
+
*/
|
|
828
|
+
_knownKeys(spec) {
|
|
829
|
+
const definedKeys = Object.keys((spec[this.childrenFieldName] || {}));
|
|
830
|
+
const known = definedKeys.length ? [{ enum: definedKeys }] : [];
|
|
831
|
+
for (const patternObj of spec.patterns || []) {
|
|
832
|
+
const pattern = toPattern(patternObj.regex);
|
|
833
|
+
//A key schema matches keys JSON Schema cannot express: any key may be known
|
|
834
|
+
if (!pattern)
|
|
835
|
+
return {};
|
|
836
|
+
known.push({ pattern: pattern.source });
|
|
837
|
+
}
|
|
838
|
+
if (!known.length)
|
|
839
|
+
return { not: {} };
|
|
840
|
+
return known.length === 1 ? known[0] : { anyOf: known };
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Whether a key is processed by an object (not stripped as an unknown key)
|
|
844
|
+
* @param spec
|
|
845
|
+
* @param key
|
|
846
|
+
*/
|
|
847
|
+
_isKnownKey(spec, key) {
|
|
848
|
+
if (Object.hasOwn((spec[this.childrenFieldName] || {}), key))
|
|
849
|
+
return true;
|
|
850
|
+
return _.some(spec.patterns, (patternObj) => {
|
|
851
|
+
const pattern = toPattern(patternObj.regex);
|
|
852
|
+
return !pattern || new RegExp(pattern.source, 'u').test(key);
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
_setObjectDependencies(schema, spec) {
|
|
856
|
+
if (!Array.isArray(spec.dependencies) || spec.dependencies.length === 0)
|
|
857
|
+
return;
|
|
858
|
+
const strips = this._stripsUnknown(spec);
|
|
859
|
+
const dependencies = spec.dependencies.filter((dependency) => {
|
|
860
|
+
const keys = [dependency.key, ...dependency.peers];
|
|
861
|
+
//Keys of nested objects have no JSON Schema equivalent, and the unknown keys are stripped before the
|
|
862
|
+
//dependencies are checked
|
|
863
|
+
if (keys.some((key) => typeof key === 'string' && (key.includes('.') || strips && !this._isKnownKey(spec, key)))) {
|
|
864
|
+
this._inexact();
|
|
865
|
+
return false;
|
|
866
|
+
}
|
|
867
|
+
return true;
|
|
868
|
+
});
|
|
869
|
+
if (dependencies.length === 1) {
|
|
870
|
+
this._mergeKeywords(schema, this._setDependencySubSchema({}, dependencies[0]));
|
|
871
|
+
}
|
|
872
|
+
else if (dependencies.length > 1) {
|
|
873
|
+
//Like upstream: the with dependencies are merged, the others are all of the dependencies
|
|
874
|
+
const allOf = [];
|
|
875
|
+
const withDependencies = {};
|
|
876
|
+
for (const dependency of dependencies) {
|
|
877
|
+
if (dependency.rel === 'with') {
|
|
878
|
+
this._setDependencySubSchema(withDependencies, dependency);
|
|
879
|
+
continue;
|
|
880
|
+
}
|
|
881
|
+
const subSchema = this._setDependencySubSchema({}, dependency);
|
|
882
|
+
if (!_.isEmpty(subSchema))
|
|
883
|
+
allOf.push(subSchema);
|
|
884
|
+
}
|
|
885
|
+
if (allOf.length)
|
|
886
|
+
this._mergeKeywords(schema, { allOf });
|
|
887
|
+
this._mergeKeywords(schema, withDependencies);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
_setDependencySubSchema(schema, dependency) {
|
|
891
|
+
const opParser = this.logicalOpParser[dependency.rel];
|
|
892
|
+
if (typeof opParser !== 'function') {
|
|
893
|
+
this._inexact();
|
|
894
|
+
return schema;
|
|
895
|
+
}
|
|
896
|
+
opParser(schema, dependency);
|
|
897
|
+
return schema;
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* The format of a number schema (JSON Schema has no number formats)
|
|
901
|
+
* @param _rules
|
|
902
|
+
*/
|
|
903
|
+
_getNumberFormat(_rules) {
|
|
904
|
+
return undefined;
|
|
905
|
+
}
|
|
906
|
+
_setNumberFieldProperties(fieldSchema, fieldDefn) {
|
|
907
|
+
if (fieldSchema.type !== 'number' && fieldSchema.type !== 'integer')
|
|
908
|
+
return;
|
|
909
|
+
const ruleArgFieldName = this.ruleArgFieldName;
|
|
910
|
+
let lower;
|
|
911
|
+
let upper;
|
|
912
|
+
const rules = fieldDefn.rules || [];
|
|
913
|
+
_.each(rules, (rule) => {
|
|
914
|
+
const value = (rule[ruleArgFieldName] || {});
|
|
915
|
+
const range = integerTypes[rule.name];
|
|
916
|
+
if (range) {
|
|
917
|
+
lower = this._bound(lower, range[0], false, true);
|
|
918
|
+
upper = this._bound(upper, range[1], false, false);
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
switch (rule.name) {
|
|
922
|
+
case 'max':
|
|
923
|
+
upper = this._bound(upper, value.limit, false, false);
|
|
924
|
+
break;
|
|
925
|
+
case 'min':
|
|
926
|
+
lower = this._bound(lower, value.limit, false, true);
|
|
927
|
+
break;
|
|
928
|
+
case 'greater':
|
|
929
|
+
lower = this._bound(lower, value.limit, true, true);
|
|
930
|
+
break;
|
|
931
|
+
case 'less':
|
|
932
|
+
upper = this._bound(upper, value.limit, true, false);
|
|
933
|
+
break;
|
|
934
|
+
case 'port':
|
|
935
|
+
lower = this._bound(lower, 0, false, true);
|
|
936
|
+
upper = this._bound(upper, 65535, false, false);
|
|
937
|
+
break;
|
|
938
|
+
case 'float':
|
|
939
|
+
lower = this._bound(lower, -FLOAT_MAX, false, true);
|
|
940
|
+
upper = this._bound(upper, FLOAT_MAX, false, false);
|
|
941
|
+
break;
|
|
942
|
+
case 'multiple': {
|
|
943
|
+
const base = numberLimit(value.base);
|
|
944
|
+
if (base !== undefined) {
|
|
945
|
+
this._addKeyword(fieldSchema, 'multipleOf', base);
|
|
946
|
+
}
|
|
947
|
+
else {
|
|
948
|
+
this._inexact();
|
|
949
|
+
}
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
case 'sign':
|
|
953
|
+
case 'positive':
|
|
954
|
+
case 'negative': {
|
|
955
|
+
const sign = rule.name === 'sign' ? value.sign : rule.name;
|
|
956
|
+
if (sign === 'positive')
|
|
957
|
+
lower = this._bound(lower, 0, true, true);
|
|
958
|
+
if (sign === 'negative')
|
|
959
|
+
upper = this._bound(upper, 0, true, false);
|
|
960
|
+
break;
|
|
961
|
+
}
|
|
962
|
+
default:
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
if (lower)
|
|
967
|
+
fieldSchema[lower.exclusive ? 'exclusiveMinimum' : 'minimum'] = lower.value;
|
|
968
|
+
if (upper)
|
|
969
|
+
fieldSchema[upper.exclusive ? 'exclusiveMaximum' : 'maximum'] = upper.value;
|
|
970
|
+
this._setIfNotEmpty(fieldSchema, 'format', this._getNumberFormat(rules));
|
|
971
|
+
}
|
|
972
|
+
_setStringFieldProperties(fieldSchema, fieldDefn) {
|
|
973
|
+
if (fieldSchema.type !== 'string' || fieldDefn.type !== 'string')
|
|
974
|
+
return;
|
|
975
|
+
if (fieldDefn.flags && fieldDefn.flags.encoding)
|
|
976
|
+
fieldSchema.contentEncoding = fieldDefn.flags.encoding;
|
|
977
|
+
const ruleArgFieldName = this.ruleArgFieldName;
|
|
978
|
+
let lower;
|
|
979
|
+
let upper;
|
|
980
|
+
const addPattern = (source, invert = false) => {
|
|
981
|
+
if (invert) {
|
|
982
|
+
this._addKeyword(fieldSchema, 'not', { pattern: source });
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
this._addKeyword(fieldSchema, 'pattern', source);
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
_.each(fieldDefn.rules, (rule) => {
|
|
989
|
+
const args = (rule[ruleArgFieldName] || {});
|
|
990
|
+
const options = (args.options || {});
|
|
991
|
+
switch (rule.name) {
|
|
992
|
+
case 'min':
|
|
993
|
+
case 'max':
|
|
994
|
+
case 'length':
|
|
995
|
+
//Lengths in bytes have no JSON Schema equivalent
|
|
996
|
+
if (args.encoding) {
|
|
997
|
+
this._inexact();
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
if (rule.name !== 'max')
|
|
1001
|
+
lower = this._bound(lower, args.limit, false, true);
|
|
1002
|
+
if (rule.name !== 'min')
|
|
1003
|
+
upper = this._bound(upper, args.limit, false, false);
|
|
1004
|
+
break;
|
|
1005
|
+
case 'format':
|
|
1006
|
+
this._addKeyword(fieldSchema, 'format', args.name);
|
|
1007
|
+
break;
|
|
1008
|
+
case 'email':
|
|
1009
|
+
this._addKeyword(fieldSchema, 'format', 'email');
|
|
1010
|
+
break;
|
|
1011
|
+
case 'hostname':
|
|
1012
|
+
this._addKeyword(fieldSchema, 'format', 'hostname');
|
|
1013
|
+
break;
|
|
1014
|
+
case 'uri':
|
|
1015
|
+
this._addKeyword(fieldSchema, 'format', options.allowRelative || options.relativeOnly ? 'uri-reference' : 'uri');
|
|
1016
|
+
//The formats accept every scheme, and absolute URIs
|
|
1017
|
+
if (options.scheme || options.relativeOnly)
|
|
1018
|
+
this._inexact();
|
|
1019
|
+
break;
|
|
1020
|
+
case 'ip': {
|
|
1021
|
+
const versions = options.version || [];
|
|
1022
|
+
const formats = versions.length ? versions.filter((version) => version === 'ipv4' || version === 'ipv6') : ['ipv4', 'ipv6'];
|
|
1023
|
+
const alternatives = options.cidr === 'required' ? [] : formats.map((format) => ({ format }));
|
|
1024
|
+
//Addresses with a CIDR prefix have no format (and the other versions): a looser pattern accepts them
|
|
1025
|
+
if (options.cidr !== 'forbidden' || formats.length !== (versions.length || 2)) {
|
|
1026
|
+
this._inexact();
|
|
1027
|
+
alternatives.push({ pattern: '^[0-9a-zA-Z:.]+(?:/[0-9]{1,3})?$' });
|
|
1028
|
+
}
|
|
1029
|
+
if (alternatives.length === 1) {
|
|
1030
|
+
this._mergeKeywords(fieldSchema, alternatives[0]);
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
this._addKeyword(fieldSchema, 'anyOf', alternatives);
|
|
1034
|
+
}
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
case 'pattern': {
|
|
1038
|
+
const pattern = toPattern(args.regex);
|
|
1039
|
+
if (pattern) {
|
|
1040
|
+
addPattern(pattern.source, !!options.invert);
|
|
1041
|
+
}
|
|
1042
|
+
else {
|
|
1043
|
+
this._inexact();
|
|
1044
|
+
}
|
|
1045
|
+
break;
|
|
1046
|
+
}
|
|
1047
|
+
case 'alphanum':
|
|
1048
|
+
addPattern('^[a-zA-Z0-9]+$');
|
|
1049
|
+
break;
|
|
1050
|
+
case 'token':
|
|
1051
|
+
addPattern('^[a-zA-Z0-9_]+$');
|
|
1052
|
+
break;
|
|
1053
|
+
case 'hex':
|
|
1054
|
+
addPattern(options.prefix === 'optional' ? '^(?:0[xX])?[0-9a-fA-F]+$' : options.prefix === true ? '^0[xX][0-9a-fA-F]+$' : '^[0-9a-fA-F]+$');
|
|
1055
|
+
if (options.byteAligned)
|
|
1056
|
+
addPattern('^(?:[\\s\\S]{2})*$');
|
|
1057
|
+
break;
|
|
1058
|
+
case 'trim':
|
|
1059
|
+
if (args.enabled !== false)
|
|
1060
|
+
addPattern('^(?:\\S(?:[\\s\\S]*\\S)?)?$');
|
|
1061
|
+
break;
|
|
1062
|
+
case 'isoDate':
|
|
1063
|
+
this._addKeyword(fieldSchema, 'format', 'date-time');
|
|
1064
|
+
break;
|
|
1065
|
+
case 'isoDuration':
|
|
1066
|
+
this._addKeyword(fieldSchema, 'format', 'duration');
|
|
1067
|
+
break;
|
|
1068
|
+
case 'uuid':
|
|
1069
|
+
case 'guid':
|
|
1070
|
+
this._addKeyword(fieldSchema, 'format', 'uuid');
|
|
1071
|
+
break;
|
|
1072
|
+
default:
|
|
1073
|
+
break;
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
//A minimum length of zero only allows the empty string
|
|
1077
|
+
if (lower && lower.value > 0)
|
|
1078
|
+
fieldSchema.minLength = lower.value;
|
|
1079
|
+
if (upper)
|
|
1080
|
+
fieldSchema.maxLength = upper.value;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Sets the schema the items of an array contain
|
|
1084
|
+
* @param schema
|
|
1085
|
+
* @param contains
|
|
1086
|
+
* @param options
|
|
1087
|
+
*/
|
|
1088
|
+
_setContains(schema, contains, options) {
|
|
1089
|
+
const min = options.min === undefined ? 1 : options.min;
|
|
1090
|
+
//Draft 07 has no count of the matching items
|
|
1091
|
+
if (min !== 1 || options.max !== undefined)
|
|
1092
|
+
this._inexact();
|
|
1093
|
+
if (min < 1)
|
|
1094
|
+
return;
|
|
1095
|
+
this._addKeyword(schema, 'contains', contains);
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Sets the items of an array with ordered items
|
|
1099
|
+
* @param schema
|
|
1100
|
+
* @param ordered
|
|
1101
|
+
* @param rest the schema of the other items (undefined: no other items)
|
|
1102
|
+
*/
|
|
1103
|
+
_setTuple(schema, ordered, rest) {
|
|
1104
|
+
schema.items = ordered;
|
|
1105
|
+
schema.additionalItems = rest === undefined ? false : rest;
|
|
1106
|
+
}
|
|
1107
|
+
_setArrayFieldProperties(fieldSchema, fieldDefn, definitions, level) {
|
|
1108
|
+
if (fieldSchema.type !== 'array')
|
|
1109
|
+
return;
|
|
1110
|
+
const ruleArgFieldName = this.ruleArgFieldName;
|
|
1111
|
+
let lower;
|
|
1112
|
+
let upper;
|
|
1113
|
+
_.each(fieldDefn.rules, (rule) => {
|
|
1114
|
+
const value = (rule[ruleArgFieldName] || {});
|
|
1115
|
+
switch (rule.name) {
|
|
1116
|
+
case 'max':
|
|
1117
|
+
upper = this._bound(upper, value.limit, false, false);
|
|
1118
|
+
break;
|
|
1119
|
+
case 'min':
|
|
1120
|
+
lower = this._bound(lower, value.limit, false, true);
|
|
1121
|
+
break;
|
|
1122
|
+
case 'length':
|
|
1123
|
+
lower = this._bound(lower, value.limit, false, true);
|
|
1124
|
+
upper = this._bound(upper, value.limit, false, false);
|
|
1125
|
+
break;
|
|
1126
|
+
case 'unique':
|
|
1127
|
+
//A custom comparator may accept duplicates
|
|
1128
|
+
if (typeof value.comparator !== 'function') {
|
|
1129
|
+
fieldSchema.uniqueItems = true;
|
|
1130
|
+
}
|
|
1131
|
+
else {
|
|
1132
|
+
this._inexact();
|
|
1133
|
+
}
|
|
1134
|
+
break;
|
|
1135
|
+
case 'has':
|
|
1136
|
+
this._setContains(fieldSchema, this.parse(value.schema, definitions, level + 1), (value.options || {}));
|
|
1137
|
+
break;
|
|
1138
|
+
default:
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
if (lower)
|
|
1143
|
+
fieldSchema.minItems = lower.value;
|
|
1144
|
+
if (upper)
|
|
1145
|
+
fieldSchema.maxItems = upper.value;
|
|
1146
|
+
//The items which match no item schema may be stripped
|
|
1147
|
+
if (this._stripsArrayItems(fieldDefn)) {
|
|
1148
|
+
this._inexact();
|
|
1149
|
+
fieldSchema.items = {};
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
//Required item schemas require a matching item, forbidden ones forbid them
|
|
1153
|
+
if (_.some([...(fieldDefn.items || []), ...(fieldDefn.ordered || [])], (item) => this._getPresence(item) !== undefined && this._getPresence(item) !== 'optional'))
|
|
1154
|
+
this._inexact();
|
|
1155
|
+
let rest;
|
|
1156
|
+
if (fieldDefn.items && fieldDefn.items.length) {
|
|
1157
|
+
if (fieldDefn.items.length === 1) {
|
|
1158
|
+
rest = this.parse(fieldDefn.items[0], definitions, level + 1);
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
rest = {
|
|
1162
|
+
anyOf: _.map(fieldDefn.items, (itemSchema) => {
|
|
1163
|
+
return this.parse(itemSchema, definitions, level + 1);
|
|
1164
|
+
})
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
const ordered = fieldDefn.ordered;
|
|
1169
|
+
if (ordered && ordered.length) {
|
|
1170
|
+
this._setTuple(fieldSchema, ordered.map((itemSchema) => this.parse(itemSchema, definitions, level + 1)), rest);
|
|
1171
|
+
}
|
|
1172
|
+
else {
|
|
1173
|
+
fieldSchema.items = rest || {};
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
_setDateFieldProperties(fieldSchema, fieldDefn) {
|
|
1177
|
+
if (fieldSchema.type !== 'date')
|
|
1178
|
+
return;
|
|
1179
|
+
const format = fieldDefn.flags && fieldDefn.flags.format;
|
|
1180
|
+
if (format === 'javascript' || format === 'unix') {
|
|
1181
|
+
//Timestamps (unix timestamps may have decimals)
|
|
1182
|
+
fieldSchema.type = 'number';
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
//https://datatracker.ietf.org/doc/draft-handrews-json-schema-validation
|
|
1186
|
+
//JSON Schema does not have date type, but use string with format.
|
|
1187
|
+
//However, the schema definition cannot clearly tells the date/time/date-time format
|
|
1188
|
+
fieldSchema.type = 'string';
|
|
1189
|
+
fieldSchema.format = 'date-time';
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
_setAlternativesProperties(schema, spec, definitions, level) {
|
|
1193
|
+
if (schema.type !== 'alternatives')
|
|
1194
|
+
return;
|
|
1195
|
+
delete schema.type;
|
|
1196
|
+
if (spec.matches.length === 0)
|
|
1197
|
+
return;
|
|
1198
|
+
const matches = spec.matches;
|
|
1199
|
+
if (matches[0].schema) {
|
|
1200
|
+
//try style
|
|
1201
|
+
const mode = spec.flags && spec.flags.match;
|
|
1202
|
+
const schemas = _.map(matches, (match) => {
|
|
1203
|
+
return this.parse(match.schema, definitions, level + 1);
|
|
1204
|
+
});
|
|
1205
|
+
//Negating schemas which accept more values would reject values of the schema: they are dropped
|
|
1206
|
+
const exact = schemas.every((converted) => this.isExact(converted));
|
|
1207
|
+
if (mode === 'none') {
|
|
1208
|
+
//None of the alternatives (lakutata)
|
|
1209
|
+
if (exact)
|
|
1210
|
+
this._mergeKeywords(schema, { not: schemas.length === 1 ? schemas[0] : { anyOf: schemas } });
|
|
1211
|
+
}
|
|
1212
|
+
else if (schemas.length === 1) {
|
|
1213
|
+
this._mergeKeywords(schema, schemas[0]);
|
|
1214
|
+
}
|
|
1215
|
+
else {
|
|
1216
|
+
this._mergeKeywords(schema, { [mode === 'one' ? (exact ? 'oneOf' : 'anyOf') : mode === 'all' ? 'allOf' : 'anyOf']: schemas });
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
else {
|
|
1220
|
+
this._setConditionProperties(schema, spec, definitions, level, 'matches', 'anyOf');
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
_setConditionProperties(schema, spec, definitions, level, conditionFieldName, logicKeyword = 'allOf') {
|
|
1224
|
+
const conditions = spec[conditionFieldName];
|
|
1225
|
+
if (!conditions || conditions.length === 0)
|
|
1226
|
+
return;
|
|
1227
|
+
//The conditions of whens are concatenated to the schema, which may replace its values and flags (not the ones of
|
|
1228
|
+
//a schema without constraints)
|
|
1229
|
+
if (conditionFieldName === 'whens' && (spec.type !== 'any' || spec.rules || spec.allow || spec.invalid))
|
|
1230
|
+
this._inexact();
|
|
1231
|
+
let ifThenStyle = this._isIfThenElseSupported();
|
|
1232
|
+
const styleSetting = _.remove(spec.metas, (meta) => {
|
|
1233
|
+
return typeof meta['if-style'] !== 'undefined';
|
|
1234
|
+
});
|
|
1235
|
+
if (ifThenStyle && styleSetting.length > 0 && styleSetting[0]['if-style'] === false)
|
|
1236
|
+
ifThenStyle = false;
|
|
1237
|
+
if (conditions.length > 1) {
|
|
1238
|
+
//Multiple case
|
|
1239
|
+
this._mergeKeywords(schema, {
|
|
1240
|
+
[logicKeyword]: _.compact(_.map(conditions, (condition) => {
|
|
1241
|
+
return this._setConditionSchema(ifThenStyle, {}, condition, definitions, level + 1);
|
|
1242
|
+
}))
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
else {
|
|
1246
|
+
const part = this._setConditionSchema(ifThenStyle, {}, conditions[0], definitions, level + 1);
|
|
1247
|
+
if (part)
|
|
1248
|
+
this._mergeKeywords(schema, part);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
_setConditionSchema(ifThenStyle, schema, conditionSpec, definitions, level) {
|
|
1252
|
+
//When "if" is not present, both "then" and "else" MUST be entirely ignored.
|
|
1253
|
+
//There must be either "is" or "switch"
|
|
1254
|
+
if (!conditionSpec.is && !conditionSpec.switch)
|
|
1255
|
+
return;
|
|
1256
|
+
if (conditionSpec.switch) {
|
|
1257
|
+
this._parseSwitchCondition(ifThenStyle, schema, conditionSpec, definitions, level);
|
|
1258
|
+
}
|
|
1259
|
+
else {
|
|
1260
|
+
if (ifThenStyle) {
|
|
1261
|
+
this._parseIfThenElseCondition(schema, conditionSpec, definitions, level);
|
|
1262
|
+
}
|
|
1263
|
+
else {
|
|
1264
|
+
this._setConditionCompositionStyle(schema, conditionSpec, definitions, level);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
return schema;
|
|
1268
|
+
}
|
|
1269
|
+
_parseIfThenElseCondition(schema, conditionSpec, definitions, level) {
|
|
1270
|
+
//Currently, if there is reference, if-then-else style is not supported
|
|
1271
|
+
//To use it, the condition must be defined in parent level using schema-style is
|
|
1272
|
+
if (conditionSpec.ref)
|
|
1273
|
+
return this._setConditionCompositionStyle(schema, conditionSpec, definitions, level);
|
|
1274
|
+
const condition = this.parse(conditionSpec.is, definitions, level);
|
|
1275
|
+
if (!this.isExact(condition))
|
|
1276
|
+
return this._setBranches(schema, conditionSpec, definitions, level);
|
|
1277
|
+
schema.if = condition;
|
|
1278
|
+
if (conditionSpec.then)
|
|
1279
|
+
schema.then = this.parse(conditionSpec.then, definitions, level);
|
|
1280
|
+
if (conditionSpec.otherwise)
|
|
1281
|
+
schema.else = this.parse(conditionSpec.otherwise, definitions, level);
|
|
1282
|
+
return schema;
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Sets the branches of a condition which cannot be converted: a value matches one of them (lakutata's own)
|
|
1286
|
+
* @param schema
|
|
1287
|
+
* @param conditionSpec
|
|
1288
|
+
* @param definitions
|
|
1289
|
+
* @param level
|
|
1290
|
+
*/
|
|
1291
|
+
_setBranches(schema, conditionSpec, definitions, level) {
|
|
1292
|
+
this._inexact();
|
|
1293
|
+
//A missing branch accepts every value
|
|
1294
|
+
if (!conditionSpec.then || !conditionSpec.otherwise)
|
|
1295
|
+
return schema;
|
|
1296
|
+
schema.anyOf = [this.parse(conditionSpec.then, definitions, level), this.parse(conditionSpec.otherwise, definitions, level)];
|
|
1297
|
+
return schema;
|
|
1298
|
+
}
|
|
1299
|
+
_parseSwitchCondition(ifThenStyle, schema, condition, definitions, level) {
|
|
1300
|
+
//Switch cannot be used if the condition is a schema
|
|
1301
|
+
//Hence, condition.ref should always exists
|
|
1302
|
+
if (condition.ref)
|
|
1303
|
+
this._inexact();
|
|
1304
|
+
const anyOf = [];
|
|
1305
|
+
for (const switchCondition of condition.switch) {
|
|
1306
|
+
if (ifThenStyle && !condition.ref) {
|
|
1307
|
+
const innerSchema = this._parseIfThenElseCondition({}, switchCondition, definitions, level + 1);
|
|
1308
|
+
anyOf.push(innerSchema);
|
|
1309
|
+
}
|
|
1310
|
+
else {
|
|
1311
|
+
if (switchCondition.then)
|
|
1312
|
+
anyOf.push(this.parse(switchCondition.then, definitions, level + 1));
|
|
1313
|
+
if (switchCondition.otherwise)
|
|
1314
|
+
anyOf.push(this.parse(switchCondition.otherwise, definitions, level + 1));
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
if (anyOf.length > 1) {
|
|
1318
|
+
schema.anyOf = anyOf;
|
|
1319
|
+
}
|
|
1320
|
+
else {
|
|
1321
|
+
//A single branch is merged (upstream merged an undeclared variable here, and threw)
|
|
1322
|
+
_.merge(schema, anyOf[0]);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
_setConditionCompositionStyle(schema, condition, definitions, level) {
|
|
1326
|
+
if (condition.ref) {
|
|
1327
|
+
//If the condition is refering to other field, cannot use the `is` condition for composition
|
|
1328
|
+
//Simple choise between then / otherwise (anyOf: both may match, upstream uses oneOf)
|
|
1329
|
+
this._inexact();
|
|
1330
|
+
const anyOf = schema.anyOf || [];
|
|
1331
|
+
if (condition.then)
|
|
1332
|
+
anyOf.push(this.parse(condition.then, definitions, level + 1));
|
|
1333
|
+
if (condition.otherwise)
|
|
1334
|
+
anyOf.push(this.parse(condition.otherwise, definitions, level + 1));
|
|
1335
|
+
if (anyOf.length > 1) {
|
|
1336
|
+
schema.anyOf = anyOf;
|
|
1337
|
+
}
|
|
1338
|
+
else {
|
|
1339
|
+
_.merge(schema, anyOf[0]);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
else {
|
|
1343
|
+
//Before Draft 7, you can express an “if-then” conditional using the Schema Composition keywords
|
|
1344
|
+
//and a boolean algebra concept called “implication”.
|
|
1345
|
+
//A -> B(pronounced, A implies B) means that if A is true, then B must also be true.
|
|
1346
|
+
//It can be expressed as !A || B
|
|
1347
|
+
//Variations of implication can express the same things you can express with the if/then/else keywords.
|
|
1348
|
+
//if/then can be expressed as A -> B, if/else can be expressed as !A -> B,
|
|
1349
|
+
//and if/then/else can be expressed as A -> B AND !A -> C
|
|
1350
|
+
if (condition.is && !this.isExact(this.parse(condition.is, definitions, level + 1))) {
|
|
1351
|
+
this._setBranches(schema, condition, definitions, level + 1);
|
|
1352
|
+
}
|
|
1353
|
+
else if (condition.is && condition.then && condition.otherwise) {
|
|
1354
|
+
schema.allOf = [
|
|
1355
|
+
{
|
|
1356
|
+
anyOf: [
|
|
1357
|
+
{
|
|
1358
|
+
not: this.parse(condition.is, definitions, level + 1)
|
|
1359
|
+
},
|
|
1360
|
+
this.parse(condition.then, definitions, level + 1)
|
|
1361
|
+
]
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
anyOf: [
|
|
1365
|
+
this.parse(condition.is, definitions, level + 1),
|
|
1366
|
+
this.parse(condition.otherwise, definitions, level + 1)
|
|
1367
|
+
]
|
|
1368
|
+
}
|
|
1369
|
+
];
|
|
1370
|
+
}
|
|
1371
|
+
else if (condition.is && condition.then) {
|
|
1372
|
+
schema.anyOf = [
|
|
1373
|
+
{
|
|
1374
|
+
not: this.parse(condition.is, definitions, level + 1)
|
|
1375
|
+
},
|
|
1376
|
+
this.parse(condition.then, definitions, level + 1)
|
|
1377
|
+
];
|
|
1378
|
+
}
|
|
1379
|
+
else if (condition.is && condition.otherwise) {
|
|
1380
|
+
schema.anyOf = [
|
|
1381
|
+
this.parse(condition.is, definitions, level + 1),
|
|
1382
|
+
this.parse(condition.otherwise, definitions, level + 1)
|
|
1383
|
+
];
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return schema;
|
|
1387
|
+
}
|
|
1388
|
+
_setAnyProperties(schema) {
|
|
1389
|
+
if (schema.type !== 'any')
|
|
1390
|
+
return;
|
|
1391
|
+
schema.type = [
|
|
1392
|
+
'array',
|
|
1393
|
+
'boolean',
|
|
1394
|
+
'number',
|
|
1395
|
+
'object',
|
|
1396
|
+
'string',
|
|
1397
|
+
'null'
|
|
1398
|
+
];
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* The schemas the value must also match (lakutata)
|
|
1402
|
+
* @param schema
|
|
1403
|
+
* @param spec
|
|
1404
|
+
* @param definitions
|
|
1405
|
+
* @param level
|
|
1406
|
+
*/
|
|
1407
|
+
_setAllOf(schema, spec, definitions, level) {
|
|
1408
|
+
for (const rule of spec.rules || []) {
|
|
1409
|
+
if (rule.name !== 'allOf')
|
|
1410
|
+
continue;
|
|
1411
|
+
const schemas = _.get(rule, `${this.ruleArgFieldName}.schemas`);
|
|
1412
|
+
this._mergeKeywords(schema, { allOf: schemas.map((subschema) => this.parse(subschema, definitions, level + 1)) });
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* No JSON value is a function or a symbol (lakutata)
|
|
1417
|
+
* @param schema
|
|
1418
|
+
* @param spec
|
|
1419
|
+
*/
|
|
1420
|
+
_setNonJsonProperties(schema, spec) {
|
|
1421
|
+
if (!NON_JSON_TYPES.includes(spec.type))
|
|
1422
|
+
return;
|
|
1423
|
+
this._addKeyword(schema, 'not', {});
|
|
1424
|
+
}
|
|
1425
|
+
_setMetaProperties(schema, spec) {
|
|
1426
|
+
_.each(spec.metas, (m) => {
|
|
1427
|
+
if (m.contentMediaType)
|
|
1428
|
+
schema.contentMediaType = m.contentMediaType;
|
|
1429
|
+
if (m.format)
|
|
1430
|
+
schema.format = m.format;
|
|
1431
|
+
if (m.title)
|
|
1432
|
+
schema.title = m.title;
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
_setLinkFieldProperties(schema, spec) {
|
|
1436
|
+
if (schema.type !== 'link')
|
|
1437
|
+
return;
|
|
1438
|
+
delete schema.type;
|
|
1439
|
+
if (_.get(spec, 'link.ref.type') === 'local') {
|
|
1440
|
+
schema.$ref = `${this._getLocalSchemaBasePath()}/${spec.link.ref.path.join('/')}`;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
_copyMetasToSchema(spec, schema) {
|
|
1444
|
+
if (!_.isEmpty(spec.metas)) {
|
|
1445
|
+
_.each(spec.metas, (meta) => {
|
|
1446
|
+
_.each(meta, (value, key) => {
|
|
1447
|
+
if (this._isKnownMetaKey(key))
|
|
1448
|
+
schema[key] = value;
|
|
1449
|
+
});
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Intended to be overridden by child parsers. By default no meta key will be is considered "known".
|
|
1455
|
+
* @param _key
|
|
1456
|
+
*/
|
|
1457
|
+
_isKnownMetaKey(_key) {
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
}
|