import Decimal from 'decimal.js'; import { graphql } from '..'; import { BaseGeneratedListTypes } from './utils'; import { CommonFieldConfig } from './config'; import { DatabaseProvider } from './core'; import { AdminMetaRootVal, JSONValue, KeystoneContext, MaybePromise } from '.'; export { Decimal }; export declare type ItemRootValue = { id: { toString(): string; }; [key: string]: unknown; }; export declare type ListInfo = { types: TypesForList; }; export declare type FieldData = { lists: Record; provider: DatabaseProvider; listKey: string; fieldKey: string; }; export declare type FieldTypeFunc = (data: FieldData) => NextFieldType; export declare type NextFieldType | undefined = graphql.Arg | undefined, UpdateArg extends graphql.Arg = graphql.Arg, UniqueWhereArg extends graphql.Arg = graphql.Arg, OrderByArg extends graphql.Arg = graphql.Arg, FilterArg extends graphql.Arg = graphql.Arg> = { dbField: TDBField; } & FieldTypeWithoutDBField; declare type ScalarPrismaTypes = { String: string; Boolean: boolean; Int: number; Float: number; DateTime: Date; BigInt: bigint; Json: JSONValue; Decimal: Decimal; }; declare type NumberLiteralDefault = { kind: 'literal'; value: number; }; declare type BigIntLiteralDefault = { kind: 'literal'; value: bigint; }; declare type BooleanLiteralDefault = { kind: 'literal'; value: boolean; }; declare type StringLiteralDefault = { kind: 'literal'; value: string; }; declare type DBGeneratedDefault = { kind: 'dbgenerated'; value: string; }; declare type AutoIncrementDefault = { kind: 'autoincrement'; }; declare type NowDefault = { kind: 'now'; }; declare type UuidDefault = { kind: 'uuid'; }; declare type CuidDefault = { kind: 'cuid'; }; export declare type ScalarDBFieldDefault = Mode extends 'many' ? never : { String: StringLiteralDefault | UuidDefault | CuidDefault; Boolean: BooleanLiteralDefault; Json: StringLiteralDefault; Float: NumberLiteralDefault; Int: AutoIncrementDefault | NumberLiteralDefault; BigInt: AutoIncrementDefault | BigIntLiteralDefault; DateTime: NowDefault | StringLiteralDefault; Decimal: StringLiteralDefault; }[Scalar] | DBGeneratedDefault; export declare type ScalarDBField = { kind: 'scalar'; scalar: Scalar; mode: Mode; /** * The native database type that the field should use. See https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#model-field-scalar-types for what the possible native types should be * The native type should not include @datasourcename. so to specify the uuid type, the correct value for nativeType would be `Uuid` */ nativeType?: string; default?: ScalarDBFieldDefault; index?: 'unique' | 'index'; map?: string; updatedAt?: Scalar extends 'DateTime' ? boolean : undefined; }; export declare const orderDirectionEnum: graphql.EnumType>>; export declare const QueryMode: graphql.EnumType>>; export declare type RelationDBField = { kind: 'relation'; list: string; field?: string; mode: Mode; foreignKey?: { one: true | { map: string; }; many: undefined; }[Mode]; relationName?: { one: undefined; many: string; }[Mode]; }; export declare type EnumDBField = { kind: 'enum'; name: string; values: readonly Value[]; mode: Mode; default?: { kind: 'literal'; value: Value; }; index?: 'unique' | 'index'; map?: string; }; export declare type NoDBField = { kind: 'none'; }; export declare type ScalarishDBField = ScalarDBField | EnumDBField; export declare type RealDBField = ScalarishDBField | RelationDBField<'many' | 'one'>; export declare type MultiDBField> = { kind: 'multi'; fields: Fields; }; export declare type DBField = RealDBField | NoDBField | MultiDBField>; declare type DBFieldToInputValue = TDBField extends ScalarDBField ? { optional: ScalarPrismaTypes[Scalar] | null | undefined; required: ScalarPrismaTypes[Scalar] | undefined; many: readonly ScalarPrismaTypes[Scalar][] | undefined; }[Mode] : TDBField extends RelationDBField<'many' | 'one'> ? { connect?: {}; disconnect?: boolean; } | undefined : TDBField extends EnumDBField ? { optional: Value | null | undefined; required: Value | undefined; many: readonly Value[] | undefined; }[Mode] : TDBField extends NoDBField ? undefined : TDBField extends MultiDBField ? { [Key in keyof Fields]: DBFieldToInputValue; } : never; declare type DBFieldUniqueWhere = TDBField extends ScalarDBField ? Scalar extends 'String' | 'Int' ? { String: string; Int: number; }[Scalar] : any : any; declare type DBFieldToOutputValue = TDBField extends ScalarDBField ? { optional: ScalarPrismaTypes[Scalar] | null; required: ScalarPrismaTypes[Scalar]; many: readonly ScalarPrismaTypes[Scalar][]; }[Mode] : TDBField extends RelationDBField ? { one: () => Promise; many: { findMany(args: FindManyArgsValue): Promise; count(args: { where: FindManyArgsValue['where']; }): Promise; }; }[Mode] : TDBField extends EnumDBField ? { optional: Value | null; required: Value; many: readonly Value[]; }[Mode] : TDBField extends NoDBField ? undefined : TDBField extends MultiDBField ? { [Key in keyof Fields]: DBFieldToOutputValue; } : never; export declare type OrderByFieldInputArg> = { arg: TArg; } & ResolveFunc<(value: Exclude, null | undefined>, context: KeystoneContext) => MaybePromise>; declare type FieldInputResolver = (value: Input, context: KeystoneContext, relationshipInputResolver: RelationshipInputResolver) => MaybePromise; declare type DBFieldFiltersInner = Record; declare type DBFieldFilters = ({ AND?: DBFieldFiltersInner; OR?: DBFieldFiltersInner; NOT?: DBFieldFiltersInner; } & DBFieldFiltersInner) | null; export declare type WhereFieldInputArg> = { arg: TArg; } & ResolveFunc, undefined>, DBFieldFilters, any>>; export declare type UpdateFieldInputArg> = { arg: TArg; } & ResolveFunc, DBFieldToInputValue, any>>; declare type CreateFieldInputResolver = FieldInputResolver, any>; export declare type CreateFieldInputArg | undefined> = { arg: TArg; } & (TArg extends graphql.Arg ? graphql.InferValueFromArg extends DBFieldToInputValue ? { resolve?: CreateFieldInputResolver, TDBField>; } : { resolve: CreateFieldInputResolver, TDBField>; } : { resolve: CreateFieldInputResolver; }); declare type UnwrapMaybePromise = T extends Promise ? Resolved : T; declare type ResolveFunc any> = Parameters[0] extends UnwrapMaybePromise> ? { resolve?: Func; } : { resolve: Func; }; export declare type UniqueWhereFieldInputArg> = { arg: TArg; } & ResolveFunc<(value: Exclude, undefined | null>, context: KeystoneContext) => MaybePromise>; declare type FieldTypeOutputField = graphql.Field<{ value: DBFieldToOutputValue; item: ItemRootValue; }, any, graphql.OutputType, 'value'>; export declare type OrderDirection = 'asc' | 'desc'; declare type DBFieldToOrderByValue = TDBField extends ScalarishDBField ? OrderDirection | undefined : TDBField extends MultiDBField ? { [Key in keyof Fields]: DBFieldToOrderByValue; } : undefined; export declare type FieldTypeWithoutDBField | undefined = graphql.Arg | undefined, UpdateArg extends graphql.Arg = graphql.Arg, UniqueWhereArg extends graphql.Arg = graphql.Arg, OrderByArg extends graphql.Arg = graphql.Arg, FilterArg extends graphql.Arg = graphql.Arg> = { input?: { uniqueWhere?: UniqueWhereFieldInputArg, UniqueWhereArg>; where?: WhereFieldInputArg; create?: CreateFieldInputArg; update?: UpdateFieldInputArg; orderBy?: OrderByFieldInputArg, OrderByArg>; }; output: FieldTypeOutputField; views: string; extraOutputFields?: Record>; getAdminMeta?: (adminMeta: AdminMetaRootVal) => JSONValue; unreferencedConcreteInterfaceImplementations?: readonly graphql.ObjectType[]; } & CommonFieldConfig; declare type AnyInputObj = graphql.InputObjectType>>; export declare type TypesForList = { update: AnyInputObj; create: AnyInputObj; uniqueWhere: AnyInputObj; where: AnyInputObj; orderBy: AnyInputObj; output: graphql.ObjectType; findManyArgs: FindManyArgs; relateTo: { many: { where: graphql.InputObjectType<{ every: graphql.Arg; some: graphql.Arg; none: graphql.Arg; }>; create?: graphql.InputObjectType<{ connect: graphql.Arg>>; create?: graphql.Arg>>; }>; update?: graphql.InputObjectType<{ disconnect: graphql.Arg>>; set: graphql.Arg>>; connect: graphql.Arg>>; create?: graphql.Arg>>; }>; }; one: { create?: graphql.InputObjectType<{ create?: graphql.Arg; connect: graphql.Arg; }>; update?: graphql.InputObjectType<{ create?: graphql.Arg; connect: graphql.Arg; disconnect: graphql.Arg; }>; }; }; }; export declare type FindManyArgs = { where: graphql.Arg, true>; orderBy: graphql.Arg>>, true>; take: graphql.Arg; skip: graphql.Arg, true>; }; export declare type FindManyArgsValue = graphql.InferValueFromArgs; export declare function fieldType(dbField: TDBField): | undefined, UpdateArg extends graphql.Arg, UniqueWhereArg extends graphql.Arg, OrderByArg extends graphql.Arg, FilterArg extends graphql.Arg>(graphQLInfo: FieldTypeWithoutDBField) => NextFieldType>;