@dereekb/dbx-components-mcp 13.11.2 → 13.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dbx-components-mcp.js +2260 -902
- package/generated/dereekb-date.utils.mcp.generated.json +1574 -0
- package/generated/dereekb-dbx-firebase.ui-components.mcp.generated.json +33 -0
- package/generated/dereekb-firebase.model-snapshot-fields.mcp.generated.json +915 -0
- package/generated/dereekb-firebase.utils.mcp.generated.json +1429 -0
- package/generated/dereekb-util.utils.mcp.generated.json +10825 -3037
- package/package.json +11 -11
|
@@ -0,0 +1,1429 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"source": "@dereekb/firebase",
|
|
4
|
+
"module": "@dereekb/firebase",
|
|
5
|
+
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
6
|
+
"generator": "@dereekb/dbx-components-mcp/scripts/generate-manifests.mjs",
|
|
7
|
+
"entries": [
|
|
8
|
+
{
|
|
9
|
+
"slug": "new-documents",
|
|
10
|
+
"name": "newDocuments",
|
|
11
|
+
"kind": "function",
|
|
12
|
+
"category": "firestore",
|
|
13
|
+
"module": "@dereekb/firebase",
|
|
14
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
15
|
+
"signature": "newDocuments(documentAccessor: FirestoreDocumentAccessor<T, D>, count: number): D[]",
|
|
16
|
+
"description": "Creates an array of new {@link FirestoreDocument} instances without persisting them to Firestore.\n\nEach document is allocated a unique auto-generated ID via {@link FirestoreDocumentAccessor.newDocument},\nbut no data is written to the database. Useful for preparing document references in bulk before\ndeciding what data to write.",
|
|
17
|
+
"params": [
|
|
18
|
+
{
|
|
19
|
+
"name": "documentAccessor",
|
|
20
|
+
"type": "FirestoreDocumentAccessor<T, D>",
|
|
21
|
+
"description": "- Accessor that provides the `newDocument()` factory method",
|
|
22
|
+
"optional": false
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "count",
|
|
26
|
+
"type": "number",
|
|
27
|
+
"description": "- Number of document instances to create",
|
|
28
|
+
"optional": false
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"returns": "Array of `count` new document instances, each with a unique auto-generated ID",
|
|
32
|
+
"tags": [
|
|
33
|
+
"firestore",
|
|
34
|
+
"document",
|
|
35
|
+
"accessor",
|
|
36
|
+
"new",
|
|
37
|
+
"allocate",
|
|
38
|
+
"bulk",
|
|
39
|
+
"documents",
|
|
40
|
+
"newdocuments"
|
|
41
|
+
],
|
|
42
|
+
"relatedSlugs": [
|
|
43
|
+
"make-documents"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"slug": "make-documents",
|
|
48
|
+
"name": "makeDocuments",
|
|
49
|
+
"kind": "function",
|
|
50
|
+
"category": "firestore",
|
|
51
|
+
"module": "@dereekb/firebase",
|
|
52
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
53
|
+
"signature": "makeDocuments(documentAccessor: FirestoreDocumentAccessor<T, D>, make: MakeDocumentsParams<T, D>): Promise<D[]>",
|
|
54
|
+
"description": "Creates and optionally persists multiple Firestore documents in sequence.\n\nUses {@link performMakeLoop} to iterate `count` times. For each iteration:\n1. A new document instance is created (via `make.newDocument` or the default factory)\n2. `make.init(i, document)` is awaited to produce initial data\n3. If init returns non-nullish data, `document.accessor.create(data)` persists it\n4. The document instance is collected regardless of whether it was persisted\n\nDocuments are created sequentially (not in parallel) to allow index-dependent logic.",
|
|
55
|
+
"params": [
|
|
56
|
+
{
|
|
57
|
+
"name": "documentAccessor",
|
|
58
|
+
"type": "FirestoreDocumentAccessor<T, D>",
|
|
59
|
+
"description": "- Accessor providing the document factory and collection context",
|
|
60
|
+
"optional": false
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "make",
|
|
64
|
+
"type": "MakeDocumentsParams<T, D>",
|
|
65
|
+
"description": "- Configuration controlling count, factory, and initialization",
|
|
66
|
+
"optional": false
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"returns": "Promise resolving to all created document instances (length === `make.count`)",
|
|
70
|
+
"tags": [
|
|
71
|
+
"firestore",
|
|
72
|
+
"document",
|
|
73
|
+
"accessor",
|
|
74
|
+
"make",
|
|
75
|
+
"create",
|
|
76
|
+
"persist",
|
|
77
|
+
"bulk",
|
|
78
|
+
"fixture",
|
|
79
|
+
"seed",
|
|
80
|
+
"documents",
|
|
81
|
+
"makedocuments"
|
|
82
|
+
],
|
|
83
|
+
"relatedSlugs": [
|
|
84
|
+
"new-documents"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"slug": "get-document-snapshots",
|
|
89
|
+
"name": "getDocumentSnapshots",
|
|
90
|
+
"kind": "function",
|
|
91
|
+
"category": "firestore",
|
|
92
|
+
"module": "@dereekb/firebase",
|
|
93
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
94
|
+
"signature": "getDocumentSnapshots(documents: D[]): Promise<DocumentSnapshot<FirestoreDocumentData<D>>[]>",
|
|
95
|
+
"description": "Fetches {@link DocumentSnapshot}s for multiple documents in parallel using {@link runAsyncTasksForValues}.\n\nEach document's `accessor.get()` is called concurrently. The returned array preserves\nthe same ordering as the input `documents` array.",
|
|
96
|
+
"params": [
|
|
97
|
+
{
|
|
98
|
+
"name": "documents",
|
|
99
|
+
"type": "D[]",
|
|
100
|
+
"description": "- Documents to fetch snapshots for",
|
|
101
|
+
"optional": false
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"returns": "Snapshots in the same order as the input array",
|
|
105
|
+
"tags": [
|
|
106
|
+
"firestore",
|
|
107
|
+
"snapshot",
|
|
108
|
+
"document",
|
|
109
|
+
"fetch",
|
|
110
|
+
"parallel",
|
|
111
|
+
"batch",
|
|
112
|
+
"read",
|
|
113
|
+
"get",
|
|
114
|
+
"snapshots",
|
|
115
|
+
"getdocumentsnapshots"
|
|
116
|
+
],
|
|
117
|
+
"relatedSlugs": [
|
|
118
|
+
"get-document-snapshot-pair",
|
|
119
|
+
"get-document-snapshot-data-pair"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"slug": "get-document-snapshot-pair",
|
|
124
|
+
"name": "getDocumentSnapshotPair",
|
|
125
|
+
"kind": "function",
|
|
126
|
+
"category": "firestore",
|
|
127
|
+
"module": "@dereekb/firebase",
|
|
128
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
129
|
+
"signature": "getDocumentSnapshotPair(document: D): Promise<FirestoreDocumentSnapshotPair<D>>",
|
|
130
|
+
"description": "Fetches the current snapshot of a single document and pairs it with the document instance.",
|
|
131
|
+
"params": [
|
|
132
|
+
{
|
|
133
|
+
"name": "document",
|
|
134
|
+
"type": "D",
|
|
135
|
+
"description": "- The document to fetch",
|
|
136
|
+
"optional": false
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"returns": "A pair containing the document and its snapshot",
|
|
140
|
+
"tags": [
|
|
141
|
+
"firestore",
|
|
142
|
+
"snapshot",
|
|
143
|
+
"pair",
|
|
144
|
+
"fetch",
|
|
145
|
+
"document",
|
|
146
|
+
"read",
|
|
147
|
+
"get",
|
|
148
|
+
"getdocumentsnapshotpair"
|
|
149
|
+
],
|
|
150
|
+
"relatedSlugs": [
|
|
151
|
+
"get-document-snapshot-pairs",
|
|
152
|
+
"get-document-snapshot-data-pair"
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"slug": "get-document-snapshot-pairs",
|
|
157
|
+
"name": "getDocumentSnapshotPairs",
|
|
158
|
+
"kind": "function",
|
|
159
|
+
"category": "firestore",
|
|
160
|
+
"module": "@dereekb/firebase",
|
|
161
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
162
|
+
"signature": "getDocumentSnapshotPairs(documents: D[]): Promise<FirestoreDocumentSnapshotPair<D>[]>",
|
|
163
|
+
"description": "Fetches snapshots for multiple documents in parallel and pairs each with its document instance.",
|
|
164
|
+
"params": [
|
|
165
|
+
{
|
|
166
|
+
"name": "documents",
|
|
167
|
+
"type": "D[]",
|
|
168
|
+
"description": "- Documents to fetch",
|
|
169
|
+
"optional": false
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"returns": "Pairs in the same order as the input array",
|
|
173
|
+
"tags": [
|
|
174
|
+
"firestore",
|
|
175
|
+
"snapshot",
|
|
176
|
+
"pair",
|
|
177
|
+
"fetch",
|
|
178
|
+
"parallel",
|
|
179
|
+
"batch",
|
|
180
|
+
"document",
|
|
181
|
+
"get",
|
|
182
|
+
"pairs",
|
|
183
|
+
"getdocumentsnapshotpairs"
|
|
184
|
+
],
|
|
185
|
+
"relatedSlugs": [
|
|
186
|
+
"get-document-snapshot-pair",
|
|
187
|
+
"get-document-snapshot-data-pairs"
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"slug": "get-document-snapshot-data-pair",
|
|
192
|
+
"name": "getDocumentSnapshotDataPair",
|
|
193
|
+
"kind": "function",
|
|
194
|
+
"category": "firestore",
|
|
195
|
+
"module": "@dereekb/firebase",
|
|
196
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
197
|
+
"signature": "getDocumentSnapshotDataPair(document: D): Promise<FirestoreDocumentSnapshotDataPair<D>>",
|
|
198
|
+
"description": "Fetches a document's snapshot, extracts its data with `id`/`key` fields, and returns all three as a triplet.",
|
|
199
|
+
"params": [
|
|
200
|
+
{
|
|
201
|
+
"name": "document",
|
|
202
|
+
"type": "D",
|
|
203
|
+
"description": "- The document to fetch",
|
|
204
|
+
"optional": false
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"returns": "A triplet of document, snapshot, and data (data may be `undefined` if the document doesn't exist)",
|
|
208
|
+
"tags": [
|
|
209
|
+
"firestore",
|
|
210
|
+
"snapshot",
|
|
211
|
+
"data",
|
|
212
|
+
"pair",
|
|
213
|
+
"fetch",
|
|
214
|
+
"document",
|
|
215
|
+
"read",
|
|
216
|
+
"idkey",
|
|
217
|
+
"get",
|
|
218
|
+
"getdocumentsnapshotdatapair"
|
|
219
|
+
],
|
|
220
|
+
"relatedSlugs": [
|
|
221
|
+
"get-document-snapshot-data-pairs",
|
|
222
|
+
"get-document-snapshot-pair"
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"slug": "get-document-snapshot-data-pairs",
|
|
227
|
+
"name": "getDocumentSnapshotDataPairs",
|
|
228
|
+
"kind": "function",
|
|
229
|
+
"category": "firestore",
|
|
230
|
+
"module": "@dereekb/firebase",
|
|
231
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
232
|
+
"signature": "getDocumentSnapshotDataPairs(documents: D[]): Promise<FirestoreDocumentSnapshotDataPair<D>[]>",
|
|
233
|
+
"description": "Fetches snapshot-data triplets for multiple documents in parallel.\n\nProcesses up to 200 documents concurrently via {@link runAsyncTasksForValues}.\nThe returned array preserves the same ordering as the input.",
|
|
234
|
+
"params": [
|
|
235
|
+
{
|
|
236
|
+
"name": "documents",
|
|
237
|
+
"type": "D[]",
|
|
238
|
+
"description": "- Documents to fetch",
|
|
239
|
+
"optional": false
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"returns": "Triplets in the same order as the input array",
|
|
243
|
+
"tags": [
|
|
244
|
+
"firestore",
|
|
245
|
+
"snapshot",
|
|
246
|
+
"data",
|
|
247
|
+
"pair",
|
|
248
|
+
"fetch",
|
|
249
|
+
"parallel",
|
|
250
|
+
"batch",
|
|
251
|
+
"idkey",
|
|
252
|
+
"get",
|
|
253
|
+
"document",
|
|
254
|
+
"pairs",
|
|
255
|
+
"getdocumentsnapshotdatapairs"
|
|
256
|
+
],
|
|
257
|
+
"relatedSlugs": [
|
|
258
|
+
"get-document-snapshot-data-pair",
|
|
259
|
+
"get-document-snapshot-data-pairs-with-data"
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"slug": "get-document-snapshot-data-pairs-with-data",
|
|
264
|
+
"name": "getDocumentSnapshotDataPairsWithData",
|
|
265
|
+
"kind": "function",
|
|
266
|
+
"category": "firestore",
|
|
267
|
+
"module": "@dereekb/firebase",
|
|
268
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
269
|
+
"signature": "getDocumentSnapshotDataPairsWithData(documents: D[]): Promise<FirestoreDocumentSnapshotDataPairWithData<D>[]>",
|
|
270
|
+
"description": "Fetches snapshot-data triplets for multiple documents and filters out those that don't exist in Firestore.\n\nConvenience wrapper around {@link getDocumentSnapshotDataPairs} that removes entries where `data` is nullish,\nreturning only {@link FirestoreDocumentSnapshotDataPairWithData} results.",
|
|
271
|
+
"params": [
|
|
272
|
+
{
|
|
273
|
+
"name": "documents",
|
|
274
|
+
"type": "D[]",
|
|
275
|
+
"description": "- Documents to fetch",
|
|
276
|
+
"optional": false
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
"returns": "Triplets for documents that exist, in their original relative order",
|
|
280
|
+
"tags": [
|
|
281
|
+
"firestore",
|
|
282
|
+
"snapshot",
|
|
283
|
+
"data",
|
|
284
|
+
"pair",
|
|
285
|
+
"fetch",
|
|
286
|
+
"batch",
|
|
287
|
+
"exists",
|
|
288
|
+
"filter",
|
|
289
|
+
"idkey",
|
|
290
|
+
"get",
|
|
291
|
+
"document",
|
|
292
|
+
"pairs",
|
|
293
|
+
"with",
|
|
294
|
+
"getdocumentsnapshotdatapairswithdata"
|
|
295
|
+
],
|
|
296
|
+
"relatedSlugs": [
|
|
297
|
+
"get-document-snapshot-data-pairs"
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"slug": "get-document-snapshot-data-tuples",
|
|
302
|
+
"name": "getDocumentSnapshotDataTuples",
|
|
303
|
+
"kind": "function",
|
|
304
|
+
"category": "firestore",
|
|
305
|
+
"module": "@dereekb/firebase",
|
|
306
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
307
|
+
"signature": "getDocumentSnapshotDataTuples(documents: D[]): Promise<FirestoreDocumentSnapshotDataTuple<D>[]>",
|
|
308
|
+
"description": "Fetches raw snapshot data tuples for multiple documents in parallel.\n\nUnlike {@link getDocumentSnapshotDataPairs}, this returns a lightweight `[document, data]` tuple\nand does not inject `id`/`key` fields onto the data. The `data` value is the raw result of\n`snapshot.data()` and may be `undefined` for non-existent documents.",
|
|
309
|
+
"params": [
|
|
310
|
+
{
|
|
311
|
+
"name": "documents",
|
|
312
|
+
"type": "D[]",
|
|
313
|
+
"description": "- Documents to fetch",
|
|
314
|
+
"optional": false
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
"returns": "Tuples in the same order as the input array",
|
|
318
|
+
"tags": [
|
|
319
|
+
"firestore",
|
|
320
|
+
"snapshot",
|
|
321
|
+
"data",
|
|
322
|
+
"tuple",
|
|
323
|
+
"fetch",
|
|
324
|
+
"parallel",
|
|
325
|
+
"batch",
|
|
326
|
+
"get",
|
|
327
|
+
"document",
|
|
328
|
+
"tuples",
|
|
329
|
+
"getdocumentsnapshotdatatuples"
|
|
330
|
+
],
|
|
331
|
+
"relatedSlugs": [
|
|
332
|
+
"get-document-snapshot-data-pairs"
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"slug": "get-document-snapshot-data",
|
|
337
|
+
"name": "getDocumentSnapshotData",
|
|
338
|
+
"kind": "function",
|
|
339
|
+
"category": "firestore",
|
|
340
|
+
"module": "@dereekb/firebase",
|
|
341
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
342
|
+
"signature": "getDocumentSnapshotData(document: D, withId?: boolean): Promise<Maybe<DocumentDataWithIdAndKey<FirestoreDocumentData<D>> | FirestoreDocumentData<D>>>",
|
|
343
|
+
"description": "Fetches the data from a single document's snapshot.\n\nBy default (`withId=true`), the returned data has `id` and `key` fields injected via\n{@link documentDataWithIdAndKey}. Pass `withId=false` to get the raw snapshot data instead.\n\nReturns `undefined` if the document does not exist.",
|
|
344
|
+
"params": [
|
|
345
|
+
{
|
|
346
|
+
"name": "document",
|
|
347
|
+
"type": "D",
|
|
348
|
+
"description": "- The document to fetch data for",
|
|
349
|
+
"optional": false
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"name": "withId",
|
|
353
|
+
"type": "boolean",
|
|
354
|
+
"description": "- Whether to inject `id` and `key` fields onto the data (default: `true`)",
|
|
355
|
+
"optional": true
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
"returns": "The document's data, or `undefined` if it doesn't exist",
|
|
359
|
+
"tags": [
|
|
360
|
+
"firestore",
|
|
361
|
+
"snapshot",
|
|
362
|
+
"data",
|
|
363
|
+
"fetch",
|
|
364
|
+
"document",
|
|
365
|
+
"read",
|
|
366
|
+
"withid",
|
|
367
|
+
"idkey",
|
|
368
|
+
"get",
|
|
369
|
+
"getdocumentsnapshotdata"
|
|
370
|
+
],
|
|
371
|
+
"relatedSlugs": [
|
|
372
|
+
"get-document-snapshots-data",
|
|
373
|
+
"get-document-snapshot-data-pair"
|
|
374
|
+
]
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"slug": "get-document-snapshots-data",
|
|
378
|
+
"name": "getDocumentSnapshotsData",
|
|
379
|
+
"kind": "function",
|
|
380
|
+
"category": "firestore",
|
|
381
|
+
"module": "@dereekb/firebase",
|
|
382
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
383
|
+
"signature": "getDocumentSnapshotsData(documents: D[], withId?: boolean): Promise<DocumentDataWithIdAndKey<FirestoreDocumentData<D>>[] | FirestoreDocumentData<D>[]>",
|
|
384
|
+
"description": "Fetches data for multiple documents in parallel, filtering out non-existent documents.\n\nBy default (`withId=true`), each data object has `id` and `key` fields injected.\nDocuments that don't exist in Firestore are excluded from the results (the returned\narray may be shorter than the input).",
|
|
385
|
+
"params": [
|
|
386
|
+
{
|
|
387
|
+
"name": "documents",
|
|
388
|
+
"type": "D[]",
|
|
389
|
+
"description": "- Documents to fetch data for",
|
|
390
|
+
"optional": false
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": "withId",
|
|
394
|
+
"type": "boolean",
|
|
395
|
+
"description": "- Whether to inject `id` and `key` fields onto each data object (default: `true`)",
|
|
396
|
+
"optional": true
|
|
397
|
+
}
|
|
398
|
+
],
|
|
399
|
+
"returns": "Data objects for existing documents only",
|
|
400
|
+
"tags": [
|
|
401
|
+
"firestore",
|
|
402
|
+
"snapshot",
|
|
403
|
+
"data",
|
|
404
|
+
"fetch",
|
|
405
|
+
"parallel",
|
|
406
|
+
"batch",
|
|
407
|
+
"filter",
|
|
408
|
+
"withid",
|
|
409
|
+
"idkey",
|
|
410
|
+
"get",
|
|
411
|
+
"document",
|
|
412
|
+
"snapshots",
|
|
413
|
+
"getdocumentsnapshotsdata"
|
|
414
|
+
],
|
|
415
|
+
"relatedSlugs": [
|
|
416
|
+
"get-document-snapshot-data",
|
|
417
|
+
"get-data-from-document-snapshots"
|
|
418
|
+
]
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"slug": "get-data-from-document-snapshots",
|
|
422
|
+
"name": "getDataFromDocumentSnapshots",
|
|
423
|
+
"kind": "function",
|
|
424
|
+
"category": "firestore",
|
|
425
|
+
"module": "@dereekb/firebase",
|
|
426
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
427
|
+
"signature": "getDataFromDocumentSnapshots(snapshots: DocumentSnapshot<T>[], withId?: boolean): DocumentDataWithIdAndKey<T>[] | T[]",
|
|
428
|
+
"description": "Extracts data from an array of {@link DocumentSnapshot}s, filtering out snapshots for non-existent documents.\n\nBy default (`withId=true`), each data object has `id` and `key` fields injected via {@link documentDataWithIdAndKey}.\nSnapshots where `data()` returns `undefined` are removed from the output via {@link filterMaybeArrayValues}.",
|
|
429
|
+
"params": [
|
|
430
|
+
{
|
|
431
|
+
"name": "snapshots",
|
|
432
|
+
"type": "DocumentSnapshot<T>[]",
|
|
433
|
+
"description": "- Snapshots to extract data from",
|
|
434
|
+
"optional": false
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"name": "withId",
|
|
438
|
+
"type": "boolean",
|
|
439
|
+
"description": "- Whether to inject `id` and `key` fields onto each data object (default: `true`)",
|
|
440
|
+
"optional": true
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
"returns": "Data objects for existing documents only (may be shorter than input)",
|
|
444
|
+
"tags": [
|
|
445
|
+
"firestore",
|
|
446
|
+
"snapshot",
|
|
447
|
+
"data",
|
|
448
|
+
"extract",
|
|
449
|
+
"filter",
|
|
450
|
+
"batch",
|
|
451
|
+
"withid",
|
|
452
|
+
"idkey",
|
|
453
|
+
"mapper",
|
|
454
|
+
"get",
|
|
455
|
+
"from",
|
|
456
|
+
"document",
|
|
457
|
+
"snapshots",
|
|
458
|
+
"getdatafromdocumentsnapshots"
|
|
459
|
+
],
|
|
460
|
+
"relatedSlugs": [
|
|
461
|
+
"get-document-snapshots-data",
|
|
462
|
+
"document-data-function"
|
|
463
|
+
]
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"slug": "load-documents-for-snapshots",
|
|
467
|
+
"name": "loadDocumentsForSnapshots",
|
|
468
|
+
"kind": "function",
|
|
469
|
+
"category": "firestore",
|
|
470
|
+
"module": "@dereekb/firebase",
|
|
471
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
472
|
+
"signature": "loadDocumentsForSnapshots(accessor: LimitedFirestoreDocumentAccessor<T, D>, snapshots: QuerySnapshot<T>): D[]",
|
|
473
|
+
"description": "Creates {@link FirestoreDocument} instances for all documents in a {@link QuerySnapshot}.\n\nMaps each document in `snapshots.docs` to a loaded document via `accessor.loadDocument(ref)`.\nNo additional data fetching occurs; the documents are loaded from their existing references.",
|
|
474
|
+
"params": [
|
|
475
|
+
{
|
|
476
|
+
"name": "accessor",
|
|
477
|
+
"type": "LimitedFirestoreDocumentAccessor<T, D>",
|
|
478
|
+
"description": "- Accessor to load documents with",
|
|
479
|
+
"optional": false
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"name": "snapshots",
|
|
483
|
+
"type": "QuerySnapshot<T>",
|
|
484
|
+
"description": "- Query snapshot containing the document references",
|
|
485
|
+
"optional": false
|
|
486
|
+
}
|
|
487
|
+
],
|
|
488
|
+
"returns": "Document instances in the same order as the query results",
|
|
489
|
+
"tags": [
|
|
490
|
+
"firestore",
|
|
491
|
+
"document",
|
|
492
|
+
"loader",
|
|
493
|
+
"accessor",
|
|
494
|
+
"snapshot",
|
|
495
|
+
"query",
|
|
496
|
+
"querysnapshot",
|
|
497
|
+
"batch",
|
|
498
|
+
"load",
|
|
499
|
+
"documents",
|
|
500
|
+
"for",
|
|
501
|
+
"snapshots",
|
|
502
|
+
"loaddocumentsforsnapshots"
|
|
503
|
+
],
|
|
504
|
+
"relatedSlugs": [
|
|
505
|
+
"load-documents-for-document-references",
|
|
506
|
+
"load-documents-for-keys"
|
|
507
|
+
]
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"slug": "load-documents-for-document-references-from-values",
|
|
511
|
+
"name": "loadDocumentsForDocumentReferencesFromValues",
|
|
512
|
+
"kind": "function",
|
|
513
|
+
"category": "firestore",
|
|
514
|
+
"module": "@dereekb/firebase",
|
|
515
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
516
|
+
"signature": "loadDocumentsForDocumentReferencesFromValues(accessor: LimitedFirestoreDocumentAccessor<T, D>, values: I[], getRef: (value: I) => DocumentReference<T>): D[]",
|
|
517
|
+
"description": "Extracts {@link DocumentReference}s from arbitrary values and loads them as {@link FirestoreDocument} instances.\n\nConvenience function that maps values through `getRef` then delegates to {@link loadDocumentsForDocumentReferences}.",
|
|
518
|
+
"params": [
|
|
519
|
+
{
|
|
520
|
+
"name": "accessor",
|
|
521
|
+
"type": "LimitedFirestoreDocumentAccessor<T, D>",
|
|
522
|
+
"description": "- Accessor to load documents with",
|
|
523
|
+
"optional": false
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"name": "values",
|
|
527
|
+
"type": "I[]",
|
|
528
|
+
"description": "- Source values to extract references from",
|
|
529
|
+
"optional": false
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"name": "getRef",
|
|
533
|
+
"type": "(value: I) => DocumentReference<T>",
|
|
534
|
+
"description": "- Extracts a document reference from each value",
|
|
535
|
+
"optional": false
|
|
536
|
+
}
|
|
537
|
+
],
|
|
538
|
+
"returns": "Document instances in the same order as the input values",
|
|
539
|
+
"tags": [
|
|
540
|
+
"firestore",
|
|
541
|
+
"document",
|
|
542
|
+
"loader",
|
|
543
|
+
"accessor",
|
|
544
|
+
"reference",
|
|
545
|
+
"value",
|
|
546
|
+
"mapper",
|
|
547
|
+
"batch",
|
|
548
|
+
"load",
|
|
549
|
+
"documents",
|
|
550
|
+
"for",
|
|
551
|
+
"references",
|
|
552
|
+
"from",
|
|
553
|
+
"values",
|
|
554
|
+
"loaddocumentsfordocumentreferencesfromvalues"
|
|
555
|
+
],
|
|
556
|
+
"relatedSlugs": [
|
|
557
|
+
"load-documents-for-document-references",
|
|
558
|
+
"load-documents-for-keys-from-values",
|
|
559
|
+
"load-documents-for-ids-from-values"
|
|
560
|
+
]
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"slug": "load-documents-for-document-references",
|
|
564
|
+
"name": "loadDocumentsForDocumentReferences",
|
|
565
|
+
"kind": "function",
|
|
566
|
+
"category": "firestore",
|
|
567
|
+
"module": "@dereekb/firebase",
|
|
568
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
569
|
+
"signature": "loadDocumentsForDocumentReferences(accessor: LimitedFirestoreDocumentAccessor<T, D>, refs: DocumentReference<T>[]): D[]",
|
|
570
|
+
"description": "Loads {@link FirestoreDocument} instances from an array of {@link DocumentReference}s.\n\nEach reference is passed to `accessor.loadDocument()` to create a document wrapper.\nNo network calls are made; this only creates in-memory document instances bound to the given references.",
|
|
571
|
+
"params": [
|
|
572
|
+
{
|
|
573
|
+
"name": "accessor",
|
|
574
|
+
"type": "LimitedFirestoreDocumentAccessor<T, D>",
|
|
575
|
+
"description": "- Accessor to load documents with",
|
|
576
|
+
"optional": false
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"name": "refs",
|
|
580
|
+
"type": "DocumentReference<T>[]",
|
|
581
|
+
"description": "- Document references to load",
|
|
582
|
+
"optional": false
|
|
583
|
+
}
|
|
584
|
+
],
|
|
585
|
+
"returns": "Document instances in the same order as the input references",
|
|
586
|
+
"tags": [
|
|
587
|
+
"firestore",
|
|
588
|
+
"document",
|
|
589
|
+
"loader",
|
|
590
|
+
"accessor",
|
|
591
|
+
"reference",
|
|
592
|
+
"batch",
|
|
593
|
+
"load",
|
|
594
|
+
"documents",
|
|
595
|
+
"for",
|
|
596
|
+
"references",
|
|
597
|
+
"loaddocumentsfordocumentreferences"
|
|
598
|
+
],
|
|
599
|
+
"relatedSlugs": [
|
|
600
|
+
"load-documents-for-document-references-from-values",
|
|
601
|
+
"load-documents-for-keys",
|
|
602
|
+
"load-documents-for-snapshots"
|
|
603
|
+
]
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
"slug": "load-documents-for-keys-from-values",
|
|
607
|
+
"name": "loadDocumentsForKeysFromValues",
|
|
608
|
+
"kind": "function",
|
|
609
|
+
"category": "firestore",
|
|
610
|
+
"module": "@dereekb/firebase",
|
|
611
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
612
|
+
"signature": "loadDocumentsForKeysFromValues(accessor: LimitedFirestoreDocumentAccessor<T, D>, values: I[], getKey: (value: I) => FirestoreModelKey): D[]",
|
|
613
|
+
"description": "Extracts {@link FirestoreModelKey}s from arbitrary values and loads them as {@link FirestoreDocument} instances.\n\nConvenience function that maps values through `getKey` then delegates to {@link loadDocumentsForKeys}.",
|
|
614
|
+
"params": [
|
|
615
|
+
{
|
|
616
|
+
"name": "accessor",
|
|
617
|
+
"type": "LimitedFirestoreDocumentAccessor<T, D>",
|
|
618
|
+
"description": "- Accessor to load documents with",
|
|
619
|
+
"optional": false
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"name": "values",
|
|
623
|
+
"type": "I[]",
|
|
624
|
+
"description": "- Source values to extract keys from",
|
|
625
|
+
"optional": false
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"name": "getKey",
|
|
629
|
+
"type": "(value: I) => FirestoreModelKey",
|
|
630
|
+
"description": "- Extracts a model key (full Firestore path) from each value",
|
|
631
|
+
"optional": false
|
|
632
|
+
}
|
|
633
|
+
],
|
|
634
|
+
"returns": "Document instances in the same order as the input values",
|
|
635
|
+
"tags": [
|
|
636
|
+
"firestore",
|
|
637
|
+
"document",
|
|
638
|
+
"loader",
|
|
639
|
+
"accessor",
|
|
640
|
+
"key",
|
|
641
|
+
"path",
|
|
642
|
+
"value",
|
|
643
|
+
"mapper",
|
|
644
|
+
"batch",
|
|
645
|
+
"load",
|
|
646
|
+
"documents",
|
|
647
|
+
"for",
|
|
648
|
+
"keys",
|
|
649
|
+
"from",
|
|
650
|
+
"values",
|
|
651
|
+
"loaddocumentsforkeysfromvalues"
|
|
652
|
+
],
|
|
653
|
+
"relatedSlugs": [
|
|
654
|
+
"load-documents-for-keys",
|
|
655
|
+
"load-documents-for-document-references-from-values",
|
|
656
|
+
"load-documents-for-ids-from-values"
|
|
657
|
+
]
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"slug": "load-documents-for-keys",
|
|
661
|
+
"name": "loadDocumentsForKeys",
|
|
662
|
+
"kind": "function",
|
|
663
|
+
"category": "firestore",
|
|
664
|
+
"module": "@dereekb/firebase",
|
|
665
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
666
|
+
"signature": "loadDocumentsForKeys(accessor: LimitedFirestoreDocumentAccessor<T, D>, keys: FirestoreModelKey[]): D[]",
|
|
667
|
+
"description": "Loads {@link FirestoreDocument} instances from an array of full Firestore document paths (keys).\n\nEach key is passed to `accessor.loadDocumentForKey()`. No network calls are made.",
|
|
668
|
+
"params": [
|
|
669
|
+
{
|
|
670
|
+
"name": "accessor",
|
|
671
|
+
"type": "LimitedFirestoreDocumentAccessor<T, D>",
|
|
672
|
+
"description": "- Accessor to load documents with",
|
|
673
|
+
"optional": false
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"name": "keys",
|
|
677
|
+
"type": "FirestoreModelKey[]",
|
|
678
|
+
"description": "- Full Firestore document paths (e.g. `'users/abc123'`)",
|
|
679
|
+
"optional": false
|
|
680
|
+
}
|
|
681
|
+
],
|
|
682
|
+
"returns": "Document instances in the same order as the input keys",
|
|
683
|
+
"tags": [
|
|
684
|
+
"firestore",
|
|
685
|
+
"document",
|
|
686
|
+
"loader",
|
|
687
|
+
"accessor",
|
|
688
|
+
"key",
|
|
689
|
+
"path",
|
|
690
|
+
"batch",
|
|
691
|
+
"load",
|
|
692
|
+
"documents",
|
|
693
|
+
"for",
|
|
694
|
+
"keys",
|
|
695
|
+
"loaddocumentsforkeys"
|
|
696
|
+
],
|
|
697
|
+
"relatedSlugs": [
|
|
698
|
+
"load-documents-for-keys-from-values",
|
|
699
|
+
"load-documents-for-document-references",
|
|
700
|
+
"load-documents-for-ids"
|
|
701
|
+
]
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
"slug": "load-documents-for-ids-from-values",
|
|
705
|
+
"name": "loadDocumentsForIdsFromValues",
|
|
706
|
+
"kind": "function",
|
|
707
|
+
"category": "firestore",
|
|
708
|
+
"module": "@dereekb/firebase",
|
|
709
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
710
|
+
"signature": "loadDocumentsForIdsFromValues(accessor: FirestoreDocumentAccessor<T, D>, values: I[], getId: (value: I) => FirestoreModelId): D[]",
|
|
711
|
+
"description": "Extracts {@link FirestoreModelId}s from arbitrary values and loads them as {@link FirestoreDocument} instances.\n\nConvenience function that maps values through `getId` then delegates to {@link loadDocumentsForIds}.\nRequires a full {@link FirestoreDocumentAccessor} (not limited) because loading by ID requires collection context.",
|
|
712
|
+
"params": [
|
|
713
|
+
{
|
|
714
|
+
"name": "accessor",
|
|
715
|
+
"type": "FirestoreDocumentAccessor<T, D>",
|
|
716
|
+
"description": "- Accessor to load documents with (must have collection context for ID resolution)",
|
|
717
|
+
"optional": false
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"name": "values",
|
|
721
|
+
"type": "I[]",
|
|
722
|
+
"description": "- Source values to extract IDs from",
|
|
723
|
+
"optional": false
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
"name": "getId",
|
|
727
|
+
"type": "(value: I) => FirestoreModelId",
|
|
728
|
+
"description": "- Extracts a model ID from each value",
|
|
729
|
+
"optional": false
|
|
730
|
+
}
|
|
731
|
+
],
|
|
732
|
+
"returns": "Document instances in the same order as the input values",
|
|
733
|
+
"tags": [
|
|
734
|
+
"firestore",
|
|
735
|
+
"document",
|
|
736
|
+
"loader",
|
|
737
|
+
"accessor",
|
|
738
|
+
"id",
|
|
739
|
+
"value",
|
|
740
|
+
"mapper",
|
|
741
|
+
"batch",
|
|
742
|
+
"collection",
|
|
743
|
+
"load",
|
|
744
|
+
"documents",
|
|
745
|
+
"for",
|
|
746
|
+
"ids",
|
|
747
|
+
"from",
|
|
748
|
+
"values",
|
|
749
|
+
"loaddocumentsforidsfromvalues"
|
|
750
|
+
],
|
|
751
|
+
"relatedSlugs": [
|
|
752
|
+
"load-documents-for-ids",
|
|
753
|
+
"load-documents-for-keys-from-values",
|
|
754
|
+
"load-documents-for-document-references-from-values"
|
|
755
|
+
]
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"slug": "load-documents-for-ids",
|
|
759
|
+
"name": "loadDocumentsForIds",
|
|
760
|
+
"kind": "function",
|
|
761
|
+
"category": "firestore",
|
|
762
|
+
"module": "@dereekb/firebase",
|
|
763
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
764
|
+
"signature": "loadDocumentsForIds(accessor: FirestoreDocumentAccessor<T, D>, ids: FirestoreModelId[]): D[]",
|
|
765
|
+
"description": "Loads {@link FirestoreDocument} instances from an array of document IDs relative to the accessor's collection.\n\nEach ID is passed to `accessor.loadDocumentForId()`. Requires a full {@link FirestoreDocumentAccessor}\nbecause ID-based loading needs the collection reference to resolve the full path. No network calls are made.",
|
|
766
|
+
"params": [
|
|
767
|
+
{
|
|
768
|
+
"name": "accessor",
|
|
769
|
+
"type": "FirestoreDocumentAccessor<T, D>",
|
|
770
|
+
"description": "- Accessor to load documents with (must have collection context)",
|
|
771
|
+
"optional": false
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
"name": "ids",
|
|
775
|
+
"type": "FirestoreModelId[]",
|
|
776
|
+
"description": "- Document IDs within the accessor's collection",
|
|
777
|
+
"optional": false
|
|
778
|
+
}
|
|
779
|
+
],
|
|
780
|
+
"returns": "Document instances in the same order as the input IDs",
|
|
781
|
+
"tags": [
|
|
782
|
+
"firestore",
|
|
783
|
+
"document",
|
|
784
|
+
"loader",
|
|
785
|
+
"accessor",
|
|
786
|
+
"id",
|
|
787
|
+
"batch",
|
|
788
|
+
"collection",
|
|
789
|
+
"load",
|
|
790
|
+
"documents",
|
|
791
|
+
"for",
|
|
792
|
+
"ids",
|
|
793
|
+
"loaddocumentsforids"
|
|
794
|
+
],
|
|
795
|
+
"relatedSlugs": [
|
|
796
|
+
"load-documents-for-ids-from-values",
|
|
797
|
+
"load-documents-for-keys",
|
|
798
|
+
"load-documents-for-document-references"
|
|
799
|
+
]
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
"slug": "firestore-document-loader",
|
|
803
|
+
"name": "firestoreDocumentLoader",
|
|
804
|
+
"kind": "factory",
|
|
805
|
+
"category": "firestore",
|
|
806
|
+
"module": "@dereekb/firebase",
|
|
807
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
808
|
+
"signature": "firestoreDocumentLoader(accessorContext: LimitedFirestoreDocumentAccessorContextExtension<T, D>): FirestoreDocumentLoader<T, D>",
|
|
809
|
+
"description": "Creates a {@link FirestoreDocumentLoader} from a {@link LimitedFirestoreDocumentAccessorContextExtension}.\n\nThe returned loader resolves the appropriate accessor based on whether a transaction is provided,\nthen delegates to {@link loadDocumentsForDocumentReferences}.",
|
|
810
|
+
"params": [
|
|
811
|
+
{
|
|
812
|
+
"name": "accessorContext",
|
|
813
|
+
"type": "LimitedFirestoreDocumentAccessorContextExtension<T, D>",
|
|
814
|
+
"description": "- Context that provides accessors for both default and transactional use",
|
|
815
|
+
"optional": false
|
|
816
|
+
}
|
|
817
|
+
],
|
|
818
|
+
"returns": "A loader function that converts document references to document instances",
|
|
819
|
+
"tags": [
|
|
820
|
+
"firestore",
|
|
821
|
+
"document",
|
|
822
|
+
"loader",
|
|
823
|
+
"factory",
|
|
824
|
+
"transaction",
|
|
825
|
+
"accessor",
|
|
826
|
+
"context",
|
|
827
|
+
"firestoredocumentloader"
|
|
828
|
+
],
|
|
829
|
+
"relatedSlugs": [
|
|
830
|
+
"firestore-document-snapshot-pairs-loader",
|
|
831
|
+
"load-documents-for-document-references"
|
|
832
|
+
]
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
"slug": "firestore-document-snapshot-pairs-loader",
|
|
836
|
+
"name": "firestoreDocumentSnapshotPairsLoader",
|
|
837
|
+
"kind": "factory",
|
|
838
|
+
"category": "firestore",
|
|
839
|
+
"module": "@dereekb/firebase",
|
|
840
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
841
|
+
"signature": "firestoreDocumentSnapshotPairsLoader(accessorContext: LimitedFirestoreDocumentAccessorContextExtension<T, D>): FirestoreDocumentSnapshotPairsLoader<T, D> & FirestoreQueryDocumentSnapshotPairsLoader<T, D>",
|
|
842
|
+
"description": "Creates a {@link FirestoreDocumentSnapshotPairsLoader} from a {@link LimitedFirestoreDocumentAccessorContextExtension}.\n\nThe returned loader resolves the appropriate accessor based on whether a transaction is provided,\nthen maps each snapshot to a {@link FirestoreDocumentSnapshotDataPair} using {@link firestoreDocumentSnapshotPairsLoaderInstance}.\n\nAlso satisfies the {@link FirestoreQueryDocumentSnapshotPairsLoader} type since the implementation\nhandles both {@link DocumentSnapshot} and {@link QueryDocumentSnapshot} inputs.",
|
|
843
|
+
"params": [
|
|
844
|
+
{
|
|
845
|
+
"name": "accessorContext",
|
|
846
|
+
"type": "LimitedFirestoreDocumentAccessorContextExtension<T, D>",
|
|
847
|
+
"description": "- Context that provides accessors for both default and transactional use",
|
|
848
|
+
"optional": false
|
|
849
|
+
}
|
|
850
|
+
],
|
|
851
|
+
"returns": "A loader function that converts snapshots to document-snapshot-data pairs",
|
|
852
|
+
"tags": [
|
|
853
|
+
"firestore",
|
|
854
|
+
"snapshot",
|
|
855
|
+
"pair",
|
|
856
|
+
"loader",
|
|
857
|
+
"factory",
|
|
858
|
+
"transaction",
|
|
859
|
+
"accessor",
|
|
860
|
+
"query",
|
|
861
|
+
"context",
|
|
862
|
+
"document",
|
|
863
|
+
"pairs",
|
|
864
|
+
"firestoredocumentsnapshotpairsloader"
|
|
865
|
+
],
|
|
866
|
+
"relatedSlugs": [
|
|
867
|
+
"firestore-document-snapshot-pairs-loader-instance",
|
|
868
|
+
"firestore-query-document-snapshot-pairs-loader",
|
|
869
|
+
"firestore-document-loader"
|
|
870
|
+
]
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
"slug": "firestore-document-snapshot-pairs-loader-instance",
|
|
874
|
+
"name": "firestoreDocumentSnapshotPairsLoaderInstance",
|
|
875
|
+
"kind": "factory",
|
|
876
|
+
"category": "firestore",
|
|
877
|
+
"module": "@dereekb/firebase",
|
|
878
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
879
|
+
"signature": "firestoreDocumentSnapshotPairsLoaderInstance(accessor: LimitedFirestoreDocumentAccessor<T, D>): FirestoreDocumentSnapshotPairsLoaderInstance<T, D>",
|
|
880
|
+
"description": "Creates a {@link FirestoreDocumentSnapshotPairsLoaderInstance} bound to a specific accessor.\n\nThe returned function converts a snapshot into a {@link FirestoreDocumentSnapshotDataPair} by:\n1. Extracting data with `id`/`key` fields via {@link documentDataWithIdAndKey}\n2. Loading the document from the snapshot's reference via `accessor.loadDocument()`\n3. Combining all three into a single pair object",
|
|
881
|
+
"params": [
|
|
882
|
+
{
|
|
883
|
+
"name": "accessor",
|
|
884
|
+
"type": "LimitedFirestoreDocumentAccessor<T, D>",
|
|
885
|
+
"description": "- The accessor to bind for document loading",
|
|
886
|
+
"optional": false
|
|
887
|
+
}
|
|
888
|
+
],
|
|
889
|
+
"returns": "A reusable function that converts snapshots to pairs using the bound accessor",
|
|
890
|
+
"tags": [
|
|
891
|
+
"firestore",
|
|
892
|
+
"snapshot",
|
|
893
|
+
"pair",
|
|
894
|
+
"loader",
|
|
895
|
+
"factory",
|
|
896
|
+
"instance",
|
|
897
|
+
"accessor",
|
|
898
|
+
"idkey",
|
|
899
|
+
"document",
|
|
900
|
+
"pairs",
|
|
901
|
+
"firestoredocumentsnapshotpairsloaderinstance"
|
|
902
|
+
],
|
|
903
|
+
"relatedSlugs": [
|
|
904
|
+
"firestore-document-snapshot-pairs-loader",
|
|
905
|
+
"document-data-with-id-and-key"
|
|
906
|
+
]
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
"slug": "document-data",
|
|
910
|
+
"name": "documentData",
|
|
911
|
+
"kind": "function",
|
|
912
|
+
"category": "firestore",
|
|
913
|
+
"module": "@dereekb/firebase",
|
|
914
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
915
|
+
"signature": "documentData(snapshot: DocumentSnapshot<T>, withId?: boolean): Maybe<T> | Maybe<DocumentDataWithIdAndKey<T>>",
|
|
916
|
+
"description": "Extracts data from a {@link DocumentSnapshot}, optionally injecting `id` and `key` fields.\n\nWhen `withId` is `true` (default is `false`), delegates to {@link documentDataWithIdAndKey} to mutate\nthe data object with `id` (document ID) and `key` (full document path). When `false`, returns the\nraw result of `snapshot.data()`.\n\nFor {@link QueryDocumentSnapshot} inputs, the return value is guaranteed non-nullish.\nFor {@link DocumentSnapshot} inputs, may return `undefined` if the document doesn't exist.",
|
|
917
|
+
"params": [
|
|
918
|
+
{
|
|
919
|
+
"name": "snapshot",
|
|
920
|
+
"type": "DocumentSnapshot<T>",
|
|
921
|
+
"description": "- The snapshot to extract data from",
|
|
922
|
+
"optional": false
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"name": "withId",
|
|
926
|
+
"type": "boolean",
|
|
927
|
+
"description": "- Whether to inject `id` and `key` fields (default: `false`)",
|
|
928
|
+
"optional": true
|
|
929
|
+
}
|
|
930
|
+
],
|
|
931
|
+
"returns": "The snapshot data, or `undefined` for non-existent documents",
|
|
932
|
+
"tags": [
|
|
933
|
+
"firestore",
|
|
934
|
+
"snapshot",
|
|
935
|
+
"data",
|
|
936
|
+
"extract",
|
|
937
|
+
"withid",
|
|
938
|
+
"idkey",
|
|
939
|
+
"mapper",
|
|
940
|
+
"document",
|
|
941
|
+
"documentdata"
|
|
942
|
+
],
|
|
943
|
+
"relatedSlugs": [
|
|
944
|
+
"document-data-with-id-and-key",
|
|
945
|
+
"document-data-function",
|
|
946
|
+
"get-document-snapshot-data"
|
|
947
|
+
]
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
"slug": "document-data-function",
|
|
951
|
+
"name": "documentDataFunction",
|
|
952
|
+
"kind": "factory",
|
|
953
|
+
"category": "firestore",
|
|
954
|
+
"module": "@dereekb/firebase",
|
|
955
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
956
|
+
"signature": "documentDataFunction(withId: boolean): DocumentDataWithIdAndKeyFunction<T> | DocumentDataFunction<T>",
|
|
957
|
+
"description": "Returns a data extraction function based on whether `id`/`key` injection is desired.\n\nWhen `withId` is `true`, returns {@link documentDataWithIdAndKey} (a {@link DocumentDataWithIdAndKeyFunction}).\nWhen `false`, returns a simple `snapshot.data()` wrapper (a {@link DocumentDataFunction}).\n\nUseful for creating reusable mappers when processing arrays of snapshots.",
|
|
958
|
+
"params": [
|
|
959
|
+
{
|
|
960
|
+
"name": "withId",
|
|
961
|
+
"type": "boolean",
|
|
962
|
+
"description": "- Whether the returned function should inject `id` and `key` fields",
|
|
963
|
+
"optional": false
|
|
964
|
+
}
|
|
965
|
+
],
|
|
966
|
+
"returns": "A snapshot-to-data extraction function",
|
|
967
|
+
"tags": [
|
|
968
|
+
"firestore",
|
|
969
|
+
"snapshot",
|
|
970
|
+
"data",
|
|
971
|
+
"factory",
|
|
972
|
+
"mapper",
|
|
973
|
+
"withid",
|
|
974
|
+
"idkey",
|
|
975
|
+
"extract",
|
|
976
|
+
"document",
|
|
977
|
+
"function",
|
|
978
|
+
"documentdatafunction"
|
|
979
|
+
],
|
|
980
|
+
"relatedSlugs": [
|
|
981
|
+
"document-data",
|
|
982
|
+
"document-data-with-id-and-key",
|
|
983
|
+
"get-data-from-document-snapshots"
|
|
984
|
+
]
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
"slug": "document-data-with-id-and-key",
|
|
988
|
+
"name": "documentDataWithIdAndKey",
|
|
989
|
+
"kind": "function",
|
|
990
|
+
"category": "firestore",
|
|
991
|
+
"module": "@dereekb/firebase",
|
|
992
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
993
|
+
"signature": "documentDataWithIdAndKey(snapshot: DocumentSnapshot<T>): Maybe<DocumentDataWithIdAndKey<T>>",
|
|
994
|
+
"description": "Extracts data from a {@link DocumentSnapshot} and mutates it to include `id` and `key` fields.\n\nThe `id` is set to `snapshot.id` (the document's ID within its collection) and `key` is set\nto `snapshot.ref.path` (the full Firestore document path). The mutation is performed in-place\non the data object returned by `snapshot.data()`.\n\nFor {@link QueryDocumentSnapshot} inputs, the return value is guaranteed non-nullish.\nReturns `undefined` if the document does not exist (i.e. `snapshot.data()` returns falsy).",
|
|
995
|
+
"params": [
|
|
996
|
+
{
|
|
997
|
+
"name": "snapshot",
|
|
998
|
+
"type": "DocumentSnapshot<T>",
|
|
999
|
+
"description": "- The snapshot to extract and augment data from",
|
|
1000
|
+
"optional": false
|
|
1001
|
+
}
|
|
1002
|
+
],
|
|
1003
|
+
"returns": "The data object with `id` and `key` fields, or `undefined` if the document doesn't exist",
|
|
1004
|
+
"tags": [
|
|
1005
|
+
"firestore",
|
|
1006
|
+
"snapshot",
|
|
1007
|
+
"data",
|
|
1008
|
+
"augment",
|
|
1009
|
+
"idkey",
|
|
1010
|
+
"id",
|
|
1011
|
+
"key",
|
|
1012
|
+
"mutate",
|
|
1013
|
+
"extract",
|
|
1014
|
+
"document",
|
|
1015
|
+
"with",
|
|
1016
|
+
"and",
|
|
1017
|
+
"documentdatawithidandkey"
|
|
1018
|
+
],
|
|
1019
|
+
"relatedSlugs": [
|
|
1020
|
+
"document-data",
|
|
1021
|
+
"set-id-and-key-from-snapshot-on-document-data",
|
|
1022
|
+
"document-data-function"
|
|
1023
|
+
]
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
"slug": "set-id-and-key-from-snapshot-on-document-data",
|
|
1027
|
+
"name": "setIdAndKeyFromSnapshotOnDocumentData",
|
|
1028
|
+
"kind": "function",
|
|
1029
|
+
"category": "firestore",
|
|
1030
|
+
"module": "@dereekb/firebase",
|
|
1031
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1032
|
+
"signature": "setIdAndKeyFromSnapshotOnDocumentData(data: T, snapshot: DocumentSnapshot<T>): DocumentDataWithIdAndKey<T>",
|
|
1033
|
+
"description": "Mutates the input data object to include `id` and `key` fields from a {@link DocumentSnapshot}.\n\nSets `data.id` to `snapshot.id` and `data.key` to `snapshot.ref.path`. The data object\nis modified in-place and also returned for chaining convenience.",
|
|
1034
|
+
"params": [
|
|
1035
|
+
{
|
|
1036
|
+
"name": "data",
|
|
1037
|
+
"type": "T",
|
|
1038
|
+
"description": "- The data object to augment (mutated in-place)",
|
|
1039
|
+
"optional": false
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
"name": "snapshot",
|
|
1043
|
+
"type": "DocumentSnapshot<T>",
|
|
1044
|
+
"description": "- Source of the `id` and `key` values",
|
|
1045
|
+
"optional": false
|
|
1046
|
+
}
|
|
1047
|
+
],
|
|
1048
|
+
"returns": "The same data object, now typed as {@link DocumentDataWithIdAndKey }",
|
|
1049
|
+
"tags": [
|
|
1050
|
+
"firestore",
|
|
1051
|
+
"data",
|
|
1052
|
+
"augment",
|
|
1053
|
+
"mutate",
|
|
1054
|
+
"idkey",
|
|
1055
|
+
"id",
|
|
1056
|
+
"key",
|
|
1057
|
+
"snapshot",
|
|
1058
|
+
"set",
|
|
1059
|
+
"and",
|
|
1060
|
+
"from",
|
|
1061
|
+
"on",
|
|
1062
|
+
"document",
|
|
1063
|
+
"setidandkeyfromsnapshotondocumentdata"
|
|
1064
|
+
],
|
|
1065
|
+
"relatedSlugs": [
|
|
1066
|
+
"set-id-and-key-from-key-id-ref-on-document-data",
|
|
1067
|
+
"document-data-with-id-and-key"
|
|
1068
|
+
]
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
"slug": "set-id-and-key-from-key-id-ref-on-document-data",
|
|
1072
|
+
"name": "setIdAndKeyFromKeyIdRefOnDocumentData",
|
|
1073
|
+
"kind": "function",
|
|
1074
|
+
"category": "firestore",
|
|
1075
|
+
"module": "@dereekb/firebase",
|
|
1076
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1077
|
+
"signature": "setIdAndKeyFromKeyIdRefOnDocumentData(data: T, modelRef: FirestoreModelKeyRef & FirestoreModelIdRef): DocumentDataWithIdAndKey<T>",
|
|
1078
|
+
"description": "Mutates the input data object to include `id` and `key` fields from a model reference.\n\nSimilar to {@link setIdAndKeyFromSnapshotOnDocumentData}, but sources the values from a\n{@link FirestoreModelKeyRef} & {@link FirestoreModelIdRef} instead of a snapshot.\nThe data object is modified in-place and also returned for chaining convenience.",
|
|
1079
|
+
"params": [
|
|
1080
|
+
{
|
|
1081
|
+
"name": "data",
|
|
1082
|
+
"type": "T",
|
|
1083
|
+
"description": "- The data object to augment (mutated in-place)",
|
|
1084
|
+
"optional": false
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
"name": "modelRef",
|
|
1088
|
+
"type": "FirestoreModelKeyRef & FirestoreModelIdRef",
|
|
1089
|
+
"description": "- Source of the `id` and `key` values",
|
|
1090
|
+
"optional": false
|
|
1091
|
+
}
|
|
1092
|
+
],
|
|
1093
|
+
"returns": "The same data object, now typed as {@link DocumentDataWithIdAndKey }",
|
|
1094
|
+
"tags": [
|
|
1095
|
+
"firestore",
|
|
1096
|
+
"data",
|
|
1097
|
+
"augment",
|
|
1098
|
+
"mutate",
|
|
1099
|
+
"idkey",
|
|
1100
|
+
"id",
|
|
1101
|
+
"key",
|
|
1102
|
+
"ref",
|
|
1103
|
+
"modelref",
|
|
1104
|
+
"set",
|
|
1105
|
+
"and",
|
|
1106
|
+
"from",
|
|
1107
|
+
"on",
|
|
1108
|
+
"document",
|
|
1109
|
+
"setidandkeyfromkeyidrefondocumentdata"
|
|
1110
|
+
],
|
|
1111
|
+
"relatedSlugs": [
|
|
1112
|
+
"set-id-and-key-from-snapshot-on-document-data"
|
|
1113
|
+
]
|
|
1114
|
+
},
|
|
1115
|
+
{
|
|
1116
|
+
"slug": "use-document-snapshot",
|
|
1117
|
+
"name": "useDocumentSnapshot",
|
|
1118
|
+
"kind": "function",
|
|
1119
|
+
"category": "firestore",
|
|
1120
|
+
"module": "@dereekb/firebase",
|
|
1121
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1122
|
+
"signature": "useDocumentSnapshot(document: Maybe<D>, use: UseAsync<DocumentSnapshot<FirestoreDocumentData<D>>, O>, defaultValue?: Maybe<AsyncGetterOrValue<O>>): Promise<Maybe<O>>",
|
|
1123
|
+
"description": "Fetches a document's snapshot and passes it to a `use` callback, following the {@link UseAsync} pattern.\n\nIf `document` is nullish, the `use` callback is not invoked and `defaultValue` is returned instead.\nIf `document` exists but the snapshot is nullish (shouldn't happen in practice), `defaultValue` is also used.",
|
|
1124
|
+
"params": [
|
|
1125
|
+
{
|
|
1126
|
+
"name": "document",
|
|
1127
|
+
"type": "Maybe<D>",
|
|
1128
|
+
"description": "- The document to fetch, or nullish to skip",
|
|
1129
|
+
"optional": false
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
"name": "use",
|
|
1133
|
+
"type": "UseAsync<DocumentSnapshot<FirestoreDocumentData<D>>, O>",
|
|
1134
|
+
"description": "- Callback that receives the fetched snapshot and returns a result",
|
|
1135
|
+
"optional": false
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
"name": "defaultValue",
|
|
1139
|
+
"type": "Maybe<AsyncGetterOrValue<O>>",
|
|
1140
|
+
"description": "- Fallback value when `document` is nullish or the snapshot is unavailable",
|
|
1141
|
+
"optional": true
|
|
1142
|
+
}
|
|
1143
|
+
],
|
|
1144
|
+
"returns": "The result of `use`, or the default value",
|
|
1145
|
+
"tags": [
|
|
1146
|
+
"firestore",
|
|
1147
|
+
"snapshot",
|
|
1148
|
+
"document",
|
|
1149
|
+
"use",
|
|
1150
|
+
"async",
|
|
1151
|
+
"callback",
|
|
1152
|
+
"default",
|
|
1153
|
+
"optional",
|
|
1154
|
+
"usedocumentsnapshot"
|
|
1155
|
+
],
|
|
1156
|
+
"relatedSlugs": [
|
|
1157
|
+
"use-document-snapshot-data",
|
|
1158
|
+
"get-document-snapshot-pair"
|
|
1159
|
+
]
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
"slug": "use-document-snapshot-data",
|
|
1163
|
+
"name": "useDocumentSnapshotData",
|
|
1164
|
+
"kind": "function",
|
|
1165
|
+
"category": "firestore",
|
|
1166
|
+
"module": "@dereekb/firebase",
|
|
1167
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1168
|
+
"signature": "useDocumentSnapshotData(): <D extends import(\"/home/circleci/code/packages/firebase/src/lib/common/firestore/accessor/document\").FirestoreDocument<any, import(\"/home/circleci/code/packages/firebase/src/lib/common/firestore/collection/collection\").FirestoreModelIdentity>, O = void>(document: Maybe<D>, use: UseAsync<import(\"/home/circleci/code/packages/firebase/src/lib/common/firestore/accessor/document\").FirestoreDocumentData<D>, O>, defaultValue?: Maybe<AsyncGetterOrValue<O>>) => Promise<Maybe<O>>",
|
|
1169
|
+
"description": "Fetches a document's snapshot data (via `snapshot.data()`) and passes it to a `use` callback.\n\nWraps {@link useDocumentSnapshot} with a mapping step that extracts raw data from the snapshot.\nIf the document doesn't exist (data is `undefined`), the `use` callback is not invoked\nand `defaultValue` is returned instead.",
|
|
1170
|
+
"params": [],
|
|
1171
|
+
"returns": "The result of `use`, or the default value",
|
|
1172
|
+
"tags": [
|
|
1173
|
+
"firestore",
|
|
1174
|
+
"snapshot",
|
|
1175
|
+
"data",
|
|
1176
|
+
"document",
|
|
1177
|
+
"use",
|
|
1178
|
+
"async",
|
|
1179
|
+
"callback",
|
|
1180
|
+
"default",
|
|
1181
|
+
"usedocumentsnapshotdata"
|
|
1182
|
+
],
|
|
1183
|
+
"relatedSlugs": [
|
|
1184
|
+
"use-document-snapshot",
|
|
1185
|
+
"get-document-snapshot-data"
|
|
1186
|
+
]
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
"slug": "firestore-model-id-from-document",
|
|
1190
|
+
"name": "firestoreModelIdFromDocument",
|
|
1191
|
+
"kind": "function",
|
|
1192
|
+
"category": "firestore",
|
|
1193
|
+
"module": "@dereekb/firebase",
|
|
1194
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1195
|
+
"signature": "firestoreModelIdFromDocument(document: D): FirestoreModelId",
|
|
1196
|
+
"description": "Extracts the document ID ({@link FirestoreModelId}) from a {@link FirestoreDocument}.\n\nUseful as a mapper function, e.g. `documents.map(firestoreModelIdFromDocument)`.",
|
|
1197
|
+
"params": [
|
|
1198
|
+
{
|
|
1199
|
+
"name": "document",
|
|
1200
|
+
"type": "D",
|
|
1201
|
+
"description": "- The document to extract the ID from",
|
|
1202
|
+
"optional": false
|
|
1203
|
+
}
|
|
1204
|
+
],
|
|
1205
|
+
"returns": "The document's ID (the last segment of its Firestore path)",
|
|
1206
|
+
"tags": [
|
|
1207
|
+
"firestore",
|
|
1208
|
+
"document",
|
|
1209
|
+
"id",
|
|
1210
|
+
"accessor",
|
|
1211
|
+
"mapper",
|
|
1212
|
+
"key",
|
|
1213
|
+
"model",
|
|
1214
|
+
"from",
|
|
1215
|
+
"firestoremodelidfromdocument"
|
|
1216
|
+
],
|
|
1217
|
+
"relatedSlugs": [
|
|
1218
|
+
"firestore-model-ids-from-documents",
|
|
1219
|
+
"firestore-model-key-from-document"
|
|
1220
|
+
]
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
"slug": "firestore-model-ids-from-documents",
|
|
1224
|
+
"name": "firestoreModelIdsFromDocuments",
|
|
1225
|
+
"kind": "function",
|
|
1226
|
+
"category": "firestore",
|
|
1227
|
+
"module": "@dereekb/firebase",
|
|
1228
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1229
|
+
"signature": "firestoreModelIdsFromDocuments(documents: D[]): FirestoreModelId[]",
|
|
1230
|
+
"description": "Extracts document IDs from an array of {@link FirestoreDocument}s.",
|
|
1231
|
+
"params": [
|
|
1232
|
+
{
|
|
1233
|
+
"name": "documents",
|
|
1234
|
+
"type": "D[]",
|
|
1235
|
+
"description": "- Documents to extract IDs from",
|
|
1236
|
+
"optional": false
|
|
1237
|
+
}
|
|
1238
|
+
],
|
|
1239
|
+
"returns": "Array of document IDs in the same order as the input",
|
|
1240
|
+
"tags": [
|
|
1241
|
+
"firestore",
|
|
1242
|
+
"document",
|
|
1243
|
+
"id",
|
|
1244
|
+
"accessor",
|
|
1245
|
+
"batch",
|
|
1246
|
+
"mapper",
|
|
1247
|
+
"model",
|
|
1248
|
+
"ids",
|
|
1249
|
+
"from",
|
|
1250
|
+
"documents",
|
|
1251
|
+
"firestoremodelidsfromdocuments"
|
|
1252
|
+
],
|
|
1253
|
+
"relatedSlugs": [
|
|
1254
|
+
"firestore-model-id-from-document",
|
|
1255
|
+
"firestore-model-keys-from-documents"
|
|
1256
|
+
]
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
"slug": "firestore-model-key-from-document",
|
|
1260
|
+
"name": "firestoreModelKeyFromDocument",
|
|
1261
|
+
"kind": "function",
|
|
1262
|
+
"category": "firestore",
|
|
1263
|
+
"module": "@dereekb/firebase",
|
|
1264
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1265
|
+
"signature": "firestoreModelKeyFromDocument(document: D): FirestoreModelKey",
|
|
1266
|
+
"description": "Extracts the full Firestore path ({@link FirestoreModelKey}) from a {@link FirestoreDocument}.\n\nUseful as a mapper function, e.g. `documents.map(firestoreModelKeyFromDocument)`.",
|
|
1267
|
+
"params": [
|
|
1268
|
+
{
|
|
1269
|
+
"name": "document",
|
|
1270
|
+
"type": "D",
|
|
1271
|
+
"description": "- The document to extract the key from",
|
|
1272
|
+
"optional": false
|
|
1273
|
+
}
|
|
1274
|
+
],
|
|
1275
|
+
"returns": "The document's full Firestore path (e.g. `'users/abc123'`)",
|
|
1276
|
+
"tags": [
|
|
1277
|
+
"firestore",
|
|
1278
|
+
"document",
|
|
1279
|
+
"key",
|
|
1280
|
+
"path",
|
|
1281
|
+
"accessor",
|
|
1282
|
+
"mapper",
|
|
1283
|
+
"model",
|
|
1284
|
+
"from",
|
|
1285
|
+
"firestoremodelkeyfromdocument"
|
|
1286
|
+
],
|
|
1287
|
+
"relatedSlugs": [
|
|
1288
|
+
"firestore-model-keys-from-documents",
|
|
1289
|
+
"firestore-model-id-from-document"
|
|
1290
|
+
]
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
"slug": "firestore-model-keys-from-documents",
|
|
1294
|
+
"name": "firestoreModelKeysFromDocuments",
|
|
1295
|
+
"kind": "function",
|
|
1296
|
+
"category": "firestore",
|
|
1297
|
+
"module": "@dereekb/firebase",
|
|
1298
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1299
|
+
"signature": "firestoreModelKeysFromDocuments(documents: D[]): FirestoreModelKey[]",
|
|
1300
|
+
"description": "Extracts full Firestore paths from an array of {@link FirestoreDocument}s.",
|
|
1301
|
+
"params": [
|
|
1302
|
+
{
|
|
1303
|
+
"name": "documents",
|
|
1304
|
+
"type": "D[]",
|
|
1305
|
+
"description": "- Documents to extract keys from",
|
|
1306
|
+
"optional": false
|
|
1307
|
+
}
|
|
1308
|
+
],
|
|
1309
|
+
"returns": "Array of full Firestore paths in the same order as the input",
|
|
1310
|
+
"tags": [
|
|
1311
|
+
"firestore",
|
|
1312
|
+
"document",
|
|
1313
|
+
"key",
|
|
1314
|
+
"path",
|
|
1315
|
+
"accessor",
|
|
1316
|
+
"batch",
|
|
1317
|
+
"mapper",
|
|
1318
|
+
"model",
|
|
1319
|
+
"keys",
|
|
1320
|
+
"from",
|
|
1321
|
+
"documents",
|
|
1322
|
+
"firestoremodelkeysfromdocuments"
|
|
1323
|
+
],
|
|
1324
|
+
"relatedSlugs": [
|
|
1325
|
+
"firestore-model-key-from-document",
|
|
1326
|
+
"firestore-model-ids-from-documents"
|
|
1327
|
+
]
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
"slug": "document-reference-from-document",
|
|
1331
|
+
"name": "documentReferenceFromDocument",
|
|
1332
|
+
"kind": "function",
|
|
1333
|
+
"category": "firestore",
|
|
1334
|
+
"module": "@dereekb/firebase",
|
|
1335
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1336
|
+
"signature": "documentReferenceFromDocument(document: D): DocumentReference<T>",
|
|
1337
|
+
"description": "Extracts the {@link DocumentReference} from a {@link FirestoreDocument}.\n\nUseful as a mapper function, e.g. `documents.map(documentReferenceFromDocument)`.",
|
|
1338
|
+
"params": [
|
|
1339
|
+
{
|
|
1340
|
+
"name": "document",
|
|
1341
|
+
"type": "D",
|
|
1342
|
+
"description": "- The document to extract the reference from",
|
|
1343
|
+
"optional": false
|
|
1344
|
+
}
|
|
1345
|
+
],
|
|
1346
|
+
"returns": "The underlying Firestore document reference",
|
|
1347
|
+
"tags": [
|
|
1348
|
+
"firestore",
|
|
1349
|
+
"document",
|
|
1350
|
+
"reference",
|
|
1351
|
+
"accessor",
|
|
1352
|
+
"mapper",
|
|
1353
|
+
"from",
|
|
1354
|
+
"documentreferencefromdocument"
|
|
1355
|
+
],
|
|
1356
|
+
"relatedSlugs": [
|
|
1357
|
+
"document-references-from-documents",
|
|
1358
|
+
"firestore-model-key-from-document"
|
|
1359
|
+
]
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
"slug": "document-references-from-documents",
|
|
1363
|
+
"name": "documentReferencesFromDocuments",
|
|
1364
|
+
"kind": "function",
|
|
1365
|
+
"category": "firestore",
|
|
1366
|
+
"module": "@dereekb/firebase",
|
|
1367
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1368
|
+
"signature": "documentReferencesFromDocuments(documents: D[]): DocumentReference<T>[]",
|
|
1369
|
+
"description": "Extracts {@link DocumentReference}s from an array of {@link FirestoreDocument}s.",
|
|
1370
|
+
"params": [
|
|
1371
|
+
{
|
|
1372
|
+
"name": "documents",
|
|
1373
|
+
"type": "D[]",
|
|
1374
|
+
"description": "- Documents to extract references from",
|
|
1375
|
+
"optional": false
|
|
1376
|
+
}
|
|
1377
|
+
],
|
|
1378
|
+
"returns": "Array of document references in the same order as the input",
|
|
1379
|
+
"tags": [
|
|
1380
|
+
"firestore",
|
|
1381
|
+
"document",
|
|
1382
|
+
"reference",
|
|
1383
|
+
"accessor",
|
|
1384
|
+
"batch",
|
|
1385
|
+
"mapper",
|
|
1386
|
+
"references",
|
|
1387
|
+
"from",
|
|
1388
|
+
"documents",
|
|
1389
|
+
"documentreferencesfromdocuments"
|
|
1390
|
+
],
|
|
1391
|
+
"relatedSlugs": [
|
|
1392
|
+
"document-reference-from-document",
|
|
1393
|
+
"firestore-model-keys-from-documents"
|
|
1394
|
+
]
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
"slug": "limited-firestore-document-accessor-snapshot-cache",
|
|
1398
|
+
"name": "limitedFirestoreDocumentAccessorSnapshotCache",
|
|
1399
|
+
"kind": "factory",
|
|
1400
|
+
"category": "firestore",
|
|
1401
|
+
"module": "@dereekb/firebase",
|
|
1402
|
+
"subpath": "common/firestore/accessor/document.utility",
|
|
1403
|
+
"signature": "limitedFirestoreDocumentAccessorSnapshotCache(accessor: LimitedFirestoreDocumentAccessor<T, D>): LimitedFirestoreDocumentAccessorSnapshotCache<T, D>",
|
|
1404
|
+
"description": "Creates a {@link LimitedFirestoreDocumentAccessorSnapshotCache} that wraps the given accessor\nwith an in-memory {@link Map} cache so that repeated loads for the same key return the cached\npromise instead of re-reading from Firestore.\n\nThe cache stores the promise itself (not the resolved value), which means concurrent requests\nfor the same key that arrive before the first read completes will also be deduplicated.\n\nThe cache lives for the lifetime of the returned object and is never invalidated, so this is\nbest suited for short-lived scopes (e.g. a single request or batch operation) where stale reads\nare acceptable.",
|
|
1405
|
+
"params": [
|
|
1406
|
+
{
|
|
1407
|
+
"name": "accessor",
|
|
1408
|
+
"type": "LimitedFirestoreDocumentAccessor<T, D>",
|
|
1409
|
+
"description": "- The accessor to wrap with caching behavior",
|
|
1410
|
+
"optional": false
|
|
1411
|
+
}
|
|
1412
|
+
],
|
|
1413
|
+
"returns": "A {@link LimitedFirestoreDocumentAccessorSnapshotCache } backed by the given accessor",
|
|
1414
|
+
"tags": [
|
|
1415
|
+
"firestore",
|
|
1416
|
+
"cache",
|
|
1417
|
+
"snapshot",
|
|
1418
|
+
"accessor",
|
|
1419
|
+
"deduplicate",
|
|
1420
|
+
"memoize",
|
|
1421
|
+
"reader",
|
|
1422
|
+
"limited",
|
|
1423
|
+
"document",
|
|
1424
|
+
"limitedfirestoredocumentaccessorsnapshotcache"
|
|
1425
|
+
],
|
|
1426
|
+
"example": "const cache = limitedFirestoreDocumentAccessorSnapshotCache(accessor);\n\n// First call reads from Firestore; second call returns cached result\nconst pair = await cache.getDocumentSnapshotDataPairForKey('users/abc123');\nconst samePair = await cache.getDocumentSnapshotDataPairForKey('users/abc123');\n\n// Batch fetch with automatic deduplication\nconst pairs = await cache.getDocumentSnapshotDataPairsWithDataForKeys(['users/abc', 'users/def']);\n\n// Access the underlying accessor directly\nconst doc = cache.accessor.loadDocumentForKey('users/xyz');"
|
|
1427
|
+
}
|
|
1428
|
+
]
|
|
1429
|
+
}
|