@firebase/firestore 3.5.0-canary.e35db6f95 → 3.5.0-canary.ee871fc0b

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 (69) hide show
  1. package/dist/firestore/lite/index.d.ts +2 -0
  2. package/dist/firestore/src/api/aggregate.d.ts +19 -5
  3. package/dist/firestore/src/api/database.d.ts +6 -6
  4. package/dist/firestore/src/api.d.ts +2 -0
  5. package/dist/firestore/src/core/count_query_runner.d.ts +32 -0
  6. package/dist/firestore/src/core/firestore_client.d.ts +2 -2
  7. package/dist/firestore/src/lite-api/aggregate.d.ts +17 -61
  8. package/dist/firestore/src/lite-api/aggregate_types.d.ts +69 -0
  9. package/dist/firestore/src/lite-api/database.d.ts +6 -6
  10. package/dist/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  11. package/dist/index.d.ts +189 -7
  12. package/dist/index.esm2017.js +3167 -2981
  13. package/dist/index.esm2017.js.map +1 -1
  14. package/dist/index.esm5.js +3477 -3276
  15. package/dist/index.esm5.js.map +1 -1
  16. package/dist/index.node.cjs.js +3893 -3670
  17. package/dist/index.node.cjs.js.map +1 -1
  18. package/dist/index.node.mjs +3890 -3671
  19. package/dist/index.node.mjs.map +1 -1
  20. package/dist/index.rn.js +3231 -3045
  21. package/dist/index.rn.js.map +1 -1
  22. package/dist/internal.d.ts +103 -7
  23. package/dist/lite/firestore/lite/index.d.ts +2 -0
  24. package/dist/lite/firestore/src/api/aggregate.d.ts +19 -5
  25. package/dist/lite/firestore/src/api/database.d.ts +6 -6
  26. package/dist/lite/firestore/src/api.d.ts +2 -0
  27. package/dist/lite/firestore/src/core/count_query_runner.d.ts +32 -0
  28. package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -2
  29. package/dist/lite/firestore/src/lite-api/aggregate.d.ts +17 -61
  30. package/dist/lite/firestore/src/lite-api/aggregate_types.d.ts +69 -0
  31. package/dist/lite/firestore/src/lite-api/database.d.ts +6 -6
  32. package/dist/lite/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  33. package/dist/lite/index.browser.esm2017.js +1068 -917
  34. package/dist/lite/index.browser.esm2017.js.map +1 -1
  35. package/dist/lite/index.browser.esm5.js +1183 -1037
  36. package/dist/lite/index.browser.esm5.js.map +1 -1
  37. package/dist/lite/index.d.ts +84 -4
  38. package/dist/lite/index.node.cjs.js +240 -62
  39. package/dist/lite/index.node.cjs.js.map +1 -1
  40. package/dist/lite/index.node.mjs +238 -64
  41. package/dist/lite/index.node.mjs.map +1 -1
  42. package/dist/lite/index.rn.esm2017.js +1059 -908
  43. package/dist/lite/index.rn.esm2017.js.map +1 -1
  44. package/dist/lite/internal.d.ts +95 -6
  45. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +213 -128
  46. package/dist/lite/packages/firestore/lite/index.d.ts +2 -0
  47. package/dist/lite/packages/firestore/src/api/aggregate.d.ts +19 -5
  48. package/dist/lite/packages/firestore/src/api/database.d.ts +6 -6
  49. package/dist/lite/packages/firestore/src/api.d.ts +2 -0
  50. package/dist/lite/packages/firestore/src/core/count_query_runner.d.ts +32 -0
  51. package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -2
  52. package/dist/lite/packages/firestore/src/lite-api/aggregate.d.ts +17 -61
  53. package/dist/lite/packages/firestore/src/lite-api/aggregate_types.d.ts +69 -0
  54. package/dist/lite/packages/firestore/src/lite-api/database.d.ts +6 -6
  55. package/dist/lite/packages/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  56. package/dist/lite/private.d.ts +93 -4
  57. package/dist/packages/firestore/dist/index.esm2017.d.ts +295 -186
  58. package/dist/packages/firestore/lite/index.d.ts +2 -0
  59. package/dist/packages/firestore/src/api/aggregate.d.ts +19 -5
  60. package/dist/packages/firestore/src/api/database.d.ts +6 -6
  61. package/dist/packages/firestore/src/api.d.ts +2 -0
  62. package/dist/packages/firestore/src/core/count_query_runner.d.ts +32 -0
  63. package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -2
  64. package/dist/packages/firestore/src/lite-api/aggregate.d.ts +17 -61
  65. package/dist/packages/firestore/src/lite-api/aggregate_types.d.ts +69 -0
  66. package/dist/packages/firestore/src/lite-api/database.d.ts +6 -6
  67. package/dist/packages/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  68. package/dist/private.d.ts +200 -11
  69. package/package.json +9 -9
@@ -58,6 +58,77 @@ export declare type AddPrefixToKeys<Prefix extends string, T extends Record<stri
58
58
  [K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
59
59
  };
60
60
 
