@warlock.js/seal 5.31.0 → 5.33.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/CHANGELOG.md +14 -0
- package/cjs/index.cjs +20 -16
- package/cjs/index.cjs.map +1 -1
- package/cjs/{object-VTtA-k1a.cjs → object-BoVGJ68E.cjs} +30 -13
- package/cjs/object-BoVGJ68E.cjs.map +1 -0
- package/cjs/object.cjs +2 -2
- package/cjs/{required-methods-chT0TXQS.cjs → required-methods-BJlnLnwa.cjs} +237 -228
- package/cjs/required-methods-BJlnLnwa.cjs.map +1 -0
- package/cjs/{string-edcPIpcU.cjs → string-CM8x0u2w.cjs} +44 -42
- package/cjs/string-CM8x0u2w.cjs.map +1 -0
- package/cjs/string.cjs +2 -2
- package/esm/config.d.mts +7 -8
- package/esm/config.d.mts.map +1 -1
- package/esm/factory/index.d.mts +2 -1
- package/esm/factory/index.mjs +1 -1
- package/esm/factory/validate.d.mts +3 -6
- package/esm/factory/validate.d.mts.map +1 -1
- package/esm/factory/validators.d.mts +9 -6
- package/esm/factory/validators.d.mts.map +1 -1
- package/esm/helpers/date-helpers.d.mts +1 -2
- package/esm/helpers/date-helpers.d.mts.map +1 -1
- package/esm/helpers/file.utils.d.mts +2 -4
- package/esm/helpers/file.utils.d.mts.map +1 -1
- package/esm/helpers/get-field-value.d.mts +2 -3
- package/esm/helpers/get-field-value.d.mts.map +1 -1
- package/esm/helpers/get-field-value.mjs +2 -1
- package/esm/helpers/get-field-value.mjs.map +1 -1
- package/esm/helpers/index.d.mts +6 -0
- package/esm/helpers/index.mjs +1 -1
- package/esm/helpers/path-helpers.d.mts +1 -2
- package/esm/helpers/path-helpers.d.mts.map +1 -1
- package/esm/helpers/validation-helpers.d.mts +4 -10
- package/esm/helpers/validation-helpers.d.mts.map +1 -1
- package/esm/index.d.mts +7 -0
- package/esm/mutators/array-mutators.d.mts +6 -7
- package/esm/mutators/array-mutators.d.mts.map +1 -1
- package/esm/mutators/boolean-mutators.d.mts +3 -4
- package/esm/mutators/boolean-mutators.d.mts.map +1 -1
- package/esm/mutators/date-mutators.d.mts +18 -19
- package/esm/mutators/date-mutators.d.mts.map +1 -1
- package/esm/mutators/index.d.mts +8 -0
- package/esm/mutators/index.mjs +1 -1
- package/esm/mutators/number-mutators.d.mts +10 -11
- package/esm/mutators/number-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.d.mts +4 -5
- package/esm/mutators/object-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.mjs +5 -4
- package/esm/mutators/object-mutators.mjs.map +1 -1
- package/esm/mutators/scalar-mutators.d.mts +2 -3
- package/esm/mutators/scalar-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.d.mts +37 -38
- package/esm/mutators/string-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.mjs +3 -1
- package/esm/mutators/string-mutators.mjs.map +1 -1
- package/esm/object.d.mts +3 -3
- package/esm/object.d.mts.map +1 -1
- package/esm/plugins/plugin-system.d.mts +11 -9
- package/esm/plugins/plugin-system.d.mts.map +1 -1
- package/esm/rules/array/array-rules.d.mts +3 -4
- package/esm/rules/array/array-rules.d.mts.map +1 -1
- package/esm/rules/array/index.d.mts +2 -0
- package/esm/rules/array/index.mjs +1 -1
- package/esm/rules/color/color-rules.d.mts +8 -9
- package/esm/rules/color/color-rules.d.mts.map +1 -1
- package/esm/rules/color/index.d.mts +2 -0
- package/esm/rules/color/index.mjs +1 -1
- package/esm/rules/common/enum.d.mts +5 -6
- package/esm/rules/common/enum.d.mts.map +1 -1
- package/esm/rules/common/equals-field-rules.d.mts +3 -4
- package/esm/rules/common/equals-field-rules.d.mts.map +1 -1
- package/esm/rules/common/index.d.mts +7 -0
- package/esm/rules/common/index.mjs +1 -1
- package/esm/rules/common/instanceof.d.mts +2 -3
- package/esm/rules/common/instanceof.d.mts.map +1 -1
- package/esm/rules/common/literal.d.mts +2 -3
- package/esm/rules/common/literal.d.mts.map +1 -1
- package/esm/rules/common/type-rules.d.mts +10 -11
- package/esm/rules/common/type-rules.d.mts.map +1 -1
- package/esm/rules/common/unknown-key.d.mts +2 -3
- package/esm/rules/common/unknown-key.d.mts.map +1 -1
- package/esm/rules/conditional/forbidden-if-rules.d.mts +7 -8
- package/esm/rules/conditional/forbidden-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/index.d.mts +11 -0
- package/esm/rules/conditional/index.mjs +1 -1
- package/esm/rules/conditional/present-if-rules.d.mts +6 -7
- package/esm/rules/conditional/present-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-unless-rules.d.mts +2 -3
- package/esm/rules/conditional/present-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-with-rules.d.mts +4 -5
- package/esm/rules/conditional/present-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-without-rules.d.mts +4 -5
- package/esm/rules/conditional/present-without-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-if-rules.d.mts +10 -11
- package/esm/rules/conditional/required-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-unless-rules.d.mts +2 -3
- package/esm/rules/conditional/required-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-when-rule.d.mts +2 -3
- package/esm/rules/conditional/required-when-rule.d.mts.map +1 -1
- package/esm/rules/conditional/required-with-rules.d.mts +4 -5
- package/esm/rules/conditional/required-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-without-rules.d.mts +4 -5
- package/esm/rules/conditional/required-without-rules.d.mts.map +1 -1
- package/esm/rules/core/equal.d.mts +2 -3
- package/esm/rules/core/equal.d.mts.map +1 -1
- package/esm/rules/core/forbidden.d.mts +2 -3
- package/esm/rules/core/forbidden.d.mts.map +1 -1
- package/esm/rules/core/index.d.mts +6 -0
- package/esm/rules/core/index.mjs +1 -1
- package/esm/rules/core/required.d.mts +3 -4
- package/esm/rules/core/required.d.mts.map +1 -1
- package/esm/rules/core/union.d.mts +2 -3
- package/esm/rules/core/union.d.mts.map +1 -1
- package/esm/rules/core/when.d.mts +2 -3
- package/esm/rules/core/when.d.mts.map +1 -1
- package/esm/rules/date/date-comparison-rules.d.mts +6 -7
- package/esm/rules/date/date-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-day-rules.d.mts +5 -6
- package/esm/rules/date/date-day-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.d.mts +4 -5
- package/esm/rules/date/date-field-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.mjs +6 -3
- package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
- package/esm/rules/date/date-period-rules.d.mts +16 -16
- package/esm/rules/date/date-period-rules.d.mts.map +1 -1
- package/esm/rules/date/date-period-rules.mjs +24 -12
- package/esm/rules/date/date-period-rules.mjs.map +1 -1
- package/esm/rules/date/date-relative-rules.d.mts +4 -5
- package/esm/rules/date/date-relative-rules.d.mts.map +1 -1
- package/esm/rules/date/date-relative-rules.mjs +3 -3
- package/esm/rules/date/date-relative-rules.mjs.map +1 -1
- package/esm/rules/date/date-special-rules.d.mts +4 -5
- package/esm/rules/date/date-special-rules.d.mts.map +1 -1
- package/esm/rules/date/date.d.mts +16 -17
- package/esm/rules/date/date.d.mts.map +1 -1
- package/esm/rules/date/date.mjs +4 -2
- package/esm/rules/date/date.mjs.map +1 -1
- package/esm/rules/date/index.d.mts +8 -0
- package/esm/rules/date/index.mjs +1 -1
- package/esm/rules/file/dimensions.d.mts +5 -6
- package/esm/rules/file/dimensions.d.mts.map +1 -1
- package/esm/rules/file/file-size.d.mts +3 -4
- package/esm/rules/file/file-size.d.mts.map +1 -1
- package/esm/rules/file/index.d.mts +3 -0
- package/esm/rules/file/index.mjs +1 -1
- package/esm/rules/index.d.mts +56 -0
- package/esm/rules/index.mjs +1 -1
- package/esm/rules/length/index.d.mts +2 -0
- package/esm/rules/length/index.mjs +1 -1
- package/esm/rules/length/length-rules.d.mts +8 -9
- package/esm/rules/length/length-rules.d.mts.map +1 -1
- package/esm/rules/number/index.d.mts +2 -0
- package/esm/rules/number/index.mjs +1 -1
- package/esm/rules/number/number-rules.d.mts +11 -12
- package/esm/rules/number/number-rules.d.mts.map +1 -1
- package/esm/rules/number/number-rules.mjs +12 -6
- package/esm/rules/number/number-rules.mjs.map +1 -1
- package/esm/rules/scalar/index.mjs +1 -1
- package/esm/rules/string/alpha.d.mts +4 -5
- package/esm/rules/string/alpha.d.mts.map +1 -1
- package/esm/rules/string/credit-card.d.mts +2 -3
- package/esm/rules/string/credit-card.d.mts.map +1 -1
- package/esm/rules/string/email.d.mts +2 -3
- package/esm/rules/string/email.d.mts.map +1 -1
- package/esm/rules/string/id-formats.d.mts +6 -7
- package/esm/rules/string/id-formats.d.mts.map +1 -1
- package/esm/rules/string/index.d.mts +12 -0
- package/esm/rules/string/index.mjs +1 -1
- package/esm/rules/string/ip.d.mts +7 -8
- package/esm/rules/string/ip.d.mts.map +1 -1
- package/esm/rules/string/matches.d.mts +2 -3
- package/esm/rules/string/matches.d.mts.map +1 -1
- package/esm/rules/string/pattern.d.mts +2 -3
- package/esm/rules/string/pattern.d.mts.map +1 -1
- package/esm/rules/string/string-comparison.d.mts +5 -6
- package/esm/rules/string/string-comparison.d.mts.map +1 -1
- package/esm/rules/string/strong-password-rule.d.mts +2 -3
- package/esm/rules/string/strong-password-rule.d.mts.map +1 -1
- package/esm/rules/string/url.d.mts +2 -3
- package/esm/rules/string/url.d.mts.map +1 -1
- package/esm/rules/string/without-whitespace.d.mts +2 -3
- package/esm/rules/string/without-whitespace.d.mts.map +1 -1
- package/esm/standard-schema/index.d.mts +4 -0
- package/esm/standard-schema/json-schema.d.mts +5 -7
- package/esm/standard-schema/json-schema.d.mts.map +1 -1
- package/esm/standard-schema/map-result.d.mts +2 -3
- package/esm/standard-schema/map-result.d.mts.map +1 -1
- package/esm/standard-schema/types.d.mts +4 -5
- package/esm/standard-schema/types.d.mts.map +1 -1
- package/esm/string.d.mts +2 -3
- package/esm/string.d.mts.map +1 -1
- package/esm/types/conditional-types.d.mts +8 -6
- package/esm/types/conditional-types.d.mts.map +1 -1
- package/esm/types/context-types.d.mts +24 -15
- package/esm/types/context-types.d.mts.map +1 -1
- package/esm/types/data-transformer-types.d.mts +3 -5
- package/esm/types/data-transformer-types.d.mts.map +1 -1
- package/esm/types/date-types.d.mts +2 -3
- package/esm/types/date-types.d.mts.map +1 -1
- package/esm/types/file.types.d.mts +1 -2
- package/esm/types/file.types.d.mts.map +1 -1
- package/esm/types/index.d.mts +11 -0
- package/esm/types/inference-types.d.mts +14 -13
- package/esm/types/inference-types.d.mts.map +1 -1
- package/esm/types/mutator-types.d.mts +9 -7
- package/esm/types/mutator-types.d.mts.map +1 -1
- package/esm/types/result-types.d.mts +12 -7
- package/esm/types/result-types.d.mts.map +1 -1
- package/esm/types/rule-types.d.mts +25 -16
- package/esm/types/rule-types.d.mts.map +1 -1
- package/esm/types/schema-types.d.mts +1 -3
- package/esm/types/schema-types.d.mts.map +1 -1
- package/esm/validators/any-validator.d.mts +1 -3
- package/esm/validators/any-validator.d.mts.map +1 -1
- package/esm/validators/array-validator.d.mts +2 -3
- package/esm/validators/array-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.d.mts +2 -3
- package/esm/validators/base-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.mjs +2 -1
- package/esm/validators/base-validator.mjs.map +1 -1
- package/esm/validators/boolean-validator.d.mts +1 -3
- package/esm/validators/boolean-validator.d.mts.map +1 -1
- package/esm/validators/computed-validator.d.mts +3 -4
- package/esm/validators/computed-validator.d.mts.map +1 -1
- package/esm/validators/date-validator.d.mts +2 -3
- package/esm/validators/date-validator.d.mts.map +1 -1
- package/esm/validators/discriminated-union-validator.d.mts +3 -3
- package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
- package/esm/validators/float-validator.d.mts +1 -3
- package/esm/validators/float-validator.d.mts.map +1 -1
- package/esm/validators/index.d.mts +2 -1
- package/esm/validators/index.mjs +1 -1
- package/esm/validators/instanceof-validator.d.mts +1 -3
- package/esm/validators/instanceof-validator.d.mts.map +1 -1
- package/esm/validators/int-validator.d.mts +1 -3
- package/esm/validators/int-validator.d.mts.map +1 -1
- package/esm/validators/lazy-validator.d.mts +2 -3
- package/esm/validators/lazy-validator.d.mts.map +1 -1
- package/esm/validators/literal-validator.d.mts +1 -3
- package/esm/validators/literal-validator.d.mts.map +1 -1
- package/esm/validators/managed-validator.d.mts +3 -4
- package/esm/validators/managed-validator.d.mts.map +1 -1
- package/esm/validators/methods/equality-conditional-methods.d.mts +3 -4
- package/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -1
- package/esm/validators/methods/forbidden-methods.d.mts +2 -3
- package/esm/validators/methods/forbidden-methods.d.mts.map +1 -1
- package/esm/validators/methods/present-methods.d.mts +2 -3
- package/esm/validators/methods/present-methods.d.mts.map +1 -1
- package/esm/validators/methods/required-methods.d.mts +3 -4
- package/esm/validators/methods/required-methods.d.mts.map +1 -1
- package/esm/validators/number-validator.d.mts +1 -3
- package/esm/validators/number-validator.d.mts.map +1 -1
- package/esm/validators/number-validator.mjs +12 -8
- package/esm/validators/number-validator.mjs.map +1 -1
- package/esm/validators/numeric-validator.d.mts +1 -3
- package/esm/validators/numeric-validator.d.mts.map +1 -1
- package/esm/validators/object-validator.d.mts +2 -3
- package/esm/validators/object-validator.d.mts.map +1 -1
- package/esm/validators/primitive-validator.d.mts +1 -3
- package/esm/validators/primitive-validator.d.mts.map +1 -1
- package/esm/validators/record-validator.d.mts +2 -3
- package/esm/validators/record-validator.d.mts.map +1 -1
- package/esm/validators/scalar-validator.d.mts +1 -3
- package/esm/validators/scalar-validator.d.mts.map +1 -1
- package/esm/validators/string-validator.d.mts +1 -3
- package/esm/validators/string-validator.d.mts.map +1 -1
- package/esm/validators/tuple-validator.d.mts +2 -3
- package/esm/validators/tuple-validator.d.mts.map +1 -1
- package/esm/validators/union-validator.d.mts +1 -3
- package/esm/validators/union-validator.d.mts.map +1 -1
- package/package.json +1 -1
- package/cjs/object-VTtA-k1a.cjs.map +0 -1
- package/cjs/required-methods-chT0TXQS.cjs.map +0 -1
- package/cjs/string-edcPIpcU.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/number/number-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Min rule - value must be equal or greater than minimum\n * Supports field names with sibling scope\n */\nexport const minRule: SchemaRule<{\n min: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"min\",\n defaultErrorMessage: \"The :input must be at least :min\",\n async validate(value: any, context) {\n const { min, scope = \"global\" } = this.context.options;\n let compareMin: number;\n\n if (typeof min === \"number\") {\n compareMin = min;\n this.context.translationParams.min = min;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, min);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.min = min;\n\n compareMin = Number(fieldValue);\n\n if (isNaN(compareMin)) {\n return VALID_RULE;\n }\n }\n\n if (value >= compareMin) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Max rule - value must be equal or less than maximum\n * Supports field names with sibling scope\n */\nexport const maxRule: SchemaRule<{\n max: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"max\",\n defaultErrorMessage: \"The :input must equal to or less than :max\",\n async validate(value: any, context) {\n const { max, scope = \"global\" } = this.context.options;\n let compareMax: number;\n\n if (typeof max === \"number\") {\n compareMax = max;\n this.context.translationParams.max = max;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, max);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.max = max;\n\n compareMax = Number(fieldValue);\n\n if (isNaN(compareMax)) {\n return VALID_RULE;\n }\n }\n\n if (value <= compareMax) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Greater than rule - value must be strictly greater than minimum\n * Supports field names with sibling scope\n */\nexport const greaterThanRule: SchemaRule<{\n value: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"greaterThan\",\n defaultErrorMessage: \"The :input must be greater than :value\",\n async validate(value: any, context) {\n const { value: compareValue, scope = \"global\" } = this.context.options;\n let compareNumber: number;\n\n if (typeof compareValue === \"number\") {\n compareNumber = compareValue;\n this.context.translationParams.value = compareValue;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, compareValue);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = compareValue;\n\n compareNumber = Number(fieldValue);\n\n if (isNaN(compareNumber)) {\n return VALID_RULE;\n }\n }\n\n if (value > compareNumber) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Less than rule - value must be strictly less than maximum\n * Supports field names with sibling scope\n */\nexport const lessThanRule: SchemaRule<{\n value: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"lessThan\",\n defaultErrorMessage: \"The :input must be less than :value\",\n async validate(value: any, context) {\n const { value: compareValue, scope = \"global\" } = this.context.options;\n let compareNumber: number;\n\n if (typeof compareValue === \"number\") {\n compareNumber = compareValue;\n this.context.translationParams.value = compareValue;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, compareValue);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = compareValue;\n\n compareNumber = Number(fieldValue);\n\n if (isNaN(compareNumber)) {\n return VALID_RULE;\n }\n }\n\n if (value < compareNumber) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Positive rule - value must be greater than 0\n */\nexport const positiveRule: SchemaRule = {\n name: \"positive\",\n defaultErrorMessage: \"The :input must be a positive number\",\n async validate(value: any, context) {\n if (value > 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Negative rule - value must be less than 0\n */\nexport const negativeRule: SchemaRule = {\n name: \"negative\",\n defaultErrorMessage: \"The :input must be a negative number\",\n async validate(value: any, context) {\n if (value < 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Odd rule - value must be an odd number\n */\nexport const oddRule: SchemaRule = {\n name: \"odd\",\n defaultErrorMessage: \"The :input must be an odd number\",\n async validate(value: any, context) {\n if (value % 2 !== 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Even rule - value must be an even number\n */\nexport const evenRule: SchemaRule = {\n name: \"even\",\n defaultErrorMessage: \"The :input must be an even number\",\n async validate(value: any, context) {\n if (value % 2 === 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Modulo rule - value must be divisible by given number\n */\nexport const moduloRule: SchemaRule<{ value: number }> = {\n name: \"modulo\",\n defaultErrorMessage: \"The :input must be divisible by :value\",\n async validate(value: any, context) {\n if (value % this.context.options.value === 0) {\n return VALID_RULE;\n }\n\n this.context.translationParams.value = this.context.options.value;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Between rule - value must be between the given two numbers (Inclusive)\n * Supports field names with sibling scope\n */\nexport const betweenNumbersRule: SchemaRule<{\n min: number | string;\n max: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"betweenNumbers\",\n defaultErrorMessage: \"The :input must be between :min and :max\",\n async validate(value: any, context) {\n const { min, max, scope = \"global\" } = this.context.options;\n\n // Extract min value\n let compareMin: number;\n if (typeof min === \"number\") {\n compareMin = min;\n this.context.translationParams.min = min;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, min);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.min = min;\n\n compareMin = Number(fieldValue);\n if (isNaN(compareMin)) {\n return VALID_RULE;\n }\n }\n\n // Extract max value\n let compareMax: number;\n if (typeof max === \"number\") {\n compareMax = max;\n this.context.translationParams.max = max;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, max);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.max = max;\n\n compareMax = Number(fieldValue);\n if (isNaN(compareMax)) {\n return VALID_RULE;\n }\n }\n\n if (value >= compareMin && value <= compareMax) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,UAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,KAAK,QAAQ,aAAa,KAAK,QAAQ;EAC/C,IAAI;EAEJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAE9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAEA,IAAI,SAAS,YACX,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,UAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,KAAK,QAAQ,aAAa,KAAK,QAAQ;EAC/C,IAAI;EAEJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;G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,IAAI;EACJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAC9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAEA,IAAI,SAAS,cAAc,SAAS,YAClC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
1
|
+
{"version":3,"file":"number-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/number/number-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Min rule - value must be equal or greater than minimum\n * Supports field names with sibling scope\n */\nexport const minRule: SchemaRule<{\n min: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"min\",\n defaultErrorMessage: \"The :input must be at least :min\",\n async validate(value: any, context) {\n const { min, scope = \"global\" } = this.context.options;\n let compareMin: number;\n\n if (typeof min === \"number\") {\n compareMin = min;\n this.context.translationParams.min = min;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, min);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.min = min;\n\n compareMin = Number(fieldValue);\n\n if (isNaN(compareMin)) {\n return VALID_RULE;\n }\n }\n\n if (value >= compareMin) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Max rule - value must be equal or less than maximum\n * Supports field names with sibling scope\n */\nexport const maxRule: SchemaRule<{\n max: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"max\",\n defaultErrorMessage: \"The :input must equal to or less than :max\",\n async validate(value: any, context) {\n const { max, scope = \"global\" } = this.context.options;\n let compareMax: number;\n\n if (typeof max === \"number\") {\n compareMax = max;\n this.context.translationParams.max = max;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, max);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.max = max;\n\n compareMax = Number(fieldValue);\n\n if (isNaN(compareMax)) {\n return VALID_RULE;\n }\n }\n\n if (value <= compareMax) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Greater than rule - value must be strictly greater than minimum\n * Supports field names with sibling scope\n */\nexport const greaterThanRule: SchemaRule<{\n value: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"greaterThan\",\n defaultErrorMessage: \"The :input must be greater than :value\",\n async validate(value: any, context) {\n const { value: compareValue, scope = \"global\" } = this.context.options;\n let compareNumber: number;\n\n if (typeof compareValue === \"number\") {\n compareNumber = compareValue;\n this.context.translationParams.value = compareValue;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, compareValue);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = compareValue;\n\n compareNumber = Number(fieldValue);\n\n if (isNaN(compareNumber)) {\n return VALID_RULE;\n }\n }\n\n if (value > compareNumber) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Less than rule - value must be strictly less than maximum\n * Supports field names with sibling scope\n */\nexport const lessThanRule: SchemaRule<{\n value: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"lessThan\",\n defaultErrorMessage: \"The :input must be less than :value\",\n async validate(value: any, context) {\n const { value: compareValue, scope = \"global\" } = this.context.options;\n let compareNumber: number;\n\n if (typeof compareValue === \"number\") {\n compareNumber = compareValue;\n this.context.translationParams.value = compareValue;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, compareValue);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = compareValue;\n\n compareNumber = Number(fieldValue);\n\n if (isNaN(compareNumber)) {\n return VALID_RULE;\n }\n }\n\n if (value < compareNumber) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Positive rule - value must be greater than 0\n */\nexport const positiveRule: SchemaRule = {\n name: \"positive\",\n defaultErrorMessage: \"The :input must be a positive number\",\n async validate(value: any, context) {\n if (value > 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Negative rule - value must be less than 0\n */\nexport const negativeRule: SchemaRule = {\n name: \"negative\",\n defaultErrorMessage: \"The :input must be a negative number\",\n async validate(value: any, context) {\n if (value < 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Odd rule - value must be an odd number\n */\nexport const oddRule: SchemaRule = {\n name: \"odd\",\n defaultErrorMessage: \"The :input must be an odd number\",\n async validate(value: any, context) {\n if (value % 2 !== 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Even rule - value must be an even number\n */\nexport const evenRule: SchemaRule = {\n name: \"even\",\n defaultErrorMessage: \"The :input must be an even number\",\n async validate(value: any, context) {\n if (value % 2 === 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Modulo rule - value must be divisible by given number\n */\nexport const moduloRule: SchemaRule<{ value: number }> = {\n name: \"modulo\",\n defaultErrorMessage: \"The :input must be divisible by :value\",\n async validate(value: any, context) {\n if (value % this.context.options.value === 0) {\n return VALID_RULE;\n }\n\n this.context.translationParams.value = this.context.options.value;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Between rule - value must be between the given two numbers (Inclusive)\n * Supports field names with sibling scope\n */\nexport const betweenNumbersRule: SchemaRule<{\n min: number | string;\n max: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"betweenNumbers\",\n defaultErrorMessage: \"The :input must be between :min and :max\",\n async validate(value: any, context) {\n const { min, max, scope = \"global\" } = this.context.options;\n\n // Extract min value\n let compareMin: number;\n if (typeof min === \"number\") {\n compareMin = min;\n this.context.translationParams.min = min;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, min);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.min = min;\n\n compareMin = Number(fieldValue);\n if (isNaN(compareMin)) {\n return VALID_RULE;\n }\n }\n\n // Extract max value\n let compareMax: number;\n if (typeof max === \"number\") {\n compareMax = max;\n this.context.translationParams.max = max;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, max);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.max = max;\n\n compareMax = Number(fieldValue);\n if (isNaN(compareMax)) {\n return VALID_RULE;\n }\n }\n\n if (value >= compareMin && value <= compareMax) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,UAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,KAAK,QAAQ,aAAa,KAAK,QAAQ;EAC/C,IAAI;EAEJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GACL,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;GAC9D,MAAM,aAAa,IAAI,QAAQ,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAE9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAEA,IAAI,SAAS,YACX,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,UAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EA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AAK,QAAQ,aAAa,KAAK,QAAQ;EAGpD,IAAI;EACJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GACL,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;GAC9D,MAAM,aAAa,IAAI,QAAQ,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAC9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAGA,IAAI;EACJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GACL,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;GAC9D,MAAM,aAAa,IAAI,QAAQ,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAC9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAEA,IAAI,SAAS,cAAc,SAAS,YAClC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ACCEPTED_VALUES, acceptedIfPresentRule, acceptedIfRequiredRule, acceptedIfRule, acceptedRule, acceptedUnlessRule, acceptedWithoutRule } from "./accepted-rule.mjs";
|
|
2
2
|
import { DECLINED_VALUES, declinedIfPresentRule, declinedIfRequiredRule, declinedIfRule, declinedRule, declinedUnlessRule, declinedWithoutRule } from "./declined-rule.mjs";
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { ACCEPTED_VALUES, DECLINED_VALUES, acceptedIfPresentRule, acceptedIfRequiredRule, acceptedIfRule, acceptedRule, acceptedUnlessRule, acceptedWithoutRule, declinedIfPresentRule, declinedIfRequiredRule, declinedIfRule, declinedRule, declinedUnlessRule, declinedWithoutRule };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/alpha.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Alpha rule - allows only alphabetic characters
|
|
6
6
|
*/
|
|
7
|
-
declare const alphaRule: SchemaRule;
|
|
7
|
+
export declare const alphaRule: SchemaRule;
|
|
8
8
|
/**
|
|
9
9
|
* AlphaNumeric rule - allows only alphanumeric characters
|
|
10
10
|
*/
|
|
11
|
-
declare const alphaNumericRule: SchemaRule;
|
|
11
|
+
export declare const alphaNumericRule: SchemaRule;
|
|
12
12
|
/**
|
|
13
13
|
* Numeric string rule - allows only numeric characters
|
|
14
14
|
*/
|
|
15
|
-
declare const isNumericRule: SchemaRule;
|
|
15
|
+
export declare const isNumericRule: SchemaRule;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { alphaNumericRule, alphaRule, isNumericRule };
|
|
18
17
|
//# sourceMappingURL=alpha.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/alpha.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"alpha.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/alpha.ts"],"mappings":";;;;;;qBAMa,WAAW;;;;qBAcX,kBAAkB;;;;qBAclB,eAAe"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/credit-card.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Credit card rule - validates credit card number
|
|
6
6
|
*/
|
|
7
|
-
declare const isCreditCardRule: SchemaRule;
|
|
7
|
+
export declare const isCreditCardRule: SchemaRule;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { isCreditCardRule };
|
|
10
9
|
//# sourceMappingURL=credit-card.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit-card.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/credit-card.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"credit-card.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/credit-card.ts"],"mappings":";;;;;;qBAMa,kBAAkB"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/email.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Email rule - validates email format
|
|
6
6
|
*/
|
|
7
|
-
declare const emailRule: SchemaRule;
|
|
7
|
+
export declare const emailRule: SchemaRule;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { emailRule };
|
|
10
9
|
//# sourceMappingURL=email.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/email.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"email.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/email.ts"],"mappings":";;;;;;qBAOa,WAAW"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/id-formats.d.ts
|
|
4
|
-
type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;
|
|
4
|
+
export type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;
|
|
5
5
|
/**
|
|
6
6
|
* UUID rule — value must be a valid UUID. Optionally restrict to a specific version.
|
|
7
7
|
*
|
|
@@ -10,7 +10,7 @@ type UUIDVersion = 1 | 3 | 4 | 5 | 6 | 7;
|
|
|
10
10
|
* v.string().uuid(4) // only v4 (random)
|
|
11
11
|
* v.string().uuid(7) // only v7 (timestamp-ordered)
|
|
12
12
|
*/
|
|
13
|
-
declare const uuidRule: SchemaRule<{
|
|
13
|
+
export declare const uuidRule: SchemaRule<{
|
|
14
14
|
version?: UUIDVersion;
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
@@ -24,7 +24,7 @@ declare const uuidRule: SchemaRule<{
|
|
|
24
24
|
* v.string().cuid() // CUID2
|
|
25
25
|
* v.string().cuid({ version: 1 }) // legacy CUID1
|
|
26
26
|
*/
|
|
27
|
-
declare const cuidRule: SchemaRule<{
|
|
27
|
+
export declare const cuidRule: SchemaRule<{
|
|
28
28
|
version?: 1 | 2;
|
|
29
29
|
}>;
|
|
30
30
|
/**
|
|
@@ -35,7 +35,7 @@ declare const cuidRule: SchemaRule<{
|
|
|
35
35
|
* @example
|
|
36
36
|
* v.string().ulid()
|
|
37
37
|
*/
|
|
38
|
-
declare const ulidRule: SchemaRule;
|
|
38
|
+
export declare const ulidRule: SchemaRule;
|
|
39
39
|
/**
|
|
40
40
|
* nanoid rule — value must be a valid nanoid string.
|
|
41
41
|
*
|
|
@@ -46,9 +46,8 @@ declare const ulidRule: SchemaRule;
|
|
|
46
46
|
* v.string().nanoid() // 21 chars (default)
|
|
47
47
|
* v.string().nanoid(10) // 10 chars
|
|
48
48
|
*/
|
|
49
|
-
declare const nanoidRule: SchemaRule<{
|
|
49
|
+
export declare const nanoidRule: SchemaRule<{
|
|
50
50
|
length?: number;
|
|
51
51
|
}>;
|
|
52
52
|
//#endregion
|
|
53
|
-
export { UUIDVersion, cuidRule, nanoidRule, ulidRule, uuidRule };
|
|
54
53
|
//# sourceMappingURL=id-formats.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-formats.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/id-formats.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"id-formats.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/id-formats.ts"],"mappings":";;;YAuBY;;;;;;;;;qBAUC,UAAU;EAAa,UAAU;;;;;;;;;;;;;qBA8BjC,UAAU;EAAa;;;;;;;;;;qBAqBvB,UAAU;;;;;;;;;;;qBAoBV,YAAY;EAAa"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { alphaNumericRule, alphaRule, isNumericRule } from "./alpha.mjs";
|
|
2
|
+
import { isCreditCardRule } from "./credit-card.mjs";
|
|
3
|
+
import { emailRule } from "./email.mjs";
|
|
4
|
+
import { UUIDVersion, cuidRule, nanoidRule, ulidRule, uuidRule } from "./id-formats.mjs";
|
|
5
|
+
import { ip4Rule, ip6Rule, ipRule, isIP, isIPv4, isIPv6 } from "./ip.mjs";
|
|
6
|
+
import { matchesRule } from "./matches.mjs";
|
|
7
|
+
import { patternRule } from "./pattern.mjs";
|
|
8
|
+
import { containsRule, endsWithRule, notContainsRule, startsWithRule } from "./string-comparison.mjs";
|
|
9
|
+
import { strongPasswordRule } from "./strong-password-rule.mjs";
|
|
10
|
+
import { urlRule } from "./url.mjs";
|
|
11
|
+
import { withoutWhitespaceRule } from "./without-whitespace.mjs";
|
|
12
|
+
export { UUIDVersion, alphaNumericRule, alphaRule, containsRule, cuidRule, emailRule, endsWithRule, ip4Rule, ip6Rule, ipRule, isCreditCardRule, isIP, isIPv4, isIPv6, isNumericRule, matchesRule, nanoidRule, notContainsRule, patternRule, startsWithRule, strongPasswordRule, ulidRule, urlRule, uuidRule, withoutWhitespaceRule };
|
|
@@ -10,4 +10,4 @@ import { strongPasswordRule } from "./strong-password-rule.mjs";
|
|
|
10
10
|
import { urlRule } from "./url.mjs";
|
|
11
11
|
import { withoutWhitespaceRule } from "./without-whitespace.mjs";
|
|
12
12
|
|
|
13
|
-
export {
|
|
13
|
+
export { alphaNumericRule, alphaRule, containsRule, cuidRule, emailRule, endsWithRule, ip4Rule, ip6Rule, ipRule, isCreditCardRule, isIP, isIPv4, isIPv6, isNumericRule, matchesRule, nanoidRule, notContainsRule, patternRule, startsWithRule, strongPasswordRule, ulidRule, urlRule, uuidRule, withoutWhitespaceRule };
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/ip.d.ts
|
|
4
|
-
declare function isIPv4(value: string): boolean;
|
|
5
|
-
declare function isIPv6(value: string): boolean;
|
|
4
|
+
export declare function isIPv4(value: string): boolean;
|
|
5
|
+
export declare function isIPv6(value: string): boolean;
|
|
6
6
|
/**
|
|
7
7
|
* Returns 4 or 6 when `value` is a valid IPv4/IPv6 address, otherwise 0.
|
|
8
8
|
* Signature mirrors Node's `net.isIP` for drop-in behavior parity.
|
|
9
9
|
*/
|
|
10
|
-
declare function isIP(value: string): 0 | 4 | 6;
|
|
10
|
+
export declare function isIP(value: string): 0 | 4 | 6;
|
|
11
11
|
/**
|
|
12
12
|
* IP rule - validates IP address (v4 or v6)
|
|
13
13
|
*/
|
|
14
|
-
declare const ipRule: SchemaRule;
|
|
14
|
+
export declare const ipRule: SchemaRule;
|
|
15
15
|
/**
|
|
16
16
|
* IPv4 rule - validates IPv4 address
|
|
17
17
|
*/
|
|
18
|
-
declare const ip4Rule: SchemaRule;
|
|
18
|
+
export declare const ip4Rule: SchemaRule;
|
|
19
19
|
/**
|
|
20
20
|
* IPv6 rule - validates IPv6 address
|
|
21
21
|
*/
|
|
22
|
-
declare const ip6Rule: SchemaRule;
|
|
22
|
+
export declare const ip6Rule: SchemaRule;
|
|
23
23
|
//#endregion
|
|
24
|
-
export { ip4Rule, ip6Rule, ipRule, isIP, isIPv4, isIPv6 };
|
|
25
24
|
//# sourceMappingURL=ip.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ip.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/ip.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ip.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/ip.ts"],"mappings":";;;wBA0BgB,OAAO;wBAIP,OAAO;;;;;wBAQP,KAAK;;;;qBASR,QAAQ;;;;qBAcR,SAAS;;;;qBAcT,SAAS"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/matches.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Matches rule - value must match another field value
|
|
6
6
|
*/
|
|
7
|
-
declare const matchesRule: SchemaRule<{
|
|
7
|
+
export declare const matchesRule: SchemaRule<{
|
|
8
8
|
field: string;
|
|
9
9
|
}>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { matchesRule };
|
|
12
11
|
//# sourceMappingURL=matches.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matches.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/matches.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"matches.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/matches.ts"],"mappings":";;;;;;qBAOa,aAAa;EAAa"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/pattern.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Pattern rule - validates against regex pattern
|
|
6
6
|
*/
|
|
7
|
-
declare const patternRule: SchemaRule<{
|
|
7
|
+
export declare const patternRule: SchemaRule<{
|
|
8
8
|
pattern: RegExp;
|
|
9
9
|
}>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { patternRule };
|
|
12
11
|
//# sourceMappingURL=pattern.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/pattern.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pattern.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/pattern.ts"],"mappings":";;;;;;qBAMa,aAAa;EAAa,SAAS"}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/string-comparison.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Starts with rule
|
|
6
6
|
*/
|
|
7
|
-
declare const startsWithRule: SchemaRule<{
|
|
7
|
+
export declare const startsWithRule: SchemaRule<{
|
|
8
8
|
value: string;
|
|
9
9
|
}>;
|
|
10
10
|
/**
|
|
11
11
|
* Ends with rule
|
|
12
12
|
*/
|
|
13
|
-
declare const endsWithRule: SchemaRule<{
|
|
13
|
+
export declare const endsWithRule: SchemaRule<{
|
|
14
14
|
value: string;
|
|
15
15
|
}>;
|
|
16
16
|
/**
|
|
17
17
|
* Contains rule
|
|
18
18
|
*/
|
|
19
|
-
declare const containsRule: SchemaRule<{
|
|
19
|
+
export declare const containsRule: SchemaRule<{
|
|
20
20
|
value: string;
|
|
21
21
|
}>;
|
|
22
22
|
/**
|
|
23
23
|
* Not contains rule
|
|
24
24
|
*/
|
|
25
|
-
declare const notContainsRule: SchemaRule<{
|
|
25
|
+
export declare const notContainsRule: SchemaRule<{
|
|
26
26
|
value: string;
|
|
27
27
|
}>;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { containsRule, endsWithRule, notContainsRule, startsWithRule };
|
|
30
29
|
//# sourceMappingURL=string-comparison.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-comparison.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/string-comparison.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"string-comparison.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/string-comparison.ts"],"mappings":";;;;;;qBAMa,gBAAgB;EAAa;;;;;qBAiB7B,cAAc;EAAa;;;;;qBAiB3B,cAAc;EAAa;;;;;qBAiB3B,iBAAiB;EAAa"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/strong-password-rule.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Strong Password rule - validates password strength
|
|
@@ -10,9 +10,8 @@ import { SchemaRule } from "../../types/rule-types.mjs";
|
|
|
10
10
|
* - At least 1 number
|
|
11
11
|
* - At least 1 special character
|
|
12
12
|
*/
|
|
13
|
-
declare const strongPasswordRule: SchemaRule<{
|
|
13
|
+
export declare const strongPasswordRule: SchemaRule<{
|
|
14
14
|
minLength?: number;
|
|
15
15
|
}>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { strongPasswordRule };
|
|
18
17
|
//# sourceMappingURL=strong-password-rule.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strong-password-rule.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/strong-password-rule.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"strong-password-rule.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/strong-password-rule.ts"],"mappings":";;;;;;;;;;;;qBAYa,oBAAoB;EAAa"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/url.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* URL rule - validates URL format
|
|
6
6
|
*/
|
|
7
|
-
declare const urlRule: SchemaRule;
|
|
7
|
+
export declare const urlRule: SchemaRule;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { urlRule };
|
|
10
9
|
//# sourceMappingURL=url.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/url.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"url.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/url.ts"],"mappings":";;;;;;qBAMa,SAAS"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
import "../../types/index.mjs";
|
|
3
3
|
//#region ../../packages/seal/src/rules/string/without-whitespace.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Without whitespace rule - value must not contain whitespace
|
|
6
6
|
*/
|
|
7
|
-
declare const withoutWhitespaceRule: SchemaRule;
|
|
7
|
+
export declare const withoutWhitespaceRule: SchemaRule;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { withoutWhitespaceRule };
|
|
10
9
|
//# sourceMappingURL=without-whitespace.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"without-whitespace.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/without-whitespace.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"without-whitespace.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/string/without-whitespace.ts"],"mappings":";;;;;;qBAMa,uBAAuB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { StandardJSONSchemaV1, StandardSchemaV1 } from "./types.mjs";
|
|
2
|
+
import { JsonSchemaResult, JsonSchemaTarget, applyNullable, getRuleOptions, wrapNullableStrict } from "./json-schema.mjs";
|
|
3
|
+
import { mapToStandardResult } from "./map-result.mjs";
|
|
4
|
+
export { JsonSchemaResult, JsonSchemaTarget, StandardJSONSchemaV1, StandardSchemaV1, applyNullable, getRuleOptions, mapToStandardResult, wrapNullableStrict };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { StandardJSONSchemaV1 } from "./types.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/seal/src/standard-schema/json-schema.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Supported JSON Schema generation targets.
|
|
6
5
|
*/
|
|
7
|
-
type JsonSchemaTarget = StandardJSONSchemaV1.Target;
|
|
6
|
+
export type JsonSchemaTarget = StandardJSONSchemaV1.Target;
|
|
8
7
|
/**
|
|
9
8
|
* The result shape for a generated JSON Schema.
|
|
10
9
|
*/
|
|
11
|
-
type JsonSchemaResult = Record<string, unknown>;
|
|
10
|
+
export type JsonSchemaResult = Record<string, unknown>;
|
|
12
11
|
/**
|
|
13
12
|
* Apply nullable to a JSON Schema object based on the target dialect.
|
|
14
13
|
*
|
|
@@ -26,7 +25,7 @@ type JsonSchemaResult = Record<string, unknown>;
|
|
|
26
25
|
* // → { type: ["string", "null"] }
|
|
27
26
|
* ```
|
|
28
27
|
*/
|
|
29
|
-
declare function applyNullable(schema: JsonSchemaResult, target: JsonSchemaTarget): void;
|
|
28
|
+
export declare function applyNullable(schema: JsonSchemaResult, target: JsonSchemaTarget): void;
|
|
30
29
|
/**
|
|
31
30
|
* Wrap a field schema as nullable for OpenAI strict mode.
|
|
32
31
|
*
|
|
@@ -49,17 +48,16 @@ declare function applyNullable(schema: JsonSchemaResult, target: JsonSchemaTarge
|
|
|
49
48
|
* // → { oneOf: [..., { type: "null" }] }
|
|
50
49
|
* ```
|
|
51
50
|
*/
|
|
52
|
-
declare function wrapNullableStrict(schema: JsonSchemaResult): JsonSchemaResult;
|
|
51
|
+
export declare function wrapNullableStrict(schema: JsonSchemaResult): JsonSchemaResult;
|
|
53
52
|
/**
|
|
54
53
|
* Find the first rule matching the given name in a rules array,
|
|
55
54
|
* and return its options bag.
|
|
56
55
|
*/
|
|
57
|
-
declare function getRuleOptions(rules: Array<{
|
|
56
|
+
export declare function getRuleOptions(rules: Array<{
|
|
58
57
|
name: string;
|
|
59
58
|
context: {
|
|
60
59
|
options: Record<string, unknown>;
|
|
61
60
|
};
|
|
62
61
|
}>, ruleName: string): Record<string, unknown> | undefined;
|
|
63
62
|
//#endregion
|
|
64
|
-
export { JsonSchemaResult, JsonSchemaTarget, applyNullable, getRuleOptions, wrapNullableStrict };
|
|
65
63
|
//# sourceMappingURL=json-schema.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/standard-schema/json-schema.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"json-schema.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/standard-schema/json-schema.ts"],"mappings":";;;;;YAKY,mBAAmB,qBAAqB;;;;YAKxC,mBAAmB;;;;;;;;;;;;;;;;;;wBAmBf,cAAc,QAAQ,kBAAkB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;wBA0ChD,mBAAmB,QAAQ,mBAAmB;;;;;wBA2B9C,eACd,OAAO;EAAQ;EAAc;IAAW,SAAS;;IACjD,mBACC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from "./types.mjs";
|
|
2
2
|
import { ValidationResult } from "../types/result-types.mjs";
|
|
3
|
-
|
|
3
|
+
import "../types/index.mjs";
|
|
4
4
|
//#region ../../packages/seal/src/standard-schema/map-result.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Maps a Seal ValidationResult to a Standard Schema result shape.
|
|
@@ -16,7 +16,6 @@ import { ValidationResult } from "../types/result-types.mjs";
|
|
|
16
16
|
* // Failure → { issues: [{ message: "...", path: [{ key: "..." }] }] }
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
declare function mapToStandardResult(result: ValidationResult): StandardSchemaV1.Result<unknown>;
|
|
19
|
+
export declare function mapToStandardResult(result: ValidationResult): StandardSchemaV1.Result<unknown>;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { mapToStandardResult };
|
|
22
21
|
//# sourceMappingURL=map-result.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-result.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/standard-schema/map-result.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"map-result.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/standard-schema/map-result.ts"],"mappings":";;;;;;;;;;;;;;;;;;wBAiBgB,oBAAoB,QAAQ,mBAAmB,iBAAiB"}
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* - StandardJSONSchemaV1 — for JSON Schema generation (OpenAPI, draft-07, draft-2020-12)
|
|
11
11
|
*/
|
|
12
12
|
/** The Standard Schema interface. */
|
|
13
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
13
|
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
14
14
|
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
15
15
|
}
|
|
16
|
-
declare namespace StandardSchemaV1 {
|
|
16
|
+
export declare namespace StandardSchemaV1 {
|
|
17
17
|
/** The Standard Schema properties interface. */
|
|
18
18
|
interface Props<Input = unknown, Output = Input> {
|
|
19
19
|
/** The version number of the standard. */
|
|
@@ -59,10 +59,10 @@ declare namespace StandardSchemaV1 {
|
|
|
59
59
|
type InferOutput<S extends StandardSchemaV1> = NonNullable<S["~standard"]["types"]>["output"];
|
|
60
60
|
}
|
|
61
61
|
/** The Standard JSON Schema interface. */
|
|
62
|
-
interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
62
|
+
export interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
63
63
|
readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
|
|
64
64
|
}
|
|
65
|
-
declare namespace StandardJSONSchemaV1 {
|
|
65
|
+
export declare namespace StandardJSONSchemaV1 {
|
|
66
66
|
interface Props<Input = unknown, Output = Input> extends Omit<StandardSchemaV1.Props<Input, Output>, never> {
|
|
67
67
|
readonly jsonSchema: Converter;
|
|
68
68
|
}
|
|
@@ -92,5 +92,4 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
//#endregion
|
|
95
|
-
export { StandardJSONSchemaV1, StandardSchemaV1 };
|
|
96
95
|
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/standard-schema/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/standard-schema/types.ts"],"mappings":";;;;;;;;;;;;iBAgBiB,iBAAiB,iBAAiB,SAAS;WACjD,aAAa,iBAAiB,MAAM,OAAO;;yBAG7B;;YAEN,MAAM,iBAAiB,SAAS;;aAEtC;;aAEA;;aAEA,QAAQ,MAAM,OAAO;;aAErB,WACP,gBACA,UAAU,wBACP,OAAO,UAAU,QAAQ,OAAO;;;YAItB,cAAc;aACpB,OAAO;aACP;;;YAIM;aACN,iBAAiB;;;YAIX;aACN,QAAQ,cAAc;;OAGrB,OAAO,UAAU,cAAc,UAAU;;YAGpC;aACN;aACA,OAAO,cAAc,cAAc;;;YAI7B;aACN,KAAK;;;YAIC,MAAM,iBAAiB,SAAS;aACtC,OAAO;aACP,QAAQ;;;OAIP,WAAW,UAAU,oBAAoB,YACnD;;OAIU,YAAY,UAAU,oBAAoB,YACpD;;;iBASa,qBAAqB,iBAAiB,SAAS;WACrD,aAAa,qBAAqB,MAAM,OAAO;;yBAGjC;YACN,MAAM,iBAAiB,SAAS,eAAe,KAC9D,iBAAiB,MAAM,OAAO;aAGrB,YAAY;;;YAIN;;aAEN,QAAQ,SAAS,YAAY;;aAE7B,SAAS,SAAS,YAAY;;;;;;;;;;;;;;OAe7B;YAOK;aACN,QAAQ;aACR,iBAAiB"}
|
package/esm/string.d.mts
CHANGED
|
@@ -4,10 +4,9 @@ import { forbiddenMethodsApplied } from "./validators/methods/forbidden-methods.
|
|
|
4
4
|
import { presentMethodsApplied } from "./validators/methods/present-methods.mjs";
|
|
5
5
|
import { requiredMethodsApplied } from "./validators/methods/required-methods.mjs";
|
|
6
6
|
import { StringValidator } from "./validators/string-validator.mjs";
|
|
7
|
-
|
|
8
7
|
//#region ../../packages/seal/src/string.d.ts
|
|
9
8
|
/** Create a string schema without importing the complete `v` factory. */
|
|
10
|
-
declare const string: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;
|
|
9
|
+
export declare const string: (errorMessage?: string) => StringValidator & StandardSchemaV1<string>;
|
|
11
10
|
//#endregion
|
|
12
|
-
export { StringValidator, equalityConditionalMethodsApplied, forbiddenMethodsApplied, presentMethodsApplied, requiredMethodsApplied
|
|
11
|
+
export { StringValidator, equalityConditionalMethodsApplied, forbiddenMethodsApplied, presentMethodsApplied, requiredMethodsApplied };
|
|
13
12
|
//# sourceMappingURL=string.d.mts.map
|
package/esm/string.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.mts","names":[],"sources":["../../../../../../../packages/seal/src/string.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.d.mts","names":[],"sources":["../../../../../../../packages/seal/src/string.ts"],"mappings":";;;;;;;;qBAUa,SAAM,0BACoB,kBAAkB"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { BaseValidator } from "../validators/base-validator.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/seal/src/types/conditional-types.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Options for conditional when rule
|
|
6
5
|
*/
|
|
7
|
-
type WhenRuleOptions = {
|
|
8
|
-
/** Field name to check */
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export type WhenRuleOptions = {
|
|
7
|
+
/** Field name to check */
|
|
8
|
+
field: string;
|
|
9
|
+
/** Map of field values to validators */
|
|
10
|
+
is: Record<string, BaseValidator>;
|
|
11
|
+
/** Fallback validator if no condition matches */
|
|
12
|
+
otherwise?: BaseValidator;
|
|
13
|
+
/** Whether to check in global context or sibling context (default: "global") */
|
|
11
14
|
scope?: "global" | "sibling";
|
|
12
15
|
};
|
|
13
16
|
//#endregion
|
|
14
|
-
export { WhenRuleOptions };
|
|
15
17
|
//# sourceMappingURL=conditional-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/conditional-types.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"conditional-types.d.mts","names":[],"sources":["../../../../../../../../packages/seal/src/types/conditional-types.ts"],"mappings":";;;;;YAKY;;EAEV;;EAEA,IAAI,eAAe;;EAEnB,YAAY;;EAEZ"}
|