From e0309536da8a46fcf7b8994c31df798e7ac49e23 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 23 Aug 2021 11:22:56 -0700 Subject: [PATCH 1/2] Add app property to typings of all services --- common/api-review/auth.api.md | 1 + common/api-review/installations.api.md | 83 +++++----- common/api-review/messaging-sw.api.md | 137 ++++++++-------- common/api-review/messaging.api.md | 139 ++++++++-------- common/api-review/performance.api.md | 109 ++++++------- common/api-review/remote-config.api.md | 153 +++++++++--------- packages/auth/src/model/public_types.ts | 7 +- .../src/interfaces/public-types.ts | 9 +- .../messaging/src/interfaces/public-types.ts | 9 +- packages/performance/src/public_types.ts | 7 + packages/remote-config/src/public_types.ts | 6 + packages/storage/src/public-types.ts | 2 +- 12 files changed, 349 insertions(+), 313 deletions(-) diff --git a/common/api-review/auth.api.md b/common/api-review/auth.api.md index 0155a4509fd..7c16552b6f4 100644 --- a/common/api-review/auth.api.md +++ b/common/api-review/auth.api.md @@ -80,6 +80,7 @@ export function applyActionCode(auth: Auth, oobCode: string): Promise; // @public export interface Auth { + readonly app: FirebaseApp; readonly config: Config; readonly currentUser: User | null; readonly emulatorConfig: EmulatorConfig | null; diff --git a/common/api-review/installations.api.md b/common/api-review/installations.api.md index d6f978290cb..4b1465b1cb8 100644 --- a/common/api-review/installations.api.md +++ b/common/api-review/installations.api.md @@ -1,41 +1,42 @@ -## API Report File for "@firebase/installations" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { FirebaseApp } from '@firebase/app'; - -// @public -export function deleteInstallations(installations: Installations): Promise; - -// @internal -export interface _FirebaseInstallationsInternal { - getId(): Promise; - getToken(forceRefresh?: boolean): Promise; -} - -// @public -export function getId(installations: Installations): Promise; - -// @public -export function getInstallations(app?: FirebaseApp): Installations; - -// @public -export function getToken(installations: Installations, forceRefresh?: boolean): Promise; - -// @public -export type IdChangeCallbackFn = (installationId: string) => void; - -// @public -export type IdChangeUnsubscribeFn = () => void; - -// @public -export interface Installations { -} - -// @public -export function onIdChange(installations: Installations, callback: IdChangeCallbackFn): IdChangeUnsubscribeFn; - - -``` +## API Report File for "@firebase/installations" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { FirebaseApp } from '@firebase/app'; + +// @public +export function deleteInstallations(installations: Installations): Promise; + +// @internal +export interface _FirebaseInstallationsInternal { + getId(): Promise; + getToken(forceRefresh?: boolean): Promise; +} + +// @public +export function getId(installations: Installations): Promise; + +// @public +export function getInstallations(app?: FirebaseApp): Installations; + +// @public +export function getToken(installations: Installations, forceRefresh?: boolean): Promise; + +// @public +export type IdChangeCallbackFn = (installationId: string) => void; + +// @public +export type IdChangeUnsubscribeFn = () => void; + +// @public +export interface Installations { + app: FirebaseApp; +} + +// @public +export function onIdChange(installations: Installations, callback: IdChangeCallbackFn): IdChangeUnsubscribeFn; + + +``` diff --git a/common/api-review/messaging-sw.api.md b/common/api-review/messaging-sw.api.md index 30c02c096da..bff14180926 100644 --- a/common/api-review/messaging-sw.api.md +++ b/common/api-review/messaging-sw.api.md @@ -1,68 +1,69 @@ -## API Report File for "@firebase/messaging-sw" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { FirebaseApp } from '@firebase/app'; -import { NextFn } from '@firebase/util'; -import { Observer } from '@firebase/util'; -import { Unsubscribe } from '@firebase/util'; - -// @public -export function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void; - -// @public -export interface FcmOptions { - analyticsLabel?: string; - link?: string; -} - -// @public -export function getMessaging(app?: FirebaseApp): Messaging; - -// @public -export interface GetTokenOptions { - serviceWorkerRegistration?: ServiceWorkerRegistration; - vapidKey?: string; -} - -// @public -export function isSupported(): Promise; - -// @public -export interface MessagePayload { - collapseKey: string; - data?: { - [key: string]: string; - }; - fcmOptions?: FcmOptions; - from: string; - messageId: string; - notification?: NotificationPayload; -} - -// @public -export interface Messaging { -} - -export { NextFn } - -// @public -export interface NotificationPayload { - body?: string; - image?: string; - title?: string; -} - -export { Observer } - -// @public -export function onBackgroundMessage(messaging: Messaging, nextOrObserver: NextFn | Observer): Unsubscribe; - -export { Unsubscribe } - - -// (No @packageDocumentation comment for this package) - -``` +## API Report File for "@firebase/messaging-sw" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { FirebaseApp } from '@firebase/app'; +import { NextFn } from '@firebase/util'; +import { Observer } from '@firebase/util'; +import { Unsubscribe } from '@firebase/util'; + +// @public +export function experimentalSetDeliveryMetricsExportedToBigQueryEnabled(messaging: Messaging, enable: boolean): void; + +// @public +export interface FcmOptions { + analyticsLabel?: string; + link?: string; +} + +// @public +export function getMessaging(app?: FirebaseApp): Messaging; + +// @public +export interface GetTokenOptions { + serviceWorkerRegistration?: ServiceWorkerRegistration; + vapidKey?: string; +} + +// @public +export function isSupported(): Promise; + +// @public +export interface MessagePayload { + collapseKey: string; + data?: { + [key: string]: string; + }; + fcmOptions?: FcmOptions; + from: string; + messageId: string; + notification?: NotificationPayload; +} + +// @public +export interface Messaging { + app: FirebaseApp; +} + +export { NextFn } + +// @public +export interface NotificationPayload { + body?: string; + image?: string; + title?: string; +} + +export { Observer } + +// @public +export function onBackgroundMessage(messaging: Messaging, nextOrObserver: NextFn | Observer): Unsubscribe; + +export { Unsubscribe } + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/common/api-review/messaging.api.md b/common/api-review/messaging.api.md index 002d864c9b9..f01c41abdac 100644 --- a/common/api-review/messaging.api.md +++ b/common/api-review/messaging.api.md @@ -1,69 +1,70 @@ -## API Report File for "@firebase/messaging" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { FirebaseApp } from '@firebase/app'; -import { NextFn } from '@firebase/util'; -import { Observer } from '@firebase/util'; -import { Unsubscribe } from '@firebase/util'; - -// @public -export function deleteToken(messaging: Messaging): Promise; - -// @public -export interface FcmOptions { - analyticsLabel?: string; - link?: string; -} - -// @public -export function getMessaging(app?: FirebaseApp): Messaging; - -// @public -export function getToken(messaging: Messaging, options?: GetTokenOptions): Promise; - -// @public -export interface GetTokenOptions { - serviceWorkerRegistration?: ServiceWorkerRegistration; - vapidKey?: string; -} - -// @public -export function isSupported(): Promise; - -// @public -export interface MessagePayload { - collapseKey: string; - data?: { - [key: string]: string; - }; - fcmOptions?: FcmOptions; - from: string; - messageId: string; - notification?: NotificationPayload; -} - -// @public -export interface Messaging { -} - -export { NextFn } - -// @public -export interface NotificationPayload { - body?: string; - image?: string; - title?: string; -} - -export { Observer } - -// @public -export function onMessage(messaging: Messaging, nextOrObserver: NextFn | Observer): Unsubscribe; - -export { Unsubscribe } - - -``` +## API Report File for "@firebase/messaging" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { FirebaseApp } from '@firebase/app'; +import { NextFn } from '@firebase/util'; +import { Observer } from '@firebase/util'; +import { Unsubscribe } from '@firebase/util'; + +// @public +export function deleteToken(messaging: Messaging): Promise; + +// @public +export interface FcmOptions { + analyticsLabel?: string; + link?: string; +} + +// @public +export function getMessaging(app?: FirebaseApp): Messaging; + +// @public +export function getToken(messaging: Messaging, options?: GetTokenOptions): Promise; + +// @public +export interface GetTokenOptions { + serviceWorkerRegistration?: ServiceWorkerRegistration; + vapidKey?: string; +} + +// @public +export function isSupported(): Promise; + +// @public +export interface MessagePayload { + collapseKey: string; + data?: { + [key: string]: string; + }; + fcmOptions?: FcmOptions; + from: string; + messageId: string; + notification?: NotificationPayload; +} + +// @public +export interface Messaging { + app: FirebaseApp; +} + +export { NextFn } + +// @public +export interface NotificationPayload { + body?: string; + image?: string; + title?: string; +} + +export { Observer } + +// @public +export function onMessage(messaging: Messaging, nextOrObserver: NextFn | Observer): Unsubscribe; + +export { Unsubscribe } + + +``` diff --git a/common/api-review/performance.api.md b/common/api-review/performance.api.md index 81e26749a7a..0de7ee63704 100644 --- a/common/api-review/performance.api.md +++ b/common/api-review/performance.api.md @@ -1,54 +1,55 @@ -## API Report File for "@firebase/performance" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { FirebaseApp } from '@firebase/app'; - -// @public -export interface FirebasePerformance { - dataCollectionEnabled: boolean; - instrumentationEnabled: boolean; -} - -// @public -export function getPerformance(app?: FirebaseApp): FirebasePerformance; - -// @public -export function initializePerformance(app: FirebaseApp, settings?: PerformanceSettings): FirebasePerformance; - -// @public -export interface PerformanceSettings { - dataCollectionEnabled?: boolean; - instrumentationEnabled?: boolean; -} - -// @public -export interface PerformanceTrace { - getAttribute(attr: string): string | undefined; - getAttributes(): { - [key: string]: string; - }; - getMetric(metricName: string): number; - incrementMetric(metricName: string, num?: number): void; - putAttribute(attr: string, value: string): void; - putMetric(metricName: string, num: number): void; - record(startTime: number, duration: number, options?: { - metrics?: { - [key: string]: number; - }; - attributes?: { - [key: string]: string; - }; - }): void; - removeAttribute(attr: string): void; - start(): void; - stop(): void; -} - -// @public -export function trace(performance: FirebasePerformance, name: string): PerformanceTrace; - - -``` +## API Report File for "@firebase/performance" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { FirebaseApp } from '@firebase/app'; + +// @public +export interface FirebasePerformance { + app: FirebaseApp; + dataCollectionEnabled: boolean; + instrumentationEnabled: boolean; +} + +// @public +export function getPerformance(app?: FirebaseApp): FirebasePerformance; + +// @public +export function initializePerformance(app: FirebaseApp, settings?: PerformanceSettings): FirebasePerformance; + +// @public +export interface PerformanceSettings { + dataCollectionEnabled?: boolean; + instrumentationEnabled?: boolean; +} + +// @public +export interface PerformanceTrace { + getAttribute(attr: string): string | undefined; + getAttributes(): { + [key: string]: string; + }; + getMetric(metricName: string): number; + incrementMetric(metricName: string, num?: number): void; + putAttribute(attr: string, value: string): void; + putMetric(metricName: string, num: number): void; + record(startTime: number, duration: number, options?: { + metrics?: { + [key: string]: number; + }; + attributes?: { + [key: string]: string; + }; + }): void; + removeAttribute(attr: string): void; + start(): void; + stop(): void; +} + +// @public +export function trace(performance: FirebasePerformance, name: string): PerformanceTrace; + + +``` diff --git a/common/api-review/remote-config.api.md b/common/api-review/remote-config.api.md index 6b97c4aa59a..8ddf568d0c0 100644 --- a/common/api-review/remote-config.api.md +++ b/common/api-review/remote-config.api.md @@ -1,76 +1,77 @@ -## API Report File for "@firebase/remote-config" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { FirebaseApp } from '@firebase/app'; - -// @public -export function activate(remoteConfig: RemoteConfig): Promise; - -// @public -export function ensureInitialized(remoteConfig: RemoteConfig): Promise; - -// @public -export function fetchAndActivate(remoteConfig: RemoteConfig): Promise; - -// @public -export function fetchConfig(remoteConfig: RemoteConfig): Promise; - -// @public -export type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle'; - -// @public -export function getAll(remoteConfig: RemoteConfig): Record; - -// @public -export function getBoolean(remoteConfig: RemoteConfig, key: string): boolean; - -// @public -export function getNumber(remoteConfig: RemoteConfig, key: string): number; - -// @public (undocumented) -export function getRemoteConfig(app?: FirebaseApp): RemoteConfig; - -// @public -export function getString(remoteConfig: RemoteConfig, key: string): string; - -// @public -export function getValue(remoteConfig: RemoteConfig, key: string): Value; - -// @public -export type LogLevel = 'debug' | 'error' | 'silent'; - -// @public -export interface RemoteConfig { - defaultConfig: { - [key: string]: string | number | boolean; - }; - fetchTimeMillis: number; - lastFetchStatus: FetchStatus; - settings: RemoteConfigSettings; -} - -// @public -export interface RemoteConfigSettings { - fetchTimeoutMillis: number; - minimumFetchIntervalMillis: number; -} - -// @public -export function setLogLevel(remoteConfig: RemoteConfig, logLevel: LogLevel): void; - -// @public -export interface Value { - asBoolean(): boolean; - asNumber(): number; - asString(): string; - getSource(): ValueSource; -} - -// @public -export type ValueSource = 'static' | 'default' | 'remote'; - - -``` +## API Report File for "@firebase/remote-config" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { FirebaseApp } from '@firebase/app'; + +// @public +export function activate(remoteConfig: RemoteConfig): Promise; + +// @public +export function ensureInitialized(remoteConfig: RemoteConfig): Promise; + +// @public +export function fetchAndActivate(remoteConfig: RemoteConfig): Promise; + +// @public +export function fetchConfig(remoteConfig: RemoteConfig): Promise; + +// @public +export type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle'; + +// @public +export function getAll(remoteConfig: RemoteConfig): Record; + +// @public +export function getBoolean(remoteConfig: RemoteConfig, key: string): boolean; + +// @public +export function getNumber(remoteConfig: RemoteConfig, key: string): number; + +// @public (undocumented) +export function getRemoteConfig(app?: FirebaseApp): RemoteConfig; + +// @public +export function getString(remoteConfig: RemoteConfig, key: string): string; + +// @public +export function getValue(remoteConfig: RemoteConfig, key: string): Value; + +// @public +export type LogLevel = 'debug' | 'error' | 'silent'; + +// @public +export interface RemoteConfig { + app: FirebaseApp; + defaultConfig: { + [key: string]: string | number | boolean; + }; + fetchTimeMillis: number; + lastFetchStatus: FetchStatus; + settings: RemoteConfigSettings; +} + +// @public +export interface RemoteConfigSettings { + fetchTimeoutMillis: number; + minimumFetchIntervalMillis: number; +} + +// @public +export function setLogLevel(remoteConfig: RemoteConfig, logLevel: LogLevel): void; + +// @public +export interface Value { + asBoolean(): boolean; + asNumber(): number; + asString(): string; + getSource(): ValueSource; +} + +// @public +export type ValueSource = 'static' | 'default' | 'remote'; + + +``` diff --git a/packages/auth/src/model/public_types.ts b/packages/auth/src/model/public_types.ts index 49117bbf859..92adb411a0c 100644 --- a/packages/auth/src/model/public_types.ts +++ b/packages/auth/src/model/public_types.ts @@ -15,6 +15,7 @@ * limitations under the License. */ +import { FirebaseApp } from '@firebase/app'; import { CompleteFn, ErrorFn, @@ -170,12 +171,14 @@ export interface AuthSettings { * @public */ export interface Auth { - /** The name of the app associated with the Auth service instance. */ + /** The {@link @firebase/app#FirebaseApp} associated with the `Auth` service instance. */ + readonly app: FirebaseApp; + /** The name of the app associated with the `Auth` service instance. */ readonly name: string; /** The {@link Config} used to initialize this instance. */ readonly config: Config; /** - * Changes the type of persistence on the {@link Auth} instance. + * Changes the type of persistence on the `Auth` instance. * * @remarks * This will affect the currently saved Auth session and applies this type of persistence for diff --git a/packages/installations/src/interfaces/public-types.ts b/packages/installations/src/interfaces/public-types.ts index 559d3f6cb2c..c619127f472 100644 --- a/packages/installations/src/interfaces/public-types.ts +++ b/packages/installations/src/interfaces/public-types.ts @@ -15,12 +15,19 @@ * limitations under the License. */ +import { FirebaseApp } from '@firebase/app'; + /** * Public interface of the Firebase Installations SDK. * * @public */ -export interface Installations {} +export interface Installations { + /** + * The {@link @firebase/app#FirebaseApp} this `Installations` instance is associated with. + */ + app: FirebaseApp; +} /** * An interface for Firebase internal SDKs use only. diff --git a/packages/messaging/src/interfaces/public-types.ts b/packages/messaging/src/interfaces/public-types.ts index cb9f7aefa77..382db13a640 100644 --- a/packages/messaging/src/interfaces/public-types.ts +++ b/packages/messaging/src/interfaces/public-types.ts @@ -15,6 +15,8 @@ * limitations under the License. */ +import { FirebaseApp } from '@firebase/app'; + /** * Display notification details. They are sent through the * {@link https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#notification | Send API} @@ -131,7 +133,12 @@ export interface GetTokenOptions { * * @public */ -export interface Messaging {} +export interface Messaging { + /** + * The {@link @firebase/app#FirebaseApp} this `Messaging` instance is associated with. + */ + app: FirebaseApp; +} /** * @internal diff --git a/packages/performance/src/public_types.ts b/packages/performance/src/public_types.ts index 36cce416239..56b3c177697 100644 --- a/packages/performance/src/public_types.ts +++ b/packages/performance/src/public_types.ts @@ -15,6 +15,8 @@ * limitations under the License. */ +import { FirebaseApp } from '@firebase/app'; + /** * Defines configuration options for the Performance Monitoring SDK. * @@ -34,6 +36,11 @@ export interface PerformanceSettings { * @public */ export interface FirebasePerformance { + /** + * The {@link @firebase/app#FirebaseApp} this `FirebasePerformance` instance is associated with. + */ + app: FirebaseApp; + /** * Controls the logging of automatic traces and HTTP/S network monitoring. */ diff --git a/packages/remote-config/src/public_types.ts b/packages/remote-config/src/public_types.ts index eadfac15dbc..843841ef57d 100644 --- a/packages/remote-config/src/public_types.ts +++ b/packages/remote-config/src/public_types.ts @@ -15,12 +15,18 @@ * limitations under the License. */ +import { FirebaseApp } from '@firebase/app'; + /** * The Firebase Remote Config service interface. * * @public */ export interface RemoteConfig { + /** + * The {@link @firebase/app#FirebaseApp} this `RemoteConfig` instance is associated with. + */ + app: FirebaseApp; /** * Defines configuration for the Remote Config SDK. */ diff --git a/packages/storage/src/public-types.ts b/packages/storage/src/public-types.ts index 12b61c4a55a..36f4e7a2865 100644 --- a/packages/storage/src/public-types.ts +++ b/packages/storage/src/public-types.ts @@ -31,7 +31,7 @@ import { */ export interface FirebaseStorage extends _FirebaseService { /** - * FirebaseApp associated with this StorageService instance. + * The `FirebaseApp` associated with this `FirebaseStorage` instance. */ readonly app: FirebaseApp; From 13926c31c8a95a3acfffdcf25648ba47b75e5566 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 23 Aug 2021 11:50:10 -0700 Subject: [PATCH 2/2] Update packages/storage/src/public-types.ts Co-authored-by: Feiyang --- packages/storage/src/public-types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/storage/src/public-types.ts b/packages/storage/src/public-types.ts index 36f4e7a2865..b2890cf0bfc 100644 --- a/packages/storage/src/public-types.ts +++ b/packages/storage/src/public-types.ts @@ -31,7 +31,7 @@ import { */ export interface FirebaseStorage extends _FirebaseService { /** - * The `FirebaseApp` associated with this `FirebaseStorage` instance. + * The {@link @firebase/app#FirebaseApp} associated with this `FirebaseStorage` instance. */ readonly app: FirebaseApp;