@firebase/auth 1.13.5 → 1.13.6

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.
Files changed (62) hide show
  1. package/dist/auth-public.d.ts +4 -1
  2. package/dist/auth.d.ts +5 -1
  3. package/dist/browser-cjs/{index-DY73Er5u.js → index-DBOuNQej.js} +75 -24
  4. package/dist/browser-cjs/index-DBOuNQej.js.map +1 -0
  5. package/dist/browser-cjs/index.js +1 -1
  6. package/dist/browser-cjs/internal.js +1 -1
  7. package/dist/browser-cjs/src/core/user/account_info.d.ts +1 -1
  8. package/dist/cordova/auth-cordova-public.d.ts +4 -1
  9. package/dist/cordova/auth-cordova.d.ts +5 -1
  10. package/dist/cordova/index.js +2 -2
  11. package/dist/cordova/internal.js +2 -2
  12. package/dist/cordova/{popup_redirect-D_ZWtJhY.js → popup_redirect-CHQiJtfZ.js} +75 -24
  13. package/dist/cordova/popup_redirect-CHQiJtfZ.js.map +1 -0
  14. package/dist/cordova/src/core/user/account_info.d.ts +1 -1
  15. package/dist/cordova/tsdoc-metadata.json +1 -1
  16. package/dist/esm/{index-CvXU3_1x.js → index-4NFEPWkC.js} +75 -24
  17. package/dist/esm/index-4NFEPWkC.js.map +1 -0
  18. package/dist/esm/index.js +1 -1
  19. package/dist/esm/internal.js +2 -2
  20. package/dist/esm/src/core/user/account_info.d.ts +1 -1
  21. package/dist/index.webworker.js +74 -23
  22. package/dist/index.webworker.js.map +1 -1
  23. package/dist/node/index.js +1 -1
  24. package/dist/node/internal.js +1 -1
  25. package/dist/node/src/core/user/account_info.d.ts +1 -1
  26. package/dist/node/{totp-B19JzI52.js → totp-C8DKrPQi.js} +69 -16
  27. package/dist/node/totp-C8DKrPQi.js.map +1 -0
  28. package/dist/node-esm/index.js +1 -1
  29. package/dist/node-esm/internal.js +2 -2
  30. package/dist/node-esm/src/core/user/account_info.d.ts +1 -1
  31. package/dist/node-esm/{totp-C24pd8aS.js → totp-BU9AvxK8.js} +69 -16
  32. package/dist/node-esm/totp-BU9AvxK8.js.map +1 -0
  33. package/dist/rn/{index-CiDS6PaG.js → index-DSVEw5ju.js} +69 -16
  34. package/dist/rn/index-DSVEw5ju.js.map +1 -0
  35. package/dist/rn/index.js +1 -1
  36. package/dist/rn/internal.js +7 -9
  37. package/dist/rn/internal.js.map +1 -1
  38. package/dist/rn/src/core/user/account_info.d.ts +1 -1
  39. package/dist/src/core/user/account_info.d.ts +1 -1
  40. package/dist/tsdoc-metadata.json +1 -1
  41. package/dist/web-extension-cjs/index.js +1 -1
  42. package/dist/web-extension-cjs/internal.js +1 -1
  43. package/dist/web-extension-cjs/{register-dQ43sygv.js → register-eaUKtaNP.js} +75 -24
  44. package/dist/web-extension-cjs/register-eaUKtaNP.js.map +1 -0
  45. package/dist/web-extension-cjs/src/core/user/account_info.d.ts +1 -1
  46. package/dist/web-extension-esm/auth-web-extension-public.d.ts +1 -1
  47. package/dist/web-extension-esm/auth-web-extension.d.ts +1 -1
  48. package/dist/web-extension-esm/index.js +2 -2
  49. package/dist/web-extension-esm/internal.js +2 -2
  50. package/dist/web-extension-esm/{register-DN05P0kB.js → register-CPcgXhGD.js} +75 -24
  51. package/dist/web-extension-esm/register-CPcgXhGD.js.map +1 -0
  52. package/dist/web-extension-esm/src/core/user/account_info.d.ts +1 -1
  53. package/dist/web-extension-esm/tsdoc-metadata.json +1 -1
  54. package/package.json +3 -3
  55. package/dist/browser-cjs/index-DY73Er5u.js.map +0 -1
  56. package/dist/cordova/popup_redirect-D_ZWtJhY.js.map +0 -1
  57. package/dist/esm/index-CvXU3_1x.js.map +0 -1
  58. package/dist/node/totp-B19JzI52.js.map +0 -1
  59. package/dist/node-esm/totp-C24pd8aS.js.map +0 -1
  60. package/dist/rn/index-CiDS6PaG.js.map +0 -1
  61. package/dist/web-extension-cjs/register-dQ43sygv.js.map +0 -1
  62. package/dist/web-extension-esm/register-DN05P0kB.js.map +0 -1
@@ -23,7 +23,7 @@ import { User } from '../../model/public_types';
23
23
  *
24
24
  * @public
25
25
  */
26
- export declare function updateProfile(user: User, { displayName, photoURL: photoUrl }: {
26
+ export declare function updateProfile(user: User, profile: {
27
27
  displayName?: string | null;
28
28
  photoURL?: string | null;
29
29
  }): Promise<void>;
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "0.1.2"
8
+ "packageVersion": "7.58.13"
9
9
  }
10
10
  ]
11
11
  }
@@ -2089,7 +2089,12 @@ class PersistenceUserManager {
2089
2089
  this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
2090
2090
  this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
2091
2091
  this.boundEventHandler = auth._onStorageEvent.bind(auth);
2092
- this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
2092
+ try {
2093
+ this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
2094
+ }
2095
+ catch {
2096
+ // Best effort; ignore errors if addListener throws
2097
+ }
2093
2098
  }
2094
2099
  setCurrentUser(user) {
2095
2100
  return this.persistence._set(this.fullUserKey, user.toJSON());
@@ -2126,7 +2131,10 @@ class PersistenceUserManager {
2126
2131
  }
2127
2132
  }
2128
2133
  delete() {
2129
- this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
2134
+ try {
2135
+ this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
2136
+ }
2137
+ catch { }
2130
2138
  }
