@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,134 +0,0 @@
1
- # Connect your app and start prototyping
2
-
3
- In this guide, we'll look at how to use `@angular/fire` to connect an Angular application with Firebase Emulator Suite to start prototyping your apps.
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
- There are four supported emulators, all of them available at the Firebase suite workflow:
8
-
9
- - [Authentication Emulator](https://firebase.google.com/docs/emulator-suite/connect_auth)
10
- - [Realtime Database Emulator](https://firebase.google.com/docs/emulator-suite/connect_rtdb)
11
- - [Cloud Firestore Emulator](https://firebase.google.com/docs/emulator-suite/connect_firestore)
12
- - [Cloud Functions Emulator](https://firebase.google.com/docs/emulator-suite/connect_functions)
13
-
14
- **The Auth Emulator only works with Firebase v8 and above, which is supported by `@angular/fire` 6.1.0 or higher**.
15
-
16
- Before configuring these emulators at the Angular App, be sure to install the ones you need by following the [Install, configure and integrate Local Emulator Suite](https://firebase.google.com/docs/emulator-suite/install_and_configure) documentation.
17
-
18
- _**TL;DR**_
19
-
20
- Initialize firebase to your project (if you haven't) by running:
21
-
22
- ```shell
23
- firebase init
24
- ```
25
-
26
- Then launch the emulator setup wizard by running:
27
-
28
- ```shell
29
- firebase init emulators
30
- ```
31
-
32
- Follow the instructions to download whatever emulator you want to use then checkout that the `firebase.json` file got updated with the default ports per emulator, something like this:
33
-
34
- ```jsonc
35
- {
36
- // Existing firebase configuration ...
37
- // Optional emulator configuration. Default
38
- // values are used if absent.
39
- "emulators": {
40
- "firestore": {
41
- "port": "8080"
42
- },
43
- "ui": {
44
- "enabled": true, // Default is `true`
45
- "port": 4000 // If unspecified, see CLI log for selected port
46
- },
47
- "auth": {
48
- "port": "9099"
49
- },
50
- "functions": {
51
- "port": "5001"
52
- },
53
- "database": {
54
- "port": "9000"
55
- },
56
- "pubsub": {
57
- "port": "8085"
58
- }
59
- }
60
- }
61
- ```
62
-
63
- ## Import the DI Tokens at your AppModule
64
-
65
- Configuring your app to connect to local emulators is easily done by using dependency injection tokens provided by the library. However, there are slighty changes between 6.0.0 and 6.1.0 in the way it was done.
66
-
67
- ### 6.1.0 Method
68
-
69
- Each module (database, firestore, auth, function) provides `USE_EMULATOR` token to configure the emulator `host` and `port` by passing a tuple of `[string, number]` values, which are set by default to `localhost` and the asigned port from your `firebase.json` file.
70
-
71
- Import these tokens at your `app.module.ts` as follow:
72
-
73
- ```ts
74
- import { USE_EMULATOR as USE_AUTH_EMULATOR } from '@angular/fire/compat/auth';
75
- import { USE_EMULATOR as USE_DATABASE_EMULATOR } from '@angular/fire/compat/database';
76
- import { USE_EMULATOR as USE_FIRESTORE_EMULATOR } from '@angular/fire/compat/firestore';
77
- import { USE_EMULATOR as USE_FUNCTIONS_EMULATOR } from '@angular/fire/compat/functions';
78
-
79
- @NgModule({
80
- // ... Existing configuration
81
- providers: [
82
- // ... Existing Providers
83
- { provide: USE_AUTH_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9099] : undefined },
84
- { provide: USE_DATABASE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9000] : undefined },
85
- { provide: USE_FIRESTORE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 8080] : undefined },
86
- { provide: USE_FUNCTIONS_EMULATOR, useValue: environment.useEmulators ? ['localhost', 5001] : undefined },
87
- ]
88
- })
89
- export class AppModule { }
90
- ```
91
-
92
- The environment `useEmulators` flag is used to control whenever the app should connect to the emulators, which is usually done in non-production environments.
93
-
94
- Also you can opt-in the new way of setting the Cloud Functions [origin](https://firebase.google.com/docs/functions/locations) in Firebase v8 by using the `NEW_ORIGIN_BEHAVIOR` token in conjuction with the already present `ORIGIN` token.
95
-
96
- ```ts
97
- import { isDevMode, NgModule } from '@angular/core';
98
- import { ORIGIN as FUNCTIONS_ORIGIN, NEW_ORIGIN_BEHAVIOR } from '@angular/fire/compat/functions';
99
-
100
- @NgModule({
101
- // ... Existing configuration
102
- providers: [
103
- // ... Existing Providers
104
- { provide: NEW_ORIGIN_BEHAVIOR, useValue: true },
105
- { provide: FUNCTIONS_ORIGIN, useFactory: () => isDevMode() ? undefined : location.origin },
106
- ]
107
- })
108
- export class AppModule { }
109
- ```
110
-
111
- ### 6.0.0 Method
112
-
113
- With the exception of the Auth Emulator, the old way of setting the `host` and `port` for each emulator was done using a different set of tokens by passing the entire url path as string.
114
-
115
- ```ts
116
- import { URL as DATABASE_URL } from '@angular/fire/compat/database';
117
- import { ORIGIN as FUNCTIONS_ORIGIN } from '@angular/fire/compat/functions';
118
- import { SETTINGS as FIRESTORE_SETTINGS } from '@angular/fire/compat/firestore';
119
-
120
- @NgModule({
121
- // ... Existing configuration
122
- providers: [
123
- {
124
- provide: DATABASE_URL,
125
- useValue: environment.useEmulators ? `http://localhost:9000?ns=${environment.firebase.projectId}` : undefined
126
- },
127
- { provide: FIRESTORE_SETTINGS, useValue: environment.useEmulators ? { host: 'localhost:8080', ssl: false } : {} },
128
- { provide: FUNCTIONS_ORIGIN, useFactory: environment.useEmulators ? 'http://localhost:5001' : undefined },
129
- ]
130
- })
131
- export class AppModule { }
132
- ```
133
-
134
- For older versions, please upgrade your app to latest version to get the advantages of these new features :rocket:
@@ -1,326 +0,0 @@
1
- # 3. Collections in AngularFirestore
2
-
3
- > Cloud Firestore is a NoSQL, document-oriented database. Unlike a SQL database, there are no tables or rows. Instead, you store data in *documents*, which are organized into *collections*.
4
- Each *document* contains a set of key-value pairs. Cloud Firestore is optimized for storing large collections of small documents.
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
- ## Using `AngularFirestoreCollection`
9
-
10
- The `AngularFirestoreCollection` service is a wrapper around the native Firestore SDK's [`CollectionReference`](https://firebase.google.com/docs/reference/js/firebase.firestore.CollectionReference) and [`Query`](https://firebase.google.com/docs/reference/js/firebase.firestore.Query) types. It is a generic service that provides you with a strongly typed set of methods for manipulating and streaming data. This service is designed for use as an `@Injectable()`.
11
-
12
- ```ts
13
- import { Component } from '@angular/core';
14
- import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/compat/firestore';
15
- import { Observable } from 'rxjs';
16
-
17
- export interface Item { name: string; }
18
-
19
- @Component({
20
- selector: 'app-root',
21
- template: `
22
- <ul>
23
- <li *ngFor="let item of items | async">
24
- {{ item.name }}
25
- </li>
26
- </ul>
27
- `
28
- })
29
- export class AppComponent {
30
- private itemsCollection: AngularFirestoreCollection<Item>;
31
- items: Observable<Item[]>;
32
- constructor(private afs: AngularFirestore) {
33
- this.itemsCollection = afs.collection<Item>('items');
34
- this.items = this.itemsCollection.valueChanges();
35
- }
36
- addItem(item: Item) {
37
- this.itemsCollection.add(item);
38
- }
39
- }
40
- ```
41
-
42
- The `AngularFirestoreCollection` is a service you use to create streams of the collection and perform data operations on the underyling collection.
43
-
44
- ### The `DocumentChangeAction` type
45
-
46
- With the exception of the `valueChanges()`, each streaming method returns an Observable of `DocumentChangeAction[]`.
47
-
48
- A `DocumentChangeAction` gives you the `type` and `payload` properties. The `type` tells when what `DocumentChangeType` operation occured (`added`, `modified`, `removed`). The `payload` property is a `DocumentChange` which provides you important metadata about the change and a `doc` property which is the `DocumentSnapshot`.
49
-
50
- ```ts
51
- interface DocumentChangeAction {
52
- //'added' | 'modified' | 'removed';
53
- type: DocumentChangeType;
54
- payload: DocumentChange;
55
- }
56
-
57
- interface DocumentChange {
58
- type: DocumentChangeType;
59
- doc: DocumentSnapshot;
60
- oldIndex: number;
61
- newIndex: number;
62
- }
63
-
64
- interface DocumentSnapshot {
65
- exists: boolean;
66
- ref: DocumentReference;
67
- id: string;
68
- metadata: SnapshotMetadata;
69
- data(): DocumentData;
70
- get(fieldPath: string): any;
71
- }
72
- ```
73
-
74
- ## Streaming collection data
75
-
76
- There are multiple ways of streaming collection data from Firestore.
77
-
78
- ### `valueChanges({ idField?: string })`
79
-
80
- **What is it?** - The current state of your collection. Returns an Observable of data as a synchronized array of JSON objects. All Snapshot metadata is stripped and just the document data is included. Optionally, you can pass an options object with an `idField` key containing a string. If provided, the returned JSON objects will include their document ID mapped to a property with the name provided by `idField`.
81
-
82
- **Why would you use it?** - When you just need a list of data. No document metadata is attached to the resulting array which makes it simple to render to a view.
83
-
84
- **When would you not use it?** - When you need a more complex data structure than an array.
85
-
86
- **Best practices** - Use this method to display data on a page. It's simple but effective. Use `.snapshotChanges()` once your needs become more complex.
87
-
88
- #### Example of persisting a Document Id
89
-
90
- ```ts
91
- import { Component } from '@angular/core';
92
- import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/compat/firestore';
93
- import { Observable } from 'rxjs';
94
-
95
- export interface Item { id: string; name: string; }
96
-
97
- @Component({
98
- selector: 'app-root',
99
- template: `
100
- <ul>
101
- <li *ngFor="let item of items | async">
102
- {{ item.name }}
103
- </li>
104
- </ul>
105
- `
106
- })
107
- export class AppComponent {
108
- private itemsCollection: AngularFirestoreCollection<Item>;
109
- items: Observable<Item[]>;
110
- constructor(private readonly afs: AngularFirestore) {
111
- this.itemsCollection = afs.collection<Item>('items');
112
- this.items = this.itemsCollection.valueChanges({ idField: 'customID' });
113
- }
114
- addItem(name: string) {
115
- // Persist a document id
116
- const id = this.afs.createId();
117
- const item: Item = { id, name };
118
- this.itemsCollection.doc(id).set(item);
119
- }
120
- }
121
- ```
122
-
123
- ### `snapshotChanges()`
124
-
125
- **What is it?** - The current state of your collection. Returns an Observable of data as a synchronized array of `DocumentChangeAction[]`.
126
-
127
- **Why would you use it?** - When you need a list of data but also want to keep around metadata. Metadata provides you the underyling `DocumentReference`, document id, and array index of the single document. Having the document's id around makes it easier to use data manipulation methods. This method gives you more horsepower with other Angular integrations such as ngrx, forms, and animations due to the `type` property. The `type` property on each `DocumentChangeAction` is useful for ngrx reducers, form states, and animation states.
128
-
129
- **When would you not use it?** - When you need a more complex data structure than an array or if you need to process changes as they occur. This array is synchronized with the remote and local changes in Firestore.
130
-
131
- **Best practices** - Use an observable operator to transform your data from `.snapshotChanges()`. Don't return the `DocumentChangeAction[]` to the template. See the example below.
132
-
133
- #### Example
134
-
135
- ```ts
136
- import { Component } from '@angular/core';
137
- import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/compat/firestore';
138
- import { Observable } from 'rxjs';
139
- import { map } from 'rxjs/operators';
140
-
141
- export interface Shirt { name: string; price: number; }
142
- export interface ShirtId extends Shirt { id: string; }
143
-
144
- @Component({
145
- selector: 'app-root',
146
- template: `
147
- <ul>
148
- <li *ngFor="let shirt of shirts | async">
149
- {{ shirt.name }} is {{ shirt.price }}
150
- </li>
151
- </ul>
152
- `
153
- })
154
- export class AppComponent {
155
- private shirtCollection: AngularFirestoreCollection<Shirt>;
156
- shirts: Observable<ShirtId[]>;
157
- constructor(private readonly afs: AngularFirestore) {
158
- this.shirtCollection = afs.collection<Shirt>('shirts');
159
- // .snapshotChanges() returns a DocumentChangeAction[], which contains
160
- // a lot of information about "what happened" with each change. If you want to
161
- // get the data and the id use the map operator.
162
- this.shirts = this.shirtCollection.snapshotChanges().pipe(
163
- map(actions => actions.map(a => {
164
- const data = a.payload.doc.data() as Shirt;
165
- const id = a.payload.doc.id;
166
- return { id, ...data };
167
- }))
168
- );
169
- }
170
- }
171
- ```
172
-
173
- ### `stateChanges()`
174
-
175
- **What is it?** - Returns an Observable of the most recent changes as a `DocumentChangeAction[]`.
176
-
177
- **Why would you use it?** - The above methods return a synchronized array sorted in query order. `stateChanges()` emits changes as they occur rather than syncing the query order. This works well for ngrx integrations as you can build your own data structure in your reducer methods.
178
-
179
- **When would you not use it?** - When you just need a list of data. This is a more advanced usage of AngularFirestore.
180
-
181
- #### Example
182
-
183
- ```ts
184
- import { Component } from '@angular/core';
185
- import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/compat/firestore';
186
- import { Observable } from 'rxjs';
187
- import { map } from 'rxjs/operators';
188
-
189
- export interface AccountDeposit { description: string; amount: number; }
190
- export interface AccountDepositId extends AccountDeposit { id: string; }
191
-
192
- @Component({
193
- selector: 'app-root',
194
- template: `
195
- <ul>
196
- <li *ngFor="let deposit of deposits | async">
197
- {{ deposit.description }} for {{ deposit.amount }}
198
- </li>
199
- </ul>
200
- `
201
- })
202
- export class AppComponent {
203
- private depositCollection: AngularFirestoreCollection<AccountDeposit>;
204
- deposits: Observable<AccountDepositId[]>;
205
- constructor(private readonly afs: AngularFirestore) {
206
- this.depositCollection = afs.collection<AccountDeposit>('deposits');
207
- this.deposits = this.depositCollection.stateChanges(['added']).pipe(
208
- map(actions => actions.map(a => {
209
- const data = a.payload.doc.data() as AccountDeposit;
210
- const id = a.payload.doc.id;
211
- return { id, ...data };
212
- }))
213
- );
214
- }
215
- }
216
- ```
217
-
218
- ### `auditTrail()`
219
-
220
- **What is it?** - Returns an Observable of `DocumentChangeAction[]` as they occur. Similar to `stateChanges()`, but instead it keeps around the trail of events as an array.
221
-
222
- **Why would you use it?** - This method is like `stateChanges()` except it is not ephemeral. It collects each change in an array as they occur. This is useful for ngrx integrations where you need to replay the entire state of an application. This also works as a great debugging tool for all applications. You can simply write `afs.collection('items').auditTrail().subscribe(console.log)` and check the events in the console as they occur.
223
-
224
- **When would you not use it?** - When you just need a list of data. This is a more advanced usage of AngularFirestore.
225
-
226
- #### Example
227
-
228
- ```ts
229
- import { Component } from '@angular/core';
230
- import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/compat/firestore';
231
- import { Observable } from 'rxjs';
232
- import { map } from 'rxjs/operators';
233
-
234
- export interface AccountLogItem { description: string; amount: number; }
235
- export interface AccountLogItemId extends AccountLogItem { id: string; }
236
-
237
- @Component({
238
- selector: 'app-root',
239
- template: `
240
- <ul>
241
- <li *ngFor="let log of accountLogs | async">
242
- {{ log.description }} for {{ log.amount }}
243
- </li>
244
- </ul>
245
- `
246
- })
247
- export class AppComponent {
248
- private accountLogCollection: AngularFirestoreCollection<AccountLogItem>;
249
- accountLogs: Observable<AccountLogItemId[]>;
250
- constructor(private readonly afs: AngularFirestore) {
251
- this.accountLogCollection = afs.collection<AccountLogItem>('accountLog');
252
- this.accountLogs = this.accountLogCollection.auditTrail().pipe(
253
- map(actions => actions.map(a => {
254
- const data = a.payload.doc.data() as AccountLogItem;
255
- const id = a.payload.doc.id;
256
- return { id, ...data };
257
- }))
258
- );
259
- }
260
- }
261
- ```
262
-
263
- ### Limiting events
264
-
265
- There are three `DocumentChangeType`s in Firestore: `added`, `removed`, and `modified`. Each streaming method listens to all three by default. However, you may only be interested in one of these events. You can specify which events you'd like to use through the first parameter of each method:
266
-
267
- #### Basic example
268
-
269
- ```ts
270
- constructor(private afs: AngularFirestore): {
271
- this.itemsCollection = afs.collection<Item>('items');
272
- this.items = this.itemsCollection.snapshotChanges(['added', 'removed']);
273
- }
274
- ```
275
-
276
- #### Component example
277
-
278
- ```ts
279
- import { Component } from '@angular/core';
280
- import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/compat/firestore';
281
- import { Observable } from 'rxjs';
282
-
283
- @Component({
284
- selector: 'app-root',
285
- template: `
286
- <ul>
287
- <li *ngFor="let item of items | async">
288
- {{ item.name }}
289
- </li>
290
- </ul>
291
- `
292
- })
293
- export class AppComponent {
294
- private itemsCollection: AngularFirestoreCollection<Item>;
295
- items: Observable<Item[]>;
296
- constructor(private afs: AngularFirestore) {
297
- this.itemsCollection = afs.collection<Item>('items');
298
- this.items = this.itemsCollection.valueChanges(['added', 'removed']);
299
- }
300
- }
301
- ```
302
-
303
- ## State based vs. action based
304
-
305
- Each one of these methods falls into two categories: state based and action based. State based methods return the state of your collection "as-is". Whereas action based methods return "what happened" in your collection.
306
-
307
- For example, a user updates the third item in a list. In a state based method like `.valueChanges()` will update the third item in the collection and return an array of JSON data. This is how your state looks.
308
-
309
- ## Adding documents to a collection
310
-
311
- To add a new document to a collection with a generated id use the `add()` method. This method uses the type provided by the generic class to validate it's type structure.
312
-
313
- #### Basic example
314
-
315
- ```ts
316
- constructor(private afs: AngularFirestore): {
317
- const shirtsCollection = afs.collection<Item>('tshirts');
318
- shirtsCollection.add({ name: 'item', price: 10 });
319
- }
320
- ```
321
-
322
- ## Manipulating individual documents
323
-
324
- To retrieve, update, or delete an individual document you can use the `doc()` method. This method returns an `AngularFirestoreDocument`, which provides methods for streaming, updating, and deleting. [See Using Documents with AngularFirestore for more information on how to use documents](documents.md).
325
-
326
- ### [Next Step: Querying Collections in AngularFirestore](querying-collections.md)
@@ -1,115 +0,0 @@
1
- # 2. Documents in AngularFirestore
2
-
3
- > Cloud Firestore is a NoSQL, document-oriented database. Unlike a SQL database, there are no tables or rows. Instead, you store data in *documents*, which are organized into *collections*.
4
- Each *document* contains a set of key-value pairs. Cloud Firestore is optimized for storing large collections of small documents.
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
- ## Using `AngularFirestoreDocument`
9
-
10
- The `AngularFirestoreDocument` service is a wrapper around the native Firestore SDK's [`DocumentReference` type](https://firebase.google.com/docs/reference/js/firebase.firestore.DocumentReference). It is a generic service that provides you with a strongly typed set of methods for manipulating and streaming data. This service is designed for use as an `@Injectable()`.
11
-
12
- ```ts
13
- import { Component } from '@angular/core';
14
- import { AngularFirestore, AngularFirestoreDocument } from '@angular/fire/compat/firestore';
15
- import { Observable } from 'rxjs';
16
-
17
- export interface Item { name: string; }
18
-
19
- @Component({
20
- selector: 'app-root',
21
- template: `
22
- <div>
23
- {{ (item | async)?.name }}
24
- </div>
25
- `
26
- })
27
- export class AppComponent {
28
- private itemDoc: AngularFirestoreDocument<Item>;
29
- item: Observable<Item>;
30
- constructor(private afs: AngularFirestore) {
31
- this.itemDoc = afs.doc<Item>('items/1');
32
- this.item = this.itemDoc.valueChanges();
33
- }
34
- update(item: Item) {
35
- this.itemDoc.update(item);
36
- }
37
- }
38
- ```
39
-
40
- ### The `DocumentChangeAction` type
41
-
42
- With the exception of the `valueChanges()`, each streaming method returns an Observable of `DocumentChangeAction[]`.
43
-
44
- A `DocumentChangeAction` gives you the `type` and `payload` properties. The `type` tells when what `DocumentChangeType` operation occured (`added`, `modified`, `removed`). The `payload` property is a `DocumentChange` which provides you important metadata about the change and a `doc` property which is the `DocumentSnapshot`.
45
-
46
- ```ts
47
- interface DocumentChangeAction {
48
- //'added' | 'modified' | 'removed';
49
- type: DocumentChangeType;
50
- payload: DocumentSnapshot;
51
- }
52
-
53
- interface DocumentChange {
54
- type: DocumentChangeType;
55
- doc: DocumentSnapshot;
56
- oldIndex: number;
57
- newIndex: number;
58
- }
59
-
60
- interface DocumentSnapshot {
61
- exists: boolean;
62
- ref: DocumentReference;
63
- id: string;
64
- metadata: SnapshotMetadata;
65
- data(): DocumentData;
66
- get(fieldPath: string): any;
67
- }
68
- ```
69
-
70
- ## Streaming document data
71
-
72
- There are multiple ways of streaming collection data from Firestore.
73
-
74
- ### `valueChanges({ idField?: string })`
75
-
76
- **What is it?** - Returns an Observable of document data. All Snapshot metadata is stripped. This method provides only the data. Optionally, you can pass an options object with an `idField` key containing a string. If provided, the returned object will include its document ID mapped to a property with the name provided by `idField`.
77
-
78
- **Why would you use it?** - When you just need the object data. No document metadata is attached which makes it simple to render to a view.
79
-
80
- **When would you not use it?** - When you need document metadata.
81
-
82
- ### `snapshotChanges()`
83
-
84
- **What is it?** - Returns an Observable of data as a `DocumentChangeAction`.
85
-
86
- **Why would you use it?** - When you need the document data but also want to keep around metadata. This metadata provides you the underyling `DocumentReference` and document id. Having the document's id around makes it easier to use data manipulation methods. This method gives you more horsepower with other Angular integrations such as ngrx, forms, and animations due to the `type` property. The `type` property on each `DocumentChangeAction` is useful for ngrx reducers, form states, and animation states.
87
-
88
- **When would you not use it?** - When you simply need to render data to a view and don't want to do any extra processing.
89
-
90
- ## Manipulating documents
91
-
92
- AngularFirestore provides methods for setting, updating, and deleting document data.
93
-
94
- - `set(data: T)` - Destructively updates a document's data.
95
- - `update(data: T)` - Non-destructively updates a document's data.
96
- - `delete()` - Deletes an entire document. Does not delete any nested collections.
97
-
98
- ## Querying?
99
-
100
- Querying has no effect on documents. Documents are a single object and querying effects a range of multiple documents. If you are looking for querying then you want to use a collection.
101
-
102
- ## Retrieving nested collections
103
-
104
- Nesting collections is a great way to structure your data. This allows you to group related data structures together. If you are creating a "Task List" site, you can group "tasks" under a user: `user/<uid>/tasks`.
105
-
106
- To retrieve a nested collection use the `collection(path: string)` method.
107
-
108
- ```ts
109
- constructor(private afs: AngularFirestore) {
110
- this.userDoc = afs.doc<Item>('user/david');
111
- this.tasks = this.userDoc.collection<Task>('tasks').valueChanges();
112
- }
113
- ```
114
-
115
- ### [Next Step: Collections in AngularFirestore](collections.md)
@@ -1,39 +0,0 @@
1
- # Offline Data in Firestore
2
-
3
- > Cloud Firestore supports offline data persistence. This feature caches a copy of the Cloud Firestore data that your app is actively using, so your app can access the data when the device is offline. You can write, read, listen to, and query the cached data. When the device comes back online, Cloud Firestore synchronizes any local changes made by your app to the data stored remotely in Cloud Firestore.
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
- **Offline persistence is an experimental feature that is supported only by the Chrome, Safari, and Firefox web browsers.** If a user opens multiple browser tabs that point to the same Cloud Firestore database, and offline persistence is enabled, Cloud Firestore will work correctly only in the first tab.
8
-
9
- ## Enable Offline Data in AngularFirestore
10
-
11
- To enable offline persistence in your AngularFire application, call `enablePersistence()` when you are importing `AngularFirestoreModule` into your `@NgModule`:
12
-
13
- ```ts
14
- import { BrowserModule } from '@angular/platform-browser';
15
- import { NgModule } from '@angular/core';
16
- import { AppComponent } from './app.component';
17
- import { AngularFireModule } from '@angular/fire/compat';
18
- import { AngularFirestoreModule } from '@angular/fire/compat/firestore';
19
- import { AngularFireAuthModule } from '@angular/fire/compat/auth';
20
- import { environment } from '../environments/environment';
21
-
22
- @NgModule({
23
- imports: [
24
- BrowserModule,
25
- AngularFireModule.initializeApp(environment.firebase),
26
- AngularFirestoreModule.enablePersistence(),
27
- ],
28
- declarations: [ AppComponent ],
29
- bootstrap: [ AppComponent ]
30
- })
31
- export class AppModule {}
32
-
33
- ```
34
-
35
- While offline your listeners will receive listen events when the locally cached data changes. You can use to Documents and Collections normally.
36
-
37
- To check whether you're receiving data from the server or the cache, use the `fromCache` property on the `SnapshotMetadata` in your snapshot event. If `fromCache` is true, the data came from the cache and might be stale or incomplete. If `fromCache` is false, the data is complete and current with the latest updates on the server.
38
-
39
- [To learn more about Offline Persistence in Firestore, check out the Firebase documentation](https://firebase.google.com/docs/firestore/enable-offline).