import { DocumentData, DocumentSnapshot, Firestore, QueryConstraint, QueryDocumentSnapshot, QuerySnapshot } from "firebase/firestore"; import { FirebaseDocumentInfo } from "../types/index"; /** * Get participants collection path for database reference. * @notice all participants related documents are store under `ceremonies//participants` collection path. * nb. This is a rule that must be satisfied. This is NOT an optional convention. * @param ceremonyId - the unique identifier of the ceremony. * @returns - the participants collection path. */ export declare const getParticipantsCollectionPath: (ceremonyId: string) => string; /** * Get circuits collection path for database reference. * @notice all circuits related documents are store under `ceremonies//circuits` collection path. * nb. This is a rule that must be satisfied. This is NOT an optional convention. * @param ceremonyId - the unique identifier of the ceremony. * @returns - the participants collection path. */ export declare const getCircuitsCollectionPath: (ceremonyId: string) => string; /** * Get contributions collection path for database reference. * @notice all contributions related documents are store under `ceremonies//circuits//contributions` collection path. * nb. This is a rule that must be satisfied. This is NOT an optional convention. * @param ceremonyId - the unique identifier of the ceremony. * @param circuitId - the unique identifier of the circuit. * @returns - the contributions collection path. */ export declare const getContributionsCollectionPath: (ceremonyId: string, circuitId: string) => string; /** * Get timeouts collection path for database reference. * @notice all timeouts related documents are store under `ceremonies//participants//timeouts` collection path. * nb. This is a rule that must be satisfied. This is NOT an optional convention. * @param ceremonyId - the unique identifier of the ceremony. * @param participantId - the unique identifier of the participant. * @returns - the timeouts collection path. */ export declare const getTimeoutsCollectionPath: (ceremonyId: string, participantId: string) => string; /** * Helper for query a collection based on certain constraints. * @param firestoreDatabase - the Firestore service instance associated to the current Firebase application. * @param collection - the name of the collection. * @param queryConstraints > - a sequence of where conditions. * @returns >> - return the matching documents (if any). */ export declare const queryCollection: (firestoreDatabase: Firestore, collection: string, queryConstraints: Array) => Promise>; /** * Helper for obtaining uid and data for query document snapshots. * @param queryDocSnap > - the array of query document snapshot to be converted. * @returns Array */ export declare const fromQueryToFirebaseDocumentInfo: (queryDocSnap: Array) => Array; /** * Fetch for all documents in a collection. * @param firestoreDatabase - the Firestore service instance associated to the current Firebase application. * @param collection - the name of the collection. * @returns >>> - return all documents (if any). */ export declare const getAllCollectionDocs: (firestoreDatabase: Firestore, collection: string) => Promise>>; /** * Get a specific document from database. * @param firestoreDatabase - the Firestore service instance associated to the current Firebase application. * @param collection - the name of the collection. * @param documentId - the unique identifier of the document in the collection. * @returns >> - return the document from Firestore. */ export declare const getDocumentById: (firestoreDatabase: Firestore, collection: string, documentId: string) => Promise>; /** * Query for opened ceremonies. * @param firestoreDatabase - the Firestore service instance associated to the current Firebase application. * @returns >> */ export declare const getOpenedCeremonies: (firestoreDatabase: Firestore) => Promise>; /** * Query for ceremony circuits. * @notice the order by sequence position is fundamental to maintain parallelism among contributions for different circuits. * @param firestoreDatabase - the Firestore service instance associated to the current Firebase application. * @param ceremonyId - the ceremony unique identifier. * @returns Promise> - the ceremony' circuits documents ordered by sequence position. */ export declare const getCeremonyCircuits: (firestoreDatabase: Firestore, ceremonyId: string) => Promise>; /** * Query for a specific ceremony' circuit contribution from a given contributor (if any). * @notice if the caller is a coordinator, there could be more than one contribution (= the one from finalization applies to this criteria). * @param firestoreDatabase - the Firestore service instance associated to the current Firebase application. * @param ceremonyId - the unique identifier of the ceremony. * @param circuitId - the unique identifier of the circuit. * @param participantId - the unique identifier of the participant. * @returns >> - the document info about the circuit contributions from contributor. */ export declare const getCircuitContributionsFromContributor: (firestoreDatabase: Firestore, ceremonyId: string, circuitId: string, participantId: string) => Promise>; /** * Query for the active timeout from given participant for a given ceremony (if any). * @param ceremonyId - the identifier of the ceremony. * @param participantId - the identifier of the participant. * @returns >> - the document info about the current active participant timeout. */ export declare const getCurrentActiveParticipantTimeout: (firestoreDatabase: Firestore, ceremonyId: string, participantId: string) => Promise>; /** * Query for the closed ceremonies. * @notice a ceremony is closed when the period for receiving new contributions has ended. * @dev when the ceremony is closed it becomes ready for finalization. * @param firestoreDatabase - the Firestore service instance associated to the current Firebase application. * @returns >> - the list of closed ceremonies. */ export declare const getClosedCeremonies: (firestoreDatabase: Firestore) => Promise>; //# sourceMappingURL=database.d.ts.map