UNPKG

1.13 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var debugging_1 = require("../debugging");
4var get_directives_1 = require("../utils/get-directives");
5function transformGraphQLEnum(schema, graphqlEnum) {
6 debugging_1.debugLog("[transformGraphQLEnum] transformed enum " + graphqlEnum.name);
7 var directives = get_directives_1.getDirectives(schema, graphqlEnum);
8 var enumValues = graphqlEnum.getValues().map(function (enumItem) {
9 var valueDirectives = get_directives_1.getDirectives(schema, enumItem);
10 return {
11 name: enumItem.name,
12 description: enumItem.description || '',
13 value: enumItem.value,
14 directives: valueDirectives,
15 usesDirectives: Object.keys(valueDirectives).length > 0
16 };
17 });
18 return {
19 name: graphqlEnum.name,
20 description: graphqlEnum.description || '',
21 values: enumValues,
22 directives: directives,
23 usesDirectives: Object.keys(directives).length > 0
24 };
25}
26exports.transformGraphQLEnum = transformGraphQLEnum;
27//# sourceMappingURL=transform-enum.js.map
\No newline at end of file