1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var graphql_1 = require("graphql");
|
4 | var transform_fields_1 = require("./transform-fields");
|
5 | var debugging_1 = require("../debugging");
|
6 | var get_directives_1 = require("../utils/get-directives");
|
7 | function 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 | }
|
24 | exports.transformGraphQLObject = transformGraphQLObject;
|
25 |
|
\ | No newline at end of file |