@dereekb/dbx-firebase 13.0.1 → 13.0.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.
@@ -4,9 +4,9 @@ import { DbxAnalyticsService } from '@dereekb/dbx-analytics';
4
4
  import { asObservable, timeoutStartWith, filterMaybe, isNot, SubscriptionObject, lazyFrom, switchMapWhileTrue, loadingStateFromObs, distinctUntilKeysChange, cleanupDestroyable, iterationHasNextAndCanLoadMore, pageItemAccumulatorCurrentPage, accumulatorFlattenPageListLoadingState, useFirst, itemAccumulatorNextPageUntilResultsCount, iteratorNextPageUntilPage, iteratorNextPageUntilMaxPageLoadLimit, pageLoadingStateFromObs, useAsObservable, filterMaybeArray, mapEachAsync, invertObservableDecision, filterItemsWithObservableDecision, switchMapMaybe, beginLoading, mapLoadingStateValueWithOperator, valueFromFinishedLoadingState, skipInitialMaybe, distinctUntilModelKeyChange, successResult, errorResult, isLoadingStateLoading, cleanup, mapLoadingState, throwErrorFromLoadingStateError, maybeValueFromObservableOrValue, distinctUntilHasDifferentValues, MultiSubscriptionObject, startWithBeginLoading, skipAllInitialMaybe } from '@dereekb/rxjs';
5
5
  import { switchMap, of, shareReplay, map, distinctUntilChanged, EMPTY, catchError, firstValueFrom, BehaviorSubject, combineLatest, first, from, tap, interval, exhaustMap, filter, take, startWith, Subject, throttleTime, NEVER, defaultIfEmpty, combineLatestWith, mergeMap, Observable } from 'rxjs';
6
6
  import * as i2 from '@dereekb/dbx-core';
7
- import { loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, authUserIdentifier, DbxInjectionContext, DBX_INJECTION_COMPONENT_DATA, DbxInjectionComponent, AbstractForwardDbxInjectionContextDirective, DbxInjectionContextDirective, DbxAuthService, DbxActionButtonDirective, completeOnDestroy, cleanSubscription, DbxActionDirective, DbxActionEnforceModifiedDirective, DbxActionHandlerDirective, DbxActionAutoTriggerDirective, clean, cleanLoadingContext, provideDbxRouteModelIdDirectiveDelegate, provideDbxRouteModelKeyDirectiveDelegate, AbstractIfDirective, LockSetComponentStore, newWithInjector, CutTextPipe, DbxActionContextStoreSourceInstance, DbxActionHandlerInstance, SimpleStorageAccessorFactory, dbxRouteParamReaderInstance, DbxRouteParamDefaultRedirectInstance } from '@dereekb/dbx-core';
7
+ import { loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, authUserIdentifier, DbxInjectionContext, DBX_INJECTION_COMPONENT_DATA, DbxInjectionComponent, AbstractForwardDbxInjectionContextDirective, DbxInjectionContextDirective, DbxAuthService, DbxActionButtonDirective, completeOnDestroy, cleanSubscription, DbxActionDirective, DbxActionEnforceModifiedDirective, DbxActionHandlerDirective, DbxActionAutoTriggerDirective, clean, cleanLoadingContext, provideDbxRouteModelIdDirectiveDelegate, provideDbxRouteModelKeyDirectiveDelegate, AbstractIfDirective, LockSetComponentStore, newWithInjector, CutTextPipe, DbxActionContextStoreSourceInstance, DbxActionHandlerInstance, cleanSubscriptionWithLockSet, SimpleStorageAccessorFactory, dbxRouteParamReaderInstance, DbxRouteParamDefaultRedirectInstance } from '@dereekb/dbx-core';
8
8
  import { Auth, authState, idToken, GoogleAuthProvider, FacebookAuthProvider, TwitterAuthProvider, GithubAuthProvider, signInWithPopup, createUserWithEmailAndPassword, signInWithEmailAndPassword, signInAnonymously, reauthenticateWithPopup, provideAuth, getAuth, connectAuthEmulator } from '@angular/fire/auth';
