@angular/fire 16.0.0 → 17.0.0-canary.05e9da2

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 (143) hide show
  1. package/README.md +10 -14
  2. package/analytics/analytics.module.d.ts +2 -2
  3. package/analytics/package.json +3 -0
  4. package/app/app.module.d.ts +2 -2
  5. package/app/package.json +3 -0
  6. package/app-check/app-check.module.d.ts +2 -2
  7. package/app-check/package.json +3 -0
  8. package/auth/auth.module.d.ts +2 -2
  9. package/auth/firebase.d.ts +2 -1
  10. package/auth/package.json +3 -0
  11. package/auth-guard/package.json +3 -0
  12. package/compat/analytics/package.json +3 -0
  13. package/compat/auth/package.json +3 -0
  14. package/compat/auth-guard/package.json +3 -0
  15. package/compat/database/package.json +3 -0
  16. package/compat/firestore/package.json +3 -0
  17. package/compat/functions/package.json +3 -0
  18. package/compat/messaging/package.json +3 -0
  19. package/compat/package.json +3 -0
  20. package/compat/performance/package.json +3 -0
  21. package/compat/remote-config/package.json +3 -0
  22. package/compat/storage/package.json +3 -0
  23. package/database/database.module.d.ts +2 -2
  24. package/database/package.json +3 -0
  25. package/docs/compat/auth/getting-started.md +4 -4
  26. package/docs/compat/emulators/emulators.md +28 -2
  27. package/docs/compat/firestore/collections.md +1 -1
  28. package/docs/compat/firestore/querying-collections.md +2 -2
  29. package/docs/compat.md +1 -1
  30. package/docs/install-and-setup.md +1 -1
  31. package/docs/messaging.md +187 -9
  32. package/esm2022/analytics/analytics.module.mjs +30 -23
  33. package/esm2022/analytics/screen-tracking.service.mjs +6 -6
  34. package/esm2022/analytics/user-tracking.service.mjs +5 -5
  35. package/esm2022/app/app.module.mjs +28 -22
  36. package/esm2022/app-check/app-check.module.mjs +25 -23
  37. package/esm2022/auth/auth.module.mjs +25 -23
  38. package/esm2022/auth/firebase.mjs +3 -2
  39. package/esm2022/auth-guard/auth-guard.mjs +5 -5
  40. package/esm2022/auth-guard/auth-guard.module.mjs +6 -6
  41. package/esm2022/compat/analytics/analytics.mjs +6 -6
  42. package/esm2022/compat/analytics/analytics.module.mjs +7 -7
  43. package/esm2022/compat/analytics/screen-tracking.service.mjs +6 -6
  44. package/esm2022/compat/analytics/user-tracking.service.mjs +6 -6
  45. package/esm2022/compat/auth/auth.mjs +6 -6
  46. package/esm2022/compat/auth/auth.module.mjs +6 -6
  47. package/esm2022/compat/auth-guard/auth-guard.mjs +5 -5
  48. package/esm2022/compat/auth-guard/auth-guard.module.mjs +6 -6
  49. package/esm2022/compat/database/database.mjs +6 -6
  50. package/esm2022/compat/database/database.module.mjs +6 -6
  51. package/esm2022/compat/firebase.app.module.mjs +7 -7
  52. package/esm2022/compat/firestore/firestore.mjs +6 -6
  53. package/esm2022/compat/firestore/firestore.module.mjs +6 -6
  54. package/esm2022/compat/functions/functions.mjs +6 -6
  55. package/esm2022/compat/functions/functions.module.mjs +6 -6
  56. package/esm2022/compat/messaging/messaging.mjs +6 -6
  57. package/esm2022/compat/messaging/messaging.module.mjs +6 -6
  58. package/esm2022/compat/performance/performance.mjs +6 -6
  59. package/esm2022/compat/performance/performance.module.mjs +7 -7
  60. package/esm2022/compat/performance/performance.service.mjs +5 -5
  61. package/esm2022/compat/remote-config/remote-config.mjs +6 -6
  62. package/esm2022/compat/remote-config/remote-config.module.mjs +6 -6
  63. package/esm2022/compat/storage/pipes/storageUrl.pipe.mjs +10 -10
  64. package/esm2022/compat/storage/storage.mjs +6 -6
  65. package/esm2022/compat/storage/storage.module.mjs +6 -6
  66. package/esm2022/database/database.module.mjs +27 -25
  67. package/esm2022/firestore/firestore.module.mjs +27 -25
  68. package/esm2022/firestore/lite/lite.module.mjs +27 -25
  69. package/esm2022/functions/functions.module.mjs +27 -25
  70. package/esm2022/messaging/messaging.module.mjs +29 -22
  71. package/esm2022/performance/performance.module.mjs +25 -23
  72. package/esm2022/remote-config/remote-config.module.mjs +29 -22
  73. package/esm2022/storage/storage.module.mjs +27 -25
  74. package/esm2022/zones.mjs +5 -5
  75. package/fesm2022/angular-fire-analytics.mjs +40 -33
  76. package/fesm2022/angular-fire-analytics.mjs.map +1 -1
  77. package/fesm2022/angular-fire-app-check.mjs +26 -24
  78. package/fesm2022/angular-fire-app-check.mjs.map +1 -1
  79. package/fesm2022/angular-fire-app.mjs +28 -22
  80. package/fesm2022/angular-fire-app.mjs.map +1 -1
  81. package/fesm2022/angular-fire-auth-guard.mjs +9 -9
  82. package/fesm2022/angular-fire-auth-guard.mjs.map +1 -1
  83. package/fesm2022/angular-fire-auth.mjs +28 -25
  84. package/fesm2022/angular-fire-auth.mjs.map +1 -1
  85. package/fesm2022/angular-fire-compat-analytics.mjs +22 -22
  86. package/fesm2022/angular-fire-compat-analytics.mjs.map +1 -1
  87. package/fesm2022/angular-fire-compat-auth-guard.mjs +9 -9
  88. package/fesm2022/angular-fire-compat-auth-guard.mjs.map +1 -1
  89. package/fesm2022/angular-fire-compat-auth.mjs +10 -10
  90. package/fesm2022/angular-fire-compat-auth.mjs.map +1 -1
  91. package/fesm2022/angular-fire-compat-database.mjs +10 -10
  92. package/fesm2022/angular-fire-compat-database.mjs.map +1 -1
  93. package/fesm2022/angular-fire-compat-firestore.mjs +10 -10
  94. package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -1
  95. package/fesm2022/angular-fire-compat-functions.mjs +10 -10
  96. package/fesm2022/angular-fire-compat-functions.mjs.map +1 -1
  97. package/fesm2022/angular-fire-compat-messaging.mjs +11 -11
  98. package/fesm2022/angular-fire-compat-messaging.mjs.map +1 -1
  99. package/fesm2022/angular-fire-compat-performance.mjs +16 -16
  100. package/fesm2022/angular-fire-compat-performance.mjs.map +1 -1
  101. package/fesm2022/angular-fire-compat-remote-config.mjs +11 -11
  102. package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -1
  103. package/fesm2022/angular-fire-compat-storage.mjs +19 -19
  104. package/fesm2022/angular-fire-compat-storage.mjs.map +1 -1
  105. package/fesm2022/angular-fire-compat.mjs +6 -6
  106. package/fesm2022/angular-fire-compat.mjs.map +1 -1
  107. package/fesm2022/angular-fire-database.mjs +27 -25
  108. package/fesm2022/angular-fire-database.mjs.map +1 -1
  109. package/fesm2022/angular-fire-firestore-lite.mjs +27 -25
  110. package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -1
  111. package/fesm2022/angular-fire-firestore.mjs +27 -25
  112. package/fesm2022/angular-fire-firestore.mjs.map +1 -1
  113. package/fesm2022/angular-fire-functions.mjs +27 -25
  114. package/fesm2022/angular-fire-functions.mjs.map +1 -1
  115. package/fesm2022/angular-fire-messaging.mjs +29 -22
  116. package/fesm2022/angular-fire-messaging.mjs.map +1 -1
  117. package/fesm2022/angular-fire-performance.mjs +25 -23
  118. package/fesm2022/angular-fire-performance.mjs.map +1 -1
  119. package/fesm2022/angular-fire-remote-config.mjs +29 -22
  120. package/fesm2022/angular-fire-remote-config.mjs.map +1 -1
  121. package/fesm2022/angular-fire-storage.mjs +27 -25
  122. package/fesm2022/angular-fire-storage.mjs.map +1 -1
  123. package/fesm2022/angular-fire.mjs +4 -4
  124. package/fesm2022/angular-fire.mjs.map +1 -1
  125. package/firestore/firestore.module.d.ts +2 -2
  126. package/firestore/lite/lite.module.d.ts +2 -2
  127. package/firestore/lite/package.json +3 -0
  128. package/firestore/package.json +3 -0
  129. package/functions/functions.module.d.ts +2 -2
  130. package/functions/package.json +3 -0
  131. package/messaging/messaging.module.d.ts +2 -2
  132. package/messaging/package.json +3 -0
  133. package/package.json +11 -11
  134. package/performance/package.json +3 -0
  135. package/performance/performance.module.d.ts +2 -2
  136. package/remote-config/package.json +3 -0
  137. package/remote-config/remote-config.module.d.ts +2 -2
  138. package/schematics/firebaseTools.js +2 -2
  139. package/schematics/setup/index.js +22 -7
  140. package/schematics/setup/prompts.js +24 -19
  141. package/schematics/utils.js +13 -11
  142. package/storage/package.json +3 -0
  143. package/storage/storage.module.d.ts +2 -2
