@firebase/firestore 3.4.7-canary.e9e5f6b3c → 3.4.8-canary.7b58dabdf

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 (57) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/firestore/src/core/target.d.ts +2 -0
  3. package/dist/firestore/src/local/index_manager.d.ts +19 -3
  4. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +3 -2
  5. package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
  6. package/dist/firestore/src/local/memory_index_manager.d.ts +2 -2
  7. package/dist/firestore/src/local/simple_db.d.ts +2 -0
  8. package/dist/firestore/test/unit/local/test_index_manager.d.ts +2 -2
  9. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
  10. package/dist/index.esm2017.js +2998 -2965
  11. package/dist/index.esm2017.js.map +1 -1
  12. package/dist/index.esm5.js +3303 -3272
  13. package/dist/index.esm5.js.map +1 -1
  14. package/dist/index.node.cjs.js +1575 -1508
  15. package/dist/index.node.cjs.js.map +1 -1
  16. package/dist/index.node.mjs +1575 -1508
  17. package/dist/index.node.mjs.map +1 -1
  18. package/dist/index.rn.js +3138 -3105
  19. package/dist/index.rn.js.map +1 -1
  20. package/dist/internal.d.ts +20 -3
  21. package/dist/lite/firestore/src/core/target.d.ts +2 -0
  22. package/dist/lite/firestore/src/local/index_manager.d.ts +19 -3
  23. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +3 -2
  24. package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
  25. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +2 -2
  26. package/dist/lite/firestore/src/local/simple_db.d.ts +2 -0
  27. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +2 -2
  28. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
  29. package/dist/lite/index.browser.esm2017.js +2 -2
  30. package/dist/lite/index.browser.esm2017.js.map +1 -1
  31. package/dist/lite/index.browser.esm5.js +2 -2
  32. package/dist/lite/index.browser.esm5.js.map +1 -1
  33. package/dist/lite/index.node.cjs.js +2 -2
  34. package/dist/lite/index.node.cjs.js.map +1 -1
  35. package/dist/lite/index.node.mjs +2 -2
  36. package/dist/lite/index.node.mjs.map +1 -1
  37. package/dist/lite/index.rn.esm2017.js +1143 -1143
  38. package/dist/lite/index.rn.esm2017.js.map +1 -1
  39. package/dist/lite/packages/firestore/src/core/target.d.ts +2 -0
  40. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +19 -3
  41. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +3 -2
  42. package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
  43. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +2 -2
  44. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +2 -0
  45. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +2 -2
  46. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
  47. package/dist/packages/firestore/dist/index.esm2017.d.ts +53 -53
  48. package/dist/packages/firestore/src/core/target.d.ts +2 -0
  49. package/dist/packages/firestore/src/local/index_manager.d.ts +19 -3
  50. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +3 -2
  51. package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
  52. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +2 -2
  53. package/dist/packages/firestore/src/local/simple_db.d.ts +2 -0
  54. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +2 -2
  55. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
  56. package/dist/private.d.ts +20 -3
  57. package/package.json +9 -9
