-
Notifications
You must be signed in to change notification settings - Fork 2.3k
refactor(installations)!: migrate to TypeScript #9002
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
Open
russellwheatley
wants to merge
13
commits into
main
Choose a base branch
from
installations-typescript
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f3b3877
refactor(installations): convert package sources to TypeScript
russellwheatley 73fca45
refactor(installations): split modular and namespaced TypeScript surf…
russellwheatley a290ca0
refactor(installations): type namespaced module and native bridge
russellwheatley 12f6843
refactor(installations): align modular API with firebase-js-sdk
russellwheatley fc4d881
test(installations): add type coverage and compare-types wiring
russellwheatley ffded1d
chore: update namespace types
russellwheatley 3ce5166
yarn.lock
russellwheatley 0db9870
test: expect error for modular and namespace api
russellwheatley d43aed9
fix: typedoc.json updated
russellwheatley 7d8b860
Merge branch 'main' into installations-typescript
russellwheatley 7716bb8
chore: move installation type config to flat directories
russellwheatley 00ef079
yarn.lock
russellwheatley 2dd2b23
chore: import installations types
russellwheatley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| * 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. | ||
| * | ||
| */ | ||
|
|
||
| import { getApp } from '@react-native-firebase/app'; | ||
| import type { FirebaseApp } from '@react-native-firebase/app'; | ||
| import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common'; | ||
| import type { | ||
| IdChangeCallbackFn, | ||
| IdChangeUnsubscribeFn, | ||
| Installations, | ||
| } from './types/installations'; | ||
| import type { InstallationsInternal } from './types/internal'; | ||
|
|
||
| function withModularDeprecationArg(installations: Installations): InstallationsInternal { | ||
| return installations as InstallationsInternal; | ||
| } | ||
|
|
||
| /** | ||
| * Returns an instance of Installations associated with the given FirebaseApp instance. | ||
| */ | ||
| export function getInstallations(app?: FirebaseApp): Installations { | ||
| if (app) { | ||
| return getApp(app.name).installations(); | ||
| } | ||
| return getApp().installations(); | ||
| } | ||
|
|
||
| /** | ||
| * Deletes the Firebase Installation and all associated data. | ||
| */ | ||
| export function deleteInstallations(installations: Installations): Promise<void> { | ||
| const internalInstallations = withModularDeprecationArg(installations); | ||
| return internalInstallations.delete.call(internalInstallations, MODULAR_DEPRECATION_ARG); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a Firebase Installation if there isn't one for the app and returns the Installation ID. | ||
| */ | ||
| export function getId(installations: Installations): Promise<string> { | ||
| const internalInstallations = withModularDeprecationArg(installations); | ||
| return internalInstallations.getId.call(internalInstallations, MODULAR_DEPRECATION_ARG); | ||
| } | ||
|
|
||
| /** | ||
| * Returns a Firebase Installations auth token, identifying the current Firebase Installation. | ||
| */ | ||
| export function getToken(installations: Installations, forceRefresh?: boolean): Promise<string> { | ||
| const internalInstallations = withModularDeprecationArg(installations); | ||
| return internalInstallations.getToken.call( | ||
| internalInstallations, | ||
| forceRefresh, | ||
| MODULAR_DEPRECATION_ARG, | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Throw an error since react-native-firebase does not support this method. | ||
| * | ||
| * Sets a new callback that will get called when Installation ID changes. Returns an unsubscribe function that will remove the callback when called. | ||
| */ | ||
| export function onIdChange( | ||
| _installations: Installations, | ||
| _callback: IdChangeCallbackFn, | ||
| ): IdChangeUnsubscribeFn { | ||
| throw new Error('onIdChange() is unsupported by the React Native Firebase SDK.'); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.