@firebase/firestore 3.7.3 → 3.8.0-canary.20e5ef7fb

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 (124) 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/reference_impl.d.ts +2 -1
  5. package/dist/firestore/src/api.d.ts +1 -1
  6. package/dist/firestore/src/core/bound.d.ts +49 -0
  7. package/dist/firestore/src/core/filter.d.ts +134 -0
  8. package/dist/firestore/src/core/order_by.d.ts +35 -0
  9. package/dist/firestore/src/core/query.d.ts +5 -6
  10. package/dist/firestore/src/core/target.d.ts +4 -120
  11. package/dist/firestore/src/lite-api/query.d.ts +273 -66
  12. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  13. package/dist/firestore/src/local/local_documents_view.d.ts +0 -2
  14. package/dist/firestore/src/model/document.d.ts +8 -1
  15. package/dist/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  16. package/dist/firestore/src/remote/serializer.d.ts +10 -3
  17. package/dist/firestore/src/util/logic_utils.d.ts +52 -0
  18. package/dist/firestore/src/util/types.d.ts +1 -1
  19. package/dist/firestore/test/lite/helpers.d.ts +1 -1
  20. package/dist/firestore/test/unit/core/filter.test.d.ts +17 -0
  21. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  22. package/dist/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  23. package/dist/firestore/test/util/helpers.d.ts +6 -2
  24. package/dist/firestore/test/util/test_platform.d.ts +2 -2
  25. package/dist/index.d.ts +140 -63
  26. package/dist/index.esm2017.js +4297 -3743
  27. package/dist/index.esm2017.js.map +1 -1
  28. package/dist/index.esm5.js +4982 -4410
  29. package/dist/index.esm5.js.map +1 -1
  30. package/dist/index.node.cjs.js +1659 -890
  31. package/dist/index.node.cjs.js.map +1 -1
  32. package/dist/index.node.mjs +1652 -891
  33. package/dist/index.node.mjs.map +1 -1
  34. package/dist/index.rn.js +4522 -3968
  35. package/dist/index.rn.js.map +1 -1
  36. package/dist/internal.d.ts +330 -69
  37. package/dist/lite/firestore/lite/index.d.ts +1 -1
  38. package/dist/lite/firestore/src/api/filter.d.ts +1 -1
  39. package/dist/lite/firestore/src/api/reference_impl.d.ts +2 -1
  40. package/dist/lite/firestore/src/api.d.ts +1 -1
  41. package/dist/lite/firestore/src/core/bound.d.ts +49 -0
  42. package/dist/lite/firestore/src/core/filter.d.ts +134 -0
  43. package/dist/lite/firestore/src/core/order_by.d.ts +35 -0
  44. package/dist/lite/firestore/src/core/query.d.ts +5 -6
  45. package/dist/lite/firestore/src/core/target.d.ts +4 -120
  46. package/dist/lite/firestore/src/lite-api/query.d.ts +273 -66
  47. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  48. package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -2
  49. package/dist/lite/firestore/src/model/document.d.ts +8 -1
  50. package/dist/lite/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  51. package/dist/lite/firestore/src/remote/serializer.d.ts +10 -3
  52. package/dist/lite/firestore/src/util/logic_utils.d.ts +52 -0
  53. package/dist/lite/firestore/src/util/types.d.ts +1 -1
  54. package/dist/lite/firestore/test/lite/helpers.d.ts +1 -1
  55. package/dist/lite/firestore/test/unit/core/filter.test.d.ts +17 -0
  56. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  57. package/dist/lite/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  58. package/dist/lite/firestore/test/util/helpers.d.ts +6 -2
  59. package/dist/lite/firestore/test/util/test_platform.d.ts +2 -2
  60. package/dist/lite/index.browser.esm2017.js +2091 -1793
  61. package/dist/lite/index.browser.esm2017.js.map +1 -1
  62. package/dist/lite/index.browser.esm5.js +2219 -1980
  63. package/dist/lite/index.browser.esm5.js.map +1 -1
  64. package/dist/lite/index.d.ts +138 -62
  65. package/dist/lite/index.node.cjs.js +2212 -1802
  66. package/dist/lite/index.node.cjs.js.map +1 -1
  67. package/dist/lite/index.node.mjs +2205 -1803
  68. package/dist/lite/index.node.mjs.map +1 -1
  69. package/dist/lite/index.rn.esm2017.js +2077 -1778
  70. package/dist/lite/index.rn.esm2017.js.map +1 -1
  71. package/dist/lite/internal.d.ts +328 -66
  72. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +322 -174
  73. package/dist/lite/packages/firestore/lite/index.d.ts +1 -1
  74. package/dist/lite/packages/firestore/rollup.config.debug.d.ts +1 -1
  75. package/dist/lite/packages/firestore/src/api/filter.d.ts +1 -1
  76. package/dist/lite/packages/firestore/src/api/reference_impl.d.ts +2 -1
  77. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  78. package/dist/lite/packages/firestore/src/core/bound.d.ts +49 -0
  79. package/dist/lite/packages/firestore/src/core/filter.d.ts +134 -0
  80. package/dist/lite/packages/firestore/src/core/order_by.d.ts +35 -0
  81. package/dist/lite/packages/firestore/src/core/query.d.ts +5 -6
  82. package/dist/lite/packages/firestore/src/core/target.d.ts +4 -120
  83. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +273 -66
  84. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  85. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -2
  86. package/dist/lite/packages/firestore/src/model/document.d.ts +8 -1
  87. package/dist/lite/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  88. package/dist/lite/packages/firestore/src/remote/serializer.d.ts +10 -3
  89. package/dist/lite/packages/firestore/src/util/logic_utils.d.ts +52 -0
  90. package/dist/lite/packages/firestore/src/util/types.d.ts +1 -1
  91. package/dist/lite/packages/firestore/test/lite/helpers.d.ts +1 -1
  92. package/dist/lite/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
  93. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  94. package/dist/lite/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  95. package/dist/lite/packages/firestore/test/util/helpers.d.ts +6 -2
  96. package/dist/lite/packages/firestore/test/util/test_platform.d.ts +2 -2
  97. package/dist/lite/private.d.ts +240 -66
  98. package/dist/packages/firestore/dist/index.esm2017.d.ts +370 -209
  99. package/dist/packages/firestore/lite/index.d.ts +1 -1
  100. package/dist/packages/firestore/rollup.config.debug.d.ts +1 -1
  101. package/dist/packages/firestore/src/api/filter.d.ts +1 -1
  102. package/dist/packages/firestore/src/api/reference_impl.d.ts +2 -1
  103. package/dist/packages/firestore/src/api.d.ts +1 -1
  104. package/dist/packages/firestore/src/core/bound.d.ts +49 -0
  105. package/dist/packages/firestore/src/core/filter.d.ts +134 -0
  106. package/dist/packages/firestore/src/core/order_by.d.ts +35 -0
  107. package/dist/packages/firestore/src/core/query.d.ts +5 -6
  108. package/dist/packages/firestore/src/core/target.d.ts +4 -120
  109. package/dist/packages/firestore/src/lite-api/query.d.ts +273 -66
  110. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  111. package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -2
  112. package/dist/packages/firestore/src/model/document.d.ts +8 -1
  113. package/dist/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  114. package/dist/packages/firestore/src/remote/serializer.d.ts +10 -3
  115. package/dist/packages/firestore/src/util/logic_utils.d.ts +52 -0
  116. package/dist/packages/firestore/src/util/types.d.ts +1 -1
  117. package/dist/packages/firestore/test/lite/helpers.d.ts +1 -1
  118. package/dist/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
  119. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  120. package/dist/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  121. package/dist/packages/firestore/test/util/helpers.d.ts +6 -2
  122. package/dist/packages/firestore/test/util/test_platform.d.ts +2 -2
  123. package/dist/private.d.ts +242 -69
  124. package/package.json +14 -12
