@firebase/firestore 3.4.9 → 3.4.10-canary.ebc17e27f
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 +14 -0
- package/dist/firestore/src/api/transaction.d.ts +2 -0
- package/dist/firestore/src/core/component_provider.d.ts +11 -6
- package/dist/firestore/src/lite-api/transaction.d.ts +2 -0
- package/dist/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/firestore/src/local/index_backfiller.d.ts +44 -0
- package/dist/firestore/src/local/index_manager.d.ts +2 -0
- package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/src/local/indexeddb_index_manager.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 +64 -9
- package/dist/firestore/src/local/local_store.d.ts +9 -0
- package/dist/firestore/src/local/lru_garbage_collector_impl.d.ts +5 -5
- package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/src/local/memory_index_manager.d.ts +1 -0
- package/dist/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/firestore/src/local/persistence.d.ts +3 -5
- package/dist/firestore/src/local/persistence_promise.d.ts +11 -0
- package/dist/firestore/src/local/query_engine.d.ts +1 -1
- package/dist/firestore/src/model/collections.d.ts +8 -2
- 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 +8 -4
- package/dist/firestore/src/tsdoc-metadata.json +11 -11
- package/dist/firestore/src/util/async_queue.d.ts +5 -1
- package/dist/firestore/test/unit/local/index_backfiller.test.d.ts +17 -0
- package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/firestore/test/unit/specs/spec_test_components.d.ts +5 -3
- package/dist/firestore/test/util/helpers.d.ts +13 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.esm2017.js +10689 -10296
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +9353 -8844
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +6738 -6123
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +6738 -6123
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +9818 -9424
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +6137 -5964
- package/dist/lite/firestore/src/api/transaction.d.ts +2 -0
- package/dist/lite/firestore/src/core/component_provider.d.ts +11 -6
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -0
- package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/lite/firestore/src/local/index_backfiller.d.ts +44 -0
- package/dist/lite/firestore/src/local/index_manager.d.ts +2 -0
- package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.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 +64 -9
- package/dist/lite/firestore/src/local/local_store.d.ts +9 -0
- package/dist/lite/firestore/src/local/lru_garbage_collector_impl.d.ts +5 -5
- package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +1 -0
- package/dist/lite/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/lite/firestore/src/local/persistence.d.ts +3 -5
- package/dist/lite/firestore/src/local/persistence_promise.d.ts +11 -0
- package/dist/lite/firestore/src/local/query_engine.d.ts +1 -1
- package/dist/lite/firestore/src/model/collections.d.ts +8 -2
- 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 +8 -4
- package/dist/lite/firestore/src/util/async_queue.d.ts +5 -1
- package/dist/lite/firestore/test/unit/local/index_backfiller.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/lite/firestore/test/unit/specs/spec_test_components.d.ts +5 -3
- package/dist/lite/firestore/test/util/helpers.d.ts +13 -0
- package/dist/lite/index.browser.esm2017.js +1220 -738
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +1156 -764
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +2 -0
- package/dist/lite/index.node.cjs.js +655 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +655 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1184 -702
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +2916 -2898
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +106 -104
- package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -0
- package/dist/lite/packages/firestore/src/core/component_provider.d.ts +11 -6
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -0
- package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/lite/packages/firestore/src/local/index_backfiller.d.ts +44 -0
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +2 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.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 +64 -9
- package/dist/lite/packages/firestore/src/local/local_store.d.ts +9 -0
- package/dist/lite/packages/firestore/src/local/lru_garbage_collector_impl.d.ts +5 -5
- package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +1 -0
- package/dist/lite/packages/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/lite/packages/firestore/src/local/persistence.d.ts +3 -5
- package/dist/lite/packages/firestore/src/local/persistence_promise.d.ts +11 -0
- package/dist/lite/packages/firestore/src/local/query_engine.d.ts +1 -1
- package/dist/lite/packages/firestore/src/model/collections.d.ts +8 -2
- 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 +8 -4
- package/dist/lite/packages/firestore/src/util/async_queue.d.ts +5 -1
- package/dist/lite/packages/firestore/test/unit/local/index_backfiller.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -3
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +13 -0
- package/dist/lite/private.d.ts +2776 -2758
- package/dist/packages/firestore/dist/index.esm2017.d.ts +203 -201
- package/dist/packages/firestore/src/api/transaction.d.ts +2 -0
- package/dist/packages/firestore/src/core/component_provider.d.ts +11 -6
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -0
- package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +5 -0
- package/dist/packages/firestore/src/local/index_backfiller.d.ts +44 -0
- package/dist/packages/firestore/src/local/index_manager.d.ts +2 -0
- package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.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 +64 -9
- package/dist/packages/firestore/src/local/local_store.d.ts +9 -0
- package/dist/packages/firestore/src/local/lru_garbage_collector_impl.d.ts +5 -5
- package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +1 -0
- package/dist/packages/firestore/src/local/overlayed_document.d.ts +36 -0
- package/dist/packages/firestore/src/local/persistence.d.ts +3 -5
- package/dist/packages/firestore/src/local/persistence_promise.d.ts +11 -0
- package/dist/packages/firestore/src/local/query_engine.d.ts +1 -1
- package/dist/packages/firestore/src/model/collections.d.ts +8 -2
- 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 +8 -4
- package/dist/packages/firestore/src/util/async_queue.d.ts +5 -1
- package/dist/packages/firestore/test/unit/local/index_backfiller.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +1 -0
- package/dist/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -3
- package/dist/packages/firestore/test/util/helpers.d.ts +13 -0
- package/dist/private.d.ts +5845 -5672
- package/package.json +19 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @firebase/firestore
|
|
2
2
|
|
|
3
|
+
## 3.4.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2cd1cc76f`](https://github.com/firebase/firebase-js-sdk/commit/2cd1cc76f2a308135cd60f424fe09084a34b5cb5) [#6307](https://github.com/firebase/firebase-js-sdk/pull/6307) (fixes [#6300](https://github.com/firebase/firebase-js-sdk/issues/6300)) - fix: add type declarations to exports field
|
|
8
|
+
|
|
9
|
+
* [`d4b52b612`](https://github.com/firebase/firebase-js-sdk/commit/d4b52b612cf73610c57a3c08a0415ab7b622a70a) [#6321](https://github.com/firebase/firebase-js-sdk/pull/6321) - Fix incorrect paths in package.json
|
|
10
|
+
|
|
11
|
+
* Updated dependencies [[`2cd1cc76f`](https://github.com/firebase/firebase-js-sdk/commit/2cd1cc76f2a308135cd60f424fe09084a34b5cb5)]:
|
|
12
|
+
- @firebase/component@0.5.15
|
|
13
|
+
- @firebase/logger@0.3.3
|
|
14
|
+
- @firebase/util@1.6.1
|
|
15
|
+
- @firebase/webchannel-wrapper@0.6.2
|
|
16
|
+
|
|
3
17
|
## 3.4.9
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -51,6 +51,8 @@ export declare class Transaction extends LiteTransaction {
|
|
|
51
51
|
* transaction against.
|
|
52
52
|
* @param updateFunction - The function to execute within the transaction
|
|
53
53
|
* context.
|
|
54
|
+
* @param options - An options object to configure maximum number of attempts to
|
|
55
|
+
* commit.
|
|
54
56
|
* @returns If the transaction completed successfully or was explicitly aborted
|
|
55
57
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
56
58
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
@@ -18,7 +18,7 @@ import { CredentialsProvider } from '../api/credentials';
|
|
|
18
18
|
import { User } from '../auth/user';
|
|
19
19
|
import { IndexedDbPersistence } from '../local/indexeddb_persistence';
|
|
20
20
|
import { LocalStore } from '../local/local_store';
|
|
21
|
-
import {
|
|
21
|
+
import { Scheduler, Persistence } from '../local/persistence';
|
|
22
22
|
import { ClientId, SharedClientState } from '../local/shared_client_state';
|
|
23
23
|
import { Datastore } from '../remote/datastore';
|
|
24
24
|
import { RemoteStore } from '../remote/remote_store';
|
|
@@ -44,7 +44,8 @@ export interface OfflineComponentProvider {
|
|
|
44
44
|
persistence: Persistence;
|
|
45
45
|
sharedClientState: SharedClientState;
|
|
46
46
|
localStore: LocalStore;
|
|
47
|
-
gcScheduler:
|
|
47
|
+
gcScheduler: Scheduler | null;
|
|
48
|
+
indexBackfillerScheduler: Scheduler | null;
|
|
48
49
|
synchronizeTabs: boolean;
|
|
49
50
|
initialize(cfg: ComponentConfiguration): Promise<void>;
|
|
50
51
|
terminate(): Promise<void>;
|
|
@@ -57,11 +58,13 @@ export declare class MemoryOfflineComponentProvider implements OfflineComponentP
|
|
|
57
58
|
persistence: Persistence;
|
|
58
59
|
sharedClientState: SharedClientState;
|
|
59
60
|
localStore: LocalStore;
|
|
60
|
-
gcScheduler:
|
|
61
|
+
gcScheduler: Scheduler | null;
|
|
62
|
+
indexBackfillerScheduler: Scheduler | null;
|
|
61
63
|
synchronizeTabs: boolean;
|
|
62
64
|
serializer: JsonProtoSerializer;
|
|
63
65
|
initialize(cfg: ComponentConfiguration): Promise<void>;
|
|
64
|
-
createGarbageCollectionScheduler(cfg: ComponentConfiguration):
|
|
66
|
+
createGarbageCollectionScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null;
|
|
67
|
+
createIndexBackfillerScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null;
|
|
65
68
|
createLocalStore(cfg: ComponentConfiguration): LocalStore;
|
|
66
69
|
createPersistence(cfg: ComponentConfiguration): Persistence;
|
|
67
70
|
createSharedClientState(cfg: ComponentConfiguration): SharedClientState;
|
|
@@ -77,12 +80,14 @@ export declare class IndexedDbOfflineComponentProvider extends MemoryOfflineComp
|
|
|
77
80
|
persistence: IndexedDbPersistence;
|
|
78
81
|
sharedClientState: SharedClientState;
|
|
79
82
|
localStore: LocalStore;
|
|
80
|
-
gcScheduler:
|
|
83
|
+
gcScheduler: Scheduler | null;
|
|
84
|
+
indexBackfillerScheduler: Scheduler | null;
|
|
81
85
|
synchronizeTabs: boolean;
|
|
82
86
|
constructor(onlineComponentProvider: OnlineComponentProvider, cacheSizeBytes: number | undefined, forceOwnership: boolean | undefined);
|
|
83
87
|
initialize(cfg: ComponentConfiguration): Promise<void>;
|
|
84
88
|
createLocalStore(cfg: ComponentConfiguration): LocalStore;
|
|
85
|
-
createGarbageCollectionScheduler(cfg: ComponentConfiguration):
|
|
89
|
+
createGarbageCollectionScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null;
|
|
90
|
+
createIndexBackfillerScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null;
|
|
86
91
|
createPersistence(cfg: ComponentConfiguration): IndexedDbPersistence;
|
|
87
92
|
createSharedClientState(cfg: ComponentConfiguration): SharedClientState;
|
|
88
93
|
}
|
|
@@ -112,6 +112,8 @@ export declare class Transaction {
|
|
|
112
112
|
* transaction against.
|
|
113
113
|
* @param updateFunction - The function to execute within the transaction
|
|
114
114
|
* context.
|
|
115
|
+
* @param options - An options object to configure maximum number of attempts to
|
|
116
|
+
* commit.
|
|
115
117
|
* @returns If the transaction completed successfully or was explicitly aborted
|
|
116
118
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
117
119
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
@@ -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: DocumentKey[]): 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`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AsyncQueue } from '../util/async_queue';
|
|
2
|
+
import { LocalStore } from './local_store';
|
|
3
|
+
import { Persistence, Scheduler } from './persistence';
|
|
4
|
+
/** This class is responsible for the scheduling of Index Backfiller. */
|
|
5
|
+
export declare class IndexBackfillerScheduler implements Scheduler {
|
|
6
|
+
private readonly asyncQueue;
|
|
7
|
+
private readonly backfiller;
|
|
8
|
+
private task;
|
|
9
|
+
constructor(asyncQueue: AsyncQueue, backfiller: IndexBackfiller);
|
|
10
|
+
start(): void;
|
|
11
|
+
stop(): void;
|
|
12
|
+
get started(): boolean;
|
|
13
|
+
private schedule;
|
|
14
|
+
}
|
|
15
|
+
/** Implements the steps for backfilling indexes. */
|
|
16
|
+
export declare class IndexBackfiller {
|
|
17
|
+
/**
|
|
18
|
+
* LocalStore provides access to IndexManager and LocalDocumentView.
|
|
19
|
+
* These properties will update when the user changes. Consequently,
|
|
20
|
+
* making a local copy of IndexManager and LocalDocumentView will require
|
|
21
|
+
* updates over time. The simpler solution is to rely on LocalStore to have
|
|
22
|
+
* an up-to-date references to IndexManager and LocalDocumentStore.
|
|
23
|
+
*/
|
|
24
|
+
private readonly localStore;
|
|
25
|
+
private readonly persistence;
|
|
26
|
+
constructor(
|
|
27
|
+
/**
|
|
28
|
+
* LocalStore provides access to IndexManager and LocalDocumentView.
|
|
29
|
+
* These properties will update when the user changes. Consequently,
|
|
30
|
+
* making a local copy of IndexManager and LocalDocumentView will require
|
|
31
|
+
* updates over time. The simpler solution is to rely on LocalStore to have
|
|
32
|
+
* an up-to-date references to IndexManager and LocalDocumentStore.
|
|
33
|
+
*/
|
|
34
|
+
localStore: LocalStore, persistence: Persistence);
|
|
35
|
+
backfill(maxDocumentsToProcess?: number): Promise<number>;
|
|
36
|
+
/** Writes index entries until the cap is reached. Returns the number of documents processed. */
|
|
37
|
+
private writeIndexEntries;
|
|
38
|
+
/**
|
|
39
|
+
* Writes entries for the provided collection group. Returns the number of documents processed.
|
|
40
|
+
*/
|
|
41
|
+
private writeEntriesForCollectionGroup;
|
|
42
|
+
/** Returns the next offset based on the provided documents. */
|
|
43
|
+
private getNewOffset;
|
|
44
|
+
}
|
|
@@ -114,4 +114,6 @@ export interface IndexManager {
|
|
|
114
114
|
* and returns the minimum offset of them all.
|
|
115
115
|
*/
|
|
116
116
|
getMinOffset(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexOffset>;
|
|
117
|
+
/** Returns the minimum offset for the given collection group. */
|
|
118
|
+
getMinOffsetFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<IndexOffset>;
|
|
117
119
|
}
|
|
@@ -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: DocumentKey[]): 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>;
|
|
@@ -128,5 +128,6 @@ export declare class IndexedDbIndexManager implements IndexManager {
|
|
|
128
128
|
* '[foo > 2 && foo != 3]` becomes `[foo > 2 && < 3, foo > 3]`.
|
|
129
129
|
*/
|
|
130
130
|
private createRange;
|
|
131
|
+
getMinOffsetFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<IndexOffset>;
|
|
131
132
|
getMinOffset(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexOffset>;
|
|
132
133
|
}
|
|
@@ -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,11 +15,14 @@
|
|
|
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, OverlayedDocumentMap } 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';
|
|
25
|
+
import { LocalWriteResult } from './local_store_impl';
|
|
23
26
|
import { MutationQueue } from './mutation_queue';
|
|
24
27
|
import { PersistencePromise } from './persistence_promise';
|
|
25
28
|
import { PersistenceTransaction } from './persistence_transaction';
|
|
@@ -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<OverlayedDocumentMap>;
|
|
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<OverlayedDocumentMap>;
|
|
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
|
*
|
|
@@ -65,7 +102,25 @@ export declare class LocalDocumentsView {
|
|
|
65
102
|
* @param offset - Read time and key to start scanning by (exclusive).
|
|
66
103
|
*/
|
|
67
104
|
getDocumentsMatchingQuery(transaction: PersistenceTransaction, query: Query, offset: IndexOffset): PersistencePromise<DocumentMap>;
|
|
105
|
+
/**
|
|
106
|
+
* Given a collection group, returns the next documents that follow the provided offset, along
|
|
107
|
+
* with an updated batch ID.
|
|
108
|
+
*
|
|
109
|
+
* <p>The documents returned by this method are ordered by remote version from the provided
|
|
110
|
+
* offset. If there are no more remote documents after the provided offset, documents with
|
|
111
|
+
* mutations in order of batch id from the offset are returned. Since all documents in a batch are
|
|
112
|
+
* returned together, the total number of documents returned can exceed {@code count}.
|
|
113
|
+
*
|
|
114
|
+
* @param transaction
|
|
115
|
+
* @param collectionGroup The collection group for the documents.
|
|
116
|
+
* @param offset The offset to index into.
|
|
117
|
+
* @param count The number of documents to return
|
|
118
|
+
* @return A LocalWriteResult with the documents that follow the provided offset and the last processed batch id.
|
|
119
|
+
*/
|
|
120
|
+
getNextDocuments(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset, count: number): PersistencePromise<LocalWriteResult>;
|
|
68
121
|
private getDocumentsMatchingDocumentQuery;
|
|
69
122
|
private getDocumentsMatchingCollectionGroupQuery;
|
|
70
123
|
private getDocumentsMatchingCollectionQuery;
|
|
124
|
+
/** Returns a base document that can be used to apply `overlay`. */
|
|
125
|
+
private getBaseDocument;
|
|
71
126
|
}
|
|
@@ -15,9 +15,18 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { FirestoreError } from '../util/error';
|
|
18
|
+
import { IndexManager } from './index_manager';
|
|
19
|
+
import { LocalDocumentsView } from './local_documents_view';
|
|
18
20
|
import { LruGarbageCollector, LruResults } from './lru_garbage_collector';
|
|
19
21
|
export interface LocalStore {
|
|
20
22
|
collectGarbage(garbageCollector: LruGarbageCollector): Promise<LruResults>;
|
|
23
|
+
/** Manages the list of active field and collection indices. */
|
|
24
|
+
indexManager: IndexManager;
|
|
25
|
+
/**
|
|
26
|
+
* The "local" view of all documents (layering mutationQueue on top of
|
|
27
|
+
* remoteDocumentCache).
|
|
28
|
+
*/
|
|
29
|
+
localDocuments: LocalDocumentsView;
|
|
21
30
|
}
|
|
22
31
|
/**
|
|
23
32
|
* Verifies the error thrown by a LocalStore operation. If a LocalStore
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
import { AsyncQueue } from '../util/async_queue';
|
|
18
18
|
import { LocalStore } from './local_store';
|
|
19
19
|
import { LruDelegate, LruGarbageCollector, LruParams } from './lru_garbage_collector';
|
|
20
|
-
import {
|
|
20
|
+
import { Scheduler } from './persistence';
|
|
21
21
|
export declare const LRU_MINIMUM_CACHE_SIZE_BYTES: number;
|
|
22
22
|
/**
|
|
23
23
|
* This class is responsible for the scheduling of LRU garbage collection. It handles checking
|
|
24
24
|
* whether or not GC is enabled, as well as which delay to use before the next run.
|
|
25
25
|
*/
|
|
26
|
-
export declare class LruScheduler implements
|
|
26
|
+
export declare class LruScheduler implements Scheduler {
|
|
27
27
|
private readonly garbageCollector;
|
|
28
28
|
private readonly asyncQueue;
|
|
29
|
-
private
|
|
29
|
+
private readonly localStore;
|
|
30
30
|
private gcTask;
|
|
31
|
-
constructor(garbageCollector: LruGarbageCollector, asyncQueue: AsyncQueue);
|
|
32
|
-
start(
|
|
31
|
+
constructor(garbageCollector: LruGarbageCollector, asyncQueue: AsyncQueue, localStore: LocalStore);
|
|
32
|
+
start(): void;
|
|
33
33
|
stop(): void;
|
|
34
34
|
get started(): boolean;
|
|
35
35
|
private scheduleGC;
|
|
@@ -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: DocumentKey[]): 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>;
|
|
@@ -36,6 +36,7 @@ export declare class MemoryIndexManager implements IndexManager {
|
|
|
36
36
|
getFieldIndexes(transaction: PersistenceTransaction, collectionGroup?: string): PersistencePromise<FieldIndex[]>;
|
|
37
37
|
getNextCollectionGroupToUpdate(transaction: PersistenceTransaction): PersistencePromise<string | null>;
|
|
38
38
|
getMinOffset(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexOffset>;
|
|
39
|
+
getMinOffsetFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<IndexOffset>;
|
|
39
40
|
updateCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string, offset: IndexOffset): PersistencePromise<void>;
|
|
40
41
|
updateIndexEntries(transaction: PersistenceTransaction, documents: DocumentMap): PersistencePromise<void>;
|
|
41
42
|
}
|
|
@@ -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
|
+
}
|
|
@@ -20,7 +20,6 @@ import { DocumentKey } from '../model/document_key';
|
|
|
20
20
|
import { BundleCache } from './bundle_cache';
|
|
21
21
|
import { DocumentOverlayCache } from './document_overlay_cache';
|
|
22
22
|
import { IndexManager } from './index_manager';
|
|
23
|
-
import { LocalStore } from './local_store';
|
|
24
23
|
import { MutationQueue } from './mutation_queue';
|
|
25
24
|
import { PersistencePromise } from './persistence_promise';
|
|
26
25
|
import { PersistenceTransaction, PersistenceTransactionMode } from './persistence_transaction';
|
|
@@ -204,11 +203,10 @@ export interface Persistence {
|
|
|
204
203
|
runTransaction<T>(action: string, mode: PersistenceTransactionMode, transactionOperation: (transaction: PersistenceTransaction) => PersistencePromise<T>): Promise<T>;
|
|
205
204
|
}
|
|
206
205
|
/**
|
|
207
|
-
* Interface
|
|
208
|
-
* garbage collection.
|
|
206
|
+
* Interface to schedule periodic tasks within SDK.
|
|
209
207
|
*/
|
|
210
|
-
export interface
|
|
208
|
+
export interface Scheduler {
|
|
211
209
|
readonly started: boolean;
|
|
212
|
-
start(
|
|
210
|
+
start(): void;
|
|
213
211
|
stop(): void;
|
|
214
212
|
}
|
|
@@ -69,4 +69,15 @@ export declare class PersistencePromise<T> {
|
|
|
69
69
|
static forEach<R>(collection: {
|
|
70
70
|
forEach: (cb: (r: R) => void) => void;
|
|
71
71
|
}, f: (r: R) => PersistencePromise<void>): PersistencePromise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Concurrently map all array elements through asynchronous function.
|
|
74
|
+
*/
|
|
75
|
+
static mapArray<T, U>(array: T[], f: (t: T) => PersistencePromise<U>): PersistencePromise<U[]>;
|
|
76
|
+
/**
|
|
77
|
+
* An alternative to recursive PersistencePromise calls, that avoids
|
|
78
|
+
* potential memory problems from unbounded chains of promises.
|
|
79
|
+
*
|
|
80
|
+
* The `action` will be called repeatedly while `condition` is true.
|
|
81
|
+
*/
|
|
82
|
+
static doWhile(condition: () => boolean, action: () => PersistencePromise<void>): PersistencePromise<void>;
|
|
72
83
|
}
|
|
@@ -83,7 +83,7 @@ export declare class QueryEngine {
|
|
|
83
83
|
* Determines if a limit query needs to be refilled from cache, making it
|
|
84
84
|
* ineligible for index-free execution.
|
|
85
85
|
*
|
|
86
|
-
* @param query The query.
|
|
86
|
+
* @param query - The query.
|
|
87
87
|
* @param sortedPreviousResults - The documents that matched the query when it
|
|
88
88
|
* was last synchronized, sorted by the query's comparator.
|
|
89
89
|
* @param remoteKeys - The document keys that matched the query at the last
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { SnapshotVersion } from '../core/snapshot_version';
|
|
18
18
|
import { TargetId } from '../core/types';
|
|
19
|
+
import { OverlayedDocument } from '../local/overlayed_document';
|
|
19
20
|
import { ObjectMap } from '../util/obj_map';
|
|
20
21
|
import { SortedMap } from '../util/sorted_map';
|
|
21
22
|
import { SortedSet } from '../util/sorted_set';
|
|
@@ -32,10 +33,15 @@ export interface DocumentSizeEntries {
|
|
|
32
33
|
}
|
|
33
34
|
export declare type DocumentMap = SortedMap<DocumentKey, Document>;
|
|
34
35
|
export declare function documentMap(...docs: Document[]): DocumentMap;
|
|
35
|
-
export declare type
|
|
36
|
+
export declare type OverlayedDocumentMap = DocumentKeyMap<OverlayedDocument>;
|
|
37
|
+
export declare function newOverlayedDocumentMap(): OverlayedDocumentMap;
|
|
38
|
+
export declare function convertOverlayedDocumentMapToDocumentMap(collection: OverlayedDocumentMap): DocumentMap;
|
|
39
|
+
export declare type OverlayMap = DocumentKeyMap<Overlay>;
|
|
36
40
|
export declare function newOverlayMap(): OverlayMap;
|
|
37
|
-
export declare type MutationMap =
|
|
41
|
+
export declare type MutationMap = DocumentKeyMap<Mutation>;
|
|
38
42
|
export declare function newMutationMap(): MutationMap;
|
|
43
|
+
export declare type DocumentKeyMap<T> = ObjectMap<DocumentKey, T>;
|
|
44
|
+
export declare function newDocumentKeyMap<T>(): DocumentKeyMap<T>;
|
|
39
45
|
export declare type DocumentVersionMap = SortedMap<DocumentKey, SnapshotVersion>;
|
|
40
46
|
export declare function documentVersionMap(): DocumentVersionMap;
|
|
41
47
|
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,9 @@
|
|
|
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 { DocumentKeySet,
|
|
20
|
+
import { DocumentKeySet, MutationMap, DocumentVersionMap, OverlayedDocumentMap } from './collections';
|
|
21
21
|
import { MutableDocument } from './document';
|
|
22
|
+
import { FieldMask } from './field_mask';
|
|
22
23
|
import { Mutation, MutationResult } from './mutation';
|
|
23
24
|
/**
|
|
24
25
|
* A batch of mutations that will be sent as one unit to the backend.
|
|
@@ -54,13 +55,16 @@ export declare class MutationBatch {
|
|
|
54
55
|
* batch.
|
|
55
56
|
*
|
|
56
57
|
* @param document - The document to apply mutations to.
|
|
58
|
+
* @param mutatedFields - Fields that have been updated before applying this mutation batch.
|
|
59
|
+
* @returns A `FieldMask` representing all the fields that are mutated.
|
|
57
60
|
*/
|
|
58
|
-
applyToLocalView(document: MutableDocument):
|
|
61
|
+
applyToLocalView(document: MutableDocument, mutatedFields: FieldMask | null): FieldMask | null;
|
|
59
62
|
/**
|
|
60
63
|
* Computes the local view for all provided documents given the mutations in
|
|
61
|
-
* this batch.
|
|
64
|
+
* this batch. Returns a `DocumentKey` to `Mutation` map which can be used to
|
|
65
|
+
* replace all the mutation applications.
|
|
62
66
|
*/
|
|
63
|
-
applyToLocalDocumentSet(documentMap:
|
|
67
|
+
applyToLocalDocumentSet(documentMap: OverlayedDocumentMap, documentsWithoutRemoteVersion: DocumentKeySet): MutationMap;
|
|
64
68
|
keys(): DocumentKeySet;
|
|
65
69
|
isEqual(other: MutationBatch): boolean;
|
|
66
70
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "0.1.2"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "0.1.2"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|