@glissandoo/lib 1.32.8 → 1.32.10

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 (304) hide show
  1. package/{lib/models → models}/Communication/Comment/index.d.ts +1 -1
  2. package/{lib/models → models}/Communication/Comment/types.d.ts +1 -1
  3. package/{lib/models → models}/Communication/index.d.ts +4 -4
  4. package/{lib/models → models}/Communication/types.d.ts +1 -1
  5. package/{lib/models → models}/Counters/Group/Analytics/index.d.ts +2 -2
  6. package/{lib/models → models}/Counters/Group/Analytics/types.d.ts +1 -1
  7. package/{lib/models → models}/Counters/Group/index.d.ts +2 -2
  8. package/{lib/models → models}/Counters/Group/types.d.ts +1 -1
  9. package/{lib/models → models}/Counters/event.d.ts +1 -1
  10. package/{lib/models → models}/Counters/index.d.ts +1 -1
  11. package/{lib/models → models}/Evento/Player/index.d.ts +1 -1
  12. package/{lib/models → models}/Evento/Player/types.d.ts +1 -1
  13. package/{lib/models → models}/Evento/Repertory/index.d.ts +1 -1
  14. package/{lib/models → models}/Evento/Repertory/types.d.ts +1 -1
  15. package/{lib/models → models}/Evento/basic.d.ts +3 -3
  16. package/{lib/models → models}/Evento/index.d.ts +7 -7
  17. package/{lib/models → models}/Evento/promoter.d.ts +1 -1
  18. package/{lib/models → models}/Evento/types.d.ts +1 -1
  19. package/{lib/models → models}/Federation/Partnership/index.d.ts +3 -3
  20. package/{lib/models → models}/Federation/Partnership/types.d.ts +1 -1
  21. package/{lib/models → models}/Federation/index.d.ts +4 -4
  22. package/{lib/models → models}/Federation/types.d.ts +1 -1
  23. package/{lib/models → models}/Group/Analytics/index.d.ts +1 -1
  24. package/{lib/models → models}/Group/Analytics/types.d.ts +1 -1
  25. package/{lib/models → models}/Group/Event/index.d.ts +2 -2
  26. package/{lib/models → models}/Group/Event/types.d.ts +1 -1
  27. package/{lib/models → models}/Group/Player/Event/index.d.ts +2 -2
  28. package/{lib/models → models}/Group/Player/Event/types.d.ts +1 -1
  29. package/{lib/models → models}/Group/Player/Log/index.d.ts +2 -2
  30. package/{lib/models → models}/Group/Player/Log/types.d.ts +1 -1
  31. package/{lib/models → models}/Group/Player/index.d.ts +1 -1
  32. package/{lib/models → models}/Group/Player/types.d.ts +1 -1
  33. package/{lib/models → models}/Group/Repertory/index.d.ts +1 -1
  34. package/{lib/models → models}/Group/Repertory/types.d.ts +1 -1
  35. package/{lib/models → models}/Group/basic.d.ts +2 -2
  36. package/{lib/models → models}/Group/index.d.ts +1 -1
  37. package/{lib/models → models}/Group/index.js +2 -2
  38. package/{lib/models → models}/Group/types.d.ts +1 -1
  39. package/{lib/models → models}/Metrics/index.d.ts +1 -1
  40. package/{lib/models → models}/Metrics/types.d.ts +1 -1
  41. package/{lib/models → models}/Model/index.d.ts +1 -1
  42. package/{lib/models → models}/Model/lang.d.ts +1 -1
  43. package/{lib/models → models}/Notification/index.d.ts +1 -1
  44. package/{lib/models → models}/Notification/types.d.ts +1 -1
  45. package/{lib/models → models}/Partner/basic.d.ts +4 -4
  46. package/{lib/models → models}/Partner/index.d.ts +2 -2
  47. package/{lib/models → models}/Partner/tiny.d.ts +1 -1
  48. package/{lib/models → models}/Partner/types.d.ts +1 -1
  49. package/{lib/models → models}/Partnership/Group/index.d.ts +5 -5
  50. package/{lib/models → models}/Partnership/Group/types.d.ts +1 -1
  51. package/{lib/models → models}/Partnership/Partner/Subscription/index.d.ts +5 -5
  52. package/{lib/models → models}/Partnership/Partner/Subscription/types.d.ts +1 -1
  53. package/{lib/models → models}/Partnership/Partner/index.d.ts +1 -1
  54. package/{lib/models → models}/Partnership/Payment/index.d.ts +1 -1
  55. package/{lib/models → models}/Partnership/Plan/basic.d.ts +1 -1
  56. package/{lib/models → models}/Partnership/Plan/index.d.ts +3 -3
  57. package/{lib/models → models}/Partnership/Plan/types.d.ts +1 -1
  58. package/{lib/models → models}/Partnership/basic.d.ts +1 -1
  59. package/{lib/models → models}/Partnership/index.d.ts +2 -2
  60. package/{lib/models → models}/Partnership/types.d.ts +1 -1
  61. package/{lib/models → models}/Payment/basic.d.ts +1 -1
  62. package/{lib/models → models}/Payment/index.d.ts +1 -1
  63. package/{lib/models → models}/Payment/types.d.ts +1 -1
  64. package/{lib/models → models}/Player/basic.d.ts +1 -1
  65. package/{lib/models → models}/Repertory/basic.d.ts +1 -1
  66. package/{lib/models → models}/User/Group/index.d.ts +2 -2
  67. package/{lib/models → models}/User/Group/types.d.ts +1 -1
  68. package/{lib/models → models}/User/Notification/index.d.ts +1 -1
  69. package/{lib/models → models}/User/Notification/types.d.ts +1 -1
  70. package/{lib/models → models}/User/basic.d.ts +1 -1
  71. package/{lib/models → models}/User/index.d.ts +6 -6
  72. package/{lib/models → models}/User/types.d.ts +1 -1
  73. package/package.json +1 -1
  74. package/types/firestore.d.ts +1998 -0
  75. package/.husky/pre-commit +0 -4
  76. package/README.md +0 -70
  77. package/scripts/setHusky.js +0 -11
  78. /package/{lib/functions → functions}/auth.d.ts +0 -0
  79. /package/{lib/functions → functions}/auth.js +0 -0
  80. /package/{lib/functions → functions}/communication.d.ts +0 -0
  81. /package/{lib/functions → functions}/communication.js +0 -0
  82. /package/{lib/functions → functions}/communicationComment.d.ts +0 -0
  83. /package/{lib/functions → functions}/communicationComment.js +0 -0
  84. /package/{lib/functions → functions}/event.d.ts +0 -0
  85. /package/{lib/functions → functions}/event.js +0 -0
  86. /package/{lib/functions → functions}/eventPlayer.d.ts +0 -0
  87. /package/{lib/functions → functions}/eventPlayer.js +0 -0
  88. /package/{lib/functions → functions}/eventRepertory.d.ts +0 -0
  89. /package/{lib/functions → functions}/eventRepertory.js +0 -0
  90. /package/{lib/functions → functions}/federation.d.ts +0 -0
  91. /package/{lib/functions → functions}/federation.js +0 -0
  92. /package/{lib/functions → functions}/federationPartnership.d.ts +0 -0
  93. /package/{lib/functions → functions}/federationPartnership.js +0 -0
  94. /package/{lib/functions → functions}/group.d.ts +0 -0
  95. /package/{lib/functions → functions}/group.js +0 -0
  96. /package/{lib/functions → functions}/groupPlayer.d.ts +0 -0
  97. /package/{lib/functions → functions}/groupPlayer.js +0 -0
  98. /package/{lib/functions → functions}/groupRepertory.d.ts +0 -0
  99. /package/{lib/functions → functions}/groupRepertory.js +0 -0
  100. /package/{lib/functions → functions}/index.d.ts +0 -0
  101. /package/{lib/functions → functions}/index.js +0 -0
  102. /package/{lib/functions → functions}/jwt.d.ts +0 -0
  103. /package/{lib/functions → functions}/jwt.js +0 -0
  104. /package/{lib/functions → functions}/misc.d.ts +0 -0
  105. /package/{lib/functions → functions}/misc.js +0 -0
  106. /package/{lib/functions → functions}/notification.d.ts +0 -0
  107. /package/{lib/functions → functions}/notification.js +0 -0
  108. /package/{lib/functions → functions}/partner.d.ts +0 -0
  109. /package/{lib/functions → functions}/partner.js +0 -0
  110. /package/{lib/functions → functions}/partnership.d.ts +0 -0
  111. /package/{lib/functions → functions}/partnership.js +0 -0
  112. /package/{lib/functions → functions}/partnershipGroup.d.ts +0 -0
  113. /package/{lib/functions → functions}/partnershipGroup.js +0 -0
  114. /package/{lib/functions → functions}/partnershipPlan.d.ts +0 -0
  115. /package/{lib/functions → functions}/partnershipPlan.js +0 -0
  116. /package/{lib/functions → functions}/regions.d.ts +0 -0
  117. /package/{lib/functions → functions}/regions.js +0 -0
  118. /package/{lib/functions → functions}/subscription.d.ts +0 -0
  119. /package/{lib/functions → functions}/subscription.js +0 -0
  120. /package/{lib/functions → functions}/user.d.ts +0 -0
  121. /package/{lib/functions → functions}/user.js +0 -0
  122. /package/{lib/helpers → helpers}/appScenes.d.ts +0 -0
  123. /package/{lib/helpers → helpers}/appScenes.js +0 -0
  124. /package/{lib/helpers → helpers}/audios.d.ts +0 -0
  125. /package/{lib/helpers → helpers}/audios.js +0 -0
  126. /package/{lib/helpers → helpers}/auth.d.ts +0 -0
  127. /package/{lib/helpers → helpers}/auth.js +0 -0
  128. /package/{lib/helpers → helpers}/badges.d.ts +0 -0
  129. /package/{lib/helpers → helpers}/badges.js +0 -0
  130. /package/{lib/helpers → helpers}/collections.d.ts +0 -0
  131. /package/{lib/helpers → helpers}/collections.js +0 -0
  132. /package/{lib/helpers → helpers}/dlinks.d.ts +0 -0
  133. /package/{lib/helpers → helpers}/dlinks.js +0 -0
  134. /package/{lib/helpers → helpers}/errors.d.ts +0 -0
  135. /package/{lib/helpers → helpers}/errors.js +0 -0
  136. /package/{lib/helpers → helpers}/fileSections/index.d.ts +0 -0
  137. /package/{lib/helpers → helpers}/fileSections/index.js +0 -0
  138. /package/{lib/helpers → helpers}/fileSections/orders.d.ts +0 -0
  139. /package/{lib/helpers → helpers}/fileSections/orders.js +0 -0
  140. /package/{lib/helpers → helpers}/instruments/index.d.ts +0 -0
  141. /package/{lib/helpers → helpers}/instruments/index.js +0 -0
  142. /package/{lib/helpers → helpers}/musicStyles/index.d.ts +0 -0
  143. /package/{lib/helpers → helpers}/musicStyles/index.js +0 -0
  144. /package/{lib/helpers → helpers}/musicStyles/orders.d.ts +0 -0
  145. /package/{lib/helpers → helpers}/musicStyles/orders.js +0 -0
  146. /package/{lib/helpers → helpers}/notifications.d.ts +0 -0
  147. /package/{lib/helpers → helpers}/notifications.js +0 -0
  148. /package/{lib/helpers → helpers}/objects.d.ts +0 -0
  149. /package/{lib/helpers → helpers}/objects.js +0 -0
  150. /package/{lib/helpers → helpers}/payments.d.ts +0 -0
  151. /package/{lib/helpers → helpers}/payments.js +0 -0
  152. /package/{lib/helpers → helpers}/plans.d.ts +0 -0
  153. /package/{lib/helpers → helpers}/plans.js +0 -0
  154. /package/{lib/helpers → helpers}/rates.d.ts +0 -0
  155. /package/{lib/helpers → helpers}/rates.js +0 -0
  156. /package/{lib/helpers → helpers}/reasons.d.ts +0 -0
  157. /package/{lib/helpers → helpers}/reasons.js +0 -0
  158. /package/{lib/helpers → helpers}/slate.d.ts +0 -0
  159. /package/{lib/helpers → helpers}/slate.js +0 -0
  160. /package/{lib/helpers → helpers}/styles.d.ts +0 -0
  161. /package/{lib/helpers → helpers}/styles.js +0 -0
  162. /package/{lib/helpers → helpers}/ts-extras/array-includes.d.ts +0 -0
  163. /package/{lib/helpers → helpers}/ts-extras/array-includes.js +0 -0
  164. /package/{lib/helpers → helpers}/ts-extras/as-mutable.d.ts +0 -0
  165. /package/{lib/helpers → helpers}/ts-extras/as-mutable.js +0 -0
  166. /package/{lib/helpers → helpers}/ts-extras/assert-error.d.ts +0 -0
  167. /package/{lib/helpers → helpers}/ts-extras/assert-error.js +0 -0
  168. /package/{lib/helpers → helpers}/ts-extras/index.d.ts +0 -0
  169. /package/{lib/helpers → helpers}/ts-extras/index.js +0 -0
  170. /package/{lib/helpers → helpers}/ts-extras/is-defined.d.ts +0 -0
  171. /package/{lib/helpers → helpers}/ts-extras/is-defined.js +0 -0
  172. /package/{lib/helpers → helpers}/ts-extras/is-empty.d.ts +0 -0
  173. /package/{lib/helpers → helpers}/ts-extras/is-empty.js +0 -0
  174. /package/{lib/helpers → helpers}/ts-extras/is-finite.d.ts +0 -0
  175. /package/{lib/helpers → helpers}/ts-extras/is-finite.js +0 -0
  176. /package/{lib/helpers → helpers}/ts-extras/is-infinite.d.ts +0 -0
  177. /package/{lib/helpers → helpers}/ts-extras/is-infinite.js +0 -0
  178. /package/{lib/helpers → helpers}/ts-extras/is-integer.d.ts +0 -0
  179. /package/{lib/helpers → helpers}/ts-extras/is-integer.js +0 -0
  180. /package/{lib/helpers → helpers}/ts-extras/is-present.d.ts +0 -0
  181. /package/{lib/helpers → helpers}/ts-extras/is-present.js +0 -0
  182. /package/{lib/helpers → helpers}/ts-extras/is-safe-integer.d.ts +0 -0
  183. /package/{lib/helpers → helpers}/ts-extras/is-safe-integer.js +0 -0
  184. /package/{lib/helpers → helpers}/ts-extras/object-entries.d.ts +0 -0
  185. /package/{lib/helpers → helpers}/ts-extras/object-entries.js +0 -0
  186. /package/{lib/helpers → helpers}/ts-extras/object-from-entries.d.ts +0 -0
  187. /package/{lib/helpers → helpers}/ts-extras/object-from-entries.js +0 -0
  188. /package/{lib/helpers → helpers}/ts-extras/object-has-own.d.ts +0 -0
  189. /package/{lib/helpers → helpers}/ts-extras/object-has-own.js +0 -0
  190. /package/{lib/helpers → helpers}/ts-extras/object-keys.d.ts +0 -0
  191. /package/{lib/helpers → helpers}/ts-extras/object-keys.js +0 -0
  192. /package/{lib/helpers → helpers}/ts-extras/set-has.d.ts +0 -0
  193. /package/{lib/helpers → helpers}/ts-extras/set-has.js +0 -0
  194. /package/{lib/helpers → helpers}/types.d.ts +0 -0
  195. /package/{lib/helpers → helpers}/types.js +0 -0
  196. /package/{lib/helpers → helpers}/utils.d.ts +0 -0
  197. /package/{lib/helpers → helpers}/utils.js +0 -0
  198. /package/{lib/index.d.ts → index.d.ts} +0 -0
  199. /package/{lib/index.js → index.js} +0 -0
  200. /package/{lib/lang → lang}/ca.json +0 -0
  201. /package/{lib/lang → lang}/de.json +0 -0
  202. /package/{lib/lang → lang}/en.json +0 -0
  203. /package/{lib/lang → lang}/es.json +0 -0
  204. /package/{lib/lang → lang}/eu.json +0 -0
  205. /package/{lib/lang → lang}/gl.json +0 -0
  206. /package/{lib/lang → lang}/index.d.ts +0 -0
  207. /package/{lib/lang → lang}/index.js +0 -0
  208. /package/{lib/lang → lang}/pt.json +0 -0
  209. /package/{lib/models → models}/Communication/Comment/index.js +0 -0
  210. /package/{lib/models → models}/Communication/Comment/types.js +0 -0
  211. /package/{lib/models → models}/Communication/index.js +0 -0
  212. /package/{lib/models → models}/Communication/types.js +0 -0
  213. /package/{lib/models → models}/Counters/Group/Analytics/index.js +0 -0
  214. /package/{lib/models → models}/Counters/Group/Analytics/types.js +0 -0
  215. /package/{lib/models → models}/Counters/Group/index.js +0 -0
  216. /package/{lib/models → models}/Counters/Group/types.js +0 -0
  217. /package/{lib/models → models}/Counters/event.js +0 -0
  218. /package/{lib/models → models}/Counters/index.js +0 -0
  219. /package/{lib/models → models}/Counters/types.d.ts +0 -0
  220. /package/{lib/models → models}/Counters/types.js +0 -0
  221. /package/{lib/models → models}/Evento/Player/index.js +0 -0
  222. /package/{lib/models → models}/Evento/Player/types.js +0 -0
  223. /package/{lib/models → models}/Evento/Repertory/index.js +0 -0
  224. /package/{lib/models → models}/Evento/Repertory/types.js +0 -0
  225. /package/{lib/models → models}/Evento/basic.js +0 -0
  226. /package/{lib/models → models}/Evento/index.js +0 -0
  227. /package/{lib/models → models}/Evento/promoter.js +0 -0
  228. /package/{lib/models → models}/Evento/tiny.d.ts +0 -0
  229. /package/{lib/models → models}/Evento/tiny.js +0 -0
  230. /package/{lib/models → models}/Evento/types.js +0 -0
  231. /package/{lib/models → models}/Federation/Partnership/index.js +0 -0
  232. /package/{lib/models → models}/Federation/Partnership/types.js +0 -0
  233. /package/{lib/models → models}/Federation/index.js +0 -0
  234. /package/{lib/models → models}/Federation/types.js +0 -0
  235. /package/{lib/models → models}/Group/Analytics/index.js +0 -0
  236. /package/{lib/models → models}/Group/Analytics/types.js +0 -0
  237. /package/{lib/models → models}/Group/Event/index.js +0 -0
  238. /package/{lib/models → models}/Group/Event/types.js +0 -0
  239. /package/{lib/models → models}/Group/Player/Event/index.js +0 -0
  240. /package/{lib/models → models}/Group/Player/Event/types.js +0 -0
  241. /package/{lib/models → models}/Group/Player/Log/index.js +0 -0
  242. /package/{lib/models → models}/Group/Player/Log/types.js +0 -0
  243. /package/{lib/models → models}/Group/Player/index.js +0 -0
  244. /package/{lib/models → models}/Group/Player/types.js +0 -0
  245. /package/{lib/models → models}/Group/Repertory/File/Section/index.d.ts +0 -0
  246. /package/{lib/models → models}/Group/Repertory/File/Section/index.js +0 -0
  247. /package/{lib/models → models}/Group/Repertory/File/Section/types.d.ts +0 -0
  248. /package/{lib/models → models}/Group/Repertory/File/Section/types.js +0 -0
  249. /package/{lib/models → models}/Group/Repertory/File/index.d.ts +0 -0
  250. /package/{lib/models → models}/Group/Repertory/File/index.js +0 -0
  251. /package/{lib/models → models}/Group/Repertory/File/types.d.ts +0 -0
  252. /package/{lib/models → models}/Group/Repertory/File/types.js +0 -0
  253. /package/{lib/models → models}/Group/Repertory/FilePath/index.d.ts +0 -0
  254. /package/{lib/models → models}/Group/Repertory/FilePath/index.js +0 -0
  255. /package/{lib/models → models}/Group/Repertory/index.js +0 -0
  256. /package/{lib/models → models}/Group/Repertory/types.js +0 -0
  257. /package/{lib/models → models}/Group/basic.js +0 -0
  258. /package/{lib/models → models}/Group/types.js +0 -0
  259. /package/{lib/models → models}/Instrument/index.d.ts +0 -0
  260. /package/{lib/models → models}/Instrument/index.js +0 -0
  261. /package/{lib/models → models}/Metrics/index.js +0 -0
  262. /package/{lib/models → models}/Metrics/types.js +0 -0
  263. /package/{lib/models → models}/Model/index.js +0 -0
  264. /package/{lib/models → models}/Model/lang.js +0 -0
  265. /package/{lib/models → models}/MusicStyle/index.d.ts +0 -0
  266. /package/{lib/models → models}/MusicStyle/index.js +0 -0
  267. /package/{lib/models → models}/Notification/index.js +0 -0
  268. /package/{lib/models → models}/Notification/types.js +0 -0
  269. /package/{lib/models → models}/Partner/basic.js +0 -0
  270. /package/{lib/models → models}/Partner/index.js +0 -0
  271. /package/{lib/models → models}/Partner/tiny.js +0 -0
  272. /package/{lib/models → models}/Partner/types.js +0 -0
  273. /package/{lib/models → models}/Partnership/Group/index.js +0 -0
  274. /package/{lib/models → models}/Partnership/Group/types.js +0 -0
  275. /package/{lib/models → models}/Partnership/Partner/Subscription/index.js +0 -0
  276. /package/{lib/models → models}/Partnership/Partner/Subscription/types.js +0 -0
  277. /package/{lib/models → models}/Partnership/Partner/index.js +0 -0
  278. /package/{lib/models → models}/Partnership/Partner/types.d.ts +0 -0
  279. /package/{lib/models → models}/Partnership/Partner/types.js +0 -0
  280. /package/{lib/models → models}/Partnership/Payment/index.js +0 -0
  281. /package/{lib/models → models}/Partnership/Payment/types.d.ts +0 -0
  282. /package/{lib/models → models}/Partnership/Payment/types.js +0 -0
  283. /package/{lib/models → models}/Partnership/Plan/basic.js +0 -0
  284. /package/{lib/models → models}/Partnership/Plan/index.js +0 -0
  285. /package/{lib/models → models}/Partnership/Plan/types.js +0 -0
  286. /package/{lib/models → models}/Partnership/basic.js +0 -0
  287. /package/{lib/models → models}/Partnership/index.js +0 -0
  288. /package/{lib/models → models}/Partnership/types.js +0 -0
  289. /package/{lib/models → models}/Payment/basic.js +0 -0
  290. /package/{lib/models → models}/Payment/index.js +0 -0
  291. /package/{lib/models → models}/Payment/types.js +0 -0
  292. /package/{lib/models → models}/Player/basic.js +0 -0
  293. /package/{lib/models → models}/Player/types.d.ts +0 -0
  294. /package/{lib/models → models}/Player/types.js +0 -0
  295. /package/{lib/models → models}/Repertory/basic.js +0 -0
  296. /package/{lib/models → models}/Repertory/types.d.ts +0 -0
  297. /package/{lib/models → models}/Repertory/types.js +0 -0
  298. /package/{lib/models → models}/User/Group/index.js +0 -0
  299. /package/{lib/models → models}/User/Group/types.js +0 -0
  300. /package/{lib/models → models}/User/Notification/index.js +0 -0
  301. /package/{lib/models → models}/User/Notification/types.js +0 -0
  302. /package/{lib/models → models}/User/basic.js +0 -0
  303. /package/{lib/models → models}/User/index.js +0 -0
  304. /package/{lib/models → models}/User/types.js +0 -0
