@firebase/firestore 3.4.6-canary.69aa7b02d → 3.4.7-2022222232915

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/firestore/src/core/bundle.d.ts +2 -2
  3. package/dist/firestore/src/core/bundle_impl.d.ts +2 -0
  4. package/dist/firestore/src/core/query.d.ts +7 -0
  5. package/dist/firestore/src/core/sync_engine_impl.d.ts +1 -1
  6. package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
  7. package/dist/firestore/src/local/indexeddb_sentinels.d.ts +0 -8
  8. package/dist/firestore/src/local/local_store_impl.d.ts +1 -7
  9. package/dist/firestore/src/local/shared_client_state.d.ts +6 -3
  10. package/dist/firestore/src/local/shared_client_state_schema.d.ts +1 -1
  11. package/dist/firestore/src/local/shared_client_state_syncer.d.ts +1 -1
  12. package/dist/index.esm2017.js +2052 -2083
  13. package/dist/index.esm2017.js.map +1 -1
  14. package/dist/index.esm5.js +3047 -3051
  15. package/dist/index.esm5.js.map +1 -1
  16. package/dist/index.node.cjs.js +72 -117
  17. package/dist/index.node.cjs.js.map +1 -1
  18. package/dist/index.node.mjs +72 -117
  19. package/dist/index.node.mjs.map +1 -1
  20. package/dist/index.rn.js +2061 -2092
  21. package/dist/index.rn.js.map +1 -1
  22. package/dist/internal.d.ts +3 -1
  23. package/dist/lite/firestore/src/core/bundle.d.ts +2 -2
  24. package/dist/lite/firestore/src/core/bundle_impl.d.ts +2 -0
  25. package/dist/lite/firestore/src/core/query.d.ts +7 -0
  26. package/dist/lite/firestore/src/core/sync_engine_impl.d.ts +1 -1
  27. package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
  28. package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +0 -8
  29. package/dist/lite/firestore/src/local/local_store_impl.d.ts +1 -7
  30. package/dist/lite/firestore/src/local/shared_client_state.d.ts +6 -3
  31. package/dist/lite/firestore/src/local/shared_client_state_schema.d.ts +1 -1
  32. package/dist/lite/firestore/src/local/shared_client_state_syncer.d.ts +1 -1
  33. package/dist/lite/index.browser.esm2017.js +73 -73
  34. package/dist/lite/index.browser.esm2017.js.map +1 -1
  35. package/dist/lite/index.browser.esm5.js +8 -8
  36. package/dist/lite/index.browser.esm5.js.map +1 -1
  37. package/dist/lite/index.node.cjs.js +2 -2
  38. package/dist/lite/index.node.cjs.js.map +1 -1
  39. package/dist/lite/index.node.mjs +2 -2
  40. package/dist/lite/index.node.mjs.map +1 -1
  41. package/dist/lite/index.rn.esm2017.js +2 -2
  42. package/dist/lite/index.rn.esm2017.js.map +1 -1
  43. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +18 -18
  44. package/dist/lite/packages/firestore/src/core/bundle.d.ts +2 -2
  45. package/dist/lite/packages/firestore/src/core/bundle_impl.d.ts +2 -0
  46. package/dist/lite/packages/firestore/src/core/query.d.ts +7 -0
  47. package/dist/lite/packages/firestore/src/core/sync_engine_impl.d.ts +1 -1
  48. package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
  49. package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +0 -8
  50. package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +1 -7
  51. package/dist/lite/packages/firestore/src/local/shared_client_state.d.ts +6 -3
  52. package/dist/lite/packages/firestore/src/local/shared_client_state_schema.d.ts +1 -1
  53. package/dist/lite/packages/firestore/src/local/shared_client_state_syncer.d.ts +1 -1
  54. package/dist/packages/firestore/dist/index.esm2017.d.ts +55 -55
  55. package/dist/packages/firestore/src/core/bundle.d.ts +2 -2
  56. package/dist/packages/firestore/src/core/bundle_impl.d.ts +2 -0
  57. package/dist/packages/firestore/src/core/query.d.ts +7 -0
  58. package/dist/packages/firestore/src/core/sync_engine_impl.d.ts +1 -1
  59. package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +0 -17
  60. package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +0 -8
  61. package/dist/packages/firestore/src/local/local_store_impl.d.ts +1 -7
  62. package/dist/packages/firestore/src/local/shared_client_state.d.ts +6 -3
  63. package/dist/packages/firestore/src/local/shared_client_state_schema.d.ts +1 -1
  64. package/dist/packages/firestore/src/local/shared_client_state_syncer.d.ts +1 -1
  65. package/dist/private.d.ts +3 -1
  66. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @firebase/firestore
2
2
 
