import * as Nexus from '@nexus/schema'; import { DynamicOutputPropertyDef } from '@nexus/schema/dist/dynamicProperty'; import { DmmfDocument, DmmfTypes } from './dmmf'; import { OnUnknownArgName, OnUnknownFieldName, OnUnknownFieldType, OnUnknownPrismaModelName } from './hooks'; import { ArgsNamingStrategy, FieldNamingStrategy, OperationName } from './naming-strategies'; import { Publisher } from './publisher'; import { Index, InputsConfig, CollapseToValue, PreResolver } from './utils'; import { WithRequiredKeys } from '@re-do/utils'; declare type FieldPublisherConfig = { alias?: string; type?: Nexus.core.AllOutputTypes; pagination?: boolean | Record; filtering?: boolean | Record; ordering?: boolean | Record; inputs?: InputsConfig; collapseTo?: CollapseToValue; preResolve?: PreResolver; }; declare type ResolvedFieldPublisherConfig = WithRequiredKeys & { customNameRequired: boolean; }; declare type PublisherConfigData = { field: DmmfTypes.SchemaField; givenOptions?: FieldPublisherConfig; }; declare type FieldConfigData = { field: DmmfTypes.SchemaField; publisherConfig: ResolvedFieldPublisherConfig; typeName: string; operation?: OperationName | null; resolve?: Nexus.FieldResolver; }; declare type PrismaClientFetcher = (ctx: Nexus.core.GetGen<'context'>) => any; export declare type Options = { /** * nexus-prisma will call this to get a reference to an instance of the Prisma Client. * The function is passed the context object. Typically a Photon instance will * be available on the context to support your custom resolvers. Therefore the * default getter returns `ctx.prisma`. */ prismaClient?: PrismaClientFetcher; /** * Same purpose as for that used in `Nexus.makeSchema`. Follows the same rules * and permits the same environment variables. This configuration will completely * go away once Nexus has typeGen plugin support. */ shouldGenerateArtifacts?: boolean; paths?: { /** * Where can nexus-prisma find the Prisma Client JS package? By default looks in * `node_modules/@prisma/client`. This is needed because nexus-prisma * gets your Prisma schema AST and Prisma Client JS crud info from the generated * Prisma Client JS package. */ prismaClient?: string; /** * Where should nexus-prisma put its typegen on disk? By default matches the * default approach of Nexus typegen which is to emit into `node_modules/@types`. * This configuration will completely go away once Nexus has typeGen plugin * support. */ typegen?: string; }; inputs?: InputsConfig; collapseTo?: CollapseToValue; }; export declare type InternalOptions = Options & { dmmf?: DmmfDocument; builderHook?: any; nexusBuilder: Nexus.PluginBuilderLens; onUnknownFieldName?: OnUnknownFieldName; onUnknownFieldType?: OnUnknownFieldType; onUnknownArgName?: OnUnknownArgName; onUnknownPrismaModelName?: OnUnknownPrismaModelName; }; export declare function build(options: InternalOptions): (DynamicOutputPropertyDef<"crud"> | DynamicOutputPropertyDef<"model">)[]; export declare const getDefaultTypegenPath: () => string; export declare const getDefaultClientPath: () => string; export declare const getShouldGenerateArtifacts: () => boolean; export interface CustomInputArg { arg: DmmfTypes.SchemaArg; type: DmmfTypes.InputType | DmmfTypes.Enum | { name: string; }; } export declare class SchemaBuilder { options: InternalOptions; readonly dmmf: DmmfDocument; protected argsNamingStrategy: ArgsNamingStrategy; protected fieldNamingStrategy: FieldNamingStrategy; protected getPhoton: PrismaClientFetcher; protected inputs: InputsConfig; protected collapseTo: CollapseToValue; protected unknownFieldsByModel: Index; publisher: Publisher; constructor(options: InternalOptions); /** * The build entrypoint, bringing together sub-builders. */ build(): (DynamicOutputPropertyDef<"crud"> | DynamicOutputPropertyDef<"model">)[]; /** * Build `t.crud` dynamic output property */ protected buildCRUD(): DynamicOutputPropertyDef<'crud'>; /** * Build the `t.model` dynamic output property. */ protected buildModel(): DynamicOutputPropertyDef<"model">; protected internalBuildModel(typeName: string, t: Nexus.core.OutputDefinitionBlock, stage: Nexus.core.OutputFactoryConfig['stage']): any; addDefaultsToPublisherConfig({ field, givenOptions: { inputs, ...otherGivenOptions }, }: Required): ResolvedFieldPublisherConfig; buildFieldConfig(config: FieldConfigData): Nexus.core.NexusOutputFieldConfig; buildArgsFromField(config: FieldConfigData): Nexus.core.ArgsRecord; determineArgs(config: FieldConfigData): CustomInputArg[]; toCustomArgs(args: DmmfTypes.SchemaArg[]): CustomInputArg[]; deepTransformInputTypes(args: CustomInputArg[], config: ResolvedFieldPublisherConfig): CustomInputArg[]; getTransformedTypeName: (typeName: string, config: ResolvedFieldPublisherConfig) => string; argsFromQueryOrModelField({ typeName, field, publisherConfig, }: FieldConfigData): CustomInputArg[]; /** * This handles "tailored field feature publishing". * * With tailord field feature publishing, users can specify that only some * fields of the PSL model are exposed under the given field feature. For * example, in the following... * * ```ts * t.model.friends({ filtering: { firstName: true, location: true } }) * ``` * * ...the field feature is "filtering" and the user has tailored it so that * only "firstName" and "location" of the field's type (e.g. "User") are * exposed to filtering on this field. So the resulting GQL TypeDef would look * something like: * * ```ts * ... * friends(where: { firstName: ..., location: ..., }): [User] * ... * ``` */ protected handleInputObjectCustomization(fieldWhitelist: Record | boolean, inputTypeName: string, fieldName: string, graphQLTypeName: string): DmmfTypes.InputType; protected assertOutputTypeIsDefined(typeName: string, fieldName: string, outputType: string, stage: 'walk' | 'build'): boolean; protected assertArgNameExists(parentTypeName: string, prismaOutputTypeName: string, fieldName: string, config: FieldPublisherConfig, stage: 'build' | 'walk', configProperty: 'filtering' | 'ordering'): { wrongArgNames: string[]; } | true; protected assertFilteringOrOrderingArgNameExists(parentTypeName: string, prismaOutputTypeName: string, fieldName: string, config: FieldPublisherConfig, stage: 'build' | 'walk'): void; } export {}; //# sourceMappingURL=builder.d.ts.map