@firebase/firestore 3.4.7 → 3.4.8-2022312211851

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 (65) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/firestore/src/local/index_manager.d.ts +3 -2
  3. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
  4. package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
  5. package/dist/firestore/src/local/indexeddb_schema.d.ts +7 -2
  6. package/dist/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
  7. package/dist/firestore/src/local/memory_index_manager.d.ts +3 -2
  8. package/dist/firestore/src/local/simple_db.d.ts +2 -0
  9. package/dist/firestore/src/model/field_index.d.ts +6 -0
  10. package/dist/firestore/test/unit/local/test_index_manager.d.ts +3 -2
  11. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
  12. package/dist/index.esm2017.js +3268 -3209
  13. package/dist/index.esm2017.js.map +1 -1
  14. package/dist/index.esm5.js +3571 -3518
  15. package/dist/index.esm5.js.map +1 -1
  16. package/dist/index.node.cjs.js +192 -124
  17. package/dist/index.node.cjs.js.map +1 -1
  18. package/dist/index.node.mjs +192 -124
  19. package/dist/index.node.mjs.map +1 -1
  20. package/dist/index.rn.js +3089 -3030
  21. package/dist/index.rn.js.map +1 -1
  22. package/dist/internal.d.ts +1 -1
  23. package/dist/lite/firestore/src/local/index_manager.d.ts +3 -2
  24. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
  25. package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
  26. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +7 -2
  27. package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
  28. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +3 -2
  29. package/dist/lite/firestore/src/local/simple_db.d.ts +2 -0
  30. package/dist/lite/firestore/src/model/field_index.d.ts +6 -0
  31. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +3 -2
  32. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
  33. package/dist/lite/index.browser.esm2017.js +2 -2
  34. package/dist/lite/index.browser.esm2017.js.map +1 -1
  35. package/dist/lite/index.browser.esm5.js +2 -2
  36. package/dist/lite/index.browser.esm5.js.map +1 -1
  37. package/dist/lite/index.node.cjs.js +2 -2
  38. package/dist/lite/index.node.cjs.js.map +1 -1
  39. package/dist/lite/index.node.mjs +2 -2
  40. package/dist/lite/index.node.mjs.map +1 -1
  41. package/dist/lite/index.rn.esm2017.js +2 -2
  42. package/dist/lite/index.rn.esm2017.js.map +1 -1
  43. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +3 -2
  44. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
  45. package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
  46. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +7 -2
  47. package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
  48. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
  49. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +2 -0
  50. package/dist/lite/packages/firestore/src/model/field_index.d.ts +6 -0
  51. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +3 -2
  52. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
  53. package/dist/packages/firestore/dist/index.esm2017.d.ts +163 -163
  54. package/dist/packages/firestore/src/local/index_manager.d.ts +3 -2
  55. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
  56. package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
  57. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +7 -2
  58. package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
  59. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
  60. package/dist/packages/firestore/src/local/simple_db.d.ts +2 -0
  61. package/dist/packages/firestore/src/model/field_index.d.ts +6 -0
  62. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +3 -2
  63. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
  64. package/dist/private.d.ts +1 -1
  65. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @firebase/firestore
2
2
 