3
+ ## 3.4.7-2022222232915
4
+
5
+ ### Patch Changes
6
+
7
+ - [`69aa7b02d`](https://github.com/firebase/firebase-js-sdk/commit/69aa7b02df3b4d1f9832b7713951936b6bf32ca9) [#5988](https://github.com/firebase/firebase-js-sdk/pull/5988) - The format of some of the IndexedDB data changed. This increases the performance of document lookups after an initial migration. If you do not want to migrate data, you can call `clearIndexedDbPersistence()` before invoking `enableIndexedDbPersistence()`.
8
+
9
+ - Updated dependencies [[`3198d58dc`](https://github.com/firebase/firebase-js-sdk/commit/3198d58dcedbf7583914dbcc76984f6f7df8d2ef)]:
10
+ - @firebase/util@1.5.1-2022222232915
11
+ - @firebase/app@0.7.20-2022222232915
12
+ - @firebase/component@0.5.12-2022222232915
13
+
3
14
  ## 3.4.6
4
15
 
5
16
  ### Patch Changes
@@ -34,10 +34,10 @@ export interface BundledDocument {
34
34
  * An array of `BundledDocument`.
35
35
  */
36
36
  export declare type BundledDocuments = BundledDocument[];
37
- export declare class BundleLoadResult {
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.
@@ -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. */
@@ -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>;
@@ -95,14 +95,6 @@ export declare type DbRemoteDocumentKey = [
95
95
  * access by collection path and read time.
96
96
  */
97
97
  export declare const DbRemoteDocumentKeyPath: string[];
98
- /**
99
- * An index that provides access to all entries sorted by read time (which
100
- * corresponds to the last modification time of each row).
101
- *
102
- * This index is used to provide a changelog for Multi-Tab.
103
- */
104
- export declare const DbRemoteDocumentReadTimeIndex = "readTimeIndex";
105
- export declare const DbRemoteDocumentReadTimeIndexPath = "readTime";
106
98
  /** An index that provides access to documents by key. */
107
99
  export declare const DbRemoteDocumentDocumentKeyIndex = "documentKeyIndex";
108
100
  export declare const DbRemoteDocumentDocumentKeyIndexPath: string[];
@@ -165,13 +165,7 @@ export declare function localStoreGetCachedTarget(localStore: LocalStore, target
165
165
  * initialization. Further invocations will return document that have changed
166
166
  * since the prior call.
167
167
  */
168
- export declare function localStoreGetNewDocumentChanges(localStore: LocalStore): Promise<DocumentMap>;
169
- /**
170
- * Reads the newest document change from persistence and moves the internal
171
- * synchronization marker forward so that calls to `getNewDocumentChanges()`
172
- * only return changes that happened after client initialization.
173
- */
174
- export declare function localStoreSynchronizeLastDocumentChangeReadTime(localStore: LocalStore): Promise<void>;
168
+ export declare function localStoreGetNewDocumentChanges(localStore: LocalStore, collectionGroup: string): Promise<DocumentMap>;
175
169
  /**
176
170
  * Applies the documents from a bundle to the "ground-state" (remote)
177
171
  * documents.
@@ -113,8 +113,10 @@ export interface SharedClientState {
113
113
  /**
114
114
  * Notifies other clients when remote documents have changed due to loading
115
115
  * a bundle.
116
+ *
117
+ * @param collectionGroups The collection groups affected by this bundle.
116
118
  */
117
- notifyBundleLoaded(): void;
119
+ notifyBundleLoaded(collectionGroups: Set<string>): void;
118
120
  }
119
121
  /**
120
122
  * Holds the state of a mutation batch, including its user ID, batch ID and
@@ -237,7 +239,7 @@ export declare class WebStorageSharedClientState implements SharedClientState {
237
239
  updateQueryState(targetId: TargetId, state: QueryTargetState, error?: FirestoreError): void;
238
240
  handleUserChange(user: User, removedBatchIds: BatchId[], addedBatchIds: BatchId[]): void;
239
241
  setOnlineState(onlineState: OnlineState): void;
240
- notifyBundleLoaded(): void;
242
+ notifyBundleLoaded(collectionGroups: Set<string>): void;
241
243
  shutdown(): void;
242
244
  private getItem;
243
245
  private setItem;
@@ -275,6 +277,7 @@ export declare class WebStorageSharedClientState implements SharedClientState {
275
277
  * could not be parsed.
276
278
  */
277
279
  private fromWebStorageOnlineState;
280
+ private fromWebStoreBundleLoadedState;
278
281
  private handleMutationBatchEvent;
279
282
  private handleQueryTargetEvent;
280
283
  private handleClientStateEvent;
@@ -305,5 +308,5 @@ export declare class MemorySharedClientState implements SharedClientState {
305
308
  setOnlineState(onlineState: OnlineState): void;
306
309
  shutdown(): void;
307
310
  writeSequenceNumber(sequenceNumber: ListenSequenceNumber): void;
308
- notifyBundleLoaded(): void;
311
+ notifyBundleLoaded(collectionGroups: Set<string>): void;
309
312
  }
@@ -64,7 +64,7 @@ export interface QueryTargetStateSchema {
64
64
  export declare const ONLINE_STATE_KEY_PREFIX = "firestore_online_state";
65
65
  /** Assembles the key for the online state of the primary tab. */
66
66
  export declare function createWebStorageOnlineStateKey(persistenceKey: string): string;
67
- export declare const BUNDLE_LOADED_KEY_PREFIX = "firestore_bundle_loaded";
67
+ export declare const BUNDLE_LOADED_KEY_PREFIX = "firestore_bundle_loaded_v2";
68
68
  export declare function createBundleLoadedKey(persistenceKey: string): string;
69
69
  /**
70
70
  * The JSON representation of the system's online state, as written by the
@@ -36,5 +36,5 @@ export interface SharedClientStateSyncer {
36
36
  * Retrieves newly changed documents from remote document cache and raises
37
37
  * snapshots if needed.
38
38
  */
39
- synchronizeWithChangedDocuments(): Promise<void>;
39
+ synchronizeWithChangedDocuments(collectionGroup: string): Promise<void>;
40
40
  }