import type { DistributeOmit, FieldKind, FieldNullability, FieldOptionsFromKind, InferredFieldOptionKeys, InputFieldMap, InputShapeFromFields, InterfaceParam, InterfaceRef, InterfaceTypeOptions, MaybePromise, ObjectParam, ObjectRef, ObjectTypeOptions, OutputRef, OutputShape, OutputType, Resolver, SchemaTypes, ShapeFromTypeParam, TypeParam } from '@pothos/core'; import type DataLoader from 'dataloader'; import type { GraphQLResolveInfo } from 'graphql'; export type DataloaderKey = bigint | number | string; export type LoadableFieldOptions, Nullable extends FieldNullability, Args extends InputFieldMap, ResolveReturnShape, Key, CacheKey, Kind extends FieldKind = FieldKind, ByPath extends boolean = boolean> = Omit, InferredFieldOptionKeys> & { byPath?: ByPath; load: (keys: Key[], context: Types['Context'], args: false extends ByPath ? never : InputShapeFromFields, info: false extends ByPath ? never : GraphQLResolveInfo) => Promise)[]>; loaderOptions?: DataLoader.Options, CacheKey>; sort?: (value: LoaderShapeFromType) => Key; resolve: Resolver, Types['Context'], (Type extends unknown[] ? [OutputRef] : OutputRef) extends infer KeyType ? KeyType extends OutputRef | [OutputRef] ? ShapeFromTypeParam ? Nullable : never> : never : never, ResolveReturnShape>; }; export type LoadableListFieldOptions, Nullable extends FieldNullability<[Type]>, Args extends InputFieldMap, ResolveReturnShape, Key, CacheKey, Kind extends FieldKind = FieldKind, ByPath extends boolean = boolean> = Omit, InferredFieldOptionKeys | 'type'> & { type: Type; byPath?: ByPath; load: (keys: Key[], context: Types['Context'], args: false extends ByPath ? never : InputShapeFromFields, info: false extends ByPath ? never : GraphQLResolveInfo) => Promise)[]>; loaderOptions?: DataLoader.Options, CacheKey>; sort?: (value: ShapeFromTypeParam) => Key; resolve: Resolver, Types['Context'], Key, ResolveReturnShape>; }; export type LoadableGroupFieldOptions, Nullable extends FieldNullability<[Type]>, Args extends InputFieldMap, ResolveReturnShape, Key, CacheKey, Kind extends FieldKind = FieldKind, ByPath extends boolean = boolean> = Omit, InferredFieldOptionKeys | 'type'> & { type: Type; byPath?: ByPath; load: (keys: Key[], context: Types['Context'], args: false extends ByPath ? never : InputShapeFromFields, info: false extends ByPath ? never : GraphQLResolveInfo) => Promise[]>; loaderOptions?: DataLoader.Options[], CacheKey>; group: (value: ShapeFromTypeParam) => Key; resolve: Resolver, Types['Context'], Key, ResolveReturnShape>; }; export type DataLoaderOptions> = { load: (keys: Key[], context: Types['Context']) => Promise; loaderOptions?: DataLoader.Options; } & ({ toKey: (value: Shape) => Key; cacheResolved?: boolean; sort?: boolean; } | { toKey?: undefined; cacheResolved?: (value: Shape) => Key; sort?: (value: Shape) => Key; }); export type DataloaderObjectTypeOptions[], NameOrRef extends ObjectParam | string, CacheKey, Shape> = DataLoaderOptions & ObjectTypeOptions ? NameOrRef : ObjectRef, Shape, Interfaces>; export type LoadableInterfaceOptions[], NameOrRef extends InterfaceParam | string, CacheKey, Shape = ShapeFromLoadResult> = DataLoaderOptions & InterfaceTypeOptions ? NameOrRef : InterfaceRef, Shape, Interfaces>; export type LoadableUnionOptions, CacheKey, Shape> = DataLoaderOptions & PothosSchemaTypes.UnionTypeOptions; export type LoaderShapeFromType, Nullable extends FieldNullability> = Type extends [TypeParam] ? ShapeFromTypeParam : ShapeFromTypeParam; export interface LoadableRef { getDataloader: (context: C) => DataLoader; } export interface LoadableNodeId { id: DistributeOmit>>, 'args' | 'nullable' | 'type'> & { parse?: (id: string, ctx: Types['Context']) => IDShape; }; } export type LoadableNodeOptions[], NameOrRef extends ObjectParam | string, IDShape extends bigint | number | string = string, Key extends bigint | number | string = IDShape, CacheKey = Key, Shape = ShapeFromLoadResult> = DataloaderObjectTypeOptions & LoadableNodeId; export type ShapeFromLoadResult = Exclude; //# sourceMappingURL=types.d.ts.map