@firebase/firestore 3.4.5 → 3.4.6-2022216223411

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 (101) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/firestore/src/index/index_entry.d.ts +6 -0
  3. package/dist/firestore/src/local/document_overlay_cache.d.ts +4 -5
  4. package/dist/firestore/src/local/index_manager.d.ts +2 -2
  5. package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
  6. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
  7. package/dist/firestore/src/local/indexeddb_schema.d.ts +34 -553
  8. package/dist/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
  9. package/dist/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
  10. package/dist/firestore/src/local/local_serializer.d.ts +2 -1
  11. package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
  12. package/dist/firestore/src/local/memory_index_manager.d.ts +1 -1
  13. package/dist/firestore/src/local/simple_db.d.ts +11 -0
  14. package/dist/firestore/src/model/collections.d.ts +7 -0
  15. package/dist/firestore/src/model/field_index.d.ts +2 -0
  16. package/dist/firestore/src/model/type_order.d.ts +2 -1
  17. package/dist/firestore/src/platform/node/base64.d.ts +1 -0
  18. package/dist/firestore/src/util/obj_map.d.ts +3 -0
  19. package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
  20. package/dist/firestore/test/unit/local/test_index_manager.d.ts +1 -1
  21. package/dist/index.esm2017.js +4160 -4201
  22. package/dist/index.esm2017.js.map +1 -1
  23. package/dist/index.esm5.js +4332 -4311
  24. package/dist/index.esm5.js.map +1 -1
  25. package/dist/index.node.cjs.js +1223 -956
  26. package/dist/index.node.cjs.js.map +1 -1
  27. package/dist/index.node.mjs +1223 -956
  28. package/dist/index.node.mjs.map +1 -1
  29. package/dist/index.rn.js +4157 -4198
  30. package/dist/index.rn.js.map +1 -1
  31. package/dist/internal.d.ts +12 -5
  32. package/dist/lite/firestore/src/index/index_entry.d.ts +6 -0
  33. package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +4 -5
  34. package/dist/lite/firestore/src/local/index_manager.d.ts +2 -2
  35. package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
  36. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
  37. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +34 -553
  38. package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
  39. package/dist/lite/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
  40. package/dist/lite/firestore/src/local/local_serializer.d.ts +2 -1
  41. package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
  42. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +1 -1
  43. package/dist/lite/firestore/src/local/simple_db.d.ts +11 -0
  44. package/dist/lite/firestore/src/model/collections.d.ts +7 -0
  45. package/dist/lite/firestore/src/model/field_index.d.ts +2 -0
  46. package/dist/lite/firestore/src/model/type_order.d.ts +2 -1
  47. package/dist/lite/firestore/src/platform/node/base64.d.ts +1 -0
  48. package/dist/lite/firestore/src/util/obj_map.d.ts +3 -0
  49. package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
  50. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +1 -1
  51. package/dist/lite/index.browser.esm2017.js +34 -24
  52. package/dist/lite/index.browser.esm2017.js.map +1 -1
  53. package/dist/lite/index.browser.esm5.js +12 -23
  54. package/dist/lite/index.browser.esm5.js.map +1 -1
  55. package/dist/lite/index.node.cjs.js +21 -9
  56. package/dist/lite/index.node.cjs.js.map +1 -1
  57. package/dist/lite/index.node.mjs +21 -9
  58. package/dist/lite/index.node.mjs.map +1 -1
  59. package/dist/lite/index.rn.esm2017.js +34 -24
  60. package/dist/lite/index.rn.esm2017.js.map +1 -1
  61. package/dist/lite/packages/firestore/src/index/index_entry.d.ts +6 -0
  62. package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +4 -5
  63. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +2 -2
  64. package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
  65. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
  66. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +34 -553
  67. package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
  68. package/dist/lite/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
  69. package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +2 -1
  70. package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
  71. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +1 -1
  72. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +11 -0
  73. package/dist/lite/packages/firestore/src/model/collections.d.ts +7 -0
  74. package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -0
  75. package/dist/lite/packages/firestore/src/model/type_order.d.ts +2 -1
  76. package/dist/lite/packages/firestore/src/platform/node/base64.d.ts +1 -0
  77. package/dist/lite/packages/firestore/src/util/obj_map.d.ts +3 -0
  78. package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
  79. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +1 -1
  80. package/dist/packages/firestore/dist/index.esm2017.d.ts +191 -191
  81. package/dist/packages/firestore/src/index/index_entry.d.ts +6 -0
  82. package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +4 -5
  83. package/dist/packages/firestore/src/local/index_manager.d.ts +2 -2
  84. package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
  85. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
  86. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +34 -553
  87. package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +238 -0
  88. package/dist/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
  89. package/dist/packages/firestore/src/local/local_serializer.d.ts +2 -1
  90. package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
  91. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +1 -1
  92. package/dist/packages/firestore/src/local/simple_db.d.ts +11 -0
  93. package/dist/packages/firestore/src/model/collections.d.ts +7 -0
  94. package/dist/packages/firestore/src/model/field_index.d.ts +2 -0
  95. package/dist/packages/firestore/src/model/type_order.d.ts +2 -1
  96. package/dist/packages/firestore/src/platform/node/base64.d.ts +1 -0
  97. package/dist/packages/firestore/src/util/obj_map.d.ts +3 -0
  98. package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
  99. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +1 -1
  100. package/dist/private.d.ts +12 -5
  101. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @firebase/firestore
