@warlock.js/seal 5.29.0 → 5.31.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 +59 -0
- package/README.md +58 -8
- package/cjs/index.cjs +58 -43
- package/cjs/index.cjs.map +1 -1
- package/cjs/{object-DubGC-xu.cjs → object-VTtA-k1a.cjs} +23 -19
- package/cjs/object-VTtA-k1a.cjs.map +1 -0
- package/cjs/object.cjs +2 -2
- package/cjs/{required-methods-BOVNRtci.cjs → required-methods-chT0TXQS.cjs} +197 -92
- package/cjs/required-methods-chT0TXQS.cjs.map +1 -0
- package/cjs/{string-DpDpgefH.cjs → string-edcPIpcU.cjs} +8 -8
- package/cjs/string-edcPIpcU.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 +13 -13
- package/esm/factory/validators.d.mts.map +1 -1
- package/esm/factory/validators.mjs +8 -2
- 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 +3 -3
- package/esm/mutators/string-mutators.mjs.map +1 -1
- package/esm/object.d.mts +2 -4
- 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 +9 -2
- package/esm/rules/core/union.d.mts.map +1 -1
- package/esm/rules/core/union.mjs +59 -11
- 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 +22 -5
- 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 +11 -2
- 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 +4 -4
- package/esm/validators/array-validator.mjs.map +1 -1
- package/esm/validators/base-validator.d.mts +10 -3
- package/esm/validators/base-validator.d.mts.map +1 -1
- package/esm/validators/base-validator.mjs +67 -18
- 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 +5 -5
- 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 +7 -2
- 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 +2 -2
- 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 +14 -10
- 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 +4 -4
- 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 +4 -4
- package/esm/validators/tuple-validator.mjs.map +1 -1
- package/esm/validators/union-validator.d.mts +4 -2
- package/esm/validators/union-validator.d.mts.map +1 -1
- package/esm/validators/union-validator.mjs +4 -2
- package/esm/validators/union-validator.mjs.map +1 -1
- package/llms-full.txt +664 -533
- package/llms.txt +1 -1
- package/package.json +3 -2
- package/skills/bridge-standard-schema/SKILL.md +60 -36
- package/skills/compose-seal-modifiers/SKILL.md +89 -53
- package/skills/define-structural-shape/SKILL.md +41 -27
- package/skills/define-structural-shape/array-methods.md +27 -27
- package/skills/define-structural-shape/object-methods.md +38 -30
- package/skills/extend-seal-with-plugins/SKILL.md +39 -5
- package/skills/generate-json-schema/SKILL.md +13 -13
- package/skills/handle-seal-errors/SKILL.md +26 -28
- package/skills/index.md +4 -1
- package/skills/overview/SKILL.md +10 -2
- package/skills/pick-seal-primitive/SKILL.md +49 -45
- package/skills/pick-seal-primitive/date-methods.md +96 -96
- package/skills/pick-seal-primitive/number-methods.md +55 -55
- package/skills/pick-seal-primitive/string-methods.md +107 -102
- package/skills/seal-basics/SKILL.md +15 -15
- 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
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,64 @@ All notable changes to `@warlock.js/seal` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.31.0 - 2026-10-18
|
|
8
|
+
|
|
9
|
+
### Upgrading
|
|
10
|
+
|
|
11
|
+
- **BREAKING:** a failed `v.union(...)` reports the closest member's errors at their own paths (`actor.id` instead of `actor`), still typed `union`; with `firstErrorOnly: false` it reports each of that member's errors separately instead of one `;`-joined message from every member. A custom union message, or a value no member can hold by type, still gives one error at the union's path. Update code that reads union errors by path or splits the joined message.
|
|
12
|
+
- **BREAKING:** `.refine()` now runs against successful output after child validation and transformers, and skips absent/null or invalid values. Callbacks are typed from the validator's output instead of `any`. Move checks that need input before child validation to `.addRule()`. `warlock upgrade --from 5.30 --to 5.31.0` lists every `.refine()` to review (codemod `seal-refine-output`).
|
|
13
|
+
- **BREAKING:** `.catch()` is a no-op on container validators, including failures in the container's own rules. Inputs previously accepted by an array/object catch after a length or unknown-key error now fail. Apply catches to child validators or handle a failed container result explicitly. `warlock upgrade --from 5.30 --to 5.31.0` lists `.catch()` calls on containers (codemod `seal-container-catch`).
|
|
14
|
+
- **BREAKING:** `v.union()` now returns its matched branch's validated output. Trimming and date parsing change values; object defaults/computed fields are retained, stripped unknown keys disappear, and an explicit `undefined` output drops the containing object field. Persisted, compared or serialized output can differ. Read and keep the raw input before validation when you need it. `warlock upgrade --from 5.30 --to 5.31.0` lists every `v.union()` to review (codemod `seal-union-output`).
|
|
15
|
+
- Refinements now also check successful empty defaults such as `.default("")`; callbacks that reject those defaults now reject validation.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Object factories return their already typed class directly, avoiding a duplicate Standard Schema intersection and reducing compiler work for composed schemas. CI now checks the Seal inference benchmark against its updated baseline.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- `v.union(...)` tries every member whose type matches before failing, so a union of several object schemas accepts a value that matches a later member; `firstErrorOnly` limits the errors reported, not the members tried. A failing union reports its closest member: fewest mismatched literals, then fewest errors, then the deepest error path, then declaration order.
|
|
24
|
+
- A failing union no longer stores its last member error on the shared rule, so a later validation with no type-matching member reports the default message instead of a stale one.
|
|
25
|
+
- The custom-error locale example is strict JSON, with its filename outside the code fence.
|
|
26
|
+
- Standalone string replacement mutators accept an omitted context or options and preserve the stringified input instead of throwing.
|
|
27
|
+
- Object `.merge()` retains refinements from both schemas, in their original order; cloning, extending and selecting fields preserve the original schema's refinements.
|
|
28
|
+
- Union and record Standard Schema types now distinguish child input from validated output; `Infer.Output` reads the Standard Schema output parameter. Defaults and catches remain guaranteed in output.
|
|
29
|
+
- Object, array, tuple and lazy Standard Schema output declarations preserve child defaults and catches independently of their input types.
|
|
30
|
+
- `v.tuple([...])` infers one type per position: `v.tuple([v.string(), v.int()])` is typed `[string, number]` for input and output instead of `(string | number)[]`, so a value with swapped positions no longer type-checks. A `BaseValidator[]` variable is still accepted.
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- A failed rule result may carry `errors: [{ error, path }]` to report several errors, each at its own path, under the rule's type.
|
|
35
|
+
- Successful custom rules may return a `data` property to replace the current validated value, including explicit `undefined`; omitting the property preserves the value.
|
|
36
|
+
|
|
37
|
+
## 5.30.0 - 2026-10-16
|
|
38
|
+
|
|
39
|
+
### Upgrading
|
|
40
|
+
|
|
41
|
+
- **BREAKING (types only):** `validate()` now returns a result narrowed on `isValid`. On success `data` is `Infer.Output<typeof schema>`, on failure it is `undefined`. Code that read `result.data` without checking `isValid`, or assigned it to an unrelated type, may need a check or a cast. A schema typed as bare `BaseValidator`/`ObjectValidator` keeps `data: any`. `warlock upgrade --from 5.29 --to 5.31.0` lists `validate()` results read without an `isValid` check (codemod `seal-validate-result`).
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- `TypedValidationResult<T>` and `ValidatedOutput<T>` types.
|
|
46
|
+
- `pnpm bench:types` measures inference compile cost on a generated composed-schema project (16 entities, 8 services) and fails when instantiations or types grow more than 5% over `bench/types-baseline.json`. It also fails when it cannot read a metric or is given a malformed option, warns when the TypeScript version differs from the baseline's (`--strict` makes that a failure), and removes its temporary project on Ctrl+C.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- `validate()` takes `data: unknown` instead of `any`.
|
|
51
|
+
- `Infer.Input`/`Infer.Output` of an object is one flat object type instead of an intersection of its optional and required halves; the shape is unchanged and compile cost moves by 0.1%.
|
|
52
|
+
- `pnpm typecheck` now also checks the `expectTypeOf` assertions in `tests/unit/types/` (`tsconfig.typecheck.json`); they were never enforced before.
|
|
53
|
+
- `.refine()` callbacks stay `value: any` on purpose: custom rules run before an object or array validates its children, so the value is not the schema output.
|
|
54
|
+
- **Behaviour change:** `v.union([...])` now checks a present empty value (`""`) against its members instead of accepting it unchecked; a missing key is still the required/`.optional()` question. `v.union([v.literal("x"), v.int()]).present()` now rejects `""`.
|
|
55
|
+
- `validate()` keeps the typed output of `v.record(...)` (`Record<string, …>`); only an index signature over `any`/`unknown` (the wide `Schema`) stays `any`.
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- `v.literal("")` accepts a present `""` again (regressed in 5.25): its default (implicit) required state and `.present()` keep it, `.optional()` and `.nullable()` no longer drop it. An explicit `.required()` or `requiredIf(...)` still rejects `""`. A literal set without a blank value still reads `""` as missing.
|
|
60
|
+
- A field with an empty default (`v.string().max(n).default("")`) no longer fails "is required" when the input omits it, sends `null`, or sends a blank string (an untouched HTML input); the output is the default.
|
|
61
|
+
- A `null` default no longer satisfies "required" on a field that is not `.nullable()`, and an empty default of the wrong type (`v.int().default("")`) now fails the type rule instead of being returned unchecked.
|
|
62
|
+
- `v.discriminatedUnion(...).optional()` accepts an absent, `undefined` or `null` field, as every other validator does; `.default(...)` replaces `null` too and is validated through its branch. A required union reports a missing or `null` field with the `required` error; `.nullable()` keeps `null`.
|
|
63
|
+
- `schema["~standard"].validate(...)` on a discriminated union resolves to the branch output union instead of `unknown`.
|
|
64
|
+
|
|
7
65
|
## 5.29.0 - 2026-10-01
|
|
8
66
|
|
|
9
67
|
### Changed
|
|
@@ -84,6 +142,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
84
142
|
### Changed
|
|
85
143
|
|
|
86
144
|
- Lockstep release maintenance and dependency refresh.
|
|
145
|
+
|
|
87
146
|
## 5.20.0 - 2026-09-24
|
|
88
147
|
|
|
89
148
|
### Changed
|
package/README.md
CHANGED
|
@@ -181,17 +181,57 @@ const schema = v.object({
|
|
|
181
181
|
});
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
### Union and record output types
|
|
185
|
+
|
|
186
|
+
`v.union(...)` and `v.record(...)` expose separate Standard Schema input and output
|
|
187
|
+
types. `Infer.Output` and `~standard.validate()` describe validated child output:
|
|
188
|
+
defaults and catches guarantee fields even when callers may omit them. A union
|
|
189
|
+
returns its matching branch's validated data, including computed fields and child
|
|
190
|
+
transformers, before running its own transformers and refinements.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
const entry = v.object({ count: v.int().optional().default(1) });
|
|
194
|
+
const union = v.union([entry, v.string()]);
|
|
195
|
+
const record = v.record(entry);
|
|
196
|
+
// Infer.Input<typeof union>: { count?: number } | string
|
|
197
|
+
// Infer.Output<typeof union>: { count: number } | string
|
|
198
|
+
// Infer.Output<typeof record>: Record<string, { count: number }>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Upgrading:** union output now includes member trimming, date parsing, defaults,
|
|
202
|
+
computed fields and unknown-key stripping. A member that outputs `undefined`
|
|
203
|
+
causes the containing object field to be omitted. This can change stored,
|
|
204
|
+
compared or serialized values. Keep any raw input you need before validation.
|
|
205
|
+
|
|
184
206
|
### ✅ Custom Validation
|
|
185
207
|
|
|
186
208
|
Add your own validation logic:
|
|
187
209
|
|
|
188
210
|
```typescript
|
|
189
|
-
v.string().refine(async value => {
|
|
211
|
+
v.string().refine(async (value) => {
|
|
190
212
|
const exists = await checkUsername(value);
|
|
191
213
|
if (exists) return "Username already taken";
|
|
192
214
|
});
|
|
193
215
|
```
|
|
194
216
|
|
|
217
|
+
The callback's `value` is typed from the validator's output. Refinements run after value rules, child validation (including defaults and computed fields), and output transformers succeed. They skip absent/null values and failed validation, even with `firstErrorOnly: false`. Multiple refinements run in declaration order and respect `firstErrorOnly`. Use `.addRule()` for checks that need the input before child validation.
|
|
218
|
+
|
|
219
|
+
Refinements also run on successful empty defaults such as `.default("")`. Object
|
|
220
|
+
`.merge()` appends refinements from the merged schema; `.extend()` imports only
|
|
221
|
+
its fields and retains the receiver's refinements. Other clone/field-selection
|
|
222
|
+
operations keep the receiver's refinements, so callbacks must tolerate any fields
|
|
223
|
+
you remove from the shape.
|
|
224
|
+
|
|
225
|
+
Output transformer types are not fully tracked yet: for example,
|
|
226
|
+
`v.date().toISOString()` returns a string at runtime while its declared output
|
|
227
|
+
remains `Date`. Use a Date input rule or convert the Date after validation when
|
|
228
|
+
a refinement needs Date methods. Chaining `.refine()` before `.toISOString()`
|
|
229
|
+
does not change execution order.
|
|
230
|
+
|
|
231
|
+
A successful `.addRule()` callback may return `{ isValid: true, data: replacement }`
|
|
232
|
+
to replace the value for later rules, transformers and refinements. Omitting `data`
|
|
233
|
+
keeps the current value; including `data: undefined` explicitly clears it.
|
|
234
|
+
|
|
195
235
|
### ✅ Mutators & Transformers
|
|
196
236
|
|
|
197
237
|
Normalize input and format output:
|
|
@@ -302,19 +342,14 @@ const bookingSchema = v.object({
|
|
|
302
342
|
### Array Validation
|
|
303
343
|
|
|
304
344
|
```typescript
|
|
305
|
-
const tagsSchema = v
|
|
306
|
-
.array(v.string())
|
|
307
|
-
.required()
|
|
308
|
-
.minLength(1)
|
|
309
|
-
.maxLength(10)
|
|
310
|
-
.unique();
|
|
345
|
+
const tagsSchema = v.array(v.string()).required().minLength(1).maxLength(10).unique();
|
|
311
346
|
|
|
312
347
|
const usersSchema = v
|
|
313
348
|
.array(
|
|
314
349
|
v.object({
|
|
315
350
|
name: v.string().required(),
|
|
316
351
|
email: v.string().email(),
|
|
317
|
-
})
|
|
352
|
+
}),
|
|
318
353
|
)
|
|
319
354
|
.minLength(1);
|
|
320
355
|
```
|
|
@@ -380,6 +415,21 @@ The documentation includes:
|
|
|
380
415
|
|
|
381
416
|
---
|
|
382
417
|
|
|
418
|
+
## Type inference compiler budget
|
|
419
|
+
|
|
420
|
+
From `packages/seal`, run `pnpm bench:types --check` to compile a deterministic
|
|
421
|
+
fixture of 16 composed entities and 8 services. CI runs the same check when Seal
|
|
422
|
+
is selected. It rejects compiler errors and growth above 5% in instantiations or
|
|
423
|
+
types; memory and elapsed time are recorded for context. Object factories use the
|
|
424
|
+
class's existing input/output generics directly, avoiding a duplicate Standard
|
|
425
|
+
Schema intersection on every nested object.
|
|
426
|
+
|
|
427
|
+
After reviewing a deliberate change, refresh the baseline with
|
|
428
|
+
`node scripts/bench-types.mjs --update`. Keep fixture sizes and TypeScript versions
|
|
429
|
+
the same when comparing counts.
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
383
433
|
## 📄 License
|
|
384
434
|
|
|
385
435
|
MIT
|
package/cjs/index.cjs
CHANGED
|
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
}) : target, mod));
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
const require_required_methods = require('./required-methods-
|
|
30
|
-
const require_object = require('./object-
|
|
31
|
-
const require_string = require('./string-
|
|
29
|
+
const require_required_methods = require('./required-methods-chT0TXQS.cjs');
|
|
30
|
+
const require_object = require('./object-VTtA-k1a.cjs');
|
|
31
|
+
const require_string = require('./string-edcPIpcU.cjs');
|
|
32
32
|
let _mongez_reinforcements = require("@mongez/reinforcements");
|
|
33
33
|
let _mongez_supportive_is = require("@mongez/supportive-is");
|
|
34
34
|
let dayjs = require("dayjs");
|
|
35
35
|
dayjs = __toESM(dayjs, 1);
|
|
36
36
|
|
|
37
|
-
//#region
|
|
37
|
+
//#region ../../packages/seal/src/validators/any-validator.ts
|
|
38
38
|
/**
|
|
39
39
|
* Any validator - accepts any value
|
|
40
40
|
*/
|
|
@@ -64,7 +64,7 @@ var AnyValidator = class extends require_required_methods.BaseValidator {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
//#endregion
|
|
67
|
-
//#region
|
|
67
|
+
//#region ../../packages/seal/src/mutators/array-mutators.ts
|
|
68
68
|
/** Reverse array order */
|
|
69
69
|
const flipArrayMutator = async (value) => {
|
|
70
70
|
return value.reverse();
|
|
@@ -99,7 +99,7 @@ const removeEmptyArrayElementsMutator = async (value) => {
|
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
//#endregion
|
|
102
|
-
//#region
|
|
102
|
+
//#region ../../packages/seal/src/rules/scalar/accepted-rule.ts
|
|
103
103
|
/**
|
|
104
104
|
* The full set of values treated as "accepted" by `acceptedRule` and its
|
|
105
105
|
* conditional variants. Shared with `formBooleanMutator` (see
|
|
@@ -215,7 +215,7 @@ const acceptedWithoutRule = {
|
|
|
215
215
|
};
|
|
216
216
|
|
|
217
217
|
//#endregion
|
|
218
|
-
//#region
|
|
218
|
+
//#region ../../packages/seal/src/rules/scalar/declined-rule.ts
|
|
219
219
|
/**
|
|
220
220
|
* The full set of values treated as "declined" by `declinedRule` and its
|
|
221
221
|
* conditional variants. Shared with `formBooleanMutator` (see
|
|
@@ -331,7 +331,7 @@ const declinedWithoutRule = {
|
|
|
331
331
|
};
|
|
332
332
|
|
|
333
333
|
//#endregion
|
|
334
|
-
//#region
|
|
334
|
+
//#region ../../packages/seal/src/mutators/boolean-mutators.ts
|
|
335
335
|
/**
|
|
336
336
|
* Coerce a query-string-shaped boolean into a real boolean.
|
|
337
337
|
*
|
|
@@ -366,7 +366,7 @@ const formBooleanMutator = async (value) => {
|
|
|
366
366
|
};
|
|
367
367
|
|
|
368
368
|
//#endregion
|
|
369
|
-
//#region
|
|
369
|
+
//#region ../../packages/seal/src/mutators/date-mutators.ts
|
|
370
370
|
/**
|
|
371
371
|
* Convert value to Date object
|
|
372
372
|
* Returns Invalid Date if value cannot be converted
|
|
@@ -475,7 +475,7 @@ const toEndOfYearMutator = async (value) => {
|
|
|
475
475
|
};
|
|
476
476
|
|
|
477
477
|
//#endregion
|
|
478
|
-
//#region
|
|
478
|
+
//#region ../../packages/seal/src/mutators/number-mutators.ts
|
|
479
479
|
/** Convert value to number */
|
|
480
480
|
const numberMutator = async (value) => {
|
|
481
481
|
if (!value) return value;
|
|
@@ -531,14 +531,14 @@ const toFixedMutator = async (value, context) => {
|
|
|
531
531
|
};
|
|
532
532
|
|
|
533
533
|
//#endregion
|
|
534
|
-
//#region
|
|
534
|
+
//#region ../../packages/seal/src/mutators/scalar-mutators.ts
|
|
535
535
|
const stringMutator = async (value) => {
|
|
536
536
|
if ([void 0, null].includes(value)) return value;
|
|
537
537
|
return String(value);
|
|
538
538
|
};
|
|
539
539
|
|
|
540
540
|
//#endregion
|
|
541
|
-
//#region
|
|
541
|
+
//#region ../../packages/seal/src/validators/array-validator.ts
|
|
542
542
|
/**
|
|
543
543
|
* Array validator class
|
|
544
544
|
*/
|
|
@@ -650,7 +650,7 @@ var ArrayValidator = class extends require_required_methods.BaseValidator {
|
|
|
650
650
|
async validate(data, context) {
|
|
651
651
|
const valueForRules = data ?? this.getDefaultValue();
|
|
652
652
|
const mutatedData = await this.mutate(valueForRules, context);
|
|
653
|
-
const result = await
|
|
653
|
+
const result = await this.validateRules(data, context);
|
|
654
654
|
if (result.isValid === false) return result;
|
|
655
655
|
if (mutatedData === void 0 || mutatedData === null) return result;
|
|
656
656
|
if (!Array.isArray(mutatedData)) return result;
|
|
@@ -668,11 +668,11 @@ var ArrayValidator = class extends require_required_methods.BaseValidator {
|
|
|
668
668
|
if (childResult.isValid === false) errors.push(...childResult.errors);
|
|
669
669
|
});
|
|
670
670
|
await Promise.all(validationPromises);
|
|
671
|
-
return {
|
|
671
|
+
return this.refineResult({
|
|
672
672
|
isValid: errors.length === 0,
|
|
673
673
|
errors,
|
|
674
674
|
data: await this.startTransformationPipeline(mutatedData, context)
|
|
675
|
-
};
|
|
675
|
+
}, context);
|
|
676
676
|
}
|
|
677
677
|
/**
|
|
678
678
|
* @inheritdoc
|
|
@@ -710,7 +710,7 @@ var ArrayValidator = class extends require_required_methods.BaseValidator {
|
|
|
710
710
|
};
|
|
711
711
|
|
|
712
712
|
//#endregion
|
|
713
|
-
//#region
|
|
713
|
+
//#region ../../packages/seal/src/validators/boolean-validator.ts
|
|
714
714
|
/**
|
|
715
715
|
* Boolean validator class
|
|
716
716
|
*
|
|
@@ -874,7 +874,7 @@ var BooleanValidator = class extends require_string.PrimitiveValidator {
|
|
|
874
874
|
};
|
|
875
875
|
|
|
876
876
|
//#endregion
|
|
877
|
-
//#region
|
|
877
|
+
//#region ../../packages/seal/src/validators/date-validator.ts
|
|
878
878
|
/**
|
|
879
879
|
* Date validator class
|
|
880
880
|
*/
|
|
@@ -1495,7 +1495,7 @@ var DateValidator = class extends require_required_methods.BaseValidator {
|
|
|
1495
1495
|
};
|
|
1496
1496
|
|
|
1497
1497
|
//#endregion
|
|
1498
|
-
//#region
|
|
1498
|
+
//#region ../../packages/seal/src/validators/literal-validator.ts
|
|
1499
1499
|
/**
|
|
1500
1500
|
* Literal validator class
|
|
1501
1501
|
*
|
|
@@ -1513,9 +1513,11 @@ var DateValidator = class extends require_required_methods.BaseValidator {
|
|
|
1513
1513
|
var LiteralValidator = class extends require_required_methods.BaseValidator {
|
|
1514
1514
|
constructor(values, errorMessage) {
|
|
1515
1515
|
super();
|
|
1516
|
-
this.blankIsMissing = true;
|
|
1517
1516
|
this.values = values;
|
|
1518
1517
|
this.addMutableRule(require_required_methods.literalRule, errorMessage, { values });
|
|
1518
|
+
const acceptsBlank = values.some((value) => typeof value === "string" && value.trim() === "");
|
|
1519
|
+
this.blankIsMissing = !acceptsBlank;
|
|
1520
|
+
if (acceptsBlank) this.requiredRule = this.createRule(require_required_methods.presentRule);
|
|
1519
1521
|
}
|
|
1520
1522
|
/**
|
|
1521
1523
|
* Check if value is one of the configured literals
|
|
@@ -1557,7 +1559,7 @@ var LiteralValidator = class extends require_required_methods.BaseValidator {
|
|
|
1557
1559
|
};
|
|
1558
1560
|
|
|
1559
1561
|
//#endregion
|
|
1560
|
-
//#region
|
|
1562
|
+
//#region ../../packages/seal/src/validators/discriminated-union-validator.ts
|
|
1561
1563
|
/** Whether a value read from the payload can be a discriminator key. */
|
|
1562
1564
|
function isDiscriminatorValue(value) {
|
|
1563
1565
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
@@ -1627,6 +1629,11 @@ var DiscriminatedUnionValidator = class DiscriminatedUnionValidator extends requ
|
|
|
1627
1629
|
errors: [],
|
|
1628
1630
|
data: null
|
|
1629
1631
|
};
|
|
1632
|
+
if (data == null) {
|
|
1633
|
+
const fallback = this.getDefaultValue();
|
|
1634
|
+
if (fallback == null) return super.validate(void 0, context);
|
|
1635
|
+
data = fallback;
|
|
1636
|
+
}
|
|
1630
1637
|
if (!(0, _mongez_supportive_is.isPlainObject)(data)) return {
|
|
1631
1638
|
isValid: false,
|
|
1632
1639
|
errors: [{
|
|
@@ -1650,7 +1657,7 @@ var DiscriminatedUnionValidator = class DiscriminatedUnionValidator extends requ
|
|
|
1650
1657
|
data: void 0
|
|
1651
1658
|
};
|
|
1652
1659
|
}
|
|
1653
|
-
return branch.validate(data, context);
|
|
1660
|
+
return this.refineResult(await branch.validate(data, context), context);
|
|
1654
1661
|
}
|
|
1655
1662
|
clone() {
|
|
1656
1663
|
const cloned = super.clone();
|
|
@@ -1679,7 +1686,7 @@ var DiscriminatedUnionValidator = class DiscriminatedUnionValidator extends requ
|
|
|
1679
1686
|
};
|
|
1680
1687
|
|
|
1681
1688
|
//#endregion
|
|
1682
|
-
//#region
|
|
1689
|
+
//#region ../../packages/seal/src/validators/number-validator.ts
|
|
1683
1690
|
/**
|
|
1684
1691
|
* Number validator class - base for Int and Float validators
|
|
1685
1692
|
*/
|
|
@@ -1999,7 +2006,7 @@ var NumberValidator = class extends require_string.PrimitiveValidator {
|
|
|
1999
2006
|
};
|
|
2000
2007
|
|
|
2001
2008
|
//#endregion
|
|
2002
|
-
//#region
|
|
2009
|
+
//#region ../../packages/seal/src/validators/float-validator.ts
|
|
2003
2010
|
/**
|
|
2004
2011
|
* Float validator class
|
|
2005
2012
|
*/
|
|
@@ -2011,7 +2018,7 @@ var FloatValidator = class extends NumberValidator {
|
|
|
2011
2018
|
};
|
|
2012
2019
|
|
|
2013
2020
|
//#endregion
|
|
2014
|
-
//#region
|
|
2021
|
+
//#region ../../packages/seal/src/validators/instanceof-validator.ts
|
|
2015
2022
|
/**
|
|
2016
2023
|
* InstanceOf validator class
|
|
2017
2024
|
*
|
|
@@ -2069,7 +2076,7 @@ var InstanceOfValidator = class extends require_required_methods.BaseValidator {
|
|
|
2069
2076
|
};
|
|
2070
2077
|
|
|
2071
2078
|
//#endregion
|
|
2072
|
-
//#region
|
|
2079
|
+
//#region ../../packages/seal/src/validators/int-validator.ts
|
|
2073
2080
|
/**
|
|
2074
2081
|
* Integer validator class
|
|
2075
2082
|
*/
|
|
@@ -2093,7 +2100,7 @@ var IntValidator = class extends NumberValidator {
|
|
|
2093
2100
|
};
|
|
2094
2101
|
|
|
2095
2102
|
//#endregion
|
|
2096
|
-
//#region
|
|
2103
|
+
//#region ../../packages/seal/src/validators/lazy-validator.ts
|
|
2097
2104
|
/**
|
|
2098
2105
|
* Lazy validator — defers resolution of the inner validator until validate-time.
|
|
2099
2106
|
*
|
|
@@ -2150,7 +2157,7 @@ var LazyValidator = class extends require_required_methods.BaseValidator {
|
|
|
2150
2157
|
return this.resolvedValidator;
|
|
2151
2158
|
}
|
|
2152
2159
|
async validate(data, context) {
|
|
2153
|
-
return this.resolve().validate(data, context);
|
|
2160
|
+
return this.refineResult(await this.resolve().validate(data, context), context);
|
|
2154
2161
|
}
|
|
2155
2162
|
matchesType(value) {
|
|
2156
2163
|
return this.resolve().matchesType(value);
|
|
@@ -2174,7 +2181,7 @@ var LazyValidator = class extends require_required_methods.BaseValidator {
|
|
|
2174
2181
|
};
|
|
2175
2182
|
|
|
2176
2183
|
//#endregion
|
|
2177
|
-
//#region
|
|
2184
|
+
//#region ../../packages/seal/src/validators/managed-validator.ts
|
|
2178
2185
|
/**
|
|
2179
2186
|
* Managed field validator
|
|
2180
2187
|
*
|
|
@@ -2209,7 +2216,7 @@ var ManagedValidator = class extends require_object.ComputedValidator {
|
|
|
2209
2216
|
};
|
|
2210
2217
|
|
|
2211
2218
|
//#endregion
|
|
2212
|
-
//#region
|
|
2219
|
+
//#region ../../packages/seal/src/validators/numeric-validator.ts
|
|
2213
2220
|
/**
|
|
2214
2221
|
* Numeric validator class - base for Int and Float validators either as number or string
|
|
2215
2222
|
*/
|
|
@@ -2230,7 +2237,7 @@ var NumericValidator = class extends NumberValidator {
|
|
|
2230
2237
|
};
|
|
2231
2238
|
|
|
2232
2239
|
//#endregion
|
|
2233
|
-
//#region
|
|
2240
|
+
//#region ../../packages/seal/src/validators/record-validator.ts
|
|
2234
2241
|
/**
|
|
2235
2242
|
* Record validator class - validates objects with dynamic keys and consistent value types
|
|
2236
2243
|
*
|
|
@@ -2281,7 +2288,7 @@ var RecordValidator = class extends require_required_methods.BaseValidator {
|
|
|
2281
2288
|
async validate(data, context) {
|
|
2282
2289
|
const valueForRules = data ?? this.getDefaultValue();
|
|
2283
2290
|
const mutatedData = await this.mutate(valueForRules, context);
|
|
2284
|
-
const result = await
|
|
2291
|
+
const result = await this.validateRules(data, context);
|
|
2285
2292
|
if (result.isValid === false) return result;
|
|
2286
2293
|
if (mutatedData === void 0 || mutatedData === null) return result;
|
|
2287
2294
|
if (!(0, _mongez_supportive_is.isPlainObject)(mutatedData)) return result;
|
|
@@ -2299,11 +2306,11 @@ var RecordValidator = class extends require_required_methods.BaseValidator {
|
|
|
2299
2306
|
if (childResult.isValid === false) errors.push(...childResult.errors);
|
|
2300
2307
|
});
|
|
2301
2308
|
await Promise.all(validationPromises);
|
|
2302
|
-
return {
|
|
2309
|
+
return this.refineResult({
|
|
2303
2310
|
isValid: errors.length === 0,
|
|
2304
2311
|
errors,
|
|
2305
2312
|
data: await this.startTransformationPipeline(mutatedData, context)
|
|
2306
|
-
};
|
|
2313
|
+
}, context);
|
|
2307
2314
|
}
|
|
2308
2315
|
/**
|
|
2309
2316
|
* @inheritdoc
|
|
@@ -2331,7 +2338,7 @@ var RecordValidator = class extends require_required_methods.BaseValidator {
|
|
|
2331
2338
|
};
|
|
2332
2339
|
|
|
2333
2340
|
//#endregion
|
|
2334
|
-
//#region
|
|
2341
|
+
//#region ../../packages/seal/src/validators/scalar-validator.ts
|
|
2335
2342
|
/**
|
|
2336
2343
|
* Scalar validator class
|
|
2337
2344
|
*
|
|
@@ -2491,7 +2498,7 @@ var ScalarValidator = class extends require_string.PrimitiveValidator {
|
|
|
2491
2498
|
};
|
|
2492
2499
|
|
|
2493
2500
|
//#endregion
|
|
2494
|
-
//#region
|
|
2501
|
+
//#region ../../packages/seal/src/validators/tuple-validator.ts
|
|
2495
2502
|
/**
|
|
2496
2503
|
* Tuple validator class - validates fixed-length arrays with position-specific types
|
|
2497
2504
|
*
|
|
@@ -2538,7 +2545,7 @@ var TupleValidator = class extends require_required_methods.BaseValidator {
|
|
|
2538
2545
|
async validate(data, context) {
|
|
2539
2546
|
const valueForRules = data ?? this.getDefaultValue();
|
|
2540
2547
|
const mutatedData = await this.mutate(valueForRules, context);
|
|
2541
|
-
const result = await
|
|
2548
|
+
const result = await this.validateRules(data, context);
|
|
2542
2549
|
if (result.isValid === false) return result;
|
|
2543
2550
|
if (mutatedData === void 0 || mutatedData === null) return result;
|
|
2544
2551
|
if (!Array.isArray(mutatedData)) return result;
|
|
@@ -2568,11 +2575,11 @@ var TupleValidator = class extends require_required_methods.BaseValidator {
|
|
|
2568
2575
|
if (childResult.isValid === false) errors.push(...childResult.errors);
|
|
2569
2576
|
});
|
|
2570
2577
|
await Promise.all(validationPromises);
|
|
2571
|
-
return {
|
|
2578
|
+
return this.refineResult({
|
|
2572
2579
|
isValid: errors.length === 0,
|
|
2573
2580
|
errors,
|
|
2574
2581
|
data: await this.startTransformationPipeline(mutatedData, context)
|
|
2575
|
-
};
|
|
2582
|
+
}, context);
|
|
2576
2583
|
}
|
|
2577
2584
|
/**
|
|
2578
2585
|
* @inheritdoc
|
|
@@ -2615,13 +2622,15 @@ var TupleValidator = class extends require_required_methods.BaseValidator {
|
|
|
2615
2622
|
};
|
|
2616
2623
|
|
|
2617
2624
|
//#endregion
|
|
2618
|
-
//#region
|
|
2625
|
+
//#region ../../packages/seal/src/validators/union-validator.ts
|
|
2619
2626
|
/**
|
|
2620
2627
|
* Union validator class - validates value against multiple validator types
|
|
2621
2628
|
*
|
|
2622
2629
|
* Tries each validator in order until one passes. If a validator's matchesType()
|
|
2623
2630
|
* returns false, it's skipped for optimization. First validator that both matches
|
|
2624
|
-
* the type and passes validation wins
|
|
2631
|
+
* the type and passes validation wins; every type-matching validator is tried,
|
|
2632
|
+
* whatever `firstErrorOnly` says. When none passes, the closest one's errors are
|
|
2633
|
+
* reported (fewest mismatched literals, then fewest errors, then deepest path).
|
|
2625
2634
|
*
|
|
2626
2635
|
* @example
|
|
2627
2636
|
* ```ts
|
|
@@ -2674,7 +2683,7 @@ var UnionValidator = class extends require_required_methods.BaseValidator {
|
|
|
2674
2683
|
};
|
|
2675
2684
|
|
|
2676
2685
|
//#endregion
|
|
2677
|
-
//#region
|
|
2686
|
+
//#region ../../packages/seal/src/factory/validators.ts
|
|
2678
2687
|
/**
|
|
2679
2688
|
* Seal factory object - creates instances of validators
|
|
2680
2689
|
*
|
|
@@ -2689,7 +2698,13 @@ const v = {
|
|
|
2689
2698
|
array: (validator, errorMessage) => new ArrayValidator(validator, errorMessage),
|
|
2690
2699
|
/** Create a record validator - object with dynamic keys and consistent value types */
|
|
2691
2700
|
record: (validator, errorMessage) => new RecordValidator(validator || v.any(), errorMessage),
|
|
2692
|
-
/**
|
|
2701
|
+
/**
|
|
2702
|
+
* Create a tuple validator - fixed-length array with position-specific types.
|
|
2703
|
+
*
|
|
2704
|
+
* The `| []` in the constraint makes TypeScript infer a literal list as a tuple, so
|
|
2705
|
+
* `v.tuple([v.string(), v.int()])` is typed `[string, number]` rather than
|
|
2706
|
+
* `(string | number)[]`; a `BaseValidator[]` variable is still accepted.
|
|
2707
|
+
*/
|
|
2693
2708
|
tuple: (validators, errorMessage) => new TupleValidator(validators, errorMessage),
|
|
2694
2709
|
/** Create a date validator */
|
|
2695
2710
|
date: (errorMessage) => new DateValidator(errorMessage),
|
|
@@ -2778,7 +2793,7 @@ const v = {
|
|
|
2778
2793
|
};
|
|
2779
2794
|
|
|
2780
2795
|
//#endregion
|
|
2781
|
-
//#region
|
|
2796
|
+
//#region ../../packages/seal/src/plugins/plugin-system.ts
|
|
2782
2797
|
/**
|
|
2783
2798
|
* Registry of installed plugins
|
|
2784
2799
|
*/
|