firestore-snapshot-utils
Version:
[](https://github.com/ericvera/firestore-snapshot-utils/blob/master/LICENSE) [ • 2.62 kB
TypeScript
import type { QueryDocumentSnapshot } from 'firebase-admin/firestore';
export interface DBSnapshotChanges {
added: AddedDocumentSnapshot[];
removed: RemovedDocumentSnapshot[];
modified: ModifiedDocumentSnapshot[];
unmodified: UnmodifiedDocumentSnapshot[];
}
declare abstract class BaseDocumentSnapshot {
protected readonly doc: QueryDocumentSnapshot;
protected readonly normalizedData?: unknown | undefined;
readonly normalizedPath: string;
constructor(doc: QueryDocumentSnapshot, allDocs: QueryDocumentSnapshot[], normalizedData?: unknown | undefined);
abstract getDiff(): string | undefined;
}
export declare class AddedDocumentSnapshot extends BaseDocumentSnapshot {
readonly addedDoc: QueryDocumentSnapshot;
private normalizedAddedData;
constructor(addedDoc: QueryDocumentSnapshot, normalizedAddedData: unknown, allDocs: QueryDocumentSnapshot[]);
/**
* Returns a string with the differences between two objects or undefined if
* there are no differences.
* Timestamps are normalized to a string representation before comparison.
*/
getDiff(): string | undefined;
}
export declare class RemovedDocumentSnapshot extends BaseDocumentSnapshot {
private normalizedRemovedData;
constructor(removedDoc: QueryDocumentSnapshot, normalizedRemovedData: unknown, allDocs: QueryDocumentSnapshot[]);
/**
* Returns a string with the differences between two objects or undefined if
* there are no differences.
* Timestamps are normalized to a string representation before comparison.
*/
getDiff(): string | undefined;
}
export declare class ModifiedDocumentSnapshot extends BaseDocumentSnapshot {
readonly beforeDoc: QueryDocumentSnapshot;
readonly afterDoc: QueryDocumentSnapshot;
private normalizedBeforeData;
private normalizedAfterData;
constructor(beforeDoc: QueryDocumentSnapshot, afterDoc: QueryDocumentSnapshot, normalizeBeforeData: unknown, normalizeAfterData: unknown, allDocs: QueryDocumentSnapshot[]);
/**
* Returns a string with the differences between two objects or undefined if
* there are no differences.
* Timestamps are normalized to a string representation before comparison.
*/
getDiff(): string | undefined;
}
export declare class UnmodifiedDocumentSnapshot extends BaseDocumentSnapshot {
/**
* Returns a string with the differences between two objects or undefined if
* there are no differences.
* Timestamps are normalized to a string representation before comparison.
*/
getDiff(): string | undefined;
}
export {};