@angular/fire 7.6.1 → 16.0.0-canary.e04cd7f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (455) hide show
  1. package/analytics/is-analytics-supported-factory.d.ts +4 -0
  2. package/auth-guard/auth-guard.d.ts +4 -4
  3. package/compat/auth/auth.d.ts +1 -1
  4. package/compat/auth-guard/auth-guard.d.ts +6 -4
  5. package/compat/database/interfaces.d.ts +12 -12
  6. package/compat/firestore/interfaces.d.ts +17 -17
  7. package/compat/proxy.d.ts +8 -8
  8. package/compat/remote-config/interfaces.d.ts +1 -1
  9. package/compat/storage/interfaces.d.ts +8 -8
  10. package/compat/storage/pipes/storageUrl.pipe.d.ts +1 -1
  11. package/core.d.ts +1 -12
  12. package/esm2022/analytics/analytics.module.mjs +94 -0
  13. package/esm2022/analytics/is-analytics-supported-factory.mjs +16 -0
  14. package/esm2022/analytics/overrides.mjs +3 -0
  15. package/esm2022/analytics/screen-tracking.service.mjs +147 -0
  16. package/esm2022/analytics/user-tracking.service.mjs +44 -0
  17. package/esm2022/app/app.module.mjs +84 -0
  18. package/esm2022/app-check/app-check.module.mjs +80 -0
  19. package/{esm2015/auth/auth.module.js → esm2022/auth/auth.module.mjs} +8 -8
  20. package/esm2022/auth-guard/auth-guard.mjs +51 -0
  21. package/{esm2015/auth-guard/auth-guard.module.js → esm2022/auth-guard/auth-guard.module.mjs} +5 -5
  22. package/esm2022/compat/analytics/analytics.mjs +161 -0
  23. package/{esm2015/compat/analytics/analytics.module.js → esm2022/compat/analytics/analytics.module.mjs} +5 -5
  24. package/esm2022/compat/analytics/screen-tracking.service.mjs +49 -0
  25. package/esm2022/compat/analytics/user-tracking.service.mjs +53 -0
  26. package/esm2022/compat/auth/auth.mjs +161 -0
  27. package/{esm2015/compat/auth/auth.module.js → esm2022/compat/auth/auth.module.mjs} +5 -5
  28. package/{esm2015/compat/auth/public_api.js → esm2022/compat/auth/public_api.mjs} +1 -1
  29. package/esm2022/compat/auth-guard/auth-guard.mjs +51 -0
  30. package/{esm2015/compat/auth-guard/auth-guard.module.js → esm2022/compat/auth-guard/auth-guard.module.mjs} +5 -5
  31. package/{esm2015/compat/cache.js → esm2022/compat/cache.mjs} +3 -3
  32. package/esm2022/compat/database/database.mjs +119 -0
  33. package/{esm2015/compat/database/database.module.js → esm2022/compat/database/database.module.mjs} +5 -5
  34. package/esm2022/compat/database/list/create-reference.mjs +44 -0
  35. package/{esm2015/compat/firebase.app.module.js → esm2022/compat/firebase.app.module.mjs} +11 -11
  36. package/esm2022/compat/firestore/collection/changes.mjs +108 -0
  37. package/esm2022/compat/firestore/collection/collection.mjs +123 -0
  38. package/esm2022/compat/firestore/collection-group/collection-group.mjs +86 -0
  39. package/esm2022/compat/firestore/document/document.mjs +87 -0
  40. package/esm2022/compat/firestore/firestore.mjs +257 -0
  41. package/{esm2015/compat/firestore/firestore.module.js → esm2022/compat/firestore/firestore.module.mjs} +5 -5
  42. package/esm2022/compat/firestore/interfaces.mjs +2 -0
  43. package/esm2022/compat/firestore/observable/fromRef.mjs +40 -0
  44. package/esm2022/compat/functions/functions.mjs +69 -0
  45. package/{esm2015/compat/functions/functions.module.js → esm2022/compat/functions/functions.module.mjs} +5 -5
  46. package/{esm2015/compat/functions/public_api.js → esm2022/compat/functions/public_api.mjs} +1 -1
  47. package/esm2022/compat/messaging/messaging.mjs +80 -0
  48. package/{esm2015/compat/messaging/messaging.module.js → esm2022/compat/messaging/messaging.module.mjs} +5 -5
  49. package/{esm2015/compat/performance/performance.js → esm2022/compat/performance/performance.mjs} +7 -6
  50. package/{esm2015/compat/performance/performance.module.js → esm2022/compat/performance/performance.module.mjs} +5 -5
  51. package/esm2022/compat/performance/performance.service.mjs +27 -0
  52. package/esm2022/compat/proxy.mjs +59 -0
  53. package/esm2022/compat/remote-config/remote-config.mjs +207 -0
  54. package/{esm2015/compat/remote-config/remote-config.module.js → esm2022/compat/remote-config/remote-config.module.mjs} +5 -5
  55. package/esm2022/compat/storage/pipes/storageUrl.pipe.mjs +58 -0
  56. package/esm2022/compat/storage/storage.mjs +95 -0
  57. package/{esm2015/compat/storage/storage.module.js → esm2022/compat/storage/storage.module.mjs} +5 -5
  58. package/esm2022/core.mjs +37 -0
  59. package/{esm2015/database/database.module.js → esm2022/database/database.module.mjs} +8 -8
  60. package/{esm2015/firestore/firestore.module.js → esm2022/firestore/firestore.module.mjs} +8 -8
  61. package/{esm2015/firestore/lite/lite.module.js → esm2022/firestore/lite/lite.module.mjs} +8 -8
  62. package/esm2022/firestore/rxfire.mjs +15 -0
  63. package/{esm2015/functions/functions.module.js → esm2022/functions/functions.module.mjs} +8 -8
  64. package/esm2022/messaging/is-messaging-supported-factory.mjs +16 -0
  65. package/esm2022/messaging/messaging.module.mjs +86 -0
  66. package/esm2022/messaging/overrides.mjs +3 -0
  67. package/{esm2015/performance/performance.module.js → esm2022/performance/performance.module.mjs} +8 -8
  68. package/esm2022/remote-config/is-remote-config-supported-factory.mjs +16 -0
  69. package/esm2022/remote-config/overrides.mjs +3 -0
  70. package/esm2022/remote-config/remote-config.module.mjs +86 -0
  71. package/{esm2015/storage/storage.module.js → esm2022/storage/storage.module.mjs} +8 -8
  72. package/esm2022/zones.mjs +196 -0
  73. package/{fesm2015/angular-fire-analytics.js → fesm2022/angular-fire-analytics.mjs} +61 -38
  74. package/fesm2022/angular-fire-analytics.mjs.map +1 -0
  75. package/{fesm2015/angular-fire-app-check.js → fesm2022/angular-fire-app-check.mjs} +9 -10
  76. package/fesm2022/angular-fire-app-check.mjs.map +1 -0
  77. package/{fesm2015/angular-fire-app.js → fesm2022/angular-fire-app.mjs} +8 -8
  78. package/fesm2022/angular-fire-app.mjs.map +1 -0
  79. package/{fesm2015/angular-fire-auth-guard.js → fesm2022/angular-fire-auth-guard.mjs} +25 -23
  80. package/fesm2022/angular-fire-auth-guard.mjs.map +1 -0
  81. package/{fesm2015/angular-fire-auth.js → fesm2022/angular-fire-auth.mjs} +8 -8
  82. package/fesm2022/angular-fire-auth.mjs.map +1 -0
  83. package/{fesm2015/angular-fire-compat-analytics.js → fesm2022/angular-fire-compat-analytics.mjs} +28 -28
  84. package/fesm2022/angular-fire-compat-analytics.mjs.map +1 -0
  85. package/{fesm2015/angular-fire-compat-auth-guard.js → fesm2022/angular-fire-compat-auth-guard.mjs} +25 -23
  86. package/fesm2022/angular-fire-compat-auth-guard.mjs.map +1 -0
  87. package/{fesm2015/angular-fire-compat-auth.js → fesm2022/angular-fire-compat-auth.mjs} +32 -10
  88. package/fesm2022/angular-fire-compat-auth.mjs.map +1 -0
  89. package/{fesm2015/angular-fire-compat-database.js → fesm2022/angular-fire-compat-database.mjs} +17 -12
  90. package/fesm2022/angular-fire-compat-database.mjs.map +1 -0
  91. package/{fesm2015/angular-fire-compat-firestore.js → fesm2022/angular-fire-compat-firestore.mjs} +37 -16
  92. package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -0
  93. package/{fesm2015/angular-fire-compat-functions.js → fesm2022/angular-fire-compat-functions.mjs} +10 -9
  94. package/fesm2022/angular-fire-compat-functions.mjs.map +1 -0
  95. package/{fesm2015/angular-fire-compat-messaging.js → fesm2022/angular-fire-compat-messaging.mjs} +20 -15
  96. package/fesm2022/angular-fire-compat-messaging.mjs.map +1 -0
  97. package/{fesm2015/angular-fire-compat-performance.js → fesm2022/angular-fire-compat-performance.mjs} +16 -15
  98. package/fesm2022/angular-fire-compat-performance.mjs.map +1 -0
  99. package/{fesm2015/angular-fire-compat-remote-config.js → fesm2022/angular-fire-compat-remote-config.mjs} +33 -19
  100. package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -0
  101. package/{fesm2015/angular-fire-compat-storage.js → fesm2022/angular-fire-compat-storage.mjs} +23 -18
  102. package/fesm2022/angular-fire-compat-storage.mjs.map +1 -0
  103. package/{fesm2015/angular-fire-compat.js → fesm2022/angular-fire-compat.mjs} +15 -17
  104. package/fesm2022/angular-fire-compat.mjs.map +1 -0
  105. package/{fesm2015/angular-fire-database.js → fesm2022/angular-fire-database.mjs} +8 -8
  106. package/fesm2022/angular-fire-database.mjs.map +1 -0
  107. package/{fesm2015/angular-fire-firestore-lite.js → fesm2022/angular-fire-firestore-lite.mjs} +8 -8
  108. package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -0
  109. package/{fesm2015/angular-fire-firestore.js → fesm2022/angular-fire-firestore.mjs} +12 -10
  110. package/fesm2022/angular-fire-firestore.mjs.map +1 -0
  111. package/{fesm2015/angular-fire-functions.js → fesm2022/angular-fire-functions.mjs} +8 -8
  112. package/fesm2022/angular-fire-functions.mjs.map +1 -0
  113. package/{fesm2015/angular-fire-messaging.js → fesm2022/angular-fire-messaging.mjs} +33 -19
  114. package/fesm2022/angular-fire-messaging.mjs.map +1 -0
  115. package/{fesm2015/angular-fire-performance.js → fesm2022/angular-fire-performance.mjs} +8 -8
  116. package/fesm2022/angular-fire-performance.mjs.map +1 -0
  117. package/{fesm2015/angular-fire-remote-config.js → fesm2022/angular-fire-remote-config.mjs} +34 -20
  118. package/fesm2022/angular-fire-remote-config.mjs.map +1 -0
  119. package/{fesm2015/angular-fire-storage.js → fesm2022/angular-fire-storage.mjs} +8 -8
  120. package/fesm2022/angular-fire-storage.mjs.map +1 -0
  121. package/{fesm2015/angular-fire.js → fesm2022/angular-fire.mjs} +23 -52
  122. package/fesm2022/angular-fire.mjs.map +1 -0
  123. package/firestore/rxfire.d.ts +3 -1
  124. package/messaging/is-messaging-supported-factory.d.ts +4 -0
  125. package/package.json +158 -7
  126. package/publish.sh +1 -0
  127. package/remote-config/is-remote-config-supported-factory.d.ts +4 -0
  128. package/schematics/add/index.js +1 -1
  129. package/schematics/common.js +8 -4
  130. package/schematics/deploy/actions.js +59 -59
  131. package/schematics/deploy/builder.js +5 -5
  132. package/schematics/firebaseTools.js +9 -5
  133. package/schematics/setup/index.js +24 -23
  134. package/schematics/setup/prompts.js +20 -15
  135. package/schematics/update/v7/index.js +5 -5
  136. package/schematics/utils.js +30 -30
  137. package/README.md +0 -216
  138. package/analytics/package.json +0 -11
  139. package/app/package.json +0 -11
  140. package/app-check/package.json +0 -11
  141. package/auth/package.json +0 -11
  142. package/auth-guard/package.json +0 -11
  143. package/bundles/angular-fire-analytics.umd.js +0 -673
  144. package/bundles/angular-fire-analytics.umd.js.map +0 -1
  145. package/bundles/angular-fire-app-check.umd.js +0 -465
  146. package/bundles/angular-fire-app-check.umd.js.map +0 -1
  147. package/bundles/angular-fire-app.umd.js +0 -477
  148. package/bundles/angular-fire-app.umd.js.map +0 -1
  149. package/bundles/angular-fire-auth-guard.umd.js +0 -109
  150. package/bundles/angular-fire-auth-guard.umd.js.map +0 -1
  151. package/bundles/angular-fire-auth.umd.js +0 -557
  152. package/bundles/angular-fire-auth.umd.js.map +0 -1
  153. package/bundles/angular-fire-compat-analytics.umd.js +0 -672
  154. package/bundles/angular-fire-compat-analytics.umd.js.map +0 -1
  155. package/bundles/angular-fire-compat-auth-guard.umd.js +0 -112
  156. package/bundles/angular-fire-compat-auth-guard.umd.js.map +0 -1
  157. package/bundles/angular-fire-compat-auth.umd.js +0 -559
  158. package/bundles/angular-fire-compat-auth.umd.js.map +0 -1
  159. package/bundles/angular-fire-compat-database.umd.js +0 -799
  160. package/bundles/angular-fire-compat-database.umd.js.map +0 -1
  161. package/bundles/angular-fire-compat-firestore.umd.js +0 -1073
  162. package/bundles/angular-fire-compat-firestore.umd.js.map +0 -1
  163. package/bundles/angular-fire-compat-functions.umd.js +0 -443
  164. package/bundles/angular-fire-compat-functions.umd.js.map +0 -1
  165. package/bundles/angular-fire-compat-messaging.umd.js +0 -465
  166. package/bundles/angular-fire-compat-messaging.umd.js.map +0 -1
  167. package/bundles/angular-fire-compat-performance.umd.js +0 -212
  168. package/bundles/angular-fire-compat-performance.umd.js.map +0 -1
  169. package/bundles/angular-fire-compat-remote-config.umd.js +0 -605
  170. package/bundles/angular-fire-compat-remote-config.umd.js.map +0 -1
  171. package/bundles/angular-fire-compat-storage.umd.js +0 -598
  172. package/bundles/angular-fire-compat-storage.umd.js.map +0 -1
  173. package/bundles/angular-fire-compat.umd.js +0 -535
  174. package/bundles/angular-fire-compat.umd.js.map +0 -1
  175. package/bundles/angular-fire-database.umd.js +0 -557
  176. package/bundles/angular-fire-database.umd.js.map +0 -1
  177. package/bundles/angular-fire-firestore-lite.umd.js +0 -531
  178. package/bundles/angular-fire-firestore-lite.umd.js.map +0 -1
  179. package/bundles/angular-fire-firestore.umd.js +0 -565
  180. package/bundles/angular-fire-firestore.umd.js.map +0 -1
  181. package/bundles/angular-fire-functions.umd.js +0 -461
  182. package/bundles/angular-fire-functions.umd.js.map +0 -1
  183. package/bundles/angular-fire-messaging.umd.js +0 -473
  184. package/bundles/angular-fire-messaging.umd.js.map +0 -1
  185. package/bundles/angular-fire-performance.umd.js +0 -473
  186. package/bundles/angular-fire-performance.umd.js.map +0 -1
  187. package/bundles/angular-fire-remote-config.umd.js +0 -499
  188. package/bundles/angular-fire-remote-config.umd.js.map +0 -1
  189. package/bundles/angular-fire-storage.umd.js +0 -485
  190. package/bundles/angular-fire-storage.umd.js.map +0 -1
  191. package/bundles/angular-fire.umd.js +0 -308
  192. package/bundles/angular-fire.umd.js.map +0 -1
  193. package/compat/analytics/package.json +0 -11
  194. package/compat/auth/package.json +0 -11
  195. package/compat/auth-guard/package.json +0 -11
  196. package/compat/database/package.json +0 -11
  197. package/compat/firestore/package.json +0 -11
  198. package/compat/functions/package.json +0 -11
  199. package/compat/messaging/package.json +0 -11
  200. package/compat/package.json +0 -11
  201. package/compat/performance/package.json +0 -11
  202. package/compat/remote-config/package.json +0 -11
  203. package/compat/storage/package.json +0 -11
  204. package/database/package.json +0 -11
  205. package/docs/analytics.md +0 -67
  206. package/docs/app-check.md +0 -53
  207. package/docs/auth.md +0 -165
  208. package/docs/compat/analytics/getting-started.md +0 -137
  209. package/docs/compat/auth/getting-started.md +0 -162
  210. package/docs/compat/auth/router-guards.md +0 -104
  211. package/docs/compat/emulators/emulators.md +0 -134
  212. package/docs/compat/firestore/collections.md +0 -326
  213. package/docs/compat/firestore/documents.md +0 -115
  214. package/docs/compat/firestore/offline-data.md +0 -39
  215. package/docs/compat/firestore/querying-collections.md +0 -204
  216. package/docs/compat/functions/functions.md +0 -166
  217. package/docs/compat/messaging/messaging.md +0 -232
  218. package/docs/compat/performance/getting-started.md +0 -132
  219. package/docs/compat/remote-config/getting-started.md +0 -134
  220. package/docs/compat/rtdb/lists.md +0 -257
  221. package/docs/compat/rtdb/objects.md +0 -182
  222. package/docs/compat/rtdb/querying-lists.md +0 -155
  223. package/docs/compat/storage/storage.md +0 -257
  224. package/docs/compat.md +0 -70
  225. package/docs/database.md +0 -175
  226. package/docs/deploy/getting-started.md +0 -204
  227. package/docs/firebase.json +0 -16
  228. package/docs/firestore.md +0 -148
  229. package/docs/functions.md +0 -52
  230. package/docs/images/analytics-illo_1x.png +0 -0
  231. package/docs/images/auth-illo_1x.png +0 -0
  232. package/docs/images/cloud-messaging-illo_1x.png +0 -0
  233. package/docs/images/database-illo_1x.png +0 -0
  234. package/docs/images/firestore-illo_1x.png +0 -0
  235. package/docs/images/functions-illo_1x.png +0 -0
  236. package/docs/images/hosting-illo_1x.png +0 -0
  237. package/docs/images/performance-illo_1x.png +0 -0
  238. package/docs/images/reCAPTCHA-logo@1x.png +0 -0
  239. package/docs/images/remote-config-illo_1x.png +0 -0
  240. package/docs/images/storage-illo_1x.png +0 -0
  241. package/docs/install-and-setup.md +0 -114
  242. package/docs/install-angular-cli-windows10.md +0 -82
  243. package/docs/messaging.md +0 -25
  244. package/docs/performance.md +0 -57
  245. package/docs/remote-config.md +0 -53
  246. package/docs/storage.md +0 -90
  247. package/docs/universal/cloud-functions.md +0 -75
  248. package/docs/universal/getting-started.md +0 -153
  249. package/docs/universal/prerendering.md +0 -72
  250. package/docs/version-4-upgrade.md +0 -119
  251. package/docs/version-5-upgrade.md +0 -82
  252. package/docs/version-6-upgrade.md +0 -16
  253. package/docs/version-7-upgrade.md +0 -298
  254. package/esm2015/analytics/analytics.module.js +0 -93
  255. package/esm2015/analytics/overrides.js +0 -3
  256. package/esm2015/analytics/screen-tracking.service.js +0 -139
  257. package/esm2015/analytics/user-tracking.service.js +0 -43
  258. package/esm2015/app/app.module.js +0 -84
  259. package/esm2015/app-check/app-check.module.js +0 -81
  260. package/esm2015/auth-guard/auth-guard.js +0 -49
  261. package/esm2015/compat/analytics/analytics.js +0 -163
  262. package/esm2015/compat/analytics/screen-tracking.service.js +0 -49
  263. package/esm2015/compat/analytics/user-tracking.service.js +0 -52
  264. package/esm2015/compat/auth/auth.js +0 -139
  265. package/esm2015/compat/auth-guard/auth-guard.js +0 -49
  266. package/esm2015/compat/database/database.js +0 -117
  267. package/esm2015/compat/database/list/create-reference.js +0 -41
  268. package/esm2015/compat/firestore/collection/changes.js +0 -107
  269. package/esm2015/compat/firestore/collection/collection.js +0 -117
  270. package/esm2015/compat/firestore/collection-group/collection-group.js +0 -81
  271. package/esm2015/compat/firestore/document/document.js +0 -82
  272. package/esm2015/compat/firestore/firestore.js +0 -254
  273. package/esm2015/compat/firestore/interfaces.js +0 -2
  274. package/esm2015/compat/firestore/observable/fromRef.js +0 -39
  275. package/esm2015/compat/functions/functions.js +0 -68
  276. package/esm2015/compat/messaging/messaging.js +0 -75
  277. package/esm2015/compat/performance/performance.service.js +0 -27
  278. package/esm2015/compat/proxy.js +0 -61
  279. package/esm2015/compat/remote-config/remote-config.js +0 -193
  280. package/esm2015/compat/storage/pipes/storageUrl.pipe.js +0 -54
  281. package/esm2015/compat/storage/storage.js +0 -94
  282. package/esm2015/core.js +0 -79
  283. package/esm2015/firestore/rxfire.js +0 -13
  284. package/esm2015/messaging/messaging.module.js +0 -85
  285. package/esm2015/messaging/overrides.js +0 -3
  286. package/esm2015/remote-config/overrides.js +0 -3
  287. package/esm2015/remote-config/remote-config.module.js +0 -85
  288. package/esm2015/zones.js +0 -183
  289. package/fesm2015/angular-fire-analytics.js.map +0 -1
  290. package/fesm2015/angular-fire-app-check.js.map +0 -1
  291. package/fesm2015/angular-fire-app.js.map +0 -1
  292. package/fesm2015/angular-fire-auth-guard.js.map +0 -1
  293. package/fesm2015/angular-fire-auth.js.map +0 -1
  294. package/fesm2015/angular-fire-compat-analytics.js.map +0 -1
  295. package/fesm2015/angular-fire-compat-auth-guard.js.map +0 -1
  296. package/fesm2015/angular-fire-compat-auth.js.map +0 -1
  297. package/fesm2015/angular-fire-compat-database.js.map +0 -1
  298. package/fesm2015/angular-fire-compat-firestore.js.map +0 -1
  299. package/fesm2015/angular-fire-compat-functions.js.map +0 -1
  300. package/fesm2015/angular-fire-compat-messaging.js.map +0 -1
  301. package/fesm2015/angular-fire-compat-performance.js.map +0 -1
  302. package/fesm2015/angular-fire-compat-remote-config.js.map +0 -1
  303. package/fesm2015/angular-fire-compat-storage.js.map +0 -1
  304. package/fesm2015/angular-fire-compat.js.map +0 -1
  305. package/fesm2015/angular-fire-database.js.map +0 -1
  306. package/fesm2015/angular-fire-firestore-lite.js.map +0 -1
  307. package/fesm2015/angular-fire-firestore.js.map +0 -1
  308. package/fesm2015/angular-fire-functions.js.map +0 -1
  309. package/fesm2015/angular-fire-messaging.js.map +0 -1
  310. package/fesm2015/angular-fire-performance.js.map +0 -1
  311. package/fesm2015/angular-fire-remote-config.js.map +0 -1
  312. package/fesm2015/angular-fire-storage.js.map +0 -1
  313. package/fesm2015/angular-fire.js.map +0 -1
  314. package/firestore/lite/package.json +0 -11
  315. package/firestore/package.json +0 -11
  316. package/firestore-protos.js +0 -4
  317. package/functions/package.json +0 -11
  318. package/messaging/package.json +0 -11
  319. package/performance/package.json +0 -11
  320. package/remote-config/package.json +0 -11
  321. package/schematics/add/schema.json +0 -16
  322. package/schematics/builders.json +0 -10
  323. package/schematics/collection.json +0 -15
  324. package/schematics/deploy/schema.json +0 -119
  325. package/schematics/migration.json +0 -15
  326. package/schematics/setup/schema.json +0 -16
  327. package/storage/package.json +0 -11
  328. /package/analytics/{angular-fire-analytics.d.ts → index.d.ts} +0 -0
  329. /package/app/{angular-fire-app.d.ts → index.d.ts} +0 -0
  330. /package/app-check/{angular-fire-app-check.d.ts → index.d.ts} +0 -0
  331. /package/auth/{angular-fire-auth.d.ts → index.d.ts} +0 -0
  332. /package/auth-guard/{angular-fire-auth-guard.d.ts → index.d.ts} +0 -0
  333. /package/compat/analytics/{angular-fire-compat-analytics.d.ts → index.d.ts} +0 -0
  334. /package/compat/auth/{angular-fire-compat-auth.d.ts → index.d.ts} +0 -0
  335. /package/compat/auth-guard/{angular-fire-compat-auth-guard.d.ts → index.d.ts} +0 -0
  336. /package/compat/database/{angular-fire-compat-database.d.ts → index.d.ts} +0 -0
  337. /package/compat/firestore/{angular-fire-compat-firestore.d.ts → index.d.ts} +0 -0
  338. /package/compat/functions/{angular-fire-compat-functions.d.ts → index.d.ts} +0 -0
  339. /package/compat/{angular-fire-compat.d.ts → index.d.ts} +0 -0
  340. /package/compat/messaging/{angular-fire-compat-messaging.d.ts → index.d.ts} +0 -0
  341. /package/compat/performance/{angular-fire-compat-performance.d.ts → index.d.ts} +0 -0
  342. /package/compat/remote-config/{angular-fire-compat-remote-config.d.ts → index.d.ts} +0 -0
  343. /package/compat/storage/{angular-fire-compat-storage.d.ts → index.d.ts} +0 -0
  344. /package/database/{angular-fire-database.d.ts → index.d.ts} +0 -0
  345. /package/{esm2015/analytics/analytics.js → esm2022/analytics/analytics.mjs} +0 -0
  346. /package/{esm2015/analytics/angular-fire-analytics.js → esm2022/analytics/angular-fire-analytics.mjs} +0 -0
  347. /package/{esm2015/analytics/firebase.js → esm2022/analytics/firebase.mjs} +0 -0
  348. /package/{esm2015/analytics/public_api.js → esm2022/analytics/public_api.mjs} +0 -0
  349. /package/{esm2015/angular-fire.js → esm2022/angular-fire.mjs} +0 -0
  350. /package/{esm2015/app/angular-fire-app.js → esm2022/app/angular-fire-app.mjs} +0 -0
  351. /package/{esm2015/app/app.js → esm2022/app/app.mjs} +0 -0
  352. /package/{esm2015/app/firebase.js → esm2022/app/firebase.mjs} +0 -0
  353. /package/{esm2015/app/public_api.js → esm2022/app/public_api.mjs} +0 -0
  354. /package/{esm2015/app-check/angular-fire-app-check.js → esm2022/app-check/angular-fire-app-check.mjs} +0 -0
  355. /package/{esm2015/app-check/app-check.js → esm2022/app-check/app-check.mjs} +0 -0
  356. /package/{esm2015/app-check/firebase.js → esm2022/app-check/firebase.mjs} +0 -0
  357. /package/{esm2015/app-check/public_api.js → esm2022/app-check/public_api.mjs} +0 -0
  358. /package/{esm2015/auth/angular-fire-auth.js → esm2022/auth/angular-fire-auth.mjs} +0 -0
  359. /package/{esm2015/auth/auth.js → esm2022/auth/auth.mjs} +0 -0
  360. /package/{esm2015/auth/firebase.js → esm2022/auth/firebase.mjs} +0 -0
  361. /package/{esm2015/auth/public_api.js → esm2022/auth/public_api.mjs} +0 -0
  362. /package/{esm2015/auth/rxfire.js → esm2022/auth/rxfire.mjs} +0 -0
  363. /package/{esm2015/auth-guard/angular-fire-auth-guard.js → esm2022/auth-guard/angular-fire-auth-guard.mjs} +0 -0
  364. /package/{esm2015/auth-guard/public_api.js → esm2022/auth-guard/public_api.mjs} +0 -0
  365. /package/{esm2015/compat/analytics/angular-fire-compat-analytics.js → esm2022/compat/analytics/angular-fire-compat-analytics.mjs} +0 -0
  366. /package/{esm2015/compat/analytics/base.js → esm2022/compat/analytics/base.mjs} +0 -0
  367. /package/{esm2015/compat/analytics/public_api.js → esm2022/compat/analytics/public_api.mjs} +0 -0
  368. /package/{esm2015/compat/angular-fire-compat.js → esm2022/compat/angular-fire-compat.mjs} +0 -0
  369. /package/{esm2015/compat/auth/angular-fire-compat-auth.js → esm2022/compat/auth/angular-fire-compat-auth.mjs} +0 -0
  370. /package/{esm2015/compat/auth/base.js → esm2022/compat/auth/base.mjs} +0 -0
  371. /package/{esm2015/compat/auth-guard/angular-fire-compat-auth-guard.js → esm2022/compat/auth-guard/angular-fire-compat-auth-guard.mjs} +0 -0
  372. /package/{esm2015/compat/auth-guard/public_api.js → esm2022/compat/auth-guard/public_api.mjs} +0 -0
  373. /package/{esm2015/compat/database/angular-fire-compat-database.js → esm2022/compat/database/angular-fire-compat-database.mjs} +0 -0
  374. /package/{esm2015/compat/database/interfaces.js → esm2022/compat/database/interfaces.mjs} +0 -0
  375. /package/{esm2015/compat/database/list/audit-trail.js → esm2022/compat/database/list/audit-trail.mjs} +0 -0
  376. /package/{esm2015/compat/database/list/changes.js → esm2022/compat/database/list/changes.mjs} +0 -0
  377. /package/{esm2015/compat/database/list/data-operation.js → esm2022/compat/database/list/data-operation.mjs} +0 -0
  378. /package/{esm2015/compat/database/list/remove.js → esm2022/compat/database/list/remove.mjs} +0 -0
  379. /package/{esm2015/compat/database/list/snapshot-changes.js → esm2022/compat/database/list/snapshot-changes.mjs} +0 -0
  380. /package/{esm2015/compat/database/list/state-changes.js → esm2022/compat/database/list/state-changes.mjs} +0 -0
  381. /package/{esm2015/compat/database/list/utils.js → esm2022/compat/database/list/utils.mjs} +0 -0
  382. /package/{esm2015/compat/database/object/create-reference.js → esm2022/compat/database/object/create-reference.mjs} +0 -0
  383. /package/{esm2015/compat/database/object/snapshot-changes.js → esm2022/compat/database/object/snapshot-changes.mjs} +0 -0
  384. /package/{esm2015/compat/database/observable/fromRef.js → esm2022/compat/database/observable/fromRef.mjs} +0 -0
  385. /package/{esm2015/compat/database/public_api.js → esm2022/compat/database/public_api.mjs} +0 -0
  386. /package/{esm2015/compat/database/utils.js → esm2022/compat/database/utils.mjs} +0 -0
  387. /package/{esm2015/compat/firebase.app.js → esm2022/compat/firebase.app.mjs} +0 -0
  388. /package/{esm2015/compat/firestore/angular-fire-compat-firestore.js → esm2022/compat/firestore/angular-fire-compat-firestore.mjs} +0 -0
  389. /package/{esm2015/compat/firestore/public_api.js → esm2022/compat/firestore/public_api.mjs} +0 -0
  390. /package/{esm2015/compat/functions/angular-fire-compat-functions.js → esm2022/compat/functions/angular-fire-compat-functions.mjs} +0 -0
  391. /package/{esm2015/compat/functions/base.js → esm2022/compat/functions/base.mjs} +0 -0
  392. /package/{esm2015/compat/messaging/angular-fire-compat-messaging.js → esm2022/compat/messaging/angular-fire-compat-messaging.mjs} +0 -0
  393. /package/{esm2015/compat/messaging/base.js → esm2022/compat/messaging/base.mjs} +0 -0
  394. /package/{esm2015/compat/messaging/public_api.js → esm2022/compat/messaging/public_api.mjs} +0 -0
  395. /package/{esm2015/compat/performance/angular-fire-compat-performance.js → esm2022/compat/performance/angular-fire-compat-performance.mjs} +0 -0
  396. /package/{esm2015/compat/performance/base.js → esm2022/compat/performance/base.mjs} +0 -0
  397. /package/{esm2015/compat/performance/public_api.js → esm2022/compat/performance/public_api.mjs} +0 -0
  398. /package/{esm2015/compat/public_api.js → esm2022/compat/public_api.mjs} +0 -0
  399. /package/{esm2015/compat/remote-config/angular-fire-compat-remote-config.js → esm2022/compat/remote-config/angular-fire-compat-remote-config.mjs} +0 -0
  400. /package/{esm2015/compat/remote-config/base.js → esm2022/compat/remote-config/base.mjs} +0 -0
  401. /package/{esm2015/compat/remote-config/interfaces.js → esm2022/compat/remote-config/interfaces.mjs} +0 -0
  402. /package/{esm2015/compat/remote-config/public_api.js → esm2022/compat/remote-config/public_api.mjs} +0 -0
  403. /package/{esm2015/compat/storage/angular-fire-compat-storage.js → esm2022/compat/storage/angular-fire-compat-storage.mjs} +0 -0
  404. /package/{esm2015/compat/storage/interfaces.js → esm2022/compat/storage/interfaces.mjs} +0 -0
  405. /package/{esm2015/compat/storage/observable/fromTask.js → esm2022/compat/storage/observable/fromTask.mjs} +0 -0
  406. /package/{esm2015/compat/storage/public_api.js → esm2022/compat/storage/public_api.mjs} +0 -0
  407. /package/{esm2015/compat/storage/ref.js → esm2022/compat/storage/ref.mjs} +0 -0
  408. /package/{esm2015/compat/storage/task.js → esm2022/compat/storage/task.mjs} +0 -0
  409. /package/{esm2015/database/angular-fire-database.js → esm2022/database/angular-fire-database.mjs} +0 -0
  410. /package/{esm2015/database/database.js → esm2022/database/database.mjs} +0 -0
  411. /package/{esm2015/database/firebase.js → esm2022/database/firebase.mjs} +0 -0
  412. /package/{esm2015/database/public_api.js → esm2022/database/public_api.mjs} +0 -0
  413. /package/{esm2015/database/rxfire.js → esm2022/database/rxfire.mjs} +0 -0
  414. /package/{esm2015/firestore/angular-fire-firestore.js → esm2022/firestore/angular-fire-firestore.mjs} +0 -0
  415. /package/{esm2015/firestore/firebase.js → esm2022/firestore/firebase.mjs} +0 -0
  416. /package/{esm2015/firestore/firestore.js → esm2022/firestore/firestore.mjs} +0 -0
  417. /package/{esm2015/firestore/lite/angular-fire-firestore-lite.js → esm2022/firestore/lite/angular-fire-firestore-lite.mjs} +0 -0
  418. /package/{esm2015/firestore/lite/firebase.js → esm2022/firestore/lite/firebase.mjs} +0 -0
  419. /package/{esm2015/firestore/lite/lite.js → esm2022/firestore/lite/lite.mjs} +0 -0
  420. /package/{esm2015/firestore/lite/public_api.js → esm2022/firestore/lite/public_api.mjs} +0 -0
  421. /package/{esm2015/firestore/lite/rxfire.js → esm2022/firestore/lite/rxfire.mjs} +0 -0
  422. /package/{esm2015/firestore/public_api.js → esm2022/firestore/public_api.mjs} +0 -0
  423. /package/{esm2015/functions/angular-fire-functions.js → esm2022/functions/angular-fire-functions.mjs} +0 -0
  424. /package/{esm2015/functions/firebase.js → esm2022/functions/firebase.mjs} +0 -0
  425. /package/{esm2015/functions/functions.js → esm2022/functions/functions.mjs} +0 -0
  426. /package/{esm2015/functions/public_api.js → esm2022/functions/public_api.mjs} +0 -0
  427. /package/{esm2015/functions/rxfire.js → esm2022/functions/rxfire.mjs} +0 -0
  428. /package/{esm2015/messaging/angular-fire-messaging.js → esm2022/messaging/angular-fire-messaging.mjs} +0 -0
  429. /package/{esm2015/messaging/firebase.js → esm2022/messaging/firebase.mjs} +0 -0
  430. /package/{esm2015/messaging/messaging.js → esm2022/messaging/messaging.mjs} +0 -0
  431. /package/{esm2015/messaging/public_api.js → esm2022/messaging/public_api.mjs} +0 -0
  432. /package/{esm2015/performance/angular-fire-performance.js → esm2022/performance/angular-fire-performance.mjs} +0 -0
  433. /package/{esm2015/performance/firebase.js → esm2022/performance/firebase.mjs} +0 -0
  434. /package/{esm2015/performance/performance.js → esm2022/performance/performance.mjs} +0 -0
  435. /package/{esm2015/performance/public_api.js → esm2022/performance/public_api.mjs} +0 -0
  436. /package/{esm2015/performance/rxfire.js → esm2022/performance/rxfire.mjs} +0 -0
  437. /package/{esm2015/public_api.js → esm2022/public_api.mjs} +0 -0
  438. /package/{esm2015/remote-config/angular-fire-remote-config.js → esm2022/remote-config/angular-fire-remote-config.mjs} +0 -0
  439. /package/{esm2015/remote-config/firebase.js → esm2022/remote-config/firebase.mjs} +0 -0
  440. /package/{esm2015/remote-config/public_api.js → esm2022/remote-config/public_api.mjs} +0 -0
  441. /package/{esm2015/remote-config/remote-config.js → esm2022/remote-config/remote-config.mjs} +0 -0
  442. /package/{esm2015/remote-config/rxfire.js → esm2022/remote-config/rxfire.mjs} +0 -0
  443. /package/{esm2015/storage/angular-fire-storage.js → esm2022/storage/angular-fire-storage.mjs} +0 -0
  444. /package/{esm2015/storage/firebase.js → esm2022/storage/firebase.mjs} +0 -0
  445. /package/{esm2015/storage/public_api.js → esm2022/storage/public_api.mjs} +0 -0
  446. /package/{esm2015/storage/rxfire.js → esm2022/storage/rxfire.mjs} +0 -0
  447. /package/{esm2015/storage/storage.js → esm2022/storage/storage.mjs} +0 -0
  448. /package/firestore/{angular-fire-firestore.d.ts → index.d.ts} +0 -0
  449. /package/firestore/lite/{angular-fire-firestore-lite.d.ts → index.d.ts} +0 -0
  450. /package/functions/{angular-fire-functions.d.ts → index.d.ts} +0 -0
  451. /package/{angular-fire.d.ts → index.d.ts} +0 -0
  452. /package/messaging/{angular-fire-messaging.d.ts → index.d.ts} +0 -0
  453. /package/performance/{angular-fire-performance.d.ts → index.d.ts} +0 -0
  454. /package/remote-config/{angular-fire-remote-config.d.ts → index.d.ts} +0 -0
  455. /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&hellip;</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).