@@ -0,0 +1,1998 @@
1
+ /*!
2
+ * Copyright 2020 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ // We deliberately use `any` in the external API to not impose type-checking
18
+ // on end users.
19
+ /* eslint-disable @typescript-eslint/no-explicit-any */
20
+
21
+ // Declare a global (ambient) namespace
22
+ // (used when not using import statement, but just script include).
23
+
24
+ /**
25
+ * Document data (for use with `DocumentReference.set()`) consists of fields
26
+ * mapped to values.
27
+ */
28
+ export type DocumentData = { [field: string]: any };
29
+
30
+ /**
31
+ * Update data (for use with `DocumentReference.update()`) consists of field
32
+ * paths (e.g. 'foo' or 'foo.baz') mapped to values. Fields that contain dots
33
+ * reference nested fields within the document.
34
+ */
35
+ export type UpdateData = { [fieldPath: string]: any };
36
+
37
+ /**
38
+ * Converter used by `withConverter()` to transform user objects of type T
39
+ * into Firestore data.
40
+ *
41
+ * Using the converter allows you to specify generic type arguments when
42
+ * storing and retrieving objects from Firestore.
43
+ *
44
+ * @example
45
+ * class Post {
46
+ * constructor(readonly title: string, readonly author: string) {}
47
+ *
48
+ * toString(): string {
49
+ * return this.title + ', by ' + this.author;
50
+ * }
51
+ * }
52
+ *
53
+ * const postConverter = {
54
+ * toFirestore(post: Post): FirebaseFirestore.DocumentData {
55
+ * return {title: post.title, author: post.author};
56
+ * },
57
+ * fromFirestore(
58
+ * snapshot: FirebaseFirestore.QueryDocumentSnapshot
59
+ * ): Post {
60
+ * const data = snapshot.data();
61
+ * return new Post(data.title, data.author);
62
+ * }
63
+ * };
64
+ *
65
+ * const postSnap = await Firestore()
66
+ * .collection('posts')
67
+ * .withConverter(postConverter)
68
+ * .doc().get();
69
+ * const post = postSnap.data();
70
+ * if (post !== undefined) {
71
+ * post.title; // string
72
+ * post.toString(); // Should be defined
73
+ * post.someNonExistentProperty; // TS error
74
+ * }
75
+ */
76
+ export interface FirestoreDataConverter<T> {
77
+ /**
78
+ * Called by the Firestore SDK to convert a custom model object of type T
79
+ * into a plain Javascript object (suitable for writing directly to the
80
+ * Firestore database). To use set() with `merge` and `mergeFields`,
81
+ * toFirestore() must be defined with `Partial<T>`.
82
+ */
83
+ toFirestore(modelObject: T): DocumentData;
84
+ toFirestore(modelObject: Partial<T>, options: SetOptions): DocumentData;
85
+
86
+ /**
87
+ * Called by the Firestore SDK to convert Firestore data into an object of
88
+ * type T.
89
+ */
90
+ fromFirestore(snapshot: QueryDocumentSnapshot): T;
91
+ }
92
+
93
+ /**
94
+ * Settings used to directly configure a `Firestore` instance.
95
+ */
96
+ export interface Settings {
97
+ /**
98
+ * The project ID from the Google Developer's Console, e.g.
99
+ * 'grape-spaceship-123'. We will also check the environment variable
100
+ * GCLOUD_PROJECT for your project ID. Can be omitted in environments that
101
+ * support {@link https://cloud.google.com/docs/authentication Application
102
+ * Default Credentials}
103
+ */
104
+ projectId?: string;
105
+
106
+ /** The hostname to connect to. */
107
+ host?: string;
108
+
109
+ /** The port to connect to. */
110
+ port?: number;
111
+
112
+ /**
113
+ * Local file containing the Service Account credentials as downloaded from
114
+ * the Google Developers Console. Can be omitted in environments that
115
+ * support {@link https://cloud.google.com/docs/authentication Application
116
+ * Default Credentials}. To configure Firestore with custom credentials, use
117
+ * the `credentials` property to provide the `client_email` and
118
+ * `private_key` of your service account.
119
+ */
120
+ keyFilename?: string;
121
+
122
+ /**
123
+ * The 'client_email' and 'private_key' properties of the service account
124
+ * to use with your Firestore project. Can be omitted in environments that
125
+ * support {@link https://cloud.google.com/docs/authentication Application
126
+ * Default Credentials}. If your credentials are stored in a JSON file, you
127
+ * can specify a `keyFilename` instead.
128
+ */
129
+ credentials?: { client_email?: string; private_key?: string };
130
+
131
+ /** Whether to use SSL when connecting. */
132
+ ssl?: boolean;
133
+
134
+ /**
135
+ * The maximum number of idle GRPC channels to keep. A smaller number of idle
136
+ * channels reduces memory usage but increases request latency for clients
137
+ * with fluctuating request rates. If set to 0, shuts down all GRPC channels
138
+ * when the client becomes idle. Defaults to 1.
139
+ */
140
+ maxIdleChannels?: number;
141
+
142
+ /**
143
+ * Whether to use `BigInt` for integer types when deserializing Firestore
144
+ * Documents. Regardless of magnitude, all integer values are returned as
145
+ * `BigInt` to match the precision of the Firestore backend. Floating point
146
+ * numbers continue to use JavaScript's `number` type.
147
+ */
148
+ useBigInt?: boolean;
149
+
150
+ /**
151
+ * Whether to skip nested properties that are set to `undefined` during
152
+ * object serialization. If set to `true`, these properties are skipped
153
+ * and not written to Firestore. If set `false` or omitted, the SDK throws
154
+ * an exception when it encounters properties of type `undefined`.
155
+ */
156
+ ignoreUndefinedProperties?: boolean;
157
+
158
+ [key: string]: any; // Accept other properties, such as GRPC settings.
159
+ }
160
+
161
+ /**
162
+ * `Firestore` represents a Firestore Database and is the entry point for all
163
+ * Firestore operations.
164
+ */
165
+ export class Firestore {
166
+ /**
167
+ * @param settings Configuration object. See [Firestore Documentation]
168
+ * {@link https://firebase.google.com/docs/firestore/}
169
+ */
170
+ public constructor(settings?: Settings);
171
+
172
+ /**
173
+ * Specifies custom settings to be used to configure the `Firestore`
174
+ * instance. Can only be invoked once and before any other Firestore
175
+ * method.
176
+ *
177
+ * If settings are provided via both `settings()` and the `Firestore`
178
+ * constructor, both settings objects are merged and any settings provided
179
+ * via `settings()` take precedence.
180
+ *
181
+ * @param {object} settings The settings to use for all Firestore
182
+ * operations.
183
+ */
184
+ settings(settings: Settings): void;
185
+
186
+ /**
187
+ * Gets a `CollectionReference` instance that refers to the collection at
188
+ * the specified path.
189
+ *
190
+ * @param collectionPath A slash-separated path to a collection.
191
+ * @return The `CollectionReference` instance.
192
+ */
193
+ collection(collectionPath: string): CollectionReference<DocumentData>;
194
+
195
+ /**
196
+ * Gets a `DocumentReference` instance that refers to the document at the
197
+ * specified path.
198
+ *
199
+ * @param documentPath A slash-separated path to a document.
200
+ * @return The `DocumentReference` instance.
201
+ */
202
+ doc(documentPath: string): DocumentReference<DocumentData>;
203
+
204
+ /**
205
+ * Creates and returns a new Query that includes all documents in the
206
+ * database that are contained in a collection or subcollection with the
207
+ * given collectionId.
208
+ *
209
+ * @param collectionId Identifies the collections to query over. Every
210
+ * collection or subcollection with this ID as the last segment of its path
211
+ * will be included. Cannot contain a slash.
212
+ * @return The created `CollectionGroup`.
213
+ */
214
+ collectionGroup(collectionId: string): CollectionGroup<DocumentData>;
215
+
216
+ /**
217
+ * Retrieves multiple documents from Firestore.
218
+ *
219
+ * The first argument is required and must be of type `DocumentReference`
220
+ * followed by any additional `DocumentReference` documents. If used, the
221
+ * optional `ReadOptions` must be the last argument.
222
+ *
223
+ * @param {Array.<DocumentReference|ReadOptions>} documentRefsOrReadOptions
224
+ * The `DocumentReferences` to receive, followed by an optional field
225
+ * mask.
226
+ * @return A Promise that resolves with an array of resulting document
227
+ * snapshots.
228
+ */
229
+ getAll(
230
+ ...documentRefsOrReadOptions: Array<DocumentReference<DocumentData> | ReadOptions>
231
+ ): Promise<Array<DocumentSnapshot<DocumentData>>>;
232
+
233
+ /**
234
+ * Recursively deletes all documents and subcollections at and under the
235
+ * specified level.
236
+ *
237
+ * If any delete fails, the promise is rejected with an error message
238
+ * containing the number of failed deletes and the stack trace of the last
239
+ * failed delete. The provided reference is deleted regardless of whether
240
+ * all deletes succeeded.
241
+ *
242
+ * `recursiveDelete()` uses a BulkWriter instance with default settings to
243
+ * perform the deletes. To customize throttling rates or add success/error
244
+ * callbacks, pass in a custom BulkWriter instance.
245
+ *
246
+ * @param ref The reference of a document or collection to delete.
247
+ * @param bulkWriter A custom BulkWriter instance used to perform the
248
+ * deletes.
249
+ * @return A promise that resolves when all deletes have been performed.
250
+ * The promise is rejected if any of the deletes fail.
251
+ *
252
+ * @example
253
+ * // Recursively delete a reference and log the references of failures.
254
+ * const bulkWriter = firestore.bulkWriter();
255
+ * bulkWriter
256
+ * .onWriteError((error) => {
257
+ * if (
258
+ * error.failedAttempts < MAX_RETRY_ATTEMPTS
259
+ * ) {
260
+ * return true;
261
+ * } else {
262
+ * console.log('Failed write at document: ', error.documentRef.path);
263
+ * return false;
264
+ * }
265
+ * });
266
+ * await firestore.recursiveDelete(docRef, bulkWriter);
267
+ */
268
+ recursiveDelete(
269
+ ref: CollectionReference<unknown> | DocumentReference<unknown>,
270
+ bulkWriter?: BulkWriter
271
+ ): Promise<void>;
272
+
273
+ /**
274
+ * Terminates the Firestore client and closes all open streams.
275
+ *
276
+ * @return A Promise that resolves when the client is terminated.
277
+ */
278
+ terminate(): Promise<void>;
279
+
280
+ /**
281
+ * Fetches the root collections that are associated with this Firestore
282
+ * database.
283
+ *
284
+ * @returns A Promise that resolves with an array of CollectionReferences.
285
+ */
286
+ listCollections(): Promise<Array<CollectionReference<DocumentData>>>;
287
+
288
+ /**
289
+ * Executes the given updateFunction and commits the changes applied within
290
+ * the transaction.
291
+ *
292
+ * You can use the transaction object passed to 'updateFunction' to read and
293
+ * modify Firestore documents under lock. Transactions are committed once
294
+ * 'updateFunction' resolves and attempted up to five times on failure.
295
+ *
296
+ * @param updateFunction The function to execute within the transaction
297
+ * context.
298
+ * @param {object=} transactionOptions Transaction options.
299
+ * @param {number=} transactionOptions.maxAttempts The maximum number of
300
+ * attempts for this transaction.
301
+ * @return If the transaction completed successfully or was explicitly
302
+ * aborted (by the updateFunction returning a failed Promise), the Promise
303
+ * returned by the updateFunction will be returned here. Else if the
304
+ * transaction failed, a rejected Promise with the corresponding failure
305
+ * error will be returned.
306
+ */
307
+ runTransaction<T>(
308
+ updateFunction: (transaction: Transaction) => Promise<T>,
309
+ transactionOptions?: { maxAttempts?: number }
310
+ ): Promise<T>;
311
+
312
+ /**
313
+ * Creates a write batch, used for performing multiple writes as a single
314
+ * atomic operation.
315
+ */
316
+ batch(): WriteBatch;
317
+
318
+ /**
319
+ * Creates a [BulkWriter]{@link BulkWriter}, used for performing
320
+ * multiple writes in parallel. Gradually ramps up writes as specified
321
+ * by the 500/50/5 rule.
322
+ *
323
+ * @see https://firebase.google.com/docs/firestore/best-practices#ramping_up_traffic
324
+ *
325
+ * @param options An options object used to configure the throttling
326
+ * behavior for the underlying BulkWriter.
327
+ */
328
+ bulkWriter(options?: BulkWriterOptions): BulkWriter;
329
+
330
+ /**
331
+ * Creates a new `BundleBuilder` instance to package selected Firestore data into
332
+ * a bundle.
333
+ *
334
+ * @param bundleId The ID of the bundle. When loaded on clients, client SDKs use this ID
335
+ * and the timestamp associated with the bundle to tell if it has been loaded already.
336
+ * If not specified, a random identifier will be used.
337
+ *
338
+ *
339
+ * @example
340
+ * const bundle = firestore.bundle('data-bundle');
341
+ * const docSnapshot = await firestore.doc('abc/123').get();
342
+ * const querySnapshot = await firestore.collection('coll').get();
343
+ *
344
+ * const bundleBuffer = bundle.add(docSnapshot); // Add a document
345
+ * .add('coll-query', querySnapshot) // Add a named query.
346
+ * .build()
347
+ * // Save `bundleBuffer` to CDN or stream it to clients.
348
+ */
349
+ bundle(bundleId?: string): BundleBuilder;
350
+ }
351
+
352
+ /**
353
+ * An immutable object representing a geo point in Firestore. The geo point
354
+ * is represented as latitude/longitude pair.
355
+ *
356
+ * Latitude values are in the range of [-90, 90].
357
+ * Longitude values are in the range of [-180, 180].
358
+ */
359
+ export class GeoPoint {
360
+ /**
361
+ * Creates a new immutable GeoPoint object with the provided latitude and
362
+ * longitude values.
363
+ * @param latitude The latitude as number between -90 and 90.
364
+ * @param longitude The longitude as number between -180 and 180.
365
+ */
366
+ constructor(latitude: number, longitude: number);
367
+
368
+ readonly latitude: number;
369
+ readonly longitude: number;
370
+
371
+ /**
372
+ * Returns true if this `GeoPoint` is equal to the provided one.
373
+ *
374
+ * @param other The `GeoPoint` to compare against.
375
+ * @return true if this `GeoPoint` is equal to the provided one.
376
+ */
377
+ isEqual(other: GeoPoint): boolean;
378
+ }
379
+
380
+ /**
381
+ * A reference to a transaction.
382
+ * The `Transaction` object passed to a transaction's updateFunction provides
383
+ * the methods to read and write data within the transaction context. See
384
+ * `Firestore.runTransaction()`.
385
+ */
386
+ export class Transaction {
387
+ private constructor();
388
+
389
+ /**
390
+ * Retrieves a query result. Holds a pessimistic lock on all returned
391
+ * documents.
392
+ *
393
+ * @param query A query to execute.
394
+ * @return A QuerySnapshot for the retrieved data.
395
+ */
396
+ get<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
397
+
398
+ /**
399
+ * Reads the document referenced by the provided `DocumentReference.`
400
+ * Holds a pessimistic lock on the returned document.
401
+ *
402
+ * @param documentRef A reference to the document to be read.
403
+ * @return A DocumentSnapshot for the read data.
404
+ */
405
+ get<T>(documentRef: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
406
+
407
+ /**
408
+ * Retrieves multiple documents from Firestore. Holds a pessimistic lock on
409
+ * all returned documents.
410
+ *
411
+ * The first argument is required and must be of type `DocumentReference`
412
+ * followed by any additional `DocumentReference` documents. If used, the
413
+ * optional `ReadOptions` must be the last argument.
414
+ *
415
+ * @param {Array.<DocumentReference|ReadOptions>} documentRefsOrReadOptions
416
+ * The `DocumentReferences` to receive, followed by an optional field
417
+ * mask.
418
+ * @return A Promise that resolves with an array of resulting document
419
+ * snapshots.
420
+ */
421
+ getAll<T>(
422
+ ...documentRefsOrReadOptions: Array<DocumentReference<T> | ReadOptions>
423
+ ): Promise<Array<DocumentSnapshot<T>>>;
424
+
425
+ /**
426
+ * Create the document referred to by the provided `DocumentReference`.
427
+ * The operation will fail the transaction if a document exists at the
428
+ * specified location.
429
+ *
430
+ * @param documentRef A reference to the document to be create.
431
+ * @param data The object data to serialize as the document.
432
+ * @return This `Transaction` instance. Used for chaining method calls.
433
+ */
434
+ create<T>(documentRef: DocumentReference<T>, data: T): Transaction;
435
+
436
+ /**
437
+ * Writes to the document referred to by the provided `DocumentReference`.
438
+ * If the document does not exist yet, it will be created. If you pass
439
+ * `SetOptions`, the provided data can be merged into the existing document.
440
+ *
441
+ * @param documentRef A reference to the document to be set.
442
+ * @param data An object of the fields and values for the document.
443
+ * @param options An object to configure the set behavior.
444
+ * @return This `Transaction` instance. Used for chaining method calls.
445
+ */
446
+ set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): Transaction;
447
+ set<T>(documentRef: DocumentReference<T>, data: T): Transaction;
448
+
449
+ /**
450
+ * Updates fields in the document referred to by the provided
451
+ * `DocumentReference`. The update will fail if applied to a document that
452
+ * does not exist.
453
+ *
454
+ * Nested fields can be updated by providing dot-separated field path
455
+ * strings.
456
+ *
457
+ * @param documentRef A reference to the document to be updated.
458
+ * @param data An object containing the fields and values with which to
459
+ * update the document.
460
+ * @param precondition A Precondition to enforce on this update.
461
+ * @return This `Transaction` instance. Used for chaining method calls.
462
+ */
463
+ update(
464
+ documentRef: DocumentReference<any>,
465
+ data: UpdateData,
466
+ precondition?: Precondition
467
+ ): Transaction;
468
+
469
+ /**
470
+ * Updates fields in the document referred to by the provided
471
+ * `DocumentReference`. The update will fail if applied to a document that
472
+ * does not exist.
473
+ *
474
+ * Nested fields can be updated by providing dot-separated field path
475
+ * strings or by providing FieldPath objects.
476
+ *
477
+ * A `Precondition` restricting this update can be specified as the last
478
+ * argument.
479
+ *
480
+ * @param documentRef A reference to the document to be updated.
481
+ * @param field The first field to update.
482
+ * @param value The first value
483
+ * @param fieldsOrPrecondition An alternating list of field paths and values
484
+ * to update, optionally followed by a `Precondition` to enforce on this
485
+ * update.
486
+ * @return This `Transaction` instance. Used for chaining method calls.
487
+ */
488
+ update(
489
+ documentRef: DocumentReference<any>,
490
+ field: string | FieldPath,
491
+ value: any,
492
+ ...fieldsOrPrecondition: any[]
493
+ ): Transaction;
494
+
495
+ /**
496
+ * Deletes the document referred to by the provided `DocumentReference`.
497
+ *
498
+ * @param documentRef A reference to the document to be deleted.
499
+ * @param precondition A Precondition to enforce for this delete.
500
+ * @return This `Transaction` instance. Used for chaining method calls.
501
+ */
502
+ delete(documentRef: DocumentReference<any>, precondition?: Precondition): Transaction;
503
+ }
504
+
505
+ /**
506
+ * A Firestore BulkWriter than can be used to perform a large number of writes
507
+ * in parallel. Writes to the same document will be executed sequentially.
508
+ *
509
+ * @class
510
+ */
511
+ export class BulkWriter {
512
+ private constructor();
513
+
514
+ /**
515
+ * Create a document with the provided data. This single operation will fail
516
+ * if a document exists at its location.
517
+ *
518
+ * @param documentRef A reference to the document to be
519
+ * created.
520
+ * @param data The object to serialize as the document.
521
+ * @returns A promise that resolves with the result of the write. If the
522
+ * write fails, the promise is rejected with a
523
+ * [BulkWriterError]{@link BulkWriterError}.
524
+ */
525
+ create<T>(documentRef: DocumentReference<T>, data: T): Promise<WriteResult>;
526
+
527
+ /**
528
+ * Delete a document from the database.
529
+ *
530
+ * @param documentRef A reference to the document to be
531
+ * deleted.
532
+ * @param precondition A precondition to enforce for this
533
+ * delete.
534
+ * @param precondition.lastUpdateTime If set, enforces that the
535
+ * document was last updated at lastUpdateTime. Fails the batch if the
536
+ * document doesn't exist or was last updated at a different time.
537
+ * @param precondition.exists If set, enforces that the target document
538
+ * must or must not exist.
539
+ * @returns A promise that resolves with the result of the delete. If the
540
+ * delete fails, the promise is rejected with a
541
+ * [BulkWriterError]{@link BulkWriterError}.
542
+ */
543
+ delete(documentRef: DocumentReference<any>, precondition?: Precondition): Promise<WriteResult>;
544
+
545
+ /**
546
+ * Write to the document referred to by the provided
547
+ * [DocumentReference]{@link DocumentReference}. If the document does not
548
+ * exist yet, it will be created. If you pass
549
+ * [SetOptions]{@link SetOptions}., the provided data can be merged into the
550
+ * existing document.
551
+ *
552
+ * @param documentRef A reference to the document to be
553
+ * set.
554
+ * @param data The object to serialize as the document.
555
+ * @param options An object to configure the set behavior.
556
+ * @param options.merge - If true, set() merges the values
557
+ * specified in its data argument. Fields omitted from this set() call
558
+ * remain untouched.
559
+ * @param options.mergeFields - If provided,
560
+ * set() only replaces the specified field paths. Any field path that is not
561
+ * specified is ignored and remains untouched.
562
+ * @returns A promise that resolves with the result of the write. If the
563
+ * write fails, the promise is rejected with a
564
+ * [BulkWriterError]{@link BulkWriterError}.
565
+ */
566
+ set<T>(
567
+ documentRef: DocumentReference<T>,
568
+ data: Partial<T>,
569
+ options: SetOptions
570
+ ): Promise<WriteResult>;
571
+ set<T>(documentRef: DocumentReference<T>, data: T): Promise<WriteResult>;
572
+
573
+ /**
574
+ * Update fields of the document referred to by the provided
575
+ * [DocumentReference]{@link DocumentReference}. If the document doesn't yet
576
+ * exist, the update fails and the entire batch will be rejected.
577
+ *
578
+ * The update() method accepts either an object with field paths encoded as
579
+ * keys and field values encoded as values, or a variable number of
580
+ * arguments that alternate between field paths and field values. Nested
581
+ * fields can be updated by providing dot-separated field path strings or by
582
+ * providing FieldPath objects.
583
+ *
584
+ *
585
+ * A Precondition restricting this update can be specified as the last
586
+ * argument.
587
+ *
588
+ * @param documentRef A reference to the document to be updated.
589
+ * @param data An object containing the fields and values with which to
590
+ * update the document.
591
+ * @param precondition A Precondition to enforce on this update.
592
+ * @returns A promise that resolves with the result of the write. If the
593
+ * write fails, the promise is rejected with a
594
+ * [BulkWriterError]{@link BulkWriterError}.
595
+ */
596
+ update(
597
+ documentRef: DocumentReference<any>,
598
+ data: UpdateData,
599
+ precondition?: Precondition
600
+ ): Promise<WriteResult>;
601
+
602
+ /**
603
+ * Update fields of the document referred to by the provided
604
+ * [DocumentReference]{@link DocumentReference}. If the document doesn't yet
605
+ * exist, the update fails and the entire batch will be rejected.
606
+ *
607
+ * The update() method accepts either an object with field paths encoded as
608
+ * keys and field values encoded as values, or a variable number of
609
+ * arguments that alternate between field paths and field values. Nested
610
+ * fields can be updated by providing dot-separated field path strings or by
611
+ * providing FieldPath objects.
612
+ *
613
+ *
614
+ * A Precondition restricting this update can be specified as the last
615
+ * argument.
616
+ *
617
+ * @param documentRef A reference to the document to be updated.
618
+ * @param field The first field to update.
619
+ * @param value The first value
620
+ * @param fieldsOrPrecondition An alternating list of field paths and values
621
+ * to update, optionally followed a `Precondition` to enforce on this update.
622
+ * @returns A promise that resolves with the result of the write. If the
623
+ * write fails, the promise is rejected with a
624
+ * [BulkWriterError]{@link BulkWriterError}.
625
+ */
626
+ update(
627
+ documentRef: DocumentReference<any>,
628
+ field: string | FieldPath,
629
+ value: any,
630
+ ...fieldsOrPrecondition: any[]
631
+ ): Promise<WriteResult>;
632
+
633
+ /**
634
+ * Attaches a listener that is run every time a BulkWriter operation
635
+ * successfully completes.
636
+ *
637
+ * @param callback A callback to be called every time a BulkWriter operation
638
+ * successfully completes.
639
+ */
640
+ onWriteResult(
641
+ callback: (documentRef: DocumentReference<any>, result: WriteResult) => void
642
+ ): void;
643
+
644
+ /**
645
+ * Attaches an error handler listener that is run every time a BulkWriter
646
+ * operation fails.
647
+ *
648
+ * BulkWriter has a default error handler that retries UNAVAILABLE and
649
+ * ABORTED errors up to a maximum of 10 failed attempts. When an error
650
+ * handler is specified, the default error handler will be overwritten.
651
+ *
652
+ * @param shouldRetryCallback A callback to be called every time a BulkWriter
653
+ * operation fails. Returning `true` will retry the operation. Returning
654
+ * `false` will stop the retry loop.
655
+ */
656
+ onWriteError(shouldRetryCallback: (error: BulkWriterError) => boolean): void;
657
+
658
+ /**
659
+ * Commits all writes that have been enqueued up to this point in parallel.
660
+ *
661
+ * Returns a Promise that resolves when all currently queued operations have
662
+ * been committed. The Promise will never be rejected since the results for
663
+ * each individual operation are conveyed via their individual Promises.
664
+ *
665
+ * The Promise resolves immediately if there are no pending writes.
666
+ * Otherwise, the Promise waits for all previously issued writes, but it
667
+ * does not wait for writes that were added after the method is called. If
668
+ * you want to wait for additional writes, call `flush()` again.
669
+ *
670
+ * @return A promise that resolves when all enqueued writes
671
+ * up to this point have been committed.
672
+ */
673
+ flush(): Promise<void>;
674
+
675
+ /**
676
+ * Commits all enqueued writes and marks the BulkWriter instance as closed.
677
+ *
678
+ * After calling `close()`, calling any method will throw an error. Any
679
+ * retries scheduled as part of an `onWriteError()` handler will be run
680
+ * before the `close()` promise resolves.
681
+ *
682
+ * Returns a Promise that resolves when all writes have been committed. The
683
+ * Promise will never be rejected. Calling this method will send all
684
+ * requests. The promise resolves immediately if there are no pending
685
+ * writes.
686
+ *
687
+ * @return A promise that resolves when all enqueued writes
688
+ * up to this point have been committed.
689
+ */
690
+ close(): Promise<void>;
691
+ }
692
+
693
+ /**
694
+ * An options object to configure throttling on BulkWriter.
695
+ */
696
+ export interface BulkWriterOptions {
697
+ /**
698
+ * Whether to disable or configure throttling. By default, throttling is
699
+ * enabled. This field can be set to either a boolean or a config
700
+ * object. Setting it to `true` will use default values. You can override
701
+ * the defaults by setting it to `false` to disable throttling, or by
702
+ * setting the config values to enable throttling with the provided values.
703
+ *
704
+ * @see https://firebase.google.com/docs/firestore/best-practices#ramping_up_traffic
705
+ *
706
+ * @param initialOpsPerSecond The initial maximum number of operations per
707
+ * second allowed by the throttler. If this field is not set, the default
708
+ * is 500 operations per second.
709
+ * @param maxOpsPerSecond The maximum number of operations per second
710
+ * allowed by the throttler. If this field is set, the throttler's allowed
711
+ * operations per second does not ramp up past the specified operations per
712
+ * second.
713
+ */
714
+ readonly throttling?: boolean | { initialOpsPerSecond?: number; maxOpsPerSecond?: number };
715
+ }
716
+
717
+ /**
718
+ * The error thrown when a BulkWriter operation fails.
719
+ */
720
+ export class BulkWriterError extends Error {
721
+ /** The status code of the error. */
722
+ readonly code: GrpcStatus;
723
+
724
+ /** The error message of the error. */
725
+ readonly message: string;
726
+
727
+ /** The document reference the operation was performed on. */
728
+ readonly documentRef: DocumentReference<any>;
729
+
730
+ /** The type of operation performed. */
731
+ readonly operationType: 'create' | 'set' | 'update' | 'delete';
732
+
733
+ /** How many times this operation has been attempted unsuccessfully. */
734
+ readonly failedAttempts: number;
735
+ }
736
+
737
+ /**
738
+ * A write batch, used to perform multiple writes as a single atomic unit.
739
+ *
740
+ * A `WriteBatch` object can be acquired by calling `Firestore.batch()`. It
741
+ * provides methods for adding writes to the write batch. None of the
742
+ * writes will be committed (or visible locally) until `WriteBatch.commit()`
743
+ * is called.
744
+ *
745
+ * Unlike transactions, write batches are persisted offline and therefore are
746
+ * preferable when you don't need to condition your writes on read data.
747
+ */
748
+ export class WriteBatch {
749
+ private constructor();
750
+
751
+ /**
752
+ * Create the document referred to by the provided `DocumentReference`. The
753
+ * operation will fail the batch if a document exists at the specified
754
+ * location.
755
+ *
756
+ * @param documentRef A reference to the document to be created.
757
+ * @param data The object data to serialize as the document.
758
+ * @return This `WriteBatch` instance. Used for chaining method calls.
759
+ */
760
+ create<T>(documentRef: DocumentReference<T>, data: T): WriteBatch;
761
+
762
+ /**
763
+ * Write to the document referred to by the provided `DocumentReference`.
764
+ * If the document does not exist yet, it will be created. If you pass
765
+ * `SetOptions`, the provided data can be merged into the existing document.
766
+ *
767
+ * @param documentRef A reference to the document to be set.
768
+ * @param data An object of the fields and values for the document.
769
+ * @param options An object to configure the set behavior.
770
+ * @return This `WriteBatch` instance. Used for chaining method calls.
771
+ */
772
+ set<T>(documentRef: DocumentReference<T>, data: Partial<T>, options: SetOptions): WriteBatch;
773
+ set<T>(documentRef: DocumentReference<T>, data: T): WriteBatch;
774
+
775
+ /**
776
+ * Update fields of the document referred to by the provided
777
+ * `DocumentReference`. If the document doesn't yet exist, the update fails
778
+ * and the entire batch will be rejected.
779
+ *
780
+ * Nested fields can be updated by providing dot-separated field path
781
+ * strings.
782
+ *
783
+ * @param documentRef A reference to the document to be updated.
784
+ * @param data An object containing the fields and values with which to
785
+ * update the document.
786
+ * @param precondition A Precondition to enforce on this update.
787
+ * @return This `WriteBatch` instance. Used for chaining method calls.
788
+ */
789
+ update(
790
+ documentRef: DocumentReference<any>,
791
+ data: UpdateData,
792
+ precondition?: Precondition
793
+ ): WriteBatch;
794
+
795
+ /**
796
+ * Updates fields in the document referred to by the provided
797
+ * `DocumentReference`. The update will fail if applied to a document that
798
+ * does not exist.
799
+ *
800
+ * Nested fields can be updated by providing dot-separated field path
801
+ * strings or by providing FieldPath objects.
802
+ *
803
+ * A `Precondition` restricting this update can be specified as the last
804
+ * argument.
805
+ *
806
+ * @param documentRef A reference to the document to be updated.
807
+ * @param field The first field to update.
808
+ * @param value The first value
809
+ * @param fieldsOrPrecondition An alternating list of field paths and values
810
+ * to update, optionally followed a `Precondition` to enforce on this update.
811
+ * @return This `WriteBatch` instance. Used for chaining method calls.
812
+ */
813
+ update(
814
+ documentRef: DocumentReference<any>,
815
+ field: string | FieldPath,
816
+ value: any,
817
+ ...fieldsOrPrecondition: any[]
818
+ ): WriteBatch;
819
+
820
+ /**
821
+ * Deletes the document referred to by the provided `DocumentReference`.
822
+ *
823
+ * @param documentRef A reference to the document to be deleted.
824
+ * @param precondition A Precondition to enforce for this delete.
825
+ * @return This `WriteBatch` instance. Used for chaining method calls.
826
+ */
827
+ delete(documentRef: DocumentReference<any>, precondition?: Precondition): WriteBatch;
828
+
829
+ /**
830
+ * Commits all of the writes in this write batch as a single atomic unit.
831
+ *
832
+ * @return A Promise resolved once all of the writes in the batch have been
833
+ * successfully written to the backend as an atomic unit.
834
+ */
835
+ commit(): Promise<WriteResult[]>;
836
+ }
837
+
838
+ /**
839
+ * An options object that configures conditional behavior of `update()` and
840
+ * `delete()` calls in `DocumentReference`, `WriteBatch`, and `Transaction`.
841
+ * Using Preconditions, these calls can be restricted to only apply to
842
+ * documents that match the specified restrictions.
843
+ */
844
+ export interface Precondition {
845
+ /**
846
+ * If set, the last update time to enforce.
847
+ */
848
+ readonly lastUpdateTime?: Timestamp;
849
+
850
+ /**
851
+ * If set, enforces that the target document must or must not exist.
852
+ */
853
+ readonly exists?: boolean;
854
+ }
855
+
856
+ /**
857
+ * An options object that configures the behavior of `set()` calls in
858
+ * `DocumentReference`, `WriteBatch` and `Transaction`. These calls can be
859
+ * configured to perform granular merges instead of overwriting the target
860
+ * documents in their entirety.
861
+ */
862
+ export interface SetOptions {
863
+ /**
864
+ * Changes the behavior of a set() call to only replace the values specified
865
+ * in its data argument. Fields omitted from the set() call remain
866
+ * untouched.
867
+ */
868
+ readonly merge?: boolean;
869
+
870
+ /**
871
+ * Changes the behavior of set() calls to only replace the specified field
872
+ * paths. Any field path that is not specified is ignored and remains
873
+ * untouched.
874
+ *
875
+ * It is an error to pass a SetOptions object to a set() call that is
876
+ * missing a value for any of the fields specified here.
877
+ */
878
+ readonly mergeFields?: (string | FieldPath)[];
879
+ }
880
+
881
+ /**
882
+ * An options object that can be used to configure the behavior of `getAll()`
883
+ * calls. By providing a `fieldMask`, these calls can be configured to only
884
+ * return a subset of fields.
885
+ */
886
+ export interface ReadOptions {
887
+ /**
888
+ * Specifies the set of fields to return and reduces the amount of data
889
+ * transmitted by the backend.
890
+ *
891
+ * Adding a field mask does not filter results. Documents do not need to
892
+ * contain values for all the fields in the mask to be part of the result
893
+ * set.
894
+ */
895
+ readonly fieldMask?: (string | FieldPath)[];
896
+ }
897
+
898
+ /**
899
+ * A WriteResult wraps the write time set by the Firestore servers on `sets()`,
900
+ * `updates()`, and `creates()`.
901
+ */
902
+ export class WriteResult {
903
+ private constructor();
904
+
905
+ /**
906
+ * The write time as set by the Firestore servers.
907
+ */
908
+ readonly writeTime: Timestamp;
909
+
910
+ /**
911
+ * Returns true if this `WriteResult` is equal to the provided one.
912
+ *
913
+ * @param other The `WriteResult` to compare against.
914
+ * @return true if this `WriteResult` is equal to the provided one.
915
+ */
916
+ isEqual(other: WriteResult): boolean;
917
+ }
918
+
919
+ /**
920
+ * A `DocumentReference` refers to a document location in a Firestore database
921
+ * and can be used to write, read, or listen to the location. The document at
922
+ * the referenced location may or may not exist. A `DocumentReference` can
923
+ * also be used to create a `CollectionReference` to a subcollection.
924
+ */
925
+ export class DocumentReference<T = DocumentData> {
926
+ private constructor();
927
+
928
+ /** The identifier of the document within its collection. */
929
+ readonly id: string;
930
+
931
+ /**
932
+ * The `Firestore` for the Firestore database (useful for performing
933
+ * transactions, etc.).
934
+ */
935
+ readonly firestore: Firestore;
936
+
937
+ /**
938
+ * A reference to the Collection to which this DocumentReference belongs.
939
+ */
940
+ readonly parent: CollectionReference<T>;
941
+
942
+ /**
943
+ * A string representing the path of the referenced document (relative
944
+ * to the root of the database).
945
+ */
946
+ readonly path: string;
947
+
948
+ /**
949
+ * Gets a `CollectionReference` instance that refers to the collection at
950
+ * the specified path.
951
+ *
952
+ * @param collectionPath A slash-separated path to a collection.
953
+ * @return The `CollectionReference` instance.
954
+ */
955
+ collection(collectionPath: string): CollectionReference<DocumentData>;
956
+
957
+ /**
958
+ * Fetches the subcollections that are direct children of this document.
959
+ *
960
+ * @returns A Promise that resolves with an array of CollectionReferences.
961
+ */
962
+ listCollections(): Promise<Array<CollectionReference<DocumentData>>>;
963
+
964
+ /**
965
+ * Creates a document referred to by this `DocumentReference` with the
966
+ * provided object values. The write fails if the document already exists
967
+ *
968
+ * @param data The object data to serialize as the document.
969
+ * @return A Promise resolved with the write time of this create.
970
+ */
971
+ create(data: T): Promise<WriteResult>;
972
+
973
+ /**
974
+ * Writes to the document referred to by this `DocumentReference`. If the
975
+ * document does not yet exist, it will be created. If you pass
976
+ * `SetOptions`, the provided data can be merged into an existing document.
977
+ *
978
+ * @param data A map of the fields and values for the document.
979
+ * @param options An object to configure the set behavior.
980
+ * @return A Promise resolved with the write time of this set.
981
+ */
982
+ set(data: Partial<T>, options: SetOptions): Promise<WriteResult>;
983
+ set(data: T): Promise<WriteResult>;
984
+
985
+ /**
986
+ * Updates fields in the document referred to by this `DocumentReference`.
987
+ * The update will fail if applied to a document that does not exist.
988
+ *
989
+ * Nested fields can be updated by providing dot-separated field path
990
+ * strings.
991
+ *
992
+ * @param data An object containing the fields and values with which to
993
+ * update the document.
994
+ * @param precondition A Precondition to enforce on this update.
995
+ * @return A Promise resolved with the write time of this update.
996
+ */
997
+ update(data: UpdateData, precondition?: Precondition): Promise<WriteResult>;
998
+
999
+ /**
1000
+ * Updates fields in the document referred to by this `DocumentReference`.
1001
+ * The update will fail if applied to a document that does not exist.
1002
+ *
1003
+ * Nested fields can be updated by providing dot-separated field path
1004
+ * strings or by providing FieldPath objects.
1005
+ *
1006
+ * A `Precondition` restricting this update can be specified as the last
1007
+ * argument.
1008
+ *
1009
+ * @param field The first field to update.
1010
+ * @param value The first value.
1011
+ * @param moreFieldsOrPrecondition An alternating list of field paths and
1012
+ * values to update, optionally followed by a `Precondition` to enforce on
1013
+ * this update.
1014
+ * @return A Promise resolved with the write time of this update.
1015
+ */
1016
+ update(
1017
+ field: string | FieldPath,
1018
+ value: any,
1019
+ ...moreFieldsOrPrecondition: any[]
1020
+ ): Promise<WriteResult>;
1021
+
1022
+ /**
1023
+ * Deletes the document referred to by this `DocumentReference`.
1024
+ *
1025
+ * @param precondition A Precondition to enforce for this delete.
1026
+ * @return A Promise resolved with the write time of this delete.
1027
+ */
1028
+ delete(precondition?: Precondition): Promise<WriteResult>;
1029
+
1030
+ /**
1031
+ * Reads the document referred to by this `DocumentReference`.
1032
+ *
1033
+ * @return A Promise resolved with a DocumentSnapshot containing the
1034
+ * current document contents.
1035
+ */
1036
+ get(): Promise<DocumentSnapshot<T>>;
1037
+
1038
+ /**
1039
+ * Attaches a listener for DocumentSnapshot events.
1040
+ *
1041
+ * @param onNext A callback to be called every time a new `DocumentSnapshot`
1042
+ * is available.
1043
+ * @param onError A callback to be called if the listen fails or is
1044
+ * cancelled. No further callbacks will occur.
1045
+ * @return An unsubscribe function that can be called to cancel
1046
+ * the snapshot listener.
1047
+ */
1048
+ onSnapshot(
1049
+ onNext: (snapshot: DocumentSnapshot<T>) => void,
1050
+ onError?: (error: Error) => void
1051
+ ): () => void;
1052
+
1053
+ /**
1054
+ * Returns true if this `DocumentReference` is equal to the provided one.
1055
+ *
1056
+ * @param other The `DocumentReference` to compare against.
1057
+ * @return true if this `DocumentReference` is equal to the provided one.
1058
+ */
1059
+ isEqual(other: DocumentReference<T>): boolean;
1060
+
1061
+ /**
1062
+ * Applies a custom data converter to this DocumentReference, allowing you
1063
+ * to use your own custom model objects with Firestore. When you call
1064
+ * set(), get(), etc. on the returned DocumentReference instance, the
1065
+ * provided converter will convert between Firestore data and your custom
1066
+ * type U.
1067
+ *
1068
+ * @param converter Converts objects to and from Firestore. Passing in
1069
+ * `null` removes the current converter.
1070
+ * @return A DocumentReference<U> that uses the provided converter.
1071
+ */
1072
+ withConverter<U>(converter: FirestoreDataConverter<U>): DocumentReference<U>;
1073
+ withConverter(converter: null): DocumentReference<DocumentData>;
1074
+ }
1075
+
1076
+ /**
1077
+ * A `DocumentSnapshot` contains data read from a document in your Firestore
1078
+ * database. The data can be extracted with `.data()` or `.get(<field>)` to
1079
+ * get a specific field.
1080
+ *
1081
+ * For a `DocumentSnapshot` that points to a non-existing document, any data
1082
+ * access will return 'undefined'. You can use the `exists` property to
1083
+ * explicitly verify a document's existence.
1084
+ */
1085
+ export class DocumentSnapshot<T = DocumentData> {
1086
+ protected constructor();
1087
+
1088
+ /** True if the document exists. */
1089
+ readonly exists: boolean;
1090
+
1091
+ /** A `DocumentReference` to the document location. */
1092
+ readonly ref: DocumentReference<T>;
1093
+
1094
+ /**
1095
+ * The ID of the document for which this `DocumentSnapshot` contains data.
1096
+ */
1097
+ readonly id: string;
1098
+
1099
+ /**
1100
+ * The time the document was created. Not set for documents that don't
1101
+ * exist.
1102
+ */
1103
+ readonly createTime?: Timestamp;
1104
+
1105
+ /**
1106
+ * The time the document was last updated (at the time the snapshot was
1107
+ * generated). Not set for documents that don't exist.
1108
+ */
1109
+ readonly updateTime?: Timestamp;
1110
+
1111
+ /**
1112
+ * The time this snapshot was read.
1113
+ */
1114
+ readonly readTime: Timestamp;
1115
+
1116
+ /**
1117
+ * Retrieves all fields in the document as an Object. Returns 'undefined' if
1118
+ * the document doesn't exist.
1119
+ *
1120
+ * @return An Object containing all fields in the document.
1121
+ */
1122
+ data(): T | undefined;
1123
+
1124
+ /**
1125
+ * Retrieves the field specified by `fieldPath`.
1126
+ *
1127
+ * @param fieldPath The path (e.g. 'foo' or 'foo.bar') to a specific field.
1128
+ * @return The data at the specified field location or undefined if no such
1129
+ * field exists in the document.
1130
+ */
1131
+ get(fieldPath: string | FieldPath): any;
1132
+
1133
+ /**
1134
+ * Returns true if the document's data and path in this `DocumentSnapshot`
1135
+ * is equal to the provided one.
1136
+ *
1137
+ * @param other The `DocumentSnapshot` to compare against.
1138
+ * @return true if this `DocumentSnapshot` is equal to the provided one.
1139
+ */
1140
+ isEqual(other: DocumentSnapshot<T>): boolean;
1141
+ }
1142
+
1143
+ /**
1144
+ * A `QueryDocumentSnapshot` contains data read from a document in your
1145
+ * Firestore database as part of a query. The document is guaranteed to exist
1146
+ * and its data can be extracted with `.data()` or `.get(<field>)` to get a
1147
+ * specific field.
1148
+ *
1149
+ * A `QueryDocumentSnapshot` offers the same API surface as a
1150
+ * `DocumentSnapshot`. Since query results contain only existing documents, the
1151
+ * `exists` property will always be true and `data()` will never return
1152
+ * 'undefined'.
1153
+ */
1154
+ export class QueryDocumentSnapshot<T = DocumentData> extends DocumentSnapshot<T> {
1155
+ private constructor();
1156
+
1157
+ /**
1158
+ * The time the document was created.
1159
+ */
1160
+ readonly createTime: Timestamp;
1161
+
1162
+ /**
1163
+ * The time the document was last updated (at the time the snapshot was
1164
+ * generated).
1165
+ */
1166
+ readonly updateTime: Timestamp;
1167
+
1168
+ /**
1169
+ * Retrieves all fields in the document as an Object.
1170
+ *
1171
+ * @override
1172
+ * @return An Object containing all fields in the document.
1173
+ */
1174
+ data(): T;
1175
+ }
1176
+
1177
+ /**
1178
+ * The direction of a `Query.orderBy()` clause is specified as 'desc' or 'asc'
1179
+ * (descending or ascending).
1180
+ */
1181
+ export type OrderByDirection = 'desc' | 'asc';
1182
+
1183
+ /**
1184
+ * Filter conditions in a `Query.where()` clause are specified using the
1185
+ * strings '<', '<=', '==', '!=', '>=', '>', 'array-contains', 'in', 'not-in',
1186
+ * and 'array-contains-any'.
1187
+ */
1188
+ export type WhereFilterOp =
1189
+ | '<'
1190
+ | '<='
1191
+ | '=='
1192
+ | '!='
1193
+ | '>='
1194
+ | '>'
1195
+ | 'array-contains'
1196
+ | 'in'
1197
+ | 'not-in'
1198
+ | 'array-contains-any';
1199
+
1200
+ /**
1201
+ * A `Query` refers to a Query which you can read or listen to. You can also
1202
+ * construct refined `Query` objects by adding filters and ordering.
1203
+ */
1204
+ export class Query<T = DocumentData> {
1205
+ protected constructor();
1206
+
1207
+ /**
1208
+ * The `Firestore` for the Firestore database (useful for performing
1209
+ * transactions, etc.).
1210
+ */
1211
+ readonly firestore: Firestore;
1212
+
1213
+ /**
1214
+ * Creates and returns a new Query with the additional filter that documents
1215
+ * must contain the specified field and that its value should satisfy the
1216
+ * relation constraint provided.
1217
+ *
1218
+ * This function returns a new (immutable) instance of the Query (rather
1219
+ * than modify the existing instance) to impose the filter.
1220
+ *
1221
+ * @param fieldPath The path to compare
1222
+ * @param opStr The operation string (e.g "<", "<=", "==", ">", ">=").
1223
+ * @param value The value for comparison
1224
+ * @return The created Query.
1225
+ */
1226
+ where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: any): Query<T>;
1227
+
1228
+ /**
1229
+ * Creates and returns a new Query that's additionally sorted by the
1230
+ * specified field, optionally in descending order instead of ascending.
1231
+ *
1232
+ * This function returns a new (immutable) instance of the Query (rather
1233
+ * than modify the existing instance) to impose the order.
1234
+ *
1235
+ * @param fieldPath The field to sort by.
1236
+ * @param directionStr Optional direction to sort by ('asc' or 'desc'). If
1237
+ * not specified, order will be ascending.
1238
+ * @return The created Query.
1239
+ */
1240
+ orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): Query<T>;
1241
+
1242
+ /**
1243
+ * Creates and returns a new Query that only returns the first matching
1244
+ * documents.
1245
+ *
1246
+ * This function returns a new (immutable) instance of the Query (rather
1247
+ * than modify the existing instance) to impose the limit.
1248
+ *
1249
+ * @param limit The maximum number of items to return.
1250
+ * @return The created Query.
1251
+ */
1252
+ limit(limit: number): Query<T>;
1253
+
1254
+ /**
1255
+ * Creates and returns a new Query that only returns the last matching
1256
+ * documents.
1257
+ *
1258
+ * You must specify at least one orderBy clause for limitToLast queries,
1259
+ * otherwise an exception will be thrown during execution.
1260
+ *
1261
+ * Results for limitToLast queries cannot be streamed via the `stream()`
1262
+ * API.
1263
+ *
1264
+ * @param limit The maximum number of items to return.
1265
+ * @return The created Query.
1266
+ */
1267
+ limitToLast(limit: number): Query<T>;
1268
+
1269
+ /**
1270
+ * Specifies the offset of the returned results.
1271
+ *
1272
+ * This function returns a new (immutable) instance of the Query (rather
1273
+ * than modify the existing instance) to impose the offset.
1274
+ *
1275
+ * @param offset The offset to apply to the Query results.
1276
+ * @return The created Query.
1277
+ */
1278
+ offset(offset: number): Query<T>;
1279
+
1280
+ /**
1281
+ * Creates and returns a new Query instance that applies a field mask to
1282
+ * the result and returns only the specified subset of fields. You can
1283
+ * specify a list of field paths to return, or use an empty list to only
1284
+ * return the references of matching documents.
1285
+ *
1286
+ * Queries that contain field masks cannot be listened to via `onSnapshot()`
1287
+ * listeners.
1288
+ *
1289
+ * This function returns a new (immutable) instance of the Query (rather
1290
+ * than modify the existing instance) to impose the field mask.
1291
+ *
1292
+ * @param field The field paths to return.
1293
+ * @return The created Query.
1294
+ */
1295
+ select(...field: (string | FieldPath)[]): Query<DocumentData>;
1296
+
1297
+ /**
1298
+ * Creates and returns a new Query that starts at the provided document
1299
+ * (inclusive). The starting position is relative to the order of the query.
1300
+ * The document must contain all of the fields provided in the orderBy of
1301
+ * this query.
1302
+ *
1303
+ * @param snapshot The snapshot of the document to start after.
1304
+ * @return The created Query.
1305
+ */
1306
+ startAt(snapshot: DocumentSnapshot<any>): Query<T>;
1307
+
1308
+ /**
1309
+ * Creates and returns a new Query that starts at the provided fields
1310
+ * relative to the order of the query. The order of the field values
1311
+ * must match the order of the order by clauses of the query.
1312
+ *
1313
+ * @param fieldValues The field values to start this query at, in order
1314
+ * of the query's order by.
1315
+ * @return The created Query.
1316
+ */
1317
+ startAt(...fieldValues: any[]): Query<T>;
1318
+
1319
+ /**
1320
+ * Creates and returns a new Query that starts after the provided document
1321
+ * (exclusive). The starting position is relative to the order of the query.
1322
+ * The document must contain all of the fields provided in the orderBy of
1323
+ * this query.
1324
+ *
1325
+ * @param snapshot The snapshot of the document to start after.
1326
+ * @return The created Query.
1327
+ */
1328
+ startAfter(snapshot: DocumentSnapshot<any>): Query<T>;
1329
+
1330
+ /**
1331
+ * Creates and returns a new Query that starts after the provided fields
1332
+ * relative to the order of the query. The order of the field values
1333
+ * must match the order of the order by clauses of the query.
1334
+ *
1335
+ * @param fieldValues The field values to start this query after, in order
1336
+ * of the query's order by.
1337
+ * @return The created Query.
1338
+ */
1339
+ startAfter(...fieldValues: any[]): Query<T>;
1340
+
1341
+ /**
1342
+ * Creates and returns a new Query that ends before the provided document
1343
+ * (exclusive). The end position is relative to the order of the query. The
1344
+ * document must contain all of the fields provided in the orderBy of this
1345
+ * query.
1346
+ *
1347
+ * @param snapshot The snapshot of the document to end before.
1348
+ * @return The created Query.
1349
+ */
1350
+ endBefore(snapshot: DocumentSnapshot<any>): Query<T>;
1351
+
1352
+ /**
1353
+ * Creates and returns a new Query that ends before the provided fields
1354
+ * relative to the order of the query. The order of the field values
1355
+ * must match the order of the order by clauses of the query.
1356
+ *
1357
+ * @param fieldValues The field values to end this query before, in order
1358
+ * of the query's order by.
1359
+ * @return The created Query.
1360
+ */
1361
+ endBefore(...fieldValues: any[]): Query<T>;
1362
+
1363
+ /**
1364
+ * Creates and returns a new Query that ends at the provided document
1365
+ * (inclusive). The end position is relative to the order of the query. The
1366
+ * document must contain all of the fields provided in the orderBy of this
1367
+ * query.
1368
+ *
1369
+ * @param snapshot The snapshot of the document to end at.
1370
+ * @return The created Query.
1371
+ */
1372
+ endAt(snapshot: DocumentSnapshot<any>): Query<T>;
1373
+
1374
+ /**
1375
+ * Creates and returns a new Query that ends at the provided fields
1376
+ * relative to the order of the query. The order of the field values
1377
+ * must match the order of the order by clauses of the query.
1378
+ *
1379
+ * @param fieldValues The field values to end this query at, in order
1380
+ * of the query's order by.
1381
+ * @return The created Query.
1382
+ */
1383
+ endAt(...fieldValues: any[]): Query<T>;
1384
+
1385
+ /**
1386
+ * Executes the query and returns the results as a `QuerySnapshot`.
1387
+ *
1388
+ * @return A Promise that will be resolved with the results of the Query.
1389
+ */
1390
+ get(): Promise<QuerySnapshot<T>>;
1391
+
1392
+ /*
1393
+ * Executes the query and returns the results as Node Stream.
1394
+ *
1395
+ * @return A stream of QueryDocumentSnapshot.
1396
+ */
1397
+ stream(): NodeJS.ReadableStream;
1398
+
1399
+ /**
1400
+ * Attaches a listener for `QuerySnapshot `events.
1401
+ *
1402
+ * @param onNext A callback to be called every time a new `QuerySnapshot`
1403
+ * is available.
1404
+ * @param onError A callback to be called if the listen fails or is
1405
+ * cancelled. No further callbacks will occur.
1406
+ * @return An unsubscribe function that can be called to cancel
1407
+ * the snapshot listener.
1408
+ */
1409
+ onSnapshot(
1410
+ onNext: (snapshot: QuerySnapshot<T>) => void,
1411
+ onError?: (error: Error) => void
1412
+ ): () => void;
1413
+
1414
+ /**
1415
+ * Returns true if this `Query` is equal to the provided one.
1416
+ *
1417
+ * @param other The `Query` to compare against.
1418
+ * @return true if this `Query` is equal to the provided one.
1419
+ */
1420
+ isEqual(other: Query<T>): boolean;
1421
+
1422
+ /**
1423
+ * Applies a custom data converter to this Query, allowing you to use your
1424
+ * own custom model objects with Firestore. When you call get() on the
1425
+ * returned Query, the provided converter will convert between Firestore
1426
+ * data and your custom type U.
1427
+ *
1428
+ * @param converter Converts objects to and from Firestore. Passing in
1429
+ * `null` removes the current converter.
1430
+ * @return A Query<U> that uses the provided converter.
1431
+ */
1432
+ withConverter<U>(converter: FirestoreDataConverter<U>): Query<U>;
1433
+ withConverter(converter: null): Query<DocumentData>;
1434
+ }
1435
+
1436
+ /**
1437
+ * A `QuerySnapshot` contains zero or more `QueryDocumentSnapshot` objects
1438
+ * representing the results of a query. The documents can be accessed as an
1439
+ * array via the `docs` property or enumerated using the `forEach` method. The
1440
+ * number of documents can be determined via the `empty` and `size`
1441
+ * properties.
1442
+ */
1443
+ export class QuerySnapshot<T = DocumentData> {
1444
+ private constructor();
1445
+
1446
+ /**
1447
+ * The query on which you called `get` or `onSnapshot` in order to get this
1448
+ * `QuerySnapshot`.
1449
+ */
1450
+ readonly query: Query<T>;
1451
+
1452
+ /** An array of all the documents in the QuerySnapshot. */
1453
+ readonly docs: Array<QueryDocumentSnapshot<T>>;
1454
+
1455
+ /** The number of documents in the QuerySnapshot. */
1456
+ readonly size: number;
1457
+
1458
+ /** True if there are no documents in the QuerySnapshot. */
1459
+ readonly empty: boolean;
1460
+
1461
+ /** The time this query snapshot was obtained. */
1462
+ readonly readTime: Timestamp;
1463
+
1464
+ /**
1465
+ * Returns an array of the documents changes since the last snapshot. If
1466
+ * this is the first snapshot, all documents will be in the list as added
1467
+ * changes.
1468
+ */
1469
+ docChanges(): DocumentChange<T>[];
1470
+
1471
+ /**
1472
+ * Enumerates all of the documents in the QuerySnapshot.
1473
+ *
1474
+ * @param callback A callback to be called with a `DocumentSnapshot` for
1475
+ * each document in the snapshot.
1476
+ * @param thisArg The `this` binding for the callback.
1477
+ */
1478
+ forEach(callback: (result: QueryDocumentSnapshot<T>) => void, thisArg?: any): void;
1479
+
1480
+ /**
1481
+ * Returns true if the document data in this `QuerySnapshot` is equal to the
1482
+ * provided one.
1483
+ *
1484
+ * @param other The `QuerySnapshot` to compare against.
1485
+ * @return true if this `QuerySnapshot` is equal to the provided one.
1486
+ */
1487
+ isEqual(other: QuerySnapshot<T>): boolean;
1488
+ }
1489
+
1490
+ /**
1491
+ * The type of of a `DocumentChange` may be 'added', 'removed', or 'modified'.
1492
+ */
1493
+ export type DocumentChangeType = 'added' | 'removed' | 'modified';
1494
+
1495
+ /**
1496
+ * A `DocumentChange` represents a change to the documents matching a query.
1497
+ * It contains the document affected and the type of change that occurred.
1498
+ */
1499
+ export interface DocumentChange<T = DocumentData> {
1500
+ /** The type of change ('added', 'modified', or 'removed'). */
1501
+ readonly type: DocumentChangeType;
1502
+
1503
+ /** The document affected by this change. */
1504
+ readonly doc: QueryDocumentSnapshot<T>;
1505
+
1506
+ /**
1507
+ * The index of the changed document in the result set immediately prior to
1508
+ * this DocumentChange (i.e. supposing that all prior DocumentChange objects
1509
+ * have been applied). Is -1 for 'added' events.
1510
+ */
1511
+ readonly oldIndex: number;
1512
+
1513
+ /**
1514
+ * The index of the changed document in the result set immediately after
1515
+ * this DocumentChange (i.e. supposing that all prior DocumentChange
1516
+ * objects and the current DocumentChange object have been applied).
1517
+ * Is -1 for 'removed' events.
1518
+ */
1519
+ readonly newIndex: number;
1520
+
1521
+ /**
1522
+ * Returns true if the data in this `DocumentChange` is equal to the
1523
+ * provided one.
1524
+ *
1525
+ * @param other The `DocumentChange` to compare against.
1526
+ * @return true if this `DocumentChange` is equal to the provided one.
1527
+ */
1528
+ isEqual(other: DocumentChange<T>): boolean;
1529
+ }
1530
+
1531
+ /**
1532
+ * A `CollectionReference` object can be used for adding documents, getting
1533
+ * document references, and querying for documents (using the methods
1534
+ * inherited from `Query`).
1535
+ */
1536
+ export class CollectionReference<T = DocumentData> extends Query<T> {
1537
+ private constructor();
1538
+
1539
+ /** The identifier of the collection. */
1540
+ readonly id: string;
1541
+
1542
+ /**
1543
+ * A reference to the containing Document if this is a subcollection, else
1544
+ * null.
1545
+ */
1546
+ readonly parent: DocumentReference<DocumentData> | null;
1547
+
1548
+ /**
1549
+ * A string representing the path of the referenced collection (relative
1550
+ * to the root of the database).
1551
+ */
1552
+ readonly path: string;
1553
+
1554
+ /**
1555
+ * Retrieves the list of documents in this collection.
1556
+ *
1557
+ * The document references returned may include references to "missing
1558
+ * documents", i.e. document locations that have no document present but
1559
+ * which contain subcollections with documents. Attempting to read such a
1560
+ * document reference (e.g. via `.get()` or `.onSnapshot()`) will return a
1561
+ * `DocumentSnapshot` whose `.exists` property is false.
1562
+ *
1563
+ * @return {Promise<DocumentReference[]>} The list of documents in this
1564
+ * collection.
1565
+ */
1566
+ listDocuments(): Promise<Array<DocumentReference<T>>>;
1567
+
1568
+ /**
1569
+ * Get a `DocumentReference` for a randomly-named document within this
1570
+ * collection. An automatically-generated unique ID will be used as the
1571
+ * document ID.
1572
+ *
1573
+ * @return The `DocumentReference` instance.
1574
+ */
1575
+ doc(): DocumentReference<T>;
1576
+
1577
+ /**
1578
+ * Get a `DocumentReference` for the document within the collection at the
1579
+ * specified path.
1580
+ *
1581
+ * @param documentPath A slash-separated path to a document.
1582
+ * @return The `DocumentReference` instance.
1583
+ */
1584
+ doc(documentPath: string): DocumentReference<T>;
1585
+
1586
+ /**
1587
+ * Add a new document to this collection with the specified data, assigning
1588
+ * it a document ID automatically.
1589
+ *
1590
+ * @param data An Object containing the data for the new document.
1591
+ * @return A Promise resolved with a `DocumentReference` pointing to the
1592
+ * newly created document after it has been written to the backend.
1593
+ */
1594
+ add(data: T): Promise<DocumentReference<T>>;
1595
+
1596
+ /**
1597
+ * Returns true if this `CollectionReference` is equal to the provided one.
1598
+ *
1599
+ * @param other The `CollectionReference` to compare against.
1600
+ * @return true if this `CollectionReference` is equal to the provided one.
1601
+ */
1602
+ isEqual(other: CollectionReference<T>): boolean;
1603
+
1604
+ /**
1605
+ * Applies a custom data converter to this CollectionReference, allowing you
1606
+ * to use your own custom model objects with Firestore. When you call add()
1607
+ * on the returned CollectionReference instance, the provided converter will
1608
+ * convert between Firestore data and your custom type U.
1609
+ *
1610
+ * @param converter Converts objects to and from Firestore. Passing in
1611
+ * `null` removes the current converter.
1612
+ * @return A CollectionReference<U> that uses the provided converter.
1613
+ */
1614
+ withConverter<U>(converter: FirestoreDataConverter<U>): CollectionReference<U>;
1615
+ withConverter(converter: null): CollectionReference<DocumentData>;
1616
+ }
1617
+
1618
+ /**
1619
+ * A `CollectionGroup` refers to all documents that are contained in a
1620
+ * collection or subcollection with a specific collection ID.
1621
+ */
1622
+ export class CollectionGroup<T = DocumentData> extends Query<T> {
1623
+ private constructor();
1624
+
1625
+ /**
1626
+ * Partitions a query by returning partition cursors that can be used to run
1627
+ * the query in parallel. The returned cursors are split points that can be
1628
+ * used as starting and end points for individual query invocations.
1629
+ *
1630
+ * @param desiredPartitionCount The desired maximum number of partition
1631
+ * points. The number must be strictly positive. The actual number of
1632
+ * partitions returned may be fewer.
1633
+ * @return An AsyncIterable of `QueryPartition`s.
1634
+ */
1635
+ getPartitions(desiredPartitionCount: number): AsyncIterable<QueryPartition<T>>;
1636
+
1637
+ /**
1638
+ * Applies a custom data converter to this `CollectionGroup`, allowing you
1639
+ * to use your own custom model objects with Firestore. When you call get()
1640
+ * on the returned `CollectionGroup`, the provided converter will convert
1641
+ * between Firestore data and your custom type U.
1642
+ *
1643
+ * Using the converter allows you to specify generic type arguments when
1644
+ * storing and retrieving objects from Firestore.
1645
+ *
1646
+ * @example
1647
+ * class Post {
1648
+ * constructor(readonly title: string, readonly author: string) {}
1649
+ *
1650
+ * toString(): string {
1651
+ * return this.title + ', by ' + this.author;
1652
+ * }
1653
+ * }
1654
+ *
1655
+ * const postConverter = {
1656
+ * toFirestore(post: Post): FirebaseFirestore.DocumentData {
1657
+ * return {title: post.title, author: post.author};
1658
+ * },
1659
+ * fromFirestore(
1660
+ * snapshot: FirebaseFirestore.QueryDocumentSnapshot
1661
+ * ): Post {
1662
+ * const data = snapshot.data();
1663
+ * return new Post(data.title, data.author);
1664
+ * }
1665
+ * };
1666
+ *
1667
+ * const querySnapshot = await Firestore()
1668
+ * .collectionGroup('posts')
1669
+ * .withConverter(postConverter)
1670
+ * .get();
1671
+ * for (const doc of querySnapshot.docs) {
1672
+ * const post = doc.data();
1673
+ * post.title; // string
1674
+ * post.toString(); // Should be defined
1675
+ * post.someNonExistentProperty; // TS error
1676
+ * }
1677
+ *
1678
+ * @param converter Converts objects to and from Firestore. Passing in
1679
+ * `null` removes the current converter.
1680
+ * @return A `CollectionGroup<U>` that uses the provided converter.
1681
+ */
1682
+ withConverter<U>(converter: FirestoreDataConverter<U>): CollectionGroup<U>;
1683
+ withConverter(converter: null): CollectionGroup<DocumentData>;
1684
+ }
1685
+
1686
+ /**
1687
+ * A split point that can be used in a query as a starting and/or end point for
1688
+ * the query results. The cursors returned by {@link #startAt} and {@link
1689
+ * #endBefore} can only be used in a query that matches the constraint of query
1690
+ * that produced this partition.
1691
+ */
1692
+ export class QueryPartition<T = DocumentData> {
1693
+ private constructor();
1694
+
1695
+ /**
1696
+ * The cursor that defines the first result for this partition or
1697
+ * `undefined` if this is the first partition. The cursor value must be
1698
+ * destructured when passed to `startAt()` (for example with
1699
+ * `query.startAt(...queryPartition.startAt)`).
1700
+ *
1701
+ * @return Cursor values that can be used with {@link Query#startAt} or
1702
+ * `undefined` if this is the first partition.
1703
+ */
1704
+ get startAt(): unknown[] | undefined;
1705
+
1706
+ /**
1707
+ * The cursor that defines the first result after this partition or
1708
+ * `undefined` if this is the last partition. The cursor value must be
1709
+ * destructured when passed to `endBefore()` (for example with
1710
+ * `query.endBefore(...queryPartition.endBefore)`).
1711
+ *
1712
+ * @return Cursor values that can be used with {@link Query#endBefore} or
1713
+ * `undefined` if this is the last partition.
1714
+ */
1715
+ get endBefore(): unknown[] | undefined;
1716
+
1717
+ /**
1718
+ * Returns a query that only returns the documents for this partition.
1719
+ *
1720
+ * @return A query partitioned by a {@link Query#startAt} and {@link
1721
+ * Query#endBefore} cursor.
1722
+ */
1723
+ toQuery(): Query<T>;
1724
+ }
1725
+
1726
+ /**
1727
+ * Sentinel values that can be used when writing document fields with set(),
1728
+ * create() or update().
1729
+ */
1730
+ export class FieldValue {
1731
+ private constructor();
1732
+
1733
+ /**
1734
+ * Returns a sentinel used with set(), create() or update() to include a
1735
+ * server-generated timestamp in the written data.
1736
+ *
1737
+ * @return The FieldValue sentinel for use in a call to set(), create() or
1738
+ * update().
1739
+ */
1740
+ static serverTimestamp(): FieldValue;
1741
+
1742
+ /**
1743
+ * Returns a sentinel for use with update() or set() with {merge:true} to
1744
+ * mark a field for deletion.
1745
+ *
1746
+ * @return The FieldValue sentinel for use in a call to set() or update().
1747
+ */
1748
+ static delete(): FieldValue;
1749
+
1750
+ /**
1751
+ * Returns a special value that can be used with set(), create() or update()
1752
+ * that tells the server to increment the field's current value by the given
1753
+ * value.
1754
+ *
1755
+ * If either current field value or the operand uses floating point
1756
+ * precision, both values will be interpreted as floating point numbers and
1757
+ * all arithmetic will follow IEEE 754 semantics. Otherwise, integer
1758
+ * precision is kept and the result is capped between -2^63 and 2^63-1.
1759
+ *
1760
+ * If the current field value is not of type 'number', or if the field does
1761
+ * not yet exist, the transformation will set the field to the given value.
1762
+ *
1763
+ * @param n The value to increment by.
1764
+ * @return The FieldValue sentinel for use in a call to set(), create() or
1765
+ * update().
1766
+ */
1767
+ static increment(n: number): FieldValue;
1768
+
1769
+ /**
1770
+ * Returns a special value that can be used with set(), create() or update()
1771
+ * that tells the server to union the given elements with any array value
1772
+ * that already exists on the server. Each specified element that doesn't
1773
+ * already exist in the array will be added to the end. If the field being
1774
+ * modified is not already an array it will be overwritten with an array
1775
+ * containing exactly the specified elements.
1776
+ *
1777
+ * @param elements The elements to union into the array.
1778
+ * @return The FieldValue sentinel for use in a call to set(), create() or
1779
+ * update().
1780
+ */
1781
+ static arrayUnion(...elements: any[]): FieldValue;
1782
+
1783
+ /**
1784
+ * Returns a special value that can be used with set(), create() or update()
1785
+ * that tells the server to remove the given elements from any array value
1786
+ * that already exists on the server. All instances of each element
1787
+ * specified will be removed from the array. If the field being modified is
1788
+ * not already an array it will be overwritten with an empty array.
1789
+ *
1790
+ * @param elements The elements to remove from the array.
1791
+ * @return The FieldValue sentinel for use in a call to set(), create() or
1792
+ * update().
1793
+ */
1794
+ static arrayRemove(...elements: any[]): FieldValue;
1795
+
1796
+ /**
1797
+ * Returns true if this `FieldValue` is equal to the provided one.
1798
+ *
1799
+ * @param other The `FieldValue` to compare against.
1800
+ * @return true if this `FieldValue` is equal to the provided one.
1801
+ */
1802
+ isEqual(other: FieldValue): boolean;
1803
+ }
1804
+
1805
+ /**
1806
+ * A FieldPath refers to a field in a document. The path may consist of a
1807
+ * single field name (referring to a top-level field in the document), or a
1808
+ * list of field names (referring to a nested field in the document).
1809
+ */
1810
+ export class FieldPath {
1811
+ /**
1812
+ * Creates a FieldPath from the provided field names. If more than one field
1813
+ * name is provided, the path will point to a nested field in a document.
1814
+ *
1815
+ * @param fieldNames A list of field names.
1816
+ */
1817
+ constructor(...fieldNames: string[]);
1818
+
1819
+ /**
1820
+ * Returns a special sentinel FieldPath to refer to the ID of a document.
1821
+ * It can be used in queries to sort or filter by the document ID.
1822
+ */
1823
+ static documentId(): FieldPath;
1824
+
1825
+ /**
1826
+ * Returns true if this `FieldPath` is equal to the provided one.
1827
+ *
1828
+ * @param other The `FieldPath` to compare against.
1829
+ * @return true if this `FieldPath` is equal to the provided one.
1830
+ */
1831
+ isEqual(other: FieldPath): boolean;
1832
+ }
1833
+
1834
+ /**
1835
+ * A Timestamp represents a point in time independent of any time zone or
1836
+ * calendar, represented as seconds and fractions of seconds at nanosecond
1837
+ * resolution in UTC Epoch time. It is encoded using the Proleptic Gregorian
1838
+ * Calendar which extends the Gregorian calendar backwards to year one. It is
1839
+ * encoded assuming all minutes are 60 seconds long, i.e. leap seconds are
1840
+ * "smeared" so that no leap second table is needed for interpretation. Range
1841
+ * is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
1842
+ *
1843
+ * @see https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto
1844
+ */
1845
+ export class Timestamp {
1846
+ /**
1847
+ * Creates a new timestamp with the current date, with millisecond precision.
1848
+ *
1849
+ * @return A new `Timestamp` representing the current date.
1850
+ */
1851
+ static now(): Timestamp;
1852
+
1853
+ /**
1854
+ * Creates a new timestamp from the given date.
1855
+ *
1856
+ * @param date The date to initialize the `Timestamp` from.
1857
+ * @return A new `Timestamp` representing the same point in time as the
1858
+ * given date.
1859
+ */
1860
+ static fromDate(date: Date): Timestamp;
1861
+
1862
+ /**
1863
+ * Creates a new timestamp from the given number of milliseconds.
1864
+ *
1865
+ * @param milliseconds Number of milliseconds since Unix epoch
1866
+ * 1970-01-01T00:00:00Z.
1867
+ * @return A new `Timestamp` representing the same point in time as the
1868
+ * given number of milliseconds.
1869
+ */
1870
+ static fromMillis(milliseconds: number): Timestamp;
1871
+
1872
+ /**
1873
+ * Creates a new timestamp.
1874
+ *
1875
+ * @param seconds The number of seconds of UTC time since Unix epoch
1876
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
1877
+ * 9999-12-31T23:59:59Z inclusive.
1878
+ * @param nanoseconds The non-negative fractions of a second at nanosecond
1879
+ * resolution. Negative second values with fractions must still have
1880
+ * non-negative nanoseconds values that count forward in time. Must be from
1881
+ * 0 to 999,999,999 inclusive.
1882
+ */
1883
+ constructor(seconds: number, nanoseconds: number);
1884
+
1885
+ /**
1886
+ * The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
1887
+ */
1888
+ readonly seconds: number;
1889
+
1890
+ /** The non-negative fractions of a second at nanosecond resolution. */
1891
+ readonly nanoseconds: number;
1892
+
1893
+ /**
1894
+ * Returns a new `Date` corresponding to this timestamp. This may lose
1895
+ * precision.
1896
+ *
1897
+ * @return JavaScript `Date` object representing the same point in time as
1898
+ * this `Timestamp`, with millisecond precision.
1899
+ */
1900
+ toDate(): Date;
1901
+
1902
+ /**
1903
+ * Returns the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
1904
+ *
1905
+ * @return The point in time corresponding to this timestamp, represented as
1906
+ * the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.
1907
+ */
1908
+ toMillis(): number;
1909
+
1910
+ /**
1911
+ * Returns true if this `Timestamp` is equal to the provided one.
1912
+ *
1913
+ * @param other The `Timestamp` to compare against.
1914
+ * @return 'true' if this `Timestamp` is equal to the provided one.
1915
+ */
1916
+ isEqual(other: Timestamp): boolean;
1917
+
1918
+ /**
1919
+ * Converts this object to a primitive `string`, which allows `Timestamp` objects to be compared
1920
+ * using the `>`, `<=`, `>=` and `>` operators.
1921
+ *
1922
+ * @return a string encoding of this object.
1923
+ */
1924
+ valueOf(): string;
1925
+ }
1926
+
1927
+ /**
1928
+ * Builds a Firestore data bundle with results from the given document and query snapshots.
1929
+ */
1930
+ export class BundleBuilder {
1931
+ /** The ID of this bundle. */
1932
+ readonly bundleId: string;
1933
+
1934
+ /**
1935
+ * Adds a Firestore `DocumentSnapshot` to the bundle. Both the documents data and the document
1936
+ * read time will be included in the bundle.
1937
+ *
1938
+ * @param documentSnapshot A `DocumentSnapshot` to add.
1939
+ * @returns This instance.
1940
+ */
1941
+ add<T>(documentSnapshot: DocumentSnapshot<T>): BundleBuilder;
1942
+
1943
+ /**
1944
+ * Adds a Firestore `QuerySnapshot` to the bundle. Both the documents in the query results and
1945
+ * the query read time will be included in the bundle.
1946
+ *
1947
+ * @param queryName The name of the query to add.
1948
+ * @param querySnapshot A `QuerySnapshot` to add to the bundle.
1949
+ * @returns This instance.
1950
+ */
1951
+ add<T>(queryName: string, querySnapshot: QuerySnapshot<T>): BundleBuilder;
1952
+
1953
+ /**
1954
+ * Builds the bundle and returns the result as a `Buffer` instance.
1955
+ */
1956
+ build(): Buffer;
1957
+ }
1958
+
1959
+ /**
1960
+ * The v1beta1 Veneer client. This client provides access to to the underlying
1961
+ * Firestore v1beta1 RPCs.
1962
+ * @deprecated Use v1 instead.
1963
+ */
1964
+ // export const v1beta1: {
1965
+ // FirestoreClient: typeof import('./v1beta1/firestore_client').FirestoreClient;
1966
+ // };
1967
+
1968
+ /**
1969
+ * The v1 Veneer clients. These clients provide access to the Firestore Admin
1970
+ * API and the underlying Firestore v1 RPCs.
1971
+ */
1972
+ // export const v1: {
1973
+ // FirestoreClient: typeof import('./v1/firestore_client').FirestoreClient;
1974
+ // FirestoreAdminClient: typeof import('./v1/firestore_admin_client').FirestoreAdminClient;
1975
+ // };
1976
+
1977
+ /**
1978
+ * Status codes returned by Firestore's gRPC calls.
1979
+ */
1980
+ export enum GrpcStatus {
1981
+ OK = 0,
1982
+ CANCELLED = 1,
1983
+ UNKNOWN = 2,
1984
+ INVALID_ARGUMENT = 3,
1985
+ DEADLINE_EXCEEDED = 4,
1986
+ NOT_FOUND = 5,
1987
+ ALREADY_EXISTS = 6,
1988
+ PERMISSION_DENIED = 7,
1989
+ RESOURCE_EXHAUSTED = 8,
1990
+ FAILED_PRECONDITION = 9,
1991
+ ABORTED = 10,
1992
+ OUT_OF_RANGE = 11,
1993
+ UNIMPLEMENTED = 12,
1994
+ INTERNAL = 13,
1995
+ UNAVAILABLE = 14,
1996
+ DATA_LOSS = 15,
1997
+ UNAUTHENTICATED = 16,
1998
+ }