import { GraphQLFieldConfigArgumentMap } from "graphql"; import * as Knex from "knex"; import { Dict } from "./utils/util-types"; import { ArgMapping } from "./ArgMapping"; import { MappedDataSource } from "./MappedDataSource"; /** * Dictionary of [ArgMapping](api:ConfigType:ArgMapping) * * @api-category ConfigType */ export declare type ArgMappingDict = { [K in keyof TArgs]: ArgMapping; }; /** * Derive the type of arguments object (args) that the resolver receives from the ArgMapping specification. */ export declare type ArgsType = { [K in keyof T]: T[K]["type"]["Type"]; }; /** * Input argument configuration mapper. * * There shouldn't be a need to extend or instantiate this class. Use the mapArgs function instead to map an argument * mapping configuration to a MappedArgs instance. * * @api-category MapperClass */ export declare class MappedArgs { private mapping; constructor(mapping: ArgMappingDict); /** * This Getter can be used to get the static type for the arguments object. * * Example: * ``` * const productsArgs: ArgMapping = mapArgs({ * department_ids: { * type: types.array(types.number), * } * }) * * type IProductArgs = typeof productArgs["ArgsType"]; * // IProductArgs is * // {department_ids: number[]} * ``` * * This getter should be used only for extracting type information. * Invoking the getter at runtime will cause an error to be thrown. */ get ArgsType(): TArgs; /** * Getter to access the ArgMappingDict specification type from which this instance was derived. * * This getter should be used only for extracting type information. * Invoking the getter at runtime will cause an error to be thrown. */ get ArgsMappingType(): ArgMappingDict; /** * @returns The GraphQLFieldConfigArgumentMap (which is passed to graphql-js) derived from the specified argument mapping. */ getMappedArgsFor(dataSource?: MappedDataSource): GraphQLFieldConfigArgumentMap; /** * Apply all argument level query interceptors on the database query being constructed * for this operation. */ interceptQuery(qb: Knex.QueryBuilder, args: TArgs): Knex.QueryBuilder; /** * Apply all argument level entity interceptors on an entity which is being used * for the operation. */ interceptEntity(entity: Partial): Partial; } /** * Map arguments for an operation. * * ``` * const args: ArgMapping = mapArgs({ * department_ids: { * type: types.array(types.number), * } * }) * ``` * * @api-category PrimaryAPI */ export declare function mapArgs(mapping: ArgMappingDict): MappedArgs;