@pothos/core
Version:
Pothos (formerly GiraphQL) is a plugin based schema builder for creating code-first GraphQL schemas in typescript
30 lines • 1.76 kB
TypeScript
import type { BuildCache } from '../build-cache';
import type { PothosInputFieldConfig, PothosInputFieldType, PothosTypeConfig, SchemaTypes } from '../types';
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;
config: PothosInputFieldConfig<Types>;
value: T;
} | {
kind: 'InputObject';
config: PothosInputFieldConfig<Types>;
isList: boolean;
value: T | null;
fields: InputTypeFieldsMapping<Types, T>;
} | {
kind: 'Scalar';
isList: boolean;
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