Skip to content

Commit

Permalink
Tighten the typing in the Firebase Performance package (#2402)
Browse files Browse the repository at this point in the history
* Tighten the typings on Firebase Performance SDK

* run yarn run v1.21.0
$ prettier --config .prettierrc --write '**/*.{ts,js}'
config/.eslintrc.js 70ms
config/functions/index.js 47ms
config/karma.base.js 29ms
config/karma.saucelabs.js 42ms
config/webpack.test.js 18ms
integration/browserify/karma.conf.js 10ms
integration/browserify/src/namespace.test.js 7ms
integration/firebase-typings/index.submodules.ts 217ms
integration/firebase-typings/index.ts 9ms
integration/firestore/gulpfile.js 19ms
integration/firestore/karma.conf.js 11ms
integration/messaging/download-browsers.js 9ms
integration/messaging/manual-test-server.js 6ms
integration/messaging/test/static/app.js 23ms
integration/messaging/test/static/firebase-messaging-sw.js 9ms
integration/messaging/test/static/sw-shared.js 5ms
integration/messaging/test/static/valid-no-vapid-key/firebaseConfig.js 8ms
integration/messaging/test/static/valid-no-vapid-key/sw.js 7ms
integration/messaging/test/static/valid-vapid-key/firebaseConfig.js 7ms
integration/messaging/test/static/valid-vapid-key/sw.js 6ms
integration/messaging/test/test-default-sw.js 15ms
integration/messaging/test/test-deleteToken.js 19ms
integration/messaging/test/test-send.js 40ms
integration/messaging/test/test-updateToken.js 14ms
integration/messaging/test/test-valid-manifest.js 10ms
integration/messaging/test/utils/deleteFCMToken.js 7ms
integration/messaging/test/utils/getDemoSetup.js 6ms
integration/messaging/test/utils/getErrors.js 6ms
integration/messaging/test/utils/getFCMToken.js 6ms
integration/messaging/test/utils/getReceivedMessages.js 8ms
integration/messaging/test/utils/makeFCMAPICall.js 8ms
integration/messaging/test/utils/retrieveFCMToken.js 6ms
integration/messaging/test/utils/setupNotificationPermission.js 9ms
integration/messaging/test/utils/test-server.js 11ms
integration/messaging/test/utils/timeForward.js 6ms
integration/shared/validator.js 14ms
integration/typescript/karma.conf.js 7ms
integration/typescript/test/namespace.test.ts 10ms
integration/typescript/test/typings.d.ts 9ms
integration/webpack/karma.conf.js 7ms
integration/webpack/src/namespace.test.js 6ms
integration/webpack/webpack.config.js 5ms
packages/analytics-interop-types/index.d.ts 11ms
packages/analytics-types/index.d.ts 26ms
packages/analytics/.eslintrc.js 5ms
packages/analytics/index.test.ts 40ms
packages/analytics/index.ts 19ms
packages/analytics/karma.conf.js 6ms
packages/analytics/rollup.config.js 10ms
packages/analytics/src/constants.ts 8ms
packages/analytics/src/errors.ts 8ms
packages/analytics/src/factory.ts 21ms
packages/analytics/src/functions.test.ts 30ms
packages/analytics/src/functions.ts 18ms
packages/analytics/src/helpers.test.ts 95ms
packages/analytics/src/helpers.ts 30ms
packages/analytics/testing/get-fake-firebase-services.ts 10ms
packages/analytics/testing/gtag-script-util.ts 6ms
packages/analytics/testing/setup.ts 5ms
packages/app-types/index.d.ts 10ms
packages/app-types/private.d.ts 16ms
packages/app/.eslintrc.js 5ms
packages/app/index.lite.ts 5ms
packages/app/index.node.ts 6ms
packages/app/index.rn.ts 6ms
packages/app/index.ts 9ms
packages/app/karma.conf.js 6ms
packages/app/rollup.config.js 14ms
packages/app/src/constants.ts 11ms
packages/app/src/errors.ts 10ms
packages/app/src/firebaseApp.ts 22ms
packages/app/src/firebaseNamespace.ts 8ms
packages/app/src/firebaseNamespaceCore.ts 32ms
packages/app/src/lite/firebaseAppLite.ts 22ms
packages/app/src/lite/firebaseNamespaceLite.ts 9ms
packages/app/src/logger.ts 6ms
packages/app/src/platformLoggerService.ts 8ms
packages/app/src/registerCoreComponents.ts 6ms
packages/app/test/firebaseApp.test.ts 72ms
packages/app/test/platformLogger.test.ts 24ms
packages/app/test/setup.ts 10ms
packages/auth-interop-types/index.d.ts 7ms
packages/auth-types/index.d.ts 54ms
packages/component/.eslintrc.js 5ms
packages/component/index.ts 5ms
packages/component/karma.conf.js 6ms
packages/component/rollup.config.js 8ms
packages/component/src/component_container.test.ts 17ms
packages/component/src/component_container.ts 11ms
packages/component/src/component.ts 8ms
packages/component/src/constants.ts 4ms
packages/component/src/provider.test.ts 60ms
packages/component/src/provider.ts 23ms
packages/component/src/types.ts 7ms
packages/component/test/setup.ts 5ms
packages/component/test/util.ts 8ms
packages/database-types/index.d.ts 18ms
packages/database/index.node.ts 12ms
packages/database/index.ts 10ms
packages/database/karma.conf.js 6ms
packages/database/rollup.config.js 9ms
packages/database/src/api/Database.ts 17ms
packages/database/src/api/DataSnapshot.ts 16ms
packages/database/src/api/internal.ts 8ms
packages/database/src/api/onDisconnect.ts 16ms
packages/database/src/api/Query.ts 64ms
packages/database/src/api/Reference.ts 44ms
packages/database/src/api/test_access.ts 9ms
packages/database/src/api/TransactionResult.ts 6ms
packages/database/src/core/AuthTokenProvider.ts 13ms
packages/database/src/core/CompoundWrite.ts 18ms
packages/database/src/core/operation/AckUserWrite.ts 11ms
packages/database/src/core/operation/ListenComplete.ts 6ms
packages/database/src/core/operation/Merge.ts 10ms
packages/database/src/core/operation/Operation.ts 9ms
packages/database/src/core/operation/Overwrite.ts 7ms
packages/database/src/core/PersistentConnection.ts 141ms
packages/database/src/core/ReadonlyRestClient.ts 40ms
packages/database/src/core/Repo_transaction.ts 66ms
packages/database/src/core/Repo.ts 67ms
packages/database/src/core/RepoInfo.ts 14ms
packages/database/src/core/RepoManager.ts 14ms
packages/database/src/core/ServerActions.ts 12ms
packages/database/src/core/snap/ChildrenNode.ts 55ms
packages/database/src/core/snap/childSet.ts 24ms
packages/database/src/core/snap/comparators.ts 5ms
packages/database/src/core/snap/indexes/Index.ts 8ms
packages/database/src/core/snap/indexes/KeyIndex.ts 9ms
packages/database/src/core/snap/indexes/PathIndex.ts 10ms
packages/database/src/core/snap/indexes/PriorityIndex.ts 10ms
packages/database/src/core/snap/indexes/ValueIndex.ts 8ms
packages/database/src/core/snap/IndexMap.ts 22ms
packages/database/src/core/snap/LeafNode.ts 19ms
packages/database/src/core/snap/Node.ts 10ms
packages/database/src/core/snap/nodeFromJSON.ts 16ms
packages/database/src/core/snap/snap.ts 8ms
packages/database/src/core/SnapshotHolder.ts 5ms
packages/database/src/core/SparseSnapshotTree.ts 14ms
packages/database/src/core/stats/StatsCollection.ts 5ms
packages/database/src/core/stats/StatsListener.ts 6ms
packages/database/src/core/stats/StatsManager.ts 6ms
packages/database/src/core/stats/StatsReporter.ts 8ms
packages/database/src/core/storage/DOMStorageWrapper.ts 9ms
packages/database/src/core/storage/MemoryStorage.ts 5ms
packages/database/src/core/storage/storage.ts 7ms
packages/database/src/core/SyncPoint.ts 19ms
packages/database/src/core/SyncTree.ts 76ms
packages/database/src/core/util/EventEmitter.ts 16ms
packages/database/src/core/util/ImmutableTree.ts 42ms
packages/database/src/core/util/libs/parser.ts 21ms
packages/database/src/core/util/NextPushId.ts 14ms
packages/database/src/core/util/OnlineMonitor.ts 13ms
packages/database/src/core/util/Path.ts 33ms
packages/database/src/core/util/ServerValues.ts 19ms
packages/database/src/core/util/SortedMap.ts 82ms
packages/database/src/core/util/Tree.ts 25ms
packages/database/src/core/util/util.ts 53ms
packages/database/src/core/util/validation.ts 37ms
packages/database/src/core/util/VisibilityMonitor.ts 10ms
packages/database/src/core/version.ts 5ms
packages/database/src/core/view/CacheNode.ts 7ms
packages/database/src/core/view/Change.ts 11ms
packages/database/src/core/view/ChildChangeAccumulator.ts 13ms
packages/database/src/core/view/CompleteChildSource.ts 10ms
packages/database/src/core/view/Event.ts 11ms
packages/database/src/core/view/EventGenerator.ts 13ms
packages/database/src/core/view/EventQueue.ts 20ms
packages/database/src/core/view/EventRegistration.ts 23ms
packages/database/src/core/view/filter/IndexedFilter.ts 27ms
packages/database/src/core/view/filter/LimitedFilter.ts 42ms
packages/database/src/core/view/filter/NodeFilter.ts 9ms
packages/database/src/core/view/filter/RangedFilter.ts 20ms
packages/database/src/core/view/QueryParams.ts 62ms
packages/database/src/core/view/View.ts 27ms
packages/database/src/core/view/ViewCache.ts 10ms
packages/database/src/core/view/ViewProcessor.ts 57ms
packages/database/src/core/WriteTree.ts 44ms
packages/database/src/realtime/BrowserPollConnection.ts 48ms
packages/database/src/realtime/Connection.ts 44ms
packages/database/src/realtime/Constants.ts 6ms
packages/database/src/realtime/polling/PacketReceiver.ts 9ms
packages/database/src/realtime/Transport.ts 9ms
packages/database/src/realtime/TransportManager.ts 8ms
packages/database/src/realtime/WebSocketConnection.ts 29ms
packages/database/test/browser/crawler_support.test.ts 27ms
packages/database/test/compound_write.test.ts 54ms
packages/database/test/connection.test.ts 8ms
packages/database/test/database.test.ts 23ms
packages/database/test/datasnapshot.test.ts 50ms
packages/database/test/helpers/EventAccumulator.ts 8ms
packages/database/test/helpers/events.ts 21ms
packages/database/test/helpers/util.ts 22ms
packages/database/test/info.test.ts 21ms
packages/database/test/node.test.ts 43ms
packages/database/test/order_by.test.ts 40ms
packages/database/test/order.test.ts 57ms
packages/database/test/path.test.ts 14ms
packages/database/test/promise.test.ts 31ms
packages/database/test/query.test.ts 443ms
packages/database/test/repoinfo.test.ts 38ms
packages/database/test/servervalues.test.ts 15ms
packages/database/test/sortedmap.test.ts 57ms
packages/database/test/sparsesnapshottree.test.ts 30ms
packages/database/test/transaction.test.ts 155ms
packages/firebase/analytics/index.ts 5ms
packages/firebase/app/index.ts 5ms
packages/firebase/auth/index.ts 5ms
packages/firebase/database/index.ts 5ms
packages/firebase/empty-import.d.ts 5ms
packages/firebase/externs/firebase-app-externs.js 12ms
packages/firebase/externs/firebase-app-internal-externs.js 10ms
packages/firebase/externs/firebase-auth-externs.js 47ms
packages/firebase/externs/firebase-client-auth-externs.js 10ms
packages/firebase/externs/firebase-database-externs.js 20ms
packages/firebase/externs/firebase-database-internal-externs.js 6ms
packages/firebase/externs/firebase-error-externs.js 5ms
packages/firebase/externs/firebase-externs.js 6ms
packages/firebase/externs/firebase-firestore-externs.js 30ms
packages/firebase/externs/firebase-messaging-externs.js 6ms
packages/firebase/externs/firebase-storage-externs.js 17ms
packages/firebase/firestore/index.ts 5ms
packages/firebase/functions/index.ts 5ms
packages/firebase/index.d.ts 229ms
packages/firebase/installations/index.ts 5ms
packages/firebase/messaging/index.ts 4ms
packages/firebase/performance/index.ts 4ms
packages/firebase/remote-config/index.ts 4ms
packages/firebase/rollup-internal.config.js 11ms
packages/firebase/rollup.config.js 20ms
packages/firebase/src/index.cdn.ts 7ms
packages/firebase/src/index.node.ts 5ms
packages/firebase/src/index.perf.ts 5ms
packages/firebase/src/index.rn.ts 5ms
packages/firebase/src/index.ts 6ms
packages/firebase/storage/index.ts 4ms
packages/firestore-types/index.d.ts 29ms
packages/firestore/.eslintrc.js 5ms
packages/firestore/index.console.ts 4ms
packages/firestore/index.node.ts 7ms
packages/firestore/index.ts 9ms
packages/firestore/karma.conf.js 8ms
packages/firestore/rollup.config.js 11ms
packages/firestore/src/api/blob.ts 13ms
packages/firestore/src/api/credentials.ts 31ms
packages/firestore/src/api/database.ts 207ms
packages/firestore/src/api/field_path.ts 15ms
packages/firestore/src/api/field_value.ts 9ms
packages/firestore/src/api/geo_point.ts 8ms
packages/firestore/src/api/observer.ts 8ms
packages/firestore/src/api/timestamp.ts 9ms
packages/firestore/src/api/user_data_converter.ts 59ms
packages/firestore/src/auth/user.ts 8ms
packages/firestore/src/core/database_info.ts 9ms
packages/firestore/src/core/event_manager.ts 22ms
packages/firestore/src/core/firestore_client.ts 39ms
packages/firestore/src/core/listen_sequence.ts 7ms
packages/firestore/src/core/query.ts 64ms
packages/firestore/src/core/snapshot_version.ts 9ms
packages/firestore/src/core/sync_engine.ts 85ms
packages/firestore/src/core/target_id_generator.ts 12ms
packages/firestore/src/core/target.ts 14ms
packages/firestore/src/core/transaction_runner.ts 14ms
packages/firestore/src/core/transaction.ts 15ms
packages/firestore/src/core/types.ts 6ms
packages/firestore/src/core/version.ts 8ms
packages/firestore/src/core/view_snapshot.ts 17ms
packages/firestore/src/core/view.ts 32ms
packages/firestore/src/local/encoded_resource_path.ts 13ms
packages/firestore/src/local/index_free_query_engine.ts 13ms
packages/firestore/src/local/index_manager.ts 7ms
packages/firestore/src/local/indexeddb_index_manager.ts 10ms
packages/firestore/src/local/indexeddb_mutation_queue.ts 61ms
packages/firestore/src/local/indexeddb_persistence.ts 98ms
packages/firestore/src/local/indexeddb_remote_document_cache.ts 43ms
packages/firestore/src/local/indexeddb_schema.ts 53ms
packages/firestore/src/local/indexeddb_target_cache.ts 36ms
packages/firestore/src/local/local_documents_view.ts 21ms
packages/firestore/src/local/local_serializer.ts 21ms
packages/firestore/src/local/local_store.ts 82ms
packages/firestore/src/local/local_view_changes.ts 11ms
packages/firestore/src/local/lru_garbage_collector.ts 41ms
packages/firestore/src/local/memory_index_manager.ts 11ms
packages/firestore/src/local/memory_mutation_queue.ts 38ms
packages/firestore/src/local/memory_persistence.ts 38ms
packages/firestore/src/local/memory_remote_document_cache.ts 18ms
packages/firestore/src/local/memory_target_cache.ts 18ms
packages/firestore/src/local/mutation_queue.ts 9ms
packages/firestore/src/local/persistence_promise.ts 27ms
packages/firestore/src/local/persistence.ts 12ms
packages/firestore/src/local/query_engine.ts 5ms
packages/firestore/src/local/reference_set.ts 17ms
packages/firestore/src/local/remote_document_cache.ts 7ms
packages/firestore/src/local/remote_document_change_buffer.ts 11ms
packages/firestore/src/local/shared_client_state_syncer.ts 6ms
packages/firestore/src/local/shared_client_state.ts 70ms
packages/firestore/src/local/simple_db.ts 55ms
packages/firestore/src/local/simple_query_engine.ts 7ms
packages/firestore/src/local/target_cache.ts 12ms
packages/firestore/src/local/target_data.ts 9ms
packages/firestore/src/model/collections.ts 9ms
packages/firestore/src/model/document_comparator.ts 4ms
packages/firestore/src/model/document_key.ts 8ms
packages/firestore/src/model/document_set.ts 13ms
packages/firestore/src/model/document.ts 20ms
packages/firestore/src/model/field_value.ts 48ms
packages/firestore/src/model/mutation_batch.ts 14ms
packages/firestore/src/model/mutation.ts 39ms
packages/firestore/src/model/path.ts 24ms
packages/firestore/src/model/transform_operation.ts 17ms
packages/firestore/src/platform_browser/browser_connectivity_monitor.ts 8ms
packages/firestore/src/platform_browser/browser_init.ts 5ms
packages/firestore/src/platform_browser/browser_platform.ts 7ms
packages/firestore/src/platform_browser/webchannel_connection.ts 29ms
packages/firestore/src/platform_node/grpc_connection.ts 21ms
packages/firestore/src/platform_node/load_protos.ts 8ms
packages/firestore/src/platform_node/node_init.ts 4ms
packages/firestore/src/platform_node/node_platform.ts 11ms
packages/firestore/src/platform/config.ts 8ms
packages/firestore/src/platform/config/goog_module_config.ts 6ms
packages/firestore/src/platform/platform.ts 8ms
packages/firestore/src/protos/firestore_proto_api.d.ts 80ms
packages/firestore/src/remote/backoff.ts 11ms
packages/firestore/src/remote/connection.ts 7ms
packages/firestore/src/remote/connectivity_monitor_noop.ts 5ms
packages/firestore/src/remote/connectivity_monitor.ts 6ms
packages/firestore/src/remote/datastore.ts 13ms
packages/firestore/src/remote/existence_filter.ts 5ms
packages/firestore/src/remote/online_state_tracker.ts 12ms
packages/firestore/src/remote/persistent_stream.ts 38ms
packages/firestore/src/remote/remote_event.ts 8ms
packages/firestore/src/remote/remote_store.ts 41ms
packages/firestore/src/remote/remote_syncer.ts 12ms
packages/firestore/src/remote/rpc_error.ts 16ms
packages/firestore/src/remote/serializer.ts 126ms
packages/firestore/src/remote/stream_bridge.ts 9ms
packages/firestore/src/remote/watch_change.ts 43ms
packages/firestore/src/util/api.ts 6ms
packages/firestore/src/util/array.ts 6ms
packages/firestore/src/util/assert.ts 5ms
packages/firestore/src/util/async_observer.ts 6ms
packages/firestore/src/util/async_queue.ts 26ms
packages/firestore/src/util/error.ts 9ms
packages/firestore/src/util/input_validation.ts 26ms
packages/firestore/src/util/log.ts 8ms
packages/firestore/src/util/misc.ts 14ms
packages/firestore/src/util/node_api.ts 6ms
packages/firestore/src/util/obj_map.ts 11ms
packages/firestore/src/util/obj.ts 12ms
packages/firestore/src/util/promise.ts 7ms
packages/firestore/src/util/sorted_map.ts 50ms
packages/firestore/src/util/sorted_set.ts 18ms
packages/firestore/src/util/types.ts 8ms
packages/firestore/test/integration/api_internal/idle_timeout.test.ts 8ms
packages/firestore/test/integration/api/array_transforms.test.ts 26ms
packages/firestore/test/integration/api/batch_writes.test.ts 32ms
packages/firestore/test/integration/api/cursor.test.ts 83ms
packages/firestore/test/integration/api/database.test.ts 149ms
packages/firestore/test/integration/api/fields.test.ts 40ms
packages/firestore/test/integration/api/get_options.test.ts 62ms
packages/firestore/test/integration/api/numeric_transforms.test.ts 24ms
packages/firestore/test/integration/api/query.test.ts 85ms
packages/firestore/test/integration/api/server_timestamp.test.ts 29ms
packages/firestore/test/integration/api/smoke.test.ts 17ms
packages/firestore/test/integration/api/transactions.test.ts 66ms
packages/firestore/test/integration/api/type.test.ts 14ms
packages/firestore/test/integration/api/validation.test.ts 130ms
packages/firestore/test/integration/bootstrap.ts 6ms
packages/firestore/test/integration/browser/indexeddb.test.ts 8ms
packages/firestore/test/integration/browser/webchannel.test.ts 10ms
packages/firestore/test/integration/prime_backend.test.ts 12ms
packages/firestore/test/integration/remote/remote.test.ts 34ms
packages/firestore/test/integration/remote/stream.test.ts 53ms
packages/firestore/test/integration/util/events_accumulator.ts 22ms
packages/firestore/test/integration/util/firebase_export.ts 4ms
packages/firestore/test/integration/util/helpers.ts 42ms
packages/firestore/test/integration/util/internal_helpers.ts 11ms
packages/firestore/test/unit/api/blob.test.ts 13ms
packages/firestore/test/unit/api/database.test.ts 19ms
packages/firestore/test/unit/api/document_change.test.ts 19ms
packages/firestore/test/unit/api/field_path.test.ts 5ms
packages/firestore/test/unit/api/field_value.test.ts 5ms
packages/firestore/test/unit/api/geo_point.test.ts 11ms
packages/firestore/test/unit/api/timestamp.test.ts 5ms
packages/firestore/test/unit/bootstrap.ts 8ms
packages/firestore/test/unit/core/event_manager.test.ts 53ms
packages/firestore/test/unit/core/listen_sequence.test.ts 7ms
packages/firestore/test/unit/core/query.test.ts 73ms
packages/firestore/test/unit/core/target_id_generator.test.ts 9ms
packages/firestore/test/unit/core/view.test.ts 61ms
packages/firestore/test/unit/generate_spec_json.js 11ms
packages/firestore/test/unit/local/counting_query_engine.ts 12ms
packages/firestore/test/unit/local/encoded_resource_path.test.ts 19ms
packages/firestore/test/unit/local/index_free_query_engine.test.ts 40ms
packages/firestore/test/unit/local/index_manager.test.ts 9ms
packages/firestore/test/unit/local/indexeddb_persistence.test.ts 93ms
packages/firestore/test/unit/local/local_store.test.ts 193ms
packages/firestore/test/unit/local/lru_garbage_collector.test.ts 78ms
packages/firestore/test/unit/local/mutation_queue.test.ts 30ms
packages/firestore/test/unit/local/persistence_promise.test.ts 23ms
packages/firestore/test/unit/local/persistence_test_helpers.ts 15ms
packages/firestore/test/unit/local/persistence_transaction.test.ts 14ms
packages/firestore/test/unit/local/reference_set.test.ts 10ms
packages/firestore/test/unit/local/remote_document_cache.test.ts 37ms
packages/firestore/test/unit/local/remote_document_change_buffer.test.ts 13ms
packages/firestore/test/unit/local/simple_db.test.ts 54ms
packages/firestore/test/unit/local/target_cache.test.ts 30ms
packages/firestore/test/unit/local/test_index_manager.ts 6ms
packages/firestore/test/unit/local/test_mutation_queue.ts 14ms
packages/firestore/test/unit/local/test_remote_document_cache.ts 13ms
packages/firestore/test/unit/local/test_remote_document_change_buffer.ts 7ms
packages/firestore/test/unit/local/test_target_cache.ts 12ms
packages/firestore/test/unit/local/web_storage_shared_client_state.test.ts 60ms
packages/firestore/test/unit/model/document_set.test.ts 13ms
packages/firestore/test/unit/model/document.test.ts 9ms
packages/firestore/test/unit/model/field_value.test.ts 72ms
packages/firestore/test/unit/model/mutation.test.ts 57ms
packages/firestore/test/unit/model/path.test.ts 21ms
packages/firestore/test/unit/platform/platform.test.ts 4ms
packages/firestore/test/unit/remote/node/serializer.test.ts 103ms
packages/firestore/test/unit/remote/remote_event.test.ts 71ms
packages/firestore/test/unit/specs/collection_spec.test.ts 9ms
packages/firestore/test/unit/specs/describe_spec.ts 22ms
packages/firestore/test/unit/specs/existence_filter_spec.test.ts 40ms
packages/firestore/test/unit/specs/limbo_spec.test.ts 66ms
packages/firestore/test/unit/specs/limit_spec.test.ts 49ms
packages/firestore/test/unit/specs/listen_spec.test.ts 133ms
packages/firestore/test/unit/specs/offline_spec.test.ts 18ms
packages/firestore/test/unit/specs/orderby_spec.test.ts 9ms
packages/firestore/test/unit/specs/perf_spec.test.ts 27ms
packages/firestore/test/unit/specs/persistence_spec.test.ts 22ms
packages/firestore/test/unit/specs/query_spec.test.ts 14ms
packages/firestore/test/unit/specs/remote_store_spec.test.ts 12ms
packages/firestore/test/unit/specs/resume_token_spec.test.ts 7ms
packages/firestore/test/unit/specs/spec_builder.ts 80ms
packages/firestore/test/unit/specs/spec_rpc_error.ts 13ms
packages/firestore/test/unit/specs/spec_test_runner.ts 103ms
packages/firestore/test/unit/specs/write_spec.test.ts 104ms
packages/firestore/test/unit/util/api.test.ts 8ms
packages/firestore/test/unit/util/async_queue.test.ts 23ms
packages/firestore/test/unit/util/misc.test.ts 5ms
packages/firestore/test/unit/util/node_api.test.ts 6ms
packages/firestore/test/unit/util/obj_map.test.ts 14ms
packages/firestore/test/unit/util/sorted_map.test.ts 40ms
packages/firestore/test/unit/util/sorted_set.test.ts 18ms
packages/firestore/test/util/api_helpers.ts 11ms
packages/firestore/test/util/equality_matcher.ts 11ms
packages/firestore/test/util/helpers.ts 72ms
packages/firestore/test/util/node_persistence.ts 6ms
packages/firestore/test/util/promise.ts 6ms
packages/firestore/test/util/test_platform.ts 21ms
packages/firestore/tools/console.build.js 9ms
packages/functions-types/index.d.ts 7ms
packages/functions/.eslintrc.js 4ms
packages/functions/index.node.ts 5ms
packages/functions/index.ts 5ms
packages/functions/karma.conf.js 5ms
packages/functions/rollup.config.js 9ms
packages/functions/src/api/error.ts 11ms
packages/functions/src/api/service.ts 16ms
packages/functions/src/config.ts 7ms
packages/functions/src/context.ts 9ms
packages/functions/src/serializer.ts 10ms
packages/functions/test/browser/callable.test.ts 7ms
packages/functions/test/callable.test.ts 16ms
packages/functions/test/serializer.test.ts 13ms
packages/functions/test/service.test.ts 6ms
packages/functions/test/utils.ts 6ms
packages/installations-types/index.d.ts 5ms
packages/installations/.eslintrc.js 5ms
packages/installations/karma.conf.js 5ms
packages/installations/rollup.config.js 8ms
packages/installations/src/api/common.test.ts 9ms
packages/installations/src/api/common.ts 12ms
packages/installations/src/api/create-installation.test.ts 12ms
packages/installations/src/api/create-installation.ts 6ms
packages/installations/src/api/delete-installation.test.ts 11ms
packages/installations/src/api/delete-installation.ts 6ms
packages/installations/src/api/generate-auth-token.test.ts 11ms
packages/installations/src/api/generate-auth-token.ts 7ms
packages/installations/src/functions/delete-installation.test.ts 12ms
packages/installations/src/functions/delete-installation.ts 6ms
packages/installations/src/functions/get-id.test.ts 9ms
packages/installations/src/functions/get-id.ts 6ms
packages/installations/src/functions/get-token.test.ts 29ms
packages/installations/src/functions/get-token.ts 6ms
packages/installations/src/functions/index.ts 5ms
packages/installations/src/helpers/buffer-to-base64-url-safe.test.ts 5ms
packages/installations/src/helpers/buffer-to-base64-url-safe.ts 4ms
packages/installations/src/helpers/extract-app-config.test.ts 7ms
packages/installations/src/helpers/extract-app-config.ts 6ms
packages/installations/src/helpers/generate-fid.test.ts 14ms
packages/installations/src/helpers/generate-fid.ts 7ms
packages/installations/src/helpers/get-installation-entry.test.ts 45ms
packages/installations/src/helpers/get-installation-entry.ts 15ms
packages/installations/src/helpers/idb-manager.test.ts 13ms
packages/installations/src/helpers/idb-manager.ts 11ms
packages/installations/src/helpers/refresh-auth-token.test.ts 20ms
packages/installations/src/helpers/refresh-auth-token.ts 15ms
packages/installations/src/index.ts 7ms
packages/installations/src/interfaces/api-response.ts 4ms
packages/installations/src/interfaces/app-config.ts 5ms
packages/installations/src/interfaces/installation-entry.ts 7ms
packages/installations/src/testing/compare-headers.test.ts 7ms
packages/installations/src/testing/compare-headers.ts 6ms
packages/installations/src/testing/get-fake-app.ts 5ms
packages/installations/src/testing/setup.ts 5ms
packages/installations/src/util/constants.ts 5ms
packages/installations/src/util/errors.ts 8ms
packages/installations/src/util/sleep.test.ts 6ms
packages/installations/src/util/sleep.ts 5ms
packages/installations/test-app/index.js 12ms
packages/installations/test-app/rollup.config.js 6ms
packages/logger/.eslintrc.js 4ms
packages/logger/index.ts 5ms
packages/logger/karma.conf.js 6ms
packages/logger/rollup.config.js 8ms
packages/logger/src/logger.ts 14ms
packages/logger/test/logger.test.ts 10ms
packages/messaging-types/index.d.ts 7ms
packages/messaging/.eslintrc.js 5ms
packages/messaging/index.ts 9ms
packages/messaging/karma.conf.js 5ms
packages/messaging/rollup.config.js 9ms
packages/messaging/src/controllers/base-controller.ts 25ms
packages/messaging/src/controllers/sw-controller.ts 25ms
packages/messaging/src/controllers/sw-types.ts 9ms
packages/messaging/src/controllers/window-controller.ts 19ms
packages/messaging/src/helpers/array-buffer-to-base64.ts 6ms
packages/messaging/src/helpers/base64-to-array-buffer.ts 6ms
packages/messaging/src/helpers/is-array-buffer-equal.ts 6ms
packages/messaging/src/interfaces/internal-services.ts 4ms
packages/messaging/src/interfaces/message-payload.ts 8ms
packages/messaging/src/interfaces/token-details.ts 5ms
packages/messaging/src/interfaces/vapid-details.ts 4ms
packages/messaging/src/models/clean-v1-undefined.ts 9ms
packages/messaging/src/models/db-interface.ts 13ms
packages/messaging/src/models/default-sw.ts 4ms
packages/messaging/src/models/errors.ts 10ms
packages/messaging/src/models/fcm-details.ts 7ms
packages/messaging/src/models/subscription-manager.ts 19ms
packages/messaging/src/models/token-details-model.ts 21ms
packages/messaging/src/models/vapid-details-model.ts 11ms
packages/messaging/src/models/worker-page-message.ts 12ms
packages/messaging/test/constructor.test.ts 10ms
packages/messaging/test/controller-delete-token.test.ts 30ms
packages/messaging/test/controller-get-token.test.ts 73ms
packages/messaging/test/controller-interface.test.ts 27ms
packages/messaging/test/db-interface.test.ts 12ms
packages/messaging/test/get-sw-reg.test.ts 15ms
packages/messaging/test/helpers.test.ts 14ms
packages/messaging/test/index.test.ts 11ms
packages/messaging/test/subscription-manager.test.ts 40ms
packages/messaging/test/sw-controller.test.ts 99ms
packages/messaging/test/testing-utils/db-helper.ts 10ms
packages/messaging/test/testing-utils/detail-comparator.ts 9ms
packages/messaging/test/testing-utils/make-fake-firebase-services.ts 9ms
packages/messaging/test/testing-utils/make-fake-subscription.ts 8ms
packages/messaging/test/testing-utils/make-fake-sw-reg.ts 8ms
packages/messaging/test/testing-utils/mock-fetch.ts 7ms
packages/messaging/test/token-details-model.test.ts 26ms
packages/messaging/test/vapid-details-model.test.ts 13ms
packages/messaging/test/window-controller.test.ts 27ms
packages/performance-types/index.d.ts 8ms
packages/performance/.eslintrc.js 5ms
packages/performance/index.ts 8ms
packages/performance/karma.conf.js 6ms
packages/performance/rollup.config.js 10ms
packages/performance/src/constants.ts 5ms
packages/performance/src/controllers/perf.test.ts 12ms
packages/performance/src/controllers/perf.ts 6ms
packages/performance/src/resources/network_request.test.ts 8ms
packages/performance/src/resources/network_request.ts 7ms
packages/performance/src/resources/trace.test.ts 26ms
packages/performance/src/resources/trace.ts 24ms
packages/performance/src/services/api_service.test.ts 10ms
packages/performance/src/services/api_service.ts 14ms
packages/performance/src/services/cc_service.test.ts 9ms
packages/performance/src/services/cc_service.ts 12ms
packages/performance/src/services/iid_service.test.ts 7ms
packages/performance/src/services/iid_service.ts 6ms
packages/performance/src/services/initialization_service.test.ts 7ms
packages/performance/src/services/initialization_service.ts 8ms
packages/performance/src/services/oob_resources_service.test.ts 14ms
packages/performance/src/services/oob_resources_service.ts 8ms
packages/performance/src/services/perf_logger.test.ts 15ms
packages/performance/src/services/perf_logger.ts 22ms
packages/performance/src/services/remote_config_service.test.ts 21ms
packages/performance/src/services/remote_config_service.ts 18ms
packages/performance/src/services/settings_service.ts 9ms
packages/performance/src/utils/attribute_utils.test.ts 14ms
packages/performance/src/utils/attributes_utils.ts 9ms
packages/performance/src/utils/console_logger.ts 5ms
packages/performance/src/utils/errors.ts 7ms
packages/performance/src/utils/metric_utils.test.ts 7ms
packages/performance/src/utils/metric_utils.ts 5ms
packages/performance/test/setup.ts 4ms
packages/polyfill/index.ts 4ms
packages/polyfill/rollup.config.js 6ms
packages/remote-config-types/index.d.ts 8ms
packages/remote-config/.eslintrc.js 4ms
packages/remote-config/index.ts 9ms
packages/remote-config/karma.conf.js 5ms
packages/remote-config/rollup.config.js 7ms
packages/remote-config/src/client/caching_client.ts 10ms
packages/remote-config/src/client/exponential_backoff.ts 6ms
packages/remote-config/src/client/remote_config_fetch_client.ts 7ms
packages/remote-config/src/client/rest_client.ts 13ms
packages/remote-config/src/client/retrying_client.ts 10ms
packages/remote-config/src/errors.ts 9ms
packages/remote-config/src/language.ts 5ms
packages/remote-config/src/remote_config.ts 17ms
packages/remote-config/src/storage/storage_cache.ts 8ms
packages/remote-config/src/storage/storage.ts 22ms
packages/remote-config/src/value.ts 8ms
packages/remote-config/test_app/index.js 27ms
packages/remote-config/test/client/caching_client.test.ts 18ms
packages/remote-config/test/client/exponential_backoff.test.ts 8ms
packages/remote-config/test/client/rest_client.test.ts 24ms
packages/remote-config/test/client/retrying_client.test.ts 18ms
packages/remote-config/test/errors.test.ts 25ms
packages/remote-config/test/language.test.ts 6ms
packages/remote-config/test/remote_config.test.ts 40ms
packages/remote-config/test/setup.ts 5ms
packages/remote-config/test/storage/storage_cache.test.ts 9ms
packages/remote-config/test/storage/storage.test.ts 10ms
packages/remote-config/test/value.test.ts 10ms
packages/rxfire/.eslintrc.js 5ms
packages/rxfire/auth/index.ts 7ms
packages/rxfire/database/fromRef.ts 6ms
packages/rxfire/database/index.ts 5ms
packages/rxfire/database/interfaces.ts 5ms
packages/rxfire/database/list/audit-trail.ts 11ms
packages/rxfire/database/list/index.ts 27ms
packages/rxfire/database/object/index.ts 15ms
packages/rxfire/database/utils.ts 5ms
packages/rxfire/firestore/collection/index.ts 18ms
packages/rxfire/firestore/document/index.ts 11ms
packages/rxfire/firestore/fromRef.ts 7ms
packages/rxfire/firestore/index.ts 5ms
packages/rxfire/functions/index.ts 6ms
packages/rxfire/karma.conf.js 6ms
packages/rxfire/rollup.config.js 9ms
packages/rxfire/rxfire-auth.js 8ms
packages/rxfire/rxfire-database.js 23ms
packages/rxfire/rxfire-firestore.js 23ms
packages/rxfire/rxfire-functions.js 5ms
packages/rxfire/rxfire-storage.js 8ms
packages/rxfire/storage/index.ts 9ms
packages/rxfire/test/database.test.ts 67ms
packages/rxfire/test/firestore.test.ts 31ms
packages/storage-types/index.d.ts 14ms
packages/storage/.eslintrc.js 5ms
packages/storage/index.ts 9ms
packages/storage/karma.conf.js 6ms
packages/storage/rollup.config.js 9ms
packages/storage/src/implementation/args.ts 17ms
packages/storage/src/implementation/async.ts 5ms
packages/storage/src/implementation/authwrapper.ts 13ms
packages/storage/src/implementation/backoff.ts 10ms
packages/storage/src/implementation/blob.ts 36ms
packages/storage/src/implementation/blobbuilder.d.ts 6ms
packages/storage/src/implementation/constants.ts 5ms
packages/storage/src/implementation/error.ts 19ms
packages/storage/src/implementation/failrequest.ts 6ms
packages/storage/src/implementation/fs.ts 8ms
packages/storage/src/implementation/json.ts 7ms
packages/storage/src/implementation/list.ts 11ms
packages/storage/src/implementation/location.ts 11ms
packages/storage/src/implementation/metadata.ts 20ms
packages/storage/src/implementation/observer.ts 9ms
packages/storage/src/implementation/path.ts 7ms
packages/storage/src/implementation/request.ts 24ms
packages/storage/src/implementation/requestinfo.ts 7ms
packages/storage/src/implementation/requestmaker.ts 5ms
packages/storage/src/implementation/requestmap.ts 7ms
packages/storage/src/implementation/requests.ts 38ms
packages/storage/src/implementation/string.ts 21ms
packages/storage/src/implementation/taskenums.ts 9ms
packages/storage/src/implementation/type.ts 8ms
packages/storage/src/implementation/url.ts 6ms
packages/storage/src/implementation/xhrio_network.ts 11ms
packages/storage/src/implementation/xhrio.ts 6ms
packages/storage/src/implementation/xhriopool.ts 5ms
packages/storage/src/list.ts 5ms
packages/storage/src/metadata.ts 6ms
packages/storage/src/reference.ts 35ms
packages/storage/src/service.ts 15ms
packages/storage/src/task.ts 59ms
packages/storage/src/tasksnapshot.ts 6ms
packages/storage/test/blob.test.ts 10ms
packages/storage/test/reference.test.ts 42ms
packages/storage/test/request.test.ts 16ms
packages/storage/test/requests.test.ts 59ms
packages/storage/test/service.test.ts 30ms
packages/storage/test/string.test.ts 17ms
packages/storage/test/task.test.ts 48ms
packages/storage/test/testshared.ts 13ms
packages/storage/test/xhrio.ts 12ms
packages/template-types/index.d.ts 4ms
packages/template/.eslintrc.js 6ms
packages/template/index.node.ts 5ms
packages/template/index.ts 4ms
packages/template/karma.conf.js 5ms
packages/template/rollup.config.js 8ms
packages/template/src/index.ts 5ms
packages/template/test/index.test.ts 5ms
packages/testing/index.ts 5ms
packages/testing/rollup.config.js 8ms
packages/testing/src/api/index.ts 20ms
packages/testing/test/database.test.ts 18ms
packages/util/.eslintrc.js 5ms
packages/util/index.node.ts 4ms
packages/util/index.ts 6ms
packages/util/karma.conf.js 6ms
packages/util/rollup.config.js 8ms
packages/util/src/assert.ts 5ms
packages/util/src/constants.ts 5ms
packages/util/src/crypt.ts 26ms
packages/util/src/deepCopy.ts 12ms
packages/util/src/deferred.ts 8ms
packages/util/src/environment.ts 9ms
packages/util/src/errors.ts 14ms
packages/util/src/json.ts 5ms
packages/util/src/jwt.ts 30ms
packages/util/src/obj.ts 14ms
packages/util/src/query.ts 10ms
packages/util/src/sha1.ts 32ms
packages/util/src/subscribe.ts 52ms
packages/util/src/utf8.ts 20ms
packages/util/src/validation.ts 16ms
packages/util/test/base64.test.ts 6ms
packages/util/test/deepCopy.test.ts 14ms
packages/util/test/errors.test.ts 13ms
packages/util/test/subscribe.test.ts 21ms
packages/webchannel-wrapper/externs/overrides.js 8ms
packages/webchannel-wrapper/src/index.d.ts 9ms
packages/webchannel-wrapper/src/index.js 13ms
packages/webchannel-wrapper/tools/build.js 10ms
scripts/docgen/generate-docs.js 41ms
scripts/docgen/typedoc.js 5ms
scripts/emulator-testing/database-test-runner.ts 7ms
scripts/emulator-testing/emulators/database-emulator.ts 6ms
scripts/emulator-testing/emulators/emulator.ts 19ms
scripts/emulator-testing/emulators/firestore-emulator.ts 5ms
scripts/emulator-testing/firestore-test-runner.ts 12ms
scripts/release/cli.js 17ms
scripts/release/utils/banner.js 6ms
scripts/release/utils/constants.js 4ms
scripts/release/utils/git.js 11ms
scripts/release/utils/inquirer.js 14ms
scripts/release/utils/lerna.js 6ms
scripts/release/utils/npm.js 10ms
scripts/release/utils/tests.js 6ms
scripts/release/utils/workspace.js 18ms
scripts/release/utils/yarn.js 6ms
scripts/run_saucelabs.js 20ms
tools/config.js 22ms
tools/gitHooks/license.js 13ms
tools/gitHooks/prepush.js 6ms
tools/gitHooks/prettier.js 11ms
tools/pretest.js 8ms
tools/repl.js 7ms
Done in 17.21s.
  • Loading branch information
richieforeman authored and Feiyang1 committed Dec 10, 2019
1 parent f0fc426 commit 85c9f48
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 25 deletions.
24 changes: 13 additions & 11 deletions packages/performance/src/services/api_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,20 @@ export type EntryType =
| 'navigation';

/**
* This class holds a reference to various browser related objects injected by set methods.
* This class holds a reference to various browser related objects injected by
* set methods.
*/
export class Api {
private performance: Performance;
private readonly performance: Performance;
/** PreformanceObserver constructor function. */
private PerformanceObserver: typeof PerformanceObserver;
private windowLocation: Location;
onFirstInputDelay?: Function;
localStorage!: Storage;
document: Document;
navigator: Navigator;

constructor(window?: Window) {
private readonly PerformanceObserver: typeof PerformanceObserver;
private readonly windowLocation: Location;
readonly onFirstInputDelay?: Function;
readonly localStorage?: Storage;
readonly document: Document;
readonly navigator: Navigator;

constructor(readonly window?: Window) {
if (!window) {
throw ERROR_FACTORY.create(ErrorCode.NO_WINDOW);
}
Expand All @@ -58,7 +59,8 @@ export class Api {
this.navigator = window.navigator;
this.document = window.document;
if (this.navigator && this.navigator.cookieEnabled) {
// If user blocks cookies on the browser, accessing localStorage will throw an exception.
// If user blocks cookies on the browser, accessing localStorage will
// throw an exception.
this.localStorage = window.localStorage;
}
if (window.perfMetrics && window.perfMetrics.onFirstInputDelay) {
Expand Down
29 changes: 17 additions & 12 deletions packages/performance/src/services/remote_config_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
* limitations under the License.
*/

import { SettingsService } from './settings_service';
import {
SDK_VERSION,
CONFIG_EXPIRY_LOCAL_STORAGE_KEY,
CONFIG_LOCAL_STORAGE_KEY,
CONFIG_EXPIRY_LOCAL_STORAGE_KEY
SDK_VERSION
} from '../constants';
import { Api } from './api_service';
import { getAuthTokenPromise } from './iid_service';
import { consoleLogger } from '../utils/console_logger';
import { ERROR_FACTORY, ErrorCode } from '../utils/errors';

import { Api } from './api_service';
import { getAuthTokenPromise } from './iid_service';
import { SettingsService } from './settings_service';

const REMOTE_CONFIG_SDK_VERSION = '0.0.1';

interface SecondaryConfig {
Expand Down Expand Up @@ -71,12 +72,16 @@ export function getConfig(iid: string): Promise<void> {
.then(config => processConfig(config))
.then(
config => storeConfig(config),
/** Do nothing for error, use defaults set in settings service. */ () => {}
/** Do nothing for error, use defaults set in settings service. */
() => {}
);
}

function getStoredConfig(): RemoteConfigResponse | undefined {
const localStorage = Api.getInstance().localStorage;
if (!localStorage) {
return;
}
const expiryString = localStorage.getItem(CONFIG_EXPIRY_LOCAL_STORAGE_KEY);
if (!expiryString || !configValid(expiryString)) {
return;
Expand All @@ -95,10 +100,11 @@ function getStoredConfig(): RemoteConfigResponse | undefined {
}

function storeConfig(config: RemoteConfigResponse | undefined): void {
if (!config) {
const localStorage = Api.getInstance().localStorage;
if (!config || !localStorage) {
return;
}
const localStorage = Api.getInstance().localStorage;

localStorage.setItem(CONFIG_LOCAL_STORAGE_KEY, JSON.stringify(config));
localStorage.setItem(
CONFIG_EXPIRY_LOCAL_STORAGE_KEY,
Expand All @@ -122,9 +128,7 @@ function getRemoteConfig(
const configEndPoint = `https://firebaseremoteconfig.googleapis.com/v1/projects/${projectId}/namespaces/fireperf:fetch?key=${SettingsService.getInstance().getApiKey()}`;
const request = new Request(configEndPoint, {
method: 'POST',
headers: {
Authorization: `${FIS_AUTH_PREFIX} ${authToken}`
},
headers: { Authorization: `${FIS_AUTH_PREFIX} ${authToken}` },
/* eslint-disable camelcase */
body: JSON.stringify({
app_instance_id: iid,
Expand Down Expand Up @@ -163,7 +167,8 @@ function processConfig(
const settingsServiceInstance = SettingsService.getInstance();
const entries = config.entries || {};
if (entries.fpr_enabled !== undefined) {
// TODO: Change the assignment of loggingEnabled once the received type is known.
// TODO: Change the assignment of loggingEnabled once the received type is
// known.
settingsServiceInstance.loggingEnabled =
String(entries.fpr_enabled) === 'true';
} else if (SECONDARY_CONFIGS.loggingEnabled !== undefined) {
Expand Down
16 changes: 14 additions & 2 deletions packages/performance/src/utils/attributes_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ const enum EffectiveConnectionType {
CONNECTION_4G = 4
}

/**
* NetworkInformation
*
* ref: https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation
*/
interface NetworkInformation {
readonly effectiveType?: 'slow-2g' | '2g' | '3g' | '4g';
}

interface NavigatorWithConnection extends Navigator {
readonly connection: NetworkInformation;
}

const RESERVED_ATTRIBUTE_PREFIXES = ['firebase_', 'google_', 'ga_'];
const ATTRIBUTE_FORMAT_REGEX = new RegExp('^[a-zA-Z]\\w*$');
const MAX_ATTRIBUTE_NAME_LENGTH = 40;
Expand Down Expand Up @@ -72,8 +85,7 @@ export function getVisibilityState(): VisibilityState {

export function getEffectiveConnectionType(): EffectiveConnectionType {
const navigator = Api.getInstance().navigator;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const navigatorConnection = (navigator as any).connection;
const navigatorConnection = (navigator as NavigatorWithConnection).connection;
const effectiveType =
navigatorConnection && navigatorConnection.effectiveType;
switch (effectiveType) {
Expand Down

0 comments on commit 85c9f48

Please sign in to comment.