Skip to content

Conversation

@dependabot-preview
Copy link
Contributor

Bumps superstruct from 0.13.1 to 0.14.0.

Changelog

Sourced from superstruct's changelog.

0.14.0 — January 26, 2021

BREAKING

The mask helper now works for nested objects. Previously it would only mask the properties at the top-level of a struct, however now it acts deeply. You can use it to define object structs once, but use them either strictly or loosely.

The masked coercion has been removed. This previously allowed you to mix in masking to a specific struct, but the mask helper is a more robust way to do this, and it doesn't force you to maintain two separate structs.

0.13.0 — December 11, 2020

NEW

Structs can now define an entries iterator for nested values. Previously iterating through nested values was defined in a one-off manner inside certain structs, but this led to non-uniform support. Now, any struct can define an entries iterator that will cause nested values to be automatically coerced and validated.

Coercion receives context objects and supports nested values. Previously context objects were only passed to the validations and refinements. But now the same context is passed to coercions too so you can implement more complex logic. And coercions are automatically applied to nested values thanks to the addition of entries.

Iteration logic has gotten simpler, and more performant. The addition of the entries logic has enabled us to only ever iterate through a tree of values one time for coercion and validation, instead of once each. This should speed up most standard use cases.

BREAKING

The ctx.fail() function has been removed. Previously you'd use it to return more information about a failure inside a struct. Now you can simply return a partial failure object.

The ctx.check() function has been removed. Previously you'd use it to validate nested objects in more complex struct shapes. Now you can use the new entries property for this instead.

The context.struct and context.value properties have been removed. These properties were previously available, but unnecessary since anywhere you have the context object you will also know the value and the specific struct that is being validated. Keeping them around required extra unnecessary plumbing in the library that made composing structs much more difficult so they were removed.

0.12.0 — November 24, 2020

NEW

New Describe utility type. This new utility lets you define a struct from an existing TypeScript type and ensure that the struct's validation matches it, otherwise TypeScript's compiler will error. For example:

type User = {
  id: number
  name: string
}
const User: Describe<User> = object({
id: string(), // This mistake will fail to pass type checking!
name: string(),
})

BREAKING

The coerce helper has changed to be more type-safe! Previously coerce functions were called with value: unknown because they ran before all validation. However, now they take a new second argument that is another struct to narrow the cases where coercions occurs. This means the value for coercion will now be type-safe.

// Previously
</tr></table> 

... (truncated)

Commits
  • c7df7c2 v0.14.0
  • 0081125 update changelog
  • 4f78a9a remove masked coercion, in favor of mask
  • 01b8ee0 make mask() recursive, allow type() pass unknown properties through in mask=t...
  • 140461d Bump eslint-config-prettier from 6.15.0 to 7.2.0 (#625)
  • c8eef6c Bump @typescript-eslint/parser from 4.13.0 to 4.14.0
  • 89702e5 Bump @typescript-eslint/eslint-plugin from 4.13.0 to 4.14.0
  • 9ee2ff1 Bump rollup from 2.36.2 to 2.38.0
  • b6f5283 Bump @types/lodash from 4.14.167 to 4.14.168
  • dc4bde4 Bump @types/node from 14.14.21 to 14.14.22
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

@dependabot-preview dependabot-preview bot added the dependencies Pull requests that update a dependency file label Jan 27, 2021
@dependabot-preview
Copy link
Contributor Author

Superseded by #70.

@dependabot-preview dependabot-preview bot deleted the dependabot/npm_and_yarn/superstruct-0.14.0 branch February 9, 2021 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants