@firebase/database-compat 0.2.10 → 0.3.0
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 +17 -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 +222 -304
- package/dist/index.standalone.js.map +1 -1
- package/dist/node-esm/index.js +1 -1
- package/package.json +8 -7
package/dist/index.standalone.js
CHANGED
|
@@ -3665,7 +3665,7 @@ var logWrapper = function (prefix) {
|
|
|
3665
3665
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3666
3666
|
varArgs[_i] = arguments[_i];
|
|
3667
3667
|
}
|
|
3668
|
-
log.apply(void 0, tslib.__spreadArray([prefix], tslib.__read(varArgs)));
|
|
3668
|
+
log.apply(void 0, tslib.__spreadArray([prefix], tslib.__read(varArgs), false));
|
|
3669
3669
|
};
|
|
3670
3670
|
};
|
|
3671
3671
|
var error = function () {
|
|
@@ -3673,7 +3673,7 @@ var error = function () {
|
|
|
3673
3673
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3674
3674
|
varArgs[_i] = arguments[_i];
|
|
3675
3675
|
}
|
|
3676
|
-
var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs)));
|
|
3676
|
+
var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs), false));
|
|
3677
3677
|
logClient$1.error(message);
|
|
3678
3678
|
};
|
|
3679
3679
|
var fatal = function () {
|
|
@@ -3681,7 +3681,7 @@ var fatal = function () {
|
|
|
3681
3681
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3682
3682
|
varArgs[_i] = arguments[_i];
|
|
3683
3683
|
}
|
|
3684
|
-
var message = "FIREBASE FATAL ERROR: "
|
|
3684
|
+
var message = "FIREBASE FATAL ERROR: ".concat(buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs), false)));
|
|
3685
3685
|
logClient$1.error(message);
|
|
3686
3686
|
throw new Error(message);
|
|
3687
3687
|
};
|
|
@@ -3690,7 +3690,7 @@ var warn$1 = function () {
|
|
|
3690
3690
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3691
3691
|
varArgs[_i] = arguments[_i];
|
|
3692
3692
|
}
|
|
3693
|
-
var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs)));
|
|
3693
|
+
var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs), false));
|
|
3694
3694
|
logClient$1.warn(message);
|
|
3695
3695
|
};
|
|
3696
3696
|
/**
|
|
@@ -4147,9 +4147,9 @@ var RepoInfo = /** @class */ (function () {
|
|
|
4147
4147
|
RepoInfo.prototype.toURLString = function () {
|
|
4148
4148
|
var protocol = this.secure ? 'https://' : 'http://';
|
|
4149
4149
|
var query = this.includeNamespaceInQueryParams
|
|
4150
|
-
? "?ns="
|
|
4150
|
+
? "?ns=".concat(this.namespace)
|
|
4151
4151
|
: '';
|
|
4152
|
-
return ""
|
|
4152
|
+
return "".concat(protocol).concat(this.host, "/").concat(query);
|
|
4153
4153
|
};
|
|
4154
4154
|
return RepoInfo;
|
|
4155
4155
|
}());
|
|
@@ -4394,7 +4394,7 @@ var WebSocketConnection = /** @class */ (function () {
|
|
|
4394
4394
|
// UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
|
|
4395
4395
|
options = {
|
|
4396
4396
|
headers: {
|
|
4397
|
-
'User-Agent': "Firebase/"
|
|
4397
|
+
'User-Agent': "Firebase/".concat(PROTOCOL_VERSION, "/").concat(SDK_VERSION, "/").concat(process.platform, "/").concat(device),
|
|
4398
4398
|
'X-Firebase-GMPID': this.applicationId || ''
|
|
4399
4399
|
}
|
|
4400
4400
|
};
|
|
@@ -4404,7 +4404,7 @@ var WebSocketConnection = /** @class */ (function () {
|
|
|
4404
4404
|
// Note that this header is just used to bypass appcheck, and the token should still be sent
|
|
4405
4405
|
// through the websocket connection once it is established.
|
|
4406
4406
|
if (this.authToken) {
|
|
4407
|
-
options.headers['Authorization'] = "Bearer "
|
|
4407
|
+
options.headers['Authorization'] = "Bearer ".concat(this.authToken);
|
|
4408
4408
|
}
|
|
4409
4409
|
if (this.appCheckToken) {
|
|
4410
4410
|
options.headers['X-Firebase-AppCheck'] = this.appCheckToken;
|
|
@@ -4695,7 +4695,7 @@ var AppCheckTokenProvider = /** @class */ (function () {
|
|
|
4695
4695
|
(_a = this.appCheckProvider) === null || _a === void 0 ? void 0 : _a.get().then(function (appCheck) { return appCheck.addTokenListener(listener); });
|
|
4696
4696
|
};
|
|
4697
4697
|
AppCheckTokenProvider.prototype.notifyForInvalidToken = function () {
|
|
4698
|
-
warn$1("Provided AppCheck credentials for the app named \""
|
|
4698
|
+
warn$1("Provided AppCheck credentials for the app named \"".concat(this.appName_, "\" ") +
|
|
4699
4699
|
'are invalid. This usually indicates your app was not initialized correctly.');
|
|
4700
4700
|
};
|
|
4701
4701
|
return AppCheckTokenProvider;
|
|
@@ -5708,7 +5708,7 @@ var Connection = /** @class */ (function () {
|
|
|
5708
5708
|
this.lastSessionId = lastSessionId;
|
|
5709
5709
|
this.connectionCount = 0;
|
|
5710
5710
|
this.pendingDataMessages = [];
|
|
5711
|
-
this.state_ = 0 /* CONNECTING */;
|
|
5711
|
+
this.state_ = 0 /* RealtimeState.CONNECTING */;
|
|
5712
5712
|
this.log_ = logWrapper('c:' + this.id + ':');
|
|
5713
5713
|
this.transportManager_ = new TransportManager(repoInfo_);
|
|
5714
5714
|
this.log_('Connection created');
|
|
@@ -5791,7 +5791,7 @@ var Connection = /** @class */ (function () {
|
|
|
5791
5791
|
Connection.prototype.connReceiver_ = function (conn) {
|
|
5792
5792
|
var _this = this;
|
|
5793
5793
|
return function (message) {
|
|
5794
|
-
if (_this.state_ !== 2 /* DISCONNECTED */) {
|
|
5794
|
+
if (_this.state_ !== 2 /* RealtimeState.DISCONNECTED */) {
|
|
5795
5795
|
if (conn === _this.rx_) {
|
|
5796
5796
|
_this.onPrimaryMessageReceived_(message);
|
|
5797
5797
|
}
|
|
@@ -5957,7 +5957,7 @@ var Connection = /** @class */ (function () {
|
|
|
5957
5957
|
this.sessionId = handshake.s;
|
|
5958
5958
|
this.repoInfo_.host = host;
|
|
5959
5959
|
// if we've already closed the connection, then don't bother trying to progress further
|
|
5960
|
-
if (this.state_ === 0 /* CONNECTING */) {
|
|
5960
|
+
if (this.state_ === 0 /* RealtimeState.CONNECTING */) {
|
|
5961
5961
|
this.conn_.start();
|
|
5962
5962
|
this.onConnectionEstablished_(this.conn_, timestamp);
|
|
5963
5963
|
if (PROTOCOL_VERSION !== version) {
|
|
@@ -5996,7 +5996,7 @@ var Connection = /** @class */ (function () {
|
|
|
5996
5996
|
this.repoInfo_.host = host;
|
|
5997
5997
|
// TODO: if we're already "connected", we need to trigger a disconnect at the next layer up.
|
|
5998
5998
|
// We don't currently support resets after the connection has already been established
|
|
5999
|
-
if (this.state_ === 1 /* CONNECTED */) {
|
|
5999
|
+
if (this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
6000
6000
|
this.close();
|
|
6001
6001
|
}
|
|
6002
6002
|
else {
|
|
@@ -6009,7 +6009,7 @@ var Connection = /** @class */ (function () {
|
|
|
6009
6009
|
var _this = this;
|
|
6010
6010
|
this.log_('Realtime connection established.');
|
|
6011
6011
|
this.conn_ = conn;
|
|
6012
|
-
this.state_ = 1 /* CONNECTED */;
|
|
6012
|
+
this.state_ = 1 /* RealtimeState.CONNECTED */;
|
|
6013
6013
|
if (this.onReady_) {
|
|
6014
6014
|
this.onReady_(timestamp, this.sessionId);
|
|
6015
6015
|
this.onReady_ = null;
|
|
@@ -6028,7 +6028,7 @@ var Connection = /** @class */ (function () {
|
|
|
6028
6028
|
};
|
|
6029
6029
|
Connection.prototype.sendPingOnPrimaryIfNecessary_ = function () {
|
|
6030
6030
|
// If the connection isn't considered healthy yet, we'll send a noop ping packet request.
|
|
6031
|
-
if (!this.isHealthy_ && this.state_ === 1 /* CONNECTED */) {
|
|
6031
|
+
if (!this.isHealthy_ && this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
6032
6032
|
this.log_('sending ping on primary.');
|
|
6033
6033
|
this.sendData_({ t: 'c', d: { t: PING, d: {} } });
|
|
6034
6034
|
}
|
|
@@ -6049,7 +6049,7 @@ var Connection = /** @class */ (function () {
|
|
|
6049
6049
|
this.conn_ = null;
|
|
6050
6050
|
// NOTE: IF you're seeing a Firefox error for this line, I think it might be because it's getting
|
|
6051
6051
|
// called on window close and RealtimeState.CONNECTING is no longer defined. Just a guess.
|
|
6052
|
-
if (!everConnected && this.state_ === 0 /* CONNECTING */) {
|
|
6052
|
+
if (!everConnected && this.state_ === 0 /* RealtimeState.CONNECTING */) {
|
|
6053
6053
|
this.log_('Realtime connection failed.');
|
|
6054
6054
|
// Since we failed to connect at all, clear any cached entry for this namespace in case the machine went away
|
|
6055
6055
|
if (this.repoInfo_.isCacheableHost()) {
|
|
@@ -6058,7 +6058,7 @@ var Connection = /** @class */ (function () {
|
|
|
6058
6058
|
this.repoInfo_.internalHost = this.repoInfo_.host;
|
|
6059
6059
|
}
|
|
6060
6060
|
}
|
|
6061
|
-
else if (this.state_ === 1 /* CONNECTED */) {
|
|
6061
|
+
else if (this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
6062
6062
|
this.log_('Realtime connection lost.');
|
|
6063
6063
|
}
|
|
6064
6064
|
this.close();
|
|
@@ -6075,7 +6075,7 @@ var Connection = /** @class */ (function () {
|
|
|
6075
6075
|
this.close();
|
|
6076
6076
|
};
|
|
6077
6077
|
Connection.prototype.sendData_ = function (data) {
|
|
6078
|
-
if (this.state_ !== 1 /* CONNECTED */) {
|
|
6078
|
+
if (this.state_ !== 1 /* RealtimeState.CONNECTED */) {
|
|
6079
6079
|
throw 'Connection is not connected';
|
|
6080
6080
|
}
|
|
6081
6081
|
else {
|
|
@@ -6086,9 +6086,9 @@ var Connection = /** @class */ (function () {
|
|
|
6086
6086
|
* Cleans up this connection, calling the appropriate callbacks
|
|
6087
6087
|
*/
|
|
6088
6088
|
Connection.prototype.close = function () {
|
|
6089
|
-
if (this.state_ !== 2 /* DISCONNECTED */) {
|
|
6089
|
+
if (this.state_ !== 2 /* RealtimeState.DISCONNECTED */) {
|
|
6090
6090
|
this.log_('Closing realtime connection.');
|
|
6091
|
-
this.state_ = 2 /* DISCONNECTED */;
|
|
6091
|
+
this.state_ = 2 /* RealtimeState.DISCONNECTED */;
|
|
6092
6092
|
this.closeConnections_();
|
|
6093
6093
|
if (this.onDisconnect_) {
|
|
6094
6094
|
this.onDisconnect_();
|
|
@@ -6194,7 +6194,7 @@ var EventEmitter = /** @class */ (function () {
|
|
|
6194
6194
|
}
|
|
6195
6195
|
if (Array.isArray(this.listeners_[eventType])) {
|
|
6196
6196
|
// Clone the list, since callbacks could add/remove listeners.
|
|
6197
|
-
var listeners = tslib.__spreadArray([], tslib.__read(this.listeners_[eventType]));
|
|
6197
|
+
var listeners = tslib.__spreadArray([], tslib.__read(this.listeners_[eventType]), false);
|
|
6198
6198
|
for (var i = 0; i < listeners.length; i++) {
|
|
6199
6199
|
listeners[i].callback.apply(listeners[i].context, varArgs);
|
|
6200
6200
|
}
|
|
@@ -6839,8 +6839,8 @@ var PersistentConnection = /** @class */ (function (_super) {
|
|
|
6839
6839
|
var indexSpec = '".indexOn": "' + query._queryParams.getIndex().toString() + '"';
|
|
6840
6840
|
var indexPath = query._path.toString();
|
|
6841
6841
|
warn$1("Using an unspecified index. Your data will be downloaded and " +
|
|
6842
|
-
|
|
6843
|
-
(indexPath
|
|
6842
|
+
"filtered on the client. Consider adding ".concat(indexSpec, " at ") +
|
|
6843
|
+
"".concat(indexPath, " to your security rules for better performance."));
|
|
6844
6844
|
}
|
|
6845
6845
|
}
|
|
6846
6846
|
};
|
|
@@ -9519,153 +9519,6 @@ var ValueIndex = /** @class */ (function (_super) {
|
|
|
9519
9519
|
}(Index));
|
|
9520
9520
|
var VALUE_INDEX = new ValueIndex();
|
|
9521
9521
|
|
|
9522
|
-
/**
|
|
9523
|
-
* @license
|
|
9524
|
-
* Copyright 2017 Google LLC
|
|
9525
|
-
*
|
|
9526
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9527
|
-
* you may not use this file except in compliance with the License.
|
|
9528
|
-
* You may obtain a copy of the License at
|
|
9529
|
-
*
|
|
9530
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9531
|
-
*
|
|
9532
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9533
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9534
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9535
|
-
* See the License for the specific language governing permissions and
|
|
9536
|
-
* limitations under the License.
|
|
9537
|
-
*/
|
|
9538
|
-
// Modeled after base64 web-safe chars, but ordered by ASCII.
|
|
9539
|
-
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
9540
|
-
var MIN_PUSH_CHAR = '-';
|
|
9541
|
-
var MAX_PUSH_CHAR = 'z';
|
|
9542
|
-
var MAX_KEY_LEN = 786;
|
|
9543
|
-
/**
|
|
9544
|
-
* Fancy ID generator that creates 20-character string identifiers with the
|
|
9545
|
-
* following properties:
|
|
9546
|
-
*
|
|
9547
|
-
* 1. They're based on timestamp so that they sort *after* any existing ids.
|
|
9548
|
-
* 2. They contain 72-bits of random data after the timestamp so that IDs won't
|
|
9549
|
-
* collide with other clients' IDs.
|
|
9550
|
-
* 3. They sort *lexicographically* (so the timestamp is converted to characters
|
|
9551
|
-
* that will sort properly).
|
|
9552
|
-
* 4. They're monotonically increasing. Even if you generate more than one in
|
|
9553
|
-
* the same timestamp, the latter ones will sort after the former ones. We do
|
|
9554
|
-
* this by using the previous random bits but "incrementing" them by 1 (only
|
|
9555
|
-
* in the case of a timestamp collision).
|
|
9556
|
-
*/
|
|
9557
|
-
var nextPushId = (function () {
|
|
9558
|
-
// Timestamp of last push, used to prevent local collisions if you push twice
|
|
9559
|
-
// in one ms.
|
|
9560
|
-
var lastPushTime = 0;
|
|
9561
|
-
// We generate 72-bits of randomness which get turned into 12 characters and
|
|
9562
|
-
// appended to the timestamp to prevent collisions with other clients. We
|
|
9563
|
-
// store the last characters we generated because in the event of a collision,
|
|
9564
|
-
// we'll use those same characters except "incremented" by one.
|
|
9565
|
-
var lastRandChars = [];
|
|
9566
|
-
return function (now) {
|
|
9567
|
-
var duplicateTime = now === lastPushTime;
|
|
9568
|
-
lastPushTime = now;
|
|
9569
|
-
var i;
|
|
9570
|
-
var timeStampChars = new Array(8);
|
|
9571
|
-
for (i = 7; i >= 0; i--) {
|
|
9572
|
-
timeStampChars[i] = PUSH_CHARS.charAt(now % 64);
|
|
9573
|
-
// NOTE: Can't use << here because javascript will convert to int and lose
|
|
9574
|
-
// the upper bits.
|
|
9575
|
-
now = Math.floor(now / 64);
|
|
9576
|
-
}
|
|
9577
|
-
util.assert(now === 0, 'Cannot push at time == 0');
|
|
9578
|
-
var id = timeStampChars.join('');
|
|
9579
|
-
if (!duplicateTime) {
|
|
9580
|
-
for (i = 0; i < 12; i++) {
|
|
9581
|
-
lastRandChars[i] = Math.floor(Math.random() * 64);
|
|
9582
|
-
}
|
|
9583
|
-
}
|
|
9584
|
-
else {
|
|
9585
|
-
// If the timestamp hasn't changed since last push, use the same random
|
|
9586
|
-
// number, except incremented by 1.
|
|
9587
|
-
for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) {
|
|
9588
|
-
lastRandChars[i] = 0;
|
|
9589
|
-
}
|
|
9590
|
-
lastRandChars[i]++;
|
|
9591
|
-
}
|
|
9592
|
-
for (i = 0; i < 12; i++) {
|
|
9593
|
-
id += PUSH_CHARS.charAt(lastRandChars[i]);
|
|
9594
|
-
}
|
|
9595
|
-
util.assert(id.length === 20, 'nextPushId: Length should be 20.');
|
|
9596
|
-
return id;
|
|
9597
|
-
};
|
|
9598
|
-
})();
|
|
9599
|
-
var successor = function (key) {
|
|
9600
|
-
if (key === '' + INTEGER_32_MAX) {
|
|
9601
|
-
// See https://firebase.google.com/docs/database/web/lists-of-data#data-order
|
|
9602
|
-
return MIN_PUSH_CHAR;
|
|
9603
|
-
}
|
|
9604
|
-
var keyAsInt = tryParseInt(key);
|
|
9605
|
-
if (keyAsInt != null) {
|
|
9606
|
-
return '' + (keyAsInt + 1);
|
|
9607
|
-
}
|
|
9608
|
-
var next = new Array(key.length);
|
|
9609
|
-
for (var i_1 = 0; i_1 < next.length; i_1++) {
|
|
9610
|
-
next[i_1] = key.charAt(i_1);
|
|
9611
|
-
}
|
|
9612
|
-
if (next.length < MAX_KEY_LEN) {
|
|
9613
|
-
next.push(MIN_PUSH_CHAR);
|
|
9614
|
-
return next.join('');
|
|
9615
|
-
}
|
|
9616
|
-
var i = next.length - 1;
|
|
9617
|
-
while (i >= 0 && next[i] === MAX_PUSH_CHAR) {
|
|
9618
|
-
i--;
|
|
9619
|
-
}
|
|
9620
|
-
// `successor` was called on the largest possible key, so return the
|
|
9621
|
-
// MAX_NAME, which sorts larger than all keys.
|
|
9622
|
-
if (i === -1) {
|
|
9623
|
-
return MAX_NAME;
|
|
9624
|
-
}
|
|
9625
|
-
var source = next[i];
|
|
9626
|
-
var sourcePlusOne = PUSH_CHARS.charAt(PUSH_CHARS.indexOf(source) + 1);
|
|
9627
|
-
next[i] = sourcePlusOne;
|
|
9628
|
-
return next.slice(0, i + 1).join('');
|
|
9629
|
-
};
|
|
9630
|
-
// `key` is assumed to be non-empty.
|
|
9631
|
-
var predecessor = function (key) {
|
|
9632
|
-
if (key === '' + INTEGER_32_MIN) {
|
|
9633
|
-
return MIN_NAME;
|
|
9634
|
-
}
|
|
9635
|
-
var keyAsInt = tryParseInt(key);
|
|
9636
|
-
if (keyAsInt != null) {
|
|
9637
|
-
return '' + (keyAsInt - 1);
|
|
9638
|
-
}
|
|
9639
|
-
var next = new Array(key.length);
|
|
9640
|
-
for (var i = 0; i < next.length; i++) {
|
|
9641
|
-
next[i] = key.charAt(i);
|
|
9642
|
-
}
|
|
9643
|
-
// If `key` ends in `MIN_PUSH_CHAR`, the largest key lexicographically
|
|
9644
|
-
// smaller than `key`, is `key[0:key.length - 1]`. The next key smaller
|
|
9645
|
-
// than that, `predecessor(predecessor(key))`, is
|
|
9646
|
-
//
|
|
9647
|
-
// `key[0:key.length - 2] + (key[key.length - 1] - 1) + \
|
|
9648
|
-
// { MAX_PUSH_CHAR repeated MAX_KEY_LEN - (key.length - 1) times }
|
|
9649
|
-
//
|
|
9650
|
-
// analogous to increment/decrement for base-10 integers.
|
|
9651
|
-
//
|
|
9652
|
-
// This works because lexigographic comparison works character-by-character,
|
|
9653
|
-
// using length as a tie-breaker if one key is a prefix of the other.
|
|
9654
|
-
if (next[next.length - 1] === MIN_PUSH_CHAR) {
|
|
9655
|
-
if (next.length === 1) {
|
|
9656
|
-
// See https://firebase.google.com/docs/database/web/lists-of-data#orderbykey
|
|
9657
|
-
return '' + INTEGER_32_MAX;
|
|
9658
|
-
}
|
|
9659
|
-
delete next[next.length - 1];
|
|
9660
|
-
return next.join('');
|
|
9661
|
-
}
|
|
9662
|
-
// Replace the last character with it's immediate predecessor, and
|
|
9663
|
-
// fill the suffix of the key with MAX_PUSH_CHAR. This is the
|
|
9664
|
-
// lexicographically largest possible key smaller than `key`.
|
|
9665
|
-
next[next.length - 1] = PUSH_CHARS.charAt(PUSH_CHARS.indexOf(next[next.length - 1]) - 1);
|
|
9666
|
-
return next.join('') + MAX_PUSH_CHAR.repeat(MAX_KEY_LEN - next.length);
|
|
9667
|
-
};
|
|
9668
|
-
|
|
9669
9522
|
/**
|
|
9670
9523
|
* @license
|
|
9671
9524
|
* Copyright 2017 Google LLC
|
|
@@ -9683,24 +9536,24 @@ var predecessor = function (key) {
|
|
|
9683
9536
|
* limitations under the License.
|
|
9684
9537
|
*/
|
|
9685
9538
|
function changeValue(snapshotNode) {
|
|
9686
|
-
return { type: "value" /* VALUE */, snapshotNode: snapshotNode };
|
|
9539
|
+
return { type: "value" /* ChangeType.VALUE */, snapshotNode: snapshotNode };
|
|
9687
9540
|
}
|
|
9688
9541
|
function changeChildAdded(childName, snapshotNode) {
|
|
9689
|
-
return { type: "child_added" /* CHILD_ADDED */, snapshotNode: snapshotNode, childName: childName };
|
|
9542
|
+
return { type: "child_added" /* ChangeType.CHILD_ADDED */, snapshotNode: snapshotNode, childName: childName };
|
|
9690
9543
|
}
|
|
9691
9544
|
function changeChildRemoved(childName, snapshotNode) {
|
|
9692
|
-
return { type: "child_removed" /* CHILD_REMOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
9545
|
+
return { type: "child_removed" /* ChangeType.CHILD_REMOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
9693
9546
|
}
|
|
9694
9547
|
function changeChildChanged(childName, snapshotNode, oldSnap) {
|
|
9695
9548
|
return {
|
|
9696
|
-
type: "child_changed" /* CHILD_CHANGED */,
|
|
9549
|
+
type: "child_changed" /* ChangeType.CHILD_CHANGED */,
|
|
9697
9550
|
snapshotNode: snapshotNode,
|
|
9698
9551
|
childName: childName,
|
|
9699
9552
|
oldSnap: oldSnap
|
|
9700
9553
|
};
|
|
9701
9554
|
}
|
|
9702
9555
|
function changeChildMoved(childName, snapshotNode) {
|
|
9703
|
-
return { type: "child_moved" /* CHILD_MOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
9556
|
+
return { type: "child_moved" /* ChangeType.CHILD_MOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
9704
9557
|
}
|
|
9705
9558
|
|
|
9706
9559
|
/**
|
|
@@ -9835,6 +9688,8 @@ var RangedFilter = /** @class */ (function () {
|
|
|
9835
9688
|
this.index_ = params.getIndex();
|
|
9836
9689
|
this.startPost_ = RangedFilter.getStartPost_(params);
|
|
9837
9690
|
this.endPost_ = RangedFilter.getEndPost_(params);
|
|
9691
|
+
this.startIsInclusive_ = !params.startAfterSet_;
|
|
9692
|
+
this.endIsInclusive_ = !params.endBeforeSet_;
|
|
9838
9693
|
}
|
|
9839
9694
|
RangedFilter.prototype.getStartPost = function () {
|
|
9840
9695
|
return this.startPost_;
|
|
@@ -9843,8 +9698,13 @@ var RangedFilter = /** @class */ (function () {
|
|
|
9843
9698
|
return this.endPost_;
|
|
9844
9699
|
};
|
|
9845
9700
|
RangedFilter.prototype.matches = function (node) {
|
|
9846
|
-
|
|
9847
|
-
this.index_.compare(
|
|
9701
|
+
var isWithinStart = this.startIsInclusive_
|
|
9702
|
+
? this.index_.compare(this.getStartPost(), node) <= 0
|
|
9703
|
+
: this.index_.compare(this.getStartPost(), node) < 0;
|
|
9704
|
+
var isWithinEnd = this.endIsInclusive_
|
|
9705
|
+
? this.index_.compare(node, this.getEndPost()) <= 0
|
|
9706
|
+
: this.index_.compare(node, this.getEndPost()) < 0;
|
|
9707
|
+
return isWithinStart && isWithinEnd;
|
|
9848
9708
|
};
|
|
9849
9709
|
RangedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) {
|
|
9850
9710
|
if (!this.matches(new NamedNode(key, newChild))) {
|
|
@@ -9923,10 +9783,27 @@ var RangedFilter = /** @class */ (function () {
|
|
|
9923
9783
|
*/
|
|
9924
9784
|
var LimitedFilter = /** @class */ (function () {
|
|
9925
9785
|
function LimitedFilter(params) {
|
|
9786
|
+
var _this = this;
|
|
9787
|
+
this.withinDirectionalStart = function (node) {
|
|
9788
|
+
return _this.reverse_ ? _this.withinEndPost(node) : _this.withinStartPost(node);
|
|
9789
|
+
};
|
|
9790
|
+
this.withinDirectionalEnd = function (node) {
|
|
9791
|
+
return _this.reverse_ ? _this.withinStartPost(node) : _this.withinEndPost(node);
|
|
9792
|
+
};
|
|
9793
|
+
this.withinStartPost = function (node) {
|
|
9794
|
+
var compareRes = _this.index_.compare(_this.rangedFilter_.getStartPost(), node);
|
|
9795
|
+
return _this.startIsInclusive_ ? compareRes <= 0 : compareRes < 0;
|
|
9796
|
+
};
|
|
9797
|
+
this.withinEndPost = function (node) {
|
|
9798
|
+
var compareRes = _this.index_.compare(node, _this.rangedFilter_.getEndPost());
|
|
9799
|
+
return _this.endIsInclusive_ ? compareRes <= 0 : compareRes < 0;
|
|
9800
|
+
};
|
|
9926
9801
|
this.rangedFilter_ = new RangedFilter(params);
|
|
9927
9802
|
this.index_ = params.getIndex();
|
|
9928
9803
|
this.limit_ = params.getLimit();
|
|
9929
9804
|
this.reverse_ = !params.isViewFromLeft();
|
|
9805
|
+
this.startIsInclusive_ = !params.startAfterSet_;
|
|
9806
|
+
this.endIsInclusive_ = !params.endBeforeSet_;
|
|
9930
9807
|
}
|
|
9931
9808
|
LimitedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) {
|
|
9932
9809
|
if (!this.rangedFilter_.matches(new NamedNode(key, newChild))) {
|
|
@@ -9967,23 +9844,18 @@ var LimitedFilter = /** @class */ (function () {
|
|
|
9967
9844
|
var count = 0;
|
|
9968
9845
|
while (iterator.hasNext() && count < this.limit_) {
|
|
9969
9846
|
var next = iterator.getNext();
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
this.index_.compare(this.rangedFilter_.getStartPost(), next) <= 0;
|
|
9847
|
+
if (!this.withinDirectionalStart(next)) {
|
|
9848
|
+
// if we have not reached the start, skip to the next element
|
|
9849
|
+
continue;
|
|
9974
9850
|
}
|
|
9975
|
-
else {
|
|
9976
|
-
|
|
9977
|
-
|
|
9851
|
+
else if (!this.withinDirectionalEnd(next)) {
|
|
9852
|
+
// if we have reached the end, stop adding elements
|
|
9853
|
+
break;
|
|
9978
9854
|
}
|
|
9979
|
-
|
|
9855
|
+
else {
|
|
9980
9856
|
filtered = filtered.updateImmediateChild(next.name, next.node);
|
|
9981
9857
|
count++;
|
|
9982
9858
|
}
|
|
9983
|
-
else {
|
|
9984
|
-
// if we have reached the end post, we cannot keep adding elemments
|
|
9985
|
-
break;
|
|
9986
|
-
}
|
|
9987
9859
|
}
|
|
9988
9860
|
}
|
|
9989
9861
|
else {
|
|
@@ -9991,32 +9863,19 @@ var LimitedFilter = /** @class */ (function () {
|
|
|
9991
9863
|
filtered = newSnap.withIndex(this.index_);
|
|
9992
9864
|
// Don't support priorities on queries
|
|
9993
9865
|
filtered = filtered.updatePriority(ChildrenNode.EMPTY_NODE);
|
|
9994
|
-
var startPost = void 0;
|
|
9995
|
-
var endPost = void 0;
|
|
9996
|
-
var cmp = void 0;
|
|
9997
9866
|
var iterator = void 0;
|
|
9998
9867
|
if (this.reverse_) {
|
|
9999
9868
|
iterator = filtered.getReverseIterator(this.index_);
|
|
10000
|
-
startPost = this.rangedFilter_.getEndPost();
|
|
10001
|
-
endPost = this.rangedFilter_.getStartPost();
|
|
10002
|
-
var indexCompare_1 = this.index_.getCompare();
|
|
10003
|
-
cmp = function (a, b) { return indexCompare_1(b, a); };
|
|
10004
9869
|
}
|
|
10005
9870
|
else {
|
|
10006
9871
|
iterator = filtered.getIterator(this.index_);
|
|
10007
|
-
startPost = this.rangedFilter_.getStartPost();
|
|
10008
|
-
endPost = this.rangedFilter_.getEndPost();
|
|
10009
|
-
cmp = this.index_.getCompare();
|
|
10010
9872
|
}
|
|
10011
9873
|
var count = 0;
|
|
10012
|
-
var foundStartPost = false;
|
|
10013
9874
|
while (iterator.hasNext()) {
|
|
10014
9875
|
var next = iterator.getNext();
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
}
|
|
10019
|
-
var inRange = foundStartPost && count < this.limit_ && cmp(next, endPost) <= 0;
|
|
9876
|
+
var inRange = count < this.limit_ &&
|
|
9877
|
+
this.withinDirectionalStart(next) &&
|
|
9878
|
+
this.withinDirectionalEnd(next);
|
|
10020
9879
|
if (inRange) {
|
|
10021
9880
|
count++;
|
|
10022
9881
|
}
|
|
@@ -10148,10 +10007,10 @@ var QueryParams = /** @class */ (function () {
|
|
|
10148
10007
|
this.limitSet_ = false;
|
|
10149
10008
|
this.startSet_ = false;
|
|
10150
10009
|
this.startNameSet_ = false;
|
|
10151
|
-
this.startAfterSet_ = false;
|
|
10010
|
+
this.startAfterSet_ = false; // can only be true if startSet_ is true
|
|
10152
10011
|
this.endSet_ = false;
|
|
10153
10012
|
this.endNameSet_ = false;
|
|
10154
|
-
this.endBeforeSet_ = false;
|
|
10013
|
+
this.endBeforeSet_ = false; // can only be true if endSet_ is true
|
|
10155
10014
|
this.limit_ = 0;
|
|
10156
10015
|
this.viewFrom_ = '';
|
|
10157
10016
|
this.indexStartValue_ = null;
|
|
@@ -10163,12 +10022,6 @@ var QueryParams = /** @class */ (function () {
|
|
|
10163
10022
|
QueryParams.prototype.hasStart = function () {
|
|
10164
10023
|
return this.startSet_;
|
|
10165
10024
|
};
|
|
10166
|
-
QueryParams.prototype.hasStartAfter = function () {
|
|
10167
|
-
return this.startAfterSet_;
|
|
10168
|
-
};
|
|
10169
|
-
QueryParams.prototype.hasEndBefore = function () {
|
|
10170
|
-
return this.endBeforeSet_;
|
|
10171
|
-
};
|
|
10172
10025
|
/**
|
|
10173
10026
|
* @returns True if it would return from left.
|
|
10174
10027
|
*/
|
|
@@ -10181,7 +10034,7 @@ var QueryParams = /** @class */ (function () {
|
|
|
10181
10034
|
return this.startSet_;
|
|
10182
10035
|
}
|
|
10183
10036
|
else {
|
|
10184
|
-
return this.viewFrom_ === "l" /* VIEW_FROM_LEFT */;
|
|
10037
|
+
return this.viewFrom_ === "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
10185
10038
|
}
|
|
10186
10039
|
};
|
|
10187
10040
|
/**
|
|
@@ -10257,10 +10110,12 @@ var QueryParams = /** @class */ (function () {
|
|
|
10257
10110
|
copy.limitSet_ = this.limitSet_;
|
|
10258
10111
|
copy.limit_ = this.limit_;
|
|
10259
10112
|
copy.startSet_ = this.startSet_;
|
|
10113
|
+
copy.startAfterSet_ = this.startAfterSet_;
|
|
10260
10114
|
copy.indexStartValue_ = this.indexStartValue_;
|
|
10261
10115
|
copy.startNameSet_ = this.startNameSet_;
|
|
10262
10116
|
copy.indexStartName_ = this.indexStartName_;
|
|
10263
10117
|
copy.endSet_ = this.endSet_;
|
|
10118
|
+
copy.endBeforeSet_ = this.endBeforeSet_;
|
|
10264
10119
|
copy.indexEndValue_ = this.indexEndValue_;
|
|
10265
10120
|
copy.endNameSet_ = this.endNameSet_;
|
|
10266
10121
|
copy.indexEndName_ = this.indexEndName_;
|
|
@@ -10285,14 +10140,14 @@ function queryParamsLimitToFirst(queryParams, newLimit) {
|
|
|
10285
10140
|
var newParams = queryParams.copy();
|
|
10286
10141
|
newParams.limitSet_ = true;
|
|
10287
10142
|
newParams.limit_ = newLimit;
|
|
10288
|
-
newParams.viewFrom_ = "l" /* VIEW_FROM_LEFT */;
|
|
10143
|
+
newParams.viewFrom_ = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
10289
10144
|
return newParams;
|
|
10290
10145
|
}
|
|
10291
10146
|
function queryParamsLimitToLast(queryParams, newLimit) {
|
|
10292
10147
|
var newParams = queryParams.copy();
|
|
10293
10148
|
newParams.limitSet_ = true;
|
|
10294
10149
|
newParams.limit_ = newLimit;
|
|
10295
|
-
newParams.viewFrom_ = "r" /* VIEW_FROM_RIGHT */;
|
|
10150
|
+
newParams.viewFrom_ = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
10296
10151
|
return newParams;
|
|
10297
10152
|
}
|
|
10298
10153
|
function queryParamsStartAt(queryParams, indexValue, key) {
|
|
@@ -10314,21 +10169,11 @@ function queryParamsStartAt(queryParams, indexValue, key) {
|
|
|
10314
10169
|
}
|
|
10315
10170
|
function queryParamsStartAfter(queryParams, indexValue, key) {
|
|
10316
10171
|
var params;
|
|
10317
|
-
if (queryParams.index_ === KEY_INDEX) {
|
|
10318
|
-
if (typeof indexValue === 'string') {
|
|
10319
|
-
indexValue = successor(indexValue);
|
|
10320
|
-
}
|
|
10172
|
+
if (queryParams.index_ === KEY_INDEX || !!key) {
|
|
10321
10173
|
params = queryParamsStartAt(queryParams, indexValue, key);
|
|
10322
10174
|
}
|
|
10323
10175
|
else {
|
|
10324
|
-
|
|
10325
|
-
if (key == null) {
|
|
10326
|
-
childKey = MAX_NAME;
|
|
10327
|
-
}
|
|
10328
|
-
else {
|
|
10329
|
-
childKey = successor(key);
|
|
10330
|
-
}
|
|
10331
|
-
params = queryParamsStartAt(queryParams, indexValue, childKey);
|
|
10176
|
+
params = queryParamsStartAt(queryParams, indexValue, MAX_NAME);
|
|
10332
10177
|
}
|
|
10333
10178
|
params.startAfterSet_ = true;
|
|
10334
10179
|
return params;
|
|
@@ -10351,22 +10196,12 @@ function queryParamsEndAt(queryParams, indexValue, key) {
|
|
|
10351
10196
|
return newParams;
|
|
10352
10197
|
}
|
|
10353
10198
|
function queryParamsEndBefore(queryParams, indexValue, key) {
|
|
10354
|
-
var childKey;
|
|
10355
10199
|
var params;
|
|
10356
|
-
if (queryParams.index_ === KEY_INDEX) {
|
|
10357
|
-
if (typeof indexValue === 'string') {
|
|
10358
|
-
indexValue = predecessor(indexValue);
|
|
10359
|
-
}
|
|
10200
|
+
if (queryParams.index_ === KEY_INDEX || !!key) {
|
|
10360
10201
|
params = queryParamsEndAt(queryParams, indexValue, key);
|
|
10361
10202
|
}
|
|
10362
10203
|
else {
|
|
10363
|
-
|
|
10364
|
-
childKey = MIN_NAME;
|
|
10365
|
-
}
|
|
10366
|
-
else {
|
|
10367
|
-
childKey = predecessor(key);
|
|
10368
|
-
}
|
|
10369
|
-
params = queryParamsEndAt(queryParams, indexValue, childKey);
|
|
10204
|
+
params = queryParamsEndAt(queryParams, indexValue, MIN_NAME);
|
|
10370
10205
|
}
|
|
10371
10206
|
params.endBeforeSet_ = true;
|
|
10372
10207
|
return params;
|
|
@@ -10388,39 +10223,43 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
10388
10223
|
}
|
|
10389
10224
|
var orderBy;
|
|
10390
10225
|
if (queryParams.index_ === PRIORITY_INDEX) {
|
|
10391
|
-
orderBy = "$priority" /* PRIORITY_INDEX */;
|
|
10226
|
+
orderBy = "$priority" /* REST_QUERY_CONSTANTS.PRIORITY_INDEX */;
|
|
10392
10227
|
}
|
|
10393
10228
|
else if (queryParams.index_ === VALUE_INDEX) {
|
|
10394
|
-
orderBy = "$value" /* VALUE_INDEX */;
|
|
10229
|
+
orderBy = "$value" /* REST_QUERY_CONSTANTS.VALUE_INDEX */;
|
|
10395
10230
|
}
|
|
10396
10231
|
else if (queryParams.index_ === KEY_INDEX) {
|
|
10397
|
-
orderBy = "$key" /* KEY_INDEX */;
|
|
10232
|
+
orderBy = "$key" /* REST_QUERY_CONSTANTS.KEY_INDEX */;
|
|
10398
10233
|
}
|
|
10399
10234
|
else {
|
|
10400
10235
|
util.assert(queryParams.index_ instanceof PathIndex, 'Unrecognized index type!');
|
|
10401
10236
|
orderBy = queryParams.index_.toString();
|
|
10402
10237
|
}
|
|
10403
|
-
qs["orderBy" /* ORDER_BY */] = util.stringify(orderBy);
|
|
10238
|
+
qs["orderBy" /* REST_QUERY_CONSTANTS.ORDER_BY */] = util.stringify(orderBy);
|
|
10404
10239
|
if (queryParams.startSet_) {
|
|
10405
|
-
|
|
10240
|
+
var startParam = queryParams.startAfterSet_
|
|
10241
|
+
? "startAfter" /* REST_QUERY_CONSTANTS.START_AFTER */
|
|
10242
|
+
: "startAt" /* REST_QUERY_CONSTANTS.START_AT */;
|
|
10243
|
+
qs[startParam] = util.stringify(queryParams.indexStartValue_);
|
|
10406
10244
|
if (queryParams.startNameSet_) {
|
|
10407
|
-
qs[
|
|
10408
|
-
',' + util.stringify(queryParams.indexStartName_);
|
|
10245
|
+
qs[startParam] += ',' + util.stringify(queryParams.indexStartName_);
|
|
10409
10246
|
}
|
|
10410
10247
|
}
|
|
10411
10248
|
if (queryParams.endSet_) {
|
|
10412
|
-
|
|
10249
|
+
var endParam = queryParams.endBeforeSet_
|
|
10250
|
+
? "endBefore" /* REST_QUERY_CONSTANTS.END_BEFORE */
|
|
10251
|
+
: "endAt" /* REST_QUERY_CONSTANTS.END_AT */;
|
|
10252
|
+
qs[endParam] = util.stringify(queryParams.indexEndValue_);
|
|
10413
10253
|
if (queryParams.endNameSet_) {
|
|
10414
|
-
qs[
|
|
10415
|
-
',' + util.stringify(queryParams.indexEndName_);
|
|
10254
|
+
qs[endParam] += ',' + util.stringify(queryParams.indexEndName_);
|
|
10416
10255
|
}
|
|
10417
10256
|
}
|
|
10418
10257
|
if (queryParams.limitSet_) {
|
|
10419
10258
|
if (queryParams.isViewFromLeft()) {
|
|
10420
|
-
qs["limitToFirst" /* LIMIT_TO_FIRST */] = queryParams.limit_;
|
|
10259
|
+
qs["limitToFirst" /* REST_QUERY_CONSTANTS.LIMIT_TO_FIRST */] = queryParams.limit_;
|
|
10421
10260
|
}
|
|
10422
10261
|
else {
|
|
10423
|
-
qs["limitToLast" /* LIMIT_TO_LAST */] = queryParams.limit_;
|
|
10262
|
+
qs["limitToLast" /* REST_QUERY_CONSTANTS.LIMIT_TO_LAST */] = queryParams.limit_;
|
|
10424
10263
|
}
|
|
10425
10264
|
}
|
|
10426
10265
|
return qs;
|
|
@@ -10428,35 +10267,39 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
10428
10267
|
function queryParamsGetQueryObject(queryParams) {
|
|
10429
10268
|
var obj = {};
|
|
10430
10269
|
if (queryParams.startSet_) {
|
|
10431
|
-
obj["sp" /* INDEX_START_VALUE */] =
|
|
10270
|
+
obj["sp" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_VALUE */] =
|
|
10432
10271
|
queryParams.indexStartValue_;
|
|
10433
10272
|
if (queryParams.startNameSet_) {
|
|
10434
|
-
obj["sn" /* INDEX_START_NAME */] =
|
|
10273
|
+
obj["sn" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_NAME */] =
|
|
10435
10274
|
queryParams.indexStartName_;
|
|
10436
10275
|
}
|
|
10276
|
+
obj["sin" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_IS_INCLUSIVE */] =
|
|
10277
|
+
!queryParams.startAfterSet_;
|
|
10437
10278
|
}
|
|
10438
10279
|
if (queryParams.endSet_) {
|
|
10439
|
-
obj["ep" /* INDEX_END_VALUE */] = queryParams.indexEndValue_;
|
|
10280
|
+
obj["ep" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_VALUE */] = queryParams.indexEndValue_;
|
|
10440
10281
|
if (queryParams.endNameSet_) {
|
|
10441
|
-
obj["en" /* INDEX_END_NAME */] = queryParams.indexEndName_;
|
|
10282
|
+
obj["en" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_NAME */] = queryParams.indexEndName_;
|
|
10442
10283
|
}
|
|
10284
|
+
obj["ein" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_IS_INCLUSIVE */] =
|
|
10285
|
+
!queryParams.endBeforeSet_;
|
|
10443
10286
|
}
|
|
10444
10287
|
if (queryParams.limitSet_) {
|
|
10445
|
-
obj["l" /* LIMIT */] = queryParams.limit_;
|
|
10288
|
+
obj["l" /* WIRE_PROTOCOL_CONSTANTS.LIMIT */] = queryParams.limit_;
|
|
10446
10289
|
var viewFrom = queryParams.viewFrom_;
|
|
10447
10290
|
if (viewFrom === '') {
|
|
10448
10291
|
if (queryParams.isViewFromLeft()) {
|
|
10449
|
-
viewFrom = "l" /* VIEW_FROM_LEFT */;
|
|
10292
|
+
viewFrom = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
10450
10293
|
}
|
|
10451
10294
|
else {
|
|
10452
|
-
viewFrom = "r" /* VIEW_FROM_RIGHT */;
|
|
10295
|
+
viewFrom = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
10453
10296
|
}
|
|
10454
10297
|
}
|
|
10455
|
-
obj["vf" /* VIEW_FROM */] = viewFrom;
|
|
10298
|
+
obj["vf" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM */] = viewFrom;
|
|
10456
10299
|
}
|
|
10457
10300
|
// For now, priority index is the default, so we only specify if it's some other index
|
|
10458
10301
|
if (queryParams.index_ !== PRIORITY_INDEX) {
|
|
10459
|
-
obj["i" /* INDEX */] = queryParams.index_.toString();
|
|
10302
|
+
obj["i" /* WIRE_PROTOCOL_CONSTANTS.INDEX */] = queryParams.index_.toString();
|
|
10460
10303
|
}
|
|
10461
10304
|
return obj;
|
|
10462
10305
|
}
|
|
@@ -11218,16 +11061,16 @@ function eventGeneratorGenerateEventsForChanges(eventGenerator, changes, eventCa
|
|
|
11218
11061
|
var events = [];
|
|
11219
11062
|
var moves = [];
|
|
11220
11063
|
changes.forEach(function (change) {
|
|
11221
|
-
if (change.type === "child_changed" /* CHILD_CHANGED */ &&
|
|
11064
|
+
if (change.type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
11222
11065
|
eventGenerator.index_.indexedValueChanged(change.oldSnap, change.snapshotNode)) {
|
|
11223
11066
|
moves.push(changeChildMoved(change.childName, change.snapshotNode));
|
|
11224
11067
|
}
|
|
11225
11068
|
});
|
|
11226
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_removed" /* CHILD_REMOVED */, changes, eventRegistrations, eventCache);
|
|
11227
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_added" /* CHILD_ADDED */, changes, eventRegistrations, eventCache);
|
|
11228
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_moved" /* CHILD_MOVED */, moves, eventRegistrations, eventCache);
|
|
11229
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_changed" /* CHILD_CHANGED */, changes, eventRegistrations, eventCache);
|
|
11230
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "value" /* VALUE */, changes, eventRegistrations, eventCache);
|
|
11069
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_removed" /* ChangeType.CHILD_REMOVED */, changes, eventRegistrations, eventCache);
|
|
11070
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_added" /* ChangeType.CHILD_ADDED */, changes, eventRegistrations, eventCache);
|
|
11071
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_moved" /* ChangeType.CHILD_MOVED */, moves, eventRegistrations, eventCache);
|
|
11072
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_changed" /* ChangeType.CHILD_CHANGED */, changes, eventRegistrations, eventCache);
|
|
11073
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "value" /* ChangeType.VALUE */, changes, eventRegistrations, eventCache);
|
|
11231
11074
|
return events;
|
|
11232
11075
|
}
|
|
11233
11076
|
/**
|
|
@@ -12313,31 +12156,31 @@ var ChildChangeAccumulator = /** @class */ (function () {
|
|
|
12313
12156
|
ChildChangeAccumulator.prototype.trackChildChange = function (change) {
|
|
12314
12157
|
var type = change.type;
|
|
12315
12158
|
var childKey = change.childName;
|
|
12316
|
-
util.assert(type === "child_added" /* CHILD_ADDED */ ||
|
|
12317
|
-
type === "child_changed" /* CHILD_CHANGED */ ||
|
|
12318
|
-
type === "child_removed" /* CHILD_REMOVED */, 'Only child changes supported for tracking');
|
|
12159
|
+
util.assert(type === "child_added" /* ChangeType.CHILD_ADDED */ ||
|
|
12160
|
+
type === "child_changed" /* ChangeType.CHILD_CHANGED */ ||
|
|
12161
|
+
type === "child_removed" /* ChangeType.CHILD_REMOVED */, 'Only child changes supported for tracking');
|
|
12319
12162
|
util.assert(childKey !== '.priority', 'Only non-priority child changes can be tracked.');
|
|
12320
12163
|
var oldChange = this.changeMap.get(childKey);
|
|
12321
12164
|
if (oldChange) {
|
|
12322
12165
|
var oldType = oldChange.type;
|
|
12323
|
-
if (type === "child_added" /* CHILD_ADDED */ &&
|
|
12324
|
-
oldType === "child_removed" /* CHILD_REMOVED */) {
|
|
12166
|
+
if (type === "child_added" /* ChangeType.CHILD_ADDED */ &&
|
|
12167
|
+
oldType === "child_removed" /* ChangeType.CHILD_REMOVED */) {
|
|
12325
12168
|
this.changeMap.set(childKey, changeChildChanged(childKey, change.snapshotNode, oldChange.snapshotNode));
|
|
12326
12169
|
}
|
|
12327
|
-
else if (type === "child_removed" /* CHILD_REMOVED */ &&
|
|
12328
|
-
oldType === "child_added" /* CHILD_ADDED */) {
|
|
12170
|
+
else if (type === "child_removed" /* ChangeType.CHILD_REMOVED */ &&
|
|
12171
|
+
oldType === "child_added" /* ChangeType.CHILD_ADDED */) {
|
|
12329
12172
|
this.changeMap.delete(childKey);
|
|
12330
12173
|
}
|
|
12331
|
-
else if (type === "child_removed" /* CHILD_REMOVED */ &&
|
|
12332
|
-
oldType === "child_changed" /* CHILD_CHANGED */) {
|
|
12174
|
+
else if (type === "child_removed" /* ChangeType.CHILD_REMOVED */ &&
|
|
12175
|
+
oldType === "child_changed" /* ChangeType.CHILD_CHANGED */) {
|
|
12333
12176
|
this.changeMap.set(childKey, changeChildRemoved(childKey, oldChange.oldSnap));
|
|
12334
12177
|
}
|
|
12335
|
-
else if (type === "child_changed" /* CHILD_CHANGED */ &&
|
|
12336
|
-
oldType === "child_added" /* CHILD_ADDED */) {
|
|
12178
|
+
else if (type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
12179
|
+
oldType === "child_added" /* ChangeType.CHILD_ADDED */) {
|
|
12337
12180
|
this.changeMap.set(childKey, changeChildAdded(childKey, change.snapshotNode));
|
|
12338
12181
|
}
|
|
12339
|
-
else if (type === "child_changed" /* CHILD_CHANGED */ &&
|
|
12340
|
-
oldType === "child_changed" /* CHILD_CHANGED */) {
|
|
12182
|
+
else if (type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
12183
|
+
oldType === "child_changed" /* ChangeType.CHILD_CHANGED */) {
|
|
12341
12184
|
this.changeMap.set(childKey, changeChildChanged(childKey, change.snapshotNode, oldChange.oldSnap));
|
|
12342
12185
|
}
|
|
12343
12186
|
else {
|
|
@@ -15062,7 +14905,7 @@ function repoLog(repo) {
|
|
|
15062
14905
|
if (repo.persistentConnection_) {
|
|
15063
14906
|
prefix = repo.persistentConnection_.id + ':';
|
|
15064
14907
|
}
|
|
15065
|
-
log.apply(void 0, tslib.__spreadArray([prefix], tslib.__read(varArgs)));
|
|
14908
|
+
log.apply(void 0, tslib.__spreadArray([prefix], tslib.__read(varArgs), false));
|
|
15066
14909
|
}
|
|
15067
14910
|
function repoCallOnCompleteCallback(repo, callback, status, errorReason) {
|
|
15068
14911
|
if (callback) {
|
|
@@ -15136,7 +14979,7 @@ function repoStartTransaction(repo, path, transactionUpdate, onComplete, unwatch
|
|
|
15136
14979
|
else {
|
|
15137
14980
|
validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path);
|
|
15138
14981
|
// Mark as run and add to our queue.
|
|
15139
|
-
transaction.status = 0 /* RUN */;
|
|
14982
|
+
transaction.status = 0 /* TransactionStatus.RUN */;
|
|
15140
14983
|
var queueNode = treeSubTree(repo.transactionQueueTree_, path);
|
|
15141
14984
|
var nodeQueue = treeGetValue(queueNode) || [];
|
|
15142
14985
|
nodeQueue.push(transaction);
|
|
@@ -15195,7 +15038,7 @@ function repoSendReadyTransactions(repo, node) {
|
|
|
15195
15038
|
if (treeGetValue(node)) {
|
|
15196
15039
|
var queue = repoBuildTransactionQueue(repo, node);
|
|
15197
15040
|
util.assert(queue.length > 0, 'Sending zero length transaction queue');
|
|
15198
|
-
var allRun = queue.every(function (transaction) { return transaction.status === 0 /* RUN */; });
|
|
15041
|
+
var allRun = queue.every(function (transaction) { return transaction.status === 0 /* TransactionStatus.RUN */; });
|
|
15199
15042
|
// If they're all run (and not sent), we can send them. Else, we must wait.
|
|
15200
15043
|
if (allRun) {
|
|
15201
15044
|
repoSendTransactionQueue(repo, treeGetPath(node), queue);
|
|
@@ -15224,8 +15067,8 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
15224
15067
|
var latestHash = latestState.hash();
|
|
15225
15068
|
for (var i = 0; i < queue.length; i++) {
|
|
15226
15069
|
var txn = queue[i];
|
|
15227
|
-
util.assert(txn.status === 0 /* RUN */, 'tryToSendTransactionQueue_: items in queue should all be run.');
|
|
15228
|
-
txn.status = 1 /* SENT */;
|
|
15070
|
+
util.assert(txn.status === 0 /* TransactionStatus.RUN */, 'tryToSendTransactionQueue_: items in queue should all be run.');
|
|
15071
|
+
txn.status = 1 /* TransactionStatus.SENT */;
|
|
15229
15072
|
txn.retryCount++;
|
|
15230
15073
|
var relativePath = newRelativePath(path, txn.path);
|
|
15231
15074
|
// If we've gotten to this point, the output snapshot must be defined.
|
|
@@ -15246,7 +15089,7 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
15246
15089
|
// transactions or sets.
|
|
15247
15090
|
var callbacks = [];
|
|
15248
15091
|
var _loop_1 = function (i) {
|
|
15249
|
-
queue[i].status = 2 /* COMPLETED */;
|
|
15092
|
+
queue[i].status = 2 /* TransactionStatus.COMPLETED */;
|
|
15250
15093
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, queue[i].currentWriteId));
|
|
15251
15094
|
if (queue[i].onComplete) {
|
|
15252
15095
|
// We never unset the output snapshot, and given that this
|
|
@@ -15274,18 +15117,18 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
15274
15117
|
// transactions are no longer sent. Update their status appropriately.
|
|
15275
15118
|
if (status === 'datastale') {
|
|
15276
15119
|
for (var i = 0; i < queue.length; i++) {
|
|
15277
|
-
if (queue[i].status === 3 /* SENT_NEEDS_ABORT */) {
|
|
15278
|
-
queue[i].status = 4 /* NEEDS_ABORT */;
|
|
15120
|
+
if (queue[i].status === 3 /* TransactionStatus.SENT_NEEDS_ABORT */) {
|
|
15121
|
+
queue[i].status = 4 /* TransactionStatus.NEEDS_ABORT */;
|
|
15279
15122
|
}
|
|
15280
15123
|
else {
|
|
15281
|
-
queue[i].status = 0 /* RUN */;
|
|
15124
|
+
queue[i].status = 0 /* TransactionStatus.RUN */;
|
|
15282
15125
|
}
|
|
15283
15126
|
}
|
|
15284
15127
|
}
|
|
15285
15128
|
else {
|
|
15286
15129
|
warn$1('transaction at ' + pathToSend.toString() + ' failed: ' + status);
|
|
15287
15130
|
for (var i = 0; i < queue.length; i++) {
|
|
15288
|
-
queue[i].status = 4 /* NEEDS_ABORT */;
|
|
15131
|
+
queue[i].status = 4 /* TransactionStatus.NEEDS_ABORT */;
|
|
15289
15132
|
queue[i].abortReason = status;
|
|
15290
15133
|
}
|
|
15291
15134
|
}
|
|
@@ -15329,7 +15172,7 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
15329
15172
|
var events = [];
|
|
15330
15173
|
// Ignore all of the sets we're going to re-run.
|
|
15331
15174
|
var txnsToRerun = queue.filter(function (q) {
|
|
15332
|
-
return q.status === 0 /* RUN */;
|
|
15175
|
+
return q.status === 0 /* TransactionStatus.RUN */;
|
|
15333
15176
|
});
|
|
15334
15177
|
var setsToIgnore = txnsToRerun.map(function (q) {
|
|
15335
15178
|
return q.currentWriteId;
|
|
@@ -15339,12 +15182,12 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
15339
15182
|
var relativePath = newRelativePath(path, transaction.path);
|
|
15340
15183
|
var abortTransaction = false, abortReason;
|
|
15341
15184
|
util.assert(relativePath !== null, 'rerunTransactionsUnderNode_: relativePath should not be null.');
|
|
15342
|
-
if (transaction.status === 4 /* NEEDS_ABORT */) {
|
|
15185
|
+
if (transaction.status === 4 /* TransactionStatus.NEEDS_ABORT */) {
|
|
15343
15186
|
abortTransaction = true;
|
|
15344
15187
|
abortReason = transaction.abortReason;
|
|
15345
15188
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, transaction.currentWriteId, true));
|
|
15346
15189
|
}
|
|
15347
|
-
else if (transaction.status === 0 /* RUN */) {
|
|
15190
|
+
else if (transaction.status === 0 /* TransactionStatus.RUN */) {
|
|
15348
15191
|
if (transaction.retryCount >= MAX_TRANSACTION_RETRIES) {
|
|
15349
15192
|
abortTransaction = true;
|
|
15350
15193
|
abortReason = 'maxretry';
|
|
@@ -15387,7 +15230,7 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
15387
15230
|
events = [];
|
|
15388
15231
|
if (abortTransaction) {
|
|
15389
15232
|
// Abort.
|
|
15390
|
-
queue[i].status = 2 /* COMPLETED */;
|
|
15233
|
+
queue[i].status = 2 /* TransactionStatus.COMPLETED */;
|
|
15391
15234
|
// Removing a listener can trigger pruning which can muck with
|
|
15392
15235
|
// mergedData/visibleData (as it prunes data). So defer the unwatcher
|
|
15393
15236
|
// until we're done.
|
|
@@ -15475,7 +15318,7 @@ function repoPruneCompletedTransactionsBelowNode(repo, node) {
|
|
|
15475
15318
|
if (queue) {
|
|
15476
15319
|
var to = 0;
|
|
15477
15320
|
for (var from = 0; from < queue.length; from++) {
|
|
15478
|
-
if (queue[from].status !== 2 /* COMPLETED */) {
|
|
15321
|
+
if (queue[from].status !== 2 /* TransactionStatus.COMPLETED */) {
|
|
15479
15322
|
queue[to] = queue[from];
|
|
15480
15323
|
to++;
|
|
15481
15324
|
}
|
|
@@ -15523,16 +15366,16 @@ function repoAbortTransactionsOnNode(repo, node) {
|
|
|
15523
15366
|
var events = [];
|
|
15524
15367
|
var lastSent = -1;
|
|
15525
15368
|
for (var i = 0; i < queue.length; i++) {
|
|
15526
|
-
if (queue[i].status === 3 /* SENT_NEEDS_ABORT */) ;
|
|
15527
|
-
else if (queue[i].status === 1 /* SENT */) {
|
|
15369
|
+
if (queue[i].status === 3 /* TransactionStatus.SENT_NEEDS_ABORT */) ;
|
|
15370
|
+
else if (queue[i].status === 1 /* TransactionStatus.SENT */) {
|
|
15528
15371
|
util.assert(lastSent === i - 1, 'All SENT items should be at beginning of queue.');
|
|
15529
15372
|
lastSent = i;
|
|
15530
15373
|
// Mark transaction for abort when it comes back.
|
|
15531
|
-
queue[i].status = 3 /* SENT_NEEDS_ABORT */;
|
|
15374
|
+
queue[i].status = 3 /* TransactionStatus.SENT_NEEDS_ABORT */;
|
|
15532
15375
|
queue[i].abortReason = 'set';
|
|
15533
15376
|
}
|
|
15534
15377
|
else {
|
|
15535
|
-
util.assert(queue[i].status === 0 /* RUN */, 'Unexpected transaction status in abort');
|
|
15378
|
+
util.assert(queue[i].status === 0 /* TransactionStatus.RUN */, 'Unexpected transaction status in abort');
|
|
15536
15379
|
// We can abort it immediately.
|
|
15537
15380
|
queue[i].unwatcher();
|
|
15538
15381
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, queue[i].currentWriteId, true));
|
|
@@ -15608,7 +15451,7 @@ function decodeQuery(queryString) {
|
|
|
15608
15451
|
results[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]);
|
|
15609
15452
|
}
|
|
15610
15453
|
else {
|
|
15611
|
-
warn$1("Invalid query segment '"
|
|
15454
|
+
warn$1("Invalid query segment '".concat(segment, "' in query '").concat(queryString, "'"));
|
|
15612
15455
|
}
|
|
15613
15456
|
}
|
|
15614
15457
|
}
|
|
@@ -15713,6 +15556,81 @@ var parseDatabaseURL = function (dataURL) {
|
|
|
15713
15556
|
};
|
|
15714
15557
|
};
|
|
15715
15558
|
|
|
15559
|
+
/**
|
|
15560
|
+
* @license
|
|
15561
|
+
* Copyright 2017 Google LLC
|
|
15562
|
+
*
|
|
15563
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15564
|
+
* you may not use this file except in compliance with the License.
|
|
15565
|
+
* You may obtain a copy of the License at
|
|
15566
|
+
*
|
|
15567
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15568
|
+
*
|
|
15569
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15570
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15571
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15572
|
+
* See the License for the specific language governing permissions and
|
|
15573
|
+
* limitations under the License.
|
|
15574
|
+
*/
|
|
15575
|
+
// Modeled after base64 web-safe chars, but ordered by ASCII.
|
|
15576
|
+
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
15577
|
+
/**
|
|
15578
|
+
* Fancy ID generator that creates 20-character string identifiers with the
|
|
15579
|
+
* following properties:
|
|
15580
|
+
*
|
|
15581
|
+
* 1. They're based on timestamp so that they sort *after* any existing ids.
|
|
15582
|
+
* 2. They contain 72-bits of random data after the timestamp so that IDs won't
|
|
15583
|
+
* collide with other clients' IDs.
|
|
15584
|
+
* 3. They sort *lexicographically* (so the timestamp is converted to characters
|
|
15585
|
+
* that will sort properly).
|
|
15586
|
+
* 4. They're monotonically increasing. Even if you generate more than one in
|
|
15587
|
+
* the same timestamp, the latter ones will sort after the former ones. We do
|
|
15588
|
+
* this by using the previous random bits but "incrementing" them by 1 (only
|
|
15589
|
+
* in the case of a timestamp collision).
|
|
15590
|
+
*/
|
|
15591
|
+
var nextPushId = (function () {
|
|
15592
|
+
// Timestamp of last push, used to prevent local collisions if you push twice
|
|
15593
|
+
// in one ms.
|
|
15594
|
+
var lastPushTime = 0;
|
|
15595
|
+
// We generate 72-bits of randomness which get turned into 12 characters and
|
|
15596
|
+
// appended to the timestamp to prevent collisions with other clients. We
|
|
15597
|
+
// store the last characters we generated because in the event of a collision,
|
|
15598
|
+
// we'll use those same characters except "incremented" by one.
|
|
15599
|
+
var lastRandChars = [];
|
|
15600
|
+
return function (now) {
|
|
15601
|
+
var duplicateTime = now === lastPushTime;
|
|
15602
|
+
lastPushTime = now;
|
|
15603
|
+
var i;
|
|
15604
|
+
var timeStampChars = new Array(8);
|
|
15605
|
+
for (i = 7; i >= 0; i--) {
|
|
15606
|
+
timeStampChars[i] = PUSH_CHARS.charAt(now % 64);
|
|
15607
|
+
// NOTE: Can't use << here because javascript will convert to int and lose
|
|
15608
|
+
// the upper bits.
|
|
15609
|
+
now = Math.floor(now / 64);
|
|
15610
|
+
}
|
|
15611
|
+
util.assert(now === 0, 'Cannot push at time == 0');
|
|
15612
|
+
var id = timeStampChars.join('');
|
|
15613
|
+
if (!duplicateTime) {
|
|
15614
|
+
for (i = 0; i < 12; i++) {
|
|
15615
|
+
lastRandChars[i] = Math.floor(Math.random() * 64);
|
|
15616
|
+
}
|
|
15617
|
+
}
|
|
15618
|
+
else {
|
|
15619
|
+
// If the timestamp hasn't changed since last push, use the same random
|
|
15620
|
+
// number, except incremented by 1.
|
|
15621
|
+
for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) {
|
|
15622
|
+
lastRandChars[i] = 0;
|
|
15623
|
+
}
|
|
15624
|
+
lastRandChars[i]++;
|
|
15625
|
+
}
|
|
15626
|
+
for (i = 0; i < 12; i++) {
|
|
15627
|
+
id += PUSH_CHARS.charAt(lastRandChars[i]);
|
|
15628
|
+
}
|
|
15629
|
+
util.assert(id.length === 20, 'nextPushId: Length should be 20.');
|
|
15630
|
+
return id;
|
|
15631
|
+
};
|
|
15632
|
+
})();
|
|
15633
|
+
|
|
15716
15634
|
/**
|
|
15717
15635
|
* @license
|
|
15718
15636
|
* Copyright 2017 Google LLC
|
|
@@ -17350,7 +17268,7 @@ var useRestClient = false;
|
|
|
17350
17268
|
* Update an existing `Repo` in place to point to a new host/port.
|
|
17351
17269
|
*/
|
|
17352
17270
|
function repoManagerApplyEmulatorSettings(repo, host, port, tokenProvider) {
|
|
17353
|
-
repo.repoInfo_ = new RepoInfo(host
|
|
17271
|
+
repo.repoInfo_ = new RepoInfo("".concat(host, ":").concat(port),
|
|
17354
17272
|
/* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams);
|
|
17355
17273
|
if (tokenProvider) {
|
|
17356
17274
|
repo.authTokenProvider_ = tokenProvider;
|
|
@@ -17368,7 +17286,7 @@ function repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, no
|
|
|
17368
17286
|
' a Project ID when calling firebase.initializeApp().');
|
|
17369
17287
|
}
|
|
17370
17288
|
log('Using default host for project ', app.options.projectId);
|
|
17371
|
-
dbUrl = app.options.projectId
|
|
17289
|
+
dbUrl = "".concat(app.options.projectId, "-default-rtdb.firebaseio.com");
|
|
17372
17290
|
}
|
|
17373
17291
|
var parsedUrl = parseRepoInfo(dbUrl, nodeAdmin);
|
|
17374
17292
|
var repoInfo = parsedUrl.repoInfo;
|
|
@@ -17379,7 +17297,7 @@ function repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, no
|
|
|
17379
17297
|
}
|
|
17380
17298
|
if (dbEmulatorHost) {
|
|
17381
17299
|
isEmulator = true;
|
|
17382
|
-
dbUrl = "http://"
|
|
17300
|
+
dbUrl = "http://".concat(dbEmulatorHost, "?ns=").concat(repoInfo.namespace);
|
|
17383
17301
|
parsedUrl = parseRepoInfo(dbUrl, nodeAdmin);
|
|
17384
17302
|
repoInfo = parsedUrl.repoInfo;
|
|
17385
17303
|
}
|
|
@@ -17405,7 +17323,7 @@ function repoManagerDeleteRepo(repo, appName) {
|
|
|
17405
17323
|
var appRepos = repos[appName];
|
|
17406
17324
|
// This should never happen...
|
|
17407
17325
|
if (!appRepos || appRepos[repo.key] !== repo) {
|
|
17408
|
-
fatal("Database "
|
|
17326
|
+
fatal("Database ".concat(appName, "(").concat(repo.repoInfo_, ") has already been deleted."));
|
|
17409
17327
|
}
|
|
17410
17328
|
repoInterrupt(repo);
|
|
17411
17329
|
delete appRepos[repo.key];
|