UNPKG

@pothos/core

Version:

Pothos (formerly GiraphQL) is a plugin based schema builder for creating code-first GraphQL schemas in typescript

35 lines (34 loc) 1.85 kB
import type { BuildCache } from '../build-cache.js'; import type { PothosInputFieldConfig, PothosInputFieldType, PothosTypeConfig, SchemaTypes } from '../types/index.js'; export interface InputTypeFieldsMapping<Types extends SchemaTypes, T> { configs: Record<string, PothosInputFieldConfig<Types>>; map: InputFieldsMapping<Types, T> | null; } export type InputFieldMapping<Types extends SchemaTypes, T> = { kind: "Enum"; isList: boolean; listDepth: number; config: PothosInputFieldConfig<Types>; value: T; } | { kind: "InputObject"; config: PothosInputFieldConfig<Types>; isList: boolean; listDepth: number; value: T | null; fields: InputTypeFieldsMapping<Types, T>; } | { kind: "Scalar"; isList: boolean; listDepth: number; config: PothosInputFieldConfig<Types>; value: T; }; export type InputFieldsMapping<Types extends SchemaTypes, T> = Map<string, InputFieldMapping<Types, T>>; export declare function resolveInputTypeConfig<Types extends SchemaTypes>(type: PothosInputFieldType<Types>, buildCache: BuildCache<Types>): Extract<PothosTypeConfig, { kind: "Enum" | "InputObject" | "Scalar"; }>; export declare function mapInputFields<Types extends SchemaTypes, T>(inputs: Record<string, PothosInputFieldConfig<Types>>, buildCache: BuildCache<Types>, mapper: (config: PothosInputFieldConfig<Types>) => T | null, cache?: Map<string, InputTypeFieldsMapping<Types, T>>): InputFieldsMapping<Types, T> | null; export declare function createInputValueMapper<Types extends SchemaTypes, T, Args extends unknown[] = [ ]>(argMap: InputFieldsMapping<Types, T>, mapValue: (val: unknown, mapping: InputFieldMapping<Types, T>, ...args: Args) => unknown): (obj: object, map?: InputFieldsMapping<Types, T>, ...args: Args) => Record<string, unknown>; //# sourceMappingURL=input.d.ts.map