@@ -82,6 +82,8 @@ export declare function targetGetLowerBound(target: Target, fieldIndex: FieldInd
82
82
  * upper bound exists.
83
83
  */
84
84
  export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound | null;
85
+ /** Returns the number of segments of a perfect index for this target. */
86
+ export declare function targetGetSegmentCount(target: Target): number;
85
87
  export declare abstract class Filter {
86
88
  abstract matches(doc: Document): boolean;
87
89
  }
@@ -21,6 +21,22 @@ import { FieldIndex, IndexOffset } from '../model/field_index';
21
21
  import { ResourcePath } from '../model/path';
22
22
  import { PersistencePromise } from './persistence_promise';
23
23
  import { PersistenceTransaction } from './persistence_transaction';
24
+ /** Represents the index state as it relates to a particular target. */
25
+ export declare const enum IndexType {
26
+ /** Indicates that no index could be found for serving the target. */
27
+ NONE = 0,
28
+ /**
29
+ * Indicates that only a "partial index" could be found for serving the
30
+ * target. A partial index is one which does not have a segment for every
31
+ * filter/orderBy in the target.
32
+ */
33
+ PARTIAL = 1,
34
+ /**
35
+ * Indicates that a "full index" could be found for serving the target. A full
36
+ * index is one which has a segment for every filter/orderBy in the target.
37
+ */
38
+ FULL = 2
39
+ }
24
40
  /**
25
41
  * Represents a set of indexes that are used to execute queries efficiently.
26
42
  *
@@ -68,10 +84,10 @@ export interface IndexManager {
68
84
  /** Returns all configured field indexes. */
69
85
  getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>;
70
86
  /**
71
- * Returns an index that can be used to serve the provided target. Returns
72
- * `null` if no index is configured.
87
+ * Returns the type of index (if any) that can be used to serve the given
88
+ * target.
73
89
  */
74
- getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
90
+ getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>;
75
91
  /**
76
92
  * Returns the documents that match the given target based on the provided
77
93
  * index or `null` if the target does not have a matching index.
@@ -21,7 +21,7 @@ import { DocumentMap } from '../model/collections';
21
21
  import { DocumentKey } from '../model/document_key';
22
22
  import { FieldIndex, IndexOffset } from '../model/field_index';
23
23
  import { ResourcePath } from '../model/path';
24
- import { IndexManager } from './index_manager';
24
+ import { IndexManager, IndexType } from './index_manager';
25
25
  import { PersistencePromise } from './persistence_promise';
26
26
  import { PersistenceTransaction } from './persistence_transaction';
27
27
  /**
@@ -75,7 +75,8 @@ export declare class IndexedDbIndexManager implements IndexManager {
75
75
  * and user.
76
76
  */
77
77
  private generateEmptyBound;
78
- getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
78
+ private getFieldIndex;
79
+ getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>;
79
80
  /**
80
81
  * Returns the byte encoded form of the directional values in the field index.
81
82
  * Returns `null` if the document does not have all fields specified in the
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { MutableDocument } from '../model/document';
18
+ import { DocumentKey } from '../model/document_key';
18
19
  import { LocalSerializer } from './local_serializer';
19
20
  import { RemoteDocumentCache } from './remote_document_cache';
20
21
  export interface DocumentSizeEntry {
@@ -25,3 +26,11 @@ export interface IndexedDbRemoteDocumentCache extends RemoteDocumentCache {
25
26
  }
26
27
  /** Creates a new IndexedDbRemoteDocumentCache. */
27
28
  export declare function newIndexedDbRemoteDocumentCache(serializer: LocalSerializer): IndexedDbRemoteDocumentCache;
29
+ /**
30
+ * Comparator that compares document keys according to the primary key sorting
31
+ * used by the `DbRemoteDocumentDocument` store (by prefix path, collection id
32
+ * and then document ID).
33
+ *
34
+ * Visible for testing.
35
+ */
36
+ export declare function dbKeyComparator(l: DocumentKey, r: DocumentKey): number;
@@ -19,7 +19,7 @@ import { DocumentMap } from '../model/collections';
19
19
  import { DocumentKey } from '../model/document_key';
20
20
  import { FieldIndex, IndexOffset } from '../model/field_index';
21
21
  import { ResourcePath } from '../model/path';
22
- import { IndexManager } from './index_manager';
22
+ import { IndexManager, IndexType } from './index_manager';
23
23
  import { PersistencePromise } from './persistence_promise';
24
24
  import { PersistenceTransaction } from './persistence_transaction';
25
25
  /**
@@ -32,7 +32,7 @@ export declare class MemoryIndexManager implements IndexManager {
32
32
  addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
33
33
  deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
34
34
  getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>;
35
- getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
35
+ getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>;
36
36
  getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>;
37
37
  getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
38
38
  updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
@@ -186,6 +186,8 @@ export declare class SimpleDbStore<KeyType extends IDBValidKey, ValueType extend
186
186
  loadAll(): PersistencePromise<ValueType[]>;
187
187
  /** Loads all elements for the index range from the object store. */
188
188
  loadAll(range: IDBKeyRange): PersistencePromise<ValueType[]>;
189
+ /** Loads all elements ordered by the given index. */
190
+ loadAll(index: string): PersistencePromise<ValueType[]>;
189
191
  /**
190
192
  * Loads all elements from the object store that fall into the provided in the
191
193
  * index range for the given index.
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { Target } from '../../../src/core/target';
18
- import { IndexManager } from '../../../src/local/index_manager';
18
+ import { IndexManager, IndexType } from '../../../src/local/index_manager';
19
19
  import { Persistence } from '../../../src/local/persistence';
20
20
  import { DocumentMap } from '../../../src/model/collections';
21
21
  import { DocumentKey } from '../../../src/model/document_key';
@@ -34,7 +34,7 @@ export declare class TestIndexManager {
34
34
  addFieldIndex(index: FieldIndex): Promise<void>;
35
35
  deleteFieldIndex(index: FieldIndex): Promise<void>;
36
36
  getFieldIndexes(collectionGroup?: string): Promise<FieldIndex[]>;
37
- getFieldIndex(target: Target): Promise<FieldIndex | null>;
37
+ getIndexType(target: Target): Promise<IndexType>;
38
38
  getDocumentsMatchingTarget(target: Target): Promise<DocumentKey[] | null>;
39
39
  getNextCollectionGroupToUpdate(): Promise<string | null>;
40
40
  updateCollectionGroup(collectionGroup: string, offset: IndexOffset): Promise<void>;
@@ -47,10 +47,6 @@ export declare class TestRemoteDocumentCache {
47
47
  getEntries(documentKeys: DocumentKeySet): Promise<MutableDocumentMap>;
48
48
  getAllFromCollection(collection: ResourcePath, offset: IndexOffset): Promise<MutableDocumentMap>;
49
49
  getAllFromCollectionGroup(collectionGroup: string, offset: IndexOffset, limit: number): Promise<MutableDocumentMap>;
50
- getNewDocumentChanges(sinceReadTime: SnapshotVersion): Promise<{
51
- changedDocs: MutableDocumentMap;
52
- readTime: SnapshotVersion;
53
- }>;
54
50
  getSize(): Promise<number>;
55
51
  newChangeBuffer(options?: {
56
52
  trackRemovals: boolean;
@@ -793,7 +793,7 @@ declare function lc(t: any, e: any): any;
793
793
  declare function yt(): boolean;
794
794
  /**
795
795
  * @internal
796
- */ declare function $(t: any, ...e: any[]): void;
796
+ */ declare function F(t: any, ...e: any[]): void;
797
797
  /**
798
798
  * @license
799
799
  * Copyright 2021 Google LLC
@@ -951,7 +951,7 @@ declare function Tc(t: any, e: any, ...n: any[]): mc;
951
951
  * call to {@link disableNetwork}.
952
952
  *
953
953
  * @returns A `Promise` that is resolved once the network has been enabled.
954
- */ declare function $c(t: any): any;
954
+ */ declare function Fc(t: any): any;
955
955
  declare function Qh(...t: any[]): Kh;
956
956
  declare function Gh(...t: any[]): Kh;
957
957
  /**
@@ -1093,7 +1093,7 @@ declare function el(t: any): Promise<bh>;
1093
1093
  *
1094
1094
  * @param limit - The maximum number of items to return.
1095
1095
  * @returns The created {@link Query}.
1096
- */ declare function $h(t: any): Fh;
1096
+ */ declare function Fh(t: any): $h;
1097
1097
  /**
1098
1098
  * Creates a {@link QueryConstraint} that only returns the last matching documents.
1099
1099
  *
@@ -1102,7 +1102,7 @@ declare function el(t: any): Promise<bh>;
1102
1102
  *
1103
1103
  * @param limit - The maximum number of items to return.
1104
1104
  * @returns The created {@link Query}.
1105
- */ declare function Bh(t: any): Fh;
1105
+ */ declare function Bh(t: any): $h;
1106
1106
  /**
1107
1107
  * Loads a Firestore bundle into the local cache.
1108
1108
  *
@@ -1245,7 +1245,7 @@ declare function cl(t: any, e: any, n: any, ...s: any[]): Promise<any>;
1245
1245
  *
1246
1246
  * @returns A `Promise` which resolves when all currently pending writes have been
1247
1247
  * acknowledged by the backend.
1248
- */ declare function Fc(t: any): Promise<any>;
1248
+ */ declare function $c(t: any): Promise<any>;
1249
1249
  /**
1250
1250
  * Creates a {@link QueryConstraint} that enforces that documents must contain the
1251
1251
  * specified field and that the value should satisfy the relation constraint
@@ -1417,16 +1417,16 @@ declare function cl(t: any, e: any, n: any, ...s: any[]): Promise<any>;
1417
1417
  * See the License for the specific language governing permissions and
1418
1418
  * limitations under the License.
1419
1419
  */ declare class Rc {
1420
- ka: Promise<void>;
1421
- Ma: any[];
1422
- Oa: boolean;
1420
+ Ma: Promise<void>;
1421
+ Oa: any[];
1422
+ $a: boolean;
1423
1423
  Fa: any[];
1424
- $a: any;
1425
- Ba: boolean;
1424
+ Ba: any;
1426
1425
  La: boolean;
1427
- Ua: any[];
1428
- Do: zo;
1429
- qa: () => void;
1426
+ Ua: boolean;
1427
+ qa: any[];
1428
+ Co: zo;
1429
+ Ka: () => void;
1430
1430
  get isShuttingDown(): boolean;
1431
1431
  /**
1432
1432
  * Adds a new operation to the queue without waiting for it to complete (i.e.
@@ -1439,30 +1439,30 @@ declare function cl(t: any, e: any, n: any, ...s: any[]): Promise<any>;
1439
1439
  /**
1440
1440
  * Runs the next operation from the retryable queue. If the operation fails,
1441
1441
  * reschedules with backoff.
1442
- */ Qa(): Promise<void>;
1443
- Ga(t: any): Promise<any>;
1442
+ */ ja(): Promise<void>;
1443
+ Qa(t: any): Promise<any>;
1444
1444
  enqueueAfterDelay(t: any, e: any, n: any): Su;
1445
- Ka(): void;
1445
+ Ga(): void;
1446
1446
  verifyOperationInProgress(): void;
1447
1447
  /**
1448
1448
  * Waits until all currently queued tasks are finished executing. Delayed
1449
1449
  * operations are not run.
1450
- */ Wa(): Promise<void>;
1450
+ */ za(): Promise<void>;
1451
1451
  /**
1452
1452
  * For Tests: Determine if a delayed operation with a particular TimerId
1453
1453
  * exists.
1454
- */ za(t: any): boolean;
1454
+ */ Ha(t: any): boolean;
1455
1455
  /**
1456
1456
  * For Tests: Runs some or all delayed operations early.
1457
1457
  *
1458
1458
  * @param lastTimerId - Delayed operations up to and including this TimerId
1459
1459
  * will be drained. Pass TimerId.All to run all delayed operations.
1460
1460
  * @returns a Promise that resolves once all operations have been run.
1461
- */ Ha(t: any): Promise<void>;
1461
+ */ Ja(t: any): Promise<void>;
1462
1462
  /**
1463
1463
  * For Tests: Skip all subsequent delays for a timer id.
1464
- */ Ja(t: any): void;
1465
- /** Called once a DelayedOperation is run or canceled. */ ja(t: any): void;
1464
+ */ Ya(t: any): void;
1465
+ /** Called once a DelayedOperation is run or canceled. */ Wa(t: any): void;
1466
1466
  }
1467
1467
  import { FirebaseError as a } from "@firebase/util/dist/src/errors";
1468
1468
  /**
@@ -1493,7 +1493,7 @@ import { FirebaseError as a } from "@firebase/util/dist/src/errors";
1493
1493
  databaseId: any;
1494
1494
  ignoreUndefinedProperties: any;
1495
1495
  M: any;
1496
- /** Creates a new top-level parse context. */ ac(t: any, e: any, n: any, s?: boolean): Zc;
1496
+ /** Creates a new top-level parse context. */ cc(t: any, e: any, n: any, s?: boolean): Zc;
1497
1497
  }
