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

refactor: consolidate subscription into execution #3195

Closed
wants to merge 11 commits into from

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Jun 22, 2021

subscription operations are described by the 'Execution' section of the spec.

@yaacovCR yaacovCR force-pushed the aggregate-error branch 2 times, most recently from e4f2ace to d8e3254 Compare October 3, 2021 20:44
@yaacovCR yaacovCR force-pushed the consolidate-subscription branch 4 times, most recently from dc88bcf to 112feed Compare October 5, 2021 18:05
@yaacovCR yaacovCR changed the base branch from aggregate-error to main October 5, 2021 18:07
@yaacovCR
Copy link
Contributor Author

yaacovCR commented Oct 5, 2021

@IvanGoncharov I have lifted the dependency for this PR on the #3192

This is now just code reorganization/polish, and I believe can be released in v16.

Copy link
Member

@IvanGoncharov IvanGoncharov left a comment

Choose a reason for hiding this comment

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

Can you please make a separate PR where you just merge the subscription folder to execute.
That way we don't lose history on subscribe.ts and also it would be way easier to see changes in that file.

@IvanGoncharov
Copy link
Member

I believe can be released in v16.

One issue though is that people using graphql/subscription in imports and configs.
Can you please keep src/subscription/index.ts where you reexport necessary functions from src/execute/index.ts with a note that it's deprecated and will be removed in v17?

expect(await createSourceEventStream(schema, document)).to.deep.equal(
result,
);
const exeContext = buildExecutionContext(
Copy link
Member

Choose a reason for hiding this comment

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

buildExecutionContext is not a part of public API so shouldn't use it in our tests
createSourceEventStream is part of public API so it should be usable as previously with schema + document.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@yaacovCR
Copy link
Contributor Author

yaacovCR commented Oct 6, 2021

Can you please make a separate PR where you just merge the subscription folder to execute. That way we don't lose history on subscribe.ts and also it would be way easier to see changes in that file.

I have added some more commits where I removed the subscribe.ts file entirely (it's superfluous now that subscribe is part of execution. So I am not sure how we are going to avoid losing the hx from that file. Thoughts?

@yaacovCR
Copy link
Contributor Author

yaacovCR commented Oct 7, 2021

Can you please make a separate PR where you just merge the subscription folder to execute. That way we don't lose history on subscribe.ts and also it would be way easier to see changes in that file.

see #3292

I will work soon on rebasing this PR and addressing the other code review, but I suppose we can pick up at least from there.

...and executeQueryOrMutationRootFields

to prepare for integration of executeSubscription
this function currently does not throw GraphQLErrors -- it is not within the parallel try block within execute
to executeSubscriptionRootField
to operate only on ExecutionContext
-- In at least a few cases, destructuring assignment from exeContext can improve code readability.
-- Overrides to exeContext can be set using object spread syntax.
Execution arguments object can be passes as-is to the function.
assertValidExecutionArguments can be called within the function rather
than prior
@IvanGoncharov
Copy link
Member

IvanGoncharov commented Oct 7, 2021

I have added some more commits where I removed the subscribe.ts file entirely (it's superfluous now that subscribe is part of execution. So I am not sure how we are going to avoid losing the hx from that file. Thoughts?

@yaacovCR It totally ok to lose history. I just prefer to have as small as possible bridge PR for that, we should separate commit where we move content and also keep content intact as much as possible.
That way in git blame it's clear that code was the move from another file without changes so it's just a matter of switching to parent commit and git blame on the removed file.

...capable of processing requests of all operation types.

ExecutionArgs now augmented with all relevant arguments for
subscriptions as well.
@yaacovCR
Copy link
Contributor Author

yaacovCR commented Oct 7, 2021

ok the separate PR for code move is done, and this PR is rebased, but I still need to address your other feedback

@yaacovCR
Copy link
Contributor Author

yaacovCR commented Oct 7, 2021

actually i think the rebase was a bit unsuccessful, will go back through it commit by commit later. maybe i will find something else to break out into a different PR as well

@IvanGoncharov
Copy link
Member

@yaacovCR sounds good 👍
BTW. I find this plugin to be super useful for following file history on GitHub https://chrome.google.com/webstore/detail/follow-for-github/agalokjhnhheienloigiaoohgmjdpned

@yaacovCR
Copy link
Contributor Author

yaacovCR commented Oct 7, 2021

Closed this in favor of PR stack 3293 => 3302.

@yaacovCR yaacovCR closed this Oct 7, 2021
@yaacovCR yaacovCR deleted the consolidate-subscription branch October 7, 2021 21:24
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.

None yet

2 participants