@dereekb/dbx-firebase 8.6.0 → 8.6.1

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.
@@ -31,7 +31,7 @@ import { provideFunctions, getFunctions, connectFunctionsEmulator, Functions } f
31
31
  import * as i1$3 from '@angular/fire/firestore';
32
32
  import { provideFirestore, getFirestore, connectFirestoreEmulator, enableIndexedDbPersistence, Firestore } from '@angular/fire/firestore';
33
33
  import { HTTP_INTERCEPTORS } from '@angular/common/http';
34
- import { firebaseFirestoreContextFactory, iterationQueryDocChangeWatcher, firebaseQueryItemAccumulator, firestoreModelKeysFromDocuments, firestoreModelIdsFromDocuments, documentReferencesFromDocuments, getDocumentSnapshots, getDataFromDocumentSnapshots, streamDocumentSnapshots, dataFromDocumentSnapshots, loadDocumentsForKeys, loadDocumentsForDocumentReferences, loadDocumentsForIds, documentDataWithId } from '@dereekb/firebase';
34
+ import { firebaseFirestoreContextFactory, iterationQueryDocChangeWatcher, firebaseQueryItemAccumulator, firestoreModelKeysFromDocuments, firestoreModelIdsFromDocuments, documentReferencesFromDocuments, getDocumentSnapshots, getDataFromDocumentSnapshots, streamDocumentSnapshots, dataFromDocumentSnapshots, loadDocumentsForKeys, loadDocumentsForDocumentReferences, loadDocumentsForIds, firestoreModelIdsFromKey, firestoreModelKeyPartPairs, firestoreModelKeyPairObject, documentDataWithId } from '@dereekb/firebase';
35
35
 
36
36
  /**
37
37
  * Enables debug token generation for AppCheck by setting FIREBASE_APPCHECK_DEBUG_TOKEN in the browser's self/window.
@@ -2604,9 +2604,12 @@ class AbstractDbxFirebaseDocumentStore extends LockSetComponentStore {
2604
2604
  }), distinctUntilChanged(), shareReplay(1));
2605
2605
  this.document$ = this.currentDocument$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
2606
2606
  this.documentLoadingState$ = this.currentDocument$.pipe(map((x) => (x ? successResult(x) : beginLoading())), shareReplay(1));
2607
- this.id$ = this.document$.pipe(map((x) => x.id), shareReplay());
2608
- this.key$ = this.document$.pipe(map((x) => x.key), shareReplay());
2609
- this.ref$ = this.document$.pipe(map((x) => x.documentRef), shareReplay());
2607
+ this.id$ = this.document$.pipe(map((x) => x.id), shareReplay(1));
2608
+ this.key$ = this.document$.pipe(map((x) => x.key), shareReplay(1));
2609
+ this.keyModelIds$ = this.key$.pipe(map(firestoreModelIdsFromKey), shareReplay(1));
2610
+ this.keyPairs$ = this.key$.pipe(map(firestoreModelKeyPartPairs), filterMaybe(), shareReplay(1));
2611
+ this.keyPairObject$ = this.key$.pipe(map(firestoreModelKeyPairObject), filterMaybe(), shareReplay(1));
2612
+ this.ref$ = this.document$.pipe(map((x) => x.documentRef), shareReplay(1));
2610
2613
  this.snapshot$ = this.document$.pipe(switchMap((x) => x.accessor.stream()), shareReplay(1));
2611
2614
  this.snapshotLoadingState$ = this.currentDocument$.pipe(switchMap(() => loadingStateFromObs(this.snapshot$)), shareReplay(1));
2612
2615
  this.currentData$ = this.document$.pipe(switchMap((x) => x.accessor.stream().pipe(map((y) => documentDataWithId(y)))), shareReplay(1));
@@ -2637,15 +2640,15 @@ class AbstractDbxFirebaseDocumentStore extends LockSetComponentStore {
2637
2640
  /**
2638
2641
  * Sets the id of the document to load.
2639
2642
  */
2640
- this.setId = this.updater((state, id) => (id ? { ...state, id, ref: undefined } : { ...state, id }));
2643
+ this.setId = this.updater((state, id) => (id ? { ...state, id, key: undefined, ref: undefined } : { ...state, id }));
2641
2644
  /**
2642
2645
  * Sets the key of the document to load.
2643
2646
  */
2644
- this.setKey = this.updater((state, key) => (key ? { ...state, key, ref: undefined } : { ...state, key }));
2647
+ this.setKey = this.updater((state, key) => (key ? { ...state, key, id: undefined, ref: undefined } : { ...state, key }));
2645
2648
  /**
2646
2649
  * Sets the ref of the document to load.
2647
2650
  */
2648
- this.setRef = this.updater((state, ref) => (ref ? { ...state, id: undefined, ref } : { ...state, ref }));
2651
+ this.setRef = this.updater((state, ref) => (ref ? { ...state, key: undefined, id: undefined, ref } : { ...state, ref }));
2649
2652
  this.clearRefs = this.updater((state) => ({ ...state, id: undefined, key: undefined, ref: undefined }));
2650
2653
  this.setFirestoreCollection = this.updater((state, firestoreCollection) => ({ ...state, firestoreCollection }));
2651
2654
  this.setFirestoreCollectionLike = this.updater((state, firestoreCollectionLike) => ({ ...state, firestoreCollectionLike }));