@@ -30,9 +30,10 @@ import {
30
30
_FirebaseAppInternal as _FirebaseAppExp
31
31
} from '@firebase/app-exp' ;
32
32
import { _FirebaseService , _FirebaseNamespace } from './types' ;
33
+ import { Compat } from '@firebase/util' ;
33
34
34
35
// eslint-disable-next-line @typescript-eslint/naming-convention
35
- export interface _FirebaseApp {
36
+ export interface _FirebaseApp extends Compat < _FirebaseAppExp > {
36
37
/**
37
38
* The (read-only) name (identifier) for this App. '[DEFAULT]' is the default
38
39
* App.
@@ -62,41 +63,41 @@ export class FirebaseAppImpl implements _FirebaseApp {
62
63
private container : ComponentContainer ;
63
64
64
65
constructor (
65
- private readonly app : _FirebaseAppExp ,
66
+ readonly _delegate : _FirebaseAppExp ,
66
67
private readonly firebase : _FirebaseNamespace
67
68
) {
68
69
// add itself to container
69
70
_addComponent (
70
- app ,
71
+ _delegate ,
71
72
new Component ( 'app-compat' , ( ) => this , ComponentType . PUBLIC )
72
73
) ;
73
74
74
- this . container = app . container ;
75
+ this . container = _delegate . container ;
75
76
}
76
77
77
78
get automaticDataCollectionEnabled ( ) : boolean {
78
- return this . app . automaticDataCollectionEnabled ;
79
+ return this . _delegate . automaticDataCollectionEnabled ;
79
80
}
80
81
81
82
set automaticDataCollectionEnabled ( val ) {
82
- this . app . automaticDataCollectionEnabled = val ;
83
+ this . _delegate . automaticDataCollectionEnabled = val ;
83
84
}
84
85
85
86
get name ( ) : string {
86
- return this . app . name ;
87
+ return this . _delegate . name ;
87
88
}
88
89
89
90
get options ( ) : FirebaseOptions {
90
- return this . app . options ;
91
+ return this . _delegate . options ;
91
92
}
92
93
93
94
delete ( ) : Promise < void > {
94
95
return new Promise < void > ( resolve => {
95
- this . app . checkDestroyed ( ) ;
96
+ this . _delegate . checkDestroyed ( ) ;
96
97
resolve ( ) ;
97
98
} ) . then ( ( ) => {
98
99
this . firebase . INTERNAL . removeApp ( this . name ) ;
99
- return deleteApp ( this . app ) ;
100
+ return deleteApp ( this . _delegate ) ;
100
101
} ) ;
101
102
}
102
103
@@ -118,10 +119,10 @@ export class FirebaseAppImpl implements _FirebaseApp {
118
119
name : string ,
119
120
instanceIdentifier : string = _DEFAULT_ENTRY_NAME
120
121
) : _FirebaseService {
121
- this . app . checkDestroyed ( ) ;
122
+ this . _delegate . checkDestroyed ( ) ;
122
123
123
124
// getImmediate will always succeed because _getService is only called for registered components.
124
- return ( this . app . container . getProvider ( name as Name ) . getImmediate ( {
125
+ return ( this . _delegate . container . getProvider ( name as Name ) . getImmediate ( {
125
126
identifier : instanceIdentifier
126
127
} ) as unknown ) as _FirebaseService ;
127
128
}
@@ -140,7 +141,7 @@ export class FirebaseAppImpl implements _FirebaseApp {
140
141
name : string ,
141
142
instanceIdentifier : string = _DEFAULT_ENTRY_NAME
142
143
) : void {
143
- this . app . container
144
+ this . _delegate . container
144
145
// eslint-disable-next-line @typescript-eslint/no-explicit-any
145
146
. getProvider ( name as any )
146
147
. clearInstance ( instanceIdentifier ) ;
@@ -151,11 +152,11 @@ export class FirebaseAppImpl implements _FirebaseApp {
151
152
* @internal
152
153
*/
153
154
_addComponent ( component : Component ) : void {
154
- _addComponent ( this . app , component ) ;
155
+ _addComponent ( this . _delegate , component ) ;
155
156
}
156
157
157
158
_addOrOverwriteComponent ( component : Component ) : void {
158
- _addOrOverwriteComponent ( this . app , component ) ;
159
+ _addOrOverwriteComponent ( this . _delegate , component ) ;
159
160
}
160
161
161
162
toJSON ( ) : object {
0 commit comments