@dereekb/dbx-firebase 9.15.1 → 9.15.3
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/esm2020/lib/model/store/store.document.directive.mjs +13 -2
- package/esm2020/lib/model/store/store.document.mjs +6 -13
- package/fesm2015/dereekb-dbx-firebase.mjs +16 -13
- package/fesm2015/dereekb-dbx-firebase.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-firebase.mjs +16 -13
- package/fesm2020/dereekb-dbx-firebase.mjs.map +1 -1
- package/lib/model/store/store.document.d.ts +22 -14
- package/lib/model/store/store.document.directive.d.ts +7 -5
- package/package.json +6 -6
|
@@ -20,7 +20,7 @@ import { sendPasswordResetEmail } from 'firebase/auth';
|
|
|
20
20
|
import * as i1$2 from '@dereekb/dbx-web';
|
|
21
21
|
import { DbxRouterAnchorModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule, AbstractDbxSelectionListWrapperDirective, provideDbxListViewWrapper, DEFAULT_LIST_WRAPPER_DIRECTIVE_TEMPLATE, AbstractDbxSelectionListViewDirective, provideDbxListView, DEFAULT_DBX_SELECTION_VALUE_LIST_DIRECTIVE_TEMPLATE, AbstractDbxValueListViewItemComponent, DBX_VALUE_LIST_VIEW_ITEM, TwoColumnsContextStore, AbstractPopupDirective, DbxWidgetModule, DbxTextModule, DbxBlockLayoutModule, DbxTwoColumnLayoutModule, DbxPopupInteractionModule, DbxListLayoutModule } from '@dereekb/dbx-web';
|
|
22
22
|
import * as i1$3 from '@dereekb/firebase';
|
|
23
|
-
import { firebaseAuthErrorToReadableError, ScheduledFunctionDevelopmentFunctionTypeEnum, clientFirebaseFirestoreContextFactory, SystemStateFirestoreCollections, FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY, FirebaseDevelopmentFunctions, iterationQueryDocChangeWatcher, firebaseQuerySnapshotAccumulator, firebaseQueryItemAccumulator, firestoreModelKeysFromDocuments, firestoreModelIdsFromDocuments, documentReferencesFromDocuments, getDocumentSnapshots, getDataFromDocumentSnapshots, latestSnapshotsFromDocuments, dataFromDocumentSnapshots, loadDocumentsForKeys, loadDocumentsForDocumentReferences, loadDocumentsForIds, firestoreModelIdsFromKey, firestoreModelKeyPartPairs, firestoreModelKeyPairObject, documentDataWithIdAndKey, clientFirebaseStorageContextFactory } from '@dereekb/firebase';
|
|
23
|
+
import { firebaseAuthErrorToReadableError, ScheduledFunctionDevelopmentFunctionTypeEnum, clientFirebaseFirestoreContextFactory, SystemStateFirestoreCollections, FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY, FirebaseDevelopmentFunctions, iterationQueryDocChangeWatcher, firebaseQuerySnapshotAccumulator, firebaseQueryItemAccumulator, firestoreModelKeysFromDocuments, firestoreModelIdsFromDocuments, documentReferencesFromDocuments, getDocumentSnapshots, getDataFromDocumentSnapshots, latestSnapshotsFromDocuments, dataFromDocumentSnapshots, loadDocumentsForKeys, loadDocumentsForDocumentReferences, loadDocumentsForIds, FirestoreAccessorStreamMode, firestoreModelIdsFromKey, firestoreModelKeyPartPairs, firestoreModelKeyPairObject, documentDataWithIdAndKey, clientFirebaseStorageContextFactory } from '@dereekb/firebase';
|
|
24
24
|
import * as i5 from '@dereekb/dbx-form';
|
|
25
25
|
import { AbstractAsyncFormlyFormDirective, usernamePasswordLoginFields, provideFormlyContext, AbstractSyncFormlyFormDirective, emailField, DbxFormIoModule, DbxFormModule, DbxFormlyModule, DbxFormActionModule, DbxFormFormlyTextFieldModule, AbstractConfigAsyncFormlyFormDirective, pickableItemChipField, filterPickableItemFieldValuesByLabel } from '@dereekb/dbx-form';
|
|
26
26
|
import { msToSeconds } from '@dereekb/date';
|
|
@@ -2910,18 +2910,28 @@ class DbxFirebaseDocumentStoreDirective {
|
|
|
2910
2910
|
set id(id) {
|
|
2911
2911
|
this.store.setId(id);
|
|
2912
2912
|
}
|
|
2913
|
+
set key(key) {
|
|
2914
|
+
this.store.setKey(key);
|
|
2915
|
+
}
|
|
2913
2916
|
set ref(ref) {
|
|
2914
2917
|
this.store.setRef(ref);
|
|
2915
2918
|
}
|
|
2919
|
+
set streamMode(streamMode) {
|
|
2920
|
+
this.store.setStreamMode(streamMode);
|
|
2921
|
+
}
|
|
2916
2922
|
}
|
|
2917
2923
|
DbxFirebaseDocumentStoreDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFirebaseDocumentStoreDirective, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
2918
|
-
DbxFirebaseDocumentStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: DbxFirebaseDocumentStoreDirective, inputs: { id: "id", ref: "ref" }, ngImport: i0 });
|
|
2924
|
+
DbxFirebaseDocumentStoreDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: DbxFirebaseDocumentStoreDirective, inputs: { id: "id", key: "key", ref: "ref", streamMode: "streamMode" }, ngImport: i0 });
|
|
2919
2925
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFirebaseDocumentStoreDirective, decorators: [{
|
|
2920
2926
|
type: Directive
|
|
2921
2927
|
}], ctorParameters: function () { return [{ type: undefined }]; }, propDecorators: { id: [{
|
|
2922
2928
|
type: Input
|
|
2929
|
+
}], key: [{
|
|
2930
|
+
type: Input
|
|
2923
2931
|
}], ref: [{
|
|
2924
2932
|
type: Input
|
|
2933
|
+
}], streamMode: [{
|
|
2934
|
+
type: Input
|
|
2925
2935
|
}] } });
|
|
2926
2936
|
function provideDbxFirebaseDocumentStoreDirective(sourceType, storeType) {
|
|
2927
2937
|
const providers = [
|
|
@@ -3166,6 +3176,7 @@ class AbstractDbxFirebaseDocumentStore extends LockSetComponentStore {
|
|
|
3166
3176
|
this.inputKey$ = this.currentInputKey$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
|
|
3167
3177
|
this.currentInputRef$ = this.state$.pipe(map((x) => x.ref), distinctUntilChanged(), shareReplay(1));
|
|
3168
3178
|
this.inputRef$ = this.currentInputRef$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
|
|
3179
|
+
this.streamMode$ = this.state$.pipe(map((x) => x.streamMode ?? FirestoreAccessorStreamMode.STREAM), distinctUntilChanged(), shareReplay(1));
|
|
3169
3180
|
this.currentDocument$ = combineLatest([this.currentInputId$, this.currentInputKey$, this.currentInputRef$]).pipe(switchMap(([id, key, ref]) => {
|
|
3170
3181
|
let document;
|
|
3171
3182
|
if (ref) {
|
|
@@ -3194,9 +3205,9 @@ class AbstractDbxFirebaseDocumentStore extends LockSetComponentStore {
|
|
|
3194
3205
|
this.keyPairs$ = this.key$.pipe(map(firestoreModelKeyPartPairs), filterMaybe(), shareReplay(1));
|
|
3195
3206
|
this.keyPairObject$ = this.key$.pipe(map(firestoreModelKeyPairObject), filterMaybe(), shareReplay(1));
|
|
3196
3207
|
this.ref$ = this.document$.pipe(map((x) => x.documentRef), shareReplay(1));
|
|
3197
|
-
this.snapshot$ = this.document
|
|
3208
|
+
this.snapshot$ = combineLatest([this.document$, this.streamMode$]).pipe(switchMap(([x, mode]) => x.snapshotStream(mode)), shareReplay(1));
|
|
3198
3209
|
this.snapshotLoadingState$ = this.currentDocument$.pipe(switchMap(() => loadingStateFromObs(this.snapshot$)), shareReplay(1));
|
|
3199
|
-
this.currentData$ = this.
|
|
3210
|
+
this.currentData$ = this.snapshot$.pipe(map((x) => documentDataWithIdAndKey(x)), shareReplay(1));
|
|
3200
3211
|
this.data$ = this.currentDocument$.pipe(switchMap(() => this.currentData$.pipe(filterMaybe())), shareReplay(1));
|
|
3201
3212
|
this.dataLoadingState$ = this.snapshotLoadingState$.pipe(map((x) => {
|
|
3202
3213
|
let result;
|
|
@@ -3232,18 +3243,10 @@ class AbstractDbxFirebaseDocumentStore extends LockSetComponentStore {
|
|
|
3232
3243
|
this.doesNotExist$ = this.exists$.pipe(map((x) => !x), shareReplay(1));
|
|
3233
3244
|
this.modelIdentity$ = this.document$.pipe(map((x) => x.modelIdentity), shareReplay(1));
|
|
3234
3245
|
// MARK: State Changes
|
|
3235
|
-
/**
|
|
3236
|
-
* Sets the id of the document to load.
|
|
3237
|
-
*/
|
|
3238
3246
|
this.setId = this.updater((state, id) => (id ? { ...state, id, key: undefined, ref: undefined } : { ...state, id }));
|
|
3239
|
-
/**
|
|
3240
|
-
* Sets the key of the document to load.
|
|
3241
|
-
*/
|
|
3242
3247
|
this.setKey = this.updater((state, key) => (key ? { ...state, key, id: undefined, ref: undefined } : { ...state, key }));
|
|
3243
|
-
/**
|
|
3244
|
-
* Sets the ref of the document to load.
|
|
3245
|
-
*/
|
|
3246
3248
|
this.setRef = this.updater((state, ref) => (ref ? { ...state, key: undefined, id: undefined, ref } : { ...state, ref }));
|
|
3249
|
+
this.setStreamMode = this.updater((state, streamMode) => ({ ...state, streamMode }));
|
|
3247
3250
|
this.clearRefs = this.updater((state) => ({ ...state, id: undefined, key: undefined, ref: undefined }));
|
|
3248
3251
|
this.setFirestoreCollection = this.updater((state, firestoreCollection) => ({ ...state, firestoreCollection }));
|
|
3249
3252
|
this.setFirestoreCollectionLike = this.updater((state, firestoreCollectionLike) => ({ ...state, firestoreCollectionLike }));
|