import { GraphQLResolveInfo } from 'graphql'; import { GraphweaverSchemaInfoExtensionWithSourceEntity } from '../schema-builder'; import { BaseContext } from '@apollo/server'; import { Filter, ReadHookParams, ResolverOptions } from '../types'; import { EntityMetadata } from '../metadata'; export declare const getGraphweaverMutationType: (info: GraphQLResolveInfo) => GraphweaverSchemaInfoExtensionWithSourceEntity["type"] | undefined; export type ID = string | number | bigint; /** * Retrieves the ID value from the source data. * If the id is a function then it calls it to get the ID value. * If the id is a string then it tries to get the value from the source data. */ export declare const getIdValue: (id: string | bigint | ((dataEntity: D) => string | number | bigint | undefined) | undefined, source: G) => ID | ID[] | undefined; interface ConstructFilterForRelatedEntityParams { resolverOptions: ResolverOptions<{ filter: Filter; }, C, G>; idValue: ID | ID[] | undefined; relatedPrimaryKeyField: string; relatedField: string | undefined; relatedEntityMetadata: EntityMetadata; sourcePrimaryKeyField: keyof G; } /** * For this entity we may get a filter, this is the filter passed by the client for this entity, * we then get this filter and _and it with the filter for the relationship. * Both the resulting filter and the relationship filter are returned so that later we can remove the relationship filter from the filter. */ export declare const constructFilterForRelatedEntity: (params: ConstructFilterForRelatedEntityParams) => { relatedEntityFilter: Filter; relationshipFilterChunk: Filter; }; /** * To load the entities in bulk, we need a filter that doesn't contain the relationship filter. * This function will remove the relationship filter from the filter. */ export declare const getLoaderFilter: (hookParams: ReadHookParams, relationshipFilterChunk: Filter) => Filter | undefined; interface GetDataEntitiesParams { source: G; idValue: ID | ID[] | undefined; field: EntityMetadata['fields'][string]; sourcePrimaryKeyField: keyof G; loaderFilter: Filter | undefined; gqlEntityType: { new (...args: any[]): R; }; } /** * Fetches the data entities for the given field. * If the field has a relatedField, it will use the relatedField to load the data entities. * If the field has an id, it will use the id to load the data entities. */ export declare const getDataEntities: (params: GetDataEntitiesParams) => Promise; export {};