@firebase/database 0.12.8 → 0.13.0-20220505222723

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.
@@ -1,11 +1,11 @@
1
1
  import { getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION as SDK_VERSION$1 } from '@firebase/app';
2
2
  import { Component } from '@firebase/component';
3
- import { stringify, jsonEval, contains, assert, base64, stringToByteArray, Sha1, isNodeSdk, deepCopy, base64Encode, isMobileCordova, stringLength, Deferred, safeGet, isAdmin, isValidFormat, isEmpty, isReactNative, assertionError, map, querystring, errorPrefix, getModularInstance, createMockUserToken } from '@firebase/util';
3
+ import { stringify, jsonEval, contains, assert, isNodeSdk, base64, stringToByteArray, Sha1, deepCopy, base64Encode, isMobileCordova, stringLength, Deferred, safeGet, isAdmin, isValidFormat, isEmpty, isReactNative, assertionError, map, querystring, errorPrefix, getModularInstance, createMockUserToken } from '@firebase/util';
4
4
  import { __spreadArray, __read, __values, __extends, __awaiter, __generator, __assign } from 'tslib';
5
5
  import { Logger, LogLevel } from '@firebase/logger';
6
6
 
7
7
  var name = "@firebase/database";
8
- var version = "0.12.8";
8
+ var version = "0.13.0-20220505222723";
9
9
 
10
10
  /**
11
11
  * @license
@@ -2214,6 +2214,17 @@ var TransportManager = /** @class */ (function () {
2214
2214
  enumerable: false,
2215
2215
  configurable: true
2216
2216
  });
2217
+ Object.defineProperty(TransportManager, "IS_TRANSPORT_INITIALIZED", {
2218
+ /**
2219
+ * Returns whether transport has been selected to ensure WebSocketConnection or BrowserPollConnection are not called after
2220
+ * TransportManager has already set up transports_
2221
+ */
2222
+ get: function () {
2223
+ return this.globalTransportInitialized_;
2224
+ },
2225
+ enumerable: false,
2226
+ configurable: true
2227
+ });
2217
2228
  TransportManager.prototype.initTransports_ = function (repoInfo) {
2218
2229
  var e_1, _a;
2219
2230
  var isWebSocketsAvailable = WebSocketConnection && WebSocketConnection['isAvailable']();
@@ -2244,6 +2255,7 @@ var TransportManager = /** @class */ (function () {
2244
2255
  }
2245
2256
  finally { if (e_1) throw e_1.error; }
2246
2257
  }
2258
+ TransportManager.globalTransportInitialized_ = true;
2247
2259
  }
2248
2260
  };
2249
2261
  /**
@@ -2268,6 +2280,8 @@ var TransportManager = /** @class */ (function () {
2268
2280
  return null;
2269
2281
  }
2270
2282
  };
2283
+ // Keeps track of whether the TransportManager has already chosen a transport to use
2284
+ TransportManager.globalTransportInitialized_ = false;
2271
2285
  return TransportManager;
2272
2286
  }());
2273
2287
 
@@ -14118,6 +14132,26 @@ var Database = /** @class */ (function () {
14118
14132
  };
14119
14133
  return Database;
14120
14134
  }());
14135
+ function checkTransportInit() {
14136
+ if (TransportManager.IS_TRANSPORT_INITIALIZED) {
14137
+ warn('Transport has already been initialized. Please call this function before calling ref or setting up a listener');
14138
+ }
14139
+ }
14140
+ /**
14141
+ * Force the use of websockets instead of longPolling.
14142
+ */
14143
+ function forceWebSockets() {
14144
+ checkTransportInit();
14145
+ BrowserPollConnection.forceDisallow();
14146
+ }
14147
+ /**
14148
+ * Force the use of longPolling instead of websockets. This will be ignored if websocket protocol is used in databaseURL.
14149
+ */
14150
+ function forceLongPolling() {
14151
+ checkTransportInit();
14152
+ WebSocketConnection.forceDisallow();
14153
+ BrowserPollConnection.forceAllow();
14154
+ }
14121
14155
  /**
14122
14156
  * Returns the instance of the Realtime Database SDK that is associated
14123
14157
  * with the provided {@link @firebase/app#FirebaseApp}. Initializes a new instance with
@@ -14442,5 +14476,5 @@ var forceRestClient = function (forceRestClient) {
14442
14476
  */
14443
14477
  registerDatabase();
14444
14478
 
14445
- export { DataSnapshot, Database, OnDisconnect, QueryConstraint, TransactionResult, QueryImpl as _QueryImpl, QueryParams as _QueryParams, ReferenceImpl as _ReferenceImpl, forceRestClient as _TEST_ACCESS_forceRestClient, hijackHash as _TEST_ACCESS_hijackHash, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp, setSDKVersion as _setSDKVersion, validatePathString as _validatePathString, validateWritablePath as _validateWritablePath, child, connectDatabaseEmulator, enableLogging, endAt, endBefore, equalTo, get, getDatabase, goOffline, goOnline, increment, limitToFirst, limitToLast, off, onChildAdded, onChildChanged, onChildMoved, onChildRemoved, onDisconnect, onValue, orderByChild, orderByKey, orderByPriority, orderByValue, push, query, ref, refFromURL, remove, runTransaction, serverTimestamp, set, setPriority, setWithPriority, startAfter, startAt, update };
14479
+ export { DataSnapshot, Database, OnDisconnect, QueryConstraint, TransactionResult, QueryImpl as _QueryImpl, QueryParams as _QueryParams, ReferenceImpl as _ReferenceImpl, forceRestClient as _TEST_ACCESS_forceRestClient, hijackHash as _TEST_ACCESS_hijackHash, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp, setSDKVersion as _setSDKVersion, validatePathString as _validatePathString, validateWritablePath as _validateWritablePath, child, connectDatabaseEmulator, enableLogging, endAt, endBefore, equalTo, forceLongPolling, forceWebSockets, get, getDatabase, goOffline, goOnline, increment, limitToFirst, limitToLast, off, onChildAdded, onChildChanged, onChildMoved, onChildRemoved, onDisconnect, onValue, orderByChild, orderByKey, orderByPriority, orderByValue, push, query, ref, refFromURL, remove, runTransaction, serverTimestamp, set, setPriority, setWithPriority, startAfter, startAt, update };
14446
14480
  //# sourceMappingURL=index.esm5.js.map