Skip to content

Commit 65b9d42

Browse files
Merge
2 parents 2f21579 + 0986b92 commit 65b9d42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+180
-148
lines changed

.changeset/polite-readers-wait.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/shiny-forks-pull.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/tame-donuts-relate.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/thin-buses-fail.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

common/api-review/installations-exp.api.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
import { FirebaseApp } from '@firebase/app-types-exp';
88
import { FirebaseInstallations } from '@firebase/installations-types-exp';
99

10-
// @public (undocumented)
10+
// @public
1111
export function deleteInstallations(installations: FirebaseInstallations): Promise<void>;
1212

13-
// @public (undocumented)
13+
// @public
1414
export function getId(installations: FirebaseInstallations): Promise<string>;
1515

16-
// @public (undocumented)
16+
// @public
1717
export function getInstallations(app: FirebaseApp): FirebaseInstallations;
1818

19-
// @public (undocumented)
19+
// @public
2020
export function getToken(installations: FirebaseInstallations, forceRefresh?: boolean): Promise<string>;
2121

22-
// @public (undocumented)
22+
// @public
2323
export type IdChangeCallbackFn = (installationId: string) => void;
2424

25-
// @public (undocumented)
25+
// @public
2626
export type IdChangeUnsubscribeFn = () => void;
2727

2828
// @public