@@ -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 */
@@ -2316,7 +2362,8 @@ export declare function getDocs<T>(query: Query<T>): Promise<QuerySnapshot<T>>;
2316
2362
 
2317
2363
  /**
2318
2364
  * Executes the query and returns the results as a `QuerySnapshot` from cache.
2319
- * Returns an error if the document is not currently cached.
2365
+ * Returns an empty result set if no documents matching the query are currently
2366
+ * cached.
2320
2367
  *
2321
2368
  * @returns A `Promise` that will be resolved with the results of the query.
2322
2369
  */
@@ -2625,23 +2672,25 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Firestor
2625
2672
  /* Excluded from this release type: _isBase64Available */
2626
2673
 
2627
2674
  /**
2628
- * Creates a {@link QueryConstraint} that only returns the first matching documents.
2675
+ * Creates a {@link QueryLimitConstraint} that only returns the first matching
2676
+ * documents.
2629
2677
  *
2630
2678
  * @param limit - The maximum number of items to return.
2631
- * @returns The created {@link Query}.
2679
+ * @returns The created {@link QueryLimitConstraint}.
2632
2680
  */
2633
- export declare function limit(limit: number): QueryConstraint;
2681
+ export declare function limit(limit: number): QueryLimitConstraint;
2634
2682
 
