queryToVariables<_Model extends GraphqlModel> method
Remove associations from variables and transform them from field names to document node names.
Implementation
Map<String, dynamic> queryToVariables<_Model extends GraphqlModel>(Query? query) {
if (query?.where == null) return {};
final adapter = modelDictionary.adapterFor[_Model]!;
return query!.where!.fold<Map<String, dynamic>>(<String, dynamic>{}, (allVariables, where) {
final definition = adapter.fieldsToGraphqlRuntimeDefinition[where.evaluatedField];
if (definition != null && !definition.association) {
allVariables[definition.documentNodeName] = where.value;
}
return allVariables;
});
}