@firebase/firestore 3.4.5 → 3.4.6-canary.3198d58dc
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 +8 -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/index/index_entry.d.ts +6 -0
- package/dist/firestore/src/local/document_overlay_cache.d.ts +4 -5
- package/dist/firestore/src/local/index_manager.d.ts +2 -2
- package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
- package/dist/firestore/src/local/indexeddb_mutation_batch_impl.d.ts +2 -1
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
- package/dist/firestore/src/local/indexeddb_schema.d.ts +47 -563
- 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 +243 -0
- package/dist/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/firestore/src/local/local_serializer.d.ts +3 -1
- package/dist/firestore/src/local/local_store_impl.d.ts +1 -7
- package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
- package/dist/firestore/src/local/memory_index_manager.d.ts +1 -1
- 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 +11 -0
- package/dist/firestore/src/model/collections.d.ts +7 -0
- package/dist/firestore/src/model/field_index.d.ts +10 -1
- package/dist/firestore/src/model/type_order.d.ts +2 -1
- package/dist/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/firestore/src/util/obj_map.d.ts +3 -0
- package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +1 -1
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -1
- package/dist/index.esm2017.js +4533 -4502
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4455 -4308
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1606 -1180
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1606 -1180
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4425 -4394
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +31 -10
- 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/index/index_entry.d.ts +6 -0
- package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +4 -5
- package/dist/lite/firestore/src/local/index_manager.d.ts +2 -2
- package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
- 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 +0 -17
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +47 -563
- 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 +243 -0
- package/dist/lite/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/lite/firestore/src/local/local_serializer.d.ts +3 -1
- package/dist/lite/firestore/src/local/local_store_impl.d.ts +1 -7
- package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +1 -1
- 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 +11 -0
- package/dist/lite/firestore/src/model/collections.d.ts +7 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +10 -1
- package/dist/lite/firestore/src/model/type_order.d.ts +2 -1
- package/dist/lite/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/lite/firestore/src/util/obj_map.d.ts +3 -0
- package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +1 -1
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -1
- package/dist/lite/index.browser.esm2017.js +37 -24
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +104 -113
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +24 -9
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +24 -9
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +37 -24
- 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/index/index_entry.d.ts +6 -0
- package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +4 -5
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
- 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 +0 -17
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +47 -563
- 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 +243 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- 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 +3 -1
- package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +1 -7
- package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +1 -1
- 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 +11 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +7 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +10 -1
- package/dist/lite/packages/firestore/src/model/type_order.d.ts +2 -1
- package/dist/lite/packages/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/lite/packages/firestore/src/util/obj_map.d.ts +3 -0
- package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +1 -1
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -1
- package/dist/lite/private.d.ts +1 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +197 -197
- 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/index/index_entry.d.ts +6 -0
- package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +4 -5
- package/dist/packages/firestore/src/local/index_manager.d.ts +2 -2
- package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +4 -5
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +48 -1
- 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 +0 -17
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +47 -563
- 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 +243 -0
- package/dist/packages/firestore/src/local/indexeddb_target_cache.d.ts +2 -1
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +3 -4
- package/dist/packages/firestore/src/local/local_serializer.d.ts +3 -1
- package/dist/packages/firestore/src/local/local_store_impl.d.ts +1 -7
- package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +4 -5
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +1 -1
- 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 +11 -0
- package/dist/packages/firestore/src/model/collections.d.ts +7 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +10 -1
- package/dist/packages/firestore/src/model/type_order.d.ts +2 -1
- package/dist/packages/firestore/src/platform/node/base64.d.ts +1 -0
- package/dist/packages/firestore/src/util/obj_map.d.ts +3 -0
- package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +4 -4
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +1 -1
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +3 -1
- package/dist/private.d.ts +31 -10
- package/package.json +9 -9
package/dist/internal.d.ts
CHANGED
|
@@ -982,7 +982,7 @@ declare interface DocumentOverlayCache {
|
|
|
982
982
|
* Saves the given document mutation map to persistence as overlays.
|
|
983
983
|
* All overlays will have their largest batch id set to `largestBatchId`.
|
|
984
984
|
*/
|
|
985
|
-
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays:
|
|
985
|
+
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>;
|
|
986
986
|
/** Removes overlays for the given document keys and batch ID. */
|
|
987
987
|
removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
|
|
988
988
|
/**
|
|
@@ -994,7 +994,7 @@ declare interface DocumentOverlayCache {
|
|
|
994
994
|
* Only overlays that contain a change past `sinceBatchId` are returned.
|
|
995
995
|
* @returns Mapping of each document key in the collection to its overlay.
|
|
996
996
|
*/
|
|
997
|
-
getOverlaysForCollection(transaction: PersistenceTransaction, collection: _ResourcePath, sinceBatchId: number): PersistencePromise<
|
|
997
|
+
getOverlaysForCollection(transaction: PersistenceTransaction, collection: _ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>;
|
|
998
998
|
/**
|
|
999
999
|
* Returns `count` overlays with a batch ID higher than `sinceBatchId` for the
|
|
1000
1000
|
* provided collection group, processed by ascending batch ID. The method
|
|
@@ -1009,7 +1009,7 @@ declare interface DocumentOverlayCache {
|
|
|
1009
1009
|
* batch contains more entries.
|
|
1010
1010
|
* @return Mapping of each document key in the collection group to its overlay.
|
|
1011
1011
|
*/
|
|
1012
|
-
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<
|
|
1012
|
+
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<OverlayMap>;
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
1015
|
/**
|
|
@@ -2523,9 +2523,9 @@ declare interface IndexManager {
|
|
|
2523
2523
|
getFieldIndex(transaction: PersistenceTransaction, target: Target): PersistencePromise<FieldIndex | null>;
|
|
2524
2524
|
/**
|
|
2525
2525
|
* Returns the documents that match the given target based on the provided
|
|
2526
|
-
* index.
|
|
2526
|
+
* index or `null` if the target does not have a matching index.
|
|
2527
2527
|
*/
|
|
2528
|
-
getDocumentsMatchingTarget(transaction: PersistenceTransaction,
|
|
2528
|
+
getDocumentsMatchingTarget(transaction: PersistenceTransaction, target: Target): PersistencePromise<DocumentKeySet | null>;
|
|
2529
2529
|
/**
|
|
2530
2530
|
* Returns the next collection group to update. Returns `null` if no group
|
|
2531
2531
|
* exists.
|
|
@@ -2571,8 +2571,10 @@ declare class IndexOffset {
|
|
|
2571
2571
|
* `DocumentKey.empty()` if no document has been indexed.
|
|
2572
2572
|
*/
|
|
2573
2573
|
documentKey: _DocumentKey, largestBatchId: number);
|
|
2574
|
-
/**
|
|
2574
|
+
/** Returns an offset that sorts before all regular offsets. */
|
|
2575
2575
|
static min(): IndexOffset;
|
|
2576
|
+
/** Returns an offset that sorts after all regular offsets. */
|
|
2577
|
+
static max(): IndexOffset;
|
|
2576
2578
|
}
|
|
2577
2579
|
|
|
2578
2580
|
/** An index component consisting of field path and index type. */
|
|
@@ -3039,6 +3041,8 @@ declare class MutationBatchResult {
|
|
|
3039
3041
|
static from(batch: MutationBatch, commitVersion: SnapshotVersion, results: MutationResult[]): MutationBatchResult;
|
|
3040
3042
|
}
|
|
3041
3043
|
|
|
3044
|
+
declare type MutationMap = ObjectMap<_DocumentKey, Mutation>;
|
|
3045
|
+
|
|
3042
3046
|
/** A queue of mutations to apply to the remote store. */
|
|
3043
3047
|
declare interface MutationQueue {
|
|
3044
3048
|
/** Returns true if this queue contains no mutation batches. */
|
|
@@ -3265,6 +3269,8 @@ declare class ObjectMap<KeyType, ValueType> {
|
|
|
3265
3269
|
* constant time lookups in practice.
|
|
3266
3270
|
*/
|
|
3267
3271
|
private inner;
|
|
3272
|
+
/** The number of entries stored in the map */
|
|
3273
|
+
private innerSize;
|
|
3268
3274
|
constructor(mapKeyFn: (key: KeyType) => string, equalsFn: (l: KeyType, r: KeyType) => boolean);
|
|
3269
3275
|
/** Get a value for this key, or undefined if it does not exist. */
|
|
3270
3276
|
get(key: KeyType): ValueType | undefined;
|
|
@@ -3277,6 +3283,7 @@ declare class ObjectMap<KeyType, ValueType> {
|
|
|
3277
3283
|
delete(key: KeyType): boolean;
|
|
3278
3284
|
forEach(fn: (key: KeyType, val: ValueType) => void): void;
|
|
3279
3285
|
isEmpty(): boolean;
|
|
3286
|
+
size(): number;
|
|
3280
3287
|
}
|
|
3281
3288
|
|
|
3282
3289
|
/**
|
|
@@ -3643,6 +3650,8 @@ declare class Overlay {
|
|
|
3643
3650
|
toString(): string;
|
|
3644
3651
|
}
|
|
3645
3652
|
|
|
3653
|
+
declare type OverlayMap = ObjectMap<_DocumentKey, Overlay>;
|
|
3654
|
+
|
|
3646
3655
|
declare interface ParseContext {
|
|
3647
3656
|
readonly databaseId: _DatabaseId;
|
|
3648
3657
|
readonly ignoreUndefinedProperties: boolean;
|
|
@@ -4217,11 +4226,20 @@ declare interface RemoteDocumentCache {
|
|
|
4217
4226
|
* Returns the documents from the provided collection.
|
|
4218
4227
|
*
|
|
4219
4228
|
* @param collection - The collection to read.
|
|
4220
|
-
* @param
|
|
4221
|
-
*
|
|
4229
|
+
* @param offset - The offset to start the scan at (exclusive).
|
|
4230
|
+
* @returns The set of matching documents.
|
|
4231
|
+
*/
|
|
4232
|
+
getAllFromCollection(transaction: PersistenceTransaction, collection: _ResourcePath, offset: IndexOffset): PersistencePromise<MutableDocumentMap>;
|
|
4233
|
+
/**
|
|
4234
|
+
* Looks up the next `limit` documents for a collection group based on the
|
|
4235
|
+
* provided offset. The ordering is based on the document's read time and key.
|
|
4236
|
+
*
|
|
4237
|
+
* @param collectionGroup - The collection group to scan.
|
|
4238
|
+
* @param offset - The offset to start the scan at (exclusive).
|
|
4239
|
+
* @param limit - The maximum number of results to return.
|
|
4222
4240
|
* @returns The set of matching documents.
|
|
4223
4241
|
*/
|
|
4224
|
-
|
|
4242
|
+
getAllFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset, limit: number): PersistencePromise<MutableDocumentMap>;
|
|
4225
4243
|
/**
|
|
4226
4244
|
* Provides access to add or update the contents of the cache. The buffer
|
|
4227
4245
|
* handles proper size accounting for the change.
|
|
@@ -4689,8 +4707,10 @@ declare interface SharedClientState {
|
|
|
4689
4707
|
/**
|
|
4690
4708
|
* Notifies other clients when remote documents have changed due to loading
|
|
4691
4709
|
* a bundle.
|
|
4710
|
+
*
|
|
4711
|
+
* @param collectionGroups The collection groups affected by this bundle.
|
|
4692
4712
|
*/
|
|
4693
|
-
notifyBundleLoaded(): void;
|
|
4713
|
+
notifyBundleLoaded(collectionGroups: Set<string>): void;
|
|
4694
4714
|
}
|
|
4695
4715
|
|
|
4696
4716
|
/**
|
|
@@ -4778,6 +4798,7 @@ declare class SnapshotVersion {
|
|
|
4778
4798
|
private timestamp;
|
|
4779
4799
|
static fromTimestamp(value: Timestamp): SnapshotVersion;
|
|
4780
4800
|
static min(): SnapshotVersion;
|
|
4801
|
+
static max(): SnapshotVersion;
|
|
4781
4802
|
private constructor();
|
|
4782
4803
|
compareTo(other: SnapshotVersion): number;
|
|
4783
4804
|
isEqual(other: SnapshotVersion): boolean;
|
|
@@ -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. */
|
|
@@ -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:
|
|
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<
|
|
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<
|
|
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,
|
|
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:
|
|
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<
|
|
43
|
-
getOverlaysForCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, sinceBatchId: number, count: number): PersistencePromise<
|
|
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,
|
|
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
|
}
|
|
@@ -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,8 @@
|
|
|
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';
|
|
20
18
|
import { LocalSerializer } from './local_serializer';
|
|
21
|
-
import { PersistencePromise } from './persistence_promise';
|
|
22
|
-
import { PersistenceTransaction } from './persistence_transaction';
|
|
23
19
|
import { RemoteDocumentCache } from './remote_document_cache';
|
|
24
20
|
export interface DocumentSizeEntry {
|
|
25
21
|
document: MutableDocument;
|
|
@@ -29,16 +25,3 @@ export interface IndexedDbRemoteDocumentCache extends RemoteDocumentCache {
|
|
|
29
25
|
}
|
|
30
26
|
/** Creates a new IndexedDbRemoteDocumentCache. */
|
|
31
27
|
export declare function newIndexedDbRemoteDocumentCache(serializer: LocalSerializer): IndexedDbRemoteDocumentCache;
|
|
32
|
-
/**
|
|
33
|
-
* Returns the set of documents that have changed since the specified read
|
|
34
|
-
* time.
|
|
35
|
-
*/
|
|
36
|
-
export declare function remoteDocumentCacheGetNewDocumentChanges(remoteDocumentCache: IndexedDbRemoteDocumentCache, transaction: PersistenceTransaction, sinceReadTime: SnapshotVersion): PersistencePromise<{
|
|
37
|
-
changedDocs: MutableDocumentMap;
|
|
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.
|
|
43
|
-
*/
|
|
44
|
-
export declare function remoteDocumentCacheGetLastReadTime(transaction: PersistenceTransaction): PersistencePromise<SnapshotVersion>;
|