@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
  /**
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.
@@ -1253,48 +1272,48 @@ export declare function enableMultiTabIndexedDbPersistence(firestore: Firestore)
1253
1272
  export declare function enableNetwork(firestore: Firestore): Promise<void>;
1254
1273
 
1255
1274
  /**
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
1275
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
1276
+ * the provided document (inclusive). The end position is relative to the order
1277
+ * of the query. The document must contain all of the fields provided in the
1259
1278
  * orderBy of the query.
1260
1279
  *
1261
1280
  * @param snapshot - The snapshot of the document to end at.
1262
- * @returns A {@link QueryConstraint} to pass to `query()`
1281
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
1263
1282
  */
1264
- export declare function endAt(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
1283
+ export declare function endAt(snapshot: DocumentSnapshot_2<unknown>): QueryEndAtConstraint;
1265
1284
 
1266
1285
  /**
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
1286
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
1287
+ * the provided fields relative to the order of the query. The order of the field
1269
1288
  * values must match the order of the order by clauses of the query.
1270
1289
  *
1271
1290
  * @param fieldValues - The field values to end this query at, in order
1272
1291
  * of the query's order by.
1273
- * @returns A {@link QueryConstraint} to pass to `query()`
1292
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
1274
1293
  */
1275
- export declare function endAt(...fieldValues: unknown[]): QueryConstraint;
1294
+ export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
1276
1295
 
1277
1296
  /**
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.
1297
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end
1298
+ * before the provided document (exclusive). The end position is relative to the
1299
+ * order of the query. The document must contain all of the fields provided in
1300
+ * the orderBy of the query.
1282
1301
  *
1283
1302
  * @param snapshot - The snapshot of the document to end before.
1284
- * @returns A {@link QueryConstraint} to pass to `query()`
1303
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
1285
1304
  */
1286
- export declare function endBefore(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
1305
+ export declare function endBefore(snapshot: DocumentSnapshot_2<unknown>): QueryEndAtConstraint;
1287
1306
 
1288
1307
  /**
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.
1308
+ * Creates a {@link QueryEndAtConstraint} that modifies the result set to end
1309
+ * before the provided fields relative to the order of the query. The order of
1310
+ * the field values must match the order of the order by clauses of the query.
1292
1311
  *
1293
1312
  * @param fieldValues - The field values to end this query before, in order
1294
1313
  * of the query's order by.
1295
- * @returns A {@link QueryConstraint} to pass to `query()`
1314
+ * @returns A {@link QueryEndAtConstraint} to pass to `query()`
1296
1315
  */
1297
- export declare function endBefore(...fieldValues: unknown[]): QueryConstraint;
1316
+ export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;
1298
1317
 
1299
1318
  /* Excluded from this release type: ensureFirestoreConfigured */
1300
1319
 
@@ -1319,6 +1338,24 @@ declare interface EventManager {
1319
1338
 
1320
1339
  /* Excluded from this release type: executeWrite */
1321
1340
 
1341
+ declare class FieldFilter extends Filter {
1342
+ readonly field: _FieldPath;
1343
+ readonly op: Operator;
1344
+ readonly value: Value;
1345
+ protected constructor(field: _FieldPath, op: Operator, value: Value);
1346
+ /**
1347
+ * Creates a filter based on the provided arguments.
1348
+ */
1349
+ static create(field: _FieldPath, op: Operator, value: Value): FieldFilter;
1350
+ private static createKeyFieldInFilter;
1351
+ matches(doc: Document_2): boolean;
1352
+ protected matchesComparison(comparison: number): boolean;
1353
+ isInequality(): boolean;
1354
+ getFlattenedFilters(): readonly FieldFilter[];
1355
+ getFilters(): Filter[];
1356
+ getFirstInequalityField(): _FieldPath | null;
1357
+ }
1358
+
1322
1359
  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
1360
 
1324
1361
  /**
@@ -1445,6 +1482,9 @@ export declare abstract class FieldValue {
1445
1482
 
1446
1483
  declare abstract class Filter {
1447
1484
  abstract matches(doc: Document_2): boolean;
1485
+ abstract getFlattenedFilters(): readonly FieldFilter[];
1486
+ abstract getFilters(): Filter[];
1487
+ abstract getFirstInequalityField(): _FieldPath | null;
1448
1488
  }
1449
1489
 
1450
1490
  /* Excluded from this release type: _FirebaseService */
@@ -2625,23 +2665,25 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Firestor
2625
2665
  /* Excluded from this release type: _isBase64Available */
2626
2666
 
2627
2667
  /**
2628
- * Creates a {@link QueryConstraint} that only returns the first matching documents.
2668
+ * Creates a {@link QueryLimitConstraint} that only returns the first matching
2669
+ * documents.
2629
2670
  *
2630
2671
  * @param limit - The maximum number of items to return.
2631
- * @returns The created {@link Query}.
2672
+ * @returns The created {@link QueryLimitConstraint}.
2632
2673
  */
2633
- export declare function limit(limit: number): QueryConstraint;
2674
+ export declare function limit(limit: number): QueryLimitConstraint;
2634
2675
 
2635
2676
  /**
2636
- * Creates a {@link QueryConstraint} that only returns the last matching documents.
2677
+ * Creates a {@link QueryLimitConstraint} that only returns the last matching
2678
+ * documents.
2637
2679
  *
2638
2680
  * You must specify at least one `orderBy` clause for `limitToLast` queries,
2639
2681
  * otherwise an exception will be thrown during execution.
2640
2682
  *
2641
2683
  * @param limit - The maximum number of items to return.
2642
- * @returns The created {@link Query}.
2684
+ * @returns The created {@link QueryLimitConstraint}.
2643
2685
  */
2644
- export declare function limitToLast(limit: number): QueryConstraint;
2686
+ export declare function limitToLast(limit: number): QueryLimitConstraint;
2645
2687
 
2646
2688
  declare const enum LimitType {
2647
2689
  First = "F",
@@ -3716,6 +3758,21 @@ export declare function onSnapshotsInSync(firestore: Firestore, observer: {
3716
3758
  */
3717
3759
  export declare function onSnapshotsInSync(firestore: Firestore, onSync: () => void): Unsubscribe;
3718
3760
 
3761
+ declare const enum Operator {
3762
+ LESS_THAN = "<",
3763
+ LESS_THAN_OR_EQUAL = "<=",
3764
+ EQUAL = "==",
3765
+ NOT_EQUAL = "!=",
3766
+ GREATER_THAN = ">",
3767
+ GREATER_THAN_OR_EQUAL = ">=",
3768
+ ARRAY_CONTAINS = "array-contains",
3769
+ IN = "in",
3770
+ NOT_IN = "not-in",
3771
+ ARRAY_CONTAINS_ANY = "array-contains-any"
3772
+ }
3773
+
3774
+ /* Excluded from this release type: or */
3775
+
3719
3776
  /**
3720
3777
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
3721
3778
  */
@@ -3726,15 +3783,18 @@ declare class OrderBy {
3726
3783
  }
3727
3784
 
3728
3785
  /**
3729
- * Creates a {@link QueryConstraint} that sorts the query result by the
3786
+ * Creates a {@link QueryOrderByConstraint} that sorts the query result by the
3730
3787
  * specified field, optionally in descending order instead of ascending.
3731
3788
  *
3789
+ * Note: Documents that do not contain the specified field will not be present
3790
+ * in the query result.
3791
+ *
3732
3792
  * @param fieldPath - The field to sort by.
3733
3793
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
3734
3794
  * not specified, order will be ascending.
3735
- * @returns The created {@link Query}.
3795
+ * @returns The created {@link QueryOrderByConstraint}.
3736
3796
  */
3737
- export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryConstraint;
3797
+ export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
3738
3798
 
3739
3799
  /**
3740
3800
  * The direction of a {@link orderBy} clause is specified as 'desc' or 'asc'
@@ -4128,11 +4188,14 @@ export declare class Query<T = DocumentData> {
4128
4188
  withConverter<U>(converter: FirestoreDataConverter_2<U>): Query<U>;
4129
4189
  }
4130
4190
 
4191
+ /* Excluded declaration from this release type: query */
4192
+
4131
4193
  /**
4132
- * Creates a new immutable instance of {@link Query} that is extended to also include
4133
- * additional query constraints.
4194
+ * Creates a new immutable instance of {@link Query} that is extended to also
4195
+ * include additional query constraints.
4134
4196
  *
4135
- * @param query - The {@link Query} instance to use as a base for the new constraints.
4197
+ * @param query - The {@link Query} instance to use as a base for the new
4198
+ * constraints.
4136
4199
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4137
4200
  * @throws if any of the provided query constraints cannot be combined with the
4138
4201
  * existing or new constraints.
@@ -4156,20 +4219,22 @@ declare interface Query_2 {
4156
4219
  readonly endAt: Bound | null;
4157
4220
  }
4158
4221
 
4222
+ /* Excluded from this release type: QueryCompositeFilterConstraint */
4223
+
4159
4224
  /**
4160
4225
  * A `QueryConstraint` is used to narrow the set of documents returned by a
4161
4226
  * 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
4227
+ * {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
4228
+ * endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
4164
4229
  * can then be passed to {@link query} to create a new query instance that
4165
4230
  * also contains this `QueryConstraint`.
4166
4231
  */
4167
- export declare abstract class QueryConstraint {
4168
- /** The type of this query constraints */
4232
+ export declare abstract class QueryConstraint extends AppliableConstraint {
4233
+ /** The type of this query constraint */
4169
4234
  abstract readonly type: QueryConstraintType;
4170
4235
  /**
4171
4236
  * Takes the provided {@link Query} and returns a copy of the {@link Query} with this
4172
- * {@link QueryConstraint} applied.
4237
+ * {@link AppliableConstraint} applied.
4173
4238
  */
4174
4239
  abstract _apply<T>(query: Query<T>): Query<T>;
4175
4240
  }
@@ -4226,6 +4291,23 @@ declare class QueryDocumentSnapshot_2<T = DocumentData> extends DocumentSnapshot
4226
4291
  data(): T;
4227
4292
  }
4228
4293
 
4294
+ /**
4295
+ * A `QueryEndAtConstraint` is used to exclude documents from the end of a
4296
+ * result set returned by a Firestore query.
4297
+ * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
4298
+ * {@link (endBefore:1)} and can then be passed to {@link query} to create a new
4299
+ * query instance that also contains this `QueryEndAtConstraint`.
4300
+ */
4301
+ export declare class QueryEndAtConstraint extends QueryConstraint {
4302
+ /** The type of this query constraint */
4303
+ readonly type: 'endBefore' | 'endAt';
4304
+ private readonly _docOrFields;
4305
+ private readonly _inclusive;
4306
+ /* Excluded from this release type: __constructor */
4307
+ static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot_2<unknown>>, _inclusive: boolean): QueryEndAtConstraint;
4308
+ _apply<T>(query: Query<T>): Query<T>;
4309
+ }
4310
+
4229
4311
  /**
4230
4312
  * Returns true if the provided queries point to the same collection and apply
4231
4313
  * the same constraints.
@@ -4237,6 +4319,74 @@ declare class QueryDocumentSnapshot_2<T = DocumentData> extends DocumentSnapshot
4237
4319
  */
4238
4320
  export declare function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
4239
4321
 
4322
+ /**
4323
+ * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
4324
+ * a Firestore query by filtering on one or more document fields.
4325
+ * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
4326
+ * be passed to {@link query} to create a new query instance that also contains
4327
+ * this `QueryFieldFilterConstraint`.
4328
+ */
4329
+ export declare class QueryFieldFilterConstraint extends QueryConstraint {
4330
+ private readonly _field;
4331
+ private _op;
4332
+ private _value;
4333
+ /** The type of this query constraint */
4334
+ readonly type = "where";
4335
+ /* Excluded from this release type: __constructor */
4336
+ static _create(_field: _FieldPath, _op: Operator, _value: unknown): QueryFieldFilterConstraint;
4337
+ _apply<T>(query: Query<T>): Query<T>;
4338
+ _parse<T>(query: Query<T>): FieldFilter;
4339
+ }
4340
+
4341
+ /* Excluded from this release type: QueryFilterConstraint */
4342
+
4343
+ /**
4344
+ * A `QueryLimitConstraint` is used to limit the number of documents returned by
4345
+ * a Firestore query.
4346
+ * `QueryLimitConstraint`s are created by invoking {@link limit} or
4347
+ * {@link limitToLast} and can then be passed to {@link query} to create a new
4348
+ * query instance that also contains this `QueryLimitConstraint`.
4349
+ */
4350
+ export declare class QueryLimitConstraint extends QueryConstraint {
4351
+ /** The type of this query constraint */
4352
+ readonly type: 'limit' | 'limitToLast';
4353
+ private readonly _limit;
4354
+ private readonly _limitType;
4355
+ /* Excluded from this release type: __constructor */
4356
+ static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType): QueryLimitConstraint;
4357
+ _apply<T>(query: Query<T>): Query<T>;
4358
+ }
4359
+
4360
+ /**
4361
+ * `QueryNonFilterConstraint` is a helper union type that represents
4362
+ * QueryConstraints which are used to narrow or order the set of documents,
4363
+ * but that do not explicitly filter on a document field.
4364
+ * `QueryNonFilterConstraint`s are created by invoking {@link orderBy},
4365
+ * {@link startAt}, {@link startAfter}, {@link endBefore}, {@link endAt},
4366
+ * {@link limit} or {@link limitToLast} and can then be passed to {@link query}
4367
+ * to create a new query instance that also contains the `QueryConstraint`.
4368
+ */
4369
+ export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
4370
+
4371
+ /**
4372
+ * A `QueryOrderByConstraint` is used to sort the set of documents returned by a
4373
+ * Firestore query. `QueryOrderByConstraint`s are created by invoking
4374
+ * {@link orderBy} and can then be passed to {@link query} to create a new query
4375
+ * instance that also contains this `QueryOrderByConstraint`.
4376
+ *
4377
+ * Note: Documents that do not contain the orderBy field will not be present in
4378
+ * the query result.
4379
+ */
4380
+ export declare class QueryOrderByConstraint extends QueryConstraint {
4381
+ private readonly _field;
4382
+ private _direction;
4383
+ /** The type of this query constraint */
4384
+ readonly type = "orderBy";
4385
+ /* Excluded from this release type: __constructor */
4386
+ static _create(_field: _FieldPath, _direction: Direction): QueryOrderByConstraint;
4387
+ _apply<T>(query: Query<T>): Query<T>;
4388
+ }
4389
+
4240
4390
  /**
4241
4391
  * A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects
4242
4392
  * representing the results of a query. The documents can be accessed as an
@@ -4288,6 +4438,23 @@ export declare class QuerySnapshot<T = DocumentData> {
4288
4438
  docChanges(options?: SnapshotListenOptions): Array<DocumentChange<T>>;
4289
4439
  }
4290
4440
 
4441
+ /**
4442
+ * A `QueryStartAtConstraint` is used to exclude documents from the start of a
4443
+ * result set returned by a Firestore query.
4444
+ * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
4445
+ * {@link (startAfter:1)} and can then be passed to {@link query} to create a
4446
+ * new query instance that also contains this `QueryStartAtConstraint`.
4447
+ */
4448
+ export declare class QueryStartAtConstraint extends QueryConstraint {
4449
+ /** The type of this query constraint */
4450
+ readonly type: 'startAt' | 'startAfter';
4451
+ private readonly _docOrFields;
4452
+ private readonly _inclusive;
4453
+ /* Excluded from this release type: __constructor */
4454
+ static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot_2<unknown>>, _inclusive: boolean): QueryStartAtConstraint;
4455
+ _apply<T>(query: Query<T>): Query<T>;
4456
+ }
4457
+
4291
4458
  /** The different states of a watch target. */
4292
4459
  declare type QueryTargetState = 'not-current' | 'current' | 'rejected';
4293
4460
 
@@ -5022,48 +5189,48 @@ declare class SortedSetIterator<T> {
5022
5189
  }
5023
5190
 
5024
5191
  /**
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.
5192
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5193
+ * start after the provided document (exclusive). The starting position is
5194
+ * relative to the order of the query. The document must contain all of the
5195
+ * fields provided in the orderBy of the query.
5029
5196
  *
5030
5197
  * @param snapshot - The snapshot of the document to start after.
5031
- * @returns A {@link QueryConstraint} to pass to `query()`
5198
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`
5032
5199
  */
5033
- export declare function startAfter(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
5200
+ export declare function startAfter(snapshot: DocumentSnapshot_2<unknown>): QueryStartAtConstraint;
5034
5201
 
5035
5202
  /**
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.
5203
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5204
+ * start after the provided fields relative to the order of the query. The order
5205
+ * of the field values must match the order of the order by clauses of the query.
5039
5206
  *
5040
5207
  * @param fieldValues - The field values to start this query after, in order
5041
5208
  * of the query's order by.
5042
- * @returns A {@link QueryConstraint} to pass to `query()`
5209
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`
5043
5210
  */
5044
- export declare function startAfter(...fieldValues: unknown[]): QueryConstraint;
5211
+ export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;
5045
5212
 
5046
5213
  /**
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.
5214
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5215
+ * start at the provided document (inclusive). The starting position is relative
5216
+ * to the order of the query. The document must contain all of the fields
5217
+ * provided in the `orderBy` of this query.
5051
5218
  *
5052
5219
  * @param snapshot - The snapshot of the document to start at.
5053
- * @returns A {@link QueryConstraint} to pass to `query()`.
5220
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`.
5054
5221
  */
5055
- export declare function startAt(snapshot: DocumentSnapshot_2<unknown>): QueryConstraint;
5222
+ export declare function startAt(snapshot: DocumentSnapshot_2<unknown>): QueryStartAtConstraint;
5056
5223
 
5057
5224
  /**
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.
5225
+ * Creates a {@link QueryStartAtConstraint} that modifies the result set to
5226
+ * start at the provided fields relative to the order of the query. The order of
5227
+ * the field values must match the order of the order by clauses of the query.
5061
5228
  *
5062
5229
  * @param fieldValues - The field values to start this query at, in order
5063
5230
  * of the query's order by.
5064
- * @returns A {@link QueryConstraint} to pass to `query()`.
5231
+ * @returns A {@link QueryStartAtConstraint} to pass to `query()`.
5065
5232
  */
5066
- export declare function startAt(...fieldValues: unknown[]): QueryConstraint;
5233
+ export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
5067
5234
 
5068
5235
  declare type StructuredQuery = firestoreV1ApiClientInterfaces.StructuredQuery;
5069
5236
 
@@ -5945,17 +6112,17 @@ declare class ViewSnapshot {
5945
6112
  export declare function waitForPendingWrites(firestore: Firestore): Promise<void>;
5946
6113
 
5947
6114
  /**
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.
6115
+ * Creates a {@link QueryFieldFilterConstraint} that enforces that documents
6116
+ * must contain the specified field and that the value should satisfy the
6117
+ * relation constraint provided.
5951
6118
  *
5952
6119
  * @param fieldPath - The path to compare
5953
6120
  * @param opStr - The operation string (e.g "&lt;", "&lt;=", "==", "&lt;",
5954
6121
  * "&lt;=", "!=").
5955
6122
  * @param value - The value for comparison
5956
- * @returns The created {@link Query}.
6123
+ * @returns The created {@link QueryFieldFilterConstraint}.
5957
6124
  */
5958
- export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryConstraint;
6125
+ export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint;
5959
6126
 
5960
6127
  /**
5961
6128
  * Filter conditions in a {@link where} clause are specified using the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/firestore",
3
- "version": "3.7.3-canary.e9fb4037f",
3
+ "version": "3.7.3-canary.fde5adf63",
4
4
  "engines": {
5
5
  "node": ">=10.10.0"
6
6
  },
@@ -30,6 +30,8 @@
30
30
  "test:all:ci": "run-p test:browser test:lite:browser test:travis",
31
31
  "test:all": "run-p test:browser test:lite:browser test:travis test:minified",
32
32
  "test:browser": "karma start --single-run",
33
+ "test:browser:emulator:debug": "karma start --browsers=Chrome --local",
34
+ "test:browser:emulator": "karma start --single-run --local",
33
35
  "test:browser:unit": "karma start --single-run --unit",
34
36
  "test:browser:debug": "karma start --browsers=Chrome --auto-watch",
35
37
  "test:node": "node ./scripts/run-tests.js --main=test/register.ts --emulator 'test/{,!(browser|lite)/**/}*.test.ts'",
@@ -80,22 +82,22 @@
80
82
  "lite/package.json"
81
83
  ],
82
84
  "dependencies": {
83
- "@firebase/component": "0.5.21-canary.e9fb4037f",
84
- "@firebase/logger": "0.3.4-canary.e9fb4037f",
85
- "@firebase/util": "1.7.3-canary.e9fb4037f",
86
- "@firebase/webchannel-wrapper": "0.8.1-canary.e9fb4037f",
87
- "@grpc/grpc-js": "^1.3.2",
85
+ "@firebase/component": "0.5.21-canary.fde5adf63",
86
+ "@firebase/logger": "0.3.4-canary.fde5adf63",
87
+ "@firebase/util": "1.7.3-canary.fde5adf63",
88
+ "@firebase/webchannel-wrapper": "0.8.1-canary.fde5adf63",
89
+ "@grpc/grpc-js": "~1.7.0",
88
90
  "@grpc/proto-loader": "^0.6.13",
89
91
  "node-fetch": "2.6.7",
90
92
  "tslib": "^2.1.0"
91
93
  },
92
94
  "peerDependencies": {
93
- "@firebase/app": "0.8.4-canary.e9fb4037f"
95
+ "@firebase/app": "0.8.4-canary.fde5adf63"
94
96
  },
95
97
  "devDependencies": {
96
- "@firebase/app": "0.8.4-canary.e9fb4037f",
97
- "@firebase/app-compat": "0.1.39-canary.e9fb4037f",
98
- "@firebase/auth": "0.20.11-canary.e9fb4037f",
98
+ "@firebase/app": "0.8.4-canary.fde5adf63",
99
+ "@firebase/app-compat": "0.1.39-canary.fde5adf63",
100
+ "@firebase/auth": "0.20.11-canary.fde5adf63",
99
101
  "@rollup/plugin-alias": "3.1.9",
100
102
  "@rollup/plugin-json": "4.1.0",
101
103
  "@types/eslint": "7.29.0",
@@ -111,7 +113,7 @@
111
113
  "rollup-plugin-terser": "7.0.2",
112
114
  "rollup-plugin-typescript2": "0.31.2",
113
115
  "ts-node": "10.9.1",
114
- "typescript": "4.2.2"
116
+ "typescript": "4.7.4"
115
117
  },
116
118
  "repository": {
117
119
  "directory": "packages/firestore",