Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log correct version for v9 Firestore and RTDB #4842

Merged
merged 10 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/database/exp/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@
*/

// eslint-disable-next-line import/no-extraneous-dependencies
import { _registerComponent, registerVersion } from '@firebase/app-exp';
import {
_registerComponent,
registerVersion,
SDK_VERSION
} from '@firebase/app-exp';
import { Component, ComponentType } from '@firebase/component';

import { name, version } from '../package.json';
import { setSDKVersion } from '../src/core/version';
import {
FirebaseDatabase,
repoManagerDatabaseFromApp
Expand All @@ -32,6 +37,7 @@ declare module '@firebase/component' {
}

export function registerDatabase(variant?: string): void {
setSDKVersion(SDK_VERSION);
_registerComponent(
new Component(
'database-exp',
Expand Down
2 changes: 2 additions & 0 deletions packages/firestore/compat/index.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import firebase from '@firebase/app-compat';
import { FirebaseNamespace } from '@firebase/app-types';

import { Firestore, IndexedDbPersistenceProvider } from '../src/api/database';
import { setSDKVersion } from '../src/core/version';

import { registerBundle } from './bundle';
import { configureForFirebase } from './config';
Expand All @@ -30,6 +31,7 @@ import { name, version } from './package.json';
* Persistence can be enabled via `firebase.firestore().enablePersistence()`.
*/
export function registerFirestore(instance: FirebaseNamespace): void {
setSDKVersion(instance.SDK_VERSION);
configureForFirebase(
instance,
(app, firestoreExp) =>
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/compat/index.rn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ import firebase from '@firebase/app-compat';
import { FirebaseNamespace } from '@firebase/app-types';

import { Firestore, IndexedDbPersistenceProvider } from '../src/api/database';
import { setSDKVersion } from '../src/core/version';

import { registerBundle } from './bundle';
import { configureForFirebase } from './config';
import { name, version } from './package.json';

/**
* Registers the main Firestore ReactNative build with the components framework.
* Persistence can be enabled via `firebase.firestore().enablePersistence()`.
*/
export function registerFirestore(instance: FirebaseNamespace): void {
setSDKVersion(instance.SDK_VERSION);
configureForFirebase(
instance,
(app, firestoreExp) =>
Expand Down
2 changes: 2 additions & 0 deletions packages/firestore/compat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { FirebaseNamespace } from '@firebase/app-types';
import * as types from '@firebase/firestore-types';

import { Firestore, IndexedDbPersistenceProvider } from '../src/api/database';
import { setSDKVersion } from '../src/core/version';

import { registerBundle } from './bundle';
import { configureForFirebase } from './config';
Expand All @@ -33,6 +34,7 @@ import '../register-module';
* Persistence can be enabled via `firebase.firestore().enablePersistence()`.
*/
export function registerFirestore(instance: FirebaseNamespace): void {
setSDKVersion(instance.SDK_VERSION);
configureForFirebase(
instance,
(app, firestoreExp) =>
Expand Down
8 changes: 7 additions & 1 deletion packages/firestore/exp/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
* limitations under the License.
*/

import { _registerComponent, registerVersion } from '@firebase/app-exp';
import {
_registerComponent,
registerVersion,
SDK_VERSION
} from '@firebase/app-exp';
import { Component, ComponentType } from '@firebase/component';

import { name, version } from '../package.json';
import { setSDKVersion } from '../src/core/version';
import { FirebaseFirestore } from '../src/exp/database';
import { Settings } from '../src/exp/settings';

Expand All @@ -29,6 +34,7 @@ declare module '@firebase/component' {
}

export function registerFirestore(variant?: string): void {
setSDKVersion(SDK_VERSION);
_registerComponent(
new Component(
'firestore-exp',
Expand Down
8 changes: 7 additions & 1 deletion packages/firestore/lite/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
* limitations under the License.
*/

import { _registerComponent, registerVersion } from '@firebase/app-exp';
import {
_registerComponent,
registerVersion,
SDK_VERSION
} from '@firebase/app-exp';
import { Component, ComponentType } from '@firebase/component';

import { version } from '../package.json';
import { setSDKVersion } from '../src/core/version';
import { FirebaseFirestore } from '../src/lite/database';
import { Settings } from '../src/lite/settings';

Expand All @@ -29,6 +34,7 @@ declare module '@firebase/component' {
}

export function registerFirestore(): void {
setSDKVersion(SDK_VERSION);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we differentiate Firestore lite from Firestore? I wonder if we should prefix or postfix this with lite.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like 9.0.0-beta.1_lite?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we normally put variant info in the product string and not in the version number string? It's already in the product string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The product string is in line 55, I think that should be enough to distinguish for platform logging, unless this is for Firestore-only backend logging? I think it might make platform logging queries a little harder to have one version not like the others.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version is logged to Firestore backend directly. We will have to do some data massage to join Firestore data with platform logging data.

_registerComponent(
new Component(
'firestore/lite',
Expand Down
6 changes: 5 additions & 1 deletion packages/firestore/src/core/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
*/

/** The semver (www.semver.org) version of the SDK. */
export { version as SDK_VERSION } from '../../../firebase/package.json';
import { version } from '../../../firebase/package.json';
export let SDK_VERSION = version;
export function setSDKVersion(version: string): void {
SDK_VERSION = version;
}
11 changes: 8 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,11 @@
resolved "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.6.1.tgz#dcbd23030a71c0c74fc95d4a3f75ba81653850e9"
integrity sha512-L/ZnJRAq7F++utfuoTKX4CLBG5YR7tFO3PLzG1/oXXKEezJ0kRL3CMRoueBEmTCzVb/6SIs2Qlaw++uDgi5Xyg==

"@firebase/[email protected]":
version "0.1.5"
resolved "https://registry.npmjs.org/@firebase/auth-interop-types/-/auth-interop-types-0.1.5.tgz#9fc9bd7c879f16b8d1bb08373a0f48c3a8b74557"
integrity sha512-88h74TMQ6wXChPA6h9Q3E1Jg6TkTHep2+k63OWg3s0ozyGVMeY+TTOti7PFPzq5RhszQPQOoCi59es4MaRvgCw==

"@firebase/[email protected]":
version "0.1.21"
resolved "https://registry.npmjs.org/@firebase/component/-/component-0.1.21.tgz#56062eb0d449dc1e7bbef3c084a9b5fa48c7c14d"
Expand Down Expand Up @@ -7482,8 +7487,8 @@ [email protected]:
"@firebase/app-exp" "0.0.900"
"@firebase/auth-compat" "0.0.900"
"@firebase/auth-exp" "0.0.900"
"@firebase/database" "0.9.10"
"@firebase/firestore" "2.2.4"
"@firebase/database" "0.9.11"
"@firebase/firestore" "2.2.5"
"@firebase/functions-compat" "0.0.900"
"@firebase/functions-exp" "0.0.900"
"@firebase/messaging-compat" "0.0.900"
Expand All @@ -7492,7 +7497,7 @@ [email protected]:
"@firebase/performance-exp" "0.0.900"
"@firebase/remote-config-compat" "0.0.900"
"@firebase/remote-config-exp" "0.0.900"
"@firebase/storage" "0.5.0"
"@firebase/storage" "0.5.1"

[email protected]:
version "3.13.0"
Expand Down