Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

(introspection) - Improve schema minification by removing meta types (#1351)

authored by

Phil Pluckthun and committed by
GitHub
c38c721e 27a88abb

+26 -10
+5
.changeset/orange-maps-raise.md
··· 1 + --- 2 + '@urql/introspection': minor 3 + --- 4 + 5 + Update `minifyIntrospectionQuery` utility to remove additional information on arguments and to filter out schema metadata types, like `__Field` and others.
+21 -10
packages/introspection/src/minifyIntrospectionQuery.ts
··· 57 57 args: 58 58 field.args && 59 59 field.args.map(arg => ({ 60 - ...arg, 60 + name: arg.name, 61 61 type: mapType(arg.type, anyType), 62 - defaultValue: undefined, 63 62 })), 64 63 } as any) 65 64 ), ··· 84 83 args: 85 84 field.args && 86 85 field.args.map(arg => ({ 87 - ...arg, 86 + name: arg.name, 88 87 type: mapType(arg.type, anyType), 89 - defaultValue: undefined, 90 88 })), 91 89 } as any) 92 90 ), ··· 133 131 } = schema; 134 132 135 133 const minifiedTypes = types 136 - .filter( 137 - type => 138 - type.kind === 'OBJECT' || 139 - type.kind === 'INTERFACE' || 140 - type.kind === 'UNION' 141 - ) 134 + .filter(type => { 135 + switch (type.name) { 136 + case '__Directive': 137 + case '__DirectiveLocation': 138 + case '__EnumValue': 139 + case '__InputValue': 140 + case '__Field': 141 + case '__Type': 142 + case '__TypeKind': 143 + case '__Schema': 144 + return false; 145 + default: 146 + return ( 147 + type.kind === 'OBJECT' || 148 + type.kind === 'INTERFACE' || 149 + type.kind === 'UNION' 150 + ); 151 + } 152 + }) 142 153 .map(minifyIntrospectionType); 143 154 144 155 minifiedTypes.push({ kind: 'SCALAR', name: anyType.name });