package/README.md CHANGED
@@ -7,18 +7,14 @@ by conforming to Angular conventions.
7
7
 
8
8
  <strong><pre>ng add @angular/fire</pre></strong>
9
9
 
10
- _Note: If you want to ng add AngularFire and will be using Hosting/Cloud Functions, you need to configure the
11
- Firebase CLI first so that you are logged in for the schematics that are run as part of `ng add @angular/fire`.
12
- Follow [this guide](docs/install-firebase-tools.md) to have the Firebase CLI walk you through the setup._
13
-
14
- - **Dependency injection** - Provide and Inject Firebase services in your components
15
- - **Zone.js wrappers** - Stable zones allow proper functionality of service workers, forms, SSR, and pre-rendering
16
- - **Observable based** - Utilize RxJS rather than callbacks for realtime streams
10
+ - **Dependency injection** - Provide and Inject Firebase services in your components.
11
+ - **Zone.js wrappers** - Stable zones allow proper functionality of service workers, forms, SSR, and pre-rendering.
12
+ - **Observable based** - Utilize RxJS rather than callbacks for real-time streams.
17
13
  - **NgRx friendly API** - Integrate with NgRx using AngularFire's action based APIs.
18
- - **Lazy-loading** - AngularFire dynamically imports much of Firebase, reducing time to load your app
19
- - **Deploy schematics** - Get your Angular application deployed on Firebase Hosting with a single command
20
- - **Google Analytics** - Zero-effort Angular Router awareness in Google Analytics
21
- - **Router Guards** - Guard your Angular routes with built-in Firebase Authentication checks
14
+ - **Lazy-loading** - AngularFire dynamically imports much of Firebase, reducing the time to load your app.
15
+ - **Deploy schematics** - Get your Angular application deployed on Firebase Hosting with a single command.
16
+ - **Google Analytics** - Zero-effort Angular Router awareness in Google Analytics.
17
+ - **Router Guards** - Guard your Angular routes with built-in Firebase Authentication checks.
22
18
 