2131
2139
  static async create(auth, persistenceHierarchy, userKey = "authUser" /* KeyName.AUTH_USER */) {
2132
2140
  if (!persistenceHierarchy.length) {
@@ -2134,8 +2142,13 @@ class PersistenceUserManager {
2134
2142
  }
2135
2143
  // Eliminate any persistences that are not available
2136
2144
  const availablePersistences = (await Promise.all(persistenceHierarchy.map(async (persistence) => {
2137
- if (await persistence._isAvailable()) {
2138
- return persistence;
2145
+ try {
2146
+ if (await persistence._isAvailable()) {
2147
+ return persistence;
2148
+ }
2149
+ }
2150
+ catch {
2151
+ return undefined;
2139
2152
  }
2140
2153
  return undefined;
2141
2154
  }))).filter(persistence => persistence);
@@ -2685,8 +2698,16 @@ class AuthImpl {
2685
2698
  if (this._deleted) {
2686
2699
  return;
2687
2700
  }
2688
- this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);
2689
- this._resolvePersistenceManagerAvailable?.();
2701
+ try {
2702
+ this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);
2703
+ }
2704
+ catch (e) {
2705
+ _logWarn(`Failed to initialize persistence: ${e}`);
2706
+ this.persistenceManager = await PersistenceUserManager.create(this, []);
2707
+ }
2708
+ finally {
2709
+ this._resolvePersistenceManagerAvailable?.();
2710
+ }
2690
2711
  if (this._deleted) {
2691
2712
  return;
2692
2713
  }
@@ -2701,7 +2722,13 @@ class AuthImpl {
2701
2722
  /* Ignore the error */
2702
2723
  }
2703
2724
  }
2704
- await this.initializeCurrentUser(popupRedirectResolver);
2725
+ try {
2726
+ await this.initializeCurrentUser(popupRedirectResolver);
2727
+ }
2728
+ catch (e) {
2729
+ _logWarn(`Failed to initialize current user: ${e}`);
2730
+ await this.directlySetCurrentUser(null).catch(() => { });
2731
+ }
2705
2732
  this.lastNotifiedUid = this.currentUser?.uid || null;
2706
2733
  if (this._deleted) {
2707
2734
  return;
@@ -3099,11 +3126,26 @@ class AuthImpl {
3099
3126
  _assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
3100
3127
  // The callback needs to be called asynchronously per the spec.
3101
3128
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
3102
- promise.then(() => {
3129
+ promise
3130
+ .then(() => {
3103
3131
  if (isUnsubscribed) {
3104
3132
  return;
3105
3133
  }
3106
3134
  cb(this.currentUser);
3135
+ })
3136
+ .catch(err => {
3137
+ if (isUnsubscribed) {
3138
+ return;
3139
+ }
3140
+ if (typeof nextOrObserver !== 'function' && nextOrObserver.error) {
3141
+ nextOrObserver.error(err);
3142
+ }
3143
+ else if (error) {
3144
+ error(err);
3145
+ }
3146
+ else {
3147
+ throw err;
3148
+ }
3107
3149
  });
3108
3150
  if (typeof nextOrObserver === 'function') {
3109
3151
  const unsubscribe = subscription.addObserver(nextOrObserver, error, completed);
@@ -3133,11 +3175,21 @@ class AuthImpl {
3133
3175
  user._startProactiveRefresh();
3134
3176
  }
3135
3177
  this.currentUser = user;
3136
- if (user) {
3137
- await this.assertedPersistence.setCurrentUser(user);
3138
- }
3139
- else {
3140
- await this.assertedPersistence.removeCurrentUser();
3178
+ if (this.persistenceManager) {
3179
+ try {
3180
+ if (user) {
3181
+ await this.persistenceManager.setCurrentUser(user);
3182
+ }
3183
+ else {
3184
+ await this.persistenceManager.removeCurrentUser();
3185
+ }
3186
+ }
3187
+ catch (e) {
3188
+ const originalMessage = e?.message || String(e);
3189
+ const error = _errorWithCustomMessage(this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, `An internal AuthError has occurred: ${originalMessage}`);
3190
+ error.customData = { originalError: e };
3191
+ throw error;
3192
+ }
3141
3193
  }
3142
3194
  }
3143
3195
  queue(action) {
@@ -6714,7 +6766,8 @@ async function updateProfile$1(auth, request) {
6714
6766
  *
6715
6767
  * @public
6716
6768
  */
6717
- async function updateProfile(user, { displayName, photoURL: photoUrl }) {
6769
+ async function updateProfile(user, profile) {
6770
+ const { displayName, photoURL: photoUrl } = profile;
6718
6771
  if (displayName === undefined && photoUrl === undefined) {
6719
6772
  return;
6720
6773
  }
@@ -8295,9 +8348,6 @@ class IndexedDBLocalPersistence {
8295
8348
  this.initializeServiceWorkerMessaging().then(() => { }, () => { });
8296
8349
  }
8297
8350
  async _openDb() {
8298
- if (this.isClosing) {
8299
- throw new Error('Database is closing');
8300
- }
8301
8351
  if (this.dbPromise) {
8302
8352
  return this.dbPromise;
8303
8353
  }
@@ -8315,16 +8365,17 @@ class IndexedDBLocalPersistence {
8315
8365
  return await op(db);
8316
8366
  }
8317
8367
  catch (e) {
8318
- if (this.isClosing) {
8319
- throw e;
8320
- }
8321
8368
  if (numAttempts++ > _TRANSACTION_RETRY_COUNT) {
8322
8369
  throw e;
8323
8370
  }
8324
8371
  if (this.dbPromise) {
8325
- const db = await this.dbPromise;
8326
- db.close();
8372
+ const dbPromise = this.dbPromise;
8327
8373
  this.dbPromise = null;
8374
+ try {
8375
+ const db = await dbPromise;
8376
+ db.close();
8377
+ }
8378
+ catch { }
8328
8379
  }
8329
8380
  // TODO: consider adding exponential backoff
8330
8381
  }
@@ -11014,7 +11065,7 @@ function _isEmptyString(input) {
11014
11065
  }
11015
11066
 
11016
11067
  var name = "@firebase/auth";
11017
- var version = "1.13.5";
11068
+ var version = "1.13.6";
11018
11069
 
11019
11070
  /**
11020
11071
  * @license
@@ -11267,4 +11318,4 @@ _setExternalJSProvider({
11267
11318
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
11268
11319
 
11269
11320
  export { onIdTokenChanged as $, ActionCodeOperation as A, fetchSignInMethodsForEmail as B, getAdditionalUserInfo as C, getAuth as D, EmailAuthCredential as E, FacebookAuthProvider as F, GithubAuthProvider as G, getIdToken as H, getIdTokenResult as I, getMultiFactorResolver as J, getRedirectResult as K, inMemoryPersistence as L, indexedDBLocalPersistence as M, initializeAuth as N, OAuthCredential as O, PhoneAuthCredential as P, initializeRecaptchaConfig as Q, RecaptchaVerifier as R, SAMLAuthProvider as S, TotpMultiFactorGenerator as T, isSignInWithEmailLink as U, linkWithCredential as V, linkWithPhoneNumber as W, linkWithPopup as X, linkWithRedirect as Y, multiFactor as Z, onAuthStateChanged as _, ActionCodeURL as a, parseActionCodeURL as a0, prodErrorMap as a1, reauthenticateWithCredential as a2, reauthenticateWithPhoneNumber as a3, reauthenticateWithPopup as a4, reauthenticateWithRedirect as a5, reload as a6, revokeAccessToken as a7, sendEmailVerification as a8, sendPasswordResetEmail as a9, _getRedirectUrl as aA, _isIOS7Or8 as aB, _createError as aC, _getProjectConfig as aD, AuthEventManager as aE, _getInstance as aF, _persistenceKeyName as aG, _getRedirectResult as aH, _overrideRedirectResult as aI, _clearRedirectOutcomes as aJ, _castAuth as aK, AuthImpl as aL, AuthPopup as aM, FetchProvider as aN, SAMLAuthCredential as aO, UserImpl as aP, _generateEventId as aQ, _getClientVersion as aR, sendSignInLinkToEmail as aa, setPersistence as ab, signInAnonymously as ac, signInWithCredential as ad, signInWithCustomToken as ae, signInWithEmailAndPassword as af, signInWithEmailLink as ag, signInWithPhoneNumber as ah, signInWithPopup as ai, signInWithRedirect as aj, signOut as ak, unlink as al, updateCurrentUser as am, updateEmail as an, updatePassword as ao, updatePhoneNumber as ap, updateProfile as aq, useDeviceLanguage as ar, validatePassword as as, verifyBeforeUpdateEmail as at, verifyPasswordResetCode as au, _assert as av, debugAssert as aw, _isIOS as ax, _isAndroid as ay, _fail as az, AuthCredential as b, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as c, EmailAuthProvider as d, FactorId as e, GoogleAuthProvider as f, OAuthProvider as g, OperationType as h, PhoneAuthProvider as i, PhoneMultiFactorGenerator as j, ProviderId as k, SignInMethod as l, TotpSecret as m, TwitterAuthProvider as n, applyActionCode as o, beforeAuthStateChanged as p, browserCookiePersistence as q, browserLocalPersistence as r, browserPopupRedirectResolver as s, browserSessionPersistence as t, checkActionCode as u, confirmPasswordReset as v, connectAuthEmulator as w, createUserWithEmailAndPassword as x, debugErrorMap as y, deleteUser as z };
11270
- //# sourceMappingURL=index-CvXU3_1x.js.map
11321
+ //# sourceMappingURL=index-4NFEPWkC.js.map