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 #41

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

[pull] main from graphql:main #41

wants to merge 162 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Jan 24, 2024

See Commits and Changes for more details.


Created by pull[bot]

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

In GraphQL.js working group we discussed and put process in place. But
we never officially wrote down in docs. You can watch this recording
https://youtu.be/BBxc_HmB71I?si=cvdUMI47vBsT9F2y&t=1316 or check the
transcript. These are the changes we agreed in the working group, just
putting them in writing.

---------

Co-authored-by: Benjie <[email protected]>
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 Jan 24, 2024
yaacovCR and others added 27 commits March 19, 2024 15:59
The publish method checks to see if a subsequent result is empty; this
same logic should be employed to suppress pending notices for empty
records.

This has already been achieved for subsequent results that are children
of the initial result, as we generated the pending notices from the list
of initially published records.

For subsequent results that are children of other subsequent results, we
previously generated the pending notice prior to actually publishing.

This change integrates the logic: the publishing method itself returns a
pending notice as required. This results in a bug-fix for subsequent
records of other subsequent records as well as a reduction of code for
subsequent results to the initial result.
inline much of the original executeOperation
leave out executeRootGroupedFieldSet, will help reduce the diff for
#4026
Fixes the error message created by the
DeferStreamDirectiveOnValidOperationsRule for the stream directive.
following graphql/graphql-spec#1077

now part of the following PR stack, with the laters PRs extracted from
this one

#4026: incremental: introduce GraphQLWrappedResult to avoid filtering
#4050: perf: allow skipping of field plan generation
#4051: perf: introduce completePromisedListItemValue
#4052: refactor: introduce completeIterableValue
#4053: perf: optimize completion loops
#4046: perf: use undefined for empty
in the non-deferred case.

depends on #4026

---------

Co-authored-by: Rob Richard <[email protected]>
refactoring that will streamline when we introduce two versions of this
function to optimize the loop when not streaming

depends on #4051
As convention, we will lazily instantiate arrays/sets when adding the first item.

This applies to arrays/sets on execution/incremental context, as well as the second member of the GraphQLWrappedResult tuple holding the array of incremental data records.
…fragments (#3997)

Group field sets should be properly consolidated when some of the fields
in a sibling defer overlap with a child deferred fragment.

The child deferred fragment should not prompt creation of an additional incremental data record for that field, because the field would always be sent with the parent.
Test logic was inadvertently altered in #4026.

Tests still pass, just fixing logic.
yaacovCR and others added 30 commits December 1, 2024 14:49
…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
Projects
None yet
Development

Successfully merging this pull request may close these issues.