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} from '../jsutils/instanceOf.ts';\nimport type { Maybe } from '../jsutils/Maybe.ts';\nimport type { ObjMap } from '../jsutils/ObjMap.ts';\nimport { toObjMapWithSymbols } from '../jsutils/toObjMap.ts';\n\nimport type { GraphQLError } from '../error/GraphQLError.ts';\n\nimport type {\n  SchemaDefinitionNode,\n  SchemaExtensionNode,\n} from '../language/ast.ts';\nimport { OperationTypeNode } from '../language/ast.ts';\n\nimport type {\n  GraphQLAbstractType,\n  GraphQLCompositeType,\n  GraphQLField,\n  GraphQLInterfaceType,\n  GraphQLNamedType,\n  GraphQLObjectType,\n  GraphQLType,\n} from './definition.ts';\nimport {\n  getNamedType,\n  isInputObjectType,\n  isInterfaceType,\n  isObjectType,\n  isUnionType,\n} from './definition.ts';\nimport type { GraphQLDirective } from './directives.ts';\nimport { isDirective, specifiedDirectives } from './directives.ts';\nimport {\n  __Schema,\n  SchemaMetaFieldDef,\n  TypeMetaFieldDef,\n  TypeNameMetaFieldDef,\n} from './introspection.ts';\n\n/**\n * Test if the given value is a GraphQL schema.\n * @param schema - Value to inspect.\n * @returns True when the value is a GraphQLSchema.\n * @example\n * ```ts\n * import { buildSchema } from 'graphql/utilities';\n * import { GraphQLString, isSchema } from 'graphql/type';\n *\n * const schema = buildSchema(`\n *   type Query {\n *     greeting: String\n *   }\n * `);\n *\n * isSchema(schema); // => true\n * isSchema(GraphQLString); // => false\n * ```\n */\nexport function isSchema(schema: unknown): schema is GraphQLSchema {\n  return instanceOf(schema, schemaSymbol, GraphQLSchema);\n}\n\n/**\n * Returns the value as a GraphQLSchema, or throws if it is not a schema.\n * @param schema - GraphQL schema to use.\n * @returns The value typed as a GraphQLSchema.\n * @example\n * ```ts\n * import { buildSchema } from 'graphql/utilities';\n * import { assertSchema, GraphQLString } from 'graphql/type';\n *\n * const schema = buildSchema(`\n *   type Query {\n *     greeting: String\n *   }\n * `);\n *\n * assertSchema(schema); // => schema\n * assertSchema(GraphQLString); // throws an error\n * ```\n */\nexport function assertSchema(schema: unknown): GraphQLSchema {\n  if (!isSchema(schema)) {\n    throw new Error(`Expected ${inspect(schema)} to be a GraphQL schema.`);\n  }\n  return schema;\n}\n\n/**\n * Custom extensions\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\nexport interface GraphQLSchemaExtensions {\n  [attributeName: string | symbol]: unknown;\n}\n\n/** @private */\nconst schemaSymbol: unique symbol = Symbol('Schema');\n\n/**\n * Schema Definition\n *\n * A Schema is created by supplying the root types of each type of operation,\n * query and mutation (optional). A schema definition is then supplied to the\n * validator and executor.\n * @example\n * ```ts\n * const MyAppQueryRootType = new GraphQLObjectType({\n *   name: 'Query',\n *   fields: {\n *     greeting: { type: GraphQLString },\n *   },\n * });\n *\n * const MyAppMutationRootType = new GraphQLObjectType({\n *   name: 'Mutation',\n *   fields: {\n *     setGreeting: { type: GraphQLString },\n *   },\n * });\n *\n * const MyAppSchema = new GraphQLSchema({\n *   query: MyAppQueryRootType,\n *   mutation: MyAppMutationRootType,\n * });\n * ```\n * @example\n * When the schema is constructed, by default only the types that are reachable\n * by traversing the root types are included, other types must be explicitly\n * referenced.\n *\n * ```ts\n * const characterInterface = new GraphQLInterfaceType({\n *   name: 'Character',\n *   fields: {\n *     name: { type: GraphQLString },\n *   },\n * });\n *\n * const humanType = new GraphQLObjectType({\n *   name: 'Human',\n *   interfaces: [characterInterface],\n *   fields: {\n *     name: { type: GraphQLString },\n *   },\n * });\n *\n * const droidType = new GraphQLObjectType({\n *   name: 'Droid',\n *   interfaces: [characterInterface],\n *   fields: {\n *     name: { type: GraphQLString },\n *   },\n * });\n *\n * const schema = new GraphQLSchema({\n *   query: new GraphQLObjectType({\n *     name: 'Query',\n *     fields: {\n *       hero: { type: characterInterface },\n *     },\n *   }),\n *   // Since this schema references only the `Character` interface it's\n *   // necessary to explicitly list the types that implement it if\n *   // you want them to be included in the final schema.\n *   types: [humanType, droidType],\n * });\n * ```\n * @example\n * If an array of `directives` are provided to GraphQLSchema, that will be the\n * exact list of directives represented and allowed. If `directives` is not\n * provided then a default set of the specified directives (e.g. `@include` and\n * `@skip`) will be used. If you wish to provide *additional* directives to\n * these specified directives, you must explicitly declare them.\n *\n * ```ts\n * const MyAppSchema = new GraphQLSchema({\n *   query: MyAppQueryRootType,\n *   directives: specifiedDirectives.concat([myCustomDirective]),\n * });\n * ```\n */\nexport class GraphQLSchema {\n  /**\n   * Internal runtime marker used to identify GraphQLSchema instances.\n   * @private\n   */\n  readonly __kind: typeof schemaSymbol = schemaSymbol;\n  /** Human-readable description for this schema element, if provided. */\n  description: Maybe<string>;\n  /** Custom extension fields reserved for users. */\n  extensions: Readonly<GraphQLSchemaExtensions>;\n  /** AST node from which this schema element was built, if available. */\n  astNode: Maybe<SchemaDefinitionNode>;\n  /** AST extension nodes applied to this schema element. */\n  extensionASTNodes: ReadonlyArray<SchemaExtensionNode>;\n\n  /** Whether this schema instance skips validation checks. */\n  assumeValid: boolean;\n  /**\n   * Cached schema validation errors, if validation has already run.\n   * @private\n   */\n  __validationErrors: Maybe<ReadonlyArray<GraphQLError>>;\n\n  private _queryType: Maybe<GraphQLObjectType>;\n  private _mutationType: Maybe<GraphQLObjectType>;\n  private _subscriptionType: Maybe<GraphQLObjectType>;\n  private _directives: ReadonlyArray<GraphQLDirective>;\n  private _typeMap: TypeMap;\n  private _subTypeMap: Map<\n    GraphQLAbstractType,\n    Set<GraphQLObjectType | GraphQLInterfaceType>\n  >;\n\n  private _implementationsMap: ObjMap<{\n    objects: Array<GraphQLObjectType>;\n    interfaces: Array<GraphQLInterfaceType>;\n  }>;\n\n  /**\n   * Creates a GraphQLSchema instance.\n   * @param config - Configuration describing this object.\n   * @example\n   * ```ts\n   * // Create a schema with the required query root.\n   * import { GraphQLObjectType, GraphQLSchema, GraphQLString } from 'graphql/type';\n   *\n   * const Query = new GraphQLObjectType({\n   *   name: 'Query',\n   *   fields: {\n   *     greeting: {\n   *       type: GraphQLString,\n   *       resolve: () => 'Hello',\n   *     },\n   *   },\n   * });\n   *\n   * const schema = new GraphQLSchema({\n   *   description: 'The application schema.',\n   *   query: Query,\n   * });\n   *\n   * schema.getQueryType(); // => Query\n   * schema.description; // => 'The application schema.'\n   * ```\n   * @example\n   * ```ts\n   * // This variant configures every schema option, including directives and extensions.\n   * import { DirectiveLocation, parse } from 'graphql/language';\n   * import {\n   *   GraphQLBoolean,\n   *   GraphQLDirective,\n   *   GraphQLObjectType,\n   *   GraphQLSchema,\n   *   GraphQLString,\n   * } from 'graphql/type';\n   *\n   * const Query = new GraphQLObjectType({\n   *   name: 'Query',\n   *   fields: { greeting: { type: GraphQLString } },\n   * });\n   * const Mutation = new GraphQLObjectType({\n   *   name: 'Mutation',\n   *   fields: { setGreeting: { type: GraphQLString } },\n   * });\n   * const Subscription = new GraphQLObjectType({\n   *   name: 'Subscription',\n   *   fields: { greetingChanged: { type: GraphQLString } },\n   * });\n   * const AuditEvent = new GraphQLObjectType({\n   *   name: 'AuditEvent',\n   *   fields: { message: { type: GraphQLString } },\n   * });\n   * const authDirective = new GraphQLDirective({\n   *   name: 'auth',\n   *   locations: [DirectiveLocation.FIELD_DEFINITION],\n   *   args: { required: { type: GraphQLBoolean } },\n   * });\n   * const schemaDocument = parse(`\n   *   schema {\n   *     query: Query\n   *     mutation: Mutation\n   *     subscription: Subscription\n   *   }\n   *\n   *   extend schema @auth\n   * `);\n   *\n   * const schema = new GraphQLSchema({\n   *   description: 'Operations exposed by the application.',\n   *   query: Query,\n   *   mutation: Mutation,\n   *   subscription: Subscription,\n   *   types: [AuditEvent],\n   *   directives: [authDirective],\n   *   extensions: { owner: 'platform' },\n   *   astNode: schemaDocument.definitions[0],\n   *   extensionASTNodes: [schemaDocument.definitions[1]],\n   *   assumeValid: true,\n   * });\n   *\n   * schema.getMutationType(); // => Mutation\n   * schema.getSubscriptionType(); // => Subscription\n   * schema.getType('AuditEvent'); // => AuditEvent\n   * schema.getDirective('auth'); // => authDirective\n   * schema.extensions; // => { owner: 'platform' }\n   * ```\n   */\n  constructor(config: Readonly<GraphQLSchemaConfig>) {\n    // If this schema was built from a source known to be valid, then it may be\n    // marked with assumeValid to avoid an additional type system validation.\n    this.assumeValid = config.assumeValid ?? false;\n    // Used as a cache for validateSchema().\n    this.__validationErrors = config.assumeValid === true ? [] : undefined;\n\n    this.description = config.description;\n    this.extensions = toObjMapWithSymbols(config.extensions);\n    this.astNode = config.astNode;\n    this.extensionASTNodes = config.extensionASTNodes ?? [];\n\n    this._queryType = config.query;\n    this._mutationType = config.mutation;\n    this._subscriptionType = config.subscription;\n    // Provide specified directives (e.g. @include and @skip) by default.\n    this._directives = config.directives ?? specifiedDirectives;\n\n    // To preserve order of user-provided types, we add first to add them to\n    // the set of \"collected\" types, so `collectReferencedTypes` ignore them.\n    const allReferencedTypes = new Set<GraphQLNamedType>(config.types);\n    if (config.types != null) {\n      for (const type of config.types) {\n        // When we ready to process this type, we remove it from \"collected\" types\n        // and then add it together with all dependent types in the correct position.\n        allReferencedTypes.delete(type);\n        collectReferencedTypes(type, allReferencedTypes);\n      }\n    }\n\n    if (this._queryType != null) {\n      collectReferencedTypes(this._queryType, allReferencedTypes);\n    }\n    if (this._mutationType != null) {\n      collectReferencedTypes(this._mutationType, allReferencedTypes);\n    }\n    if (this._subscriptionType != null) {\n      collectReferencedTypes(this._subscriptionType, allReferencedTypes);\n    }\n\n    for (const directive of this._directives) {\n      // Directives are not validated until validateSchema() is called.\n      if (isDirective(directive)) {\n        for (const arg of directive.args) {\n          collectReferencedTypes(arg.type, allReferencedTypes);\n        }\n      }\n    }\n    collectReferencedTypes(__Schema, allReferencedTypes);\n\n    // Storing the resulting map for reference by the schema.\n    this._typeMap = Object.create(null);\n    this._subTypeMap = new Map();\n    // Keep track of all implementations by interface name.\n    this._implementationsMap = Object.create(null);\n\n    for (const namedType of allReferencedTypes) {\n      if (namedType == null) {\n        continue;\n      }\n\n      const typeName = namedType.name;\n      if (this._typeMap[typeName] !== undefined) {\n        throw new Error(\n          `Schema must contain uniquely named types but contains multiple types named \"${typeName}\".`,\n        );\n      }\n      this._typeMap[typeName] = namedType;\n\n      if (isInterfaceType(namedType)) {\n        // Store implementations by interface.\n        for (const iface of namedType.getInterfaces()) {\n          if (isInterfaceType(iface)) {\n            let implementations = this._implementationsMap[iface.name];\n            implementations ??= this._implementationsMap[iface.name] = {\n              objects: [],\n              interfaces: [],\n            };\n\n            implementations.interfaces.push(namedType);\n          }\n        }\n      } else if (isObjectType(namedType)) {\n        // Store implementations by objects.\n        for (const iface of namedType.getInterfaces()) {\n          if (isInterfaceType(iface)) {\n            let implementations = this._implementationsMap[iface.name];\n            implementations ??= this._implementationsMap[iface.name] = {\n              objects: [],\n              interfaces: [],\n            };\n\n            implementations.objects.push(namedType);\n          }\n        }\n      }\n    }\n  }\n\n  /**\n   * Returns the value used by `Object.prototype.toString`.\n   * @returns The built-in string tag for this object.\n   */\n  get [Symbol.toStringTag](): string {\n    return 'GraphQLSchema';\n  }\n\n  /**\n   * Returns the root object type for query operations.\n   * @returns The query root type, if this schema defines one.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   type Query {\n   *     greeting: String\n   *   }\n   * `);\n   *\n   * schema.getQueryType()?.name; // => 'Query'\n   * ```\n   */\n  getQueryType(): Maybe<GraphQLObjectType> {\n    return this._queryType;\n  }\n\n  /**\n   * Returns the root object type for mutation operations.\n   * @returns The mutation root type, if this schema defines one.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   type Query {\n   *     greeting: String\n   *   }\n   *\n   *   type Mutation {\n   *     setGreeting(value: String!): String\n   *   }\n   * `);\n   *\n   * schema.getMutationType()?.name; // => 'Mutation'\n   * ```\n   */\n  getMutationType(): Maybe<GraphQLObjectType> {\n    return this._mutationType;\n  }\n\n  /**\n   * Returns the root object type for subscription operations.\n   * @returns The subscription root type, if this schema defines one.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   type Query {\n   *     greeting: String\n   *   }\n   *\n   *   type Subscription {\n   *     greetings: String\n   *   }\n   * `);\n   *\n   * schema.getSubscriptionType()?.name; // => 'Subscription'\n   * ```\n   */\n  getSubscriptionType(): Maybe<GraphQLObjectType> {\n    return this._subscriptionType;\n  }\n\n  /**\n   * Returns the root object type for the requested operation kind.\n   * @param operation - Operation kind to resolve.\n   * @returns The root object type for the operation kind, if this schema defines one.\n   * @example\n   * ```ts\n   * import { OperationTypeNode } from 'graphql/language';\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   type Query {\n   *     greeting: String\n   *   }\n   *\n   *   type Mutation {\n   *     setGreeting(value: String!): String\n   *   }\n   * `);\n   *\n   * schema.getRootType(OperationTypeNode.QUERY)?.name; // => 'Query'\n   * schema.getRootType(OperationTypeNode.MUTATION)?.name; // => 'Mutation'\n   * schema.getRootType(OperationTypeNode.SUBSCRIPTION); // => undefined\n   * ```\n   */\n  getRootType(operation: OperationTypeNode): Maybe<GraphQLObjectType> {\n    switch (operation) {\n      case OperationTypeNode.QUERY:\n        return this.getQueryType();\n      case OperationTypeNode.MUTATION:\n        return this.getMutationType();\n      case OperationTypeNode.SUBSCRIPTION:\n        return this.getSubscriptionType();\n    }\n  }\n\n  /**\n   * Returns all named types known to this schema.\n   * @returns A map of schema types keyed by type name.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   type User {\n   *     name: String\n   *   }\n   *\n   *   type Query {\n   *     viewer: User\n   *   }\n   * `);\n   *\n   * const typeMap = schema.getTypeMap();\n   *\n   * typeMap.User.name; // => 'User'\n   * typeMap.Query.name; // => 'Query'\n   * typeMap.String.name; // => 'String'\n   * ```\n   */\n  getTypeMap(): TypeMap {\n    return this._typeMap;\n  }\n\n  /**\n   * Returns the named type with the provided name.\n   * @param name - The GraphQL name to look up.\n   * @returns The named schema type, if one exists.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   type User {\n   *     name: String\n   *   }\n   *\n   *   type Query {\n   *     viewer: User\n   *   }\n   * `);\n   *\n   * schema.getType('User')?.toString(); // => 'User'\n   * schema.getType('Missing'); // => undefined\n   * ```\n   */\n  getType(name: string): GraphQLNamedType | undefined {\n    return this.getTypeMap()[name];\n  }\n\n  /**\n   * Returns object types that may be returned for an abstract type.\n   * @param abstractType - Interface or union type to inspect.\n   * @returns Object types that may satisfy the abstract type.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   * import { assertInterfaceType, assertUnionType } from 'graphql/type';\n   *\n   * const schema = buildSchema(`\n   *   interface Node {\n   *     id: ID!\n   *   }\n   *\n   *   type User implements Node {\n   *     id: ID!\n   *   }\n   *\n   *   type Organization implements Node {\n   *     id: ID!\n   *   }\n   *\n   *   union SearchResult = User | Organization\n   *\n   *   type Query {\n   *     node: Node\n   *     search: [SearchResult]\n   *   }\n   * `);\n   *\n   * const Node = assertInterfaceType(schema.getType('Node'));\n   * const SearchResult = assertUnionType(schema.getType('SearchResult'));\n   *\n   * schema.getPossibleTypes(Node).map((type) => type.name); // => ['User', 'Organization']\n   * schema.getPossibleTypes(SearchResult).map((type) => type.name); // => ['User', 'Organization']\n   * ```\n   */\n  getPossibleTypes(\n    abstractType: GraphQLAbstractType,\n  ): ReadonlyArray<GraphQLObjectType> {\n    return isUnionType(abstractType)\n      ? abstractType.getTypes()\n      : this.getImplementations(abstractType).objects;\n  }\n\n  /**\n   * Returns objects and interfaces that implement an interface type.\n   * @param interfaceType - Interface type to inspect.\n   * @returns Object and interface implementations of the interface.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   * import { assertInterfaceType } from 'graphql/type';\n   *\n   * const schema = buildSchema(`\n   *   interface Resource {\n   *     url: String!\n   *   }\n   *\n   *   interface Image implements Resource {\n   *     url: String!\n   *     width: Int\n   *   }\n   *\n   *   type Photo implements Resource & Image {\n   *     url: String!\n   *     width: Int\n   *   }\n   *\n   *   type Query {\n   *     resource: Resource\n   *   }\n   * `);\n   *\n   * const Resource = assertInterfaceType(schema.getType('Resource'));\n   * const implementations = schema.getImplementations(Resource);\n   *\n   * implementations.interfaces.map((type) => type.name); // => ['Image']\n   * implementations.objects.map((type) => type.name); // => ['Photo']\n   * ```\n   */\n  getImplementations(interfaceType: GraphQLInterfaceType): {\n    objects: ReadonlyArray<GraphQLObjectType>;\n    interfaces: ReadonlyArray<GraphQLInterfaceType>;\n  } {\n    const implementations = this._implementationsMap[interfaceType.name];\n    return implementations ?? { objects: [], interfaces: [] };\n  }\n\n  /**\n   * Returns whether one type is a possible runtime subtype of an abstract type.\n   * @param abstractType - Interface or union type to inspect.\n   * @param maybeSubType - Object or interface type to test as a possible subtype.\n   * @returns True when the subtype may satisfy the abstract type.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   * import { assertInterfaceType, assertObjectType } from 'graphql/type';\n   *\n   * const schema = buildSchema(`\n   *   interface Node {\n   *     id: ID!\n   *   }\n   *\n   *   type User implements Node {\n   *     id: ID!\n   *   }\n   *\n   *   type Review {\n   *     body: String\n   *   }\n   *\n   *   type Query {\n   *     node: Node\n   *     review: Review\n   *   }\n   * `);\n   *\n   * const Node = assertInterfaceType(schema.getType('Node'));\n   * const User = assertObjectType(schema.getType('User'));\n   * const Review = assertObjectType(schema.getType('Review'));\n   *\n   * schema.isSubType(Node, User); // => true\n   * schema.isSubType(Node, Review); // => false\n   * ```\n   */\n  isSubType(\n    abstractType: GraphQLAbstractType,\n    maybeSubType: GraphQLObjectType | GraphQLInterfaceType,\n  ): boolean {\n    let set = this._subTypeMap.get(abstractType);\n    if (set === undefined) {\n      if (isUnionType(abstractType)) {\n        set = new Set<GraphQLObjectType>(abstractType.getTypes());\n      } else {\n        const implementations = this.getImplementations(abstractType);\n        set = new Set<GraphQLObjectType | GraphQLInterfaceType>([\n          ...implementations.objects,\n          ...implementations.interfaces,\n        ]);\n      }\n\n      this._subTypeMap.set(abstractType, set);\n    }\n    return set.has(maybeSubType);\n  }\n\n  /**\n   * Returns directives available in this schema.\n   * @returns Directives available in this schema.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   directive @upper on FIELD_DEFINITION\n   *\n   *   type Query {\n   *     greeting: String @upper\n   *   }\n   * `);\n   *\n   * schema.getDirectives().map((directive) => directive.name); // => ['include', 'skip', 'deprecated', 'specifiedBy', 'oneOf', 'upper']\n   * ```\n   */\n  getDirectives(): ReadonlyArray<GraphQLDirective> {\n    return this._directives;\n  }\n\n  /**\n   * Returns the current directive definition.\n   * @param name - The GraphQL name to look up.\n   * @returns The current directive definition, if known.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   directive @upper on FIELD_DEFINITION\n   *\n   *   type Query {\n   *     greeting: String @upper\n   *   }\n   * `);\n   *\n   * schema.getDirective('upper')?.name; // => 'upper'\n   * schema.getDirective('missing'); // => undefined\n   * ```\n   */\n  getDirective(name: string): Maybe<GraphQLDirective> {\n    return this.getDirectives().find((directive) => directive.name === name);\n  }\n\n  /**\n   * This method looks up the field on the given type definition.\n   * It has special casing for the three introspection fields, `__schema`,\n   * `__type` and `__typename`.\n   *\n   * `__typename` is special because it can always be queried as a field, even\n   * in situations where no other fields are allowed, like on a Union.\n   *\n   * `__schema` and `__type` could get automatically added to the query type,\n   * but that would require mutating type definitions, which would cause issues.\n   * @param parentType - Composite type to look up the field on.\n   * @param fieldName - Field name to look up.\n   * @returns The field definition, including supported introspection fields.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   *\n   * const schema = buildSchema(`\n   *   type Query {\n   *     greeting: String\n   *   }\n   * `);\n   * const queryType = schema.getQueryType();\n   *\n   * schema.getField(queryType, 'greeting')?.name; // => 'greeting'\n   * schema.getField(queryType, '__typename')?.name; // => '__typename'\n   * schema.getField(queryType, 'missing'); // => undefined\n   * ```\n   */\n  getField(\n    parentType: GraphQLCompositeType,\n    fieldName: string,\n  ): GraphQLField<unknown, unknown> | undefined {\n    switch (fieldName) {\n      case SchemaMetaFieldDef.name:\n        return this.getQueryType() === parentType\n          ? SchemaMetaFieldDef\n          : undefined;\n      case TypeMetaFieldDef.name:\n        return this.getQueryType() === parentType\n          ? TypeMetaFieldDef\n          : undefined;\n      case TypeNameMetaFieldDef.name:\n        return TypeNameMetaFieldDef;\n    }\n\n    // this function is part \"hot\" path inside executor and check presence\n    // of 'getFields' is faster than to use `!isUnionType`\n    if ('getFields' in parentType) {\n      return parentType.getFields()[fieldName];\n    }\n    return undefined;\n  }\n\n  /**\n   * Returns a normalized configuration object for this object.\n   *\n   * The returned config preserves the original `assumeValid` flag so the schema\n   * can be recreated with the same validation behavior.\n   * @returns A configuration object that can be used to recreate this object.\n   * @example\n   * ```ts\n   * import { buildSchema } from 'graphql/utilities';\n   * import { GraphQLSchema } from 'graphql/type';\n   *\n   * const schema = buildSchema(`\n   *   type Query {\n   *     greeting: String\n   *   }\n   * `);\n   *\n   * const config = schema.toConfig();\n   * const schemaCopy = new GraphQLSchema(config);\n   *\n   * config.query?.name; // => 'Query'\n   * schemaCopy.getQueryType()?.name; // => 'Query'\n   * ```\n   */\n  toConfig(): GraphQLSchemaNormalizedConfig {\n    return {\n      description: this.description,\n      query: this.getQueryType(),\n      mutation: this.getMutationType(),\n      subscription: this.getSubscriptionType(),\n      types: Object.values(this.getTypeMap()),\n      directives: this.getDirectives(),\n      extensions: this.extensions,\n      astNode: this.astNode,\n      extensionASTNodes: this.extensionASTNodes,\n      assumeValid: this.assumeValid,\n    };\n  }\n}\n\ntype TypeMap = ObjMap<GraphQLNamedType>;\n\n/** @internal */\nexport interface GraphQLSchemaValidationOptions {\n  /**\n   * When building a schema from a GraphQL service's introspection result, it\n   * might be safe to assume the schema is valid. Set to true to assume the\n   * produced schema is valid.\n   *\n   * Default: false\n   *\n   * @internal\n   */\n  assumeValid?: boolean | undefined;\n}\n\n/** Configuration used to construct a GraphQLSchema. */\nexport interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions {\n  /** Human-readable description for this schema element, if provided. */\n  description?: Maybe<string>;\n  /** Root object type for query operations. */\n  query?: Maybe<GraphQLObjectType>;\n  /** Root object type for mutation operations. */\n  mutation?: Maybe<GraphQLObjectType>;\n  /** Root object type for subscription operations. */\n  subscription?: Maybe<GraphQLObjectType>;\n  /** Object types that belong to this union type. */\n  types?: Maybe<ReadonlyArray<GraphQLNamedType>>;\n  /** Directives available in this schema or applied to this AST node. */\n  directives?: Maybe<ReadonlyArray<GraphQLDirective>>;\n  /** Custom extension fields reserved for users. */\n  extensions?: Maybe<Readonly<GraphQLSchemaExtensions>>;\n  /** AST node from which this schema element was built, if available. */\n  astNode?: Maybe<SchemaDefinitionNode>;\n  /** AST extension nodes applied to this schema element. */\n  extensionASTNodes?: Maybe<ReadonlyArray<SchemaExtensionNode>>;\n}\n\n/** @internal */\nexport interface GraphQLSchemaNormalizedConfig extends GraphQLSchemaConfig {\n  description: Maybe<string>;\n  types: ReadonlyArray<GraphQLNamedType>;\n  directives: ReadonlyArray<GraphQLDirective>;\n  extensions: Readonly<GraphQLSchemaExtensions>;\n  extensionASTNodes: ReadonlyArray<SchemaExtensionNode>;\n  assumeValid: boolean;\n}\n\nfunction collectReferencedTypes(\n  type: GraphQLType,\n  typeSet: Set<GraphQLNamedType>,\n): Set<GraphQLNamedType> {\n  const namedType = getNamedType(type);\n\n  if (!typeSet.has(namedType)) {\n    typeSet.add(namedType);\n    if (isUnionType(namedType)) {\n      for (const memberType of namedType.getTypes()) {\n        collectReferencedTypes(memberType, typeSet);\n      }\n    } else if (isObjectType(namedType) || isInterfaceType(namedType)) {\n      for (const interfaceType of namedType.getInterfaces()) {\n        collectReferencedTypes(interfaceType, typeSet);\n      }\n\n      for (const field of Object.values(namedType.getFields())) {\n        collectReferencedTypes(field.type, typeSet);\n        for (const arg of field.args) {\n          collectReferencedTypes(arg.type, typeSet);\n        }\n      }\n    } else if (isInputObjectType(namedType)) {\n      for (const field of Object.values(namedType.getFields())) {\n        collectReferencedTypes(field.type, typeSet);\n      }\n    }\n  }\n\n  return typeSet;\n}\n"]}