UNPKG

typegraphql-nestjs

Version:

Basic integration of TypeGraphQL in NestJS. Allows to use TypeGraphQL features while integrating with NestJS modules system and dependency injector.

26 lines (25 loc) 828 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.printSubgraphSchema = void 0; const utils_1 = require("@graphql-tools/utils"); const importUrl = "https://specs.apollo.dev/federation/v2.0"; const directives = [ "@key", "@shareable", "@external", "@override", "@requires", "@tag", "@inaccessible", "@extends", "@provides", ]; const directivesString = directives.map(it => `"${it}"`).join(", "); function printSubgraphSchema(schema, federationVersion) { let typeDefs = (0, utils_1.printSchemaWithDirectives)(schema); if (federationVersion === 2) { typeDefs = typeDefs.replace("schema", `extend schema @link(url: "${importUrl}", import: [${directivesString}])`); } return typeDefs; } exports.printSubgraphSchema = printSubgraphSchema;