Validation Rules API
- Base URL:
https://validation-rules.sls.epilot.io - Full API Docs: https://docs.epilot.io/api/validation-rules
Usageโ
import { epilot } from '@epilot/sdk'
epilot.authorize(() => '<token>')
const { data } = await epilot.validationRules.getValidationRules(...)
Tree-shakeable importโ
import { getClient, authorize } from '@epilot/sdk/validation-rules'
const validationRulesClient = getClient()
authorize(validationRulesClient, () => '<token>')
const { data } = await validationRulesClient.getValidationRules(...)
Operationsโ
Validation Rules
getValidationRulescreateValidationRulegetValidationRuleByIdupdateValidationRuledeleteValidationRuleaddUsedByReferenceremoveUsedByReference
Schemas
GetValidationRulesResponseCreateValidationRuleRequestUpdateValidationRuleRequestValidationRuleBaseValidationRuleUsedByRegexRuleTypePatternRuleTypeNumericRuleTypeRegexConditionRegexNestedConditionRegexFactConditionPatternConditionPatternNestedConditionPatternFactConditionNumericConditionNumericNestedConditionNumericFactCondition
getValidationRulesโ
Get all validation rules by organization Id
GET /v1/validation-rules
const { data } = await client.getValidationRules()
Response
{
"results": [
{
"title": "string",
"placeholder": "string",
"used_by": [
{
"type": "journey",
"schema_slug": "string",
"source_id": "string"
}
],
"rule": {
"type": "regex",
"conditions": {
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
},
{
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
}
]
}
]
}
},
"_schema_version": "string",
"_id": "string",
"_organization_id": "string",
"created_at": "string",
"updated_at": "string",
"created_by": "string",
"updated_by": "string"
}
]
}
createValidationRuleโ
Create Validation Rule
POST /v1/validation-rules
const { data } = await client.createValidationRule(
null,
{
title: 'string',
placeholder: 'string',
used_by: [
{
type: 'journey',
schema_slug: 'string',
source_id: 'string'
}
],
rule: {
type: 'regex',
conditions: {
all: [
{
fact: 'inputValue',
operator: 'regexMatch',
value: 'string',
params: {
errorMessage: 'string'
}
},
{
all: [
{
fact: 'inputValue',
operator: 'regexMatch',
value: 'string',
params: {
errorMessage: 'string'
}
}
]
}
]
}
}
},
)
Response
{
"title": "string",
"placeholder": "string",
"used_by": [
{
"type": "journey",
"schema_slug": "string",
"source_id": "string"
}
],
"rule": {
"type": "regex",
"conditions": {
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
},
{
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
}
]
}
]
}
},
"_schema_version": "string",
"_id": "string",
"_organization_id": "string",
"created_at": "string",
"updated_at": "string",
"created_by": "string",
"updated_by": "string"
}
getValidationRuleByIdโ
Get validation rule by ID
GET /v1/validation-rules/{ruleId}
const { data } = await client.getValidationRuleById({
ruleId: 'example',
})
Response
{
"title": "string",
"placeholder": "string",
"used_by": [
{
"type": "journey",
"schema_slug": "string",
"source_id": "string"
}
],
"rule": {
"type": "regex",
"conditions": {
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
},
{
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
}
]
}
]
}
},
"_schema_version": "string",
"_id": "string",
"_organization_id": "string",
"created_at": "string",
"updated_at": "string",
"created_by": "string",
"updated_by": "string"
}
updateValidationRuleโ
Update Validation Rule (partial update)
PATCH /v1/validation-rules/{ruleId}
const { data } = await client.updateValidationRule(
{
ruleId: 'example',
},
{
title: 'string',
placeholder: 'string',
used_by: [
{
type: 'journey',
schema_slug: 'string',
source_id: 'string'
}
],
rule: {
type: 'regex',
conditions: {
all: [
{
fact: 'inputValue',
operator: 'regexMatch',
value: 'string',
params: {
errorMessage: 'string'
}
},
{
all: [
{
fact: 'inputValue',
operator: 'regexMatch',
value: 'string',
params: {
errorMessage: 'string'
}
}
]
}
]
}
}
},
)
Response
{
"title": "string",
"placeholder": "string",
"used_by": [
{
"type": "journey",
"schema_slug": "string",
"source_id": "string"
}
],
"rule": {
"type": "regex",
"conditions": {
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
},
{
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
}
]
}
]
}
},
"_schema_version": "string",
"_id": "string",
"_organization_id": "string",
"created_at": "string",
"updated_at": "string",
"created_by": "string",
"updated_by": "string"
}
deleteValidationRuleโ
Delete Validation Rule
DELETE /v1/validation-rules/{ruleId}
const { data } = await client.deleteValidationRule({
ruleId: 'example',
})
addUsedByReferenceโ
Add a reference to the usedBy array
POST /v1/validation-rules/{ruleId}/used-by
const { data } = await client.addUsedByReference(
{
ruleId: 'example',
},
{
type: 'journey',
schema_slug: 'string',
source_id: 'string'
},
)
Response
{
"title": "string",
"placeholder": "string",
"used_by": [
{
"type": "journey",
"schema_slug": "string",
"source_id": "string"
}
],
"rule": {
"type": "regex",
"conditions": {
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
},
{
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
}
]
}
]
}
},
"_schema_version": "string",
"_id": "string",
"_organization_id": "string",
"created_at": "string",
"updated_at": "string",
"created_by": "string",
"updated_by": "string"
}
removeUsedByReferenceโ
Remove a reference from the usedBy array
DELETE /v1/validation-rules/{ruleId}/used-by
const { data } = await client.removeUsedByReference(
{
ruleId: 'example',
},
{
type: 'journey',
schema_slug: 'string',
source_id: 'string'
},
)
Response
{
"title": "string",
"placeholder": "string",
"used_by": [
{
"type": "journey",
"schema_slug": "string",
"source_id": "string"
}
],
"rule": {
"type": "regex",
"conditions": {
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
},
{
"all": [
{
"fact": "inputValue",
"operator": "regexMatch",
"value": "string",
"params": {
"errorMessage": "string"
}
}
]
}
]
}
},
"_schema_version": "string",
"_id": "string",
"_organization_id": "string",
"created_at": "string",
"updated_at": "string",
"created_by": "string",
"updated_by": "string"
}
Schemasโ
GetValidationRulesResponseโ
type GetValidationRulesResponse = {
results?: Array<{
_schema_version: string
_id: string
_organization_id: string
created_at: string
updated_at: string
created_by: string
updated_by: string
}>
}
CreateValidationRuleRequestโ
type CreateValidationRuleRequest = object
UpdateValidationRuleRequestโ
type UpdateValidationRuleRequest = {
title?: string
placeholder?: string
used_by?: Array<{
type: "journey" | "entity"
schema_slug?: string
source_id?: string
}>
rule?: {
type: "regex"
conditions: {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
} | {
type: "pattern"
conditions: {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
} | {
type: "numeric"
conditions: {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
}
}
ValidationRuleBaseโ
type ValidationRuleBase = {
title?: string
placeholder?: string
used_by?: Array<{
type: "journey" | "entity"
schema_slug?: string
source_id?: string
}>
rule?: {
type: "regex"
conditions: {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
} | {
type: "pattern"
conditions: {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
} | {
type: "numeric"
conditions: {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
}
}
ValidationRuleโ
The Validation rule definition.
type ValidationRule = {
_schema_version: string
_id: string
_organization_id: string
created_at: string
updated_at: string
created_by: string
updated_by: string
}
UsedByโ
Describes where and how a validation rule is applied.
type UsedBy = {
type: "journey" | "entity"
schema_slug?: string
source_id?: string
}
RegexRuleTypeโ
Validation rule that uses a regular expression to validate input.
type RegexRuleType = {
type: "regex"
conditions: {
all: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}>
} | {
any: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}>
} | {
not: {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
}
}
PatternRuleTypeโ
Validation rule that uses a sequence of patterns to validate input.
type PatternRuleType = {
type: "pattern"
conditions: {
all: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}>
} | {
any: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}>
} | {
not: {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
}
}
NumericRuleTypeโ
Validation rule for numeric values, supporting range and digit count constraints.
type NumericRuleType = {
type: "numeric"
conditions: {
all: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}>
} | {
any: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}>
} | {
not: {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
all: { ... }
} | {
any: { ... }
} | {
not: { ... }
}
}
}
RegexConditionโ
Condition definition for a regex-based validation rule (2 levels deep)
type RegexCondition = {
all: Array<{
fact: "inputValue"
operator: "regexMatch"
value: string
params?: {
errorMessage?: { ... }
}
} | {
all: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
any: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
not: {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}
}>
} | {
any: Array<{
fact: "inputValue"
operator: "regexMatch"
value: string
params?: {
errorMessage?: { ... }
}
} | {
all: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
any: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
not: {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}
}>
} | {
not: {
fact: "inputValue"
operator: "regexMatch"
value: string
params?: {
errorMessage?: { ... }
}
} | {
all: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
any: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
not: {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}
}
}
RegexNestedConditionโ
Nested condition with logical operators (level 2 only)
type RegexNestedCondition = {
all: Array<{
fact: "inputValue"
operator: "regexMatch"
value: string
params?: {
errorMessage?: { ... }
}
}>
} | {
any: Array<{
fact: "inputValue"
operator: "regexMatch"
value: string
params?: {
errorMessage?: { ... }
}
}>
} | {
not: {
fact: "inputValue"
operator: "regexMatch"
value: string
params?: {
errorMessage?: { ... }
}
}
}
RegexFactConditionโ
Fact-based condition for regex validation
type RegexFactCondition = {
fact: "inputValue"
operator: "regexMatch"
value: string
params?: {
errorMessage?: string
}
}
PatternConditionโ
Condition definition for a pattern-based validation rule (2 levels deep)
type PatternCondition = {
all: Array<{
fact: "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check" | "total-length"
operator: "exactlyNDigits"
value: number
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check"
operator: "in" | "notIn" | "contains" | "doesNotContain"
value: string[]
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check"
operator: "equal" | "notEqual"
value: string
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
all: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
any: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
not: {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
// ...
}
PatternNestedConditionโ
Nested condition with logical operators (level 2 only)
type PatternNestedCondition = {
all: Array<{
fact: "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check" | "total-length"
operator: "exactlyNDigits"
value: number
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check"
operator: "in" | "notIn" | "contains" | "doesNotContain"
value: string[]
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check"
operator: "equal" | "notEqual"
value: string
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
}>
} | {
any: Array<{
fact: "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check" | "total-length"
operator: "exactlyNDigits"
value: number
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check"
operator: "in" | "notIn" | "contains" | "doesNotContain"
value: string[]
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check"
operator: "equal" | "notEqual"
value: string
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
}>
} | {
not: {
fact: "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check" | "total-length"
operator: "exactlyNDigits"
value: number
params?: {
errorMessage?: { ... }
start?: { ... }
end?: { ... }
}
} | {
fact: "static-check"
operator: "in" | "notIn" | "contains" | "doesNotContain"
value: string[]
params?: {
// ...
}
PatternFactConditionโ
Fact-based condition for pattern validation
type PatternFactCondition = {
fact: "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: string
start?: number
end?: number
}
} | {
fact: "static-check" | "total-length"
operator: "exactlyNDigits"
value: number
params?: {
errorMessage?: string
start?: number
end?: number
}
} | {
fact: "static-check"
operator: "in" | "notIn" | "contains" | "doesNotContain"
value: string[]
params?: {
errorMessage?: string
start?: number
end?: number
}
} | {
fact: "static-check"
operator: "equal" | "notEqual"
value: string
params?: {
errorMessage?: string
start?: number
end?: number
}
}
NumericConditionโ
Condition definition for a numeric-based validation rule (2 levels deep)
type NumericCondition = {
all: Array<{
fact: "numeric-value" | "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: { ... }
}
} | {
fact: "integer-digits-count"
operator: "equal" | "exactlyNDigits" | "minIntegerDigits" | "maxIntegerDigits"
value: number
params?: {
errorMessage?: { ... }
allowLeadingZeroes?: { ... }
}
} | {
fact: "decimal-digits-count"
operator: "equal" | "minDecimalDigits" | "maxDecimalDigits"
value: number
params?: {
errorMessage?: { ... }
}
} | {
fact: "has-leading-zeroes"
operator: "equal" | "notAllowed"
value: boolean
params?: {
errorMessage?: { ... }
}
} | {
all: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
any: Array<{
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}>
} | {
not: {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
} | {
fact: { ... }
operator: { ... }
value: { ... }
params?: { ... }
}
}>
} | {
any: Array<{
fact: "numeric-value" | "total-length"
// ...
}
NumericNestedConditionโ
Nested condition with logical operators (level 2 only)
type NumericNestedCondition = {
all: Array<{
fact: "numeric-value" | "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: { ... }
}
} | {
fact: "integer-digits-count"
operator: "equal" | "exactlyNDigits" | "minIntegerDigits" | "maxIntegerDigits"
value: number
params?: {
errorMessage?: { ... }
allowLeadingZeroes?: { ... }
}
} | {
fact: "decimal-digits-count"
operator: "equal" | "minDecimalDigits" | "maxDecimalDigits"
value: number
params?: {
errorMessage?: { ... }
}
} | {
fact: "has-leading-zeroes"
operator: "equal" | "notAllowed"
value: boolean
params?: {
errorMessage?: { ... }
}
}>
} | {
any: Array<{
fact: "numeric-value" | "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: { ... }
}
} | {
fact: "integer-digits-count"
operator: "equal" | "exactlyNDigits" | "minIntegerDigits" | "maxIntegerDigits"
value: number
params?: {
errorMessage?: { ... }
allowLeadingZeroes?: { ... }
}
} | {
fact: "decimal-digits-count"
operator: "equal" | "minDecimalDigits" | "maxDecimalDigits"
value: number
params?: {
errorMessage?: { ... }
}
} | {
fact: "has-leading-zeroes"
operator: "equal" | "notAllowed"
value: boolean
params?: {
errorMessage?: { ... }
}
}>
} | {
not: {
fact: "numeric-value" | "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: { ... }
}
} | {
fact: "integer-digits-count"
operator: "equal" | "exactlyNDigits" | "minIntegerDigits" | "maxIntegerDigits"
value: number
params?: {
errorMessage?: { ... }
allowLeadingZeroes?: { ... }
}
} | {
fact: "decimal-digits-count"
operator: "equal" | "minDecimalDigits" | "maxDecimalDigits"
value: number
params?: {
errorMessage?: { ... }
}
} | {
fact: "has-leading-zeroes"
operator: "equal" | "notAllowed"
value: boolean
params?: {
errorMessage?: { ... }
}
}
}
NumericFactConditionโ
Fact-based condition for numeric validation
type NumericFactCondition = {
fact: "numeric-value" | "total-length"
operator: "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive"
value: number
params?: {
errorMessage?: string
}
} | {
fact: "integer-digits-count"
operator: "equal" | "exactlyNDigits" | "minIntegerDigits" | "maxIntegerDigits"
value: number
params?: {
errorMessage?: string
allowLeadingZeroes?: boolean
}
} | {
fact: "decimal-digits-count"
operator: "equal" | "minDecimalDigits" | "maxDecimalDigits"
value: number
params?: {
errorMessage?: string
}
} | {
fact: "has-leading-zeroes"
operator: "equal" | "notAllowed"
value: boolean
params?: {
errorMessage?: string
}
}