MCPcopy Create free account
hub / github.com/firebase/firebase-tools / makeFirestoreValue

Method makeFirestoreValue

src/localFunction.ts:200–218  ·  view source on GitHub ↗
(input?: unknown)

Source from the content-addressed store, hash-verified

198 }
199
200 makeFirestoreValue(input?: unknown) {
201 if (
202 typeof input === "undefined" ||
203 input === null ||
204 (typeof input === "object" && Object.keys(input).length === 0)
205 ) {
206 // Document does not exist.
207 return {};
208 }
209 if (typeof input !== "object") {
210 throw new Error("Firestore data must be key-value pairs.");
211 }
212 const currentTime = new Date().toISOString();
213 return {
214 fields: encodeFirestoreValue(input),
215 createTime: currentTime,
216 updateTime: currentTime,
217 };
218 }
219
220 private requestCallBack<T>(err: unknown, response?: ClientResponse<T>, body?: string | object) {
221 if (err) {

Callers 2

triggerEventMethod · 0.95

Calls 1

encodeFirestoreValueFunction · 0.90

Tested by

no test coverage detected