import groq from 'groq'; export default function getMostRecentRevisions(filter: string) { return groq` { "drafts": select( !$live => *[ ${filter} && _id in path("drafts.**") ], $live => [] ), "published": *[ ${filter} && !(_id in path("drafts.**")) ], } { "current": published[ !("drafts." + @._id in ^.drafts[]._id) ] + drafts }.current[]`; }