From 157fadfe2f9904824126affe3d5125e25a055235 Mon Sep 17 00:00:00 2001 From: Anthony Etops <41380451+toinhao1@users.noreply.github.com> Date: Thu, 25 May 2023 13:55:24 +0000 Subject: [PATCH] Remove deprecated graphql method assertValidName and replaced with assertName --- src/builder.ts | 4 ++-- src/definitions/directive.ts | 4 ++-- src/definitions/enumType.ts | 4 ++-- src/definitions/extendInputType.ts | 4 ++-- src/definitions/extendType.ts | 4 ++-- src/definitions/inputObjectType.ts | 4 ++-- src/definitions/interfaceType.ts | 4 ++-- src/definitions/objectType.ts | 4 ++-- src/definitions/scalarType.ts | 4 ++-- src/definitions/unionType.ts | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/builder.ts b/src/builder.ts index b23c3302..9dac7550 100644 --- a/src/builder.ts +++ b/src/builder.ts @@ -1,5 +1,5 @@ import { - assertValidName, + assertName, ASTKindToNode, defaultFieldResolver, GraphQLBoolean, @@ -1228,7 +1228,7 @@ export class SchemaBuilder { // See: https://www.typescriptlang.org/docs/handbook/enums.html .filter((key) => isNaN(+key)) .forEach((key) => { - assertValidName(key) + assertName(key) values[key] = { value: (members as Record)[key], diff --git a/src/definitions/directive.ts b/src/definitions/directive.ts index 85194c14..177a6266 100644 --- a/src/definitions/directive.ts +++ b/src/definitions/directive.ts @@ -1,6 +1,6 @@ import { ArgumentNode, - assertValidName, + assertName, astFromValue, ASTKindToNode, DirectiveNode, @@ -109,7 +109,7 @@ withNexusSymbol(NexusDirectiveUse, NexusTypes.DirectiveUse) export function directive( config: NexusDirectiveConfig ): NexusDirectiveDef { - assertValidName(config.name) + assertName(config.name) config = Object.freeze(config) diff --git a/src/definitions/enumType.ts b/src/definitions/enumType.ts index 9d349f20..07cd7586 100644 --- a/src/definitions/enumType.ts +++ b/src/definitions/enumType.ts @@ -1,4 +1,4 @@ -import { assertValidName, GraphQLEnumTypeConfig, GraphQLEnumValueConfig } from 'graphql' +import { assertName, GraphQLEnumTypeConfig, GraphQLEnumValueConfig } from 'graphql' import { arg, NexusArgDef, NexusAsArgConfig } from './args' import type { Directives } from './directive' import { Maybe, NexusTypes, SourceTypingDef, withNexusSymbol } from './_types' @@ -64,7 +64,7 @@ export interface NexusEnumTypeConfig { export class NexusEnumTypeDef { constructor(readonly name: TypeName, protected config: NexusEnumTypeConfig) { - assertValidName(name) + assertName(name) } get value() { return this.config diff --git a/src/definitions/extendInputType.ts b/src/definitions/extendInputType.ts index cc9e5069..d2b6ae65 100644 --- a/src/definitions/extendInputType.ts +++ b/src/definitions/extendInputType.ts @@ -1,4 +1,4 @@ -import { assertValidName } from 'graphql' +import { assertName } from 'graphql' import type { GetGen } from '../typegenTypeHelpers' import type { InputDefinitionBlock } from './definitionBlocks' import { NexusTypes, withNexusSymbol } from './_types' @@ -10,7 +10,7 @@ export interface NexusExtendInputTypeConfig { export class NexusExtendInputTypeDef { constructor(readonly name: TypeName, protected config: NexusExtendInputTypeConfig & { name: string }) { - assertValidName(name) + assertName(name) } get value() { return this.config diff --git a/src/definitions/extendType.ts b/src/definitions/extendType.ts index cca993c9..973cd8b7 100644 --- a/src/definitions/extendType.ts +++ b/src/definitions/extendType.ts @@ -1,4 +1,4 @@ -import { assertValidName } from 'graphql' +import { assertName } from 'graphql' import type { AllOutputTypesPossible } from '../typegenTypeHelpers' import type { ObjectDefinitionBlock } from './objectType' import type { IsSubscriptionType, SubscriptionBuilder } from './subscriptionType' @@ -34,7 +34,7 @@ export class NexusExtendTypeDef { readonly name: TypeName, protected config: NexusExtendTypeConfig & { name: TypeName } ) { - assertValidName(name) + assertName(name) } get value() { return this.config diff --git a/src/definitions/inputObjectType.ts b/src/definitions/inputObjectType.ts index 5c430013..1b6a2cff 100644 --- a/src/definitions/inputObjectType.ts +++ b/src/definitions/inputObjectType.ts @@ -1,4 +1,4 @@ -import { assertValidName, GraphQLInputObjectTypeConfig } from 'graphql' +import { assertName, GraphQLInputObjectTypeConfig } from 'graphql' import { arg, NexusArgDef, NexusAsArgConfig } from './args' import type { InputDefinitionBlock } from './definitionBlocks' import type { Directives } from './directive' @@ -35,7 +35,7 @@ export type NexusInputObjectTypeConfig = { export class NexusInputObjectTypeDef { constructor(readonly name: TypeName, protected config: NexusInputObjectTypeConfig) { - assertValidName(name) + assertName(name) } get value() { return this.config diff --git a/src/definitions/interfaceType.ts b/src/definitions/interfaceType.ts index 2eeb2eb9..9c39dc97 100644 --- a/src/definitions/interfaceType.ts +++ b/src/definitions/interfaceType.ts @@ -1,4 +1,4 @@ -import { assertValidName, GraphQLInterfaceTypeConfig } from 'graphql' +import { assertName, GraphQLInterfaceTypeConfig } from 'graphql' import type { FieldResolver, GetGen, InterfaceFieldsFor, ModificationType } from '../typegenTypeHelpers' import type { ArgsRecord } from './args' import { OutputDefinitionBlock, OutputDefinitionBuilder } from './definitionBlocks' @@ -89,7 +89,7 @@ export class InterfaceDefinitionBlock extends OutputDef export class NexusInterfaceTypeDef { constructor(readonly name: TypeName, protected config: NexusInterfaceTypeConfig) { - assertValidName(name) + assertName(name) } get value() { return this.config diff --git a/src/definitions/objectType.ts b/src/definitions/objectType.ts index 77938e3f..ecfb948b 100644 --- a/src/definitions/objectType.ts +++ b/src/definitions/objectType.ts @@ -1,4 +1,4 @@ -import { assertValidName, GraphQLObjectType } from 'graphql' +import { assertName, GraphQLObjectType } from 'graphql' import type { InterfaceFieldsFor } from '../typegenTypeHelpers' import { OutputDefinitionBlock, OutputDefinitionBuilder } from './definitionBlocks' import type { Directives } from './directive' @@ -204,7 +204,7 @@ export type NexusObjectTypeConfig = { export class NexusObjectTypeDef { constructor(readonly name: TypeName, protected config: NexusObjectTypeConfig) { - assertValidName(name) + assertName(name) } get value() { return this.config diff --git a/src/definitions/scalarType.ts b/src/definitions/scalarType.ts index 6267115d..b64f328b 100644 --- a/src/definitions/scalarType.ts +++ b/src/definitions/scalarType.ts @@ -1,4 +1,4 @@ -import { assertValidName, GraphQLNamedType, GraphQLScalarTypeConfig } from 'graphql' +import { assertName, GraphQLNamedType, GraphQLScalarTypeConfig } from 'graphql' import type { AllNexusInputTypeDefs, AllNexusOutputTypeDefs } from '../core' import { decorateType } from './decorateType' import type { Directives } from './directive' @@ -39,7 +39,7 @@ export interface NexusScalarTypeConfig extends ScalarBase, Sca export class NexusScalarTypeDef { constructor(readonly name: TypeName, protected config: NexusScalarTypeConfig) { - assertValidName(name) + assertName(name) } get value() { return this.config diff --git a/src/definitions/unionType.ts b/src/definitions/unionType.ts index 2f9f687c..44d09829 100644 --- a/src/definitions/unionType.ts +++ b/src/definitions/unionType.ts @@ -1,4 +1,4 @@ -import { assertValidName, GraphQLUnionTypeConfig } from 'graphql' +import { assertName, GraphQLUnionTypeConfig } from 'graphql' import type { Directives } from '../core' import type { GetGen } from '../typegenTypeHelpers' import type { NexusObjectTypeDef } from './objectType' @@ -55,7 +55,7 @@ export type NexusUnionTypeConfig = { export class NexusUnionTypeDef { constructor(readonly name: TypeName, protected config: NexusUnionTypeConfig) { - assertValidName(name) + assertName(name) } get value() { return this.config