From 74a5d478386d4cf9c084dbb74e3a8df4c5c03c4a Mon Sep 17 00:00:00 2001 From: Gavin Xue Date: Fri, 28 Oct 2022 18:00:43 +0800 Subject: [PATCH] fix: add missing subcribe when rebuildOutput, solve subcription megreSchema problem --- src/definitions/definitionBlocks.ts | 5 +++++ src/rebuildType.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/src/definitions/definitionBlocks.ts b/src/definitions/definitionBlocks.ts index 6b3e490f..77b1021d 100644 --- a/src/definitions/definitionBlocks.ts +++ b/src/definitions/definitionBlocks.ts @@ -13,6 +13,7 @@ import type { Directives } from './directive' import type { NexusMetaType } from './nexusMeta' import type { AllNexusInputTypeDefs, AllNexusOutputTypeDefs, NexusWrapKind } from './wrapping' import type { BaseScalars, Maybe } from './_types' +import type { IsSubscriptionType, SubscriptionTypeConfigBase } from './subscriptionType' export interface CommonFieldConfig { /** The description to annotate the GraphQL SDL */ @@ -353,6 +354,8 @@ export type FieldOutConfig = resolve: FieldResolver } : NexusOutputFieldConfig + & + IsSubscriptionType extends true ? SubscriptionTypeConfigBase : {} // prettier-ignore export type FieldOutConfigWithName = @@ -361,6 +364,8 @@ export type FieldOutConfigWithName } : NexusOutputFieldConfigWithName + & + IsSubscriptionType extends true ? SubscriptionTypeConfigBase : {} export interface OutputDefinitionBuilder { typeName: string diff --git a/src/rebuildType.ts b/src/rebuildType.ts index cf986f7b..9faf2f6b 100644 --- a/src/rebuildType.ts +++ b/src/rebuildType.ts @@ -178,6 +178,7 @@ export function rebuildOutputDefinition( description: fieldConfig.description, deprecation: fieldConfig.deprecationReason, extensions: fieldConfig.extensions, + subscribe: fieldConfig.subscribe, args: rebuildArgs(typeName, fieldName, fieldConfig.args ?? {}, config), resolve: fieldConfig.resolve, })