import { Document as v1Document } from "@firestore-emulator/proto/dist/google/firestore/v1/document"; import type { ListenRequest as v1ListenRequest } from "@firestore-emulator/proto/dist/google/firestore/v1/firestore"; import { ListenResponse as v1ListenResponse } from "@firestore-emulator/proto/dist/google/firestore/v1/firestore"; import type { StructuredQuery as v1StructuredQuery } from "@firestore-emulator/proto/dist/google/firestore/v1/query"; import type { DocumentTransformFieldTransform as v1DocumentTransformFieldTransform, Write as v1Write } from "@firestore-emulator/proto/dist/google/firestore/v1/write"; import { WriteResult as v1WriteResult } from "@firestore-emulator/proto/dist/google/firestore/v1/write"; import { Timestamp } from "@firestore-emulator/proto/dist/google/protobuf/timestamp"; import type { TypeSafeEventEmitter } from "typesafe-event-emitter"; import type { FirestoreStateDocumentFields } from "./field"; interface Events { "add-collection": { collection: FirestoreStateCollection; }; "add-database": { database: FirestoreStateDatabase; }; "add-document": { document: FirestoreStateDocument; }; "add-project": { project: FirestoreStateProject; }; "clear-all-projects": Record; "create-document": { document: FirestoreStateDocument; }; "delete-document": { document: FirestoreStateDocument; }; "update-document": { document: FirestoreStateDocument; }; } export interface HasCollections { getCollection(collectionName: string): FirestoreStateCollection; getPath(): string; } type FirestoreStateDocumentMetadata = { createdAt: null; hasExist: false; updatedAt: null; } | { createdAt: Date; hasExist: true; updatedAt: Date; }; export declare class FirestoreStateDocument implements HasCollections { private emitter; readonly database: FirestoreStateDatabase; readonly parent: FirestoreStateCollection; readonly name: string; private fields; private collections; metadata: FirestoreStateDocumentMetadata; constructor(emitter: TypeSafeEventEmitter, database: FirestoreStateDatabase, parent: FirestoreStateCollection, name: string, fields: Record, collections: Record); iterateFromRoot(): FirestoreStateDocument[]; hasChild(): boolean; getCollection(collectionName: string): FirestoreStateCollection; toV1Document(): v1Document; toV1DocumentObject(): ReturnType; toJSON(): { collections: Record>; fields: Record>; path: string; }; create(date: Date, fields: Record): void; update(date: Date, fields: Record, updateMask?: string[]): void; set(date: Date, fields: Record, updateMask?: string[]): void; delete(): void; getField(path: string): FirestoreStateDocumentFields | undefined; getPath(): string; getDocumentPath(): string; v1Transform(date: Date, transforms: v1DocumentTransformFieldTransform[]): void; } export declare class FirestoreStateCollection { private emitter; readonly database: FirestoreStateDatabase; readonly parent: FirestoreStateDocument | FirestoreStateDatabase; readonly name: string; private documents; constructor(emitter: TypeSafeEventEmitter, database: FirestoreStateDatabase, parent: FirestoreStateDocument | FirestoreStateDatabase, name: string, documents: Record); getDocument(documentName: string): FirestoreStateDocument; hasChild(): boolean; getAllDocuments(): FirestoreStateDocument[]; toJSON(): { documents: { [k: string]: { collections: Record>; fields: Record>; path: string; }; }; path: string; }; getPath(): string; getDocumentPath(): string; } export declare class FirestoreStateDatabase implements HasCollections { private emitter; readonly project: FirestoreStateProject; readonly name: string; private collections; constructor(emitter: TypeSafeEventEmitter, project: FirestoreStateProject, name: string, collections: Record); getCollection(collectionName: string): FirestoreStateCollection; toJSON(): { collections: { [k: string]: { documents: { [k: string]: { collections: Record>; fields: Record>; path: string; }; }; path: string; }; }; path: string; }; getPath(): string; } export declare class FirestoreStateProject { private emitter; readonly name: string; private databases; constructor(emitter: TypeSafeEventEmitter, name: string, databases: Record); toJSON(): { databases: { [k: string]: { collections: { [k: string]: { documents: { [k: string]: { collections: Record>; fields: Record>; path: string; }; }; path: string; }; }; path: string; }; }; path: string; }; getPath(): string; getDatabase(databaseName: string): FirestoreStateDatabase; } export declare const TimestampFromDate: (date: Date) => Timestamp; export declare const DateFromTimestamp: (timestamp: Timestamp) => Date; export declare const TimestampFromNow: () => Timestamp; export declare class FirestoreState { private projects; readonly emitter: TypeSafeEventEmitter; constructor(projects?: Record); toJSON(): { projects: { [k: string]: { databases: { [k: string]: { collections: { [k: string]: { documents: { [k: string]: { collections: Record>; fields: Record>; path: string; }; }; path: string; }; }; path: string; }; }; path: string; }; }; }; getProject(projectName: string): FirestoreStateProject; getCollection(path: string): FirestoreStateCollection; getDocument(path: string): FirestoreStateDocument; clear(): void; writeV1Document(date: Date, write: v1Write): v1WriteResult; v1Query(parent: string, query: v1StructuredQuery): FirestoreStateDocument[]; v1Listen(listen: v1ListenRequest, callback: (response: v1ListenResponse) => void, onEnd: (handler: () => void) => void): void; } export {}; //# sourceMappingURL=index.d.ts.map