@dereekb/firebase 13.0.5 → 13.0.7
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/index.cjs.js +575 -146
- package/index.cjs.js.map +1 -1
- package/index.esm.js +573 -149
- package/index.esm.js.map +1 -1
- package/package.json +5 -5
- package/src/lib/common/firestore/accessor/document.rxjs.d.ts +55 -3
- package/src/lib/common/firestore/accessor/document.utility.d.ts +439 -128
- package/src/lib/common/firestore/query/constraint.d.ts +27 -22
- package/src/lib/common/firestore/query/constraint.template.d.ts +48 -32
- package/src/lib/common/firestore/query/iterator.d.ts +58 -2
- package/src/lib/common/firestore/query/query.iterate.d.ts +300 -96
- package/test/index.cjs.js +824 -15
- package/test/index.esm.js +826 -18
- package/test/package.json +6 -6
- package/test/src/lib/common/firestore/index.d.ts +1 -0
- package/test/src/lib/common/firestore/test.driver.utility.d.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.7",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./test": {
|
|
6
6
|
"module": "./test/index.esm.js",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@dereekb/date": "13.0.
|
|
21
|
-
"@dereekb/model": "13.0.
|
|
22
|
-
"@dereekb/rxjs": "13.0.
|
|
23
|
-
"@dereekb/util": "13.0.
|
|
20
|
+
"@dereekb/date": "13.0.7",
|
|
21
|
+
"@dereekb/model": "13.0.7",
|
|
22
|
+
"@dereekb/rxjs": "13.0.7",
|
|
23
|
+
"@dereekb/util": "13.0.7",
|
|
24
24
|
"@firebase/rules-unit-testing": "5.0.0",
|
|
25
25
|
"class-transformer": "^0.5.1",
|
|
26
26
|
"class-validator": "^0.15.1",
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type Observable, type OperatorFunction } from 'rxjs';
|
|
2
2
|
import { type DocumentDataWithIdAndKey, type DocumentSnapshot } from '../types';
|
|
3
3
|
import { type FirestoreDocument, type FirestoreDocumentData } from './document';
|
|
4
|
+
import { type FirestoreDocumentSnapshotDataPair, type FirestoreDocumentSnapshotDataPairWithData } from './document.utility';
|
|
4
5
|
/**
|
|
5
6
|
* Creates an Observable that emits arrays of document snapshots for multiple documents.
|
|
6
7
|
*
|
|
7
8
|
* This function streams the latest snapshots for each document in the provided array.
|
|
8
9
|
* Each time any document in the array changes, a new array containing the latest snapshots
|
|
9
|
-
* of all documents is emitted.
|
|
10
|
+
* of all documents is emitted.
|
|
10
11
|
*
|
|
11
12
|
* If the input array is empty, an Observable that emits an empty array is returned.
|
|
12
13
|
*
|
|
@@ -15,13 +16,29 @@ import { type FirestoreDocument, type FirestoreDocumentData } from './document';
|
|
|
15
16
|
* @returns Observable that emits arrays of DocumentSnapshots whenever any document changes
|
|
16
17
|
*/
|
|
17
18
|
export declare function latestSnapshotsFromDocuments<D extends FirestoreDocument<any>>(documents: D[]): Observable<DocumentSnapshot<FirestoreDocumentData<D>>[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an Observable that streams and transforms snapshots for multiple documents using `combineLatest`.
|
|
21
|
+
*
|
|
22
|
+
* Pipes each document's `accessor.stream()` through the provided `operator` before combining.
|
|
23
|
+
* This ensures the transformation runs per-document when only one document changes, rather than
|
|
24
|
+
* re-mapping all snapshots on every emission.
|
|
25
|
+
*
|
|
26
|
+
* {@link latestSnapshotsFromDocuments} delegates to this function with an identity operator.
|
|
27
|
+
*
|
|
28
|
+
* Returns `of([])` for an empty input array.
|
|
29
|
+
*
|
|
30
|
+
* @param documents - Documents to stream from
|
|
31
|
+
* @param operator - RxJS operator applied to each document's snapshot stream individually
|
|
32
|
+
* @returns Observable emitting an array of transformed values whenever any document changes
|
|
33
|
+
*/
|
|
34
|
+
export declare function mapLatestSnapshotsFromDocuments<D extends FirestoreDocument<any>, O>(documents: D[], operator: OperatorFunction<DocumentSnapshot<FirestoreDocumentData<D>>, O>): Observable<O[]>;
|
|
18
35
|
/**
|
|
19
36
|
* Creates an Observable that emits arrays of document data for multiple documents.
|
|
20
37
|
*
|
|
21
38
|
* This function streams the latest data for each document in the provided array.
|
|
22
39
|
* Each time any document in the array changes, a new array containing the latest data
|
|
23
40
|
* of all documents is emitted. Document data includes both the document content and
|
|
24
|
-
* metadata like document ID and key.
|
|
41
|
+
* metadata like document ID and key.
|
|
25
42
|
*
|
|
26
43
|
* Non-existent documents are filtered out of the results automatically.
|
|
27
44
|
*
|
|
@@ -29,7 +46,7 @@ export declare function latestSnapshotsFromDocuments<D extends FirestoreDocument
|
|
|
29
46
|
* @param documents - Array of document instances to stream data for
|
|
30
47
|
* @returns Observable that emits arrays of document data whenever any document changes
|
|
31
48
|
*/
|
|
32
|
-
export declare function
|
|
49
|
+
export declare function streamDocumentSnapshotsData<D extends FirestoreDocument<any>>(documents: D[]): Observable<DocumentDataWithIdAndKey<FirestoreDocumentData<D>>[]>;
|
|
33
50
|
/**
|
|
34
51
|
* Creates an RxJS operator that transforms arrays of DocumentSnapshots into arrays of document data.
|
|
35
52
|
*
|
|
@@ -41,3 +58,38 @@ export declare function latestDataFromDocuments<D extends FirestoreDocument<any>
|
|
|
41
58
|
* @returns An operator that transforms arrays of DocumentSnapshots into arrays of document data
|
|
42
59
|
*/
|
|
43
60
|
export declare function dataFromDocumentSnapshots<T>(): OperatorFunction<DocumentSnapshot<T>[], DocumentDataWithIdAndKey<T>[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Streams {@link FirestoreDocumentSnapshotDataPair}s for multiple documents using `combineLatest`.
|
|
63
|
+
*
|
|
64
|
+
* Each document's `accessor.stream()` is individually piped to produce a `{ document, snapshot, data }` triplet,
|
|
65
|
+
* then all streams are combined via `combineLatest`. This ensures the mapping only runs for the document
|
|
66
|
+
* that actually changed. The `data` field has `id` and `key` fields injected via {@link documentDataWithIdAndKey},
|
|
67
|
+
* and will be `undefined` for documents that don't exist in Firestore.
|
|
68
|
+
*
|
|
69
|
+
* Returns `of([])` for an empty input array.
|
|
70
|
+
*
|
|
71
|
+
* This is the streaming equivalent of {@link import('./document.utility').getDocumentSnapshotDataPairs}.
|
|
72
|
+
*
|
|
73
|
+
* @param documents - Documents to stream snapshot-data pairs for
|
|
74
|
+
* @returns Observable emitting snapshot-data pairs whenever any document changes
|
|
75
|
+
*/
|
|
76
|
+
export declare function streamDocumentSnapshotDataPairs<D extends FirestoreDocument<any>>(documents: D[]): Observable<FirestoreDocumentSnapshotDataPair<D>[]>;
|
|
77
|
+
/**
|
|
78
|
+
* Streams {@link FirestoreDocumentSnapshotDataPairWithData}s for multiple documents, filtering out non-existent documents.
|
|
79
|
+
*
|
|
80
|
+
* Builds on {@link streamDocumentSnapshotDataPairs} and filters each emission to include only pairs where
|
|
81
|
+
* `data` is non-nullish (i.e., the document exists in Firestore). The filtered array may be shorter than
|
|
82
|
+
* the input `documents` array and may change length over time as documents are created or deleted.
|
|
83
|
+
*
|
|
84
|
+
* Returns `of([])` for an empty input array.
|
|
85
|
+
*
|
|
86
|
+
* This is the streaming equivalent of {@link import('./document.utility').getDocumentSnapshotDataPairsWithData}.
|
|
87
|
+
*
|
|
88
|
+
* @param documents - Documents to stream snapshot-data pairs for
|
|
89
|
+
* @returns Observable emitting snapshot-data pairs for existing documents only, whenever any document changes
|
|
90
|
+
*/
|
|
91
|
+
export declare function streamDocumentSnapshotDataPairsWithData<D extends FirestoreDocument<any>>(documents: D[]): Observable<FirestoreDocumentSnapshotDataPairWithData<D>[]>;
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated Use {@link streamDocumentSnapshotsData} instead.
|
|
94
|
+
*/
|
|
95
|
+
export declare const latestDataFromDocuments: typeof streamDocumentSnapshotsData;
|