@firebase/firestore 3.7.3-canary.e9fb4037f → 3.7.3-canary.fde5adf63

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 (111) hide show
  1. package/dist/firestore/lite/index.d.ts +1 -1
  2. package/dist/firestore/src/api/filter.d.ts +1 -1
  3. package/dist/firestore/src/api.d.ts +1 -1
  4. package/dist/firestore/src/core/bound.d.ts +49 -0
  5. package/dist/firestore/src/core/filter.d.ts +134 -0
  6. package/dist/firestore/src/core/order_by.d.ts +35 -0
  7. package/dist/firestore/src/core/query.d.ts +5 -6
  8. package/dist/firestore/src/core/target.d.ts +4 -120
  9. package/dist/firestore/src/lite-api/query.d.ts +273 -66
  10. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  11. package/dist/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  12. package/dist/firestore/src/remote/serializer.d.ts +10 -3
  13. package/dist/firestore/src/util/logic_utils.d.ts +52 -0
  14. package/dist/firestore/src/util/types.d.ts +1 -1
  15. package/dist/firestore/test/lite/helpers.d.ts +1 -1
  16. package/dist/firestore/test/unit/core/filter.test.d.ts +17 -0
  17. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +1 -1
  18. package/dist/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  19. package/dist/firestore/test/util/helpers.d.ts +5 -1
  20. package/dist/firestore/test/util/test_platform.d.ts +2 -2
  21. package/dist/index.d.ts +138 -62
  22. package/dist/index.esm2017.js +4271 -3734
  23. package/dist/index.esm2017.js.map +1 -1
  24. package/dist/index.esm5.js +4959 -4404
  25. package/dist/index.esm5.js.map +1 -1
  26. package/dist/index.node.cjs.js +1609 -874
  27. package/dist/index.node.cjs.js.map +1 -1
  28. package/dist/index.node.mjs +1602 -875
  29. package/dist/index.node.mjs.map +1 -1
  30. package/dist/index.rn.js +4496 -3959
  31. package/dist/index.rn.js.map +1 -1
  32. package/dist/internal.d.ts +320 -65
  33. package/dist/lite/firestore/lite/index.d.ts +1 -1
  34. package/dist/lite/firestore/src/api/filter.d.ts +1 -1
  35. package/dist/lite/firestore/src/api.d.ts +1 -1
  36. package/dist/lite/firestore/src/core/bound.d.ts +49 -0
  37. package/dist/lite/firestore/src/core/filter.d.ts +134 -0
  38. package/dist/lite/firestore/src/core/order_by.d.ts +35 -0
  39. package/dist/lite/firestore/src/core/query.d.ts +5 -6
  40. package/dist/lite/firestore/src/core/target.d.ts +4 -120
  41. package/dist/lite/firestore/src/lite-api/query.d.ts +273 -66
  42. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  43. package/dist/lite/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  44. package/dist/lite/firestore/src/remote/serializer.d.ts +10 -3
  45. package/dist/lite/firestore/src/util/logic_utils.d.ts +52 -0
  46. package/dist/lite/firestore/src/util/types.d.ts +1 -1
  47. package/dist/lite/firestore/test/lite/helpers.d.ts +1 -1
  48. package/dist/lite/firestore/test/unit/core/filter.test.d.ts +17 -0
  49. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +1 -1
  50. package/dist/lite/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  51. package/dist/lite/firestore/test/util/helpers.d.ts +5 -1
  52. package/dist/lite/firestore/test/util/test_platform.d.ts +2 -2
  53. package/dist/lite/index.browser.esm2017.js +2059 -1779
  54. package/dist/lite/index.browser.esm2017.js.map +1 -1
  55. package/dist/lite/index.browser.esm5.js +2218 -1997
  56. package/dist/lite/index.browser.esm5.js.map +1 -1
  57. package/dist/lite/index.d.ts +138 -62
  58. package/dist/lite/index.node.cjs.js +2165 -1788
  59. package/dist/lite/index.node.cjs.js.map +1 -1
  60. package/dist/lite/index.node.mjs +2158 -1789
  61. package/dist/lite/index.node.mjs.map +1 -1
  62. package/dist/lite/index.rn.esm2017.js +2203 -1922
  63. package/dist/lite/index.rn.esm2017.js.map +1 -1
  64. package/dist/lite/internal.d.ts +320 -65
  65. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +322 -174
  66. package/dist/lite/packages/firestore/lite/index.d.ts +1 -1
  67. package/dist/lite/packages/firestore/rollup.config.debug.d.ts +1 -1
  68. package/dist/lite/packages/firestore/src/api/filter.d.ts +1 -1
  69. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  70. package/dist/lite/packages/firestore/src/core/bound.d.ts +49 -0
  71. package/dist/lite/packages/firestore/src/core/filter.d.ts +134 -0
  72. package/dist/lite/packages/firestore/src/core/order_by.d.ts +35 -0
  73. package/dist/lite/packages/firestore/src/core/query.d.ts +5 -6
  74. package/dist/lite/packages/firestore/src/core/target.d.ts +4 -120
  75. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +273 -66
  76. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  77. package/dist/lite/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  78. package/dist/lite/packages/firestore/src/remote/serializer.d.ts +10 -3
  79. package/dist/lite/packages/firestore/src/util/logic_utils.d.ts +52 -0
  80. package/dist/lite/packages/firestore/src/util/types.d.ts +1 -1
  81. package/dist/lite/packages/firestore/test/lite/helpers.d.ts +1 -1
  82. package/dist/lite/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
  83. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +1 -1
  84. package/dist/lite/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  85. package/dist/lite/packages/firestore/test/util/helpers.d.ts +5 -1
  86. package/dist/lite/packages/firestore/test/util/test_platform.d.ts +2 -2
  87. package/dist/lite/private.d.ts +232 -65
  88. package/dist/packages/firestore/dist/index.esm2017.d.ts +368 -208
  89. package/dist/packages/firestore/lite/index.d.ts +1 -1
  90. package/dist/packages/firestore/rollup.config.debug.d.ts +1 -1
  91. package/dist/packages/firestore/src/api/filter.d.ts +1 -1
  92. package/dist/packages/firestore/src/api.d.ts +1 -1
  93. package/dist/packages/firestore/src/core/bound.d.ts +49 -0
  94. package/dist/packages/firestore/src/core/filter.d.ts +134 -0
  95. package/dist/packages/firestore/src/core/order_by.d.ts +35 -0
  96. package/dist/packages/firestore/src/core/query.d.ts +5 -6
  97. package/dist/packages/firestore/src/core/target.d.ts +4 -120
  98. package/dist/packages/firestore/src/lite-api/query.d.ts +273 -66
  99. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  100. package/dist/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  101. package/dist/packages/firestore/src/remote/serializer.d.ts +10 -3
  102. package/dist/packages/firestore/src/util/logic_utils.d.ts +52 -0
  103. package/dist/packages/firestore/src/util/types.d.ts +1 -1
  104. package/dist/packages/firestore/test/lite/helpers.d.ts +1 -1
  105. package/dist/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
  106. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +1 -1
  107. package/dist/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  108. package/dist/packages/firestore/test/util/helpers.d.ts +5 -1
  109. package/dist/packages/firestore/test/util/test_platform.d.ts +2 -2
  110. package/dist/private.d.ts +232 -65
  111. package/package.json +13 -11
