@firebase/firestore 3.7.3 → 3.8.0

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 (120) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/firestore/lite/index.d.ts +1 -1
  3. package/dist/firestore/src/api/filter.d.ts +1 -1
  4. package/dist/firestore/src/api.d.ts +1 -1
  5. package/dist/firestore/src/core/bound.d.ts +49 -0
  6. package/dist/firestore/src/core/filter.d.ts +134 -0
  7. package/dist/firestore/src/core/order_by.d.ts +35 -0
  8. package/dist/firestore/src/core/query.d.ts +5 -6
  9. package/dist/firestore/src/core/target.d.ts +4 -120
  10. package/dist/firestore/src/lite-api/query.d.ts +273 -66
  11. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  12. package/dist/firestore/src/local/local_documents_view.d.ts +0 -2
  13. package/dist/firestore/src/model/document.d.ts +8 -1
  14. package/dist/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  15. package/dist/firestore/src/remote/serializer.d.ts +10 -3
  16. package/dist/firestore/src/util/logic_utils.d.ts +52 -0
  17. package/dist/firestore/src/util/types.d.ts +1 -1
  18. package/dist/firestore/test/lite/helpers.d.ts +1 -1
  19. package/dist/firestore/test/unit/core/filter.test.d.ts +17 -0
  20. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  21. package/dist/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  22. package/dist/firestore/test/util/helpers.d.ts +6 -2
  23. package/dist/firestore/test/util/test_platform.d.ts +2 -2
  24. package/dist/index.d.ts +138 -62
  25. package/dist/index.esm2017.js +4295 -3742
  26. package/dist/index.esm2017.js.map +1 -1
  27. package/dist/index.esm5.js +4981 -4410
  28. package/dist/index.esm5.js.map +1 -1
  29. package/dist/index.node.cjs.js +1657 -889
  30. package/dist/index.node.cjs.js.map +1 -1
  31. package/dist/index.node.mjs +1650 -890
  32. package/dist/index.node.mjs.map +1 -1
  33. package/dist/index.rn.js +4520 -3967
  34. package/dist/index.rn.js.map +1 -1
  35. package/dist/internal.d.ts +328 -68
  36. package/dist/lite/firestore/lite/index.d.ts +1 -1
  37. package/dist/lite/firestore/src/api/filter.d.ts +1 -1
  38. package/dist/lite/firestore/src/api.d.ts +1 -1
  39. package/dist/lite/firestore/src/core/bound.d.ts +49 -0
  40. package/dist/lite/firestore/src/core/filter.d.ts +134 -0
  41. package/dist/lite/firestore/src/core/order_by.d.ts +35 -0
  42. package/dist/lite/firestore/src/core/query.d.ts +5 -6
  43. package/dist/lite/firestore/src/core/target.d.ts +4 -120
  44. package/dist/lite/firestore/src/lite-api/query.d.ts +273 -66
  45. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  46. package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -2
  47. package/dist/lite/firestore/src/model/document.d.ts +8 -1
  48. package/dist/lite/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  49. package/dist/lite/firestore/src/remote/serializer.d.ts +10 -3
  50. package/dist/lite/firestore/src/util/logic_utils.d.ts +52 -0
  51. package/dist/lite/firestore/src/util/types.d.ts +1 -1
  52. package/dist/lite/firestore/test/lite/helpers.d.ts +1 -1
  53. package/dist/lite/firestore/test/unit/core/filter.test.d.ts +17 -0
  54. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  55. package/dist/lite/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  56. package/dist/lite/firestore/test/util/helpers.d.ts +6 -2
  57. package/dist/lite/firestore/test/util/test_platform.d.ts +2 -2
  58. package/dist/lite/index.browser.esm2017.js +2091 -1793
  59. package/dist/lite/index.browser.esm2017.js.map +1 -1
  60. package/dist/lite/index.browser.esm5.js +2239 -2000
  61. package/dist/lite/index.browser.esm5.js.map +1 -1
  62. package/dist/lite/index.d.ts +138 -62
  63. package/dist/lite/index.node.cjs.js +2212 -1802
  64. package/dist/lite/index.node.cjs.js.map +1 -1
  65. package/dist/lite/index.node.mjs +2205 -1803
  66. package/dist/lite/index.node.mjs.map +1 -1
  67. package/dist/lite/index.rn.esm2017.js +2077 -1778
  68. package/dist/lite/index.rn.esm2017.js.map +1 -1
  69. package/dist/lite/internal.d.ts +328 -66
  70. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +322 -174
  71. package/dist/lite/packages/firestore/lite/index.d.ts +1 -1
  72. package/dist/lite/packages/firestore/rollup.config.debug.d.ts +1 -1
  73. package/dist/lite/packages/firestore/src/api/filter.d.ts +1 -1
  74. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  75. package/dist/lite/packages/firestore/src/core/bound.d.ts +49 -0
  76. package/dist/lite/packages/firestore/src/core/filter.d.ts +134 -0
  77. package/dist/lite/packages/firestore/src/core/order_by.d.ts +35 -0
  78. package/dist/lite/packages/firestore/src/core/query.d.ts +5 -6
  79. package/dist/lite/packages/firestore/src/core/target.d.ts +4 -120
  80. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +273 -66
  81. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  82. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -2
  83. package/dist/lite/packages/firestore/src/model/document.d.ts +8 -1
  84. package/dist/lite/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  85. package/dist/lite/packages/firestore/src/remote/serializer.d.ts +10 -3
  86. package/dist/lite/packages/firestore/src/util/logic_utils.d.ts +52 -0
  87. package/dist/lite/packages/firestore/src/util/types.d.ts +1 -1
  88. package/dist/lite/packages/firestore/test/lite/helpers.d.ts +1 -1
  89. package/dist/lite/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
  90. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  91. package/dist/lite/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  92. package/dist/lite/packages/firestore/test/util/helpers.d.ts +6 -2
  93. package/dist/lite/packages/firestore/test/util/test_platform.d.ts +2 -2
  94. package/dist/lite/private.d.ts +240 -66
  95. package/dist/packages/firestore/dist/index.esm2017.d.ts +368 -208
  96. package/dist/packages/firestore/lite/index.d.ts +1 -1
  97. package/dist/packages/firestore/rollup.config.debug.d.ts +1 -1
  98. package/dist/packages/firestore/src/api/filter.d.ts +1 -1
  99. package/dist/packages/firestore/src/api.d.ts +1 -1
  100. package/dist/packages/firestore/src/core/bound.d.ts +49 -0
  101. package/dist/packages/firestore/src/core/filter.d.ts +134 -0
  102. package/dist/packages/firestore/src/core/order_by.d.ts +35 -0
  103. package/dist/packages/firestore/src/core/query.d.ts +5 -6
  104. package/dist/packages/firestore/src/core/target.d.ts +4 -120
  105. package/dist/packages/firestore/src/lite-api/query.d.ts +273 -66
  106. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  107. package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -2
  108. package/dist/packages/firestore/src/model/document.d.ts +8 -1
  109. package/dist/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  110. package/dist/packages/firestore/src/remote/serializer.d.ts +10 -3
  111. package/dist/packages/firestore/src/util/logic_utils.d.ts +52 -0
  112. package/dist/packages/firestore/src/util/types.d.ts +1 -1
  113. package/dist/packages/firestore/test/lite/helpers.d.ts +1 -1
  114. package/dist/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
  115. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  116. package/dist/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  117. package/dist/packages/firestore/test/util/helpers.d.ts +6 -2
  118. package/dist/packages/firestore/test/util/test_platform.d.ts +2 -2
  119. package/dist/private.d.ts +240 -68
  120. package/package.json +13 -11
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
@@ -218,7 +218,7 @@ export interface SpecWatchEntity {
218
218
  }
