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

make useEngine plugin the only way to pass engine functions #1536

Merged
merged 5 commits into from
Sep 26, 2022

Conversation

saihaj
Copy link
Collaborator

@saihaj saihaj commented Sep 22, 2022

makes user pass the useEngine plugin as the only way to set engine functions.

- import { envelop } from '@envelop/core';
+ import { envelop, useEngine } from '@envelop/core';
+ import { parse, validate, execute, subscribe } from 'graphql';

- const getEnveloped = envelop([ ... ])
+ const getEnveloped = envelop({ plugins: [ useEngine({ parse, validate, execute, subscribe }), ... ] })

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2022

⚠️ No Changeset found

Latest commit: 58c5e6c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link

vercel bot commented Sep 22, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
envelop ✅ Ready (Inspect) Visit Preview Sep 26, 2022 at 1:23PM (UTC)

Copy link
Collaborator

@enisdenjo enisdenjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One benefit of having the GQL functions as root options is type safety - if you just envelop() you'll get a TS error complaining about the missing engine functions.

How does this get tackled with the new useEngine plugin? Envelop instantly errors out if useEngine is missing? Required plugin?

@saihaj
Copy link
Collaborator Author

saihaj commented Sep 23, 2022

Envelop instantly errors out if useEngine is missing?

with current implementation you will start getting runtime errors. Like parse is missing. Provide useEngine. I did try doing a required engine plugin but the problem with that is when you are composing envelops some may not even need to provide the engine.

Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
@saihaj saihaj merged commit 99d06a4 into saihaj/use-engine-plugin Sep 26, 2022
@saihaj saihaj deleted the saihaj/use-engine-as-default branch September 26, 2022 13:23
saihaj added a commit that referenced this pull request Sep 28, 2022
* 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>
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants