@firebase/database-compat 0.2.1 → 0.2.2-canary.d3336a9cd
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 +10 -0
- package/dist/index.esm2017.js +1 -1
- package/dist/index.esm5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.standalone.js +65 -12
- package/dist/index.standalone.js.map +1 -1
- package/dist/node-esm/index.js +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @firebase/database-compat
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`578dc5836`](https://github.com/firebase/firebase-js-sdk/commit/578dc58365c6c71d8ad01dd8b9dbe829e76de068), [`efe2000fc`](https://github.com/firebase/firebase-js-sdk/commit/efe2000fc499e2c85c4e5e0fef6741ff3bad2eb0)]:
|
|
8
|
+
- @firebase/database@0.13.2
|
|
9
|
+
- @firebase/util@1.6.2
|
|
10
|
+
- @firebase/component@0.5.16
|
|
11
|
+
- @firebase/database-types@0.9.10
|
|
12
|
+
|
|
3
13
|
## 0.2.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.esm2017.js
CHANGED
package/dist/index.esm5.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
12
|
var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
|
|
13
13
|
|
|
14
14
|
var name = "@firebase/database-compat";
|
|
15
|
-
var version = "0.2.
|
|
15
|
+
var version = "0.2.2-canary.d3336a9cd";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
package/dist/index.standalone.js
CHANGED
|
@@ -6475,7 +6475,7 @@ function pathEquals(path, other) {
|
|
|
6475
6475
|
return true;
|
|
6476
6476
|
}
|
|
6477
6477
|
/**
|
|
6478
|
-
* @returns True if this path is a parent (or the same as) other
|
|
6478
|
+
* @returns True if this path is a parent of (or the same as) other
|
|
6479
6479
|
*/
|
|
6480
6480
|
function pathContains(path, other) {
|
|
6481
6481
|
var i = path.pieceNum_;
|
|
@@ -6741,9 +6741,6 @@ var PersistentConnection = /** @class */ (function (_super) {
|
|
|
6741
6741
|
onComplete: function (message) {
|
|
6742
6742
|
var payload = message['d'];
|
|
6743
6743
|
if (message['s'] === 'ok') {
|
|
6744
|
-
_this.onDataUpdate_(request['p'], payload,
|
|
6745
|
-
/*isMerge*/ false,
|
|
6746
|
-
/*tag*/ null);
|
|
6747
6744
|
deferred.resolve(payload);
|
|
6748
6745
|
}
|
|
6749
6746
|
else {
|
|
@@ -6783,7 +6780,7 @@ var PersistentConnection = /** @class */ (function (_super) {
|
|
|
6783
6780
|
this.listens.set(pathString, new Map());
|
|
6784
6781
|
}
|
|
6785
6782
|
util.assert(query._queryParams.isDefault() || !query._queryParams.loadsAllData(), 'listen() called for non-default but complete query');
|
|
6786
|
-
util.assert(!this.listens.get(pathString).has(queryId),
|
|
6783
|
+
util.assert(!this.listens.get(pathString).has(queryId), "listen() called twice for same path/queryId.");
|
|
6787
6784
|
var listenSpec = {
|
|
6788
6785
|
onComplete: onComplete,
|
|
6789
6786
|
hashFn: currentHashFn,
|
|
@@ -13528,6 +13525,30 @@ function syncTreeRemoveEventRegistration(syncTree, query, eventRegistration, can
|
|
|
13528
13525
|
}
|
|
13529
13526
|
return cancelEvents;
|
|
13530
13527
|
}
|
|
13528
|
+
/**
|
|
13529
|
+
* This function was added to support non-listener queries,
|
|
13530
|
+
* specifically for use in repoGetValue. It sets up all the same
|
|
13531
|
+
* local cache data-structures (SyncPoint + View) that are
|
|
13532
|
+
* needed for listeners without installing an event registration.
|
|
13533
|
+
* If `query` is not `loadsAllData`, it will also provision a tag for
|
|
13534
|
+
* the query so that query results can be merged into the sync
|
|
13535
|
+
* tree using existing logic for tagged listener queries.
|
|
13536
|
+
*
|
|
13537
|
+
* @param syncTree - Synctree to add the query to.
|
|
13538
|
+
* @param query - Query to register
|
|
13539
|
+
* @returns tag as a string if query is not a default query, null if query is not.
|
|
13540
|
+
*/
|
|
13541
|
+
function syncTreeRegisterQuery(syncTree, query) {
|
|
13542
|
+
var _a = syncTreeRegisterSyncPoint(query, syncTree), syncPoint = _a.syncPoint, serverCache = _a.serverCache, writesCache = _a.writesCache, serverCacheComplete = _a.serverCacheComplete;
|
|
13543
|
+
var view = syncPointGetView(syncPoint, query, writesCache, serverCache, serverCacheComplete);
|
|
13544
|
+
if (!syncPoint.views.has(query._queryIdentifier)) {
|
|
13545
|
+
syncPoint.views.set(query._queryIdentifier, view);
|
|
13546
|
+
}
|
|
13547
|
+
if (!query._queryParams.loadsAllData()) {
|
|
13548
|
+
return syncTreeTagForQuery_(syncTree, query);
|
|
13549
|
+
}
|
|
13550
|
+
return null;
|
|
13551
|
+
}
|
|
13531
13552
|
/**
|
|
13532
13553
|
* Apply new server data for the specified tagged query.
|
|
13533
13554
|
*
|
|
@@ -13568,11 +13589,11 @@ function syncTreeApplyTaggedQueryMerge(syncTree, path, changedChildren, tag) {
|
|
|
13568
13589
|
}
|
|
13569
13590
|
}
|
|
13570
13591
|
/**
|
|
13571
|
-
*
|
|
13572
|
-
*
|
|
13573
|
-
*
|
|
13592
|
+
* Creates a new syncpoint for a query and creates a tag if the view doesn't exist.
|
|
13593
|
+
* Extracted from addEventRegistration to allow `repoGetValue` to properly set up the SyncTree
|
|
13594
|
+
* without actually listening on a query.
|
|
13574
13595
|
*/
|
|
13575
|
-
function
|
|
13596
|
+
function syncTreeRegisterSyncPoint(query, syncTree) {
|
|
13576
13597
|
var path = query._path;
|
|
13577
13598
|
var serverCache = null;
|
|
13578
13599
|
var foundAncestorDefaultView = false;
|
|
@@ -13621,6 +13642,22 @@ function syncTreeAddEventRegistration(syncTree, query, eventRegistration) {
|
|
|
13621
13642
|
syncTree.tagToQueryMap.set(tag, queryKey);
|
|
13622
13643
|
}
|
|
13623
13644
|
var writesCache = writeTreeChildWrites(syncTree.pendingWriteTree_, path);
|
|
13645
|
+
return {
|
|
13646
|
+
syncPoint: syncPoint,
|
|
13647
|
+
writesCache: writesCache,
|
|
13648
|
+
serverCache: serverCache,
|
|
13649
|
+
serverCacheComplete: serverCacheComplete,
|
|
13650
|
+
foundAncestorDefaultView: foundAncestorDefaultView,
|
|
13651
|
+
viewAlreadyExists: viewAlreadyExists
|
|
13652
|
+
};
|
|
13653
|
+
}
|
|
13654
|
+
/**
|
|
13655
|
+
* Add an event callback for the specified query.
|
|
13656
|
+
*
|
|
13657
|
+
* @returns Events to raise.
|
|
13658
|
+
*/
|
|
13659
|
+
function syncTreeAddEventRegistration(syncTree, query, eventRegistration) {
|
|
13660
|
+
var _a = syncTreeRegisterSyncPoint(query, syncTree), syncPoint = _a.syncPoint, serverCache = _a.serverCache, writesCache = _a.writesCache, serverCacheComplete = _a.serverCacheComplete, viewAlreadyExists = _a.viewAlreadyExists, foundAncestorDefaultView = _a.foundAncestorDefaultView;
|
|
13624
13661
|
var events = syncPointAddEventRegistration(syncPoint, query, eventRegistration, writesCache, serverCache, serverCacheComplete);
|
|
13625
13662
|
if (!viewAlreadyExists && !foundAncestorDefaultView) {
|
|
13626
13663
|
var view = syncPointViewForQuery(syncPoint, query);
|
|
@@ -14863,9 +14900,25 @@ function repoGetValue(repo, query) {
|
|
|
14863
14900
|
}
|
|
14864
14901
|
return repo.server_.get(query).then(function (payload) {
|
|
14865
14902
|
var node = nodeFromJSON(payload).withIndex(query._queryParams.getIndex());
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14903
|
+
// if this is a filtered query, then overwrite at path
|
|
14904
|
+
if (query._queryParams.loadsAllData()) {
|
|
14905
|
+
syncTreeApplyServerOverwrite(repo.serverSyncTree_, query._path, node);
|
|
14906
|
+
}
|
|
14907
|
+
else {
|
|
14908
|
+
// Simulate `syncTreeAddEventRegistration` without events/listener setup.
|
|
14909
|
+
// We do this (along with the syncTreeRemoveEventRegistration` below) so that
|
|
14910
|
+
// `repoGetValue` results have the same cache effects as initial listener(s)
|
|
14911
|
+
// updates.
|
|
14912
|
+
var tag = syncTreeRegisterQuery(repo.serverSyncTree_, query);
|
|
14913
|
+
syncTreeApplyTaggedQueryOverwrite(repo.serverSyncTree_, query._path, node, tag);
|
|
14914
|
+
// Call `syncTreeRemoveEventRegistration` with a null event registration, since there is none.
|
|
14915
|
+
// Note: The below code essentially unregisters the query and cleans up any views/syncpoints temporarily created above.
|
|
14916
|
+
}
|
|
14917
|
+
var cancels = syncTreeRemoveEventRegistration(repo.serverSyncTree_, query, null);
|
|
14918
|
+
if (cancels.length > 0) {
|
|
14919
|
+
repoLog(repo, 'unexpected cancel events in repoGetValue');
|
|
14920
|
+
}
|
|
14921
|
+
return node;
|
|
14869
14922
|
}, function (err) {
|
|
14870
14923
|
repoLog(repo, 'get for query ' + util.stringify(query) + ' failed: ' + err);
|
|
14871
14924
|
return Promise.reject(new Error(err));
|