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