-
Notifications
You must be signed in to change notification settings - Fork 134
feat: @envelop/on-resolve plugin for hooking into schema resolvers
#1500
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
Merged
saihaj
merged 20 commits into
graphql-hive:saihaj/engine-agnostic-non-breaking
from
enisdenjo:on-resolve
Sep 7, 2022
Merged
feat: @envelop/on-resolve plugin for hooking into schema resolvers
#1500
saihaj
merged 20 commits into
graphql-hive:saihaj/engine-agnostic-non-breaking
from
enisdenjo:on-resolve
Sep 7, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: 4b52971 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
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 |
|
@enisdenjo is attempting to deploy a commit to the The Guild Team on Vercel. A member of the Team first needs to authorize it. |
45a7ce7 to
88a3c57
Compare
n1ru4l
approved these changes
Sep 7, 2022
ardatan
approved these changes
Sep 7, 2022
saihaj
approved these changes
Sep 7, 2022
Merged
saihaj
added a commit
that referenced
this pull request
Oct 12, 2022
* feat: non-breaking GraphQL Engine * feat: make envelop take in engine functions * structural typings * remove grapqhl as peer dep from types pkg * make core more agnostic * chore(dependencies): updated changesets for modified dependencies * remove traced schema * remove traced orchestrator * make plugin agnostic * drop EnvelopError * remove more graphql import * Drop useTiming * make core completely free of graphql-js * add eslint rule * eslint disallow in types too * more agnostic packages * remove introspection util * chore(dependencies): updated changesets for modified dependencies * prettier * TEMP: make bot calm down * update all docs * test matrix for core * experimenting traced schema (#1501) * experimenting traced schema * Fix * remove comment * do optional chaining since we are not strongly typing * document * cleanup Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com> * feat: drop node 12 (#1505) * feat: remove `enableIf` utility (#1504) * feat: remove enableIf utility * make types happpy * make types happy * add changeset * feat: remove async schema plugin and rename lazy loaded schema plugin (#1506) * remove useAsyncSchema * rename to useSchemaByContext * add eslint rule (#1509) * feat: `@envelop/on-resolve` plugin for hooking into schema resolvers (#1500) * on resolve plugin * changeset * no more onResolverCalled * unused import * args is a record * integrate and useOnResolve * resolversHooksSymbol does not exist * plugincontext for OnPluginInit * on-resolve uses addPlugin * onresolvercalled is no more * refactor for new on-resolve * fix open-telemetry tests * fix newrelic * opentelemetry graphql as peer dep * tests * addPlugin doesnt need to be used * reorder * respects onPluginInit context * drop unused import * fixes false positive eslint warnings Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com> * docs: order of plugins matter (#1513) * feat: remove handler for validation and parse errors (#1510) * feat: remove hanlder for validation and parse errors * tests * make it work * Add docs * Fix serialization issue * Go * .. * update docs * update test * make it work * feat: add originalError in dev mode (#1514) * remove Fn appendix * name graphql error * make ts happy * make toJSON required Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com> * add changeset * Update .changeset/nervous-seas-own.md * Update .changeset/rude-cats-peel.md * no-use-before-define (#1522) * feat: trigger on context, validate and parse errors (#1511) * feat: trigger on context, validate and parse errors * trying * make it work * pass in phase * add phase details * feedback * docs: migration guide (#1520) * docs: migration guide * remove slashes * Update website/docs/guides/migrating-from-v2-to-v3.mdx Co-authored-by: Denis Badurina <badurinadenis@gmail.com> * feedback * document removing of orchestrated tracer * more feedback * update docs * update examples * async schema example Co-authored-by: Denis Badurina <badurinadenis@gmail.com> * Add redirects * remove deafult skip error from sentry plugin * export masked error plugin * sentry plugin default skip GraphQLError * sentry: og error is not graphql error then send to sentry * doc: drop introspection utils * should fix ts issues on v15 * test: stack error we should not match the error name since it can be different across impl * feat: use engine plugin (#1535) * feat: use engine plugin * remove assertion * make useEngine plugin the only way to pass engine functions (#1536) * make useEngine plugin the only way to pass engine fns * update types * update docs * Update packages/plugins/apollo-datasources/README.md Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com> * prettier: Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com> Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com> * fix * versioned docs with v3 default * fix build * fix * feat this is cool * docs reword schema tracing * docs add graphql error example * docs restructuring, fix typos * chore remove autogenerated changeset * cleanup changeset * docs sycn patch Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com> Co-authored-by: Denis Badurina <denis@domonda.com> Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com> Co-authored-by: Denis Badurina <badurinadenis@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In light of the next release of envelop aiming to be engine agnostic,
onResolverCalledmust be no more because we can’t be wrapping theGraphQLSchemaobject.To reduce migration friction and still have be able to hook onto schema resolvers, we introduce a new plugin called
@envelop/on-resolve(debatable) that does exactly that.Migration from
onResolverCalledto{ useOnResolve } from '@envelop/on-resolve'*
onResolverCalledsignature stays exactly the sameimport { envelop, Plugin } from '@envelop/core'; + import { useOnResolve } from '@envelop/on-resolve'; import { onResolverCalled } from './my-resolver'; function useResolve(): Plugin { return { - onResolverCalled: onResolverCalled, + onPluginInit: ({ addPlugin }) => { + addPlugin(useOnResolve(onResolverCalled)); + }, }; } const getEnveloped = envelop({ plugins: [ // ... other plugins ... useResolve(), ], });Things to note
OnPluginInitHooknow accepts a generic for the plugin contextonPluginInitto respect the context genericonResolverCalledis no moreTODO
@envelop/newrelic