@dereekb/dbx-firebase 13.0.2 → 13.0.5

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,7 +4,7 @@ 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
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';
@@ -6489,26 +6489,35 @@ class DbxFirebaseStorageFileUploadActionHandlerDirective {
6489
6489
  constructor() {
6490
6490
  this._dbxActionHandlerInstance.init();
6491
6491
  // trigger the action if files are available
6492
- cleanSubscription(this.triggerOnFiles$
6493
- .pipe(switchMap((triggerOnFiles) => {
6494
- if (triggerOnFiles) {
6495
- return this.files$.pipe(map((x) => x?.length));
6496
- }
6497
- else {
6498
- return of(false);
6499
- }
6500
- }))
6501
- .subscribe((canTrigger) => {
6502
- if (canTrigger) {
6503
- this.source.trigger();
6504
- }
6505
- }));
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
+ });
6506
6509
  // ready the source with files after trigger is called and files are available
6507
- cleanSubscription(this.files$.pipe(switchMap((files) => this.source.triggered$.pipe(map(() => files)))).subscribe((files) => {
6508
- this.source.readyValue(files);
6509
- }));
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
+ });
6510
6516
  // sync isWorking
6511
- cleanSubscription(this.uploadStore.setIsUploadHandlerWorking(this.source.isWorking$));
6517
+ cleanSubscriptionWithLockSet({
6518
+ lockSet: this.source.lockSet,
6519
+ sub: this.uploadStore.setIsUploadHandlerWorking(this.source.isWorking$)
6520
+ });
6512
6521
  // sync progress amount
6513
6522
  this.source.setWorkProgress(this.uploadStore.latestProgressEvent$.pipe(throttleTime(100, undefined, { leading: true, trailing: true }), map((x) => x?.overallProgress), distinctUntilChanged()));
6514
6523
  }