23
19
  ## Example use
24
20
 
@@ -62,14 +58,14 @@ export class AppComponent {
62
58
 
63
59
  constructor() {
64
60
  const itemCollection = collection(this.firestore, 'items');
65
- this.item$ = collectionData(itemCollection);
61
+ this.item$ = collectionData<Item>(itemCollection);
66
62
  }
67
63
  }
68
64
  ```
69
65
 
70
66
  ### Polyfills
71
67
 
72
- Neither AngularFire or Firebase ship with polyfills. To have compatibility across as wide-range of environments we suggest the following polyfills be added to your application:
68
+ Neither AngularFire nor Firebase ship with polyfills. To have compatibility across a wide-range of environments, we suggest the following polyfills be added to your application:
73
69
 
74
70
  | API | Environments | Suggested Polyfill | License |
75
71
  |-----|--------------|--------------------|---------|
@@ -104,7 +100,7 @@ Get help on our [Q&A board](https://github.com/angular/angularfire/discussions?d
104
100
 
105
101
  ## Developer Guide
106
102
 
107
- This developer guide assimes you're using the new tree-shakable AngularFire API, [if you're looking for the compatability API you can find the documentation here](docs/compat.md).
103
+ This developer guide assumes you're using the new tree-shakable AngularFire API, [if you're looking for the compatability API you can find the documentation here](docs/compat.md).
108
104
 
109
105
  [See the v7 upgrade guide for more information on this change.](docs/version-7-upgrade.md).
110
106
 
@@ -1,4 +1,4 @@
1
- import { InjectionToken, Injector, ModuleWithProviders, NgZone } from '@angular/core';
1
+ import { EnvironmentProviders, InjectionToken, Injector, NgZone } from '@angular/core';
2
2
  import { FirebaseApp } from '@angular/fire/app';
3
3
  import { Analytics as FirebaseAnalytics } from 'firebase/analytics';
4
4
  import { Analytics } from './analytics';
@@ -14,4 +14,4 @@ export declare class AnalyticsModule {
14
14
  static ɵmod: i0.ɵɵNgModuleDeclaration<AnalyticsModule, never, never, never>;
15
15
  static ɵinj: i0.ɵɵInjectorDeclaration<AnalyticsModule>;
16
16
  }
17
- export declare function provideAnalytics(fn: (injector: Injector) => FirebaseAnalytics, ...deps: any[]): ModuleWithProviders<AnalyticsModule>;
17
+ export declare function provideAnalytics(fn: (injector: Injector) => FirebaseAnalytics, ...deps: any[]): EnvironmentProviders;
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/angular-fire-analytics.mjs"
3
+ }
@@ -1,4 +1,4 @@
1
- import { InjectionToken, Injector, ModuleWithProviders, NgZone } from '@angular/core';
1
+ import { EnvironmentProviders, InjectionToken, Injector, NgZone } from '@angular/core';
2
2
  import { FirebaseApp as IFirebaseApp } from 'firebase/app';
3
3
  import { FirebaseApp } from './app';
4
4
  import * as i0 from "@angular/core";
@@ -11,4 +11,4 @@ export declare class FirebaseAppModule {
11
11
  static ɵmod: i0.ɵɵNgModuleDeclaration<FirebaseAppModule, never, never, never>;
12
12
  static ɵinj: i0.ɵɵInjectorDeclaration<FirebaseAppModule>;
13
13
  }
14
- export declare function provideFirebaseApp(fn: (injector: Injector) => IFirebaseApp, ...deps: any[]): ModuleWithProviders<FirebaseAppModule>;
14
+ export declare function provideFirebaseApp(fn: (injector: Injector) => IFirebaseApp, ...deps: any[]): EnvironmentProviders;
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/angular-fire-app.mjs"
3
+ }
@@ -1,4 +1,4 @@
1
- import { InjectionToken, Injector, ModuleWithProviders, NgZone } from '@angular/core';
1
+ import { EnvironmentProviders, InjectionToken, Injector, NgZone } from '@angular/core';
2
2
  import { FirebaseApp } from '@angular/fire/app';
3
3
  import { AppCheck as FirebaseAppCheck } from 'firebase/app-check';
4
4
  import { AppCheck } from './app-check';
@@ -12,4 +12,4 @@ export declare class AppCheckModule {
12
12
  static ɵmod: i0.ɵɵNgModuleDeclaration<AppCheckModule, never, never, never>;
13
13
  static ɵinj: i0.ɵɵInjectorDeclaration<AppCheckModule>;
14
14
  }
15
- export declare function provideAppCheck(fn: (injector: Injector) => FirebaseAppCheck, ...deps: any[]): ModuleWithProviders<AppCheckModule>;
15
+ export declare function provideAppCheck(fn: (injector: Injector) => FirebaseAppCheck, ...deps: any[]): EnvironmentProviders;
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/angular-fire-app-check.mjs"
3
+ }
@@ -1,4 +1,4 @@
1
- import { InjectionToken, Injector, ModuleWithProviders, NgZone } from '@angular/core';
1
+ import { EnvironmentProviders, InjectionToken, Injector, NgZone } from '@angular/core';
2
2
  import { FirebaseApp } from '@angular/fire/app';
3
3
  import { Auth as FirebaseAuth } from 'firebase/auth';
4
4
  import { Auth } from './auth';
@@ -12,4 +12,4 @@ export declare class AuthModule {
12
12
  static ɵmod: i0.ɵɵNgModuleDeclaration<AuthModule, never, never, never>;
13
13
  static ɵinj: i0.ɵɵInjectorDeclaration<AuthModule>;
14
14
  }
15
- export declare function provideAuth(fn: (injector: Injector) => FirebaseAuth, ...deps: any[]): ModuleWithProviders<AuthModule>;
15
+ export declare function provideAuth(fn: (injector: Injector) => FirebaseAuth, ...deps: any[]): EnvironmentProviders;
@@ -1,5 +1,5 @@
1
1
  export * from 'firebase/auth';
2
- import { applyActionCode as _applyActionCode, beforeAuthStateChanged as _beforeAuthStateChanged, checkActionCode as _checkActionCode, confirmPasswordReset as _confirmPasswordReset, connectAuthEmulator as _connectAuthEmulator, createUserWithEmailAndPassword as _createUserWithEmailAndPassword, deleteUser as _deleteUser, fetchSignInMethodsForEmail as _fetchSignInMethodsForEmail, getAdditionalUserInfo as _getAdditionalUserInfo, getAuth as _getAuth, getIdToken as _getIdToken, getIdTokenResult as _getIdTokenResult, getMultiFactorResolver as _getMultiFactorResolver, getRedirectResult as _getRedirectResult, initializeAuth as _initializeAuth, initializeRecaptchaConfig as _initializeRecaptchaConfig, isSignInWithEmailLink as _isSignInWithEmailLink, linkWithCredential as _linkWithCredential, linkWithPhoneNumber as _linkWithPhoneNumber, linkWithPopup as _linkWithPopup, linkWithRedirect as _linkWithRedirect, multiFactor as _multiFactor, onAuthStateChanged as _onAuthStateChanged, onIdTokenChanged as _onIdTokenChanged, parseActionCodeURL as _parseActionCodeURL, reauthenticateWithCredential as _reauthenticateWithCredential, reauthenticateWithPhoneNumber as _reauthenticateWithPhoneNumber, reauthenticateWithPopup as _reauthenticateWithPopup, reauthenticateWithRedirect as _reauthenticateWithRedirect, reload as _reload, sendEmailVerification as _sendEmailVerification, sendPasswordResetEmail as _sendPasswordResetEmail, sendSignInLinkToEmail as _sendSignInLinkToEmail, setPersistence as _setPersistence, signInAnonymously as _signInAnonymously, signInWithCredential as _signInWithCredential, signInWithCustomToken as _signInWithCustomToken, signInWithEmailAndPassword as _signInWithEmailAndPassword, signInWithEmailLink as _signInWithEmailLink, signInWithPhoneNumber as _signInWithPhoneNumber, signInWithPopup as _signInWithPopup, signInWithRedirect as _signInWithRedirect, signOut as _signOut, unlink as _unlink, updateCurrentUser as _updateCurrentUser, updateEmail as _updateEmail, updatePassword as _updatePassword, updatePhoneNumber as _updatePhoneNumber, updateProfile as _updateProfile, useDeviceLanguage as _useDeviceLanguage, validatePassword as _validatePassword, verifyBeforeUpdateEmail as _verifyBeforeUpdateEmail, verifyPasswordResetCode as _verifyPasswordResetCode } from 'firebase/auth';
2
+ import { applyActionCode as _applyActionCode, beforeAuthStateChanged as _beforeAuthStateChanged, checkActionCode as _checkActionCode, confirmPasswordReset as _confirmPasswordReset, connectAuthEmulator as _connectAuthEmulator, createUserWithEmailAndPassword as _createUserWithEmailAndPassword, deleteUser as _deleteUser, fetchSignInMethodsForEmail as _fetchSignInMethodsForEmail, getAdditionalUserInfo as _getAdditionalUserInfo, getAuth as _getAuth, getIdToken as _getIdToken, getIdTokenResult as _getIdTokenResult, getMultiFactorResolver as _getMultiFactorResolver, getRedirectResult as _getRedirectResult, initializeAuth as _initializeAuth, initializeRecaptchaConfig as _initializeRecaptchaConfig, isSignInWithEmailLink as _isSignInWithEmailLink, linkWithCredential as _linkWithCredential, linkWithPhoneNumber as _linkWithPhoneNumber, linkWithPopup as _linkWithPopup, linkWithRedirect as _linkWithRedirect, multiFactor as _multiFactor, onAuthStateChanged as _onAuthStateChanged, onIdTokenChanged as _onIdTokenChanged, parseActionCodeURL as _parseActionCodeURL, reauthenticateWithCredential as _reauthenticateWithCredential, reauthenticateWithPhoneNumber as _reauthenticateWithPhoneNumber, reauthenticateWithPopup as _reauthenticateWithPopup, reauthenticateWithRedirect as _reauthenticateWithRedirect, reload as _reload, revokeAccessToken as _revokeAccessToken, sendEmailVerification as _sendEmailVerification, sendPasswordResetEmail as _sendPasswordResetEmail, sendSignInLinkToEmail as _sendSignInLinkToEmail, setPersistence as _setPersistence, signInAnonymously as _signInAnonymously, signInWithCredential as _signInWithCredential, signInWithCustomToken as _signInWithCustomToken, signInWithEmailAndPassword as _signInWithEmailAndPassword, signInWithEmailLink as _signInWithEmailLink, signInWithPhoneNumber as _signInWithPhoneNumber, signInWithPopup as _signInWithPopup, signInWithRedirect as _signInWithRedirect, signOut as _signOut, unlink as _unlink, updateCurrentUser as _updateCurrentUser, updateEmail as _updateEmail, updatePassword as _updatePassword, updatePhoneNumber as _updatePhoneNumber, updateProfile as _updateProfile, useDeviceLanguage as _useDeviceLanguage, validatePassword as _validatePassword, verifyBeforeUpdateEmail as _verifyBeforeUpdateEmail, verifyPasswordResetCode as _verifyPasswordResetCode } from 'firebase/auth';
3
3
  export declare const applyActionCode: typeof _applyActionCode;
4
4
  export declare const beforeAuthStateChanged: typeof _beforeAuthStateChanged;
5
5
  export declare const checkActionCode: typeof _checkActionCode;
@@ -30,6 +30,7 @@ export declare const reauthenticateWithPhoneNumber: typeof _reauthenticateWithPh
30
30
  export declare const reauthenticateWithPopup: typeof _reauthenticateWithPopup;
31
31
  export declare const reauthenticateWithRedirect: typeof _reauthenticateWithRedirect;
32
32
  export declare const reload: typeof _reload;
33
+ export declare const revokeAccessToken: typeof _revokeAccessToken;
33
34
  export declare const sendEmailVerification: typeof _sendEmailVerification;
34
35
  export declare const sendPasswordResetEmail: typeof _sendPasswordResetEmail;
35
36
  export declare const sendSignInLinkToEmail: typeof _sendSignInLinkToEmail;
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/angular-fire-auth.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/angular-fire-auth-guard.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-analytics.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-auth.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-auth-guard.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-database.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-firestore.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-functions.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-messaging.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/angular-fire-compat.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-performance.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-remote-config.mjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/angular-fire-compat-storage.mjs"
3
+ }
@@ -1,4 +1,4 @@
1
- import { InjectionToken, Injector, ModuleWithProviders, NgZone } from '@angular/core';
1
+ import { EnvironmentProviders, InjectionToken, Injector, NgZone } from '@angular/core';
2
2
  import { FirebaseApp } from '@angular/fire/app';
3
3
  import { Database as FirebaseDatabase } from 'firebase/database';
4
4
  import { Database } from './database';
@@ -12,4 +12,4 @@ export declare class DatabaseModule {
12
12
  static ɵmod: i0.ɵɵNgModuleDeclaration<DatabaseModule, never, never, never>;
13
13
  static ɵinj: i0.ɵɵInjectorDeclaration<DatabaseModule>;
14
14
  }
15
- export declare function provideDatabase(fn: (injector: Injector) => FirebaseDatabase, ...deps: any[]): ModuleWithProviders<DatabaseModule>;
15
+ export declare function provideDatabase(fn: (injector: Injector) => FirebaseDatabase, ...deps: any[]): EnvironmentProviders;
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/angular-fire-database.mjs"
3
+ }
@@ -4,7 +4,7 @@
4
4
 
5
5
  `AngularFireAuth` promise proxies an initialized
6
6
  `firebase.auth.Auth` instance, allowing you to log users in, out, etc. [See
7
- the Firebase docs for more information on what methods are available.](https://firebase.google.com/docs/reference/js/firebase.auth.Auth)
7
+ the Firebase docs for more information on what methods are available.](https://firebase.google.com/docs/reference/js/auth.auth)
8
8
 
9
9
  > **NOTE**: [AngularFire has a new tree-shakable API](../../../README.md#developer-guide), you're looking at the documentation for the compatability version of the library. [See the v7 upgrade guide for more information on this change.](../../version-7-upgrade.md).
10
10
 
@@ -65,7 +65,7 @@ import { SETTINGS as AUTH_SETTINGS } from '@angular/fire/compat/auth';
65
65
  export class AppModule { }
66
66
  ```
67
67
 
68
- Read more at [Firebase Auth Settings](https://firebase.google.com/docs/reference/js/firebase.auth.AuthSettings).
68
+ Read more at [Firebase Auth Settings](https://firebase.google.com/docs/reference/js/auth.authsettings).
69
69
 
70
70
  ### Use Current Browser Language
71
71
 
@@ -90,7 +90,7 @@ export class AppModule { }
90
90
  If you want to set a different language, you can use `LANGUAGE_CODE` DI Token
91
91
  (*default: null*).
92
92
 
93
- More info at the [firebase auth docs](https://firebase.google.com/docs/reference/js/firebase.auth.Auth#languagecode).
93
+ More info at the [firebase auth docs](https://firebase.google.com/docs/reference/js/auth.auth#authlanguagecode).
94
94
 
95
95
  ```ts
96
96
  import { LANGUAGE_CODE } from '@angular/fire/compat/auth';
@@ -150,7 +150,7 @@ export class AppModule { }
150
150
  ```
151
151
 
152
152
  - [Multi-Tenancy Authentication](https://cloud.google.com/identity-platform/docs/multi-tenancy-authentication)
153
- - [Firebase Auth Tenant](https://firebase.google.com/docs/reference/js/firebase.auth.Auth#tenantid)
153
+ - [Firebase Auth Tenant](https://firebase.google.com/docs/reference/js/auth.auth#tenantid)
154
154
 
155
155
  ## UI Libraries
156
156
 
@@ -60,6 +60,21 @@ Follow the instructions to download whatever emulator you want to use then check
60
60
  }
61
61
  ```
62
62
 
63
+ Then launch the emulators by running
64
+
65
+ ```shell
66
+ firebase emulators:start
67
+ ```
68
+
69
+ Then you can visit
70
+
71
+ ```shell
72
+ ┌─────────────────────────────────────────────────────────────┐
73
+ │ ✔ All emulators ready! It is now safe to connect your app. │
74
+ │ i View Emulator UI at http://127.0.0.1:4000/ │
75
+ └─────────────────────────────────────────────────────────────┘
76
+ ```
77
+
63
78
  ## Import the DI Tokens at your AppModule
64
79
 
65
80
  Configuring your app to connect to local emulators is easily done by using dependency injection tokens provided by the library. However, there are slighty changes between 6.0.0 and 6.1.0 in the way it was done.
@@ -68,6 +83,17 @@ Configuring your app to connect to local emulators is easily done by using depen
68
83
 
69
84
  Each module (database, firestore, auth, function) provides `USE_EMULATOR` token to configure the emulator `host` and `port` by passing a tuple of `[string, number]` values, which are set by default to `localhost` and the asigned port from your `firebase.json` file.
70
85
 
86
+ Update your `environment.ts` file:
87
+
88
+ ```ts
89
+ export const environment = {
90
+ production: false,
91
+ useEmulators: true,
92
+ ...
93
+ }
94
+
95
+ ```
96
+
71
97
  Import these tokens at your `app.module.ts` as follow:
72
98
 
73
99
  ```ts
@@ -80,7 +106,7 @@ import { USE_EMULATOR as USE_FUNCTIONS_EMULATOR } from '@angular/fire/compat/fun
80
106
  // ... Existing configuration
81
107
  providers: [
82
108
  // ... Existing Providers
83
- { provide: USE_AUTH_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9099] : undefined },
109
+ { provide: USE_AUTH_EMULATOR, useValue: environment.useEmulators ? ['http://localhost', 9099] : undefined },
84
110
  { provide: USE_DATABASE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9000] : undefined },
85
111
  { provide: USE_FIRESTORE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 8080] : undefined },
86
112
  { provide: USE_FUNCTIONS_EMULATOR, useValue: environment.useEmulators ? ['localhost', 5001] : undefined },
@@ -131,4 +157,4 @@ import { SETTINGS as FIRESTORE_SETTINGS } from '@angular/fire/compat/firestore';
131
157
  export class AppModule { }
132
158
  ```
133
159
 
134
- For older versions, please upgrade your app to latest version to get the advantages of these new features :rocket:
160
+ For older versions, please upgrade your app to latest version to get the advantages of these new features :rocket:
@@ -7,7 +7,7 @@ Each *document* contains a set of key-value pairs. Cloud Firestore is optimized
7
7
 
8
8
  ## Using `AngularFirestoreCollection`
9
9
 
10
- The `AngularFirestoreCollection` service is a wrapper around the native Firestore SDK's [`CollectionReference`](https://firebase.google.com/docs/reference/js/firebase.firestore.CollectionReference) and [`Query`](https://firebase.google.com/docs/reference/js/firebase.firestore.Query) types. It is a generic service that provides you with a strongly typed set of methods for manipulating and streaming data. This service is designed for use as an `@Injectable()`.
10
+ The `AngularFirestoreCollection` service is a wrapper around the native Firestore SDK's [`CollectionReference`](https://firebase.google.com/docs/reference/js/v8/firebase.firestore.CollectionReference) and [`Query`](https://firebase.google.com/docs/reference/js/v8/firebase.firestore.Query) types. It is a generic service that provides you with a strongly typed set of methods for manipulating and streaming data. This service is designed for use as an `@Injectable()`.
11
11
 
12
12
  ```ts
13
13
  import { Component } from '@angular/core';
@@ -1,13 +1,13 @@
1
1
  # 4. Querying Collections in AngularFirestore
2
2
 
3
3
  > Firestore has [powerful querying syntax](https://firebase.google.com/docs/firestore/query-data/queries) and the `AngularFirestoreCollection` provides a thin wrapper around it. This keeps you from having to learn two query syntax systems.
4
- If you know the [Firestore query API](https://firebase.google.com/docs/reference/js/firebase.firestore.Query) then you know how to query in AngularFirestore.
4
+ If you know the [Firestore query API](https://firebase.google.com/docs/reference/js/v8/firebase.firestore.Query) then you know how to query in AngularFirestore.
5
5
 
6
6
  > **NOTE**: [AngularFire has a new tree-shakable API](../../../README.md#developer-guide), you're looking at the documentation for the compatability version of the library. [See the v7 upgrade guide for more information on this change.](../../version-7-upgrade.md).
7
7
 
8
8
  ## Creating a query with primitive/scalar values
9
9
 
10
- Queries are created by building on the [`firebase.firestore.CollectionReference`](https://firebase.google.com/docs/reference/js/firebase.firestore.CollectionReference).
10
+ Queries are created by building on the [`firebase.firestore.CollectionReference`](https://firebase.google.com/docs/reference/js/v8/firebase.firestore.CollectionReference).
11
11
 
12
12
  ```ts
13
13
  afs.collection('items', ref => ref.where('size', '==', 'large'))
package/docs/compat.md CHANGED
@@ -38,7 +38,7 @@ Firebase offers two cloud-based, client-accessible database solutions that suppo
38
38
 
39
39
  ### Authenticate users
40
40
 
41
- - [Getting started with Firebase Authentication](acompat/uth/getting-started.md)
41
+ - [Getting started with Firebase Authentication](compat/auth/getting-started.md)
42
42
  - [Route users with AngularFire guards](compat/auth/router-guards.md)
43
43
 
44
44
  ### Local Emulator Suite
@@ -73,7 +73,7 @@ import { Observable } from 'rxjs';
73
73
  styleUrls: ['app.component.css']
74
74
  })
75
75
  export class AppComponent {
76
- firestore: Firestore = inject(Firestore)
76
+ firestore: Firestore = inject(Firestore);
77
77
  items$: Observable<any[]>;
78
78
 
79
79
  constructor() {
package/docs/messaging.md CHANGED
@@ -6,20 +6,198 @@
6
6
 
7
7
  # Cloud Messaging
8
8
 
9
- The FCM JavaScript API lets you receive notification messages in web apps running in browsers that support the Push API.
9
+ Firebase FCM allows you to register devices with unique FCM tokens, that you can later programtically send notifications to using Firebase Cloud Functions. It is up to the application to update these tokens in Firebase if you want to use them in other layers of your application, i.e send a notification to all administrators, etc. In that case, you would likely want to store your fcm tokens on your user collection, or a sub collection or another collection with different permissions.
10
10
 
11
- [Learn More](https://firebase.google.com/docs/cloud-messaging/)
11
+ # Provide Messaging to your existing application
12
12
 
13
- ## Dependency Injection
13
+ ```
14
+ import { getMessaging, provideMessaging } from "@angular/fire/messaging";
14
15
 
15
- YADA YADA YADA
16
+ bootstrapApplication(AppComponent, {
17
+ providers: [
18
+ ...,
19
+ provideMessaging(() => getMessaging())
20
+ ),
21
+ ],
22
+ });
23
+ ```
16
24
 
17
- ## Firebase API
25
+ # Create a Firebase Messaging Service Worker
18
26
 
19
- Something something look at the offical docs
27
+ There are two parts to Firebase Messaging, a Service Worker and the DOM API. Angular Fire Messaging allows you to request permission, get tokens, delete tokens, and subscribe to messages on the DOM side. To register to receive notifications you need to set up the Service Worker. [The official Firebase documentation for setting up the details exactly how to do that](https://firebase.google.com/docs/cloud-messaging/js/client).
20
28
 
21
- ## Convenience observables
29
+ #### Create your firebase-messaging-sw.js file in your src/assets folder
22
30
 
23
- ### Foo
31
+ *Note: When copying the below file, make sure your firebase version in your installation matches the version your are importing from below*
24
32
 
25
- bar baz
33
+ It may be wise to use file replacements or environments here for different environments
34
+
35
+ ```
36
+ // This sample application is using 9.22, make sure you are importing the same version
37
+
38
+ import { initializeApp } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-app.js";
39
+ import { getMessaging } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-messaging-sw.js";
40
+
41
+ const firebaseApp = initializeApp({
42
+ apiKey: "",
43
+ authDomain: "",
44
+ projectId: "",
45
+ storageBucket: "",
46
+ messagingSenderId: "",
47
+ appId: "",
48
+ });
49
+
50
+ const messaging = getMessaging(firebaseApp);
51
+ ```
52
+
53
+ # Example messaging service
54
+
55
+ ```
56
+ import { Injectable } from "@angular/core";
57
+ import { Messaging, getToken, onMessage, deleteToken } from "@angular/fire/messaging";
58
+ import { Observable, tap } from "rxjs";
59
+
60
+ @Injectable({
61
+ providedIn: "root",
62
+ })
63
+ export class FcmService {
64
+ constructor(private msg: Messaging){
65
+ Notification.requestPermission().then(
66
+ (notificationPermissions: NotificationPermission) => {
67
+ if (notificationPermissions === "granted") {
68
+ console.log("Granted");
69
+ }
70
+ if (notificationPermissions === "denied") {
71
+ console.log("Denied");
72
+ }
73
+ });
74
+ navigator.serviceWorker
75
+ .register("/assets/firebase-messaging-sw.js", {
76
+ type: "module",
77
+ })
78
+ .then((serviceWorkerRegistration) => {
79
+ getToken(this.msg, {
80
+ vapidKey: `an optional key generated on Firebase for your fcm tokens`,
81
+ serviceWorkerRegistration: serviceWorkerRegistration,
82
+ }).then((x) => {
83
+ console.log('my fcm token', x);
84
+ // This is a good place to then store it on your database for each user
85
+ });
86
+ });
87
+ }
88
+ this.message$ = new Observable((sub) => onMessage(this.msg, (msg) =>
89
+ sub.next(msg))).pipe(
90
+ tap((msg) => {
91
+ console.log("My Firebase Cloud Message", msg);
92
+ })
93
+ );
94
+ }
95
+ deleteToken(){
96
+ // We can also delete fcm tokens, make sure to also update this on your firestore db if you are storing them as well
97
+ await deleteToken(this.msg);
98
+ }
99
+ ```
100
+
101
+ # Testing and Sending Notifications
102
+
103
+ Firebase will allow you to send a test notification under Engage > Messaging > New Campaign > Notifications. Here you can click send a test message. Additionally, you can send them programmatically through Firebase cloud functions.
104
+
105
+ Here is a barebones Node example:
106
+
107
+ ```
108
+ export const sendTestMessage = onRequest(async (_, res) => {
109
+ try {
110
+ const message = {
111
+ notification: {
112
+ title: "Test Title",
113
+ body: "Test Body",
114
+ },
115
+ token: "your token here, you can store these and retreive as you please",
116
+ };
117
+ await admin.messaging().send(message);
118
+ res.sendStatus(200);
119
+ } catch (error) {
120
+ console.error(error);
121
+ res.sendStatus(500);
122
+ }
123
+ });
124
+ ```
125
+
126
+ Here is a Node example that listens for a new comment on a collection, then sends a notification, and also adds it to a cache on Firebase so users can click through them.
127
+
128
+ ```
129
+ exports.onPostReply =
130
+ onDocumentCreated("comments/{commentId}", async (event) => {
131
+ if (!event) throw new Error("No event found for document creation");
132
+ const snapshot = event.data;
133
+ if (!snapshot) {
134
+ throw new Error("No data associated with the event");
135
+ }
136
+ const data = snapshot.data();
137
+ if (!data.postId) {
138
+ throw new Error("No post ID found");
139
+ }
140
+ const postRef = await firestore.collection("posts").doc(data.postId).get();
141
+ const postData = postRef.data();
142
+ if (!postData) {
143
+ throw new Error("No postData found");
144
+ }
145
+ // userUid will be the post author's id.
146
+ const {userUid} = postData;
147
+ if (!userUid) {
148
+ throw new Error(
149
+ "Could not find the userUid for the post author for post reply"
150
+ );
151
+ }
152
+ const messageForNotification = {
153
+ title: "You have a new reply on your post",
154
+ body: "",
155
+ };
156
+ await createNotificationAndCache(messageForNotification, userUid);
157
+ });
158
+
159
+ // If you want to cache notifications a number of times, abstracting this
160
+ // to a function can bring a lot of value.
161
+
162
+ interface NotificationProps {
163
+ title: string;
164
+ body: string;
165
+ }
166
+
167
+ async function createNotificationAndCache(
168
+ notificationProps: NotificationProps, userAuthUid: string) {
169
+ const userRef = await firestore.collection("users").where("authUid", "==",
170
+ userAuthUid).get();
171
+ const userData = userRef.docs[0].data();
172
+
173
+ const promises: Promise<any>[] = [];
174
+ // This sample application has seperate fcm tokens for web and mobile
175
+ if (userData.mobileToken) {
176
+ const message = {
177
+ notification: notificationProps,
178
+ token: userData.mobileToken,
179
+ };
180
+ const promise = admin.messaging().send(message);
181
+ promises.push(promise);
182
+ }
183
+ if (userData.webToken) {
184
+ const message = {
185
+ notification: notificationProps,
186
+ token: userData.webToken,
187
+ };
188
+ const promise = admin.messaging().send(message);
189
+ promises.push(promise);
190
+ }
191
+
192
+ const notificationCacheValue = {
193
+ userAuthUid: userAuthUid,
194
+ tokenTitle: notificationProps.title,
195
+ tokenBody: notificationProps.body,
196
+ isActive: true, // This determines whether a notification has been seen
197
+ };
198
+
199
+ promises.push(
200
+ firestore.collection("notificationCache").add(notificationCacheValue));
201
+
202
+ await Promise.all(promises);
203
+ } ```