-
Notifications
You must be signed in to change notification settings - Fork 391
Allow FCM to auto-generate typings, separate internal vs external APIs #982
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6945398
Add progress
MathBunny 1d141e0
Add progress
MathBunny 9fa689e
Progress
MathBunny 2dfd308
tmp
MathBunny 6e9b3d4
Merge branch 'master' of https://github.com/firebase/firebase-admin-n…
MathBunny dc42d15
Add index
MathBunny 72e664f
fix: cleanup
MathBunny 1e38fe3
fix: Add back newline
MathBunny 43dfbbb
fix: Add missing interfaces
MathBunny 99e7f83
fix: Alphabetical order of imports/exports
MathBunny f5d9b58
fix: Align newlines with former code
MathBunny ac5f2c8
fix: Move messaging-types-internal to messaging-internal
MathBunny 1b84c2f
Resolve merge conflicts
MathBunny d433964
fix: Retain order of curated files in gulpfile
MathBunny 737be18
fix: Remove appended comma for last list element in gulpfile
MathBunny df96dd2
fix: Add missing MessagingDevicesResponse interface from barrel export
MathBunny 726d66a
fix: Add trailing comma and separate legacy types
MathBunny 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
File renamed without changes.
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,41 @@ | ||
/*! | ||
* Copyright 2020 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file 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 { FirebaseApp } from '../firebase-app'; | ||
import * as messagingApi from './messaging'; | ||
import * as firebaseAdmin from '../index'; | ||
|
||
export function messaging(app?: FirebaseApp): messagingApi.Messaging { | ||
if (typeof(app) === 'undefined') { | ||
app = firebaseAdmin.app(); | ||
} | ||
return app.messaging(); | ||
} | ||
|
||
/** | ||
* We must define a namespace to make the typings work correctly. Otherwise | ||
* `admin.messaging()` cannot be called like a function. Temporarily, | ||
* admin.messaging is used as the namespace name because we cannot barrel | ||
* re-export the contents from messsaging, and we want it to | ||
* match the namespacing in the re-export inside src/index.d.ts | ||
*/ | ||
/* eslint-disable @typescript-eslint/no-namespace */ | ||
export namespace admin.messaging { | ||
// See https://github.com/microsoft/TypeScript/issues/4336 | ||
// Allows for exposing classes as interfaces in typings | ||
/* eslint-disable @typescript-eslint/no-empty-interface */ | ||
export interface Messaging extends messagingApi.Messaging {} | ||
} |
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
File renamed without changes.
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,23 @@ | ||
/*! | ||
* Copyright 2020 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file 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. | ||
*/ | ||
|
||
// Keys which are not allowed in the messaging data payload object. | ||
export const BLACKLISTED_DATA_PAYLOAD_KEYS = ['from']; | ||
|
||
// Keys which are not allowed in the messaging options object. | ||
export const BLACKLISTED_OPTIONS_KEYS = [ | ||
'condition', 'data', 'notification', 'registrationIds', 'registration_ids', 'to', | ||
]; |
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.