Skip to content

Releases: unleashy/vahv

v0.5.0

02 May 22:38
72927bd
Compare
Choose a tag to compare

Added

  • Several internal types are now exported
  • ParserError to represent errors from the err function

Changed

  • BREAKING CHANGES:
    • ParserResult errors changed; now they take a generic E type to define
      their error property. No code changes are needed if your custom parsers
      only use the err function.
    • Instead of throwing on failure, schema now returns a ParserResult
      object. See README.md for details.

Removed

  • BREAKING CHANGES:
    • Drop support for async validation: AsyncParser removed, SyncParser
      renamed to just Parser.
    • ValidationError removed.

v0.4.0

02 May 07:34
e238dc1
Compare
Choose a tag to compare

Changed

  • Updated project to modern standards, using unbuild, vitest, modern eslint,
    etc.
  • BREAKING CHANGES:
    • This package is ESM-only now and requires Node ^20.

v0.3.2

02 Jun 03:16
20a9f13
Compare
Choose a tag to compare

Changed

  • Fix wrong return type of err

v0.3.1

02 Jun 03:15
87f45c6
Compare
Choose a tag to compare

Changed

  • Improved typing for and; now message functions are properly typed

v0.3.0

31 May 20:58
1c16fde
Compare
Choose a tag to compare

Added

  • ValidationError, thrown when a validation error occurs.
  • Infer<S> takes a SchemaParser and returns the final parsed structure.
  • trim is a transformer that trims both ends of a given string.
  • defaultTo is a transformer that applies a default value if necessary.

Changed

  • BREAKING CHANGES:
    • Vahv now uses a parsing
      methodology rather than a validation one. Thus, there are many breaking
      changes.
    • and is now always async and can always take async
      parsers.
    • Validator and AsyncValidator have been renamed to SyncParser and
      AsyncParser respectively. Parser now refers to an union of SyncParser
      and AsyncParser.
    • schema’s returned function now returns the parsed contents of the given
      data object. If there is a validation error, it throws ValidationError.
    • The internal file structure has changed.
  • The messages object may not be exhaustive with regard to the given parsers
    anymore, because then you'd need to give error messages for transformers. If
    an error message is missing, an error will be thrown at runtime.
  • Development dependencies have been upgraded to their latest version.

Removed

  • BREAKING CHANGE: asyncAnd has been removed. Use and instead.

v0.2.0

07 Oct 02:11
71a1b0c
Compare
Choose a tag to compare

Added

  • A CHANGELOG file.
  • asyncAnd, a validator that can receive sync and async validators alike.
    Always returns an async validator.

Changed

  • schema now returns a Promise, resolving to a validation result.
  • Validator functions can now return a Promise resolving to a validation result.
    These are async validators. Note that and can only receive sync validators;
    use asyncAnd to compose async validators.

v0.1.0

06 Oct 22:34
a2b7d96
Compare
Choose a tag to compare

Added

  • Vahv itself! This is its first release.