@react-native-firebase/app 23.7.0 → 23.8.1
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/CHANGELOG.md +16 -0
- package/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java +2 -2
- package/android/src/reactnative/java/io/invertase/firebase/app/ReactNativeFirebaseVersion.java +1 -1
- package/dist/commonjs/FirebaseApp.js +85 -0
- package/dist/commonjs/FirebaseApp.js.map +1 -0
- package/dist/commonjs/common/Base64.js +106 -0
- package/dist/commonjs/common/Base64.js.map +1 -0
- package/dist/commonjs/common/MutatableParams.js +50 -0
- package/dist/commonjs/common/MutatableParams.js.map +1 -0
- package/dist/commonjs/common/ReferenceBase.js +49 -0
- package/dist/commonjs/common/ReferenceBase.js.map +1 -0
- package/dist/commonjs/common/deeps.js +82 -0
- package/dist/commonjs/common/deeps.js.map +1 -0
- package/dist/commonjs/common/id.js +88 -0
- package/dist/commonjs/common/id.js.map +1 -0
- package/dist/commonjs/common/index.js +799 -0
- package/dist/commonjs/common/index.js.map +1 -0
- package/dist/commonjs/common/path.js +133 -0
- package/dist/commonjs/common/path.js.map +1 -0
- package/dist/commonjs/common/promise.js +65 -0
- package/dist/commonjs/common/promise.js.map +1 -0
- package/dist/commonjs/common/serialize.js +48 -0
- package/dist/commonjs/common/serialize.js.map +1 -0
- package/dist/commonjs/common/unitTestUtils.js +54 -0
- package/dist/commonjs/common/unitTestUtils.js.map +1 -0
- package/dist/commonjs/common/validate.js +236 -0
- package/dist/commonjs/common/validate.js.map +1 -0
- package/dist/commonjs/index.js +42 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/internal/FirebaseModule.js +63 -0
- package/dist/commonjs/internal/FirebaseModule.js.map +1 -0
- package/dist/commonjs/internal/NativeFirebaseError.js +92 -0
- package/dist/commonjs/internal/NativeFirebaseError.js.map +1 -0
- package/dist/commonjs/internal/NativeModules.js +6 -0
- package/dist/commonjs/internal/NativeModules.js.map +1 -0
- package/dist/commonjs/internal/RNFBNativeEventEmitter.js +118 -0
- package/dist/commonjs/internal/RNFBNativeEventEmitter.js.map +1 -0
- package/dist/commonjs/internal/SharedEventEmitter.js +26 -0
- package/dist/commonjs/internal/SharedEventEmitter.js.map +1 -0
- package/dist/commonjs/internal/asyncStorage.js +83 -0
- package/dist/commonjs/internal/asyncStorage.js.map +1 -0
- package/dist/commonjs/internal/constants.js +27 -0
- package/dist/commonjs/internal/constants.js.map +1 -0
- package/dist/commonjs/internal/index.js +109 -0
- package/dist/commonjs/internal/index.js.map +1 -0
- package/dist/commonjs/internal/logger.js +256 -0
- package/dist/commonjs/internal/logger.js.map +1 -0
- package/dist/commonjs/internal/nativeModule.android.js +19 -0
- package/dist/commonjs/internal/nativeModule.android.js.map +1 -0
- package/dist/commonjs/internal/nativeModule.ios.js +19 -0
- package/dist/commonjs/internal/nativeModule.ios.js.map +1 -0
- package/dist/commonjs/internal/nativeModule.js +19 -0
- package/dist/commonjs/internal/nativeModule.js.map +1 -0
- package/dist/commonjs/internal/nativeModuleAndroidIos.js +51 -0
- package/dist/commonjs/internal/nativeModuleAndroidIos.js.map +1 -0
- package/dist/commonjs/internal/nativeModuleWeb.js +52 -0
- package/dist/commonjs/internal/nativeModuleWeb.js.map +1 -0
- package/dist/commonjs/internal/nullSerialization.js +162 -0
- package/dist/commonjs/internal/nullSerialization.js.map +1 -0
- package/dist/commonjs/internal/registry/app.js +238 -0
- package/dist/commonjs/internal/registry/app.js.map +1 -0
- package/dist/commonjs/internal/registry/namespace.js +269 -0
- package/dist/commonjs/internal/registry/namespace.js.map +1 -0
- package/dist/commonjs/internal/registry/nativeModule.js +224 -0
- package/dist/commonjs/internal/registry/nativeModule.js.map +1 -0
- package/dist/commonjs/internal/web/RNFBAppModule.js +273 -0
- package/dist/commonjs/internal/web/RNFBAppModule.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseApp.js +17 -0
- package/dist/commonjs/internal/web/firebaseApp.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseAppCheck.js +36 -0
- package/dist/commonjs/internal/web/firebaseAppCheck.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseAuth.js +28 -0
- package/dist/commonjs/internal/web/firebaseAuth.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseDatabase.js +28 -0
- package/dist/commonjs/internal/web/firebaseDatabase.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseFirestore.js +28 -0
- package/dist/commonjs/internal/web/firebaseFirestore.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseFunctions.js +28 -0
- package/dist/commonjs/internal/web/firebaseFunctions.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseInstallations.js +36 -0
- package/dist/commonjs/internal/web/firebaseInstallations.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseRemoteConfig.js +36 -0
- package/dist/commonjs/internal/web/firebaseRemoteConfig.js.map +1 -0
- package/dist/commonjs/internal/web/firebaseStorage.js +28 -0
- package/dist/commonjs/internal/web/firebaseStorage.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBCursor.js +479 -0
- package/dist/commonjs/internal/web/memidb/FDBCursor.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBCursorWithValue.js +19 -0
- package/dist/commonjs/internal/web/memidb/FDBCursorWithValue.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBDatabase.js +163 -0
- package/dist/commonjs/internal/web/memidb/FDBDatabase.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBFactory.js +264 -0
- package/dist/commonjs/internal/web/memidb/FDBFactory.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBIndex.js +191 -0
- package/dist/commonjs/internal/web/memidb/FDBIndex.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBKeyRange.js +78 -0
- package/dist/commonjs/internal/web/memidb/FDBKeyRange.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBObjectStore.js +383 -0
- package/dist/commonjs/internal/web/memidb/FDBObjectStore.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBOpenDBRequest.js +17 -0
- package/dist/commonjs/internal/web/memidb/FDBOpenDBRequest.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBRequest.js +41 -0
- package/dist/commonjs/internal/web/memidb/FDBRequest.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBTransaction.js +221 -0
- package/dist/commonjs/internal/web/memidb/FDBTransaction.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/FDBVersionChangeEvent.js +20 -0
- package/dist/commonjs/internal/web/memidb/FDBVersionChangeEvent.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/LICENSE +208 -0
- package/dist/commonjs/internal/web/memidb/index.js +45 -0
- package/dist/commonjs/internal/web/memidb/index.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/Database.js +38 -0
- package/dist/commonjs/internal/web/memidb/lib/Database.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/FakeDOMStringList.js +78 -0
- package/dist/commonjs/internal/web/memidb/lib/FakeDOMStringList.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/FakeEvent.js +45 -0
- package/dist/commonjs/internal/web/memidb/lib/FakeEvent.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/FakeEventTarget.js +111 -0
- package/dist/commonjs/internal/web/memidb/lib/FakeEventTarget.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/Index.js +164 -0
- package/dist/commonjs/internal/web/memidb/lib/Index.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/KeyGenerator.js +29 -0
- package/dist/commonjs/internal/web/memidb/lib/KeyGenerator.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/ObjectStore.js +180 -0
- package/dist/commonjs/internal/web/memidb/lib/ObjectStore.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/RecordStore.js +141 -0
- package/dist/commonjs/internal/web/memidb/lib/RecordStore.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/binarySearch.js +86 -0
- package/dist/commonjs/internal/web/memidb/lib/binarySearch.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/canInjectKey.js +30 -0
- package/dist/commonjs/internal/web/memidb/lib/canInjectKey.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/cmp.js +85 -0
- package/dist/commonjs/internal/web/memidb/lib/cmp.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/enforceRange.js +20 -0
- package/dist/commonjs/internal/web/memidb/lib/enforceRange.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/errors.js +95 -0
- package/dist/commonjs/internal/web/memidb/lib/errors.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/extractKey.js +46 -0
- package/dist/commonjs/internal/web/memidb/lib/extractKey.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/scheduling.js +37 -0
- package/dist/commonjs/internal/web/memidb/lib/scheduling.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/types.js +6 -0
- package/dist/commonjs/internal/web/memidb/lib/types.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/validateKeyPath.js +51 -0
- package/dist/commonjs/internal/web/memidb/lib/validateKeyPath.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/valueToKey.js +62 -0
- package/dist/commonjs/internal/web/memidb/lib/valueToKey.js.map +1 -0
- package/dist/commonjs/internal/web/memidb/lib/valueToKeyRange.js +26 -0
- package/dist/commonjs/internal/web/memidb/lib/valueToKeyRange.js.map +1 -0
- package/dist/commonjs/internal/web/structuredClone/index.js +239 -0
- package/dist/commonjs/internal/web/structuredClone/index.js.map +1 -0
- package/dist/commonjs/internal/web/utils.js +59 -0
- package/dist/commonjs/internal/web/utils.js.map +1 -0
- package/dist/commonjs/modular.js +190 -0
- package/dist/commonjs/modular.js.map +1 -0
- package/dist/commonjs/namespaced.js +35 -0
- package/dist/commonjs/namespaced.js.map +1 -0
- package/dist/commonjs/package.json +1 -0
- package/dist/commonjs/types/app.js +139 -0
- package/dist/commonjs/types/app.js.map +1 -0
- package/dist/commonjs/types/internal.js +6 -0
- package/dist/commonjs/types/internal.js.map +1 -0
- package/dist/commonjs/utils/UtilsStatics.js +59 -0
- package/dist/commonjs/utils/UtilsStatics.js.map +1 -0
- package/dist/commonjs/utils/index.js +94 -0
- package/dist/commonjs/utils/index.js.map +1 -0
- package/dist/commonjs/version.js +9 -0
- package/dist/commonjs/version.js.map +1 -0
- package/{lib → dist/module}/FirebaseApp.js +14 -14
- package/dist/module/FirebaseApp.js.map +1 -0
- package/dist/module/common/Base64.js +100 -0
- package/dist/module/common/Base64.js.map +1 -0
- package/{lib → dist/module}/common/MutatableParams.js +4 -6
- package/dist/module/common/MutatableParams.js.map +1 -0
- package/{lib → dist/module}/common/ReferenceBase.js +3 -2
- package/dist/module/common/ReferenceBase.js.map +1 -0
- package/{lib → dist/module}/common/deeps.js +5 -9
- package/dist/module/common/deeps.js.map +1 -0
- package/{lib → dist/module}/common/id.js +20 -11
- package/dist/module/common/id.js.map +1 -0
- package/dist/module/common/index.js +701 -0
- package/dist/module/common/index.js.map +1 -0
- package/{lib → dist/module}/common/path.js +4 -8
- package/dist/module/common/path.js.map +1 -0
- package/{lib → dist/module}/common/promise.js +21 -23
- package/dist/module/common/promise.js.map +1 -0
- package/dist/module/common/serialize.js +43 -0
- package/dist/module/common/serialize.js.map +1 -0
- package/dist/module/common/unitTestUtils.js +48 -0
- package/dist/module/common/unitTestUtils.js.map +1 -0
- package/{lib → dist/module}/common/validate.js +20 -16
- package/dist/module/common/validate.js.map +1 -0
- package/dist/module/index.js +22 -0
- package/dist/module/index.js.map +1 -0
- package/{lib → dist/module}/internal/FirebaseModule.js +6 -11
- package/dist/module/internal/FirebaseModule.js.map +1 -0
- package/{lib → dist/module}/internal/NativeFirebaseError.js +19 -24
- package/dist/module/internal/NativeFirebaseError.js.map +1 -0
- package/dist/module/internal/NativeModules.js +4 -0
- package/dist/module/internal/NativeModules.js.map +1 -0
- package/{lib → dist/module}/internal/RNFBNativeEventEmitter.js +30 -21
- package/dist/module/internal/RNFBNativeEventEmitter.js.map +1 -0
- package/dist/module/internal/SharedEventEmitter.js +22 -0
- package/dist/module/internal/SharedEventEmitter.js.map +1 -0
- package/dist/module/internal/asyncStorage.js +73 -0
- package/dist/module/internal/asyncStorage.js.map +1 -0
- package/dist/module/internal/constants.js +23 -0
- package/dist/module/internal/constants.js.map +1 -0
- package/dist/module/internal/index.js +30 -0
- package/dist/module/internal/index.js.map +1 -0
- package/{lib → dist/module}/internal/logger.js +65 -55
- package/dist/module/internal/logger.js.map +1 -0
- package/dist/module/internal/nativeModule.android.js +5 -0
- package/dist/module/internal/nativeModule.android.js.map +1 -0
- package/dist/module/internal/nativeModule.ios.js +5 -0
- package/dist/module/internal/nativeModule.ios.js.map +1 -0
- package/dist/module/internal/nativeModule.js +7 -0
- package/dist/module/internal/nativeModule.js.map +1 -0
- package/dist/module/internal/nativeModuleAndroidIos.js +46 -0
- package/dist/module/internal/nativeModuleAndroidIos.js.map +1 -0
- package/dist/module/internal/nativeModuleWeb.js +45 -0
- package/dist/module/internal/nativeModuleWeb.js.map +1 -0
- package/dist/module/internal/nullSerialization.js +158 -0
- package/dist/module/internal/nullSerialization.js.map +1 -0
- package/{lib → dist/module}/internal/registry/app.js +41 -79
- package/dist/module/internal/registry/app.js.map +1 -0
- package/dist/module/internal/registry/namespace.js +262 -0
- package/dist/module/internal/registry/namespace.js.map +1 -0
- package/{lib → dist/module}/internal/registry/nativeModule.js +46 -62
- package/dist/module/internal/registry/nativeModule.js.map +1 -0
- package/{lib → dist/module}/internal/web/RNFBAppModule.js +76 -67
- package/dist/module/internal/web/RNFBAppModule.js.map +1 -0
- package/dist/module/internal/web/firebaseApp.js +23 -0
- package/dist/module/internal/web/firebaseApp.js.map +1 -0
- package/dist/module/internal/web/firebaseAppCheck.js +26 -0
- package/dist/module/internal/web/firebaseAppCheck.js.map +1 -0
- package/dist/module/internal/web/firebaseAuth.js +24 -0
- package/dist/module/internal/web/firebaseAuth.js.map +1 -0
- package/dist/module/internal/web/firebaseDatabase.js +24 -0
- package/dist/module/internal/web/firebaseDatabase.js.map +1 -0
- package/dist/module/internal/web/firebaseFirestore.js +24 -0
- package/dist/module/internal/web/firebaseFirestore.js.map +1 -0
- package/dist/module/internal/web/firebaseFunctions.js +24 -0
- package/dist/module/internal/web/firebaseFunctions.js.map +1 -0
- package/dist/module/internal/web/firebaseInstallations.js +26 -0
- package/dist/module/internal/web/firebaseInstallations.js.map +1 -0
- package/dist/module/internal/web/firebaseRemoteConfig.js +26 -0
- package/dist/module/internal/web/firebaseRemoteConfig.js.map +1 -0
- package/dist/module/internal/web/firebaseStorage.js +24 -0
- package/dist/module/internal/web/firebaseStorage.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBCursor.js +474 -0
- package/dist/module/internal/web/memidb/FDBCursor.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBCursorWithValue.js +14 -0
- package/dist/module/internal/web/memidb/FDBCursorWithValue.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBDatabase.js +158 -0
- package/dist/module/internal/web/memidb/FDBDatabase.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBFactory.js +259 -0
- package/dist/module/internal/web/memidb/FDBFactory.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBIndex.js +186 -0
- package/dist/module/internal/web/memidb/FDBIndex.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBKeyRange.js +74 -0
- package/dist/module/internal/web/memidb/FDBKeyRange.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBObjectStore.js +378 -0
- package/dist/module/internal/web/memidb/FDBObjectStore.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBOpenDBRequest.js +12 -0
- package/dist/module/internal/web/memidb/FDBOpenDBRequest.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBRequest.js +36 -0
- package/dist/module/internal/web/memidb/FDBRequest.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBTransaction.js +216 -0
- package/dist/module/internal/web/memidb/FDBTransaction.js.map +1 -0
- package/dist/module/internal/web/memidb/FDBVersionChangeEvent.js +15 -0
- package/dist/module/internal/web/memidb/FDBVersionChangeEvent.js.map +1 -0
- package/dist/module/internal/web/memidb/LICENSE +208 -0
- package/dist/module/internal/web/memidb/index.js +41 -0
- package/dist/module/internal/web/memidb/index.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/Database.js +35 -0
- package/dist/module/internal/web/memidb/lib/Database.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/FakeDOMStringList.js +75 -0
- package/dist/module/internal/web/memidb/lib/FakeDOMStringList.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/FakeEvent.js +41 -0
- package/dist/module/internal/web/memidb/lib/FakeEvent.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/FakeEventTarget.js +107 -0
- package/dist/module/internal/web/memidb/lib/FakeEventTarget.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/Index.js +160 -0
- package/dist/module/internal/web/memidb/lib/Index.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/KeyGenerator.js +25 -0
- package/dist/module/internal/web/memidb/lib/KeyGenerator.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/ObjectStore.js +175 -0
- package/dist/module/internal/web/memidb/lib/ObjectStore.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/RecordStore.js +136 -0
- package/dist/module/internal/web/memidb/lib/RecordStore.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/binarySearch.js +77 -0
- package/dist/module/internal/web/memidb/lib/binarySearch.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/canInjectKey.js +26 -0
- package/dist/module/internal/web/memidb/lib/canInjectKey.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/cmp.js +80 -0
- package/dist/module/internal/web/memidb/lib/cmp.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/enforceRange.js +16 -0
- package/dist/module/internal/web/memidb/lib/enforceRange.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/errors.js +81 -0
- package/dist/module/internal/web/memidb/lib/errors.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/extractKey.js +42 -0
- package/dist/module/internal/web/memidb/lib/extractKey.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/scheduling.js +32 -0
- package/dist/module/internal/web/memidb/lib/scheduling.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/types.js +4 -0
- package/dist/module/internal/web/memidb/lib/types.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/validateKeyPath.js +47 -0
- package/dist/module/internal/web/memidb/lib/validateKeyPath.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/valueToKey.js +58 -0
- package/dist/module/internal/web/memidb/lib/valueToKey.js.map +1 -0
- package/dist/module/internal/web/memidb/lib/valueToKeyRange.js +22 -0
- package/dist/module/internal/web/memidb/lib/valueToKeyRange.js.map +1 -0
- package/dist/module/internal/web/structuredClone/index.js +235 -0
- package/dist/module/internal/web/structuredClone/index.js.map +1 -0
- package/{lib → dist/module}/internal/web/utils.js +24 -5
- package/dist/module/internal/web/utils.js.map +1 -0
- package/dist/module/modular.js +172 -0
- package/dist/module/modular.js.map +1 -0
- package/dist/module/namespaced.js +25 -0
- package/dist/module/namespaced.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/types/app.js +135 -0
- package/dist/module/types/app.js.map +1 -0
- package/dist/module/types/internal.js +4 -0
- package/dist/module/types/internal.js.map +1 -0
- package/dist/module/utils/UtilsStatics.js +55 -0
- package/dist/module/utils/UtilsStatics.js.map +1 -0
- package/{lib → dist/module}/utils/index.js +13 -15
- package/dist/module/utils/index.js.map +1 -0
- package/dist/module/version.js +5 -0
- package/dist/module/version.js.map +1 -0
- package/dist/typescript/commonjs/lib/FirebaseApp.d.ts +21 -0
- package/dist/typescript/commonjs/lib/FirebaseApp.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/Base64.d.ts +23 -0
- package/dist/typescript/commonjs/lib/common/Base64.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/MutatableParams.d.ts +10 -0
- package/dist/typescript/commonjs/lib/common/MutatableParams.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/ReferenceBase.d.ts +12 -0
- package/dist/typescript/commonjs/lib/common/ReferenceBase.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/deeps.d.ts +19 -0
- package/dist/typescript/commonjs/lib/common/deeps.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/id.d.ts +12 -0
- package/dist/typescript/commonjs/lib/common/id.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/index.d.ts +33 -0
- package/dist/typescript/commonjs/lib/common/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/path.d.ts +51 -0
- package/dist/typescript/commonjs/lib/common/path.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/promise.d.ts +12 -0
- package/dist/typescript/commonjs/lib/common/promise.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/serialize.d.ts +4 -0
- package/dist/typescript/commonjs/lib/common/serialize.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/unitTestUtils.d.ts +4 -0
- package/dist/typescript/commonjs/lib/common/unitTestUtils.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/common/validate.d.ts +100 -0
- package/dist/typescript/commonjs/lib/common/validate.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/index.d.ts +4 -0
- package/dist/typescript/commonjs/lib/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/FirebaseModule.d.ts +17 -0
- package/dist/typescript/commonjs/lib/internal/FirebaseModule.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/NativeFirebaseError.d.ts +20 -0
- package/dist/typescript/commonjs/lib/internal/NativeFirebaseError.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/NativeModules.d.ts +83 -0
- package/dist/typescript/commonjs/lib/internal/NativeModules.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/RNFBNativeEventEmitter.d.ts +13 -0
- package/dist/typescript/commonjs/lib/internal/RNFBNativeEventEmitter.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/SharedEventEmitter.d.ts +4 -0
- package/dist/typescript/commonjs/lib/internal/SharedEventEmitter.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/asyncStorage.d.ts +10 -0
- package/dist/typescript/commonjs/lib/internal/asyncStorage.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/constants.d.ts +5 -0
- package/dist/typescript/commonjs/lib/internal/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/index.d.ts +12 -0
- package/dist/typescript/commonjs/lib/internal/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/logger.d.ts +83 -0
- package/dist/typescript/commonjs/lib/internal/logger.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/nativeModule.android.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/nativeModule.android.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/nativeModule.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/nativeModule.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/nativeModule.ios.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/nativeModule.ios.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/nativeModuleAndroidIos.d.ts +10 -0
- package/dist/typescript/commonjs/lib/internal/nativeModuleAndroidIos.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/nativeModuleWeb.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/nativeModuleWeb.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/nullSerialization.d.ts +16 -0
- package/dist/typescript/commonjs/lib/internal/nullSerialization.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/registry/app.d.ts +47 -0
- package/dist/typescript/commonjs/lib/internal/registry/app.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/registry/namespace.d.ts +26 -0
- package/dist/typescript/commonjs/lib/internal/registry/namespace.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/registry/nativeModule.d.ts +17 -0
- package/dist/typescript/commonjs/lib/internal/registry/nativeModule.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/web/RNFBAppModule.d.ts +139 -0
- package/dist/typescript/commonjs/lib/internal/web/RNFBAppModule.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseApp.d.ts +2 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseApp.d.ts.map +1 -0
- package/{lib/internal/web/firebaseAppCheck.js → dist/typescript/commonjs/lib/internal/web/firebaseAppCheck.d.ts} +1 -2
- package/dist/typescript/commonjs/lib/internal/web/firebaseAppCheck.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseAuth.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseAuth.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseDatabase.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseDatabase.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseFirestore.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseFirestore.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseFunctions.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseFunctions.d.ts.map +1 -0
- package/{lib/internal/web/firebaseInstallations.js → dist/typescript/commonjs/lib/internal/web/firebaseInstallations.d.ts} +1 -2
- package/dist/typescript/commonjs/lib/internal/web/firebaseInstallations.d.ts.map +1 -0
- package/{lib/internal/web/firebaseRemoteConfig.js → dist/typescript/commonjs/lib/internal/web/firebaseRemoteConfig.d.ts} +1 -2
- package/dist/typescript/commonjs/lib/internal/web/firebaseRemoteConfig.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseStorage.d.ts +3 -0
- package/dist/typescript/commonjs/lib/internal/web/firebaseStorage.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/internal/web/utils.d.ts +13 -0
- package/dist/typescript/commonjs/lib/internal/web/utils.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/modular.d.ts +95 -0
- package/dist/typescript/commonjs/lib/modular.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/namespaced.d.ts +5 -0
- package/dist/typescript/commonjs/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/types/app.d.ts +561 -0
- package/dist/typescript/commonjs/lib/types/app.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/types/internal.d.ts +101 -0
- package/dist/typescript/commonjs/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/utils/UtilsStatics.d.ts +4 -0
- package/dist/typescript/commonjs/lib/utils/UtilsStatics.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/utils/index.d.ts +4 -0
- package/dist/typescript/commonjs/lib/utils/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/version.d.ts +2 -0
- package/dist/typescript/commonjs/lib/version.d.ts.map +1 -0
- package/dist/typescript/commonjs/package.json +1 -0
- package/dist/typescript/module/lib/FirebaseApp.d.ts +21 -0
- package/dist/typescript/module/lib/FirebaseApp.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/Base64.d.ts +23 -0
- package/dist/typescript/module/lib/common/Base64.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/MutatableParams.d.ts +10 -0
- package/dist/typescript/module/lib/common/MutatableParams.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/ReferenceBase.d.ts +12 -0
- package/dist/typescript/module/lib/common/ReferenceBase.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/deeps.d.ts +19 -0
- package/dist/typescript/module/lib/common/deeps.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/id.d.ts +12 -0
- package/dist/typescript/module/lib/common/id.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/index.d.ts +33 -0
- package/dist/typescript/module/lib/common/index.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/path.d.ts +51 -0
- package/dist/typescript/module/lib/common/path.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/promise.d.ts +12 -0
- package/dist/typescript/module/lib/common/promise.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/serialize.d.ts +4 -0
- package/dist/typescript/module/lib/common/serialize.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/unitTestUtils.d.ts +4 -0
- package/dist/typescript/module/lib/common/unitTestUtils.d.ts.map +1 -0
- package/dist/typescript/module/lib/common/validate.d.ts +100 -0
- package/dist/typescript/module/lib/common/validate.d.ts.map +1 -0
- package/dist/typescript/module/lib/index.d.ts +4 -0
- package/dist/typescript/module/lib/index.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/FirebaseModule.d.ts +17 -0
- package/dist/typescript/module/lib/internal/FirebaseModule.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/NativeFirebaseError.d.ts +20 -0
- package/dist/typescript/module/lib/internal/NativeFirebaseError.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/NativeModules.d.ts +83 -0
- package/dist/typescript/module/lib/internal/NativeModules.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/RNFBNativeEventEmitter.d.ts +13 -0
- package/dist/typescript/module/lib/internal/RNFBNativeEventEmitter.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/SharedEventEmitter.d.ts +4 -0
- package/dist/typescript/module/lib/internal/SharedEventEmitter.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/asyncStorage.d.ts +10 -0
- package/dist/typescript/module/lib/internal/asyncStorage.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/constants.d.ts +5 -0
- package/dist/typescript/module/lib/internal/constants.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/index.d.ts +12 -0
- package/dist/typescript/module/lib/internal/index.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/logger.d.ts +83 -0
- package/dist/typescript/module/lib/internal/logger.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/nativeModule.android.d.ts +3 -0
- package/dist/typescript/module/lib/internal/nativeModule.android.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/nativeModule.d.ts +3 -0
- package/dist/typescript/module/lib/internal/nativeModule.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/nativeModule.ios.d.ts +3 -0
- package/dist/typescript/module/lib/internal/nativeModule.ios.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/nativeModuleAndroidIos.d.ts +10 -0
- package/dist/typescript/module/lib/internal/nativeModuleAndroidIos.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/nativeModuleWeb.d.ts +3 -0
- package/dist/typescript/module/lib/internal/nativeModuleWeb.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/nullSerialization.d.ts +16 -0
- package/dist/typescript/module/lib/internal/nullSerialization.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/registry/app.d.ts +47 -0
- package/dist/typescript/module/lib/internal/registry/app.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/registry/namespace.d.ts +26 -0
- package/dist/typescript/module/lib/internal/registry/namespace.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/registry/nativeModule.d.ts +17 -0
- package/dist/typescript/module/lib/internal/registry/nativeModule.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/RNFBAppModule.d.ts +139 -0
- package/dist/typescript/module/lib/internal/web/RNFBAppModule.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseApp.d.ts +2 -0
- package/dist/typescript/module/lib/internal/web/firebaseApp.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseAppCheck.d.ts +5 -0
- package/dist/typescript/module/lib/internal/web/firebaseAppCheck.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseAuth.d.ts +3 -0
- package/dist/typescript/module/lib/internal/web/firebaseAuth.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseDatabase.d.ts +3 -0
- package/dist/typescript/module/lib/internal/web/firebaseDatabase.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseFirestore.d.ts +3 -0
- package/dist/typescript/module/lib/internal/web/firebaseFirestore.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseFunctions.d.ts +3 -0
- package/dist/typescript/module/lib/internal/web/firebaseFunctions.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseInstallations.d.ts +5 -0
- package/dist/typescript/module/lib/internal/web/firebaseInstallations.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseRemoteConfig.d.ts +5 -0
- package/dist/typescript/module/lib/internal/web/firebaseRemoteConfig.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/firebaseStorage.d.ts +3 -0
- package/dist/typescript/module/lib/internal/web/firebaseStorage.d.ts.map +1 -0
- package/dist/typescript/module/lib/internal/web/utils.d.ts +13 -0
- package/dist/typescript/module/lib/internal/web/utils.d.ts.map +1 -0
- package/dist/typescript/module/lib/modular.d.ts +95 -0
- package/dist/typescript/module/lib/modular.d.ts.map +1 -0
- package/dist/typescript/module/lib/namespaced.d.ts +5 -0
- package/dist/typescript/module/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/module/lib/types/app.d.ts +561 -0
- package/dist/typescript/module/lib/types/app.d.ts.map +1 -0
- package/dist/typescript/module/lib/types/internal.d.ts +101 -0
- package/dist/typescript/module/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/module/lib/utils/UtilsStatics.d.ts +4 -0
- package/dist/typescript/module/lib/utils/UtilsStatics.d.ts.map +1 -0
- package/dist/typescript/module/lib/utils/index.d.ts +4 -0
- package/dist/typescript/module/lib/utils/index.d.ts.map +1 -0
- package/dist/typescript/module/lib/version.d.ts +2 -0
- package/dist/typescript/module/lib/version.d.ts.map +1 -0
- package/dist/typescript/module/package.json +1 -0
- package/ios/RNFBApp/RNFBNullSentinelInterceptor.h +47 -0
- package/ios/RNFBApp/RNFBNullSentinelInterceptor.m +74 -0
- package/ios/RNFBApp/RNFBSharedUtils.h +2 -0
- package/ios/RNFBApp/RNFBSharedUtils.m +118 -0
- package/ios/RNFBApp/RNFBVersion.m +1 -1
- package/ios/RNFBApp.xcodeproj/project.pbxproj +6 -0
- package/lib/FirebaseApp.ts +98 -0
- package/lib/common/{Base64.js → Base64.ts} +19 -11
- package/lib/common/MutatableParams.ts +50 -0
- package/lib/common/ReferenceBase.ts +45 -0
- package/lib/common/deeps.ts +92 -0
- package/lib/common/id.ts +91 -0
- package/lib/common/{index.js → index.ts} +60 -38
- package/lib/common/path.ts +124 -0
- package/lib/common/promise.ts +68 -0
- package/lib/common/{serialize.js → serialize.ts} +3 -2
- package/lib/common/unitTestUtils.ts +5 -4
- package/lib/common/validate.ts +232 -0
- package/lib/index.ts +27 -0
- package/lib/internal/FirebaseModule.ts +78 -0
- package/lib/internal/NativeFirebaseError.ts +111 -0
- package/lib/internal/NativeModules.ts +116 -0
- package/lib/internal/RNFBNativeEventEmitter.ts +139 -0
- package/lib/internal/asyncStorage.ts +76 -0
- package/lib/internal/{constants.js → constants.ts} +3 -1
- package/lib/internal/global.d.ts +33 -0
- package/lib/internal/{index.js → index.ts} +2 -0
- package/lib/internal/logger.ts +270 -0
- package/lib/internal/nativeModuleAndroidIos.ts +55 -0
- package/lib/internal/nativeModuleWeb.ts +60 -0
- package/lib/internal/nullSerialization.ts +186 -0
- package/lib/internal/registry/app.ts +278 -0
- package/lib/internal/registry/{namespace.js → namespace.ts} +93 -54
- package/lib/internal/registry/nativeModule.ts +282 -0
- package/lib/internal/web/RNFBAppModule.ts +318 -0
- package/lib/internal/web/firebaseApp.ts +20 -0
- package/lib/internal/web/firebaseAppCheck.ts +23 -0
- package/lib/internal/web/firebaseAuth.ts +21 -0
- package/lib/internal/web/firebaseDatabase.ts +21 -0
- package/lib/internal/web/firebaseFirestore.ts +21 -0
- package/lib/internal/web/firebaseFunctions.ts +21 -0
- package/lib/internal/web/firebaseInstallations.ts +23 -0
- package/lib/internal/web/firebaseRemoteConfig.ts +23 -0
- package/lib/internal/web/firebaseStorage.ts +21 -0
- package/lib/internal/web/memidb/index.d.ts +21 -0
- package/lib/internal/web/memidb/lib/errors.js +17 -0
- package/lib/internal/web/utils.ts +57 -0
- package/lib/modular.ts +219 -0
- package/lib/{index.js → namespaced.ts} +2 -2
- package/lib/{index.d.ts → types/app.ts} +81 -40
- package/lib/types/internal.ts +142 -0
- package/lib/utils/{UtilsStatics.js → UtilsStatics.ts} +20 -12
- package/lib/utils/index.ts +94 -0
- package/lib/version.ts +2 -0
- package/package.json +99 -9
- package/tsconfig.json +10 -0
- package/lib/internal/asyncStorage.js +0 -47
- package/lib/internal/logger.d.ts +0 -85
- package/lib/internal/nativeModuleAndroidIos.js +0 -45
- package/lib/internal/nativeModuleWeb.js +0 -49
- package/lib/internal/web/firebaseApp.js +0 -3
- package/lib/internal/web/firebaseAuth.js +0 -4
- package/lib/internal/web/firebaseDatabase.js +0 -4
- package/lib/internal/web/firebaseFirestore.js +0 -4
- package/lib/internal/web/firebaseFunctions.js +0 -4
- package/lib/internal/web/firebaseStorage.js +0 -4
- package/lib/modular/index.d.ts +0 -131
- package/lib/modular/index.js +0 -150
- package/lib/version.js +0 -2
- /package/lib/internal/{SharedEventEmitter.js → SharedEventEmitter.ts} +0 -0
- /package/lib/internal/{nativeModule.android.js → nativeModule.android.ts} +0 -0
- /package/lib/internal/{nativeModule.ios.js → nativeModule.ios.ts} +0 -0
- /package/lib/internal/{nativeModule.js → nativeModule.ts} +0 -0
package/lib/common/id.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
19
|
+
|
|
20
|
+
const AUTO_ID_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
21
|
+
|
|
22
|
+
// timestamp of last push, used to prevent local collisions if you push twice in one ms.
|
|
23
|
+
let lastPushTime = 0;
|
|
24
|
+
|
|
25
|
+
// we generate 72-bits of randomness which get turned into 12 characters and appended to the
|
|
26
|
+
// timestamp to prevent collisions with other clients. We store the last characters we
|
|
27
|
+
// generated because in the event of a collision, we'll use those same characters except
|
|
28
|
+
// "incremented" by one.
|
|
29
|
+
const lastRandChars: number[] = [];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Generate a firebase id - for use with ref().push(val, cb) - e.g. -KXMr7k2tXUFQqiaZRY4'
|
|
33
|
+
* @param serverTimeOffset - pass in server time offset from native side
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
export function generateDatabaseId(serverTimeOffset: number = 0): string {
|
|
37
|
+
const timeStampChars = new Array(8);
|
|
38
|
+
let now = new Date().getTime() + serverTimeOffset;
|
|
39
|
+
const duplicateTime = now === lastPushTime;
|
|
40
|
+
|
|
41
|
+
lastPushTime = now;
|
|
42
|
+
|
|
43
|
+
for (let i = 7; i >= 0; i -= 1) {
|
|
44
|
+
timeStampChars[i] = PUSH_CHARS.charAt(now % 64);
|
|
45
|
+
now = Math.floor(now / 64);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (now !== 0) {
|
|
49
|
+
throw new Error('We should have converted the entire timestamp.');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let id = timeStampChars.join('');
|
|
53
|
+
|
|
54
|
+
if (!duplicateTime) {
|
|
55
|
+
for (let i = 0; i < 12; i += 1) {
|
|
56
|
+
lastRandChars[i] = Math.floor(Math.random() * 64);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
// if the timestamp hasn't changed since last push,
|
|
60
|
+
// use the same random number, but increment it by 1.
|
|
61
|
+
let i;
|
|
62
|
+
for (i = 11; i >= 0 && lastRandChars[i] === 63; i -= 1) {
|
|
63
|
+
lastRandChars[i] = 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
lastRandChars[i]! += 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
for (let i = 0; i < 12; i++) {
|
|
70
|
+
id += PUSH_CHARS.charAt(lastRandChars[i]!);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (id.length !== 20) {
|
|
74
|
+
throw new Error('Length should be 20.');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return id;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Generate a firestore auto id for use with collection/document .add()
|
|
82
|
+
* @return {string}
|
|
83
|
+
*/
|
|
84
|
+
export function generateFirestoreId(): string {
|
|
85
|
+
let autoId = '';
|
|
86
|
+
|
|
87
|
+
for (let i = 0; i < 20; i++) {
|
|
88
|
+
autoId += AUTO_ID_CHARS.charAt(Math.floor(Math.random() * AUTO_ID_CHARS.length));
|
|
89
|
+
}
|
|
90
|
+
return autoId;
|
|
91
|
+
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { Platform } from 'react-native';
|
|
18
18
|
import Base64 from './Base64';
|
|
19
19
|
import { isFunction, isObject, isString } from './validate';
|
|
20
|
+
import type { DataUrlParts, Observer } from '../types/internal';
|
|
20
21
|
|
|
21
22
|
export * from './id';
|
|
22
23
|
export * from './path';
|
|
@@ -26,7 +27,9 @@ export * from './validate';
|
|
|
26
27
|
export { default as Base64 } from './Base64';
|
|
27
28
|
export { default as ReferenceBase } from './ReferenceBase';
|
|
28
29
|
|
|
29
|
-
export
|
|
30
|
+
export type { DataUrlParts, Observer };
|
|
31
|
+
|
|
32
|
+
export function getDataUrlParts(dataUrlString: string): DataUrlParts {
|
|
30
33
|
const isBase64 = dataUrlString.includes(';base64');
|
|
31
34
|
let [mediaType, base64String] = dataUrlString.split(',');
|
|
32
35
|
if (!mediaType || !base64String) {
|
|
@@ -42,11 +45,14 @@ export function getDataUrlParts(dataUrlString) {
|
|
|
42
45
|
return { base64String, mediaType };
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
export function once(
|
|
46
|
-
|
|
48
|
+
export function once<T extends (...args: any[]) => any>(
|
|
49
|
+
fn: T,
|
|
50
|
+
context?: any,
|
|
51
|
+
): (...args: Parameters<T>) => ReturnType<T> {
|
|
52
|
+
let onceResult: ReturnType<T>;
|
|
47
53
|
let ranOnce = false;
|
|
48
54
|
|
|
49
|
-
return function onceInner(...args) {
|
|
55
|
+
return function onceInner(this: any, ...args: Parameters<T>): ReturnType<T> {
|
|
50
56
|
if (!ranOnce) {
|
|
51
57
|
ranOnce = true;
|
|
52
58
|
onceResult = fn.apply(context || this, args);
|
|
@@ -56,7 +62,7 @@ export function once(fn, context) {
|
|
|
56
62
|
};
|
|
57
63
|
}
|
|
58
64
|
|
|
59
|
-
export function isError(value) {
|
|
65
|
+
export function isError(value: any): value is Error {
|
|
60
66
|
if (Object.prototype.toString.call(value) === '[object Error]') {
|
|
61
67
|
return true;
|
|
62
68
|
}
|
|
@@ -64,7 +70,7 @@ export function isError(value) {
|
|
|
64
70
|
return value instanceof Error;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
|
-
export function hasOwnProperty(target, property) {
|
|
73
|
+
export function hasOwnProperty(target: object, property: string | symbol): boolean {
|
|
68
74
|
return Object.hasOwnProperty.call(target, property);
|
|
69
75
|
}
|
|
70
76
|
|
|
@@ -74,7 +80,7 @@ export function hasOwnProperty(target, property) {
|
|
|
74
80
|
* @param string
|
|
75
81
|
* @returns {*}
|
|
76
82
|
*/
|
|
77
|
-
export function stripTrailingSlash(string) {
|
|
83
|
+
export function stripTrailingSlash(string: any): any {
|
|
78
84
|
if (!isString(string)) {
|
|
79
85
|
return string;
|
|
80
86
|
}
|
|
@@ -87,7 +93,7 @@ export const isAndroid = Platform.OS === 'android';
|
|
|
87
93
|
|
|
88
94
|
export const isOther = Platform.OS !== 'ios' && Platform.OS !== 'android';
|
|
89
95
|
|
|
90
|
-
export function tryJSONParse(string) {
|
|
96
|
+
export function tryJSONParse(string: string | null | undefined): any {
|
|
91
97
|
try {
|
|
92
98
|
return string && JSON.parse(string);
|
|
93
99
|
} catch (_) {
|
|
@@ -95,7 +101,7 @@ export function tryJSONParse(string) {
|
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
103
|
|
|
98
|
-
export function tryJSONStringify(data) {
|
|
104
|
+
export function tryJSONStringify(data: any): string | null {
|
|
99
105
|
try {
|
|
100
106
|
return JSON.stringify(data);
|
|
101
107
|
} catch (_) {
|
|
@@ -103,14 +109,17 @@ export function tryJSONStringify(data) {
|
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
|
|
106
|
-
export function parseListenerOrObserver(
|
|
112
|
+
export function parseListenerOrObserver<T>(
|
|
113
|
+
listenerOrObserver: ((value: T) => void) | Observer<T>,
|
|
114
|
+
): (value: T) => void {
|
|
107
115
|
if (!isFunction(listenerOrObserver) && !isObject(listenerOrObserver)) {
|
|
116
|
+
throw new Error("'listenerOrObserver' expected a function or an object with 'next' function.");
|
|
108
117
|
}
|
|
109
118
|
if (isFunction(listenerOrObserver)) {
|
|
110
119
|
return listenerOrObserver;
|
|
111
120
|
}
|
|
112
|
-
if (isObject(listenerOrObserver) && isFunction(listenerOrObserver.next)) {
|
|
113
|
-
return listenerOrObserver.next
|
|
121
|
+
if (isObject(listenerOrObserver) && isFunction((listenerOrObserver as Observer<T>).next)) {
|
|
122
|
+
return (listenerOrObserver as Observer<T>).next!.bind(listenerOrObserver);
|
|
114
123
|
}
|
|
115
124
|
|
|
116
125
|
throw new Error("'listenerOrObserver' expected a function or an object with 'next' function.");
|
|
@@ -119,7 +128,11 @@ export function parseListenerOrObserver(listenerOrObserver) {
|
|
|
119
128
|
// Used to indicate if there is no corresponding modular function
|
|
120
129
|
const NO_REPLACEMENT = true;
|
|
121
130
|
|
|
122
|
-
|
|
131
|
+
type MethodMap = Record<string, string | typeof NO_REPLACEMENT>;
|
|
132
|
+
type InstanceMap = Record<string, MethodMap>;
|
|
133
|
+
type DeprecationMap = Record<string, InstanceMap>;
|
|
134
|
+
|
|
135
|
+
const mapOfDeprecationReplacements: DeprecationMap = {
|
|
123
136
|
analytics: {
|
|
124
137
|
default: {
|
|
125
138
|
logEvent: 'logEvent()',
|
|
@@ -523,12 +536,17 @@ const modularDeprecationMessage =
|
|
|
523
536
|
'This method is deprecated (as well as all React Native Firebase namespaced API) and will be removed in the next major release ' +
|
|
524
537
|
'as part of move to match Firebase Web modular SDK API. Please see migration guide for more details: https://rnfirebase.io/migrating-to-v22';
|
|
525
538
|
|
|
526
|
-
export function deprecationConsoleWarning(
|
|
539
|
+
export function deprecationConsoleWarning(
|
|
540
|
+
nameSpace: string,
|
|
541
|
+
methodName: string,
|
|
542
|
+
instanceName: string,
|
|
543
|
+
isModularMethod: boolean,
|
|
544
|
+
): void {
|
|
527
545
|
if (!isModularMethod) {
|
|
528
546
|
const moduleMap = mapOfDeprecationReplacements[nameSpace];
|
|
529
547
|
if (moduleMap) {
|
|
530
548
|
const instanceMap = moduleMap[instanceName];
|
|
531
|
-
const deprecatedMethod = instanceMap[methodName];
|
|
549
|
+
const deprecatedMethod = instanceMap?.[methodName];
|
|
532
550
|
if (instanceMap && deprecatedMethod) {
|
|
533
551
|
if (!globalThis.RNFB_SILENCE_MODULAR_DEPRECATION_WARNINGS) {
|
|
534
552
|
// eslint-disable-next-line no-console
|
|
@@ -544,11 +562,11 @@ export function deprecationConsoleWarning(nameSpace, methodName, instanceName, i
|
|
|
544
562
|
}
|
|
545
563
|
|
|
546
564
|
export function createMessage(
|
|
547
|
-
nameSpace,
|
|
548
|
-
methodName,
|
|
549
|
-
instanceName = 'default',
|
|
550
|
-
uniqueMessage = null,
|
|
551
|
-
) {
|
|
565
|
+
nameSpace: string,
|
|
566
|
+
methodName: string,
|
|
567
|
+
instanceName: string = 'default',
|
|
568
|
+
uniqueMessage: string | null = null,
|
|
569
|
+
): string | undefined {
|
|
552
570
|
if (uniqueMessage) {
|
|
553
571
|
// Unique deprecation message used for testing
|
|
554
572
|
return uniqueMessage;
|
|
@@ -570,9 +588,10 @@ export function createMessage(
|
|
|
570
588
|
}
|
|
571
589
|
}
|
|
572
590
|
}
|
|
591
|
+
return undefined;
|
|
573
592
|
}
|
|
574
593
|
|
|
575
|
-
function getNamespace(target) {
|
|
594
|
+
function getNamespace(target: any): string | undefined {
|
|
576
595
|
if (target.constructor.name === 'DatabaseReference') {
|
|
577
596
|
return 'database';
|
|
578
597
|
}
|
|
@@ -588,13 +607,14 @@ function getNamespace(target) {
|
|
|
588
607
|
}
|
|
589
608
|
const className = target.name ? target.name : target.constructor.name;
|
|
590
609
|
return Object.keys(mapOfDeprecationReplacements).find(key => {
|
|
591
|
-
if (mapOfDeprecationReplacements[key][className]) {
|
|
610
|
+
if (mapOfDeprecationReplacements[key]?.[className]) {
|
|
592
611
|
return key;
|
|
593
612
|
}
|
|
613
|
+
return false;
|
|
594
614
|
});
|
|
595
615
|
}
|
|
596
616
|
|
|
597
|
-
function getInstanceName(target) {
|
|
617
|
+
function getInstanceName(target: any): string {
|
|
598
618
|
if (target.GeoPoint || target.CustomProvider) {
|
|
599
619
|
// target is statics object. GeoPoint - Firestore, CustomProvider - AppCheck
|
|
600
620
|
return 'statics';
|
|
@@ -619,13 +639,13 @@ function getInstanceName(target) {
|
|
|
619
639
|
return target.constructor.name;
|
|
620
640
|
}
|
|
621
641
|
|
|
622
|
-
export function createDeprecationProxy(instance) {
|
|
642
|
+
export function createDeprecationProxy<T extends object>(instance: T): T {
|
|
623
643
|
return new Proxy(instance, {
|
|
624
|
-
construct(target, args) {
|
|
644
|
+
construct(target: any, args: any[]) {
|
|
625
645
|
// needed for Timestamp which we pass as static, when we construct new instance, we need to wrap it in proxy again.
|
|
626
646
|
return createDeprecationProxy(new target(...args));
|
|
627
647
|
},
|
|
628
|
-
get(target, prop, receiver) {
|
|
648
|
+
get(target: any, prop: string | symbol, receiver: any) {
|
|
629
649
|
const originalMethod = target[prop];
|
|
630
650
|
|
|
631
651
|
if (prop === 'constructor') {
|
|
@@ -633,7 +653,7 @@ export function createDeprecationProxy(instance) {
|
|
|
633
653
|
}
|
|
634
654
|
|
|
635
655
|
if (target && target.constructor && target.constructor.name === 'FirestoreTimestamp') {
|
|
636
|
-
deprecationConsoleWarning('firestore', prop, 'FirestoreTimestamp', false);
|
|
656
|
+
deprecationConsoleWarning('firestore', prop as string, 'FirestoreTimestamp', false);
|
|
637
657
|
return Reflect.get(target, prop, receiver);
|
|
638
658
|
}
|
|
639
659
|
|
|
@@ -703,28 +723,30 @@ export function createDeprecationProxy(instance) {
|
|
|
703
723
|
const instanceName = getInstanceName(target);
|
|
704
724
|
const nameSpace = getNamespace(target);
|
|
705
725
|
|
|
706
|
-
if (descriptor.get) {
|
|
726
|
+
if (descriptor.get && nameSpace) {
|
|
707
727
|
// Handle getter - call it and show deprecation warning
|
|
708
|
-
deprecationConsoleWarning(nameSpace, prop, instanceName, _isModularCall);
|
|
728
|
+
deprecationConsoleWarning(nameSpace, prop as string, instanceName, _isModularCall);
|
|
709
729
|
return descriptor.get.call(target);
|
|
710
730
|
}
|
|
711
731
|
|
|
712
|
-
if (descriptor.set) {
|
|
732
|
+
if (descriptor.set && nameSpace) {
|
|
713
733
|
// Handle setter - return a function that calls the setter with deprecation warning
|
|
714
|
-
return function (value) {
|
|
715
|
-
deprecationConsoleWarning(nameSpace, prop, instanceName, _isModularCall);
|
|
716
|
-
descriptor.set
|
|
734
|
+
return function (value: any) {
|
|
735
|
+
deprecationConsoleWarning(nameSpace, prop as string, instanceName, _isModularCall);
|
|
736
|
+
descriptor.set!.call(target, value);
|
|
717
737
|
};
|
|
718
738
|
}
|
|
719
739
|
}
|
|
720
740
|
|
|
721
741
|
if (typeof originalMethod === 'function') {
|
|
722
|
-
return function (...args) {
|
|
742
|
+
return function (...args: any[]) {
|
|
723
743
|
const isModularMethod = args.includes(MODULAR_DEPRECATION_ARG);
|
|
724
744
|
const instanceName = getInstanceName(target);
|
|
725
745
|
const nameSpace = getNamespace(target);
|
|
726
746
|
|
|
727
|
-
|
|
747
|
+
if (nameSpace) {
|
|
748
|
+
deprecationConsoleWarning(nameSpace, prop as string, instanceName, isModularMethod);
|
|
749
|
+
}
|
|
728
750
|
|
|
729
751
|
return originalMethod.apply(target, filterModularArgument(args));
|
|
730
752
|
};
|
|
@@ -739,7 +761,7 @@ export const MODULAR_DEPRECATION_ARG = 'react-native-firebase-modular-method-cal
|
|
|
739
761
|
// Flag to track if we're currently in a modular call
|
|
740
762
|
let _isModularCall = false;
|
|
741
763
|
|
|
742
|
-
export function withModularFlag(fn) {
|
|
764
|
+
export function withModularFlag<T>(fn: () => T): T {
|
|
743
765
|
const previousFlag = _isModularCall;
|
|
744
766
|
_isModularCall = true;
|
|
745
767
|
try {
|
|
@@ -749,11 +771,11 @@ export function withModularFlag(fn) {
|
|
|
749
771
|
}
|
|
750
772
|
}
|
|
751
773
|
|
|
752
|
-
export function filterModularArgument(list) {
|
|
774
|
+
export function filterModularArgument(list: any[]): any[] {
|
|
753
775
|
return list.filter(arg => arg !== MODULAR_DEPRECATION_ARG);
|
|
754
776
|
}
|
|
755
777
|
|
|
756
|
-
export function warnIfNotModularCall(args, replacementMethodName = '') {
|
|
778
|
+
export function warnIfNotModularCall(args: IArguments, replacementMethodName: string = ''): void {
|
|
757
779
|
for (let i = 0; i < args.length; i++) {
|
|
758
780
|
if (args[i] === MODULAR_DEPRECATION_ARG) {
|
|
759
781
|
return;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns the next parent of the path e.g. /foo/bar/car -> /foo/bar
|
|
20
|
+
*/
|
|
21
|
+
export function pathParent(path: string): string | null {
|
|
22
|
+
if (path.length === 0) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const index = path.lastIndexOf('/');
|
|
27
|
+
if (index <= 0) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return path.slice(0, index);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Joins a parent and a child path
|
|
36
|
+
*/
|
|
37
|
+
export function pathChild(path: string, childPath: string): string {
|
|
38
|
+
const canonicalChildPath = pathPieces(childPath).join('/');
|
|
39
|
+
|
|
40
|
+
if (path.length === 0) {
|
|
41
|
+
return canonicalChildPath;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return `${path}/${canonicalChildPath}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns the last component of a path, e.g /foo/bar.jpeg -> bar.jpeg
|
|
49
|
+
*/
|
|
50
|
+
export function pathLastComponent(path: string): string {
|
|
51
|
+
const index = path.lastIndexOf('/', path.length - 2);
|
|
52
|
+
if (index === -1) {
|
|
53
|
+
return path;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return path.slice(index + 1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Returns all none empty pieces of the path
|
|
61
|
+
* @param path
|
|
62
|
+
* @returns {*}
|
|
63
|
+
*/
|
|
64
|
+
export function pathPieces(path: string): string[] {
|
|
65
|
+
return path.split('/').filter($ => $.length > 0);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns whether a given path is empty
|
|
70
|
+
* @param path
|
|
71
|
+
* @returns {boolean}
|
|
72
|
+
*/
|
|
73
|
+
export function pathIsEmpty(path: string): boolean {
|
|
74
|
+
return !pathPieces(path).length;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Converts a given path to a URL encoded string
|
|
79
|
+
* @param path
|
|
80
|
+
* @returns {string|string}
|
|
81
|
+
*/
|
|
82
|
+
export function pathToUrlEncodedString(path: string): string {
|
|
83
|
+
const pieces = pathPieces(path);
|
|
84
|
+
let pathString = '';
|
|
85
|
+
for (let i = 0; i < pieces.length; i++) {
|
|
86
|
+
pathString += `/${encodeURIComponent(String(pieces[i]))}`;
|
|
87
|
+
}
|
|
88
|
+
return pathString || '/';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const INVALID_PATH_REGEX = /[[\].#$\u0000-\u001F\u007F]/;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Ensures a given path is a valid Firebase path
|
|
95
|
+
* @param path
|
|
96
|
+
* @returns {boolean}
|
|
97
|
+
*/
|
|
98
|
+
export function isValidPath(path: unknown): boolean {
|
|
99
|
+
return typeof path === 'string' && path.length !== 0 && !INVALID_PATH_REGEX.test(path);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const INVALID_KEY_REGEX = /[\[\].#$\/\u0000-\u001F\u007F]/;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Ensures a given key is a valid Firebase key
|
|
106
|
+
* @param key
|
|
107
|
+
* @returns {boolean}
|
|
108
|
+
*/
|
|
109
|
+
export function isValidKey(key: unknown): boolean {
|
|
110
|
+
return typeof key === 'string' && key.length !== 0 && !INVALID_KEY_REGEX.test(key);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Converts a file path to a standardized string path
|
|
115
|
+
* @param path
|
|
116
|
+
* @returns {*}
|
|
117
|
+
*/
|
|
118
|
+
export function toFilePath(path: string): string {
|
|
119
|
+
let _filePath = path.replace('file://', '');
|
|
120
|
+
if (_filePath.includes('%')) {
|
|
121
|
+
_filePath = decodeURIComponent(_filePath);
|
|
122
|
+
}
|
|
123
|
+
return _filePath;
|
|
124
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { isFunction } from './validate';
|
|
19
|
+
import type { Deferred, Callback } from '../types/internal';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a deferred promise
|
|
23
|
+
*/
|
|
24
|
+
export function promiseDefer<T = void>(): Deferred<T> {
|
|
25
|
+
const deferred: Deferred<T> = {
|
|
26
|
+
promise: null as unknown as Promise<T>,
|
|
27
|
+
resolve: null,
|
|
28
|
+
reject: null,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
deferred.promise = new Promise<T>((resolve, reject) => {
|
|
32
|
+
deferred.resolve = resolve;
|
|
33
|
+
deferred.reject = reject;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return deferred;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Attaches an optional callback to a promise
|
|
41
|
+
* @param promise
|
|
42
|
+
* @param callback
|
|
43
|
+
*/
|
|
44
|
+
export function promiseWithOptionalCallback<T>(
|
|
45
|
+
promise: Promise<T>,
|
|
46
|
+
callback?: Callback<T>,
|
|
47
|
+
): Promise<T> {
|
|
48
|
+
if (!isFunction(callback)) {
|
|
49
|
+
return promise;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return promise
|
|
53
|
+
.then(result => {
|
|
54
|
+
if (callback && callback.length === 1) {
|
|
55
|
+
(callback as (error: Error | null) => void)(null);
|
|
56
|
+
} else if (callback) {
|
|
57
|
+
(callback as (error: Error | null, result?: T) => void)(null, result);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return result;
|
|
61
|
+
})
|
|
62
|
+
.catch(error => {
|
|
63
|
+
if (callback) {
|
|
64
|
+
callback(error);
|
|
65
|
+
}
|
|
66
|
+
return Promise.reject(error);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
import { tryJSONParse, tryJSONStringify } from './index';
|
|
19
19
|
import { isObject } from './validate';
|
|
20
|
+
import type { SerializedValue } from '../types/internal';
|
|
20
21
|
|
|
21
|
-
export function serializeType(value) {
|
|
22
|
+
export function serializeType(value: any): SerializedValue {
|
|
22
23
|
if (isObject(value)) {
|
|
23
24
|
return {
|
|
24
25
|
type: 'object',
|
|
@@ -32,7 +33,7 @@ export function serializeType(value) {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export function serializeObject(object) {
|
|
36
|
+
export function serializeObject(object: any): any {
|
|
36
37
|
if (!isObject(object)) {
|
|
37
38
|
return object;
|
|
38
39
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { expect, jest } from '@jest/globals';
|
|
3
2
|
import { createMessage } from './index';
|
|
4
3
|
|
|
@@ -28,10 +27,10 @@ export const createCheckV9Deprecation = (moduleNames: string[]): CheckV9Deprecat
|
|
|
28
27
|
modularFunction: () => void,
|
|
29
28
|
nonModularFunction: () => void,
|
|
30
29
|
methodNameKey: string,
|
|
31
|
-
uniqueMessage
|
|
30
|
+
uniqueMessage?: string | null,
|
|
32
31
|
checkFirebaseAppDeprecationWarning: boolean = false,
|
|
33
32
|
) => {
|
|
34
|
-
const moduleName = moduleNames[0]; // firestore, database, etc
|
|
33
|
+
const moduleName = moduleNames[0] as string; // firestore, database, etc
|
|
35
34
|
const instanceName = moduleNames[1] || 'default'; // default, FirestoreCollectionReference, etc
|
|
36
35
|
const consoleWarnSpy = jest.spyOn(console, 'warn');
|
|
37
36
|
consoleWarnSpy.mockReset();
|
|
@@ -53,7 +52,9 @@ export const createCheckV9Deprecation = (moduleNames: string[]): CheckV9Deprecat
|
|
|
53
52
|
consoleWarnSpy.mockRestore();
|
|
54
53
|
const consoleWarnSpy2 = jest.spyOn(console, 'warn').mockImplementation(warnMessage => {
|
|
55
54
|
const message = createMessage(moduleName, methodNameKey, instanceName, uniqueMessage);
|
|
56
|
-
|
|
55
|
+
if (message) {
|
|
56
|
+
expect(warnMessage).toMatch(message);
|
|
57
|
+
}
|
|
57
58
|
});
|
|
58
59
|
nonModularFunction();
|
|
59
60
|
|