UNPKG

@gqlts/cli

Version:

Generate a client sdk from your GraphQl API

37 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.comment = comment; exports.typeComment = typeComment; exports.fieldComment = fieldComment; exports.argumentComment = argumentComment; function comment(comment) { const lines = []; if (comment.deprecated) { lines.push(`@deprecated ${comment.deprecated.replace(/\s/g, ' ')}`); } if (comment.text) { lines.push(...comment.text.split('\n')); } return lines.length > 0 ? lines.length === 1 ? `\n/** ${lines[0]} */\n` : `\n/**\n${lines.map((l) => ` * ${l}`).join('\n')}\n */\n` : ''; } function typeComment(type) { return comment({ text: type.description, }); } function fieldComment(field) { return comment({ deprecated: field.deprecationReason, text: field.description, }); } function argumentComment(arg) { return comment({ text: arg.description, }); } //# sourceMappingURL=comment.js.map