@nestjs/graphql
Version:
GraphQL for NestJS: code-first and schema-first APIs, resolvers as providers, subscriptions, federation and generated SDL, on Apollo or Mercurius.
47 lines • 2.55 kB
TypeScript
import { ContextId, InstanceWrapper } from '@nestjs/core/injector/instance-wrapper.js';
import { Module } from '@nestjs/core/injector/module.js';
import { ResolverMetadata } from '../interfaces/resolver-metadata.interface.js';
/**
* A handler found by an explorer, along with the classes `groupMetadata()`
* needs to tell which of two handlers of the same field takes precedence.
*/
export interface ExploredResolverMetadata extends ResolverMetadata {
/** The class of the instance the handler was found on. */
target?: Function;
/** The class whose prototype declares the handler method. */
declaredOn?: Function;
}
export declare class BaseExplorerService {
/**
* @param skipGlobalImports whether to leave out the global modules that the
* included modules (or their imports) only see because they are global:
* Nest adds every global module to the imports of every other module.
*/
getModules(modulesContainer: Map<string, Module> | undefined, include: Function[], skipGlobalImports?: boolean): Module[];
includeWhitelisted(modulesContainer: Map<string, Module>, include: Function[]): Module[];
flatMap<T = ResolverMetadata>(modules: Module[], callback: (instance: InstanceWrapper, moduleRef: Module) => T | T[]): T[];
/**
* Groups the handlers by type and field name. When two handlers are found
* for one field, the one declared on the most derived class wins (then the
* one found on the most derived class), whatever the order the modules are
* scanned in, so that a subclass overriding a handler (e.g., to guard it)
* is not replaced by the base resolver it extends. Two handlers of classes
* that do not extend one another are refused: the order the modules are
* scanned in would decide which one runs.
*/
groupMetadata(resolvers: ExploredResolverMetadata[]): Record<string, Record<string, Function | Record<string, any>>>;
/**
* Returns the context id of the request a GraphQL context belongs to (the
* one Nest middleware assigned to it, if any) and pins it on the context.
*/
getContextId(gqlContext: Record<string | symbol, any>): ContextId;
/**
* Whether the handler registered first for a field is kept over the one
* found after it. Handlers without class information keep the "last one
* wins" behaviour.
* @throws when neither handler takes precedence over the other.
*/
private keepsPrecedence;
private isDerivedFrom;
}
//# sourceMappingURL=base-explorer.service.d.ts.map