firestore-facade
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -6,14 +6,5 @@ import type { firestore } from "firebase-admin"; | ||
set: (documentId: string, data: T) => Promise<firestore.WriteResult>; | ||
/** | ||
* @TODO firestore.UpdateData is not strict at all, we need to find | ||
* a way to type the data argument. | ||
* | ||
* Problem is that update can get many different types, including number | ||
* increments and array remove/union instructions. | ||
* See https://firebase.google.com/docs/firestore/manage-data/add-data#web-version-9_4 | ||
* | ||
* So not sure how strict we can get here. | ||
*/ | ||
update: (documentId: string, data: Partial<T> | FieldPaths<T>) => Promise<firestore.WriteResult>; | ||
get: (documentId: string) => Promise<import("./documents.js").FirestoreDocument<unknown>>; | ||
update: (documentId: string, data: Partial<T> | Partial<FieldPaths<T>>) => Promise<firestore.WriteResult>; | ||
updateFields: (documentId: string, data: Partial<FieldPaths<T>>) => Promise<firestore.WriteResult>; | ||
get: (documentId: string) => Promise<import("./documents.js").FirestoreDocument<T>>; | ||
query: (fn: (ref: firestore.CollectionReference) => firestore.Query) => Promise<import("./documents.js").FirestoreDocument<T>[]>; | ||
@@ -20,0 +11,0 @@ /** |
@@ -6,15 +6,4 @@ import { getDocument, getDocuments, getDocumentsWithSelect, } from "./documents.js"; | ||
set: (documentId, data) => db.collection(collectionPath).doc(documentId).set(data), | ||
/** | ||
* @TODO firestore.UpdateData is not strict at all, we need to find | ||
* a way to type the data argument. | ||
* | ||
* Problem is that update can get many different types, including number | ||
* increments and array remove/union instructions. | ||
* See https://firebase.google.com/docs/firestore/manage-data/add-data#web-version-9_4 | ||
* | ||
* So not sure how strict we can get here. | ||
*/ | ||
update: (documentId, data) => db.collection(collectionPath).doc(documentId).update(data), | ||
// updateField: (documentId: string, data: DeepKeyMap<T>) => | ||
// db.collection(collectionPath).doc(documentId).update(data), | ||
updateFields: (documentId, data) => db.collection(collectionPath).doc(documentId).update(data), | ||
get: (documentId) => getDocument(db, collectionPath, documentId), | ||
@@ -21,0 +10,0 @@ query: (fn) => getDocuments(fn(db.collection(collectionPath))), |
{ | ||
"name": "firestore-facade", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A clean, strongly-typed, zero-dependency API for Firestore Typescript projects", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20245
22
155