3
+ ## 3.4.8-2022312211851
4
+
5
+ ### Patch Changes
6
+
7
+ - [`05dc9d6a0`](https://github.com/firebase/firebase-js-sdk/commit/05dc9d6a0db3058611dd7a2dc34daa726f9ba20d) [#6128](https://github.com/firebase/firebase-js-sdk/pull/6128) (fixes [#6110](https://github.com/firebase/firebase-js-sdk/issues/6110)) - Fixes an issue during multi-document lookup that resulted in the IndexedDB error "The parameter is less than or equal to this cursor's".
8
+
9
+ - Updated dependencies [[`e9e5f6b3c`](https://github.com/firebase/firebase-js-sdk/commit/e9e5f6b3ca9d61323b22f87986d9959f5297ec59)]:
10
+ - @firebase/util@1.5.2-2022312211851
11
+ - @firebase/app@0.7.21-2022312211851
12
+ - @firebase/component@0.5.13-2022312211851
13
+
3
14
  ## 3.4.7
4
15
 
5
16
  ### Patch Changes
@@ -15,7 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { Target } from '../core/target';
18
- import { DocumentKeySet, DocumentMap } from '../model/collections';
18
+ import { DocumentMap } from '../model/collections';
19
+ import { DocumentKey } from '../model/document_key';
19
20
  import { FieldIndex, IndexOffset } from '../model/field_index';
20
21
  import { ResourcePath } from '../model/path';
21
22
  import { PersistencePromise } from './persistence_promise';
@@ -75,7 +76,7 @@ export interface IndexManager {
75
76
  * Returns the documents that match the given target based on the provided
76
77
  * index or `null` if the target does not have a matching index.
77
78
  */
78
- getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
79
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>;
79
80
  /**
80
81
  * Returns the next collection group to update. Returns `null` if no group
81
82
  * exists.
@@ -15,8 +15,10 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { User } from '../auth/user';
18
+ import { DatabaseId } from '../core/database_info';
18
19
  import { Target } from '../core/target';
19
- import { DocumentKeySet, DocumentMap } from '../model/collections';
20
+ import { DocumentMap } from '../model/collections';
21
+ import { DocumentKey } from '../model/document_key';
20
22
  import { FieldIndex, IndexOffset } from '../model/field_index';
21
23
  import { ResourcePath } from '../model/path';
22
24
  import { IndexManager } from './index_manager';
@@ -30,6 +32,7 @@ import { PersistenceTransaction } from './persistence_transaction';
30
32
  */
31
33
  export declare class IndexedDbIndexManager implements IndexManager {
32
34
  private user;
35
+ private readonly databaseId;
33
36
  /**
34
37
  * An in-memory copy of the index entries we've already written since the SDK
35
38
  * launched. Used to avoid re-writing the same entry repeatedly.
@@ -44,7 +47,7 @@ export declare class IndexedDbIndexManager implements IndexManager {
44
47
  * contains only one term from the target's disjunctive normal form (DNF).
45
48
  */
46
49
  private targetToDnfSubTargets;
47
- constructor(user: User);
50
+ constructor(user: User, databaseId: DatabaseId);
48
51
  /**
49
52
  * Adds a new entry to the collection parent index.
50
53
  *
@@ -56,7 +59,7 @@ export declare class IndexedDbIndexManager implements IndexManager {
56
59
  getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>;
57
60
  addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
58
61
  deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
59
- getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
62
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>;
60
63
  private getSubTargets;
61
64
  /**
62
65
  * Constructs a key range query on `DbIndexEntryStore` that unions all
@@ -81,6 +84,11 @@ export declare class IndexedDbIndexManager implements IndexManager {
81
84
  private encodeDirectionalElements;
82
85
  /** Encodes a single value to the ascending index format. */
83
86
  private encodeSingleElement;
87
+ /**
88
+ * Returns an encoded form of the document key that sorts based on the key
89
+ * ordering of the field index.
90
+ */
91
+ private encodeDirectionalKey;
84
92
  /**
85
93
  * Encodes the given field values according to the specification in `target`.
86
94
  * For IN queries, a list of possible values is returned.
@@ -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;
@@ -470,8 +470,13 @@ export interface DbIndexEntry {
470
470
  arrayValue: Uint8Array;
471
471
  /** The encoded directional value for equality and inequality filters. */
472
472
  directionalValue: Uint8Array;
473
- /** The document key this entry points to. */
474
- documentKey: EncodedResourcePath;
473
+ /**
474
+ * The document key this entry points to. This entry is encoded by an ordered
475
+ * encoder to match the key order of the index.
476
+ */
477
+ orderedDocumentKey: Uint8Array;
478
+ /** The segments of the document key this entry points to. */
479
+ documentKey: string[];
475
480
  }
476
481
  /**
477
482
  * An object representing a document overlay.
@@ -204,9 +204,16 @@ export declare const DbIndexStateSequenceNumberIndexPath: string[];
204
204
  /**
205
205
  * The key for each index entry consists of the index id and its user id,
206
206
  * the encoded array and directional value for the indexed fields as well as
207
- * the encoded document path for the indexed document.
207
+ * an ordered and an encoded document path for the indexed document.
208
208
  */
209
- export declare type DbIndexEntryKey = [number, string, Uint8Array, Uint8Array, string];
209
+ export declare type DbIndexEntryKey = [
210
+ number,
211
+ string,
212
+ Uint8Array,
213
+ Uint8Array,
214
+ Uint8Array,
215
+ string[]
216
+ ];
210
217
  /** Name of the IndexedDb object store. */
211
218
  export declare const DbIndexEntryStore = "indexEntries";
212
219
  export declare const DbIndexEntryKeyPath: string[];
@@ -15,7 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { Target } from '../core/target';
18
- import { DocumentKeySet, DocumentMap } from '../model/collections';
18
+ import { DocumentMap } from '../model/collections';
19
+ import { DocumentKey } from '../model/document_key';
19
20
  import { FieldIndex, IndexOffset } from '../model/field_index';
20
21
  import { ResourcePath } from '../model/path';
21
22
  import { IndexManager } from './index_manager';
@@ -30,7 +31,7 @@ export declare class MemoryIndexManager implements IndexManager {
30
31
  getCollectionParents(transaction: PersistenceTransaction, collectionId: string): PersistencePromise<ResourcePath[]>;
31
32
  addFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
32
33
  deleteFieldIndex(transaction: PersistenceTransaction, index: FieldIndex): PersistencePromise<void>;
33
- getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
34
+ getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKey[] | null>;
34
35
  getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
35
36
  getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>;
36
37
  getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
@@ -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.
@@ -70,6 +70,12 @@ export declare class FieldIndex {
70
70
  export declare function fieldIndexGetArraySegment(fieldIndex: FieldIndex): IndexSegment | undefined;
71
71
  /** Returns all directional (ascending/descending) segments for this index. */
72
72
  export declare function fieldIndexGetDirectionalSegments(fieldIndex: FieldIndex): IndexSegment[];
73
+ /**
74
+ * Returns the order of the document key component for the given index.
75
+ *
76
+ * PORTING NOTE: This is only used in the Web IndexedDb implementation.
77
+ */
78
+ export declare function fieldIndexGetKeyOrder(fieldIndex: FieldIndex): IndexKind;
73
79
  /**
74
80
  * Compares indexes by collection group and segments. Ignores update time and
75
81
  * index ID.
@@ -17,7 +17,8 @@
17
17
  import { Target } from '../../../src/core/target';
18
18
  import { IndexManager } from '../../../src/local/index_manager';
19
19
  import { Persistence } from '../../../src/local/persistence';
20
- import { DocumentKeySet, DocumentMap } from '../../../src/model/collections';
20
+ import { DocumentMap } from '../../../src/model/collections';
21
+ import { DocumentKey } from '../../../src/model/document_key';
21
22
  import { FieldIndex, IndexOffset } from '../../../src/model/field_index';
22
23
  import { ResourcePath } from '../../../src/model/path';
23
24
  /**
@@ -34,7 +35,7 @@ export declare class TestIndexManager {
34
35
  deleteFieldIndex(index: FieldIndex): Promise<void>;
35
36
  getFieldIndexes(collectionGroup?: string): Promise<FieldIndex[]>;
36
37
  getFieldIndex(target: Target): Promise<FieldIndex | null>;
37
- getDocumentsMatchingTarget(target: Target): Promise<DocumentKeySet | null>;
38
+ getDocumentsMatchingTarget(target: Target): Promise<DocumentKey[] | null>;
38
39
  getNextCollectionGroupToUpdate(): Promise<string | null>;
39
40
  updateCollectionGroup(collectionGroup: string, offset: IndexOffset): Promise<void>;
40
41
  updateIndexEntries(documents: DocumentMap): 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;