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

feat: Add unsafe_readResult() and maskFragments() utilities #43

Merged
merged 8 commits into from
Jan 28, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented Jan 28, 2024

Resolve #38

Summary

This PR, when applied, adds two new utilities, as documented in the website changes.

  • maskFragments accepts a list of fragments and the combined data (or a list of such) matching the fragments’ result type, and returns the combined fragment masks of the fragments.
  • unsafe_readResult accepts a document and its result type (without fragment refs) and unsafely casts it to the result type (as an alternative to as any as ResultType<typeof document>

The former operation is safe but cumbersome when creating test data.
The latter is unsafe, but safer than an as any cast.

Set of changes

  • Add maskFragments
  • Add unsafe_readResult

Copy link

changeset-bot bot commented Jan 28, 2024

🦋 Changeset detected

Latest commit: cac589e

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten kitten changed the title feat: Add unsafe_readResult and maskFragments utilities feat: Add unsafe_readResult() and maskFragments() utilities Jan 28, 2024
@kitten kitten merged commit 5ec863c into main Jan 28, 2024
3 checks passed
@kitten kitten deleted the feat/masking-fragments branch January 28, 2024 12:04
@github-actions github-actions bot mentioned this pull request Jan 28, 2024
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.

RFC: Add helper function to create Fragment data
2 participants