File tree Expand file tree Collapse file tree 6 files changed +29
-22
lines changed
packages-exp/functions-exp Expand file tree Collapse file tree 6 files changed +29
-22
lines changed Original file line number Diff line number Diff line change 51
51
"typings" : " dist/functions-exp-public.d.ts" ,
52
52
"dependencies" : {
53
53
"@firebase/component" : " 0.5.6" ,
54
- "@firebase/messaging-types" : " 0.5.0 " ,
54
+ "@firebase/messaging-interop- types" : " 0.0.1 " ,
55
55
"@firebase/auth-interop-types" : " 0.1.6" ,
56
56
"@firebase/app-check-interop-types" : " 0.1.0" ,
57
57
"@firebase/util" : " 1.3.0" ,
Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ import {
25
25
ComponentType
26
26
} from '@firebase/component' ;
27
27
import {
28
- FirebaseMessaging ,
29
- FirebaseMessagingName
30
- } from '@firebase/messaging-types' ;
28
+ MessagingInternal ,
29
+ MessagingInternalComponentName
30
+ } from '@firebase/messaging-interop- types' ;
31
31
import {
32
32
FirebaseAuthInternal ,
33
33
FirebaseAuthInternalName
@@ -139,15 +139,15 @@ describe('Firebase Functions > Call', () => {
139
139
return ;
140
140
}
141
141
// mock firebase messaging
142
- const messagingMock : FirebaseMessaging = ( {
142
+ const messagingMock : MessagingInternal = ( {
143
143
getToken : async ( ) => 'iid'
144
- } as unknown ) as FirebaseMessaging ;
145
- const messagingProvider = new Provider < FirebaseMessagingName > (
146
- 'messaging' ,
144
+ } as unknown ) as MessagingInternal ;
145
+ const messagingProvider = new Provider < MessagingInternalComponentName > (
146
+ 'messaging-internal ' ,
147
147
new ComponentContainer ( 'test' )
148
148
) ;
149
149
messagingProvider . setComponent (
150
- new Component ( 'messaging' , ( ) => messagingMock , ComponentType . PRIVATE )
150
+ new Component ( 'messaging-internal ' , ( ) => messagingMock , ComponentType . PRIVATE )
151
151
) ;
152
152
153
153
const functions = createTestService (
Original file line number Diff line number Diff line change @@ -24,19 +24,26 @@ import {
24
24
InstanceFactory
25
25
} from '@firebase/component' ;
26
26
import { FUNCTIONS_TYPE } from './constants' ;
27
+ import { FirebaseAuthInternalName } from '@firebase/auth-interop-types' ;
27
28
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types' ;
29
+ import { MessagingInternalComponentName } from '@firebase/messaging-interop-types' ;
28
30
31
+ const AUTH_INTERNAL_NAME : FirebaseAuthInternalName =
32
+ 'auth-internal' ;
29
33
const APP_CHECK_INTERNAL_NAME : AppCheckInternalComponentName =
30
34
'app-check-internal' ;
35
+ const MESSAGING_INTERNAL_NAME : MessagingInternalComponentName =
36
+ 'messaging-internal' ;
37
+
31
38
export function registerFunctions ( fetchImpl : typeof fetch ) : void {
32
39
const factory : InstanceFactory < 'functions-exp' > = (
33
40
container : ComponentContainer ,
34
41
{ instanceIdentifier : regionOrCustomDomain }
35
42
) => {
36
43
// Dependencies
37
44
const app = container . getProvider ( 'app-exp' ) . getImmediate ( ) ;
38
- const authProvider = container . getProvider ( 'auth-internal' ) ;
39
- const messagingProvider = container . getProvider ( 'messaging' ) ;
45
+ const authProvider = container . getProvider ( AUTH_INTERNAL_NAME ) ;
46
+ const messagingProvider = container . getProvider ( MESSAGING_INTERNAL_NAME ) ;
40
47
const appCheckProvider = container . getProvider ( APP_CHECK_INTERNAL_NAME ) ;
41
48
42
49
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Original file line number Diff line number Diff line change @@ -18,16 +18,16 @@ import {
18
18
* See the License for the specific language governing permissions and
19
19
* limitations under the License.
20
20
*/
21
- import {
22
- FirebaseMessaging ,
23
- FirebaseMessagingName
24
- } from '@firebase/messaging-types' ;
25
21
26
22
import { Provider } from '@firebase/component' ;
27
23
import {
28
24
AppCheckInternalComponentName ,
29
25
FirebaseAppCheckInternal
30
26
} from '@firebase/app-check-interop-types' ;
27
+ import {
28
+ MessagingInternal ,
29
+ MessagingInternalComponentName
30
+ } from '@firebase/messaging-interop-types' ;
31
31
32
32
/**
33
33
* The metadata that should be supplied with function calls.
@@ -45,11 +45,11 @@ export interface Context {
45
45
*/
46
46
export class ContextProvider {
47
47
private auth : FirebaseAuthInternal | null = null ;
48
- private messaging : FirebaseMessaging | null = null ;
48
+ private messaging : MessagingInternal | null = null ;
49
49
private appCheck : FirebaseAppCheckInternal | null = null ;
50
50
constructor (
51
51
authProvider : Provider < FirebaseAuthInternalName > ,
52
- messagingProvider : Provider < FirebaseMessagingName > ,
52
+ messagingProvider : Provider < MessagingInternalComponentName > ,
53
53
appCheckProvider : Provider < AppCheckInternalComponentName >
54
54
) {
55
55
this . auth = authProvider . getImmediate ( { optional : true } ) ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import { ContextProvider } from './context';
26
26
import { encode , decode } from './serializer' ;
27
27
import { Provider } from '@firebase/component' ;
28
28
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types' ;
29
- import { FirebaseMessagingName } from '@firebase/messaging-types' ;
29
+ import { MessagingInternalComponentName } from '@firebase/messaging-interop -types' ;
30
30
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types' ;
31
31
32
32
export const DEFAULT_REGION = 'us-central1' ;
@@ -86,7 +86,7 @@ export class FunctionsService implements _FirebaseService {
86
86
constructor (
87
87
readonly app : FirebaseApp ,
88
88
authProvider : Provider < FirebaseAuthInternalName > ,
89
- messagingProvider : Provider < FirebaseMessagingName > ,
89
+ messagingProvider : Provider < MessagingInternalComponentName > ,
90
90
appCheckProvider : Provider < AppCheckInternalComponentName > ,
91
91
regionOrCustomDomain : string = DEFAULT_REGION ,
92
92
readonly fetchImpl : typeof fetch
Original file line number Diff line number Diff line change 18
18
import { FirebaseOptions , FirebaseApp } from '@firebase/app-exp' ;
19
19
import { Provider , ComponentContainer } from '@firebase/component' ;
20
20
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types' ;
21
- import { FirebaseMessagingName } from '@firebase/messaging-types' ;
22
21
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types' ;
23
22
import { FunctionsService } from '../src/service' ;
24
23
import { connectFunctionsEmulator } from '../src/api' ;
25
24
import nodeFetch from 'node-fetch' ;
25
+ import { MessagingInternalComponentName } from '../../../packages/messaging-interop-types' ;
26
26
27
27
export function makeFakeApp ( options : FirebaseOptions = { } ) : FirebaseApp {
28
28
options = {
@@ -49,8 +49,8 @@ export function createTestService(
49
49
'auth-internal' ,
50
50
new ComponentContainer ( 'test' )
51
51
) ,
52
- messagingProvider = new Provider < FirebaseMessagingName > (
53
- 'messaging' ,
52
+ messagingProvider = new Provider < MessagingInternalComponentName > (
53
+ 'messaging-internal ' ,
54
54
new ComponentContainer ( 'test' )
55
55
) ,
56
56
appCheckProvider = new Provider < AppCheckInternalComponentName > (
You can’t perform that action at this time.
0 commit comments