INNER CODE UNIT · TypeScript

getGraphQLInsertTypeFields

OS-Guild/graphql-to-mongodb · src/graphQLInsertType.ts:14

function getGraphQLInsertTypeFields(graphQLType: GraphQLObjectType, ...excludedFields: string[]) : () => FieldMap<GraphQLInputType> {
    return () => {
        const fields = getUnresolvedFieldsTypes(graphQLType, getGraphQLInsertTypeNested, ...excludedFields)();

        const idField = fields['_id'];

        if (idField && idField.type instanceof GraphQLNonNull) {
            idField.type = idField.type.ofType;
        }

        return fields;
    };
}

function getGraphQLInsertTypeNested(
    type: GraphQLScalarType | GraphQLEnumType | GraphQLNonNull<any> | GraphQLObjectType | GraphQLList<any>, 
    ...excludedFields: string[]) : GraphQLInputType {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…