Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions .github/scripts/compare-types/packages/installations/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Known differences between the firebase-js-sdk @firebase/installations public
* API and the @react-native-firebase/installations modular API.
*
* Each entry must have a `name` (the export name) and a `reason` explaining
* why the difference exists. Any difference NOT listed here will cause CI to
* fail so that new drift is caught and deliberately acknowledged.
*/

import type { PackageConfig } from '../../src/types';

const config: PackageConfig = {
nameMapping: {},
missingInRN: [],
extraInRN: [],
differentShape: [],
};

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* The Firebase Installations Web SDK.
* This SDK does not work in a Node.js environment.
*
* @packageDocumentation
*/

import { FirebaseApp } from '@firebase/app';

/**
* Deletes the Firebase Installation and all associated data.
* @param installations - The `Installations` instance.
*
* @public
*/
export declare function deleteInstallations(installations: Installations): Promise<void>;

/* Excluded from this release type: _FirebaseInstallationsInternal */

/**
* Creates a Firebase Installation if there isn't one for the app and
* returns the Installation ID.
* @param installations - The `Installations` instance.
*
* @public
*/
export declare function getId(installations: Installations): Promise<string>;

/**
* Returns an instance of {@link Installations} associated with the given
* {@link @firebase/app#FirebaseApp} instance.
* @param app - The {@link @firebase/app#FirebaseApp} instance.
*
* @public
*/
export declare function getInstallations(app?: FirebaseApp): Installations;

/**
* Returns a Firebase Installations auth token, identifying the current
* Firebase Installation.
* @param installations - The `Installations` instance.
* @param forceRefresh - Force refresh regardless of token expiration.
*
* @public
*/
export declare function getToken(
installations: Installations,
forceRefresh?: boolean,
): Promise<string>;

/**
* An user defined callback function that gets called when Installations ID changes.
*
* @public
*/
export declare type IdChangeCallbackFn = (installationId: string) => void;

/**
* Unsubscribe a callback function previously added via {@link IdChangeCallbackFn}.
*
* @public
*/
export declare type IdChangeUnsubscribeFn = () => void;

/**
* Public interface of the Firebase Installations SDK.
*
* @public
*/
export declare interface Installations {
/**
* The {@link @firebase/app#FirebaseApp} this `Installations` instance is associated with.
*/
app: FirebaseApp;
}

/**
* Sets a new callback that will get called when Installation ID changes.
* Returns an unsubscribe function that will remove the callback when called.
* @param installations - The `Installations` instance.
* @param callback - The callback function that is invoked when FID changes.
* @returns A function that can be called to unsubscribe.
*
* @public
*/
export declare function onIdChange(
installations: Installations,
callback: IdChangeCallbackFn,
): IdChangeUnsubscribeFn;

export {};
26 changes: 15 additions & 11 deletions .github/scripts/compare-types/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import aiConfig from '../packages/ai/config';
import appCheckConfig from '../packages/app-check/config';
import firestoreConfig from '../packages/firestore/config';
import firestorePipelinesConfig from '../packages/firestore-pipelines/config';
import installationsConfig from '../packages/installations/config';
import remoteConfigConfig from '../packages/remote-config/config';

const SCRIPT_DIR = path.resolve(__dirname, '..');
Expand Down Expand Up @@ -53,12 +54,7 @@ function rnDist(packageName: string): string {
export const packages: PackageEntry[] = [
{
name: 'storage',
firebaseSdkTypesPaths: [path.join(
SCRIPT_DIR,
'packages',
'storage',
'storage-js-sdk.d.ts',
)],
firebaseSdkTypesPaths: [path.join(SCRIPT_DIR, 'packages', 'storage', 'storage-js-sdk.d.ts')],
rnFirebaseModularFiles: [
path.join(rnDist('storage'), 'types', 'storage.d.ts'),
path.join(rnDist('storage'), 'modular.d.ts'),
Expand Down Expand Up @@ -121,9 +117,7 @@ export const packages: PackageEntry[] = [
},
{
name: 'app-check',
firebaseSdkTypesPaths: [
path.join(SCRIPT_DIR, 'packages', 'app-check', 'app-check-sdk.d.ts'),
],
firebaseSdkTypesPaths: [path.join(SCRIPT_DIR, 'packages', 'app-check', 'app-check-sdk.d.ts')],
rnFirebaseModularFiles: [
path.join(rnDist('app-check'), 'types', 'appcheck.d.ts'),
path.join(rnDist('app-check'), 'modular.d.ts'),
Expand All @@ -134,6 +128,18 @@ export const packages: PackageEntry[] = [
],
config: appCheckConfig,
},
{
name: 'installations',
firebaseSdkTypesPaths: [
path.join(SCRIPT_DIR, 'packages', 'installations', 'firebase-sdk.d.ts'),
],
rnFirebaseModularFiles: [
path.join(rnDist('installations'), 'types', 'installations.d.ts'),
path.join(rnDist('installations'), 'modular.d.ts'),
],
rnFirebaseSupportFiles: [path.join(rnDist('installations'), 'types', 'internal.d.ts')],
config: installationsConfig,
},
{
name: 'firestore',
firebaseSdkTypesPaths: [
Expand Down Expand Up @@ -190,5 +196,3 @@ export const packages: PackageEntry[] = [
config: firestorePipelinesConfig,
},
];


3 changes: 3 additions & 0 deletions packages/installations/__tests__/installations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ describe('installations()', function () {
const installations = getInstallations();
installationsV9Deprecation(
() => deleteInstallations(installations),
// @ts-expect-error Combines modular and namespace API
() => installations.delete(),
'delete',
);
Expand All @@ -118,6 +119,7 @@ describe('installations()', function () {
const installations = getInstallations();
installationsV9Deprecation(
() => getId(installations),
// @ts-expect-error Combines modular and namespace API
() => installations.getId(),
'getId',
);
Expand All @@ -127,6 +129,7 @@ describe('installations()', function () {
const installations = getInstallations();
installationsV9Deprecation(
() => getToken(installations),
// @ts-expect-error Combines modular and namespace API
() => installations.getToken(),
'getToken',
);
Expand Down
173 changes: 0 additions & 173 deletions packages/installations/lib/index.d.ts

This file was deleted.

27 changes: 27 additions & 0 deletions packages/installations/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2016-present Invertase Limited & Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this library except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Export modular/public types.
export type * from './types/installations';

// Export modular API functions.
export * from './modular';

// Export namespaced API.
export type { FirebaseInstallationsTypes } from './types/namespaced';
export * from './namespaced';
export { default } from './namespaced';
Loading
Loading