This has been addressed in JSS 16+ where hasLayout computed field has been added to query content items with layout. You can use this query below to get this result.
{
search(fieldsEqual: [{name: "hasLayout", value: "True"}]) {
results {
items {
id
name
}
}
}
}
If you're in JSS 15 below you need to add a computed field that checks if Layout exists and add it to your config.
public class HasLayout : IComputedIndexField
{
public object ComputeFieldValue(IIndexable indexable)
{
Item item = (indexable as SitecoreIndexableItem);
return item.Visualization != null && item.Visualization.Layout != null;
}
public string FieldName { get; set; }
public string ReturnType { get; set; }
}