UNPKG

firesage

Version:

🔥 Extremely High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience

21 lines (17 loc) • 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateDoc = void 0; var firestore_1 = require("firebase/firestore"); var utils_1 = require("../utils"); var fieldValue_1 = require("../fieldValue"); /** Updates fields in the document referred to by the specified DocumentReference. The update will fail if applied to a document that does not exist. @param reference — A reference to the document to update. @param data An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document. @returns A Promise resolved once the data has been successfully written to the backend (note that it won't resolve while you're offline). */ exports.updateDoc = (function (reference, data) { // @ts-expect-error return (0, firestore_1.updateDoc)(reference, (0, utils_1.flatten)((0, fieldValue_1.removeFieldValueInhomogeneousProps)(data))); });