9
- import { AUTH_ADMIN_ROLE, cachedGetter, urlWithoutParameters, addToSet, removeFromSet, filterMaybeArrayValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, addToSetCopy, iterableToArray, runAsyncTasksForValues, pushArrayItemsIntoArray, forEachKeyValue, countAllInNestedArray, invertDecision, filterUniqueValues, reverseCompareFn, sortByNumberFunction, separateValues, readableError, isMaybeSo, firstValue, splitJoinRemainder, MS_IN_HOUR, SECONDS_IN_MINUTE, MS_IN_DAY, unixDateTimeSecondsNumberForNow, MS_IN_MINUTE, addMilliseconds, unixDateTimeSecondsNumberFromDate, dateFromDateOrTimeSecondsNumber, MS_IN_SECOND, isPast } from '@dereekb/util';
9
+ import { AUTH_ADMIN_ROLE, cachedGetter, urlWithoutParameters, addToSet, removeFromSet, filterMaybeArrayValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, addToSetCopy, iterableToArray, runAsyncTasksForValues, pushArrayItemsIntoArray, forEachKeyValue, countAllInNestedArray, invertDecision, useIterableOrValue, filterUniqueValues, reverseCompareFn, sortByNumberFunction, separateValues, readableError, isMaybeSo, firstValue, splitJoinRemainder, MS_IN_HOUR, SECONDS_IN_MINUTE, MS_IN_DAY, unixDateTimeSecondsNumberForNow, MS_IN_MINUTE, addMilliseconds, unixDateTimeSecondsNumberFromDate, dateFromDateOrTimeSecondsNumber, MS_IN_SECOND, isPast } from '@dereekb/util';
10
10
  import { safeFormatToISO8601DateString, msToSeconds, isSameDate } from '@dereekb/date';
11
11
  import { sendPasswordResetEmail } from 'firebase/auth';
12
12
  import { getToken, initializeAppCheck, ReCaptchaV3Provider } from 'firebase/app-check';
@@ -3280,8 +3280,7 @@ class DbxFirebaseModelEntitiesWidgetService {
3280
3280
  * @param override Whether to override existing entries (default: true)
3281
3281
  */
3282
3282
  register(entries, override = true) {
3283
- const entriesArray = asArray(entries);
3284
- entriesArray.forEach((entry) => {
3283
+ useIterableOrValue(entries, (entry) => {
3285
3284
  if (override || !this._entries.has(entry.identity)) {
3286
3285
  this._entries.set(entry.identity, entry);
3287
3286
  }
@@ -6490,26 +6489,35 @@ class DbxFirebaseStorageFileUploadActionHandlerDirective {
6490
6489
  constructor() {
6491
6490
  this._dbxActionHandlerInstance.init();
6492
6491
  // trigger the action if files are available
6493
- cleanSubscription(this.triggerOnFiles$
6494
- .pipe(switchMap((triggerOnFiles) => {
6495
- if (triggerOnFiles) {
6496
- return this.files$.pipe(map((x) => x?.length));
6497
- }
6498
- else {
6499
- return of(false);
6500
- }
6501
- }))
6502
- .subscribe((canTrigger) => {
6503
- if (canTrigger) {
6504
- this.source.trigger();
6505
- }
6506
- }));
6492
+ cleanSubscriptionWithLockSet({
6493
+ lockSet: this.source.lockSet,
6494
+ sub: this.triggerOnFiles$
6495
+ .pipe(switchMap((triggerOnFiles) => {
6496
+ if (triggerOnFiles) {
6497
+ return this.files$.pipe(map((x) => x?.length));
6498
+ }
6499
+ else {
6500
+ return of(false);
6501
+ }
6502
+ }))
6503
+ .subscribe((canTrigger) => {
6504
+ if (canTrigger) {
6505
+ this.source.trigger();
6506
+ }
6507
+ })
6508
+ });
6507
6509
  // ready the source with files after trigger is called and files are available
6508
- cleanSubscription(this.files$.pipe(switchMap((files) => this.source.triggered$.pipe(map(() => files)))).subscribe((files) => {
6509
- this.source.readyValue(files);
6510
- }));
6510
+ cleanSubscriptionWithLockSet({
6511
+ lockSet: this.source.lockSet,
6512
+ sub: this.files$.pipe(switchMap((files) => this.source.triggered$.pipe(map(() => files)))).subscribe((files) => {
6513
+ this.source.readyValue(files);
6514
+ })
6515
+ });
6511
6516
  // sync isWorking
6512
- cleanSubscription(this.uploadStore.setIsUploadHandlerWorking(this.source.isWorking$));
6517
+ cleanSubscriptionWithLockSet({
6518
+ lockSet: this.source.lockSet,
6519
+ sub: this.uploadStore.setIsUploadHandlerWorking(this.source.isWorking$)
6520
+ });
6513
6521
  // sync progress amount
6514
6522
  this.source.setWorkProgress(this.uploadStore.latestProgressEvent$.pipe(throttleTime(100, undefined, { leading: true, trailing: true }), map((x) => x?.overallProgress), distinctUntilChanged()));
6515
6523
  }