ACTION_CANCEL_REQUEST |
Type : string
|
Default value : '[Rulesets] cancel request'
|
ACTION_CLEAR_ENTITIES |
Type : string
|
Default value : '[Rulesets] clear entities'
|
Entity Actions |
ACTION_FAIL_ENTITIES |
Type : string
|
Default value : '[Rulesets] fail entities'
|
ACTION_RESET |
Type : string
|
Default value : '[Rulesets] reset'
|
ACTION_SET |
Type : string
|
Default value : '[Rulesets] set'
|
StateDetailsActions |
ACTION_SET_ENTITIES |
Type : string
|
Default value : '[Rulesets] set entities'
|
ACTION_SET_ENTITIES_FROM_API |
Type : string
|
Default value : '[Rulesets] set entities from api'
|
Async Actions |
ACTION_UPDATE |
Type : string
|
Default value : '[Rulesets] update'
|
ACTION_UPSERT_ENTITIES |
Type : string
|
Default value : '[Rulesets] upsert entities'
|
ACTION_UPSERT_ENTITIES_FROM_API |
Type : string
|
Default value : '[Rulesets] upsert entities from api'
|
clearRulesetsEntities |
Default value : createAction(ACTION_CLEAR_ENTITIES)
|
Action to empty the list of entities, keeping the global state |
failRulesetsEntities |
Default value : createAction(ACTION_FAIL_ENTITIES, props<FailAsyncStoreItemEntitiesActionPayload<any>>())
|
Action to update failureStatus for every RulesetsModel |
resetRulesets |
Default value : createAction(ACTION_RESET)
|
Action to reset the whole state, by returning it to initial state. |
setRulesets |
Default value : createAction(ACTION_SET, props<SetActionPayload<RulesetsStateDetails>>())
|
Action to clear the StateDetails of the store and replace it |
setRulesetsEntities |
Default value : createAction(ACTION_SET_ENTITIES, props<SetAsyncStoreItemEntitiesActionPayload<RulesetsModel>>())
|
Action to clear all rulesets and fill the store with the payload |
updateRulesets |
Default value : createAction(ACTION_UPDATE, props<UpdateActionPayload<RulesetsStateDetails>>())
|
Action to change a part or the whole object in the store. |
allEqual |
Type : Operator<SupportedSimpleTypes[], SupportedSimpleTypes>
|
Default value : {
name: 'allEqual',
// eslint-disable-next-line eqeqeq -- possibility of comparing string and number values
evaluator: (array, value) => array.every((elementValue) => elementValue == value),
validateLhs: Array.isArray,
validateRhs: isSupportedSimpleTypes
}
|
Check if every value of the variable equals a specific value |
allGreater |
Type : Operator<SupportedSimpleTypes[], number | string>
|
Default value : {
name: 'allGreater',
evaluator: (array, value) => array.every((elementValue) => numberValidator(elementValue) && +elementValue > +value),
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if every numerical value of the variable is greater than a specific value |
allIn |
Type : Operator<SupportedSimpleTypes[], SupportedSimpleTypes[]>
|
Default value : {
name: 'allIn',
evaluator: (array, value) => array.every((elementValue) => value.includes(elementValue)),
validateLhs: Array.isArray,
validateRhs: Array.isArray
}
|
Check if every value of the variable is in a specific list |
allLower |
Type : Operator<number[], number | string>
|
Default value : {
name: 'allLower',
evaluator: (arrayNumber, number) => arrayNumber.every((elementNumber) => elementNumber < +number),
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if every numerical value of the variable is lower than a specific value |
allMatch |
Type : Operator<string[], string>
|
Default value : {
name: 'allMatch',
evaluator: (array, inputRegExp) => {
const regExp = parseRegExp(inputRegExp);
return array.every((elementValue) => regExp.test(elementValue));
},
validateLhs: Array.isArray,
validateRhs: isString
}
|
Check if every string value of the variable matches a specific pattern |
allNotIn |
Type : Operator<SupportedSimpleTypes[], SupportedSimpleTypes[]>
|
Default value : {
name: 'allNotIn',
evaluator: (array, value) => !array.some((elementValue) => value.includes(elementValue)),
validateLhs: Array.isArray,
validateRhs: Array.isArray
}
|
Check if every value of the variable is not in a specific list |
allRangeNumber |
Type : Operator<number[], >
|
Default value : {
name: 'allRangeNumber',
evaluator: (rangeArray, [from, to]) =>
rangeArray.every((elementValue) => elementValue >= +from && elementValue <= +to),
validateLhs: Array.isArray,
validateRhs: isRangeNumber
}
|
Check if every value of the variable is included in a specified range |
arrayContains |
Type : Operator<SupportedSimpleTypes[], SupportedSimpleTypes>
|
Default value : {
name: 'arrayContains',
evaluator: (value, b) => value.includes(b),
validateLhs: Array.isArray,
validateRhs: isSupportedSimpleTypes
}
|
Check if any of the variable's value is equal to a specific value |
lengthEquals |
Type : Operator<any[], number | string>
|
Default value : {
name: 'lengthEquals',
evaluator: (array, length) => array.length === Number(length),
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if the number of values of the variable is equal to a specific value |
lengthGreaterThan |
Type : Operator<any[], number | string>
|
Default value : {
name: 'lengthGreaterThan',
evaluator: (array, length) => array.length > +length,
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if the number of values of the variable is greater than a specific value |
lengthGreaterThanOrEquals |
Type : Operator<any[], number | string>
|
Default value : {
name: 'lengthGreaterThanOrEquals',
evaluator: (array, length) => array.length >= +length,
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if the number of values of the variable is greater or equal to a specific value |
lengthLessThan |
Type : Operator<any[], number | string>
|
Default value : {
name: 'lengthLessThan',
evaluator: (array, length) => array.length < +length,
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if the number of values of the variable is lower than a specific value |
lengthLessThanOrEquals |
Type : Operator<any[], number | string>
|
Default value : {
name: 'lengthLessThanOrEquals',
evaluator: (array, length) => array.length <= +length,
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if the number of values of the variable is lower or equal to a specific value |
lengthNotEquals |
Type : Operator<any[], number | string>
|
Default value : {
name: 'lengthNotEquals',
evaluator: (array, length) => array.length !== Number(length),
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if the number of values of the variable is different from a specific value |
notArrayContains |
Type : Operator<SupportedSimpleTypes[], SupportedSimpleTypes>
|
Default value : {
name: 'notArrayContains',
evaluator: (array, value) => !array.includes(value),
validateLhs: Array.isArray,
validateRhs: isSupportedSimpleTypes
}
|
Check if every value of the variable is different from a specific value |
notStringContains |
Type : Operator<string, string>
|
Default value : {
name: 'notStringContains',
evaluator: (inputString, substring: any) => !inputString.includes(substring),
validateLhs: isString,
validateRhs: isString
}
|
Check if the specified text value is not included in the text variable |
oneEquals |
Type : Operator<SupportedSimpleTypes[], SupportedSimpleTypes>
|
Default value : {
name: 'oneEquals',
// eslint-disable-next-line eqeqeq -- possibility of comparing string and number values
evaluator: (array, value) => array.some((elementValue) => elementValue == value),
validateLhs: Array.isArray,
validateRhs: isSupportedSimpleTypes
}
|
Check if at least one of the values of the variable equals a specific value |
oneGreater |
Type : Operator<number[], number | string>
|
Default value : {
name: 'oneGreater',
evaluator: (arrayNumber, number) => arrayNumber.some((elementValue) => elementValue > +number),
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if one of the values of the variable is greater than a specific value |
oneIn |
Type : Operator<SupportedSimpleTypes[], SupportedSimpleTypes[]>
|
Default value : {
name: 'oneIn',
evaluator: (firstArray, secondArray) =>
firstArray.some((elementValue) => secondArray.includes(elementValue)),
validateLhs: Array.isArray,
validateRhs: Array.isArray
}
|
Check if at least one of the values of the variable is equal to one in a specified list |
oneLower |
Type : Operator<number[], number | string>
|
Default value : {
name: 'oneLower',
evaluator: (arrayNumber, number) => arrayNumber.some((elementValue) => elementValue < +number),
validateLhs: Array.isArray,
validateRhs: numberValidator
}
|
Check if one of the values of the variable is lower than a specific value |
oneMatches |
Type : Operator<string[], string>
|
Default value : {
name: 'oneMatches',
evaluator: (arrayString, inputRegExp) => {
const regExp = parseRegExp(inputRegExp);
return arrayString.some((elementValue) => regExp.test(elementValue));
},
validateLhs: Array.isArray,
validateRhs: isString
}
|
Check if one of the values of the variable matches a specific pattern |
oneRangeNumber |
Type : Operator<number[], >
|
Default value : {
name: 'oneRangeNumber',
evaluator: (arrayNumber, [from, to]) =>
arrayNumber.some((elementValue) => elementValue >= +from && elementValue <= +to),
validateLhs: Array.isArray,
validateRhs: isRangeNumber
}
|
Check if one of the values of the variable is included in a specified range |
stringContains |
Type : Operator<string, string>
|
Default value : {
name: 'stringContains',
evaluator: (inputString, substring) => inputString.includes(substring),
validateLhs: isString,
validateRhs: isString
}
|
Check if the specified text value is included in the text variable |
basicOperators |
Type : []
|
Default value : [
equals, inArray, inString, isDefined, isUndefined, matchesPattern, notEquals, notInArray, notInString
]
|
List of all default basic operators |
equals |
Type : Operator
|
Default value : {
name: 'equals',
// eslint-disable-next-line eqeqeq -- possibility of comparing string and number values
evaluator: (firstValue, secondValue) => firstValue == secondValue
}
|
Check if a variable is equal to a specific value |
inArray |
Type : Operator<SupportedSimpleTypes, SupportedSimpleTypes[]>
|
Default value : {
name: 'inArray',
evaluator: (value, array) => array.includes(value),
validateLhs: isSupportedSimpleTypes,
validateRhs: Array.isArray
}
|
Check if the variable's value is included in a specified list |
inString |
Type : Operator<string, string>
|
Default value : {
name: 'inString',
evaluator: (value, inputString) => inputString.includes(value),
validateLhs: isString,
validateRhs: isString
}
|
Check if the text variable is part of the specified value |
isDefined |
Type : UnaryOperator<any>
|
Default value : {
name: 'isDefined',
evaluator: (input) => input !== undefined && input !== null
}
|
Check if the variable and its value are defined |
isUndefined |
Type : UnaryOperator<any>
|
Default value : {
name: 'isUndefined',
evaluator: (input) => input === undefined || input === null
}
|
Check if the variable and its value are undefined |
matchesPattern |
Type : Operator<string, string>
|
Default value : {
name: 'matchesPattern',
evaluator: (value, inputRegExp) => {
const regExp = parseRegExp(inputRegExp);
return regExp.test(value);
},
validateLhs: isString,
validateRhs: isString
}
|
Check if the text variable matches the specified RegExp pattern |
notEquals |
Type : Operator
|
Default value : {
name: 'notEquals',
// eslint-disable-next-line eqeqeq -- possibility of comparing string and number values
evaluator: (firstValue, secondValue) => firstValue != secondValue
}
|
Check if a variable is different from a specific value |
notInArray |
Type : Operator<SupportedSimpleTypes, SupportedSimpleTypes[]>
|
Default value : {
name: 'notInArray',
evaluator: (value, array) => !array.includes(value),
validateLhs: isSupportedSimpleTypes,
validateRhs: Array.isArray
}
|
Check if the variable's value is not included in the value list |
notInString |
Type : Operator<string, string>
|
Default value : {
name: 'notInString',
evaluator: (value, inputString) => !inputString.includes(value),
validateLhs: isString,
validateRhs: isString
}
|
Check if the text variable is not part of the specified value |
CLIPBOARD_FEATURE_LENGTH_THRESHOLD |
Type : number
|
Default value : 80
|
Minimal length required to enable clipboard feature |
NOTIFICATION_DURATION |
Type : number
|
Default value : 1750
|
Duration of the notification for clipboard feature (in milliseconds) |
dateAfter |
Type : Operator<Date, DateInput, DateInput>
|
Default value : {
name: 'dateAfter',
evaluator: (leftDate, rightDate) => {
const firstDateTime = new Date(leftDate).setHours(0, 0, 0, 0);
const secondDateTime = new Date(rightDate).setHours(0, 0, 0, 0);
return firstDateTime > secondDateTime;
},
validateLhs: isValidDateInput,
validateRhs: isValidDateInput
}
|
Check if a date variable is posterior than a specified date |
dateBasedOperators |
Type : []
|
Default value : [
inRangeDate, dateInNextMinutes, dateNotInNextMinutes, dateAfter, dateBefore, dateEquals, dateNotEquals
]
|
dateBefore |
Type : Operator<Date, DateInput, DateInput>
|
Default value : {
name: 'dateBefore',
evaluator: (leftDate, rightDate) => {
const firstDateTime = new Date(leftDate).setHours(0, 0, 0, 0);
const secondDateTime = new Date(rightDate).setHours(0, 0, 0, 0);
return firstDateTime < secondDateTime;
},
validateLhs: isValidDateInput,
validateRhs: isValidDateInput
}
|
Check if a date variable is prior than a specified date |
dateEquals |
Type : Operator<Date, DateInput, DateInput>
|
Default value : {
name: 'dateEquals',
evaluator: (leftDate, rightDate) => {
const firstDateIgnoringHours = new Date(leftDate).setHours(0, 0, 0, 0);
const secondDateIgnoringHours = new Date(rightDate).setHours(0, 0, 0, 0);
return firstDateIgnoringHours === secondDateIgnoringHours;
},
validateLhs: isValidDateInput,
validateRhs: isValidDateInput
}
|
Check if a date variable is the same as a specified date |
dateInNextMinutes |
Type : Operator<Date, number, DateInput, string | number>
|
Default value : {
name: 'dateInNextMinutes',
evaluator: (leftDateInput, minutes, operatorFactValues) => {
if (!operatorFactValues) {
throw new Error('No operatorFactValues. Unable to retrieve the current time.');
}
if (typeof operatorFactValues.o3rCurrentTime !== 'number') {
throw new Error('o3rCurrentTime value is not a number');
}
const currentTimeValue = operatorFactValues.o3rCurrentTime;
return inRangeDate.evaluator(leftDateInput, [currentTimeValue, currentTimeValue + +minutes * 60_000]);
},
factImplicitDependencies: ['o3rCurrentTime'],
validateLhs: isValidDateInput,
validateRhs: numberValidator
}
|
Check if the value of the variable is in the next x minutes |
dateNotEquals |
Type : Operator<Date, DateInput, DateInput>
|
Default value : {
name: 'dateNotEquals',
evaluator: (leftDate, rightDate) => {
const firstDateIgnoringHours = new Date(leftDate).setHours(0, 0, 0, 0);
const secondDateIgnoringHours = new Date(rightDate).setHours(0, 0, 0, 0);
return firstDateIgnoringHours !== secondDateIgnoringHours;
},
validateLhs: isValidDateInput,
validateRhs: isValidDateInput
}
|
Check if a date variable is different from a specified date |
dateNotInNextMinutes |
Type : Operator<Date, number, DateInput, string | number>
|
Default value : {
name: 'dateNotInNextMinutes',
evaluator: (leftDateInput, minutes, operatorFactValues) => {
if (!operatorFactValues) {
throw new Error('No operatorFactValues. Unable to retrieve the current time.');
}
if (typeof operatorFactValues.o3rCurrentTime !== 'number') {
throw new Error('o3rCurrentTime value is not a number');
}
const currentTimeValue = operatorFactValues.o3rCurrentTime;
const now = new Date(currentTimeValue);
const leftDate = new Date(leftDateInput);
const targetDate = new Date(new Date(currentTimeValue).setMinutes(now.getMinutes() + +minutes));
return leftDate >= now && leftDate > targetDate;
},
factImplicitDependencies: ['o3rCurrentTime'],
validateLhs: isValidDateInput,
validateRhs: numberValidator
}
|
Check if the value of the variable is not in the next x minutes |
inRangeDate |
Type : Operator<Date, , DateInput>
|
Default value : {
name: 'inRangeDate',
evaluator: (date, [from, to]) => {
const dateObject = new Date(date);
return new Date(from) <= dateObject && new Date(to) >= dateObject;
},
validateLhs: isValidDateInput,
validateRhs: isValidDateRange
}
|
Check if a date variable is in a specified date range |
DEFAULT_RULES_ENGINE_OPTIONS |
Type : Readonly<RulesEngineServiceOptions>
|
Default value : {
dryRun: false,
debug: false
} as const
|
Default Rules engine options |
RULES_ENGINE_OPTIONS |
Default value : new InjectionToken<boolean>('Rules Engine Options')
|
Determine if the action should be executed |
greaterThan |
Type : Operator<number, number, number | string, number | string>
|
Default value : {
name: 'greaterThan',
evaluator: (firstNumber, secondNumber) => firstNumber > secondNumber,
validateLhs: numberValidator,
validateRhs: numberValidator
}
|
Check if the number variable is greater than a specific value |
greaterThanOrEqual |
Type : Operator<number, number, number | string, number | string>
|
Default value : {
name: 'greaterThanOrEqual',
evaluator: (firstNumber, secondNumber) => firstNumber >= secondNumber,
validateLhs: numberValidator,
validateRhs: numberValidator
}
|
Check if the number variable is greater or equal to a specific value |
lessOrEqual |
Type : Operator<number, number, number | string, number | string>
|
Default value : {
name: 'lessOrEqual',
evaluator: (firstNumber, secondNumber) => firstNumber <= secondNumber,
validateLhs: numberValidator,
validateRhs: numberValidator
}
|
Check if the number variable is lower or equal to a specific value |
lessThan |
Type : Operator<number, number, number | string, number | string>
|
Default value : {
name: 'lessThan',
evaluator: (firstNumber, secondNumber) => firstNumber < secondNumber,
validateLhs: numberValidator,
validateRhs: numberValidator
}
|
Check if the number variable is lower than a specific value |
numberBasedOperators |
Type : []
|
Default value : [greaterThan, greaterThanOrEqual, lessThan, lessOrEqual]
|
List of all default number based operators |
inRangeTime |
Type : Operator<string, >
|
Default value : {
name: 'inRangeTime',
evaluator: (currentTime, [from, to]) => {
const parseTime = (timeStr: string) => {
const [hours, minutes] = timeStr.split(':').map((value) => +value);
return hours * 60 + minutes;
};
const currentMinutes = parseTime(currentTime);
const startMinutes = parseTime(from);
const endMinutes = parseTime(to);
return startMinutes <= endMinutes ? currentMinutes >= startMinutes && currentMinutes <= endMinutes : currentMinutes >= startMinutes || currentMinutes <= endMinutes;
},
validateLhs: isValidTimeInput,
validateRhs: isValidTimeRange
}
|
Check if the time variable is between the specified start and end times. This method also supports time ranges that cross midnight. For example, a range from "23:00" to "02:00" will be true for an input like "00:30". |
timeBasedOperators |
Type : []
|
Default value : [
inRangeTime
]
|
List of all default time-based operators |
isValidDate |
Default value : (d: any) => !Number.isNaN(d) && d instanceof Date
|
Check if the given value is a valid date |
selectAllRulesets |
Default value : createSelector(selectRulesetsState, selectAll)
|
Select the array of Rulesets |
selectRulesetsEntities |
Default value : createSelector(selectRulesetsState, selectEntities)
|
Select the dictionary of Rulesets entities |
selectRulesetsIds |
Default value : createSelector(selectRulesetsState, selectIds)
|
Select the array of Rulesets ids |
selectRulesetsState |
Default value : createFeatureSelector<RulesetsState>(RULESETS_STORE_NAME)
|
Select Rulesets State |
selectRulesetsStorePendingStatus |
Default value : createSelector(selectRulesetsState, (state) => state.isPending || false)
|
Select the store pending status |
selectRulesetsTotal |
Default value : createSelector(selectRulesetsState, selectTotal)
|
Select the total Rulesets count |
Default value : rulesetsAdapter.getSelectors()
|
operatorList |
Type : []
|
Default value : [...arrayBasedOperators, ...basicOperators, ...numberBasedOperators, ...dateBasedOperators]
|
OTTER_RULES_ENGINE_DEVTOOLS_DEFAULT_OPTIONS |
Type : Readonly<RulesEngineDevtoolsServiceOptions>
|
Default value : {
isActivatedOnBootstrap: false
} as const
|
OTTER_RULES_ENGINE_DEVTOOLS_OPTIONS |
Default value : new InjectionToken<RulesEngineDevtoolsServiceOptions>('Otter RulesEngine Devtools options')
|
RULESETS_REDUCER_TOKEN |
Default value : new InjectionToken<ActionReducer<RulesetsState, Action>>('Feature Rulesets Reducer')
|
Token of the Rulesets reducer |
RULESETS_STORE_NAME |
Type : string
|
Default value : 'rulesets'
|
Name of the Rulesets Store |
rulesetsStorageSerializer |
Default value : (state: RulesetsState) => {
return asyncStoreItemAdapter.clearAsyncStoreItem(state);
}
|
rulesetsStorageSync |
Type : Serializer<RulesetsState>
|
Default value : {
serialize: rulesetsStorageSerializer,
deserialize: rulesetsStorageDeserializer
}
|