Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 17x 17x 17x 17x 17x 117x 117x 1x 116x 73x 43x 3x 40x 2x 38x 3x 35x 19x 16x 3x 13x 4x 9x 17x 3x 3x 3x 3x 3x 2x 2x 4x 17x | import { isType, GraphQLType, GraphQLList, GraphQLNonNull } from 'graphql'; import { Thunk } from 'services/types'; import { objectTypeRegistry, compileObjectType, inputObjectTypeRegistry, compileInputObjectType, } from 'domains'; import { enumsRegistry, unionRegistry } from 'domains'; import { parseNativeTypeToGraphQL, isParsableScalar } from './parseNative'; export function resolveType(input: any, allowThunk = true): GraphQLType { if (isType(input)) { return input; } if (isParsableScalar(input)) { return parseNativeTypeToGraphQL(input); } if (Array.isArray(input)) { return resolveListType(input); } if (enumsRegistry.has(input)) { return enumsRegistry.get(input); } if (unionRegistry.has(input)) { return unionRegistry.get(input)(); } if (objectTypeRegistry.has(input)) { return compileObjectType(input); } I if (inputObjectTypeRegistry.has(input)) { return compileInputObjectType(input); } ifI (!allowThunk || typeof input !== 'function') { return; } return resolveType(input(), false); } E function resolveListType(input: any[]): GraphQLType { if (input.length !== 1) { return; } const [itemType] = input; const resolvedItemType = resolveType(itemType); if (!resolvedItemType) { return; } return new GraphQLList(new GraphQLNonNull(resolvedItemType)); } export function resolveTypesList(types: Thunk<any[]>): GraphQLType[] { if (Array.isArray(types)) { return types.map(type => { return resolveType(type); }); } return types().map(type => { return resolveType(type); }); } |