@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.esm5.js
CHANGED
|
@@ -5,7 +5,7 @@ import { stringify, jsonEval, contains, assert, isNodeSdk, stringToByteArray, Sh
|
|
|
5
5
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
6
6
|
|
|
7
7
|
var name = "@firebase/database";
|
|
8
|
-
var version = "0.
|
|
8
|
+
var version = "0.14.0";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @license
|
|
@@ -311,7 +311,7 @@ var logWrapper = function (prefix) {
|
|
|
311
311
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
312
312
|
varArgs[_i] = arguments[_i];
|
|
313
313
|
}
|
|
314
|
-
log.apply(void 0, __spreadArray([prefix], __read(varArgs)));
|
|
314
|
+
log.apply(void 0, __spreadArray([prefix], __read(varArgs), false));
|
|
315
315
|
};
|
|
316
316
|
};
|
|
317
317
|
var error = function () {
|
|
@@ -319,7 +319,7 @@ var error = function () {
|
|
|
319
319
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
320
320
|
varArgs[_i] = arguments[_i];
|
|
321
321
|
}
|
|
322
|
-
var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, __spreadArray([], __read(varArgs)));
|
|
322
|
+
var message = 'FIREBASE INTERNAL ERROR: ' + buildLogMessage_.apply(void 0, __spreadArray([], __read(varArgs), false));
|
|
323
323
|
logClient.error(message);
|
|
324
324
|
};
|
|
325
325
|
var fatal = function () {
|
|
@@ -327,7 +327,7 @@ var fatal = function () {
|
|
|
327
327
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
328
328
|
varArgs[_i] = arguments[_i];
|
|
329
329
|
}
|
|
330
|
-
var message = "FIREBASE FATAL ERROR: "
|
|
330
|
+
var message = "FIREBASE FATAL ERROR: ".concat(buildLogMessage_.apply(void 0, __spreadArray([], __read(varArgs), false)));
|
|
331
331
|
logClient.error(message);
|
|
332
332
|
throw new Error(message);
|
|
333
333
|
};
|
|
@@ -336,7 +336,7 @@ var warn = function () {
|
|
|
336
336
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
337
337
|
varArgs[_i] = arguments[_i];
|
|
338
338
|
}
|
|
339
|
-
var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, __spreadArray([], __read(varArgs)));
|
|
339
|
+
var message = 'FIREBASE WARNING: ' + buildLogMessage_.apply(void 0, __spreadArray([], __read(varArgs), false));
|
|
340
340
|
logClient.warn(message);
|
|
341
341
|
};
|
|
342
342
|
/**
|
|
@@ -772,7 +772,7 @@ var AppCheckTokenProvider = /** @class */ (function () {
|
|
|
772
772
|
(_a = this.appCheckProvider) === null || _a === void 0 ? void 0 : _a.get().then(function (appCheck) { return appCheck.addTokenListener(listener); });
|
|
773
773
|
};
|
|
774
774
|
AppCheckTokenProvider.prototype.notifyForInvalidToken = function () {
|
|
775
|
-
warn("Provided AppCheck credentials for the app named \""
|
|
775
|
+
warn("Provided AppCheck credentials for the app named \"".concat(this.appName_, "\" ") +
|
|
776
776
|
'are invalid. This usually indicates your app was not initialized correctly.');
|
|
777
777
|
};
|
|
778
778
|
return AppCheckTokenProvider;
|
|
@@ -1010,9 +1010,9 @@ var RepoInfo = /** @class */ (function () {
|
|
|
1010
1010
|
RepoInfo.prototype.toURLString = function () {
|
|
1011
1011
|
var protocol = this.secure ? 'https://' : 'http://';
|
|
1012
1012
|
var query = this.includeNamespaceInQueryParams
|
|
1013
|
-
? "?ns="
|
|
1013
|
+
? "?ns=".concat(this.namespace)
|
|
1014
1014
|
: '';
|
|
1015
|
-
return ""
|
|
1015
|
+
return "".concat(protocol).concat(this.host, "/").concat(query);
|
|
1016
1016
|
};
|
|
1017
1017
|
return RepoInfo;
|
|
1018
1018
|
}());
|
|
@@ -1934,7 +1934,7 @@ var WebSocketConnection = /** @class */ (function () {
|
|
|
1934
1934
|
// UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
|
|
1935
1935
|
options = {
|
|
1936
1936
|
headers: {
|
|
1937
|
-
'User-Agent': "Firebase/"
|
|
1937
|
+
'User-Agent': "Firebase/".concat(PROTOCOL_VERSION, "/").concat(SDK_VERSION, "/").concat(process.platform, "/").concat(device),
|
|
1938
1938
|
'X-Firebase-GMPID': this.applicationId || ''
|
|
1939
1939
|
}
|
|
1940
1940
|
};
|
|
@@ -1944,7 +1944,7 @@ var WebSocketConnection = /** @class */ (function () {
|
|
|
1944
1944
|
// Note that this header is just used to bypass appcheck, and the token should still be sent
|
|
1945
1945
|
// through the websocket connection once it is established.
|
|
1946
1946
|
if (this.authToken) {
|
|
1947
|
-
options.headers['Authorization'] = "Bearer "
|
|
1947
|
+
options.headers['Authorization'] = "Bearer ".concat(this.authToken);
|
|
1948
1948
|
}
|
|
1949
1949
|
if (this.appCheckToken) {
|
|
1950
1950
|
options.headers['X-Firebase-AppCheck'] = this.appCheckToken;
|
|
@@ -2355,7 +2355,7 @@ var Connection = /** @class */ (function () {
|
|
|
2355
2355
|
this.lastSessionId = lastSessionId;
|
|
2356
2356
|
this.connectionCount = 0;
|
|
2357
2357
|
this.pendingDataMessages = [];
|
|
2358
|
-
this.state_ = 0 /* CONNECTING */;
|
|
2358
|
+
this.state_ = 0 /* RealtimeState.CONNECTING */;
|
|
2359
2359
|
this.log_ = logWrapper('c:' + this.id + ':');
|
|
2360
2360
|
this.transportManager_ = new TransportManager(repoInfo_);
|
|
2361
2361
|
this.log_('Connection created');
|
|
@@ -2438,7 +2438,7 @@ var Connection = /** @class */ (function () {
|
|
|
2438
2438
|
Connection.prototype.connReceiver_ = function (conn) {
|
|
2439
2439
|
var _this = this;
|
|
2440
2440
|
return function (message) {
|
|
2441
|
-
if (_this.state_ !== 2 /* DISCONNECTED */) {
|
|
2441
|
+
if (_this.state_ !== 2 /* RealtimeState.DISCONNECTED */) {
|
|
2442
2442
|
if (conn === _this.rx_) {
|
|
2443
2443
|
_this.onPrimaryMessageReceived_(message);
|
|
2444
2444
|
}
|
|
@@ -2604,7 +2604,7 @@ var Connection = /** @class */ (function () {
|
|
|
2604
2604
|
this.sessionId = handshake.s;
|
|
2605
2605
|
this.repoInfo_.host = host;
|
|
2606
2606
|
// if we've already closed the connection, then don't bother trying to progress further
|
|
2607
|
-
if (this.state_ === 0 /* CONNECTING */) {
|
|
2607
|
+
if (this.state_ === 0 /* RealtimeState.CONNECTING */) {
|
|
2608
2608
|
this.conn_.start();
|
|
2609
2609
|
this.onConnectionEstablished_(this.conn_, timestamp);
|
|
2610
2610
|
if (PROTOCOL_VERSION !== version) {
|
|
@@ -2643,7 +2643,7 @@ var Connection = /** @class */ (function () {
|
|
|
2643
2643
|
this.repoInfo_.host = host;
|
|
2644
2644
|
// TODO: if we're already "connected", we need to trigger a disconnect at the next layer up.
|
|
2645
2645
|
// We don't currently support resets after the connection has already been established
|
|
2646
|
-
if (this.state_ === 1 /* CONNECTED */) {
|
|
2646
|
+
if (this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2647
2647
|
this.close();
|
|
2648
2648
|
}
|
|
2649
2649
|
else {
|
|
@@ -2656,7 +2656,7 @@ var Connection = /** @class */ (function () {
|
|
|
2656
2656
|
var _this = this;
|
|
2657
2657
|
this.log_('Realtime connection established.');
|
|
2658
2658
|
this.conn_ = conn;
|
|
2659
|
-
this.state_ = 1 /* CONNECTED */;
|
|
2659
|
+
this.state_ = 1 /* RealtimeState.CONNECTED */;
|
|
2660
2660
|
if (this.onReady_) {
|
|
2661
2661
|
this.onReady_(timestamp, this.sessionId);
|
|
2662
2662
|
this.onReady_ = null;
|
|
@@ -2675,7 +2675,7 @@ var Connection = /** @class */ (function () {
|
|
|
2675
2675
|
};
|
|
2676
2676
|
Connection.prototype.sendPingOnPrimaryIfNecessary_ = function () {
|
|
2677
2677
|
// If the connection isn't considered healthy yet, we'll send a noop ping packet request.
|
|
2678
|
-
if (!this.isHealthy_ && this.state_ === 1 /* CONNECTED */) {
|
|
2678
|
+
if (!this.isHealthy_ && this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2679
2679
|
this.log_('sending ping on primary.');
|
|
2680
2680
|
this.sendData_({ t: 'c', d: { t: PING, d: {} } });
|
|
2681
2681
|
}
|
|
@@ -2696,7 +2696,7 @@ var Connection = /** @class */ (function () {
|
|
|
2696
2696
|
this.conn_ = null;
|
|
2697
2697
|
// NOTE: IF you're seeing a Firefox error for this line, I think it might be because it's getting
|
|
2698
2698
|
// called on window close and RealtimeState.CONNECTING is no longer defined. Just a guess.
|
|
2699
|
-
if (!everConnected && this.state_ === 0 /* CONNECTING */) {
|
|
2699
|
+
if (!everConnected && this.state_ === 0 /* RealtimeState.CONNECTING */) {
|
|
2700
2700
|
this.log_('Realtime connection failed.');
|
|
2701
2701
|
// Since we failed to connect at all, clear any cached entry for this namespace in case the machine went away
|
|
2702
2702
|
if (this.repoInfo_.isCacheableHost()) {
|
|
@@ -2705,7 +2705,7 @@ var Connection = /** @class */ (function () {
|
|
|
2705
2705
|
this.repoInfo_.internalHost = this.repoInfo_.host;
|
|
2706
2706
|
}
|
|
2707
2707
|
}
|
|
2708
|
-
else if (this.state_ === 1 /* CONNECTED */) {
|
|
2708
|
+
else if (this.state_ === 1 /* RealtimeState.CONNECTED */) {
|
|
2709
2709
|
this.log_('Realtime connection lost.');
|
|
2710
2710
|
}
|
|
2711
2711
|
this.close();
|
|
@@ -2722,7 +2722,7 @@ var Connection = /** @class */ (function () {
|
|
|
2722
2722
|
this.close();
|
|
2723
2723
|
};
|
|
2724
2724
|
Connection.prototype.sendData_ = function (data) {
|
|
2725
|
-
if (this.state_ !== 1 /* CONNECTED */) {
|
|
2725
|
+
if (this.state_ !== 1 /* RealtimeState.CONNECTED */) {
|
|
2726
2726
|
throw 'Connection is not connected';
|
|
2727
2727
|
}
|
|
2728
2728
|
else {
|
|
@@ -2733,9 +2733,9 @@ var Connection = /** @class */ (function () {
|
|
|
2733
2733
|
* Cleans up this connection, calling the appropriate callbacks
|
|
2734
2734
|
*/
|
|
2735
2735
|
Connection.prototype.close = function () {
|
|
2736
|
-
if (this.state_ !== 2 /* DISCONNECTED */) {
|
|
2736
|
+
if (this.state_ !== 2 /* RealtimeState.DISCONNECTED */) {
|
|
2737
2737
|
this.log_('Closing realtime connection.');
|
|
2738
|
-
this.state_ = 2 /* DISCONNECTED */;
|
|
2738
|
+
this.state_ = 2 /* RealtimeState.DISCONNECTED */;
|
|
2739
2739
|
this.closeConnections_();
|
|
2740
2740
|
if (this.onDisconnect_) {
|
|
2741
2741
|
this.onDisconnect_();
|
|
@@ -2841,7 +2841,7 @@ var EventEmitter = /** @class */ (function () {
|
|
|
2841
2841
|
}
|
|
2842
2842
|
if (Array.isArray(this.listeners_[eventType])) {
|
|
2843
2843
|
// Clone the list, since callbacks could add/remove listeners.
|
|
2844
|
-
var listeners = __spreadArray([], __read(this.listeners_[eventType]));
|
|
2844
|
+
var listeners = __spreadArray([], __read(this.listeners_[eventType]), false);
|
|
2845
2845
|
for (var i = 0; i < listeners.length; i++) {
|
|
2846
2846
|
listeners[i].callback.apply(listeners[i].context, varArgs);
|
|
2847
2847
|
}
|
|
@@ -3486,8 +3486,8 @@ var PersistentConnection = /** @class */ (function (_super) {
|
|
|
3486
3486
|
var indexSpec = '".indexOn": "' + query._queryParams.getIndex().toString() + '"';
|
|
3487
3487
|
var indexPath = query._path.toString();
|
|
3488
3488
|
warn("Using an unspecified index. Your data will be downloaded and " +
|
|
3489
|
-
|
|
3490
|
-
(indexPath
|
|
3489
|
+
"filtered on the client. Consider adding ".concat(indexSpec, " at ") +
|
|
3490
|
+
"".concat(indexPath, " to your security rules for better performance."));
|
|
3491
3491
|
}
|
|
3492
3492
|
}
|
|
3493
3493
|
};
|
|
@@ -6166,153 +6166,6 @@ var ValueIndex = /** @class */ (function (_super) {
|
|
|
6166
6166
|
}(Index));
|
|
6167
6167
|
var VALUE_INDEX = new ValueIndex();
|
|
6168
6168
|
|
|
6169
|
-
/**
|
|
6170
|
-
* @license
|
|
6171
|
-
* Copyright 2017 Google LLC
|
|
6172
|
-
*
|
|
6173
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6174
|
-
* you may not use this file except in compliance with the License.
|
|
6175
|
-
* You may obtain a copy of the License at
|
|
6176
|
-
*
|
|
6177
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6178
|
-
*
|
|
6179
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
6180
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6181
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6182
|
-
* See the License for the specific language governing permissions and
|
|
6183
|
-
* limitations under the License.
|
|
6184
|
-
*/
|
|
6185
|
-
// Modeled after base64 web-safe chars, but ordered by ASCII.
|
|
6186
|
-
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
6187
|
-
var MIN_PUSH_CHAR = '-';
|
|
6188
|
-
var MAX_PUSH_CHAR = 'z';
|
|
6189
|
-
var MAX_KEY_LEN = 786;
|
|
6190
|
-
/**
|
|
6191
|
-
* Fancy ID generator that creates 20-character string identifiers with the
|
|
6192
|
-
* following properties:
|
|
6193
|
-
*
|
|
6194
|
-
* 1. They're based on timestamp so that they sort *after* any existing ids.
|
|
6195
|
-
* 2. They contain 72-bits of random data after the timestamp so that IDs won't
|
|
6196
|
-
* collide with other clients' IDs.
|
|
6197
|
-
* 3. They sort *lexicographically* (so the timestamp is converted to characters
|
|
6198
|
-
* that will sort properly).
|
|
6199
|
-
* 4. They're monotonically increasing. Even if you generate more than one in
|
|
6200
|
-
* the same timestamp, the latter ones will sort after the former ones. We do
|
|
6201
|
-
* this by using the previous random bits but "incrementing" them by 1 (only
|
|
6202
|
-
* in the case of a timestamp collision).
|
|
6203
|
-
*/
|
|
6204
|
-
var nextPushId = (function () {
|
|
6205
|
-
// Timestamp of last push, used to prevent local collisions if you push twice
|
|
6206
|
-
// in one ms.
|
|
6207
|
-
var lastPushTime = 0;
|
|
6208
|
-
// We generate 72-bits of randomness which get turned into 12 characters and
|
|
6209
|
-
// appended to the timestamp to prevent collisions with other clients. We
|
|
6210
|
-
// store the last characters we generated because in the event of a collision,
|
|
6211
|
-
// we'll use those same characters except "incremented" by one.
|
|
6212
|
-
var lastRandChars = [];
|
|
6213
|
-
return function (now) {
|
|
6214
|
-
var duplicateTime = now === lastPushTime;
|
|
6215
|
-
lastPushTime = now;
|
|
6216
|
-
var i;
|
|
6217
|
-
var timeStampChars = new Array(8);
|
|
6218
|
-
for (i = 7; i >= 0; i--) {
|
|
6219
|
-
timeStampChars[i] = PUSH_CHARS.charAt(now % 64);
|
|
6220
|
-
// NOTE: Can't use << here because javascript will convert to int and lose
|
|
6221
|
-
// the upper bits.
|
|
6222
|
-
now = Math.floor(now / 64);
|
|
6223
|
-
}
|
|
6224
|
-
assert(now === 0, 'Cannot push at time == 0');
|
|
6225
|
-
var id = timeStampChars.join('');
|
|
6226
|
-
if (!duplicateTime) {
|
|
6227
|
-
for (i = 0; i < 12; i++) {
|
|
6228
|
-
lastRandChars[i] = Math.floor(Math.random() * 64);
|
|
6229
|
-
}
|
|
6230
|
-
}
|
|
6231
|
-
else {
|
|
6232
|
-
// If the timestamp hasn't changed since last push, use the same random
|
|
6233
|
-
// number, except incremented by 1.
|
|
6234
|
-
for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) {
|
|
6235
|
-
lastRandChars[i] = 0;
|
|
6236
|
-
}
|
|
6237
|
-
lastRandChars[i]++;
|
|
6238
|
-
}
|
|
6239
|
-
for (i = 0; i < 12; i++) {
|
|
6240
|
-
id += PUSH_CHARS.charAt(lastRandChars[i]);
|
|
6241
|
-
}
|
|
6242
|
-
assert(id.length === 20, 'nextPushId: Length should be 20.');
|
|
6243
|
-
return id;
|
|
6244
|
-
};
|
|
6245
|
-
})();
|
|
6246
|
-
var successor = function (key) {
|
|
6247
|
-
if (key === '' + INTEGER_32_MAX) {
|
|
6248
|
-
// See https://firebase.google.com/docs/database/web/lists-of-data#data-order
|
|
6249
|
-
return MIN_PUSH_CHAR;
|
|
6250
|
-
}
|
|
6251
|
-
var keyAsInt = tryParseInt(key);
|
|
6252
|
-
if (keyAsInt != null) {
|
|
6253
|
-
return '' + (keyAsInt + 1);
|
|
6254
|
-
}
|
|
6255
|
-
var next = new Array(key.length);
|
|
6256
|
-
for (var i_1 = 0; i_1 < next.length; i_1++) {
|
|
6257
|
-
next[i_1] = key.charAt(i_1);
|
|
6258
|
-
}
|
|
6259
|
-
if (next.length < MAX_KEY_LEN) {
|
|
6260
|
-
next.push(MIN_PUSH_CHAR);
|
|
6261
|
-
return next.join('');
|
|
6262
|
-
}
|
|
6263
|
-
var i = next.length - 1;
|
|
6264
|
-
while (i >= 0 && next[i] === MAX_PUSH_CHAR) {
|
|
6265
|
-
i--;
|
|
6266
|
-
}
|
|
6267
|
-
// `successor` was called on the largest possible key, so return the
|
|
6268
|
-
// MAX_NAME, which sorts larger than all keys.
|
|
6269
|
-
if (i === -1) {
|
|
6270
|
-
return MAX_NAME;
|
|
6271
|
-
}
|
|
6272
|
-
var source = next[i];
|
|
6273
|
-
var sourcePlusOne = PUSH_CHARS.charAt(PUSH_CHARS.indexOf(source) + 1);
|
|
6274
|
-
next[i] = sourcePlusOne;
|
|
6275
|
-
return next.slice(0, i + 1).join('');
|
|
6276
|
-
};
|
|
6277
|
-
// `key` is assumed to be non-empty.
|
|
6278
|
-
var predecessor = function (key) {
|
|
6279
|
-
if (key === '' + INTEGER_32_MIN) {
|
|
6280
|
-
return MIN_NAME;
|
|
6281
|
-
}
|
|
6282
|
-
var keyAsInt = tryParseInt(key);
|
|
6283
|
-
if (keyAsInt != null) {
|
|
6284
|
-
return '' + (keyAsInt - 1);
|
|
6285
|
-
}
|
|
6286
|
-
var next = new Array(key.length);
|
|
6287
|
-
for (var i = 0; i < next.length; i++) {
|
|
6288
|
-
next[i] = key.charAt(i);
|
|
6289
|
-
}
|
|
6290
|
-
// If `key` ends in `MIN_PUSH_CHAR`, the largest key lexicographically
|
|
6291
|
-
// smaller than `key`, is `key[0:key.length - 1]`. The next key smaller
|
|
6292
|
-
// than that, `predecessor(predecessor(key))`, is
|
|
6293
|
-
//
|
|
6294
|
-
// `key[0:key.length - 2] + (key[key.length - 1] - 1) + \
|
|
6295
|
-
// { MAX_PUSH_CHAR repeated MAX_KEY_LEN - (key.length - 1) times }
|
|
6296
|
-
//
|
|
6297
|
-
// analogous to increment/decrement for base-10 integers.
|
|
6298
|
-
//
|
|
6299
|
-
// This works because lexigographic comparison works character-by-character,
|
|
6300
|
-
// using length as a tie-breaker if one key is a prefix of the other.
|
|
6301
|
-
if (next[next.length - 1] === MIN_PUSH_CHAR) {
|
|
6302
|
-
if (next.length === 1) {
|
|
6303
|
-
// See https://firebase.google.com/docs/database/web/lists-of-data#orderbykey
|
|
6304
|
-
return '' + INTEGER_32_MAX;
|
|
6305
|
-
}
|
|
6306
|
-
delete next[next.length - 1];
|
|
6307
|
-
return next.join('');
|
|
6308
|
-
}
|
|
6309
|
-
// Replace the last character with it's immediate predecessor, and
|
|
6310
|
-
// fill the suffix of the key with MAX_PUSH_CHAR. This is the
|
|
6311
|
-
// lexicographically largest possible key smaller than `key`.
|
|
6312
|
-
next[next.length - 1] = PUSH_CHARS.charAt(PUSH_CHARS.indexOf(next[next.length - 1]) - 1);
|
|
6313
|
-
return next.join('') + MAX_PUSH_CHAR.repeat(MAX_KEY_LEN - next.length);
|
|
6314
|
-
};
|
|
6315
|
-
|
|
6316
6169
|
/**
|
|
6317
6170
|
* @license
|
|
6318
6171
|
* Copyright 2017 Google LLC
|
|
@@ -6330,24 +6183,24 @@ var predecessor = function (key) {
|
|
|
6330
6183
|
* limitations under the License.
|
|
6331
6184
|
*/
|
|
6332
6185
|
function changeValue(snapshotNode) {
|
|
6333
|
-
return { type: "value" /* VALUE */, snapshotNode: snapshotNode };
|
|
6186
|
+
return { type: "value" /* ChangeType.VALUE */, snapshotNode: snapshotNode };
|
|
6334
6187
|
}
|
|
6335
6188
|
function changeChildAdded(childName, snapshotNode) {
|
|
6336
|
-
return { type: "child_added" /* CHILD_ADDED */, snapshotNode: snapshotNode, childName: childName };
|
|
6189
|
+
return { type: "child_added" /* ChangeType.CHILD_ADDED */, snapshotNode: snapshotNode, childName: childName };
|
|
6337
6190
|
}
|
|
6338
6191
|
function changeChildRemoved(childName, snapshotNode) {
|
|
6339
|
-
return { type: "child_removed" /* CHILD_REMOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
6192
|
+
return { type: "child_removed" /* ChangeType.CHILD_REMOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
6340
6193
|
}
|
|
6341
6194
|
function changeChildChanged(childName, snapshotNode, oldSnap) {
|
|
6342
6195
|
return {
|
|
6343
|
-
type: "child_changed" /* CHILD_CHANGED */,
|
|
6196
|
+
type: "child_changed" /* ChangeType.CHILD_CHANGED */,
|
|
6344
6197
|
snapshotNode: snapshotNode,
|
|
6345
6198
|
childName: childName,
|
|
6346
6199
|
oldSnap: oldSnap
|
|
6347
6200
|
};
|
|
6348
6201
|
}
|
|
6349
6202
|
function changeChildMoved(childName, snapshotNode) {
|
|
6350
|
-
return { type: "child_moved" /* CHILD_MOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
6203
|
+
return { type: "child_moved" /* ChangeType.CHILD_MOVED */, snapshotNode: snapshotNode, childName: childName };
|
|
6351
6204
|
}
|
|
6352
6205
|
|
|
6353
6206
|
/**
|
|
@@ -6482,6 +6335,8 @@ var RangedFilter = /** @class */ (function () {
|
|
|
6482
6335
|
this.index_ = params.getIndex();
|
|
6483
6336
|
this.startPost_ = RangedFilter.getStartPost_(params);
|
|
6484
6337
|
this.endPost_ = RangedFilter.getEndPost_(params);
|
|
6338
|
+
this.startIsInclusive_ = !params.startAfterSet_;
|
|
6339
|
+
this.endIsInclusive_ = !params.endBeforeSet_;
|
|
6485
6340
|
}
|
|
6486
6341
|
RangedFilter.prototype.getStartPost = function () {
|
|
6487
6342
|
return this.startPost_;
|
|
@@ -6490,8 +6345,13 @@ var RangedFilter = /** @class */ (function () {
|
|
|
6490
6345
|
return this.endPost_;
|
|
6491
6346
|
};
|
|
6492
6347
|
RangedFilter.prototype.matches = function (node) {
|
|
6493
|
-
|
|
6494
|
-
this.index_.compare(
|
|
6348
|
+
var isWithinStart = this.startIsInclusive_
|
|
6349
|
+
? this.index_.compare(this.getStartPost(), node) <= 0
|
|
6350
|
+
: this.index_.compare(this.getStartPost(), node) < 0;
|
|
6351
|
+
var isWithinEnd = this.endIsInclusive_
|
|
6352
|
+
? this.index_.compare(node, this.getEndPost()) <= 0
|
|
6353
|
+
: this.index_.compare(node, this.getEndPost()) < 0;
|
|
6354
|
+
return isWithinStart && isWithinEnd;
|
|
6495
6355
|
};
|
|
6496
6356
|
RangedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) {
|
|
6497
6357
|
if (!this.matches(new NamedNode(key, newChild))) {
|
|
@@ -6570,10 +6430,27 @@ var RangedFilter = /** @class */ (function () {
|
|
|
6570
6430
|
*/
|
|
6571
6431
|
var LimitedFilter = /** @class */ (function () {
|
|
6572
6432
|
function LimitedFilter(params) {
|
|
6433
|
+
var _this = this;
|
|
6434
|
+
this.withinDirectionalStart = function (node) {
|
|
6435
|
+
return _this.reverse_ ? _this.withinEndPost(node) : _this.withinStartPost(node);
|
|
6436
|
+
};
|
|
6437
|
+
this.withinDirectionalEnd = function (node) {
|
|
6438
|
+
return _this.reverse_ ? _this.withinStartPost(node) : _this.withinEndPost(node);
|
|
6439
|
+
};
|
|
6440
|
+
this.withinStartPost = function (node) {
|
|
6441
|
+
var compareRes = _this.index_.compare(_this.rangedFilter_.getStartPost(), node);
|
|
6442
|
+
return _this.startIsInclusive_ ? compareRes <= 0 : compareRes < 0;
|
|
6443
|
+
};
|
|
6444
|
+
this.withinEndPost = function (node) {
|
|
6445
|
+
var compareRes = _this.index_.compare(node, _this.rangedFilter_.getEndPost());
|
|
6446
|
+
return _this.endIsInclusive_ ? compareRes <= 0 : compareRes < 0;
|
|
6447
|
+
};
|
|
6573
6448
|
this.rangedFilter_ = new RangedFilter(params);
|
|
6574
6449
|
this.index_ = params.getIndex();
|
|
6575
6450
|
this.limit_ = params.getLimit();
|
|
6576
6451
|
this.reverse_ = !params.isViewFromLeft();
|
|
6452
|
+
this.startIsInclusive_ = !params.startAfterSet_;
|
|
6453
|
+
this.endIsInclusive_ = !params.endBeforeSet_;
|
|
6577
6454
|
}
|
|
6578
6455
|
LimitedFilter.prototype.updateChild = function (snap, key, newChild, affectedPath, source, optChangeAccumulator) {
|
|
6579
6456
|
if (!this.rangedFilter_.matches(new NamedNode(key, newChild))) {
|
|
@@ -6614,23 +6491,18 @@ var LimitedFilter = /** @class */ (function () {
|
|
|
6614
6491
|
var count = 0;
|
|
6615
6492
|
while (iterator.hasNext() && count < this.limit_) {
|
|
6616
6493
|
var next = iterator.getNext();
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
this.index_.compare(this.rangedFilter_.getStartPost(), next) <= 0;
|
|
6494
|
+
if (!this.withinDirectionalStart(next)) {
|
|
6495
|
+
// if we have not reached the start, skip to the next element
|
|
6496
|
+
continue;
|
|
6621
6497
|
}
|
|
6622
|
-
else {
|
|
6623
|
-
|
|
6624
|
-
|
|
6498
|
+
else if (!this.withinDirectionalEnd(next)) {
|
|
6499
|
+
// if we have reached the end, stop adding elements
|
|
6500
|
+
break;
|
|
6625
6501
|
}
|
|
6626
|
-
|
|
6502
|
+
else {
|
|
6627
6503
|
filtered = filtered.updateImmediateChild(next.name, next.node);
|
|
6628
6504
|
count++;
|
|
6629
6505
|
}
|
|
6630
|
-
else {
|
|
6631
|
-
// if we have reached the end post, we cannot keep adding elemments
|
|
6632
|
-
break;
|
|
6633
|
-
}
|
|
6634
6506
|
}
|
|
6635
6507
|
}
|
|
6636
6508
|
else {
|
|
@@ -6638,32 +6510,19 @@ var LimitedFilter = /** @class */ (function () {
|
|
|
6638
6510
|
filtered = newSnap.withIndex(this.index_);
|
|
6639
6511
|
// Don't support priorities on queries
|
|
6640
6512
|
filtered = filtered.updatePriority(ChildrenNode.EMPTY_NODE);
|
|
6641
|
-
var startPost = void 0;
|
|
6642
|
-
var endPost = void 0;
|
|
6643
|
-
var cmp = void 0;
|
|
6644
6513
|
var iterator = void 0;
|
|
6645
6514
|
if (this.reverse_) {
|
|
6646
6515
|
iterator = filtered.getReverseIterator(this.index_);
|
|
6647
|
-
startPost = this.rangedFilter_.getEndPost();
|
|
6648
|
-
endPost = this.rangedFilter_.getStartPost();
|
|
6649
|
-
var indexCompare_1 = this.index_.getCompare();
|
|
6650
|
-
cmp = function (a, b) { return indexCompare_1(b, a); };
|
|
6651
6516
|
}
|
|
6652
6517
|
else {
|
|
6653
6518
|
iterator = filtered.getIterator(this.index_);
|
|
6654
|
-
startPost = this.rangedFilter_.getStartPost();
|
|
6655
|
-
endPost = this.rangedFilter_.getEndPost();
|
|
6656
|
-
cmp = this.index_.getCompare();
|
|
6657
6519
|
}
|
|
6658
6520
|
var count = 0;
|
|
6659
|
-
var foundStartPost = false;
|
|
6660
6521
|
while (iterator.hasNext()) {
|
|
6661
6522
|
var next = iterator.getNext();
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
}
|
|
6666
|
-
var inRange = foundStartPost && count < this.limit_ && cmp(next, endPost) <= 0;
|
|
6523
|
+
var inRange = count < this.limit_ &&
|
|
6524
|
+
this.withinDirectionalStart(next) &&
|
|
6525
|
+
this.withinDirectionalEnd(next);
|
|
6667
6526
|
if (inRange) {
|
|
6668
6527
|
count++;
|
|
6669
6528
|
}
|
|
@@ -6795,10 +6654,10 @@ var QueryParams = /** @class */ (function () {
|
|
|
6795
6654
|
this.limitSet_ = false;
|
|
6796
6655
|
this.startSet_ = false;
|
|
6797
6656
|
this.startNameSet_ = false;
|
|
6798
|
-
this.startAfterSet_ = false;
|
|
6657
|
+
this.startAfterSet_ = false; // can only be true if startSet_ is true
|
|
6799
6658
|
this.endSet_ = false;
|
|
6800
6659
|
this.endNameSet_ = false;
|
|
6801
|
-
this.endBeforeSet_ = false;
|
|
6660
|
+
this.endBeforeSet_ = false; // can only be true if endSet_ is true
|
|
6802
6661
|
this.limit_ = 0;
|
|
6803
6662
|
this.viewFrom_ = '';
|
|
6804
6663
|
this.indexStartValue_ = null;
|
|
@@ -6810,12 +6669,6 @@ var QueryParams = /** @class */ (function () {
|
|
|
6810
6669
|
QueryParams.prototype.hasStart = function () {
|
|
6811
6670
|
return this.startSet_;
|
|
6812
6671
|
};
|
|
6813
|
-
QueryParams.prototype.hasStartAfter = function () {
|
|
6814
|
-
return this.startAfterSet_;
|
|
6815
|
-
};
|
|
6816
|
-
QueryParams.prototype.hasEndBefore = function () {
|
|
6817
|
-
return this.endBeforeSet_;
|
|
6818
|
-
};
|
|
6819
6672
|
/**
|
|
6820
6673
|
* @returns True if it would return from left.
|
|
6821
6674
|
*/
|
|
@@ -6828,7 +6681,7 @@ var QueryParams = /** @class */ (function () {
|
|
|
6828
6681
|
return this.startSet_;
|
|
6829
6682
|
}
|
|
6830
6683
|
else {
|
|
6831
|
-
return this.viewFrom_ === "l" /* VIEW_FROM_LEFT */;
|
|
6684
|
+
return this.viewFrom_ === "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
6832
6685
|
}
|
|
6833
6686
|
};
|
|
6834
6687
|
/**
|
|
@@ -6904,10 +6757,12 @@ var QueryParams = /** @class */ (function () {
|
|
|
6904
6757
|
copy.limitSet_ = this.limitSet_;
|
|
6905
6758
|
copy.limit_ = this.limit_;
|
|
6906
6759
|
copy.startSet_ = this.startSet_;
|
|
6760
|
+
copy.startAfterSet_ = this.startAfterSet_;
|
|
6907
6761
|
copy.indexStartValue_ = this.indexStartValue_;
|
|
6908
6762
|
copy.startNameSet_ = this.startNameSet_;
|
|
6909
6763
|
copy.indexStartName_ = this.indexStartName_;
|
|
6910
6764
|
copy.endSet_ = this.endSet_;
|
|
6765
|
+
copy.endBeforeSet_ = this.endBeforeSet_;
|
|
6911
6766
|
copy.indexEndValue_ = this.indexEndValue_;
|
|
6912
6767
|
copy.endNameSet_ = this.endNameSet_;
|
|
6913
6768
|
copy.indexEndName_ = this.indexEndName_;
|
|
@@ -6932,14 +6787,14 @@ function queryParamsLimitToFirst(queryParams, newLimit) {
|
|
|
6932
6787
|
var newParams = queryParams.copy();
|
|
6933
6788
|
newParams.limitSet_ = true;
|
|
6934
6789
|
newParams.limit_ = newLimit;
|
|
6935
|
-
newParams.viewFrom_ = "l" /* VIEW_FROM_LEFT */;
|
|
6790
|
+
newParams.viewFrom_ = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
6936
6791
|
return newParams;
|
|
6937
6792
|
}
|
|
6938
6793
|
function queryParamsLimitToLast(queryParams, newLimit) {
|
|
6939
6794
|
var newParams = queryParams.copy();
|
|
6940
6795
|
newParams.limitSet_ = true;
|
|
6941
6796
|
newParams.limit_ = newLimit;
|
|
6942
|
-
newParams.viewFrom_ = "r" /* VIEW_FROM_RIGHT */;
|
|
6797
|
+
newParams.viewFrom_ = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
6943
6798
|
return newParams;
|
|
6944
6799
|
}
|
|
6945
6800
|
function queryParamsStartAt(queryParams, indexValue, key) {
|
|
@@ -6961,21 +6816,11 @@ function queryParamsStartAt(queryParams, indexValue, key) {
|
|
|
6961
6816
|
}
|
|
6962
6817
|
function queryParamsStartAfter(queryParams, indexValue, key) {
|
|
6963
6818
|
var params;
|
|
6964
|
-
if (queryParams.index_ === KEY_INDEX) {
|
|
6965
|
-
if (typeof indexValue === 'string') {
|
|
6966
|
-
indexValue = successor(indexValue);
|
|
6967
|
-
}
|
|
6819
|
+
if (queryParams.index_ === KEY_INDEX || !!key) {
|
|
6968
6820
|
params = queryParamsStartAt(queryParams, indexValue, key);
|
|
6969
6821
|
}
|
|
6970
6822
|
else {
|
|
6971
|
-
|
|
6972
|
-
if (key == null) {
|
|
6973
|
-
childKey = MAX_NAME;
|
|
6974
|
-
}
|
|
6975
|
-
else {
|
|
6976
|
-
childKey = successor(key);
|
|
6977
|
-
}
|
|
6978
|
-
params = queryParamsStartAt(queryParams, indexValue, childKey);
|
|
6823
|
+
params = queryParamsStartAt(queryParams, indexValue, MAX_NAME);
|
|
6979
6824
|
}
|
|
6980
6825
|
params.startAfterSet_ = true;
|
|
6981
6826
|
return params;
|
|
@@ -6998,22 +6843,12 @@ function queryParamsEndAt(queryParams, indexValue, key) {
|
|
|
6998
6843
|
return newParams;
|
|
6999
6844
|
}
|
|
7000
6845
|
function queryParamsEndBefore(queryParams, indexValue, key) {
|
|
7001
|
-
var childKey;
|
|
7002
6846
|
var params;
|
|
7003
|
-
if (queryParams.index_ === KEY_INDEX) {
|
|
7004
|
-
if (typeof indexValue === 'string') {
|
|
7005
|
-
indexValue = predecessor(indexValue);
|
|
7006
|
-
}
|
|
6847
|
+
if (queryParams.index_ === KEY_INDEX || !!key) {
|
|
7007
6848
|
params = queryParamsEndAt(queryParams, indexValue, key);
|
|
7008
6849
|
}
|
|
7009
6850
|
else {
|
|
7010
|
-
|
|
7011
|
-
childKey = MIN_NAME;
|
|
7012
|
-
}
|
|
7013
|
-
else {
|
|
7014
|
-
childKey = predecessor(key);
|
|
7015
|
-
}
|
|
7016
|
-
params = queryParamsEndAt(queryParams, indexValue, childKey);
|
|
6851
|
+
params = queryParamsEndAt(queryParams, indexValue, MIN_NAME);
|
|
7017
6852
|
}
|
|
7018
6853
|
params.endBeforeSet_ = true;
|
|
7019
6854
|
return params;
|
|
@@ -7035,39 +6870,43 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
7035
6870
|
}
|
|
7036
6871
|
var orderBy;
|
|
7037
6872
|
if (queryParams.index_ === PRIORITY_INDEX) {
|
|
7038
|
-
orderBy = "$priority" /* PRIORITY_INDEX */;
|
|
6873
|
+
orderBy = "$priority" /* REST_QUERY_CONSTANTS.PRIORITY_INDEX */;
|
|
7039
6874
|
}
|
|
7040
6875
|
else if (queryParams.index_ === VALUE_INDEX) {
|
|
7041
|
-
orderBy = "$value" /* VALUE_INDEX */;
|
|
6876
|
+
orderBy = "$value" /* REST_QUERY_CONSTANTS.VALUE_INDEX */;
|
|
7042
6877
|
}
|
|
7043
6878
|
else if (queryParams.index_ === KEY_INDEX) {
|
|
7044
|
-
orderBy = "$key" /* KEY_INDEX */;
|
|
6879
|
+
orderBy = "$key" /* REST_QUERY_CONSTANTS.KEY_INDEX */;
|
|
7045
6880
|
}
|
|
7046
6881
|
else {
|
|
7047
6882
|
assert(queryParams.index_ instanceof PathIndex, 'Unrecognized index type!');
|
|
7048
6883
|
orderBy = queryParams.index_.toString();
|
|
7049
6884
|
}
|
|
7050
|
-
qs["orderBy" /* ORDER_BY */] = stringify(orderBy);
|
|
6885
|
+
qs["orderBy" /* REST_QUERY_CONSTANTS.ORDER_BY */] = stringify(orderBy);
|
|
7051
6886
|
if (queryParams.startSet_) {
|
|
7052
|
-
|
|
6887
|
+
var startParam = queryParams.startAfterSet_
|
|
6888
|
+
? "startAfter" /* REST_QUERY_CONSTANTS.START_AFTER */
|
|
6889
|
+
: "startAt" /* REST_QUERY_CONSTANTS.START_AT */;
|
|
6890
|
+
qs[startParam] = stringify(queryParams.indexStartValue_);
|
|
7053
6891
|
if (queryParams.startNameSet_) {
|
|
7054
|
-
qs[
|
|
7055
|
-
',' + stringify(queryParams.indexStartName_);
|
|
6892
|
+
qs[startParam] += ',' + stringify(queryParams.indexStartName_);
|
|
7056
6893
|
}
|
|
7057
6894
|
}
|
|
7058
6895
|
if (queryParams.endSet_) {
|
|
7059
|
-
|
|
6896
|
+
var endParam = queryParams.endBeforeSet_
|
|
6897
|
+
? "endBefore" /* REST_QUERY_CONSTANTS.END_BEFORE */
|
|
6898
|
+
: "endAt" /* REST_QUERY_CONSTANTS.END_AT */;
|
|
6899
|
+
qs[endParam] = stringify(queryParams.indexEndValue_);
|
|
7060
6900
|
if (queryParams.endNameSet_) {
|
|
7061
|
-
qs[
|
|
7062
|
-
',' + stringify(queryParams.indexEndName_);
|
|
6901
|
+
qs[endParam] += ',' + stringify(queryParams.indexEndName_);
|
|
7063
6902
|
}
|
|
7064
6903
|
}
|
|
7065
6904
|
if (queryParams.limitSet_) {
|
|
7066
6905
|
if (queryParams.isViewFromLeft()) {
|
|
7067
|
-
qs["limitToFirst" /* LIMIT_TO_FIRST */] = queryParams.limit_;
|
|
6906
|
+
qs["limitToFirst" /* REST_QUERY_CONSTANTS.LIMIT_TO_FIRST */] = queryParams.limit_;
|
|
7068
6907
|
}
|
|
7069
6908
|
else {
|
|
7070
|
-
qs["limitToLast" /* LIMIT_TO_LAST */] = queryParams.limit_;
|
|
6909
|
+
qs["limitToLast" /* REST_QUERY_CONSTANTS.LIMIT_TO_LAST */] = queryParams.limit_;
|
|
7071
6910
|
}
|
|
7072
6911
|
}
|
|
7073
6912
|
return qs;
|
|
@@ -7075,35 +6914,39 @@ function queryParamsToRestQueryStringParameters(queryParams) {
|
|
|
7075
6914
|
function queryParamsGetQueryObject(queryParams) {
|
|
7076
6915
|
var obj = {};
|
|
7077
6916
|
if (queryParams.startSet_) {
|
|
7078
|
-
obj["sp" /* INDEX_START_VALUE */] =
|
|
6917
|
+
obj["sp" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_VALUE */] =
|
|
7079
6918
|
queryParams.indexStartValue_;
|
|
7080
6919
|
if (queryParams.startNameSet_) {
|
|
7081
|
-
obj["sn" /* INDEX_START_NAME */] =
|
|
6920
|
+
obj["sn" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_NAME */] =
|
|
7082
6921
|
queryParams.indexStartName_;
|
|
7083
6922
|
}
|
|
6923
|
+
obj["sin" /* WIRE_PROTOCOL_CONSTANTS.INDEX_START_IS_INCLUSIVE */] =
|
|
6924
|
+
!queryParams.startAfterSet_;
|
|
7084
6925
|
}
|
|
7085
6926
|
if (queryParams.endSet_) {
|
|
7086
|
-
obj["ep" /* INDEX_END_VALUE */] = queryParams.indexEndValue_;
|
|
6927
|
+
obj["ep" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_VALUE */] = queryParams.indexEndValue_;
|
|
7087
6928
|
if (queryParams.endNameSet_) {
|
|
7088
|
-
obj["en" /* INDEX_END_NAME */] = queryParams.indexEndName_;
|
|
6929
|
+
obj["en" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_NAME */] = queryParams.indexEndName_;
|
|
7089
6930
|
}
|
|
6931
|
+
obj["ein" /* WIRE_PROTOCOL_CONSTANTS.INDEX_END_IS_INCLUSIVE */] =
|
|
6932
|
+
!queryParams.endBeforeSet_;
|
|
7090
6933
|
}
|
|
7091
6934
|
if (queryParams.limitSet_) {
|
|
7092
|
-
obj["l" /* LIMIT */] = queryParams.limit_;
|
|
6935
|
+
obj["l" /* WIRE_PROTOCOL_CONSTANTS.LIMIT */] = queryParams.limit_;
|
|
7093
6936
|
var viewFrom = queryParams.viewFrom_;
|
|
7094
6937
|
if (viewFrom === '') {
|
|
7095
6938
|
if (queryParams.isViewFromLeft()) {
|
|
7096
|
-
viewFrom = "l" /* VIEW_FROM_LEFT */;
|
|
6939
|
+
viewFrom = "l" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_LEFT */;
|
|
7097
6940
|
}
|
|
7098
6941
|
else {
|
|
7099
|
-
viewFrom = "r" /* VIEW_FROM_RIGHT */;
|
|
6942
|
+
viewFrom = "r" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM_RIGHT */;
|
|
7100
6943
|
}
|
|
7101
6944
|
}
|
|
7102
|
-
obj["vf" /* VIEW_FROM */] = viewFrom;
|
|
6945
|
+
obj["vf" /* WIRE_PROTOCOL_CONSTANTS.VIEW_FROM */] = viewFrom;
|
|
7103
6946
|
}
|
|
7104
6947
|
// For now, priority index is the default, so we only specify if it's some other index
|
|
7105
6948
|
if (queryParams.index_ !== PRIORITY_INDEX) {
|
|
7106
|
-
obj["i" /* INDEX */] = queryParams.index_.toString();
|
|
6949
|
+
obj["i" /* WIRE_PROTOCOL_CONSTANTS.INDEX */] = queryParams.index_.toString();
|
|
7107
6950
|
}
|
|
7108
6951
|
return obj;
|
|
7109
6952
|
}
|
|
@@ -7865,16 +7708,16 @@ function eventGeneratorGenerateEventsForChanges(eventGenerator, changes, eventCa
|
|
|
7865
7708
|
var events = [];
|
|
7866
7709
|
var moves = [];
|
|
7867
7710
|
changes.forEach(function (change) {
|
|
7868
|
-
if (change.type === "child_changed" /* CHILD_CHANGED */ &&
|
|
7711
|
+
if (change.type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
7869
7712
|
eventGenerator.index_.indexedValueChanged(change.oldSnap, change.snapshotNode)) {
|
|
7870
7713
|
moves.push(changeChildMoved(change.childName, change.snapshotNode));
|
|
7871
7714
|
}
|
|
7872
7715
|
});
|
|
7873
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_removed" /* CHILD_REMOVED */, changes, eventRegistrations, eventCache);
|
|
7874
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_added" /* CHILD_ADDED */, changes, eventRegistrations, eventCache);
|
|
7875
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_moved" /* CHILD_MOVED */, moves, eventRegistrations, eventCache);
|
|
7876
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_changed" /* CHILD_CHANGED */, changes, eventRegistrations, eventCache);
|
|
7877
|
-
eventGeneratorGenerateEventsForType(eventGenerator, events, "value" /* VALUE */, changes, eventRegistrations, eventCache);
|
|
7716
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_removed" /* ChangeType.CHILD_REMOVED */, changes, eventRegistrations, eventCache);
|
|
7717
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_added" /* ChangeType.CHILD_ADDED */, changes, eventRegistrations, eventCache);
|
|
7718
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_moved" /* ChangeType.CHILD_MOVED */, moves, eventRegistrations, eventCache);
|
|
7719
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "child_changed" /* ChangeType.CHILD_CHANGED */, changes, eventRegistrations, eventCache);
|
|
7720
|
+
eventGeneratorGenerateEventsForType(eventGenerator, events, "value" /* ChangeType.VALUE */, changes, eventRegistrations, eventCache);
|
|
7878
7721
|
return events;
|
|
7879
7722
|
}
|
|
7880
7723
|
/**
|
|
@@ -8960,31 +8803,31 @@ var ChildChangeAccumulator = /** @class */ (function () {
|
|
|
8960
8803
|
ChildChangeAccumulator.prototype.trackChildChange = function (change) {
|
|
8961
8804
|
var type = change.type;
|
|
8962
8805
|
var childKey = change.childName;
|
|
8963
|
-
assert(type === "child_added" /* CHILD_ADDED */ ||
|
|
8964
|
-
type === "child_changed" /* CHILD_CHANGED */ ||
|
|
8965
|
-
type === "child_removed" /* CHILD_REMOVED */, 'Only child changes supported for tracking');
|
|
8806
|
+
assert(type === "child_added" /* ChangeType.CHILD_ADDED */ ||
|
|
8807
|
+
type === "child_changed" /* ChangeType.CHILD_CHANGED */ ||
|
|
8808
|
+
type === "child_removed" /* ChangeType.CHILD_REMOVED */, 'Only child changes supported for tracking');
|
|
8966
8809
|
assert(childKey !== '.priority', 'Only non-priority child changes can be tracked.');
|
|
8967
8810
|
var oldChange = this.changeMap.get(childKey);
|
|
8968
8811
|
if (oldChange) {
|
|
8969
8812
|
var oldType = oldChange.type;
|
|
8970
|
-
if (type === "child_added" /* CHILD_ADDED */ &&
|
|
8971
|
-
oldType === "child_removed" /* CHILD_REMOVED */) {
|
|
8813
|
+
if (type === "child_added" /* ChangeType.CHILD_ADDED */ &&
|
|
8814
|
+
oldType === "child_removed" /* ChangeType.CHILD_REMOVED */) {
|
|
8972
8815
|
this.changeMap.set(childKey, changeChildChanged(childKey, change.snapshotNode, oldChange.snapshotNode));
|
|
8973
8816
|
}
|
|
8974
|
-
else if (type === "child_removed" /* CHILD_REMOVED */ &&
|
|
8975
|
-
oldType === "child_added" /* CHILD_ADDED */) {
|
|
8817
|
+
else if (type === "child_removed" /* ChangeType.CHILD_REMOVED */ &&
|
|
8818
|
+
oldType === "child_added" /* ChangeType.CHILD_ADDED */) {
|
|
8976
8819
|
this.changeMap.delete(childKey);
|
|
8977
8820
|
}
|
|
8978
|
-
else if (type === "child_removed" /* CHILD_REMOVED */ &&
|
|
8979
|
-
oldType === "child_changed" /* CHILD_CHANGED */) {
|
|
8821
|
+
else if (type === "child_removed" /* ChangeType.CHILD_REMOVED */ &&
|
|
8822
|
+
oldType === "child_changed" /* ChangeType.CHILD_CHANGED */) {
|
|
8980
8823
|
this.changeMap.set(childKey, changeChildRemoved(childKey, oldChange.oldSnap));
|
|
8981
8824
|
}
|
|
8982
|
-
else if (type === "child_changed" /* CHILD_CHANGED */ &&
|
|
8983
|
-
oldType === "child_added" /* CHILD_ADDED */) {
|
|
8825
|
+
else if (type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
8826
|
+
oldType === "child_added" /* ChangeType.CHILD_ADDED */) {
|
|
8984
8827
|
this.changeMap.set(childKey, changeChildAdded(childKey, change.snapshotNode));
|
|
8985
8828
|
}
|
|
8986
|
-
else if (type === "child_changed" /* CHILD_CHANGED */ &&
|
|
8987
|
-
oldType === "child_changed" /* CHILD_CHANGED */) {
|
|
8829
|
+
else if (type === "child_changed" /* ChangeType.CHILD_CHANGED */ &&
|
|
8830
|
+
oldType === "child_changed" /* ChangeType.CHILD_CHANGED */) {
|
|
8988
8831
|
this.changeMap.set(childKey, changeChildChanged(childKey, change.snapshotNode, oldChange.oldSnap));
|
|
8989
8832
|
}
|
|
8990
8833
|
else {
|
|
@@ -11709,7 +11552,7 @@ function repoLog(repo) {
|
|
|
11709
11552
|
if (repo.persistentConnection_) {
|
|
11710
11553
|
prefix = repo.persistentConnection_.id + ':';
|
|
11711
11554
|
}
|
|
11712
|
-
log.apply(void 0, __spreadArray([prefix], __read(varArgs)));
|
|
11555
|
+
log.apply(void 0, __spreadArray([prefix], __read(varArgs), false));
|
|
11713
11556
|
}
|
|
11714
11557
|
function repoCallOnCompleteCallback(repo, callback, status, errorReason) {
|
|
11715
11558
|
if (callback) {
|
|
@@ -11783,7 +11626,7 @@ function repoStartTransaction(repo, path, transactionUpdate, onComplete, unwatch
|
|
|
11783
11626
|
else {
|
|
11784
11627
|
validateFirebaseData('transaction failed: Data returned ', newVal, transaction.path);
|
|
11785
11628
|
// Mark as run and add to our queue.
|
|
11786
|
-
transaction.status = 0 /* RUN */;
|
|
11629
|
+
transaction.status = 0 /* TransactionStatus.RUN */;
|
|
11787
11630
|
var queueNode = treeSubTree(repo.transactionQueueTree_, path);
|
|
11788
11631
|
var nodeQueue = treeGetValue(queueNode) || [];
|
|
11789
11632
|
nodeQueue.push(transaction);
|
|
@@ -11842,7 +11685,7 @@ function repoSendReadyTransactions(repo, node) {
|
|
|
11842
11685
|
if (treeGetValue(node)) {
|
|
11843
11686
|
var queue = repoBuildTransactionQueue(repo, node);
|
|
11844
11687
|
assert(queue.length > 0, 'Sending zero length transaction queue');
|
|
11845
|
-
var allRun = queue.every(function (transaction) { return transaction.status === 0 /* RUN */; });
|
|
11688
|
+
var allRun = queue.every(function (transaction) { return transaction.status === 0 /* TransactionStatus.RUN */; });
|
|
11846
11689
|
// If they're all run (and not sent), we can send them. Else, we must wait.
|
|
11847
11690
|
if (allRun) {
|
|
11848
11691
|
repoSendTransactionQueue(repo, treeGetPath(node), queue);
|
|
@@ -11871,8 +11714,8 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11871
11714
|
var latestHash = latestState.hash();
|
|
11872
11715
|
for (var i = 0; i < queue.length; i++) {
|
|
11873
11716
|
var txn = queue[i];
|
|
11874
|
-
assert(txn.status === 0 /* RUN */, 'tryToSendTransactionQueue_: items in queue should all be run.');
|
|
11875
|
-
txn.status = 1 /* SENT */;
|
|
11717
|
+
assert(txn.status === 0 /* TransactionStatus.RUN */, 'tryToSendTransactionQueue_: items in queue should all be run.');
|
|
11718
|
+
txn.status = 1 /* TransactionStatus.SENT */;
|
|
11876
11719
|
txn.retryCount++;
|
|
11877
11720
|
var relativePath = newRelativePath(path, txn.path);
|
|
11878
11721
|
// If we've gotten to this point, the output snapshot must be defined.
|
|
@@ -11893,7 +11736,7 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11893
11736
|
// transactions or sets.
|
|
11894
11737
|
var callbacks = [];
|
|
11895
11738
|
var _loop_1 = function (i) {
|
|
11896
|
-
queue[i].status = 2 /* COMPLETED */;
|
|
11739
|
+
queue[i].status = 2 /* TransactionStatus.COMPLETED */;
|
|
11897
11740
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, queue[i].currentWriteId));
|
|
11898
11741
|
if (queue[i].onComplete) {
|
|
11899
11742
|
// We never unset the output snapshot, and given that this
|
|
@@ -11921,18 +11764,18 @@ function repoSendTransactionQueue(repo, path, queue) {
|
|
|
11921
11764
|
// transactions are no longer sent. Update their status appropriately.
|
|
11922
11765
|
if (status === 'datastale') {
|
|
11923
11766
|
for (var i = 0; i < queue.length; i++) {
|
|
11924
|
-
if (queue[i].status === 3 /* SENT_NEEDS_ABORT */) {
|
|
11925
|
-
queue[i].status = 4 /* NEEDS_ABORT */;
|
|
11767
|
+
if (queue[i].status === 3 /* TransactionStatus.SENT_NEEDS_ABORT */) {
|
|
11768
|
+
queue[i].status = 4 /* TransactionStatus.NEEDS_ABORT */;
|
|
11926
11769
|
}
|
|
11927
11770
|
else {
|
|
11928
|
-
queue[i].status = 0 /* RUN */;
|
|
11771
|
+
queue[i].status = 0 /* TransactionStatus.RUN */;
|
|
11929
11772
|
}
|
|
11930
11773
|
}
|
|
11931
11774
|
}
|
|
11932
11775
|
else {
|
|
11933
11776
|
warn('transaction at ' + pathToSend.toString() + ' failed: ' + status);
|
|
11934
11777
|
for (var i = 0; i < queue.length; i++) {
|
|
11935
|
-
queue[i].status = 4 /* NEEDS_ABORT */;
|
|
11778
|
+
queue[i].status = 4 /* TransactionStatus.NEEDS_ABORT */;
|
|
11936
11779
|
queue[i].abortReason = status;
|
|
11937
11780
|
}
|
|
11938
11781
|
}
|
|
@@ -11976,7 +11819,7 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
11976
11819
|
var events = [];
|
|
11977
11820
|
// Ignore all of the sets we're going to re-run.
|
|
11978
11821
|
var txnsToRerun = queue.filter(function (q) {
|
|
11979
|
-
return q.status === 0 /* RUN */;
|
|
11822
|
+
return q.status === 0 /* TransactionStatus.RUN */;
|
|
11980
11823
|
});
|
|
11981
11824
|
var setsToIgnore = txnsToRerun.map(function (q) {
|
|
11982
11825
|
return q.currentWriteId;
|
|
@@ -11986,12 +11829,12 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
11986
11829
|
var relativePath = newRelativePath(path, transaction.path);
|
|
11987
11830
|
var abortTransaction = false, abortReason;
|
|
11988
11831
|
assert(relativePath !== null, 'rerunTransactionsUnderNode_: relativePath should not be null.');
|
|
11989
|
-
if (transaction.status === 4 /* NEEDS_ABORT */) {
|
|
11832
|
+
if (transaction.status === 4 /* TransactionStatus.NEEDS_ABORT */) {
|
|
11990
11833
|
abortTransaction = true;
|
|
11991
11834
|
abortReason = transaction.abortReason;
|
|
11992
11835
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, transaction.currentWriteId, true));
|
|
11993
11836
|
}
|
|
11994
|
-
else if (transaction.status === 0 /* RUN */) {
|
|
11837
|
+
else if (transaction.status === 0 /* TransactionStatus.RUN */) {
|
|
11995
11838
|
if (transaction.retryCount >= MAX_TRANSACTION_RETRIES) {
|
|
11996
11839
|
abortTransaction = true;
|
|
11997
11840
|
abortReason = 'maxretry';
|
|
@@ -12034,7 +11877,7 @@ function repoRerunTransactionQueue(repo, queue, path) {
|
|
|
12034
11877
|
events = [];
|
|
12035
11878
|
if (abortTransaction) {
|
|
12036
11879
|
// Abort.
|
|
12037
|
-
queue[i].status = 2 /* COMPLETED */;
|
|
11880
|
+
queue[i].status = 2 /* TransactionStatus.COMPLETED */;
|
|
12038
11881
|
// Removing a listener can trigger pruning which can muck with
|
|
12039
11882
|
// mergedData/visibleData (as it prunes data). So defer the unwatcher
|
|
12040
11883
|
// until we're done.
|
|
@@ -12122,7 +11965,7 @@ function repoPruneCompletedTransactionsBelowNode(repo, node) {
|
|
|
12122
11965
|
if (queue) {
|
|
12123
11966
|
var to = 0;
|
|
12124
11967
|
for (var from = 0; from < queue.length; from++) {
|
|
12125
|
-
if (queue[from].status !== 2 /* COMPLETED */) {
|
|
11968
|
+
if (queue[from].status !== 2 /* TransactionStatus.COMPLETED */) {
|
|
12126
11969
|
queue[to] = queue[from];
|
|
12127
11970
|
to++;
|
|
12128
11971
|
}
|
|
@@ -12170,16 +12013,16 @@ function repoAbortTransactionsOnNode(repo, node) {
|
|
|
12170
12013
|
var events = [];
|
|
12171
12014
|
var lastSent = -1;
|
|
12172
12015
|
for (var i = 0; i < queue.length; i++) {
|
|
12173
|
-
if (queue[i].status === 3 /* SENT_NEEDS_ABORT */) ;
|
|
12174
|
-
else if (queue[i].status === 1 /* SENT */) {
|
|
12016
|
+
if (queue[i].status === 3 /* TransactionStatus.SENT_NEEDS_ABORT */) ;
|
|
12017
|
+
else if (queue[i].status === 1 /* TransactionStatus.SENT */) {
|
|
12175
12018
|
assert(lastSent === i - 1, 'All SENT items should be at beginning of queue.');
|
|
12176
12019
|
lastSent = i;
|
|
12177
12020
|
// Mark transaction for abort when it comes back.
|
|
12178
|
-
queue[i].status = 3 /* SENT_NEEDS_ABORT */;
|
|
12021
|
+
queue[i].status = 3 /* TransactionStatus.SENT_NEEDS_ABORT */;
|
|
12179
12022
|
queue[i].abortReason = 'set';
|
|
12180
12023
|
}
|
|
12181
12024
|
else {
|
|
12182
|
-
assert(queue[i].status === 0 /* RUN */, 'Unexpected transaction status in abort');
|
|
12025
|
+
assert(queue[i].status === 0 /* TransactionStatus.RUN */, 'Unexpected transaction status in abort');
|
|
12183
12026
|
// We can abort it immediately.
|
|
12184
12027
|
queue[i].unwatcher();
|
|
12185
12028
|
events = events.concat(syncTreeAckUserWrite(repo.serverSyncTree_, queue[i].currentWriteId, true));
|
|
@@ -12255,7 +12098,7 @@ function decodeQuery(queryString) {
|
|
|
12255
12098
|
results[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]);
|
|
12256
12099
|
}
|
|
12257
12100
|
else {
|
|
12258
|
-
warn("Invalid query segment '"
|
|
12101
|
+
warn("Invalid query segment '".concat(segment, "' in query '").concat(queryString, "'"));
|
|
12259
12102
|
}
|
|
12260
12103
|
}
|
|
12261
12104
|
}
|
|
@@ -12360,6 +12203,81 @@ var parseDatabaseURL = function (dataURL) {
|
|
|
12360
12203
|
};
|
|
12361
12204
|
};
|
|
12362
12205
|
|
|
12206
|
+
/**
|
|
12207
|
+
* @license
|
|
12208
|
+
* Copyright 2017 Google LLC
|
|
12209
|
+
*
|
|
12210
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12211
|
+
* you may not use this file except in compliance with the License.
|
|
12212
|
+
* You may obtain a copy of the License at
|
|
12213
|
+
*
|
|
12214
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12215
|
+
*
|
|
12216
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12217
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12218
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12219
|
+
* See the License for the specific language governing permissions and
|
|
12220
|
+
* limitations under the License.
|
|
12221
|
+
*/
|
|
12222
|
+
// Modeled after base64 web-safe chars, but ordered by ASCII.
|
|
12223
|
+
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
12224
|
+
/**
|
|
12225
|
+
* Fancy ID generator that creates 20-character string identifiers with the
|
|
12226
|
+
* following properties:
|
|
12227
|
+
*
|
|
12228
|
+
* 1. They're based on timestamp so that they sort *after* any existing ids.
|
|
12229
|
+
* 2. They contain 72-bits of random data after the timestamp so that IDs won't
|
|
12230
|
+
* collide with other clients' IDs.
|
|
12231
|
+
* 3. They sort *lexicographically* (so the timestamp is converted to characters
|
|
12232
|
+
* that will sort properly).
|
|
12233
|
+
* 4. They're monotonically increasing. Even if you generate more than one in
|
|
12234
|
+
* the same timestamp, the latter ones will sort after the former ones. We do
|
|
12235
|
+
* this by using the previous random bits but "incrementing" them by 1 (only
|
|
12236
|
+
* in the case of a timestamp collision).
|
|
12237
|
+
*/
|
|
12238
|
+
var nextPushId = (function () {
|
|
12239
|
+
// Timestamp of last push, used to prevent local collisions if you push twice
|
|
12240
|
+
// in one ms.
|
|
12241
|
+
var lastPushTime = 0;
|
|
12242
|
+
// We generate 72-bits of randomness which get turned into 12 characters and
|
|
12243
|
+
// appended to the timestamp to prevent collisions with other clients. We
|
|
12244
|
+
// store the last characters we generated because in the event of a collision,
|
|
12245
|
+
// we'll use those same characters except "incremented" by one.
|
|
12246
|
+
var lastRandChars = [];
|
|
12247
|
+
return function (now) {
|
|
12248
|
+
var duplicateTime = now === lastPushTime;
|
|
12249
|
+
lastPushTime = now;
|
|
12250
|
+
var i;
|
|
12251
|
+
var timeStampChars = new Array(8);
|
|
12252
|
+
for (i = 7; i >= 0; i--) {
|
|
12253
|
+
timeStampChars[i] = PUSH_CHARS.charAt(now % 64);
|
|
12254
|
+
// NOTE: Can't use << here because javascript will convert to int and lose
|
|
12255
|
+
// the upper bits.
|
|
12256
|
+
now = Math.floor(now / 64);
|
|
12257
|
+
}
|
|
12258
|
+
assert(now === 0, 'Cannot push at time == 0');
|
|
12259
|
+
var id = timeStampChars.join('');
|
|
12260
|
+
if (!duplicateTime) {
|
|
12261
|
+
for (i = 0; i < 12; i++) {
|
|
12262
|
+
lastRandChars[i] = Math.floor(Math.random() * 64);
|
|
12263
|
+
}
|
|
12264
|
+
}
|
|
12265
|
+
else {
|
|
12266
|
+
// If the timestamp hasn't changed since last push, use the same random
|
|
12267
|
+
// number, except incremented by 1.
|
|
12268
|
+
for (i = 11; i >= 0 && lastRandChars[i] === 63; i--) {
|
|
12269
|
+
lastRandChars[i] = 0;
|
|
12270
|
+
}
|
|
12271
|
+
lastRandChars[i]++;
|
|
12272
|
+
}
|
|
12273
|
+
for (i = 0; i < 12; i++) {
|
|
12274
|
+
id += PUSH_CHARS.charAt(lastRandChars[i]);
|
|
12275
|
+
}
|
|
12276
|
+
assert(id.length === 20, 'nextPushId: Length should be 20.');
|
|
12277
|
+
return id;
|
|
12278
|
+
};
|
|
12279
|
+
})();
|
|
12280
|
+
|
|
12363
12281
|
/**
|
|
12364
12282
|
* @license
|
|
12365
12283
|
* Copyright 2017 Google LLC
|
|
@@ -13997,7 +13915,7 @@ var useRestClient = false;
|
|
|
13997
13915
|
* Update an existing `Repo` in place to point to a new host/port.
|
|
13998
13916
|
*/
|
|
13999
13917
|
function repoManagerApplyEmulatorSettings(repo, host, port, tokenProvider) {
|
|
14000
|
-
repo.repoInfo_ = new RepoInfo(host
|
|
13918
|
+
repo.repoInfo_ = new RepoInfo("".concat(host, ":").concat(port),
|
|
14001
13919
|
/* secure= */ false, repo.repoInfo_.namespace, repo.repoInfo_.webSocketOnly, repo.repoInfo_.nodeAdmin, repo.repoInfo_.persistenceKey, repo.repoInfo_.includeNamespaceInQueryParams);
|
|
14002
13920
|
if (tokenProvider) {
|
|
14003
13921
|
repo.authTokenProvider_ = tokenProvider;
|
|
@@ -14015,7 +13933,7 @@ function repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, no
|
|
|
14015
13933
|
' a Project ID when calling firebase.initializeApp().');
|
|
14016
13934
|
}
|
|
14017
13935
|
log('Using default host for project ', app.options.projectId);
|
|
14018
|
-
dbUrl = app.options.projectId
|
|
13936
|
+
dbUrl = "".concat(app.options.projectId, "-default-rtdb.firebaseio.com");
|
|
14019
13937
|
}
|
|
14020
13938
|
var parsedUrl = parseRepoInfo(dbUrl, nodeAdmin);
|
|
14021
13939
|
var repoInfo = parsedUrl.repoInfo;
|
|
@@ -14026,7 +13944,7 @@ function repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, no
|
|
|
14026
13944
|
}
|
|
14027
13945
|
if (dbEmulatorHost) {
|
|
14028
13946
|
isEmulator = true;
|
|
14029
|
-
dbUrl = "http://"
|
|
13947
|
+
dbUrl = "http://".concat(dbEmulatorHost, "?ns=").concat(repoInfo.namespace);
|
|
14030
13948
|
parsedUrl = parseRepoInfo(dbUrl, nodeAdmin);
|
|
14031
13949
|
repoInfo = parsedUrl.repoInfo;
|
|
14032
13950
|
}
|
|
@@ -14052,7 +13970,7 @@ function repoManagerDeleteRepo(repo, appName) {
|
|
|
14052
13970
|
var appRepos = repos[appName];
|
|
14053
13971
|
// This should never happen...
|
|
14054
13972
|
if (!appRepos || appRepos[repo.key] !== repo) {
|
|
14055
|
-
fatal("Database "
|
|
13973
|
+
fatal("Database ".concat(appName, "(").concat(repo.repoInfo_, ") has already been deleted."));
|
|
14056
13974
|
}
|
|
14057
13975
|
repoInterrupt(repo);
|
|
14058
13976
|
delete appRepos[repo.key];
|
|
@@ -14174,7 +14092,7 @@ function getDatabase(app, url) {
|
|
|
14174
14092
|
});
|
|
14175
14093
|
var emulator = getDefaultEmulatorHostnameAndPort('database');
|
|
14176
14094
|
if (emulator) {
|
|
14177
|
-
connectDatabaseEmulator.apply(void 0, __spreadArray([db], __read(emulator)));
|
|
14095
|
+
connectDatabaseEmulator.apply(void 0, __spreadArray([db], __read(emulator), false));
|
|
14178
14096
|
}
|
|
14179
14097
|
return db;
|
|
14180
14098
|
}
|
|
@@ -14283,7 +14201,7 @@ function registerDatabase(variant) {
|
|
|
14283
14201
|
var authProvider = container.getProvider('auth-internal');
|
|
14284
14202
|
var appCheckProvider = container.getProvider('app-check-internal');
|
|
14285
14203
|
return repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url);
|
|
14286
|
-
}, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
|
|
14204
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true));
|
|
14287
14205
|
registerVersion(name, version, variant);
|
|
14288
14206
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
14289
14207
|
registerVersion(name, version, 'esm5');
|