@firebase/database 0.13.10-canary.ab3f16cba → 0.13.10-canary.c20633ed3
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/index.esm2017.js +79 -79
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +98 -98
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +98 -98
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.standalone.js +95 -95
- package/dist/index.standalone.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +79 -79
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +7 -7
package/dist/index.esm2017.js
CHANGED
|
@@ -4,7 +4,7 @@ import { stringify, jsonEval, contains, assert, isNodeSdk, stringToByteArray, Sh
|
|
|
4
4
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
5
5
|
|
|
6
6
|
const name = "@firebase/database";
|
|
7
|
-
const version = "0.13.10-canary.
|
|
7
|
+
const version = "0.13.10-canary.c20633ed3";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -2262,7 +2262,7 @@ class Connection {
|
|
|
2262
2262
|
this.lastSessionId = lastSessionId;
|
|
2263
2263
|
this.connectionCount = 0;
|
|
2264
2264
|
this.pendingDataMessages = [];
|
|
2265
|
-
this.state_ = 0 /* CONNECTING */;
|
|
2265
|
+
this.state_ = 0 /* RealtimeState.CONNECTING */;
|
|
2266
2266
|
this.log_ = logWrapper('c:' + this.id + ':');
|
|
2267
2267
|
this.transportManager_ = new TransportManager(repoInfo_);
|
|
2268
2268
|
this.log_('Connection created');
|
|
@@ -2342,7 +2342,7 @@ class Connection {
|
|
|
2342
2342
|
}
|
|
2343
2343
|
connReceiver_(conn) {
|
|
2344
2344
|
return (message) => {
|
|
2345
|
-
if (this.state_ !== 2 /* DISCONNECTED */) {
|
|
2345
|
+
if (this.state_ !== 2 /* RealtimeState.DISCONNECTED */) {
|
|
2346
2346
|
if (conn === this.rx_) {
|
|
2347
2347
|
this.onPrimaryMessageReceived_(message);
|
|
2348
2348
|
}
|
|
@@ -2508,7 +2508,7 @@ class Connection {
|
|
|
2508
2508
|
this.sessionId = handshake.s;
|
|
2509
2509
|
this.repoInfo_.host = host;
|
|
2510
2510
|
// if we've already closed the connection, then don't bother trying to progress further
|
|
2511
|
-
if (this.state_ === 0 /* CONNECTING */) {
|
|
2511
|
+
if (this.state_ === 0 /* RealtimeState.CONNECTING */) {
|
|
2512
2512
|
this.conn_.start();
|
|
2513
2513
|
this.onConnectionEstablished_(this.conn_, timestamp);
|
|
2514
2514
|
if (PROTOCOL_VERSION !== version) {
|
|
@@ -2546,7 +2546,7 @@ class Connection {
|
|
|
2546
2546
|
this.repoInfo_.host = host;
|
|
2547
2547
|
// TODO: if we're already "connected", we need to trigger a disconnect at the next layer up.
|
|
2548
2548
|
// We don't currently support resets after the connection has already been established
|
|
2549
|
-
if (this.state_ === 1 /* CONNECTED */) {
|
|
2549
|
+
if (this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2550
2550
|
this.close();
|
|
2551
2551
|
}
|
|
2552
2552
|
else {
|
|
@@ -2558,7 +2558,7 @@ class Connection {
|
|
|
2558
2558
|
onConnectionEstablished_(conn, timestamp) {
|
|
2559
2559
|
this.log_('Realtime connection established.');
|
|
2560
2560
|
this.conn_ = conn;
|
|
2561
|
-
this.state_ = 1 /* CONNECTED */;
|
|
2561
|
+
this.state_ = 1 /* RealtimeState.CONNECTED */;
|
|
2562
2562
|
if (this.onReady_) {
|
|
2563
2563
|
this.onReady_(timestamp, this.sessionId);
|
|
2564
2564
|
this.onReady_ = null;
|
|
@@ -2577,7 +2577,7 @@ class Connection {
|
|
|
2577
2577
|
}
|
|
2578
2578
|
sendPingOnPrimaryIfNecessary_() {
|
|
2579
2579
|
// If the connection isn't considered healthy yet, we'll send a noop ping packet request.
|
|
2580
|
-
if (!this.isHealthy_ && this.state_ === 1 /* CONNECTED */) {
|
|
2580
|
+
if (!this.isHealthy_ && this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2581
2581
|
this.log_('sending ping on primary.');
|
|
2582
2582
|
this.sendData_({ t: 'c', d: { t: PING, d: {} } });
|
|
2583
2583
|
}
|
|
@@ -2598,7 +2598,7 @@ class Connection {
|
|
|
2598
2598
|
this.conn_ = null;
|
|
2599
2599
|
// NOTE: IF you're seeing a Firefox error for this line, I think it might be because it's getting
|
|
2600
2600
|
// called on window close and RealtimeState.CONNECTING is no longer defined. Just a guess.
|
|
2601
|
-
if (!everConnected && this.state_ === 0 /* CONNECTING */) {
|
|
2601
|
+
if (!everConnected && this.state_ === 0 /* RealtimeState.CONNECTING */) {
|
|
2602
2602
|
this.log_('Realtime connection failed.');
|
|
2603
2603
|
// Since we failed to connect at all, clear any cached entry for this namespace in case the machine went away
|
|
2604
2604
|
if (this.repoInfo_.isCacheableHost()) {
|
|
@@ -2607,7 +2607,7 @@ class Connection {
|
|
|
2607
2607
|
this.repoInfo_.internalHost = this.repoInfo_.host;
|
|
2608
2608
|
}
|
|
2609
2609
|
}
|
|
2610
|
-
else if (this.state_ === 1 /* CONNECTED */) {
|
|
2610
|
+
else if (this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2611
2611
|
this.log_('Realtime connection lost.');
|
|
2612
2612
|
}
|
|
2613
2613
|
this.close();
|
|
@@ -2624,7 +2624,7 @@ class Connection {
|
|
|
2624
2624
|
this.close();
|
|
2625
2625
|
}
|
|
2626
2626
|
sendData_(data) {
|
|
2627
|
-
if (this.state_ !== 1 /* CONNECTED */) {
|
|
2627
|
+
if (this.state_ !== 1 /* RealtimeState.CONNECTED */) {
|
|
2628
2628
|
throw 'Connection is not connected';
|
|
2629
2629
|
}
|
|
2630
2630
|
else {
|
|
@@ -2635,9 +2635,9 @@ class Connection {
|
|
|
2635
2635
|
* Cleans up this connection, calling the appropriate callbacks
|
|
2636
2636
|
*/
|
|
2637
2637
|
close() {
|
|
2638
|
-
if (this.state_ !== 2 /* DISCONNECTED */) {
|
|
2638
|
+
if (this.state_ !== 2 /* RealtimeState.DISCONNECTED */) {
|
|
2639
2639
|
this.log_('Closing realtime connection.');
|
|
2640
|
-
this.state_ = 2 /* DISCONNECTED */;
|
|
2640
|
+
this.state_ = 2 /* RealtimeState.DISCONNECTED */;
|
|
2641
2641
|
this.closeConnections_();
|
|
2642
2642
|
if (this.onDisconnect_) {
|
|
2643
2643
|
this.onDisconnect_();
|
|
@@ -5968,24 +5968,24 @@ const VALUE_INDEX = new ValueIndex();
|
|
|
5968
5968
|
* limitations under the License.
|
|
5969
5969
|
*/
|
|
5970
5970
|
function changeValue(snapshotNode) {
|
|
5971
|
-
return { type: "value" /* VALUE */, snapshotNode };
|
|
5971
|
+
return { type: "value" /* ChangeType.VALUE */, snapshotNode };
|
|
5972
5972
|
}
|
|
5973
5973
|
function changeChildAdded(childName, snapshotNode) {
|
|
5974
|
-
return { type: "child_added" /* CHILD_ADDED */, snapshotNode, childName };
|
|
5974
|
+
return { type: "child_added" /* ChangeType.CHILD_ADDED */, snapshotNode, childName };
|
|
5975
5975
|
}
|
|
5976
5976
|
function changeChildRemoved(childName, snapshotNode) {
|
|
5977
|
-
return { type: "child_removed" /* CHILD_REMOVED */, snapshotNode, childName };
|
|
5977
|
+
return { type: "child_removed" /* ChangeType.CHILD_REMOVED */, snapshotNode, childName };
|
|
5978
5978
|
}
|
|
5979
5979
|
function changeChildChanged(childName, snapshotNode, oldSnap) {
|
|
5980
5980
|
return {
|
|
5981
|
-
type: "child_changed" /* CHILD_CHANGED */,
|
|
5981
|
+
type: "child_changed" /* ChangeType.CHILD_CHANGED */,
|
|
5982
5982
|
snapshotNode,
|
|
5983
5983
|
childName,
|
|
5984
5984
|
oldSnap
|
|
5985
5985
|
};
|
|
5986
5986
|
}
|
|
5987
5987
|
function changeChildMoved(childName, snapshotNode) {
|
|
5988
|
-
return { type: "child_moved" /* CHILD_MOVED */, snapshotNode, childName };
|
|
5988
|
+
return { type: "child_moved" /* ChangeType.CHILD_MOVED */, snapshotNode, childName };
|
|
5989
5989
|
}
|
|
5990
5990
|
|
|
5991
5991
|
/**
|
|
@@ -6458,7 +6458,7 @@ class QueryParams {
|
|
|
6458
6458
|
return this.startSet_;
|
|
6459
6459
|
}
|
|
6460
6460
|
else {
|
|
6461
|
-
return this.viewFrom_ === "l" /* VIEW_FROM_LEFT */;
|
|
6461
|
+
return this.viewFrom_ === "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
6462
6462
|
}
|
|
6463
6463
|
}
|
|
6464
6464
|
/**
|
|
@@ -6563,14 +6563,14 @@ function queryParamsLimitToFirst(queryParams, newLimit) {
|
|
|
6563
6563
|
const newParams = queryParams.copy();
|
|
6564
6564
|
newParams.limitSet_ = true;
|
|
6565
6565
|
newParams.limit_ = newLimit;
|
|
6566
|
-
newParams.viewFrom_ = "l" /* VIEW_FROM_LEFT */;
|
|
6566
|
+
newParams.viewFrom_ = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
6567
6567
|
return newParams;
|
|
6568
6568
|
}
|
|
6569
6569
|
function queryParamsLimitToLast(queryParams, newLimit) {
|
|
6570
6570
|
const newParams = queryParams.copy();
|
|
6571
6571
|
newParams.limitSet_ = true;
|
|
6572
6572
|
newParams.limit_ = newLimit;
|
|
6573
|
-
newParams.viewFrom_ = "r" /* VIEW_FROM_RIGHT */;
|
|
6573
|
+
newParams.viewFrom_ = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
6574
6574
|
return newParams;
|
|
6575
6575
|
}
|
|
6576
6576
|
function queryParamsStartAt(queryParams, indexValue, key) {
|
|
@@ -6646,23 +6646,23 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
6646
6646
|
}
|
|
6647
6647
|
let orderBy;
|
|
6648
6648
|
if (queryParams.index_ === PRIORITY_INDEX) {
|
|
6649
|
-
orderBy = "$priority" /* PRIORITY_INDEX */;
|
|
6649
|
+
orderBy = "$priority" /* REST_QUERY_CONSTANTS.PRIORITY_INDEX */;
|
|
6650
6650
|
}
|
|
6651
6651
|
else if (queryParams.index_ === VALUE_INDEX) {
|
|
6652
|
-
orderBy = "$value" /* VALUE_INDEX */;
|
|
6652
|
+
orderBy = "$value" /* REST_QUERY_CONSTANTS.VALUE_INDEX */;
|
|
6653
6653
|
}
|
|
6654
6654
|
else if (queryParams.index_ === KEY_INDEX) {
|
|
6655
|
-
orderBy = "$key" /* KEY_INDEX */;
|
|
6655
|
+
orderBy = "$key" /* REST_QUERY_CONSTANTS.KEY_INDEX */;
|
|
6656
6656
|
}
|
|
6657
6657
|
else {
|
|
6658
6658
|
assert(queryParams.index_ instanceof PathIndex, 'Unrecognized index type!');
|
|
6659
6659
|
orderBy = queryParams.index_.toString();
|
|
6660
6660
|
}
|
|
6661
|
-
qs["orderBy" /* ORDER_BY */] = stringify(orderBy);
|
|
6661
|
+
qs["orderBy" /* REST_QUERY_CONSTANTS.ORDER_BY */] = stringify(orderBy);
|
|
6662
6662
|
if (queryParams.startSet_) {
|
|
6663
6663
|
const startParam = queryParams.startAfterSet_
|
|
6664
|
-
? "startAfter" /* START_AFTER */
|
|
6665
|
-
: "startAt" /* START_AT */;
|
|
6664
|
+
? "startAfter" /* REST_QUERY_CONSTANTS.START_AFTER */
|
|
6665
|
+
: "startAt" /* REST_QUERY_CONSTANTS.START_AT */;
|
|
6666
6666
|
qs[startParam] = stringify(queryParams.indexStartValue_);
|
|
6667
6667
|
if (queryParams.startNameSet_) {
|
|
6668
6668
|
qs[startParam] += ',' + stringify(queryParams.indexStartName_);
|
|
@@ -6670,8 +6670,8 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
6670
6670
|
}
|
|
6671
6671
|
if (queryParams.endSet_) {
|
|
6672
6672
|
const endParam = queryParams.endBeforeSet_
|
|
6673
|
-
? "endBefore" /* END_BEFORE */
|
|
6674
|
-
: "endAt" /* END_AT */;
|
|
6673
|
+
? "endBefore" /* REST_QUERY_CONSTANTS.END_BEFORE */
|
|
6674
|
+
: "endAt" /* REST_QUERY_CONSTANTS.END_AT */;
|
|
6675
6675
|
qs[endParam] = stringify(queryParams.indexEndValue_);
|
|
6676
6676
|
if (queryParams.endNameSet_) {
|
|
6677
6677
|
qs[endParam] += ',' + stringify(queryParams.indexEndName_);
|
|
@@ -6679,10 +6679,10 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
6679
6679
|
}
|
|
6680
6680
|
if (queryParams.limitSet_) {
|
|
6681
6681
|
if (queryParams.isViewFromLeft()) {
|
|
6682
|
-
qs["limitToFirst" /* LIMIT_TO_FIRST */] = queryParams.limit_;
|
|
6682
|
+
qs["limitToFirst" /* REST_QUERY_CONSTANTS.LIMIT_TO_FIRST */] = queryParams.limit_;
|
|
6683
6683
|
}
|
|
6684
6684
|
else {
|
|
6685
|
-
qs["limitToLast" /* LIMIT_TO_LAST */] = queryParams.limit_;
|
|
6685
|
+
qs["limitToLast" /* REST_QUERY_CONSTANTS.LIMIT_TO_LAST */] = queryParams.limit_;
|
|
6686
6686
|
}
|
|
6687
6687
|
}
|
|
6688
6688
|
return qs;
|
|
@@ -6690,39 +6690,39 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
6690
6690
|
function queryParamsGetQueryObject(queryParams) {
|
|
6691
6691
|
const obj = {};
|
|
6692
6692
|
if (queryParams.startSet_) {
|
|
6693
|
-
obj["sp" /* INDEX_START_VALUE */] =
|
|
6693
|
+
obj["sp" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_VALUE */] =
|
|
6694
6694
|
queryParams.indexStartValue_;
|
|
6695
6695
|
if (queryParams.startNameSet_) {
|
|
6696
|
-
obj["sn" /* INDEX_START_NAME */] =
|
|
6696
|
+
obj["sn" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_NAME */] =
|
|
6697
6697
|
queryParams.indexStartName_;
|
|
6698
6698
|
}
|
|
6699
|
-
obj["sin" /* INDEX_START_IS_INCLUSIVE */] =
|
|
6699
|
+
obj["sin" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_IS_INCLUSIVE */] =
|
|
6700
6700
|
!queryParams.startAfterSet_;
|
|
6701
6701
|
}
|
|
6702
6702
|
if (queryParams.endSet_) {
|
|
6703
|
-
obj["ep" /* INDEX_END_VALUE */] = queryParams.indexEndValue_;
|
|
6703
|
+
obj["ep" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_VALUE */] = queryParams.indexEndValue_;
|
|
6704
6704
|
if (queryParams.endNameSet_) {
|
|
6705
|
-
obj["en" /* INDEX_END_NAME */] = queryParams.indexEndName_;
|
|
6705
|
+
obj["en" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_NAME */] = queryParams.indexEndName_;
|
|
6706
6706
|
}
|
|
6707
|
-
obj["ein" /* INDEX_END_IS_INCLUSIVE */] =
|
|
6707
|
+
obj["ein" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_IS_INCLUSIVE */] =
|
|
6708
6708
|
!queryParams.endBeforeSet_;
|
|
6709
6709
|
}
|
|
6710
6710
|
if (queryParams.limitSet_) {
|
|
6711
|
-
obj["l" /* LIMIT */] = queryParams.limit_;
|
|
6711
|
+
obj["l" /* WIRE_PROTOCOL_CONSTANTS.LIMIT */] = queryParams.limit_;
|
|
6712
6712
|
let viewFrom = queryParams.viewFrom_;
|
|
6713
6713
|
if (viewFrom === '') {
|
|
6714
6714
|
if (queryParams.isViewFromLeft()) {
|
|
6715
|
-
viewFrom = "l" /* VIEW_FROM_LEFT */;
|
|
6715
|
+
viewFrom = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
6716
6716
|
}
|
|
6717
6717
|
else {
|
|
6718
|
-
viewFrom = "r" /* VIEW_FROM_RIGHT */;
|
|
6718
|
+
viewFrom = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
6719
6719
|
}
|
|
6720
6720
|
}
|
|
6721
|
-
obj["vf" /* VIEW_FROM */] = viewFrom;
|
|
6721
|
+
obj["vf" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM */] = viewFrom;
|
|
6722
6722
|
}
|
|
6723
6723
|
// For now, priority index is the default, so we only specify if it's some other index
|
|
6724
6724
|
if (queryParams.index_ !== PRIORITY_INDEX) {
|
|
6725
|
-
obj["i" /* INDEX */] = queryParams.index_.toString();
|
|
6725
|
+
obj["i" /* WIRE_PROTOCOL_CONSTANTS.INDEX */] = queryParams.index_.toString();
|
|
6726
6726
|
}
|
|
6727
6727
|
return obj;
|
|
6728
6728
|
}
|
|
@@ -7466,16 +7466,16 @@ function eventGeneratorGenerateEventsForChanges(eventGenerator, changes, eventCa
|
|
|
7466
7466
|
const events = [];
|
|
7467
7467
|
const moves = [];
|
|
7468
7468
|
changes.forEach(change => {
|
|
7469
|
-
if (change.type === "child_changed" /* CHILD_CHANGED */ &&
|
|
7469
|
+
if (change.type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
7470
7470
|
eventGenerator.index_.indexedValueChanged(change.oldSnap, change.snapshotNode)) {
|
|
7471
7471
|
moves.push(changeChildMoved(change.childName, change.snapshotNode));
|
|
7472
7472
|
}
|
|
7473
7473
|
});
|
|
7474
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_removed" /* CHILD_REMOVED */, changes, eventRegistrations, eventCache);
|
|
7475
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_added" /* CHILD_ADDED */, changes, eventRegistrations, eventCache);
|
|
7476
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_moved" /* CHILD_MOVED */, moves, eventRegistrations, eventCache);
|
|
7477
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_changed" /* CHILD_CHANGED */, changes, eventRegistrations, eventCache);
|
|
7478
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "value" /* VALUE */, changes, eventRegistrations, eventCache);
|
|
7474
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_removed" /* ChangeType.CHILD_REMOVED */, changes, eventRegistrations, eventCache);
|
|
7475
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_added" /* ChangeType.CHILD_ADDED */, changes, eventRegistrations, eventCache);
|
|
7476
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_moved" /* ChangeType.CHILD_MOVED */, moves, eventRegistrations, eventCache);
|
|
7477
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_changed" /* ChangeType.CHILD_CHANGED */, changes, eventRegistrations, eventCache);
|
|
7478
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "value" /* ChangeType.VALUE */, changes, eventRegistrations, eventCache);
|
|
7479
7479
|
return events;
|
|
7480
7480
|
}
|
|
7481
7481
|
/**
|
|
@@ -8556,31 +8556,31 @@ class ChildChangeAccumulator {
|
|
|
8556
8556
|
trackChildChange(change) {
|
|
8557
8557
|
const type = change.type;
|
|
8558
8558
|
const childKey = change.childName;
|
|
8559
|
-
assert(type === "child_added" /* CHILD_ADDED */ ||
|
|
8560
|
-
type === "child_changed" /* CHILD_CHANGED */ ||
|
|
8561
|
-
type === "child_removed" /* CHILD_REMOVED */, 'Only child changes supported for tracking');
|
|
8559
|
+
assert(type === "child_added" /* ChangeType.CHILD_ADDED */ ||
|
|
8560
|
+
type === "child_changed" /* ChangeType.CHILD_CHANGED */ ||
|
|
8561
|
+
type === "child_removed" /* ChangeType.CHILD_REMOVED */, 'Only child changes supported for tracking');
|
|
8562
8562
|
assert(childKey !== '.priority', 'Only non-priority child changes can be tracked.');
|
|
8563
8563
|
const oldChange = this.changeMap.get(childKey);
|
|
8564
8564
|
if (oldChange) {
|
|
8565
8565
|
const oldType = oldChange.type;
|
|
8566
|
-
if (type === "child_added" /* CHILD_ADDED */ &&
|
|
8567
|
-
oldType === "child_removed" /* CHILD_REMOVED */) {
|
|
8566
|
+
if (type === "child_added" /* ChangeType.CHILD_ADDED */ &&
|
|
8567
|
+
oldType === "child_removed" /* ChangeType.CHILD_REMOVED */) {
|
|
8568
8568
|
this.changeMap.set(childKey, changeChildChanged(childKey, change.snapshotNode, oldChange.snapshotNode));
|
|
8569
8569
|
}
|
|
8570
|
-
else if (type === "child_removed" /* CHILD_REMOVED */ &&
|
|
8571
|
-
oldType === "child_added" /* CHILD_ADDED */) {
|
|
8570
|
+
else if (type === "child_removed" /* ChangeType.CHILD_REMOVED */ &&
|
|
8571
|
+
oldType === "child_added" /* ChangeType.CHILD_ADDED */) {
|
|
8572
8572
|
this.changeMap.delete(childKey);
|
|
8573
8573
|
}
|
|
8574
|
-
else if (type === "child_removed" /* CHILD_REMOVED */ &&
|
|
8575
|
-
oldType === "child_changed" /* CHILD_CHANGED */) {
|
|
8574
|
+
else if (type === "child_removed" /* ChangeType.CHILD_REMOVED */ &&
|
|
8575
|
+
oldType === "child_changed" /* ChangeType.CHILD_CHANGED */) {
|
|
8576
8576
|
this.changeMap.set(childKey, changeChildRemoved(childKey, oldChange.oldSnap));
|
|
8577
8577
|
}
|
|
8578
|
-
else if (type === "child_changed" /* CHILD_CHANGED */ &&
|
|
8579
|
-
oldType === "child_added" /* CHILD_ADDED */) {
|
|
8578
|
+
else if (type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
8579
|
+
oldType === "child_added" /* ChangeType.CHILD_ADDED */) {
|
|
8580
8580
|
this.changeMap.set(childKey, changeChildAdded(childKey, change.snapshotNode));
|
|
8581
8581
|
}
|
|
8582
|
-
else if (type === "child_changed" /* CHILD_CHANGED */ &&
|
|
8583
|
-
oldType === "child_changed" /* CHILD_CHANGED */) {
|
|
8582
|
+
else if (type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
8583
|
+
oldType === "child_changed" /* ChangeType.CHILD_CHANGED */) {
|
|
8584
8584
|
this.changeMap.set(childKey, changeChildChanged(childKey, change.snapshotNode, oldChange.oldSnap));
|
|
8585
8585
|
}
|
|
8586
8586
|
else {
|
|
@@ -11290,7 +11290,7 @@ function repoStartTransaction(repo, path, transactionUpdate, onComplete, unwatch
|
|
|
11290
11290
|
else {
|
|
11291
11291
|
validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path);
|
|
11292
11292
|
// Mark as run and add to our queue.
|
|
11293
|
-
transaction.status = 0 /* RUN */;
|
|
11293
|
+
transaction.status = 0 /* TransactionStatus.RUN */;
|
|
11294
11294
|
const queueNode = treeSubTree(repo.transactionQueueTree_, path);
|
|
11295
11295
|
const nodeQueue = treeGetValue(queueNode) || [];
|
|
11296
11296
|
nodeQueue.push(transaction);
|
|
@@ -11348,7 +11348,7 @@ function repoSendReadyTransactions(repo, node = repo.transactionQueueTree_) {
|
|
|
11348
11348
|
if (treeGetValue(node)) {
|
|
11349
11349
|
const queue = repoBuildTransactionQueue(repo, node);
|
|
11350
11350
|
assert(queue.length > 0, 'Sending zero length transaction queue');
|
|
11351
|
-
const allRun = queue.every((transaction) => transaction.status === 0 /* RUN */);
|
|
11351
|
+
const allRun = queue.every((transaction) => transaction.status === 0 /* TransactionStatus.RUN */);
|
|
11352
11352
|
// If they're all run (and not sent), we can send them. Else, we must wait.
|
|
11353
11353
|
if (allRun) {
|
|
11354
11354
|
repoSendTransactionQueue(repo, treeGetPath(node), queue);
|
|
@@ -11377,8 +11377,8 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11377
11377
|
const latestHash = latestState.hash();
|
|
11378
11378
|
for (let i = 0; i < queue.length; i++) {
|
|
11379
11379
|
const txn = queue[i];
|
|
11380
|
-
assert(txn.status === 0 /* RUN */, 'tryToSendTransactionQueue_: items in queue should all be run.');
|
|
11381
|
-
txn.status = 1 /* SENT */;
|
|
11380
|
+
assert(txn.status === 0 /* TransactionStatus.RUN */, 'tryToSendTransactionQueue_: items in queue should all be run.');
|
|
11381
|
+
txn.status = 1 /* TransactionStatus.SENT */;
|
|
11382
11382
|
txn.retryCount++;
|
|
11383
11383
|
const relativePath = newRelativePath(path, txn.path);
|
|
11384
11384
|
// If we've gotten to this point, the output snapshot must be defined.
|
|
@@ -11399,7 +11399,7 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11399
11399
|
// transactions or sets.
|
|
11400
11400
|
const callbacks = [];
|
|
11401
11401
|
for (let i = 0; i < queue.length; i++) {
|
|
11402
|
-
queue[i].status = 2 /* COMPLETED */;
|
|
11402
|
+
queue[i].status = 2 /* TransactionStatus.COMPLETED */;
|
|
11403
11403
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, queue[i].currentWriteId));
|
|
11404
11404
|
if (queue[i].onComplete) {
|
|
11405
11405
|
// We never unset the output snapshot, and given that this
|
|
@@ -11422,18 +11422,18 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11422
11422
|
// transactions are no longer sent. Update their status appropriately.
|
|
11423
11423
|
if (status === 'datastale') {
|
|
11424
11424
|
for (let i = 0; i < queue.length; i++) {
|
|
11425
|
-
if (queue[i].status === 3 /* SENT_NEEDS_ABORT */) {
|
|
11426
|
-
queue[i].status = 4 /* NEEDS_ABORT */;
|
|
11425
|
+
if (queue[i].status === 3 /* TransactionStatus.SENT_NEEDS_ABORT */) {
|
|
11426
|
+
queue[i].status = 4 /* TransactionStatus.NEEDS_ABORT */;
|
|
11427
11427
|
}
|
|
11428
11428
|
else {
|
|
11429
|
-
queue[i].status = 0 /* RUN */;
|
|
11429
|
+
queue[i].status = 0 /* TransactionStatus.RUN */;
|
|
11430
11430
|
}
|
|
11431
11431
|
}
|
|
11432
11432
|
}
|
|
11433
11433
|
else {
|
|
11434
11434
|
warn('transaction at ' + pathToSend.toString() + ' failed: ' + status);
|
|
11435
11435
|
for (let i = 0; i < queue.length; i++) {
|
|
11436
|
-
queue[i].status = 4 /* NEEDS_ABORT */;
|
|
11436
|
+
queue[i].status = 4 /* TransactionStatus.NEEDS_ABORT */;
|
|
11437
11437
|
queue[i].abortReason = status;
|
|
11438
11438
|
}
|
|
11439
11439
|
}
|
|
@@ -11477,7 +11477,7 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
11477
11477
|
let events = [];
|
|
11478
11478
|
// Ignore all of the sets we're going to re-run.
|
|
11479
11479
|
const txnsToRerun = queue.filter(q => {
|
|
11480
|
-
return q.status === 0 /* RUN */;
|
|
11480
|
+
return q.status === 0 /* TransactionStatus.RUN */;
|
|
11481
11481
|
});
|
|
11482
11482
|
const setsToIgnore = txnsToRerun.map(q => {
|
|
11483
11483
|
return q.currentWriteId;
|
|
@@ -11487,12 +11487,12 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
11487
11487
|
const relativePath = newRelativePath(path, transaction.path);
|
|
11488
11488
|
let abortTransaction = false, abortReason;
|
|
11489
11489
|
assert(relativePath !== null, 'rerunTransactionsUnderNode_: relativePath should not be null.');
|
|
11490
|
-
if (transaction.status === 4 /* NEEDS_ABORT */) {
|
|
11490
|
+
if (transaction.status === 4 /* TransactionStatus.NEEDS_ABORT */) {
|
|
11491
11491
|
abortTransaction = true;
|
|
11492
11492
|
abortReason = transaction.abortReason;
|
|
11493
11493
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, transaction.currentWriteId, true));
|
|
11494
11494
|
}
|
|
11495
|
-
else if (transaction.status === 0 /* RUN */) {
|
|
11495
|
+
else if (transaction.status === 0 /* TransactionStatus.RUN */) {
|
|
11496
11496
|
if (transaction.retryCount >= MAX_TRANSACTION_RETRIES) {
|
|
11497
11497
|
abortTransaction = true;
|
|
11498
11498
|
abortReason = 'maxretry';
|
|
@@ -11535,7 +11535,7 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
11535
11535
|
events = [];
|
|
11536
11536
|
if (abortTransaction) {
|
|
11537
11537
|
// Abort.
|
|
11538
|
-
queue[i].status = 2 /* COMPLETED */;
|
|
11538
|
+
queue[i].status = 2 /* TransactionStatus.COMPLETED */;
|
|
11539
11539
|
// Removing a listener can trigger pruning which can muck with
|
|
11540
11540
|
// mergedData/visibleData (as it prunes data). So defer the unwatcher
|
|
11541
11541
|
// until we're done.
|
|
@@ -11616,7 +11616,7 @@ function repoPruneCompletedTransactionsBelowNode(repo, node) {
|
|
|
11616
11616
|
if (queue) {
|
|
11617
11617
|
let to = 0;
|
|
11618
11618
|
for (let from = 0; from < queue.length; from++) {
|
|
11619
|
-
if (queue[from].status !== 2 /* COMPLETED */) {
|
|
11619
|
+
if (queue[from].status !== 2 /* TransactionStatus.COMPLETED */) {
|
|
11620
11620
|
queue[to] = queue[from];
|
|
11621
11621
|
to++;
|
|
11622
11622
|
}
|
|
@@ -11664,16 +11664,16 @@ function repoAbortTransactionsOnNode(repo, node) {
|
|
|
11664
11664
|
let events = [];
|
|
11665
11665
|
let lastSent = -1;
|
|
11666
11666
|
for (let i = 0; i < queue.length; i++) {
|
|
11667
|
-
if (queue[i].status === 3 /* SENT_NEEDS_ABORT */) ;
|
|
11668
|
-
else if (queue[i].status === 1 /* SENT */) {
|
|
11667
|
+
if (queue[i].status === 3 /* TransactionStatus.SENT_NEEDS_ABORT */) ;
|
|
11668
|
+
else if (queue[i].status === 1 /* TransactionStatus.SENT */) {
|
|
11669
11669
|
assert(lastSent === i - 1, 'All SENT items should be at beginning of queue.');
|
|
11670
11670
|
lastSent = i;
|
|
11671
11671
|
// Mark transaction for abort when it comes back.
|
|
11672
|
-
queue[i].status = 3 /* SENT_NEEDS_ABORT */;
|
|
11672
|
+
queue[i].status = 3 /* TransactionStatus.SENT_NEEDS_ABORT */;
|
|
11673
11673
|
queue[i].abortReason = 'set';
|
|
11674
11674
|
}
|
|
11675
11675
|
else {
|
|
11676
|
-
assert(queue[i].status === 0 /* RUN */, 'Unexpected transaction status in abort');
|
|
11676
|
+
assert(queue[i].status === 0 /* TransactionStatus.RUN */, 'Unexpected transaction status in abort');
|
|
11677
11677
|
// We can abort it immediately.
|
|
11678
11678
|
queue[i].unwatcher();
|
|
11679
11679
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, queue[i].currentWriteId, true));
|
|
@@ -13726,7 +13726,7 @@ function registerDatabase(variant) {
|
|
|
13726
13726
|
const authProvider = container.getProvider('auth-internal');
|
|
13727
13727
|
const appCheckProvider = container.getProvider('app-check-internal');
|
|
13728
13728
|
return repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url);
|
|
13729
|
-
}, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
|
|
13729
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true));
|
|
13730
13730
|
registerVersion(name, version, variant);
|
|
13731
13731
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
13732
13732
|
registerVersion(name, version, 'esm2017');
|