@firebase/database 0.13.10 → 0.14.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 +16 -0
- package/dist/index.esm2017.js +201 -288
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +225 -307
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +225 -307
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.standalone.js +222 -304
- package/dist/index.standalone.js.map +1 -1
- package/dist/internal.d.ts +0 -2
- package/dist/node-esm/index.node.esm.js +201 -288
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/core/view/QueryParams.d.ts +0 -2
- package/dist/node-esm/src/core/view/filter/LimitedFilter.d.ts +6 -0
- package/dist/node-esm/src/core/view/filter/RangedFilter.d.ts +2 -0
- package/dist/src/core/view/QueryParams.d.ts +0 -2
- package/dist/src/core/view/filter/LimitedFilter.d.ts +6 -0
- package/dist/src/core/view/filter/RangedFilter.d.ts +2 -0
- package/package.json +7 -7
package/dist/index.standalone.js
CHANGED
|
@@ -319,7 +319,7 @@ var logWrapper = function (prefix) {
|
|
|
319
319
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
320
320
|
varArgs[_i] = arguments[_i];
|
|
321
321
|
}
|
|
322
|
-
log.apply(void 0, tslib.__spreadArray([prefix], tslib.__read(varArgs)));
|
|
322
|
+
log.apply(void 0, tslib.__spreadArray([prefix], tslib.__read(varArgs), false));
|
|
323
323
|
};
|
|
324
324
|
};
|
|
325
325
|
var error = function () {
|
|
@@ -327,7 +327,7 @@ var error = function () {
|
|
|
327
327
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
328
328
|
varArgs[_i] = arguments[_i];
|
|
329
329
|
}
|
|
330
|
-
var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs)));
|
|
330
|
+
var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs), false));
|
|
331
331
|
logClient.error(message);
|
|
332
332
|
};
|
|
333
333
|
var fatal = function () {
|
|
@@ -335,7 +335,7 @@ var fatal = function () {
|
|
|
335
335
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
336
336
|
varArgs[_i] = arguments[_i];
|
|
337
337
|
}
|
|
338
|
-
var message = "FIREBASE FATAL ERROR: "
|
|
338
|
+
var message = "FIREBASE FATAL ERROR: ".concat(buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs), false)));
|
|
339
339
|
logClient.error(message);
|
|
340
340
|
throw new Error(message);
|
|
341
341
|
};
|
|
@@ -344,7 +344,7 @@ var warn = function () {
|
|
|
344
344
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
345
345
|
varArgs[_i] = arguments[_i];
|
|
346
346
|
}
|
|
347
|
-
var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs)));
|
|
347
|
+
var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, tslib.__spreadArray([], tslib.__read(varArgs), false));
|
|
348
348
|
logClient.warn(message);
|
|
349
349
|
};
|
|
350
350
|
/**
|
|
@@ -801,9 +801,9 @@ var RepoInfo = /** @class */ (function () {
|
|
|
801
801
|
RepoInfo.prototype.toURLString = function () {
|
|
802
802
|
var protocol = this.secure ? 'https://' : 'http://';
|
|
803
803
|
var query = this.includeNamespaceInQueryParams
|
|
804
|
-
? "?ns="
|
|
804
|
+
? "?ns=".concat(this.namespace)
|
|
805
805
|
: '';
|
|
806
|
-
return ""
|
|
806
|
+
return "".concat(protocol).concat(this.host, "/").concat(query);
|
|
807
807
|
};
|
|
808
808
|
return RepoInfo;
|
|
809
809
|
}());
|
|
@@ -1048,7 +1048,7 @@ var WebSocketConnection = /** @class */ (function () {
|
|
|
1048
1048
|
// UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
|
|
1049
1049
|
options = {
|
|
1050
1050
|
headers: {
|
|
1051
|
-
'User-Agent': "Firebase/"
|
|
1051
|
+
'User-Agent': "Firebase/".concat(PROTOCOL_VERSION, "/").concat(SDK_VERSION, "/").concat(process.platform, "/").concat(device),
|
|
1052
1052
|
'X-Firebase-GMPID': this.applicationId || ''
|
|
1053
1053
|
}
|
|
1054
1054
|
};
|
|
@@ -1058,7 +1058,7 @@ var WebSocketConnection = /** @class */ (function () {
|
|
|
1058
1058
|
// Note that this header is just used to bypass appcheck, and the token should still be sent
|
|
1059
1059
|
// through the websocket connection once it is established.
|
|
1060
1060
|
if (this.authToken) {
|
|
1061
|
-
options.headers['Authorization'] = "Bearer "
|
|
1061
|
+
options.headers['Authorization'] = "Bearer ".concat(this.authToken);
|
|
1062
1062
|
}
|
|
1063
1063
|
if (this.appCheckToken) {
|
|
1064
1064
|
options.headers['X-Firebase-AppCheck'] = this.appCheckToken;
|
|
@@ -1349,7 +1349,7 @@ var AppCheckTokenProvider = /** @class */ (function () {
|
|
|
1349
1349
|
(_a = this.appCheckProvider) === null || _a === void 0 ? void 0 : _a.get().then(function (appCheck) { return appCheck.addTokenListener(listener); });
|
|
1350
1350
|
};
|
|
1351
1351
|
AppCheckTokenProvider.prototype.notifyForInvalidToken = function () {
|
|
1352
|
-
warn("Provided AppCheck credentials for the app named \""
|
|
1352
|
+
warn("Provided AppCheck credentials for the app named \"".concat(this.appName_, "\" ") +
|
|
1353
1353
|
'are invalid. This usually indicates your app was not initialized correctly.');
|
|
1354
1354
|
};
|
|
1355
1355
|
return AppCheckTokenProvider;
|
|
@@ -2362,7 +2362,7 @@ var Connection = /** @class */ (function () {
|
|
|
2362
2362
|
this.lastSessionId = lastSessionId;
|
|
2363
2363
|
this.connectionCount = 0;
|
|
2364
2364
|
this.pendingDataMessages = [];
|
|
2365
|
-
this.state_ = 0 /* CONNECTING */;
|
|
2365
|
+
this.state_ = 0 /* RealtimeState.CONNECTING */;
|
|
2366
2366
|
this.log_ = logWrapper('c:' + this.id + ':');
|
|
2367
2367
|
this.transportManager_ = new TransportManager(repoInfo_);
|
|
2368
2368
|
this.log_('Connection created');
|
|
@@ -2445,7 +2445,7 @@ var Connection = /** @class */ (function () {
|
|
|
2445
2445
|
Connection.prototype.connReceiver_ = function (conn) {
|
|
2446
2446
|
var _this = this;
|
|
2447
2447
|
return function (message) {
|
|
2448
|
-
if (_this.state_ !== 2 /* DISCONNECTED */) {
|
|
2448
|
+
if (_this.state_ !== 2 /* RealtimeState.DISCONNECTED */) {
|
|
2449
2449
|
if (conn === _this.rx_) {
|
|
2450
2450
|
_this.onPrimaryMessageReceived_(message);
|
|
2451
2451
|
}
|
|
@@ -2611,7 +2611,7 @@ var Connection = /** @class */ (function () {
|
|
|
2611
2611
|
this.sessionId = handshake.s;
|
|
2612
2612
|
this.repoInfo_.host = host;
|
|
2613
2613
|
// if we've already closed the connection, then don't bother trying to progress further
|
|
2614
|
-
if (this.state_ === 0 /* CONNECTING */) {
|
|
2614
|
+
if (this.state_ === 0 /* RealtimeState.CONNECTING */) {
|
|
2615
2615
|
this.conn_.start();
|
|
2616
2616
|
this.onConnectionEstablished_(this.conn_, timestamp);
|
|
2617
2617
|
if (PROTOCOL_VERSION !== version) {
|
|
@@ -2650,7 +2650,7 @@ var Connection = /** @class */ (function () {
|
|
|
2650
2650
|
this.repoInfo_.host = host;
|
|
2651
2651
|
// TODO: if we're already "connected", we need to trigger a disconnect at the next layer up.
|
|
2652
2652
|
// We don't currently support resets after the connection has already been established
|
|
2653
|
-
if (this.state_ === 1 /* CONNECTED */) {
|
|
2653
|
+
if (this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2654
2654
|
this.close();
|
|
2655
2655
|
}
|
|
2656
2656
|
else {
|
|
@@ -2663,7 +2663,7 @@ var Connection = /** @class */ (function () {
|
|
|
2663
2663
|
var _this = this;
|
|
2664
2664
|
this.log_('Realtime connection established.');
|
|
2665
2665
|
this.conn_ = conn;
|
|
2666
|
-
this.state_ = 1 /* CONNECTED */;
|
|
2666
|
+
this.state_ = 1 /* RealtimeState.CONNECTED */;
|
|
2667
2667
|
if (this.onReady_) {
|
|
2668
2668
|
this.onReady_(timestamp, this.sessionId);
|
|
2669
2669
|
this.onReady_ = null;
|
|
@@ -2682,7 +2682,7 @@ var Connection = /** @class */ (function () {
|
|
|
2682
2682
|
};
|
|
2683
2683
|
Connection.prototype.sendPingOnPrimaryIfNecessary_ = function () {
|
|
2684
2684
|
// If the connection isn't considered healthy yet, we'll send a noop ping packet request.
|
|
2685
|
-
if (!this.isHealthy_ && this.state_ === 1 /* CONNECTED */) {
|
|
2685
|
+
if (!this.isHealthy_ && this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2686
2686
|
this.log_('sending ping on primary.');
|
|
2687
2687
|
this.sendData_({ t: 'c', d: { t: PING, d: {} } });
|
|
2688
2688
|
}
|
|
@@ -2703,7 +2703,7 @@ var Connection = /** @class */ (function () {
|
|
|
2703
2703
|
this.conn_ = null;
|
|
2704
2704
|
// NOTE: IF you're seeing a Firefox error for this line, I think it might be because it's getting
|
|
2705
2705
|
// called on window close and RealtimeState.CONNECTING is no longer defined. Just a guess.
|
|
2706
|
-
if (!everConnected && this.state_ === 0 /* CONNECTING */) {
|
|
2706
|
+
if (!everConnected && this.state_ === 0 /* RealtimeState.CONNECTING */) {
|
|
2707
2707
|
this.log_('Realtime connection failed.');
|
|
2708
2708
|
// Since we failed to connect at all, clear any cached entry for this namespace in case the machine went away
|
|
2709
2709
|
if (this.repoInfo_.isCacheableHost()) {
|
|
@@ -2712,7 +2712,7 @@ var Connection = /** @class */ (function () {
|
|
|
2712
2712
|
this.repoInfo_.internalHost = this.repoInfo_.host;
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
|
-
else if (this.state_ === 1 /* CONNECTED */) {
|
|
2715
|
+
else if (this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2716
2716
|
this.log_('Realtime connection lost.');
|
|
2717
2717
|
}
|
|
2718
2718
|
this.close();
|
|
@@ -2729,7 +2729,7 @@ var Connection = /** @class */ (function () {
|
|
|
2729
2729
|
this.close();
|
|
2730
2730
|
};
|
|
2731
2731
|
Connection.prototype.sendData_ = function (data) {
|
|
2732
|
-
if (this.state_ !== 1 /* CONNECTED */) {
|
|
2732
|
+
if (this.state_ !== 1 /* RealtimeState.CONNECTED */) {
|
|
2733
2733
|
throw 'Connection is not connected';
|
|
2734
2734
|
}
|
|
2735
2735
|
else {
|
|
@@ -2740,9 +2740,9 @@ var Connection = /** @class */ (function () {
|
|
|
2740
2740
|
* Cleans up this connection, calling the appropriate callbacks
|
|
2741
2741
|
*/
|
|
2742
2742
|
Connection.prototype.close = function () {
|
|
2743
|
-
if (this.state_ !== 2 /* DISCONNECTED */) {
|
|
2743
|
+
if (this.state_ !== 2 /* RealtimeState.DISCONNECTED */) {
|
|
2744
2744
|
this.log_('Closing realtime connection.');
|
|
2745
|
-
this.state_ = 2 /* DISCONNECTED */;
|
|
2745
|
+
this.state_ = 2 /* RealtimeState.DISCONNECTED */;
|
|
2746
2746
|
this.closeConnections_();
|
|
2747
2747
|
if (this.onDisconnect_) {
|
|
2748
2748
|
this.onDisconnect_();
|
|
@@ -2848,7 +2848,7 @@ var EventEmitter = /** @class */ (function () {
|
|
|
2848
2848
|
}
|
|
2849
2849
|
if (Array.isArray(this.listeners_[eventType])) {
|
|
2850
2850
|
// Clone the list, since callbacks could add/remove listeners.
|
|
2851
|
-
var listeners = tslib.__spreadArray([], tslib.__read(this.listeners_[eventType]));
|
|
2851
|
+
var listeners = tslib.__spreadArray([], tslib.__read(this.listeners_[eventType]), false);
|
|
2852
2852
|
for (var i = 0; i < listeners.length; i++) {
|
|
2853
2853
|
listeners[i].callback.apply(listeners[i].context, varArgs);
|
|
2854
2854
|
}
|
|
@@ -3493,8 +3493,8 @@ var PersistentConnection = /** @class */ (function (_super) {
|
|
|
3493
3493
|
var indexSpec = '".indexOn": "' + query._queryParams.getIndex().toString() + '"';
|
|
3494
3494
|
var indexPath = query._path.toString();
|
|
3495
3495
|
warn("Using an unspecified index. Your data will be downloaded and " +
|
|
3496
|
-
|
|
3497
|
-
(indexPath
|
|
3496
|
+
"filtered on the client. Consider adding ".concat(indexSpec, " at ") +
|
|
3497
|
+
"".concat(indexPath, " to your security rules for better performance."));
|
|
3498
3498
|
}
|
|
3499
3499
|
}
|
|
3500
3500
|
};
|
|
@@ -6173,153 +6173,6 @@ var ValueIndex = /** @class */ (function (_super) {
|
|
|
6173
6173
|
}(Index));
|
|
6174
6174
|
var VALUE_INDEX = new ValueIndex();
|
|
6175
6175
|
|
|
6176
|
-
/**
|
|
6177
|
-
* @license
|
|
6178
|
-
* Copyright 2017 Google LLC
|
|
6179
|
-
*
|
|
6180
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6181
|
-
* you may not use this file except in compliance with the License.
|
|
6182
|
-
* You may obtain a copy of the License at
|
|
6183
|
-
*
|
|
6184
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6185
|
-
*
|
|
6186
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
6187
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6188
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6189
|
-
* See the License for the specific language governing permissions and
|
|
6190
|
-
* limitations under the License.
|
|
6191
|
-
*/
|
|
6192
|
-
// Modeled after base64 web-safe chars, but ordered by ASCII.
|
|
6193
|
-
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
6194
|
-
var MIN_PUSH_CHAR = '-';
|
|
6195
|
-
var MAX_PUSH_CHAR = 'z';
|
|
6196
|
-
var MAX_KEY_LEN = 786;
|
|
6197
|
-
/**
|
|
6198
|
-
* Fancy ID generator that creates 20-character string identifiers with the
|
|
6199
|
-
* following properties:
|
|
6200
|
-
*
|
|
6201
|
-
* 1. They're based on timestamp so that they sort *after* any existing ids.
|
|
6202
|
-
* 2. They contain 72-bits of random data after the timestamp so that IDs won't
|
|
6203
|
-
* collide with other clients' IDs.
|
|
6204
|
-
* 3. They sort *lexicographically* (so the timestamp is converted to characters
|
|
6205
|
-
* that will sort properly).
|
|
6206
|
-
* 4. They're monotonically increasing. Even if you generate more than one in
|
|
6207
|
-
* the same timestamp, the latter ones will sort after the former ones. We do
|
|
6208
|
-
* this by using the previous random bits but "incrementing" them by 1 (only
|
|
6209
|
-
* in the case of a timestamp collision).
|
|
6210
|
-
*/
|
|
6211
|
-
var nextPushId = (function () {
|
|
6212
|
-
// Timestamp of last push, used to prevent local collisions if you push twice
|
|
6213
|
-
// in one ms.
|
|
6214
|
-
var lastPushTime = 0;
|
|
6215
|
-
// We generate 72-bits of randomness which get turned into 12 characters and
|
|
6216
|
-
// appended to the timestamp to prevent collisions with other clients. We
|
|
6217
|
-
// store the last characters we generated because in the event of a collision,
|
|
6218
|
-
// we'll use those same characters except "incremented" by one.
|
|
6219
|
-
var lastRandChars = [];
|
|
6220
|
-
return function (now) {
|
|
6221
|
-
var duplicateTime = now === lastPushTime;
|
|
6222
|
-
lastPushTime = now;
|
|
6223
|
-
var i;
|
|
6224
|
-
var timeStampChars = new Array(8);
|
|
6225
|
-
for (i = 7; i >= 0; i--) {
|
|
6226
|
-
timeStampChars[i] = PUSH_CHARS.charAt(now % 64);
|
|
6227
|
-
// NOTE: Can't use << here because javascript will convert to int and lose
|
|
6228
|
-
// the upper bits.
|
|
6229
|
-
now = Math.floor(now / 64);
|
|
6230
|
-
}
|
|
6231
|
-
util.assert(now === 0, 'Cannot push at time == 0');
|
|
6232
|
-
var id = timeStampChars.join('');
|
|
6233
|
-
if (!duplicateTime) {
|
|
6234
|
-
for (i = 0; i < 12; i++) {
|
|
6235
|
-
lastRandChars[i] = Math.floor(Math.random() * 64);
|
|
6236
|
-
}
|
|
6237
|
-
}
|
|
6238
|
-
else {
|
|
6239
|
-
// If the timestamp hasn't changed since last push, use the same random
|
|
6240
|
-
// number, except incremented by 1.
|
|
6241
|
-
for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) {
|
|
6242
|
-
lastRandChars[i] = 0;
|
|
6243
|
-
}
|
|
6244
|
-
lastRandChars[i]++;
|
|
6245
|
-
}
|
|
6246
|
-
for (i = 0; i < 12; i++) {
|
|
6247
|
-
id += PUSH_CHARS.charAt(lastRandChars[i]);
|
|
6248
|
-
}
|
|
6249
|
-
util.assert(id.length === 20, 'nextPushId: Length should be 20.');
|
|
6250
|
-
return id;
|
|
6251
|
-
};
|
|
6252
|
-
})();
|
|
6253
|
-
var successor = function (key) {
|
|
6254
|
-
if (key === '' + INTEGER_32_MAX) {
|
|
6255
|
-
// See https://firebase.google.com/docs/database/web/lists-of-data#data-order
|
|
6256
|
-
return MIN_PUSH_CHAR;
|
|
6257
|
-
}
|
|
6258
|
-
var keyAsInt = tryParseInt(key);
|
|
6259
|
-
if (keyAsInt != null) {
|
|
6260
|
-
return '' + (keyAsInt + 1);
|
|
6261
|
-
}
|
|
6262
|
-
var next = new Array(key.length);
|
|
6263
|
-
for (var i_1 = 0; i_1 < next.length; i_1++) {
|
|
6264
|
-
next[i_1] = key.charAt(i_1);
|
|
6265
|
-
}
|
|
6266
|
-
if (next.length < MAX_KEY_LEN) {
|
|
6267
|
-
next.push(MIN_PUSH_CHAR);
|
|
6268
|
-
return next.join('');
|
|
6269
|
-
}
|
|
6270
|
-
var i = next.length - 1;
|
|
6271
|
-
while (i >= 0 && next[i] === MAX_PUSH_CHAR) {
|
|
6272
|
-
i--;
|
|
6273
|
-
}
|
|
6274
|
-
// `successor` was called on the largest possible key, so return the
|
|
6275
|
-
// MAX_NAME, which sorts larger than all keys.
|
|
6276
|
-
if (i === -1) {
|
|
6277
|
-
return MAX_NAME;
|
|
6278
|
-
}
|
|
6279
|
-
var source = next[i];
|
|
6280
|
-
var sourcePlusOne = PUSH_CHARS.charAt(PUSH_CHARS.indexOf(source) + 1);
|
|
6281
|
-
next[i] = sourcePlusOne;
|
|
6282
|
-
return next.slice(0, i + 1).join('');
|
|
6283
|
-
};
|
|
6284
|
-
// `key` is assumed to be non-empty.
|
|
6285
|
-
var predecessor = function (key) {
|
|
6286
|
-
if (key === '' + INTEGER_32_MIN) {
|
|
6287
|
-
return MIN_NAME;
|
|
6288
|
-
}
|
|
6289
|
-
var keyAsInt = tryParseInt(key);
|
|
6290
|
-
if (keyAsInt != null) {
|
|
6291
|
-
return '' + (keyAsInt - 1);
|
|
6292
|
-
}
|
|
6293
|
-
var next = new Array(key.length);
|
|
6294
|
-
for (var i = 0; i < next.length; i++) {
|
|
6295
|
-
next[i] = key.charAt(i);
|
|
6296
|
-
}
|
|
6297
|
-
// If `key` ends in `MIN_PUSH_CHAR`, the largest key lexicographically
|
|
6298
|
-
// smaller than `key`, is `key[0:key.length - 1]`. The next key smaller
|
|
6299
|
-
// than that, `predecessor(predecessor(key))`, is
|
|
6300
|
-
//
|
|
6301
|
-
// `key[0:key.length - 2] + (key[key.length - 1] - 1) + \
|
|
6302
|
-
// { MAX_PUSH_CHAR repeated MAX_KEY_LEN - (key.length - 1) times }
|
|
6303
|
-
//
|
|
6304
|
-
// analogous to increment/decrement for base-10 integers.
|
|
6305
|
-
//
|
|
6306
|
-
// This works because lexigographic comparison works character-by-character,
|
|
6307
|
-
// using length as a tie-breaker if one key is a prefix of the other.
|
|
6308
|
-
if (next[next.length - 1] === MIN_PUSH_CHAR) {
|
|
6309
|
-
if (next.length === 1) {
|
|
6310
|
-
// See https://firebase.google.com/docs/database/web/lists-of-data#orderbykey
|
|
6311
|
-
return '' + INTEGER_32_MAX;
|
|
6312
|
-
}
|
|
6313
|
-
delete next[next.length - 1];
|
|
6314
|
-
return next.join('');
|
|
6315
|
-
}
|
|
6316
|
-
// Replace the last character with it's immediate predecessor, and
|
|
6317
|
-
// fill the suffix of the key with MAX_PUSH_CHAR. This is the
|
|
6318
|
-
// lexicographically largest possible key smaller than `key`.
|
|
6319
|
-
next[next.length - 1] = PUSH_CHARS.charAt(PUSH_CHARS.indexOf(next[next.length - 1]) - 1);
|
|
6320
|
-
return next.join('') + MAX_PUSH_CHAR.repeat(MAX_KEY_LEN - next.length);
|
|
6321
|
-
};
|
|
6322
|
-
|
|
6323
6176
|
/**
|
|
6324
6177
|
* @license
|
|
6325
6178
|
* Copyright 2017 Google LLC
|
|
@@ -6337,24 +6190,24 @@ var predecessor = function (key) {
|
|
|
6337
6190
|
* limitations under the License.
|
|
6338
6191
|
*/
|
|
6339
6192
|
function changeValue(snapshotNode) {
|
|
6340
|
-
return { type: "value" /* VALUE */, snapshotNode: snapshotNode };
|
|
6193
|
+
return { type: "value" /* ChangeType.VALUE */, snapshotNode: snapshotNode };
|
|
6341
6194
|
}
|
|
6342
6195
|
function changeChildAdded(childName, snapshotNode) {
|
|
6343
|
-
return { type: "child_added" /* CHILD_ADDED */, snapshotNode: snapshotNode, childName: childName };
|
|
6196
|
+
return { type: "child_added" /* ChangeType.CHILD_ADDED */, snapshotNode: snapshotNode, childName: childName };
|
|
6344
6197
|
}
|
|
6345
6198
|
function changeChildRemoved(childName, snapshotNode) {
|
|
6346
|
-
return { type: "child_removed" /* CHILD_REMOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
6199
|
+
return { type: "child_removed" /* ChangeType.CHILD_REMOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
6347
6200
|
}
|
|
6348
6201
|
function changeChildChanged(childName, snapshotNode, oldSnap) {
|
|
6349
6202
|
return {
|
|
6350
|
-
type: "child_changed" /* CHILD_CHANGED */,
|
|
6203
|
+
type: "child_changed" /* ChangeType.CHILD_CHANGED */,
|
|
6351
6204
|
snapshotNode: snapshotNode,
|
|
6352
6205
|
childName: childName,
|
|
6353
6206
|
oldSnap: oldSnap
|
|
6354
6207
|
};
|
|
6355
6208
|
}
|
|
6356
6209
|
function changeChildMoved(childName, snapshotNode) {
|
|
6357
|
-
return { type: "child_moved" /* CHILD_MOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
6210
|
+
return { type: "child_moved" /* ChangeType.CHILD_MOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
6358
6211
|
}
|
|
6359
6212
|
|
|
6360
6213
|
/**
|
|
@@ -6489,6 +6342,8 @@ var RangedFilter = /** @class */ (function () {
|
|
|
6489
6342
|
this.index_ = params.getIndex();
|
|
6490
6343
|
this.startPost_ = RangedFilter.getStartPost_(params);
|
|
6491
6344
|
this.endPost_ = RangedFilter.getEndPost_(params);
|
|
6345
|
+
this.startIsInclusive_ = !params.startAfterSet_;
|
|
6346
|
+
this.endIsInclusive_ = !params.endBeforeSet_;
|
|
6492
6347
|
}
|
|
6493
6348
|
RangedFilter.prototype.getStartPost = function () {
|
|
6494
6349
|
return this.startPost_;
|
|
@@ -6497,8 +6352,13 @@ var RangedFilter = /** @class */ (function () {
|
|
|
6497
6352
|
return this.endPost_;
|
|
6498
6353
|
};
|
|
6499
6354
|
RangedFilter.prototype.matches = function (node) {
|
|
6500
|
-
|
|
6501
|
-
this.index_.compare(
|
|
6355
|
+
var isWithinStart = this.startIsInclusive_
|
|
6356
|
+
? this.index_.compare(this.getStartPost(), node) <= 0
|
|
6357
|
+
: this.index_.compare(this.getStartPost(), node) < 0;
|
|
6358
|
+
var isWithinEnd = this.endIsInclusive_
|
|
6359
|
+
? this.index_.compare(node, this.getEndPost()) <= 0
|
|
6360
|
+
: this.index_.compare(node, this.getEndPost()) < 0;
|
|
6361
|
+
return isWithinStart && isWithinEnd;
|
|
6502
6362
|
};
|
|
6503
6363
|
RangedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) {
|
|
6504
6364
|
if (!this.matches(new NamedNode(key, newChild))) {
|
|
@@ -6577,10 +6437,27 @@ var RangedFilter = /** @class */ (function () {
|
|
|
6577
6437
|
*/
|
|
6578
6438
|
var LimitedFilter = /** @class */ (function () {
|
|
6579
6439
|
function LimitedFilter(params) {
|
|
6440
|
+
var _this = this;
|
|
6441
|
+
this.withinDirectionalStart = function (node) {
|
|
6442
|
+
return _this.reverse_ ? _this.withinEndPost(node) : _this.withinStartPost(node);
|
|
6443
|
+
};
|
|
6444
|
+
this.withinDirectionalEnd = function (node) {
|
|
6445
|
+
return _this.reverse_ ? _this.withinStartPost(node) : _this.withinEndPost(node);
|
|
6446
|
+
};
|
|
6447
|
+
this.withinStartPost = function (node) {
|
|
6448
|
+
var compareRes = _this.index_.compare(_this.rangedFilter_.getStartPost(), node);
|
|
6449
|
+
return _this.startIsInclusive_ ? compareRes <= 0 : compareRes < 0;
|
|
6450
|
+
};
|
|
6451
|
+
this.withinEndPost = function (node) {
|
|
6452
|
+
var compareRes = _this.index_.compare(node, _this.rangedFilter_.getEndPost());
|
|
6453
|
+
return _this.endIsInclusive_ ? compareRes <= 0 : compareRes < 0;
|
|
6454
|
+
};
|
|
6580
6455
|
this.rangedFilter_ = new RangedFilter(params);
|
|
6581
6456
|
this.index_ = params.getIndex();
|
|
6582
6457
|
this.limit_ = params.getLimit();
|
|
6583
6458
|
this.reverse_ = !params.isViewFromLeft();
|
|
6459
|
+
this.startIsInclusive_ = !params.startAfterSet_;
|
|
6460
|
+
this.endIsInclusive_ = !params.endBeforeSet_;
|
|
6584
6461
|
}
|
|
6585
6462
|
LimitedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) {
|
|
6586
6463
|
if (!this.rangedFilter_.matches(new NamedNode(key, newChild))) {
|
|
@@ -6621,23 +6498,18 @@ var LimitedFilter = /** @class */ (function () {
|
|
|
6621
6498
|
var count = 0;
|
|
6622
6499
|
while (iterator.hasNext() && count < this.limit_) {
|
|
6623
6500
|
var next = iterator.getNext();
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
this.index_.compare(this.rangedFilter_.getStartPost(), next) <= 0;
|
|
6501
|
+
if (!this.withinDirectionalStart(next)) {
|
|
6502
|
+
// if we have not reached the start, skip to the next element
|
|
6503
|
+
continue;
|
|
6628
6504
|
}
|
|
6629
|
-
else {
|
|
6630
|
-
|
|
6631
|
-
|
|
6505
|
+
else if (!this.withinDirectionalEnd(next)) {
|
|
6506
|
+
// if we have reached the end, stop adding elements
|
|
6507
|
+
break;
|
|
6632
6508
|
}
|
|
6633
|
-
|
|
6509
|
+
else {
|
|
6634
6510
|
filtered = filtered.updateImmediateChild(next.name, next.node);
|
|
6635
6511
|
count++;
|
|
6636
6512
|
}
|
|
6637
|
-
else {
|
|
6638
|
-
// if we have reached the end post, we cannot keep adding elemments
|
|
6639
|
-
break;
|
|
6640
|
-
}
|
|
6641
6513
|
}
|
|
6642
6514
|
}
|
|
6643
6515
|
else {
|
|
@@ -6645,32 +6517,19 @@ var LimitedFilter = /** @class */ (function () {
|
|
|
6645
6517
|
filtered = newSnap.withIndex(this.index_);
|
|
6646
6518
|
// Don't support priorities on queries
|
|
6647
6519
|
filtered = filtered.updatePriority(ChildrenNode.EMPTY_NODE);
|
|
6648
|
-
var startPost = void 0;
|
|
6649
|
-
var endPost = void 0;
|
|
6650
|
-
var cmp = void 0;
|
|
6651
6520
|
var iterator = void 0;
|
|
6652
6521
|
if (this.reverse_) {
|
|
6653
6522
|
iterator = filtered.getReverseIterator(this.index_);
|
|
6654
|
-
startPost = this.rangedFilter_.getEndPost();
|
|
6655
|
-
endPost = this.rangedFilter_.getStartPost();
|
|
6656
|
-
var indexCompare_1 = this.index_.getCompare();
|
|
6657
|
-
cmp = function (a, b) { return indexCompare_1(b, a); };
|
|
6658
6523
|
}
|
|
6659
6524
|
else {
|
|
6660
6525
|
iterator = filtered.getIterator(this.index_);
|
|
6661
|
-
startPost = this.rangedFilter_.getStartPost();
|
|
6662
|
-
endPost = this.rangedFilter_.getEndPost();
|
|
6663
|
-
cmp = this.index_.getCompare();
|
|
6664
6526
|
}
|
|
6665
6527
|
var count = 0;
|
|
6666
|
-
var foundStartPost = false;
|
|
6667
6528
|
while (iterator.hasNext()) {
|
|
6668
6529
|
var next = iterator.getNext();
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
}
|
|
6673
|
-
var inRange = foundStartPost && count < this.limit_ && cmp(next, endPost) <= 0;
|
|
6530
|
+
var inRange = count < this.limit_ &&
|
|
6531
|
+
this.withinDirectionalStart(next) &&
|
|
6532
|
+
this.withinDirectionalEnd(next);
|
|
6674
6533
|
if (inRange) {
|
|
6675
6534
|
count++;
|
|
6676
6535
|
}
|
|
@@ -6802,10 +6661,10 @@ var QueryParams = /** @class */ (function () {
|
|
|
6802
6661
|
this.limitSet_ = false;
|
|
6803
6662
|
this.startSet_ = false;
|
|
6804
6663
|
this.startNameSet_ = false;
|
|
6805
|
-
this.startAfterSet_ = false;
|
|
6664
|
+
this.startAfterSet_ = false; // can only be true if startSet_ is true
|
|
6806
6665
|
this.endSet_ = false;
|
|
6807
6666
|
this.endNameSet_ = false;
|
|
6808
|
-
this.endBeforeSet_ = false;
|
|
6667
|
+
this.endBeforeSet_ = false; // can only be true if endSet_ is true
|
|
6809
6668
|
this.limit_ = 0;
|
|
6810
6669
|
this.viewFrom_ = '';
|
|
6811
6670
|
this.indexStartValue_ = null;
|
|
@@ -6817,12 +6676,6 @@ var QueryParams = /** @class */ (function () {
|
|
|
6817
6676
|
QueryParams.prototype.hasStart = function () {
|
|
6818
6677
|
return this.startSet_;
|
|
6819
6678
|
};
|
|
6820
|
-
QueryParams.prototype.hasStartAfter = function () {
|
|
6821
|
-
return this.startAfterSet_;
|
|
6822
|
-
};
|
|
6823
|
-
QueryParams.prototype.hasEndBefore = function () {
|
|
6824
|
-
return this.endBeforeSet_;
|
|
6825
|
-
};
|
|
6826
6679
|
/**
|
|
6827
6680
|
* @returns True if it would return from left.
|
|
6828
6681
|
*/
|
|
@@ -6835,7 +6688,7 @@ var QueryParams = /** @class */ (function () {
|
|
|
6835
6688
|
return this.startSet_;
|
|
6836
6689
|
}
|
|
6837
6690
|
else {
|
|
6838
|
-
return this.viewFrom_ === "l" /* VIEW_FROM_LEFT */;
|
|
6691
|
+
return this.viewFrom_ === "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
6839
6692
|
}
|
|
6840
6693
|
};
|
|
6841
6694
|
/**
|
|
@@ -6911,10 +6764,12 @@ var QueryParams = /** @class */ (function () {
|
|
|
6911
6764
|
copy.limitSet_ = this.limitSet_;
|
|
6912
6765
|
copy.limit_ = this.limit_;
|
|
6913
6766
|
copy.startSet_ = this.startSet_;
|
|
6767
|
+
copy.startAfterSet_ = this.startAfterSet_;
|
|
6914
6768
|
copy.indexStartValue_ = this.indexStartValue_;
|
|
6915
6769
|
copy.startNameSet_ = this.startNameSet_;
|
|
6916
6770
|
copy.indexStartName_ = this.indexStartName_;
|
|
6917
6771
|
copy.endSet_ = this.endSet_;
|
|
6772
|
+
copy.endBeforeSet_ = this.endBeforeSet_;
|
|
6918
6773
|
copy.indexEndValue_ = this.indexEndValue_;
|
|
6919
6774
|
copy.endNameSet_ = this.endNameSet_;
|
|
6920
6775
|
copy.indexEndName_ = this.indexEndName_;
|
|
@@ -6939,14 +6794,14 @@ function queryParamsLimitToFirst(queryParams, newLimit) {
|
|
|
6939
6794
|
var newParams = queryParams.copy();
|
|
6940
6795
|
newParams.limitSet_ = true;
|
|
6941
6796
|
newParams.limit_ = newLimit;
|
|
6942
|
-
newParams.viewFrom_ = "l" /* VIEW_FROM_LEFT */;
|
|
6797
|
+
newParams.viewFrom_ = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
6943
6798
|
return newParams;
|
|
6944
6799
|
}
|
|
6945
6800
|
function queryParamsLimitToLast(queryParams, newLimit) {
|
|
6946
6801
|
var newParams = queryParams.copy();
|
|
6947
6802
|
newParams.limitSet_ = true;
|
|
6948
6803
|
newParams.limit_ = newLimit;
|
|
6949
|
-
newParams.viewFrom_ = "r" /* VIEW_FROM_RIGHT */;
|
|
6804
|
+
newParams.viewFrom_ = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
6950
6805
|
return newParams;
|
|
6951
6806
|
}
|
|
6952
6807
|
function queryParamsStartAt(queryParams, indexValue, key) {
|
|
@@ -6968,21 +6823,11 @@ function queryParamsStartAt(queryParams, indexValue, key) {
|
|
|
6968
6823
|
}
|
|
6969
6824
|
function queryParamsStartAfter(queryParams, indexValue, key) {
|
|
6970
6825
|
var params;
|
|
6971
|
-
if (queryParams.index_ === KEY_INDEX) {
|
|
6972
|
-
if (typeof indexValue === 'string') {
|
|
6973
|
-
indexValue = successor(indexValue);
|
|
6974
|
-
}
|
|
6826
|
+
if (queryParams.index_ === KEY_INDEX || !!key) {
|
|
6975
6827
|
params = queryParamsStartAt(queryParams, indexValue, key);
|
|
6976
6828
|
}
|
|
6977
6829
|
else {
|
|
6978
|
-
|
|
6979
|
-
if (key == null) {
|
|
6980
|
-
childKey = MAX_NAME;
|
|
6981
|
-
}
|
|
6982
|
-
else {
|
|
6983
|
-
childKey = successor(key);
|
|
6984
|
-
}
|
|
6985
|
-
params = queryParamsStartAt(queryParams, indexValue, childKey);
|
|
6830
|
+
params = queryParamsStartAt(queryParams, indexValue, MAX_NAME);
|
|
6986
6831
|
}
|
|
6987
6832
|
params.startAfterSet_ = true;
|
|
6988
6833
|
return params;
|
|
@@ -7005,22 +6850,12 @@ function queryParamsEndAt(queryParams, indexValue, key) {
|
|
|
7005
6850
|
return newParams;
|
|
7006
6851
|
}
|
|
7007
6852
|
function queryParamsEndBefore(queryParams, indexValue, key) {
|
|
7008
|
-
var childKey;
|
|
7009
6853
|
var params;
|
|
7010
|
-
if (queryParams.index_ === KEY_INDEX) {
|
|
7011
|
-
if (typeof indexValue === 'string') {
|
|
7012
|
-
indexValue = predecessor(indexValue);
|
|
7013
|
-
}
|
|
6854
|
+
if (queryParams.index_ === KEY_INDEX || !!key) {
|
|
7014
6855
|
params = queryParamsEndAt(queryParams, indexValue, key);
|
|
7015
6856
|
}
|
|
7016
6857
|
else {
|
|
7017
|
-
|
|
7018
|
-
childKey = MIN_NAME;
|
|
7019
|
-
}
|
|
7020
|
-
else {
|
|
7021
|
-
childKey = predecessor(key);
|
|
7022
|
-
}
|
|
7023
|
-
params = queryParamsEndAt(queryParams, indexValue, childKey);
|
|
6858
|
+
params = queryParamsEndAt(queryParams, indexValue, MIN_NAME);
|
|
7024
6859
|
}
|
|
7025
6860
|
params.endBeforeSet_ = true;
|
|
7026
6861
|
return params;
|
|
@@ -7042,39 +6877,43 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
7042
6877
|
}
|
|
7043
6878
|
var orderBy;
|
|
7044
6879
|
if (queryParams.index_ === PRIORITY_INDEX) {
|
|
7045
|
-
orderBy = "$priority" /* PRIORITY_INDEX */;
|
|
6880
|
+
orderBy = "$priority" /* REST_QUERY_CONSTANTS.PRIORITY_INDEX */;
|
|
7046
6881
|
}
|
|
7047
6882
|
else if (queryParams.index_ === VALUE_INDEX) {
|
|
7048
|
-
orderBy = "$value" /* VALUE_INDEX */;
|
|
6883
|
+
orderBy = "$value" /* REST_QUERY_CONSTANTS.VALUE_INDEX */;
|
|
7049
6884
|
}
|
|
7050
6885
|
else if (queryParams.index_ === KEY_INDEX) {
|
|
7051
|
-
orderBy = "$key" /* KEY_INDEX */;
|
|
6886
|
+
orderBy = "$key" /* REST_QUERY_CONSTANTS.KEY_INDEX */;
|
|
7052
6887
|
}
|
|
7053
6888
|
else {
|
|
7054
6889
|
util.assert(queryParams.index_ instanceof PathIndex, 'Unrecognized index type!');
|
|
7055
6890
|
orderBy = queryParams.index_.toString();
|
|
7056
6891
|
}
|
|
7057
|
-
qs["orderBy" /* ORDER_BY */] = util.stringify(orderBy);
|
|
6892
|
+
qs["orderBy" /* REST_QUERY_CONSTANTS.ORDER_BY */] = util.stringify(orderBy);
|
|
7058
6893
|
if (queryParams.startSet_) {
|
|
7059
|
-
|
|
6894
|
+
var startParam = queryParams.startAfterSet_
|
|
6895
|
+
? "startAfter" /* REST_QUERY_CONSTANTS.START_AFTER */
|
|
6896
|
+
: "startAt" /* REST_QUERY_CONSTANTS.START_AT */;
|
|
6897
|
+
qs[startParam] = util.stringify(queryParams.indexStartValue_);
|
|
7060
6898
|
if (queryParams.startNameSet_) {
|
|
7061
|
-
qs[
|
|
7062
|
-
',' + util.stringify(queryParams.indexStartName_);
|
|
6899
|
+
qs[startParam] += ',' + util.stringify(queryParams.indexStartName_);
|
|
7063
6900
|
}
|
|
7064
6901
|
}
|
|
7065
6902
|
if (queryParams.endSet_) {
|
|
7066
|
-
|
|
6903
|
+
var endParam = queryParams.endBeforeSet_
|
|
6904
|
+
? "endBefore" /* REST_QUERY_CONSTANTS.END_BEFORE */
|
|
6905
|
+
: "endAt" /* REST_QUERY_CONSTANTS.END_AT */;
|
|
6906
|
+
qs[endParam] = util.stringify(queryParams.indexEndValue_);
|
|
7067
6907
|
if (queryParams.endNameSet_) {
|
|
7068
|
-
qs[
|
|
7069
|
-
',' + util.stringify(queryParams.indexEndName_);
|
|
6908
|
+
qs[endParam] += ',' + util.stringify(queryParams.indexEndName_);
|
|
7070
6909
|
}
|
|
7071
6910
|
}
|
|
7072
6911
|
if (queryParams.limitSet_) {
|
|
7073
6912
|
if (queryParams.isViewFromLeft()) {
|
|
7074
|
-
qs["limitToFirst" /* LIMIT_TO_FIRST */] = queryParams.limit_;
|
|
6913
|
+
qs["limitToFirst" /* REST_QUERY_CONSTANTS.LIMIT_TO_FIRST */] = queryParams.limit_;
|
|
7075
6914
|
}
|
|
7076
6915
|
else {
|
|
7077
|
-
qs["limitToLast" /* LIMIT_TO_LAST */] = queryParams.limit_;
|
|
6916
|
+
qs["limitToLast" /* REST_QUERY_CONSTANTS.LIMIT_TO_LAST */] = queryParams.limit_;
|
|
7078
6917
|
}
|
|
7079
6918
|
}
|
|
7080
6919
|
return qs;
|
|
@@ -7082,35 +6921,39 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
7082
6921
|
function queryParamsGetQueryObject(queryParams) {
|
|
7083
6922
|
var obj = {};
|
|
7084
6923
|
if (queryParams.startSet_) {
|
|
7085
|
-
obj["sp" /* INDEX_START_VALUE */] =
|
|
6924
|
+
obj["sp" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_VALUE */] =
|
|
7086
6925
|
queryParams.indexStartValue_;
|
|
7087
6926
|
if (queryParams.startNameSet_) {
|
|
7088
|
-
obj["sn" /* INDEX_START_NAME */] =
|
|
6927
|
+
obj["sn" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_NAME */] =
|
|
7089
6928
|
queryParams.indexStartName_;
|
|
7090
6929
|
}
|
|
6930
|
+
obj["sin" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_IS_INCLUSIVE */] =
|
|
6931
|
+
!queryParams.startAfterSet_;
|
|
7091
6932
|
}
|
|
7092
6933
|
if (queryParams.endSet_) {
|
|
7093
|
-
obj["ep" /* INDEX_END_VALUE */] = queryParams.indexEndValue_;
|
|
6934
|
+
obj["ep" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_VALUE */] = queryParams.indexEndValue_;
|
|
7094
6935
|
if (queryParams.endNameSet_) {
|
|
7095
|
-
obj["en" /* INDEX_END_NAME */] = queryParams.indexEndName_;
|
|
6936
|
+
obj["en" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_NAME */] = queryParams.indexEndName_;
|
|
7096
6937
|
}
|
|
6938
|
+
obj["ein" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_IS_INCLUSIVE */] =
|
|
6939
|
+
!queryParams.endBeforeSet_;
|
|
7097
6940
|
}
|
|
7098
6941
|
if (queryParams.limitSet_) {
|
|
7099
|
-
obj["l" /* LIMIT */] = queryParams.limit_;
|
|
6942
|
+
obj["l" /* WIRE_PROTOCOL_CONSTANTS.LIMIT */] = queryParams.limit_;
|
|
7100
6943
|
var viewFrom = queryParams.viewFrom_;
|
|
7101
6944
|
if (viewFrom === '') {
|
|
7102
6945
|
if (queryParams.isViewFromLeft()) {
|
|
7103
|
-
viewFrom = "l" /* VIEW_FROM_LEFT */;
|
|
6946
|
+
viewFrom = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
7104
6947
|
}
|
|
7105
6948
|
else {
|
|
7106
|
-
viewFrom = "r" /* VIEW_FROM_RIGHT */;
|
|
6949
|
+
viewFrom = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
7107
6950
|
}
|
|
7108
6951
|
}
|
|
7109
|
-
obj["vf" /* VIEW_FROM */] = viewFrom;
|
|
6952
|
+
obj["vf" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM */] = viewFrom;
|
|
7110
6953
|
}
|
|
7111
6954
|
// For now, priority index is the default, so we only specify if it's some other index
|
|
7112
6955
|
if (queryParams.index_ !== PRIORITY_INDEX) {
|
|
7113
|
-
obj["i" /* INDEX */] = queryParams.index_.toString();
|
|
6956
|
+
obj["i" /* WIRE_PROTOCOL_CONSTANTS.INDEX */] = queryParams.index_.toString();
|
|
7114
6957
|
}
|
|
7115
6958
|
return obj;
|
|
7116
6959
|
}
|
|
@@ -7872,16 +7715,16 @@ function eventGeneratorGenerateEventsForChanges(eventGenerator, changes, eventCa
|
|
|
7872
7715
|
var events = [];
|
|
7873
7716
|
var moves = [];
|
|
7874
7717
|
changes.forEach(function (change) {
|
|
7875
|
-
if (change.type === "child_changed" /* CHILD_CHANGED */ &&
|
|
7718
|
+
if (change.type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
7876
7719
|
eventGenerator.index_.indexedValueChanged(change.oldSnap, change.snapshotNode)) {
|
|
7877
7720
|
moves.push(changeChildMoved(change.childName, change.snapshotNode));
|
|
7878
7721
|
}
|
|
7879
7722
|
});
|
|
7880
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_removed" /* CHILD_REMOVED */, changes, eventRegistrations, eventCache);
|
|
7881
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_added" /* CHILD_ADDED */, changes, eventRegistrations, eventCache);
|
|
7882
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_moved" /* CHILD_MOVED */, moves, eventRegistrations, eventCache);
|
|
7883
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_changed" /* CHILD_CHANGED */, changes, eventRegistrations, eventCache);
|
|
7884
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "value" /* VALUE */, changes, eventRegistrations, eventCache);
|
|
7723
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_removed" /* ChangeType.CHILD_REMOVED */, changes, eventRegistrations, eventCache);
|
|
7724
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_added" /* ChangeType.CHILD_ADDED */, changes, eventRegistrations, eventCache);
|
|
7725
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_moved" /* ChangeType.CHILD_MOVED */, moves, eventRegistrations, eventCache);
|
|
7726
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_changed" /* ChangeType.CHILD_CHANGED */, changes, eventRegistrations, eventCache);
|
|
7727
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "value" /* ChangeType.VALUE */, changes, eventRegistrations, eventCache);
|
|
7885
7728
|
return events;
|
|
7886
7729
|
}
|
|
7887
7730
|
/**
|
|
@@ -8967,31 +8810,31 @@ var ChildChangeAccumulator = /** @class */ (function () {
|
|
|
8967
8810
|
ChildChangeAccumulator.prototype.trackChildChange = function (change) {
|
|
8968
8811
|
var type = change.type;
|
|
8969
8812
|
var childKey = change.childName;
|
|
8970
|
-
util.assert(type === "child_added" /* CHILD_ADDED */ ||
|
|
8971
|
-
type === "child_changed" /* CHILD_CHANGED */ ||
|
|
8972
|
-
type === "child_removed" /* CHILD_REMOVED */, 'Only child changes supported for tracking');
|
|
8813
|
+
util.assert(type === "child_added" /* ChangeType.CHILD_ADDED */ ||
|
|
8814
|
+
type === "child_changed" /* ChangeType.CHILD_CHANGED */ ||
|
|
8815
|
+
type === "child_removed" /* ChangeType.CHILD_REMOVED */, 'Only child changes supported for tracking');
|
|
8973
8816
|
util.assert(childKey !== '.priority', 'Only non-priority child changes can be tracked.');
|
|
8974
8817
|
var oldChange = this.changeMap.get(childKey);
|
|
8975
8818
|
if (oldChange) {
|
|
8976
8819
|
var oldType = oldChange.type;
|
|
8977
|
-
if (type === "child_added" /* CHILD_ADDED */ &&
|
|
8978
|
-
oldType === "child_removed" /* CHILD_REMOVED */) {
|
|
8820
|
+
if (type === "child_added" /* ChangeType.CHILD_ADDED */ &&
|
|
8821
|
+
oldType === "child_removed" /* ChangeType.CHILD_REMOVED */) {
|
|
8979
8822
|
this.changeMap.set(childKey, changeChildChanged(childKey, change.snapshotNode, oldChange.snapshotNode));
|
|
8980
8823
|
}
|
|
8981
|
-
else if (type === "child_removed" /* CHILD_REMOVED */ &&
|
|
8982
|
-
oldType === "child_added" /* CHILD_ADDED */) {
|
|
8824
|
+
else if (type === "child_removed" /* ChangeType.CHILD_REMOVED */ &&
|
|
8825
|
+
oldType === "child_added" /* ChangeType.CHILD_ADDED */) {
|
|
8983
8826
|
this.changeMap.delete(childKey);
|
|
8984
8827
|
}
|
|
8985
|
-
else if (type === "child_removed" /* CHILD_REMOVED */ &&
|
|
8986
|
-
oldType === "child_changed" /* CHILD_CHANGED */) {
|
|
8828
|
+
else if (type === "child_removed" /* ChangeType.CHILD_REMOVED */ &&
|
|
8829
|
+
oldType === "child_changed" /* ChangeType.CHILD_CHANGED */) {
|
|
8987
8830
|
this.changeMap.set(childKey, changeChildRemoved(childKey, oldChange.oldSnap));
|
|
8988
8831
|
}
|
|
8989
|
-
else if (type === "child_changed" /* CHILD_CHANGED */ &&
|
|
8990
|
-
oldType === "child_added" /* CHILD_ADDED */) {
|
|
8832
|
+
else if (type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
8833
|
+
oldType === "child_added" /* ChangeType.CHILD_ADDED */) {
|
|
8991
8834
|
this.changeMap.set(childKey, changeChildAdded(childKey, change.snapshotNode));
|
|
8992
8835
|
}
|
|
8993
|
-
else if (type === "child_changed" /* CHILD_CHANGED */ &&
|
|
8994
|
-
oldType === "child_changed" /* CHILD_CHANGED */) {
|
|
8836
|
+
else if (type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
8837
|
+
oldType === "child_changed" /* ChangeType.CHILD_CHANGED */) {
|
|
8995
8838
|
this.changeMap.set(childKey, changeChildChanged(childKey, change.snapshotNode, oldChange.oldSnap));
|
|
8996
8839
|
}
|
|
8997
8840
|
else {
|
|
@@ -11716,7 +11559,7 @@ function repoLog(repo) {
|
|
|
11716
11559
|
if (repo.persistentConnection_) {
|
|
11717
11560
|
prefix = repo.persistentConnection_.id + ':';
|
|
11718
11561
|
}
|
|
11719
|
-
log.apply(void 0, tslib.__spreadArray([prefix], tslib.__read(varArgs)));
|
|
11562
|
+
log.apply(void 0, tslib.__spreadArray([prefix], tslib.__read(varArgs), false));
|
|
11720
11563
|
}
|
|
11721
11564
|
function repoCallOnCompleteCallback(repo, callback, status, errorReason) {
|
|
11722
11565
|
if (callback) {
|
|
@@ -11790,7 +11633,7 @@ function repoStartTransaction(repo, path, transactionUpdate, onComplete, unwatch
|
|
|
11790
11633
|
else {
|
|
11791
11634
|
validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path);
|
|
11792
11635
|
// Mark as run and add to our queue.
|
|
11793
|
-
transaction.status = 0 /* RUN */;
|
|
11636
|
+
transaction.status = 0 /* TransactionStatus.RUN */;
|
|
11794
11637
|
var queueNode = treeSubTree(repo.transactionQueueTree_, path);
|
|
11795
11638
|
var nodeQueue = treeGetValue(queueNode) || [];
|
|
11796
11639
|
nodeQueue.push(transaction);
|
|
@@ -11849,7 +11692,7 @@ function repoSendReadyTransactions(repo, node) {
|
|
|
11849
11692
|
if (treeGetValue(node)) {
|
|
11850
11693
|
var queue = repoBuildTransactionQueue(repo, node);
|
|
11851
11694
|
util.assert(queue.length > 0, 'Sending zero length transaction queue');
|
|
11852
|
-
var allRun = queue.every(function (transaction) { return transaction.status === 0 /* RUN */; });
|
|
11695
|
+
var allRun = queue.every(function (transaction) { return transaction.status === 0 /* TransactionStatus.RUN */; });
|
|
11853
11696
|
// If they're all run (and not sent), we can send them. Else, we must wait.
|
|
11854
11697
|
if (allRun) {
|
|
11855
11698
|
repoSendTransactionQueue(repo, treeGetPath(node), queue);
|
|
@@ -11878,8 +11721,8 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11878
11721
|
var latestHash = latestState.hash();
|
|
11879
11722
|
for (var i = 0; i < queue.length; i++) {
|
|
11880
11723
|
var txn = queue[i];
|
|
11881
|
-
util.assert(txn.status === 0 /* RUN */, 'tryToSendTransactionQueue_: items in queue should all be run.');
|
|
11882
|
-
txn.status = 1 /* SENT */;
|
|
11724
|
+
util.assert(txn.status === 0 /* TransactionStatus.RUN */, 'tryToSendTransactionQueue_: items in queue should all be run.');
|
|
11725
|
+
txn.status = 1 /* TransactionStatus.SENT */;
|
|
11883
11726
|
txn.retryCount++;
|
|
11884
11727
|
var relativePath = newRelativePath(path, txn.path);
|
|
11885
11728
|
// If we've gotten to this point, the output snapshot must be defined.
|
|
@@ -11900,7 +11743,7 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11900
11743
|
// transactions or sets.
|
|
11901
11744
|
var callbacks = [];
|
|
11902
11745
|
var _loop_1 = function (i) {
|
|
11903
|
-
queue[i].status = 2 /* COMPLETED */;
|
|
11746
|
+
queue[i].status = 2 /* TransactionStatus.COMPLETED */;
|
|
11904
11747
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, queue[i].currentWriteId));
|
|
11905
11748
|
if (queue[i].onComplete) {
|
|
11906
11749
|
// We never unset the output snapshot, and given that this
|
|
@@ -11928,18 +11771,18 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11928
11771
|
// transactions are no longer sent. Update their status appropriately.
|
|
11929
11772
|
if (status === 'datastale') {
|
|
11930
11773
|
for (var i = 0; i < queue.length; i++) {
|
|
11931
|
-
if (queue[i].status === 3 /* SENT_NEEDS_ABORT */) {
|
|
11932
|
-
queue[i].status = 4 /* NEEDS_ABORT */;
|
|
11774
|
+
if (queue[i].status === 3 /* TransactionStatus.SENT_NEEDS_ABORT */) {
|
|
11775
|
+
queue[i].status = 4 /* TransactionStatus.NEEDS_ABORT */;
|
|
11933
11776
|
}
|
|
11934
11777
|
else {
|
|
11935
|
-
queue[i].status = 0 /* RUN */;
|
|
11778
|
+
queue[i].status = 0 /* TransactionStatus.RUN */;
|
|
11936
11779
|
}
|
|
11937
11780
|
}
|
|
11938
11781
|
}
|
|
11939
11782
|
else {
|
|
11940
11783
|
warn('transaction at ' + pathToSend.toString() + ' failed: ' + status);
|
|
11941
11784
|
for (var i = 0; i < queue.length; i++) {
|
|
11942
|
-
queue[i].status = 4 /* NEEDS_ABORT */;
|
|
11785
|
+
queue[i].status = 4 /* TransactionStatus.NEEDS_ABORT */;
|
|
11943
11786
|
queue[i].abortReason = status;
|
|
11944
11787
|
}
|
|
11945
11788
|
}
|
|
@@ -11983,7 +11826,7 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
11983
11826
|
var events = [];
|
|
11984
11827
|
// Ignore all of the sets we're going to re-run.
|
|
11985
11828
|
var txnsToRerun = queue.filter(function (q) {
|
|
11986
|
-
return q.status === 0 /* RUN */;
|
|
11829
|
+
return q.status === 0 /* TransactionStatus.RUN */;
|
|
11987
11830
|
});
|
|
11988
11831
|
var setsToIgnore = txnsToRerun.map(function (q) {
|
|
11989
11832
|
return q.currentWriteId;
|
|
@@ -11993,12 +11836,12 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
11993
11836
|
var relativePath = newRelativePath(path, transaction.path);
|
|
11994
11837
|
var abortTransaction = false, abortReason;
|
|
11995
11838
|
util.assert(relativePath !== null, 'rerunTransactionsUnderNode_: relativePath should not be null.');
|
|
11996
|
-
if (transaction.status === 4 /* NEEDS_ABORT */) {
|
|
11839
|
+
if (transaction.status === 4 /* TransactionStatus.NEEDS_ABORT */) {
|
|
11997
11840
|
abortTransaction = true;
|
|
11998
11841
|
abortReason = transaction.abortReason;
|
|
11999
11842
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, transaction.currentWriteId, true));
|
|
12000
11843
|
}
|
|
12001
|
-
else if (transaction.status === 0 /* RUN */) {
|
|
11844
|
+
else if (transaction.status === 0 /* TransactionStatus.RUN */) {
|
|
12002
11845
|
if (transaction.retryCount >= MAX_TRANSACTION_RETRIES) {
|
|
12003
11846
|
abortTransaction = true;
|
|
12004
11847
|
abortReason = 'maxretry';
|
|
@@ -12041,7 +11884,7 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
12041
11884
|
events = [];
|
|
12042
11885
|
if (abortTransaction) {
|
|
12043
11886
|
// Abort.
|
|
12044
|
-
queue[i].status = 2 /* COMPLETED */;
|
|
11887
|
+
queue[i].status = 2 /* TransactionStatus.COMPLETED */;
|
|
12045
11888
|
// Removing a listener can trigger pruning which can muck with
|
|
12046
11889
|
// mergedData/visibleData (as it prunes data). So defer the unwatcher
|
|
12047
11890
|
// until we're done.
|
|
@@ -12129,7 +11972,7 @@ function repoPruneCompletedTransactionsBelowNode(repo, node) {
|
|
|
12129
11972
|
if (queue) {
|
|
12130
11973
|
var to = 0;
|
|
12131
11974
|
for (var from = 0; from < queue.length; from++) {
|
|
12132
|
-
if (queue[from].status !== 2 /* COMPLETED */) {
|
|
11975
|
+
if (queue[from].status !== 2 /* TransactionStatus.COMPLETED */) {
|
|
12133
11976
|
queue[to] = queue[from];
|
|
12134
11977
|
to++;
|
|
12135
11978
|
}
|
|
@@ -12177,16 +12020,16 @@ function repoAbortTransactionsOnNode(repo, node) {
|
|
|
12177
12020
|
var events = [];
|
|
12178
12021
|
var lastSent = -1;
|
|
12179
12022
|
for (var i = 0; i < queue.length; i++) {
|
|
12180
|
-
if (queue[i].status === 3 /* SENT_NEEDS_ABORT */) ;
|
|
12181
|
-
else if (queue[i].status === 1 /* SENT */) {
|
|
12023
|
+
if (queue[i].status === 3 /* TransactionStatus.SENT_NEEDS_ABORT */) ;
|
|
12024
|
+
else if (queue[i].status === 1 /* TransactionStatus.SENT */) {
|
|
12182
12025
|
util.assert(lastSent === i - 1, 'All SENT items should be at beginning of queue.');
|
|
12183
12026
|
lastSent = i;
|
|
12184
12027
|
// Mark transaction for abort when it comes back.
|
|
12185
|
-
queue[i].status = 3 /* SENT_NEEDS_ABORT */;
|
|
12028
|
+
queue[i].status = 3 /* TransactionStatus.SENT_NEEDS_ABORT */;
|
|
12186
12029
|
queue[i].abortReason = 'set';
|
|
12187
12030
|
}
|
|
12188
12031
|
else {
|
|
12189
|
-
util.assert(queue[i].status === 0 /* RUN */, 'Unexpected transaction status in abort');
|
|
12032
|
+
util.assert(queue[i].status === 0 /* TransactionStatus.RUN */, 'Unexpected transaction status in abort');
|
|
12190
12033
|
// We can abort it immediately.
|
|
12191
12034
|
queue[i].unwatcher();
|
|
12192
12035
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, queue[i].currentWriteId, true));
|
|
@@ -12262,7 +12105,7 @@ function decodeQuery(queryString) {
|
|
|
12262
12105
|
results[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]);
|
|
12263
12106
|
}
|
|
12264
12107
|
else {
|
|
12265
|
-
warn("Invalid query segment '"
|
|
12108
|
+
warn("Invalid query segment '".concat(segment, "' in query '").concat(queryString, "'"));
|
|
12266
12109
|
}
|
|
12267
12110
|
}
|
|
12268
12111
|
}
|
|
@@ -12367,6 +12210,81 @@ var parseDatabaseURL = function (dataURL) {
|
|
|
12367
12210
|
};
|
|
12368
12211
|
};
|
|
12369
12212
|
|
|
12213
|
+
/**
|
|
12214
|
+
* @license
|
|
12215
|
+
* Copyright 2017 Google LLC
|
|
12216
|
+
*
|
|
12217
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12218
|
+
* you may not use this file except in compliance with the License.
|
|
12219
|
+
* You may obtain a copy of the License at
|
|
12220
|
+
*
|
|
12221
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12222
|
+
*
|
|
12223
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12224
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12225
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12226
|
+
* See the License for the specific language governing permissions and
|
|
12227
|
+
* limitations under the License.
|
|
12228
|
+
*/
|
|
12229
|
+
// Modeled after base64 web-safe chars, but ordered by ASCII.
|
|
12230
|
+
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
12231
|
+
/**
|
|
12232
|
+
* Fancy ID generator that creates 20-character string identifiers with the
|
|
12233
|
+
* following properties:
|
|
12234
|
+
*
|
|
12235
|
+
* 1. They're based on timestamp so that they sort *after* any existing ids.
|
|
12236
|
+
* 2. They contain 72-bits of random data after the timestamp so that IDs won't
|
|
12237
|
+
* collide with other clients' IDs.
|
|
12238
|
+
* 3. They sort *lexicographically* (so the timestamp is converted to characters
|
|
12239
|
+
* that will sort properly).
|
|
12240
|
+
* 4. They're monotonically increasing. Even if you generate more than one in
|
|
12241
|
+
* the same timestamp, the latter ones will sort after the former ones. We do
|
|
12242
|
+
* this by using the previous random bits but "incrementing" them by 1 (only
|
|
12243
|
+
* in the case of a timestamp collision).
|
|
12244
|
+
*/
|
|
12245
|
+
var nextPushId = (function () {
|
|
12246
|
+
// Timestamp of last push, used to prevent local collisions if you push twice
|
|
12247
|
+
// in one ms.
|
|
12248
|
+
var lastPushTime = 0;
|
|
12249
|
+
// We generate 72-bits of randomness which get turned into 12 characters and
|
|
12250
|
+
// appended to the timestamp to prevent collisions with other clients. We
|
|
12251
|
+
// store the last characters we generated because in the event of a collision,
|
|
12252
|
+
// we'll use those same characters except "incremented" by one.
|
|
12253
|
+
var lastRandChars = [];
|
|
12254
|
+
return function (now) {
|
|
12255
|
+
var duplicateTime = now === lastPushTime;
|
|
12256
|
+
lastPushTime = now;
|
|
12257
|
+
var i;
|
|
12258
|
+
var timeStampChars = new Array(8);
|
|
12259
|
+
for (i = 7; i >= 0; i--) {
|
|
12260
|
+
timeStampChars[i] = PUSH_CHARS.charAt(now % 64);
|
|
12261
|
+
// NOTE: Can't use << here because javascript will convert to int and lose
|
|
12262
|
+
// the upper bits.
|
|
12263
|
+
now = Math.floor(now / 64);
|
|
12264
|
+
}
|
|
12265
|
+
util.assert(now === 0, 'Cannot push at time == 0');
|
|
12266
|
+
var id = timeStampChars.join('');
|
|
12267
|
+
if (!duplicateTime) {
|
|
12268
|
+
for (i = 0; i < 12; i++) {
|
|
12269
|
+
lastRandChars[i] = Math.floor(Math.random() * 64);
|
|
12270
|
+
}
|
|
12271
|
+
}
|
|
12272
|
+
else {
|
|
12273
|
+
// If the timestamp hasn't changed since last push, use the same random
|
|
12274
|
+
// number, except incremented by 1.
|
|
12275
|
+
for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) {
|
|
12276
|
+
lastRandChars[i] = 0;
|
|
12277
|
+
}
|
|
12278
|
+
lastRandChars[i]++;
|
|
12279
|
+
}
|
|
12280
|
+
for (i = 0; i < 12; i++) {
|
|
12281
|
+
id += PUSH_CHARS.charAt(lastRandChars[i]);
|
|
12282
|
+
}
|
|
12283
|
+
util.assert(id.length === 20, 'nextPushId: Length should be 20.');
|
|
12284
|
+
return id;
|
|
12285
|
+
};
|
|
12286
|
+
})();
|
|
12287
|
+
|
|
12370
12288
|
/**
|
|
12371
12289
|
* @license
|
|
12372
12290
|
* Copyright 2017 Google LLC
|
|
@@ -14004,7 +13922,7 @@ var useRestClient = false;
|
|
|
14004
13922
|
* Update an existing `Repo` in place to point to a new host/port.
|
|
14005
13923
|
*/
|
|
14006
13924
|
function repoManagerApplyEmulatorSettings(repo, host, port, tokenProvider) {
|
|
14007
|
-
repo.repoInfo_ = new RepoInfo(host
|
|
13925
|
+
repo.repoInfo_ = new RepoInfo("".concat(host, ":").concat(port),
|
|
14008
13926
|
/* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams);
|
|
14009
13927
|
if (tokenProvider) {
|
|
14010
13928
|
repo.authTokenProvider_ = tokenProvider;
|
|
@@ -14022,7 +13940,7 @@ function repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, no
|
|
|
14022
13940
|
' a Project ID when calling firebase.initializeApp().');
|
|
14023
13941
|
}
|
|
14024
13942
|
log('Using default host for project ', app.options.projectId);
|
|
14025
|
-
dbUrl = app.options.projectId
|
|
13943
|
+
dbUrl = "".concat(app.options.projectId, "-default-rtdb.firebaseio.com");
|
|
14026
13944
|
}
|
|
14027
13945
|
var parsedUrl = parseRepoInfo(dbUrl, nodeAdmin);
|
|
14028
13946
|
var repoInfo = parsedUrl.repoInfo;
|
|
@@ -14033,7 +13951,7 @@ function repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, no
|
|
|
14033
13951
|
}
|
|
14034
13952
|
if (dbEmulatorHost) {
|
|
14035
13953
|
isEmulator = true;
|
|
14036
|
-
dbUrl = "http://"
|
|
13954
|
+
dbUrl = "http://".concat(dbEmulatorHost, "?ns=").concat(repoInfo.namespace);
|
|
14037
13955
|
parsedUrl = parseRepoInfo(dbUrl, nodeAdmin);
|
|
14038
13956
|
repoInfo = parsedUrl.repoInfo;
|
|
14039
13957
|
}
|
|
@@ -14059,7 +13977,7 @@ function repoManagerDeleteRepo(repo, appName) {
|
|
|
14059
13977
|
var appRepos = repos[appName];
|
|
14060
13978
|
// This should never happen...
|
|
14061
13979
|
if (!appRepos || appRepos[repo.key] !== repo) {
|
|
14062
|
-
fatal("Database "
|
|
13980
|
+
fatal("Database ".concat(appName, "(").concat(repo.repoInfo_, ") has already been deleted."));
|
|
14063
13981
|
}
|
|
14064
13982
|
repoInterrupt(repo);
|
|
14065
13983
|
delete appRepos[repo.key];
|