@@ -15,11 +15,13 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { Bytes, DocumentReference } from '../../src';
18
+ import { Bound } from '../../src/core/bound';
18
19
  import { BundledDocuments } from '../../src/core/bundle';
19
20
  import { DatabaseId } from '../../src/core/database_info';
21
+ import { FieldFilter, CompositeFilter, Filter } from '../../src/core/filter';
22
+ import { OrderBy } from '../../src/core/order_by';
20
23
  import { Query } from '../../src/core/query';
21
24
  import { SnapshotVersion } from '../../src/core/snapshot_version';
22
- import { Bound, FieldFilter, Filter, OrderBy } from '../../src/core/target';
23
25
  import { TargetId } from '../../src/core/types';
24
26
  import { LimboDocumentChange, View, ViewChange } from '../../src/core/view';
25
27
  import { UserDataReader } from '../../src/lite-api/user_data_reader';
@@ -68,6 +70,8 @@ export declare function fieldIndex(collectionGroup: string, options?: {
68
70
  export declare function mask(...paths: string[]): FieldMask;
69
71
  export declare function blob(...bytes: number[]): Bytes;
70
72
  export declare function filter(path: string, op: string, value: unknown): FieldFilter;
73
+ export declare function andFilter(...filters: Filter[]): CompositeFilter;
74
+ export declare function orFilter(...filters: Filter[]): CompositeFilter;
71
75
  export declare function setMutation(keyStr: string, json: JsonObject<unknown>): SetMutation;
72
76
  export declare function patchMutation(keyStr: string, json: JsonObject<unknown>, precondition?: Precondition): PatchMutation;
73
77
  export declare function mergeMutation(keyStr: string, json: JsonObject<unknown>, updateMask: FieldPath[]): PatchMutation;
@@ -36,10 +36,10 @@ export declare function testWindow(sharedWebStorage?: SharedFakeWebStorage): Fak
36
36
  export declare class FakeDocument implements DocumentLike {
37
37
  private _visibilityState;
38
38
  private visibilityListener;
39
- get visibilityState(): VisibilityState;
39
+ get visibilityState(): DocumentVisibilityState;
40
40
  addEventListener(type: string, listener: EventListener): void;
41
41
  removeEventListener(type: string, listener: EventListener): void;
42
- raiseVisibilityEvent(visibility: VisibilityState): void;
42
+ raiseVisibilityEvent(visibility: DocumentVisibilityState): void;
43
43
  }
44
44
  export declare function testDocument(): FakeDocument;
45
45
  /**
@@ -112,10 +112,24 @@ export declare type AggregateSpecData<T extends AggregateSpec> = {
112
112
  [P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
113
113
  };
114
114
 
115
+ /* Excluded from this release type: and */
116
+
115
117
  declare interface ApiClientObjectMap<T> {
116
118
  [k: string]: T;
117
119
  }
118
120
 
121
+ /**
122
+ * An `AppliableConstraint` is an abstraction of a constraint that can be applied
123
+ * to a Firestore query.
124
+ */
125
+ declare abstract class AppliableConstraint {
126
+ /**
127
+ * Takes the provided {@link Query} and returns a copy of the {@link Query} with this
128
+ * {@link AppliableConstraint} applied.
129
+ */
130
+ abstract _apply<T>(query: Query<T>): Query<T>;
131
+ }
132
+
119
133
  /**
120
134
  * Returns a special value that can be used with {@link (setDoc:1)} or {@link
121
135
  * updateDoc:1} that tells the server to remove the given elements from any
@@ -412,7 +426,12 @@ export declare class CollectionReference<T = DocumentData> extends Query<T> {
412
426
  withConverter(converter: null): CollectionReference<DocumentData>;
413
427
  }
414
428
 
415
- declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND';
429
+ declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND' | 'OR';
430
+
431
+ declare const enum CompositeOperator {
432
+ OR = "or",
433
+ AND = "and"
434
+ }
416
435
 
417
436
  /**
418
437
  * Modify this instance to communicate with the Cloud Firestore emulator.
@@ -785,48 +804,66 @@ export declare class DocumentSnapshot<T = DocumentData> {
785
804
  export { EmulatorMockTokenOptions }
786
805
 
787
806
  /**
788
- * Creates a {@link QueryConstraint} that modifies the result set to end at the
789
- * provided document (inclusive). The end position is relative to the order of
790
- * the query. The document must contain all of the fields provided in the
807
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
808
+ * the provided document (inclusive). The end position is relative to the order
809
+ * of the query. The document must contain all of the fields provided in the
791
810
  * orderBy of the query.
792
811
  *
793
812
  * @param snapshot - The snapshot of the document to end at.
794
- * @returns A {@link QueryConstraint} to pass to `query()`
813
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
795
814
  */
796
- export declare function endAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
815
+ export declare function endAt(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstraint;
797
816
 
798
817
  /**
799
- * Creates a {@link QueryConstraint} that modifies the result set to end at the
800
- * provided fields relative to the order of the query. The order of the field
818
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
819
+ * the provided fields relative to the order of the query. The order of the field
801
820
  * values must match the order of the order by clauses of the query.
802
821
  *
803
822
  * @param fieldValues - The field values to end this query at, in order
804
823
  * of the query's order by.
805
- * @returns A {@link QueryConstraint} to pass to `query()`
824
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
806
825
  */
807
- export declare function endAt(...fieldValues: unknown[]): QueryConstraint;
826
+ export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
808
827
 
809
828
  /**
810
- * Creates a {@link QueryConstraint} that modifies the result set to end before the
811
- * provided document (exclusive). The end position is relative to the order of
812
- * the query. The document must contain all of the fields provided in the
813
- * orderBy of the query.
829
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end
830
+ * before the provided document (exclusive). The end position is relative to the
831
+ * order of the query. The document must contain all of the fields provided in
832
+ * the orderBy of the query.
814
833
  *
815
834
  * @param snapshot - The snapshot of the document to end before.
816
- * @returns A {@link QueryConstraint} to pass to `query()`
835
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
817
836
  */
818
- export declare function endBefore(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
837
+ export declare function endBefore(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstraint;
819
838
 
820
839
  /**
821
- * Creates a {@link QueryConstraint} that modifies the result set to end before the
822
- * provided fields relative to the order of the query. The order of the field
823
- * values must match the order of the order by clauses of the query.
840
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end
841
+ * before the provided fields relative to the order of the query. The order of
842
+ * the field values must match the order of the order by clauses of the query.
824
843
  *
825
844
  * @param fieldValues - The field values to end this query before, in order
826
845
  * of the query's order by.
827
- * @returns A {@link QueryConstraint} to pass to `query()`
846
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
828
847
  */
829
- export declare function endBefore(...fieldValues: unknown[]): QueryConstraint;
848
+ export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;
849
+
850
+ declare class FieldFilter extends Filter {
851
+ readonly field: FieldPath_2;
852
+ readonly op: Operator;
853
+ readonly value: Value;
854
+ protected constructor(field: FieldPath_2, op: Operator, value: Value);
855
+ /**
856
+ * Creates a filter based on the provided arguments.
857
+ */
858
+ static create(field: FieldPath_2, op: Operator, value: Value): FieldFilter;
859
+ private static createKeyFieldInFilter;
860
+ matches(doc: Document_2): boolean;
861
+ protected matchesComparison(comparison: number): boolean;
862
+ isInequality(): boolean;
863
+ getFlattenedFilters(): readonly FieldFilter[];
864
+ getFilters(): Filter[];
865
+ getFirstInequalityField(): FieldPath_2 | null;
866
+ }
830
867
 
831
868
  declare type FieldFilterOp = 'OPERATOR_UNSPECIFIED' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL' | 'ARRAY_CONTAINS' | 'IN' | 'ARRAY_CONTAINS_ANY' | 'NOT_IN';
832
869
 
@@ -915,6 +952,9 @@ export declare abstract class FieldValue {
915
952
 
916
953
  declare abstract class Filter {
917
954
  abstract matches(doc: Document_2): boolean;
955
+ abstract getFlattenedFilters(): readonly FieldFilter[];
956
+ abstract getFilters(): Filter[];
957
+ abstract getFirstInequalityField(): FieldPath_2 | null;
918
958
  }
919
959
 
920
960
  /* Excluded from this release type: _FirebaseService */
@@ -1611,23 +1651,25 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Settings
1611
1651
  /* Excluded declaration from this release type: initializeFirestore */
1612
1652
 
1613
1653
  /**
1614
- * Creates a {@link QueryConstraint} that only returns the first matching documents.
1654
+ * Creates a {@link QueryLimitConstraint} that only returns the first matching
1655
+ * documents.
1615
1656
  *
1616
1657
  * @param limit - The maximum number of items to return.
1617
- * @returns The created {@link Query}.
1658
+ * @returns The created {@link QueryLimitConstraint}.
1618
1659
  */
1619
- export declare function limit(limit: number): QueryConstraint;
1660
+ export declare function limit(limit: number): QueryLimitConstraint;
1620
1661
 
1621
1662
  /**
1622
- * Creates a {@link QueryConstraint} that only returns the last matching documents.
1663
+ * Creates a {@link QueryLimitConstraint} that only returns the last matching
1664
+ * documents.
1623
1665
  *
1624
1666
  * You must specify at least one `orderBy` clause for `limitToLast` queries,
1625
1667
  * otherwise an exception will be thrown during execution.
1626
1668
  *
1627
1669
  * @param limit - The maximum number of items to return.
1628
- * @returns The created {@link Query}.
1670
+ * @returns The created {@link QueryLimitConstraint}.
1629
1671
  */
1630
- export declare function limitToLast(limit: number): QueryConstraint;
1672
+ export declare function limitToLast(limit: number): QueryLimitConstraint;
1631
1673
 
1632
1674
  declare const enum LimitType {
1633
1675
  First = "F",
@@ -1830,6 +1872,21 @@ declare class ObjectValue {
1830
1872
  clone(): ObjectValue;
1831
1873
  }
1832
1874
 
1875
+ declare const enum Operator {
1876
+ LESS_THAN = "<",
1877
+ LESS_THAN_OR_EQUAL = "<=",
1878
+ EQUAL = "==",
1879
+ NOT_EQUAL = "!=",
1880
+ GREATER_THAN = ">",
1881
+ GREATER_THAN_OR_EQUAL = ">=",
1882
+ ARRAY_CONTAINS = "array-contains",
1883
+ IN = "in",
1884
+ NOT_IN = "not-in",
1885
+ ARRAY_CONTAINS_ANY = "array-contains-any"
1886
+ }
1887
+
1888
+ /* Excluded from this release type: or */
1889
+
1833
1890
  /**
1834
1891
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
1835
1892
  */
@@ -1840,15 +1897,18 @@ declare class OrderBy {
1840
1897
  }
1841
1898
 
1842
1899
  /**
1843
- * Creates a {@link QueryConstraint} that sorts the query result by the
1900
+ * Creates a {@link QueryOrderByConstraint} that sorts the query result by the
1844
1901
  * specified field, optionally in descending order instead of ascending.
1845
1902
  *
1903
+ * Note: Documents that do not contain the specified field will not be present
1904
+ * in the query result.
1905
+ *
1846
1906
  * @param fieldPath - The field to sort by.
1847
1907
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
1848
1908
  * not specified, order will be ascending.
1849
- * @returns The created {@link Query}.
1909
+ * @returns The created {@link QueryOrderByConstraint}.
1850
1910
  */
1851
- export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint;
1911
+ export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
1852
1912
 
1853
1913
  /**
1854
1914
  * The direction of a {@link orderBy} clause is specified as 'desc' or 'asc'
@@ -1973,11 +2033,14 @@ export declare class Query<T = DocumentData> {
1973
2033
  withConverter<U>(converter: FirestoreDataConverter<U>): Query<U>;
1974
2034
  }
1975
2035
 
2036
+ /* Excluded declaration from this release type: query */
2037
+
1976
2038
  /**
1977
- * Creates a new immutable instance of {@link Query} that is extended to also include
1978
- * additional query constraints.
2039
+ * Creates a new immutable instance of {@link Query} that is extended to also
2040
+ * include additional query constraints.
1979
2041
  *
1980
- * @param query - The {@link Query} instance to use as a base for the new constraints.
2042
+ * @param query - The {@link Query} instance to use as a base for the new
2043
+ * constraints.
1981
2044
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
1982
2045
  * @throws if any of the provided query constraints cannot be combined with the
1983
2046
  * existing or new constraints.
@@ -2001,20 +2064,22 @@ declare interface Query_2 {
2001
2064
  readonly endAt: Bound | null;
2002
2065
  }
2003
2066
 
2067
+ /* Excluded from this release type: QueryCompositeFilterConstraint */
2068
+
2004
2069
  /**
2005
2070
  * A `QueryConstraint` is used to narrow the set of documents returned by a
2006
2071
  * Firestore query. `QueryConstraint`s are created by invoking {@link where},
2007
- * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
2008
- * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
2072
+ * {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
2073
+ * endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
2009
2074
  * can then be passed to {@link query} to create a new query instance that
2010
2075
  * also contains this `QueryConstraint`.
2011
2076
  */
2012
- export declare abstract class QueryConstraint {
2013
- /** The type of this query constraints */
2077
+ export declare abstract class QueryConstraint extends AppliableConstraint {
2078
+ /** The type of this query constraint */
2014
2079
  abstract readonly type: QueryConstraintType;
2015
2080
  /**
2016
2081
  * Takes the provided {@link Query} and returns a copy of the {@link Query} with this
2017
- * {@link QueryConstraint} applied.
2082
+ * {@link AppliableConstraint} applied.
2018
2083
  */
2019
2084
  abstract _apply<T>(query: Query<T>): Query<T>;
2020
2085
  }
@@ -2043,6 +2108,23 @@ export declare class QueryDocumentSnapshot<T = DocumentData> extends DocumentSna
2043
2108
  data(): T;
2044
2109
  }
2045
2110
 
2111
+ /**
2112
+ * A `QueryEndAtConstraint` is used to exclude documents from the end of a
2113
+ * result set returned by a Firestore query.
2114
+ * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
2115
+ * {@link (endBefore:1)} and can then be passed to {@link query} to create a new
2116
+ * query instance that also contains this `QueryEndAtConstraint`.
2117
+ */
2118
+ export declare class QueryEndAtConstraint extends QueryConstraint {
2119
+ /** The type of this query constraint */
2120
+ readonly type: 'endBefore' | 'endAt';
2121
+ private readonly _docOrFields;
2122
+ private readonly _inclusive;
2123
+ /* Excluded from this release type: __constructor */
2124
+ static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryEndAtConstraint;
2125
+ _apply<T>(query: Query<T>): Query<T>;
2126
+ }
2127
+
2046
2128
  /**
2047
2129
  * Returns true if the provided queries point to the same collection and apply
2048
2130
  * the same constraints.
@@ -2054,6 +2136,74 @@ export declare class QueryDocumentSnapshot<T = DocumentData> extends DocumentSna
2054
2136
  */
2055
2137
  export declare function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
2056
2138
 
2139
+ /**
2140
+ * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
2141
+ * a Firestore query by filtering on one or more document fields.
2142
+ * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
2143
+ * be passed to {@link query} to create a new query instance that also contains
2144
+ * this `QueryFieldFilterConstraint`.
2145
+ */
2146
+ export declare class QueryFieldFilterConstraint extends QueryConstraint {
2147
+ private readonly _field;
2148
+ private _op;
2149
+ private _value;
2150
+ /** The type of this query constraint */
2151
+ readonly type = "where";
2152
+ /* Excluded from this release type: __constructor */
2153
+ static _create(_field: FieldPath_2, _op: Operator, _value: unknown): QueryFieldFilterConstraint;
2154
+ _apply<T>(query: Query<T>): Query<T>;
2155
+ _parse<T>(query: Query<T>): FieldFilter;
2156
+ }
2157
+
2158
+ /* Excluded from this release type: QueryFilterConstraint */
2159
+
2160
+ /**
2161
+ * A `QueryLimitConstraint` is used to limit the number of documents returned by
2162
+ * a Firestore query.
2163
+ * `QueryLimitConstraint`s are created by invoking {@link limit} or
2164
+ * {@link limitToLast} and can then be passed to {@link query} to create a new
2165
+ * query instance that also contains this `QueryLimitConstraint`.
2166
+ */
2167
+ export declare class QueryLimitConstraint extends QueryConstraint {
2168
+ /** The type of this query constraint */
2169
+ readonly type: 'limit' | 'limitToLast';
2170
+ private readonly _limit;
2171
+ private readonly _limitType;
2172
+ /* Excluded from this release type: __constructor */
2173
+ static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType): QueryLimitConstraint;
2174
+ _apply<T>(query: Query<T>): Query<T>;
2175
+ }
2176
+
2177
+ /**
2178
+ * `QueryNonFilterConstraint` is a helper union type that represents
2179
+ * QueryConstraints which are used to narrow or order the set of documents,
2180
+ * but that do not explicitly filter on a document field.
2181
+ * `QueryNonFilterConstraint`s are created by invoking {@link orderBy},
2182
+ * {@link startAt}, {@link startAfter}, {@link endBefore}, {@link endAt},
2183
+ * {@link limit} or {@link limitToLast} and can then be passed to {@link query}
2184
+ * to create a new query instance that also contains the `QueryConstraint`.
2185
+ */
2186
+ export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
2187
+
2188
+ /**
2189
+ * A `QueryOrderByConstraint` is used to sort the set of documents returned by a
2190
+ * Firestore query. `QueryOrderByConstraint`s are created by invoking
2191
+ * {@link orderBy} and can then be passed to {@link query} to create a new query
2192
+ * instance that also contains this `QueryOrderByConstraint`.
2193
+ *
2194
+ * Note: Documents that do not contain the orderBy field will not be present in
2195
+ * the query result.
2196
+ */
2197
+ export declare class QueryOrderByConstraint extends QueryConstraint {
2198
+ private readonly _field;
2199
+ private _direction;
2200
+ /** The type of this query constraint */
2201
+ readonly type = "orderBy";
2202
+ /* Excluded from this release type: __constructor */
2203
+ static _create(_field: FieldPath_2, _direction: Direction): QueryOrderByConstraint;
2204
+ _apply<T>(query: Query<T>): Query<T>;
2205
+ }
2206
+
2057
2207
  /**
2058
2208
  * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects
2059
2209
  * representing the results of a query. The documents can be accessed as an
@@ -2086,6 +2236,23 @@ export declare class QuerySnapshot<T = DocumentData> {
2086
2236
  forEach(callback: (result: QueryDocumentSnapshot<T>) => void, thisArg?: unknown): void;
2087
2237
  }
2088
2238
 
2239
+ /**
2240
+ * A `QueryStartAtConstraint` is used to exclude documents from the start of a
2241
+ * result set returned by a Firestore query.
2242
+ * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
2243
+ * {@link (startAfter:1)} and can then be passed to {@link query} to create a
2244
+ * new query instance that also contains this `QueryStartAtConstraint`.
2245
+ */
2246
+ export declare class QueryStartAtConstraint extends QueryConstraint {
2247
+ /** The type of this query constraint */
2248
+ readonly type: 'startAt' | 'startAfter';
2249
+ private readonly _docOrFields;
2250
+ private readonly _inclusive;
2251
+ /* Excluded from this release type: __constructor */
2252
+ static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryStartAtConstraint;
2253
+ _apply<T>(query: Query<T>): Query<T>;
2254
+ }
2255
+
2089
2256
  /**
2090
2257
  * Returns true if the provided references are equal.
2091
2258
  *
@@ -2245,48 +2412,48 @@ declare class SnapshotVersion {
2245
2412
  }
2246
2413
 
2247
2414
  /**
2248
- * Creates a {@link QueryConstraint} that modifies the result set to start after the
2249
- * provided document (exclusive). The starting position is relative to the order
2250
- * of the query. The document must contain all of the fields provided in the
2251
- * orderBy of the query.
2415
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
2416
+ * start after the provided document (exclusive). The starting position is
2417
+ * relative to the order of the query. The document must contain all of the
2418
+ * fields provided in the orderBy of the query.
2252
2419
  *
2253
2420
  * @param snapshot - The snapshot of the document to start after.
2254
- * @returns A {@link QueryConstraint} to pass to `query()`
2421
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`
2255
2422
  */
2256
- export declare function startAfter(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
2423
+ export declare function startAfter(snapshot: DocumentSnapshot<unknown>): QueryStartAtConstraint;
2257
2424
 
2258
2425
  /**
2259
- * Creates a {@link QueryConstraint} that modifies the result set to start after the
2260
- * provided fields relative to the order of the query. The order of the field
2261
- * values must match the order of the order by clauses of the query.
2426
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
2427
+ * start after the provided fields relative to the order of the query. The order
2428
+ * of the field values must match the order of the order by clauses of the query.
2262
2429
  *
2263
2430
  * @param fieldValues - The field values to start this query after, in order
2264
2431
  * of the query's order by.
2265
- * @returns A {@link QueryConstraint} to pass to `query()`
2432
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`
2266
2433
  */
2267
- export declare function startAfter(...fieldValues: unknown[]): QueryConstraint;
2434
+ export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;
2268
2435
 
2269
2436
  /**
2270
- * Creates a {@link QueryConstraint} that modifies the result set to start at the
2271
- * provided document (inclusive). The starting position is relative to the order
2272
- * of the query. The document must contain all of the fields provided in the
2273
- * `orderBy` of this query.
2437
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
2438
+ * start at the provided document (inclusive). The starting position is relative
2439
+ * to the order of the query. The document must contain all of the fields
2440
+ * provided in the `orderBy` of this query.
2274
2441
  *
2275
2442
  * @param snapshot - The snapshot of the document to start at.
2276
- * @returns A {@link QueryConstraint} to pass to `query()`.
2443
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`.
2277
2444
  */
2278
- export declare function startAt(snapshot: DocumentSnapshot<unknown>): QueryConstraint;
2445
+ export declare function startAt(snapshot: DocumentSnapshot<unknown>): QueryStartAtConstraint;
2279
2446
 
2280
2447
  /**
2281
- * Creates a {@link QueryConstraint} that modifies the result set to start at the
2282
- * provided fields relative to the order of the query. The order of the field
2283
- * values must match the order of the order by clauses of the query.
2448
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
2449
+ * start at the provided fields relative to the order of the query. The order of
2450
+ * the field values must match the order of the order by clauses of the query.
2284
2451
  *
2285
2452
  * @param fieldValues - The field values to start this query at, in order
2286
2453
  * of the query's order by.
2287
- * @returns A {@link QueryConstraint} to pass to `query()`.
2454
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`.
2288
2455
  */
2289
- export declare function startAt(...fieldValues: unknown[]): QueryConstraint;
2456
+ export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
2290
2457
 
2291
2458
  declare type TargetChangeTargetChangeType = 'NO_CHANGE' | 'ADD' | 'REMOVE' | 'CURRENT' | 'RESET';
2292
2459
 
@@ -2774,17 +2941,17 @@ declare type Value = firestoreV1ApiClientInterfaces.Value;
2774
2941
  declare type ValueNullValue = 'NULL_VALUE';
2775
2942
 
2776
2943
  /**
2777
- * Creates a {@link QueryConstraint} that enforces that documents must contain the
2778
- * specified field and that the value should satisfy the relation constraint
2779
- * provided.
2944
+ * Creates a {@link QueryFieldFilterConstraint} that enforces that documents
2945
+ * must contain the specified field and that the value should satisfy the
2946
+ * relation constraint provided.
2780
2947
  *
2781
2948
  * @param fieldPath - The path to compare
2782
2949
  * @param opStr - The operation string (e.g "&lt;", "&lt;=", "==", "&lt;",
2783
2950
  * "&lt;=", "!=").
2784
2951
  * @param value - The value for comparison
2785
- * @returns The created {@link Query}.
2952
+ * @returns The created {@link QueryFieldFilterConstraint}.
2786
2953
  */
2787
- export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryConstraint;
2954
+ export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint;
2788
2955
 
2789
2956
  /**
2790
2957
  * Filter conditions in a {@link where} clause are specified using the