@firebase/database-compat 2.0.2-canary.9d88e3a85 → 2.0.2-canary.d75102f84
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 +34 -57
- 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.d75102f84";
|
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.d75102f84";
|
15
15
|
|
16
16
|
/**
|
17
17
|
* @license
|
package/dist/index.standalone.js
CHANGED
@@ -8,11 +8,12 @@ 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');
|
11
12
|
var require$$1$2 = require('net');
|
12
13
|
var require$$2$2 = require('tls');
|
13
14
|
var require$$2$3 = require('@firebase/util');
|
14
15
|
var require$$1$3 = require('@firebase/logger');
|
15
|
-
var require$$0$
|
16
|
+
var require$$0$3 = require('@firebase/component');
|
16
17
|
|
17
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
18
19
|
|
@@ -22,11 +23,12 @@ var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
22
23
|
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
23
24
|
var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
24
25
|
var require$$2__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$2$1);
|
26
|
+
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
25
27
|
var require$$1__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$1$2);
|
26
28
|
var require$$2__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$2$2);
|
27
29
|
var require$$2__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$2$3);
|
28
30
|
var require$$1__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$1$3);
|
29
|
-
var require$$0__default$
|
31
|
+
var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
|
30
32
|
|
31
33
|
function getAugmentedNamespace(n) {
|
32
34
|
if (n.__esModule) return n;
|
@@ -560,20 +562,17 @@ var base = Base$7;
|
|
560
562
|
var httpParser = {};
|
561
563
|
|
562
564
|
/*jshint node:true */
|
565
|
+
var assert = require$$0__default$2["default"];
|
566
|
+
|
563
567
|
httpParser.HTTPParser = HTTPParser;
|
564
568
|
function HTTPParser(type) {
|
565
|
-
|
566
|
-
throw new Error('type must be REQUEST or RESPONSE');
|
567
|
-
}
|
569
|
+
assert.ok(type === HTTPParser.REQUEST || type === HTTPParser.RESPONSE || type === undefined);
|
568
570
|
if (type === undefined) ; else {
|
569
571
|
this.initialize(type);
|
570
572
|
}
|
571
|
-
this.maxHeaderSize=HTTPParser.maxHeaderSize;
|
572
573
|
}
|
573
574
|
HTTPParser.prototype.initialize = function (type, async_resource) {
|
574
|
-
|
575
|
-
throw new Error('type must be REQUEST or RESPONSE');
|
576
|
-
}
|
575
|
+
assert.ok(type === HTTPParser.REQUEST || type === HTTPParser.RESPONSE);
|
577
576
|
this.type = type;
|
578
577
|
this.state = type + '_LINE';
|
579
578
|
this.info = {
|
@@ -650,15 +649,13 @@ var methods = httpParser.methods = HTTPParser.methods = [
|
|
650
649
|
'PURGE',
|
651
650
|
'MKCALENDAR',
|
652
651
|
'LINK',
|
653
|
-
'UNLINK'
|
654
|
-
'SOURCE',
|
652
|
+
'UNLINK'
|
655
653
|
];
|
656
654
|
var method_connect = methods.indexOf('CONNECT');
|
657
655
|
HTTPParser.prototype.reinitialize = HTTPParser;
|
658
656
|
HTTPParser.prototype.close =
|
659
657
|
HTTPParser.prototype.pause =
|
660
658
|
HTTPParser.prototype.resume =
|
661
|
-
HTTPParser.prototype.remove =
|
662
659
|
HTTPParser.prototype.free = function () {};
|
663
660
|
HTTPParser.prototype._compatMode0_11 = false;
|
664
661
|
HTTPParser.prototype.getAsyncId = function() { return 0; };
|
@@ -698,7 +695,7 @@ HTTPParser.prototype.execute = function (chunk, start, length) {
|
|
698
695
|
length = this.offset - start;
|
699
696
|
if (headerState[this.state]) {
|
700
697
|
this.headerSize += length;
|
701
|
-
if (this.headerSize >
|
698
|
+
if (this.headerSize > HTTPParser.maxHeaderSize) {
|
702
699
|
return new Error('max header size exceeded');
|
703
700
|
}
|
704
701
|
}
|
@@ -953,8 +950,7 @@ HTTPParser.prototype.BODY_CHUNKHEAD = function () {
|
|
953
950
|
|
954
951
|
HTTPParser.prototype.BODY_CHUNK = function () {
|
955
952
|
var length = Math.min(this.end - this.offset, this.body_bytes);
|
956
|
-
|
957
|
-
this.userCall()(this[kOnBody](this.chunk.slice(this.offset, this.offset + length), 0, length));
|
953
|
+
this.userCall()(this[kOnBody](this.chunk, this.offset, length));
|
958
954
|
this.offset += length;
|
959
955
|
this.body_bytes -= length;
|
960
956
|
if (!this.body_bytes) {
|
@@ -967,9 +963,7 @@ HTTPParser.prototype.BODY_CHUNKEMPTYLINE = function () {
|
|
967
963
|
if (line === undefined) {
|
968
964
|
return;
|
969
965
|
}
|
970
|
-
|
971
|
-
throw new Error('Expected empty line');
|
972
|
-
}
|
966
|
+
assert.equal(line, '');
|
973
967
|
this.state = 'BODY_CHUNKHEAD';
|
974
968
|
};
|
975
969
|
|
@@ -989,15 +983,14 @@ HTTPParser.prototype.BODY_CHUNKTRAILERS = function () {
|
|
989
983
|
};
|
990
984
|
|
991
985
|
HTTPParser.prototype.BODY_RAW = function () {
|
992
|
-
|
993
|
-
this.userCall()(this[kOnBody](this.chunk
|
986
|
+
var length = this.end - this.offset;
|
987
|
+
this.userCall()(this[kOnBody](this.chunk, this.offset, length));
|
994
988
|
this.offset = this.end;
|
995
989
|
};
|
996
990
|
|
997
991
|
HTTPParser.prototype.BODY_SIZED = function () {
|
998
992
|
var length = Math.min(this.end - this.offset, this.body_bytes);
|
999
|
-
|
1000
|
-
this.userCall()(this[kOnBody](this.chunk.slice(this.offset, this.offset + length), 0, length));
|
993
|
+
this.userCall()(this[kOnBody](this.chunk, this.offset, length));
|
1001
994
|
this.offset += length;
|
1002
995
|
this.body_bytes -= length;
|
1003
996
|
if (!this.body_bytes) {
|
@@ -3658,7 +3651,7 @@ var require$$3 = /*@__PURE__*/getAugmentedNamespace(build);
|
|
3658
3651
|
|
3659
3652
|
Object.defineProperty(exports, '__esModule', { value: true });
|
3660
3653
|
|
3661
|
-
var component = require$$0__default$
|
3654
|
+
var component = require$$0__default$3["default"];
|
3662
3655
|
var logger$1 = require$$1__default$3["default"];
|
3663
3656
|
var util = require$$2__default$3["default"];
|
3664
3657
|
var idb = require$$3;
|
@@ -3717,7 +3710,7 @@ function isVersionServiceProvider(provider) {
|
|
3717
3710
|
}
|
3718
3711
|
|
3719
3712
|
const name$q = "@firebase/app";
|
3720
|
-
const version$1 = "0.10.18-canary.
|
3713
|
+
const version$1 = "0.10.18-canary.d75102f84";
|
3721
3714
|
|
3722
3715
|
/**
|
3723
3716
|
* @license
|
@@ -3788,7 +3781,7 @@ const name$2 = "@firebase/vertexai";
|
|
3788
3781
|
const name$1 = "@firebase/firestore-compat";
|
3789
3782
|
|
3790
3783
|
const name = "firebase";
|
3791
|
-
const version = "11.2.0-canary.
|
3784
|
+
const version = "11.2.0-canary.d75102f84";
|
3792
3785
|
|
3793
3786
|
/**
|
3794
3787
|
* @license
|
@@ -4569,7 +4562,8 @@ function computeKey(app) {
|
|
4569
4562
|
* limitations under the License.
|
4570
4563
|
*/
|
4571
4564
|
const MAX_HEADER_BYTES = 1024;
|
4572
|
-
|
4565
|
+
// 30 days
|
4566
|
+
const STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;
|
4573
4567
|
class HeartbeatServiceImpl {
|
4574
4568
|
constructor(container) {
|
4575
4569
|
this.container = container;
|
@@ -4623,13 +4617,14 @@ class HeartbeatServiceImpl {
|
|
4623
4617
|
else {
|
4624
4618
|
// There is no entry for this date. Create one.
|
4625
4619
|
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
|
-
}
|
4632
4620
|
}
|
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
|
+
});
|
4633
4628
|
return this._storage.overwrite(this._heartbeatsCache);
|
4634
4629
|
}
|
4635
4630
|
catch (e) {
|
@@ -4804,24 +4799,6 @@ function countBytes(heartbeatsCache) {
|
|
4804
4799
|
// heartbeatsCache wrapper properties
|
4805
4800
|
JSON.stringify({ version: 2, heartbeats: heartbeatsCache })).length;
|
4806
4801
|
}
|
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
|
-
}
|
4825
4802
|
|
4826
4803
|
/**
|
4827
4804
|
* @license
|
@@ -4892,7 +4869,7 @@ var Websocket = websocket;
|
|
4892
4869
|
var util = require$$2__default$3["default"];
|
4893
4870
|
var logger$1 = require$$1__default$3["default"];
|
4894
4871
|
var app = index_cjs;
|
4895
|
-
var component = require$$0__default$
|
4872
|
+
var component = require$$0__default$3["default"];
|
4896
4873
|
|
4897
4874
|
function _interopDefaultLegacy$1 (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
4898
4875
|
|
@@ -8636,7 +8613,7 @@ class PersistentConnection extends ServerActions {
|
|
8636
8613
|
}
|
8637
8614
|
this.lastConnectionEstablishedTime_ = null;
|
8638
8615
|
}
|
8639
|
-
const timeSinceLastConnectAttempt =
|
8616
|
+
const timeSinceLastConnectAttempt = new Date().getTime() - this.lastConnectionAttemptTime_;
|
8640
8617
|
let reconnectDelay = Math.max(0, this.reconnectDelay_ - timeSinceLastConnectAttempt);
|
8641
8618
|
reconnectDelay = Math.random() * reconnectDelay;
|
8642
8619
|
this.log_('Trying to reconnect in ' + reconnectDelay + 'ms');
|
@@ -19680,17 +19657,17 @@ Database.ServerValue = {
|
|
19680
19657
|
*/
|
19681
19658
|
function initStandalone$1({ app, url, version, customAuthImpl, customAppCheckImpl, namespace, nodeAdmin = false }) {
|
19682
19659
|
_setSDKVersion(version);
|
19683
|
-
const container = new require$$0$
|
19660
|
+
const container = new require$$0$3.ComponentContainer('database-standalone');
|
19684
19661
|
/**
|
19685
19662
|
* ComponentContainer('database-standalone') is just a placeholder that doesn't perform
|
19686
19663
|
* any actual function.
|
19687
19664
|
*/
|
19688
|
-
const authProvider = new require$$0$
|
19689
|
-
authProvider.setComponent(new require$$0$
|
19665
|
+
const authProvider = new require$$0$3.Provider('auth-internal', container);
|
19666
|
+
authProvider.setComponent(new require$$0$3.Component('auth-internal', () => customAuthImpl, "PRIVATE" /* ComponentType.PRIVATE */));
|
19690
19667
|
let appCheckProvider = undefined;
|
19691
19668
|
if (customAppCheckImpl) {
|
19692
|
-
appCheckProvider = new require$$0$
|
19693
|
-
appCheckProvider.setComponent(new require$$0$
|
19669
|
+
appCheckProvider = new require$$0$3.Provider('app-check-internal', container);
|
19670
|
+
appCheckProvider.setComponent(new require$$0$3.Component('app-check-internal', () => customAppCheckImpl, "PRIVATE" /* ComponentType.PRIVATE */));
|
19694
19671
|
}
|
19695
19672
|
return {
|
19696
19673
|
instance: new Database(_repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, nodeAdmin), app),
|