UNPKG

1.25 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var graphql_1 = require("graphql");
4var transform_fields_1 = require("./transform-fields");
5var debugging_1 = require("../debugging");
6var get_directives_1 = require("../utils/get-directives");
7function transformGraphQLObject(schema, object) {
8 debugging_1.debugLog("[transformGraphQLObject] transforming type " + object.name);
9 var resolvedFields = transform_fields_1.resolveFields(schema, object.getFields(), object);
10 var resolvedInterfaces = object instanceof graphql_1.GraphQLObjectType ? object.getInterfaces().map(function (inf) { return inf.name; }) : [];
11 var directives = get_directives_1.getDirectives(schema, object);
12 return {
13 name: object.name,
14 description: object.description || '',
15 fields: resolvedFields,
16 interfaces: resolvedInterfaces,
17 isInputType: object instanceof graphql_1.GraphQLInputObjectType,
18 hasFields: resolvedFields.length > 0,
19 hasInterfaces: resolvedInterfaces.length > 0,
20 directives: directives,
21 usesDirectives: Object.keys(directives).length > 0
22 };
23}
24exports.transformGraphQLObject = transformGraphQLObject;
25//# sourceMappingURL=transform-object.js.map
\No newline at end of file