Skip to content

Commit fa26bb1

Browse files
committed
Make options to factory optional.
1 parent 0453815 commit fa26bb1

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

packages-exp/functions-compat/src/register.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ declare module '@firebase/component' {
3939

4040
const factory: InstanceFactory<'functions-compat'> = (
4141
container: ComponentContainer,
42-
{ instanceIdentifier: regionOrCustomDomain }: InstanceFactoryOptions
42+
options?: InstanceFactoryOptions
4343
) => {
4444
// Dependencies
4545
const app = container.getProvider('app-compat').getImmediate();
4646
const functionsServiceExp = container
4747
.getProvider('functions-exp')
4848
.getImmediate({
49-
identifier: regionOrCustomDomain
49+
// This value is used as regionOrCustomDomain
50+
identifier: options?.instanceIdentifier
5051
});
5152

5253
return new FunctionsService(app, functionsServiceExp);

packages-exp/functions-exp/src/config.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
Component,
2222
ComponentType,
2323
ComponentContainer,
24-
InstanceFactory
24+
InstanceFactory,
25+
InstanceFactoryOptions
2526
} from '@firebase/component';
2627
import { FUNCTIONS_TYPE } from './constants';
2728

@@ -30,7 +31,7 @@ export const DEFAULT_REGION = 'us-central1';
3031
export function registerFunctions(fetchImpl: typeof fetch): void {
3132
const factory: InstanceFactory<'functions'> = (
3233
container: ComponentContainer,
33-
{ instanceIdentifier: regionOrCustomDomain }
34+
options?: InstanceFactoryOptions
3435
) => {
3536
// Dependencies
3637
const app = container.getProvider('app-exp').getImmediate();
@@ -42,7 +43,8 @@ export function registerFunctions(fetchImpl: typeof fetch): void {
4243
app,
4344
authProvider,
4445
messagingProvider,
45-
regionOrCustomDomain,
46+
// regionOrCustomDomain
47+
options?.instanceIdentifier,
4648
fetchImpl
4749
);
4850
};

packages/functions/src/config.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function registerFunctions(
4040

4141
function factory(
4242
container: ComponentContainer,
43-
{ instanceIdentifier: regionOrCustomDomain }: InstanceFactoryOptions
43+
options?: InstanceFactoryOptions
4444
): Service {
4545
// Dependencies
4646
const app = container.getProvider('app').getImmediate();
@@ -52,7 +52,8 @@ export function registerFunctions(
5252
app,
5353
authProvider,
5454
messagingProvider,
55-
regionOrCustomDomain,
55+
// regionOrCustomDomain
56+
options?.instanceIdentifier,
5657
fetchImpl
5758
);
5859
}

0 commit comments

Comments
 (0)