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 graphql.persisted() utility to create persisted stand-in documents #98

Merged
merged 6 commits into from
Mar 2, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented Mar 2, 2024

Related to #77
Related to 0no-co/GraphQLSP#240
Related to urql-graphql/urql#3515

Summary

This implements a graphql.persisted() function, as per the RFC in #77.

This accepts a documentId string and returns a value that matches a GraphQL.js DocumentNode shape but contains no definitions. The resulting value contains no reference to the original document, while the return type of graphql.persisted() matches the document’s type that's been passed in.

The returned type is also transformed to a more strict type that clearly indicates that the documentId is present but that no definitions are present.

Set of changes

  • Add graphql.persisted()
  • Add TadaPersistedDocumentNode

Copy link

changeset-bot bot commented Mar 2, 2024

🦋 Changeset detected

Latest commit: 3ba1123

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
Copy link
Member Author

kitten commented Mar 2, 2024

Merging since I expect this to be somewhat usable before the next release

Edit: not resolving #77 as part of merging this, since it's not complete until all parts are done

@kitten kitten force-pushed the feat/persisted-documents branch from 4334a77 to 3ba1123 Compare March 2, 2024 13:15
@kitten kitten merged commit d3ae08f into main Mar 2, 2024
1 check passed
@kitten kitten deleted the feat/persisted-documents branch March 2, 2024 13:17
@github-actions github-actions bot mentioned this pull request Mar 2, 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.

2 participants