async function getWatchedDocumentFilenames(filenames = []) {
  return (
    await Document.where(
      {
        docpath: { in: Object.keys(filenames) },
        watched: true,
      },
      null,
      null,
      null,
      { workspaceId: true, docpath: true }
    )
  ).reduce((result, { workspaceId, docpath }) => {
    const filename = filenames[docpath];
    result[filename] = workspaceId;
    return result;
  }, {});
}
Get a record of filenames and their corresponding workspaceIds that have watched a document
that will be used to determine if a document should be displayed in the watched documents sidebar
@param {string[]} filenames - array of filenames to check for watched workspaces
@returns {Promise<Record<string, string[]>>} - a record of filenames and their corresponding workspaceIds