@firebase/firestore 3.4.7-canary.7343a55c4 → 3.4.7-canary.7a4e65cef

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 (52) hide show
  1. package/dist/firestore/src/local/index_manager.d.ts +3 -2
  2. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
  3. package/dist/firestore/src/local/indexeddb_schema.d.ts +7 -2
  4. package/dist/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
  5. package/dist/firestore/src/local/memory_index_manager.d.ts +3 -2
  6. package/dist/firestore/src/model/field_index.d.ts +6 -0
  7. package/dist/firestore/test/unit/local/test_index_manager.d.ts +3 -2
  8. package/dist/index.esm2017.js +3257 -3205
  9. package/dist/index.esm2017.js.map +1 -1
  10. package/dist/index.esm5.js +3563 -3514
  11. package/dist/index.esm5.js.map +1 -1
  12. package/dist/index.node.cjs.js +168 -117
  13. package/dist/index.node.cjs.js.map +1 -1
  14. package/dist/index.node.mjs +168 -117
  15. package/dist/index.node.mjs.map +1 -1
  16. package/dist/index.rn.js +3078 -3026
  17. package/dist/index.rn.js.map +1 -1
  18. package/dist/internal.d.ts +1 -1
  19. package/dist/lite/firestore/src/local/index_manager.d.ts +3 -2
  20. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
  21. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +7 -2
  22. package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
  23. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +3 -2
  24. package/dist/lite/firestore/src/model/field_index.d.ts +6 -0
  25. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +3 -2
  26. package/dist/lite/index.browser.esm2017.js +2 -2
  27. package/dist/lite/index.browser.esm2017.js.map +1 -1
  28. package/dist/lite/index.browser.esm5.js +2 -2
  29. package/dist/lite/index.browser.esm5.js.map +1 -1
  30. package/dist/lite/index.node.cjs.js +2 -2
  31. package/dist/lite/index.node.cjs.js.map +1 -1
  32. package/dist/lite/index.node.mjs +2 -2
  33. package/dist/lite/index.node.mjs.map +1 -1
  34. package/dist/lite/index.rn.esm2017.js +1112 -1112
  35. package/dist/lite/index.rn.esm2017.js.map +1 -1
  36. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +3 -2
  37. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
  38. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +7 -2
  39. package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
  40. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
  41. package/dist/lite/packages/firestore/src/model/field_index.d.ts +6 -0
  42. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +3 -2
  43. package/dist/packages/firestore/dist/index.esm2017.d.ts +163 -163
  44. package/dist/packages/firestore/src/local/index_manager.d.ts +3 -2
  45. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
  46. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +7 -2
  47. package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
  48. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
  49. package/dist/packages/firestore/src/model/field_index.d.ts +6 -0
  50. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +3 -2
  51. package/dist/private.d.ts +1 -1
  52. package/package.json +9 -9
@@ -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.
@@ -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>;
@@ -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>;