firebase-tools-extra
Version:
Extra functionality for firebase-tools with support for emulators and auth through service account.
50 lines (49 loc) • 1.76 kB
TypeScript
export declare type FirestoreAction = 'get' | 'set' | 'add' | 'update' | 'delete';
/**
* Methods that are applicable on a ref for a get action
*/
export interface FirestoreQueryMethods {
orderBy?: string;
startAt?: any;
startAfter?: any;
where?: [string | FirebaseFirestore.FieldPath, FirebaseFirestore.WhereFilterOp, any];
limit?: number;
}
/**
* Options for Firestore get action
*/
export interface FirestoreGetOptions extends FirestoreQueryMethods {
pretty?: boolean;
output?: boolean;
emulator?: boolean;
debug?: boolean;
}
/**
* Get data from Firestore at given path (works for documents & collections)
* @param actionPath - Path where to run firestore get
* @param options - Options object
* @returns Data value that results from running get within Firestore
*/
export declare function firestoreGet(actionPath: string, options?: any): Promise<any>;
/**
* Run write action for Firestore
* @param action - Firestore action to run
* @param actionPath - Path at which Firestore action should be run
* @param filePath - Path to file to write
* @param options - Options object
* @returns Results of running action within Firestore
*/
export declare function firestoreWrite(action: "add" | "update" | "get" | "set" | "delete" | undefined, actionPath: string, filePath?: string, options?: any): Promise<any>;
interface FirestoreDeleteOptions {
batchSize?: number;
emulator?: boolean;
debug?: boolean;
}
/**
* Delete data from Firestore
* @param actionPath - Path at which Firestore action should be run
* @param options - Options object
* @returns Action within Firestore
*/
export declare function firestoreDelete(actionPath: string, options?: FirestoreDeleteOptions): Promise<any>;
export {};