2635
2683
  /**
2636
- * Creates a {@link QueryConstraint} that only returns the last matching documents.
2684
+ * Creates a {@link QueryLimitConstraint} that only returns the last matching
2685
+ * documents.
2637
2686
  *
2638
2687
  * You must specify at least one `orderBy` clause for `limitToLast` queries,
2639
2688
  * otherwise an exception will be thrown during execution.
2640
2689
  *
2641
2690
  * @param limit - The maximum number of items to return.
2642
- * @returns The created {@link Query}.
2691
+ * @returns The created {@link QueryLimitConstraint}.
2643
2692
  */
2644
- export declare function limitToLast(limit: number): QueryConstraint;
2693
+ export declare function limitToLast(limit: number): QueryLimitConstraint;
2645
2694
 
2646
2695
  declare const enum LimitType {
2647
2696
  First = "F",
@@ -2884,8 +2933,6 @@ declare class LocalDocumentsView {
2884
2933
  private getDocumentsMatchingDocumentQuery;
2885
2934
  private getDocumentsMatchingCollectionGroupQuery;
2886
2935
  private getDocumentsMatchingCollectionQuery;
2887
- /** Returns a base document that can be used to apply `overlay`. */
2888
- private getBaseDocument;
2889
2936
  }
2890
2937
 
2891
2938
  declare interface LocalStore {
@@ -2970,6 +3017,7 @@ declare class MutableDocument implements Document_2 {
2970
3017
  private documentType;
2971
3018
  version: SnapshotVersion;
2972
3019
  readTime: SnapshotVersion;
3020
+ createTime: SnapshotVersion;
2973
3021
  data: ObjectValue;
2974
3022
  private documentState;
2975
3023
  private constructor();
@@ -2982,7 +3030,7 @@ declare class MutableDocument implements Document_2 {
2982
3030
  * Creates a new document that is known to exist with the given data at the
2983
3031
  * given version.
2984
3032
  */
2985
- static newFoundDocument(documentKey: _DocumentKey, version: SnapshotVersion, value: ObjectValue): MutableDocument;
3033
+ static newFoundDocument(documentKey: _DocumentKey, version: SnapshotVersion, createTime: SnapshotVersion, value: ObjectValue): MutableDocument;
2986
3034
  /** Creates a new document that is known to not exist at the given version. */
2987
3035
  static newNoDocument(documentKey: _DocumentKey, version: SnapshotVersion): MutableDocument;
2988
3036
  /**
@@ -3716,6 +3764,21 @@ export declare function onSnapshotsInSync(firestore: Firestore, observer: {
3716
3764
  */
3717
3765
  export declare function onSnapshotsInSync(firestore: Firestore, onSync: () => void): Unsubscribe;
3718
3766
 
3767
+ declare const enum Operator {
3768
+ LESS_THAN = "<",
3769
+ LESS_THAN_OR_EQUAL = "<=",
3770
+ EQUAL = "==",
3771
+ NOT_EQUAL = "!=",
3772
+ GREATER_THAN = ">",
3773
+ GREATER_THAN_OR_EQUAL = ">=",
3774
+ ARRAY_CONTAINS = "array-contains",
3775
+ IN = "in",
3776
+ NOT_IN = "not-in",
3777
+ ARRAY_CONTAINS_ANY = "array-contains-any"
3778
+ }
3779
+
3780
+ /* Excluded from this release type: or */
3781
+
3719
3782
  /**
3720
3783
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
3721
3784
  */
@@ -3726,15 +3789,18 @@ declare class OrderBy {
3726
3789
  }
3727
3790
 
3728
3791
  /**
3729
- * Creates a {@link QueryConstraint} that sorts the query result by the
3792
+ * Creates a {@link QueryOrderByConstraint} that sorts the query result by the
3730
3793
  * specified field, optionally in descending order instead of ascending.
3731
3794
  *
3795
+ * Note: Documents that do not contain the specified field will not be present
3796
+ * in the query result.
3797
+ *
3732
3798
  * @param fieldPath - The field to sort by.
3733
3799
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
3734
3800
  * not specified, order will be ascending.
3735
- * @returns The created {@link Query}.
3801
+ * @returns The created {@link QueryOrderByConstraint}.
3736
3802
  */
3737
- export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint;
3803
+ export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
3738
3804
 
3739
3805
  /**
3740
3806
  * The direction of a {@link orderBy} clause is specified as 'desc' or 'asc'
@@ -4128,11 +4194,14 @@ export declare class Query<T = DocumentData> {
4128
4194
  withConverter<U>(converter: FirestoreDataConverter_2<U>): Query<U>;
4129
4195
  }
4130
4196
 
4197
+ /* Excluded declaration from this release type: query */
4198
+
4131
4199
  /**
4132
- * Creates a new immutable instance of {@link Query} that is extended to also include
4133
- * additional query constraints.
4200
+ * Creates a new immutable instance of {@link Query} that is extended to also
4201
+ * include additional query constraints.
4134
4202
  *
4135
- * @param query - The {@link Query} instance to use as a base for the new constraints.
4203
+ * @param query - The {@link Query} instance to use as a base for the new
4204
+ * constraints.
4136
4205
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4137
4206
  * @throws if any of the provided query constraints cannot be combined with the
4138
4207
  * existing or new constraints.
@@ -4156,20 +4225,22 @@ declare interface Query_2 {
4156
4225
  readonly endAt: Bound | null;
4157
4226
  }
4158
4227
 
4228
+ /* Excluded from this release type: QueryCompositeFilterConstraint */
4229
+
4159
4230
  /**
4160
4231
  * A `QueryConstraint` is used to narrow the set of documents returned by a
4161
4232
  * 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
4233
+ * {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
4234
+ * endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
4164
4235
  * can then be passed to {@link query} to create a new query instance that
4165
4236
  * also contains this `QueryConstraint`.
4166
4237
  */
4167
- export declare abstract class QueryConstraint {
4168
- /** The type of this query constraints */
4238
+ export declare abstract class QueryConstraint extends AppliableConstraint {
4239
+ /** The type of this query constraint */
4169
4240
  abstract readonly type: QueryConstraintType;
4170
4241
  /**
4171
4242
  * Takes the provided {@link Query} and returns a copy of the {@link Query} with this
4172
- * {@link QueryConstraint} applied.
4243
+ * {@link AppliableConstraint} applied.
4173
4244
  */
4174
4245
  abstract _apply<T>(query: Query<T>): Query<T>;
4175
4246
  }
@@ -4226,6 +4297,23 @@ declare class QueryDocumentSnapshot_2<T = DocumentData> extends DocumentSnapshot
4226
4297
  data(): T;
4227
4298
  }
4228
4299
 
4300
+ /**
4301
+ * A `QueryEndAtConstraint` is used to exclude documents from the end of a
4302
+ * result set returned by a Firestore query.
4303
+ * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
4304
+ * {@link (endBefore:1)} and can then be passed to {@link query} to create a new
4305
+ * query instance that also contains this `QueryEndAtConstraint`.
4306
+ */
4307
+ export declare class QueryEndAtConstraint extends QueryConstraint {
4308
+ /** The type of this query constraint */
4309
+ readonly type: 'endBefore' | 'endAt';
4310
+ private readonly _docOrFields;
4311
+ private readonly _inclusive;
4312
+ /* Excluded from this release type: __constructor */
4313
+ static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot_2<unknown>>, _inclusive: boolean): QueryEndAtConstraint;
4314
+ _apply<T>(query: Query<T>): Query<T>;
4315
+ }
4316
+
4229
4317
  /**
4230
4318
  * Returns true if the provided queries point to the same collection and apply
4231
4319
  * the same constraints.
@@ -4237,6 +4325,74 @@ declare class QueryDocumentSnapshot_2<T = DocumentData> extends DocumentSnapshot
4237
4325
  */
4238
4326
  export declare function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
4239
4327
 
4328
+ /**
4329
+ * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
4330
+ * a Firestore query by filtering on one or more document fields.
4331
+ * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
4332
+ * be passed to {@link query} to create a new query instance that also contains
4333
+ * this `QueryFieldFilterConstraint`.
4334
+ */
4335
+ export declare class QueryFieldFilterConstraint extends QueryConstraint {
4336
+ private readonly _field;
4337
+ private _op;
4338
+ private _value;
4339
+ /** The type of this query constraint */
4340
+ readonly type = "where";
4341
+ /* Excluded from this release type: __constructor */
4342
+ static _create(_field: _FieldPath, _op: Operator, _value: unknown): QueryFieldFilterConstraint;
4343
+ _apply<T>(query: Query<T>): Query<T>;
4344
+ _parse<T>(query: Query<T>): FieldFilter;
4345
+ }
4346
+
4347
+ /* Excluded from this release type: QueryFilterConstraint */
4348
+
4349
+ /**
4350
+ * A `QueryLimitConstraint` is used to limit the number of documents returned by
4351
+ * a Firestore query.
4352
+ * `QueryLimitConstraint`s are created by invoking {@link limit} or
4353
+ * {@link limitToLast} and can then be passed to {@link query} to create a new
4354
+ * query instance that also contains this `QueryLimitConstraint`.
4355
+ */
4356
+ export declare class QueryLimitConstraint extends QueryConstraint {
4357
+ /** The type of this query constraint */
4358
+ readonly type: 'limit' | 'limitToLast';
4359
+ private readonly _limit;
4360
+ private readonly _limitType;
4361
+ /* Excluded from this release type: __constructor */
4362
+ static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType): QueryLimitConstraint;
4363
+ _apply<T>(query: Query<T>): Query<T>;
4364
+ }
4365
+
4366
+ /**
4367
+ * `QueryNonFilterConstraint` is a helper union type that represents
4368
+ * QueryConstraints which are used to narrow or order the set of documents,
4369
+ * but that do not explicitly filter on a document field.
4370
+ * `QueryNonFilterConstraint`s are created by invoking {@link orderBy},
4371
+ * {@link startAt}, {@link startAfter}, {@link endBefore}, {@link endAt},
4372
+ * {@link limit} or {@link limitToLast} and can then be passed to {@link query}
4373
+ * to create a new query instance that also contains the `QueryConstraint`.
4374
+ */
4375
+ export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
4376
+
4377
+ /**
4378
+ * A `QueryOrderByConstraint` is used to sort the set of documents returned by a
4379
+ * Firestore query. `QueryOrderByConstraint`s are created by invoking
4380
+ * {@link orderBy} and can then be passed to {@link query} to create a new query
4381
+ * instance that also contains this `QueryOrderByConstraint`.
4382
+ *
4383
+ * Note: Documents that do not contain the orderBy field will not be present in
4384
+ * the query result.
4385
+ */
4386
+ export declare class QueryOrderByConstraint extends QueryConstraint {
4387
+ private readonly _field;
4388
+ private _direction;
4389
+ /** The type of this query constraint */
4390
+ readonly type = "orderBy";
4391
+ /* Excluded from this release type: __constructor */
4392
+ static _create(_field: _FieldPath, _direction: Direction): QueryOrderByConstraint;
4393
+ _apply<T>(query: Query<T>): Query<T>;
4394
+ }
4395
+
4240
4396
  /**
4241
4397
  * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects
4242
4398
  * representing the results of a query. The documents can be accessed as an
@@ -4288,6 +4444,23 @@ export declare class QuerySnapshot<T = DocumentData> {
4288
4444
  docChanges(options?: SnapshotListenOptions): Array<DocumentChange<T>>;
4289
4445
  }
4290
4446
 
4447
+ /**
4448
+ * A `QueryStartAtConstraint` is used to exclude documents from the start of a
4449
+ * result set returned by a Firestore query.
4450
+ * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
4451
+ * {@link (startAfter:1)} and can then be passed to {@link query} to create a
4452
+ * new query instance that also contains this `QueryStartAtConstraint`.
4453
+ */
4454
+ export declare class QueryStartAtConstraint extends QueryConstraint {
4455
+ /** The type of this query constraint */
4456
+ readonly type: 'startAt' | 'startAfter';
4457
+ private readonly _docOrFields;
4458
+ private readonly _inclusive;
4459
+ /* Excluded from this release type: __constructor */
4460
+ static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot_2<unknown>>, _inclusive: boolean): QueryStartAtConstraint;
4461
+ _apply<T>(query: Query<T>): Query<T>;
4462
+ }
4463
+
4291
4464
  /** The different states of a watch target. */
4292
4465
  declare type QueryTargetState = 'not-current' | 'current' | 'rejected';
4293
4466
 
@@ -5022,48 +5195,48 @@ declare class SortedSetIterator<T> {
5022
5195
  }
5023
5196
 
5024
5197
  /**
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.
5198
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5199
+ * start after the provided document (exclusive). The starting position is
5200
+ * relative to the order of the query. The document must contain all of the
5201
+ * fields provided in the orderBy of the query.
5029
5202
  *
5030
5203
  * @param snapshot - The snapshot of the document to start after.
5031
- * @returns A {@link QueryConstraint} to pass to `query()`
5204
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`
5032
5205
  */
5033
- export declare function startAfter(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
5206
+ export declare function startAfter(snapshot: DocumentSnapshot_2<unknown>): QueryStartAtConstraint;
5034
5207
 
5035
5208
  /**
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.
5209
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5210
+ * start after the provided fields relative to the order of the query. The order
5211
+ * of the field values must match the order of the order by clauses of the query.
5039
5212
  *
5040
5213
  * @param fieldValues - The field values to start this query after, in order
5041
5214
  * of the query's order by.
5042
- * @returns A {@link QueryConstraint} to pass to `query()`
5215
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`
5043
5216
  */
5044
- export declare function startAfter(...fieldValues: unknown[]): QueryConstraint;
5217
+ export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;
5045
5218
 
5046
5219
  /**
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.
5220
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5221
+ * start at the provided document (inclusive). The starting position is relative
5222
+ * to the order of the query. The document must contain all of the fields
5223
+ * provided in the `orderBy` of this query.
5051
5224
  *
5052
5225
  * @param snapshot - The snapshot of the document to start at.
5053
- * @returns A {@link QueryConstraint} to pass to `query()`.
5226
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`.
5054
5227
  */
5055
- export declare function startAt(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
5228
+ export declare function startAt(snapshot: DocumentSnapshot_2<unknown>): QueryStartAtConstraint;
5056
5229
 
5057
5230
  /**
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.
5231
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5232
+ * start at the provided fields relative to the order of the query. The order of
5233
+ * the field values must match the order of the order by clauses of the query.
5061
5234
  *
5062
5235
  * @param fieldValues - The field values to start this query at, in order
5063
5236
  * of the query's order by.
5064
- * @returns A {@link QueryConstraint} to pass to `query()`.
5237
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`.
5065
5238
  */
5066
- export declare function startAt(...fieldValues: unknown[]): QueryConstraint;
5239
+ export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
5067
5240
 
5068
5241
  declare type StructuredQuery = firestoreV1ApiClientInterfaces.StructuredQuery;
5069
5242
 
@@ -5945,17 +6118,17 @@ declare class ViewSnapshot {
5945
6118
  export declare function waitForPendingWrites(firestore: Firestore): Promise<void>;
5946
6119
 
5947
6120
  /**
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.
6121
+ * Creates a {@link QueryFieldFilterConstraint} that enforces that documents
6122
+ * must contain the specified field and that the value should satisfy the
6123
+ * relation constraint provided.
5951
6124
  *
5952
6125
  * @param fieldPath - The path to compare
5953
6126
  * @param opStr - The operation string (e.g "&lt;", "&lt;=", "==", "&lt;",
5954
6127
  * "&lt;=", "!=").
5955
6128
  * @param value - The value for comparison
5956
- * @returns The created {@link Query}.
6129
+ * @returns The created {@link QueryFieldFilterConstraint}.
5957
6130
  */
5958
- export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryConstraint;
6131
+ export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint;
5959
6132
 
5960
6133
  /**
5961
6134
  * Filter conditions in a {@link where} clause are specified using the