integration/firebase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test"
88
},
99
"devDependencies": {
10-
"firebase": "7.20.0",
10+
"firebase": "7.21.0",
1111
"@babel/core": "7.11.4",
1212
"@babel/preset-env": "7.11.0",
1313
"@types/chai": "4.2.12",

integration/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"devDependencies": {
1717
"@firebase/app": "0.6.11",
18-
"@firebase/firestore": "1.16.7",
18+
"@firebase/firestore": "1.17.0",
1919
"@types/mocha": "7.0.2",
2020
"gulp": "4.0.2",
2121
"gulp-filter": "6.0.0",

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"test:manual": "mocha --exit"
1010
},
1111
"devDependencies": {
12-
"firebase": "7.20.0",
12+
"firebase": "7.21.0",
1313
"chai": "4.2.0",
1414
"chromedriver": "84.0.1",
1515
"express": "4.17.1",

packages-exp/firebase-exp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@firebase/app-exp": "0.0.800",
4141
"@firebase/app-compat": "0.0.800",
4242
"@firebase/functions-exp": "0.0.800",
43-
"@firebase/firestore": "1.16.7"
43+
"@firebase/firestore": "1.17.0"
4444
},
4545
"devDependencies": {
4646
"rollup": "2.26.7",

packages-exp/installations-exp/src/api/delete-installations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { FirebaseInstallationsImpl } from '../interfaces/installation-impl';
2323
import { FirebaseInstallations } from '@firebase/installations-types-exp';
2424

2525
/**
26+
* Deletes the Firebase Installation and all associated data.
27+
*
2628
* @public
2729
*/
2830
export async function deleteInstallations(

packages-exp/installations-exp/src/api/get-id.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import { FirebaseInstallationsImpl } from '../interfaces/installation-impl';
2121
import { FirebaseInstallations } from '@firebase/installations-types-exp';
2222

2323
/**
24+
* Creates a Firebase Installation if there isn't one for the app and
25+
* returns the Installation ID.
26+
*
2427
* @public
2528
*/
2629
export async function getId(

packages-exp/installations-exp/src/api/get-installations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { FirebaseInstallations } from '@firebase/installations-types-exp';
2020
import { _getProvider } from '@firebase/app-exp';
2121

2222
/**
23+
* Returns an instance of FirebaseInstallations associated with the given FirebaseApp instance.
24+
*
2325
* @public
2426
*/
2527
export function getInstallations(app: FirebaseApp): FirebaseInstallations {

packages-exp/installations-exp/src/api/get-token.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import {
2424
import { FirebaseInstallations } from '@firebase/installations-types-exp';
2525

2626
/**
27+
* Returns an Installation auth token, identifying the current Firebase Installation.
28+
*
2729
* @public
2830
*/
2931
export async function getToken(

packages-exp/installations-exp/src/api/on-id-change.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ import { FirebaseInstallationsImpl } from '../interfaces/installation-impl';
2020
import { FirebaseInstallations } from '@firebase/installations-types-exp';
2121

2222
/**
23+
* An user defined callback function that gets called when Installations ID changes.
24+
*
2325
* @public
2426
*/
2527
export type IdChangeCallbackFn = (installationId: string) => void;
2628
/**
29+
* Unsubscribe a callback function previously added via {@link #IdChangeCallbackFn}.
30+
*
2731
* @public
2832
*/
2933
export type IdChangeUnsubscribeFn = () => void;

packages-exp/installations-types-exp/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717

1818
/**
19+
* Public interface of the FirebaseInstallations SDK.
20+
*
1921
* @public
2022
*/
2123
export interface FirebaseInstallations {}

packages-exp/installations-types-exp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
"devDependencies": {
3131
"typescript": "4.0.2"
3232
}
33-
}
33+
}

packages-exp/performance-exp/index.ts

Lines changed: 0 additions & 83 deletions
This file was deleted.

packages-exp/performance-exp/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@
2222
"prettier": "prettier --write '{src,test}/**/*.{js,ts}'"
2323
},
2424
"peerDependencies": {
25-
"@firebase/app": "0.x",
26-
"@firebase/app-types": "0.x"
25+
"@firebase/app-exp": "0.x",
26+
"@firebase/app-types-exp": "0.x"
2727
},
2828
"dependencies": {
2929
"@firebase/logger": "0.2.6",
30-
"@firebase/installations": "0.4.17",
30+
"@firebase/installations-exp": "0.0.800",
3131
"@firebase/util": "0.3.2",
3232
"@firebase/performance-types-exp": "0.0.800",
3333
"@firebase/component": "0.1.19",
3434
"tslib": "^1.11.1"
3535
},
3636
"license": "Apache-2.0",
3737
"devDependencies": {
38-
"@firebase/app": "0.6.11",
38+
"@firebase/app-exp": "0.0.800",
3939
"rollup": "2.26.7",
4040
"rollup-plugin-json": "4.0.0",
4141
"rollup-plugin-typescript2": "0.27.2",

packages-exp/performance-exp/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const es5BuildPlugins = [typescriptPlugin({ typescript }), json()];
3131

3232
const es5Builds = [
3333
{
34-
input: 'index.ts',
34+
input: 'src/index.ts',
3535
output: [
3636
{ file: pkg.main, format: 'cjs', sourcemap: true },
3737
{ file: pkg.module, format: 'es', sourcemap: true }
@@ -59,7 +59,7 @@ const es2017BuildPlugins = [
5959

6060
const es2017Builds = [
6161
{
62-
input: 'index.ts',
62+
input: 'src/index.ts',
6363
output: [{ file: pkg.esm2017, format: 'es', sourcemap: true }],
6464
plugins: es2017BuildPlugins,
6565
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))

packages-exp/performance-exp/src/controllers/perf.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { stub } from 'sinon';
2020
import { PerformanceController } from '../controllers/perf';
2121
import { Trace } from '../resources/trace';
2222
import { Api, setupApi } from '../services/api_service';
23-
import { FirebaseApp } from '@firebase/app-types';
23+
import { FirebaseApp } from '@firebase/app-types-exp';
2424
import * as initializationService from '../services/initialization_service';
2525
import * as FirebaseUtil from '@firebase/util';
2626
import { consoleLogger } from '../utils/console_logger';

packages-exp/performance-exp/src/controllers/perf.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ import { setupOobResources } from '../services/oob_resources_service';
1919
import { SettingsService } from '../services/settings_service';
2020
import { getInitializationPromise } from '../services/initialization_service';
2121
import { Api } from '../services/api_service';
22-
import { FirebaseApp } from '@firebase/app-types';
23-
import { FirebasePerformance } from '@firebase/performance-types';
22+
import { FirebaseApp } from '@firebase/app-types-exp';
23+
import { FirebasePerformance } from '@firebase/performance-types-exp';
2424
import { setupTransportService } from '../services/transport_service';
2525
import { validateIndexedDBOpenable } from '@firebase/util';
2626
import { consoleLogger } from '../utils/console_logger';
27+
2728
export class PerformanceController implements FirebasePerformance {
2829
constructor(readonly app: FirebaseApp) {
2930
if (Api.getInstance().requiredApisAvailable()) {
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { FirebaseApp } from '@firebase/app-types-exp';
19+
import { FirebasePerformance } from '@firebase/performance-types-exp';
20+
import { ERROR_FACTORY, ErrorCode } from './utils/errors';
21+
import { setupApi } from './services/api_service';
22+
import { PerformanceController } from './controllers/perf';
23+
import {
24+
_registerComponent,
25+
_getProvider,
26+
registerVersion
27+
} from '@firebase/app-exp';
28+
import {
29+
InstanceFactory,
30+
ComponentContainer,
31+
Component,
32+
ComponentType
33+
} from '@firebase/component';
34+
import { SettingsService } from './services/settings_service';
35+
import { name, version } from '../package.json';
36+
37+
const DEFAULT_ENTRY_NAME = '[DEFAULT]';
38+
39+
export function getPerformance(app: FirebaseApp): FirebasePerformance {
40+
const provider = _getProvider(app, 'performance-exp');
41+
const perfInstance = provider.getImmediate() as PerformanceController;
42+
return perfInstance;
43+
}
44+
45+
const factory: InstanceFactory<'performance-exp'> = (
46+
container: ComponentContainer
47+
) => {
48+
// Dependencies
49+
const app = container.getProvider('app-exp').getImmediate();
50+
const installations = container
51+
.getProvider('installations-exp-internal')
52+
.getImmediate();
53+
54+
if (app.name !== DEFAULT_ENTRY_NAME) {
55+
throw ERROR_FACTORY.create(ErrorCode.FB_NOT_DEFAULT);
56+
}
57+
if (typeof window === 'undefined') {
58+
throw ERROR_FACTORY.create(ErrorCode.NO_WINDOW);
59+
}
60+
setupApi(window);
61+
SettingsService.getInstance().firebaseAppInstance = app;
62+
SettingsService.getInstance().installationsService = installations;
63+
return new PerformanceController(app);
64+
};
65+
66+
export function registerPerformance(): void {
67+
_registerComponent(
68+
new Component('performance-exp', factory, ComponentType.PUBLIC)
69+
);
70+
}
71+
72+
registerPerformance();
73+
registerVersion(name, version);

packages-exp/performance-exp/src/resources/trace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
isValidMetricName,
3636
convertMetricValueToInteger
3737
} from '../utils/metric_utils';
38-
import { PerformanceTrace } from '@firebase/performance-types';
38+
import { PerformanceTrace } from '@firebase/performance-types-exp';
3939

4040
const enum TraceState {
4141
UNINITIALIZED = 1,

0 commit comments

Comments
 (0)