UNPKG

mongo-relay-connection

Version:

Helper for building relay connection from mongoose. Support dynamic collection, but only for single (unique or non-unique) field sorting.

29 lines (23 loc) 605 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _graphql = require("graphql"); var _graphqlRelay = require("graphql-relay"); function mrType(name, nodeType) { const _connectionDefinition = (0, _graphqlRelay.connectionDefinitions)({ name, nodeType, connectionFields: { totalCount: { type: _graphql.GraphQLInt, resolve: conn => conn.totalCount } } }), connectionType = _connectionDefinition.connectionType; return connectionType; } var _default = mrType; exports.default = _default;