@dereekb/dbx-firebase 5.3.0 → 7.0.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.
- package/esm2020/lib/auth/auth.mjs +8 -1
- package/esm2020/lib/auth/service/firebase.auth.service.delegate.mjs +5 -5
- package/esm2020/lib/auth/service/firebase.auth.service.mjs +41 -3
- package/esm2020/lib/firebase/firebase.module.mjs +3 -3
- package/esm2020/lib/model/store/index.mjs +2 -1
- package/esm2020/lib/model/store/store.document.crud.mjs +43 -0
- package/esm2020/lib/model/store/store.document.mjs +26 -10
- package/esm2020/lib/model/store/store.subcollection.document.mjs +1 -1
- package/esm2020/lib/model/store/store.subcollection.rxjs.mjs +1 -1
- package/fesm2015/dereekb-dbx-firebase.mjs +114 -17
- package/fesm2015/dereekb-dbx-firebase.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-firebase.mjs +118 -17
- package/fesm2020/dereekb-dbx-firebase.mjs.map +1 -1
- package/lib/auth/auth.d.ts +2 -0
- package/lib/auth/service/firebase.auth.service.d.ts +19 -1
- package/lib/auth/service/firebase.auth.service.delegate.d.ts +1 -2
- package/lib/model/store/index.d.ts +1 -0
- package/lib/model/store/store.document.crud.d.ts +27 -0
- package/lib/model/store/store.document.d.ts +39 -11
- package/lib/model/store/store.subcollection.document.d.ts +3 -3
- package/package.json +6 -6
|
@@ -20,4 +20,4 @@ export function setParentStoreEffect(store) {
|
|
|
20
20
|
}));
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmUuc3ViY29sbGVjdGlvbi5yeGpzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvZGJ4LWZpcmViYXNlL3NyYy9saWIvbW9kZWwvc3RvcmUvc3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b2xsZWN0aW9uTGlrZTxULCBEPj4oc3RvcmU6IERieEZpcmViYXNlQ29tcG9uZW50U3RvcmVXaXRoUGFyZW50PFQsIFBULCBELCBQRCwgQT4pOiBEYnhGaXJlYmFzZUNvbXBvbmVudFN0b3JlV2l0aFBhcmVudFNldFBhcmVudFN0b3JlRWZmZWN0RnVuY3Rpb248UFQsIFBEPiB7XG4gIHJldHVybiBzdG9yZS5lZmZlY3QoKGlucHV0OiBPYnNlcnZhYmxlPE1heWJlPERieEZpcmViYXNlRG9jdW1lbnRTdG9yZTxQVCwgUEQ+Pj4pID0+IHtcbiAgICByZXR1cm4gaW5wdXQucGlwZShcbiAgICAgIG1hcCgocGFyZW50U3RvcmUpID0+IHtcbiAgICAgICAgbGV0IHJlc3VsdDogTWF5YmU8U3Vic2NyaXB0aW9uPjtcblxuICAgICAgICBpZiAocGFyZW50U3RvcmUpIHtcbiAgICAgICAgICByZXN1bHQgPSBzdG9yZS5fc2V0UGFyZW50KHBhcmVudFN0b3JlLmN1cnJlbnREb2N1bWVudCQpIGFzIFN1YnNjcmlwdGlvbjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICByZXN1bHQgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBzZXQgYXMgdGhlIHBhcmVudCBsb2NrIHNldCB0b29cbiAgICAgICAgc3RvcmUuc2V0UGFyZW50TG9ja1NldChwYXJlbnRTdG9yZSk7XG5cbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgIH0pLFxuICAgICAgY2xlYW51cCgoc3ViKSA9PiB7XG4gICAgICAgIGlmIChzdWIpIHtcbiAgICAgICAgICBzdWIudW5zdWJzY3JpYmUoKTtcbiAgICAgICAgfVxuICAgICAgfSlcbiAgICApO1xuICB9KTtcbn1cbiJdfQ==
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { urlWithoutParameters, addToSet, removeFromSet, filterMaybeValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, addToSetCopy, forEachKeyValue, readableError, isMaybeSo } from '@dereekb/util';
|
|
1
|
+
import { urlWithoutParameters, cachedGetter, addToSet, removeFromSet, filterMaybeValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, addToSetCopy, forEachKeyValue, readableError, isMaybeSo, firstValue } from '@dereekb/util';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { InjectionToken, Injectable, Inject, Optional, Component, Input, Directive, EventEmitter, Output, NgModule, Injector, forwardRef, Host } from '@angular/core';
|
|
4
4
|
import { getToken, initializeAppCheck, ReCaptchaV3Provider } from 'firebase/app-check';
|
|
5
|
-
import { switchMap, from, first, map, of, shareReplay, timeout, startWith, distinctUntilChanged, BehaviorSubject, combineLatest, tap,
|
|
5
|
+
import { switchMap, from, first, map, of, shareReplay, timeout, startWith, distinctUntilChanged, firstValueFrom, BehaviorSubject, combineLatest, tap, Subject, throttleTime, NEVER, filter, take, exhaustMap } from 'rxjs';
|
|
6
6
|
import * as i1 from '@angular/fire/app-check';
|
|
7
7
|
import { provideAppCheck } from '@angular/fire/app-check';
|
|
8
8
|
import * as i4 from '@angular/material/button';
|
|
@@ -15,7 +15,7 @@ import * as i3 from '@dereekb/dbx-web';
|
|
|
15
15
|
import { DbxRouterAnchorModule, DbxReadableErrorModule, DbxActionModule, DbxButtonModule } from '@dereekb/dbx-web';
|
|
16
16
|
import * as i3$1 from '@dereekb/dbx-core';
|
|
17
17
|
import { loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, authUserIdentifier, DbxInjectionContext, AbstractForwardDbxInjectionContextDirective, DBX_INJECTION_COMPONENT_DATA, DbxInjectionComponentModule, DbxAuthService, AbstractSubscriptionDirective, AbstractIfDirective, LockSetComponentStore } from '@dereekb/dbx-core';
|
|
18
|
-
import { filterMaybe, isNot,
|
|
18
|
+
import { filterMaybe, isNot, SubscriptionObject, cleanupDestroyable, accumulatorFlattenPageListLoadingState, useFirst, successResult, beginLoading, loadingStateFromObs, errorResult, lazyFrom, cleanup } from '@dereekb/rxjs';
|
|
19
19
|
import * as i1$1 from '@angular/fire/auth';
|
|
20
20
|
import { authState, GoogleAuthProvider, FacebookAuthProvider, TwitterAuthProvider, GithubAuthProvider, signInWithPopup, createUserWithEmailAndPassword, signInWithEmailAndPassword, signInAnonymously, provideAuth, getAuth, connectAuthEmulator } from '@angular/fire/auth';
|
|
21
21
|
import { sendPasswordResetEmail } from 'firebase/auth';
|
|
@@ -130,6 +130,13 @@ function authUserInfoFromAuthUser(user) {
|
|
|
130
130
|
uid: user.uid
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
+
function firebaseAuthTokenFromUser(user) {
|
|
134
|
+
return {
|
|
135
|
+
email: user.email,
|
|
136
|
+
emailVerified: user.emailVerified,
|
|
137
|
+
phoneNumber: user.phoneNumber
|
|
138
|
+
};
|
|
139
|
+
}
|
|
133
140
|
|
|
134
141
|
/**
|
|
135
142
|
* Derives a user state from the input firebase auth service.
|
|
@@ -209,6 +216,21 @@ class DbxFirebaseAuthService {
|
|
|
209
216
|
this.authUserState$ = delegate.authUserStateObs(this).pipe(distinctUntilChanged(), shareReplay(1));
|
|
210
217
|
this.authRoles$ = delegate.authRolesObs(this);
|
|
211
218
|
this.isOnboarded$ = delegate.isOnboarded(this);
|
|
219
|
+
this._authRoleClaimsService = delegate.authRoleClaimsService;
|
|
220
|
+
}
|
|
221
|
+
rolesForClaims(claims) {
|
|
222
|
+
let result;
|
|
223
|
+
if (this._authRoleClaimsService) {
|
|
224
|
+
return this._authRoleClaimsService.toRoles(claims);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
console.warn('DbxFirebaseAuthService: rolesForClaims called with no authRoleClaimsService provided. An empty set is returned.');
|
|
228
|
+
result = new Set();
|
|
229
|
+
}
|
|
230
|
+
return result;
|
|
231
|
+
}
|
|
232
|
+
getAuthContextInfo() {
|
|
233
|
+
return firstValueFrom(this.authUser$).then((user) => (user ? new DbxFirebaseAuthContextInfo(this, user) : undefined));
|
|
212
234
|
}
|
|
213
235
|
logInWithGoogle() {
|
|
214
236
|
return this.logInWithPopup(new GoogleAuthProvider());
|
|
@@ -261,6 +283,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
261
283
|
type: Optional
|
|
262
284
|
}] }];
|
|
263
285
|
} });
|
|
286
|
+
/**
|
|
287
|
+
* FirebaseAuthContextInfo implementation from DbxFirebaseAuthService.
|
|
288
|
+
*/
|
|
289
|
+
class DbxFirebaseAuthContextInfo {
|
|
290
|
+
constructor(service, user) {
|
|
291
|
+
this.service = service;
|
|
292
|
+
this.user = user;
|
|
293
|
+
this._token = cachedGetter(() => firebaseAuthTokenFromUser(this.user));
|
|
294
|
+
}
|
|
295
|
+
get uid() {
|
|
296
|
+
return this.user.uid;
|
|
297
|
+
}
|
|
298
|
+
loadClaims() {
|
|
299
|
+
return this.user.getIdTokenResult().then((x) => x.claims);
|
|
300
|
+
}
|
|
301
|
+
loadAuthRoles() {
|
|
302
|
+
return this.loadClaims().then((x) => this.service.rolesForClaims(x));
|
|
303
|
+
}
|
|
304
|
+
get token() {
|
|
305
|
+
return this._token();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
264
308
|
|
|
265
309
|
class DbxFirebaseLoginTermsConfig {
|
|
266
310
|
}
|
|
@@ -1358,9 +1402,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
1358
1402
|
function authRolesObsWithClaimsService(config) {
|
|
1359
1403
|
const { addAuthUserStateToRoles: addAuthUserState, claimsService } = config;
|
|
1360
1404
|
return (dbxFirebaseAuthService) => {
|
|
1361
|
-
let obs = dbxFirebaseAuthService.idTokenResult$.pipe(
|
|
1405
|
+
let obs = dbxFirebaseAuthService.idTokenResult$.pipe(map((x) => claimsService.toRoles(x.claims)));
|
|
1362
1406
|
if (addAuthUserState) {
|
|
1363
|
-
obs = obs.pipe(
|
|
1407
|
+
obs = obs.pipe(switchMap((authRoleSet) => dbxFirebaseAuthService.authUserState$.pipe(map((userState) => addToSetCopy(authRoleSet, [userState])))));
|
|
1364
1408
|
}
|
|
1365
1409
|
return obs;
|
|
1366
1410
|
};
|
|
@@ -1369,7 +1413,8 @@ function defaultDbxFirebaseAuthServiceDelegateWithClaimsService(config) {
|
|
|
1369
1413
|
return {
|
|
1370
1414
|
authUserStateObs: DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE.authUserStateObs,
|
|
1371
1415
|
authRolesObs: authRolesObsWithClaimsService(config),
|
|
1372
|
-
isOnboarded: DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE.isOnboarded
|
|
1416
|
+
isOnboarded: DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE.isOnboarded,
|
|
1417
|
+
authRoleClaimsService: config.claimsService
|
|
1373
1418
|
};
|
|
1374
1419
|
}
|
|
1375
1420
|
|
|
@@ -1476,7 +1521,7 @@ DbxFirebaseDefaultAppCheckProviderModule.ɵinj = i0.ɵɵngDeclareInjector({ minV
|
|
|
1476
1521
|
provider: new ReCaptchaV3Provider(appCheckOptions.reCaptchaV3),
|
|
1477
1522
|
isTokenAutoRefreshEnabled: (_c = appCheckOptions.isTokenAutoRefreshEnabled) !== null && _c !== void 0 ? _c : true
|
|
1478
1523
|
});
|
|
1479
|
-
console.
|
|
1524
|
+
console.log('Enabled AppCheck.');
|
|
1480
1525
|
}
|
|
1481
1526
|
else {
|
|
1482
1527
|
appCheck = undefined;
|
|
@@ -1508,7 +1553,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
1508
1553
|
provider: new ReCaptchaV3Provider(appCheckOptions.reCaptchaV3),
|
|
1509
1554
|
isTokenAutoRefreshEnabled: (_c = appCheckOptions.isTokenAutoRefreshEnabled) !== null && _c !== void 0 ? _c : true
|
|
1510
1555
|
});
|
|
1511
|
-
console.
|
|
1556
|
+
console.log('Enabled AppCheck.');
|
|
1512
1557
|
}
|
|
1513
1558
|
else {
|
|
1514
1559
|
appCheck = undefined;
|
|
@@ -2284,27 +2329,36 @@ class AbstractDbxFirebaseDocumentStore extends LockSetComponentStore {
|
|
|
2284
2329
|
super(...arguments);
|
|
2285
2330
|
// MARK: Effects
|
|
2286
2331
|
// MARK: Accessors
|
|
2332
|
+
this.currentFirestoreCollectionLike$ = this.state$.pipe(map((x) => { var _a; return (_a = x.firestoreCollection) !== null && _a !== void 0 ? _a : x.firestoreCollectionLike; }), distinctUntilChanged(), shareReplay(1));
|
|
2287
2333
|
this.currentFirestoreCollection$ = this.state$.pipe(map((x) => x.firestoreCollection), distinctUntilChanged(), shareReplay(1));
|
|
2334
|
+
this.firestoreCollectionLike$ = this.currentFirestoreCollectionLike$.pipe(filterMaybe());
|
|
2288
2335
|
this.firestoreCollection$ = this.currentFirestoreCollection$.pipe(filterMaybe());
|
|
2289
2336
|
this.currentInputId$ = this.state$.pipe(map((x) => x.id), distinctUntilChanged(), shareReplay(1));
|
|
2290
2337
|
this.inputId$ = this.currentInputId$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
|
|
2338
|
+
this.currentInputKey$ = this.state$.pipe(map((x) => x.key), distinctUntilChanged(), shareReplay(1));
|
|
2339
|
+
this.inputKey$ = this.currentInputKey$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
|
|
2291
2340
|
this.currentInputRef$ = this.state$.pipe(map((x) => x.ref), distinctUntilChanged(), shareReplay(1));
|
|
2292
2341
|
this.inputRef$ = this.currentInputRef$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
|
|
2293
|
-
this.currentDocument$ = combineLatest([this.
|
|
2342
|
+
this.currentDocument$ = combineLatest([this.currentInputId$, this.currentInputKey$, this.currentInputRef$]).pipe(switchMap(([id, key, ref]) => {
|
|
2294
2343
|
let document;
|
|
2295
|
-
if (
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2344
|
+
if (ref) {
|
|
2345
|
+
document = this.firestoreCollectionLike$.pipe(map((x) => x.documentAccessor().loadDocument(ref)));
|
|
2346
|
+
}
|
|
2347
|
+
else if (key) {
|
|
2348
|
+
document = this.firestoreCollectionLike$.pipe(map((x) => x.documentAccessor().loadDocumentForKey(key)));
|
|
2349
|
+
}
|
|
2350
|
+
else if (id) {
|
|
2351
|
+
document = this.firestoreCollection$.pipe(map((x) => x.documentAccessor().loadDocumentForPath(id)));
|
|
2352
|
+
}
|
|
2353
|
+
else {
|
|
2354
|
+
document = of(undefined);
|
|
2302
2355
|
}
|
|
2303
2356
|
return document;
|
|
2304
2357
|
}), distinctUntilChanged(), shareReplay(1));
|
|
2305
2358
|
this.document$ = this.currentDocument$.pipe(filterMaybe(), distinctUntilChanged(), shareReplay(1));
|
|
2306
2359
|
this.documentLoadingState$ = this.currentDocument$.pipe(map((x) => (x ? successResult(x) : beginLoading())), shareReplay(1));
|
|
2307
2360
|
this.id$ = this.document$.pipe(map((x) => x.id), shareReplay());
|
|
2361
|
+
this.key$ = this.document$.pipe(map((x) => x.key), shareReplay());
|
|
2308
2362
|
this.ref$ = this.document$.pipe(map((x) => x.documentRef), shareReplay());
|
|
2309
2363
|
this.snapshot$ = this.document$.pipe(switchMap((x) => x.accessor.stream()), shareReplay(1));
|
|
2310
2364
|
this.snapshotLoadingState$ = this.currentDocument$.pipe(switchMap(() => loadingStateFromObs(this.snapshot$)), shareReplay(1));
|
|
@@ -2328,16 +2382,23 @@ class AbstractDbxFirebaseDocumentStore extends LockSetComponentStore {
|
|
|
2328
2382
|
}), shareReplay(1));
|
|
2329
2383
|
this.exists$ = this.currentData$.pipe(map((x) => isMaybeSo(x)), shareReplay(1));
|
|
2330
2384
|
this.doesNotExist$ = this.exists$.pipe(map((x) => !x), shareReplay(1));
|
|
2385
|
+
this.modelIdentity$ = this.document$.pipe(map((x) => x.modelIdentity), shareReplay(1));
|
|
2331
2386
|
// MARK: State Changes
|
|
2332
2387
|
/**
|
|
2333
2388
|
* Sets the id of the document to load.
|
|
2334
2389
|
*/
|
|
2335
2390
|
this.setId = this.updater((state, id) => (id ? Object.assign(Object.assign({}, state), { id, ref: undefined }) : Object.assign(Object.assign({}, state), { id })));
|
|
2391
|
+
/**
|
|
2392
|
+
* Sets the key of the document to load.
|
|
2393
|
+
*/
|
|
2394
|
+
this.setKey = this.updater((state, key) => (key ? Object.assign(Object.assign({}, state), { key, ref: undefined }) : Object.assign(Object.assign({}, state), { key })));
|
|
2336
2395
|
/**
|
|
2337
2396
|
* Sets the ref of the document to load.
|
|
2338
2397
|
*/
|
|
2339
2398
|
this.setRef = this.updater((state, ref) => (ref ? Object.assign(Object.assign({}, state), { id: undefined, ref }) : Object.assign(Object.assign({}, state), { ref })));
|
|
2399
|
+
this.clearRefs = this.updater((state) => (Object.assign(Object.assign({}, state), { id: undefined, key: undefined, ref: undefined })));
|
|
2340
2400
|
this.setFirestoreCollection = this.updater((state, firestoreCollection) => (Object.assign(Object.assign({}, state), { firestoreCollection })));
|
|
2401
|
+
this.setFirestoreCollectionLike = this.updater((state, firestoreCollectionLike) => (Object.assign(Object.assign({}, state), { firestoreCollectionLike })));
|
|
2341
2402
|
}
|
|
2342
2403
|
}
|
|
2343
2404
|
AbstractDbxFirebaseDocumentStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: AbstractDbxFirebaseDocumentStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -2346,6 +2407,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
2346
2407
|
type: Injectable
|
|
2347
2408
|
}] });
|
|
2348
2409
|
|
|
2410
|
+
/**
|
|
2411
|
+
* Creates a function for a store that DbxFirebaseDocumentStore captures the ModelFirebaseCreateFunction result and sets the key of the created value.
|
|
2412
|
+
*
|
|
2413
|
+
* @param store
|
|
2414
|
+
* @param fn
|
|
2415
|
+
* @returns
|
|
2416
|
+
*/
|
|
2417
|
+
function firebaseDocumentStoreCreateFunction(store, fn) {
|
|
2418
|
+
return (params) => loadingStateFromObs(lazyFrom(() => fn(params).then((result) => {
|
|
2419
|
+
const modelKeys = result.modelKeys;
|
|
2420
|
+
const firstKey = firstValue(modelKeys);
|
|
2421
|
+
if (firstKey) {
|
|
2422
|
+
store.setKey(firstKey);
|
|
2423
|
+
}
|
|
2424
|
+
return result;
|
|
2425
|
+
})));
|
|
2426
|
+
}
|
|
2427
|
+
function firebaseDocumentStoreUpdateFunction(store, fn) {
|
|
2428
|
+
return (params) => loadingStateFromObs(store.key$.pipe(first(), switchMap((key) => fn(Object.assign(Object.assign({}, params), { key // inject key into the parameters.
|
|
2429
|
+
})))));
|
|
2430
|
+
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Deletes a function for a store that DbxFirebaseDocumentStore captures the ModelFirebaseDeleteFunction result and sets the key of the created value.
|
|
2433
|
+
*
|
|
2434
|
+
* @param store
|
|
2435
|
+
* @param fn
|
|
2436
|
+
* @returns
|
|
2437
|
+
*/
|
|
2438
|
+
function firebaseDocumentStoreDeleteFunction(store, fn) {
|
|
2439
|
+
return (params) => loadingStateFromObs(store.key$.pipe(first(), switchMap((key) => fn(Object.assign(Object.assign({}, params), { key // inject key into the parameters.
|
|
2440
|
+
})).then((result) => {
|
|
2441
|
+
store.clearRefs();
|
|
2442
|
+
return result;
|
|
2443
|
+
}))));
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2349
2446
|
function setParentStoreEffect(store) {
|
|
2350
2447
|
return store.effect((input) => {
|
|
2351
2448
|
return input.pipe(map((parentStore) => {
|
|
@@ -2546,5 +2643,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
2546
2643
|
* Generated bundle index. Do not edit.
|
|
2547
2644
|
*/
|
|
2548
2645
|
|
|
2549
|
-
export { AbstractConfiguredDbxFirebaseLoginButtonDirective, AbstractDbxFirebaseCollectionStore, AbstractDbxFirebaseCollectionWithParentStore, AbstractDbxFirebaseDocumentStore, AbstractDbxFirebaseDocumentWithParentStore, DBX_FIREBASE_MODEL_DOES_NOT_EXIST_ERROR, DBX_FIREBASE_OPTIONS_TOKEN, DBX_FIREBASE_ROUTER_SYNC_DEFAULT_ID_PARAM_KEY, DBX_FIRESTORE_CONTEXT_TOKEN, DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE, DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE, DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG, DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG_TOKEN, DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN, DEFAULT_FIREBASE_AUTH_LOGIN_TERMS_COMPONENT_CLASS_TOKEN, DEFAULT_FIREBASE_LOGIN_METHOD_CATEGORY, DbxFirebaseAppCheckHttpInterceptor, DbxFirebaseAuthLoginService, DbxFirebaseAuthModule, DbxFirebaseAuthService, DbxFirebaseAuthServiceDelegate, DbxFirebaseCollectionChangeDirective, DbxFirebaseCollectionHasChangeDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionLoaderInstance, DbxFirebaseCollectionStoreDirective, DbxFirebaseCollectionWithParentStoreDirective, DbxFirebaseDefaultAppCheckProviderModule, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultFirebaseProvidersModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultFunctionsProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDocumentAuthIdDirective, DbxFirebaseDocumentStoreDirective, DbxFirebaseDocumentStoreRouteIdDirective, DbxFirebaseEmailFormComponent, DbxFirebaseEmailRecoveryFormComponent, DbxFirebaseEmulatorModule, DbxFirebaseFirestoreCollectionModule, DbxFirebaseFunctionsModule, DbxFirebaseLoginAnonymousComponent, DbxFirebaseLoginAppleComponent, DbxFirebaseLoginButtonComponent, DbxFirebaseLoginButtonContainerComponent, DbxFirebaseLoginComponent, DbxFirebaseLoginContext, DbxFirebaseLoginContextBackButtonComponent, DbxFirebaseLoginContextDirective, DbxFirebaseLoginEmailComponent, DbxFirebaseLoginEmailContentComponent, DbxFirebaseLoginFacebookComponent, DbxFirebaseLoginGitHubComponent, DbxFirebaseLoginGoogleComponent, DbxFirebaseLoginListComponent, DbxFirebaseLoginMicrosoftComponent, DbxFirebaseLoginModule, DbxFirebaseLoginModuleRootConfig, DbxFirebaseLoginTermsComponent, DbxFirebaseLoginTermsSimpleComponent, DbxFirebaseLoginTwitterComponent, DbxFirebaseModelModule, DbxFirebaseModelStoreModule, DbxFirebaseModule, DbxFirebaseParsedEmulatorsConfig, DbxFirebaseRegisterComponent, DbxFirebaseRegisterEmailComponent, DbxFirestoreContextService, FIREBASE_AUTH_NETWORK_REQUEST_ERROR, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY, authRolesObsWithClaimsService, authUserInfoFromAuthUser, authUserStateFromFirebaseAuthService, dbxFirebaseCollectionLoaderInstance, dbxFirebaseCollectionLoaderInstanceWithCollection, defaultDbxFirebaseAuthServiceDelegateWithClaimsService, defaultFirebaseAuthLoginProvidersFactory, enableAppCheckDebugTokenGeneration, firebaseAuthErrorToReadableError, modelDoesNotExistError, provideDbxFirebaseCollectionStoreDirective, provideDbxFirebaseCollectionWithParentStoreDirective, provideDbxFirebaseDocumentStoreDirective, readValueFromIdToken, setParentStoreEffect };
|
|
2646
|
+
export { AbstractConfiguredDbxFirebaseLoginButtonDirective, AbstractDbxFirebaseCollectionStore, AbstractDbxFirebaseCollectionWithParentStore, AbstractDbxFirebaseDocumentStore, AbstractDbxFirebaseDocumentWithParentStore, DBX_FIREBASE_MODEL_DOES_NOT_EXIST_ERROR, DBX_FIREBASE_OPTIONS_TOKEN, DBX_FIREBASE_ROUTER_SYNC_DEFAULT_ID_PARAM_KEY, DBX_FIRESTORE_CONTEXT_TOKEN, DEFAULT_CONFIGURED_DBX_FIREBASE_LOGIN_BUTTON_TEMPLATE, DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE, DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG, DEFAULT_FIREBASE_AUTH_LOGIN_PASSWORD_CONFIG_TOKEN, DEFAULT_FIREBASE_AUTH_LOGIN_PROVIDERS_TOKEN, DEFAULT_FIREBASE_AUTH_LOGIN_TERMS_COMPONENT_CLASS_TOKEN, DEFAULT_FIREBASE_LOGIN_METHOD_CATEGORY, DbxFirebaseAppCheckHttpInterceptor, DbxFirebaseAuthContextInfo, DbxFirebaseAuthLoginService, DbxFirebaseAuthModule, DbxFirebaseAuthService, DbxFirebaseAuthServiceDelegate, DbxFirebaseCollectionChangeDirective, DbxFirebaseCollectionHasChangeDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionLoaderInstance, DbxFirebaseCollectionStoreDirective, DbxFirebaseCollectionWithParentStoreDirective, DbxFirebaseDefaultAppCheckProviderModule, DbxFirebaseDefaultAuthProviderModule, DbxFirebaseDefaultFirebaseProvidersModule, DbxFirebaseDefaultFirestoreProviderModule, DbxFirebaseDefaultFunctionsProviderModule, DbxFirebaseDefaultStorageProviderModule, DbxFirebaseDocumentAuthIdDirective, DbxFirebaseDocumentStoreDirective, DbxFirebaseDocumentStoreRouteIdDirective, DbxFirebaseEmailFormComponent, DbxFirebaseEmailRecoveryFormComponent, DbxFirebaseEmulatorModule, DbxFirebaseFirestoreCollectionModule, DbxFirebaseFunctionsModule, DbxFirebaseLoginAnonymousComponent, DbxFirebaseLoginAppleComponent, DbxFirebaseLoginButtonComponent, DbxFirebaseLoginButtonContainerComponent, DbxFirebaseLoginComponent, DbxFirebaseLoginContext, DbxFirebaseLoginContextBackButtonComponent, DbxFirebaseLoginContextDirective, DbxFirebaseLoginEmailComponent, DbxFirebaseLoginEmailContentComponent, DbxFirebaseLoginFacebookComponent, DbxFirebaseLoginGitHubComponent, DbxFirebaseLoginGoogleComponent, DbxFirebaseLoginListComponent, DbxFirebaseLoginMicrosoftComponent, DbxFirebaseLoginModule, DbxFirebaseLoginModuleRootConfig, DbxFirebaseLoginTermsComponent, DbxFirebaseLoginTermsSimpleComponent, DbxFirebaseLoginTwitterComponent, DbxFirebaseModelModule, DbxFirebaseModelStoreModule, DbxFirebaseModule, DbxFirebaseParsedEmulatorsConfig, DbxFirebaseRegisterComponent, DbxFirebaseRegisterEmailComponent, DbxFirestoreContextService, FIREBASE_AUTH_NETWORK_REQUEST_ERROR, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, OAUTH_FIREBASE_LOGIN_METHOD_CATEGORY, authRolesObsWithClaimsService, authUserInfoFromAuthUser, authUserStateFromFirebaseAuthService, dbxFirebaseCollectionLoaderInstance, dbxFirebaseCollectionLoaderInstanceWithCollection, defaultDbxFirebaseAuthServiceDelegateWithClaimsService, defaultFirebaseAuthLoginProvidersFactory, enableAppCheckDebugTokenGeneration, firebaseAuthErrorToReadableError, firebaseAuthTokenFromUser, firebaseDocumentStoreCreateFunction, firebaseDocumentStoreDeleteFunction, firebaseDocumentStoreUpdateFunction, modelDoesNotExistError, provideDbxFirebaseCollectionStoreDirective, provideDbxFirebaseCollectionWithParentStoreDirective, provideDbxFirebaseDocumentStoreDirective, readValueFromIdToken, setParentStoreEffect };
|
|
2550
2647
|
//# sourceMappingURL=dereekb-dbx-firebase.mjs.map
|