2
2
 
3
+ ## 3.4.6-2022216223411
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`2d672cead`](https://github.com/firebase/firebase-js-sdk/commit/2d672cead167187cb714cd89b638c0884ba58f03), [`927c1afc1`](https://github.com/firebase/firebase-js-sdk/commit/927c1afc103e4f9b8a75320d3946a4c840445a2a)]:
8
+ - @firebase/app@0.7.19-2022216223411
9
+ - @firebase/util@1.5.0-2022216223411
10
+ - @firebase/component@0.5.11-2022216223411
11
+
3
12
  ## 3.4.5
4
13
 
5
14
  ### Patch Changes
@@ -22,5 +22,11 @@ export declare class IndexEntry {
22
22
  readonly arrayValue: Uint8Array;
23
23
  readonly directionalValue: Uint8Array;
24
24
  constructor(indexId: number, documentKey: DocumentKey, arrayValue: Uint8Array, directionalValue: Uint8Array);
25
+ /**
26
+ * Returns an IndexEntry entry that sorts immediately after the current
27
+ * directional value.
28
+ */
29
+ successor(): IndexEntry;
25
30
  }
26
31
  export declare function indexEntryComparator(left: IndexEntry, right: IndexEntry): number;
32
+ export declare function compareByteArrays(left: Uint8Array, right: Uint8Array): number;
@@ -14,9 +14,8 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { DocumentKeySet } from '../model/collections';
17
+ import { DocumentKeySet, MutationMap, OverlayMap } from '../model/collections';
18
18
  import { DocumentKey } from '../model/document_key';
19
- import { Mutation } from '../model/mutation';
20
19
  import { Overlay } from '../model/overlay';
21
20
  import { ResourcePath } from '../model/path';
22
21
  import { PersistencePromise } from './persistence_promise';
@@ -41,7 +40,7 @@ export interface DocumentOverlayCache {
41
40
  * Saves the given document mutation map to persistence as overlays.
42
41
  * All overlays will have their largest batch id set to `largestBatchId`.
43
42
  */
44
- saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: Map<DocumentKey, Mutation>): PersistencePromise<void>;
43
+ saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>;
45
44
  /** Removes overlays for the given document keys and batch ID. */
46
45
  removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
47
46
  /**
@@ -53,7 +52,7 @@ export interface DocumentOverlayCache {
53
52
  * Only overlays that contain a change past `sinceBatchId` are returned.
54
53
  * @returns Mapping of each document key in the collection to its overlay.
55
54
  */
56
- getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<Map<DocumentKey, Overlay>>;
55
+ getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>;
57
56
  /**
58
57
  * Returns `count` overlays with a batch ID higher than `sinceBatchId` for the
59
58
  * provided collection group, processed by ascending batch ID. The method
@@ -68,5 +67,5 @@ export interface DocumentOverlayCache {
68
67
  * batch contains more entries.
69
68
  * @return Mapping of each document key in the collection group to its overlay.
70
69
  */
71
- getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<Map<DocumentKey, Overlay>>;
70
+ getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>;
72
71
  }
