@angular/fire 17.0.1 → 17.1.0-canary.58e6c3b
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/README.md +30 -23
- package/analytics/analytics.module.d.ts +2 -2
- package/app/app.module.d.ts +2 -2
- package/app/firebase.d.ts +2 -1
- package/app-check/app-check.module.d.ts +2 -2
- package/auth/auth.module.d.ts +2 -2
- package/database/database.module.d.ts +2 -2
- package/docs/analytics.md +17 -29
- package/docs/app-check.md +17 -13
- package/docs/auth.md +44 -9
- package/docs/compat/auth/getting-started.md +4 -4
- package/docs/compat/emulators/emulators.md +28 -2
- package/docs/compat/firestore/collections.md +1 -1
- package/docs/compat/firestore/querying-collections.md +2 -2
- package/docs/compat.md +1 -1
- package/docs/database.md +13 -13
- package/docs/firestore.md +23 -24
- package/docs/functions.md +15 -12
- package/docs/install-and-setup.md +1 -1
- package/docs/messaging.md +210 -10
- package/docs/performance.md +14 -16
- package/docs/remote-config.md +14 -12
- package/docs/storage.md +12 -11
- package/docs/vertexai.md +53 -0
- package/esm2022/analytics/analytics.module.mjs +24 -17
- package/esm2022/app/app.module.mjs +22 -16
- package/esm2022/app/firebase.mjs +3 -2
- package/esm2022/app-check/app-check.module.mjs +20 -18
- package/esm2022/auth/auth.module.mjs +20 -18
- package/esm2022/database/database.module.mjs +22 -20
- package/esm2022/firestore/firestore.module.mjs +22 -20
- package/esm2022/firestore/lite/lite.module.mjs +22 -20
- package/esm2022/functions/functions.module.mjs +22 -20
- package/esm2022/messaging/messaging.module.mjs +24 -17
- package/esm2022/performance/performance.module.mjs +20 -18
- package/esm2022/remote-config/remote-config.module.mjs +24 -17
- package/esm2022/storage/storage.module.mjs +22 -20
- package/esm2022/vertexai-preview/angular-fire-vertexai-preview.mjs +5 -0
- package/esm2022/vertexai-preview/firebase.mjs +7 -0
- package/esm2022/vertexai-preview/public_api.mjs +4 -0
- package/esm2022/vertexai-preview/vertexai.mjs +16 -0
- package/esm2022/vertexai-preview/vertexai.module.mjs +73 -0
- package/fesm2022/angular-fire-analytics.mjs +23 -16
- package/fesm2022/angular-fire-analytics.mjs.map +1 -1
- package/fesm2022/angular-fire-app-check.mjs +19 -17
- package/fesm2022/angular-fire-app-check.mjs.map +1 -1
- package/fesm2022/angular-fire-app.mjs +24 -17
- package/fesm2022/angular-fire-app.mjs.map +1 -1
- package/fesm2022/angular-fire-auth.mjs +19 -17
- package/fesm2022/angular-fire-auth.mjs.map +1 -1
- package/fesm2022/angular-fire-database.mjs +21 -19
- package/fesm2022/angular-fire-database.mjs.map +1 -1
- package/fesm2022/angular-fire-firestore-lite.mjs +21 -19
- package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -1
- package/fesm2022/angular-fire-firestore.mjs +21 -19
- package/fesm2022/angular-fire-firestore.mjs.map +1 -1
- package/fesm2022/angular-fire-functions.mjs +21 -19
- package/fesm2022/angular-fire-functions.mjs.map +1 -1
- package/fesm2022/angular-fire-messaging.mjs +23 -16
- package/fesm2022/angular-fire-messaging.mjs.map +1 -1
- package/fesm2022/angular-fire-performance.mjs +19 -17
- package/fesm2022/angular-fire-performance.mjs.map +1 -1
- package/fesm2022/angular-fire-remote-config.mjs +23 -16
- package/fesm2022/angular-fire-remote-config.mjs.map +1 -1
- package/fesm2022/angular-fire-storage.mjs +21 -19
- package/fesm2022/angular-fire-storage.mjs.map +1 -1
- package/fesm2022/angular-fire-vertexai-preview.mjs +99 -0
- package/fesm2022/angular-fire-vertexai-preview.mjs.map +1 -0
- package/firestore/firestore.module.d.ts +2 -2
- package/firestore/lite/lite.module.d.ts +2 -2
- package/functions/functions.module.d.ts +2 -2
- package/messaging/messaging.module.d.ts +2 -2
- package/package.json +8 -2
- package/performance/performance.module.d.ts +2 -2
- package/remote-config/remote-config.module.d.ts +2 -2
- package/schematics/common.js +1 -26
- package/schematics/deploy/actions.js +7 -1
- package/schematics/interfaces.js +11 -11
- package/schematics/setup/index.js +7 -97
- package/schematics/setup/prompts.js +2 -91
- package/schematics/utils.js +27 -75
- package/storage/storage.module.d.ts +2 -2
- package/vertexai-preview/firebase.d.ts +4 -0
- package/vertexai-preview/index.d.ts +5 -0
- package/vertexai-preview/package.json +3 -0
- package/vertexai-preview/public_api.d.ts +3 -0
- package/vertexai-preview/vertexai.d.ts +13 -0
- package/vertexai-preview/vertexai.module.d.ts +15 -0
package/README.md
CHANGED
|
@@ -7,29 +7,29 @@ by conforming to Angular conventions.
|
|
|
7
7
|
|
|
8
8
|
<strong><pre>ng add @angular/fire</pre></strong>
|
|
9
9
|
|
|
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
|
|
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.
|
|
13
13
|
- **NgRx friendly API** - Integrate with NgRx using AngularFire's action based APIs.
|
|
14
|
-
- **Lazy-loading** - AngularFire dynamically imports much of Firebase, reducing 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
|
|
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.
|
|
18
18
|
|
|
19
19
|
## Example use
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
import { provideFirebaseApp,
|
|
22
|
+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
23
23
|
import { getFirestore, provideFirestore } from '@angular/fire/firestore';
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
export const appConfig: ApplicationConfig = {
|
|
26
|
+
providers: [
|
|
27
27
|
provideFirebaseApp(() => initializeApp({ ... })),
|
|
28
28
|
provideFirestore(() => getFirestore()),
|
|
29
|
+
...
|
|
29
30
|
],
|
|
30
31
|
...
|
|
31
32
|
})
|
|
32
|
-
export class AppModule { }
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
```ts
|
|
@@ -44,11 +44,14 @@ interface Item {
|
|
|
44
44
|
|
|
45
45
|
@Component({
|
|
46
46
|
selector: 'app-root',
|
|
47
|
+
standalone: true,
|
|
47
48
|
template: `
|
|
48
49
|
<ul>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
@for (item of (item$ | async); track item) {
|
|
51
|
+
<li>
|
|
52
|
+
{{ item.name }}
|
|
53
|
+
</li>
|
|
54
|
+
}
|
|
52
55
|
</ul>
|
|
53
56
|
`
|
|
54
57
|
})
|
|
@@ -58,14 +61,14 @@ export class AppComponent {
|
|
|
58
61
|
|
|
59
62
|
constructor() {
|
|
60
63
|
const itemCollection = collection(this.firestore, 'items');
|
|
61
|
-
this.item$ = collectionData(itemCollection);
|
|
64
|
+
this.item$ = collectionData<Item>(itemCollection);
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
```
|
|
65
68
|
|
|
66
69
|
### Polyfills
|
|
67
70
|
|
|
68
|
-
Neither AngularFire
|
|
71
|
+
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:
|
|
69
72
|
|
|
70
73
|
| API | Environments | Suggested Polyfill | License |
|
|
71
74
|
|-----|--------------|--------------------|---------|
|
|
@@ -96,11 +99,11 @@ We have three sample apps in this repository:
|
|
|
96
99
|
|
|
97
100
|
Get help on our [Q&A board](https://github.com/angular/angularfire/discussions?discussions_q=category%3AQ%26A), the official [Firebase Mailing List](https://groups.google.com/forum/#!forum/firebase-talk), the [Firebase Community Slack](https://firebase.community/) (`#angularfire2`), the [Angular Community Discord](http://discord.gg/angular) (`#firebase`), [Gitter](https://gitter.im/angular/angularfire2), the [Firebase subreddit](https://www.reddit.com/r/firebase), or [Stack Overflow](https://stackoverflow.com/questions/tagged/angularfire2).
|
|
98
101
|
|
|
99
|
-
> **NOTE:** AngularFire is
|
|
102
|
+
> **NOTE:** While relatively stable, AngularFire is a [developer preview](https://angular.io/guide/releases#developer-preview) and is subject to change before general availability. Questions on the mailing list and issues filed here are answered on a <strong>best-effort basis</strong> by maintainers and other community members. If you are able to reproduce a problem with Firebase <em>outside of AngularFire's implementation</em>, please [file an issue on the Firebase JS SDK](https://github.com/firebase/firebase-js-sdk/issues) or reach out to the personalized [Firebase support channel](https://firebase.google.com/support/).
|
|
100
103
|
|
|
101
104
|
## Developer Guide
|
|
102
105
|
|
|
103
|
-
This developer guide
|
|
106
|
+
This developer guide assumes you're using the new tree-shakable AngularFire API, [if you're looking for the compatibility API you can find the documentation here](docs/compat.md).
|
|
104
107
|
|
|
105
108
|
[See the v7 upgrade guide for more information on this change.](docs/version-7-upgrade.md).
|
|
106
109
|
|
|
@@ -187,10 +190,14 @@ import { } from '@angular/fire/app-check';
|
|
|
187
190
|
```
|
|
188
191
|
</td>
|
|
189
192
|
</tr>
|
|
190
|
-
|
|
193
|
+
<tr>
|
|
194
|
+
<td>
|
|
191
195
|
|
|
192
|
-
|
|
196
|
+
#### [Vertex AI](docs/vertexai.md#vertex-ai-preview)
|
|
197
|
+
```ts
|
|
198
|
+
import { } from '@angular/fire/vertexai-preview';
|
|
199
|
+
```
|
|
200
|
+
</td>
|
|
193
201
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
* Angular Universal: Deploy to Cloud Run
|
|
202
|
+
</tr>
|
|
203
|
+
</table>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionToken, Injector,
|
|
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[]):
|
|
17
|
+
export declare function provideAnalytics(fn: (injector: Injector) => FirebaseAnalytics, ...deps: any[]): EnvironmentProviders;
|
package/app/app.module.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionToken, Injector,
|
|
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[]):
|
|
14
|
+
export declare function provideFirebaseApp(fn: (injector: Injector) => IFirebaseApp, ...deps: any[]): EnvironmentProviders;
|
package/app/firebase.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from 'firebase/app';
|
|
2
|
-
import { deleteApp as _deleteApp, getApp as _getApp, getApps as _getApps, initializeApp as _initializeApp, onLog as _onLog, registerVersion as _registerVersion, setLogLevel as _setLogLevel } from 'firebase/app';
|
|
2
|
+
import { deleteApp as _deleteApp, getApp as _getApp, getApps as _getApps, initializeApp as _initializeApp, initializeServerApp as _initializeServerApp, onLog as _onLog, registerVersion as _registerVersion, setLogLevel as _setLogLevel } from 'firebase/app';
|
|
3
3
|
export declare const deleteApp: typeof _deleteApp;
|
|
4
4
|
export declare const getApp: typeof _getApp;
|
|
5
5
|
export declare const getApps: typeof _getApps;
|
|
6
6
|
export declare const initializeApp: typeof _initializeApp;
|
|
7
|
+
export declare const initializeServerApp: typeof _initializeServerApp;
|
|
7
8
|
export declare const onLog: typeof _onLog;
|
|
8
9
|
export declare const registerVersion: typeof _registerVersion;
|
|
9
10
|
export declare const setLogLevel: typeof _setLogLevel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionToken, Injector,
|
|
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[]):
|
|
15
|
+
export declare function provideAppCheck(fn: (injector: Injector) => FirebaseAppCheck, ...deps: any[]): EnvironmentProviders;
|
package/auth/auth.module.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionToken, Injector,
|
|
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[]):
|
|
15
|
+
export declare function provideAuth(fn: (injector: Injector) => FirebaseAuth, ...deps: any[]): EnvironmentProviders;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionToken, Injector,
|
|
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[]):
|
|
15
|
+
export declare function provideDatabase(fn: (injector: Injector) => FirebaseDatabase, ...deps: any[]): EnvironmentProviders;
|
package/docs/analytics.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Google Analytics is an app measurement solution, available at no charge, that provides insight on app usage and user engagement.
|
|
10
10
|
|
|
11
11
|
[Learn more](https://firebase.google.com/docs/analytics)
|
|
12
|
+
|
|
12
13
|
## Dependency Injection
|
|
13
14
|
|
|
14
15
|
As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
@@ -16,52 +17,39 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
16
17
|
ng add @angular/fire
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
Provide a
|
|
20
|
+
Provide a Analytics instance in the application's `app.config.ts`:
|
|
20
21
|
|
|
21
22
|
```ts
|
|
22
|
-
@
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
24
|
+
import { provideAnalytics, getAnalytics } from '@angular/fire/analytics';
|
|
25
|
+
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
29
|
+
provideAnalytics(() => getAnalytics()),
|
|
27
30
|
...
|
|
28
|
-
// App initialization
|
|
29
|
-
provideFirebaseApp(() => initializeApp(environment.firebase)),
|
|
30
|
-
provideAnalytics(() => getAnalytics())
|
|
31
31
|
],
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
export class AppModule { }
|
|
32
|
+
...,
|
|
33
|
+
}
|
|
36
34
|
```
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
Next inject `Analytics` into your component:
|
|
39
37
|
|
|
40
38
|
```typescript
|
|
41
39
|
import { Component, inject } from '@angular/core';
|
|
42
40
|
import { Analytics } from '@angular/fire/analytics';
|
|
43
41
|
|
|
44
|
-
@Component({
|
|
45
|
-
standalone: true,
|
|
46
|
-
selector: 'app-user-profile',
|
|
47
|
-
...
|
|
48
|
-
})
|
|
42
|
+
@Component({ ... })
|
|
49
43
|
export class UserProfileComponent {
|
|
50
|
-
private analytics
|
|
44
|
+
private analytics = inject(Analytics);
|
|
51
45
|
...
|
|
52
46
|
}
|
|
53
47
|
```
|
|
54
48
|
|
|
55
49
|
## Firebase API
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Services
|
|
60
|
-
|
|
61
|
-
### ScreenTrackingService
|
|
62
|
-
|
|
63
|
-
Coming soon, for now [please review the documentation](https://firebase.google.com/docs/analytics/screenviews)
|
|
51
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
64
52
|
|
|
65
|
-
|
|
66
|
-
Coming soon
|
|
53
|
+
Update the imports from `import { ... } from 'firebase/analytics'` to `import { ... } from '@angular/fire/analytics'` and follow the official documentation.
|
|
67
54
|
|
|
55
|
+
[Getting Started](https://firebase.google.com/docs/analytics/get-started?platform=web) | [API Reference](https://firebase.google.com/docs/reference/js/analytics)
|
package/docs/app-check.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<small>
|
|
2
|
-
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱
|
|
2
|
+
<a href="https://github.com/angular/angularfire">AngularFire</a> ❱ <a href="../README.md#developer-guide">Developer Guide</a> ❱ App Check
|
|
3
3
|
</small>
|
|
4
4
|
|
|
5
5
|
<img align="right" width="30%" src="images/reCAPTCHA-logo@1x.png">
|
|
@@ -11,28 +11,31 @@ App Check helps protect your API resources from abuse by preventing unauthorized
|
|
|
11
11
|
[Learn More](https://firebase.google.com/docs/app-check)
|
|
12
12
|
|
|
13
13
|
## Dependency Injection
|
|
14
|
+
|
|
14
15
|
As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
15
16
|
```bash
|
|
16
17
|
ng add @angular/fire
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
Provide
|
|
20
|
+
Provide a App Check instance in the application's `app.config.ts`:
|
|
20
21
|
|
|
21
22
|
```ts
|
|
22
23
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
23
|
-
import { provideAppCheck } from '@angular/fire/app-check';
|
|
24
|
+
import { provideAppCheck, initializeAppCheck, ReCaptchaV3Provider } from '@angular/fire/app-check';
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
provideFirebaseApp(() => initializeApp(
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
28
29
|
provideAppCheck(() => initializeAppCheck(getApp(), {
|
|
29
30
|
provider: new ReCaptchaV3Provider(/* configuration */),
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
})),
|
|
32
|
+
...
|
|
33
|
+
],
|
|
34
|
+
...
|
|
32
35
|
})
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
Next inject it into your component:
|
|
38
|
+
Next inject `AppCheck` it into your component:
|
|
36
39
|
|
|
37
40
|
```ts
|
|
38
41
|
import { Component, inject} from '@angular/core';
|
|
@@ -40,14 +43,15 @@ import { AppCheck } from '@angular/fire/app-check';
|
|
|
40
43
|
|
|
41
44
|
@Component({ ... })
|
|
42
45
|
export class AppCheckComponent {
|
|
43
|
-
private appCheck
|
|
46
|
+
private appCheck = inject(AppCheck);
|
|
44
47
|
...
|
|
45
48
|
}
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
## Firebase API
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
54
|
+
|
|
55
|
+
Update the imports from `import { ... } from 'firebase/app-check'` to `import { ... } from '@angular/fire/app-check'` and follow the official documentation.
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
Coming soon.
|
|
57
|
+
[Getting Started](https://firebase.google.com/docs/app-check/web/recaptcha-enterprise-provider) | [API Reference](https://firebase.google.com/docs/reference/js/app-check)
|
package/docs/auth.md
CHANGED
|
@@ -20,21 +20,23 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
20
20
|
ng add @angular/fire
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Provide
|
|
23
|
+
Provide a Auth instance in the application's `app.config.ts`:
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
26
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
27
|
-
import {
|
|
27
|
+
import { provideAuth, getAuth } from '@angular/fire/auth';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
provideFirebaseApp(() => initializeApp(
|
|
29
|
+
export const appConfig: ApplicationConfig = {
|
|
30
|
+
providers: [
|
|
31
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
32
32
|
provideAuth(() => getAuth()),
|
|
33
|
-
|
|
33
|
+
...
|
|
34
|
+
],
|
|
35
|
+
...
|
|
34
36
|
})
|
|
35
37
|
```
|
|
36
38
|
|
|
37
|
-
Next inject
|
|
39
|
+
Next inject `Auth` into your component:
|
|
38
40
|
|
|
39
41
|
```ts
|
|
40
42
|
import { Component, inject} from '@angular/core';
|
|
@@ -42,7 +44,7 @@ import { Auth } from '@angular/fire/auth';
|
|
|
42
44
|
|
|
43
45
|
@Component({ ... })
|
|
44
46
|
export class LoginComponent {
|
|
45
|
-
private auth
|
|
47
|
+
private auth = inject(Auth);
|
|
46
48
|
...
|
|
47
49
|
}
|
|
48
50
|
```
|
|
@@ -51,10 +53,43 @@ export class LoginComponent {
|
|
|
51
53
|
|
|
52
54
|
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
53
55
|
|
|
54
|
-
Update the imports from `import { ... } from 'firebase/auth'` to `import { ... } from '@angular/fire/auth'` and follow the
|
|
56
|
+
Update the imports from `import { ... } from 'firebase/auth'` to `import { ... } from '@angular/fire/auth'` and follow the official documentation.
|
|
55
57
|
|
|
56
58
|
[Getting Started](https://firebase.google.com/docs/auth/web/start) | [API Reference](https://firebase.google.com/docs/reference/js/auth)
|
|
57
59
|
|
|
60
|
+
## Server-side Rendering
|
|
61
|
+
|
|
62
|
+
To support Auth context in server-side rendering, you can provide `FirebaseServerApp`:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { ApplicationConfig, PLATFORM_ID, inject } from '@angular/core';
|
|
66
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
67
|
+
import { provideFirebaseApp, initializeApp, initializeServeApp, initializeServerApp } from '@angular/fire/app';
|
|
68
|
+
import { provideAuth, getAuth } from '@angular/fire/auth';
|
|
69
|
+
|
|
70
|
+
export const appConfig: ApplicationConfig = {
|
|
71
|
+
providers: [
|
|
72
|
+
provideFirebaseApp(() => {
|
|
73
|
+
if (isPlatformBrowser(inject(PLATFORM_ID))) {
|
|
74
|
+
return initializeApp(firebaseConfig);
|
|
75
|
+
}
|
|
76
|
+
// Optional, since it's null in dev-mode and SSG
|
|
77
|
+
const request = inject(REQUEST, { optional: true });
|
|
78
|
+
const authIdToken = request?.headers.authorization?.split("Bearer ")[1];
|
|
79
|
+
return initializeServerApp(firebaseConfig, {
|
|
80
|
+
authIdToken,
|
|
81
|
+
releaseOnDeref: request || undefined
|
|
82
|
+
});
|
|
83
|
+
}),
|
|
84
|
+
provideAuth(() => getAuth(inject(FirebaseApp)),
|
|
85
|
+
...
|
|
86
|
+
],
|
|
87
|
+
...
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Follow Firebase's [ Session Management with Service Workers documentation](https://firebase.google.com/docs/auth/web/service-worker-sessions) to learn how to pass the `idToken` to the server. __Note: this will not currently work in dev-mode as Angular SSR does not provide a method to get the Request headers.__
|
|
92
|
+
|
|
58
93
|
## Convenience observables
|
|
59
94
|
|
|
60
95
|
AngularFire provides observables to allow convenient use of the Firebase Authentication with RXJS.
|
|
@@ -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/
|
|
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/
|
|
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/
|
|
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/
|
|
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](
|
|
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
|
package/docs/database.md
CHANGED
|
@@ -17,32 +17,32 @@ As a prerequisite, ensure that `AngularFire` has been added to your project via
|
|
|
17
17
|
ng add @angular/fire
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Provide
|
|
20
|
+
Provide a Database instance in the application's `app.config.ts`:
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
24
|
-
import {
|
|
24
|
+
import { provideDatabase, getDatabase } from '@angular/fire/database';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
provideFirebaseApp(() => initializeApp(
|
|
26
|
+
export const appConfig: ApplicationConfig = {
|
|
27
|
+
providers: [
|
|
28
|
+
provideFirebaseApp(() => initializeApp({ ... })),
|
|
29
29
|
provideDatabase(() => getDatabase()),
|
|
30
|
-
|
|
30
|
+
...
|
|
31
|
+
],
|
|
32
|
+
...
|
|
31
33
|
})
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
Next inject
|
|
36
|
+
Next inject `Database` into your component:
|
|
35
37
|
|
|
36
38
|
```ts
|
|
37
39
|
import { Component, inject } from '@angular/core';
|
|
38
40
|
import { Database } from '@angular/fire/database';
|
|
39
41
|
|
|
40
42
|
@Component({...})
|
|
41
|
-
|
|
42
|
-
private database
|
|
43
|
-
|
|
44
|
-
constructor() {
|
|
45
|
-
}
|
|
43
|
+
export class DepartmentComponent {
|
|
44
|
+
private database = inject(Database);
|
|
45
|
+
...
|
|
46
46
|
}
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ extend class DepartmentComponent {
|
|
|
50
50
|
|
|
51
51
|
AngularFire wraps the Firebase JS SDK to ensure proper functionality in Angular, while providing the same API.
|
|
52
52
|
|
|
53
|
-
Just change your imports from `import { ... } from 'firebase/database'` to `import { ... } from '@angular/fire/database'` and follow the
|
|
53
|
+
Just change your imports from `import { ... } from 'firebase/database'` to `import { ... } from '@angular/fire/database'` and follow the official documentation.
|
|
54
54
|
|
|
55
55
|
[Getting Started](https://firebase.google.com/docs/database/web/start) | [API Reference](https://firebase.google.com/docs/reference/js/database)
|
|
56
56
|
|