@firebase/database-compat 2.0.2-canary.59ae45e48 → 2.0.2-canary.721e5a7e9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.standalone.js +57 -34
- package/dist/index.standalone.js.map +1 -1
- package/dist/node-esm/index.js +1 -1
- package/package.json +7 -7
package/dist/index.esm2017.js
CHANGED
@@ -5,7 +5,7 @@ import { errorPrefix, validateArgCount, validateCallback, validateContextObject,
|
|
5
5
|
import { Logger } from '@firebase/logger';
|
6
6
|
|
7
7
|
const name = "@firebase/database-compat";
|
8
|
-
const version = "2.0.2-canary.
|
8
|
+
const version = "2.0.2-canary.721e5a7e9";
|
9
9
|
|
10
10
|
/**
|
11
11
|
* @license
|
package/dist/index.js
CHANGED
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
11
11
|
var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
|
12
12
|
|
13
13
|
const name = "@firebase/database-compat";
|
14
|
-
const version = "2.0.2-canary.
|
14
|
+
const version = "2.0.2-canary.721e5a7e9";
|
15
15
|
|
16
16
|
/**
|
17
17
|
* @license
|
package/dist/index.standalone.js
CHANGED
@@ -8,12 +8,11 @@ var require$$1 = require('events');
|
|
8
8
|
var require$$0$1 = require('stream');
|
9
9
|
var require$$1$1 = require('crypto');
|
10
10
|
var require$$2$1 = require('url');
|
11
|
-
var require$$0$2 = require('assert');
|
12
11
|
var require$$1$2 = require('net');
|
13
12
|
var require$$2$2 = require('tls');
|
14
13
|
var require$$2$3 = require('@firebase/util');
|
15
14
|
var require$$1$3 = require('@firebase/logger');
|
16
|
-
var require$$0$
|
15
|
+
var require$$0$2 = require('@firebase/component');
|
17
16
|
|
18
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
19
18
|
|
@@ -23,12 +22,11 @@ var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
23
22
|
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
24
23
|
var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
25
24
|
var require$$2__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$2$1);
|
26
|
-
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
27
25
|
var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
|
28
26
|
var require$$2__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$2$2);
|
29
27
|
var require$$2__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$2$3);
|
30
28
|
var require$$1__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$1$3);
|
31
|
-
var require$$0__default$
|
29
|
+
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
32
30
|
|
33
31
|
function getAugmentedNamespace(n) {
|
34
32
|
if (n.__esModule) return n;
|
@@ -562,17 +560,20 @@ var base = Base$7;
|
|
562
560
|
var httpParser = {};
|
563
561
|
|
564
562
|
/*jshint node:true */
|
565
|
-
var assert = require$$0__default$2["default"];
|
566
|
-
|
567
563
|
httpParser.HTTPParser = HTTPParser;
|
568
564
|
function HTTPParser(type) {
|
569
|
-
|
565
|
+
if (type !== undefined && type !== HTTPParser.REQUEST && type !== HTTPParser.RESPONSE) {
|
566
|
+
throw new Error('type must be REQUEST or RESPONSE');
|
567
|
+
}
|
570
568
|
if (type === undefined) ; else {
|
571
569
|
this.initialize(type);
|
572
570
|
}
|
571
|
+
this.maxHeaderSize=HTTPParser.maxHeaderSize;
|
573
572
|
}
|
574
573
|
HTTPParser.prototype.initialize = function (type, async_resource) {
|
575
|
-
|
574
|
+
if (type !== HTTPParser.REQUEST && type !== HTTPParser.RESPONSE) {
|
575
|
+
throw new Error('type must be REQUEST or RESPONSE');
|
576
|
+
}
|
576
577
|
this.type = type;
|
577
578
|
this.state = type + '_LINE';
|
578
579
|
this.info = {
|
@@ -649,13 +650,15 @@ var methods = httpParser.methods = HTTPParser.methods = [
|
|
649
650
|
'PURGE',
|
650
651
|
'MKCALENDAR',
|
651
652
|
'LINK',
|
652
|
-
'UNLINK'
|
653
|
+
'UNLINK',
|
654
|
+
'SOURCE',
|
653
655
|
];
|
654
656
|
var method_connect = methods.indexOf('CONNECT');
|
655
657
|
HTTPParser.prototype.reinitialize = HTTPParser;
|
656
658
|
HTTPParser.prototype.close =
|
657
659
|
HTTPParser.prototype.pause =
|
658
660
|
HTTPParser.prototype.resume =
|
661
|
+
HTTPParser.prototype.remove =
|
659
662
|
HTTPParser.prototype.free = function () {};
|
660
663
|
HTTPParser.prototype._compatMode0_11 = false;
|
661
664
|
HTTPParser.prototype.getAsyncId = function() { return 0; };
|
@@ -695,7 +698,7 @@ HTTPParser.prototype.execute = function (chunk, start, length) {
|
|
695
698
|
length = this.offset - start;
|
696
699
|
if (headerState[this.state]) {
|
697
700
|
this.headerSize += length;
|
698
|
-
if (this.headerSize > HTTPParser.maxHeaderSize) {
|
701
|
+
if (this.headerSize > (this.maxHeaderSize||HTTPParser.maxHeaderSize)) {
|
699
702
|
return new Error('max header size exceeded');
|
700
703
|
}
|
701
704
|
}
|
@@ -950,7 +953,8 @@ HTTPParser.prototype.BODY_CHUNKHEAD = function () {
|
|
950
953
|
|
951
954
|
HTTPParser.prototype.BODY_CHUNK = function () {
|
952
955
|
var length = Math.min(this.end - this.offset, this.body_bytes);
|
953
|
-
|
956
|
+
// 0, length are for backwards compatibility. See: https://github.com/creationix/http-parser-js/pull/98
|
957
|
+
this.userCall()(this[kOnBody](this.chunk.slice(this.offset, this.offset + length), 0, length));
|
954
958
|
this.offset += length;
|
955
959
|
this.body_bytes -= length;
|
956
960
|
if (!this.body_bytes) {
|
@@ -963,7 +967,9 @@ HTTPParser.prototype.BODY_CHUNKEMPTYLINE = function () {
|
|
963
967
|
if (line === undefined) {
|
964
968
|
return;
|
965
969
|
}
|
966
|
-
|
970
|
+
if (line !== '') {
|
971
|
+
throw new Error('Expected empty line');
|
972
|
+
}
|
967
973
|
this.state = 'BODY_CHUNKHEAD';
|
968
974
|
};
|
969
975
|
|
@@ -983,14 +989,15 @@ HTTPParser.prototype.BODY_CHUNKTRAILERS = function () {
|
|
983
989
|
};
|
984
990
|
|
985
991
|
HTTPParser.prototype.BODY_RAW = function () {
|
986
|
-
|
987
|
-
this.userCall()(this[kOnBody](this.chunk, this.
|
992
|
+
// 0, length are for backwards compatibility. See: https://github.com/creationix/http-parser-js/pull/98
|
993
|
+
this.userCall()(this[kOnBody](this.chunk.slice(this.offset, this.end), 0, this.end - this.offset));
|
988
994
|
this.offset = this.end;
|
989
995
|
};
|
990
996
|
|
991
997
|
HTTPParser.prototype.BODY_SIZED = function () {
|
992
998
|
var length = Math.min(this.end - this.offset, this.body_bytes);
|
993
|
-
|
999
|
+
// 0, length are for backwards compatibility. See: https://github.com/creationix/http-parser-js/pull/98
|
1000
|
+
this.userCall()(this[kOnBody](this.chunk.slice(this.offset, this.offset + length), 0, length));
|
994
1001
|
this.offset += length;
|
995
1002
|
this.body_bytes -= length;
|
996
1003
|
if (!this.body_bytes) {
|
@@ -3651,7 +3658,7 @@ var require$$3 = /*@__PURE__*/getAugmentedNamespace(build);
|
|
3651
3658
|
|
3652
3659
|
Object.defineProperty(exports, '__esModule', { value: true });
|
3653
3660
|
|
3654
|
-
var component = require$$0__default$
|
3661
|
+
var component = require$$0__default$2["default"];
|
3655
3662
|
var logger$1 = require$$1__default$3["default"];
|
3656
3663
|
var util = require$$2__default$3["default"];
|
3657
3664
|
var idb = require$$3;
|
@@ -3710,7 +3717,7 @@ function isVersionServiceProvider(provider) {
|
|
3710
3717
|
}
|
3711
3718
|
|
3712
3719
|
const name$q = "@firebase/app";
|
3713
|
-
const version$1 = "0.10.18-canary.
|
3720
|
+
const version$1 = "0.10.18-canary.721e5a7e9";
|
3714
3721
|
|
3715
3722
|
/**
|
3716
3723
|
* @license
|
@@ -3781,7 +3788,7 @@ const name$2 = "@firebase/vertexai";
|
|
3781
3788
|
const name$1 = "@firebase/firestore-compat";
|
3782
3789
|
|
3783
3790
|
const name = "firebase";
|
3784
|
-
const version = "11.2.0-canary.
|
3791
|
+
const version = "11.2.0-canary.721e5a7e9";
|
3785
3792
|
|
3786
3793
|
/**
|
3787
3794
|
* @license
|
@@ -4562,8 +4569,7 @@ function computeKey(app) {
|
|
4562
4569
|
* limitations under the License.
|
4563
4570
|
*/
|
4564
4571
|
const MAX_HEADER_BYTES = 1024;
|
4565
|
-
|
4566
|
-
const STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;
|
4572
|
+
const MAX_NUM_STORED_HEARTBEATS = 30;
|
4567
4573
|
class HeartbeatServiceImpl {
|
4568
4574
|
constructor(container) {
|
4569
4575
|
this.container = container;
|
@@ -4617,14 +4623,13 @@ class HeartbeatServiceImpl {
|
|
4617
4623
|
else {
|
4618
4624
|
// There is no entry for this date. Create one.
|
4619
4625
|
this._heartbeatsCache.heartbeats.push({ date, agent });
|
4626
|
+
// If the number of stored heartbeats exceeds the maximum number of stored heartbeats, remove the heartbeat with the earliest date.
|
4627
|
+
// Since this is executed each time a heartbeat is pushed, the limit can only be exceeded by one, so only one needs to be removed.
|
4628
|
+
if (this._heartbeatsCache.heartbeats.length > MAX_NUM_STORED_HEARTBEATS) {
|
4629
|
+
const earliestHeartbeatIdx = getEarliestHeartbeatIdx(this._heartbeatsCache.heartbeats);
|
4630
|
+
this._heartbeatsCache.heartbeats.splice(earliestHeartbeatIdx, 1);
|
4631
|
+
}
|
4620
4632
|
}
|
4621
|
-
// Remove entries older than 30 days.
|
4622
|
-
this._heartbeatsCache.heartbeats =
|
4623
|
-
this._heartbeatsCache.heartbeats.filter(singleDateHeartbeat => {
|
4624
|
-
const hbTimestamp = new Date(singleDateHeartbeat.date).valueOf();
|
4625
|
-
const now = Date.now();
|
4626
|
-
return now - hbTimestamp <= STORED_HEARTBEAT_RETENTION_MAX_MILLIS;
|
4627
|
-
});
|
4628
4633
|
return this._storage.overwrite(this._heartbeatsCache);
|
4629
4634
|
}
|
4630
4635
|
catch (e) {
|
@@ -4799,6 +4804,24 @@ function countBytes(heartbeatsCache) {
|
|
4799
4804
|
// heartbeatsCache wrapper properties
|
4800
4805
|
JSON.stringify({ version: 2, heartbeats: heartbeatsCache })).length;
|
4801
4806
|
}
|
4807
|
+
/**
|
4808
|
+
* Returns the index of the heartbeat with the earliest date.
|
4809
|
+
* If the heartbeats array is empty, -1 is returned.
|
4810
|
+
*/
|
4811
|
+
function getEarliestHeartbeatIdx(heartbeats) {
|
4812
|
+
if (heartbeats.length === 0) {
|
4813
|
+
return -1;
|
4814
|
+
}
|
4815
|
+
let earliestHeartbeatIdx = 0;
|
4816
|
+
let earliestHeartbeatDate = heartbeats[0].date;
|
4817
|
+
for (let i = 1; i < heartbeats.length; i++) {
|
4818
|
+
if (heartbeats[i].date < earliestHeartbeatDate) {
|
4819
|
+
earliestHeartbeatDate = heartbeats[i].date;
|
4820
|
+
earliestHeartbeatIdx = i;
|
4821
|
+
}
|
4822
|
+
}
|
4823
|
+
return earliestHeartbeatIdx;
|
4824
|
+
}
|
4802
4825
|
|
4803
4826
|
/**
|
4804
4827
|
* @license
|
@@ -4869,7 +4892,7 @@ var Websocket = websocket;
|
|
4869
4892
|
var util = require$$2__default$3["default"];
|
4870
4893
|
var logger$1 = require$$1__default$3["default"];
|
4871
4894
|
var app = index_cjs;
|
4872
|
-
var component = require$$0__default$
|
4895
|
+
var component = require$$0__default$2["default"];
|
4873
4896
|
|
4874
4897
|
function _interopDefaultLegacy$1 (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
4875
4898
|
|
@@ -8613,7 +8636,7 @@ class PersistentConnection extends ServerActions {
|
|
8613
8636
|
}
|
8614
8637
|
this.lastConnectionEstablishedTime_ = null;
|
8615
8638
|
}
|
8616
|
-
const timeSinceLastConnectAttempt = new Date().getTime() - this.lastConnectionAttemptTime_;
|
8639
|
+
const timeSinceLastConnectAttempt = Math.max(0, new Date().getTime() - this.lastConnectionAttemptTime_);
|
8617
8640
|
let reconnectDelay = Math.max(0, this.reconnectDelay_ - timeSinceLastConnectAttempt);
|
8618
8641
|
reconnectDelay = Math.random() * reconnectDelay;
|
8619
8642
|
this.log_('Trying to reconnect in ' + reconnectDelay + 'ms');
|
@@ -19657,17 +19680,17 @@ Database.ServerValue = {
|
|
19657
19680
|
*/
|
19658
19681
|
function initStandalone$1({ app, url, version, customAuthImpl, customAppCheckImpl, namespace, nodeAdmin = false }) {
|
19659
19682
|
_setSDKVersion(version);
|
19660
|
-
const container = new require$$0$
|
19683
|
+
const container = new require$$0$2.ComponentContainer('database-standalone');
|
19661
19684
|
/**
|
19662
19685
|
* ComponentContainer('database-standalone') is just a placeholder that doesn't perform
|
19663
19686
|
* any actual function.
|
19664
19687
|
*/
|
19665
|
-
const authProvider = new require$$0$
|
19666
|
-
authProvider.setComponent(new require$$0$
|
19688
|
+
const authProvider = new require$$0$2.Provider('auth-internal', container);
|
19689
|
+
authProvider.setComponent(new require$$0$2.Component('auth-internal', () => customAuthImpl, "PRIVATE" /* ComponentType.PRIVATE */));
|
19667
19690
|
let appCheckProvider = undefined;
|
19668
19691
|
if (customAppCheckImpl) {
|
19669
|
-
appCheckProvider = new require$$0$
|
19670
|
-
appCheckProvider.setComponent(new require$$0$
|
19692
|
+
appCheckProvider = new require$$0$2.Provider('app-check-internal', container);
|
19693
|
+
appCheckProvider.setComponent(new require$$0$2.Component('app-check-internal', () => customAppCheckImpl, "PRIVATE" /* ComponentType.PRIVATE */));
|
19671
19694
|
}
|
19672
19695
|
return {
|
19673
19696
|
instance: new Database(_repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, nodeAdmin), app),
|