@firebase/firestore 3.9.0-20230301000120 → 3.9.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 (54) hide show
  1. package/CHANGELOG.md +14 -5
  2. package/dist/firestore/src/lite-api/query.d.ts +11 -19
  3. package/dist/firestore/src/lite-api/reference.d.ts +1 -1
  4. package/dist/firestore/src/util/debug_uid.d.ts +28 -0
  5. package/dist/firestore/test/unit/specs/spec_builder.d.ts +3 -0
  6. package/dist/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
  7. package/dist/index.cjs.js +1359 -1309
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +66 -14
  10. package/dist/index.esm2017.js +1272 -1222
  11. package/dist/index.esm2017.js.map +1 -1
  12. package/dist/index.esm5.js +1335 -1259
  13. package/dist/index.esm5.js.map +1 -1
  14. package/dist/index.node.cjs.js +97 -32
  15. package/dist/index.node.cjs.js.map +1 -1
  16. package/dist/index.node.mjs +97 -32
  17. package/dist/index.node.mjs.map +1 -1
  18. package/dist/index.rn.js +1380 -1330
  19. package/dist/index.rn.js.map +1 -1
  20. package/dist/internal.d.ts +12 -20
  21. package/dist/lite/firestore/src/lite-api/query.d.ts +11 -19
  22. package/dist/lite/firestore/src/lite-api/reference.d.ts +1 -1
  23. package/dist/lite/firestore/src/util/debug_uid.d.ts +28 -0
  24. package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +3 -0
  25. package/dist/lite/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
  26. package/dist/lite/index.browser.esm2017.js +775 -730
  27. package/dist/lite/index.browser.esm2017.js.map +1 -1
  28. package/dist/lite/index.browser.esm5.js +736 -693
  29. package/dist/lite/index.browser.esm5.js.map +1 -1
  30. package/dist/lite/index.cjs.js +775 -730
  31. package/dist/lite/index.cjs.js.map +1 -1
  32. package/dist/lite/index.d.ts +66 -14
  33. package/dist/lite/index.node.cjs.js +76 -18
  34. package/dist/lite/index.node.cjs.js.map +1 -1
  35. package/dist/lite/index.node.mjs +76 -18
  36. package/dist/lite/index.node.mjs.map +1 -1
  37. package/dist/lite/index.rn.esm2017.js +777 -732
  38. package/dist/lite/index.rn.esm2017.js.map +1 -1
  39. package/dist/lite/internal.d.ts +12 -20
  40. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +139 -142
  41. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +11 -19
  42. package/dist/lite/packages/firestore/src/lite-api/reference.d.ts +1 -1
  43. package/dist/lite/packages/firestore/src/util/debug_uid.d.ts +28 -0
  44. package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +3 -0
  45. package/dist/lite/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
  46. package/dist/lite/private.d.ts +72 -16
  47. package/dist/packages/firestore/dist/index.esm2017.d.ts +157 -160
  48. package/dist/packages/firestore/src/lite-api/query.d.ts +11 -19
  49. package/dist/packages/firestore/src/lite-api/reference.d.ts +1 -1
  50. package/dist/packages/firestore/src/util/debug_uid.d.ts +28 -0
  51. package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +3 -0
  52. package/dist/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
  53. package/dist/private.d.ts +72 -16
  54. package/package.json +7 -7
