@firebase/database 1.0.10 → 1.0.11-canary.01f36ea41
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 +15 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +16 -7
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +15 -6
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.standalone.js +15 -5
- package/dist/index.standalone.js.map +1 -1
- package/dist/internal.d.ts +3 -2
- package/dist/node-esm/index.node.esm.js +16 -7
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/core/AppCheckTokenProvider.d.ts +4 -2
- package/dist/private.d.ts +3 -2
- package/dist/src/core/AppCheckTokenProvider.d.ts +4 -2
- package/package.json +7 -7
package/dist/index.node.cjs.js
CHANGED
|
@@ -1259,7 +1259,7 @@ WebSocketConnection.responsesRequiredToBeHealthy = 2;
|
|
|
1259
1259
|
WebSocketConnection.healthyTimeout = 30000;
|
|
1260
1260
|
|
|
1261
1261
|
const name = "@firebase/database";
|
|
1262
|
-
const version = "1.0.
|
|
1262
|
+
const version = "1.0.11-canary.01f36ea41";
|
|
1263
1263
|
|
|
1264
1264
|
/**
|
|
1265
1265
|
* @license
|
|
@@ -1281,15 +1281,24 @@ const version = "1.0.10";
|
|
|
1281
1281
|
* Abstraction around AppCheck's token fetching capabilities.
|
|
1282
1282
|
*/
|
|
1283
1283
|
class AppCheckTokenProvider {
|
|
1284
|
-
constructor(
|
|
1285
|
-
this.appName_ = appName_;
|
|
1284
|
+
constructor(app$1, appCheckProvider) {
|
|
1286
1285
|
this.appCheckProvider = appCheckProvider;
|
|
1286
|
+
this.appName = app$1.name;
|
|
1287
|
+
if (app._isFirebaseServerApp(app$1) && app$1.settings.appCheckToken) {
|
|
1288
|
+
this.serverAppAppCheckToken = app$1.settings.appCheckToken;
|
|
1289
|
+
}
|
|
1287
1290
|
this.appCheck = appCheckProvider === null || appCheckProvider === void 0 ? void 0 : appCheckProvider.getImmediate({ optional: true });
|
|
1288
1291
|
if (!this.appCheck) {
|
|
1289
1292
|
appCheckProvider === null || appCheckProvider === void 0 ? void 0 : appCheckProvider.get().then(appCheck => (this.appCheck = appCheck));
|
|
1290
1293
|
}
|
|
1291
1294
|
}
|
|
1292
1295
|
getToken(forceRefresh) {
|
|
1296
|
+
if (this.serverAppAppCheckToken) {
|
|
1297
|
+
if (forceRefresh) {
|
|
1298
|
+
throw new Error('Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.');
|
|
1299
|
+
}
|
|
1300
|
+
return Promise.resolve({ token: this.serverAppAppCheckToken });
|
|
1301
|
+
}
|
|
1293
1302
|
if (!this.appCheck) {
|
|
1294
1303
|
return new Promise((resolve, reject) => {
|
|
1295
1304
|
// Support delayed initialization of FirebaseAppCheck. This allows our
|
|
@@ -1313,7 +1322,7 @@ class AppCheckTokenProvider {
|
|
|
1313
1322
|
(_a = this.appCheckProvider) === null || _a === void 0 ? void 0 : _a.get().then(appCheck => appCheck.addTokenListener(listener));
|
|
1314
1323
|
}
|
|
1315
1324
|
notifyForInvalidToken() {
|
|
1316
|
-
warn(`Provided AppCheck credentials for the app named "${this.
|
|
1325
|
+
warn(`Provided AppCheck credentials for the app named "${this.appName}" ` +
|
|
1317
1326
|
'are invalid. This usually indicates your app was not initialized correctly.');
|
|
1318
1327
|
}
|
|
1319
1328
|
}
|
|
@@ -3744,7 +3753,7 @@ class PersistentConnection extends ServerActions {
|
|
|
3744
3753
|
}
|
|
3745
3754
|
this.lastConnectionEstablishedTime_ = null;
|
|
3746
3755
|
}
|
|
3747
|
-
const timeSinceLastConnectAttempt = new Date().getTime() - this.lastConnectionAttemptTime_;
|
|
3756
|
+
const timeSinceLastConnectAttempt = Math.max(0, new Date().getTime() - this.lastConnectionAttemptTime_);
|
|
3748
3757
|
let reconnectDelay = Math.max(0, this.reconnectDelay_ - timeSinceLastConnectAttempt);
|
|
3749
3758
|
reconnectDelay = Math.random() * reconnectDelay;
|
|
3750
3759
|
this.log_('Trying to reconnect in ' + reconnectDelay + 'ms');
|
|
@@ -13535,7 +13544,7 @@ function repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, no
|
|
|
13535
13544
|
fatal('Database URL must point to the root of a Firebase Database ' +
|
|
13536
13545
|
'(not including a child path).');
|
|
13537
13546
|
}
|
|
13538
|
-
const repo = repoManagerCreateRepo(repoInfo, app, authTokenProvider, new AppCheckTokenProvider(app
|
|
13547
|
+
const repo = repoManagerCreateRepo(repoInfo, app, authTokenProvider, new AppCheckTokenProvider(app, appCheckProvider));
|
|
13539
13548
|
return new Database(repo, app);
|
|
13540
13549
|
}
|
|
13541
13550
|
/**
|