diff --git a/src/subscription/__tests__/mapAsyncIterator-test.ts b/src/execution/__tests__/mapAsyncIterator-test.ts similarity index 100% rename from src/subscription/__tests__/mapAsyncIterator-test.ts rename to src/execution/__tests__/mapAsyncIterator-test.ts diff --git a/src/subscription/__tests__/simplePubSub-test.ts b/src/execution/__tests__/simplePubSub-test.ts similarity index 100% rename from src/subscription/__tests__/simplePubSub-test.ts rename to src/execution/__tests__/simplePubSub-test.ts diff --git a/src/subscription/__tests__/simplePubSub.ts b/src/execution/__tests__/simplePubSub.ts similarity index 100% rename from src/subscription/__tests__/simplePubSub.ts rename to src/execution/__tests__/simplePubSub.ts diff --git a/src/subscription/__tests__/subscribe-test.ts b/src/execution/__tests__/subscribe-test.ts similarity index 100% rename from src/subscription/__tests__/subscribe-test.ts rename to src/execution/__tests__/subscribe-test.ts diff --git a/src/execution/index.ts b/src/execution/index.ts index 5ae0706ec9..679caf4411 100644 --- a/src/execution/index.ts +++ b/src/execution/index.ts @@ -13,4 +13,8 @@ export type { FormattedExecutionResult, } from './execute'; +export { subscribe, createSourceEventStream } from './subscribe'; + +export type { SubscriptionArgs } from './subscribe'; + export { getDirectiveValues } from './values'; diff --git a/src/subscription/mapAsyncIterator.ts b/src/execution/mapAsyncIterator.ts similarity index 100% rename from src/subscription/mapAsyncIterator.ts rename to src/execution/mapAsyncIterator.ts diff --git a/src/subscription/subscribe.ts b/src/execution/subscribe.ts similarity index 97% rename from src/subscription/subscribe.ts rename to src/execution/subscribe.ts index be6b517e7b..e0d1a27be6 100644 --- a/src/subscription/subscribe.ts +++ b/src/execution/subscribe.ts @@ -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 { diff --git a/src/index.ts b/src/index.ts index d3641deb73..87e8fe295b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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, diff --git a/src/subscription/README.md b/src/subscription/README.md index c938354c2b..7e099d2cfc 100644 --- a/src/subscription/README.md +++ b/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 diff --git a/src/subscription/index.ts b/src/subscription/index.ts index 899e443b6b..63f6666732 100644 --- a/src/subscription/index.ts +++ b/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';