transformSchema.js 1002 B

12345678910111213141516171819202122
  1. Object.defineProperty(exports, "__esModule", { value: true });
  2. var makeExecutableSchema_1 = require("../makeExecutableSchema");
  3. var visitSchema_1 = require("../transforms/visitSchema");
  4. var transforms_1 = require("../transforms/transforms");
  5. var resolvers_1 = require("../stitching/resolvers");
  6. function transformSchema(targetSchema, transforms) {
  7. var schema = visitSchema_1.visitSchema(targetSchema, {}, true);
  8. var mapping = resolvers_1.generateSimpleMapping(targetSchema);
  9. var resolvers = resolvers_1.generateProxyingResolvers(targetSchema, transforms, mapping);
  10. schema = makeExecutableSchema_1.addResolveFunctionsToSchema({
  11. schema: schema,
  12. resolvers: resolvers,
  13. resolverValidationOptions: {
  14. allowResolversNotInSchema: true,
  15. },
  16. });
  17. schema = transforms_1.applySchemaTransforms(schema, transforms);
  18. schema.transforms = transforms;
  19. return schema;
  20. }
  21. exports.default = transformSchema;
  22. //# sourceMappingURL=transformSchema.js.map