@warlock.js/seal 5.28.0 → 5.30.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 +34 -0
- package/README.md +2 -0
- package/cjs/index.cjs +37 -30
- package/cjs/index.cjs.map +1 -1
- package/cjs/{object-DubGC-xu.cjs → object--LXRt5RF.cjs} +10 -8
- package/cjs/object--LXRt5RF.cjs.map +1 -0
- package/cjs/object.cjs +2 -2
- package/cjs/{required-methods-BOVNRtci.cjs → required-methods-DYsRO9aZ.cjs} +97 -68
- package/cjs/required-methods-DYsRO9aZ.cjs.map +1 -0
- package/cjs/{string-DpDpgefH.cjs → string-DsqnKoSB.cjs} +6 -6
- package/cjs/string-DsqnKoSB.cjs.map +1 -0
- package/cjs/string.cjs +2 -2
- package/esm/config.d.mts +2 -1
- package/esm/config.d.mts.map +1 -1
- package/esm/config.mjs +1 -1
- package/esm/config.mjs.map +1 -1
- package/esm/factory/validate.d.mts +9 -6
- package/esm/factory/validate.d.mts.map +1 -1
- package/esm/factory/validate.mjs +12 -4
- package/esm/factory/validate.mjs.map +1 -1
- package/esm/factory/validators.d.mts +5 -5
- package/esm/factory/validators.d.mts.map +1 -1
- package/esm/factory/validators.mjs +1 -1
- package/esm/factory/validators.mjs.map +1 -1
- package/esm/helpers/date-helpers.d.mts +1 -1
- package/esm/helpers/date-helpers.d.mts.map +1 -1
- package/esm/helpers/date-helpers.mjs +1 -1
- package/esm/helpers/date-helpers.mjs.map +1 -1
- package/esm/helpers/file.utils.d.mts +1 -1
- package/esm/helpers/file.utils.d.mts.map +1 -1
- package/esm/helpers/file.utils.mjs +1 -1
- package/esm/helpers/file.utils.mjs.map +1 -1
- package/esm/helpers/get-field-value.d.mts +2 -1
- package/esm/helpers/get-field-value.d.mts.map +1 -1
- package/esm/helpers/get-field-value.mjs +1 -1
- package/esm/helpers/get-field-value.mjs.map +1 -1
- package/esm/helpers/is-empty-value.mjs +1 -1
- package/esm/helpers/is-empty-value.mjs.map +1 -1
- package/esm/helpers/path-helpers.d.mts +1 -1
- package/esm/helpers/path-helpers.d.mts.map +1 -1
- package/esm/helpers/path-helpers.mjs +1 -1
- package/esm/helpers/path-helpers.mjs.map +1 -1
- package/esm/helpers/validation-helpers.d.mts +2 -1
- package/esm/helpers/validation-helpers.d.mts.map +1 -1
- package/esm/helpers/validation-helpers.mjs +1 -1
- package/esm/helpers/validation-helpers.mjs.map +1 -1
- package/esm/index.d.mts +3 -3
- package/esm/mutators/array-mutators.d.mts +2 -1
- package/esm/mutators/array-mutators.d.mts.map +1 -1
- package/esm/mutators/array-mutators.mjs +1 -1
- package/esm/mutators/array-mutators.mjs.map +1 -1
- package/esm/mutators/boolean-mutators.d.mts +2 -1
- package/esm/mutators/boolean-mutators.d.mts.map +1 -1
- package/esm/mutators/boolean-mutators.mjs +1 -1
- package/esm/mutators/boolean-mutators.mjs.map +1 -1
- package/esm/mutators/date-mutators.d.mts +2 -1
- package/esm/mutators/date-mutators.d.mts.map +1 -1
- package/esm/mutators/date-mutators.mjs +1 -1
- package/esm/mutators/date-mutators.mjs.map +1 -1
- package/esm/mutators/number-mutators.d.mts +2 -1
- package/esm/mutators/number-mutators.d.mts.map +1 -1
- package/esm/mutators/number-mutators.mjs +1 -1
- package/esm/mutators/number-mutators.mjs.map +1 -1
- package/esm/mutators/object-mutators.d.mts +2 -1
- package/esm/mutators/object-mutators.d.mts.map +1 -1
- package/esm/mutators/object-mutators.mjs +1 -1
- package/esm/mutators/object-mutators.mjs.map +1 -1
- package/esm/mutators/scalar-mutators.d.mts +2 -1
- package/esm/mutators/scalar-mutators.d.mts.map +1 -1
- package/esm/mutators/scalar-mutators.mjs +1 -1
- package/esm/mutators/scalar-mutators.mjs.map +1 -1
- package/esm/mutators/string-mutators.d.mts +2 -1
- package/esm/mutators/string-mutators.d.mts.map +1 -1
- package/esm/mutators/string-mutators.mjs +1 -1
- package/esm/mutators/string-mutators.mjs.map +1 -1
- package/esm/object.d.mts +1 -1
- package/esm/object.d.mts.map +1 -1
- package/esm/object.mjs +1 -1
- package/esm/object.mjs.map +1 -1
- package/esm/plugins/plugin-system.d.mts +1 -1
- package/esm/plugins/plugin-system.d.mts.map +1 -1
- package/esm/plugins/plugin-system.mjs +1 -1
- package/esm/plugins/plugin-system.mjs.map +1 -1
- package/esm/rules/array/array-rules.d.mts +2 -1
- package/esm/rules/array/array-rules.d.mts.map +1 -1
- package/esm/rules/array/array-rules.mjs +1 -1
- package/esm/rules/array/array-rules.mjs.map +1 -1
- package/esm/rules/color/color-rules.d.mts +2 -1
- package/esm/rules/color/color-rules.d.mts.map +1 -1
- package/esm/rules/color/color-rules.mjs +1 -1
- package/esm/rules/color/color-rules.mjs.map +1 -1
- package/esm/rules/common/enum.d.mts +2 -1
- package/esm/rules/common/enum.d.mts.map +1 -1
- package/esm/rules/common/enum.mjs +1 -1
- package/esm/rules/common/enum.mjs.map +1 -1
- package/esm/rules/common/equals-field-rules.d.mts +2 -1
- package/esm/rules/common/equals-field-rules.d.mts.map +1 -1
- package/esm/rules/common/equals-field-rules.mjs +1 -1
- package/esm/rules/common/equals-field-rules.mjs.map +1 -1
- package/esm/rules/common/instanceof.d.mts +2 -1
- package/esm/rules/common/instanceof.d.mts.map +1 -1
- package/esm/rules/common/instanceof.mjs +1 -1
- package/esm/rules/common/instanceof.mjs.map +1 -1
- package/esm/rules/common/literal.d.mts +2 -1
- package/esm/rules/common/literal.d.mts.map +1 -1
- package/esm/rules/common/literal.mjs +1 -1
- package/esm/rules/common/literal.mjs.map +1 -1
- package/esm/rules/common/type-rules.d.mts +2 -1
- package/esm/rules/common/type-rules.d.mts.map +1 -1
- package/esm/rules/common/type-rules.mjs +1 -1
- package/esm/rules/common/type-rules.mjs.map +1 -1
- package/esm/rules/common/unknown-key.d.mts +2 -1
- package/esm/rules/common/unknown-key.d.mts.map +1 -1
- package/esm/rules/common/unknown-key.mjs +1 -1
- package/esm/rules/common/unknown-key.mjs.map +1 -1
- package/esm/rules/conditional/forbidden-if-rules.d.mts +2 -1
- package/esm/rules/conditional/forbidden-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/forbidden-if-rules.mjs +1 -1
- package/esm/rules/conditional/forbidden-if-rules.mjs.map +1 -1
- package/esm/rules/conditional/present-if-rules.d.mts +2 -1
- package/esm/rules/conditional/present-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-if-rules.mjs +1 -1
- package/esm/rules/conditional/present-if-rules.mjs.map +1 -1
- package/esm/rules/conditional/present-unless-rules.d.mts +2 -1
- package/esm/rules/conditional/present-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-unless-rules.mjs +1 -1
- package/esm/rules/conditional/present-unless-rules.mjs.map +1 -1
- package/esm/rules/conditional/present-with-rules.d.mts +2 -1
- package/esm/rules/conditional/present-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-with-rules.mjs +1 -1
- package/esm/rules/conditional/present-with-rules.mjs.map +1 -1
- package/esm/rules/conditional/present-without-rules.d.mts +2 -1
- package/esm/rules/conditional/present-without-rules.d.mts.map +1 -1
- package/esm/rules/conditional/present-without-rules.mjs +1 -1
- package/esm/rules/conditional/present-without-rules.mjs.map +1 -1
- package/esm/rules/conditional/required-if-rules.d.mts +2 -1
- package/esm/rules/conditional/required-if-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-if-rules.mjs +1 -1
- package/esm/rules/conditional/required-if-rules.mjs.map +1 -1
- package/esm/rules/conditional/required-unless-rules.d.mts +2 -1
- package/esm/rules/conditional/required-unless-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-unless-rules.mjs +1 -1
- package/esm/rules/conditional/required-unless-rules.mjs.map +1 -1
- package/esm/rules/conditional/required-when-rule.d.mts +2 -1
- package/esm/rules/conditional/required-when-rule.d.mts.map +1 -1
- package/esm/rules/conditional/required-when-rule.mjs +1 -1
- package/esm/rules/conditional/required-when-rule.mjs.map +1 -1
- package/esm/rules/conditional/required-with-rules.d.mts +2 -1
- package/esm/rules/conditional/required-with-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-with-rules.mjs +1 -1
- package/esm/rules/conditional/required-with-rules.mjs.map +1 -1
- package/esm/rules/conditional/required-without-rules.d.mts +2 -1
- package/esm/rules/conditional/required-without-rules.d.mts.map +1 -1
- package/esm/rules/conditional/required-without-rules.mjs +1 -1
- package/esm/rules/conditional/required-without-rules.mjs.map +1 -1
- package/esm/rules/core/equal.d.mts +2 -1
- package/esm/rules/core/equal.d.mts.map +1 -1
- package/esm/rules/core/equal.mjs +1 -1
- package/esm/rules/core/equal.mjs.map +1 -1
- package/esm/rules/core/forbidden.d.mts +2 -1
- package/esm/rules/core/forbidden.d.mts.map +1 -1
- package/esm/rules/core/forbidden.mjs +1 -1
- package/esm/rules/core/forbidden.mjs.map +1 -1
- package/esm/rules/core/required.d.mts +2 -1
- package/esm/rules/core/required.d.mts.map +1 -1
- package/esm/rules/core/required.mjs +1 -1
- package/esm/rules/core/required.mjs.map +1 -1
- package/esm/rules/core/union.d.mts +1 -1
- package/esm/rules/core/union.d.mts.map +1 -1
- package/esm/rules/core/union.mjs +3 -1
- package/esm/rules/core/union.mjs.map +1 -1
- package/esm/rules/core/when.d.mts +2 -1
- package/esm/rules/core/when.d.mts.map +1 -1
- package/esm/rules/core/when.mjs +1 -1
- package/esm/rules/core/when.mjs.map +1 -1
- package/esm/rules/date/date-comparison-rules.d.mts +2 -1
- package/esm/rules/date/date-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-comparison-rules.mjs +1 -1
- package/esm/rules/date/date-comparison-rules.mjs.map +1 -1
- package/esm/rules/date/date-day-rules.d.mts +2 -1
- package/esm/rules/date/date-day-rules.d.mts.map +1 -1
- package/esm/rules/date/date-day-rules.mjs +1 -1
- package/esm/rules/date/date-day-rules.mjs.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.d.mts +2 -1
- package/esm/rules/date/date-field-comparison-rules.d.mts.map +1 -1
- package/esm/rules/date/date-field-comparison-rules.mjs +1 -1
- package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
- package/esm/rules/date/date-period-rules.d.mts +2 -1
- package/esm/rules/date/date-period-rules.d.mts.map +1 -1
- package/esm/rules/date/date-period-rules.mjs +1 -1
- package/esm/rules/date/date-period-rules.mjs.map +1 -1
- package/esm/rules/date/date-relative-rules.d.mts +2 -1
- package/esm/rules/date/date-relative-rules.d.mts.map +1 -1
- package/esm/rules/date/date-relative-rules.mjs +1 -1
- package/esm/rules/date/date-relative-rules.mjs.map +1 -1
- package/esm/rules/date/date-special-rules.d.mts +2 -1
- package/esm/rules/date/date-special-rules.d.mts.map +1 -1
- package/esm/rules/date/date-special-rules.mjs +1 -1
- package/esm/rules/date/date-special-rules.mjs.map +1 -1
- package/esm/rules/date/date.d.mts +2 -1
- package/esm/rules/date/date.d.mts.map +1 -1
- package/esm/rules/date/date.mjs +1 -1
- package/esm/rules/date/date.mjs.map +1 -1
- package/esm/rules/file/dimensions.d.mts +2 -1
- package/esm/rules/file/dimensions.d.mts.map +1 -1
- package/esm/rules/file/dimensions.mjs +1 -1
- package/esm/rules/file/dimensions.mjs.map +1 -1
- package/esm/rules/file/file-size.d.mts +2 -1
- package/esm/rules/file/file-size.d.mts.map +1 -1
- package/esm/rules/file/file-size.mjs +1 -1
- package/esm/rules/file/file-size.mjs.map +1 -1
- package/esm/rules/length/length-rules.d.mts +2 -1
- package/esm/rules/length/length-rules.d.mts.map +1 -1
- package/esm/rules/length/length-rules.mjs +1 -1
- package/esm/rules/length/length-rules.mjs.map +1 -1
- package/esm/rules/number/number-rules.d.mts +2 -1
- package/esm/rules/number/number-rules.d.mts.map +1 -1
- package/esm/rules/number/number-rules.mjs +1 -1
- package/esm/rules/number/number-rules.mjs.map +1 -1
- package/esm/rules/scalar/accepted-rule.mjs +1 -1
- package/esm/rules/scalar/accepted-rule.mjs.map +1 -1
- package/esm/rules/scalar/declined-rule.mjs +1 -1
- package/esm/rules/scalar/declined-rule.mjs.map +1 -1
- package/esm/rules/string/alpha.d.mts +2 -1
- package/esm/rules/string/alpha.d.mts.map +1 -1
- package/esm/rules/string/alpha.mjs +1 -1
- package/esm/rules/string/alpha.mjs.map +1 -1
- package/esm/rules/string/credit-card.d.mts +2 -1
- package/esm/rules/string/credit-card.d.mts.map +1 -1
- package/esm/rules/string/credit-card.mjs +1 -1
- package/esm/rules/string/credit-card.mjs.map +1 -1
- package/esm/rules/string/email.d.mts +2 -1
- package/esm/rules/string/email.d.mts.map +1 -1
- package/esm/rules/string/email.mjs +1 -1
- package/esm/rules/string/email.mjs.map +1 -1
- package/esm/rules/string/id-formats.d.mts +2 -1
- package/esm/rules/string/id-formats.d.mts.map +1 -1
- package/esm/rules/string/id-formats.mjs +1 -1
- package/esm/rules/string/id-formats.mjs.map +1 -1
- package/esm/rules/string/ip.d.mts +2 -1
- package/esm/rules/string/ip.d.mts.map +1 -1
- package/esm/rules/string/ip.mjs +1 -1
- package/esm/rules/string/ip.mjs.map +1 -1
- package/esm/rules/string/matches.d.mts +2 -1
- package/esm/rules/string/matches.d.mts.map +1 -1
- package/esm/rules/string/matches.mjs +1 -1
- package/esm/rules/string/matches.mjs.map +1 -1
- package/esm/rules/string/pattern.d.mts +2 -1
- package/esm/rules/string/pattern.d.mts.map +1 -1
- package/esm/rules/string/pattern.mjs +1 -1
- package/esm/rules/string/pattern.mjs.map +1 -1
- package/esm/rules/string/string-comparison.d.mts +2 -1
- package/esm/rules/string/string-comparison.d.mts.map +1 -1
- package/esm/rules/string/string-comparison.mjs +1 -1
- package/esm/rules/string/string-comparison.mjs.map +1 -1
- package/esm/rules/string/strong-password-rule.d.mts +2 -1
- package/esm/rules/string/strong-password-rule.d.mts.map +1 -1
- package/esm/rules/string/strong-password-rule.mjs +1 -1
- package/esm/rules/string/strong-password-rule.mjs.map +1 -1
- package/esm/rules/string/url.d.mts +2 -1
- package/esm/rules/string/url.d.mts.map +1 -1
- package/esm/rules/string/url.mjs +1 -1
- package/esm/rules/string/url.mjs.map +1 -1
- package/esm/rules/string/without-whitespace.d.mts +2 -1
- package/esm/rules/string/without-whitespace.d.mts.map +1 -1
- package/esm/rules/string/without-whitespace.mjs +1 -1
- package/esm/rules/string/without-whitespace.mjs.map +1 -1
- package/esm/standard-schema/json-schema.d.mts +1 -1
- package/esm/standard-schema/json-schema.d.mts.map +1 -1
- package/esm/standard-schema/json-schema.mjs +1 -1
- package/esm/standard-schema/json-schema.mjs.map +1 -1
- package/esm/standard-schema/map-result.d.mts +2 -1
- package/esm/standard-schema/map-result.d.mts.map +1 -1
- package/esm/standard-schema/map-result.mjs +1 -1
- package/esm/standard-schema/map-result.mjs.map +1 -1
- package/esm/standard-schema/types.d.mts +1 -1
- package/esm/standard-schema/types.d.mts.map +1 -1
- package/esm/string.d.mts +1 -1
- package/esm/string.d.mts.map +1 -1
- package/esm/string.mjs +1 -1
- package/esm/string.mjs.map +1 -1
- package/esm/types/conditional-types.d.mts +1 -1
- package/esm/types/conditional-types.d.mts.map +1 -1
- package/esm/types/context-types.d.mts +8 -2
- package/esm/types/context-types.d.mts.map +1 -1
- package/esm/types/data-transformer-types.d.mts +1 -1
- package/esm/types/data-transformer-types.d.mts.map +1 -1
- package/esm/types/date-types.d.mts +1 -1
- package/esm/types/date-types.d.mts.map +1 -1
- package/esm/types/date-types.mjs +1 -1
- package/esm/types/date-types.mjs.map +1 -1
- package/esm/types/file.types.d.mts +1 -1
- package/esm/types/file.types.d.mts.map +1 -1
- package/esm/types/inference-types.d.mts +21 -4
- package/esm/types/inference-types.d.mts.map +1 -1
- package/esm/types/mutator-types.d.mts +1 -1
- package/esm/types/mutator-types.d.mts.map +1 -1
- package/esm/types/result-types.d.mts +26 -2
- package/esm/types/result-types.d.mts.map +1 -1
- package/esm/types/rule-types.d.mts +1 -1
- package/esm/types/rule-types.d.mts.map +1 -1
- package/esm/types/schema-types.d.mts +1 -1
- package/esm/types/schema-types.d.mts.map +1 -1
- package/esm/validators/any-validator.d.mts +1 -1
- package/esm/validators/any-validator.d.mts.map +1 -1
- package/esm/validators/any-validator.mjs +1 -1
- package/esm/validators/any-validator.mjs.map +1 -1
- package/esm/validators/array-validator.d.mts +1 -1
- package/esm/validators/array-validator.d.mts.map +1 -1
- package/esm/validators/array-validator.mjs +1 -1
- package/esm/validators/array-validator.mjs.map +1 -1
- package/esm/validators/base-validator.d.mts +8 -1
- package/esm/validators/base-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.mjs +23 -4
- package/esm/validators/base-validator.mjs.map +1 -1
- package/esm/validators/boolean-validator.d.mts +1 -1
- package/esm/validators/boolean-validator.d.mts.map +1 -1
- package/esm/validators/boolean-validator.mjs +1 -1
- package/esm/validators/boolean-validator.mjs.map +1 -1
- package/esm/validators/computed-validator.d.mts +1 -1
- package/esm/validators/computed-validator.d.mts.map +1 -1
- package/esm/validators/computed-validator.mjs +1 -1
- package/esm/validators/computed-validator.mjs.map +1 -1
- package/esm/validators/date-validator.d.mts +2 -1
- package/esm/validators/date-validator.d.mts.map +1 -1
- package/esm/validators/date-validator.mjs +1 -1
- package/esm/validators/date-validator.mjs.map +1 -1
- package/esm/validators/discriminated-union-validator.d.mts +8 -2
- package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
- package/esm/validators/discriminated-union-validator.mjs +6 -1
- package/esm/validators/discriminated-union-validator.mjs.map +1 -1
- package/esm/validators/float-validator.d.mts +1 -1
- package/esm/validators/float-validator.d.mts.map +1 -1
- package/esm/validators/float-validator.mjs +1 -1
- package/esm/validators/float-validator.mjs.map +1 -1
- package/esm/validators/instanceof-validator.d.mts +1 -1
- package/esm/validators/instanceof-validator.d.mts.map +1 -1
- package/esm/validators/instanceof-validator.mjs +1 -1
- package/esm/validators/instanceof-validator.mjs.map +1 -1
- package/esm/validators/int-validator.d.mts +1 -1
- package/esm/validators/int-validator.d.mts.map +1 -1
- package/esm/validators/int-validator.mjs +1 -1
- package/esm/validators/int-validator.mjs.map +1 -1
- package/esm/validators/lazy-validator.d.mts +1 -1
- package/esm/validators/lazy-validator.d.mts.map +1 -1
- package/esm/validators/lazy-validator.mjs +1 -1
- package/esm/validators/lazy-validator.mjs.map +1 -1
- package/esm/validators/literal-validator.d.mts +1 -1
- package/esm/validators/literal-validator.d.mts.map +1 -1
- package/esm/validators/literal-validator.mjs +5 -2
- package/esm/validators/literal-validator.mjs.map +1 -1
- package/esm/validators/managed-validator.d.mts +1 -1
- package/esm/validators/managed-validator.d.mts.map +1 -1
- package/esm/validators/managed-validator.mjs +1 -1
- package/esm/validators/managed-validator.mjs.map +1 -1
- package/esm/validators/methods/equality-conditional-methods.d.mts +2 -1
- package/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -1
- package/esm/validators/methods/equality-conditional-methods.mjs +1 -1
- package/esm/validators/methods/equality-conditional-methods.mjs.map +1 -1
- package/esm/validators/methods/forbidden-methods.d.mts +1 -1
- package/esm/validators/methods/forbidden-methods.d.mts.map +1 -1
- package/esm/validators/methods/forbidden-methods.mjs +1 -1
- package/esm/validators/methods/forbidden-methods.mjs.map +1 -1
- package/esm/validators/methods/present-methods.d.mts +1 -1
- package/esm/validators/methods/present-methods.d.mts.map +1 -1
- package/esm/validators/methods/present-methods.mjs +1 -1
- package/esm/validators/methods/present-methods.mjs.map +1 -1
- package/esm/validators/methods/required-methods.d.mts +2 -1
- package/esm/validators/methods/required-methods.d.mts.map +1 -1
- package/esm/validators/methods/required-methods.mjs +1 -1
- package/esm/validators/methods/required-methods.mjs.map +1 -1
- package/esm/validators/number-validator.d.mts +1 -1
- package/esm/validators/number-validator.d.mts.map +1 -1
- package/esm/validators/number-validator.mjs +1 -1
- package/esm/validators/number-validator.mjs.map +1 -1
- package/esm/validators/numeric-validator.d.mts +1 -1
- package/esm/validators/numeric-validator.d.mts.map +1 -1
- package/esm/validators/numeric-validator.mjs +1 -1
- package/esm/validators/numeric-validator.mjs.map +1 -1
- package/esm/validators/object-validator.d.mts +1 -1
- package/esm/validators/object-validator.d.mts.map +1 -1
- package/esm/validators/object-validator.mjs +5 -3
- package/esm/validators/object-validator.mjs.map +1 -1
- package/esm/validators/primitive-validator.d.mts +1 -1
- package/esm/validators/primitive-validator.d.mts.map +1 -1
- package/esm/validators/primitive-validator.mjs +1 -1
- package/esm/validators/primitive-validator.mjs.map +1 -1
- package/esm/validators/record-validator.d.mts +1 -1
- package/esm/validators/record-validator.d.mts.map +1 -1
- package/esm/validators/record-validator.mjs +1 -1
- package/esm/validators/record-validator.mjs.map +1 -1
- package/esm/validators/scalar-validator.d.mts +1 -1
- package/esm/validators/scalar-validator.d.mts.map +1 -1
- package/esm/validators/scalar-validator.mjs +1 -1
- package/esm/validators/scalar-validator.mjs.map +1 -1
- package/esm/validators/string-validator.d.mts +1 -1
- package/esm/validators/string-validator.d.mts.map +1 -1
- package/esm/validators/string-validator.mjs +1 -1
- package/esm/validators/string-validator.mjs.map +1 -1
- package/esm/validators/tuple-validator.d.mts +1 -1
- package/esm/validators/tuple-validator.d.mts.map +1 -1
- package/esm/validators/tuple-validator.mjs +1 -1
- package/esm/validators/tuple-validator.mjs.map +1 -1
- package/esm/validators/union-validator.d.mts +1 -1
- package/esm/validators/union-validator.d.mts.map +1 -1
- package/esm/validators/union-validator.mjs +1 -1
- package/esm/validators/union-validator.mjs.map +1 -1
- package/llms-full.txt +49 -47
- package/llms.txt +7 -7
- package/package.json +3 -2
- package/skills/bridge-standard-schema/SKILL.md +1 -1
- package/skills/compose-seal-modifiers/SKILL.md +2 -2
- package/skills/define-structural-shape/SKILL.md +3 -3
- package/skills/define-structural-shape/array-methods.md +1 -1
- package/skills/define-structural-shape/object-methods.md +1 -1
- package/skills/extend-seal-with-plugins/SKILL.md +3 -3
- package/skills/generate-json-schema/SKILL.md +1 -1
- package/skills/handle-seal-errors/SKILL.md +5 -7
- package/skills/overview/SKILL.md +10 -10
- package/skills/pick-seal-primitive/SKILL.md +7 -3
- package/skills/pick-seal-primitive/boolean-methods.md +1 -1
- package/skills/pick-seal-primitive/date-methods.md +1 -1
- package/skills/pick-seal-primitive/number-methods.md +1 -1
- package/skills/pick-seal-primitive/string-methods.md +2 -2
- package/skills/seal-basics/SKILL.md +10 -10
- package/cjs/object-DubGC-xu.cjs.map +0 -1
- package/cjs/required-methods-BOVNRtci.cjs.map +0 -1
- package/cjs/string-DpDpgefH.cjs.map +0 -1
- package/esm/helpers/index.d.mts +0 -5
- package/esm/mutators/index.d.mts +0 -7
- package/esm/rules/array/index.d.mts +0 -1
- package/esm/rules/color/index.d.mts +0 -1
- package/esm/rules/common/index.d.mts +0 -6
- package/esm/rules/conditional/index.d.mts +0 -10
- package/esm/rules/core/index.d.mts +0 -5
- package/esm/rules/date/index.d.mts +0 -7
- package/esm/rules/file/index.d.mts +0 -2
- package/esm/rules/index.d.mts +0 -45
- package/esm/rules/length/index.d.mts +0 -1
- package/esm/rules/number/index.d.mts +0 -1
- package/esm/rules/string/index.d.mts +0 -11
- package/esm/standard-schema/index.d.mts +0 -3
- package/esm/types/index.d.mts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-rules.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"color-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/color/color-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Color validation regex patterns\n */\nconst colorValidationRegex = {\n hex: /^#([0-9a-f]{3}){1,2}$/i,\n rgb: /^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/,\n rgba: /^rgba\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3}),\\s*(0?\\.\\d+|1)\\)$/,\n hsl: /^hsl\\((\\d{1,3}),\\s*(\\d{1,3})%?,\\s*(\\d{1,3})%?\\)$/,\n};\n\n/**\n * Generic color rule - validates any color format\n */\nexport const colorRule: SchemaRule = {\n name: \"color\",\n defaultErrorMessage: \"The :input must be a valid color\",\n async validate(value: any, context) {\n const isValidColor =\n colorValidationRegex.hex.test(value) ||\n colorValidationRegex.rgb.test(value) ||\n colorValidationRegex.rgba.test(value) ||\n colorValidationRegex.hsl.test(value);\n\n if (isValidColor) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Hex color rule\n */\nexport const hexColorRule: SchemaRule = {\n name: \"hexColor\",\n defaultErrorMessage: \"The :input must be a valid hex color\",\n async validate(value: any, context) {\n if (colorValidationRegex.hex.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * RGB color rule\n */\nexport const rgbColorRule: SchemaRule = {\n name: \"rgbColor\",\n defaultErrorMessage: \"The :input must be a valid RGB color\",\n async validate(value: any, context) {\n if (colorValidationRegex.rgb.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * RGBA color rule\n */\nexport const rgbaColorRule: SchemaRule = {\n name: \"rgbaColor\",\n defaultErrorMessage: \"The :input must be a valid RGBA color\",\n async validate(value: any, context) {\n if (colorValidationRegex.rgba.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * HSL color rule\n */\nexport const hslColorRule: SchemaRule = {\n name: \"hslColor\",\n defaultErrorMessage: \"The :input must be a valid HSL color\",\n async validate(value: any, context) {\n if (colorValidationRegex.hsl.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Light color rule\n */\nexport const lightColorRule: SchemaRule = {\n name: \"lightColor\",\n defaultErrorMessage: \"The :input must be a light color\",\n async validate(value: any, context) {\n if (!colorValidationRegex.hex.test(value)) {\n return invalidRule(this, context);\n }\n\n const hex = value.replace(\"#\", \"\");\n const r = parseInt(hex.substring(0, 2), 16);\n const g = parseInt(hex.substring(2, 4), 16);\n const b = parseInt(hex.substring(4, 6), 16);\n const brightness = (r * 299 + g * 587 + b * 114) / 1000;\n\n if (brightness > 155) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Dark color rule\n */\nexport const darkColorRule: SchemaRule = {\n name: \"darkColor\",\n defaultErrorMessage: \"The :input must be a dark color\",\n async validate(value: any, context) {\n if (!colorValidationRegex.hex.test(value)) {\n return invalidRule(this, context);\n }\n\n const hex = value.replace(\"#\", \"\");\n const r = parseInt(hex.substring(0, 2), 16);\n const g = parseInt(hex.substring(2, 4), 16);\n const b = parseInt(hex.substring(4, 6), 16);\n const brightness = (r * 299 + g * 587 + b * 114) / 1000;\n\n if (brightness <= 155) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAM,uBAAuB;CAC3B,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;AACP;;;;AAKA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAOlC,IALE,qBAAqB,IAAI,KAAK,KAAK,KACnC,qBAAqB,IAAI,KAAK,KAAK,KACnC,qBAAqB,KAAK,KAAK,KAAK,KACpC,qBAAqB,IAAI,KAAK,KAAK,GAGnC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,qBAAqB,IAAI,KAAK,KAAK,GACrC,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,qBAAqB,IAAI,KAAK,KAAK,GACrC,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAA4B;CACvC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,qBAAqB,KAAK,KAAK,KAAK,GACtC,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,qBAAqB,IAAI,KAAK,KAAK,GACrC,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA6B;CACxC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,qBAAqB,IAAI,KAAK,KAAK,GACtC,OAAO,YAAY,MAAM,OAAO;EAGlC,MAAM,MAAM,MAAM,QAAQ,KAAK,EAAE;EACjC,MAAM,IAAI,SAAS,IAAI,UAAU,GAAG,CAAC,GAAG,EAAE;EAC1C,MAAM,IAAI,SAAS,IAAI,UAAU,GAAG,CAAC,GAAG,EAAE;EAC1C,MAAM,IAAI,SAAS,IAAI,UAAU,GAAG,CAAC,GAAG,EAAE;EAG1C,KAFoB,IAAI,MAAM,IAAI,MAAM,IAAI,OAAO,MAElC,KACf,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAA4B;CACvC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,qBAAqB,IAAI,KAAK,KAAK,GACtC,OAAO,YAAY,MAAM,OAAO;EAGlC,MAAM,MAAM,MAAM,QAAQ,KAAK,EAAE;EACjC,MAAM,IAAI,SAAS,IAAI,UAAU,GAAG,CAAC,GAAG,EAAE;EAC1C,MAAM,IAAI,SAAS,IAAI,UAAU,GAAG,CAAC,GAAG,EAAE;EAC1C,MAAM,IAAI,SAAS,IAAI,UAAU,GAAG,CAAC,GAAG,EAAE;EAG1C,KAFoB,IAAI,MAAM,IAAI,MAAM,IAAI,OAAO,OAEjC,KAChB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"enum.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/enum.ts"],"mappings":";;;;;AAMA;cAAa,QAAA,EAAU,UAAU;EAAG,IAAI;AAAA;AAAA;AAwBxC;;AAxBwC,cAwB3B,MAAA,EAAQ,UAAU;EAAG,MAAM;AAAA;AAsBxC;;;AAAA,cAAa,iBAAA,EAAmB,UAAU;EAAG,aAAa;AAAA;;;;cAsB7C,oBAAA,EAAsB,UAAU;EAAG,gBAAgB;AAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VALID_RULE, invalidRule, resolveTranslation } from "../../helpers/validation-helpers.mjs";
|
|
2
2
|
import "../../helpers/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../../packages/seal/src/rules/common/enum.ts
|
|
5
5
|
/**
|
|
6
6
|
* Enum rule - value must be one of the enum values
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"enum.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/enum.ts"],"sourcesContent":["import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Enum rule - value must be one of the enum values\n */\nexport const enumRule: SchemaRule<{ enum: any }> = {\n name: \"enum\",\n defaultErrorMessage: \"The :input must be one of the following values: :enum\",\n async validate(value: any, context) {\n const enumValues = this.context.options.enum;\n\n if (enumValues.includes(value)) {\n return VALID_RULE;\n }\n\n // Translate each enum value individually, then join into a display string\n this.context.translationParams.enum = enumValues\n .map((v: any) =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * In rule - value must be in the given array\n */\nexport const inRule: SchemaRule<{ values: any[] }> = {\n name: \"in\",\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\n async validate(value: any, context) {\n if (this.context.options.values.includes(value)) {\n return VALID_RULE;\n }\n\n // Translate each value individually, then join\n this.context.translationParams.values = this.context.options.values\n .map((v: any) =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Allowed values rule - value must be one of allowed values\n */\nexport const allowedValuesRule: SchemaRule<{ allowedValues: any[] }> = {\n name: \"allowedValues\",\n defaultErrorMessage: \"The :input must be one of the allowed values\",\n async validate(value: any, context) {\n if (this.context.options.allowedValues.includes(value)) {\n return VALID_RULE;\n }\n\n // Translate each value individually, then join\n this.context.translationParams.allowedValues = this.context.options.allowedValues\n .map((v: any) =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Not allowed values rule - value must not be in forbidden list\n */\nexport const notAllowedValuesRule: SchemaRule<{ notAllowedValues: any[] }> = {\n name: \"notAllowedValues\",\n defaultErrorMessage: \"The :input contains a forbidden value\",\n async validate(value: any, context) {\n if (!this.context.options.notAllowedValues.includes(value)) {\n return VALID_RULE;\n }\n\n // Translate each value individually, then join\n this.context.translationParams.notAllowedValues = this.context.options.notAllowedValues\n .map((v: any) =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,WAAsC;CACjD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,KAAK,QAAQ,QAAQ;EAExC,IAAI,WAAW,SAAS,KAAK,GAC3B,OAAO;EAIT,KAAK,QAAQ,kBAAkB,OAAO,WACnC,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,SAAwC;CACnD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,KAAK,QAAQ,QAAQ,OAAO,SAAS,KAAK,GAC5C,OAAO;EAIT,KAAK,QAAQ,kBAAkB,SAAS,KAAK,QAAQ,QAAQ,OAC1D,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,oBAA0D;CACrE,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,KAAK,QAAQ,QAAQ,cAAc,SAAS,KAAK,GACnD,OAAO;EAIT,KAAK,QAAQ,kBAAkB,gBAAgB,KAAK,QAAQ,QAAQ,cACjE,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,uBAAgE;CAC3E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,KAAK,QAAQ,QAAQ,iBAAiB,SAAS,KAAK,GACvD,OAAO;EAIT,KAAK,QAAQ,kBAAkB,mBAAmB,KAAK,QAAQ,QAAQ,iBACpE,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/seal/src/rules/common/equals-field-rules.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Equals field rule - value must equal another field's value
|
|
5
6
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equals-field-rules.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"equals-field-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/equals-field-rules.ts"],"mappings":";;;;;AAOA;;cAAa,eAAA,EAAiB,UAAU;EACtC,KAAA;EACA,KAAA;AAAA;;;AAAK;AAwBP;cAAa,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,KAAA;AAAA"}
|
|
@@ -2,7 +2,7 @@ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
|
2
2
|
import { getFieldValue } from "../../helpers/get-field-value.mjs";
|
|
3
3
|
import "../../helpers/index.mjs";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../../packages/seal/src/rules/common/equals-field-rules.ts
|
|
6
6
|
/**
|
|
7
7
|
* Equals field rule - value must equal another field's value
|
|
8
8
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equals-field-rules.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"equals-field-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/equals-field-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Equals field rule - value must equal another field's value\n * Supports both global and sibling scope\n */\nexport const equalsFieldRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"equalsField\",\n description: \"The value must equal another field's value\",\n sortOrder: -1,\n requiresValue: true,\n defaultErrorMessage: \"The :input must match the :field field\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Value must equal the other field's value\n if (value !== fieldValue) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Not equals field rule - value must NOT equal another field's value\n * Supports both global and sibling scope\n */\nexport const notEqualsFieldRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"notEqualsField\",\n description: \"The value must NOT equal another field's value\",\n sortOrder: -1,\n requiresValue: true,\n defaultErrorMessage: \"The :input must not match the :field field\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Value must NOT equal the other field's value\n if (value === fieldValue) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;AAOA,MAAa,kBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAIlC,IAAI,UAHe,cAAc,MAAM,OAGhB,GAAG;GACxB,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,qBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAIlC,IAAI,UAHe,cAAc,MAAM,OAGhB,GACrB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instanceof.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"instanceof.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/instanceof.ts"],"mappings":";;;;;AASA;;;;cAAa,cAAA,EAAgB,UAAU;EAAG,IAAA,UAAc,IAAA;EAAqB,IAAA;AAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
2
2
|
import "../../helpers/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../../packages/seal/src/rules/common/instanceof.ts
|
|
5
5
|
/**
|
|
6
6
|
* InstanceOf rule - value must be an instance of the given constructor.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instanceof.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"instanceof.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/instanceof.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * InstanceOf rule - value must be an instance of the given constructor.\n *\n * Uses the `instanceof` operator at runtime. Useful for class instances\n * not representable in JSON Schema (File, Buffer, custom domain classes).\n */\nexport const instanceofRule: SchemaRule<{ ctor: new (...args: any[]) => any; name: string }> = {\n name: \"instanceof\",\n defaultErrorMessage: \"The :input must be an instance of :name\",\n async validate(value: any, context) {\n if (value instanceof this.context.options.ctor) {\n return VALID_RULE;\n }\n\n this.context.translationParams.name = this.context.options.name;\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,iBAAkF;CAC7F,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,KAAK,QAAQ,QAAQ,MACxC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,OAAO,KAAK,QAAQ,QAAQ;EAE3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"literal.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/literal.ts"],"mappings":";;;;;AAUA;;;;AAA6C;cAAhC,WAAA,EAAa,UAAU;EAAG,MAAM;AAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VALID_RULE, invalidRule, resolveTranslation } from "../../helpers/validation-helpers.mjs";
|
|
2
2
|
import "../../helpers/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../../packages/seal/src/rules/common/literal.ts
|
|
5
5
|
/**
|
|
6
6
|
* Literal rule - value must be strictly equal to one of the literal values.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"literal.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/literal.ts"],"sourcesContent":["import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Literal rule - value must be strictly equal to one of the literal values.\n *\n * Uses === (referential / strict equality), so distinguishes 1 from \"1\",\n * true from \"true\", etc. Mirrors `v.string().oneOf([...])` but at the\n * literal type level (TypeScript narrows to the union of literals).\n */\nexport const literalRule: SchemaRule<{ values: readonly (string | number | boolean)[] }> = {\n name: \"literal\",\n // Runs even on \"empty\" values. A literal set is an exact-match whitelist, so\n // there is no value it cannot safely be asked about — and `\"\"` is one of the\n // values callers most want to pin (`alt=\"\"` for a decorative image). Left at\n // the default, the empty string would skip this check entirely, which made\n // `v.literal(\"\").optional()` accept `\"\"`, `null` AND a missing key alike.\n requiresValue: false,\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\n async validate(value: any, context) {\n // Absence is the required/present rule's question, not this one. Without\n // this, `requiresValue: false` above would make the literal check fire on a\n // missing key and defeat `.optional()`, which works by removing that rule.\n if (value === undefined) {\n return VALID_RULE;\n }\n\n if (this.context.options.values.includes(value)) {\n return VALID_RULE;\n }\n\n this.context.translationParams.values = this.context.options.values\n .map(v =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,cAA8E;CACzF,MAAM;CAMN,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAIlC,IAAI,UAAU,QACZ,OAAO;EAGT,IAAI,KAAK,QAAQ,QAAQ,OAAO,SAAS,KAAK,GAC5C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,SAAS,KAAK,QAAQ,QAAQ,OAC1D,KAAI,MACH,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-rules.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"type-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/type-rules.ts"],"mappings":";;;;;AAOA;cAAa,UAAA,EAAY,UASxB;;;AAAA;cAKY,UAAA,EAAY,UASxB;;;;cAKY,WAAA,EAAa,UASzB;AATD;;;AAAA,cAca,OAAA,EAAS,UASrB;AAdA;AAKD;;AALC,cAmBY,SAAA,EAAW,UASvB;;AAdA;AAKD;cAca,UAAA,EAAY,UASxB;;;AAdA;cAmBY,UAAA,EAAY,UAUxB;;;;cAKY,eAAA,EAAiB,UAU7B;AAzBD;;;AAAA,cA8Ba,SAAA,EAAW,UAUvB"}
|
|
@@ -2,7 +2,7 @@ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
|
2
2
|
import "../../helpers/index.mjs";
|
|
3
3
|
import { isObject, isPlainObject } from "@mongez/supportive-is";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../../packages/seal/src/rules/common/type-rules.ts
|
|
6
6
|
/**
|
|
7
7
|
* String rule - validates string type
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-rules.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"type-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/type-rules.ts"],"sourcesContent":["import { isObject, isPlainObject } from \"@mongez/supportive-is\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * String rule - validates string type\n */\nexport const stringRule: SchemaRule = {\n name: \"string\",\n defaultErrorMessage: \"The :input must be a string\",\n async validate(value: any, context) {\n if (typeof value === \"string\") {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Number rule - validates number type\n */\nexport const numberRule: SchemaRule = {\n name: \"number\",\n defaultErrorMessage: \"The :input must be a number\",\n async validate(value: any, context) {\n if (typeof value === \"number\") {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Boolean rule - validates boolean type\n */\nexport const booleanRule: SchemaRule = {\n name: \"boolean\",\n defaultErrorMessage: \"The :input must be a boolean\",\n async validate(value: any, context) {\n if (typeof value === \"boolean\") {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Int rule - validates integer type\n */\nexport const intRule: SchemaRule = {\n name: \"int\",\n defaultErrorMessage: \"The :input must be an integer\",\n async validate(value: any, context) {\n if (Number.isInteger(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Float rule - validates float type\n */\nexport const floatRule: SchemaRule = {\n name: \"float\",\n defaultErrorMessage: \"The :input must be a float\",\n async validate(value: any, context) {\n if (Number.isFinite(value) && !Number.isInteger(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Scalar rule - validates scalar value (string, number, or boolean)\n */\nexport const scalarRule: SchemaRule = {\n name: \"scalar\",\n defaultErrorMessage: \"The :input must be a scalar value\",\n async validate(value: any, context) {\n if ([\"string\", \"number\", \"boolean\"].includes(typeof value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Object rule - validates object type\n */\nexport const objectRule: SchemaRule = {\n name: \"object\",\n defaultErrorMessage: \"The :input must be an object\",\n async validate(value: any, context) {\n if (!!isObject(value) && value !== null) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Object rule - validates object type\n */\nexport const plainObjectRule: SchemaRule = {\n name: \"plainObject\",\n defaultErrorMessage: \"The :input must be an object\",\n async validate(value: any, context) {\n if (!!isPlainObject(value) && value !== null) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Array rule - validates array type\n */\nexport const arrayRule: SchemaRule = {\n name: \"array\",\n defaultErrorMessage: \"The :input must be an array\",\n async validate(value: any, context) {\n if (Array.isArray(value)) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,aAAyB;CACpC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,UAAU,UACnB,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,aAAyB;CACpC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,UAAU,UACnB,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,cAA0B;CACrC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,UAAU,WACnB,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,UAAsB;CACjC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,UAAU,KAAK,GACxB,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,OAAO,SAAS,KAAK,KAAK,CAAC,OAAO,UAAU,KAAK,GACnD,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,aAAyB;CACpC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI;GAAC;GAAU;GAAU;EAAS,CAAC,CAAC,SAAS,OAAO,KAAK,GACvD,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,aAAyB;CACpC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,CAAC,SAAS,KAAK,KAAK,UAAU,MACjC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAA8B;CACzC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,CAAC,cAAc,KAAK,KAAK,UAAU,MACtC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema } from "../../types/schema-types.mjs";
|
|
2
2
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
//#region ../../packages/seal/src/rules/common/unknown-key.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Unknown key rule - validates that object doesn't have unknown keys
|
|
6
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown-key.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"unknown-key.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/unknown-key.ts"],"mappings":";;;;;;;cAMa,cAAA,EAAgB,UAAU;EACrC,MAAA,EAAQ,MAAA;EACR,WAAA;AAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
2
2
|
import "../../helpers/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../../packages/seal/src/rules/common/unknown-key.ts
|
|
5
5
|
/**
|
|
6
6
|
* Unknown key rule - validates that object doesn't have unknown keys
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown-key.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"unknown-key.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/common/unknown-key.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { Schema, SchemaRule } from \"../../types\";\n\n/**\n * Unknown key rule - validates that object doesn't have unknown keys\n */\nexport const unknownKeyRule: SchemaRule<{\n schema: Schema;\n allowedKeys: string[];\n}> = {\n name: \"unknownKeys\",\n defaultErrorMessage: \"The :input contains unknown keys: :unknownKeys\",\n async validate(value: any, context) {\n const schema = this.context.options.schema;\n const allowedKeys = [...Object.keys(schema), ...(this.context.options.allowedKeys || [])];\n\n const unknownKeys = Object.keys(value).filter((key) => !allowedKeys.includes(key));\n\n if (unknownKeys.length > 0) {\n this.context.translationParams.unknownKeys = unknownKeys.join(\", \");\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,iBAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,SAAS,KAAK,QAAQ,QAAQ;EACpC,MAAM,cAAc,CAAC,GAAG,OAAO,KAAK,MAAM,GAAG,GAAI,KAAK,QAAQ,QAAQ,eAAe,CAAC,CAAE;EAExF,MAAM,cAAc,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ,QAAQ,CAAC,YAAY,SAAS,GAAG,CAAC;EAEjF,IAAI,YAAY,SAAS,GAAG;GAC1B,KAAK,QAAQ,kBAAkB,cAAc,YAAY,KAAK,IAAI;GAElE,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/seal/src/rules/conditional/forbidden-if-rules.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Forbidden if rule - field is forbidden if another field equals a specific value
|
|
5
6
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden-if-rules.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"forbidden-if-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/forbidden-if-rules.ts"],"mappings":";;;;;AAQA;;cAAa,eAAA,EAAiB,UAAU;EACtC,KAAA;EACA,KAAA;EACA,KAAA;AAAA;;;AAAK;AAyBP;cAAa,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,KAAA;EACA,KAAA;AAAA;;;;AAAK;cAuBM,oBAAA,EAAsB,UAAU;EAC3C,KAAA;EACA,KAAA;AAAA;;;;;cAsBW,uBAAA,EAAyB,UAAU;EAC9C,KAAA;EACA,KAAA;AAAA;;;;;cAsBW,iBAAA,EAAmB,UAAU;EACxC,KAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;cAyBW,oBAAA,EAAsB,UAAU;EAC3C,KAAA;EACA,MAAA;EACA,KAAA;AAAA"}
|
|
@@ -3,7 +3,7 @@ import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
|
|
|
3
3
|
import { getFieldValue } from "../../helpers/get-field-value.mjs";
|
|
4
4
|
import "../../helpers/index.mjs";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../../packages/seal/src/rules/conditional/forbidden-if-rules.ts
|
|
7
7
|
/**
|
|
8
8
|
* Forbidden if rule - field is forbidden if another field equals a specific value
|
|
9
9
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden-if-rules.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"forbidden-if-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/forbidden-if-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Forbidden if rule - field is forbidden if another field equals a specific value\n * Supports both global and sibling scope\n */\nexport const forbiddenIfRule: SchemaRule<{\n field: string;\n value: any;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"forbiddenIf\",\n description: \"The field is forbidden if another field equals a specific value\",\n sortOrder: -2,\n defaultErrorMessage: \"The :input is forbidden\",\n async validate(value: any, context) {\n const { value: expectedValue } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is forbidden if it has a value and the other field equals the expected value\n if (!isEmptyValue(value) && fieldValue === expectedValue) {\n this.context.translatableParams.field = this.context.options.field;\n this.context.translationParams.value = expectedValue;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Forbidden if not rule - field is forbidden if another field does NOT equal a specific value\n * Supports both global and sibling scope\n */\nexport const forbiddenIfNotRule: SchemaRule<{\n field: string;\n value: any;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"forbiddenIfNot\",\n description: \"The field is forbidden if another field does NOT equal a specific value\",\n sortOrder: -2,\n defaultErrorMessage: \"The :input is forbidden\",\n async validate(value: any, context) {\n const { value: expectedValue } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is forbidden if it has a value and the other field does NOT equal the expected value\n if (!isEmptyValue(value) && fieldValue !== expectedValue) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Forbidden if empty rule - field is forbidden if another field is empty\n * Supports both global and sibling scope\n */\nexport const forbiddenIfEmptyRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"forbiddenIfEmpty\",\n description: \"The field is forbidden if another field is empty\",\n sortOrder: -2,\n defaultErrorMessage: \"The :input is forbidden\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is forbidden if it has a value and the other field is empty\n if (!isEmptyValue(value) && isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Forbidden if not empty rule - field is forbidden if another field is not empty\n * Supports both global and sibling scope\n */\nexport const forbiddenIfNotEmptyRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"forbiddenIfNotEmpty\",\n description: \"The field is forbidden if another field is not empty\",\n sortOrder: -2,\n defaultErrorMessage: \"The :input is forbidden\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is forbidden if it has a value and the other field is not empty\n if (!isEmptyValue(value) && !isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Forbidden if in rule - field is forbidden if another field's value is in the given array\n * Supports both global and sibling scope\n */\nexport const forbiddenIfInRule: SchemaRule<{\n field: string;\n values: any[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"forbiddenIfIn\",\n description: \"The field is forbidden if another field's value is in the given array\",\n sortOrder: -2,\n defaultErrorMessage: \"The :input is forbidden\",\n async validate(value: any, context) {\n const { values } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is forbidden if it has a value and the other field's value is in the array\n if (!isEmptyValue(value) && values.includes(fieldValue)) {\n this.context.translationParams.values = values.join(\", \");\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Forbidden if not in rule - field is forbidden if another field's value is NOT in the given array\n * Supports both global and sibling scope\n */\nexport const forbiddenIfNotInRule: SchemaRule<{\n field: string;\n values: any[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"forbiddenIfNotIn\",\n description: \"The field is forbidden if another field's value is NOT in the given array\",\n sortOrder: -2,\n defaultErrorMessage: \"The :input is forbidden\",\n async validate(value: any, context) {\n const { values } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is forbidden if it has a value and the other field's value is NOT in the array\n if (!isEmptyValue(value) && !values.includes(fieldValue)) {\n this.context.translationParams.values = values.join(\", \");\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,kBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAC9C,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,CAAC,aAAa,KAAK,KAAK,eAAe,eAAe;GACxD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,KAAK,QAAQ,kBAAkB,QAAQ;GACvC,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,qBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAC9C,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,CAAC,aAAa,KAAK,KAAK,eAAe,eACzC,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,uBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,CAAC,aAAa,KAAK,KAAK,aAAa,UAAU,GACjD,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,0BAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa,UAAU,GAClD,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,oBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,WAAW,KAAK,QAAQ;EAChC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,CAAC,aAAa,KAAK,KAAK,OAAO,SAAS,UAAU,GAAG;GACvD,KAAK,QAAQ,kBAAkB,SAAS,OAAO,KAAK,IAAI;GACxD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,uBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,WAAW,KAAK,QAAQ;EAChC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,OAAO,SAAS,UAAU,GAAG;GACxD,KAAK,QAAQ,kBAAkB,SAAS,OAAO,KAAK,IAAI;GACxD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/seal/src/rules/conditional/present-if-rules.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Present if rule - field must be present if another field equals a specific value
|
|
5
6
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-if-rules.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"present-if-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-if-rules.ts"],"mappings":";;;;;AAQA;;cAAa,aAAA,EAAe,UAAU;EACpC,KAAA;EACA,KAAA;EACA,KAAA;AAAA;;;AAAK;AA0BP;cAAa,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,KAAA;AAAA;;;;AAAK;cAuBM,qBAAA,EAAuB,UAAU;EAC5C,KAAA;EACA,KAAA;AAAA;;;;;cAuBW,eAAA,EAAiB,UAAU;EACtC,KAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;cAwBW,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,MAAA;EACA,KAAA;AAAA"}
|
|
@@ -3,7 +3,7 @@ import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
|
|
|
3
3
|
import { getFieldValue } from "../../helpers/get-field-value.mjs";
|
|
4
4
|
import "../../helpers/index.mjs";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../../packages/seal/src/rules/conditional/present-if-rules.ts
|
|
7
7
|
/**
|
|
8
8
|
* Present if rule - field must be present if another field equals a specific value
|
|
9
9
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-if-rules.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"present-if-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-if-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\n\n/**\n * Present if rule - field must be present if another field equals a specific value\n * Supports both global and sibling scope\n */\nexport const presentIfRule: SchemaRule<{\n field: string;\n value: any;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentIf\",\n description: \"The field must be present if another field equals a specific value\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { value: expectedValue } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present if the other field equals the expected value\n if (value === undefined && fieldValue === expectedValue) {\n this.context.translationParams.value = expectedValue;\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present if empty rule - field must be present if another field is empty\n * Supports both global and sibling scope\n */\nexport const presentIfEmptyRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentIfEmpty\",\n description: \"The field must be present if another field is empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present if the other field is empty\n if (value === undefined && isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present if not empty rule - field must be present if another field is not empty\n * Supports both global and sibling scope\n */\nexport const presentIfNotEmptyRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentIfNotEmpty\",\n description: \"The field must be present if another field is not empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present if the other field is not empty\n if (value === undefined && !isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present if in rule - field must be present if another field's value is in the given array\n * Supports both global and sibling scope\n */\nexport const presentIfInRule: SchemaRule<{\n field: string;\n values: any[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentIfIn\",\n description: \"The field must be present if another field's value is in the given array\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { values } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present if the other field's value is in the array\n if (value === undefined && values.includes(fieldValue)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present if not in rule - field must be present if another field's value is NOT in the given array\n * Supports both global and sibling scope\n */\nexport const presentIfNotInRule: SchemaRule<{\n field: string;\n values: any[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentIfNotIn\",\n description: \"The field must be present if another field's value is NOT in the given array\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { values } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present if the other field's value is NOT in the array\n if (value === undefined && !values.includes(fieldValue)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,gBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAC9C,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,eAAe,eAAe;GACvD,KAAK,QAAQ,kBAAkB,QAAQ;GACvC,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,qBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,aAAa,UAAU,GAChD,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,wBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,CAAC,aAAa,UAAU,GACjD,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,kBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,WAAW,KAAK,QAAQ;EAChC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,OAAO,SAAS,UAAU,GACnD,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,qBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,WAAW,KAAK,QAAQ;EAChC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,CAAC,OAAO,SAAS,UAAU,GACpD,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/seal/src/rules/conditional/present-unless-rules.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Present unless rule - field must be present unless another field equals a specific value
|
|
5
6
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-unless-rules.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"present-unless-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-unless-rules.ts"],"mappings":";;;;;AAOA;;cAAa,iBAAA,EAAmB,UAAU;EACxC,KAAA;EACA,KAAA;EACA,KAAA;AAAA"}
|
|
@@ -2,7 +2,7 @@ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
|
|
|
2
2
|
import { getFieldValue } from "../../helpers/get-field-value.mjs";
|
|
3
3
|
import "../../helpers/index.mjs";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../../packages/seal/src/rules/conditional/present-unless-rules.ts
|
|
6
6
|
/**
|
|
7
7
|
* Present unless rule - field must be present unless another field equals a specific value
|
|
8
8
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-unless-rules.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"present-unless-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-unless-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Present unless rule - field must be present unless another field equals a specific value\n * Supports both global and sibling scope\n */\nexport const presentUnlessRule: SchemaRule<{\n field: string;\n value: any;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentUnless\",\n description: \"The field must be present unless another field equals a specific value\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { value: expectedValue } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present unless the other field equals the expected value\n if (value === undefined && fieldValue !== expectedValue) {\n this.context.translationParams.value = expectedValue;\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;AAOA,MAAa,oBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAC9C,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,eAAe,eAAe;GACvD,KAAK,QAAQ,kBAAkB,QAAQ;GACvC,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/seal/src/rules/conditional/present-with-rules.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Present with rule - field must be present if another field is present
|
|
5
6
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-with-rules.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"present-with-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-with-rules.ts"],"mappings":";;;;;AAQA;;cAAa,eAAA,EAAiB,UAAU;EACtC,KAAA;EACA,KAAA;AAAA;;;AAAK;AAwBP;cAAa,kBAAA,EAAoB,UAAU;EACzC,MAAA;EACA,KAAA;AAAA;;;;AAAK;cA+BM,kBAAA,EAAoB,UAAU;EACzC,MAAA;EACA,KAAA;AAAA"}
|
|
@@ -3,7 +3,7 @@ import { getFieldValue } from "../../helpers/get-field-value.mjs";
|
|
|
3
3
|
import "../../helpers/index.mjs";
|
|
4
4
|
import { get } from "@mongez/reinforcements";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../../packages/seal/src/rules/conditional/present-with-rules.ts
|
|
7
7
|
/**
|
|
8
8
|
* Present with rule - field must be present if another field is present
|
|
9
9
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-with-rules.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"present-with-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-with-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Present with rule - field must be present if another field is present\n * Supports both global and sibling scope\n */\nexport const presentWithRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWith\",\n description: \"The field must be present if another field is present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // The field must be present if the other field is present\n if (value === undefined && fieldValue !== undefined) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present with all rule - field must be present if all specified fields are present\n * Supports both global and sibling scope\n */\nexport const presentWithAllRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithAll\",\n description: \"The field must be present if all specified fields are present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if all fields are present\n const allPresent = fields.every((field) => get(source, field) !== undefined);\n\n // Field must be present if all other fields are present\n if (value === undefined && allPresent) {\n fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present with any rule - field must be present if any of the specified fields is present\n * Supports both global and sibling scope\n */\nexport const presentWithAnyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithAny\",\n description: \"The field must be present if any of the specified fields is present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if any field is present\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\n\n // Field must be present if any other field is present\n if (value === undefined && anyPresent) {\n fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,kBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,qBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,UAAU,UAAa,YAAY;GACrC,OAAO,SAAS,UAAU;IACxB,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GAED,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,qBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,UAAU,UAAa,YAAY;GACrC,OAAO,SAAS,UAAU;IACxB,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GAED,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/seal/src/rules/conditional/present-without-rules.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Present without rule - field must be present if another field is missing
|
|
5
6
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-without-rules.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"present-without-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-without-rules.ts"],"mappings":";;;;;AAQA;;cAAa,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,KAAA;AAAA;;;AAAK;AAwBP;cAAa,qBAAA,EAAuB,UAAU;EAC5C,MAAA;EACA,KAAA;AAAA;;;;AAAK;cA+BM,qBAAA,EAAuB,UAAU;EAC5C,MAAA;EACA,KAAA;AAAA"}
|
|
@@ -3,7 +3,7 @@ import { getFieldValue } from "../../helpers/get-field-value.mjs";
|
|
|
3
3
|
import "../../helpers/index.mjs";
|
|
4
4
|
import { get } from "@mongez/reinforcements";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../../packages/seal/src/rules/conditional/present-without-rules.ts
|
|
7
7
|
/**
|
|
8
8
|
* Present without rule - field must be present if another field is missing
|
|
9
9
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present-without-rules.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"present-without-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-without-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Present without rule - field must be present if another field is missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithout\",\n description: \"The field must be present if another field is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present if the other field is missing\n if (value === undefined && fieldValue === undefined) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present without all rule - field must be present if all specified fields are missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutAllRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithoutAll\",\n description: \"The field must be present if all specified fields are missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if all fields are missing\n const allMissing = fields.every((field) => get(source, field) === undefined);\n\n // Field must be present if all other fields are missing\n if (value === undefined && allMissing) {\n fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present without any rule - field must be present if any of the specified fields is missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutAnyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithoutAny\",\n description: \"The field must be present if any of the specified fields is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if any field is missing\n const anyMissing = fields.some((field) => get(source, field) === undefined);\n\n // Field must be present if any other field is missing\n if (value === undefined && anyMissing) {\n fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,qBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,wBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,UAAU,UAAa,YAAY;GACrC,OAAO,SAAS,UAAU;IACxB,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GAED,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,wBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,UAAU,UAAa,YAAY;GACrC,OAAO,SAAS,UAAU;IACxB,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GAED,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SchemaRule } from "../../types/rule-types.mjs";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/seal/src/rules/conditional/required-if-rules.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Required if rule - field is required if another field equals a specific value
|
|
5
6
|
* Supports both global and sibling scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"required-if-rules.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"required-if-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-if-rules.ts"],"mappings":";;;;;AASA;;cAAa,cAAA,EAAgB,UAAU;EACrC,KAAA;EACA,KAAA;EACA,KAAA;AAAA;;;AAAK;AAyBP;cAAa,mBAAA,EAAqB,UAAU;EAC1C,KAAA;EACA,KAAA;AAAA;;;;AAAK;cAwBM,sBAAA,EAAwB,UAAU;EAC7C,KAAA;EACA,KAAA;AAAA;;;;;cAwBW,gBAAA,EAAkB,UAAU;EACvC,KAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;cA0BW,mBAAA,EAAqB,UAAU;EAC1C,KAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;cAsCW,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA;;;;;cA2BW,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA;AAFF;;;;AAAA,cA6Ba,yBAAA,EAA2B,UAAU;EAChD,MAAA;EACA,KAAA;AAAA;AA7BK;AA2BP;;;AA3BO,cAwDM,yBAAA,EAA2B,UAAU;EAChD,MAAA;EACA,KAAA;AAAA"}
|
|
@@ -4,7 +4,7 @@ import { getFieldValue } from "../../helpers/get-field-value.mjs";
|
|
|
4
4
|
import "../../helpers/index.mjs";
|
|
5
5
|
import { get } from "@mongez/reinforcements";
|
|
6
6
|
|
|
7
|
-
//#region
|
|
7
|
+
//#region ../../packages/seal/src/rules/conditional/required-if-rules.ts
|
|
8
8
|
/**
|
|
9
9
|
* Required if rule - field is required if another field equals a specific value
|
|
10
10
|
* Supports both global and sibling scope
|