@firebase/firestore 3.4.9-canary.d38eced3b → 3.4.9-canary.dbf623ffe
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/dist/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/src/local/indexeddb_schema.d.ts +3 -2
- package/dist/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
- package/dist/firestore/src/local/local_documents_view.d.ts +48 -9
- package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/firestore/src/model/collections.d.ts +2 -0
- package/dist/firestore/src/model/field_mask.d.ts +6 -0
- package/dist/firestore/src/model/mutation.d.ts +19 -1
- package/dist/firestore/src/model/mutation_batch.d.ts +9 -4
- package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/test/util/helpers.d.ts +12 -0
- package/dist/index.esm2017.js +10630 -10387
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +10793 -10516
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +10955 -10585
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +10955 -10585
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +10565 -10322
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +44 -3
- package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +3 -2
- package/dist/lite/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +48 -9
- package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/lite/firestore/src/model/collections.d.ts +2 -0
- package/dist/lite/firestore/src/model/field_mask.d.ts +6 -0
- package/dist/lite/firestore/src/model/mutation.d.ts +19 -1
- package/dist/lite/firestore/src/model/mutation_batch.d.ts +9 -4
- package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +12 -0
- package/dist/lite/index.browser.esm2017.js +1218 -738
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +1154 -764
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +653 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +653 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1231 -751
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +12 -0
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +104 -104
- package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +3 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +48 -9
- package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +2 -0
- package/dist/lite/packages/firestore/src/model/field_mask.d.ts +6 -0
- package/dist/lite/packages/firestore/src/model/mutation.d.ts +19 -1
- package/dist/lite/packages/firestore/src/model/mutation_batch.d.ts +9 -4
- package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +12 -0
- package/dist/lite/private.d.ts +12 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +189 -189
- package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +3 -2
- package/dist/packages/firestore/src/local/indexeddb_schema_converter.d.ts +1 -0
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +1 -0
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +48 -9
- package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/packages/firestore/src/model/collections.d.ts +2 -0
- package/dist/packages/firestore/src/model/field_mask.d.ts +6 -0
- package/dist/packages/firestore/src/model/mutation.d.ts +19 -1
- package/dist/packages/firestore/src/model/mutation_batch.d.ts +9 -4
- package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +12 -0
- package/dist/private.d.ts +44 -3
- package/package.json +13 -13
|
@@ -36,6 +36,11 @@ export interface DocumentOverlayCache {
|
|
|
36
36
|
* Returns null if there is no overlay for that key.
|
|
37
37
|
*/
|
|
38
38
|
getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the saved overlay mutation for the given document keys. Skips keys for
|
|
41
|
+
* which there are no overlays.
|
|
42
|
+
*/
|
|
43
|
+
getOverlays(transaction: PersistenceTransaction, keys: DocumentKeySet): PersistencePromise<OverlayMap>;
|
|
39
44
|
/**
|
|
40
45
|
* Saves the given document mutation map to persistence as overlays.
|
|
41
46
|
* All overlays will have their largest batch id set to `largestBatchId`.
|
|
@@ -36,6 +36,7 @@ export declare class IndexedDbDocumentOverlayCache implements DocumentOverlayCac
|
|
|
36
36
|
constructor(serializer: LocalSerializer, userId: string);
|
|
37
37
|
static forUser(serializer: LocalSerializer, user: User): IndexedDbDocumentOverlayCache;
|
|
38
38
|
getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>;
|
|
39
|
+
getOverlays(transaction: PersistenceTransaction, keys: DocumentKeySet): PersistencePromise<OverlayMap>;
|
|
39
40
|
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>;
|
|
40
41
|
removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
|
|
41
42
|
getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>;
|
|
@@ -21,7 +21,7 @@ import { Document as ProtoDocument, DocumentsTarget as ProtoDocumentsTarget, Que
|
|
|
21
21
|
import { EncodedResourcePath } from './encoded_resource_path';
|
|
22
22
|
import { DbTimestampKey } from './indexeddb_sentinels';
|
|
23
23
|
export declare const INDEXING_ENABLED = false;
|
|
24
|
-
export declare const INDEXING_SCHEMA_VERSION =
|
|
24
|
+
export declare const INDEXING_SCHEMA_VERSION = 15;
|
|
25
25
|
/**
|
|
26
26
|
* Schema Version for the Web client:
|
|
27
27
|
* 1. Initial version including Mutation Queue, Query Cache, and Remote
|
|
@@ -43,7 +43,8 @@ export declare const INDEXING_SCHEMA_VERSION = 14;
|
|
|
43
43
|
* 12. Add document overlays.
|
|
44
44
|
* 13. Rewrite the keys of the remote document cache to allow for efficient
|
|
45
45
|
* document lookup via `getAll()`.
|
|
46
|
-
* 14. Add
|
|
46
|
+
* 14. Add overlays.
|
|
47
|
+
* 15. Add indexing support.
|
|
47
48
|
*/
|
|
48
49
|
export declare const SCHEMA_VERSION: number;
|
|
49
50
|
/**
|
|
@@ -240,6 +240,7 @@ export declare const V11_STORES: string[];
|
|
|
240
240
|
export declare const V12_STORES: string[];
|
|
241
241
|
export declare const V13_STORES: string[];
|
|
242
242
|
export declare const V14_STORES: string[];
|
|
243
|
+
export declare const V15_STORES: string[];
|
|
243
244
|
/**
|
|
244
245
|
* The list of all default IndexedDB stores used throughout the SDK. This is
|
|
245
246
|
* used when creating transactions so that access across all stores is done
|
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { Query } from '../core/query';
|
|
18
|
-
import { DocumentKeySet, DocumentMap, MutableDocumentMap } from '../model/collections';
|
|
18
|
+
import { DocumentKeySet, OverlayMap, DocumentMap, MutableDocumentMap, DocumentKeyMap } from '../model/collections';
|
|
19
19
|
import { Document } from '../model/document';
|
|
20
20
|
import { DocumentKey } from '../model/document_key';
|
|
21
21
|
import { IndexOffset } from '../model/field_index';
|
|
22
|
+
import { FieldMask } from '../model/field_mask';
|
|
23
|
+
import { DocumentOverlayCache } from './document_overlay_cache';
|
|
22
24
|
import { IndexManager } from './index_manager';
|
|
23
25
|
import { MutationQueue } from './mutation_queue';
|
|
26
|
+
import { OverlayedDocument } from './overlayed_document';
|
|
24
27
|
import { PersistencePromise } from './persistence_promise';
|
|
25
28
|
import { PersistenceTransaction } from './persistence_transaction';
|
|
26
29
|
import { RemoteDocumentCache } from './remote_document_cache';
|
|
@@ -33,8 +36,9 @@ import { RemoteDocumentCache } from './remote_document_cache';
|
|
|
33
36
|
export declare class LocalDocumentsView {
|
|
34
37
|
readonly remoteDocumentCache: RemoteDocumentCache;
|
|
35
38
|
readonly mutationQueue: MutationQueue;
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
readonly documentOverlayCache: DocumentOverlayCache;
|
|
40
|
+
readonly indexManager: IndexManager;
|
|
41
|
+
constructor(remoteDocumentCache: RemoteDocumentCache, mutationQueue: MutationQueue, documentOverlayCache: DocumentOverlayCache, indexManager: IndexManager);
|
|
38
42
|
/**
|
|
39
43
|
* Get the local view of the document identified by `key`.
|
|
40
44
|
*
|
|
@@ -42,9 +46,6 @@ export declare class LocalDocumentsView {
|
|
|
42
46
|
* state for it.
|
|
43
47
|
*/
|
|
44
48
|
getDocument(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Document>;
|
|
45
|
-
/** Internal version of `getDocument` that allows reusing batches. */
|
|
46
|
-
private getDocumentInternal;
|
|
47
|
-
private applyLocalMutationsToDocuments;
|
|
48
49
|
/**
|
|
49
50
|
* Gets the local view of the documents identified by `keys`.
|
|
50
51
|
*
|
|
@@ -53,10 +54,46 @@ export declare class LocalDocumentsView {
|
|
|
53
54
|
*/
|
|
54
55
|
getDocuments(transaction: PersistenceTransaction, keys: DocumentKeySet): PersistencePromise<DocumentMap>;
|
|
55
56
|
/**
|
|
56
|
-
*
|
|
57
|
-
* from the local store.
|
|
57
|
+
* Similar to `getDocuments`, but creates the local view from the given
|
|
58
|
+
* `baseDocs` without retrieving documents from the local store.
|
|
59
|
+
*
|
|
60
|
+
* @param transaction - The transaction this operation is scoped to.
|
|
61
|
+
* @param docs - The documents to apply local mutations to get the local views.
|
|
62
|
+
* @param existenceStateChanged - The set of document keys whose existence state
|
|
63
|
+
* is changed. This is useful to determine if some documents overlay needs
|
|
64
|
+
* to be recalculated.
|
|
65
|
+
*/
|
|
66
|
+
getLocalViewOfDocuments(transaction: PersistenceTransaction, docs: MutableDocumentMap, existenceStateChanged?: DocumentKeySet): PersistencePromise<DocumentMap>;
|
|
67
|
+
/**
|
|
68
|
+
* Gets the overlayed documents for the given document map, which will include
|
|
69
|
+
* the local view of those documents and a `FieldMask` indicating which fields
|
|
70
|
+
* are mutated locally, `null` if overlay is a Set or Delete mutation.
|
|
71
|
+
*/
|
|
72
|
+
getOverlayedDocuments(transaction: PersistenceTransaction, docs: MutableDocumentMap): PersistencePromise<DocumentKeyMap<OverlayedDocument>>;
|
|
73
|
+
/**
|
|
74
|
+
* Fetches the overlays for {@code docs} and adds them to provided overlay map
|
|
75
|
+
* if the map does not already contain an entry for the given document key.
|
|
76
|
+
*/
|
|
77
|
+
private populateOverlays;
|
|
78
|
+
/**
|
|
79
|
+
* Computes the local view for the given documents.
|
|
80
|
+
*
|
|
81
|
+
* @param docs - The documents to compute views for. It also has the base
|
|
82
|
+
* version of the documents.
|
|
83
|
+
* @param overlays - The overlays that need to be applied to the given base
|
|
84
|
+
* version of the documents.
|
|
85
|
+
* @param existenceStateChanged - A set of documents whose existence states
|
|
86
|
+
* might have changed. This is used to determine if we need to re-calculate
|
|
87
|
+
* overlays from mutation queues.
|
|
88
|
+
* @return A map represents the local documents view.
|
|
89
|
+
*/
|
|
90
|
+
computeViews(transaction: PersistenceTransaction, docs: MutableDocumentMap, overlays: OverlayMap, existenceStateChanged: DocumentKeySet): PersistencePromise<DocumentKeyMap<OverlayedDocument>>;
|
|
91
|
+
private recalculateAndSaveOverlays;
|
|
92
|
+
/**
|
|
93
|
+
* Recalculates overlays by reading the documents from remote document cache
|
|
94
|
+
* first, and saves them after they are calculated.
|
|
58
95
|
*/
|
|
59
|
-
|
|
96
|
+
recalculateAndSaveOverlaysForDocumentKeys(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<DocumentKeyMap<FieldMask | null>>;
|
|
60
97
|
/**
|
|
61
98
|
* Performs a query against the local view of all documents.
|
|
62
99
|
*
|
|
@@ -68,4 +105,6 @@ export declare class LocalDocumentsView {
|
|
|
68
105
|
private getDocumentsMatchingDocumentQuery;
|
|
69
106
|
private getDocumentsMatchingCollectionGroupQuery;
|
|
70
107
|
private getDocumentsMatchingCollectionQuery;
|
|
108
|
+
/** Returns a base document that can be used to apply `overlay`. */
|
|
109
|
+
private getBaseDocument;
|
|
71
110
|
}
|
|
@@ -28,6 +28,7 @@ export declare class MemoryDocumentOverlayCache implements DocumentOverlayCache
|
|
|
28
28
|
private overlays;
|
|
29
29
|
private overlayByBatchId;
|
|
30
30
|
getOverlay(transaction: PersistenceTransaction, key: DocumentKey): PersistencePromise<Overlay | null>;
|
|
31
|
+
getOverlays(transaction: PersistenceTransaction, keys: DocumentKeySet): PersistencePromise<OverlayMap>;
|
|
31
32
|
saveOverlays(transaction: PersistenceTransaction, largestBatchId: number, overlays: MutationMap): PersistencePromise<void>;
|
|
32
33
|
removeOverlaysForBatchId(transaction: PersistenceTransaction, documentKeys: DocumentKeySet, batchId: number): PersistencePromise<void>;
|
|
33
34
|
getOverlaysForCollection(transaction: PersistenceTransaction, collection: ResourcePath, sinceBatchId: number): PersistencePromise<OverlayMap>;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 } from '../model/document';
|
|
18
|
+
import { FieldMask } from '../model/field_mask';
|
|
19
|
+
/**
|
|
20
|
+
* Represents a local view (overlay) of a document, and the fields that are
|
|
21
|
+
* locally mutated.
|
|
22
|
+
*/
|
|
23
|
+
export declare class OverlayedDocument {
|
|
24
|
+
readonly overlayedDocument: Document;
|
|
25
|
+
/**
|
|
26
|
+
* The fields that are locally mutated by patch mutations. If the overlayed
|
|
27
|
+
* document is from set or delete mutations, this returns null.
|
|
28
|
+
*/
|
|
29
|
+
readonly mutatedFields: FieldMask | null;
|
|
30
|
+
constructor(overlayedDocument: Document,
|
|
31
|
+
/**
|
|
32
|
+
* The fields that are locally mutated by patch mutations. If the overlayed
|
|
33
|
+
* document is from set or delete mutations, this returns null.
|
|
34
|
+
*/
|
|
35
|
+
mutatedFields: FieldMask | null);
|
|
36
|
+
}
|
|
@@ -36,6 +36,8 @@ export declare type OverlayMap = ObjectMap<DocumentKey, Overlay>;
|
|
|
36
36
|
export declare function newOverlayMap(): OverlayMap;
|
|
37
37
|
export declare type MutationMap = ObjectMap<DocumentKey, Mutation>;
|
|
38
38
|
export declare function newMutationMap(): MutationMap;
|
|
39
|
+
export declare type DocumentKeyMap<T> = ObjectMap<DocumentKey, T>;
|
|
40
|
+
export declare function newDocumentKeyMap<T>(): DocumentKeyMap<T>;
|
|
39
41
|
export declare type DocumentVersionMap = SortedMap<DocumentKey, SnapshotVersion>;
|
|
40
42
|
export declare function documentVersionMap(): DocumentVersionMap;
|
|
41
43
|
export declare type DocumentKeySet = SortedSet<DocumentKey>;
|
|
@@ -28,6 +28,12 @@ import { FieldPath } from './path';
|
|
|
28
28
|
export declare class FieldMask {
|
|
29
29
|
readonly fields: FieldPath[];
|
|
30
30
|
constructor(fields: FieldPath[]);
|
|
31
|
+
static empty(): FieldMask;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a new FieldMask object that is the result of adding all the given
|
|
34
|
+
* fields paths to this field mask.
|
|
35
|
+
*/
|
|
36
|
+
unionWith(extraFields: FieldPath[]): FieldMask;
|
|
31
37
|
/**
|
|
32
38
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
33
39
|
* mask.
|
|
@@ -149,7 +149,19 @@ export declare abstract class Mutation {
|
|
|
149
149
|
abstract readonly key: DocumentKey;
|
|
150
150
|
abstract readonly precondition: Precondition;
|
|
151
151
|
abstract readonly fieldTransforms: FieldTransform[];
|
|
152
|
+
/**
|
|
153
|
+
* Returns a `FieldMask` representing the fields that will be changed by
|
|
154
|
+
* applying this mutation. Returns `null` if the mutation will overwrite the
|
|
155
|
+
* entire document.
|
|
156
|
+
*/
|
|
157
|
+
abstract getFieldMask(): FieldMask | null;
|
|
152
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* A utility method to calculate a `Mutation` representing the overlay from the
|
|
161
|
+
* final state of the document, and a `FieldMask` representing the fields that
|
|
162
|
+
* are mutated by the local mutations.
|
|
163
|
+
*/
|
|
164
|
+
export declare function calculateOverlayMutation(doc: MutableDocument, mask: FieldMask | null): Mutation | null;
|
|
153
165
|
/**
|
|
154
166
|
* Applies this mutation to the given document for the purposes of computing a
|
|
155
167
|
* new remote document. If the input document doesn't match the expected state
|
|
@@ -172,10 +184,12 @@ export declare function mutationApplyToRemoteDocument(mutation: Mutation, docume
|
|
|
172
184
|
* @param document - The document to mutate. The input document can be an
|
|
173
185
|
* invalid document if the client has no knowledge of the pre-mutation state
|
|
174
186
|
* of the document.
|
|
187
|
+
* @param previousMask - The fields that have been updated before applying this mutation.
|
|
175
188
|
* @param localWriteTime - A timestamp indicating the local write time of the
|
|
176
189
|
* batch this mutation is a part of.
|
|
190
|
+
* @returns A `FieldMask` representing the fields that are changed by applying this mutation.
|
|
177
191
|
*/
|
|
178
|
-
export declare function mutationApplyToLocalView(mutation: Mutation, document: MutableDocument, localWriteTime: Timestamp):
|
|
192
|
+
export declare function mutationApplyToLocalView(mutation: Mutation, document: MutableDocument, previousMask: FieldMask | null, localWriteTime: Timestamp): FieldMask | null;
|
|
179
193
|
/**
|
|
180
194
|
* If this mutation is not idempotent, returns the base value to persist with
|
|
181
195
|
* this mutation. If a base value is returned, the mutation is always applied
|
|
@@ -205,6 +219,7 @@ export declare class SetMutation extends Mutation {
|
|
|
205
219
|
readonly fieldTransforms: FieldTransform[];
|
|
206
220
|
constructor(key: DocumentKey, value: ObjectValue, precondition: Precondition, fieldTransforms?: FieldTransform[]);
|
|
207
221
|
readonly type: MutationType;
|
|
222
|
+
getFieldMask(): FieldMask | null;
|
|
208
223
|
}
|
|
209
224
|
/**
|
|
210
225
|
* A mutation that modifies fields of the document at the given key with the
|
|
@@ -227,6 +242,7 @@ export declare class PatchMutation extends Mutation {
|
|
|
227
242
|
readonly fieldTransforms: FieldTransform[];
|
|
228
243
|
constructor(key: DocumentKey, data: ObjectValue, fieldMask: FieldMask, precondition: Precondition, fieldTransforms?: FieldTransform[]);
|
|
229
244
|
readonly type: MutationType;
|
|
245
|
+
getFieldMask(): FieldMask | null;
|
|
230
246
|
}
|
|
231
247
|
/** A mutation that deletes the document at the given key. */
|
|
232
248
|
export declare class DeleteMutation extends Mutation {
|
|
@@ -235,6 +251,7 @@ export declare class DeleteMutation extends Mutation {
|
|
|
235
251
|
constructor(key: DocumentKey, precondition: Precondition);
|
|
236
252
|
readonly type: MutationType;
|
|
237
253
|
readonly fieldTransforms: FieldTransform[];
|
|
254
|
+
getFieldMask(): FieldMask | null;
|
|
238
255
|
}
|
|
239
256
|
/**
|
|
240
257
|
* A mutation that verifies the existence of the document at the given key with
|
|
@@ -249,4 +266,5 @@ export declare class VerifyMutation extends Mutation {
|
|
|
249
266
|
constructor(key: DocumentKey, precondition: Precondition);
|
|
250
267
|
readonly type: MutationType;
|
|
251
268
|
readonly fieldTransforms: FieldTransform[];
|
|
269
|
+
getFieldMask(): FieldMask | null;
|
|
252
270
|
}
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
import { SnapshotVersion } from '../core/snapshot_version';
|
|
18
18
|
import { BatchId } from '../core/types';
|
|
19
19
|
import { Timestamp } from '../lite-api/timestamp';
|
|
20
|
-
import {
|
|
20
|
+
import { OverlayedDocument } from '../local/overlayed_document';
|
|
21
|
+
import { DocumentKeySet, MutationMap, DocumentVersionMap, DocumentKeyMap } from './collections';
|
|
21
22
|
import { MutableDocument } from './document';
|
|
23
|
+
import { FieldMask } from './field_mask';
|
|
22
24
|
import { Mutation, MutationResult } from './mutation';
|
|
23
25
|
/**
|
|
24
26
|
* A batch of mutations that will be sent as one unit to the backend.
|
|
@@ -54,13 +56,16 @@ export declare class MutationBatch {
|
|
|
54
56
|
* batch.
|
|
55
57
|
*
|
|
56
58
|
* @param document - The document to apply mutations to.
|
|
59
|
+
* @param mutatedFields - Fields that have been updated before applying this mutation batch.
|
|
60
|
+
* @returns A `FieldMask` representing all the fields that are mutated.
|
|
57
61
|
*/
|
|
58
|
-
applyToLocalView(document: MutableDocument):
|
|
62
|
+
applyToLocalView(document: MutableDocument, mutatedFields: FieldMask | null): FieldMask | null;
|
|
59
63
|
/**
|
|
60
64
|
* Computes the local view for all provided documents given the mutations in
|
|
61
|
-
* this batch.
|
|
65
|
+
* this batch. Returns a `DocumentKey` to `Mutation` map which can be used to
|
|
66
|
+
* replace all the mutation applications.
|
|
62
67
|
*/
|
|
63
|
-
applyToLocalDocumentSet(documentMap:
|
|
68
|
+
applyToLocalDocumentSet(documentMap: DocumentKeyMap<OverlayedDocument>, documentsWithoutRemoteVersion: DocumentKeySet): MutationMap;
|
|
64
69
|
keys(): DocumentKeySet;
|
|
65
70
|
isEqual(other: MutationBatch): boolean;
|
|
66
71
|
}
|
|
@@ -31,6 +31,7 @@ export declare class TestDocumentOverlayCache {
|
|
|
31
31
|
constructor(persistence: Persistence, cache: DocumentOverlayCache);
|
|
32
32
|
saveOverlays(largestBatch: number, data: MutationMap): Promise<void>;
|
|
33
33
|
getOverlay(key: DocumentKey): Promise<Overlay | null>;
|
|
34
|
+
getOverlays(keys: DocumentKeySet): Promise<OverlayMap>;
|
|
34
35
|
getOverlayMutation(docKey: string): Promise<Mutation | null>;
|
|
35
36
|
getOverlaysForCollection(path: ResourcePath, sinceBatchId: number): Promise<OverlayMap>;
|
|
36
37
|
getOverlaysForCollectionGroup(collectionGroup: string, sinceBatchId: number, count: number): Promise<OverlayMap>;
|
|
@@ -69,6 +69,7 @@ export declare function blob(...bytes: number[]): Bytes;
|
|
|
69
69
|
export declare function filter(path: string, op: string, value: unknown): FieldFilter;
|
|
70
70
|
export declare function setMutation(keyStr: string, json: JsonObject<unknown>): SetMutation;
|
|
71
71
|
export declare function patchMutation(keyStr: string, json: JsonObject<unknown>, precondition?: Precondition): PatchMutation;
|
|
72
|
+
export declare function mergeMutation(keyStr: string, json: JsonObject<unknown>, updateMask: FieldPath[]): PatchMutation;
|
|
72
73
|
export declare function deleteMutation(keyStr: string): DeleteMutation;
|
|
73
74
|
export declare function mutationResult(testVersion: TestSnapshotVersion): MutationResult;
|
|
74
75
|
export declare function bound(values: unknown[], inclusive: boolean): Bound;
|
|
@@ -177,3 +178,14 @@ export declare function expectSetToEqual<T>(set: SortedSet<T>, arr: T[]): void;
|
|
|
177
178
|
export declare function expectEqualitySets<T>(elems: T[][], equalityFn: (v1: T, v2: T) => boolean, stringifyFn?: (v: T) => string): void;
|
|
178
179
|
export declare function validateFirestoreError(expectedCode: Code, actualError: Error): void;
|
|
179
180
|
export declare function forEachNumber<V>(obj: Dict<V>, fn: (key: number, val: V) => void): void;
|
|
181
|
+
/**
|
|
182
|
+
* Returns all possible permutations of the given array.
|
|
183
|
+
* For `[a, b]`, this method returns `[[a, b], [b, a]]`.
|
|
184
|
+
*/
|
|
185
|
+
export declare function computePermutations<T>(input: T[]): T[][];
|
|
186
|
+
/**
|
|
187
|
+
* Returns all possible combinations of the given array, including an empty
|
|
188
|
+
* array. For `[a, b, c]` this method returns
|
|
189
|
+
* `[[], [a], [a, b], [a, c], [b, c], [a, b, c]`.
|
|
190
|
+
*/
|
|
191
|
+
export declare function computeCombinations<T>(input: T[]): T[][];
|