@firebase/firestore 3.4.6 → 3.4.7-canary.05dc9d6a0
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.
- package/CHANGELOG.md +10 -0
- package/dist/firestore/src/core/bundle.d.ts +2 -2
- package/dist/firestore/src/core/bundle_impl.d.ts +2 -0
- package/dist/firestore/src/core/query.d.ts +7 -0
- package/dist/firestore/src/core/snapshot_version.d.ts +1 -0
- package/dist/firestore/src/core/sync_engine_impl.d.ts +1 -1
- package/dist/firestore/src/local/index_manager.d.ts +3 -2
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
- package/dist/firestore/src/local/indexeddb_mutation_batch_impl.d.ts +2 -1
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +7 -15
- package/dist/firestore/src/local/indexeddb_schema.d.ts +23 -15
- package/dist/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/firestore/src/local/indexeddb_schema_legacy.d.ts +29 -0
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +31 -19
- package/dist/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/firestore/src/local/local_serializer.d.ts +2 -1
- package/dist/firestore/src/local/local_store_impl.d.ts +1 -7
- package/dist/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/firestore/src/local/remote_document_cache.d.ts +13 -4
- package/dist/firestore/src/local/shared_client_state.d.ts +6 -3
- package/dist/firestore/src/local/shared_client_state_schema.d.ts +1 -1
- package/dist/firestore/src/local/shared_client_state_syncer.d.ts +1 -1
- package/dist/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/firestore/src/model/field_index.d.ts +14 -1
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +3 -2
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -5
- package/dist/index.esm2017.js +3531 -3400
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4157 -3978
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +589 -362
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +589 -362
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3643 -3512
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +20 -6
- package/dist/lite/firestore/src/core/bundle.d.ts +2 -2
- package/dist/lite/firestore/src/core/bundle_impl.d.ts +2 -0
- package/dist/lite/firestore/src/core/query.d.ts +7 -0
- package/dist/lite/firestore/src/core/snapshot_version.d.ts +1 -0
- package/dist/lite/firestore/src/core/sync_engine_impl.d.ts +1 -1
- package/dist/lite/firestore/src/local/index_manager.d.ts +3 -2
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
- package/dist/lite/firestore/src/local/indexeddb_mutation_batch_impl.d.ts +2 -1
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +7 -15
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +23 -15
- package/dist/lite/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/lite/firestore/src/local/indexeddb_schema_legacy.d.ts +29 -0
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +31 -19
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/lite/firestore/src/local/local_serializer.d.ts +2 -1
- package/dist/lite/firestore/src/local/local_store_impl.d.ts +1 -7
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/lite/firestore/src/local/remote_document_cache.d.ts +13 -4
- package/dist/lite/firestore/src/local/shared_client_state.d.ts +6 -3
- package/dist/lite/firestore/src/local/shared_client_state_schema.d.ts +1 -1
- package/dist/lite/firestore/src/local/shared_client_state_syncer.d.ts +1 -1
- package/dist/lite/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +14 -1
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +3 -2
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -5
- package/dist/lite/index.browser.esm2017.js +5 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +94 -92
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +5 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +5 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +5 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/bundle.d.ts +2 -2
- package/dist/lite/packages/firestore/src/core/bundle_impl.d.ts +2 -0
- package/dist/lite/packages/firestore/src/core/query.d.ts +7 -0
- package/dist/lite/packages/firestore/src/core/snapshot_version.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/sync_engine_impl.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +3 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
- package/dist/lite/packages/firestore/src/local/indexeddb_mutation_batch_impl.d.ts +2 -1
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +7 -15
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +23 -15
- package/dist/lite/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_schema_legacy.d.ts +29 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +31 -19
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +2 -1
- package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +1 -7
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +13 -4
- package/dist/lite/packages/firestore/src/local/shared_client_state.d.ts +6 -3
- package/dist/lite/packages/firestore/src/local/shared_client_state_schema.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/shared_client_state_syncer.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +14 -1
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +3 -2
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -5
- package/dist/lite/private.d.ts +1 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +180 -180
- package/dist/packages/firestore/src/core/bundle.d.ts +2 -2
- package/dist/packages/firestore/src/core/bundle_impl.d.ts +2 -0
- package/dist/packages/firestore/src/core/query.d.ts +7 -0
- package/dist/packages/firestore/src/core/snapshot_version.d.ts +1 -0
- package/dist/packages/firestore/src/core/sync_engine_impl.d.ts +1 -1
- package/dist/packages/firestore/src/local/index_manager.d.ts +3 -2
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +11 -3
- package/dist/packages/firestore/src/local/indexeddb_mutation_batch_impl.d.ts +2 -1
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +7 -15
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +23 -15
- package/dist/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/packages/firestore/src/local/indexeddb_schema_legacy.d.ts +29 -0
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +31 -19
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/packages/firestore/src/local/local_serializer.d.ts +2 -1
- package/dist/packages/firestore/src/local/local_store_impl.d.ts +1 -7
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +3 -2
- package/dist/packages/firestore/src/local/remote_document_cache.d.ts +13 -4
- package/dist/packages/firestore/src/local/shared_client_state.d.ts +6 -3
- package/dist/packages/firestore/src/local/shared_client_state_schema.d.ts +1 -1
- package/dist/packages/firestore/src/local/shared_client_state_syncer.d.ts +1 -1
- package/dist/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +14 -1
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +3 -2
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -5
- package/dist/private.d.ts +20 -6
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @firebase/firestore
|
|
2
2
|
|
|
3
|
+
## 3.4.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`69aa7b02d`](https://github.com/firebase/firebase-js-sdk/commit/69aa7b02df3b4d1f9832b7713951936b6bf32ca9) [#5988](https://github.com/firebase/firebase-js-sdk/pull/5988) - The format of some of the IndexedDB data changed. This increases the performance of document lookups after an initial migration. If you do not want to migrate data, you can call `clearIndexedDbPersistence()` before invoking `enableIndexedDbPersistence()`.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`3198d58dc`](https://github.com/firebase/firebase-js-sdk/commit/3198d58dcedbf7583914dbcc76984f6f7df8d2ef)]:
|
|
10
|
+
- @firebase/util@1.5.1
|
|
11
|
+
- @firebase/component@0.5.12
|
|
12
|
+
|
|
3
13
|
## 3.4.6
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -34,10 +34,10 @@ export interface BundledDocument {
|
|
|
34
34
|
* An array of `BundledDocument`.
|
|
35
35
|
*/
|
|
36
36
|
export declare type BundledDocuments = BundledDocument[];
|
|
37
|
-
export
|
|
37
|
+
export interface BundleLoadResult {
|
|
38
38
|
readonly progress: LoadBundleTaskProgress;
|
|
39
|
+
readonly changedCollectionGroups: Set<string>;
|
|
39
40
|
readonly changedDocs: DocumentMap;
|
|
40
|
-
constructor(progress: LoadBundleTaskProgress, changedDocs: DocumentMap);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Represents a Firestore bundle saved by the SDK in its local storage.
|
|
@@ -51,6 +51,8 @@ export declare class BundleLoader {
|
|
|
51
51
|
private queries;
|
|
52
52
|
/** Batched documents to be saved into storage */
|
|
53
53
|
private documents;
|
|
54
|
+
/** The collection groups affected by this bundle. */
|
|
55
|
+
private collectionGroups;
|
|
54
56
|
constructor(bundleMetadata: ProtoBundleMetadata, localStore: LocalStore, serializer: JsonProtoSerializer);
|
|
55
57
|
/**
|
|
56
58
|
* Adds an element from the bundle to the loader.
|
|
@@ -121,6 +121,13 @@ export declare function canonifyQuery(query: Query): string;
|
|
|
121
121
|
export declare function stringifyQuery(query: Query): string;
|
|
122
122
|
/** Returns whether `doc` matches the constraints of `query`. */
|
|
123
123
|
export declare function queryMatches(query: Query, doc: Document): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Returns the collection group that this query targets.
|
|
126
|
+
*
|
|
127
|
+
* PORTING NOTE: This is only used in the Web SDK to facilitate multi-tab
|
|
128
|
+
* synchronization for query results.
|
|
129
|
+
*/
|
|
130
|
+
export declare function queryCollectionGroup(query: Query): string;
|
|
124
131
|
/**
|
|
125
132
|
* Returns a new comparator function that can be used to compare two documents
|
|
126
133
|
* based on the Query's ordering constraint.
|
|
@@ -23,6 +23,7 @@ export declare class SnapshotVersion {
|
|
|
23
23
|
private timestamp;
|
|
24
24
|
static fromTimestamp(value: Timestamp): SnapshotVersion;
|
|
25
25
|
static min(): SnapshotVersion;
|
|
26
|
+
static max(): SnapshotVersion;
|
|
26
27
|
private constructor();
|
|
27
28
|
compareTo(other: SnapshotVersion): number;
|
|
28
29
|
isEqual(other: SnapshotVersion): boolean;
|
|
@@ -227,7 +227,7 @@ export declare function syncEngineGetRemoteKeysForTarget(syncEngine: SyncEngine,
|
|
|
227
227
|
* Retrieves newly changed documents from remote document cache and raises
|
|
228
228
|
* snapshots if needed.
|
|
229
229
|
*/
|
|
230
|
-
export declare function syncEngineSynchronizeWithChangedDocuments(syncEngine: SyncEngine): Promise<void>;
|
|
230
|
+
export declare function syncEngineSynchronizeWithChangedDocuments(syncEngine: SyncEngine, collectionGroup: string): Promise<void>;
|
|
231
231
|
/** Applies a mutation state to an existing batch. */
|
|
232
232
|
export declare function syncEngineApplyBatchState(syncEngine: SyncEngine, batchId: BatchId, batchState: MutationBatchState, error?: FirestoreError): Promise<void>;
|
|
233
233
|
/** Applies a query target change from a different tab. */
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { Target } from '../core/target';
|
|
18
|
-
import {
|
|
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<
|
|
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 {
|
|
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<
|
|
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.
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { DocumentKey } from '../model/document_key';
|
|
18
18
|
import { DbRemoteDocument } from './indexeddb_schema';
|
|
19
|
+
import { DbRemoteDocument as DbRemoteDocumentLegacy } from './indexeddb_schema_legacy';
|
|
19
20
|
import { PersistencePromise } from './persistence_promise';
|
|
20
21
|
import { SimpleDbTransaction } from './simple_db';
|
|
21
22
|
/**
|
|
@@ -31,4 +32,4 @@ export declare function removeMutationBatch(txn: SimpleDbTransaction, userId: st
|
|
|
31
32
|
/**
|
|
32
33
|
* Returns an approximate size for the given document.
|
|
33
34
|
*/
|
|
34
|
-
export declare function dbDocumentSize(doc: DbRemoteDocument | null): number;
|
|
35
|
+
export declare function dbDocumentSize(doc: DbRemoteDocument | DbRemoteDocumentLegacy | null): number;
|
|
@@ -14,12 +14,9 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { SnapshotVersion } from '../core/snapshot_version';
|
|
18
|
-
import { MutableDocumentMap } from '../model/collections';
|
|
19
17
|
import { MutableDocument } from '../model/document';
|
|
18
|
+
import { DocumentKey } from '../model/document_key';
|
|
20
19
|
import { LocalSerializer } from './local_serializer';
|
|
21
|
-
import { PersistencePromise } from './persistence_promise';
|
|
22
|
-
import { PersistenceTransaction } from './persistence_transaction';
|
|
23
20
|
import { RemoteDocumentCache } from './remote_document_cache';
|
|
24
21
|
export interface DocumentSizeEntry {
|
|
25
22
|
document: MutableDocument;
|
|
@@ -30,15 +27,10 @@ export interface IndexedDbRemoteDocumentCache extends RemoteDocumentCache {
|
|
|
30
27
|
/** Creates a new IndexedDbRemoteDocumentCache. */
|
|
31
28
|
export declare function newIndexedDbRemoteDocumentCache(serializer: LocalSerializer): IndexedDbRemoteDocumentCache;
|
|
32
29
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
readTime: SnapshotVersion;
|
|
39
|
-
}>;
|
|
40
|
-
/**
|
|
41
|
-
* Returns the read time of the most recently read document in the cache, or
|
|
42
|
-
* SnapshotVersion.min() if not available.
|
|
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.
|
|
43
35
|
*/
|
|
44
|
-
export declare function
|
|
36
|
+
export declare function dbKeyComparator(l: DocumentKey, r: DocumentKey): number;
|
|
@@ -20,7 +20,7 @@ import { BundledQuery } from '../protos/firestore_bundle_proto';
|
|
|
20
20
|
import { Document as ProtoDocument, DocumentsTarget as ProtoDocumentsTarget, QueryTarget as ProtoQueryTarget, Write as ProtoWrite } from '../protos/firestore_proto_api';
|
|
21
21
|
import { EncodedResourcePath } from './encoded_resource_path';
|
|
22
22
|
import { DbTimestampKey } from './indexeddb_sentinels';
|
|
23
|
-
export declare const INDEXING_SCHEMA_VERSION =
|
|
23
|
+
export declare const INDEXING_SCHEMA_VERSION = 14;
|
|
24
24
|
/**
|
|
25
25
|
* Schema Version for the Web client:
|
|
26
26
|
* 1. Initial version including Mutation Queue, Query Cache, and Remote
|
|
@@ -40,7 +40,9 @@ export declare const INDEXING_SCHEMA_VERSION = 13;
|
|
|
40
40
|
* 10. Rewrite the canonical IDs to the explicit Protobuf-based format.
|
|
41
41
|
* 11. Add bundles and named_queries for bundle support.
|
|
42
42
|
* 12. Add document overlays.
|
|
43
|
-
* 13.
|
|
43
|
+
* 13. Rewrite the keys of the remote document cache to allow for efficient
|
|
44
|
+
* document lookup via `getAll()`.
|
|
45
|
+
* 14. Add indexing support.
|
|
44
46
|
*/
|
|
45
47
|
export declare const SCHEMA_VERSION: number;
|
|
46
48
|
/**
|
|
@@ -174,10 +176,21 @@ export interface DbUnknownDocument {
|
|
|
174
176
|
* - An "unknown document" representing a document that is known to exist (at
|
|
175
177
|
* some version) but whose contents are unknown.
|
|
176
178
|
*
|
|
179
|
+
* The document key is split up across `prefixPath`, `collectionGroup` and
|
|
180
|
+
* `documentId`.
|
|
181
|
+
*
|
|
177
182
|
* Note: This is the persisted equivalent of a MaybeDocument and could perhaps
|
|
178
183
|
* be made more general if necessary.
|
|
179
184
|
*/
|
|
180
185
|
export interface DbRemoteDocument {
|
|
186
|
+
/** The path to the document's collection (excluding). */
|
|
187
|
+
prefixPath: string[];
|
|
188
|
+
/** The collection ID the document is direclty nested under. */
|
|
189
|
+
collectionGroup: string;
|
|
190
|
+
/** The document ID. */
|
|
191
|
+
documentId: string;
|
|
192
|
+
/** When the document was read from the backend. */
|
|
193
|
+
readTime: DbTimestampKey;
|
|
181
194
|
/**
|
|
182
195
|
* Set to an instance of DbUnknownDocument if the data for a document is
|
|
183
196
|
* not known, but it is known that a document exists at the specified
|
|
@@ -200,17 +213,7 @@ export interface DbRemoteDocument {
|
|
|
200
213
|
* documents are potentially inconsistent with the backend's copy and use
|
|
201
214
|
* the write's commit version as their document version.
|
|
202
215
|
*/
|
|
203
|
-
hasCommittedMutations
|
|
204
|
-
/**
|
|
205
|
-
* When the document was read from the backend. Undefined for data written
|
|
206
|
-
* prior to schema version 9.
|
|
207
|
-
*/
|
|
208
|
-
readTime?: DbTimestampKey;
|
|
209
|
-
/**
|
|
210
|
-
* The path of the collection this document is part of. Undefined for data
|
|
211
|
-
* written prior to schema version 9.
|
|
212
|
-
*/
|
|
213
|
-
parentPath?: string[];
|
|
216
|
+
hasCommittedMutations: boolean;
|
|
214
217
|
}
|
|
215
218
|
/**
|
|
216
219
|
* Contains a single entry that has metadata about the remote document cache.
|
|
@@ -467,8 +470,13 @@ export interface DbIndexEntry {
|
|
|
467
470
|
arrayValue: Uint8Array;
|
|
468
471
|
/** The encoded directional value for equality and inequality filters. */
|
|
469
472
|
directionalValue: Uint8Array;
|
|
470
|
-
/**
|
|
471
|
-
|
|
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[];
|
|
472
480
|
}
|
|
473
481
|
/**
|
|
474
482
|
* An object representing a document overlay.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Document as ProtoDocument } from '../protos/firestore_proto_api';
|
|
18
|
+
import { DbNoDocument, DbUnknownDocument } from './indexeddb_schema';
|
|
19
|
+
import { DbTimestampKey } from './indexeddb_sentinels';
|
|
20
|
+
export interface DbRemoteDocument {
|
|
21
|
+
unknownDocument?: DbUnknownDocument;
|
|
22
|
+
noDocument?: DbNoDocument;
|
|
23
|
+
document?: ProtoDocument;
|
|
24
|
+
hasCommittedMutations?: boolean;
|
|
25
|
+
readTime?: DbTimestampKey;
|
|
26
|
+
parentPath?: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare type DbRemoteDocumentKey = string[];
|
|
29
|
+
export declare const DbRemoteDocumentStore = "remoteDocuments";
|
|
@@ -79,24 +79,33 @@ export declare function newDbDocumentMutationKey(userId: string, path: ResourceP
|
|
|
79
79
|
*/
|
|
80
80
|
export declare const DbDocumentMutationPlaceholder: DbDocumentMutation;
|
|
81
81
|
export declare const DbDocumentMutationStore = "documentMutations";
|
|
82
|
-
export declare const DbRemoteDocumentStore = "
|
|
82
|
+
export declare const DbRemoteDocumentStore = "remoteDocumentsV14";
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
* A key in the 'remoteDocumentsV14' object store is an array containing the
|
|
85
|
+
* collection path, the collection group, the read time and the document id.
|
|
86
|
+
*/
|
|
87
|
+
export declare type DbRemoteDocumentKey = [
|
|
88
|
+
/** path to collection */ string[],
|
|
89
|
+
/** collection group */ string,
|
|
90
|
+
/** read time */ DbTimestampKey,
|
|
91
|
+
/** document ID */ string
|
|
92
|
+
];
|
|
93
|
+
/**
|
|
94
|
+
* The primary key of the remote documents store, which allows for efficient
|
|
95
|
+
* access by collection path and read time.
|
|
88
96
|
*/
|
|
89
|
-
export declare const
|
|
90
|
-
|
|
97
|
+
export declare const DbRemoteDocumentKeyPath: string[];
|
|
98
|
+
/** An index that provides access to documents by key. */
|
|
99
|
+
export declare const DbRemoteDocumentDocumentKeyIndex = "documentKeyIndex";
|
|
100
|
+
export declare const DbRemoteDocumentDocumentKeyIndexPath: string[];
|
|
91
101
|
/**
|
|
92
|
-
* An index that provides access to documents
|
|
102
|
+
* An index that provides access to documents by collection group and read
|
|
93
103
|
* time.
|
|
94
104
|
*
|
|
95
|
-
* This index is used
|
|
96
|
-
* documents in a collection.
|
|
105
|
+
* This index is used by the index backfiller.
|
|
97
106
|
*/
|
|
98
|
-
export declare const
|
|
99
|
-
export declare const
|
|
107
|
+
export declare const DbRemoteDocumentCollectionGroupIndex = "collectionGroupIndex";
|
|
108
|
+
export declare const DbRemoteDocumentCollectionGroupIndexPath: string[];
|
|
100
109
|
export declare const DbRemoteDocumentGlobalStore = "remoteDocumentGlobal";
|
|
101
110
|
export declare const DbRemoteDocumentGlobalKey = "remoteDocumentGlobalKey";
|
|
102
111
|
export declare type DbRemoteDocumentGlobalKey = typeof DbRemoteDocumentGlobalKey;
|
|
@@ -195,9 +204,16 @@ export declare const DbIndexStateSequenceNumberIndexPath: string[];
|
|
|
195
204
|
/**
|
|
196
205
|
* The key for each index entry consists of the index id and its user id,
|
|
197
206
|
* the encoded array and directional value for the indexed fields as well as
|
|
198
|
-
*
|
|
207
|
+
* an ordered and an encoded document path for the indexed document.
|
|
199
208
|
*/
|
|
200
|
-
export declare type DbIndexEntryKey = [
|
|
209
|
+
export declare type DbIndexEntryKey = [
|
|
210
|
+
number,
|
|
211
|
+
string,
|
|
212
|
+
Uint8Array,
|
|
213
|
+
Uint8Array,
|
|
214
|
+
Uint8Array,
|
|
215
|
+
string[]
|
|
216
|
+
];
|
|
201
217
|
/** Name of the IndexedDb object store. */
|
|
202
218
|
export declare const DbIndexEntryStore = "indexEntries";
|
|
203
219
|
export declare const DbIndexEntryKeyPath: string[];
|
|
@@ -223,6 +239,7 @@ export declare const V8_STORES: string[];
|
|
|
223
239
|
export declare const V11_STORES: string[];
|
|
224
240
|
export declare const V12_STORES: string[];
|
|
225
241
|
export declare const V13_STORES: string[];
|
|
242
|
+
export declare const V14_STORES: string[];
|
|
226
243
|
/**
|
|
227
244
|
* The list of all default IndexedDB stores used throughout the SDK. This is
|
|
228
245
|
* used when creating transactions so that access across all stores is done
|
|
@@ -231,8 +248,3 @@ export declare const V13_STORES: string[];
|
|
|
231
248
|
export declare const ALL_STORES: string[];
|
|
232
249
|
/** Returns the object stores for the provided schema. */
|
|
233
250
|
export declare function getObjectStores(schemaVersion: number): string[];
|
|
234
|
-
/**
|
|
235
|
-
* A key in the 'remoteDocuments' object store is a string array containing the
|
|
236
|
-
* segments that make up the path.
|
|
237
|
-
*/
|
|
238
|
-
export declare type DbRemoteDocumentKey = string[];
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { Query } from '../core/query';
|
|
18
|
-
import { SnapshotVersion } from '../core/snapshot_version';
|
|
19
18
|
import { DocumentKeySet, DocumentMap, MutableDocumentMap } from '../model/collections';
|
|
20
19
|
import { Document } from '../model/document';
|
|
21
20
|
import { DocumentKey } from '../model/document_key';
|
|
21
|
+
import { IndexOffset } from '../model/field_index';
|
|
22
22
|
import { IndexManager } from './index_manager';
|
|
23
23
|
import { MutationQueue } from './mutation_queue';
|
|
24
24
|
import { PersistencePromise } from './persistence_promise';
|
|
@@ -62,10 +62,9 @@ export declare class LocalDocumentsView {
|
|
|
62
62
|
*
|
|
63
63
|
* @param transaction - The persistence transaction.
|
|
64
64
|
* @param query - The query to match documents against.
|
|
65
|
-
* @param
|
|
66
|
-
* documents that have been read since this snapshot version (exclusive).
|
|
65
|
+
* @param offset - Read time and key to start scanning by (exclusive).
|
|
67
66
|
*/
|
|
68
|
-
getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query,
|
|
67
|
+
getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, offset: IndexOffset): PersistencePromise<DocumentMap>;
|
|
69
68
|
private getDocumentsMatchingDocumentQuery;
|
|
70
69
|
private getDocumentsMatchingCollectionGroupQuery;
|
|
71
70
|
private getDocumentsMatchingCollectionQuery;
|
|
@@ -25,7 +25,7 @@ import { MutationBatch } from '../model/mutation_batch';
|
|
|
25
25
|
import { Overlay } from '../model/overlay';
|
|
26
26
|
import { BundledQuery as ProtoBundledQuery, BundleMetadata as ProtoBundleMetadata, NamedQuery as ProtoNamedQuery } from '../protos/firestore_bundle_proto';
|
|
27
27
|
import { JsonProtoSerializer } from '../remote/serializer';
|
|
28
|
-
import { DbBundle, DbDocumentOverlay, DbIndexConfiguration, DbIndexState, DbMutationBatch, DbNamedQuery, DbRemoteDocument, DbTarget } from './indexeddb_schema';
|
|
28
|
+
import { DbBundle, DbDocumentOverlay, DbIndexConfiguration, DbIndexState, DbMutationBatch, DbNamedQuery, DbRemoteDocument, DbTarget, DbTimestamp } from './indexeddb_schema';
|
|
29
29
|
import { DbDocumentOverlayKey, DbTimestampKey } from './indexeddb_sentinels';
|
|
30
30
|
import { TargetData } from './target_data';
|
|
31
31
|
/** Serializer for values stored in the LocalStore. */
|
|
@@ -39,6 +39,7 @@ export declare function fromDbRemoteDocument(localSerializer: LocalSerializer, r
|
|
|
39
39
|
export declare function toDbRemoteDocument(localSerializer: LocalSerializer, document: MutableDocument): DbRemoteDocument;
|
|
40
40
|
export declare function toDbTimestampKey(snapshotVersion: SnapshotVersion): DbTimestampKey;
|
|
41
41
|
export declare function fromDbTimestampKey(dbTimestampKey: DbTimestampKey): SnapshotVersion;
|
|
42
|
+
export declare function toDbTimestamp(snapshotVersion: SnapshotVersion): DbTimestamp;
|
|
42
43
|
/** Encodes a batch of mutations into a DbMutationBatch for local storage. */
|
|
43
44
|
export declare function toDbMutationBatch(localSerializer: LocalSerializer, userId: string, batch: MutationBatch): DbMutationBatch;
|
|
44
45
|
/** Decodes a DbMutationBatch into a MutationBatch */
|
|
@@ -165,13 +165,7 @@ export declare function localStoreGetCachedTarget(localStore: LocalStore, target
|
|
|
165
165
|
* initialization. Further invocations will return document that have changed
|
|
166
166
|
* since the prior call.
|
|
167
167
|
*/
|
|
168
|
-
export declare function localStoreGetNewDocumentChanges(localStore: LocalStore): Promise<DocumentMap>;
|
|
169
|
-
/**
|
|
170
|
-
* Reads the newest document change from persistence and moves the internal
|
|
171
|
-
* synchronization marker forward so that calls to `getNewDocumentChanges()`
|
|
172
|
-
* only return changes that happened after client initialization.
|
|
173
|
-
*/
|
|
174
|
-
export declare function localStoreSynchronizeLastDocumentChangeReadTime(localStore: LocalStore): Promise<void>;
|
|
168
|
+
export declare function localStoreGetNewDocumentChanges(localStore: LocalStore, collectionGroup: string): Promise<DocumentMap>;
|
|
175
169
|
/**
|
|
176
170
|
* Applies the documents from a bundle to the "ground-state" (remote)
|
|
177
171
|
* documents.
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { Target } from '../core/target';
|
|
18
|
-
import {
|
|
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<
|
|
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>;
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { SnapshotVersion } from '../core/snapshot_version';
|
|
18
17
|
import { DocumentKeySet, MutableDocumentMap } from '../model/collections';
|
|
19
18
|
import { MutableDocument } from '../model/document';
|
|
20
19
|
import { DocumentKey } from '../model/document_key';
|
|
20
|
+
import { IndexOffset } from '../model/field_index';
|
|
21
21
|
import { ResourcePath } from '../model/path';
|
|
22
22
|
import { IndexManager } from './index_manager';
|
|
23
23
|
import { PersistencePromise } from './persistence_promise';
|
|
@@ -53,11 +53,20 @@ export interface RemoteDocumentCache {
|
|
|
53
53
|
* Returns the documents from the provided collection.
|
|
54
54
|
*
|
|
55
55
|
* @param collection - The collection to read.
|
|
56
|
-
* @param
|
|
57
|
-
* documents that have been read since this snapshot version (exclusive).
|
|
56
|
+
* @param offset - The offset to start the scan at (exclusive).
|
|
58
57
|
* @returns The set of matching documents.
|
|
59
58
|
*/
|
|
60
|
-
|
|
59
|
+
getAllFromCollection(transaction: PersistenceTransaction, collection: ResourcePath, offset: IndexOffset): PersistencePromise<MutableDocumentMap>;
|
|
60
|
+
/**
|
|
61
|
+
* Looks up the next `limit` documents for a collection group based on the
|
|
62
|
+
* provided offset. The ordering is based on the document's read time and key.
|
|
63
|
+
*
|
|
64
|
+
* @param collectionGroup - The collection group to scan.
|
|
65
|
+
* @param offset - The offset to start the scan at (exclusive).
|
|
66
|
+
* @param limit - The maximum number of results to return.
|
|
67
|
+
* @returns The set of matching documents.
|
|
68
|
+
*/
|
|
69
|
+
getAllFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset, limit: number): PersistencePromise<MutableDocumentMap>;
|
|
61
70
|
/**
|
|
62
71
|
* Provides access to add or update the contents of the cache. The buffer
|
|
63
72
|
* handles proper size accounting for the change.
|
|
@@ -113,8 +113,10 @@ export interface SharedClientState {
|
|
|
113
113
|
/**
|
|
114
114
|
* Notifies other clients when remote documents have changed due to loading
|
|
115
115
|
* a bundle.
|
|
116
|
+
*
|
|
117
|
+
* @param collectionGroups The collection groups affected by this bundle.
|
|
116
118
|
*/
|
|
117
|
-
notifyBundleLoaded(): void;
|
|
119
|
+
notifyBundleLoaded(collectionGroups: Set<string>): void;
|
|
118
120
|
}
|
|
119
121
|
/**
|
|
120
122
|
* Holds the state of a mutation batch, including its user ID, batch ID and
|
|
@@ -237,7 +239,7 @@ export declare class WebStorageSharedClientState implements SharedClientState {
|
|
|
237
239
|
updateQueryState(targetId: TargetId, state: QueryTargetState, error?: FirestoreError): void;
|
|
238
240
|
handleUserChange(user: User, removedBatchIds: BatchId[], addedBatchIds: BatchId[]): void;
|
|
239
241
|
setOnlineState(onlineState: OnlineState): void;
|
|
240
|
-
notifyBundleLoaded(): void;
|
|
242
|
+
notifyBundleLoaded(collectionGroups: Set<string>): void;
|
|
241
243
|
shutdown(): void;
|
|
242
244
|
private getItem;
|
|
243
245
|
private setItem;
|
|
@@ -275,6 +277,7 @@ export declare class WebStorageSharedClientState implements SharedClientState {
|
|
|
275
277
|
* could not be parsed.
|
|
276
278
|
*/
|
|
277
279
|
private fromWebStorageOnlineState;
|
|
280
|
+
private fromWebStoreBundleLoadedState;
|
|
278
281
|
private handleMutationBatchEvent;
|
|
279
282
|
private handleQueryTargetEvent;
|
|
280
283
|
private handleClientStateEvent;
|
|
@@ -305,5 +308,5 @@ export declare class MemorySharedClientState implements SharedClientState {
|
|
|
305
308
|
setOnlineState(onlineState: OnlineState): void;
|
|
306
309
|
shutdown(): void;
|
|
307
310
|
writeSequenceNumber(sequenceNumber: ListenSequenceNumber): void;
|
|
308
|
-
notifyBundleLoaded(): void;
|
|
311
|
+
notifyBundleLoaded(collectionGroups: Set<string>): void;
|
|
309
312
|
}
|
|
@@ -64,7 +64,7 @@ export interface QueryTargetStateSchema {
|
|
|
64
64
|
export declare const ONLINE_STATE_KEY_PREFIX = "firestore_online_state";
|
|
65
65
|
/** Assembles the key for the online state of the primary tab. */
|
|
66
66
|
export declare function createWebStorageOnlineStateKey(persistenceKey: string): string;
|
|
67
|
-
export declare const BUNDLE_LOADED_KEY_PREFIX = "
|
|
67
|
+
export declare const BUNDLE_LOADED_KEY_PREFIX = "firestore_bundle_loaded_v2";
|
|
68
68
|
export declare function createBundleLoadedKey(persistenceKey: string): string;
|
|
69
69
|
/**
|
|
70
70
|
* The JSON representation of the system's online state, as written by the
|
|
@@ -36,5 +36,5 @@ export interface SharedClientStateSyncer {
|
|
|
36
36
|
* Retrieves newly changed documents from remote document cache and raises
|
|
37
37
|
* snapshots if needed.
|
|
38
38
|
*/
|
|
39
|
-
synchronizeWithChangedDocuments(): Promise<void>;
|
|
39
|
+
synchronizeWithChangedDocuments(collectionGroup: string): Promise<void>;
|
|
40
40
|
}
|
|
@@ -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.
|
|
@@ -18,6 +18,11 @@ import { SnapshotVersion } from '../core/snapshot_version';
|
|
|
18
18
|
import { Document } from './document';
|
|
19
19
|
import { DocumentKey } from './document_key';
|
|
20
20
|
import { FieldPath } from './path';
|
|
21
|
+
/**
|
|
22
|
+
* The initial mutation batch id for each index. Gets updated during index
|
|
23
|
+
* backfill.
|
|
24
|
+
*/
|
|
25
|
+
export declare const INITIAL_LARGEST_BATCH_ID = -1;
|
|
21
26
|
/**
|
|
22
27
|
* The initial sequence number for each index. Gets updated during index
|
|
23
28
|
* backfill.
|
|
@@ -65,6 +70,12 @@ export declare class FieldIndex {
|
|
|
65
70
|
export declare function fieldIndexGetArraySegment(fieldIndex: FieldIndex): IndexSegment | undefined;
|
|
66
71
|
/** Returns all directional (ascending/descending) segments for this index. */
|
|
67
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;
|
|
68
79
|
/**
|
|
69
80
|
* Compares indexes by collection group and segments. Ignores update time and
|
|
70
81
|
* index ID.
|
|
@@ -152,7 +163,9 @@ export declare class IndexOffset {
|
|
|
152
163
|
* `DocumentKey.empty()` if no document has been indexed.
|
|
153
164
|
*/
|
|
154
165
|
documentKey: DocumentKey, largestBatchId: number);
|
|
155
|
-
/**
|
|
166
|
+
/** Returns an offset that sorts before all regular offsets. */
|
|
156
167
|
static min(): IndexOffset;
|
|
168
|
+
/** Returns an offset that sorts after all regular offsets. */
|
|
169
|
+
static max(): IndexOffset;
|
|
157
170
|
}
|
|
158
171
|
export declare function indexOffsetComparator(left: IndexOffset, right: IndexOffset): number;
|
|
@@ -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 {
|
|
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<
|
|
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>;
|