@dereekb/dbx-firebase 5.2.1 → 5.3.0
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/service/firebase.auth.service.delegate.mjs +22 -0
- package/esm2020/lib/auth/service/firebase.auth.service.mjs +4 -2
- package/esm2020/lib/auth/service/index.mjs +2 -1
- package/fesm2015/dereekb-dbx-firebase.mjs +33 -13
- package/fesm2015/dereekb-dbx-firebase.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-firebase.mjs +33 -13
- package/fesm2020/dereekb-dbx-firebase.mjs.map +1 -1
- package/lib/auth/service/firebase.auth.service.delegate.d.ts +14 -0
- package/lib/auth/service/index.d.ts +1 -0
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { urlWithoutParameters, addToSet, removeFromSet, filterMaybeValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, forEachKeyValue, readableError, isMaybeSo } from '@dereekb/util';
|
|
1
|
+
import { urlWithoutParameters, addToSet, removeFromSet, filterMaybeValues, mapIterable, asArray, excludeValuesFromArray, containsStringAnyCase, addToSetCopy, forEachKeyValue, readableError, isMaybeSo } 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';
|
|
@@ -11,7 +11,7 @@ import * as i2 from '@angular/material/icon';
|
|
|
11
11
|
import { MatIconModule } from '@angular/material/icon';
|
|
12
12
|
import * as i6 from '@angular/common';
|
|
13
13
|
import { CommonModule } from '@angular/common';
|
|
14
|
-
import { filterMaybe, isNot, SubscriptionObject, cleanupDestroyable, accumulatorFlattenPageListLoadingState, useFirst, successResult, beginLoading, loadingStateFromObs, errorResult, cleanup } from '@dereekb/rxjs';
|
|
14
|
+
import { filterMaybe, isNot, tapLog, SubscriptionObject, cleanupDestroyable, accumulatorFlattenPageListLoadingState, useFirst, successResult, beginLoading, loadingStateFromObs, errorResult, cleanup } from '@dereekb/rxjs';
|
|
15
15
|
import * as i3$1 from '@dereekb/dbx-core';
|
|
16
16
|
import { loggedInObsFromIsLoggedIn, loggedOutObsFromIsLoggedIn, authUserIdentifier, DbxInjectionContext, AbstractForwardDbxInjectionContextDirective, DBX_INJECTION_COMPONENT_DATA, DbxInjectionComponentModule, DbxAuthService, AbstractSubscriptionDirective, AbstractIfDirective, LockSetComponentStore } from '@dereekb/dbx-core';
|
|
17
17
|
import * as i1$1 from '@angular/fire/auth';
|
|
@@ -118,6 +118,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
118
118
|
args: [DBX_FIREBASE_OPTIONS_TOKEN]
|
|
119
119
|
}] }, { type: i1.AppCheck }]; } });
|
|
120
120
|
|
|
121
|
+
function authUserInfoFromAuthUser(user) {
|
|
122
|
+
return {
|
|
123
|
+
displayName: user?.displayName,
|
|
124
|
+
email: user.email,
|
|
125
|
+
phoneNumber: user.phoneNumber,
|
|
126
|
+
photoURL: user.photoURL,
|
|
127
|
+
uid: user.uid
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
121
131
|
/**
|
|
122
132
|
* Derives a user state from the input firebase auth service.
|
|
123
133
|
*
|
|
@@ -156,16 +166,7 @@ function readValueFromIdToken(dbxFirebaseAuthService, readBooleanFromIdToken, de
|
|
|
156
166
|
}));
|
|
157
167
|
}
|
|
158
168
|
|
|
159
|
-
|
|
160
|
-
return {
|
|
161
|
-
displayName: user?.displayName,
|
|
162
|
-
email: user.email,
|
|
163
|
-
phoneNumber: user.phoneNumber,
|
|
164
|
-
photoURL: user.photoURL,
|
|
165
|
-
uid: user.uid
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
+
// MARK: Delegate
|
|
169
170
|
class DbxFirebaseAuthServiceDelegate {
|
|
170
171
|
}
|
|
171
172
|
const DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE = {
|
|
@@ -179,6 +180,7 @@ const DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE = {
|
|
|
179
180
|
return dbxFirebaseAuthService.authUserState$.pipe(map((x) => x === 'user'));
|
|
180
181
|
}
|
|
181
182
|
};
|
|
183
|
+
// MARK: Service
|
|
182
184
|
class DbxFirebaseAuthService {
|
|
183
185
|
constructor(firebaseAuth, delegate) {
|
|
184
186
|
this.firebaseAuth = firebaseAuth;
|
|
@@ -1340,6 +1342,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
1340
1342
|
}]
|
|
1341
1343
|
}], ctorParameters: function () { return [{ type: DbxFirebaseLoginModuleRootConfig }, { type: DbxFirebaseAuthLoginService }]; } });
|
|
1342
1344
|
|
|
1345
|
+
function authRolesObsWithClaimsService(config) {
|
|
1346
|
+
const { addAuthUserStateToRoles: addAuthUserState, claimsService } = config;
|
|
1347
|
+
return (dbxFirebaseAuthService) => {
|
|
1348
|
+
let obs = dbxFirebaseAuthService.idTokenResult$.pipe(tapLog('a'), map((x) => claimsService.toRoles(x.claims)));
|
|
1349
|
+
if (addAuthUserState) {
|
|
1350
|
+
obs = obs.pipe(tapLog('b'), switchMap((authRoleSet) => dbxFirebaseAuthService.authUserState$.pipe(map((userState) => addToSetCopy(authRoleSet, [userState])))), tapLog('c'));
|
|
1351
|
+
}
|
|
1352
|
+
return obs;
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
function defaultDbxFirebaseAuthServiceDelegateWithClaimsService(config) {
|
|
1356
|
+
return {
|
|
1357
|
+
authUserStateObs: DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE.authUserStateObs,
|
|
1358
|
+
authRolesObs: authRolesObsWithClaimsService(config),
|
|
1359
|
+
isOnboarded: DEFAULT_DBX_FIREBASE_AUTH_SERVICE_DELEGATE.isOnboarded
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1343
1363
|
class DbxFirebaseAuthModule {
|
|
1344
1364
|
static forRoot(config) {
|
|
1345
1365
|
const providers = [
|
|
@@ -2499,5 +2519,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
2499
2519
|
* Generated bundle index. Do not edit.
|
|
2500
2520
|
*/
|
|
2501
2521
|
|
|
2502
|
-
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, authUserInfoFromAuthUser, authUserStateFromFirebaseAuthService, dbxFirebaseCollectionLoaderInstance, dbxFirebaseCollectionLoaderInstanceWithCollection, defaultFirebaseAuthLoginProvidersFactory, enableAppCheckDebugTokenGeneration, firebaseAuthErrorToReadableError, modelDoesNotExistError, provideDbxFirebaseCollectionStoreDirective, provideDbxFirebaseCollectionWithParentStoreDirective, provideDbxFirebaseDocumentStoreDirective, readValueFromIdToken, setParentStoreEffect };
|
|
2522
|
+
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 };
|
|
2503
2523
|
//# sourceMappingURL=dereekb-dbx-firebase.mjs.map
|