Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update npm packages (major) #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Oct 27, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@types/node (source) ^18 -> ^22.10.5 age adoption passing confidence
@vinejs/vine ^1.4.0 -> ^3.0.0 age adoption passing confidence
vitest (source) ^0.31.4 -> ^2.1.8 age adoption passing confidence

Release Notes

vinejs/vine (@​vinejs/vine)

v3.0.0: Breaking changes and bug fixes

Compare Source

This release contains a few breaking changes along with a handful of new improvements and bug fixes.

Breaking changes
Infer type

The infer type of schema now marks optional fields as optional within the TypeScript types. This ensures the property can be missing altogether from the data object/inferred types vs being marked as undefined explicitly. For example:

// Schema
vine.object({
    username: vine.string(),
    age: vine.number().optional(),
})

// Old output
{
    age: number | undefined;
    username: string;
}

// New output
{
    age?: number | undefined;
    username: string;
}
SUBTYPE symbol

Custom types extending the VineJS BaseLiteralType now must define the symbols.SUBTYPE property on the schema. This property can be used by schema transformers to get a more accurate type for the schema node. Here's how the StringSchema defines the SUBTYPE property.

For example:

import { symbols, BaseLiteralType } from '@​vinejs/vine'

class MySchemaType extends BaseLiteralType<Input, Output, CamelCaseOutput> {
   [symbols.SUBTYPE] = 'multipartFile'
}
Bug Fixes
Features
  • add subtype property to schema output (818fbf0), closes #​64
  • add support for conditional validation in arrays, object, records and tuples (890228e), closes #​71
  • add support for parsing iso8601 dates (fe61951), closes #​65
  • add support for ULID validation (#​58) (02d3a28)
Pull Requests
New Contributors

Full Changelog: vinejs/vine@v2.1.0...v3.0.0

v2.1.0: Add "tryValidate", "toJSON" method and "in" validation rule

Compare Source

tryValidate

The tryValidate method can be used to perform validation without throwing a validation error. Instead, the errors are returned as the return value of the method, which is a tuple.

const [error, result] = validator.tryValidate({ data: {} })

The try prefix is inspired from the Java world.

in

The in validation rule has been added for the VineNumber schema type and can be used to ensure the value of field is part of the allowed values list.

toJSON

The validator.toJSON method can be used to get the validator and its refs as JSON.

Commits

  • feat: add tryValidate method to Vine (a70ff38)
  • feat: add tryValidate method (cebb8e0)
  • fix: add "in" rule in default number rules (#​54) (39204e4)
  • chore: migrate to release-it (0b5e212)
  • feat: add in rule for number (#​53) (72912af)
  • feat: export modifiers (#​48) (34e07fc)
  • chore: update dependencies (a7e18b7)
  • style: reformat codebase (62d450c)
  • feat: add validator.toJSON method to get compiled schema and refs (5259933)

What's Changed

New Contributors

Full Changelog: vinejs/vine@v2.0.0...v2.1.0

v2.0.0: Improved error reporting for fields inside arrays and infer schema input types

Compare Source

This release contains a couple of minor breaking changes. So let's first talk about them.

Improved error reporting for fields inside arrays ( Breaking )

In the previous versions of VineJS, the error reporting for fields inside arrays could have been better.

Given the following schema and data

const schema = vine.object({
  categories: vine.array(vine.number()),
})

const data = {
  categories: [1, 'foo', 'bar', 11],
}

The errors reported up until 2.0 were

{
  field: 'categories.*',
  index: 1,
  message: 'The 1 field must be a number',
  rule: 'number',
},
{
  field: 'categories.*',
  index: 2,
  message: 'The 2 field must be a number',
  rule: 'number',
}

If you notice, the field name inside arrays is defined as categories.* and not the actual index of the item inside the array. Now, you may think that I can replace the * with the index property value and get a nested path to the item index within the array.

Well, the replacement of * might work in this situation. But it will not work when there are errors inside nested arrays or the field that failed the validation is a grandchild of an array. Because the index property only exists when the field is an immediate child of an array.

But anyway, after this release, you do not have to perform any manual substitutions. The field names are nested paths with the correct index. The following is an example of errors with @vinejs/vine@2.

{
  field: 'categories.1',
  index: 1,
  message: 'The 1 field must be a number',
  rule: 'number',
},
{
  field: 'categories.2',
  index: 2,
  message: 'The 2 field must be a number',
  rule: 'number',
}

Infer Schema Input value ( Breaking )

After this release, you can infer the input values a Schema type accepts. Let's consider the following example.

import { InferInput } from '@&#8203;vinejs/vine/types'

const schema = vine.object({
  is_admin: vine.boolean()
})

InferInput<typeof Schema>
{
  is_admin: boolean | string | number
}

If you notice, the is_admin property accepts a boolean | string | number. VineJS is built for parsing form inputs submitted over HTTP. Therefore, it receives all inputs as string values and performs normalization before performing any sort of validation.

Because of this change, the BaseSchema classes accept another generic value for the InputTypes. So, if you use the BaseSchema anywhere in your apps, make sure to pass the Input type as the first generic argument.

Also, please consult this commit for a better understanding of the change. vinejs/vine@df27df8

Define error messages for specific array index or a wildcard ( New feature )

Now, you will be able to define custom error messages for specific array indexes with a wildcard fallback for rest of the indexes. For example:

{
  "contacts.0.email.required": "The primary email address is required",
  "contacts.*.email.required": "The email address is required",
}

Commits

  • style: remove unused type 9dd733c
  • feat: add support for inferring schema input types df27df8
  • feat: improve error reporting for fields inside arrays 3d59dad
  • chore: update dependencies 8ff246f

What's Changed

New Contributors

Full Changelog: vinejs/vine@v1.7.0...v2.0.0

v1.8.0: Add requiredIf rules

Compare Source

Please check docs to learn how requiredIf rules work. And check this PR to understand the difference between vine.union and requiredIf rules.

Commits
  • feat: implement requiredIf rules (#​42) 893d378
  • chore: update dependencies 81beff7
  • docs: update benchmarks (#​40) 21ac492
  • fix: typo on 'Symbol.for('schema_nme') (#​36) d2a03a3
  • Merge pull request #​39 from nakrovati/fix-lolo32-pr ef50170
  • fix: add joi & ajv to devDeps 200bb39
  • Merge branch 'develop' into fix-lolo32-pr 63c49e2
  • Merge pull request #​33 from nakrovati/develop f94d274
  • chore(benchmarks): add valibot 02ff0a5
  • fix(benchmark): use namespace to import yup d6f5589
  • chore(benchmarks): add ajv and joi benchmark libraries ffb2a4e
What's Changed
New Contributors

Full Changelog: vinejs/vine@v1.7.1...v1.8.0

v1.7.1: Bug fix and performance improvements

Compare Source

  • fix: unix timetamp validation with x format bcebea5
  • style: format source code 9dd9d85
  • chore: update dependencies 6e412b2
  • refactor: performance optimizations 3e35b83
  • chore: update dependencies 4c88fa1
  • refactor: dynamic import node:dns 92a48c8

What's Changed

Full Changelog: vinejs/vine@v1.7.0...v1.7.1

v1.7.0: Support for validating dates

Compare Source

This release adds support for validating dates in VineJS. You may check the documentation here. https://vinejs.dev/docs/types/date

The vine.date schema type accepts a string value formatted as a date and returns an instance of the JavaScript Date object. The reason we accept a string is because the data submitted over an HTTP request will always represent date/datetime as a string.

Once you have a date, you may validate it further by comparing it against a fixed value or compare it against values from other fields. You may refer the documentation to view all the available validation rules.

Commits

  • refactor: changes to vine validator options normalization e85356b
  • chore: update list of files to publish e07cb69
  • docs(README): remove snyk badge 1b5c497
  • docs: update github workflow badge url b39b00c
  • chore: pin typescript to 5.2 02c2945
  • feat: add weekday and weekend rules 223bb93
  • feat: add first set of date validation rules c893f10
  • feat: add support for comparing nested values in sameAs and notSameAs rules 628b4c7
  • chore: update dependencies and generate types using tsc ce6c52c
  • chore: update dependencies cf08e2a
  • feat: Serialize messages and fields when converting toJSON 72d098d
  • refactor(SimpleMessagesProperty): make fields property optional (#​18) 16bd6e8
  • Merge pull request #​16 from vinejs/snyk-upgrade-ee4daf504d32e111676c4eb19cecf239 5d2a97a
  • feat: upgrade camelcase from 7.0.1 to 8.0.0 f98e099

v1.6.0: Bundling with tsup

Compare Source

v1.5.3: Use validator.js specific imports

Compare Source

v1.5.2: Export VineValidator class

Compare Source

  • refactor: export VineValidator class cfaeeff
  • style: format source code 74ca7e0
  • chore: update dependencies 9b7bc07

Full Changelog: vinejs/vine@v1.5.1...v1.5.2

v1.5.1: Fix: Make schema classes Macroable to be extensible

Compare Source

  • ci: fix failing tests 2f5258c
  • ci: remove test.yml workflow file 89efc20
  • test: fix failing tests d04800c
  • test: add test for extending Vine class a417418
  • fix: make schema classes Macroable 41bd3d5

Full Changelog: vinejs/vine@v1.5.0...v1.5.1

v1.5.0: Add API to make validation metadata type-safe

Compare Source

In VineJS, you can pass runtime metadata to the validation pipeline, which you can access from the validation rules, union predicates, etc. The metadata API was not type-safe until now. However, this release allows you to define the static metadata types and a validation function to validate them at runtime.

Note: The metadata API is kept very simple because only a few schemas might need runtime metadata with a few properties to be functional.

One example is the unique validation rule. You might want the unique validation rule to check all the database rows except the one for the currently logged-in user. In that case, you will pass the currently logged-in userId to the statically compiled validation schema using metadata as follows.

const updateUserValidator = vine.compile(
  vine.object({
    email: vine.string().email().unique((field) => {
      console.log(field.meta.userId)
    }),
  })
)
await updateUserValidator.validate(data, {
  meta: { userId: request.auth.user.id }
})

However, there is no way to know that updateUserValidator needs the currently logged-in user id to be functional.

From @vinejs/[email protected], you can use the withMetaData method to define static types for the metadata a validator accepts. The schema will look as follows.

const updateUserValidator = vine
  .withMetaData<{ userId: number }>()
  .compile(
    vine.object({
      email: vine.string().email().unique((field) => {
        console.log(field.meta.userId)
      }),
    })
  )

You can pass a callback to withMetaData to validate the metadata at runtime if needed.

vine
  .withMetaData<{ userId: number }>((meta) => {
    // validate id and throw an error
 })

Commits

  • feat: add support for defining static metadata types and validator function 09c4097
  • chore: use @​adonisjs/tooling presets for tooling config a02908d
  • chore: upgrade japa to v3 4181ee4
  • chore: update dependencies f24ebb8
  • chore: add labels to exempt from stale and lock bot 92697c4
  • docs: fix contributing link fcad2fb

Full Changelog: vinejs/vine@v1.4.1...v1.5.0

v1.4.1: Export testing factories

Compare Source

  • fix: export testing factories ffe8279

Full Changelog: vinejs/vine@v1.4.0...v1.4.1

vitest-dev/vitest (vitest)

v2.1.8

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v2.1.7

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v2.1.6

Compare Source

🚀 Features

  • Support VIte 6
    View changes on GitHub

v2.1.5

Compare Source

   🚀 Features
   🐞 Bug Fixes
   🏎 Performance
    View changes on GitHub

v2.1.4

Compare Source

   🚀 Features
   🐞 Bug Fixes
   🏎 Performance
    View changes on GitHub

v2.1.3

Compare Source

   🐞 Bug Fixes
   🏎 Performance
    View changes on GitHub

v2.1.2

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v2.1.1

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v2.1.0

Compare Source

This release makes another big change to the Browser Mode by introducing locators API:

test('renders blog posts', async () => {
  const screen = page.render(<Blog

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

 **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/Barbapapazes/nuxt-vine).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzkuODUuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

@renovate renovate bot changed the title chore(deps): update devdependency @types/node to v20 chore(deps): update npm packages (major) Nov 1, 2023
@renovate renovate bot force-pushed the renovate/major-npm branch 3 times, most recently from 7315773 to 829627f Compare November 8, 2023 03:02
@renovate renovate bot force-pushed the renovate/major-npm branch 5 times, most recently from 1d540f8 to 89bfa92 Compare November 18, 2023 11:20
@renovate renovate bot force-pushed the renovate/major-npm branch 6 times, most recently from 9494663 to 5fa2828 Compare November 25, 2023 08:47
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from f3a9e22 to c602bb2 Compare December 5, 2023 14:58
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 8bdfedd to 62da3f9 Compare December 10, 2023 04:59
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from b5d070d to 3157f06 Compare December 20, 2023 05:07
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from fb77ad2 to 0cc71ab Compare January 6, 2024 05:55
@renovate renovate bot force-pushed the renovate/major-npm branch 3 times, most recently from 5e15297 to 7525070 Compare January 11, 2024 20:38
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from efdd654 to 406bfe2 Compare September 28, 2024 05:46
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 1df3bac to 226ee80 Compare October 8, 2024 02:46
@renovate renovate bot force-pushed the renovate/major-npm branch 3 times, most recently from 6b9decd to bed448b Compare October 19, 2024 05:50
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from 54ae2b9 to 19b0940 Compare October 28, 2024 20:34
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from c59ded8 to 8194a00 Compare November 5, 2024 21:00
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 7e253ef to 30bc096 Compare November 19, 2024 20:45
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from bdd515e to 13c19f3 Compare November 29, 2024 06:01
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 9cb1ebc to 90e63c6 Compare December 4, 2024 05:45
@renovate renovate bot force-pushed the renovate/major-npm branch from 90e63c6 to feb5f08 Compare December 11, 2024 17:32
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 2bc0579 to 94695f9 Compare January 3, 2025 02:21
@renovate renovate bot force-pushed the renovate/major-npm branch from 94695f9 to 201ffd8 Compare January 4, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants