@angular/fire 7.6.1 → 16.0.0-canary.5793d6f
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/analytics/analytics.module.d.ts +2 -2
- package/analytics/is-analytics-supported-factory.d.ts +4 -0
- package/analytics/screen-tracking.service.d.ts +3 -3
- package/app-check/app-check.d.ts +0 -6
- package/app-check/app-check.module.d.ts +3 -4
- package/app-check/public_api.d.ts +2 -1
- package/auth/auth.module.d.ts +2 -2
- package/auth-guard/auth-guard.d.ts +6 -6
- package/compat/analytics/analytics.d.ts +1 -3
- package/compat/analytics/analytics.module.d.ts +1 -1
- package/compat/analytics/screen-tracking.service.d.ts +1 -1
- package/compat/analytics/user-tracking.service.d.ts +1 -1
- package/compat/auth/auth.d.ts +4 -4
- package/compat/auth-guard/auth-guard.d.ts +8 -6
- package/compat/database/database.d.ts +4 -4
- package/compat/database/interfaces.d.ts +14 -14
- package/compat/database/list/audit-trail.d.ts +1 -1
- package/compat/database/list/create-reference.d.ts +1 -1
- package/compat/database/list/data-operation.d.ts +1 -1
- package/compat/database/list/state-changes.d.ts +1 -1
- package/compat/database/object/create-reference.d.ts +1 -1
- package/compat/database/observable/fromRef.d.ts +1 -1
- package/compat/database/utils.d.ts +1 -1
- package/compat/firebase.app.module.d.ts +1 -1
- package/compat/firestore/collection/collection.d.ts +2 -2
- package/compat/firestore/collection-group/collection-group.d.ts +2 -2
- package/compat/firestore/document/document.d.ts +4 -4
- package/compat/firestore/firestore.d.ts +7 -7
- package/compat/firestore/interfaces.d.ts +19 -19
- package/compat/functions/functions.d.ts +3 -3
- package/compat/messaging/messaging.d.ts +2 -2
- package/compat/performance/performance.d.ts +2 -2
- package/compat/proxy.d.ts +8 -8
- package/compat/remote-config/interfaces.d.ts +1 -1
- package/compat/remote-config/remote-config.d.ts +15 -49
- package/compat/storage/interfaces.d.ts +8 -8
- package/compat/storage/observable/fromTask.d.ts +1 -2
- package/compat/storage/pipes/storageUrl.pipe.d.ts +1 -1
- package/compat/storage/ref.d.ts +1 -1
- package/compat/storage/storage.d.ts +3 -3
- package/compat/storage/task.d.ts +1 -1
- package/core.d.ts +8 -12
- package/database/database.module.d.ts +2 -2
- package/{esm2015/analytics/analytics.js → esm2022/analytics/analytics.mjs} +1 -1
- package/esm2022/analytics/analytics.module.mjs +94 -0
- package/esm2022/analytics/is-analytics-supported-factory.mjs +16 -0
- package/esm2022/analytics/overrides.mjs +3 -0
- package/esm2022/analytics/screen-tracking.service.mjs +148 -0
- package/esm2022/analytics/user-tracking.service.mjs +44 -0
- package/{esm2015/app/app.js → esm2022/app/app.mjs} +1 -1
- package/esm2022/app/app.module.mjs +85 -0
- package/esm2022/app-check/app-check.mjs +10 -0
- package/esm2022/app-check/app-check.module.mjs +78 -0
- package/esm2022/app-check/public_api.mjs +5 -0
- package/{esm2015/auth/auth.js → esm2022/auth/auth.mjs} +1 -1
- package/esm2022/auth/auth.module.mjs +71 -0
- package/esm2022/auth-guard/auth-guard.mjs +53 -0
- package/{esm2015/auth-guard/auth-guard.module.js → esm2022/auth-guard/auth-guard.module.mjs} +7 -7
- package/esm2022/compat/analytics/analytics.mjs +160 -0
- package/esm2022/compat/analytics/analytics.module.mjs +35 -0
- package/esm2022/compat/analytics/screen-tracking.service.mjs +49 -0
- package/esm2022/compat/analytics/user-tracking.service.mjs +53 -0
- package/esm2022/compat/auth/auth.mjs +161 -0
- package/{esm2015/compat/auth/auth.module.js → esm2022/compat/auth/auth.module.mjs} +7 -7
- package/{esm2015/compat/auth/public_api.js → esm2022/compat/auth/public_api.mjs} +1 -1
- package/esm2022/compat/auth-guard/auth-guard.mjs +53 -0
- package/{esm2015/compat/auth-guard/auth-guard.module.js → esm2022/compat/auth-guard/auth-guard.module.mjs} +7 -7
- package/{esm2015/compat/cache.js → esm2022/compat/cache.mjs} +4 -3
- package/esm2022/compat/database/database.mjs +119 -0
- package/{esm2015/compat/database/database.module.js → esm2022/compat/database/database.module.mjs} +7 -7
- package/esm2022/compat/database/interfaces.mjs +2 -0
- package/{esm2015/compat/database/list/audit-trail.js → esm2022/compat/database/list/audit-trail.mjs} +3 -3
- package/esm2022/compat/database/list/changes.mjs +85 -0
- package/esm2022/compat/database/list/create-reference.mjs +44 -0
- package/{esm2015/compat/database/list/data-operation.js → esm2022/compat/database/list/data-operation.mjs} +1 -1
- package/{esm2015/compat/database/list/snapshot-changes.js → esm2022/compat/database/list/snapshot-changes.mjs} +1 -1
- package/{esm2015/compat/database/list/state-changes.js → esm2022/compat/database/list/state-changes.mjs} +2 -2
- package/{esm2015/compat/database/object/create-reference.js → esm2022/compat/database/object/create-reference.mjs} +2 -2
- package/{esm2015/compat/database/object/snapshot-changes.js → esm2022/compat/database/object/snapshot-changes.mjs} +1 -1
- package/esm2022/compat/database/observable/fromRef.mjs +48 -0
- package/{esm2015/compat/database/utils.js → esm2022/compat/database/utils.mjs} +1 -1
- package/{esm2015/compat/firebase.app.js → esm2022/compat/firebase.app.mjs} +1 -1
- package/esm2022/compat/firebase.app.module.mjs +71 -0
- package/esm2022/compat/firestore/collection/changes.mjs +108 -0
- package/esm2022/compat/firestore/collection/collection.mjs +123 -0
- package/esm2022/compat/firestore/collection-group/collection-group.mjs +86 -0
- package/esm2022/compat/firestore/document/document.mjs +87 -0
- package/esm2022/compat/firestore/firestore.mjs +257 -0
- package/{esm2015/compat/firestore/firestore.module.js → esm2022/compat/firestore/firestore.module.mjs} +7 -7
- package/esm2022/compat/firestore/interfaces.mjs +2 -0
- package/esm2022/compat/firestore/observable/fromRef.mjs +40 -0
- package/esm2022/compat/functions/functions.mjs +69 -0
- package/{esm2015/compat/functions/functions.module.js → esm2022/compat/functions/functions.module.mjs} +7 -7
- package/{esm2015/compat/functions/public_api.js → esm2022/compat/functions/public_api.mjs} +1 -1
- package/esm2022/compat/messaging/messaging.mjs +81 -0
- package/{esm2015/compat/messaging/messaging.module.js → esm2022/compat/messaging/messaging.module.mjs} +7 -7
- package/esm2022/compat/performance/performance.mjs +105 -0
- package/esm2022/compat/performance/performance.module.mjs +27 -0
- package/esm2022/compat/performance/performance.service.mjs +28 -0
- package/esm2022/compat/proxy.mjs +58 -0
- package/esm2022/compat/remote-config/remote-config.mjs +206 -0
- package/{esm2015/compat/remote-config/remote-config.module.js → esm2022/compat/remote-config/remote-config.module.mjs} +7 -7
- package/esm2022/compat/storage/observable/fromTask.mjs +36 -0
- package/esm2022/compat/storage/pipes/storageUrl.pipe.mjs +58 -0
- package/{esm2015/compat/storage/ref.js → esm2022/compat/storage/ref.mjs} +3 -3
- package/esm2022/compat/storage/storage.mjs +95 -0
- package/esm2022/compat/storage/storage.module.mjs +22 -0
- package/{esm2015/compat/storage/task.js → esm2022/compat/storage/task.mjs} +2 -2
- package/esm2022/core.mjs +43 -0
- package/{esm2015/database/database.js → esm2022/database/database.mjs} +1 -1
- package/esm2022/database/database.module.mjs +74 -0
- package/esm2022/firestore/firebase.mjs +54 -0
- package/{esm2015/firestore/firestore.js → esm2022/firestore/firestore.mjs} +1 -1
- package/esm2022/firestore/firestore.module.mjs +74 -0
- package/{esm2015/firestore/lite/lite.js → esm2022/firestore/lite/lite.mjs} +1 -1
- package/esm2022/firestore/lite/lite.module.mjs +73 -0
- package/esm2022/firestore/rxfire.mjs +15 -0
- package/{esm2015/functions/functions.js → esm2022/functions/functions.mjs} +1 -1
- package/esm2022/functions/functions.module.mjs +74 -0
- package/esm2022/messaging/is-messaging-supported-factory.mjs +16 -0
- package/{esm2015/messaging/messaging.js → esm2022/messaging/messaging.mjs} +1 -1
- package/esm2022/messaging/messaging.module.mjs +86 -0
- package/esm2022/messaging/overrides.mjs +3 -0
- package/{esm2015/performance/performance.js → esm2022/performance/performance.mjs} +1 -1
- package/esm2022/performance/performance.module.mjs +81 -0
- package/esm2022/remote-config/is-remote-config-supported-factory.mjs +16 -0
- package/esm2022/remote-config/overrides.mjs +3 -0
- package/{esm2015/remote-config/remote-config.js → esm2022/remote-config/remote-config.mjs} +1 -1
- package/esm2022/remote-config/remote-config.module.mjs +86 -0
- package/{esm2015/storage/storage.js → esm2022/storage/storage.mjs} +1 -1
- package/esm2022/storage/storage.module.mjs +74 -0
- package/esm2022/zones.mjs +194 -0
- package/{fesm2015/angular-fire-analytics.js → fesm2022/angular-fire-analytics.mjs} +64 -40
- package/fesm2022/angular-fire-analytics.mjs.map +1 -0
- package/{fesm2015/angular-fire-app-check.js → fesm2022/angular-fire-app-check.mjs} +16 -24
- package/fesm2022/angular-fire-app-check.mjs.map +1 -0
- package/{fesm2015/angular-fire-app.js → fesm2022/angular-fire-app.mjs} +10 -9
- package/fesm2022/angular-fire-app.mjs.map +1 -0
- package/{fesm2015/angular-fire-auth-guard.js → fesm2022/angular-fire-auth-guard.mjs} +31 -27
- package/fesm2022/angular-fire-auth-guard.mjs.map +1 -0
- package/{fesm2015/angular-fire-auth.js → fesm2022/angular-fire-auth.mjs} +10 -11
- package/fesm2022/angular-fire-auth.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-analytics.js → fesm2022/angular-fire-compat-analytics.mjs} +43 -41
- package/fesm2022/angular-fire-compat-analytics.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-auth-guard.js → fesm2022/angular-fire-compat-auth-guard.mjs} +30 -26
- package/fesm2022/angular-fire-compat-auth-guard.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-auth.js → fesm2022/angular-fire-compat-auth.mjs} +38 -16
- package/fesm2022/angular-fire-compat-auth.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-database.js → fesm2022/angular-fire-compat-database.mjs} +138 -132
- package/fesm2022/angular-fire-compat-database.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-firestore.js → fesm2022/angular-fire-compat-firestore.mjs} +119 -98
- package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-functions.js → fesm2022/angular-fire-compat-functions.mjs} +13 -12
- package/fesm2022/angular-fire-compat-functions.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-messaging.js → fesm2022/angular-fire-compat-messaging.mjs} +25 -19
- package/fesm2022/angular-fire-compat-messaging.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-performance.js → fesm2022/angular-fire-compat-performance.mjs} +29 -34
- package/fesm2022/angular-fire-compat-performance.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-remote-config.js → fesm2022/angular-fire-compat-remote-config.mjs} +35 -22
- package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat-storage.js → fesm2022/angular-fire-compat-storage.mjs} +30 -23
- package/fesm2022/angular-fire-compat-storage.mjs.map +1 -0
- package/{fesm2015/angular-fire-compat.js → fesm2022/angular-fire-compat.mjs} +25 -25
- package/fesm2022/angular-fire-compat.mjs.map +1 -0
- package/{fesm2015/angular-fire-database.js → fesm2022/angular-fire-database.mjs} +11 -12
- package/fesm2022/angular-fire-database.mjs.map +1 -0
- package/{fesm2015/angular-fire-firestore-lite.js → fesm2022/angular-fire-firestore-lite.mjs} +11 -12
- package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -0
- package/{fesm2015/angular-fire-firestore.js → fesm2022/angular-fire-firestore.mjs} +17 -15
- package/fesm2022/angular-fire-firestore.mjs.map +1 -0
- package/{fesm2015/angular-fire-functions.js → fesm2022/angular-fire-functions.mjs} +12 -13
- package/fesm2022/angular-fire-functions.mjs.map +1 -0
- package/{fesm2015/angular-fire-messaging.js → fesm2022/angular-fire-messaging.mjs} +33 -19
- package/fesm2022/angular-fire-messaging.mjs.map +1 -0
- package/{fesm2015/angular-fire-performance.js → fesm2022/angular-fire-performance.mjs} +11 -11
- package/fesm2022/angular-fire-performance.mjs.map +1 -0
- package/{fesm2015/angular-fire-remote-config.js → fesm2022/angular-fire-remote-config.mjs} +34 -20
- package/fesm2022/angular-fire-remote-config.mjs.map +1 -0
- package/{fesm2015/angular-fire-storage.js → fesm2022/angular-fire-storage.mjs} +10 -11
- package/fesm2022/angular-fire-storage.mjs.map +1 -0
- package/{fesm2015/angular-fire.js → fesm2022/angular-fire.mjs} +33 -58
- package/fesm2022/angular-fire.mjs.map +1 -0
- package/firestore/firebase.d.ts +2 -1
- package/firestore/firestore.module.d.ts +2 -2
- package/firestore/lite/lite.module.d.ts +2 -2
- package/firestore/rxfire.d.ts +3 -1
- package/functions/functions.module.d.ts +2 -2
- package/messaging/is-messaging-supported-factory.d.ts +4 -0
- package/messaging/messaging.module.d.ts +2 -2
- package/package.json +158 -7
- package/performance/performance.module.d.ts +2 -2
- package/publish.sh +1 -0
- package/remote-config/is-remote-config-supported-factory.d.ts +4 -0
- package/remote-config/remote-config.module.d.ts +2 -2
- package/schematics/add/index.js +2 -2
- package/schematics/common.js +9 -5
- package/schematics/deploy/actions.js +69 -69
- package/schematics/deploy/builder.js +7 -7
- package/schematics/firebaseTools.js +9 -5
- package/schematics/setup/index.js +27 -27
- package/schematics/setup/prompts.js +22 -18
- package/schematics/update/index.js +1 -1
- package/schematics/update/v7/index.js +7 -7
- package/schematics/utils.js +34 -34
- package/storage/storage.module.d.ts +2 -2
- package/README.md +0 -216
- package/analytics/package.json +0 -11
- package/app/package.json +0 -11
- package/app-check/package.json +0 -11
- package/auth/package.json +0 -11
- package/auth-guard/package.json +0 -11
- package/bundles/angular-fire-analytics.umd.js +0 -673
- package/bundles/angular-fire-analytics.umd.js.map +0 -1
- package/bundles/angular-fire-app-check.umd.js +0 -465
- package/bundles/angular-fire-app-check.umd.js.map +0 -1
- package/bundles/angular-fire-app.umd.js +0 -477
- package/bundles/angular-fire-app.umd.js.map +0 -1
- package/bundles/angular-fire-auth-guard.umd.js +0 -109
- package/bundles/angular-fire-auth-guard.umd.js.map +0 -1
- package/bundles/angular-fire-auth.umd.js +0 -557
- package/bundles/angular-fire-auth.umd.js.map +0 -1
- package/bundles/angular-fire-compat-analytics.umd.js +0 -672
- package/bundles/angular-fire-compat-analytics.umd.js.map +0 -1
- package/bundles/angular-fire-compat-auth-guard.umd.js +0 -112
- package/bundles/angular-fire-compat-auth-guard.umd.js.map +0 -1
- package/bundles/angular-fire-compat-auth.umd.js +0 -559
- package/bundles/angular-fire-compat-auth.umd.js.map +0 -1
- package/bundles/angular-fire-compat-database.umd.js +0 -799
- package/bundles/angular-fire-compat-database.umd.js.map +0 -1
- package/bundles/angular-fire-compat-firestore.umd.js +0 -1073
- package/bundles/angular-fire-compat-firestore.umd.js.map +0 -1
- package/bundles/angular-fire-compat-functions.umd.js +0 -443
- package/bundles/angular-fire-compat-functions.umd.js.map +0 -1
- package/bundles/angular-fire-compat-messaging.umd.js +0 -465
- package/bundles/angular-fire-compat-messaging.umd.js.map +0 -1
- package/bundles/angular-fire-compat-performance.umd.js +0 -212
- package/bundles/angular-fire-compat-performance.umd.js.map +0 -1
- package/bundles/angular-fire-compat-remote-config.umd.js +0 -605
- package/bundles/angular-fire-compat-remote-config.umd.js.map +0 -1
- package/bundles/angular-fire-compat-storage.umd.js +0 -598
- package/bundles/angular-fire-compat-storage.umd.js.map +0 -1
- package/bundles/angular-fire-compat.umd.js +0 -535
- package/bundles/angular-fire-compat.umd.js.map +0 -1
- package/bundles/angular-fire-database.umd.js +0 -557
- package/bundles/angular-fire-database.umd.js.map +0 -1
- package/bundles/angular-fire-firestore-lite.umd.js +0 -531
- package/bundles/angular-fire-firestore-lite.umd.js.map +0 -1
- package/bundles/angular-fire-firestore.umd.js +0 -565
- package/bundles/angular-fire-firestore.umd.js.map +0 -1
- package/bundles/angular-fire-functions.umd.js +0 -461
- package/bundles/angular-fire-functions.umd.js.map +0 -1
- package/bundles/angular-fire-messaging.umd.js +0 -473
- package/bundles/angular-fire-messaging.umd.js.map +0 -1
- package/bundles/angular-fire-performance.umd.js +0 -473
- package/bundles/angular-fire-performance.umd.js.map +0 -1
- package/bundles/angular-fire-remote-config.umd.js +0 -499
- package/bundles/angular-fire-remote-config.umd.js.map +0 -1
- package/bundles/angular-fire-storage.umd.js +0 -485
- package/bundles/angular-fire-storage.umd.js.map +0 -1
- package/bundles/angular-fire.umd.js +0 -308
- package/bundles/angular-fire.umd.js.map +0 -1
- package/compat/analytics/package.json +0 -11
- package/compat/auth/package.json +0 -11
- package/compat/auth-guard/package.json +0 -11
- package/compat/database/package.json +0 -11
- package/compat/firestore/package.json +0 -11
- package/compat/functions/package.json +0 -11
- package/compat/messaging/package.json +0 -11
- package/compat/package.json +0 -11
- package/compat/performance/package.json +0 -11
- package/compat/remote-config/package.json +0 -11
- package/compat/storage/package.json +0 -11
- package/database/package.json +0 -11
- package/docs/analytics.md +0 -67
- package/docs/app-check.md +0 -53
- package/docs/auth.md +0 -165
- package/docs/compat/analytics/getting-started.md +0 -137
- package/docs/compat/auth/getting-started.md +0 -162
- package/docs/compat/auth/router-guards.md +0 -104
- package/docs/compat/emulators/emulators.md +0 -134
- package/docs/compat/firestore/collections.md +0 -326
- package/docs/compat/firestore/documents.md +0 -115
- package/docs/compat/firestore/offline-data.md +0 -39
- package/docs/compat/firestore/querying-collections.md +0 -204
- package/docs/compat/functions/functions.md +0 -166
- package/docs/compat/messaging/messaging.md +0 -232
- package/docs/compat/performance/getting-started.md +0 -132
- package/docs/compat/remote-config/getting-started.md +0 -134
- package/docs/compat/rtdb/lists.md +0 -257
- package/docs/compat/rtdb/objects.md +0 -182
- package/docs/compat/rtdb/querying-lists.md +0 -155
- package/docs/compat/storage/storage.md +0 -257
- package/docs/compat.md +0 -70
- package/docs/database.md +0 -175
- package/docs/deploy/getting-started.md +0 -204
- package/docs/firebase.json +0 -16
- package/docs/firestore.md +0 -148
- package/docs/functions.md +0 -52
- package/docs/images/analytics-illo_1x.png +0 -0
- package/docs/images/auth-illo_1x.png +0 -0
- package/docs/images/cloud-messaging-illo_1x.png +0 -0
- package/docs/images/database-illo_1x.png +0 -0
- package/docs/images/firestore-illo_1x.png +0 -0
- package/docs/images/functions-illo_1x.png +0 -0
- package/docs/images/hosting-illo_1x.png +0 -0
- package/docs/images/performance-illo_1x.png +0 -0
- package/docs/images/reCAPTCHA-logo@1x.png +0 -0
- package/docs/images/remote-config-illo_1x.png +0 -0
- package/docs/images/storage-illo_1x.png +0 -0
- package/docs/install-and-setup.md +0 -114
- package/docs/install-angular-cli-windows10.md +0 -82
- package/docs/messaging.md +0 -25
- package/docs/performance.md +0 -57
- package/docs/remote-config.md +0 -53
- package/docs/storage.md +0 -90
- package/docs/universal/cloud-functions.md +0 -75
- package/docs/universal/getting-started.md +0 -153
- package/docs/universal/prerendering.md +0 -72
- package/docs/version-4-upgrade.md +0 -119
- package/docs/version-5-upgrade.md +0 -82
- package/docs/version-6-upgrade.md +0 -16
- package/docs/version-7-upgrade.md +0 -298
- package/esm2015/analytics/analytics.module.js +0 -93
- package/esm2015/analytics/overrides.js +0 -3
- package/esm2015/analytics/screen-tracking.service.js +0 -139
- package/esm2015/analytics/user-tracking.service.js +0 -43
- package/esm2015/app/app.module.js +0 -84
- package/esm2015/app-check/app-check.js +0 -16
- package/esm2015/app-check/app-check.module.js +0 -81
- package/esm2015/app-check/public_api.js +0 -4
- package/esm2015/auth/auth.module.js +0 -71
- package/esm2015/auth-guard/auth-guard.js +0 -49
- package/esm2015/compat/analytics/analytics.js +0 -163
- package/esm2015/compat/analytics/analytics.module.js +0 -32
- package/esm2015/compat/analytics/screen-tracking.service.js +0 -49
- package/esm2015/compat/analytics/user-tracking.service.js +0 -52
- package/esm2015/compat/auth/auth.js +0 -139
- package/esm2015/compat/auth-guard/auth-guard.js +0 -49
- package/esm2015/compat/database/database.js +0 -117
- package/esm2015/compat/database/interfaces.js +0 -2
- package/esm2015/compat/database/list/changes.js +0 -85
- package/esm2015/compat/database/list/create-reference.js +0 -41
- package/esm2015/compat/database/observable/fromRef.js +0 -47
- package/esm2015/compat/firebase.app.module.js +0 -69
- package/esm2015/compat/firestore/collection/changes.js +0 -107
- package/esm2015/compat/firestore/collection/collection.js +0 -117
- package/esm2015/compat/firestore/collection-group/collection-group.js +0 -81
- package/esm2015/compat/firestore/document/document.js +0 -82
- package/esm2015/compat/firestore/firestore.js +0 -254
- package/esm2015/compat/firestore/interfaces.js +0 -2
- package/esm2015/compat/firestore/observable/fromRef.js +0 -39
- package/esm2015/compat/functions/functions.js +0 -68
- package/esm2015/compat/messaging/messaging.js +0 -75
- package/esm2015/compat/performance/performance.js +0 -110
- package/esm2015/compat/performance/performance.module.js +0 -28
- package/esm2015/compat/performance/performance.service.js +0 -27
- package/esm2015/compat/proxy.js +0 -61
- package/esm2015/compat/remote-config/remote-config.js +0 -193
- package/esm2015/compat/storage/observable/fromTask.js +0 -34
- package/esm2015/compat/storage/pipes/storageUrl.pipe.js +0 -54
- package/esm2015/compat/storage/storage.js +0 -94
- package/esm2015/compat/storage/storage.module.js +0 -22
- package/esm2015/core.js +0 -79
- package/esm2015/database/database.module.js +0 -74
- package/esm2015/firestore/firebase.js +0 -53
- package/esm2015/firestore/firestore.module.js +0 -74
- package/esm2015/firestore/lite/lite.module.js +0 -74
- package/esm2015/firestore/rxfire.js +0 -13
- package/esm2015/functions/functions.module.js +0 -74
- package/esm2015/messaging/messaging.module.js +0 -85
- package/esm2015/messaging/overrides.js +0 -3
- package/esm2015/performance/performance.module.js +0 -81
- package/esm2015/remote-config/overrides.js +0 -3
- package/esm2015/remote-config/remote-config.module.js +0 -85
- package/esm2015/storage/storage.module.js +0 -74
- package/esm2015/zones.js +0 -183
- package/fesm2015/angular-fire-analytics.js.map +0 -1
- package/fesm2015/angular-fire-app-check.js.map +0 -1
- package/fesm2015/angular-fire-app.js.map +0 -1
- package/fesm2015/angular-fire-auth-guard.js.map +0 -1
- package/fesm2015/angular-fire-auth.js.map +0 -1
- package/fesm2015/angular-fire-compat-analytics.js.map +0 -1
- package/fesm2015/angular-fire-compat-auth-guard.js.map +0 -1
- package/fesm2015/angular-fire-compat-auth.js.map +0 -1
- package/fesm2015/angular-fire-compat-database.js.map +0 -1
- package/fesm2015/angular-fire-compat-firestore.js.map +0 -1
- package/fesm2015/angular-fire-compat-functions.js.map +0 -1
- package/fesm2015/angular-fire-compat-messaging.js.map +0 -1
- package/fesm2015/angular-fire-compat-performance.js.map +0 -1
- package/fesm2015/angular-fire-compat-remote-config.js.map +0 -1
- package/fesm2015/angular-fire-compat-storage.js.map +0 -1
- package/fesm2015/angular-fire-compat.js.map +0 -1
- package/fesm2015/angular-fire-database.js.map +0 -1
- package/fesm2015/angular-fire-firestore-lite.js.map +0 -1
- package/fesm2015/angular-fire-firestore.js.map +0 -1
- package/fesm2015/angular-fire-functions.js.map +0 -1
- package/fesm2015/angular-fire-messaging.js.map +0 -1
- package/fesm2015/angular-fire-performance.js.map +0 -1
- package/fesm2015/angular-fire-remote-config.js.map +0 -1
- package/fesm2015/angular-fire-storage.js.map +0 -1
- package/fesm2015/angular-fire.js.map +0 -1
- package/firestore/lite/package.json +0 -11
- package/firestore/package.json +0 -11
- package/firestore-protos.js +0 -4
- package/functions/package.json +0 -11
- package/messaging/package.json +0 -11
- package/performance/package.json +0 -11
- package/remote-config/package.json +0 -11
- package/schematics/add/schema.json +0 -16
- package/schematics/builders.json +0 -10
- package/schematics/collection.json +0 -15
- package/schematics/deploy/schema.json +0 -119
- package/schematics/migration.json +0 -15
- package/schematics/setup/schema.json +0 -16
- package/storage/package.json +0 -11
- /package/analytics/{angular-fire-analytics.d.ts → index.d.ts} +0 -0
- /package/app/{angular-fire-app.d.ts → index.d.ts} +0 -0
- /package/app-check/{angular-fire-app-check.d.ts → index.d.ts} +0 -0
- /package/auth/{angular-fire-auth.d.ts → index.d.ts} +0 -0
- /package/auth-guard/{angular-fire-auth-guard.d.ts → index.d.ts} +0 -0
- /package/compat/analytics/{angular-fire-compat-analytics.d.ts → index.d.ts} +0 -0
- /package/compat/auth/{angular-fire-compat-auth.d.ts → index.d.ts} +0 -0
- /package/compat/auth-guard/{angular-fire-compat-auth-guard.d.ts → index.d.ts} +0 -0
- /package/compat/database/{angular-fire-compat-database.d.ts → index.d.ts} +0 -0
- /package/compat/firestore/{angular-fire-compat-firestore.d.ts → index.d.ts} +0 -0
- /package/compat/functions/{angular-fire-compat-functions.d.ts → index.d.ts} +0 -0
- /package/compat/{angular-fire-compat.d.ts → index.d.ts} +0 -0
- /package/compat/messaging/{angular-fire-compat-messaging.d.ts → index.d.ts} +0 -0
- /package/compat/performance/{angular-fire-compat-performance.d.ts → index.d.ts} +0 -0
- /package/compat/remote-config/{angular-fire-compat-remote-config.d.ts → index.d.ts} +0 -0
- /package/compat/storage/{angular-fire-compat-storage.d.ts → index.d.ts} +0 -0
- /package/database/{angular-fire-database.d.ts → index.d.ts} +0 -0
- /package/{esm2015/analytics/angular-fire-analytics.js → esm2022/analytics/angular-fire-analytics.mjs} +0 -0
- /package/{esm2015/analytics/firebase.js → esm2022/analytics/firebase.mjs} +0 -0
- /package/{esm2015/analytics/public_api.js → esm2022/analytics/public_api.mjs} +0 -0
- /package/{esm2015/angular-fire.js → esm2022/angular-fire.mjs} +0 -0
- /package/{esm2015/app/angular-fire-app.js → esm2022/app/angular-fire-app.mjs} +0 -0
- /package/{esm2015/app/firebase.js → esm2022/app/firebase.mjs} +0 -0
- /package/{esm2015/app/public_api.js → esm2022/app/public_api.mjs} +0 -0
- /package/{esm2015/app-check/angular-fire-app-check.js → esm2022/app-check/angular-fire-app-check.mjs} +0 -0
- /package/{esm2015/app-check/firebase.js → esm2022/app-check/firebase.mjs} +0 -0
- /package/{esm2015/auth/angular-fire-auth.js → esm2022/auth/angular-fire-auth.mjs} +0 -0
- /package/{esm2015/auth/firebase.js → esm2022/auth/firebase.mjs} +0 -0
- /package/{esm2015/auth/public_api.js → esm2022/auth/public_api.mjs} +0 -0
- /package/{esm2015/auth/rxfire.js → esm2022/auth/rxfire.mjs} +0 -0
- /package/{esm2015/auth-guard/angular-fire-auth-guard.js → esm2022/auth-guard/angular-fire-auth-guard.mjs} +0 -0
- /package/{esm2015/auth-guard/public_api.js → esm2022/auth-guard/public_api.mjs} +0 -0
- /package/{esm2015/compat/analytics/angular-fire-compat-analytics.js → esm2022/compat/analytics/angular-fire-compat-analytics.mjs} +0 -0
- /package/{esm2015/compat/analytics/base.js → esm2022/compat/analytics/base.mjs} +0 -0
- /package/{esm2015/compat/analytics/public_api.js → esm2022/compat/analytics/public_api.mjs} +0 -0
- /package/{esm2015/compat/angular-fire-compat.js → esm2022/compat/angular-fire-compat.mjs} +0 -0
- /package/{esm2015/compat/auth/angular-fire-compat-auth.js → esm2022/compat/auth/angular-fire-compat-auth.mjs} +0 -0
- /package/{esm2015/compat/auth/base.js → esm2022/compat/auth/base.mjs} +0 -0
- /package/{esm2015/compat/auth-guard/angular-fire-compat-auth-guard.js → esm2022/compat/auth-guard/angular-fire-compat-auth-guard.mjs} +0 -0
- /package/{esm2015/compat/auth-guard/public_api.js → esm2022/compat/auth-guard/public_api.mjs} +0 -0
- /package/{esm2015/compat/database/angular-fire-compat-database.js → esm2022/compat/database/angular-fire-compat-database.mjs} +0 -0
- /package/{esm2015/compat/database/list/remove.js → esm2022/compat/database/list/remove.mjs} +0 -0
- /package/{esm2015/compat/database/list/utils.js → esm2022/compat/database/list/utils.mjs} +0 -0
- /package/{esm2015/compat/database/public_api.js → esm2022/compat/database/public_api.mjs} +0 -0
- /package/{esm2015/compat/firestore/angular-fire-compat-firestore.js → esm2022/compat/firestore/angular-fire-compat-firestore.mjs} +0 -0
- /package/{esm2015/compat/firestore/public_api.js → esm2022/compat/firestore/public_api.mjs} +0 -0
- /package/{esm2015/compat/functions/angular-fire-compat-functions.js → esm2022/compat/functions/angular-fire-compat-functions.mjs} +0 -0
- /package/{esm2015/compat/functions/base.js → esm2022/compat/functions/base.mjs} +0 -0
- /package/{esm2015/compat/messaging/angular-fire-compat-messaging.js → esm2022/compat/messaging/angular-fire-compat-messaging.mjs} +0 -0
- /package/{esm2015/compat/messaging/base.js → esm2022/compat/messaging/base.mjs} +0 -0
- /package/{esm2015/compat/messaging/public_api.js → esm2022/compat/messaging/public_api.mjs} +0 -0
- /package/{esm2015/compat/performance/angular-fire-compat-performance.js → esm2022/compat/performance/angular-fire-compat-performance.mjs} +0 -0
- /package/{esm2015/compat/performance/base.js → esm2022/compat/performance/base.mjs} +0 -0
- /package/{esm2015/compat/performance/public_api.js → esm2022/compat/performance/public_api.mjs} +0 -0
- /package/{esm2015/compat/public_api.js → esm2022/compat/public_api.mjs} +0 -0
- /package/{esm2015/compat/remote-config/angular-fire-compat-remote-config.js → esm2022/compat/remote-config/angular-fire-compat-remote-config.mjs} +0 -0
- /package/{esm2015/compat/remote-config/base.js → esm2022/compat/remote-config/base.mjs} +0 -0
- /package/{esm2015/compat/remote-config/interfaces.js → esm2022/compat/remote-config/interfaces.mjs} +0 -0
- /package/{esm2015/compat/remote-config/public_api.js → esm2022/compat/remote-config/public_api.mjs} +0 -0
- /package/{esm2015/compat/storage/angular-fire-compat-storage.js → esm2022/compat/storage/angular-fire-compat-storage.mjs} +0 -0
- /package/{esm2015/compat/storage/interfaces.js → esm2022/compat/storage/interfaces.mjs} +0 -0
- /package/{esm2015/compat/storage/public_api.js → esm2022/compat/storage/public_api.mjs} +0 -0
- /package/{esm2015/database/angular-fire-database.js → esm2022/database/angular-fire-database.mjs} +0 -0
- /package/{esm2015/database/firebase.js → esm2022/database/firebase.mjs} +0 -0
- /package/{esm2015/database/public_api.js → esm2022/database/public_api.mjs} +0 -0
- /package/{esm2015/database/rxfire.js → esm2022/database/rxfire.mjs} +0 -0
- /package/{esm2015/firestore/angular-fire-firestore.js → esm2022/firestore/angular-fire-firestore.mjs} +0 -0
- /package/{esm2015/firestore/lite/angular-fire-firestore-lite.js → esm2022/firestore/lite/angular-fire-firestore-lite.mjs} +0 -0
- /package/{esm2015/firestore/lite/firebase.js → esm2022/firestore/lite/firebase.mjs} +0 -0
- /package/{esm2015/firestore/lite/public_api.js → esm2022/firestore/lite/public_api.mjs} +0 -0
- /package/{esm2015/firestore/lite/rxfire.js → esm2022/firestore/lite/rxfire.mjs} +0 -0
- /package/{esm2015/firestore/public_api.js → esm2022/firestore/public_api.mjs} +0 -0
- /package/{esm2015/functions/angular-fire-functions.js → esm2022/functions/angular-fire-functions.mjs} +0 -0
- /package/{esm2015/functions/firebase.js → esm2022/functions/firebase.mjs} +0 -0
- /package/{esm2015/functions/public_api.js → esm2022/functions/public_api.mjs} +0 -0
- /package/{esm2015/functions/rxfire.js → esm2022/functions/rxfire.mjs} +0 -0
- /package/{esm2015/messaging/angular-fire-messaging.js → esm2022/messaging/angular-fire-messaging.mjs} +0 -0
- /package/{esm2015/messaging/firebase.js → esm2022/messaging/firebase.mjs} +0 -0
- /package/{esm2015/messaging/public_api.js → esm2022/messaging/public_api.mjs} +0 -0
- /package/{esm2015/performance/angular-fire-performance.js → esm2022/performance/angular-fire-performance.mjs} +0 -0
- /package/{esm2015/performance/firebase.js → esm2022/performance/firebase.mjs} +0 -0
- /package/{esm2015/performance/public_api.js → esm2022/performance/public_api.mjs} +0 -0
- /package/{esm2015/performance/rxfire.js → esm2022/performance/rxfire.mjs} +0 -0
- /package/{esm2015/public_api.js → esm2022/public_api.mjs} +0 -0
- /package/{esm2015/remote-config/angular-fire-remote-config.js → esm2022/remote-config/angular-fire-remote-config.mjs} +0 -0
- /package/{esm2015/remote-config/firebase.js → esm2022/remote-config/firebase.mjs} +0 -0
- /package/{esm2015/remote-config/public_api.js → esm2022/remote-config/public_api.mjs} +0 -0
- /package/{esm2015/remote-config/rxfire.js → esm2022/remote-config/rxfire.mjs} +0 -0
- /package/{esm2015/storage/angular-fire-storage.js → esm2022/storage/angular-fire-storage.mjs} +0 -0
- /package/{esm2015/storage/firebase.js → esm2022/storage/firebase.mjs} +0 -0
- /package/{esm2015/storage/public_api.js → esm2022/storage/public_api.mjs} +0 -0
- /package/{esm2015/storage/rxfire.js → esm2022/storage/rxfire.mjs} +0 -0
- /package/firestore/{angular-fire-firestore.d.ts → index.d.ts} +0 -0
- /package/firestore/lite/{angular-fire-firestore-lite.d.ts → index.d.ts} +0 -0
- /package/functions/{angular-fire-functions.d.ts → index.d.ts} +0 -0
- /package/{angular-fire.d.ts → index.d.ts} +0 -0
- /package/messaging/{angular-fire-messaging.d.ts → index.d.ts} +0 -0
- /package/performance/{angular-fire-performance.d.ts → index.d.ts} +0 -0
- /package/remote-config/{angular-fire-remote-config.d.ts → index.d.ts} +0 -0
- /package/storage/{angular-fire-storage.d.ts → index.d.ts} +0 -0
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
# 4. Querying Collections in AngularFirestore
|
|
2
|
-
|
|
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.
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
## Creating a query with primitive/scalar values
|
|
9
|
-
|
|
10
|
-
Queries are created by building on the [`firebase.firestore.CollectionReference`](https://firebase.google.com/docs/reference/js/firebase.firestore.CollectionReference).
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
afs.collection('items', ref => ref.where('size', '==', 'large'))
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Query options
|
|
17
|
-
|
|
18
|
-
| method | purpose |
|
|
19
|
-
| ---------|--------------------|
|
|
20
|
-
| `where` | Create a new query. *Can be chained to form complex queries.* |
|
|
21
|
-
| `orderBy` | Sort by the specified field, in descending or ascending order. |
|
|
22
|
-
| `limit` | Sets the maximum number of items to return. |
|
|
23
|
-
| `startAt` | Results start at the provided document (inclusive). |
|
|
24
|
-
| `startAfter` | Results start after the provided document (exclusive). |
|
|
25
|
-
| `endAt` | Results end at the provided document (inclusive). |
|
|
26
|
-
| `endBefore` | Results end before the provided document (exclusive). |
|
|
27
|
-
|
|
28
|
-
[To learn more about querying and sorting in Firestore, check out the Firebase documentation](https://firebase.google.com/docs/firestore/query-data/queries).
|
|
29
|
-
|
|
30
|
-
## Invalid query combinations
|
|
31
|
-
|
|
32
|
-
Range filters can only be specified on a single field:
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
// WARNING: Do not copy and paste. This will not work!
|
|
36
|
-
ref.where('state', '>=', 'CA')
|
|
37
|
-
.where('population', '>', 100000)
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Range filter and orderBy cannot be on different fields:
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
// WARNING: Do not copy and paste. This will not work!
|
|
44
|
-
ref.where('population', '>', 100000).orderBy('country')
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Range filters / orderBy cannot be used in conjuction with user-defined data, they require composite indexes be defined on the specific fields.
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
// WARNING: Do not copy and paste. This will not work!
|
|
51
|
-
ref.where('tags.awesome', '==', true).orderBy('population')
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Dynamic querying
|
|
55
|
-
|
|
56
|
-
To enable dynamic queries one should lean on RxJS Operators like `switchMap`.
|
|
57
|
-
|
|
58
|
-
An RxJS Subject is imported below. A Subject is like an Observable, but can multicast to many Observers. Subjects are like EventEmitters: they maintain a registry of many listeners. See, [What is a Subject](http://reactivex.io/rxjs/manual/overview.html#subject) for more information.
|
|
59
|
-
|
|
60
|
-
When we call [`switchMap` on the Subject](https://www.learnrxjs.io/operators/transformation/switchmap.html), we can map each value to a new Observable; in this case a database query.
|
|
61
|
-
|
|
62
|
-
```ts
|
|
63
|
-
const size$ = new Subject<string>();
|
|
64
|
-
const queryObservable = size$.pipe(
|
|
65
|
-
switchMap(size =>
|
|
66
|
-
afs.collection('items', ref => ref.where('size', '==', size)).valueChanges()
|
|
67
|
-
)
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
// subscribe to changes
|
|
71
|
-
queryObservable.subscribe(queriedItems => {
|
|
72
|
-
console.log(queriedItems);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// trigger the query
|
|
76
|
-
size$.next('large');
|
|
77
|
-
|
|
78
|
-
// re-trigger the query!!!
|
|
79
|
-
size$.next('small');
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Example app
|
|
83
|
-
|
|
84
|
-
[See this example in action on StackBlitz](https://stackblitz.com/edit/angularfire-db-api-fbad9p).
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
import { Component } from '@angular/core';
|
|
88
|
-
import { AngularFirestore } from '@angular/fire/compat/firestore';
|
|
89
|
-
import { Observable, BehaviorSubject, combineLatest } from 'rxjs';
|
|
90
|
-
import { switchMap } from 'rxjs/operators';
|
|
91
|
-
|
|
92
|
-
export interface Item {
|
|
93
|
-
text: string;
|
|
94
|
-
color: string;
|
|
95
|
-
size: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@Component({
|
|
99
|
-
selector: 'app-root',
|
|
100
|
-
template: `
|
|
101
|
-
<div *ngIf="items$ | async; let items; else loading">
|
|
102
|
-
<ul>
|
|
103
|
-
<li *ngFor="let item of items">
|
|
104
|
-
{{ item.text }}
|
|
105
|
-
</li>
|
|
106
|
-
</ul>
|
|
107
|
-
<div *ngIf="items.length === 0">No results, try clearing filters</div>
|
|
108
|
-
</div>
|
|
109
|
-
<ng-template #loading>Loading…</ng-template>
|
|
110
|
-
<div>
|
|
111
|
-
<h4>Filter by size</h4>
|
|
112
|
-
<button (click)="filterBySize('small')">Small</button>
|
|
113
|
-
<button (click)="filterBySize('medium')">Medium</button>
|
|
114
|
-
<button (click)="filterBySize('large')">Large</button>
|
|
115
|
-
<button (click)="filterBySize(null)" *ngIf="this.sizeFilter$.getValue()">
|
|
116
|
-
<em>clear filter</em>
|
|
117
|
-
</button>
|
|
118
|
-
</div>
|
|
119
|
-
<div>
|
|
120
|
-
<h4>Filter by color</h4>
|
|
121
|
-
<button (click)="filterByColor('red')">Red</button>
|
|
122
|
-
<button (click)="filterByColor('green')">Blue</button>
|
|
123
|
-
<button (click)="filterByColor('blue')">Green</button>
|
|
124
|
-
<button (click)="filterByColor(null)" *ngIf="this.colorFilter$.getValue()">
|
|
125
|
-
<em>clear filter</em>
|
|
126
|
-
</button>
|
|
127
|
-
</div>
|
|
128
|
-
`,
|
|
129
|
-
})
|
|
130
|
-
export class AppComponent {
|
|
131
|
-
items$: Observable<Item[]>;
|
|
132
|
-
sizeFilter$: BehaviorSubject<string|null>;
|
|
133
|
-
colorFilter$: BehaviorSubject<string|null>;
|
|
134
|
-
|
|
135
|
-
constructor(afs: AngularFirestore) {
|
|
136
|
-
this.sizeFilter$ = new BehaviorSubject(null);
|
|
137
|
-
this.colorFilter$ = new BehaviorSubject(null);
|
|
138
|
-
this.items$ = combineLatest(
|
|
139
|
-
this.sizeFilter$,
|
|
140
|
-
this.colorFilter$
|
|
141
|
-
).pipe(
|
|
142
|
-
switchMap(([size, color]) =>
|
|
143
|
-
afs.collection('items', ref => {
|
|
144
|
-
let query : firebase.firestore.CollectionReference | firebase.firestore.Query = ref;
|
|
145
|
-
if (size) { query = query.where('size', '==', size) };
|
|
146
|
-
if (color) { query = query.where('color', '==', color) };
|
|
147
|
-
return query;
|
|
148
|
-
}).valueChanges()
|
|
149
|
-
)
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
filterBySize(size: string|null) {
|
|
153
|
-
this.sizeFilter$.next(size);
|
|
154
|
-
}
|
|
155
|
-
filterByColor(color: string|null) {
|
|
156
|
-
this.colorFilter$.next(color);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
**To run the above example as is, you need to have sample data in your Firebase database with the following structure:**
|
|
162
|
-
|
|
163
|
-
```json
|
|
164
|
-
{
|
|
165
|
-
"items": {
|
|
166
|
-
"a" : {
|
|
167
|
-
"size" : "small",
|
|
168
|
-
"text" : "small thing",
|
|
169
|
-
"color" : "red"
|
|
170
|
-
},
|
|
171
|
-
"b" : {
|
|
172
|
-
"size" : "medium",
|
|
173
|
-
"text" : "medium sample",
|
|
174
|
-
"color" : "red"
|
|
175
|
-
},
|
|
176
|
-
"c" : {
|
|
177
|
-
"size" : "large",
|
|
178
|
-
"text" : "large widget",
|
|
179
|
-
"color" : "green"
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
## Collection Group Queries
|
|
186
|
-
|
|
187
|
-
To query across collections and sub-collections with the same name anywhere in Firestore, you can use collection group queries.
|
|
188
|
-
|
|
189
|
-
Collection Group Queries allow you to have a more nested data-structure without sacrificing performance. For example, we could easily query all comments a user posted; even if the comments were stored as a sub-collection under `Articles/**` or even nested deeply (`Articles/**/Comments/**/Comments/**/...`):
|
|
190
|
-
|
|
191
|
-
```ts
|
|
192
|
-
constructor(private afs: AngularFirestore) { }
|
|
193
|
-
|
|
194
|
-
ngOnInit() {
|
|
195
|
-
...
|
|
196
|
-
// Get all the user's comments, no matter how deeply nested
|
|
197
|
-
this.comments$ = afs.collectionGroup('Comments', ref => ref.where('user', '==', userId))
|
|
198
|
-
.valueChanges({ idField: 'docId' });
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
`collectionGroup` returns an `AngularFirestoreCollectionGroup` which is similar to `AngularFirestoreCollection`. The main difference is that `AngularFirestoreCollectionGroup` has no data operation methods such as `add` because it doesn't have a concrete reference.
|
|
203
|
-
|
|
204
|
-
### [Next Step: Getting started with Firebase Authentication](../auth/getting-started.md)
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
# AngularFireFunctions
|
|
2
|
-
|
|
3
|
-
> The Cloud Functions for Firebase client SDKs let you call functions directly from a Firebase app. To call a function from your app in this way, write and deploy an HTTPS Callable function in Cloud Functions, and then add client logic to call the function from your app.
|
|
4
|
-
|
|
5
|
-
> **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).
|
|
6
|
-
|
|
7
|
-
### Import the `NgModule`
|
|
8
|
-
|
|
9
|
-
Cloud Functions for AngularFire is contained in the `@angular/fire/functions` module namespace. Import the `AngularFireFunctionsModule` in your `NgModule`. This sets up the `AngularFireFunction` service for dependency injection.
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
13
|
-
import { NgModule } from '@angular/core';
|
|
14
|
-
import { AppComponent } from './app.component';
|
|
15
|
-
import { AngularFireModule } from '@angular/fire/compat';
|
|
16
|
-
import { AngularFireFunctionsModule } from '@angular/fire/compat/functions';
|
|
17
|
-
import { environment } from '../environments/environment';
|
|
18
|
-
|
|
19
|
-
@NgModule({
|
|
20
|
-
imports: [
|
|
21
|
-
BrowserModule,
|
|
22
|
-
AngularFireModule.initializeApp(environment.firebase),
|
|
23
|
-
AngularFireFunctionsModule
|
|
24
|
-
],
|
|
25
|
-
declarations: [ AppComponent ],
|
|
26
|
-
bootstrap: [ AppComponent ]
|
|
27
|
-
})
|
|
28
|
-
export class AppModule {}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Injecting the AngularFireFunctions service
|
|
32
|
-
|
|
33
|
-
Once the `AngularFireFunctionsModule` is registered you can inject the `AngularFireFunctions` service.
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
import { Component } from '@angular/core';
|
|
37
|
-
import { AngularFireFunctions } from '@angular/fire/compat/functions';
|
|
38
|
-
|
|
39
|
-
@Component({
|
|
40
|
-
selector: 'app-component',
|
|
41
|
-
template: ``
|
|
42
|
-
})
|
|
43
|
-
export class AppComponent {
|
|
44
|
-
constructor(private fns: AngularFireFunctions) { }
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Creating a callable function
|
|
49
|
-
|
|
50
|
-
AngularFireFunctions is super easy. You create a function on the server side and then "call" it by its name with the client library.
|
|
51
|
-
|
|
52
|
-
| method | |
|
|
53
|
-
| ---------|--------------------|
|
|
54
|
-
| `httpCallable(name: string): (data: T) ` | Creates a callable function based on a function name. Returns a function that can create the observable of the http call. |
|
|
55
|
-
```ts
|
|
56
|
-
|
|
57
|
-
import { Component } from '@angular/core';
|
|
58
|
-
import { AngularFireFunctions } from '@angular/fire/compat/functions';
|
|
59
|
-
|
|
60
|
-
@Component({
|
|
61
|
-
selector: 'app-root',
|
|
62
|
-
template: `{ data$ | async }`
|
|
63
|
-
})
|
|
64
|
-
export class AppComponent {
|
|
65
|
-
constructor(private fns: AngularFireFunctions) {
|
|
66
|
-
const callable = fns.httpsCallable('my-fn-name');
|
|
67
|
-
this.data$ = callable({ name: 'some-data' });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Notice that calling `httpsCallable()` does not initiate the request. It creates a function, which when called creates an Observable, subscribe or convert it to a Promise to initiate the request.
|
|
73
|
-
|
|
74
|
-
## Configuration via Dependency Injection
|
|
75
|
-
|
|
76
|
-
### Functions Region
|
|
77
|
-
|
|
78
|
-
Allow configuration of the Function's region by adding `REGION` to the `providers` section of your `NgModule`. The default is `us-central1`.
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
import { NgModule } from '@angular/core';
|
|
82
|
-
import { AngularFireFunctionsModule, REGION } from '@angular/fire/compat/functions';
|
|
83
|
-
|
|
84
|
-
@NgModule({
|
|
85
|
-
imports: [
|
|
86
|
-
...
|
|
87
|
-
AngularFireFunctionsModule,
|
|
88
|
-
...
|
|
89
|
-
],
|
|
90
|
-
...
|
|
91
|
-
providers: [
|
|
92
|
-
{ provide: REGION, useValue: 'asia-northeast1' }
|
|
93
|
-
]
|
|
94
|
-
})
|
|
95
|
-
export class AppModule {}
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Cloud Functions emulator
|
|
100
|
-
|
|
101
|
-
Point callable Functions to the Cloud Function emulator by adding `USE_EMULATOR` to the `providers` section of your `NgModule`.
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
import { NgModule } from '@angular/core';
|
|
105
|
-
import { AngularFireFunctionsModule, USE_EMULATOR } from '@angular/fire/compat/functions';
|
|
106
|
-
|
|
107
|
-
@NgModule({
|
|
108
|
-
imports: [
|
|
109
|
-
...
|
|
110
|
-
AngularFireFunctionsModule,
|
|
111
|
-
...
|
|
112
|
-
],
|
|
113
|
-
...
|
|
114
|
-
providers: [
|
|
115
|
-
{ provide: USE_EMULATOR, useValue: ['localhost', 5001] }
|
|
116
|
-
]
|
|
117
|
-
})
|
|
118
|
-
export class AppModule {}
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
[Learn more about integration with the Firebase Emulator suite on our dedicated guide here](../emulators/emulators.md).
|
|
123
|
-
|
|
124
|
-
### Firebase Hosting integration
|
|
125
|
-
|
|
126
|
-
If you serve your app using [Firebase Hosting](https://firebase.google.com/docs/hosting/), you can configure Functions to be served from the same domain as your app. This will avoid an extra round-trip per function call due to [CORS preflight request](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request). This only applies to sites hosted via firebase on `us-central1`.
|
|
127
|
-
|
|
128
|
-
To set this up, you first need to update your `hosting` section in `firebase.json` and add one `rewrite` rule per function:
|
|
129
|
-
|
|
130
|
-
```json
|
|
131
|
-
"hosting": {
|
|
132
|
-
"rewrites": [
|
|
133
|
-
{
|
|
134
|
-
"source": "/someFunction",
|
|
135
|
-
"function": "someFunction"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"source": "/anotherFunction",
|
|
139
|
-
"function": "anotherFunction"
|
|
140
|
-
},
|
|
141
|
-
...
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Deploy your hosting project to the new settings go into effect, finally configure functions origin to point at your app domain:
|
|
147
|
-
|
|
148
|
-
```ts
|
|
149
|
-
import { NgModule } from '@angular/core';
|
|
150
|
-
import { AngularFireFunctionsModule, ORIGIN, NEW_ORIGIN_BEHAVIOR } from '@angular/fire/compat/functions';
|
|
151
|
-
|
|
152
|
-
@NgModule({
|
|
153
|
-
imports: [
|
|
154
|
-
...
|
|
155
|
-
AngularFireFunctionsModule,
|
|
156
|
-
...
|
|
157
|
-
],
|
|
158
|
-
...
|
|
159
|
-
providers: [
|
|
160
|
-
{ provide: NEW_ORIGIN_BEHAVIOR, useValue: true },
|
|
161
|
-
{ provide: ORIGIN, useValue: 'https://project-name.web.app' }
|
|
162
|
-
]
|
|
163
|
-
})
|
|
164
|
-
export class AppModule {}
|
|
165
|
-
|
|
166
|
-
```
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
# AngularFireMessaging
|
|
2
|
-
|
|
3
|
-
> The FCM JavaScript API lets you receive notification messages in web apps running in browsers that support the Push API.
|
|
4
|
-
|
|
5
|
-
> **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).
|
|
6
|
-
|
|
7
|
-
### AngularFireMessaging is not out-of-the-box compatible with the Angular Service Worker
|
|
8
|
-
|
|
9
|
-
If you are using the Angular Service Worker, you are not currently able to use AngularFireMessaging out-of-the-box.
|
|
10
|
-
If you'd like this feature please add your 👍 to [this issue](https://github.com/angular/angular/issues/34352).
|
|
11
|
-
|
|
12
|
-
Your alternatives are to use
|
|
13
|
-
- [WorkboxJS](https://developers.google.com/web/tools/workbox/)
|
|
14
|
-
- Follow the discussion in [this issue](https://github.com/angular/angular/issues/34352) and [here](https://github.com/angular/angularfire/discussions/1923), manually registering the Angular Service Worker
|
|
15
|
-
- The Firebase Messaging Service Worker, which is detailed below
|
|
16
|
-
|
|
17
|
-
### Import the `NgModule`
|
|
18
|
-
|
|
19
|
-
Push Notifications for AngularFire are contained in the `@angular/fire/messaging` module namespace. Import the `AngularFireMessagingModule` in your `NgModule`. This sets up the `AngularFireMessaging` service for dependency injection.
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
23
|
-
import { NgModule } from '@angular/core';
|
|
24
|
-
import { AppComponent } from './app.component';
|
|
25
|
-
import { AngularFireModule } from '@angular/fire/compat';
|
|
26
|
-
import { AngularFireMessagingModule } from '@angular/fire/compat/messaging';
|
|
27
|
-
import { environment } from '../environments/environment';
|
|
28
|
-
|
|
29
|
-
@NgModule({
|
|
30
|
-
imports: [
|
|
31
|
-
BrowserModule,
|
|
32
|
-
AngularFireModule.initializeApp(environment.firebase),
|
|
33
|
-
AngularFireMessagingModule
|
|
34
|
-
],
|
|
35
|
-
declarations: [ AppComponent ],
|
|
36
|
-
bootstrap: [ AppComponent ]
|
|
37
|
-
})
|
|
38
|
-
export class AppModule {}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Setting up the Firebase Messaging Service Worker
|
|
42
|
-
|
|
43
|
-
There are two parts to Firebase Messaging, a Service Worker and the DOM API. AngularFireMessaging 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).
|
|
44
|
-
|
|
45
|
-
You can either use the `firebase-messaging-sw.js` file provided in the docs or you can set your own Service Worker to import that script. Make sure to set up your `angular.json` file to copy over the Service Worker file:
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
"assets": [
|
|
49
|
-
"assets",
|
|
50
|
-
"favicon.ico",
|
|
51
|
-
"firebase-messaging-sw.js",
|
|
52
|
-
"manifest.json"
|
|
53
|
-
],
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
[Warning] Remember update the `firebase-messaging-sw.js` everytime you update the `firebase` in package.json. The missmatch version could lead to unable to receive notification in `foreground`, you can create your `firebase-messaging-sw.js` like this:
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
// Give the service worker access to Firebase Messaging.
|
|
60
|
-
// Note that you can only use Firebase Messaging here, other Firebase libraries
|
|
61
|
-
// are not available in the service worker.
|
|
62
|
-
importScripts('https://www.gstatic.com/firebasejs/[the number of version matching with firebase in package.json]/firebase-app.js');
|
|
63
|
-
importScripts('https://www.gstatic.com/firebasejs/[for example: 7.16.1]/firebase-messaging.js');
|
|
64
|
-
|
|
65
|
-
// Initialize the Firebase app in the service worker by passing in the
|
|
66
|
-
// messagingSenderId.
|
|
67
|
-
|
|
68
|
-
firebase.initializeApp({
|
|
69
|
-
apiKey: '<your-key>',
|
|
70
|
-
authDomain: '<your-project-authdomain>',
|
|
71
|
-
databaseURL: '<your-database-URL>',
|
|
72
|
-
projectId: '<your-project-id>',
|
|
73
|
-
storageBucket: '<your-storage-bucket>',
|
|
74
|
-
messagingSenderId: '<your-messaging-sender-id>'
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// Retrieve an instance of Firebase Messaging so that it can handle background
|
|
78
|
-
// messages.
|
|
79
|
-
const messaging = firebase.messaging();
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Requesting permission
|
|
85
|
-
|
|
86
|
-
Once you have the Firebase Messaging Service Worker set up and installed, you need to request permission to send a user notifications. While the browser will popup a UI for you, it is highly recommend to ask the user for permission with a custom UI and only ask when it makes sense. If you blindly ask for permission, you have an extremely high chance of getting denied or blocked.
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
import { Component } from '@angular/core';
|
|
90
|
-
import { AngularFireMessaging } from '@angular/fire/compat/messaging';
|
|
91
|
-
|
|
92
|
-
@Component({
|
|
93
|
-
selector: 'app-root',
|
|
94
|
-
template: `
|
|
95
|
-
<button (click)="requestPermission()">
|
|
96
|
-
Hello this is a chat app. You should let us send you notifications for this reason.
|
|
97
|
-
</button>
|
|
98
|
-
`
|
|
99
|
-
})
|
|
100
|
-
export class AppComponent {
|
|
101
|
-
constructor(private afMessaging: AngularFireMessaging) { }
|
|
102
|
-
requestPermission() {
|
|
103
|
-
this.afMessaging.requestPermission
|
|
104
|
-
.subscribe(
|
|
105
|
-
() => { console.log('Permission granted!'); },
|
|
106
|
-
(error) => { console.error(error); },
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Once you have the permission of the user, you need their token. You can do this with the `getToken` observable or the `tokenChanges` observable. The `tokenChanges` observable listens for token refreshes whereas the `getToken` observable is a one-time call.
|
|
113
|
-
|
|
114
|
-
```ts
|
|
115
|
-
import { Component } from '@angular/core';
|
|
116
|
-
import { AngularFireMessaging } from '@angular/fire/compat/messaging';
|
|
117
|
-
import { mergeMapTo } from 'rxjs/operators';
|
|
118
|
-
|
|
119
|
-
@Component({
|
|
120
|
-
selector: 'app-root',
|
|
121
|
-
template: `
|
|
122
|
-
<button (click)="requestPermission()">
|
|
123
|
-
Hello this is a chat app. You should let us send you notifications for this reason.
|
|
124
|
-
</button>
|
|
125
|
-
`
|
|
126
|
-
})
|
|
127
|
-
export class AppComponent {
|
|
128
|
-
constructor(private afMessaging: AngularFireMessaging) { }
|
|
129
|
-
requestPermission() {
|
|
130
|
-
this.afMessaging.requestPermission
|
|
131
|
-
.pipe(mergeMapTo(this.afMessaging.tokenChanges))
|
|
132
|
-
.subscribe(
|
|
133
|
-
(token) => { console.log('Permission granted! Save to the server!', token); },
|
|
134
|
-
(error) => { console.error(error); },
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Once you have a user's token, you need to save it to the server in order to send them notifications in response to events. Let's say you want to send a push each time a user sends a chat message. Once a user grants permission, you can send the token to the Realtime Database or Cloud Firestore and associate it with a unique id, like a Firebase Auth UID. You can then create a Cloud Function trigger that looks up the user's token when a chat message is created.
|
|
141
|
-
|
|
142
|
-
### Shortcutting token requests
|
|
143
|
-
|
|
144
|
-
An easier way of requesting permission and getting tokens is with the `requestToken` observable. It combines the two steps above into one observable.
|
|
145
|
-
|
|
146
|
-
```ts
|
|
147
|
-
import { Component } from '@angular/core';
|
|
148
|
-
import { AngularFireMessaging } from '@angular/fire/compat/messaging';
|
|
149
|
-
|
|
150
|
-
@Component({
|
|
151
|
-
selector: 'app-root',
|
|
152
|
-
template: `
|
|
153
|
-
<button (click)="requestPermission()">
|
|
154
|
-
Hello this is a chat app. You should let us send you notifications for this reason.
|
|
155
|
-
</button>
|
|
156
|
-
`
|
|
157
|
-
})
|
|
158
|
-
export class AppComponent {
|
|
159
|
-
constructor(private afMessaging: AngularFireMessaging) { }
|
|
160
|
-
requestPermission() {
|
|
161
|
-
this.afMessaging.requestToken
|
|
162
|
-
.subscribe(
|
|
163
|
-
(token) => { console.log('Permission granted! Save to the server!', token); },
|
|
164
|
-
(error) => { console.error(error); },
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
The `requestToken` observable uses the `tokenChanges` observable to listen to refreshes.
|
|
171
|
-
|
|
172
|
-
### Deleting tokens
|
|
173
|
-
|
|
174
|
-
Need to delete a user's token? Not a problem.
|
|
175
|
-
|
|
176
|
-
```ts
|
|
177
|
-
import { Component } from '@angular/core';
|
|
178
|
-
import { AngularFireMessaging } from '@angular/fire/compat/messaging';
|
|
179
|
-
import { mergeMap } from 'rxjs/operators';
|
|
180
|
-
|
|
181
|
-
@Component({
|
|
182
|
-
selector: 'app-root',
|
|
183
|
-
template: `
|
|
184
|
-
<button (click)="deleteToken()">
|
|
185
|
-
Delete my token
|
|
186
|
-
</button>
|
|
187
|
-
`
|
|
188
|
-
})
|
|
189
|
-
export class AppComponent {
|
|
190
|
-
constructor(private afMessaging: AngularFireMessaging) { }
|
|
191
|
-
deleteToken() {
|
|
192
|
-
this.afMessaging.getToken
|
|
193
|
-
.pipe(mergeMap(token => this.afMessaging.deleteToken(token)))
|
|
194
|
-
.subscribe(
|
|
195
|
-
(token) => { console.log('Token deleted!'); },
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
The code above requests the current user's token and passes it to the `deleteToken()` observable.
|
|
202
|
-
|
|
203
|
-
### Subscribing to foreground messages
|
|
204
|
-
|
|
205
|
-
Once you have a user's token and they are subscribed, you can listen to messages in the foreground. The Firebase Messaging Service Worker handles background push notifications.
|
|
206
|
-
|
|
207
|
-
```ts
|
|
208
|
-
import { Component } from '@angular/core';
|
|
209
|
-
import { AngularFireMessaging } from '@angular/fire/compat/messaging';
|
|
210
|
-
|
|
211
|
-
@Component({
|
|
212
|
-
selector: 'app-root',
|
|
213
|
-
template: `
|
|
214
|
-
<button (click)="listen()">
|
|
215
|
-
Get notified!
|
|
216
|
-
</button>
|
|
217
|
-
`
|
|
218
|
-
})
|
|
219
|
-
export class AppComponent {
|
|
220
|
-
constructor(private afMessaging: AngularFireMessaging) { }
|
|
221
|
-
listen() {
|
|
222
|
-
this.afMessaging.messages
|
|
223
|
-
.subscribe((message) => { console.log(message); });
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Sending notifications
|
|
229
|
-
|
|
230
|
-
[Sending a notification](https://firebase.google.com/docs/cloud-messaging/js/first-message) requires a call to a server. You can do this directly with an HTTP call or you can even build a Cloud Function to do this in response to an event. A Cloud Function trigger is ideal because you have trusted access to the database and can securely look up tokens to send to the right user. If you want to send push notifications via HTTP requests you'll need to secure the API call. This is usually done with a Firebase Auth UID. On the server you can verify the UID with the Firebase Admin SDK and allow access to get a user's push id.
|
|
231
|
-
|
|
232
|
-
The [Firebase Admin SDK has helper functions for sending notifications](https://firebase.google.com/docs/cloud-messaging/admin/send-messages) to the user and subscribing them to topics, which [simplifies sending grouped messages](https://firebase.google.com/docs/cloud-messaging/admin/manage-topic-subscriptions).
|