Data that supports the business rule defined in evaluate(). Consider this immutable. Expect to create a new Condition instance if its data needs to be changed.
Helps identify the purpose of the Condition. Impacts:
Protected
defaultSupplies the Condition's default Category
The WhenCondition uses the ConditionType of its child condition in error messages.
Static
DefaultProtected
loggerProvides an API for logging, sending entries to the loggerService.
Implementation for IMessageTokenSource. Conditions havea number of values that are appropriate for tokens on the ConditionConfig. Examples:
An array. If an empty array if there are no token to offer. This base class has no tokens to offer.
Protected
generateUtility to create a condition to use as a child condition. It uses the conditionFactory. If the factory throws an exception, it logs the error and returns a condition that always returns Undetermined to allow execution to continue.
Protected
tryConverts the given value and lookup key using the provided conversion lookup key. If the conversion fails, a warning log is generated. Takes no action if the conversionLookupKey is null.
The value to be converted.
The lookup key associated with the value. Often this should be assigned to valueHost.getDataType().
The conversion lookup key to be used for conversion. Often this comes from conversionLookupKey or secondConversionLookupKey found on the Config object.
The services
An object containing the converted value, lookup key, and a flag indicating if the conversion failed.
Optional
value?: anyOptional
lookupProtected
ensureProtected
logUtility to log when a conditionConfig property is incorrectly setup.
Protected
throwLogs the invalid property data and throws a CodingError.
The name of the invalid property.
The error message describing the invalid property data.
The value host services.
Protected
logReport a comparison error where the data types of the two values are mismatched.
Protected
logLogs a message indicating that the specified property lacks a value to evaluate.
The name of the property.
The value host services.
Protected
conditionReturns the result of the child condition if the enabler condition is matched. Otherwise, returns ConditionEvaluateResult.Undetermined.
Provides conditions for the enabler and the child condition based on their configs. This targets Validator.validate which uses both conditions directly instead of calling WhenCondition.evaluate.
Protected
enablerA service to provide all ValueHostNames that have been assigned to this Condition's Config.
Generated using TypeDoc v0.25.12
Specialized condition used to enable/disable another condition. It is a wrapper around another condition that evaluates the other condition only when its own enabler condition is ConditionEvaluationResult.Match.
Example: Only use requireText when the regular expression pattern is matched against another valuehost
Note that the enabler condition is not passed the current valuehost to evaluate. It is passed null, and the enabler condition should be configured to get its own value host because it is rare that the enabler condition should be based on the same valuehost as the child condition.
The Validator.validate function will call the enabler and child conditions directly, bypassing the WhenCondition.evaluate function and its limitation of no conditions that return a promise. Any condition where WhenCondition is a child will use the WhenCondition.evaluate function and retain its limitation of no conditions that return a promise.
ALERT: ConditionType=When is NEVER used as a Validator's errorCode. The child condition's ConditionType is used as the errorCode instead. This is maintained both in this class's conditionType and in resolveErrorCode().