firestore-auto-sync
Version:
<a href="https://www.npmjs.com/package/firestore-auto-sync"><img src="https://img.shields.io/npm/v/firestore-auto-sync.svg" alt="Total Downloads"></a> <a href="https://www.npmjs.com/package/firestore-auto-sync"><img src="https://img.shields.io/npm/dw/fire
34 lines (33 loc) • 1.05 kB
TypeScript
import { O } from "ts-toolbelt";
import type { Change } from "firebase-functions";
import type { DocumentSnapshot } from "firebase-admin/firestore";
export declare function isCreateEvent<T>(change: Change<DocumentSnapshot<any>>): change is O.Merge<{
before: {
data: () => undefined;
exists: false;
};
after: {
data: () => Partial<T>;
exists: true;
};
}, Change<DocumentSnapshot<Partial<T>>>, "deep">;
export declare function isUpdateEvent<T>(change: Change<DocumentSnapshot<any>>): change is O.Merge<{
before: {
data: () => Partial<T>;
exists: true;
};
after: {
data: () => Partial<T>;
exists: true;
};
}, Change<DocumentSnapshot<Partial<T>>>, "deep">;
export declare function isDeleteEvent<T>(change: Change<DocumentSnapshot<any>>): change is O.Merge<{
before: {
data: () => Partial<T>;
exists: true;
};
after: {
data: () => undefined;
exists: false;
};
}, Change<DocumentSnapshot<Partial<T>>>, "deep">;