-
-
Notifications
You must be signed in to change notification settings - Fork 818
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Subscriber and use only Executor (#3117)
* Remove Subscriber and use only Executor * Fix introspectSchema * Fix tests * Cleanup
- Loading branch information
Showing
17 changed files
with
178 additions
and
273 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@graphql-tools/wrap': major | ||
--- | ||
|
||
BREAKING CHANGE | ||
- Remove unnecessary `introspectSchemaSync`, `introspectSchema` already handles sync execution |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
'@graphql-tools/batch-execute': major | ||
'@graphql-tools/delegate': major | ||
'@graphql-tools/links': major | ||
'@graphql-tools/url-loader': major | ||
'@graphql-tools/stitch': major | ||
'@graphql-tools/utils': major | ||
'@graphql-tools/wrap': major | ||
--- | ||
|
||
BREAKING CHANGE | ||
- Remove Subscriber and use only Executor | ||
- - Now `Executor` can receive `AsyncIterable` and subscriptions will also be handled by `Executor`. This is a future-proof change for defer, stream and live queries | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export { createServerHttpLink } from './createServerHttpLink'; | ||
export { AwaitVariablesLink } from './AwaitVariablesLink'; | ||
export { linkToExecutor } from './linkToExecutor'; | ||
export { linkToSubscriber } from './linkToSubscriber'; | ||
export { GraphQLUpload } from './GraphQLUpload'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
import { toPromise } from '@apollo/client/core'; | ||
import { ApolloLink, execute } from '@apollo/client/link/core'; | ||
import { Observable } from '@apollo/client/utilities'; | ||
import { toPromise } from '@apollo/client/link/utils'; | ||
|
||
import { AsyncExecutor, ExecutionParams, ExecutionResult } from '@graphql-tools/utils'; | ||
import { Executor, ExecutionParams, ExecutionResult, observableToAsyncIterable } from '@graphql-tools/utils'; | ||
|
||
export const linkToExecutor = | ||
(link: ApolloLink): AsyncExecutor => | ||
<TReturn, TArgs, TContext>(params: ExecutionParams<TArgs, TContext>): Promise<ExecutionResult<TReturn>> => { | ||
(link: ApolloLink): Executor => | ||
async <TReturn, TArgs, TContext>(params: ExecutionParams<TArgs, TContext>) => { | ||
const { document, variables, extensions, context, info, operationName } = params; | ||
return toPromise( | ||
execute(link, { | ||
query: document, | ||
variables: variables, | ||
context: { | ||
graphqlContext: context, | ||
graphqlResolveInfo: info, | ||
clientAwareness: {}, | ||
}, | ||
extensions, | ||
operationName, | ||
}) as Observable<ExecutionResult<TReturn>> | ||
); | ||
const observable = execute(link, { | ||
query: document, | ||
variables, | ||
context: { | ||
graphqlContext: context, | ||
graphqlResolveInfo: info, | ||
clientAwareness: {}, | ||
}, | ||
extensions, | ||
operationName, | ||
}) as Observable<ExecutionResult<TReturn>>; | ||
if (info?.operation.operation === 'subscription') { | ||
return observableToAsyncIterable<ExecutionResult<TReturn>>(observable)[Symbol.asyncIterator](); | ||
} | ||
return toPromise(observable); | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.