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

[pull] main from graphql:main #6

Open
wants to merge 296 commits into
base: main
Choose a base branch
from
Open

[pull] main from graphql:main #6

wants to merge 296 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Aug 16, 2022

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@github-actions
Copy link

Hi @pull[bot], I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@pull pull bot added the ⤵️ pull label Aug 16, 2022
@pull pull bot added the merge-conflict Resolve conflicts manually label Oct 3, 2022
robrichard and others added 27 commits November 21, 2022 19:44
Promise resolution order changes in some instances, resulting in different orders for some errors within the errors array, as well as in different values of hasNext within incremental delivery payloads.

This PR introduces an async `completePromisedValue` helper function rather than using a promise chain (see below links).

https://github.com/tc39/proposal-faster-promise-adoption
tc39/ecma262#2770
tc39/ecma262#2772
tc39/ecma262#1250
https://v8.dev/blog/fast-async

Depends on #3793
We could not demonstrate via actual benchmarking that the tick reduction
from awaiting a promise prior to returning it translates into real-world
performance gains. See #3796.

In any case, the promise must be awaited (irrespective of performance)
to allow the catch block to handle rejection errors. Simply returning
`completed` would result in test failures.
`expect.fail()` was mistakenly introduced in #3760 under the assumption that expect.fail() will always cause the test to fail, and that `.next()` should be called at most once.

Actually, thought, `expect.fail()` just throws an error, `.next()` is called more than once, the error is produced and wrapped by GraphQL, but then it is filtered, so the test ultimately passes.

Fortunately, that's actually the desired behavior! It's ok if the number of calls to `.next()` is more than 1 (in our case it is 2). The exact number of calls to `.next()` depends on the # of ticks that it takes for the erroring deferred fragment to resolve, which should be as low as possible, but that is a separate objective (with other PRs in the mix already aimed at reducing).

So the test as written is intending to be overly strict, but is not actually meeting that goal and so functions as desires. This PR makes no change to the test semantics, but changes the comment, the coverage ignore statement, and removes the potentially confusing use of `expect.fail`, so that the test semantics are more clearly apparent.
internal eslint rules are referenced in package json and required to be copied for a proper install.