@@ -73,9 +73,9 @@ export interface IndexManager {
73
73
  getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
74
74
  /**
75
75
  * Returns the documents that match the given target based on the provided
76
- * index.
76
+ * index or `null` if the target does not have a matching index.
77
77
  */
78
- getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
78
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
79
79
  /**
80
80
  * Returns the next collection group to update. Returns `null` if no group
81
81
  * exists.
@@ -15,9 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { User } from '../auth/user';
18
- import { DocumentKeySet } from '../model/collections';
18
+ import { DocumentKeySet, MutationMap, OverlayMap } from '../model/collections';
19
19
  import { DocumentKey } from '../model/document_key';
20
- import { Mutation } from '../model/mutation';
21
20
  import { Overlay } from '../model/overlay';
22
21
  import { ResourcePath } from '../model/path';
23
22
  import { DocumentOverlayCache } from './document_overlay_cache';
@@ -37,9 +36,9 @@ export declare class IndexedDbDocumentOverlayCache implements DocumentOverlayCac
37
36
  constructor(serializer: LocalSerializer, userId: string);
38
37
  static forUser(serializer: LocalSerializer, user: User): IndexedDbDocumentOverlayCache;
39
38
  getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>;
40
- saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: Map<DocumentKey, Mutation>): PersistencePromise<void>;
39
+ saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>;
41
40
  removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
42
- getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<Map<DocumentKey, Overlay>>;
43
- getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<Map<DocumentKey, Overlay>>;
41
+ getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>;
42
+ getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>;
44
43
  private saveOverlay;
45
44
  }
@@ -39,6 +39,11 @@ export declare class IndexedDbIndexManager implements IndexManager {
39
39
  */
40
40
  private collectionParentsCache;
41
41
  private uid;
42
+ /**
43
+ * Maps from a target to its equivalent list of sub-targets. Each sub-target
44
+ * contains only one term from the target's disjunctive normal form (DNF).
45
+ */
46
+ private targetToDnfSubTargets;
42
47
  constructor(user: User);
43
48
  /**
44
49
  * Adds a new entry to the collection parent index.
@@ -51,7 +56,22 @@ export declare class IndexedDbIndexManager implements IndexManager {
51
56
  getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>;
52
57
  addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
53
58
  deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
54
- getDocumentsMatchingTarget(transaction: PersistenceTransaction, fieldIndex: FieldIndex, target: Target): PersistencePromise<DocumentKeySet>;
59
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
60
+ private getSubTargets;
61
+ /**
62
+ * Constructs a key range query on `DbIndexEntryStore` that unions all
63
+ * bounds.
64
+ */
65
+ private generateIndexRanges;
66
+ /** Generates the lower bound for `arrayValue` and `directionalValue`. */
67
+ private generateLowerBound;
68
+ /** Generates the upper bound for `arrayValue` and `directionalValue`. */
69
+ private generateUpperBound;
70
+ /**
71
+ * Generates an empty bound that scopes the index scan to the current index
72
+ * and user.
73
+ */
74
+ private generateEmptyBound;
55
75
  getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
56
76
  /**
57
77
  * Returns the byte encoded form of the directional values in the field index.
@@ -61,6 +81,27 @@ export declare class IndexedDbIndexManager implements IndexManager {
61
81
  private encodeDirectionalElements;
62
82
  /** Encodes a single value to the ascending index format. */
63
83
  private encodeSingleElement;
84
+ /**
85
+ * Encodes the given field values according to the specification in `target`.
86
+ * For IN queries, a list of possible values is returned.
87
+ */
88
+ private encodeValues;
89
+ /**
90
+ * Encodes the given bounds according to the specification in `target`. For IN
91
+ * queries, a list of possible values is returned.
92
+ */
93
+ private encodeBound;
94
+ /** Returns the byte representation for the provided encoders. */
95
+ private getEncodedBytes;
96
+ /**
97
+ * Creates a separate encoder for each element of an array.
98
+ *
99
+ * The method appends each value to all existing encoders (e.g. filter("a",
100
+ * "==", "a1").filter("b", "in", ["b1", "b2"]) becomes ["a1,b1", "a1,b2"]). A
101
+ * list of new encoders is returned.
102
+ */
103
+ private expandIndexValues;
104
+ private isInFilter;
64
105
  getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>;
65
106
  getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
66
107
  updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
@@ -77,4 +118,10 @@ export declare class IndexedDbIndexManager implements IndexManager {
77
118
  */
78
119
  private updateEntries;
79
120
  private getNextSequenceNumber;
121
+ /**
122
+ * Returns a new set of IDB ranges that splits the existing range and excludes
123
+ * any values that match the `notInValue` from these ranges. As an example,
124
+ * '[foo > 2 && foo != 3]` becomes `[foo > 2 && < 3, foo > 3]`.
125
+ */
126
+ private createRange;
80
127
  }