package/dist/index.d.ts CHANGED
@@ -90,6 +90,18 @@ export declare interface AggregateSpec {
90
90
  export declare type AggregateSpecData<T extends AggregateSpec> = {
91
91
  [P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
92
92
  };
93
+ /* Excluded from this release type: AggregateType */
94
+ /**
95
+ * Creates a new {@link QueryCompositeFilterConstraint} that is a conjunction of
96
+ * the given filter constraints. A conjunction filter includes a document if it
97
+ * satisfies all of the given filters.
98
+ *
99
+ * @param queryConstraints - Optional. The list of
100
+ * {@link QueryFilterConstraint}s to perform a conjunction for. These must be
101
+ * created with calls to {@link where}, {@link or}, or {@link and}.
102
+ * @returns The newly created {@link QueryCompositeFilterConstraint}.
103
+ */
104
+ export declare function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
93
105
  /**
94
106
  * Returns a special value that can be used with {@link (setDoc:1)} or {@link
95
107
  * updateDoc:1} that tells the server to remove the given elements from any
@@ -253,7 +265,7 @@ export declare function collection(reference: DocumentReference, path: string, .
253
265
  export declare function collectionGroup(firestore: Firestore, collectionId: string): Query<DocumentData>;
254
266
  /**
255
267
  * A `CollectionReference` object can be used for adding documents, getting
256
- * document references, and querying for documents (using {@link query}).
268
+ * document references, and querying for documents (using {@link (query:1)}).
257
269
  */
258
270
  export declare class CollectionReference<T = DocumentData> extends Query<T> {
259
271
  /** The type of this Firestore reference. */
@@ -1381,6 +1393,17 @@ export declare function onSnapshotsInSync(firestore: Firestore, observer: {
1381
1393
  * listener.
1382
1394
  */
1383
1395
  export declare function onSnapshotsInSync(firestore: Firestore, onSync: () => void): Unsubscribe;
1396
+ /**
1397
+ * Creates a new {@link QueryCompositeFilterConstraint} that is a disjunction of
1398
+ * the given filter constraints. A disjunction filter includes a document if it
1399
+ * satisfies any of the given filters.
1400
+ *
1401
+ * @param queryConstraints - Optional. The list of
1402
+ * {@link QueryFilterConstraint}s to perform a disjunction for. These must be
1403
+ * created with calls to {@link where}, {@link or}, or {@link and}.
1404
+ * @returns The newly created {@link QueryCompositeFilterConstraint}.
1405
+ */
1406
+ export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
1384
1407
  /**
1385
1408
  * Creates a {@link QueryOrderByConstraint} that sorts the query result by the
1386
1409
  * specified field, optionally in descending order instead of ascending.
@@ -1461,7 +1484,21 @@ export declare class Query<T = DocumentData> {
1461
1484
  */
1462
1485
  withConverter<U>(converter: FirestoreDataConverter<U>): Query<U>;
1463
1486
  }
1464
- /* Excluded declaration from this release type: query */
1487
+ /**
1488
+ * Creates a new immutable instance of {@link Query} that is extended to also
1489
+ * include additional query constraints.
1490
+ *
1491
+ * @param query - The {@link Query} instance to use as a base for the new
1492
+ * constraints.
1493
+ * @param compositeFilter - The {@link QueryCompositeFilterConstraint} to
1494
+ * apply. Create {@link QueryCompositeFilterConstraint} using {@link and} or
1495
+ * {@link or}.
1496
+ * @param queryConstraints - Additional {@link QueryNonFilterConstraint}s to
1497
+ * apply (e.g. {@link orderBy}, {@link limit}).
1498
+ * @throws if any of the provided query constraints cannot be combined with the
1499
+ * existing or new constraints.
1500
+ */
1501
+ export declare function query<T>(query: Query<T>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<T>;
1465
1502
  /**
1466
1503
  * Creates a new immutable instance of {@link Query} that is extended to also
1467
1504
  * include additional query constraints.
@@ -1473,13 +1510,24 @@ export declare class Query<T = DocumentData> {
1473
1510
  * existing or new constraints.
1474
1511
  */
1475
1512
  export declare function query<T>(query: Query<T>, ...queryConstraints: QueryConstraint[]): Query<T>;
1476
- /* Excluded from this release type: QueryCompositeFilterConstraint */
1513
+ /**
1514
+ * A `QueryCompositeFilterConstraint` is used to narrow the set of documents
1515
+ * returned by a Firestore query by performing the logical OR or AND of multiple
1516
+ * {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.
1517
+ * `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
1518
+ * {@link and} and can then be passed to {@link (query:1)} to create a new query
1519
+ * instance that also contains the `QueryCompositeFilterConstraint`.
1520
+ */
1521
+ export declare class QueryCompositeFilterConstraint {
1522
+ /** The type of this query constraint */
1523
+ readonly type: 'or' | 'and';
1524
+ }
1477
1525
  /**
1478
1526
  * A `QueryConstraint` is used to narrow the set of documents returned by a
1479
1527
  * Firestore query. `QueryConstraint`s are created by invoking {@link where},
1480
- * {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
1481
- * endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
1482
- * can then be passed to {@link query} to create a new query instance that
1528
+ * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
1529
+ * (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and
1530
+ * can then be passed to {@link (query:1)} to create a new query instance that
1483
1531
  * also contains this `QueryConstraint`.
1484
1532
  */
1485
1533
  export declare abstract class QueryConstraint {
@@ -1519,7 +1567,7 @@ export declare class QueryDocumentSnapshot<T = DocumentData> extends DocumentSna
1519
1567
  * A `QueryEndAtConstraint` is used to exclude documents from the end of a
1520
1568
  * result set returned by a Firestore query.
1521
1569
  * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
1522
- * {@link (endBefore:1)} and can then be passed to {@link query} to create a new
1570
+ * {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new
1523
1571
  * query instance that also contains this `QueryEndAtConstraint`.
1524
1572
  */
1525
1573
  export declare class QueryEndAtConstraint extends QueryConstraint {
@@ -1540,19 +1588,23 @@ export declare function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
1540
1588
  * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
1541
1589
  * a Firestore query by filtering on one or more document fields.
1542
1590
  * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
1543
- * be passed to {@link query} to create a new query instance that also contains
1591
+ * be passed to {@link (query:1)} to create a new query instance that also contains
1544
1592
  * this `QueryFieldFilterConstraint`.
1545
1593
  */
1546
1594
  export declare class QueryFieldFilterConstraint extends QueryConstraint {
1547
1595
  /** The type of this query constraint */
1548
1596
  readonly type = "where";
1549
1597
  }
1550
- /* Excluded from this release type: QueryFilterConstraint */
1598
+ /**
1599
+ * `QueryFilterConstraint` is a helper union type that represents
1600
+ * {@link QueryFieldFilterConstraint} and {@link QueryCompositeFilterConstraint}.
1601
+ */
1602
+ export declare type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
1551
1603
  /**
1552
1604
  * A `QueryLimitConstraint` is used to limit the number of documents returned by
1553
1605
  * a Firestore query.
1554
1606
  * `QueryLimitConstraint`s are created by invoking {@link limit} or
1555
- * {@link limitToLast} and can then be passed to {@link query} to create a new
1607
+ * {@link limitToLast} and can then be passed to {@link (query:1)} to create a new
1556
1608
  * query instance that also contains this `QueryLimitConstraint`.
1557
1609
  */
1558
1610
  export declare class QueryLimitConstraint extends QueryConstraint {
@@ -1564,15 +1616,15 @@ export declare class QueryLimitConstraint extends QueryConstraint {
1564
1616
  * QueryConstraints which are used to narrow or order the set of documents,
1565
1617
  * but that do not explicitly filter on a document field.
1566
1618
  * `QueryNonFilterConstraint`s are created by invoking {@link orderBy},
1567
- * {@link startAt}, {@link startAfter}, {@link endBefore}, {@link endAt},
1568
- * {@link limit} or {@link limitToLast} and can then be passed to {@link query}
1619
+ * {@link (startAt:1)}, {@link (startAfter:1)}, {@link (endBefore:1)}, {@link (endAt:1)},
1620
+ * {@link limit} or {@link limitToLast} and can then be passed to {@link (query:1)}
1569
1621
  * to create a new query instance that also contains the `QueryConstraint`.
1570
1622
  */
1571
1623
  export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
1572
1624
  /**
1573
1625
  * A `QueryOrderByConstraint` is used to sort the set of documents returned by a
1574
1626
  * Firestore query. `QueryOrderByConstraint`s are created by invoking
1575
- * {@link orderBy} and can then be passed to {@link query} to create a new query
1627
+ * {@link orderBy} and can then be passed to {@link (query:1)} to create a new query
1576
1628
  * instance that also contains this `QueryOrderByConstraint`.
1577
1629
  *
1578
1630
  * Note: Documents that do not contain the orderBy field will not be present in
@@ -1630,7 +1682,7 @@ export declare class QuerySnapshot<T = DocumentData> {
1630
1682
  * A `QueryStartAtConstraint` is used to exclude documents from the start of a
1631
1683
  * result set returned by a Firestore query.
1632
1684
  * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
1633
- * {@link (startAfter:1)} and can then be passed to {@link query} to create a
1685
+ * {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a
1634
1686
  * new query instance that also contains this `QueryStartAtConstraint`.
1635
1687
  */
1636
1688
  export declare class QueryStartAtConstraint extends QueryConstraint {