import { collection , doc , getDoc , getFirestore , setDoc } from "firebase/firestore/lite" ; import FirebaseService from "./firebase" ; namespace UserDataService { /**
     * Seed user document with files field.
     */ export async function seed ( ) { const firestore = getFirestore ( ) ; await setDoc ( doc ( collection ( firestore , "users" ) , FirebaseService . userId$ . value ) , { files : [ ] } , { merge : true } ) ; } returns { Promise < string [ ] > } export async function getHostedFiles ( ) { const firestore = getFirestore ( ) ; const userDocRef = doc ( collection ( firestore , "users" ) , FirebaseService . userId$ . value ) ; return ( await getDoc ( userDocRef ) ) . get ( "files" ) as string [ ] ; } } export default UserDataService ;