to ponder: why did this ever work?
This PR implements the tests and fixes necessary for [Spec RFC
#987](graphql/graphql-spec#987).

This PR is made of three main commits:

1. Test printing a schema that has `Query`, `Mutation` and `Virus`
types, but only supports `query` operations (via the `Query` type) and
does _not_ support `mutation` operations.
2. Test parsing this same schema text, and assert that the schema does
not have a mutation type.
3. Fix the printing of the schema.

Co-authored-by: Lee Byron <[email protected]>
Motivation: to run it as part of integration tests and also use it in CI
yaacovCR and others added 30 commits December 1, 2024 09:38
…QLEnumValue (#4288)

this extracts logic from #3044 and #3145 (later rebased as #3807 and
#3808) to implement more informative error messages without implementing
[the full schema coordinate
RFC](graphql/graphql-spec#794)

This is a BREAKING CHANGE because these schema elements are now longer
plain objects and function differently in various scenarios, for example
with `String(<schemaElement>` `JSON.stringifu(<schemaElement>` and
`.toString()` and `.toJSON()`

---------

Co-authored-by: Jovi De Croock <[email protected]>
I was just trying to understand the new flows for how scalar values are
represented/parsed/serialized, and noticed that the comments for a
couple of these methods looked backwards.

Really hoping I am not just confused about the terminology, and that
these aren't actually correct 😅
this way, if (when?) we re-enable incemental delivery support with subscriptions, the signature of collect fields will not need to change
… of `operation` (#4309)

this is the 16.x.x behavior, unlocked by #4308, further reducing the set of breaking changes to this utility
#3814 added default value validation and coercion, deprecating `astFromValue()` (which was unsafe, used `serialize()` to uncoerce input values provided in the internal format) and replacing it with a call to `valueToLiteral()` which safely operates on external values.

This PR makes that change backwards compatible by reintroducing it as a new config option of `default` instead of replacing the existing option of `defaultValue`, where the type of `default` is:

```ts
export type GraphQLDefaultInput =
  | { value: unknown; literal?: never }
  | { literal: ConstValueNode; value?: never };
```

`default.value` is the external default value, while old config option of `defaultValue` is the internal value. Instead of removing it in v17, it is deprecated, and will be removed in v18. 

Side note: `GraphqlDefaultInput` renamed from `GraphQlDefaultValueUsage` introduced within the #3814 PR stack.

Co-authored-by: Michael Hayes <[email protected]>
…erred (#4320)

In the "old" duplicating version of incremental delivery,
`collectFields()` was responsible for branching, and it therefore
allowed processing a deferred named fragment even if that named fragment
had already been visited as a regular non-deferred named fragment.

One could have argued against that, as the old version had the concept
of inlining, and so we could have just skipped the named fragment and
considered it inlined, but chose not to do that.

Now that we have an algorithm without duplication of fields, revisiting
a named fragment will have no effect, as within the
`buildExecutionPlan()` step, all the duplicated fields will be removed.
So we can just remove the exception and go back to the version
pre-incremental delivery where we always skip a visited named fragment.

Note that we still only consider a named fragment to have been visited
if it was not marked as deferred, because in the case of overlapping
deferred and non-deferred spreads of the same named fragment, we need to
visit it as the non-deferred spread to actually realize that it is
non-deferred.

[As an aside, looks like I made a mistake in
#3994 => we would never have
wanted to ignore the result of `shouldIncludeNode()` => since we are
removing all ignoring of these conditions with respect to defer, this PR
"fixes" that mistake as well.]
Updated to reflect spec draft
graphql/graphql-spec#1132

Also changed the argument order to match the spec draft
preserving content

motivation: this clears the way to upgrade our eslint configuration to v9, which should hopefully let us update our custom rule configuration

currently, when attempting to frontport the next js website from v16 to main, we get eslint errors surrounding our custom rules. if we re-implement our custom rules according to the latest eslint configuration, it should make it easier

this change allows us to do that inter alia by removing the eslint typedoc plugin
This converts the existing website to nextra just like
https://github.com/graphql/graphql.github.io. This is a first step in
moving the documentation here and having a redirect from graphql.org to
graphql-js.org.

Not sure yet why codecov started failing 😅 when I run `testonly:cover`
locally it tells me we are 100% covered.

WDYT about isolating the dependencies for the website in that folder? As
seen in
9c7d615
this prevents the weird CI leaks that we're seeing

Resolves #4200

---------

Co-authored-by: Yaacov Rydzinski <[email protected]>
Checked for broken styles and fixed them and also went over the links by
using linkinator. I did check a lot of tools but looks like there isn't
a good way at the moment to check for broken links that is maintained.

Resolves #4242
Ultimately I was trying this out to see whether we can tweak the docs
easily, it made me realize that our docs are tailored to general GraphQL
rather than how do we use this library. It made me come up with a few
suggestions

- We should have a toggle on code examples to switch between
`buildSchema` and programatically creating the schema with i.e.
`GraphQLObjectType`
- Our documentation starts with a tutorial, this ultimately feels like a
mistake, we should lead with an explanation of what GraphQL.JS is and
what it aims to do, clearly outlining the goals of this project
- We should line out use-cases for building on this library and best
practices of how to go to production

Resolves #2941 
Resolves #2567
Not quite sure yet about contents of the overview page, also the header
is pretty odd, feels like a nextra bug or I goofed the CSS up 😅
generally though it looks like the extra-button and search/... aren't in
their own container preventing a good space-between. The absence of
links seems to cause thsi.
This provides people with the option to choose between the template
approach or the classes approach. This is a proposal to tackle
#1368

[Preview](https://graphql-7w0ort26u-the-graph-ql-foundation.vercel.app/)

This has been applied throughout the codebase now, however one of the
things I am uncertain about is how we offer `buildSchema` with the
GraphQLDefer/... directives? Should we add an option to `buildSchema`?
The exports defined in that chapter seem to only exist in v17 so we
should explicitly flag that.
Following typescript documentation, it's not possible override interface
property, we can only add new props.

Since it's declared as unknown dict, even if we merge
`GraphQLErrorExtensions`, we can't access to our extensions without
workaround and verbose typescript in source-code.

It's annoying since apollo expose `GraphQLFormattedError` instead
`GraphQLError`

Refs:
https://www.typescriptlang.org/docs/handbook/declaration-merging.html
Refs: apollographql/apollo-client#11789
Currently input-unions and by extension the `@oneOf` directive aren't
present in the documentation. I have opted to put this into the advanced
section. The copy might be up for improvement, honestly fire away if
there's more cases to cover, just wanted to get the ball rolling here.

CC @benjie

---------

Co-authored-by: Benjie <[email protected]>
CC @dimaMachina

Is it possible for the sidebar on `api-v16` to restart? currently it
inherits the root one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⤵️ pull merge-conflict Resolve conflicts manually
Projects
None yet
Development

Successfully merging this pull request may close these issues.