@firebase/app 0.10.15 → 0.10.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/src/api.d.ts +207 -207
- package/dist/app/src/api.test.d.ts +22 -22
- package/dist/app/src/constants.d.ts +26 -26
- package/dist/app/src/errors.d.ts +67 -67
- package/dist/app/src/firebaseApp.d.ts +46 -46
- package/dist/app/src/firebaseApp.test.d.ts +17 -17
- package/dist/app/src/firebaseServerApp.d.ts +36 -36
- package/dist/app/src/firebaseServerApp.test.d.ts +17 -17
- package/dist/app/src/global_index.d.ts +868 -868
- package/dist/app/src/heartbeatService.d.ts +83 -83
- package/dist/app/src/heartbeatService.test.d.ts +23 -23
- package/dist/app/src/index.d.ts +9 -9
- package/dist/app/src/indexeddb.d.ts +20 -20
- package/dist/app/src/indexeddb.test.d.ts +17 -17
- package/dist/app/src/internal.d.ts +99 -99
- package/dist/app/src/internal.test.d.ts +23 -23
- package/dist/app/src/logger.d.ts +18 -18
- package/dist/app/src/platformLoggerService.d.ts +23 -23
- package/dist/app/src/platformLoggerService.test.d.ts +24 -24
- package/dist/app/src/public-types.d.ts +231 -231
- package/dist/app/src/registerCoreComponents.d.ts +17 -17
- package/dist/app/src/types.d.ts +55 -55
- package/dist/app/test/setup.d.ts +17 -17
- package/dist/app/test/util.d.ts +26 -26
- package/dist/esm/app/src/api.d.ts +207 -207
- package/dist/esm/app/src/api.test.d.ts +22 -22
- package/dist/esm/app/src/constants.d.ts +26 -26
- package/dist/esm/app/src/errors.d.ts +67 -67
- package/dist/esm/app/src/firebaseApp.d.ts +46 -46
- package/dist/esm/app/src/firebaseApp.test.d.ts +17 -17
- package/dist/esm/app/src/firebaseServerApp.d.ts +36 -36
- package/dist/esm/app/src/firebaseServerApp.test.d.ts +17 -17
- package/dist/esm/app/src/heartbeatService.d.ts +83 -83
- package/dist/esm/app/src/heartbeatService.test.d.ts +23 -23
- package/dist/esm/app/src/index.d.ts +9 -9
- package/dist/esm/app/src/indexeddb.d.ts +20 -20
- package/dist/esm/app/src/indexeddb.test.d.ts +17 -17
- package/dist/esm/app/src/internal.d.ts +99 -99
- package/dist/esm/app/src/internal.test.d.ts +23 -23
- package/dist/esm/app/src/logger.d.ts +18 -18
- package/dist/esm/app/src/platformLoggerService.d.ts +23 -23
- package/dist/esm/app/src/platformLoggerService.test.d.ts +24 -24
- package/dist/esm/app/src/public-types.d.ts +231 -231
- package/dist/esm/app/src/registerCoreComponents.d.ts +17 -17
- package/dist/esm/app/src/types.d.ts +55 -55
- package/dist/esm/app/test/setup.d.ts +17 -17
- package/dist/esm/app/test/util.d.ts +26 -26
- package/dist/esm/index.esm2017.js +1069 -1069
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/index.cjs.js +1069 -1069
- package/dist/index.cjs.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,892 +1,892 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Provider for instance for service name T, e.g. 'auth', 'auth-internal'
|
|
20
|
-
* NameServiceMapping[T] is an alias for the type of the instance
|
|
21
|
-
*/
|
|
22
|
-
declare class Provider<T extends Name> {
|
|
23
|
-
private readonly name;
|
|
24
|
-
private readonly container;
|
|
25
|
-
private component;
|
|
26
|
-
private readonly instances;
|
|
27
|
-
private readonly instancesDeferred;
|
|
28
|
-
private readonly instancesOptions;
|
|
29
|
-
private onInitCallbacks;
|
|
30
|
-
constructor(name: T, container: ComponentContainer);
|
|
31
|
-
/**
|
|
32
|
-
* @param identifier A provider can provide multiple instances of a service
|
|
33
|
-
* if this.component.multipleInstances is true.
|
|
34
|
-
*/
|
|
35
|
-
get(identifier?: string): Promise<NameServiceMapping[T]>;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @param options.identifier A provider can provide multiple instances of a service
|
|
39
|
-
* if this.component.multipleInstances is true.
|
|
40
|
-
* @param options.optional If optional is false or not provided, the method throws an error when
|
|
41
|
-
* the service is not immediately available.
|
|
42
|
-
* If optional is true, the method returns null if the service is not immediately available.
|
|
43
|
-
*/
|
|
44
|
-
getImmediate(options: {
|
|
45
|
-
identifier?: string;
|
|
46
|
-
optional: true;
|
|
47
|
-
}): NameServiceMapping[T] | null;
|
|
48
|
-
getImmediate(options?: {
|
|
49
|
-
identifier?: string;
|
|
50
|
-
optional?: false;
|
|
51
|
-
}): NameServiceMapping[T];
|
|
52
|
-
getComponent(): Component<T> | null;
|
|
53
|
-
setComponent(component: Component<T>): void;
|
|
54
|
-
clearInstance(identifier?: string): void;
|
|
55
|
-
delete(): Promise<void>;
|
|
56
|
-
isComponentSet(): boolean;
|
|
57
|
-
isInitialized(identifier?: string): boolean;
|
|
58
|
-
getOptions(identifier?: string): Record<string, unknown>;
|
|
59
|
-
initialize(opts?: InitializeOptions): NameServiceMapping[T];
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
* @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().
|
|
63
|
-
* The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.
|
|
64
|
-
*
|
|
65
|
-
* @param identifier An optional instance identifier
|
|
66
|
-
* @returns a function to unregister the callback
|
|
67
|
-
*/
|
|
68
|
-
onInit(callback: OnInitCallBack<T>, identifier?: string): () => void;
|
|
69
|
-
/**
|
|
70
|
-
* Invoke onInit callbacks synchronously
|
|
71
|
-
* @param instance the service instance`
|
|
72
|
-
*/
|
|
73
|
-
private invokeOnInitCallbacks;
|
|
74
|
-
private getOrInitializeService;
|
|
75
|
-
private normalizeInstanceIdentifier;
|
|
76
|
-
private shouldAutoInitialize;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Provider for instance for service name T, e.g. 'auth', 'auth-internal'
|
|
20
|
+
* NameServiceMapping[T] is an alias for the type of the instance
|
|
21
|
+
*/
|
|
22
|
+
declare class Provider<T extends Name> {
|
|
23
|
+
private readonly name;
|
|
24
|
+
private readonly container;
|
|
25
|
+
private component;
|
|
26
|
+
private readonly instances;
|
|
27
|
+
private readonly instancesDeferred;
|
|
28
|
+
private readonly instancesOptions;
|
|
29
|
+
private onInitCallbacks;
|
|
30
|
+
constructor(name: T, container: ComponentContainer);
|
|
31
|
+
/**
|
|
32
|
+
* @param identifier A provider can provide multiple instances of a service
|
|
33
|
+
* if this.component.multipleInstances is true.
|
|
34
|
+
*/
|
|
35
|
+
get(identifier?: string): Promise<NameServiceMapping[T]>;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param options.identifier A provider can provide multiple instances of a service
|
|
39
|
+
* if this.component.multipleInstances is true.
|
|
40
|
+
* @param options.optional If optional is false or not provided, the method throws an error when
|
|
41
|
+
* the service is not immediately available.
|
|
42
|
+
* If optional is true, the method returns null if the service is not immediately available.
|
|
43
|
+
*/
|
|
44
|
+
getImmediate(options: {
|
|
45
|
+
identifier?: string;
|
|
46
|
+
optional: true;
|
|
47
|
+
}): NameServiceMapping[T] | null;
|
|
48
|
+
getImmediate(options?: {
|
|
49
|
+
identifier?: string;
|
|
50
|
+
optional?: false;
|
|
51
|
+
}): NameServiceMapping[T];
|
|
52
|
+
getComponent(): Component<T> | null;
|
|
53
|
+
setComponent(component: Component<T>): void;
|
|
54
|
+
clearInstance(identifier?: string): void;
|
|
55
|
+
delete(): Promise<void>;
|
|
56
|
+
isComponentSet(): boolean;
|
|
57
|
+
isInitialized(identifier?: string): boolean;
|
|
58
|
+
getOptions(identifier?: string): Record<string, unknown>;
|
|
59
|
+
initialize(opts?: InitializeOptions): NameServiceMapping[T];
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().
|
|
63
|
+
* The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.
|
|
64
|
+
*
|
|
65
|
+
* @param identifier An optional instance identifier
|
|
66
|
+
* @returns a function to unregister the callback
|
|
67
|
+
*/
|
|
68
|
+
onInit(callback: OnInitCallBack<T>, identifier?: string): () => void;
|
|
69
|
+
/**
|
|
70
|
+
* Invoke onInit callbacks synchronously
|
|
71
|
+
* @param instance the service instance`
|
|
72
|
+
*/
|
|
73
|
+
private invokeOnInitCallbacks;
|
|
74
|
+
private getOrInitializeService;
|
|
75
|
+
private normalizeInstanceIdentifier;
|
|
76
|
+
private shouldAutoInitialize;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
80
|
-
* @license
|
|
81
|
-
* Copyright 2019 Google LLC
|
|
82
|
-
*
|
|
83
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
84
|
-
* you may not use this file except in compliance with the License.
|
|
85
|
-
* You may obtain a copy of the License at
|
|
86
|
-
*
|
|
87
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
88
|
-
*
|
|
89
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
90
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
91
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
92
|
-
* See the License for the specific language governing permissions and
|
|
93
|
-
* limitations under the License.
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal`
|
|
98
|
-
*/
|
|
99
|
-
declare class ComponentContainer {
|
|
100
|
-
private readonly name;
|
|
101
|
-
private readonly providers;
|
|
102
|
-
constructor(name: string);
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
* @param component Component being added
|
|
106
|
-
* @param overwrite When a component with the same name has already been registered,
|
|
107
|
-
* if overwrite is true: overwrite the existing component with the new component and create a new
|
|
108
|
-
* provider with the new component. It can be useful in tests where you want to use different mocks
|
|
109
|
-
* for different tests.
|
|
110
|
-
* if overwrite is false: throw an exception
|
|
111
|
-
*/
|
|
112
|
-
addComponent<T extends Name>(component: Component<T>): void;
|
|
113
|
-
addOrOverwriteComponent<T extends Name>(component: Component<T>): void;
|
|
114
|
-
/**
|
|
115
|
-
* getProvider provides a type safe interface where it can only be called with a field name
|
|
116
|
-
* present in NameServiceMapping interface.
|
|
117
|
-
*
|
|
118
|
-
* Firebase SDKs providing services should extend NameServiceMapping interface to register
|
|
119
|
-
* themselves.
|
|
120
|
-
*/
|
|
121
|
-
getProvider<T extends Name>(name: T): Provider<T>;
|
|
122
|
-
getProviders(): Array<Provider<Name>>;
|
|
79
|
+
/**
|
|
80
|
+
* @license
|
|
81
|
+
* Copyright 2019 Google LLC
|
|
82
|
+
*
|
|
83
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
84
|
+
* you may not use this file except in compliance with the License.
|
|
85
|
+
* You may obtain a copy of the License at
|
|
86
|
+
*
|
|
87
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
88
|
+
*
|
|
89
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
90
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
91
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
92
|
+
* See the License for the specific language governing permissions and
|
|
93
|
+
* limitations under the License.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal`
|
|
98
|
+
*/
|
|
99
|
+
declare class ComponentContainer {
|
|
100
|
+
private readonly name;
|
|
101
|
+
private readonly providers;
|
|
102
|
+
constructor(name: string);
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param component Component being added
|
|
106
|
+
* @param overwrite When a component with the same name has already been registered,
|
|
107
|
+
* if overwrite is true: overwrite the existing component with the new component and create a new
|
|
108
|
+
* provider with the new component. It can be useful in tests where you want to use different mocks
|
|
109
|
+
* for different tests.
|
|
110
|
+
* if overwrite is false: throw an exception
|
|
111
|
+
*/
|
|
112
|
+
addComponent<T extends Name>(component: Component<T>): void;
|
|
113
|
+
addOrOverwriteComponent<T extends Name>(component: Component<T>): void;
|
|
114
|
+
/**
|
|
115
|
+
* getProvider provides a type safe interface where it can only be called with a field name
|
|
116
|
+
* present in NameServiceMapping interface.
|
|
117
|
+
*
|
|
118
|
+
* Firebase SDKs providing services should extend NameServiceMapping interface to register
|
|
119
|
+
* themselves.
|
|
120
|
+
*/
|
|
121
|
+
getProvider<T extends Name>(name: T): Provider<T>;
|
|
122
|
+
getProviders(): Array<Provider<Name>>;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
/**
|
|
126
|
-
* @license
|
|
127
|
-
* Copyright 2019 Google LLC
|
|
128
|
-
*
|
|
129
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
130
|
-
* you may not use this file except in compliance with the License.
|
|
131
|
-
* You may obtain a copy of the License at
|
|
132
|
-
*
|
|
133
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
134
|
-
*
|
|
135
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
136
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
137
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
138
|
-
* See the License for the specific language governing permissions and
|
|
139
|
-
* limitations under the License.
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
|
-
declare const enum InstantiationMode {
|
|
143
|
-
LAZY = "LAZY",
|
|
144
|
-
EAGER = "EAGER",
|
|
145
|
-
EXPLICIT = "EXPLICIT"
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* PUBLIC: A public component provides a set of public APIs to customers. A service namespace will be patched
|
|
149
|
-
* onto `firebase` namespace. Assume the component name is `test`, customers will be able
|
|
150
|
-
* to get the service by calling `firebase.test()` or `app.test()` where `app` is a `FirebaseApp` instance.
|
|
151
|
-
*
|
|
152
|
-
* PRIVATE: A private component provides a set of private APIs that are used internally by other
|
|
153
|
-
* Firebase SDKs. No service namespace is created in `firebase` namespace and customers have no way to get them.
|
|
154
|
-
*/
|
|
155
|
-
declare const enum ComponentType {
|
|
156
|
-
PUBLIC = "PUBLIC",
|
|
157
|
-
PRIVATE = "PRIVATE",
|
|
158
|
-
VERSION = "VERSION"
|
|
159
|
-
}
|
|
160
|
-
interface InstanceFactoryOptions {
|
|
161
|
-
instanceIdentifier?: string;
|
|
162
|
-
options?: {};
|
|
163
|
-
}
|
|
164
|
-
declare type InitializeOptions = InstanceFactoryOptions;
|
|
165
|
-
/**
|
|
166
|
-
* Factory to create an instance of type T, given a ComponentContainer.
|
|
167
|
-
* ComponentContainer is the IOC container that provides {@link Provider}
|
|
168
|
-
* for dependencies.
|
|
169
|
-
*
|
|
170
|
-
* NOTE: The container only provides {@link Provider} rather than the actual instances of dependencies.
|
|
171
|
-
* It is useful for lazily loaded dependencies and optional dependencies.
|
|
172
|
-
*/
|
|
173
|
-
declare type InstanceFactory<T extends Name> = (container: ComponentContainer, options: InstanceFactoryOptions) => NameServiceMapping[T];
|
|
174
|
-
declare type onInstanceCreatedCallback<T extends Name> = (container: ComponentContainer, instanceIdentifier: string, instance: NameServiceMapping[T]) => void;
|
|
175
|
-
interface Dictionary {
|
|
176
|
-
[key: string]: unknown;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* This interface will be extended by Firebase SDKs to provide service name and service type mapping.
|
|
180
|
-
* It is used as a generic constraint to ensure type safety.
|
|
181
|
-
*/
|
|
182
|
-
interface NameServiceMapping {
|
|
183
|
-
}
|
|
184
|
-
declare type Name = keyof NameServiceMapping;
|
|
185
|
-
declare type OnInitCallBack<T extends Name> = (instance: NameServiceMapping[T], identifier: string) => void;
|
|
125
|
+
/**
|
|
126
|
+
* @license
|
|
127
|
+
* Copyright 2019 Google LLC
|
|
128
|
+
*
|
|
129
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
130
|
+
* you may not use this file except in compliance with the License.
|
|
131
|
+
* You may obtain a copy of the License at
|
|
132
|
+
*
|
|
133
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
134
|
+
*
|
|
135
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
136
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
137
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
138
|
+
* See the License for the specific language governing permissions and
|
|
139
|
+
* limitations under the License.
|
|
140
|
+
*/
|
|
186
141
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
setInstanceCreatedCallback(callback: onInstanceCreatedCallback<T>): this;
|
|
142
|
+
declare const enum InstantiationMode {
|
|
143
|
+
LAZY = "LAZY",// Currently most components are LAZY in JS SDK
|
|
144
|
+
EAGER = "EAGER",// EAGER components are initialized immediately upon registration
|
|
145
|
+
EXPLICIT = "EXPLICIT"
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* PUBLIC: A public component provides a set of public APIs to customers. A service namespace will be patched
|
|
149
|
+
* onto `firebase` namespace. Assume the component name is `test`, customers will be able
|
|
150
|
+
* to get the service by calling `firebase.test()` or `app.test()` where `app` is a `FirebaseApp` instance.
|
|
151
|
+
*
|
|
152
|
+
* PRIVATE: A private component provides a set of private APIs that are used internally by other
|
|
153
|
+
* Firebase SDKs. No service namespace is created in `firebase` namespace and customers have no way to get them.
|
|
154
|
+
*/
|
|
155
|
+
declare const enum ComponentType {
|
|
156
|
+
PUBLIC = "PUBLIC",
|
|
157
|
+
PRIVATE = "PRIVATE",
|
|
158
|
+
VERSION = "VERSION"
|
|
159
|
+
}
|
|
160
|
+
interface InstanceFactoryOptions {
|
|
161
|
+
instanceIdentifier?: string;
|
|
162
|
+
options?: {};
|
|
163
|
+
}
|
|
164
|
+
type InitializeOptions = InstanceFactoryOptions;
|
|
165
|
+
/**
|
|
166
|
+
* Factory to create an instance of type T, given a ComponentContainer.
|
|
167
|
+
* ComponentContainer is the IOC container that provides {@link Provider}
|
|
168
|
+
* for dependencies.
|
|
169
|
+
*
|
|
170
|
+
* NOTE: The container only provides {@link Provider} rather than the actual instances of dependencies.
|
|
171
|
+
* It is useful for lazily loaded dependencies and optional dependencies.
|
|
172
|
+
*/
|
|
173
|
+
type InstanceFactory<T extends Name> = (container: ComponentContainer, options: InstanceFactoryOptions) => NameServiceMapping[T];
|
|
174
|
+
type onInstanceCreatedCallback<T extends Name> = (container: ComponentContainer, instanceIdentifier: string, instance: NameServiceMapping[T]) => void;
|
|
175
|
+
interface Dictionary {
|
|
176
|
+
[key: string]: unknown;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* This interface will be extended by Firebase SDKs to provide service name and service type mapping.
|
|
180
|
+
* It is used as a generic constraint to ensure type safety.
|
|
181
|
+
*/
|
|
182
|
+
interface NameServiceMapping {
|
|
229
183
|
}
|
|
184
|
+
type Name = keyof NameServiceMapping;
|
|
185
|
+
type OnInitCallBack<T extends Name> = (instance: NameServiceMapping[T], identifier: string) => void;
|
|
230
186
|
|
|
231
|
-
/**
|
|
232
|
-
* @license
|
|
233
|
-
* Copyright
|
|
234
|
-
*
|
|
235
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
236
|
-
* you may not use this file except in compliance with the License.
|
|
237
|
-
* You may obtain a copy of the License at
|
|
238
|
-
*
|
|
239
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
240
|
-
*
|
|
241
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
242
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
243
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
244
|
-
* See the License for the specific language governing permissions and
|
|
245
|
-
* limitations under the License.
|
|
246
|
-
*/
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
*
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
|
|
267
|
-
|
|
187
|
+
/**
|
|
188
|
+
* @license
|
|
189
|
+
* Copyright 2019 Google LLC
|
|
190
|
+
*
|
|
191
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
* you may not use this file except in compliance with the License.
|
|
193
|
+
* You may obtain a copy of the License at
|
|
194
|
+
*
|
|
195
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
*
|
|
197
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
* See the License for the specific language governing permissions and
|
|
201
|
+
* limitations under the License.
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Component for service name T, e.g. `auth`, `auth-internal`
|
|
206
|
+
*/
|
|
207
|
+
declare class Component<T extends Name = Name> {
|
|
208
|
+
readonly name: T;
|
|
209
|
+
readonly instanceFactory: InstanceFactory<T>;
|
|
210
|
+
readonly type: ComponentType;
|
|
211
|
+
multipleInstances: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Properties to be added to the service namespace
|
|
214
|
+
*/
|
|
215
|
+
serviceProps: Dictionary;
|
|
216
|
+
instantiationMode: InstantiationMode;
|
|
217
|
+
onInstanceCreated: onInstanceCreatedCallback<T> | null;
|
|
218
|
+
/**
|
|
219
|
+
*
|
|
220
|
+
* @param name The public service name, e.g. app, auth, firestore, database
|
|
221
|
+
* @param instanceFactory Service factory responsible for creating the public interface
|
|
222
|
+
* @param type whether the service provided by the component is public or private
|
|
223
|
+
*/
|
|
224
|
+
constructor(name: T, instanceFactory: InstanceFactory<T>, type: ComponentType);
|
|
225
|
+
setInstantiationMode(mode: InstantiationMode): this;
|
|
226
|
+
setMultipleInstances(multipleInstances: boolean): this;
|
|
227
|
+
setServiceProps(props: Dictionary): this;
|
|
228
|
+
setInstanceCreatedCallback(callback: onInstanceCreatedCallback<T>): this;
|
|
268
229
|
}
|
|
269
230
|
|
|
270
|
-
/**
|
|
271
|
-
* @license
|
|
272
|
-
* Copyright 2020 Google LLC
|
|
273
|
-
*
|
|
274
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
275
|
-
* you may not use this file except in compliance with the License.
|
|
276
|
-
* You may obtain a copy of the License at
|
|
277
|
-
*
|
|
278
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
279
|
-
*
|
|
280
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
281
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
282
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
283
|
-
* See the License for the specific language governing permissions and
|
|
284
|
-
* limitations under the License.
|
|
285
|
-
*/
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
* ```
|
|
308
|
-
*
|
|
309
|
-
* @example
|
|
310
|
-
* ```javascript
|
|
311
|
-
* // A named app's name is what you provide to initializeApp()
|
|
312
|
-
* const otherApp = initializeApp(otherAppConfig, "other");
|
|
313
|
-
* console.log(otherApp.name); // "other"
|
|
314
|
-
* ```
|
|
315
|
-
*/
|
|
316
|
-
readonly name: string;
|
|
317
|
-
/**
|
|
318
|
-
* The (read-only) configuration options for this app. These are the original
|
|
319
|
-
* parameters given in {@link (initializeApp:1) | initializeApp()}.
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* ```javascript
|
|
323
|
-
* const app = initializeApp(config);
|
|
324
|
-
* console.log(app.options.databaseURL === config.databaseURL); // true
|
|
325
|
-
* ```
|
|
326
|
-
*/
|
|
327
|
-
readonly options: FirebaseOptions;
|
|
328
|
-
/**
|
|
329
|
-
* The settable config flag for GDPR opt-in/opt-out
|
|
330
|
-
*/
|
|
331
|
-
automaticDataCollectionEnabled: boolean;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* A {@link @firebase/app#FirebaseServerApp} holds the initialization information
|
|
335
|
-
* for a collection of services running in server environments.
|
|
336
|
-
*
|
|
337
|
-
* Do not call this constructor directly. Instead, use
|
|
338
|
-
* {@link (initializeServerApp:1) | initializeServerApp()} to create
|
|
339
|
-
* an app.
|
|
340
|
-
*
|
|
341
|
-
* @public
|
|
342
|
-
*/
|
|
343
|
-
interface FirebaseServerApp extends FirebaseApp {
|
|
344
|
-
/**
|
|
345
|
-
* There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
|
|
346
|
-
* applications. However, it may be used internally, and is declared here so that
|
|
347
|
-
* `FirebaseServerApp` conforms to the `FirebaseApp` interface.
|
|
348
|
-
*/
|
|
349
|
-
name: string;
|
|
350
|
-
/**
|
|
351
|
-
* The (read-only) configuration settings for this server app. These are the original
|
|
352
|
-
* parameters given in {@link (initializeServerApp:1) | initializeServerApp()}.
|
|
353
|
-
*
|
|
354
|
-
* @example
|
|
355
|
-
* ```javascript
|
|
356
|
-
* const app = initializeServerApp(settings);
|
|
357
|
-
* console.log(app.settings.authIdToken === options.authIdToken); // true
|
|
358
|
-
* ```
|
|
359
|
-
*/
|
|
360
|
-
readonly settings: FirebaseServerAppSettings;
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* @public
|
|
364
|
-
*
|
|
365
|
-
* Firebase configuration object. Contains a set of parameters required by
|
|
366
|
-
* services in order to successfully communicate with Firebase server APIs
|
|
367
|
-
* and to associate client data with your Firebase project and
|
|
368
|
-
* Firebase application. Typically this object is populated by the Firebase
|
|
369
|
-
* console at project setup. See also:
|
|
370
|
-
* {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
|
|
371
|
-
*/
|
|
372
|
-
interface FirebaseOptions {
|
|
373
|
-
/**
|
|
374
|
-
* An encrypted string used when calling certain APIs that don't need to
|
|
375
|
-
* access private user data
|
|
376
|
-
* (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
|
|
377
|
-
*/
|
|
378
|
-
apiKey?: string;
|
|
379
|
-
/**
|
|
380
|
-
* Auth domain for the project ID.
|
|
381
|
-
*/
|
|
382
|
-
authDomain?: string;
|
|
383
|
-
/**
|
|
384
|
-
* Default Realtime Database URL.
|
|
385
|
-
*/
|
|
386
|
-
databaseURL?: string;
|
|
387
|
-
/**
|
|
388
|
-
* The unique identifier for the project across all of Firebase and
|
|
389
|
-
* Google Cloud.
|
|
390
|
-
*/
|
|
391
|
-
projectId?: string;
|
|
392
|
-
/**
|
|
393
|
-
* The default Cloud Storage bucket name.
|
|
394
|
-
*/
|
|
395
|
-
storageBucket?: string;
|
|
396
|
-
/**
|
|
397
|
-
* Unique numerical value used to identify each sender that can send
|
|
398
|
-
* Firebase Cloud Messaging messages to client apps.
|
|
399
|
-
*/
|
|
400
|
-
messagingSenderId?: string;
|
|
401
|
-
/**
|
|
402
|
-
* Unique identifier for the app.
|
|
403
|
-
*/
|
|
404
|
-
appId?: string;
|
|
405
|
-
/**
|
|
406
|
-
* An ID automatically created when you enable Analytics in your
|
|
407
|
-
* Firebase project and register a web app. In versions 7.20.0
|
|
408
|
-
* and higher, this parameter is optional.
|
|
409
|
-
*/
|
|
410
|
-
measurementId?: string;
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* @public
|
|
414
|
-
*
|
|
415
|
-
* Configuration options given to {@link (initializeApp:1) | initializeApp()}
|
|
416
|
-
*/
|
|
417
|
-
interface FirebaseAppSettings {
|
|
418
|
-
/**
|
|
419
|
-
* custom name for the Firebase App.
|
|
420
|
-
* The default value is `"[DEFAULT]"`.
|
|
421
|
-
*/
|
|
422
|
-
name?: string;
|
|
423
|
-
/**
|
|
424
|
-
* The settable config flag for GDPR opt-in/opt-out
|
|
425
|
-
*/
|
|
426
|
-
automaticDataCollectionEnabled?: boolean;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* @public
|
|
430
|
-
*
|
|
431
|
-
* Configuration options given to {@link (initializeServerApp:1) | initializeServerApp()}
|
|
432
|
-
*/
|
|
433
|
-
interface FirebaseServerAppSettings extends Omit<FirebaseAppSettings, 'name'> {
|
|
434
|
-
/**
|
|
435
|
-
* An optional Auth ID token used to resume a signed in user session from a client
|
|
436
|
-
* runtime environment.
|
|
437
|
-
*
|
|
438
|
-
* Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken`
|
|
439
|
-
* causes an automatic attempt to sign in the user that the `authIdToken` represents. The token
|
|
440
|
-
* needs to have been recently minted for this operation to succeed.
|
|
441
|
-
*
|
|
442
|
-
* If the token fails local verification, or if the Auth service has failed to validate it when
|
|
443
|
-
* the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not
|
|
444
|
-
* sign in a user on initialization.
|
|
445
|
-
*
|
|
446
|
-
* If a user is successfully signed in, then the Auth instance's `onAuthStateChanged` callback
|
|
447
|
-
* is invoked with the `User` object as per standard Auth flows. However, `User` objects
|
|
448
|
-
* created via an `authIdToken` do not have a refresh token. Attempted `refreshToken`
|
|
449
|
-
* operations fail.
|
|
450
|
-
*/
|
|
451
|
-
authIdToken?: string;
|
|
452
|
-
/**
|
|
453
|
-
* An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry`
|
|
454
|
-
* object to monitor the garbage collection status of the provided object. The
|
|
455
|
-
* Firebase SDK releases its reference on the `FirebaseServerApp` instance when the
|
|
456
|
-
* provided `releaseOnDeref` object is garbage collected.
|
|
457
|
-
*
|
|
458
|
-
* You can use this field to reduce memory management overhead for your application.
|
|
459
|
-
* If provided, an app running in a SSR pass does not need to perform
|
|
460
|
-
* `FirebaseServerApp` cleanup, so long as the reference object is deleted (by falling out of
|
|
461
|
-
* SSR scope, for instance.)
|
|
462
|
-
*
|
|
463
|
-
* If an object is not provided then the application must clean up the `FirebaseServerApp`
|
|
464
|
-
* instance by invoking `deleteApp`.
|
|
465
|
-
*
|
|
466
|
-
* If the application provides an object in this parameter, but the application is
|
|
467
|
-
* executed in a JavaScript engine that predates the support of `FinalizationRegistry`
|
|
468
|
-
* (introduced in node v14.6.0, for instance), then an error is thrown at `FirebaseServerApp`
|
|
469
|
-
* initialization.
|
|
470
|
-
*/
|
|
471
|
-
releaseOnDeref?: object;
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* @internal
|
|
475
|
-
*/
|
|
476
|
-
interface _FirebaseService {
|
|
477
|
-
app: FirebaseApp;
|
|
478
|
-
/**
|
|
479
|
-
* Delete the service and free it's resources - called from
|
|
480
|
-
* {@link @firebase/app#deleteApp | deleteApp()}
|
|
481
|
-
*/
|
|
482
|
-
_delete(): Promise<void>;
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* @internal
|
|
486
|
-
*/
|
|
487
|
-
interface _FirebaseAppInternal extends FirebaseApp {
|
|
488
|
-
container: ComponentContainer;
|
|
489
|
-
isDeleted: boolean;
|
|
490
|
-
checkDestroyed(): void;
|
|
491
|
-
}
|
|
492
|
-
declare module '@firebase/component' {
|
|
493
|
-
interface NameServiceMapping {
|
|
494
|
-
'app': FirebaseApp;
|
|
495
|
-
'app-version': VersionService;
|
|
496
|
-
'heartbeat': HeartbeatService;
|
|
497
|
-
'platform-logger': PlatformLoggerService;
|
|
498
|
-
}
|
|
231
|
+
/**
|
|
232
|
+
* @license
|
|
233
|
+
* Copyright 2020 Google LLC
|
|
234
|
+
*
|
|
235
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
236
|
+
* you may not use this file except in compliance with the License.
|
|
237
|
+
* You may obtain a copy of the License at
|
|
238
|
+
*
|
|
239
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
240
|
+
*
|
|
241
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
242
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
243
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
244
|
+
* See the License for the specific language governing permissions and
|
|
245
|
+
* limitations under the License.
|
|
246
|
+
*/
|
|
247
|
+
interface VersionService {
|
|
248
|
+
library: string;
|
|
249
|
+
version: string;
|
|
250
|
+
}
|
|
251
|
+
interface PlatformLoggerService {
|
|
252
|
+
getPlatformInfoString(): string;
|
|
253
|
+
}
|
|
254
|
+
interface HeartbeatService {
|
|
255
|
+
/**
|
|
256
|
+
* Called to report a heartbeat. The function will generate
|
|
257
|
+
* a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
|
|
258
|
+
* to IndexedDB.
|
|
259
|
+
* Note that we only store one heartbeat per day. So if a heartbeat for today is
|
|
260
|
+
* already logged, subsequent calls to this function in the same day will be ignored.
|
|
261
|
+
*/
|
|
262
|
+
triggerHeartbeat(): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
|
|
265
|
+
* It also clears all heartbeats from memory as well as in IndexedDB.
|
|
266
|
+
*/
|
|
267
|
+
getHeartbeatsHeader(): Promise<string>;
|
|
499
268
|
}
|
|
500
269
|
|
|
501
|
-
/**
|
|
502
|
-
* @license
|
|
503
|
-
* Copyright
|
|
504
|
-
*
|
|
505
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
506
|
-
* you may not use this file except in compliance with the License.
|
|
507
|
-
* You may obtain a copy of the License at
|
|
508
|
-
*
|
|
509
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
510
|
-
*
|
|
511
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
512
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
513
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
514
|
-
* See the License for the specific language governing permissions and
|
|
515
|
-
* limitations under the License.
|
|
516
|
-
*/
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
270
|
+
/**
|
|
271
|
+
* @license
|
|
272
|
+
* Copyright 2020 Google LLC
|
|
273
|
+
*
|
|
274
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
275
|
+
* you may not use this file except in compliance with the License.
|
|
276
|
+
* You may obtain a copy of the License at
|
|
277
|
+
*
|
|
278
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
279
|
+
*
|
|
280
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
281
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
282
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
283
|
+
* See the License for the specific language governing permissions and
|
|
284
|
+
* limitations under the License.
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of
|
|
289
|
+
* services.
|
|
290
|
+
*
|
|
291
|
+
* Do not call this constructor directly. Instead, use
|
|
292
|
+
* {@link (initializeApp:1) | initializeApp()} to create an app.
|
|
293
|
+
*
|
|
294
|
+
* @public
|
|
295
|
+
*/
|
|
296
|
+
interface FirebaseApp {
|
|
297
|
+
/**
|
|
298
|
+
* The (read-only) name for this app.
|
|
299
|
+
*
|
|
300
|
+
* The default app's name is `"[DEFAULT]"`.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```javascript
|
|
304
|
+
* // The default app's name is "[DEFAULT]"
|
|
305
|
+
* const app = initializeApp(defaultAppConfig);
|
|
306
|
+
* console.log(app.name); // "[DEFAULT]"
|
|
307
|
+
* ```
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```javascript
|
|
311
|
+
* // A named app's name is what you provide to initializeApp()
|
|
312
|
+
* const otherApp = initializeApp(otherAppConfig, "other");
|
|
313
|
+
* console.log(otherApp.name); // "other"
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
readonly name: string;
|
|
317
|
+
/**
|
|
318
|
+
* The (read-only) configuration options for this app. These are the original
|
|
319
|
+
* parameters given in {@link (initializeApp:1) | initializeApp()}.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```javascript
|
|
323
|
+
* const app = initializeApp(config);
|
|
324
|
+
* console.log(app.options.databaseURL === config.databaseURL); // true
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
readonly options: FirebaseOptions;
|
|
328
|
+
/**
|
|
329
|
+
* The settable config flag for GDPR opt-in/opt-out
|
|
330
|
+
*/
|
|
331
|
+
automaticDataCollectionEnabled: boolean;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* A {@link @firebase/app#FirebaseServerApp} holds the initialization information
|
|
335
|
+
* for a collection of services running in server environments.
|
|
336
|
+
*
|
|
337
|
+
* Do not call this constructor directly. Instead, use
|
|
338
|
+
* {@link (initializeServerApp:1) | initializeServerApp()} to create
|
|
339
|
+
* an app.
|
|
340
|
+
*
|
|
341
|
+
* @public
|
|
342
|
+
*/
|
|
343
|
+
interface FirebaseServerApp extends FirebaseApp {
|
|
344
|
+
/**
|
|
345
|
+
* There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
|
|
346
|
+
* applications. However, it may be used internally, and is declared here so that
|
|
347
|
+
* `FirebaseServerApp` conforms to the `FirebaseApp` interface.
|
|
348
|
+
*/
|
|
349
|
+
name: string;
|
|
350
|
+
/**
|
|
351
|
+
* The (read-only) configuration settings for this server app. These are the original
|
|
352
|
+
* parameters given in {@link (initializeServerApp:1) | initializeServerApp()}.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```javascript
|
|
356
|
+
* const app = initializeServerApp(settings);
|
|
357
|
+
* console.log(app.settings.authIdToken === options.authIdToken); // true
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
readonly settings: FirebaseServerAppSettings;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* @public
|
|
364
|
+
*
|
|
365
|
+
* Firebase configuration object. Contains a set of parameters required by
|
|
366
|
+
* services in order to successfully communicate with Firebase server APIs
|
|
367
|
+
* and to associate client data with your Firebase project and
|
|
368
|
+
* Firebase application. Typically this object is populated by the Firebase
|
|
369
|
+
* console at project setup. See also:
|
|
370
|
+
* {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
|
|
371
|
+
*/
|
|
372
|
+
interface FirebaseOptions {
|
|
373
|
+
/**
|
|
374
|
+
* An encrypted string used when calling certain APIs that don't need to
|
|
375
|
+
* access private user data
|
|
376
|
+
* (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
|
|
377
|
+
*/
|
|
378
|
+
apiKey?: string;
|
|
379
|
+
/**
|
|
380
|
+
* Auth domain for the project ID.
|
|
381
|
+
*/
|
|
382
|
+
authDomain?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Default Realtime Database URL.
|
|
385
|
+
*/
|
|
386
|
+
databaseURL?: string;
|
|
387
|
+
/**
|
|
388
|
+
* The unique identifier for the project across all of Firebase and
|
|
389
|
+
* Google Cloud.
|
|
390
|
+
*/
|
|
391
|
+
projectId?: string;
|
|
392
|
+
/**
|
|
393
|
+
* The default Cloud Storage bucket name.
|
|
394
|
+
*/
|
|
395
|
+
storageBucket?: string;
|
|
396
|
+
/**
|
|
397
|
+
* Unique numerical value used to identify each sender that can send
|
|
398
|
+
* Firebase Cloud Messaging messages to client apps.
|
|
399
|
+
*/
|
|
400
|
+
messagingSenderId?: string;
|
|
401
|
+
/**
|
|
402
|
+
* Unique identifier for the app.
|
|
403
|
+
*/
|
|
404
|
+
appId?: string;
|
|
405
|
+
/**
|
|
406
|
+
* An ID automatically created when you enable Analytics in your
|
|
407
|
+
* Firebase project and register a web app. In versions 7.20.0
|
|
408
|
+
* and higher, this parameter is optional.
|
|
409
|
+
*/
|
|
410
|
+
measurementId?: string;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* @public
|
|
414
|
+
*
|
|
415
|
+
* Configuration options given to {@link (initializeApp:1) | initializeApp()}
|
|
416
|
+
*/
|
|
417
|
+
interface FirebaseAppSettings {
|
|
418
|
+
/**
|
|
419
|
+
* custom name for the Firebase App.
|
|
420
|
+
* The default value is `"[DEFAULT]"`.
|
|
421
|
+
*/
|
|
422
|
+
name?: string;
|
|
423
|
+
/**
|
|
424
|
+
* The settable config flag for GDPR opt-in/opt-out
|
|
425
|
+
*/
|
|
426
|
+
automaticDataCollectionEnabled?: boolean;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* @public
|
|
430
|
+
*
|
|
431
|
+
* Configuration options given to {@link (initializeServerApp:1) | initializeServerApp()}
|
|
432
|
+
*/
|
|
433
|
+
interface FirebaseServerAppSettings extends Omit<FirebaseAppSettings, 'name'> {
|
|
434
|
+
/**
|
|
435
|
+
* An optional Auth ID token used to resume a signed in user session from a client
|
|
436
|
+
* runtime environment.
|
|
437
|
+
*
|
|
438
|
+
* Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken`
|
|
439
|
+
* causes an automatic attempt to sign in the user that the `authIdToken` represents. The token
|
|
440
|
+
* needs to have been recently minted for this operation to succeed.
|
|
441
|
+
*
|
|
442
|
+
* If the token fails local verification, or if the Auth service has failed to validate it when
|
|
443
|
+
* the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not
|
|
444
|
+
* sign in a user on initialization.
|
|
445
|
+
*
|
|
446
|
+
* If a user is successfully signed in, then the Auth instance's `onAuthStateChanged` callback
|
|
447
|
+
* is invoked with the `User` object as per standard Auth flows. However, `User` objects
|
|
448
|
+
* created via an `authIdToken` do not have a refresh token. Attempted `refreshToken`
|
|
449
|
+
* operations fail.
|
|
450
|
+
*/
|
|
451
|
+
authIdToken?: string;
|
|
452
|
+
/**
|
|
453
|
+
* An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry`
|
|
454
|
+
* object to monitor the garbage collection status of the provided object. The
|
|
455
|
+
* Firebase SDK releases its reference on the `FirebaseServerApp` instance when the
|
|
456
|
+
* provided `releaseOnDeref` object is garbage collected.
|
|
457
|
+
*
|
|
458
|
+
* You can use this field to reduce memory management overhead for your application.
|
|
459
|
+
* If provided, an app running in a SSR pass does not need to perform
|
|
460
|
+
* `FirebaseServerApp` cleanup, so long as the reference object is deleted (by falling out of
|
|
461
|
+
* SSR scope, for instance.)
|
|
462
|
+
*
|
|
463
|
+
* If an object is not provided then the application must clean up the `FirebaseServerApp`
|
|
464
|
+
* instance by invoking `deleteApp`.
|
|
465
|
+
*
|
|
466
|
+
* If the application provides an object in this parameter, but the application is
|
|
467
|
+
* executed in a JavaScript engine that predates the support of `FinalizationRegistry`
|
|
468
|
+
* (introduced in node v14.6.0, for instance), then an error is thrown at `FirebaseServerApp`
|
|
469
|
+
* initialization.
|
|
470
|
+
*/
|
|
471
|
+
releaseOnDeref?: object;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* @internal
|
|
475
|
+
*/
|
|
476
|
+
interface _FirebaseService {
|
|
477
|
+
app: FirebaseApp;
|
|
478
|
+
/**
|
|
479
|
+
* Delete the service and free it's resources - called from
|
|
480
|
+
* {@link @firebase/app#deleteApp | deleteApp()}
|
|
481
|
+
*/
|
|
482
|
+
_delete(): Promise<void>;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* @internal
|
|
486
|
+
*/
|
|
487
|
+
interface _FirebaseAppInternal extends FirebaseApp {
|
|
488
|
+
container: ComponentContainer;
|
|
489
|
+
isDeleted: boolean;
|
|
490
|
+
checkDestroyed(): void;
|
|
491
|
+
}
|
|
492
|
+
declare module '@firebase/component' {
|
|
493
|
+
interface NameServiceMapping {
|
|
494
|
+
'app': FirebaseApp;
|
|
495
|
+
'app-version': VersionService;
|
|
496
|
+
'heartbeat': HeartbeatService;
|
|
497
|
+
'platform-logger': PlatformLoggerService;
|
|
498
|
+
}
|
|
527
499
|
}
|
|
528
500
|
|
|
529
|
-
/**
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
501
|
+
/**
|
|
502
|
+
* @license
|
|
503
|
+
* Copyright 2017 Google LLC
|
|
504
|
+
*
|
|
505
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
506
|
+
* you may not use this file except in compliance with the License.
|
|
507
|
+
* You may obtain a copy of the License at
|
|
508
|
+
*
|
|
509
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
510
|
+
*
|
|
511
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
512
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
513
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
514
|
+
* See the License for the specific language governing permissions and
|
|
515
|
+
* limitations under the License.
|
|
516
|
+
*/
|
|
517
|
+
type LogLevelString = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'silent';
|
|
518
|
+
interface LogOptions {
|
|
519
|
+
level: LogLevelString;
|
|
520
|
+
}
|
|
521
|
+
type LogCallback = (callbackParams: LogCallbackParams) => void;
|
|
522
|
+
interface LogCallbackParams {
|
|
523
|
+
level: LogLevelString;
|
|
524
|
+
message: string;
|
|
525
|
+
args: unknown[];
|
|
526
|
+
type: string;
|
|
553
527
|
}
|
|
554
528
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
529
|
+
/**
|
|
530
|
+
* An object that can be injected into the environment as __FIREBASE_DEFAULTS__,
|
|
531
|
+
* either as a property of globalThis, a shell environment variable, or a
|
|
532
|
+
* cookie.
|
|
533
|
+
*
|
|
534
|
+
* This object can be used to automatically configure and initialize
|
|
535
|
+
* a Firebase app as well as any emulators.
|
|
536
|
+
*
|
|
537
|
+
* @public
|
|
538
|
+
*/
|
|
539
|
+
interface FirebaseDefaults {
|
|
540
|
+
config?: Record<string, string>;
|
|
541
|
+
emulatorHosts?: Record<string, string>;
|
|
542
|
+
_authTokenSyncURL?: string;
|
|
543
|
+
_authIdTokenMaxAge?: number;
|
|
544
|
+
/**
|
|
545
|
+
* Override Firebase's runtime environment detection and
|
|
546
|
+
* force the SDK to act as if it were in the specified environment.
|
|
547
|
+
*/
|
|
548
|
+
forceEnvironment?: 'browser' | 'node';
|
|
549
|
+
[key: string]: unknown;
|
|
550
|
+
}
|
|
551
|
+
declare global {
|
|
552
|
+
var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
declare class FirebaseError extends Error {
|
|
556
|
+
/** The error code for this error. */
|
|
557
|
+
readonly code: string;
|
|
558
|
+
/** Custom data for this error. */
|
|
559
|
+
customData?: Record<string, unknown> | undefined;
|
|
560
|
+
/** The custom name for all FirebaseErrors. */
|
|
561
|
+
readonly name: string;
|
|
562
|
+
constructor(
|
|
563
|
+
/** The error code for this error. */
|
|
564
|
+
code: string, message: string,
|
|
565
|
+
/** Custom data for this error. */
|
|
566
|
+
customData?: Record<string, unknown> | undefined);
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
/**
|
|
570
|
-
* @license
|
|
571
|
-
* Copyright 2019 Google LLC
|
|
572
|
-
*
|
|
573
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
574
|
-
* you may not use this file except in compliance with the License.
|
|
575
|
-
* You may obtain a copy of the License at
|
|
576
|
-
*
|
|
577
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
578
|
-
*
|
|
579
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
580
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
581
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
582
|
-
* See the License for the specific language governing permissions and
|
|
583
|
-
* limitations under the License.
|
|
584
|
-
*/
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* The current SDK version.
|
|
588
|
-
*
|
|
589
|
-
* @public
|
|
590
|
-
*/
|
|
591
|
-
declare const SDK_VERSION: string;
|
|
592
|
-
/**
|
|
593
|
-
* Creates and initializes a {@link @firebase/app#FirebaseApp} instance.
|
|
594
|
-
*
|
|
595
|
-
* See
|
|
596
|
-
* {@link
|
|
597
|
-
* https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
|
|
598
|
-
* | Add Firebase to your app} and
|
|
599
|
-
* {@link
|
|
600
|
-
* https://firebase.google.com/docs/web/setup#multiple-projects
|
|
601
|
-
* | Initialize multiple projects} for detailed documentation.
|
|
602
|
-
*
|
|
603
|
-
* @example
|
|
604
|
-
* ```javascript
|
|
605
|
-
*
|
|
606
|
-
* // Initialize default app
|
|
607
|
-
* // Retrieve your own options values by adding a web app on
|
|
608
|
-
* // https://console.firebase.google.com
|
|
609
|
-
* initializeApp({
|
|
610
|
-
* apiKey: "AIza....", // Auth / General Use
|
|
611
|
-
* authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
|
|
612
|
-
* databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
|
|
613
|
-
* storageBucket: "YOUR_APP.appspot.com", // Storage
|
|
614
|
-
* messagingSenderId: "123456789" // Cloud Messaging
|
|
615
|
-
* });
|
|
616
|
-
* ```
|
|
617
|
-
*
|
|
618
|
-
* @example
|
|
619
|
-
* ```javascript
|
|
620
|
-
*
|
|
621
|
-
* // Initialize another app
|
|
622
|
-
* const otherApp = initializeApp({
|
|
623
|
-
* databaseURL: "https://<OTHER_DATABASE_NAME>.firebaseio.com",
|
|
624
|
-
* storageBucket: "<OTHER_STORAGE_BUCKET>.appspot.com"
|
|
625
|
-
* }, "otherApp");
|
|
626
|
-
* ```
|
|
627
|
-
*
|
|
628
|
-
* @param options - Options to configure the app's services.
|
|
629
|
-
* @param name - Optional name of the app to initialize. If no name
|
|
630
|
-
* is provided, the default is `"[DEFAULT]"`.
|
|
631
|
-
*
|
|
632
|
-
* @returns The initialized app.
|
|
633
|
-
*
|
|
634
|
-
* @public
|
|
635
|
-
*/
|
|
636
|
-
declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
|
|
637
|
-
/**
|
|
638
|
-
* Creates and initializes a FirebaseApp instance.
|
|
639
|
-
*
|
|
640
|
-
* @param options - Options to configure the app's services.
|
|
641
|
-
* @param config - FirebaseApp Configuration
|
|
642
|
-
*
|
|
643
|
-
* @public
|
|
644
|
-
*/
|
|
645
|
-
declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
|
|
646
|
-
/**
|
|
647
|
-
* Creates and initializes a FirebaseApp instance.
|
|
648
|
-
*
|
|
649
|
-
* @public
|
|
650
|
-
*/
|
|
651
|
-
declare function initializeApp(): FirebaseApp;
|
|
652
|
-
/**
|
|
653
|
-
* Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
|
|
654
|
-
*
|
|
655
|
-
* The `FirebaseServerApp` is similar to `FirebaseApp`, but is intended for execution in
|
|
656
|
-
* server side rendering environments only. Initialization will fail if invoked from a
|
|
657
|
-
* browser environment.
|
|
658
|
-
*
|
|
659
|
-
* See
|
|
660
|
-
* {@link
|
|
661
|
-
* https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
|
|
662
|
-
* | Add Firebase to your app} and
|
|
663
|
-
* {@link
|
|
664
|
-
* https://firebase.google.com/docs/web/setup#multiple-projects
|
|
665
|
-
* | Initialize multiple projects} for detailed documentation.
|
|
666
|
-
*
|
|
667
|
-
* @example
|
|
668
|
-
* ```javascript
|
|
669
|
-
*
|
|
670
|
-
* // Initialize an instance of `FirebaseServerApp`.
|
|
671
|
-
* // Retrieve your own options values by adding a web app on
|
|
672
|
-
* // https://console.firebase.google.com
|
|
673
|
-
* initializeServerApp({
|
|
674
|
-
* apiKey: "AIza....", // Auth / General Use
|
|
675
|
-
* authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
|
|
676
|
-
* databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
|
|
677
|
-
* storageBucket: "YOUR_APP.appspot.com", // Storage
|
|
678
|
-
* messagingSenderId: "123456789" // Cloud Messaging
|
|
679
|
-
* },
|
|
680
|
-
* {
|
|
681
|
-
* authIdToken: "Your Auth ID Token"
|
|
682
|
-
* });
|
|
683
|
-
* ```
|
|
684
|
-
*
|
|
685
|
-
* @param options - `Firebase.AppOptions` to configure the app's services, or a
|
|
686
|
-
* a `FirebaseApp` instance which contains the `AppOptions` within.
|
|
687
|
-
* @param config - `FirebaseServerApp` configuration.
|
|
688
|
-
*
|
|
689
|
-
* @returns The initialized `FirebaseServerApp`.
|
|
690
|
-
*
|
|
691
|
-
* @public
|
|
692
|
-
*/
|
|
693
|
-
declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
|
|
694
|
-
/**
|
|
695
|
-
* Retrieves a {@link @firebase/app#FirebaseApp} instance.
|
|
696
|
-
*
|
|
697
|
-
* When called with no arguments, the default app is returned. When an app name
|
|
698
|
-
* is provided, the app corresponding to that name is returned.
|
|
699
|
-
*
|
|
700
|
-
* An exception is thrown if the app being retrieved has not yet been
|
|
701
|
-
* initialized.
|
|
702
|
-
*
|
|
703
|
-
* @example
|
|
704
|
-
* ```javascript
|
|
705
|
-
* // Return the default app
|
|
706
|
-
* const app = getApp();
|
|
707
|
-
* ```
|
|
708
|
-
*
|
|
709
|
-
* @example
|
|
710
|
-
* ```javascript
|
|
711
|
-
* // Return a named app
|
|
712
|
-
* const otherApp = getApp("otherApp");
|
|
713
|
-
* ```
|
|
714
|
-
*
|
|
715
|
-
* @param name - Optional name of the app to return. If no name is
|
|
716
|
-
* provided, the default is `"[DEFAULT]"`.
|
|
717
|
-
*
|
|
718
|
-
* @returns The app corresponding to the provided app name.
|
|
719
|
-
* If no app name is provided, the default app is returned.
|
|
720
|
-
*
|
|
721
|
-
* @public
|
|
722
|
-
*/
|
|
723
|
-
declare function getApp(name?: string): FirebaseApp;
|
|
724
|
-
/**
|
|
725
|
-
* A (read-only) array of all initialized apps.
|
|
726
|
-
* @public
|
|
727
|
-
*/
|
|
728
|
-
declare function getApps(): FirebaseApp[];
|
|
729
|
-
/**
|
|
730
|
-
* Renders this app unusable and frees the resources of all associated
|
|
731
|
-
* services.
|
|
732
|
-
*
|
|
733
|
-
* @example
|
|
734
|
-
* ```javascript
|
|
735
|
-
* deleteApp(app)
|
|
736
|
-
* .then(function() {
|
|
737
|
-
* console.log("App deleted successfully");
|
|
738
|
-
* })
|
|
739
|
-
* .catch(function(error) {
|
|
740
|
-
* console.log("Error deleting app:", error);
|
|
741
|
-
* });
|
|
742
|
-
* ```
|
|
743
|
-
*
|
|
744
|
-
* @public
|
|
745
|
-
*/
|
|
746
|
-
declare function deleteApp(app: FirebaseApp): Promise<void>;
|
|
747
|
-
/**
|
|
748
|
-
* Registers a library's name and version for platform logging purposes.
|
|
749
|
-
* @param library - Name of 1p or 3p library (e.g. firestore, angularfire)
|
|
750
|
-
* @param version - Current version of that library.
|
|
751
|
-
* @param variant - Bundle variant, e.g., node, rn, etc.
|
|
752
|
-
*
|
|
753
|
-
* @public
|
|
754
|
-
*/
|
|
755
|
-
declare function registerVersion(libraryKeyOrName: string, version: string, variant?: string): void;
|
|
756
|
-
/**
|
|
757
|
-
* Sets log handler for all Firebase SDKs.
|
|
758
|
-
* @param logCallback - An optional custom log handler that executes user code whenever
|
|
759
|
-
* the Firebase SDK makes a logging call.
|
|
760
|
-
*
|
|
761
|
-
* @public
|
|
762
|
-
*/
|
|
763
|
-
declare function onLog(logCallback: LogCallback | null, options?: LogOptions): void;
|
|
764
|
-
/**
|
|
765
|
-
* Sets log level for all Firebase SDKs.
|
|
766
|
-
*
|
|
767
|
-
* All of the log types above the current log level are captured (i.e. if
|
|
768
|
-
* you set the log level to `info`, errors are logged, but `debug` and
|
|
769
|
-
* `verbose` logs are not).
|
|
770
|
-
*
|
|
771
|
-
* @public
|
|
772
|
-
*/
|
|
569
|
+
/**
|
|
570
|
+
* @license
|
|
571
|
+
* Copyright 2019 Google LLC
|
|
572
|
+
*
|
|
573
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
574
|
+
* you may not use this file except in compliance with the License.
|
|
575
|
+
* You may obtain a copy of the License at
|
|
576
|
+
*
|
|
577
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
578
|
+
*
|
|
579
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
580
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
581
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
582
|
+
* See the License for the specific language governing permissions and
|
|
583
|
+
* limitations under the License.
|
|
584
|
+
*/
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* The current SDK version.
|
|
588
|
+
*
|
|
589
|
+
* @public
|
|
590
|
+
*/
|
|
591
|
+
declare const SDK_VERSION: string;
|
|
592
|
+
/**
|
|
593
|
+
* Creates and initializes a {@link @firebase/app#FirebaseApp} instance.
|
|
594
|
+
*
|
|
595
|
+
* See
|
|
596
|
+
* {@link
|
|
597
|
+
* https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
|
|
598
|
+
* | Add Firebase to your app} and
|
|
599
|
+
* {@link
|
|
600
|
+
* https://firebase.google.com/docs/web/setup#multiple-projects
|
|
601
|
+
* | Initialize multiple projects} for detailed documentation.
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* ```javascript
|
|
605
|
+
*
|
|
606
|
+
* // Initialize default app
|
|
607
|
+
* // Retrieve your own options values by adding a web app on
|
|
608
|
+
* // https://console.firebase.google.com
|
|
609
|
+
* initializeApp({
|
|
610
|
+
* apiKey: "AIza....", // Auth / General Use
|
|
611
|
+
* authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
|
|
612
|
+
* databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
|
|
613
|
+
* storageBucket: "YOUR_APP.appspot.com", // Storage
|
|
614
|
+
* messagingSenderId: "123456789" // Cloud Messaging
|
|
615
|
+
* });
|
|
616
|
+
* ```
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```javascript
|
|
620
|
+
*
|
|
621
|
+
* // Initialize another app
|
|
622
|
+
* const otherApp = initializeApp({
|
|
623
|
+
* databaseURL: "https://<OTHER_DATABASE_NAME>.firebaseio.com",
|
|
624
|
+
* storageBucket: "<OTHER_STORAGE_BUCKET>.appspot.com"
|
|
625
|
+
* }, "otherApp");
|
|
626
|
+
* ```
|
|
627
|
+
*
|
|
628
|
+
* @param options - Options to configure the app's services.
|
|
629
|
+
* @param name - Optional name of the app to initialize. If no name
|
|
630
|
+
* is provided, the default is `"[DEFAULT]"`.
|
|
631
|
+
*
|
|
632
|
+
* @returns The initialized app.
|
|
633
|
+
*
|
|
634
|
+
* @public
|
|
635
|
+
*/
|
|
636
|
+
declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
|
|
637
|
+
/**
|
|
638
|
+
* Creates and initializes a FirebaseApp instance.
|
|
639
|
+
*
|
|
640
|
+
* @param options - Options to configure the app's services.
|
|
641
|
+
* @param config - FirebaseApp Configuration
|
|
642
|
+
*
|
|
643
|
+
* @public
|
|
644
|
+
*/
|
|
645
|
+
declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
|
|
646
|
+
/**
|
|
647
|
+
* Creates and initializes a FirebaseApp instance.
|
|
648
|
+
*
|
|
649
|
+
* @public
|
|
650
|
+
*/
|
|
651
|
+
declare function initializeApp(): FirebaseApp;
|
|
652
|
+
/**
|
|
653
|
+
* Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
|
|
654
|
+
*
|
|
655
|
+
* The `FirebaseServerApp` is similar to `FirebaseApp`, but is intended for execution in
|
|
656
|
+
* server side rendering environments only. Initialization will fail if invoked from a
|
|
657
|
+
* browser environment.
|
|
658
|
+
*
|
|
659
|
+
* See
|
|
660
|
+
* {@link
|
|
661
|
+
* https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
|
|
662
|
+
* | Add Firebase to your app} and
|
|
663
|
+
* {@link
|
|
664
|
+
* https://firebase.google.com/docs/web/setup#multiple-projects
|
|
665
|
+
* | Initialize multiple projects} for detailed documentation.
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* ```javascript
|
|
669
|
+
*
|
|
670
|
+
* // Initialize an instance of `FirebaseServerApp`.
|
|
671
|
+
* // Retrieve your own options values by adding a web app on
|
|
672
|
+
* // https://console.firebase.google.com
|
|
673
|
+
* initializeServerApp({
|
|
674
|
+
* apiKey: "AIza....", // Auth / General Use
|
|
675
|
+
* authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
|
|
676
|
+
* databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
|
|
677
|
+
* storageBucket: "YOUR_APP.appspot.com", // Storage
|
|
678
|
+
* messagingSenderId: "123456789" // Cloud Messaging
|
|
679
|
+
* },
|
|
680
|
+
* {
|
|
681
|
+
* authIdToken: "Your Auth ID Token"
|
|
682
|
+
* });
|
|
683
|
+
* ```
|
|
684
|
+
*
|
|
685
|
+
* @param options - `Firebase.AppOptions` to configure the app's services, or a
|
|
686
|
+
* a `FirebaseApp` instance which contains the `AppOptions` within.
|
|
687
|
+
* @param config - `FirebaseServerApp` configuration.
|
|
688
|
+
*
|
|
689
|
+
* @returns The initialized `FirebaseServerApp`.
|
|
690
|
+
*
|
|
691
|
+
* @public
|
|
692
|
+
*/
|
|
693
|
+
declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config: FirebaseServerAppSettings): FirebaseServerApp;
|
|
694
|
+
/**
|
|
695
|
+
* Retrieves a {@link @firebase/app#FirebaseApp} instance.
|
|
696
|
+
*
|
|
697
|
+
* When called with no arguments, the default app is returned. When an app name
|
|
698
|
+
* is provided, the app corresponding to that name is returned.
|
|
699
|
+
*
|
|
700
|
+
* An exception is thrown if the app being retrieved has not yet been
|
|
701
|
+
* initialized.
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* ```javascript
|
|
705
|
+
* // Return the default app
|
|
706
|
+
* const app = getApp();
|
|
707
|
+
* ```
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* ```javascript
|
|
711
|
+
* // Return a named app
|
|
712
|
+
* const otherApp = getApp("otherApp");
|
|
713
|
+
* ```
|
|
714
|
+
*
|
|
715
|
+
* @param name - Optional name of the app to return. If no name is
|
|
716
|
+
* provided, the default is `"[DEFAULT]"`.
|
|
717
|
+
*
|
|
718
|
+
* @returns The app corresponding to the provided app name.
|
|
719
|
+
* If no app name is provided, the default app is returned.
|
|
720
|
+
*
|
|
721
|
+
* @public
|
|
722
|
+
*/
|
|
723
|
+
declare function getApp(name?: string): FirebaseApp;
|
|
724
|
+
/**
|
|
725
|
+
* A (read-only) array of all initialized apps.
|
|
726
|
+
* @public
|
|
727
|
+
*/
|
|
728
|
+
declare function getApps(): FirebaseApp[];
|
|
729
|
+
/**
|
|
730
|
+
* Renders this app unusable and frees the resources of all associated
|
|
731
|
+
* services.
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```javascript
|
|
735
|
+
* deleteApp(app)
|
|
736
|
+
* .then(function() {
|
|
737
|
+
* console.log("App deleted successfully");
|
|
738
|
+
* })
|
|
739
|
+
* .catch(function(error) {
|
|
740
|
+
* console.log("Error deleting app:", error);
|
|
741
|
+
* });
|
|
742
|
+
* ```
|
|
743
|
+
*
|
|
744
|
+
* @public
|
|
745
|
+
*/
|
|
746
|
+
declare function deleteApp(app: FirebaseApp): Promise<void>;
|
|
747
|
+
/**
|
|
748
|
+
* Registers a library's name and version for platform logging purposes.
|
|
749
|
+
* @param library - Name of 1p or 3p library (e.g. firestore, angularfire)
|
|
750
|
+
* @param version - Current version of that library.
|
|
751
|
+
* @param variant - Bundle variant, e.g., node, rn, etc.
|
|
752
|
+
*
|
|
753
|
+
* @public
|
|
754
|
+
*/
|
|
755
|
+
declare function registerVersion(libraryKeyOrName: string, version: string, variant?: string): void;
|
|
756
|
+
/**
|
|
757
|
+
* Sets log handler for all Firebase SDKs.
|
|
758
|
+
* @param logCallback - An optional custom log handler that executes user code whenever
|
|
759
|
+
* the Firebase SDK makes a logging call.
|
|
760
|
+
*
|
|
761
|
+
* @public
|
|
762
|
+
*/
|
|
763
|
+
declare function onLog(logCallback: LogCallback | null, options?: LogOptions): void;
|
|
764
|
+
/**
|
|
765
|
+
* Sets log level for all Firebase SDKs.
|
|
766
|
+
*
|
|
767
|
+
* All of the log types above the current log level are captured (i.e. if
|
|
768
|
+
* you set the log level to `info`, errors are logged, but `debug` and
|
|
769
|
+
* `verbose` logs are not).
|
|
770
|
+
*
|
|
771
|
+
* @public
|
|
772
|
+
*/
|
|
773
773
|
declare function setLogLevel(logLevel: LogLevelString): void;
|
|
774
774
|
|
|
775
|
-
/**
|
|
776
|
-
* @license
|
|
777
|
-
* Copyright 2019 Google LLC
|
|
778
|
-
*
|
|
779
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
780
|
-
* you may not use this file except in compliance with the License.
|
|
781
|
-
* You may obtain a copy of the License at
|
|
782
|
-
*
|
|
783
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
784
|
-
*
|
|
785
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
786
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
787
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
788
|
-
* See the License for the specific language governing permissions and
|
|
789
|
-
* limitations under the License.
|
|
790
|
-
*/
|
|
791
|
-
/**
|
|
792
|
-
* The default app name
|
|
793
|
-
*
|
|
794
|
-
* @internal
|
|
795
|
-
*/
|
|
775
|
+
/**
|
|
776
|
+
* @license
|
|
777
|
+
* Copyright 2019 Google LLC
|
|
778
|
+
*
|
|
779
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
780
|
+
* you may not use this file except in compliance with the License.
|
|
781
|
+
* You may obtain a copy of the License at
|
|
782
|
+
*
|
|
783
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
784
|
+
*
|
|
785
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
786
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
787
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
788
|
+
* See the License for the specific language governing permissions and
|
|
789
|
+
* limitations under the License.
|
|
790
|
+
*/
|
|
791
|
+
/**
|
|
792
|
+
* The default app name
|
|
793
|
+
*
|
|
794
|
+
* @internal
|
|
795
|
+
*/
|
|
796
796
|
declare const DEFAULT_ENTRY_NAME = "[DEFAULT]";
|
|
797
797
|
|
|
798
|
-
/**
|
|
799
|
-
* @license
|
|
800
|
-
* Copyright 2019 Google LLC
|
|
801
|
-
*
|
|
802
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
803
|
-
* you may not use this file except in compliance with the License.
|
|
804
|
-
* You may obtain a copy of the License at
|
|
805
|
-
*
|
|
806
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
807
|
-
*
|
|
808
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
809
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
810
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
811
|
-
* See the License for the specific language governing permissions and
|
|
812
|
-
* limitations under the License.
|
|
813
|
-
*/
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* @internal
|
|
817
|
-
*/
|
|
818
|
-
declare const _apps: Map<string, FirebaseApp>;
|
|
819
|
-
/**
|
|
820
|
-
* @internal
|
|
821
|
-
*/
|
|
822
|
-
declare const _serverApps: Map<string, FirebaseServerApp>;
|
|
823
|
-
/**
|
|
824
|
-
* Registered components.
|
|
825
|
-
*
|
|
826
|
-
* @internal
|
|
827
|
-
*/
|
|
828
|
-
declare const _components: Map<string, Component<any>>;
|
|
829
|
-
/**
|
|
830
|
-
* @param component - the component being added to this app's container
|
|
831
|
-
*
|
|
832
|
-
* @internal
|
|
833
|
-
*/
|
|
834
|
-
declare function _addComponent<T extends Name>(app: FirebaseApp, component: Component<T>): void;
|
|
835
|
-
/**
|
|
836
|
-
*
|
|
837
|
-
* @internal
|
|
838
|
-
*/
|
|
839
|
-
declare function _addOrOverwriteComponent(app: FirebaseApp, component: Component): void;
|
|
840
|
-
/**
|
|
841
|
-
*
|
|
842
|
-
* @param component - the component to register
|
|
843
|
-
* @returns whether or not the component is registered successfully
|
|
844
|
-
*
|
|
845
|
-
* @internal
|
|
846
|
-
*/
|
|
847
|
-
declare function _registerComponent<T extends Name>(component: Component<T>): boolean;
|
|
848
|
-
/**
|
|
849
|
-
*
|
|
850
|
-
* @param app - FirebaseApp instance
|
|
851
|
-
* @param name - service name
|
|
852
|
-
*
|
|
853
|
-
* @returns the provider for the service with the matching name
|
|
854
|
-
*
|
|
855
|
-
* @internal
|
|
856
|
-
*/
|
|
857
|
-
declare function _getProvider<T extends Name>(app: FirebaseApp, name: T): Provider<T>;
|
|
858
|
-
/**
|
|
859
|
-
*
|
|
860
|
-
* @param app - FirebaseApp instance
|
|
861
|
-
* @param name - service name
|
|
862
|
-
* @param instanceIdentifier - service instance identifier in case the service supports multiple instances
|
|
863
|
-
*
|
|
864
|
-
* @internal
|
|
865
|
-
*/
|
|
866
|
-
declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
|
|
867
|
-
/**
|
|
868
|
-
*
|
|
869
|
-
* @param obj - an object of type FirebaseApp or FirebaseOptions.
|
|
870
|
-
*
|
|
871
|
-
* @returns true if the provide object is of type FirebaseApp.
|
|
872
|
-
*
|
|
873
|
-
* @internal
|
|
874
|
-
*/
|
|
875
|
-
declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
|
|
876
|
-
/**
|
|
877
|
-
*
|
|
878
|
-
* @param obj - an object of type FirebaseApp.
|
|
879
|
-
*
|
|
880
|
-
* @returns true if the provided object is of type FirebaseServerAppImpl.
|
|
881
|
-
*
|
|
882
|
-
* @internal
|
|
883
|
-
*/
|
|
884
|
-
declare function _isFirebaseServerApp(obj: FirebaseApp | FirebaseServerApp): obj is FirebaseServerApp;
|
|
885
|
-
/**
|
|
886
|
-
* Test only
|
|
887
|
-
*
|
|
888
|
-
* @internal
|
|
889
|
-
*/
|
|
798
|
+
/**
|
|
799
|
+
* @license
|
|
800
|
+
* Copyright 2019 Google LLC
|
|
801
|
+
*
|
|
802
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
803
|
+
* you may not use this file except in compliance with the License.
|
|
804
|
+
* You may obtain a copy of the License at
|
|
805
|
+
*
|
|
806
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
807
|
+
*
|
|
808
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
809
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
810
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
811
|
+
* See the License for the specific language governing permissions and
|
|
812
|
+
* limitations under the License.
|
|
813
|
+
*/
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* @internal
|
|
817
|
+
*/
|
|
818
|
+
declare const _apps: Map<string, FirebaseApp>;
|
|
819
|
+
/**
|
|
820
|
+
* @internal
|
|
821
|
+
*/
|
|
822
|
+
declare const _serverApps: Map<string, FirebaseServerApp>;
|
|
823
|
+
/**
|
|
824
|
+
* Registered components.
|
|
825
|
+
*
|
|
826
|
+
* @internal
|
|
827
|
+
*/
|
|
828
|
+
declare const _components: Map<string, Component<any>>;
|
|
829
|
+
/**
|
|
830
|
+
* @param component - the component being added to this app's container
|
|
831
|
+
*
|
|
832
|
+
* @internal
|
|
833
|
+
*/
|
|
834
|
+
declare function _addComponent<T extends Name>(app: FirebaseApp, component: Component<T>): void;
|
|
835
|
+
/**
|
|
836
|
+
*
|
|
837
|
+
* @internal
|
|
838
|
+
*/
|
|
839
|
+
declare function _addOrOverwriteComponent(app: FirebaseApp, component: Component): void;
|
|
840
|
+
/**
|
|
841
|
+
*
|
|
842
|
+
* @param component - the component to register
|
|
843
|
+
* @returns whether or not the component is registered successfully
|
|
844
|
+
*
|
|
845
|
+
* @internal
|
|
846
|
+
*/
|
|
847
|
+
declare function _registerComponent<T extends Name>(component: Component<T>): boolean;
|
|
848
|
+
/**
|
|
849
|
+
*
|
|
850
|
+
* @param app - FirebaseApp instance
|
|
851
|
+
* @param name - service name
|
|
852
|
+
*
|
|
853
|
+
* @returns the provider for the service with the matching name
|
|
854
|
+
*
|
|
855
|
+
* @internal
|
|
856
|
+
*/
|
|
857
|
+
declare function _getProvider<T extends Name>(app: FirebaseApp, name: T): Provider<T>;
|
|
858
|
+
/**
|
|
859
|
+
*
|
|
860
|
+
* @param app - FirebaseApp instance
|
|
861
|
+
* @param name - service name
|
|
862
|
+
* @param instanceIdentifier - service instance identifier in case the service supports multiple instances
|
|
863
|
+
*
|
|
864
|
+
* @internal
|
|
865
|
+
*/
|
|
866
|
+
declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
|
|
867
|
+
/**
|
|
868
|
+
*
|
|
869
|
+
* @param obj - an object of type FirebaseApp or FirebaseOptions.
|
|
870
|
+
*
|
|
871
|
+
* @returns true if the provide object is of type FirebaseApp.
|
|
872
|
+
*
|
|
873
|
+
* @internal
|
|
874
|
+
*/
|
|
875
|
+
declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions): obj is FirebaseApp;
|
|
876
|
+
/**
|
|
877
|
+
*
|
|
878
|
+
* @param obj - an object of type FirebaseApp.
|
|
879
|
+
*
|
|
880
|
+
* @returns true if the provided object is of type FirebaseServerAppImpl.
|
|
881
|
+
*
|
|
882
|
+
* @internal
|
|
883
|
+
*/
|
|
884
|
+
declare function _isFirebaseServerApp(obj: FirebaseApp | FirebaseServerApp): obj is FirebaseServerApp;
|
|
885
|
+
/**
|
|
886
|
+
* Test only
|
|
887
|
+
*
|
|
888
|
+
* @internal
|
|
889
|
+
*/
|
|
890
890
|
declare function _clearComponents(): void;
|
|
891
891
|
|
|
892
892
|
export { FirebaseApp, FirebaseAppSettings, FirebaseError, FirebaseOptions, FirebaseServerApp, FirebaseServerAppSettings, SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _FirebaseAppInternal, _FirebaseService, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _isFirebaseApp, _isFirebaseServerApp, _registerComponent, _removeServiceInstance, _serverApps, deleteApp, getApp, getApps, initializeApp, initializeServerApp, onLog, registerVersion, setLogLevel };
|