( _schema: IntrospectionSchema, kind: GraphqlOperationKind, typeName: string | null | undefined, types: ReadonlyMap<string, IntrospectionType>, )
| 175 | // --------------------------------------------------------------------------- |
| 176 | |
| 177 | const extractFields = ( |
| 178 | _schema: IntrospectionSchema, |
| 179 | kind: GraphqlOperationKind, |
| 180 | typeName: string | null | undefined, |
| 181 | types: ReadonlyMap<string, IntrospectionType>, |
| 182 | ): ExtractedField[] => { |
| 183 | if (!typeName) return []; |
| 184 | |
| 185 | const type = types.get(typeName); |
| 186 | if (!type?.fields) return []; |
| 187 | |
| 188 | return type.fields |
| 189 | .filter((f) => !f.name.startsWith("__")) |
| 190 | .map((field) => { |
| 191 | const args = field.args.map((arg) => |
| 192 | GraphqlArgument.make({ |
| 193 | name: arg.name, |
| 194 | typeName: formatTypeRef(arg.type), |
| 195 | required: isNonNull(arg.type), |
| 196 | description: arg.description ? Option.some(arg.description) : Option.none(), |
| 197 | }), |
| 198 | ); |
| 199 | |
| 200 | const inputSchema = buildInputSchema(field.args, types); |
| 201 | |
| 202 | return ExtractedField.make({ |
| 203 | fieldName: field.name, |
| 204 | kind, |
| 205 | description: field.description ? Option.some(field.description) : Option.none(), |
| 206 | arguments: args, |
| 207 | inputSchema: inputSchema ? Option.some(inputSchema) : Option.none(), |
| 208 | returnTypeName: unwrapTypeName(field.type), |
| 209 | }); |
| 210 | }); |
| 211 | }; |
| 212 | |
| 213 | // --------------------------------------------------------------------------- |
| 214 | // Public API |
no test coverage detected