Skip to content

Commit

Permalink
Deprecate 'graphql/subscriptions' and move code to 'execution' (#3292)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Oct 7, 2021
1 parent bfc354e commit 588d096
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 15 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions src/execution/index.ts
Expand Up @@ -13,4 +13,8 @@ export type {
FormattedExecutionResult,
} from './execute';

export { subscribe, createSourceEventStream } from './subscribe';

export type { SubscriptionArgs } from './subscribe';

export { getDirectiveValues } from './values';
File renamed without changes.
19 changes: 9 additions & 10 deletions src/subscription/subscribe.ts → src/execution/subscribe.ts
Expand Up @@ -8,22 +8,21 @@ import { locatedError } from '../error/locatedError';

import type { DocumentNode } from '../language/ast';

import type { ExecutionResult, ExecutionContext } from '../execution/execute';
import { collectFields } from '../execution/collectFields';
import { getArgumentValues } from '../execution/values';
import type { GraphQLSchema } from '../type/schema';
import type { GraphQLFieldResolver } from '../type/definition';

import { getOperationRootType } from '../utilities/getOperationRootType';

import type { ExecutionResult, ExecutionContext } from './execute';
import { collectFields } from './collectFields';
import { getArgumentValues } from './values';
import {
assertValidExecutionArguments,
buildExecutionContext,
buildResolveInfo,
execute,
getFieldDef,
} from '../execution/execute';

import type { GraphQLSchema } from '../type/schema';
import type { GraphQLFieldResolver } from '../type/definition';

import { getOperationRootType } from '../utilities/getOperationRootType';

} from './execute';
import { mapAsyncIterator } from './mapAsyncIterator';

export interface SubscriptionArgs {
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Expand Up @@ -312,17 +312,17 @@ export {
defaultTypeResolver,
responsePathAsArray,
getDirectiveValues,
subscribe,
createSourceEventStream,
} from './execution/index';

export type {
ExecutionArgs,
ExecutionResult,
FormattedExecutionResult,
SubscriptionArgs,
} from './execution/index';

export { subscribe, createSourceEventStream } from './subscription/index';
export type { SubscriptionArgs } from './subscription/index';

/** Validate GraphQL documents. */
export {
validate,
Expand Down
2 changes: 2 additions & 0 deletions src/subscription/README.md
@@ -1,5 +1,7 @@
## GraphQL Subscription

NOTE: the `graphql/subscription` module has been deprecated with its exported functions integrated into the `graphql/execution` module, to better conform with the terminology of the GraphQL specification. For backwards compatibility, the `graphql/subscription` module currently re-exports the moved functions from the `graphql/execution` module. In the next major release, the `graphql/subscription` module will be dropped entirely.

The `graphql/subscription` module is responsible for subscribing to updates on specific data.

```js
Expand Down
16 changes: 14 additions & 2 deletions src/subscription/index.ts
@@ -1,2 +1,14 @@
export { subscribe, createSourceEventStream } from './subscribe';
export type { SubscriptionArgs } from './subscribe';
/**
* NOTE: the `graphql/subscription` module has been deprecated with its
* exported functions integrated into the `graphql/execution` module, to
* better conform with the terminology of the GraphQL specification.
*
* For backwards compatibility, the `graphql/subscription` module
* currently re-exports the moved functions from the `graphql/execution`
* module. In the next major release, the `graphql/subscription` module
* will be dropped entirely.
*/

export { subscribe, createSourceEventStream } from '../execution/subscribe';

export type { SubscriptionArgs } from '../execution/subscribe';

0 comments on commit 588d096

Please sign in to comment.