protected function resolveFieldsFunction($definition): Closure
    {
        return function () use ($definition): array {
            return (new Collection($definition->fields))
                ->mapWithKeys(function (FieldDefinitionNode $fieldDefinition) use ($definition): array {
                    $fieldValue = new FieldValue(
                        new NodeValue($definition),
                        $fieldDefinition
                    );

                    return [
                        $fieldDefinition->name->value => app(FieldFactory::class)->handle($fieldValue),
                    ];
                })
                ->toArray();
        };
    }