@firebase/database 1.0.6-canary.4b4db85ff → 1.0.6-canary.62661245f
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.cjs.js +20 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +20 -15
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +20 -15
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +20 -15
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.standalone.js +16 -10
- package/dist/index.standalone.js.map +1 -1
- package/dist/internal.d.ts +4 -5
- package/dist/node-esm/index.node.esm.js +20 -15
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/Database.d.ts +3 -4
- package/dist/node-esm/src/core/WriteTree.d.ts +1 -1
- package/dist/node-esm/src/core/util/Tree.d.ts +1 -1
- package/dist/node-esm/src/core/util/util.d.ts +2 -2
- package/dist/node-esm/src/realtime/BrowserPollConnection.d.ts +1 -1
- package/dist/private.d.ts +4 -5
- package/dist/public.d.ts +3 -4
- package/dist/src/api/Database.d.ts +3 -4
- package/dist/src/core/WriteTree.d.ts +1 -1
- package/dist/src/core/util/Tree.d.ts +1 -1
- package/dist/src/core/util/util.d.ts +2 -2
- package/dist/src/realtime/BrowserPollConnection.d.ts +1 -1
- package/package.json +8 -7
package/dist/index.esm2017.js
CHANGED
|
@@ -4,7 +4,7 @@ import { stringify, jsonEval, contains, assert, isNodeSdk, stringToByteArray, Sh
|
|
|
4
4
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
5
5
|
|
|
6
6
|
const name = "@firebase/database";
|
|
7
|
-
const version = "1.0.6-canary.
|
|
7
|
+
const version = "1.0.6-canary.62661245f";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -571,7 +571,7 @@ const isWindowsStoreApp = function () {
|
|
|
571
571
|
return typeof Windows === 'object' && typeof Windows.UI === 'object';
|
|
572
572
|
};
|
|
573
573
|
/**
|
|
574
|
-
* Converts a server error code to a
|
|
574
|
+
* Converts a server error code to a JavaScript Error
|
|
575
575
|
*/
|
|
576
576
|
function errorForServerCode(code, query) {
|
|
577
577
|
let reason = 'Unknown Error';
|
|
@@ -600,7 +600,7 @@ const INTEGER_REGEXP_ = new RegExp('^-?(0*)\\d{1,10}$');
|
|
|
600
600
|
*/
|
|
601
601
|
const INTEGER_32_MIN = -2147483648;
|
|
602
602
|
/**
|
|
603
|
-
* For use in
|
|
603
|
+
* For use in keys, the maximum possible 32-bit integer.
|
|
604
604
|
*/
|
|
605
605
|
const INTEGER_32_MAX = 2147483647;
|
|
606
606
|
/**
|
|
@@ -725,7 +725,7 @@ class AppCheckTokenProvider {
|
|
|
725
725
|
// Support delayed initialization of FirebaseAppCheck. This allows our
|
|
726
726
|
// customers to initialize the RTDB SDK before initializing Firebase
|
|
727
727
|
// AppCheck and ensures that all requests are authenticated if a token
|
|
728
|
-
// becomes available before the
|
|
728
|
+
// becomes available before the timeout below expires.
|
|
729
729
|
setTimeout(() => {
|
|
730
730
|
if (this.appCheck) {
|
|
731
731
|
this.getToken(forceRefresh).then(resolve, reject);
|
|
@@ -784,7 +784,7 @@ class FirebaseAuthTokenProvider {
|
|
|
784
784
|
// Support delayed initialization of FirebaseAuth. This allows our
|
|
785
785
|
// customers to initialize the RTDB SDK before initializing Firebase
|
|
786
786
|
// Auth and ensures that all requests are authenticated if a token
|
|
787
|
-
// becomes available before the
|
|
787
|
+
// becomes available before the timeout below expires.
|
|
788
788
|
setTimeout(() => {
|
|
789
789
|
if (this.auth_) {
|
|
790
790
|
this.getToken(forceRefresh).then(resolve, reject);
|
|
@@ -1464,7 +1464,7 @@ class BrowserPollConnection {
|
|
|
1464
1464
|
*********************************************************************************************/
|
|
1465
1465
|
class FirebaseIFrameScriptHolder {
|
|
1466
1466
|
/**
|
|
1467
|
-
* @param commandCB - The callback to be called when control commands are
|
|
1467
|
+
* @param commandCB - The callback to be called when control commands are received from the server.
|
|
1468
1468
|
* @param onMessageCB - The callback to be triggered when responses arrive from the server.
|
|
1469
1469
|
* @param onDisconnect - The callback to be triggered when this tag holder is closed
|
|
1470
1470
|
* @param urlFn - A function that provides the URL of the endpoint to send data to.
|
|
@@ -1509,6 +1509,8 @@ class FirebaseIFrameScriptHolder {
|
|
|
1509
1509
|
const iframeContents = '<html><body>' + script + '</body></html>';
|
|
1510
1510
|
try {
|
|
1511
1511
|
this.myIFrame.doc.open();
|
|
1512
|
+
// TODO: Do not use document.write, since it can lead to XSS. Instead, use the safevalues
|
|
1513
|
+
// library to sanitize the HTML in the iframeContents.
|
|
1512
1514
|
this.myIFrame.doc.write(iframeContents);
|
|
1513
1515
|
this.myIFrame.doc.close();
|
|
1514
1516
|
}
|
|
@@ -1731,6 +1733,10 @@ class FirebaseIFrameScriptHolder {
|
|
|
1731
1733
|
const newScript = this.myIFrame.doc.createElement('script');
|
|
1732
1734
|
newScript.type = 'text/javascript';
|
|
1733
1735
|
newScript.async = true;
|
|
1736
|
+
// TODO: We cannot assign an arbitrary URL to a script attached to the DOM, since it is
|
|
1737
|
+
// at risk of XSS. We should use the safevalues library to create a safeScriptEl, and
|
|
1738
|
+
// assign a sanitized trustedResourceURL to it. Since the URL must be a template string
|
|
1739
|
+
// literal, this could require some heavy refactoring.
|
|
1734
1740
|
newScript.src = url;
|
|
1735
1741
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1736
1742
|
newScript.onload = newScript.onreadystatechange =
|
|
@@ -10315,7 +10321,7 @@ function treeHasChildren(tree) {
|
|
|
10315
10321
|
return tree.node.childCount > 0;
|
|
10316
10322
|
}
|
|
10317
10323
|
/**
|
|
10318
|
-
* @returns
|
|
10324
|
+
* @returns Whether the tree is empty (no value or children).
|
|
10319
10325
|
*/
|
|
10320
10326
|
function treeIsEmpty(tree) {
|
|
10321
10327
|
return treeGetValue(tree) === undefined && !treeHasChildren(tree);
|
|
@@ -12643,7 +12649,7 @@ function push(parent, value) {
|
|
|
12643
12649
|
// then() and catch() methods and is used as the return value of push(). The
|
|
12644
12650
|
// second remains a regular Reference and is used as the fulfilled value of
|
|
12645
12651
|
// the first ThennableReference.
|
|
12646
|
-
const
|
|
12652
|
+
const thenablePushRef = child(parent, name);
|
|
12647
12653
|
const pushRef = child(parent, name);
|
|
12648
12654
|
let promise;
|
|
12649
12655
|
if (value != null) {
|
|
@@ -12652,9 +12658,9 @@ function push(parent, value) {
|
|
|
12652
12658
|
else {
|
|
12653
12659
|
promise = Promise.resolve(pushRef);
|
|
12654
12660
|
}
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
return
|
|
12661
|
+
thenablePushRef.then = promise.then.bind(promise);
|
|
12662
|
+
thenablePushRef.catch = promise.then.bind(promise, undefined);
|
|
12663
|
+
return thenablePushRef;
|
|
12658
12664
|
}
|
|
12659
12665
|
/**
|
|
12660
12666
|
* Removes the data at this Database location.
|
|
@@ -13629,10 +13635,9 @@ function forceLongPolling() {
|
|
|
13629
13635
|
BrowserPollConnection.forceAllow();
|
|
13630
13636
|
}
|
|
13631
13637
|
/**
|
|
13632
|
-
* Returns the instance of the Realtime Database SDK that is associated
|
|
13633
|
-
*
|
|
13634
|
-
*
|
|
13635
|
-
* a custom database URL.
|
|
13638
|
+
* Returns the instance of the Realtime Database SDK that is associated with the provided
|
|
13639
|
+
* {@link @firebase/app#FirebaseApp}. Initializes a new instance with default settings if
|
|
13640
|
+
* no instance exists or if the existing instance uses a custom database URL.
|
|
13636
13641
|
*
|
|
13637
13642
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned Realtime
|
|
13638
13643
|
* Database instance is associated with.
|