@nestjs/graphql
Version:
GraphQL for NestJS: code-first and schema-first APIs, resolvers as providers, subscriptions, federation and generated SDL, on Apollo or Mercurius.
21 lines • 794 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createScalarType = createScalarType;
const graphql_1 = require("graphql");
function bindInstanceContext(instance, funcKey) {
return instance[funcKey]
? instance[funcKey].bind(instance)
: undefined;
}
function createScalarType(name, instance) {
return new graphql_1.GraphQLScalarType({
name,
description: instance.description,
specifiedByURL: instance.specifiedByURL,
extensions: instance.extensions,
parseValue: bindInstanceContext(instance, 'parseValue'),
serialize: bindInstanceContext(instance, 'serialize'),
parseLiteral: bindInstanceContext(instance, 'parseLiteral'),
});
}
//# sourceMappingURL=scalar-types.utils.js.map