219
219
  export interface SpecClientState {
220
220
  /** The visibility state of the browser tab running the client. */
221
- visibility?: VisibilityState;
221
+ visibility?: DocumentVisibilityState;
222
222
  /** Whether this tab should try to forcefully become primary. */
223
223
  primary?: true;
224
224
  }
@@ -262,6 +262,7 @@ export interface SpecQuery {
262
262
  export interface SpecDocument {
263
263
  key: string;
264
264
  version: TestSnapshotVersion;
265
+ createTime: TestSnapshotVersion;
265
266
  value: JsonObject<unknown> | null;
266
267
  options?: DocumentOptions;
267
268
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
@@ -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';
@@ -47,7 +49,7 @@ export declare type TestSnapshotVersion = number;
47
49
  export declare function testUserDataReader(useProto3Json?: boolean): UserDataReader;
48
50
  export declare function version(v: TestSnapshotVersion): SnapshotVersion;
49
51
  export declare function ref(key: string, offset?: number): DocumentReference;
50
- export declare function doc(keyStr: string, ver: TestSnapshotVersion, jsonOrObjectValue: JsonObject<unknown> | ObjectValue): MutableDocument;
52
+ export declare function doc(keyStr: string, ver: TestSnapshotVersion, jsonOrObjectValue: JsonObject<unknown> | ObjectValue, createTime?: TestSnapshotVersion): MutableDocument;
51
53
  export declare function deletedDoc(keyStr: string, ver: TestSnapshotVersion): MutableDocument;
52
54
  export declare function unknownDoc(keyStr: string, ver: TestSnapshotVersion): MutableDocument;
53
55
  export declare function removedDoc(keyStr: string): MutableDocument;
@@ -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
  /**
package/dist/private.d.ts CHANGED
@@ -110,10 +110,24 @@ export declare type AggregateSpecData<T extends AggregateSpec> = {
110
110
  [P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
111
111
  };
112
112
 
113
+ /* Excluded from this release type: and */
114
+
113
115
  declare interface ApiClientObjectMap<T> {
114
116
  [k: string]: T;
115
117
  }
116
118
 
119
+ /**
120
+ * An `AppliableConstraint` is an abstraction of a constraint that can be applied
121
+ * to a Firestore query.
122
+ */
123
+ declare abstract class AppliableConstraint {
124
+ /**
125
+ * Takes the provided {@link Query} and returns a copy of the {@link Query} with this
126
+ * {@link AppliableConstraint} applied.
127
+ */
128
+ abstract _apply<T>(query: Query<T>): Query<T>;
129
+ }
130
+
117
131
  /**
118
132
  * Returns a special value that can be used with {@link (setDoc:1)} or {@link
119
133
  * updateDoc:1} that tells the server to remove the given elements from any
@@ -572,7 +586,12 @@ declare interface ComponentConfiguration {
572
586
  maxConcurrentLimboResolutions: number;
573
587
  }
574
588
 
575
- declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND';
589
+ declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND' | 'OR';
590
+
591
+ declare const enum CompositeOperator {
592
+ OR = "or",
593
+ AND = "and"
594
+ }
576
595
 
577
596
  /**
578
597
  * Modify this instance to communicate with the Cloud Firestore emulator.
@@ -835,6 +854,12 @@ declare interface Document_2 {
835
854
  * `SnapshotVersion.min()` for documents created by the user.
836
855
  */
837
856
  readonly readTime: SnapshotVersion;
857
+ /**
858
+ * The timestamp at which the document was created. This value increases
859
+ * monotonically when a document is deleted then recreated. It can also be
860
+ * compared to `createTime` of other documents and the `readTime` of a query.
861
+ */
862
+ readonly createTime: SnapshotVersion;
838
863
  /** The underlying data of this document or an empty value if no data exists. */
839
864
  readonly data: ObjectValue;
840
865
  /** Returns whether local mutations were applied via the mutation queue. */
@@ -1253,48 +1278,48 @@ export declare function enableMultiTabIndexedDbPersistence(firestore: Firestore)
1253
1278
  export declare function enableNetwork(firestore: Firestore): Promise<void>;
1254
1279
 
1255
1280
  /**
1256
- * Creates a {@link QueryConstraint} that modifies the result set to end at the
1257
- * provided document (inclusive). The end position is relative to the order of
1258
- * the query. The document must contain all of the fields provided in the
1281
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
1282
+ * the provided document (inclusive). The end position is relative to the order
1283
+ * of the query. The document must contain all of the fields provided in the
1259
1284
  * orderBy of the query.
1260
1285
  *
1261
1286
  * @param snapshot - The snapshot of the document to end at.
1262
- * @returns A {@link QueryConstraint} to pass to `query()`
1287
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
1263
1288
  */
1264
- export declare function endAt(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
1289
+ export declare function endAt(snapshot: DocumentSnapshot_2<unknown>): QueryEndAtConstraint;
1265
1290
 
1266
1291
  /**
1267
- * Creates a {@link QueryConstraint} that modifies the result set to end at the
1268
- * provided fields relative to the order of the query. The order of the field
1292
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
1293
+ * the provided fields relative to the order of the query. The order of the field
1269
1294
  * values must match the order of the order by clauses of the query.
1270
1295
  *
1271
1296
  * @param fieldValues - The field values to end this query at, in order
1272
1297
  * of the query's order by.
1273
- * @returns A {@link QueryConstraint} to pass to `query()`
1298
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
1274
1299
  */
1275
- export declare function endAt(...fieldValues: unknown[]): QueryConstraint;
1300
+ export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
1276
1301
 
1277
1302
  /**
1278
- * Creates a {@link QueryConstraint} that modifies the result set to end before the
1279
- * provided document (exclusive). The end position is relative to the order of
1280
- * the query. The document must contain all of the fields provided in the
1281
- * orderBy of the query.
1303
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end
1304
+ * before the provided document (exclusive). The end position is relative to the
1305
+ * order of the query. The document must contain all of the fields provided in
1306
+ * the orderBy of the query.
1282
1307
  *
1283
1308
  * @param snapshot - The snapshot of the document to end before.
1284
- * @returns A {@link QueryConstraint} to pass to `query()`
1309
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
1285
1310
  */
1286
- export declare function endBefore(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
1311
+ export declare function endBefore(snapshot: DocumentSnapshot_2<unknown>): QueryEndAtConstraint;
1287
1312
 
1288
1313
  /**
1289
- * Creates a {@link QueryConstraint} that modifies the result set to end before the
1290
- * provided fields relative to the order of the query. The order of the field
1291
- * values must match the order of the order by clauses of the query.
1314
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end
1315
+ * before the provided fields relative to the order of the query. The order of
1316
+ * the field values must match the order of the order by clauses of the query.
1292
1317
  *
1293
1318
  * @param fieldValues - The field values to end this query before, in order
1294
1319
  * of the query's order by.
1295
- * @returns A {@link QueryConstraint} to pass to `query()`
1320
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
1296
1321
  */
1297
- export declare function endBefore(...fieldValues: unknown[]): QueryConstraint;
1322
+ export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;
1298
1323
 
1299
1324
  /* Excluded from this release type: ensureFirestoreConfigured */
1300
1325
 
@@ -1319,6 +1344,24 @@ declare interface EventManager {
1319
1344
 
1320
1345
  /* Excluded from this release type: executeWrite */
1321
1346
 
1347
+ declare class FieldFilter extends Filter {
1348
+ readonly field: _FieldPath;
1349
+ readonly op: Operator;
1350
+ readonly value: Value;
1351
+ protected constructor(field: _FieldPath, op: Operator, value: Value);
1352
+ /**
1353
+ * Creates a filter based on the provided arguments.
1354
+ */
1355
+ static create(field: _FieldPath, op: Operator, value: Value): FieldFilter;
1356
+ private static createKeyFieldInFilter;
1357
+ matches(doc: Document_2): boolean;
1358
+ protected matchesComparison(comparison: number): boolean;
1359
+ isInequality(): boolean;
1360
+ getFlattenedFilters(): readonly FieldFilter[];
1361
+ getFilters(): Filter[];
1362
+ getFirstInequalityField(): _FieldPath | null;
1363
+ }
1364
+
1322
1365
  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';
1323
1366
 
1324
1367
  /**
@@ -1445,6 +1488,9 @@ export declare abstract class FieldValue {
1445
1488
 
1446
1489
  declare abstract class Filter {
1447
1490
  abstract matches(doc: Document_2): boolean;
1491
+ abstract getFlattenedFilters(): readonly FieldFilter[];
1492
+ abstract getFilters(): Filter[];
1493
+ abstract getFirstInequalityField(): _FieldPath | null;
1448
1494
  }
1449
1495
 
1450
1496
  /* Excluded from this release type: _FirebaseService */
@@ -2625,23 +2671,25 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Firestor
2625
2671
  /* Excluded from this release type: _isBase64Available */
2626
2672
 
2627
2673
  /**
2628
- * Creates a {@link QueryConstraint} that only returns the first matching documents.
2674
+ * Creates a {@link QueryLimitConstraint} that only returns the first matching
2675
+ * documents.
2629
2676
  *
2630
2677
  * @param limit - The maximum number of items to return.
2631
- * @returns The created {@link Query}.
2678
+ * @returns The created {@link QueryLimitConstraint}.
2632
2679
  */
2633
- export declare function limit(limit: number): QueryConstraint;
2680
+ export declare function limit(limit: number): QueryLimitConstraint;
2634
2681
 
2635
2682
  /**
2636
- * Creates a {@link QueryConstraint} that only returns the last matching documents.
2683
+ * Creates a {@link QueryLimitConstraint} that only returns the last matching
2684
+ * documents.
2637
2685
  *
2638
2686
  * You must specify at least one `orderBy` clause for `limitToLast` queries,
2639
2687
  * otherwise an exception will be thrown during execution.
2640
2688
  *
2641
2689
  * @param limit - The maximum number of items to return.
2642
- * @returns The created {@link Query}.
2690
+ * @returns The created {@link QueryLimitConstraint}.
2643
2691
  */
2644
- export declare function limitToLast(limit: number): QueryConstraint;
2692
+ export declare function limitToLast(limit: number): QueryLimitConstraint;
2645
2693
 
2646
2694
  declare const enum LimitType {
2647
2695
  First = "F",
@@ -2884,8 +2932,6 @@ declare class LocalDocumentsView {
2884
2932
  private getDocumentsMatchingDocumentQuery;
2885
2933
  private getDocumentsMatchingCollectionGroupQuery;
2886
2934
  private getDocumentsMatchingCollectionQuery;
2887
- /** Returns a base document that can be used to apply `overlay`. */
2888
- private getBaseDocument;
2889
2935
  }
2890
2936
 
2891
2937
  declare interface LocalStore {
@@ -2970,6 +3016,7 @@ declare class MutableDocument implements Document_2 {
2970
3016
  private documentType;
2971
3017
  version: SnapshotVersion;
2972
3018
  readTime: SnapshotVersion;
3019
+ createTime: SnapshotVersion;
2973
3020
  data: ObjectValue;
2974
3021
  private documentState;
2975
3022
  private constructor();
@@ -2982,7 +3029,7 @@ declare class MutableDocument implements Document_2 {
2982
3029
  * Creates a new document that is known to exist with the given data at the
2983
3030
  * given version.
2984
3031
  */
2985
- static newFoundDocument(documentKey: _DocumentKey, version: SnapshotVersion, value: ObjectValue): MutableDocument;
3032
+ static newFoundDocument(documentKey: _DocumentKey, version: SnapshotVersion, createTime: SnapshotVersion, value: ObjectValue): MutableDocument;
2986
3033
  /** Creates a new document that is known to not exist at the given version. */
2987
3034
  static newNoDocument(documentKey: _DocumentKey, version: SnapshotVersion): MutableDocument;
2988
3035
  /**
@@ -3716,6 +3763,21 @@ export declare function onSnapshotsInSync(firestore: Firestore, observer: {
3716
3763
  */
3717
3764
  export declare function onSnapshotsInSync(firestore: Firestore, onSync: () => void): Unsubscribe;
3718
3765
 
3766
+ declare const enum Operator {
3767
+ LESS_THAN = "<",
3768
+ LESS_THAN_OR_EQUAL = "<=",
3769
+ EQUAL = "==",
3770
+ NOT_EQUAL = "!=",
3771
+ GREATER_THAN = ">",
3772
+ GREATER_THAN_OR_EQUAL = ">=",
3773
+ ARRAY_CONTAINS = "array-contains",
3774
+ IN = "in",
3775
+ NOT_IN = "not-in",
3776
+ ARRAY_CONTAINS_ANY = "array-contains-any"
3777
+ }
3778
+
3779
+ /* Excluded from this release type: or */
3780
+
3719
3781
  /**
3720
3782
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
3721
3783
  */
@@ -3726,15 +3788,18 @@ declare class OrderBy {
3726
3788
  }
3727
3789
 
3728
3790
  /**
3729
- * Creates a {@link QueryConstraint} that sorts the query result by the
3791
+ * Creates a {@link QueryOrderByConstraint} that sorts the query result by the
3730
3792
  * specified field, optionally in descending order instead of ascending.
3731
3793
  *
3794
+ * Note: Documents that do not contain the specified field will not be present
3795
+ * in the query result.
3796
+ *
3732
3797
  * @param fieldPath - The field to sort by.
3733
3798
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
3734
3799
  * not specified, order will be ascending.
3735
- * @returns The created {@link Query}.
3800
+ * @returns The created {@link QueryOrderByConstraint}.
3736
3801
  */
3737
- export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint;
3802
+ export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
3738
3803
 
3739
3804
  /**
3740
3805
  * The direction of a {@link orderBy} clause is specified as 'desc' or 'asc'
@@ -4128,11 +4193,14 @@ export declare class Query<T = DocumentData> {
4128
4193
  withConverter<U>(converter: FirestoreDataConverter_2<U>): Query<U>;
4129
4194
  }
4130
4195
 
4196
+ /* Excluded declaration from this release type: query */
4197
+
4131
4198
  /**
4132
- * Creates a new immutable instance of {@link Query} that is extended to also include
4133
- * additional query constraints.
4199
+ * Creates a new immutable instance of {@link Query} that is extended to also
4200
+ * include additional query constraints.
4134
4201
  *
4135
- * @param query - The {@link Query} instance to use as a base for the new constraints.
4202
+ * @param query - The {@link Query} instance to use as a base for the new
4203
+ * constraints.
4136
4204
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4137
4205
  * @throws if any of the provided query constraints cannot be combined with the
4138
4206
  * existing or new constraints.
@@ -4156,20 +4224,22 @@ declare interface Query_2 {
4156
4224
  readonly endAt: Bound | null;
4157
4225
  }
4158
4226
 
4227
+ /* Excluded from this release type: QueryCompositeFilterConstraint */
4228
+
4159
4229
  /**
4160
4230
  * A `QueryConstraint` is used to narrow the set of documents returned by a
4161
4231
  * Firestore query. `QueryConstraint`s are created by invoking {@link where},
4162
- * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
4163
- * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
4232
+ * {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
4233
+ * endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
4164
4234
  * can then be passed to {@link query} to create a new query instance that
4165
4235
  * also contains this `QueryConstraint`.
4166
4236
  */
4167
- export declare abstract class QueryConstraint {
4168
- /** The type of this query constraints */
4237
+ export declare abstract class QueryConstraint extends AppliableConstraint {
4238
+ /** The type of this query constraint */
4169
4239
  abstract readonly type: QueryConstraintType;
4170
4240
  /**
4171
4241
  * Takes the provided {@link Query} and returns a copy of the {@link Query} with this
4172
- * {@link QueryConstraint} applied.
4242
+ * {@link AppliableConstraint} applied.
4173
4243
  */
4174
4244
  abstract _apply<T>(query: Query<T>): Query<T>;
4175
4245
  }
@@ -4226,6 +4296,23 @@ declare class QueryDocumentSnapshot_2<T = DocumentData> extends DocumentSnapshot
4226
4296
  data(): T;
4227
4297
  }
4228
4298
 
4299
+ /**
4300
+ * A `QueryEndAtConstraint` is used to exclude documents from the end of a
4301
+ * result set returned by a Firestore query.
4302
+ * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
4303
+ * {@link (endBefore:1)} and can then be passed to {@link query} to create a new
4304
+ * query instance that also contains this `QueryEndAtConstraint`.
4305
+ */
4306
+ export declare class QueryEndAtConstraint extends QueryConstraint {
4307
+ /** The type of this query constraint */
4308
+ readonly type: 'endBefore' | 'endAt';
4309
+ private readonly _docOrFields;
4310
+ private readonly _inclusive;
4311
+ /* Excluded from this release type: __constructor */
4312
+ static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot_2<unknown>>, _inclusive: boolean): QueryEndAtConstraint;
4313
+ _apply<T>(query: Query<T>): Query<T>;
4314
+ }
4315
+
4229
4316
  /**
4230
4317
  * Returns true if the provided queries point to the same collection and apply
4231
4318
  * the same constraints.
@@ -4237,6 +4324,74 @@ declare class QueryDocumentSnapshot_2<T = DocumentData> extends DocumentSnapshot
4237
4324
  */
4238
4325
  export declare function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
4239
4326
 
4327
+ /**
4328
+ * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
4329
+ * a Firestore query by filtering on one or more document fields.
4330
+ * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
4331
+ * be passed to {@link query} to create a new query instance that also contains
4332
+ * this `QueryFieldFilterConstraint`.
4333
+ */
4334
+ export declare class QueryFieldFilterConstraint extends QueryConstraint {
4335
+ private readonly _field;
4336
+ private _op;
4337
+ private _value;
4338
+ /** The type of this query constraint */
4339
+ readonly type = "where";
4340
+ /* Excluded from this release type: __constructor */
4341
+ static _create(_field: _FieldPath, _op: Operator, _value: unknown): QueryFieldFilterConstraint;
4342
+ _apply<T>(query: Query<T>): Query<T>;
4343
+ _parse<T>(query: Query<T>): FieldFilter;
4344
+ }
4345
+
4346
+ /* Excluded from this release type: QueryFilterConstraint */
4347
+
4348
+ /**
4349
+ * A `QueryLimitConstraint` is used to limit the number of documents returned by
4350
+ * a Firestore query.
4351
+ * `QueryLimitConstraint`s are created by invoking {@link limit} or
4352
+ * {@link limitToLast} and can then be passed to {@link query} to create a new
4353
+ * query instance that also contains this `QueryLimitConstraint`.
4354
+ */
4355
+ export declare class QueryLimitConstraint extends QueryConstraint {
4356
+ /** The type of this query constraint */
4357
+ readonly type: 'limit' | 'limitToLast';
4358
+ private readonly _limit;
4359
+ private readonly _limitType;
4360
+ /* Excluded from this release type: __constructor */
4361
+ static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType): QueryLimitConstraint;
4362
+ _apply<T>(query: Query<T>): Query<T>;
4363
+ }
4364
+
4365
+ /**
4366
+ * `QueryNonFilterConstraint` is a helper union type that represents
4367
+ * QueryConstraints which are used to narrow or order the set of documents,
4368
+ * but that do not explicitly filter on a document field.
4369
+ * `QueryNonFilterConstraint`s are created by invoking {@link orderBy},
4370
+ * {@link startAt}, {@link startAfter}, {@link endBefore}, {@link endAt},
4371
+ * {@link limit} or {@link limitToLast} and can then be passed to {@link query}
4372
+ * to create a new query instance that also contains the `QueryConstraint`.
4373
+ */
4374
+ export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
4375
+
4376
+ /**
4377
+ * A `QueryOrderByConstraint` is used to sort the set of documents returned by a
4378
+ * Firestore query. `QueryOrderByConstraint`s are created by invoking
4379
+ * {@link orderBy} and can then be passed to {@link query} to create a new query
4380
+ * instance that also contains this `QueryOrderByConstraint`.
4381
+ *
4382
+ * Note: Documents that do not contain the orderBy field will not be present in
4383
+ * the query result.
4384
+ */
4385
+ export declare class QueryOrderByConstraint extends QueryConstraint {
4386
+ private readonly _field;
4387
+ private _direction;
4388
+ /** The type of this query constraint */
4389
+ readonly type = "orderBy";
4390
+ /* Excluded from this release type: __constructor */
4391
+ static _create(_field: _FieldPath, _direction: Direction): QueryOrderByConstraint;
4392
+ _apply<T>(query: Query<T>): Query<T>;
4393
+ }
4394
+
4240
4395
  /**
4241
4396
  * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects
4242
4397
  * representing the results of a query. The documents can be accessed as an
@@ -4288,6 +4443,23 @@ export declare class QuerySnapshot<T = DocumentData> {
4288
4443
  docChanges(options?: SnapshotListenOptions): Array<DocumentChange<T>>;
4289
4444
  }
4290
4445
 
4446
+ /**
4447
+ * A `QueryStartAtConstraint` is used to exclude documents from the start of a
4448
+ * result set returned by a Firestore query.
4449
+ * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
4450
+ * {@link (startAfter:1)} and can then be passed to {@link query} to create a
4451
+ * new query instance that also contains this `QueryStartAtConstraint`.
4452
+ */
4453
+ export declare class QueryStartAtConstraint extends QueryConstraint {
4454
+ /** The type of this query constraint */
4455
+ readonly type: 'startAt' | 'startAfter';
4456
+ private readonly _docOrFields;
4457
+ private readonly _inclusive;
4458
+ /* Excluded from this release type: __constructor */
4459
+ static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot_2<unknown>>, _inclusive: boolean): QueryStartAtConstraint;
4460
+ _apply<T>(query: Query<T>): Query<T>;
4461
+ }
4462
+
4291
4463
  /** The different states of a watch target. */
4292
4464
  declare type QueryTargetState = 'not-current' | 'current' | 'rejected';
4293
4465
 
@@ -5022,48 +5194,48 @@ declare class SortedSetIterator<T> {
5022
5194
  }
5023
5195
 
5024
5196
  /**
5025
- * Creates a {@link QueryConstraint} that modifies the result set to start after the
5026
- * provided document (exclusive). The starting position is relative to the order
5027
- * of the query. The document must contain all of the fields provided in the
5028
- * orderBy of the query.
5197
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5198
+ * start after the provided document (exclusive). The starting position is
5199
+ * relative to the order of the query. The document must contain all of the
5200
+ * fields provided in the orderBy of the query.
5029
5201
  *
5030
5202
  * @param snapshot - The snapshot of the document to start after.
5031
- * @returns A {@link QueryConstraint} to pass to `query()`
5203
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`
5032
5204
  */
5033
- export declare function startAfter(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
5205
+ export declare function startAfter(snapshot: DocumentSnapshot_2<unknown>): QueryStartAtConstraint;
5034
5206
 
5035
5207
  /**
5036
- * Creates a {@link QueryConstraint} that modifies the result set to start after the
5037
- * provided fields relative to the order of the query. The order of the field
5038
- * values must match the order of the order by clauses of the query.
5208
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5209
+ * start after the provided fields relative to the order of the query. The order
5210
+ * of the field values must match the order of the order by clauses of the query.
5039
5211
  *
5040
5212
  * @param fieldValues - The field values to start this query after, in order
5041
5213
  * of the query's order by.
5042
- * @returns A {@link QueryConstraint} to pass to `query()`
5214
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`
5043
5215
  */
5044
- export declare function startAfter(...fieldValues: unknown[]): QueryConstraint;
5216
+ export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;
5045
5217
 
5046
5218
  /**
5047
- * Creates a {@link QueryConstraint} that modifies the result set to start at the
5048
- * provided document (inclusive). The starting position is relative to the order
5049
- * of the query. The document must contain all of the fields provided in the
5050
- * `orderBy` of this query.
5219
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5220
+ * start at the provided document (inclusive). The starting position is relative
5221
+ * to the order of the query. The document must contain all of the fields
5222
+ * provided in the `orderBy` of this query.
5051
5223
  *
5052
5224
  * @param snapshot - The snapshot of the document to start at.
5053
- * @returns A {@link QueryConstraint} to pass to `query()`.
5225
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`.
5054
5226
  */
5055
- export declare function startAt(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
5227
+ export declare function startAt(snapshot: DocumentSnapshot_2<unknown>): QueryStartAtConstraint;
5056
5228
 
5057
5229
  /**
5058
- * Creates a {@link QueryConstraint} that modifies the result set to start at the
5059
- * provided fields relative to the order of the query. The order of the field
5060
- * values must match the order of the order by clauses of the query.
5230
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5231
+ * start at the provided fields relative to the order of the query. The order of
5232
+ * the field values must match the order of the order by clauses of the query.
5061
5233
  *
5062
5234
  * @param fieldValues - The field values to start this query at, in order
5063
5235
  * of the query's order by.
5064
- * @returns A {@link QueryConstraint} to pass to `query()`.
5236
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`.
5065
5237
  */
5066
- export declare function startAt(...fieldValues: unknown[]): QueryConstraint;
5238
+ export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
5067
5239
 
5068
5240
  declare type StructuredQuery = firestoreV1ApiClientInterfaces.StructuredQuery;
5069
5241
 
@@ -5945,17 +6117,17 @@ declare class ViewSnapshot {
5945
6117
  export declare function waitForPendingWrites(firestore: Firestore): Promise<void>;
5946
6118
 
5947
6119
  /**
5948
- * Creates a {@link QueryConstraint} that enforces that documents must contain the
5949
- * specified field and that the value should satisfy the relation constraint
5950
- * provided.
6120
+ * Creates a {@link QueryFieldFilterConstraint} that enforces that documents
6121
+ * must contain the specified field and that the value should satisfy the
6122
+ * relation constraint provided.
5951
6123
  *
5952
6124
  * @param fieldPath - The path to compare
5953
6125
  * @param opStr - The operation string (e.g "&lt;", "&lt;=", "==", "&lt;",
5954
6126
  * "&lt;=", "!=").
5955
6127
  * @param value - The value for comparison
5956
- * @returns The created {@link Query}.
6128
+ * @returns The created {@link QueryFieldFilterConstraint}.
5957
6129
  */
5958
- export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryConstraint;
6130
+ export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint;
5959
6131
 
5960
6132
  /**
5961
6133
  * Filter conditions in a {@link where} clause are specified using the