File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,13 @@ import {
24
24
Component ,
25
25
ComponentType ,
26
26
InstanceFactory ,
27
- ComponentContainer
27
+ ComponentContainer ,
28
+ InstanceFactoryOptions
28
29
} from '@firebase/component' ;
29
30
import { Functions as FunctionsServiceExp } from '@firebase/functions-exp' ;
30
31
32
+ const DEFAULT_REGION = 'us-central1' ;
33
+
31
34
declare module '@firebase/component' {
32
35
interface NameServiceMapping {
33
36
'app-compat' : FirebaseApp ;
@@ -38,14 +41,14 @@ declare module '@firebase/component' {
38
41
39
42
const factory : InstanceFactory < 'functions-compat' > = (
40
43
container : ComponentContainer ,
41
- regionOrCustomDomain ?: string
44
+ { instanceIdentifier : regionOrCustomDomain } : InstanceFactoryOptions
42
45
) => {
43
46
// Dependencies
44
47
const app = container . getProvider ( 'app-compat' ) . getImmediate ( ) ;
45
48
const functionsServiceExp = container
46
49
. getProvider ( 'functions-exp' )
47
50
. getImmediate ( {
48
- identifier : regionOrCustomDomain
51
+ identifier : regionOrCustomDomain ?? DEFAULT_REGION
49
52
} ) ;
50
53
51
54
return new FunctionsService ( app , functionsServiceExp ) ;
Original file line number Diff line number Diff line change @@ -25,8 +25,6 @@ import {
25
25
} from '@firebase/component' ;
26
26
import { FUNCTIONS_TYPE } from './constants' ;
27
27
28
- export const DEFAULT_REGION = 'us-central1' ;
29
-
30
28
export function registerFunctions ( fetchImpl : typeof fetch ) : void {
31
29
const factory : InstanceFactory < 'functions' > = (
32
30
container : ComponentContainer ,
You can’t perform that action at this time.
0 commit comments