@warlock.js/seal 4.0.31 → 4.0.39
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/cjs/index.js +2 -1
- package/cjs/index.js.map +1 -1
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -1
- package/package.json +36 -48
- package/cjs/config.d.ts +0 -48
- package/cjs/config.d.ts.map +0 -1
- package/cjs/config.js +0 -42
- package/cjs/config.js.map +0 -1
- package/cjs/factory/index.d.ts +0 -3
- package/cjs/factory/index.d.ts.map +0 -1
- package/cjs/factory/validate.d.ts +0 -8
- package/cjs/factory/validate.d.ts.map +0 -1
- package/cjs/factory/validate.js +0 -21
- package/cjs/factory/validate.js.map +0 -1
- package/cjs/factory/validators.d.ts +0 -36
- package/cjs/factory/validators.d.ts.map +0 -1
- package/cjs/factory/validators.js +0 -39
- package/cjs/factory/validators.js.map +0 -1
- package/cjs/helpers/date-helpers.d.ts +0 -16
- package/cjs/helpers/date-helpers.d.ts.map +0 -1
- package/cjs/helpers/date-helpers.js +0 -20
- package/cjs/helpers/date-helpers.js.map +0 -1
- package/cjs/helpers/get-field-value.d.ts +0 -37
- package/cjs/helpers/get-field-value.d.ts.map +0 -1
- package/cjs/helpers/get-field-value.js +0 -40
- package/cjs/helpers/get-field-value.js.map +0 -1
- package/cjs/helpers/index.d.ts +0 -5
- package/cjs/helpers/index.d.ts.map +0 -1
- package/cjs/helpers/path-helpers.d.ts +0 -5
- package/cjs/helpers/path-helpers.d.ts.map +0 -1
- package/cjs/helpers/path-helpers.js +0 -8
- package/cjs/helpers/path-helpers.js.map +0 -1
- package/cjs/helpers/validation-helpers.d.ts +0 -4
- package/cjs/helpers/validation-helpers.d.ts.map +0 -1
- package/cjs/helpers/validation-helpers.js +0 -48
- package/cjs/helpers/validation-helpers.js.map +0 -1
- package/cjs/index.d.ts +0 -29
- package/cjs/index.d.ts.map +0 -1
- package/cjs/mutators/array-mutators.d.ts +0 -12
- package/cjs/mutators/array-mutators.d.ts.map +0 -1
- package/cjs/mutators/array-mutators.js +0 -37
- package/cjs/mutators/array-mutators.js.map +0 -1
- package/cjs/mutators/date-mutators.d.ts +0 -39
- package/cjs/mutators/date-mutators.d.ts.map +0 -1
- package/cjs/mutators/date-mutators.js +0 -120
- package/cjs/mutators/date-mutators.js.map +0 -1
- package/cjs/mutators/index.d.ts +0 -7
- package/cjs/mutators/index.d.ts.map +0 -1
- package/cjs/mutators/number-mutators.d.ts +0 -9
- package/cjs/mutators/number-mutators.d.ts.map +0 -1
- package/cjs/mutators/number-mutators.js +0 -23
- package/cjs/mutators/number-mutators.js.map +0 -1
- package/cjs/mutators/object-mutators.d.ts +0 -8
- package/cjs/mutators/object-mutators.d.ts.map +0 -1
- package/cjs/mutators/object-mutators.js +0 -50
- package/cjs/mutators/object-mutators.js.map +0 -1
- package/cjs/mutators/scalar-mutators.d.ts +0 -3
- package/cjs/mutators/scalar-mutators.d.ts.map +0 -1
- package/cjs/mutators/scalar-mutators.js +0 -6
- package/cjs/mutators/scalar-mutators.js.map +0 -1
- package/cjs/mutators/string-mutators.d.ts +0 -72
- package/cjs/mutators/string-mutators.d.ts.map +0 -1
- package/cjs/mutators/string-mutators.js +0 -193
- package/cjs/mutators/string-mutators.js.map +0 -1
- package/cjs/plugins/index.d.ts +0 -7
- package/cjs/plugins/index.d.ts.map +0 -1
- package/cjs/plugins/plugin-system.d.ts +0 -71
- package/cjs/plugins/plugin-system.d.ts.map +0 -1
- package/cjs/plugins/plugin-system.js +0 -68
- package/cjs/plugins/plugin-system.js.map +0 -1
- package/cjs/rules/array/array-rules.d.ts +0 -12
- package/cjs/rules/array/array-rules.d.ts.map +0 -1
- package/cjs/rules/array/array-rules.js +0 -44
- package/cjs/rules/array/array-rules.js.map +0 -1
- package/cjs/rules/array/index.d.ts +0 -2
- package/cjs/rules/array/index.d.ts.map +0 -1
- package/cjs/rules/color/color-rules.d.ts +0 -30
- package/cjs/rules/color/color-rules.d.ts.map +0 -1
- package/cjs/rules/color/color-rules.js +0 -120
- package/cjs/rules/color/color-rules.js.map +0 -1
- package/cjs/rules/color/index.d.ts +0 -2
- package/cjs/rules/color/index.d.ts.map +0 -1
- package/cjs/rules/common/enum.d.ts +0 -26
- package/cjs/rules/common/enum.d.ts.map +0 -1
- package/cjs/rules/common/enum.js +0 -55
- package/cjs/rules/common/enum.js.map +0 -1
- package/cjs/rules/common/equals-field-rules.d.ts +0 -18
- package/cjs/rules/common/equals-field-rules.d.ts.map +0 -1
- package/cjs/rules/common/equals-field-rules.js +0 -38
- package/cjs/rules/common/equals-field-rules.js.map +0 -1
- package/cjs/rules/common/index.d.ts +0 -5
- package/cjs/rules/common/index.d.ts.map +0 -1
- package/cjs/rules/common/type-rules.d.ts +0 -34
- package/cjs/rules/common/type-rules.d.ts.map +0 -1
- package/cjs/rules/common/type-rules.js +0 -104
- package/cjs/rules/common/type-rules.js.map +0 -1
- package/cjs/rules/common/unknown-key.d.ts +0 -9
- package/cjs/rules/common/unknown-key.d.ts.map +0 -1
- package/cjs/rules/common/unknown-key.js +0 -20
- package/cjs/rules/common/unknown-key.js.map +0 -1
- package/cjs/rules/conditional/forbidden-if-rules.d.ts +0 -54
- package/cjs/rules/conditional/forbidden-if-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/forbidden-if-rules.js +0 -112
- package/cjs/rules/conditional/forbidden-if-rules.js.map +0 -1
- package/cjs/rules/conditional/index.d.ts +0 -10
- package/cjs/rules/conditional/index.d.ts.map +0 -1
- package/cjs/rules/conditional/present-if-rules.d.ts +0 -45
- package/cjs/rules/conditional/present-if-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/present-if-rules.js +0 -98
- package/cjs/rules/conditional/present-if-rules.js.map +0 -1
- package/cjs/rules/conditional/present-unless-rules.d.ts +0 -11
- package/cjs/rules/conditional/present-unless-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/present-unless-rules.js +0 -20
- package/cjs/rules/conditional/present-unless-rules.js.map +0 -1
- package/cjs/rules/conditional/present-with-rules.d.ts +0 -26
- package/cjs/rules/conditional/present-with-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/present-with-rules.js +0 -63
- package/cjs/rules/conditional/present-with-rules.js.map +0 -1
- package/cjs/rules/conditional/present-without-rules.d.ts +0 -26
- package/cjs/rules/conditional/present-without-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/present-without-rules.js +0 -63
- package/cjs/rules/conditional/present-without-rules.js.map +0 -1
- package/cjs/rules/conditional/required-if-rules.d.ts +0 -45
- package/cjs/rules/conditional/required-if-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/required-if-rules.js +0 -98
- package/cjs/rules/conditional/required-if-rules.js.map +0 -1
- package/cjs/rules/conditional/required-unless-rules.d.ts +0 -11
- package/cjs/rules/conditional/required-unless-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/required-unless-rules.js +0 -20
- package/cjs/rules/conditional/required-unless-rules.js.map +0 -1
- package/cjs/rules/conditional/required-with-rules.d.ts +0 -26
- package/cjs/rules/conditional/required-with-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/required-with-rules.js +0 -63
- package/cjs/rules/conditional/required-with-rules.js.map +0 -1
- package/cjs/rules/conditional/required-without-rules.d.ts +0 -26
- package/cjs/rules/conditional/required-without-rules.d.ts.map +0 -1
- package/cjs/rules/conditional/required-without-rules.js +0 -63
- package/cjs/rules/conditional/required-without-rules.js.map +0 -1
- package/cjs/rules/core/equal.d.ts +0 -8
- package/cjs/rules/core/equal.d.ts.map +0 -1
- package/cjs/rules/core/equal.js +0 -13
- package/cjs/rules/core/equal.js.map +0 -1
- package/cjs/rules/core/forbidden.d.ts +0 -6
- package/cjs/rules/core/forbidden.d.ts.map +0 -1
- package/cjs/rules/core/forbidden.js +0 -13
- package/cjs/rules/core/forbidden.js.map +0 -1
- package/cjs/rules/core/index.d.ts +0 -6
- package/cjs/rules/core/index.d.ts.map +0 -1
- package/cjs/rules/core/required.d.ts +0 -11
- package/cjs/rules/core/required.d.ts.map +0 -1
- package/cjs/rules/core/required.js +0 -31
- package/cjs/rules/core/required.js.map +0 -1
- package/cjs/rules/core/union.d.ts +0 -9
- package/cjs/rules/core/union.d.ts.map +0 -1
- package/cjs/rules/core/union.js +0 -40
- package/cjs/rules/core/union.js.map +0 -1
- package/cjs/rules/core/when.d.ts +0 -6
- package/cjs/rules/core/when.d.ts.map +0 -1
- package/cjs/rules/core/when.js +0 -40
- package/cjs/rules/core/when.js.map +0 -1
- package/cjs/rules/date/date-comparison-rules.d.ts +0 -25
- package/cjs/rules/date/date-comparison-rules.d.ts.map +0 -1
- package/cjs/rules/date/date-comparison-rules.js +0 -78
- package/cjs/rules/date/date-comparison-rules.js.map +0 -1
- package/cjs/rules/date/date-day-rules.d.ts +0 -21
- package/cjs/rules/date/date-day-rules.d.ts.map +0 -1
- package/cjs/rules/date/date-day-rules.js +0 -65
- package/cjs/rules/date/date-day-rules.js.map +0 -1
- package/cjs/rules/date/date-field-comparison-rules.d.ts +0 -28
- package/cjs/rules/date/date-field-comparison-rules.d.ts.map +0 -1
- package/cjs/rules/date/date-field-comparison-rules.js +0 -90
- package/cjs/rules/date/date-field-comparison-rules.js.map +0 -1
- package/cjs/rules/date/date-period-rules.d.ts +0 -108
- package/cjs/rules/date/date-period-rules.d.ts.map +0 -1
- package/cjs/rules/date/date-period-rules.js +0 -566
- package/cjs/rules/date/date-period-rules.js.map +0 -1
- package/cjs/rules/date/date-relative-rules.d.ts +0 -20
- package/cjs/rules/date/date-relative-rules.d.ts.map +0 -1
- package/cjs/rules/date/date-relative-rules.js +0 -57
- package/cjs/rules/date/date-relative-rules.js.map +0 -1
- package/cjs/rules/date/date-special-rules.d.ts +0 -20
- package/cjs/rules/date/date-special-rules.d.ts.map +0 -1
- package/cjs/rules/date/date-special-rules.js +0 -72
- package/cjs/rules/date/date-special-rules.js.map +0 -1
- package/cjs/rules/date/date.d.ts +0 -93
- package/cjs/rules/date/date.d.ts.map +0 -1
- package/cjs/rules/date/date.js +0 -279
- package/cjs/rules/date/date.js.map +0 -1
- package/cjs/rules/date/index.d.ts +0 -8
- package/cjs/rules/date/index.d.ts.map +0 -1
- package/cjs/rules/file/dimensions.d.ts +0 -26
- package/cjs/rules/file/dimensions.d.ts.map +0 -1
- package/cjs/rules/file/dimensions.js +0 -56
- package/cjs/rules/file/dimensions.js.map +0 -1
- package/cjs/rules/file/file-size.d.ts +0 -14
- package/cjs/rules/file/file-size.d.ts.map +0 -1
- package/cjs/rules/file/file-size.js +0 -26
- package/cjs/rules/file/file-size.js.map +0 -1
- package/cjs/rules/file/index.d.ts +0 -11
- package/cjs/rules/file/index.d.ts.map +0 -1
- package/cjs/rules/index.d.ts +0 -19
- package/cjs/rules/index.d.ts.map +0 -1
- package/cjs/rules/length/index.d.ts +0 -2
- package/cjs/rules/length/index.d.ts.map +0 -1
- package/cjs/rules/length/length-rules.d.ts +0 -49
- package/cjs/rules/length/length-rules.d.ts.map +0 -1
- package/cjs/rules/length/length-rules.js +0 -116
- package/cjs/rules/length/length-rules.js.map +0 -1
- package/cjs/rules/number/index.d.ts +0 -2
- package/cjs/rules/number/index.d.ts.map +0 -1
- package/cjs/rules/number/number-rules.d.ts +0 -65
- package/cjs/rules/number/number-rules.d.ts.map +0 -1
- package/cjs/rules/number/number-rules.js +0 -234
- package/cjs/rules/number/number-rules.js.map +0 -1
- package/cjs/rules/scalar/accepted-rule.d.ts +0 -39
- package/cjs/rules/scalar/accepted-rule.d.ts.map +0 -1
- package/cjs/rules/scalar/accepted-rule.js +0 -110
- package/cjs/rules/scalar/accepted-rule.js.map +0 -1
- package/cjs/rules/scalar/declined-rule.d.ts +0 -39
- package/cjs/rules/scalar/declined-rule.d.ts.map +0 -1
- package/cjs/rules/scalar/declined-rule.js +0 -110
- package/cjs/rules/scalar/declined-rule.js.map +0 -1
- package/cjs/rules/scalar/index.d.ts +0 -3
- package/cjs/rules/scalar/index.d.ts.map +0 -1
- package/cjs/rules/string/alpha.d.ts +0 -14
- package/cjs/rules/string/alpha.d.ts.map +0 -1
- package/cjs/rules/string/alpha.js +0 -39
- package/cjs/rules/string/alpha.js.map +0 -1
- package/cjs/rules/string/credit-card.d.ts +0 -6
- package/cjs/rules/string/credit-card.d.ts.map +0 -1
- package/cjs/rules/string/credit-card.js +0 -31
- package/cjs/rules/string/credit-card.js.map +0 -1
- package/cjs/rules/string/email.d.ts +0 -6
- package/cjs/rules/string/email.d.ts.map +0 -1
- package/cjs/rules/string/email.js +0 -13
- package/cjs/rules/string/email.js.map +0 -1
- package/cjs/rules/string/index.d.ts +0 -17
- package/cjs/rules/string/index.d.ts.map +0 -1
- package/cjs/rules/string/ip.d.ts +0 -14
- package/cjs/rules/string/ip.d.ts.map +0 -1
- package/cjs/rules/string/ip.js +0 -39
- package/cjs/rules/string/ip.js.map +0 -1
- package/cjs/rules/string/matches.d.ts +0 -8
- package/cjs/rules/string/matches.d.ts.map +0 -1
- package/cjs/rules/string/matches.js +0 -14
- package/cjs/rules/string/matches.js.map +0 -1
- package/cjs/rules/string/pattern.d.ts +0 -8
- package/cjs/rules/string/pattern.d.ts.map +0 -1
- package/cjs/rules/string/pattern.js +0 -13
- package/cjs/rules/string/pattern.js.map +0 -1
- package/cjs/rules/string/string-comparison.d.ts +0 -26
- package/cjs/rules/string/string-comparison.d.ts.map +0 -1
- package/cjs/rules/string/string-comparison.js +0 -52
- package/cjs/rules/string/string-comparison.js.map +0 -1
- package/cjs/rules/string/strong-password-rule.d.ts +0 -14
- package/cjs/rules/string/strong-password-rule.d.ts.map +0 -1
- package/cjs/rules/string/strong-password-rule.js +0 -38
- package/cjs/rules/string/strong-password-rule.js.map +0 -1
- package/cjs/rules/string/url.d.ts +0 -6
- package/cjs/rules/string/url.d.ts.map +0 -1
- package/cjs/rules/string/url.js +0 -16
- package/cjs/rules/string/url.js.map +0 -1
- package/cjs/rules/string/without-whitespace.d.ts +0 -6
- package/cjs/rules/string/without-whitespace.d.ts.map +0 -1
- package/cjs/rules/string/without-whitespace.js +0 -13
- package/cjs/rules/string/without-whitespace.js.map +0 -1
- package/cjs/types/conditional-types.d.ts +0 -15
- package/cjs/types/conditional-types.d.ts.map +0 -1
- package/cjs/types/context-types.d.ts +0 -44
- package/cjs/types/context-types.d.ts.map +0 -1
- package/cjs/types/data-transformer-types.d.ts +0 -25
- package/cjs/types/data-transformer-types.d.ts.map +0 -1
- package/cjs/types/date-types.d.ts +0 -9
- package/cjs/types/date-types.d.ts.map +0 -1
- package/cjs/types/date-types.js +0 -12
- package/cjs/types/date-types.js.map +0 -1
- package/cjs/types/index.d.ts +0 -10
- package/cjs/types/index.d.ts.map +0 -1
- package/cjs/types/inference-types.d.ts +0 -29
- package/cjs/types/inference-types.d.ts.map +0 -1
- package/cjs/types/mutator-types.d.ts +0 -27
- package/cjs/types/mutator-types.d.ts.map +0 -1
- package/cjs/types/result-types.d.ts +0 -19
- package/cjs/types/result-types.d.ts.map +0 -1
- package/cjs/types/rule-types.d.ts +0 -54
- package/cjs/types/rule-types.d.ts.map +0 -1
- package/cjs/types/schema-types.d.ts +0 -6
- package/cjs/types/schema-types.d.ts.map +0 -1
- package/cjs/validators/any-validator.d.ts +0 -7
- package/cjs/validators/any-validator.d.ts.map +0 -1
- package/cjs/validators/any-validator.js +0 -5
- package/cjs/validators/any-validator.js.map +0 -1
- package/cjs/validators/array-validator.d.ts +0 -59
- package/cjs/validators/array-validator.d.ts.map +0 -1
- package/cjs/validators/array-validator.js +0 -134
- package/cjs/validators/array-validator.js.map +0 -1
- package/cjs/validators/base-validator.d.ts +0 -609
- package/cjs/validators/base-validator.d.ts.map +0 -1
- package/cjs/validators/base-validator.js +0 -1154
- package/cjs/validators/base-validator.js.map +0 -1
- package/cjs/validators/boolean-validator.d.ts +0 -47
- package/cjs/validators/boolean-validator.d.ts.map +0 -1
- package/cjs/validators/boolean-validator.js +0 -54
- package/cjs/validators/boolean-validator.js.map +0 -1
- package/cjs/validators/date-validator.d.ts +0 -307
- package/cjs/validators/date-validator.d.ts.map +0 -1
- package/cjs/validators/date-validator.js +0 -645
- package/cjs/validators/date-validator.js.map +0 -1
- package/cjs/validators/float-validator.d.ts +0 -8
- package/cjs/validators/float-validator.d.ts.map +0 -1
- package/cjs/validators/float-validator.js +0 -9
- package/cjs/validators/float-validator.js.map +0 -1
- package/cjs/validators/index.d.ts +0 -24
- package/cjs/validators/index.d.ts.map +0 -1
- package/cjs/validators/int-validator.d.ts +0 -8
- package/cjs/validators/int-validator.d.ts.map +0 -1
- package/cjs/validators/int-validator.js +0 -9
- package/cjs/validators/int-validator.js.map +0 -1
- package/cjs/validators/number-validator.d.ts +0 -113
- package/cjs/validators/number-validator.d.ts.map +0 -1
- package/cjs/validators/number-validator.js +0 -192
- package/cjs/validators/number-validator.js.map +0 -1
- package/cjs/validators/numeric-validator.d.ts +0 -15
- package/cjs/validators/numeric-validator.d.ts.map +0 -1
- package/cjs/validators/numeric-validator.js +0 -18
- package/cjs/validators/numeric-validator.js.map +0 -1
- package/cjs/validators/object-validator.d.ts +0 -178
- package/cjs/validators/object-validator.d.ts.map +0 -1
- package/cjs/validators/object-validator.js +0 -356
- package/cjs/validators/object-validator.js.map +0 -1
- package/cjs/validators/record-validator.d.ts +0 -33
- package/cjs/validators/record-validator.d.ts.map +0 -1
- package/cjs/validators/record-validator.js +0 -70
- package/cjs/validators/record-validator.js.map +0 -1
- package/cjs/validators/scalar-validator.d.ts +0 -82
- package/cjs/validators/scalar-validator.d.ts.map +0 -1
- package/cjs/validators/scalar-validator.js +0 -160
- package/cjs/validators/scalar-validator.js.map +0 -1
- package/cjs/validators/string-validator.d.ts +0 -191
- package/cjs/validators/string-validator.d.ts.map +0 -1
- package/cjs/validators/string-validator.js +0 -410
- package/cjs/validators/string-validator.js.map +0 -1
- package/cjs/validators/tuple-validator.d.ts +0 -34
- package/cjs/validators/tuple-validator.d.ts.map +0 -1
- package/cjs/validators/tuple-validator.js +0 -79
- package/cjs/validators/tuple-validator.js.map +0 -1
- package/cjs/validators/union-validator.d.ts +0 -42
- package/cjs/validators/union-validator.d.ts.map +0 -1
- package/cjs/validators/union-validator.js +0 -44
- package/cjs/validators/union-validator.js.map +0 -1
- package/esm/config.d.ts +0 -48
- package/esm/config.d.ts.map +0 -1
- package/esm/config.js +0 -42
- package/esm/config.js.map +0 -1
- package/esm/factory/index.d.ts +0 -3
- package/esm/factory/index.d.ts.map +0 -1
- package/esm/factory/validate.d.ts +0 -8
- package/esm/factory/validate.d.ts.map +0 -1
- package/esm/factory/validate.js +0 -21
- package/esm/factory/validate.js.map +0 -1
- package/esm/factory/validators.d.ts +0 -36
- package/esm/factory/validators.d.ts.map +0 -1
- package/esm/factory/validators.js +0 -39
- package/esm/factory/validators.js.map +0 -1
- package/esm/helpers/date-helpers.d.ts +0 -16
- package/esm/helpers/date-helpers.d.ts.map +0 -1
- package/esm/helpers/date-helpers.js +0 -20
- package/esm/helpers/date-helpers.js.map +0 -1
- package/esm/helpers/get-field-value.d.ts +0 -37
- package/esm/helpers/get-field-value.d.ts.map +0 -1
- package/esm/helpers/get-field-value.js +0 -40
- package/esm/helpers/get-field-value.js.map +0 -1
- package/esm/helpers/index.d.ts +0 -5
- package/esm/helpers/index.d.ts.map +0 -1
- package/esm/helpers/path-helpers.d.ts +0 -5
- package/esm/helpers/path-helpers.d.ts.map +0 -1
- package/esm/helpers/path-helpers.js +0 -8
- package/esm/helpers/path-helpers.js.map +0 -1
- package/esm/helpers/validation-helpers.d.ts +0 -4
- package/esm/helpers/validation-helpers.d.ts.map +0 -1
- package/esm/helpers/validation-helpers.js +0 -48
- package/esm/helpers/validation-helpers.js.map +0 -1
- package/esm/index.d.ts +0 -29
- package/esm/index.d.ts.map +0 -1
- package/esm/mutators/array-mutators.d.ts +0 -12
- package/esm/mutators/array-mutators.d.ts.map +0 -1
- package/esm/mutators/array-mutators.js +0 -37
- package/esm/mutators/array-mutators.js.map +0 -1
- package/esm/mutators/date-mutators.d.ts +0 -39
- package/esm/mutators/date-mutators.d.ts.map +0 -1
- package/esm/mutators/date-mutators.js +0 -120
- package/esm/mutators/date-mutators.js.map +0 -1
- package/esm/mutators/index.d.ts +0 -7
- package/esm/mutators/index.d.ts.map +0 -1
- package/esm/mutators/number-mutators.d.ts +0 -9
- package/esm/mutators/number-mutators.d.ts.map +0 -1
- package/esm/mutators/number-mutators.js +0 -23
- package/esm/mutators/number-mutators.js.map +0 -1
- package/esm/mutators/object-mutators.d.ts +0 -8
- package/esm/mutators/object-mutators.d.ts.map +0 -1
- package/esm/mutators/object-mutators.js +0 -50
- package/esm/mutators/object-mutators.js.map +0 -1
- package/esm/mutators/scalar-mutators.d.ts +0 -3
- package/esm/mutators/scalar-mutators.d.ts.map +0 -1
- package/esm/mutators/scalar-mutators.js +0 -6
- package/esm/mutators/scalar-mutators.js.map +0 -1
- package/esm/mutators/string-mutators.d.ts +0 -72
- package/esm/mutators/string-mutators.d.ts.map +0 -1
- package/esm/mutators/string-mutators.js +0 -193
- package/esm/mutators/string-mutators.js.map +0 -1
- package/esm/plugins/index.d.ts +0 -7
- package/esm/plugins/index.d.ts.map +0 -1
- package/esm/plugins/plugin-system.d.ts +0 -71
- package/esm/plugins/plugin-system.d.ts.map +0 -1
- package/esm/plugins/plugin-system.js +0 -68
- package/esm/plugins/plugin-system.js.map +0 -1
- package/esm/rules/array/array-rules.d.ts +0 -12
- package/esm/rules/array/array-rules.d.ts.map +0 -1
- package/esm/rules/array/array-rules.js +0 -44
- package/esm/rules/array/array-rules.js.map +0 -1
- package/esm/rules/array/index.d.ts +0 -2
- package/esm/rules/array/index.d.ts.map +0 -1
- package/esm/rules/color/color-rules.d.ts +0 -30
- package/esm/rules/color/color-rules.d.ts.map +0 -1
- package/esm/rules/color/color-rules.js +0 -120
- package/esm/rules/color/color-rules.js.map +0 -1
- package/esm/rules/color/index.d.ts +0 -2
- package/esm/rules/color/index.d.ts.map +0 -1
- package/esm/rules/common/enum.d.ts +0 -26
- package/esm/rules/common/enum.d.ts.map +0 -1
- package/esm/rules/common/enum.js +0 -55
- package/esm/rules/common/enum.js.map +0 -1
- package/esm/rules/common/equals-field-rules.d.ts +0 -18
- package/esm/rules/common/equals-field-rules.d.ts.map +0 -1
- package/esm/rules/common/equals-field-rules.js +0 -38
- package/esm/rules/common/equals-field-rules.js.map +0 -1
- package/esm/rules/common/index.d.ts +0 -5
- package/esm/rules/common/index.d.ts.map +0 -1
- package/esm/rules/common/type-rules.d.ts +0 -34
- package/esm/rules/common/type-rules.d.ts.map +0 -1
- package/esm/rules/common/type-rules.js +0 -104
- package/esm/rules/common/type-rules.js.map +0 -1
- package/esm/rules/common/unknown-key.d.ts +0 -9
- package/esm/rules/common/unknown-key.d.ts.map +0 -1
- package/esm/rules/common/unknown-key.js +0 -20
- package/esm/rules/common/unknown-key.js.map +0 -1
- package/esm/rules/conditional/forbidden-if-rules.d.ts +0 -54
- package/esm/rules/conditional/forbidden-if-rules.d.ts.map +0 -1
- package/esm/rules/conditional/forbidden-if-rules.js +0 -112
- package/esm/rules/conditional/forbidden-if-rules.js.map +0 -1
- package/esm/rules/conditional/index.d.ts +0 -10
- package/esm/rules/conditional/index.d.ts.map +0 -1
- package/esm/rules/conditional/present-if-rules.d.ts +0 -45
- package/esm/rules/conditional/present-if-rules.d.ts.map +0 -1
- package/esm/rules/conditional/present-if-rules.js +0 -98
- package/esm/rules/conditional/present-if-rules.js.map +0 -1
- package/esm/rules/conditional/present-unless-rules.d.ts +0 -11
- package/esm/rules/conditional/present-unless-rules.d.ts.map +0 -1
- package/esm/rules/conditional/present-unless-rules.js +0 -20
- package/esm/rules/conditional/present-unless-rules.js.map +0 -1
- package/esm/rules/conditional/present-with-rules.d.ts +0 -26
- package/esm/rules/conditional/present-with-rules.d.ts.map +0 -1
- package/esm/rules/conditional/present-with-rules.js +0 -63
- package/esm/rules/conditional/present-with-rules.js.map +0 -1
- package/esm/rules/conditional/present-without-rules.d.ts +0 -26
- package/esm/rules/conditional/present-without-rules.d.ts.map +0 -1
- package/esm/rules/conditional/present-without-rules.js +0 -63
- package/esm/rules/conditional/present-without-rules.js.map +0 -1
- package/esm/rules/conditional/required-if-rules.d.ts +0 -45
- package/esm/rules/conditional/required-if-rules.d.ts.map +0 -1
- package/esm/rules/conditional/required-if-rules.js +0 -98
- package/esm/rules/conditional/required-if-rules.js.map +0 -1
- package/esm/rules/conditional/required-unless-rules.d.ts +0 -11
- package/esm/rules/conditional/required-unless-rules.d.ts.map +0 -1
- package/esm/rules/conditional/required-unless-rules.js +0 -20
- package/esm/rules/conditional/required-unless-rules.js.map +0 -1
- package/esm/rules/conditional/required-with-rules.d.ts +0 -26
- package/esm/rules/conditional/required-with-rules.d.ts.map +0 -1
- package/esm/rules/conditional/required-with-rules.js +0 -63
- package/esm/rules/conditional/required-with-rules.js.map +0 -1
- package/esm/rules/conditional/required-without-rules.d.ts +0 -26
- package/esm/rules/conditional/required-without-rules.d.ts.map +0 -1
- package/esm/rules/conditional/required-without-rules.js +0 -63
- package/esm/rules/conditional/required-without-rules.js.map +0 -1
- package/esm/rules/core/equal.d.ts +0 -8
- package/esm/rules/core/equal.d.ts.map +0 -1
- package/esm/rules/core/equal.js +0 -13
- package/esm/rules/core/equal.js.map +0 -1
- package/esm/rules/core/forbidden.d.ts +0 -6
- package/esm/rules/core/forbidden.d.ts.map +0 -1
- package/esm/rules/core/forbidden.js +0 -13
- package/esm/rules/core/forbidden.js.map +0 -1
- package/esm/rules/core/index.d.ts +0 -6
- package/esm/rules/core/index.d.ts.map +0 -1
- package/esm/rules/core/required.d.ts +0 -11
- package/esm/rules/core/required.d.ts.map +0 -1
- package/esm/rules/core/required.js +0 -31
- package/esm/rules/core/required.js.map +0 -1
- package/esm/rules/core/union.d.ts +0 -9
- package/esm/rules/core/union.d.ts.map +0 -1
- package/esm/rules/core/union.js +0 -40
- package/esm/rules/core/union.js.map +0 -1
- package/esm/rules/core/when.d.ts +0 -6
- package/esm/rules/core/when.d.ts.map +0 -1
- package/esm/rules/core/when.js +0 -40
- package/esm/rules/core/when.js.map +0 -1
- package/esm/rules/date/date-comparison-rules.d.ts +0 -25
- package/esm/rules/date/date-comparison-rules.d.ts.map +0 -1
- package/esm/rules/date/date-comparison-rules.js +0 -78
- package/esm/rules/date/date-comparison-rules.js.map +0 -1
- package/esm/rules/date/date-day-rules.d.ts +0 -21
- package/esm/rules/date/date-day-rules.d.ts.map +0 -1
- package/esm/rules/date/date-day-rules.js +0 -65
- package/esm/rules/date/date-day-rules.js.map +0 -1
- package/esm/rules/date/date-field-comparison-rules.d.ts +0 -28
- package/esm/rules/date/date-field-comparison-rules.d.ts.map +0 -1
- package/esm/rules/date/date-field-comparison-rules.js +0 -90
- package/esm/rules/date/date-field-comparison-rules.js.map +0 -1
- package/esm/rules/date/date-period-rules.d.ts +0 -108
- package/esm/rules/date/date-period-rules.d.ts.map +0 -1
- package/esm/rules/date/date-period-rules.js +0 -566
- package/esm/rules/date/date-period-rules.js.map +0 -1
- package/esm/rules/date/date-relative-rules.d.ts +0 -20
- package/esm/rules/date/date-relative-rules.d.ts.map +0 -1
- package/esm/rules/date/date-relative-rules.js +0 -57
- package/esm/rules/date/date-relative-rules.js.map +0 -1
- package/esm/rules/date/date-special-rules.d.ts +0 -20
- package/esm/rules/date/date-special-rules.d.ts.map +0 -1
- package/esm/rules/date/date-special-rules.js +0 -72
- package/esm/rules/date/date-special-rules.js.map +0 -1
- package/esm/rules/date/date.d.ts +0 -93
- package/esm/rules/date/date.d.ts.map +0 -1
- package/esm/rules/date/date.js +0 -279
- package/esm/rules/date/date.js.map +0 -1
- package/esm/rules/date/index.d.ts +0 -8
- package/esm/rules/date/index.d.ts.map +0 -1
- package/esm/rules/file/dimensions.d.ts +0 -26
- package/esm/rules/file/dimensions.d.ts.map +0 -1
- package/esm/rules/file/dimensions.js +0 -56
- package/esm/rules/file/dimensions.js.map +0 -1
- package/esm/rules/file/file-size.d.ts +0 -14
- package/esm/rules/file/file-size.d.ts.map +0 -1
- package/esm/rules/file/file-size.js +0 -26
- package/esm/rules/file/file-size.js.map +0 -1
- package/esm/rules/file/index.d.ts +0 -11
- package/esm/rules/file/index.d.ts.map +0 -1
- package/esm/rules/index.d.ts +0 -19
- package/esm/rules/index.d.ts.map +0 -1
- package/esm/rules/length/index.d.ts +0 -2
- package/esm/rules/length/index.d.ts.map +0 -1
- package/esm/rules/length/length-rules.d.ts +0 -49
- package/esm/rules/length/length-rules.d.ts.map +0 -1
- package/esm/rules/length/length-rules.js +0 -116
- package/esm/rules/length/length-rules.js.map +0 -1
- package/esm/rules/number/index.d.ts +0 -2
- package/esm/rules/number/index.d.ts.map +0 -1
- package/esm/rules/number/number-rules.d.ts +0 -65
- package/esm/rules/number/number-rules.d.ts.map +0 -1
- package/esm/rules/number/number-rules.js +0 -234
- package/esm/rules/number/number-rules.js.map +0 -1
- package/esm/rules/scalar/accepted-rule.d.ts +0 -39
- package/esm/rules/scalar/accepted-rule.d.ts.map +0 -1
- package/esm/rules/scalar/accepted-rule.js +0 -110
- package/esm/rules/scalar/accepted-rule.js.map +0 -1
- package/esm/rules/scalar/declined-rule.d.ts +0 -39
- package/esm/rules/scalar/declined-rule.d.ts.map +0 -1
- package/esm/rules/scalar/declined-rule.js +0 -110
- package/esm/rules/scalar/declined-rule.js.map +0 -1
- package/esm/rules/scalar/index.d.ts +0 -3
- package/esm/rules/scalar/index.d.ts.map +0 -1
- package/esm/rules/string/alpha.d.ts +0 -14
- package/esm/rules/string/alpha.d.ts.map +0 -1
- package/esm/rules/string/alpha.js +0 -39
- package/esm/rules/string/alpha.js.map +0 -1
- package/esm/rules/string/credit-card.d.ts +0 -6
- package/esm/rules/string/credit-card.d.ts.map +0 -1
- package/esm/rules/string/credit-card.js +0 -31
- package/esm/rules/string/credit-card.js.map +0 -1
- package/esm/rules/string/email.d.ts +0 -6
- package/esm/rules/string/email.d.ts.map +0 -1
- package/esm/rules/string/email.js +0 -13
- package/esm/rules/string/email.js.map +0 -1
- package/esm/rules/string/index.d.ts +0 -17
- package/esm/rules/string/index.d.ts.map +0 -1
- package/esm/rules/string/ip.d.ts +0 -14
- package/esm/rules/string/ip.d.ts.map +0 -1
- package/esm/rules/string/ip.js +0 -39
- package/esm/rules/string/ip.js.map +0 -1
- package/esm/rules/string/matches.d.ts +0 -8
- package/esm/rules/string/matches.d.ts.map +0 -1
- package/esm/rules/string/matches.js +0 -14
- package/esm/rules/string/matches.js.map +0 -1
- package/esm/rules/string/pattern.d.ts +0 -8
- package/esm/rules/string/pattern.d.ts.map +0 -1
- package/esm/rules/string/pattern.js +0 -13
- package/esm/rules/string/pattern.js.map +0 -1
- package/esm/rules/string/string-comparison.d.ts +0 -26
- package/esm/rules/string/string-comparison.d.ts.map +0 -1
- package/esm/rules/string/string-comparison.js +0 -52
- package/esm/rules/string/string-comparison.js.map +0 -1
- package/esm/rules/string/strong-password-rule.d.ts +0 -14
- package/esm/rules/string/strong-password-rule.d.ts.map +0 -1
- package/esm/rules/string/strong-password-rule.js +0 -38
- package/esm/rules/string/strong-password-rule.js.map +0 -1
- package/esm/rules/string/url.d.ts +0 -6
- package/esm/rules/string/url.d.ts.map +0 -1
- package/esm/rules/string/url.js +0 -16
- package/esm/rules/string/url.js.map +0 -1
- package/esm/rules/string/without-whitespace.d.ts +0 -6
- package/esm/rules/string/without-whitespace.d.ts.map +0 -1
- package/esm/rules/string/without-whitespace.js +0 -13
- package/esm/rules/string/without-whitespace.js.map +0 -1
- package/esm/types/conditional-types.d.ts +0 -15
- package/esm/types/conditional-types.d.ts.map +0 -1
- package/esm/types/context-types.d.ts +0 -44
- package/esm/types/context-types.d.ts.map +0 -1
- package/esm/types/data-transformer-types.d.ts +0 -25
- package/esm/types/data-transformer-types.d.ts.map +0 -1
- package/esm/types/date-types.d.ts +0 -9
- package/esm/types/date-types.d.ts.map +0 -1
- package/esm/types/date-types.js +0 -12
- package/esm/types/date-types.js.map +0 -1
- package/esm/types/index.d.ts +0 -10
- package/esm/types/index.d.ts.map +0 -1
- package/esm/types/inference-types.d.ts +0 -29
- package/esm/types/inference-types.d.ts.map +0 -1
- package/esm/types/mutator-types.d.ts +0 -27
- package/esm/types/mutator-types.d.ts.map +0 -1
- package/esm/types/result-types.d.ts +0 -19
- package/esm/types/result-types.d.ts.map +0 -1
- package/esm/types/rule-types.d.ts +0 -54
- package/esm/types/rule-types.d.ts.map +0 -1
- package/esm/types/schema-types.d.ts +0 -6
- package/esm/types/schema-types.d.ts.map +0 -1
- package/esm/validators/any-validator.d.ts +0 -7
- package/esm/validators/any-validator.d.ts.map +0 -1
- package/esm/validators/any-validator.js +0 -5
- package/esm/validators/any-validator.js.map +0 -1
- package/esm/validators/array-validator.d.ts +0 -59
- package/esm/validators/array-validator.d.ts.map +0 -1
- package/esm/validators/array-validator.js +0 -134
- package/esm/validators/array-validator.js.map +0 -1
- package/esm/validators/base-validator.d.ts +0 -609
- package/esm/validators/base-validator.d.ts.map +0 -1
- package/esm/validators/base-validator.js +0 -1154
- package/esm/validators/base-validator.js.map +0 -1
- package/esm/validators/boolean-validator.d.ts +0 -47
- package/esm/validators/boolean-validator.d.ts.map +0 -1
- package/esm/validators/boolean-validator.js +0 -54
- package/esm/validators/boolean-validator.js.map +0 -1
- package/esm/validators/date-validator.d.ts +0 -307
- package/esm/validators/date-validator.d.ts.map +0 -1
- package/esm/validators/date-validator.js +0 -645
- package/esm/validators/date-validator.js.map +0 -1
- package/esm/validators/float-validator.d.ts +0 -8
- package/esm/validators/float-validator.d.ts.map +0 -1
- package/esm/validators/float-validator.js +0 -9
- package/esm/validators/float-validator.js.map +0 -1
- package/esm/validators/index.d.ts +0 -24
- package/esm/validators/index.d.ts.map +0 -1
- package/esm/validators/int-validator.d.ts +0 -8
- package/esm/validators/int-validator.d.ts.map +0 -1
- package/esm/validators/int-validator.js +0 -9
- package/esm/validators/int-validator.js.map +0 -1
- package/esm/validators/number-validator.d.ts +0 -113
- package/esm/validators/number-validator.d.ts.map +0 -1
- package/esm/validators/number-validator.js +0 -192
- package/esm/validators/number-validator.js.map +0 -1
- package/esm/validators/numeric-validator.d.ts +0 -15
- package/esm/validators/numeric-validator.d.ts.map +0 -1
- package/esm/validators/numeric-validator.js +0 -18
- package/esm/validators/numeric-validator.js.map +0 -1
- package/esm/validators/object-validator.d.ts +0 -178
- package/esm/validators/object-validator.d.ts.map +0 -1
- package/esm/validators/object-validator.js +0 -356
- package/esm/validators/object-validator.js.map +0 -1
- package/esm/validators/record-validator.d.ts +0 -33
- package/esm/validators/record-validator.d.ts.map +0 -1
- package/esm/validators/record-validator.js +0 -70
- package/esm/validators/record-validator.js.map +0 -1
- package/esm/validators/scalar-validator.d.ts +0 -82
- package/esm/validators/scalar-validator.d.ts.map +0 -1
- package/esm/validators/scalar-validator.js +0 -160
- package/esm/validators/scalar-validator.js.map +0 -1
- package/esm/validators/string-validator.d.ts +0 -191
- package/esm/validators/string-validator.d.ts.map +0 -1
- package/esm/validators/string-validator.js +0 -410
- package/esm/validators/string-validator.js.map +0 -1
- package/esm/validators/tuple-validator.d.ts +0 -34
- package/esm/validators/tuple-validator.d.ts.map +0 -1
- package/esm/validators/tuple-validator.js +0 -79
- package/esm/validators/tuple-validator.js.map +0 -1
- package/esm/validators/union-validator.d.ts +0 -42
- package/esm/validators/union-validator.d.ts.map +0 -1
- package/esm/validators/union-validator.js +0 -44
- package/esm/validators/union-validator.js.map +0 -1
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
'use strict';var supportiveIs=require('@mongez/supportive-is');require('@mongez/reinforcements');var validationHelpers=require('../../helpers/validation-helpers.js');/**
|
|
2
|
-
* String rule - validates string type
|
|
3
|
-
*/
|
|
4
|
-
const stringRule = {
|
|
5
|
-
name: "string",
|
|
6
|
-
defaultErrorMessage: "The :input must be a string",
|
|
7
|
-
async validate(value, context) {
|
|
8
|
-
if (typeof value === "string") {
|
|
9
|
-
return validationHelpers.VALID_RULE;
|
|
10
|
-
}
|
|
11
|
-
return validationHelpers.invalidRule(this, context);
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Number rule - validates number type
|
|
16
|
-
*/
|
|
17
|
-
const numberRule = {
|
|
18
|
-
name: "number",
|
|
19
|
-
defaultErrorMessage: "The :input must be a number",
|
|
20
|
-
async validate(value, context) {
|
|
21
|
-
if (typeof value === "number") {
|
|
22
|
-
return validationHelpers.VALID_RULE;
|
|
23
|
-
}
|
|
24
|
-
return validationHelpers.invalidRule(this, context);
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Boolean rule - validates boolean type
|
|
29
|
-
*/
|
|
30
|
-
const booleanRule = {
|
|
31
|
-
name: "boolean",
|
|
32
|
-
defaultErrorMessage: "The :input must be a boolean",
|
|
33
|
-
async validate(value, context) {
|
|
34
|
-
if (typeof value === "boolean") {
|
|
35
|
-
return validationHelpers.VALID_RULE;
|
|
36
|
-
}
|
|
37
|
-
return validationHelpers.invalidRule(this, context);
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Int rule - validates integer type
|
|
42
|
-
*/
|
|
43
|
-
const intRule = {
|
|
44
|
-
name: "int",
|
|
45
|
-
defaultErrorMessage: "The :input must be an integer",
|
|
46
|
-
async validate(value, context) {
|
|
47
|
-
if (Number.isInteger(value)) {
|
|
48
|
-
return validationHelpers.VALID_RULE;
|
|
49
|
-
}
|
|
50
|
-
return validationHelpers.invalidRule(this, context);
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Float rule - validates float type
|
|
55
|
-
*/
|
|
56
|
-
const floatRule = {
|
|
57
|
-
name: "float",
|
|
58
|
-
defaultErrorMessage: "The :input must be a float",
|
|
59
|
-
async validate(value, context) {
|
|
60
|
-
if (Number.isFinite(value) && !Number.isInteger(value)) {
|
|
61
|
-
return validationHelpers.VALID_RULE;
|
|
62
|
-
}
|
|
63
|
-
return validationHelpers.invalidRule(this, context);
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Scalar rule - validates scalar value (string, number, or boolean)
|
|
68
|
-
*/
|
|
69
|
-
const scalarRule = {
|
|
70
|
-
name: "scalar",
|
|
71
|
-
defaultErrorMessage: "The :input must be a scalar value",
|
|
72
|
-
async validate(value, context) {
|
|
73
|
-
if (["string", "number", "boolean"].includes(typeof value)) {
|
|
74
|
-
return validationHelpers.VALID_RULE;
|
|
75
|
-
}
|
|
76
|
-
return validationHelpers.invalidRule(this, context);
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Object rule - validates object type
|
|
81
|
-
*/
|
|
82
|
-
const objectRule = {
|
|
83
|
-
name: "object",
|
|
84
|
-
defaultErrorMessage: "The :input must be an object",
|
|
85
|
-
async validate(value, context) {
|
|
86
|
-
if (supportiveIs.isPlainObject(value)) {
|
|
87
|
-
return validationHelpers.VALID_RULE;
|
|
88
|
-
}
|
|
89
|
-
return validationHelpers.invalidRule(this, context);
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Array rule - validates array type
|
|
94
|
-
*/
|
|
95
|
-
const arrayRule = {
|
|
96
|
-
name: "array",
|
|
97
|
-
defaultErrorMessage: "The :input must be an array",
|
|
98
|
-
async validate(value, context) {
|
|
99
|
-
if (Array.isArray(value)) {
|
|
100
|
-
return validationHelpers.VALID_RULE;
|
|
101
|
-
}
|
|
102
|
-
return validationHelpers.invalidRule(this, context);
|
|
103
|
-
},
|
|
104
|
-
};exports.arrayRule=arrayRule;exports.booleanRule=booleanRule;exports.floatRule=floatRule;exports.intRule=intRule;exports.numberRule=numberRule;exports.objectRule=objectRule;exports.scalarRule=scalarRule;exports.stringRule=stringRule;//# sourceMappingURL=type-rules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-rules.js","sources":["../../../src/rules/common/type-rules.ts"],"sourcesContent":[null],"names":["VALID_RULE","invalidRule","isPlainObject"],"mappings":"sKAIA;;AAEG;AACU,MAAA,UAAU,GAAe;AACpC,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,mBAAmB,EAAE,6BAA6B;AA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AAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACxB,YAAA,OAAOD,4BAAU,CAAC;AACnB,SAAA;AACD,QAAA,OAAOC,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Schema, SchemaRule } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Unknown key rule - validates that object doesn't have unknown keys
|
|
4
|
-
*/
|
|
5
|
-
export declare const unknownKeyRule: SchemaRule<{
|
|
6
|
-
schema: Schema;
|
|
7
|
-
allowedKeys: string[];
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=unknown-key.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unknown-key.d.ts","sourceRoot":"","sources":["../../../src/rules/common/unknown-key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAqBA,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';require('@mongez/reinforcements');var validationHelpers=require('../../helpers/validation-helpers.js');/**
|
|
2
|
-
* Unknown key rule - validates that object doesn't have unknown keys
|
|
3
|
-
*/
|
|
4
|
-
const unknownKeyRule = {
|
|
5
|
-
name: "unknownKeys",
|
|
6
|
-
defaultErrorMessage: "The :input contains unknown keys: :unknownKeys",
|
|
7
|
-
async validate(value, context) {
|
|
8
|
-
const schema = this.context.options.schema;
|
|
9
|
-
const allowedKeys = [
|
|
10
|
-
...Object.keys(schema),
|
|
11
|
-
...(this.context.options.allowedKeys || []),
|
|
12
|
-
];
|
|
13
|
-
const unknownKeys = Object.keys(value).filter(key => !allowedKeys.includes(key));
|
|
14
|
-
if (unknownKeys.length > 0) {
|
|
15
|
-
this.context.options.unknownKeys = unknownKeys.join(", ");
|
|
16
|
-
return validationHelpers.invalidRule(this, context);
|
|
17
|
-
}
|
|
18
|
-
return validationHelpers.VALID_RULE;
|
|
19
|
-
},
|
|
20
|
-
};exports.unknownKeyRule=unknownKeyRule;//# sourceMappingURL=unknown-key.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unknown-key.js","sources":["../../../src/rules/common/unknown-key.ts"],"sourcesContent":[null],"names":["invalidRule","VALID_RULE"],"mappings":"oHAGA;;AAEG;AACU,MAAA,cAAc,GAGtB;AACH,IAAA,IAAI,EAAE,aAAa;AACnB,IAAA,mBAAmB,EAAE,gDAAgD;AACrE,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;AAC3C,QAAA,MAAM,WAAW,GAAG;AAClB,YAAA,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;YACtB,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE;SAC3C,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAC3C,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAClC,CAAC;AAEF,QAAA,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AACzB,YAAA,IAAI,CAAC,OAAO,CAAC,OAAe,CAAC,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnE,YAAA,OAAOA,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,OAAOC,4BAAU,CAAC;KACnB;"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { SchemaRule } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Forbidden if rule - field is forbidden if another field equals a specific value
|
|
4
|
-
* Supports both global and sibling scope
|
|
5
|
-
*/
|
|
6
|
-
export declare const forbiddenIfRule: SchemaRule<{
|
|
7
|
-
field: string;
|
|
8
|
-
value: any;
|
|
9
|
-
scope?: "global" | "sibling";
|
|
10
|
-
}>;
|
|
11
|
-
/**
|
|
12
|
-
* Forbidden if not rule - field is forbidden if another field does NOT equal a specific value
|
|
13
|
-
* Supports both global and sibling scope
|
|
14
|
-
*/
|
|
15
|
-
export declare const forbiddenIfNotRule: SchemaRule<{
|
|
16
|
-
field: string;
|
|
17
|
-
value: any;
|
|
18
|
-
scope?: "global" | "sibling";
|
|
19
|
-
}>;
|
|
20
|
-
/**
|
|
21
|
-
* Forbidden if empty rule - field is forbidden if another field is empty
|
|
22
|
-
* Supports both global and sibling scope
|
|
23
|
-
*/
|
|
24
|
-
export declare const forbiddenIfEmptyRule: SchemaRule<{
|
|
25
|
-
field: string;
|
|
26
|
-
scope?: "global" | "sibling";
|
|
27
|
-
}>;
|
|
28
|
-
/**
|
|
29
|
-
* Forbidden if not empty rule - field is forbidden if another field is not empty
|
|
30
|
-
* Supports both global and sibling scope
|
|
31
|
-
*/
|
|
32
|
-
export declare const forbiddenIfNotEmptyRule: SchemaRule<{
|
|
33
|
-
field: string;
|
|
34
|
-
scope?: "global" | "sibling";
|
|
35
|
-
}>;
|
|
36
|
-
/**
|
|
37
|
-
* Forbidden if in rule - field is forbidden if another field's value is in the given array
|
|
38
|
-
* Supports both global and sibling scope
|
|
39
|
-
*/
|
|
40
|
-
export declare const forbiddenIfInRule: SchemaRule<{
|
|
41
|
-
field: string;
|
|
42
|
-
values: any[];
|
|
43
|
-
scope?: "global" | "sibling";
|
|
44
|
-
}>;
|
|
45
|
-
/**
|
|
46
|
-
* Forbidden if not in rule - field is forbidden if another field's value is NOT in the given array
|
|
47
|
-
* Supports both global and sibling scope
|
|
48
|
-
*/
|
|
49
|
-
export declare const forbiddenIfNotInRule: SchemaRule<{
|
|
50
|
-
field: string;
|
|
51
|
-
values: any[];
|
|
52
|
-
scope?: "global" | "sibling";
|
|
53
|
-
}>;
|
|
54
|
-
//# sourceMappingURL=forbidden-if-rules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden-if-rules.d.ts","sourceRoot":"","sources":["../../../src/rules/conditional/forbidden-if-rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAiBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAiBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAAU,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAeA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,UAAU,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAeA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAAU,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAiBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAAU,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAiBA,CAAC"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
'use strict';var supportiveIs=require('@mongez/supportive-is'),getFieldValue=require('../../helpers/get-field-value.js'),validationHelpers=require('../../helpers/validation-helpers.js');/**
|
|
2
|
-
* Forbidden if rule - field is forbidden if another field equals a specific value
|
|
3
|
-
* Supports both global and sibling scope
|
|
4
|
-
*/
|
|
5
|
-
const forbiddenIfRule = {
|
|
6
|
-
name: "forbiddenIf",
|
|
7
|
-
description: "The field is forbidden if another field equals a specific value",
|
|
8
|
-
sortOrder: -2,
|
|
9
|
-
defaultErrorMessage: "The :input is forbidden",
|
|
10
|
-
async validate(value, context) {
|
|
11
|
-
const { value: expectedValue } = this.context.options;
|
|
12
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
13
|
-
// Field is forbidden if it has a value and the other field equals the expected value
|
|
14
|
-
if (!supportiveIs.isEmpty(value) && fieldValue === expectedValue) {
|
|
15
|
-
return validationHelpers.invalidRule(this, context);
|
|
16
|
-
}
|
|
17
|
-
return validationHelpers.VALID_RULE;
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Forbidden if not rule - field is forbidden if another field does NOT equal a specific value
|
|
22
|
-
* Supports both global and sibling scope
|
|
23
|
-
*/
|
|
24
|
-
const forbiddenIfNotRule = {
|
|
25
|
-
name: "forbiddenIfNot",
|
|
26
|
-
description: "The field is forbidden if another field does NOT equal a specific value",
|
|
27
|
-
sortOrder: -2,
|
|
28
|
-
defaultErrorMessage: "The :input is forbidden",
|
|
29
|
-
async validate(value, context) {
|
|
30
|
-
const { value: expectedValue } = this.context.options;
|
|
31
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
32
|
-
// Field is forbidden if it has a value and the other field does NOT equal the expected value
|
|
33
|
-
if (!supportiveIs.isEmpty(value) && fieldValue !== expectedValue) {
|
|
34
|
-
return validationHelpers.invalidRule(this, context);
|
|
35
|
-
}
|
|
36
|
-
return validationHelpers.VALID_RULE;
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Forbidden if empty rule - field is forbidden if another field is empty
|
|
41
|
-
* Supports both global and sibling scope
|
|
42
|
-
*/
|
|
43
|
-
const forbiddenIfEmptyRule = {
|
|
44
|
-
name: "forbiddenIfEmpty",
|
|
45
|
-
description: "The field is forbidden if another field is empty",
|
|
46
|
-
sortOrder: -2,
|
|
47
|
-
defaultErrorMessage: "The :input is forbidden",
|
|
48
|
-
async validate(value, context) {
|
|
49
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
50
|
-
// Field is forbidden if it has a value and the other field is empty
|
|
51
|
-
if (!supportiveIs.isEmpty(value) && supportiveIs.isEmpty(fieldValue)) {
|
|
52
|
-
return validationHelpers.invalidRule(this, context);
|
|
53
|
-
}
|
|
54
|
-
return validationHelpers.VALID_RULE;
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Forbidden if not empty rule - field is forbidden if another field is not empty
|
|
59
|
-
* Supports both global and sibling scope
|
|
60
|
-
*/
|
|
61
|
-
const forbiddenIfNotEmptyRule = {
|
|
62
|
-
name: "forbiddenIfNotEmpty",
|
|
63
|
-
description: "The field is forbidden if another field is not empty",
|
|
64
|
-
sortOrder: -2,
|
|
65
|
-
defaultErrorMessage: "The :input is forbidden",
|
|
66
|
-
async validate(value, context) {
|
|
67
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
68
|
-
// Field is forbidden if it has a value and the other field is not empty
|
|
69
|
-
if (!supportiveIs.isEmpty(value) && !supportiveIs.isEmpty(fieldValue)) {
|
|
70
|
-
return validationHelpers.invalidRule(this, context);
|
|
71
|
-
}
|
|
72
|
-
return validationHelpers.VALID_RULE;
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Forbidden if in rule - field is forbidden if another field's value is in the given array
|
|
77
|
-
* Supports both global and sibling scope
|
|
78
|
-
*/
|
|
79
|
-
const forbiddenIfInRule = {
|
|
80
|
-
name: "forbiddenIfIn",
|
|
81
|
-
description: "The field is forbidden if another field's value is in the given array",
|
|
82
|
-
sortOrder: -2,
|
|
83
|
-
defaultErrorMessage: "The :input is forbidden",
|
|
84
|
-
async validate(value, context) {
|
|
85
|
-
const { values } = this.context.options;
|
|
86
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
87
|
-
// Field is forbidden if it has a value and the other field's value is in the array
|
|
88
|
-
if (!supportiveIs.isEmpty(value) && values.includes(fieldValue)) {
|
|
89
|
-
return validationHelpers.invalidRule(this, context);
|
|
90
|
-
}
|
|
91
|
-
return validationHelpers.VALID_RULE;
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Forbidden if not in rule - field is forbidden if another field's value is NOT in the given array
|
|
96
|
-
* Supports both global and sibling scope
|
|
97
|
-
*/
|
|
98
|
-
const forbiddenIfNotInRule = {
|
|
99
|
-
name: "forbiddenIfNotIn",
|
|
100
|
-
description: "The field is forbidden if another field's value is NOT in the given array",
|
|
101
|
-
sortOrder: -2,
|
|
102
|
-
defaultErrorMessage: "The :input is forbidden",
|
|
103
|
-
async validate(value, context) {
|
|
104
|
-
const { values } = this.context.options;
|
|
105
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
106
|
-
// Field is forbidden if it has a value and the other field's value is NOT in the array
|
|
107
|
-
if (!supportiveIs.isEmpty(value) && !values.includes(fieldValue)) {
|
|
108
|
-
return validationHelpers.invalidRule(this, context);
|
|
109
|
-
}
|
|
110
|
-
return validationHelpers.VALID_RULE;
|
|
111
|
-
},
|
|
112
|
-
};exports.forbiddenIfEmptyRule=forbiddenIfEmptyRule;exports.forbiddenIfInRule=forbiddenIfInRule;exports.forbiddenIfNotEmptyRule=forbiddenIfNotEmptyRule;exports.forbiddenIfNotInRule=forbiddenIfNotInRule;exports.forbiddenIfNotRule=forbiddenIfNotRule;exports.forbiddenIfRule=forbiddenIfRule;//# sourceMappingURL=forbidden-if-rules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden-if-rules.js","sources":["../../../src/rules/conditional/forbidden-if-rules.ts"],"sourcesContent":[null],"names":["getFieldValue","isEmpty","invalidRule","VALID_RULE"],"mappings":"0LAIA;;;AAGG;AACU,MAAA,eAAe,GAIvB;AACH,IAAA,IAAI,EAAE,aAAa;AACnB,IAAA,WAAW,EACT,iEAAiE;IACnE,SAAS,EAAE,CAAC,CAAC;AACb,IAAA,mBAAmB,EAAE,yBAAyB;AAC9C,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACtD,MAAM,UAAU,GAAGA,2BAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;;QAGhD,IAAI,CAACC,oBAAO,CAAC,KAAK,CAAC,IAAI,UAAU,KAAK,aAAa,EAAE;AACnD,YAAA,OAAOC,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,OAAOC,4BAAU,CAAC;KACnB;EACD;AAEF;;;AAGG;AACU,MAAA,kBAAkB,GAI1B;AACH,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,WAAW,EACT,yEAAyE;IAC3E,SAAS,EAAE,CAAC,CAAC;AACb,IAAA,mBAAmB,EAAE,yBAAyB;AAC9C,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACtD,MAAM,UAAU,GAAGH,2BA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
export * from "./required-unless-rules";
|
|
3
|
-
export * from "./required-with-rules";
|
|
4
|
-
export * from "./required-without-rules";
|
|
5
|
-
export * from "./present-if-rules";
|
|
6
|
-
export * from "./present-unless-rules";
|
|
7
|
-
export * from "./present-with-rules";
|
|
8
|
-
export * from "./present-without-rules";
|
|
9
|
-
export * from "./forbidden-if-rules";
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/conditional/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { SchemaRule } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Present if rule - field must be present if another field equals a specific value
|
|
4
|
-
* Supports both global and sibling scope
|
|
5
|
-
*/
|
|
6
|
-
export declare const presentIfRule: SchemaRule<{
|
|
7
|
-
field: string;
|
|
8
|
-
value: any;
|
|
9
|
-
scope?: "global" | "sibling";
|
|
10
|
-
}>;
|
|
11
|
-
/**
|
|
12
|
-
* Present if empty rule - field must be present if another field is empty
|
|
13
|
-
* Supports both global and sibling scope
|
|
14
|
-
*/
|
|
15
|
-
export declare const presentIfEmptyRule: SchemaRule<{
|
|
16
|
-
field: string;
|
|
17
|
-
scope?: "global" | "sibling";
|
|
18
|
-
}>;
|
|
19
|
-
/**
|
|
20
|
-
* Present if not empty rule - field must be present if another field is not empty
|
|
21
|
-
* Supports both global and sibling scope
|
|
22
|
-
*/
|
|
23
|
-
export declare const presentIfNotEmptyRule: SchemaRule<{
|
|
24
|
-
field: string;
|
|
25
|
-
scope?: "global" | "sibling";
|
|
26
|
-
}>;
|
|
27
|
-
/**
|
|
28
|
-
* Present if in rule - field must be present if another field's value is in the given array
|
|
29
|
-
* Supports both global and sibling scope
|
|
30
|
-
*/
|
|
31
|
-
export declare const presentIfInRule: SchemaRule<{
|
|
32
|
-
field: string;
|
|
33
|
-
values: any[];
|
|
34
|
-
scope?: "global" | "sibling";
|
|
35
|
-
}>;
|
|
36
|
-
/**
|
|
37
|
-
* Present if not in rule - field must be present if another field's value is NOT in the given array
|
|
38
|
-
* Supports both global and sibling scope
|
|
39
|
-
*/
|
|
40
|
-
export declare const presentIfNotInRule: SchemaRule<{
|
|
41
|
-
field: string;
|
|
42
|
-
values: any[];
|
|
43
|
-
scope?: "global" | "sibling";
|
|
44
|
-
}>;
|
|
45
|
-
//# sourceMappingURL=present-if-rules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"present-if-rules.d.ts","sourceRoot":"","sources":["../../../src/rules/conditional/present-if-rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAkBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAgBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,UAAU,CAAC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAgBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAkBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAkBA,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
'use strict';var supportiveIs=require('@mongez/supportive-is'),getFieldValue=require('../../helpers/get-field-value.js'),validationHelpers=require('../../helpers/validation-helpers.js');/**
|
|
2
|
-
* Present if rule - field must be present if another field equals a specific value
|
|
3
|
-
* Supports both global and sibling scope
|
|
4
|
-
*/
|
|
5
|
-
const presentIfRule = {
|
|
6
|
-
name: "presentIf",
|
|
7
|
-
description: "The field must be present if another field equals a specific value",
|
|
8
|
-
sortOrder: -2,
|
|
9
|
-
requiresValue: false,
|
|
10
|
-
defaultErrorMessage: "The :input field must be present",
|
|
11
|
-
async validate(value, context) {
|
|
12
|
-
const { value: expectedValue } = this.context.options;
|
|
13
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
14
|
-
// Field must be present if the other field equals the expected value
|
|
15
|
-
if (value === undefined && fieldValue === expectedValue) {
|
|
16
|
-
return validationHelpers.invalidRule(this, context);
|
|
17
|
-
}
|
|
18
|
-
return validationHelpers.VALID_RULE;
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Present if empty rule - field must be present if another field is empty
|
|
23
|
-
* Supports both global and sibling scope
|
|
24
|
-
*/
|
|
25
|
-
const presentIfEmptyRule = {
|
|
26
|
-
name: "presentIfEmpty",
|
|
27
|
-
description: "The field must be present if another field is empty",
|
|
28
|
-
sortOrder: -2,
|
|
29
|
-
requiresValue: false,
|
|
30
|
-
defaultErrorMessage: "The :input field must be present",
|
|
31
|
-
async validate(value, context) {
|
|
32
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
33
|
-
// Field must be present if the other field is empty
|
|
34
|
-
if (value === undefined && supportiveIs.isEmpty(fieldValue)) {
|
|
35
|
-
return validationHelpers.invalidRule(this, context);
|
|
36
|
-
}
|
|
37
|
-
return validationHelpers.VALID_RULE;
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Present if not empty rule - field must be present if another field is not empty
|
|
42
|
-
* Supports both global and sibling scope
|
|
43
|
-
*/
|
|
44
|
-
const presentIfNotEmptyRule = {
|
|
45
|
-
name: "presentIfNotEmpty",
|
|
46
|
-
description: "The field must be present if another field is not empty",
|
|
47
|
-
sortOrder: -2,
|
|
48
|
-
requiresValue: false,
|
|
49
|
-
defaultErrorMessage: "The :input field must be present",
|
|
50
|
-
async validate(value, context) {
|
|
51
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
52
|
-
// Field must be present if the other field is not empty
|
|
53
|
-
if (value === undefined && !supportiveIs.isEmpty(fieldValue)) {
|
|
54
|
-
return validationHelpers.invalidRule(this, context);
|
|
55
|
-
}
|
|
56
|
-
return validationHelpers.VALID_RULE;
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Present if in rule - field must be present if another field's value is in the given array
|
|
61
|
-
* Supports both global and sibling scope
|
|
62
|
-
*/
|
|
63
|
-
const presentIfInRule = {
|
|
64
|
-
name: "presentIfIn",
|
|
65
|
-
description: "The field must be present if another field's value is in the given array",
|
|
66
|
-
sortOrder: -2,
|
|
67
|
-
requiresValue: false,
|
|
68
|
-
defaultErrorMessage: "The :input field must be present",
|
|
69
|
-
async validate(value, context) {
|
|
70
|
-
const { values } = this.context.options;
|
|
71
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
72
|
-
// Field must be present if the other field's value is in the array
|
|
73
|
-
if (value === undefined && values.includes(fieldValue)) {
|
|
74
|
-
return validationHelpers.invalidRule(this, context);
|
|
75
|
-
}
|
|
76
|
-
return validationHelpers.VALID_RULE;
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Present if not in rule - field must be present if another field's value is NOT in the given array
|
|
81
|
-
* Supports both global and sibling scope
|
|
82
|
-
*/
|
|
83
|
-
const presentIfNotInRule = {
|
|
84
|
-
name: "presentIfNotIn",
|
|
85
|
-
description: "The field must be present if another field's value is NOT in the given array",
|
|
86
|
-
sortOrder: -2,
|
|
87
|
-
requiresValue: false,
|
|
88
|
-
defaultErrorMessage: "The :input field must be present",
|
|
89
|
-
async validate(value, context) {
|
|
90
|
-
const { values } = this.context.options;
|
|
91
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
92
|
-
// Field must be present if the other field's value is NOT in the array
|
|
93
|
-
if (value === undefined && !values.includes(fieldValue)) {
|
|
94
|
-
return validationHelpers.invalidRule(this, context);
|
|
95
|
-
}
|
|
96
|
-
return validationHelpers.VALID_RULE;
|
|
97
|
-
},
|
|
98
|
-
};exports.presentIfEmptyRule=presentIfEmptyRule;exports.presentIfInRule=presentIfInRule;exports.presentIfNotEmptyRule=presentIfNotEmptyRule;exports.presentIfNotInRule=presentIfNotInRule;exports.presentIfRule=presentIfRule;//# sourceMappingURL=present-if-rules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"present-if-rules.js","sources":["../../../src/rules/conditional/present-if-rules.ts"],"sourcesContent":[null],"names":["getFieldValue","invalidRule","VALID_RULE","isEmpty"],"mappings":"0LAIA;;;AAGG;AACU,MAAA,aAAa,GAIrB;AACH,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,WAAW,EACT,oEAAoE;IACtE,SAAS,EAAE,CAAC,CAAC;AACb,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,mBAAmB,EAAE,kCAAkC;AACvD,IAAA,M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,CAAC,EAAE;AACvD,YAAA,OAAOC,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,OAAOC,4BAAU,CAAC;KACnB;"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SchemaRule } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Present unless rule - field must be present unless another field equals a specific value
|
|
4
|
-
* Supports both global and sibling scope
|
|
5
|
-
*/
|
|
6
|
-
export declare const presentUnlessRule: SchemaRule<{
|
|
7
|
-
field: string;
|
|
8
|
-
value: any;
|
|
9
|
-
scope?: "global" | "sibling";
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=present-unless-rules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"present-unless-rules.d.ts","sourceRoot":"","sources":["../../../src/rules/conditional/present-unless-rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAAU,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAkBA,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';var getFieldValue=require('../../helpers/get-field-value.js'),validationHelpers=require('../../helpers/validation-helpers.js');/**
|
|
2
|
-
* Present unless rule - field must be present unless another field equals a specific value
|
|
3
|
-
* Supports both global and sibling scope
|
|
4
|
-
*/
|
|
5
|
-
const presentUnlessRule = {
|
|
6
|
-
name: "presentUnless",
|
|
7
|
-
description: "The field must be present unless another field equals a specific value",
|
|
8
|
-
sortOrder: -2,
|
|
9
|
-
requiresValue: false,
|
|
10
|
-
defaultErrorMessage: "The :input field must be present",
|
|
11
|
-
async validate(value, context) {
|
|
12
|
-
const { value: expectedValue } = this.context.options;
|
|
13
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
14
|
-
// Field must be present unless the other field equals the expected value
|
|
15
|
-
if (value === undefined && fieldValue !== expectedValue) {
|
|
16
|
-
return validationHelpers.invalidRule(this, context);
|
|
17
|
-
}
|
|
18
|
-
return validationHelpers.VALID_RULE;
|
|
19
|
-
},
|
|
20
|
-
};exports.presentUnlessRule=presentUnlessRule;//# sourceMappingURL=present-unless-rules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"present-unless-rules.js","sources":["../../../src/rules/conditional/present-unless-rules.ts"],"sourcesContent":[null],"names":["getFieldValue","invalidRule","VALID_RULE"],"mappings":"4IAGA;;;AAGG;AACU,MAAA,iBAAiB,GAIzB;AACH,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,WAAW,EACT,wEAAwE;IAC1E,SAAS,EAAE,CAAC,CAAC;AACb,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,mBAAmB,EAAE,kCAAkC;AACvD,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACtD,MAAM,UAAU,GAAGA,2BAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;;AAGhD,QAAA,IAAI,KAAK,KAAK,SAAS,IAAI,UAAU,KAAK,aAAa,EAAE;AACvD,YAAA,OAAOC,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,OAAOC,4BAAU,CAAC;KACnB;"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { SchemaRule } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Present with rule - field must be present if another field is present
|
|
4
|
-
* Supports both global and sibling scope
|
|
5
|
-
*/
|
|
6
|
-
export declare const presentWithRule: SchemaRule<{
|
|
7
|
-
field: string;
|
|
8
|
-
scope?: "global" | "sibling";
|
|
9
|
-
}>;
|
|
10
|
-
/**
|
|
11
|
-
* Present with all rule - field must be present if all specified fields are present
|
|
12
|
-
* Supports both global and sibling scope
|
|
13
|
-
*/
|
|
14
|
-
export declare const presentWithAllRule: SchemaRule<{
|
|
15
|
-
fields: string[];
|
|
16
|
-
scope?: "global" | "sibling";
|
|
17
|
-
}>;
|
|
18
|
-
/**
|
|
19
|
-
* Present with any rule - field must be present if any of the specified fields is present
|
|
20
|
-
* Supports both global and sibling scope
|
|
21
|
-
*/
|
|
22
|
-
export declare const presentWithAnyRule: SchemaRule<{
|
|
23
|
-
fields: string[];
|
|
24
|
-
scope?: "global" | "sibling";
|
|
25
|
-
}>;
|
|
26
|
-
//# sourceMappingURL=present-with-rules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"present-with-rules.d.ts","sourceRoot":"","sources":["../../../src/rules/conditional/present-with-rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAgBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC;IAC1C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAoBA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC;IAC1C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAqBA,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use strict';var reinforcements=require('@mongez/reinforcements'),getFieldValue=require('../../helpers/get-field-value.js'),validationHelpers=require('../../helpers/validation-helpers.js');/**
|
|
2
|
-
* Present with rule - field must be present if another field is present
|
|
3
|
-
* Supports both global and sibling scope
|
|
4
|
-
*/
|
|
5
|
-
const presentWithRule = {
|
|
6
|
-
name: "presentWith",
|
|
7
|
-
description: "The field must be present if another field is present",
|
|
8
|
-
sortOrder: -2,
|
|
9
|
-
requiresValue: false,
|
|
10
|
-
defaultErrorMessage: "The :input field must be present",
|
|
11
|
-
async validate(value, context) {
|
|
12
|
-
const fieldValue = getFieldValue.getFieldValue(this, context);
|
|
13
|
-
// The field must be present if the other field is present
|
|
14
|
-
if (value === undefined && fieldValue !== undefined) {
|
|
15
|
-
return validationHelpers.invalidRule(this, context);
|
|
16
|
-
}
|
|
17
|
-
return validationHelpers.VALID_RULE;
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Present with all rule - field must be present if all specified fields are present
|
|
22
|
-
* Supports both global and sibling scope
|
|
23
|
-
*/
|
|
24
|
-
const presentWithAllRule = {
|
|
25
|
-
name: "presentWithAll",
|
|
26
|
-
description: "The field must be present if all specified fields are present",
|
|
27
|
-
sortOrder: -2,
|
|
28
|
-
requiresValue: false,
|
|
29
|
-
defaultErrorMessage: "The :input field must be present",
|
|
30
|
-
async validate(value, context) {
|
|
31
|
-
const { fields, scope = "global" } = this.context.options;
|
|
32
|
-
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
33
|
-
// Check if all fields are present
|
|
34
|
-
const allPresent = fields.every(field => reinforcements.get(source, field) !== undefined);
|
|
35
|
-
// Field must be present if all other fields are present
|
|
36
|
-
if (value === undefined && allPresent) {
|
|
37
|
-
return validationHelpers.invalidRule(this, context);
|
|
38
|
-
}
|
|
39
|
-
return validationHelpers.VALID_RULE;
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Present with any rule - field must be present if any of the specified fields is present
|
|
44
|
-
* Supports both global and sibling scope
|
|
45
|
-
*/
|
|
46
|
-
const presentWithAnyRule = {
|
|
47
|
-
name: "presentWithAny",
|
|
48
|
-
description: "The field must be present if any of the specified fields is present",
|
|
49
|
-
sortOrder: -2,
|
|
50
|
-
requiresValue: false,
|
|
51
|
-
defaultErrorMessage: "The :input field must be present",
|
|
52
|
-
async validate(value, context) {
|
|
53
|
-
const { fields, scope = "global" } = this.context.options;
|
|
54
|
-
const source = scope === "sibling" ? context.parent : context.allValues;
|
|
55
|
-
// Check if any field is present
|
|
56
|
-
const anyPresent = fields.some(field => reinforcements.get(source, field) !== undefined);
|
|
57
|
-
// Field must be present if any other field is present
|
|
58
|
-
if (value === undefined && anyPresent) {
|
|
59
|
-
return validationHelpers.invalidRule(this, context);
|
|
60
|
-
}
|
|
61
|
-
return validationHelpers.VALID_RULE;
|
|
62
|
-
},
|
|
63
|
-
};exports.presentWithAllRule=presentWithAllRule;exports.presentWithAnyRule=presentWithAnyRule;exports.presentWithRule=presentWithRule;//# sourceMappingURL=present-with-rules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"present-with-rules.js","sources":["../../../src/rules/conditional/present-with-rules.ts"],"sourcesContent":[null],"names":["getFieldValue","invalidRule","VALID_RULE","get"],"mappings":"6LAIA;;;AAGG;AACU,MAAA,eAAe,GAGvB;AACH,IAAA,IAAI,EAAE,aAAa;AACnB,IAAA,WAAW,EAAE,uDAAuD;IACpE,SAAS,EAAE,CAAC,CAAC;AACb,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,mBAAmB,EAAE,kCAAkC;AACvD,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,MAAM,UAAU,GAAGA,2BAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;;AAGhD,QAAA,IAAI,KAAK,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS,EAAE;AACnD,YAAA,OAAOC,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,O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