1498
1498
  declare class Z {
1499
1499
  constructor(t: any);
@@ -1543,14 +1543,14 @@ declare class dt {
1543
1543
  }
1544
1544
  declare class uh extends Wc {
1545
1545
  constructor(t: any, e: any);
1546
- cc: any;
1547
- _toFieldTransform(t: any): wn;
1546
+ hc: any;
1547
+ _toFieldTransform(t: any): Tn;
1548
1548
  isEqual(t: any): boolean;
1549
1549
  }
1550
1550
  declare class oh extends Wc {
1551
1551
  constructor(t: any, e: any);
1552
- cc: any;
1553
- _toFieldTransform(t: any): wn;
1552
+ hc: any;
1553
+ _toFieldTransform(t: any): Tn;
1554
1554
  isEqual(t: any): boolean;
1555
1555
  }
1556
1556
  declare class sh extends Wc {
@@ -1560,46 +1560,46 @@ declare class sh extends Wc {
1560
1560
  declare class Kh extends Ch {
1561
1561
  constructor(t: any, e: any, n: any);
1562
1562
  type: any;
1563
- gc: any;
1564
1563
  yc: any;
1564
+ Ic: any;
1565
1565
  _apply(t: any): gc;
1566
1566
  }
1567
1567
  declare class ah extends Wc {
1568
1568
  constructor(t: any, e: any);
1569
- hc: any;
1570
- _toFieldTransform(t: any): wn;
1569
+ lc: any;
1570
+ _toFieldTransform(t: any): Tn;
1571
1571
  isEqual(t: any): boolean;
1572
1572
  }
1573
- declare class Fh extends Ch {
1573
+ declare class $h extends Ch {
1574
1574
  constructor(t: any, e: any, n: any);
1575
1575
  type: any;
1576
- wc: any;
1577
1576
  mc: any;
1577
+ gc: any;
1578
1578
  _apply(t: any): gc;
1579
1579
  }
1580
1580
  declare class Mh extends Ch {
1581
1581
  constructor(t: any, e: any);
1582
- lc: any;
1583
- _c: any;
1582
+ fc: any;
1583
+ wc: any;
1584
1584
  type: string;
1585
1585
  _apply(t: any): gc;
1586
1586
  }
1587
1587
  declare class rh extends Wc {
1588
- _toFieldTransform(t: any): wn;
1588
+ _toFieldTransform(t: any): Tn;
1589
1589
  isEqual(t: any): boolean;
1590
1590
  }
1591
1591
  declare class Lh extends Ch {
1592
1592
  constructor(t: any, e: any, n: any);
1593
1593
  type: any;
1594
- gc: any;
1595
1594
  yc: any;
1595
+ Ic: any;
1596
1596
  _apply(t: any): gc;
1597
1597
  }
1598
1598
  declare class Nh extends Ch {
1599
1599
  constructor(t: any, e: any, n: any);
1600
- lc: any;
1601
1600
  fc: any;
1602
1601
  dc: any;
1602
+ _c: any;
1603
1603
  type: string;
1604
1604
  _apply(t: any): gc;
1605
1605
  }
@@ -1650,15 +1650,15 @@ declare class dc {
1650
1650
  */
1651
1651
  declare class zo {
1652
1652
  constructor(t: any, e: any, n?: number, s?: number, i?: number);
1653
- Yn: any;
1653
+ Xn: any;
1654
1654
  timerId: any;
1655
- fo: number;
1656
1655
  _o: number;
1657
1656
  wo: number;
1658
1657
  mo: number;
1659
- yo: any;
1658
+ yo: number;
1659
+ po: any;
1660
1660
  /** The last backoff attempt, as epoch milliseconds. */
1661
- po: number;
1661
+ Io: number;
1662
1662
  /**
1663
1663
  * Resets the backoff delay.
1664
1664
  *
@@ -1669,15 +1669,15 @@ declare class zo {
1669
1669
  /**
1670
1670
  * Resets the backoff delay to the maximum delay (e.g. for use after a
1671
1671
  * RESOURCE_EXHAUSTED error).
1672
- */ Io(): void;
1672
+ */ To(): void;
1673
1673
  /**
1674
1674
  * Returns a promise that resolves after currentDelayMs, and increases the
1675
1675
  * delay for any subsequent attempts. If there was a pending backoff operation
1676
1676
  * already, it will be canceled.
1677
- */ To(t: any): void;
1678
- Ao(): void;
1677
+ */ Eo(t: any): void;
1678
+ Ro(): void;
1679
1679
  cancel(): void;
1680
- /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ Eo(): number;
1680
+ /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ Ao(): number;
1681
1681
  }
1682
1682
  /**
1683
1683
  * @license
@@ -1775,15 +1775,15 @@ declare class Su {
1775
1775
  fieldTransforms: any;
1776
1776
  fieldMask: any;
1777
1777
  get path(): any;
1778
- get Xa(): any;
1779
- /** Returns a new context with the specified settings overwritten. */ Za(t: any): Zc;
1780
- tc(t: any): Zc;
1781
- sc(t: any): Zc;
1778
+ get Za(): any;
1779
+ /** Returns a new context with the specified settings overwritten. */ tc(t: any): Zc;
1780
+ ec(t: any): Zc;
1782
1781
  ic(t: any): Zc;
1783
- rc(t: any): Q;
1782
+ rc(t: any): Zc;
1783
+ oc(t: any): Q;
1784
1784
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t: any): boolean;
1785
- Ya(): void;
1786
- nc(t: any): void;
1785
+ Xa(): void;
1786
+ sc(t: any): void;
1787
1787
  }
1788
1788
  /**
1789
1789
  * @license
@@ -1801,9 +1801,9 @@ declare class Su {
1801
1801
  * See the License for the specific language governing permissions and
1802
1802
  * limitations under the License.
1803
1803
  */
1804
- /** A field path and the TransformOperation to perform upon it. */ declare class wn {
1804
+ /** A field path and the TransformOperation to perform upon it. */ declare class Tn {
1805
1805
  constructor(t: any, e: any);
1806
1806
  field: any;
1807
1807
  transform: any;
1808
1808
  }
1809
- export { Jh as AbstractUserDataWriter, jc as Bytes, Vc as CACHE_SIZE_UNLIMITED, yc as CollectionReference, mc as DocumentReference, bh as DocumentSnapshot, Gc as FieldPath, Wc as FieldValue, vc as Firestore, Q as FirestoreError, zc as GeoPoint, Pc as LoadBundleTask, gc as Query, Ch as QueryConstraint, Ph as QueryDocumentSnapshot, Vh as QuerySnapshot, Rh as SnapshotMetadata, at as Timestamp, ml as Transaction, Zh as WriteBatch, vt as _DatabaseId, xt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, lc as _cast, q as _debugAssert, yt as _isBase64Available, $ as _logWarn, Rl as _setIndexConfiguration, uc as _validateIsNotUsedTogether, ll as addDoc, Tl as arrayRemove, Il as arrayUnion, Oc as clearIndexedDbPersistence, pc as collection, Ic as collectionGroup, wc as connectFirestoreEmulator, hl as deleteDoc, yl as deleteField, Bc as disableNetwork, Tc as doc, Qc as documentId, Nc as enableIndexedDbPersistence, kc as enableMultiTabIndexedDbPersistence, $c as enableNetwork, Qh as endAt, Gh as endBefore, Cc as ensureFirestoreConfigured, _l as executeWrite, el as getDoc, sl as getDocFromCache, il as getDocFromServer, rl as getDocs, ol as getDocsFromCache, ul as getDocsFromServer, Dc as getFirestore, El as increment, Sc as initializeFirestore, $h as limit, Bh as limitToLast, Uc as loadBundle, qc as namedQuery, fl as onSnapshot, dl as onSnapshotsInSync, Oh as orderBy, xh as query, Ac as queryEqual, Ec as refEqual, gl as runTransaction, pl as serverTimestamp, al as setDoc, M as setLogLevel, Sh as snapshotEqual, qh as startAfter, Uh as startAt, Lc as terminate, cl as updateDoc, Fc as waitForPendingWrites, kh as where, Al as writeBatch };
1809
+ export { Jh as AbstractUserDataWriter, jc as Bytes, Vc as CACHE_SIZE_UNLIMITED, yc as CollectionReference, mc as DocumentReference, bh as DocumentSnapshot, Gc as FieldPath, Wc as FieldValue, vc as Firestore, Q as FirestoreError, zc as GeoPoint, Pc as LoadBundleTask, gc as Query, Ch as QueryConstraint, Ph as QueryDocumentSnapshot, Vh as QuerySnapshot, Rh as SnapshotMetadata, at as Timestamp, ml as Transaction, Zh as WriteBatch, vt as _DatabaseId, xt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, lc as _cast, q as _debugAssert, yt as _isBase64Available, F as _logWarn, Rl as _setIndexConfiguration, uc as _validateIsNotUsedTogether, ll as addDoc, Tl as arrayRemove, Il as arrayUnion, Oc as clearIndexedDbPersistence, pc as collection, Ic as collectionGroup, wc as connectFirestoreEmulator, hl as deleteDoc, yl as deleteField, Bc as disableNetwork, Tc as doc, Qc as documentId, Nc as enableIndexedDbPersistence, kc as enableMultiTabIndexedDbPersistence, Fc as enableNetwork, Qh as endAt, Gh as endBefore, Cc as ensureFirestoreConfigured, _l as executeWrite, el as getDoc, sl as getDocFromCache, il as getDocFromServer, rl as getDocs, ol as getDocsFromCache, ul as getDocsFromServer, Dc as getFirestore, El as increment, Sc as initializeFirestore, Fh as limit, Bh as limitToLast, Uc as loadBundle, qc as namedQuery, fl as onSnapshot, dl as onSnapshotsInSync, Oh as orderBy, xh as query, Ac as queryEqual, Ec as refEqual, gl as runTransaction, pl as serverTimestamp, al as setDoc, M as setLogLevel, Sh as snapshotEqual, qh as startAfter, Uh as startAt, Lc as terminate, cl as updateDoc, $c as waitForPendingWrites, kh as where, Al as writeBatch };
@@ -82,6 +82,8 @@ export declare function targetGetLowerBound(target: Target, fieldIndex: FieldInd
82
82
  * upper bound exists.
83
83
  */
84
84
  export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound | null;
85
+ /** Returns the number of segments of a perfect index for this target. */
86
+ export declare function targetGetSegmentCount(target: Target): number;
85
87
  export declare abstract class Filter {
86
88
  abstract matches(doc: Document): boolean;
87
89
  }
@@ -21,6 +21,22 @@ import { FieldIndex, IndexOffset } from '../model/field_index';
21
21
  import { ResourcePath } from '../model/path';
22
22
  import { PersistencePromise } from './persistence_promise';
23
23
  import { PersistenceTransaction } from './persistence_transaction';
24
+ /** Represents the index state as it relates to a particular target. */
25
+ export declare const enum IndexType {
26
+ /** Indicates that no index could be found for serving the target. */
27
+ NONE = 0,
28
+ /**
29
+ * Indicates that only a "partial index" could be found for serving the
30
+ * target. A partial index is one which does not have a segment for every
31
+ * filter/orderBy in the target.
32
+ */
33
+ PARTIAL = 1,
34
+ /**
35
+ * Indicates that a "full index" could be found for serving the target. A full
36
+ * index is one which has a segment for every filter/orderBy in the target.
37
+ */
38
+ FULL = 2
39
+ }
24
40
  /**
25
41
  * Represents a set of indexes that are used to execute queries efficiently.
26
42
  *
@@ -68,10 +84,10 @@ export interface IndexManager {
68
84
  /** Returns all configured field indexes. */
69
85
  getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>;
70
86
  /**
71
- * Returns an index that can be used to serve the provided target. Returns
72
- * `null` if no index is configured.
87
+ * Returns the type of index (if any) that can be used to serve the given
88
+ * target.
73
89
  */
74
- getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
90
+ getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>;
75
91
  /**
76
92
  * Returns the documents that match the given target based on the provided
77
93
  * index or `null` if the target does not have a matching index.
@@ -21,7 +21,7 @@ import { DocumentMap } from '../model/collections';
21
21
  import { DocumentKey } from '../model/document_key';
22
22
  import { FieldIndex, IndexOffset } from '../model/field_index';
23
23
  import { ResourcePath } from '../model/path';
24
- import { IndexManager } from './index_manager';
24
+ import { IndexManager, IndexType } from './index_manager';
25
25
  import { PersistencePromise } from './persistence_promise';
26
26
  import { PersistenceTransaction } from './persistence_transaction';
27
27
  /**
@@ -75,7 +75,8 @@ export declare class IndexedDbIndexManager implements IndexManager {
75
75
  * and user.
76
76
  */
77
77
  private generateEmptyBound;
78
- getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
78
+ private getFieldIndex;
79
+ getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>;
79
80
  /**
80
81
  * Returns the byte encoded form of the directional values in the field index.
81
82
  * Returns `null` if the document does not have all fields specified in the
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { MutableDocument } from '../model/document';
18
+ import { DocumentKey } from '../model/document_key';
18
19
  import { LocalSerializer } from './local_serializer';
19
20
  import { RemoteDocumentCache } from './remote_document_cache';
20
21
  export interface DocumentSizeEntry {
@@ -25,3 +26,11 @@ export interface IndexedDbRemoteDocumentCache extends RemoteDocumentCache {
25
26
  }
26
27
  /** Creates a new IndexedDbRemoteDocumentCache. */
27
28
  export declare function newIndexedDbRemoteDocumentCache(serializer: LocalSerializer): IndexedDbRemoteDocumentCache;
29
+ /**
30
+ * Comparator that compares document keys according to the primary key sorting
31
+ * used by the `DbRemoteDocumentDocument` store (by prefix path, collection id
32
+ * and then document ID).
33
+ *
34
+ * Visible for testing.
35
+ */
36
+ export declare function dbKeyComparator(l: DocumentKey, r: DocumentKey): number;
@@ -19,7 +19,7 @@ import { DocumentMap } from '../model/collections';
19
19
  import { DocumentKey } from '../model/document_key';
20
20
  import { FieldIndex, IndexOffset } from '../model/field_index';
21
21
  import { ResourcePath } from '../model/path';
22
- import { IndexManager } from './index_manager';
22
+ import { IndexManager, IndexType } from './index_manager';
23
23
  import { PersistencePromise } from './persistence_promise';
24
24
  import { PersistenceTransaction } from './persistence_transaction';
25
25
  /**
@@ -32,7 +32,7 @@ export declare class MemoryIndexManager implements IndexManager {
32
32
  addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
33
33
  deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
34
34
  getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>;
35
- getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
35
+ getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>;
36
36
  getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>;
37
37
  getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
38
38
  updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
@@ -186,6 +186,8 @@ export declare class SimpleDbStore<KeyType extends IDBValidKey, ValueType extend
186
186
  loadAll(): PersistencePromise<ValueType[]>;
187
187
  /** Loads all elements for the index range from the object store. */
188
188
  loadAll(range: IDBKeyRange): PersistencePromise<ValueType[]>;
189
+ /** Loads all elements ordered by the given index. */
190
+ loadAll(index: string): PersistencePromise<ValueType[]>;
189
191
  /**
190
192
  * Loads all elements from the object store that fall into the provided in the
191
193
  * index range for the given index.
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { Target } from '../../../src/core/target';
18
- import { IndexManager } from '../../../src/local/index_manager';
18
+ import { IndexManager, IndexType } from '../../../src/local/index_manager';
19
19
  import { Persistence } from '../../../src/local/persistence';
20
20
  import { DocumentMap } from '../../../src/model/collections';
21
21
  import { DocumentKey } from '../../../src/model/document_key';
@@ -34,7 +34,7 @@ export declare class TestIndexManager {
34
34
  addFieldIndex(index: FieldIndex): Promise<void>;
35
35
  deleteFieldIndex(index: FieldIndex): Promise<void>;
36
36
  getFieldIndexes(collectionGroup?: string): Promise<FieldIndex[]>;
37
- getFieldIndex(target: Target): Promise<FieldIndex | null>;
37
+ getIndexType(target: Target): Promise<IndexType>;
38
38
  getDocumentsMatchingTarget(target: Target): Promise<DocumentKey[] | null>;
39
39
  getNextCollectionGroupToUpdate(): Promise<string | null>;
40
40
  updateCollectionGroup(collectionGroup: string, offset: IndexOffset): Promise<void>;
@@ -47,10 +47,6 @@ export declare class TestRemoteDocumentCache {
47
47
  getEntries(documentKeys: DocumentKeySet): Promise<MutableDocumentMap>;
48
48
  getAllFromCollection(collection: ResourcePath, offset: IndexOffset): Promise<MutableDocumentMap>;
49
49
  getAllFromCollectionGroup(collectionGroup: string, offset: IndexOffset, limit: number): Promise<MutableDocumentMap>;
50
- getNewDocumentChanges(sinceReadTime: SnapshotVersion): Promise<{
51
- changedDocs: MutableDocumentMap;
52
- readTime: SnapshotVersion;
53
- }>;
54
50
  getSize(): Promise<number>;
55
51
  newChangeBuffer(options?: {
56
52
  trackRemovals: boolean;
package/dist/private.d.ts CHANGED
@@ -2303,10 +2303,10 @@ declare interface IndexManager {
2303
2303
  /** Returns all configured field indexes. */
2304
2304
  getFieldIndexes(transaction: PersistenceTransaction): PersistencePromise<FieldIndex[]>;
2305
2305
  /**
2306
- * Returns an index that can be used to serve the provided target. Returns
2307
- * `null` if no index is configured.
2306
+ * Returns the type of index (if any) that can be used to serve the given
2307
+ * target.
2308
2308
  */
2309
- getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
2309
+ getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>;
2310
2310
  /**
2311
2311
  * Returns the documents that match the given target based on the provided
2312
2312
  * index or `null` if the target does not have a matching index.
@@ -2400,6 +2400,23 @@ declare class IndexState_2 {
2400
2400
  static empty(): IndexState_2;
2401
2401
  }
2402
2402
 
2403
+ /** Represents the index state as it relates to a particular target. */
2404
+ declare const enum IndexType {
2405
+ /** Indicates that no index could be found for serving the target. */
2406
+ NONE = 0,
2407
+ /**
2408
+ * Indicates that only a "partial index" could be found for serving the
2409
+ * target. A partial index is one which does not have a segment for every
2410
+ * filter/orderBy in the target.
2411
+ */
2412
+ PARTIAL = 1,
2413
+ /**
2414
+ * Indicates that a "full index" could be found for serving the target. A full
2415
+ * index is one which has a segment for every filter/orderBy in the target.
2416
+ */
2417
+ FULL = 2
2418
+ }
2419
+
2403
2420
  /**
2404
2421
  * Initializes a new instance of {@link Firestore} with the provided settings.
2405
2422
  * Can only be called before any other function, including
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/firestore",
3
- "version": "3.4.7-canary.e9e5f6b3c",
3
+ "version": "3.4.8-canary.7b58dabdf",
4
4
  "engines": {
5
5
  "node": ">=10.10.0"
6
6
  },
@@ -77,22 +77,22 @@
77
77
  "lite/package.json"
78
78
  ],
79
79
  "dependencies": {
80
- "@firebase/component": "0.5.12-canary.e9e5f6b3c",
81
- "@firebase/logger": "0.3.2-canary.e9e5f6b3c",
82
- "@firebase/util": "1.5.1-canary.e9e5f6b3c",
83
- "@firebase/webchannel-wrapper": "0.6.1-canary.e9e5f6b3c",
80
+ "@firebase/component": "0.5.13-canary.7b58dabdf",
81
+ "@firebase/logger": "0.3.2-canary.7b58dabdf",
82
+ "@firebase/util": "1.5.2-canary.7b58dabdf",
83
+ "@firebase/webchannel-wrapper": "0.6.1-canary.7b58dabdf",
84
84
  "@grpc/grpc-js": "^1.3.2",
85
85
  "@grpc/proto-loader": "^0.6.0",
86
86
  "node-fetch": "2.6.7",
87
87
  "tslib": "^2.1.0"
88
88
  },
89
89
  "peerDependencies": {
90
- "@firebase/app": "0.7.20-canary.e9e5f6b3c"
90
+ "@firebase/app": "0.7.21-canary.7b58dabdf"
91
91
  },
92
92
  "devDependencies": {
93
- "@firebase/app": "0.7.20-canary.e9e5f6b3c",
94
- "@firebase/app-compat": "0.1.21-canary.e9e5f6b3c",
95
- "@firebase/auth": "0.19.11-canary.e9e5f6b3c",
93
+ "@firebase/app": "0.7.21-canary.7b58dabdf",
94
+ "@firebase/app-compat": "0.1.22-canary.7b58dabdf",
95
+ "@firebase/auth": "0.19.12-canary.7b58dabdf",
96
96
  "@rollup/plugin-alias": "3.1.5",
97
97
  "@rollup/plugin-json": "4.1.0",
98
98
  "@types/eslint": "7.28.0",