61
+ /**
62
+ * Represents an aggregation that can be performed by Firestore.
63
+ */
64
+ export declare class AggregateField<T> {
65
+ /** A type string to uniquely identify instances of this class. */
66
+ type: string;
67
+ }
68
+
69
+ /**
70
+ * The union of all `AggregateField` types that are supported by Firestore.
71
+ */
72
+ export declare type AggregateFieldType = AggregateField<number>;
73
+
74
+ /**
75
+ * The results of executing an aggregation query.
76
+ */
77
+ export declare class AggregateQuerySnapshot<T extends AggregateSpec> {
78
+ private readonly _data;
79
+ /** A type string to uniquely identify instances of this class. */
80
+ readonly type = "AggregateQuerySnapshot";
81
+ /**
82
+ * The underlying query over which the aggregations recorded in this
83
+ * `AggregateQuerySnapshot` were performed.
84
+ */
85
+ readonly query: Query<unknown>;
86
+ /** @hideconstructor */
87
+ constructor(query: Query<unknown>, _data: AggregateSpecData<T>);
88
+ /**
89
+ * Returns the results of the aggregations performed over the underlying
90
+ * query.
91
+ *
92
+ * The keys of the returned object will be the same as those of the
93
+ * `AggregateSpec` object specified to the aggregation method, and the values
94
+ * will be the corresponding aggregation result.
95
+ *
96
+ * @returns The results of the aggregations performed over the underlying
97
+ * query.
98
+ */
99
+ data(): AggregateSpecData<T>;
100
+ }
101
+
102
+ /**
103
+ * Compares two `AggregateQuerySnapshot` instances for equality.
104
+ *
105
+ * Two `AggregateQuerySnapshot` instances are considered "equal" if they have
106
+ * underlying queries that compare equal, and the same data.
107
+ *
108
+ * @param left - The first `AggregateQuerySnapshot` to compare.
109
+ * @param right - The second `AggregateQuerySnapshot` to compare.
110
+ *
111
+ * @returns `true` if the objects are "equal", as defined above, or `false`
112
+ * otherwise.
113
+ */
114
+ export declare function aggregateQuerySnapshotEqual<T extends AggregateSpec>(left: AggregateQuerySnapshot<T>, right: AggregateQuerySnapshot<T>): boolean;
115
+
116
+ /**
117
+ * A type whose property values are all `AggregateField` objects.
118
+ */
119
+ export declare interface AggregateSpec {
120
+ [field: string]: AggregateFieldType;
121
+ }
122
+
123
+ /**
124
+ * A type whose keys are taken from an `AggregateSpec`, and whose values are the
125
+ * result of the aggregation performed by the corresponding `AggregateField`
126
+ * from the input `AggregateSpec`.
127
+ */
128
+ export declare type AggregateSpecData<T extends AggregateSpec> = {
129
+ [P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
130
+ };
131
+
61
132
  declare interface ApiClientObjectMap<T> {
62
133
  [k: string]: T;
63
134
  }
@@ -974,7 +1045,7 @@ declare abstract class Filter {
974
1045
  /**
975
1046
  * The Cloud Firestore service interface.
976
1047
  *
977
- * Do not call this constructor directly. Instead, use {@link getFirestore}.
1048
+ * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
978
1049
  */
979
1050
  export declare class Firestore implements FirestoreService {
980
1051
  _authCredentials: CredentialsProvider<User>;
@@ -1551,6 +1622,24 @@ export declare class GeoPoint {
1551
1622
  _compareTo(other: GeoPoint): number;
1552
1623
  }
1553
1624
 
1625
+ /**
1626
+ * Calculates the number of documents in the result set of the given query,
1627
+ * without actually downloading the documents.
1628
+ *
1629
+ * Using this function to count the documents is efficient because only the
1630
+ * final count, not the documents' data, is downloaded. This function can even
1631
+ * count the documents if the result set would be prohibitively large to
1632
+ * download entirely (e.g. thousands of documents).
1633
+ *
1634
+ * @param query - The query whose result set size to calculate.
1635
+ * @returns A Promise that will be resolved with the count; the count can be
1636
+ * retrieved from `snapshot.data().count`, where `snapshot` is the
1637
+ * `AggregateQuerySnapshot` to which the returned Promise resolves.
1638
+ */
1639
+ export declare function getCount(query: Query<unknown>): Promise<AggregateQuerySnapshot<{
1640
+ count: AggregateField<number>;
1641
+ }>>;
1642
+
1554
1643
  /**
1555
1644
  * Reads the document referred to by the specified document reference.
1556
1645
  *
@@ -1652,8 +1741,8 @@ declare type IndexState = 'STATE_UNSPECIFIED' | 'CREATING' | 'READY' | 'ERROR';
1652
1741
  /**
1653
1742
  * Initializes a new instance of Cloud Firestore with the provided settings.
1654
1743
  * Can only be called before any other functions, including
1655
- * {@link getFirestore}. If the custom settings are empty, this function is
1656
- * equivalent to calling {@link getFirestore}.
1744
+ * {@link (getFirestore:1)}. If the custom settings are empty, this function is
1745
+ * equivalent to calling {@link (getFirestore:1)}.
1657
1746
  *
1658
1747
  * @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
1659
1748
  * be associated.
@@ -1665,8 +1754,8 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Settings
1665
1754
  /**
1666
1755
  * Initializes a new instance of Cloud Firestore with the provided settings.
1667
1756
  * Can only be called before any other functions, including
1668
- * {@link getFirestore}. If the custom settings are empty, this function is
1669
- * equivalent to calling {@link getFirestore}.
1757
+ * {@link (getFirestore:1)}. If the custom settings are empty, this function is
1758
+ * equivalent to calling {@link (getFirestore:1)}.
1670
1759
  *
1671
1760
  * @param app - The {@link @firebase/app#FirebaseApp} with which the `Firestore` instance will
1672
1761
  * be associated.
@@ -2383,7 +2472,7 @@ declare type TargetChangeTargetChangeType = 'NO_CHANGE' | 'ADD' | 'REMOVE' | 'CU
2383
2472
  * response from the server will not be resolved.
2384
2473
  *
2385
2474
  * To restart after termination, create a new instance of `Firestore` with
2386
- * {@link getFirestore}.
2475
+ * {@link (getFirestore:1)}.
2387
2476
  *
2388
2477
  * Note: Under normal circumstances, calling `terminate()` is not required. This
2389
2478
  * function is useful only when you want to force this instance to release all of