import { deleteData, entries } from '../../utils/data.utils';
export const docEntries = async (_userId) => entries({ startsWith: '/docs/', notContains: '/paragraphs/' });
export const deleteDoc = async (docId) => deleteData({ key: `/docs/${docId}` });
// Backwards compatibility with current publish mask in studio and Firebase support. In case of IC we actually do not need a snapshot, publish is synchronous on the client side.
export const snapshotDoc = async ({ onNext }) => {
  document.addEventListener('docPublished', ({ detail }) => onNext(detail), { passive: true });
  return () => document.removeEventListener('docPublished', ({ detail }) => onNext(detail), false);
};
