@firebase/firestore 3.6.0 → 3.7.0-20221010190246
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 +16 -0
- package/dist/firestore/src/core/view.d.ts +1 -0
- package/dist/firestore/src/core/view_snapshot.d.ts +3 -2
- package/dist/firestore/src/remote/remote_event.d.ts +2 -2
- package/dist/firestore/test/util/api_helpers.d.ts +1 -1
- package/dist/index.esm2017.js +38 -36
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +132 -130
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +29 -21
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +29 -21
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +38 -36
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +5 -4
- package/dist/lite/firestore/src/core/view.d.ts +1 -0
- package/dist/lite/firestore/src/core/view_snapshot.d.ts +3 -2
- package/dist/lite/firestore/src/remote/remote_event.d.ts +2 -2
- package/dist/lite/firestore/test/util/api_helpers.d.ts +1 -1
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/src/core/view.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/view_snapshot.d.ts +3 -2
- package/dist/lite/packages/firestore/src/remote/remote_event.d.ts +2 -2
- package/dist/lite/packages/firestore/test/util/api_helpers.d.ts +1 -1
- package/dist/packages/firestore/src/core/view.d.ts +1 -0
- package/dist/packages/firestore/src/core/view_snapshot.d.ts +3 -2
- package/dist/packages/firestore/src/remote/remote_event.d.ts +2 -2
- package/dist/packages/firestore/test/util/api_helpers.d.ts +1 -1
- package/dist/private.d.ts +5 -4
- package/package.json +8 -8
package/dist/index.node.cjs.js
CHANGED
|
@@ -33,7 +33,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
|
|
|
33
33
|
var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
|
|
34
34
|
|
|
35
35
|
const name = "@firebase/firestore";
|
|
36
|
-
const version$1 = "3.
|
|
36
|
+
const version$1 = "3.7.0-20221010190246";
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* @license
|
|
@@ -86,7 +86,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
86
86
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
87
87
|
User.MOCK_USER = new User('mock-user');
|
|
88
88
|
|
|
89
|
-
const version = "9.
|
|
89
|
+
const version = "9.12.0-20221010190246";
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @license
|
|
@@ -7591,9 +7591,9 @@ class RemoteEvent {
|
|
|
7591
7591
|
* CURRENT status change to a View, for queries executed in a different tab.
|
|
7592
7592
|
*/
|
|
7593
7593
|
// PORTING NOTE: Multi-tab only
|
|
7594
|
-
static createSynthesizedRemoteEventForCurrentChange(targetId, current) {
|
|
7594
|
+
static createSynthesizedRemoteEventForCurrentChange(targetId, current, resumeToken) {
|
|
7595
7595
|
const targetChanges = new Map();
|
|
7596
|
-
targetChanges.set(targetId, TargetChange.createSynthesizedTargetChangeForCurrentChange(targetId, current));
|
|
7596
|
+
targetChanges.set(targetId, TargetChange.createSynthesizedTargetChangeForCurrentChange(targetId, current, resumeToken));
|
|
7597
7597
|
return new RemoteEvent(SnapshotVersion.min(), targetChanges, targetIdSet(), mutableDocumentMap(), documentKeySet());
|
|
7598
7598
|
}
|
|
7599
7599
|
}
|
|
@@ -7646,8 +7646,8 @@ class TargetChange {
|
|
|
7646
7646
|
* apply a CURRENT status change to a View (for queries executed in a different
|
|
7647
7647
|
* tab) or for new queries (to raise snapshots with correct CURRENT status).
|
|
7648
7648
|
*/
|
|
7649
|
-
static createSynthesizedTargetChangeForCurrentChange(targetId, current) {
|
|
7650
|
-
return new TargetChange(
|
|
7649
|
+
static createSynthesizedTargetChangeForCurrentChange(targetId, current, resumeToken) {
|
|
7650
|
+
return new TargetChange(resumeToken, current, documentKeySet(), documentKeySet(), documentKeySet());
|
|
7651
7651
|
}
|
|
7652
7652
|
}
|
|
7653
7653
|
|
|
@@ -22362,7 +22362,7 @@ class DocumentChangeSet {
|
|
|
22362
22362
|
}
|
|
22363
22363
|
}
|
|
22364
22364
|
class ViewSnapshot {
|
|
22365
|
-
constructor(query, docs, oldDocs, docChanges, mutatedKeys, fromCache, syncStateChanged, excludesMetadataChanges) {
|
|
22365
|
+
constructor(query, docs, oldDocs, docChanges, mutatedKeys, fromCache, syncStateChanged, excludesMetadataChanges, hasCachedResults) {
|
|
22366
22366
|
this.query = query;
|
|
22367
22367
|
this.docs = docs;
|
|
22368
22368
|
this.oldDocs = oldDocs;
|
|
@@ -22371,22 +22371,24 @@ class ViewSnapshot {
|
|
|
22371
22371
|
this.fromCache = fromCache;
|
|
22372
22372
|
this.syncStateChanged = syncStateChanged;
|
|
22373
22373
|
this.excludesMetadataChanges = excludesMetadataChanges;
|
|
22374
|
+
this.hasCachedResults = hasCachedResults;
|
|
22374
22375
|
}
|
|
22375
22376
|
/** Returns a view snapshot as if all documents in the snapshot were added. */
|
|
22376
|
-
static fromInitialDocuments(query, documents, mutatedKeys, fromCache) {
|
|
22377
|
+
static fromInitialDocuments(query, documents, mutatedKeys, fromCache, hasCachedResults) {
|
|
22377
22378
|
const changes = [];
|
|
22378
22379
|
documents.forEach(doc => {
|
|
22379
22380
|
changes.push({ type: 0 /* Added */, doc });
|
|
22380
22381
|
});
|
|
22381
22382
|
return new ViewSnapshot(query, documents, DocumentSet.emptySet(documents), changes, mutatedKeys, fromCache,
|
|
22382
22383
|
/* syncStateChanged= */ true,
|
|
22383
|
-
/* excludesMetadataChanges= */ false);
|
|
22384
|
+
/* excludesMetadataChanges= */ false, hasCachedResults);
|
|
22384
22385
|
}
|
|
22385
22386
|
get hasPendingWrites() {
|
|
22386
22387
|
return !this.mutatedKeys.isEmpty();
|
|
22387
22388
|
}
|
|
22388
22389
|
isEqual(other) {
|
|
22389
22390
|
if (this.fromCache !== other.fromCache ||
|
|
22391
|
+
this.hasCachedResults !== other.hasCachedResults ||
|
|
22390
22392
|
this.syncStateChanged !== other.syncStateChanged ||
|
|
22391
22393
|
!this.mutatedKeys.isEqual(other.mutatedKeys) ||
|
|
22392
22394
|
!queryEquals(this.query, other.query) ||
|
|
@@ -22591,7 +22593,7 @@ class QueryListener {
|
|
|
22591
22593
|
}
|
|
22592
22594
|
}
|
|
22593
22595
|
snap = new ViewSnapshot(snap.query, snap.docs, snap.oldDocs, docChanges, snap.mutatedKeys, snap.fromCache, snap.syncStateChanged,
|
|
22594
|
-
/* excludesMetadataChanges= */ true);
|
|
22596
|
+
/* excludesMetadataChanges= */ true, snap.hasCachedResults);
|
|
22595
22597
|
}
|
|
22596
22598
|
let raisedEvent = false;
|
|
22597
22599
|
if (!this.raisedInitialEvent) {
|
|
@@ -22635,8 +22637,11 @@ class QueryListener {
|
|
|
22635
22637
|
if (this.options.waitForSyncWhenOnline && maybeOnline) {
|
|
22636
22638
|
return false;
|
|
22637
22639
|
}
|
|
22638
|
-
// Raise data from cache if we have any documents
|
|
22639
|
-
|
|
22640
|
+
// Raise data from cache if we have any documents, have cached results before,
|
|
22641
|
+
// or we are offline.
|
|
22642
|
+
return (!snap.docs.isEmpty() ||
|
|
22643
|
+
snap.hasCachedResults ||
|
|
22644
|
+
onlineState === "Offline" /* Offline */);
|
|
22640
22645
|
}
|
|
22641
22646
|
shouldRaiseEvent(snap) {
|
|
22642
22647
|
// We don't need to handle includeDocumentMetadataChanges here because
|
|
@@ -22656,7 +22661,7 @@ class QueryListener {
|
|
|
22656
22661
|
return false;
|
|
22657
22662
|
}
|
|
22658
22663
|
raiseInitialEvent(snap) {
|
|
22659
|
-
snap = ViewSnapshot.fromInitialDocuments(snap.query, snap.docs, snap.mutatedKeys, snap.fromCache);
|
|
22664
|
+
snap = ViewSnapshot.fromInitialDocuments(snap.query, snap.docs, snap.mutatedKeys, snap.fromCache, snap.hasCachedResults);
|
|
22660
22665
|
this.raisedInitialEvent = true;
|
|
22661
22666
|
this.queryObserver.next(snap);
|
|
22662
22667
|
}
|
|
@@ -22893,6 +22898,7 @@ class View {
|
|
|
22893
22898
|
this.query = query;
|
|
22894
22899
|
this._syncedDocuments = _syncedDocuments;
|
|
22895
22900
|
this.syncState = null;
|
|
22901
|
+
this.hasCachedResults = false;
|
|
22896
22902
|
/**
|
|
22897
22903
|
* A flag whether the view is current with the backend. A view is considered
|
|
22898
22904
|
* current after it has seen the current flag from the backend and did not
|
|
@@ -23087,7 +23093,9 @@ class View {
|
|
|
23087
23093
|
}
|
|
23088
23094
|
else {
|
|
23089
23095
|
const snap = new ViewSnapshot(this.query, docChanges.documentSet, oldDocs, changes, docChanges.mutatedKeys, newSyncState === 0 /* Local */, syncStateChanged,
|
|
23090
|
-
/* excludesMetadataChanges= */ false
|
|
23096
|
+
/* excludesMetadataChanges= */ false, targetChange
|
|
23097
|
+
? targetChange.resumeToken.approximateByteSize() > 0
|
|
23098
|
+
: false);
|
|
23091
23099
|
return {
|
|
23092
23100
|
snapshot: snap,
|
|
23093
23101
|
limboChanges
|
|
@@ -23214,7 +23222,7 @@ class View {
|
|
|
23214
23222
|
*/
|
|
23215
23223
|
// PORTING NOTE: Multi-tab only.
|
|
23216
23224
|
computeInitialSnapshot() {
|
|
23217
|
-
return ViewSnapshot.fromInitialDocuments(this.query, this.documentSet, this.mutatedKeys, this.syncState === 0 /* Local
|
|
23225
|
+
return ViewSnapshot.fromInitialDocuments(this.query, this.documentSet, this.mutatedKeys, this.syncState === 0 /* Local */, this.hasCachedResults);
|
|
23218
23226
|
}
|
|
23219
23227
|
}
|
|
23220
23228
|
function compareChangeType(c1, c2) {
|
|
@@ -23394,7 +23402,7 @@ async function syncEngineListen(syncEngine, query) {
|
|
|
23394
23402
|
}
|
|
23395
23403
|
const status = syncEngineImpl.sharedClientState.addLocalQueryTarget(targetData.targetId);
|
|
23396
23404
|
targetId = targetData.targetId;
|
|
23397
|
-
viewSnapshot = await initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId, status === 'current');
|
|
23405
|
+
viewSnapshot = await initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId, status === 'current', targetData.resumeToken);
|
|
23398
23406
|
}
|
|
23399
23407
|
return viewSnapshot;
|
|
23400
23408
|
}
|
|
@@ -23402,7 +23410,7 @@ async function syncEngineListen(syncEngine, query) {
|
|
|
23402
23410
|
* Registers a view for a previously unknown query and computes its initial
|
|
23403
23411
|
* snapshot.
|
|
23404
23412
|
*/
|
|
23405
|
-
async function initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId, current) {
|
|
23413
|
+
async function initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId, current, resumeToken) {
|
|
23406
23414
|
// PORTING NOTE: On Web only, we inject the code that registers new Limbo
|
|
23407
23415
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
23408
23416
|
// changes when user code includes queries.
|
|
@@ -23411,7 +23419,7 @@ async function initializeViewAndComputeSnapshot(syncEngineImpl, query, targetId,
|
|
|
23411
23419
|
/* usePreviousResults= */ true);
|
|
23412
23420
|
const view = new View(query, queryResult.remoteKeys);
|
|
23413
23421
|
const viewDocChanges = view.computeDocChanges(queryResult.documents);
|
|
23414
|
-
const synthesizedTargetChange = TargetChange.createSynthesizedTargetChangeForCurrentChange(targetId, current && syncEngineImpl.onlineState !== "Offline" /* Offline
|
|
23422
|
+
const synthesizedTargetChange = TargetChange.createSynthesizedTargetChangeForCurrentChange(targetId, current && syncEngineImpl.onlineState !== "Offline" /* Offline */, resumeToken);
|
|
23415
23423
|
const viewChange = view.applyChanges(viewDocChanges,
|
|
23416
23424
|
/* updateLimboDocuments= */ syncEngineImpl.isPrimaryClient, synthesizedTargetChange);
|
|
23417
23425
|
updateTrackedLimbos(syncEngineImpl, targetId, viewChange.limboChanges);
|
|
@@ -24041,7 +24049,7 @@ async function synchronizeQueryViewsAndRaiseSnapshots(syncEngine, targets, trans
|
|
|
24041
24049
|
const target = await localStoreGetCachedTarget(syncEngineImpl.localStore, targetId);
|
|
24042
24050
|
targetData = await localStoreAllocateTarget(syncEngineImpl.localStore, target);
|
|
24043
24051
|
await initializeViewAndComputeSnapshot(syncEngineImpl, synthesizeTargetToQuery(target), targetId,
|
|
24044
|
-
/*current=*/ false);
|
|
24052
|
+
/*current=*/ false, targetData.resumeToken);
|
|
24045
24053
|
}
|
|
24046
24054
|
activeQueries.push(targetData);
|
|
24047
24055
|
}
|
|
@@ -24084,7 +24092,7 @@ async function syncEngineApplyTargetState(syncEngine, targetId, state, error) {
|
|
|
24084
24092
|
case 'current':
|
|
24085
24093
|
case 'not-current': {
|
|
24086
24094
|
const changes = await localStoreGetNewDocumentChanges(syncEngineImpl.localStore, queryCollectionGroup(query[0]));
|
|
24087
|
-
const synthesizedRemoteEvent = RemoteEvent.createSynthesizedRemoteEventForCurrentChange(targetId, state === 'current');
|
|
24095
|
+
const synthesizedRemoteEvent = RemoteEvent.createSynthesizedRemoteEventForCurrentChange(targetId, state === 'current', ByteString.EMPTY_BYTE_STRING);
|
|
24088
24096
|
await syncEngineEmitNewSnapsAndNotifyLocalStore(syncEngineImpl, changes, synthesizedRemoteEvent);
|
|
24089
24097
|
break;
|
|
24090
24098
|
}
|
|
@@ -24114,7 +24122,7 @@ async function syncEngineApplyActiveTargetsChange(syncEngine, added, removed) {
|
|
|
24114
24122
|
const target = await localStoreGetCachedTarget(syncEngineImpl.localStore, targetId);
|
|
24115
24123
|
const targetData = await localStoreAllocateTarget(syncEngineImpl.localStore, target);
|
|
24116
24124
|
await initializeViewAndComputeSnapshot(syncEngineImpl, synthesizeTargetToQuery(target), targetData.targetId,
|
|
24117
|
-
/*current=*/ false);
|
|
24125
|
+
/*current=*/ false, targetData.resumeToken);
|
|
24118
24126
|
remoteStoreListen(syncEngineImpl.remoteStore, targetData);
|
|
24119
24127
|
}
|
|
24120
24128
|
for (const targetId of removed) {
|