@depup/firebase__app 0.14.9-depup.0
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/README.md +32 -0
- package/changes.json +14 -0
- package/dist/app/src/api.d.ts +235 -0
- package/dist/app/src/constants.d.ts +26 -0
- package/dist/app/src/errors.d.ts +67 -0
- package/dist/app/src/firebaseApp.d.ts +46 -0
- package/dist/app/src/firebaseServerApp.d.ts +36 -0
- package/dist/app/src/global_index.d.ts +939 -0
- package/dist/app/src/heartbeatService.d.ts +89 -0
- package/dist/app/src/index.d.ts +9 -0
- package/dist/app/src/indexeddb.d.ts +20 -0
- package/dist/app/src/internal.d.ts +108 -0
- package/dist/app/src/logger.d.ts +18 -0
- package/dist/app/src/platformLoggerService.d.ts +23 -0
- package/dist/app/src/public-types.d.ts +241 -0
- package/dist/app/src/registerCoreComponents.d.ts +17 -0
- package/dist/app/src/tsdoc-metadata.json +11 -0
- package/dist/app/src/types.d.ts +55 -0
- package/dist/app/test/setup.d.ts +17 -0
- package/dist/app/test/util.d.ts +26 -0
- package/dist/app-public.d.ts +477 -0
- package/dist/app.d.ts +572 -0
- package/dist/esm/app/src/api.d.ts +235 -0
- package/dist/esm/app/src/constants.d.ts +26 -0
- package/dist/esm/app/src/errors.d.ts +67 -0
- package/dist/esm/app/src/firebaseApp.d.ts +46 -0
- package/dist/esm/app/src/firebaseServerApp.d.ts +36 -0
- package/dist/esm/app/src/heartbeatService.d.ts +89 -0
- package/dist/esm/app/src/index.d.ts +9 -0
- package/dist/esm/app/src/indexeddb.d.ts +20 -0
- package/dist/esm/app/src/internal.d.ts +108 -0
- package/dist/esm/app/src/logger.d.ts +18 -0
- package/dist/esm/app/src/platformLoggerService.d.ts +23 -0
- package/dist/esm/app/src/public-types.d.ts +241 -0
- package/dist/esm/app/src/registerCoreComponents.d.ts +17 -0
- package/dist/esm/app/src/types.d.ts +55 -0
- package/dist/esm/app/test/setup.d.ts +17 -0
- package/dist/esm/app/test/util.d.ts +26 -0
- package/dist/esm/index.esm.js +1237 -0
- package/dist/esm/index.esm.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/index.cjs.js +1265 -0
- package/dist/index.cjs.js.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,235 @@
|
|
|
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
|
+
import { FirebaseApp, FirebaseServerApp, FirebaseOptions, FirebaseAppSettings, FirebaseServerAppSettings } from './public-types';
|
|
18
|
+
import { LogLevelString, LogCallback, LogOptions } from '@firebase/logger';
|
|
19
|
+
export { FirebaseError } from '@firebase/util';
|
|
20
|
+
/**
|
|
21
|
+
* The current SDK version.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare const SDK_VERSION: string;
|
|
26
|
+
/**
|
|
27
|
+
* Creates and initializes a {@link @firebase/app#FirebaseApp} instance.
|
|
28
|
+
*
|
|
29
|
+
* See
|
|
30
|
+
* {@link
|
|
31
|
+
* https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
|
|
32
|
+
* | Add Firebase to your app} and
|
|
33
|
+
* {@link
|
|
34
|
+
* https://firebase.google.com/docs/web/setup#multiple-projects
|
|
35
|
+
* | Initialize multiple projects} for detailed documentation.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```javascript
|
|
39
|
+
*
|
|
40
|
+
* // Initialize default app
|
|
41
|
+
* // Retrieve your own options values by adding a web app on
|
|
42
|
+
* // https://console.firebase.google.com
|
|
43
|
+
* initializeApp({
|
|
44
|
+
* apiKey: "AIza....", // Auth / General Use
|
|
45
|
+
* authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
|
|
46
|
+
* databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
|
|
47
|
+
* storageBucket: "YOUR_APP.appspot.com", // Storage
|
|
48
|
+
* messagingSenderId: "123456789" // Cloud Messaging
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```javascript
|
|
54
|
+
*
|
|
55
|
+
* // Initialize another app
|
|
56
|
+
* const otherApp = initializeApp({
|
|
57
|
+
* databaseURL: "https://<OTHER_DATABASE_NAME>.firebaseio.com",
|
|
58
|
+
* storageBucket: "<OTHER_STORAGE_BUCKET>.appspot.com"
|
|
59
|
+
* }, "otherApp");
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param options - Options to configure the app's services.
|
|
63
|
+
* @param name - Optional name of the app to initialize. If no name
|
|
64
|
+
* is provided, the default is `"[DEFAULT]"`.
|
|
65
|
+
*
|
|
66
|
+
* @returns The initialized app.
|
|
67
|
+
*
|
|
68
|
+
* @throws If the optional `name` parameter is malformed or empty.
|
|
69
|
+
*
|
|
70
|
+
* @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
|
|
75
|
+
/**
|
|
76
|
+
* Creates and initializes a FirebaseApp instance.
|
|
77
|
+
*
|
|
78
|
+
* @param options - Options to configure the app's services.
|
|
79
|
+
* @param config - FirebaseApp Configuration
|
|
80
|
+
*
|
|
81
|
+
* @throws If {@link FirebaseAppSettings.name} is defined but the value is malformed or empty.
|
|
82
|
+
*
|
|
83
|
+
* @throws If a `FirebaseApp` already exists with the same name but with a different configuration.
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export declare function initializeApp(options: FirebaseOptions, config?: FirebaseAppSettings): FirebaseApp;
|
|
87
|
+
/**
|
|
88
|
+
* Creates and initializes a FirebaseApp instance.
|
|
89
|
+
*
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
export declare function initializeApp(): FirebaseApp;
|
|
93
|
+
/**
|
|
94
|
+
* Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
|
|
95
|
+
*
|
|
96
|
+
* The `FirebaseServerApp` is similar to `FirebaseApp`, but is intended for execution in
|
|
97
|
+
* server side rendering environments only. Initialization will fail if invoked from a
|
|
98
|
+
* browser environment.
|
|
99
|
+
*
|
|
100
|
+
* See
|
|
101
|
+
* {@link
|
|
102
|
+
* https://firebase.google.com/docs/web/setup#add_firebase_to_your_app
|
|
103
|
+
* | Add Firebase to your app} and
|
|
104
|
+
* {@link
|
|
105
|
+
* https://firebase.google.com/docs/web/setup#multiple-projects
|
|
106
|
+
* | Initialize multiple projects} for detailed documentation.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```javascript
|
|
110
|
+
*
|
|
111
|
+
* // Initialize an instance of `FirebaseServerApp`.
|
|
112
|
+
* // Retrieve your own options values by adding a web app on
|
|
113
|
+
* // https://console.firebase.google.com
|
|
114
|
+
* initializeServerApp({
|
|
115
|
+
* apiKey: "AIza....", // Auth / General Use
|
|
116
|
+
* authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
|
|
117
|
+
* databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
|
|
118
|
+
* storageBucket: "YOUR_APP.appspot.com", // Storage
|
|
119
|
+
* messagingSenderId: "123456789" // Cloud Messaging
|
|
120
|
+
* },
|
|
121
|
+
* {
|
|
122
|
+
* authIdToken: "Your Auth ID Token"
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @param options - `Firebase.AppOptions` to configure the app's services, or a
|
|
127
|
+
* a `FirebaseApp` instance which contains the `AppOptions` within.
|
|
128
|
+
* @param config - Optional `FirebaseServerApp` settings.
|
|
129
|
+
*
|
|
130
|
+
* @returns The initialized `FirebaseServerApp`.
|
|
131
|
+
*
|
|
132
|
+
* @throws If invoked in an unsupported non-server environment such as a browser.
|
|
133
|
+
*
|
|
134
|
+
* @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
|
|
135
|
+
* provide Finalization Registry support.
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
export declare function initializeServerApp(options: FirebaseOptions | FirebaseApp, config?: FirebaseServerAppSettings): FirebaseServerApp;
|
|
140
|
+
/**
|
|
141
|
+
* Creates and initializes a {@link @firebase/app#FirebaseServerApp} instance.
|
|
142
|
+
*
|
|
143
|
+
* @param config - Optional `FirebaseServerApp` settings.
|
|
144
|
+
*
|
|
145
|
+
* @returns The initialized `FirebaseServerApp`.
|
|
146
|
+
*
|
|
147
|
+
* @throws If invoked in an unsupported non-server environment such as a browser.
|
|
148
|
+
* @throws If {@link FirebaseServerAppSettings.releaseOnDeref} is defined but the runtime doesn't
|
|
149
|
+
* provide Finalization Registry support.
|
|
150
|
+
* @throws If the `FIREBASE_OPTIONS` environment variable does not contain a valid project
|
|
151
|
+
* configuration required for auto-initialization.
|
|
152
|
+
*
|
|
153
|
+
* @public
|
|
154
|
+
*/
|
|
155
|
+
export declare function initializeServerApp(config?: FirebaseServerAppSettings): FirebaseServerApp;
|
|
156
|
+
/**
|
|
157
|
+
* Retrieves a {@link @firebase/app#FirebaseApp} instance.
|
|
158
|
+
*
|
|
159
|
+
* When called with no arguments, the default app is returned. When an app name
|
|
160
|
+
* is provided, the app corresponding to that name is returned.
|
|
161
|
+
*
|
|
162
|
+
* An exception is thrown if the app being retrieved has not yet been
|
|
163
|
+
* initialized.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```javascript
|
|
167
|
+
* // Return the default app
|
|
168
|
+
* const app = getApp();
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```javascript
|
|
173
|
+
* // Return a named app
|
|
174
|
+
* const otherApp = getApp("otherApp");
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @param name - Optional name of the app to return. If no name is
|
|
178
|
+
* provided, the default is `"[DEFAULT]"`.
|
|
179
|
+
*
|
|
180
|
+
* @returns The app corresponding to the provided app name.
|
|
181
|
+
* If no app name is provided, the default app is returned.
|
|
182
|
+
*
|
|
183
|
+
* @public
|
|
184
|
+
*/
|
|
185
|
+
export declare function getApp(name?: string): FirebaseApp;
|
|
186
|
+
/**
|
|
187
|
+
* A (read-only) array of all initialized apps.
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
export declare function getApps(): FirebaseApp[];
|
|
191
|
+
/**
|
|
192
|
+
* Renders this app unusable and frees the resources of all associated
|
|
193
|
+
* services.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```javascript
|
|
197
|
+
* deleteApp(app)
|
|
198
|
+
* .then(function() {
|
|
199
|
+
* console.log("App deleted successfully");
|
|
200
|
+
* })
|
|
201
|
+
* .catch(function(error) {
|
|
202
|
+
* console.log("Error deleting app:", error);
|
|
203
|
+
* });
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
export declare function deleteApp(app: FirebaseApp): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Registers a library's name and version for platform logging purposes.
|
|
211
|
+
* @param library - Name of 1p or 3p library (e.g. firestore, angularfire)
|
|
212
|
+
* @param version - Current version of that library.
|
|
213
|
+
* @param variant - Bundle variant, e.g., node, rn, etc.
|
|
214
|
+
*
|
|
215
|
+
* @public
|
|
216
|
+
*/
|
|
217
|
+
export declare function registerVersion(libraryKeyOrName: string, version: string, variant?: string): void;
|
|
218
|
+
/**
|
|
219
|
+
* Sets log handler for all Firebase SDKs.
|
|
220
|
+
* @param logCallback - An optional custom log handler that executes user code whenever
|
|
221
|
+
* the Firebase SDK makes a logging call.
|
|
222
|
+
*
|
|
223
|
+
* @public
|
|
224
|
+
*/
|
|
225
|
+
export declare function onLog(logCallback: LogCallback | null, options?: LogOptions): void;
|
|
226
|
+
/**
|
|
227
|
+
* Sets log level for all Firebase SDKs.
|
|
228
|
+
*
|
|
229
|
+
* All of the log types above the current log level are captured (i.e. if
|
|
230
|
+
* you set the log level to `info`, errors are logged, but `debug` and
|
|
231
|
+
* `verbose` logs are not).
|
|
232
|
+
*
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
export declare function setLogLevel(logLevel: LogLevelString): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* The default app name
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_ENTRY_NAME = "[DEFAULT]";
|
|
23
|
+
export declare const PLATFORM_LOG_STRING: {
|
|
24
|
+
readonly [x: string]: "fire-core" | "fire-core-compat" | "fire-analytics" | "fire-analytics-compat" | "fire-app-check" | "fire-app-check-compat" | "fire-auth" | "fire-auth-compat" | "fire-rtdb" | "fire-data-connect" | "fire-rtdb-compat" | "fire-fn" | "fire-fn-compat" | "fire-iid" | "fire-iid-compat" | "fire-fcm" | "fire-fcm-compat" | "fire-perf" | "fire-perf-compat" | "fire-rc" | "fire-rc-compat" | "fire-gcs" | "fire-gcs-compat" | "fire-fst" | "fire-fst-compat" | "fire-vertex" | "fire-js" | "fire-js-all";
|
|
25
|
+
readonly 'fire-js': "fire-js";
|
|
26
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
import { ErrorFactory } from '@firebase/util';
|
|
18
|
+
export declare const enum AppError {
|
|
19
|
+
NO_APP = "no-app",
|
|
20
|
+
BAD_APP_NAME = "bad-app-name",
|
|
21
|
+
DUPLICATE_APP = "duplicate-app",
|
|
22
|
+
APP_DELETED = "app-deleted",
|
|
23
|
+
SERVER_APP_DELETED = "server-app-deleted",
|
|
24
|
+
NO_OPTIONS = "no-options",
|
|
25
|
+
INVALID_APP_ARGUMENT = "invalid-app-argument",
|
|
26
|
+
INVALID_LOG_ARGUMENT = "invalid-log-argument",
|
|
27
|
+
IDB_OPEN = "idb-open",
|
|
28
|
+
IDB_GET = "idb-get",
|
|
29
|
+
IDB_WRITE = "idb-set",
|
|
30
|
+
IDB_DELETE = "idb-delete",
|
|
31
|
+
FINALIZATION_REGISTRY_NOT_SUPPORTED = "finalization-registry-not-supported",
|
|
32
|
+
INVALID_SERVER_APP_ENVIRONMENT = "invalid-server-app-environment"
|
|
33
|
+
}
|
|
34
|
+
interface ErrorParams {
|
|
35
|
+
[AppError.NO_APP]: {
|
|
36
|
+
appName: string;
|
|
37
|
+
};
|
|
38
|
+
[AppError.BAD_APP_NAME]: {
|
|
39
|
+
appName: string;
|
|
40
|
+
};
|
|
41
|
+
[AppError.DUPLICATE_APP]: {
|
|
42
|
+
appName: string;
|
|
43
|
+
};
|
|
44
|
+
[AppError.APP_DELETED]: {
|
|
45
|
+
appName: string;
|
|
46
|
+
};
|
|
47
|
+
[AppError.INVALID_APP_ARGUMENT]: {
|
|
48
|
+
appName: string;
|
|
49
|
+
};
|
|
50
|
+
[AppError.IDB_OPEN]: {
|
|
51
|
+
originalErrorMessage?: string;
|
|
52
|
+
};
|
|
53
|
+
[AppError.IDB_GET]: {
|
|
54
|
+
originalErrorMessage?: string;
|
|
55
|
+
};
|
|
56
|
+
[AppError.IDB_WRITE]: {
|
|
57
|
+
originalErrorMessage?: string;
|
|
58
|
+
};
|
|
59
|
+
[AppError.IDB_DELETE]: {
|
|
60
|
+
originalErrorMessage?: string;
|
|
61
|
+
};
|
|
62
|
+
[AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED]: {
|
|
63
|
+
appName?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export declare const ERROR_FACTORY: ErrorFactory<AppError, ErrorParams>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
import { FirebaseApp, FirebaseOptions, FirebaseAppSettings } from './public-types';
|
|
18
|
+
import { ComponentContainer } from '@firebase/component';
|
|
19
|
+
export declare class FirebaseAppImpl implements FirebaseApp {
|
|
20
|
+
protected readonly _options: FirebaseOptions;
|
|
21
|
+
protected readonly _name: string;
|
|
22
|
+
/**
|
|
23
|
+
* Original config values passed in as a constructor parameter.
|
|
24
|
+
* It is only used to compare with another config object to support idempotent initializeApp().
|
|
25
|
+
*
|
|
26
|
+
* Updating automaticDataCollectionEnabled on the App instance will not change its value in _config.
|
|
27
|
+
*/
|
|
28
|
+
private readonly _config;
|
|
29
|
+
private _automaticDataCollectionEnabled;
|
|
30
|
+
protected _isDeleted: boolean;
|
|
31
|
+
private readonly _container;
|
|
32
|
+
constructor(options: FirebaseOptions, config: Required<FirebaseAppSettings>, container: ComponentContainer);
|
|
33
|
+
get automaticDataCollectionEnabled(): boolean;
|
|
34
|
+
set automaticDataCollectionEnabled(val: boolean);
|
|
35
|
+
get name(): string;
|
|
36
|
+
get options(): FirebaseOptions;
|
|
37
|
+
get config(): Required<FirebaseAppSettings>;
|
|
38
|
+
get container(): ComponentContainer;
|
|
39
|
+
get isDeleted(): boolean;
|
|
40
|
+
set isDeleted(val: boolean);
|
|
41
|
+
/**
|
|
42
|
+
* This function will throw an Error if the App has already been deleted -
|
|
43
|
+
* use before performing API actions on the App.
|
|
44
|
+
*/
|
|
45
|
+
protected checkDestroyed(): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 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
|
+
import { FirebaseServerApp, FirebaseServerAppSettings, FirebaseOptions } from './public-types';
|
|
18
|
+
import { ComponentContainer } from '@firebase/component';
|
|
19
|
+
import { FirebaseAppImpl } from './firebaseApp';
|
|
20
|
+
export declare class FirebaseServerAppImpl extends FirebaseAppImpl implements FirebaseServerApp {
|
|
21
|
+
private readonly _serverConfig;
|
|
22
|
+
private _finalizationRegistry;
|
|
23
|
+
private _refCount;
|
|
24
|
+
constructor(options: FirebaseOptions | FirebaseAppImpl, serverConfig: FirebaseServerAppSettings, name: string, container: ComponentContainer);
|
|
25
|
+
toJSON(): undefined;
|
|
26
|
+
get refCount(): number;
|
|
27
|
+
incRefCount(obj: object | undefined): void;
|
|
28
|
+
decRefCount(): number;
|
|
29
|
+
private automaticCleanup;
|
|
30
|
+
get settings(): FirebaseServerAppSettings;
|
|
31
|
+
/**
|
|
32
|
+
* This function will throw an Error if the App has already been deleted -
|
|
33
|
+
* use before performing API actions on the App.
|
|
34
|
+
*/
|
|
35
|
+
protected checkDestroyed(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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
|
+
import { ComponentContainer } from '@firebase/component';
|
|
18
|
+
import { FirebaseApp } from './public-types';
|
|
19
|
+
import { HeartbeatsByUserAgent, HeartbeatService, HeartbeatsInIndexedDB, HeartbeatStorage, SingleDateHeartbeat } from './types';
|
|
20
|
+
export declare const MAX_NUM_STORED_HEARTBEATS = 30;
|
|
21
|
+
export declare class HeartbeatServiceImpl implements HeartbeatService {
|
|
22
|
+
private readonly container;
|
|
23
|
+
/**
|
|
24
|
+
* The persistence layer for heartbeats
|
|
25
|
+
* Leave public for easier testing.
|
|
26
|
+
*/
|
|
27
|
+
_storage: HeartbeatStorageImpl;
|
|
28
|
+
/**
|
|
29
|
+
* In-memory cache for heartbeats, used by getHeartbeatsHeader() to generate
|
|
30
|
+
* the header string.
|
|
31
|
+
* Stores one record per date. This will be consolidated into the standard
|
|
32
|
+
* format of one record per user agent string before being sent as a header.
|
|
33
|
+
* Populated from indexedDB when the controller is instantiated and should
|
|
34
|
+
* be kept in sync with indexedDB.
|
|
35
|
+
* Leave public for easier testing.
|
|
36
|
+
*/
|
|
37
|
+
_heartbeatsCache: HeartbeatsInIndexedDB | null;
|
|
38
|
+
/**
|
|
39
|
+
* the initialization promise for populating heartbeatCache.
|
|
40
|
+
* If getHeartbeatsHeader() is called before the promise resolves
|
|
41
|
+
* (heartbeatsCache == null), it should wait for this promise
|
|
42
|
+
* Leave public for easier testing.
|
|
43
|
+
*/
|
|
44
|
+
_heartbeatsCachePromise: Promise<HeartbeatsInIndexedDB>;
|
|
45
|
+
constructor(container: ComponentContainer);
|
|
46
|
+
/**
|
|
47
|
+
* Called to report a heartbeat. The function will generate
|
|
48
|
+
* a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
|
|
49
|
+
* to IndexedDB.
|
|
50
|
+
* Note that we only store one heartbeat per day. So if a heartbeat for today is
|
|
51
|
+
* already logged, subsequent calls to this function in the same day will be ignored.
|
|
52
|
+
*/
|
|
53
|
+
triggerHeartbeat(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
|
|
56
|
+
* It also clears all heartbeats from memory as well as in IndexedDB.
|
|
57
|
+
*
|
|
58
|
+
* NOTE: Consuming product SDKs should not send the header if this method
|
|
59
|
+
* returns an empty string.
|
|
60
|
+
*/
|
|
61
|
+
getHeartbeatsHeader(): Promise<string>;
|
|
62
|
+
}
|
|
63
|
+
export declare function extractHeartbeatsForHeader(heartbeatsCache: SingleDateHeartbeat[], maxSize?: number): {
|
|
64
|
+
heartbeatsToSend: HeartbeatsByUserAgent[];
|
|
65
|
+
unsentEntries: SingleDateHeartbeat[];
|
|
66
|
+
};
|
|
67
|
+
export declare class HeartbeatStorageImpl implements HeartbeatStorage {
|
|
68
|
+
app: FirebaseApp;
|
|
69
|
+
private _canUseIndexedDBPromise;
|
|
70
|
+
constructor(app: FirebaseApp);
|
|
71
|
+
runIndexedDBEnvironmentCheck(): Promise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Read all heartbeats.
|
|
74
|
+
*/
|
|
75
|
+
read(): Promise<HeartbeatsInIndexedDB>;
|
|
76
|
+
overwrite(heartbeatsObject: HeartbeatsInIndexedDB): Promise<void>;
|
|
77
|
+
add(heartbeatsObject: HeartbeatsInIndexedDB): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Calculate bytes of a HeartbeatsByUserAgent array after being wrapped
|
|
81
|
+
* in a platform logging header JSON object, stringified, and converted
|
|
82
|
+
* to base 64.
|
|
83
|
+
*/
|
|
84
|
+
export declare function countBytes(heartbeatsCache: HeartbeatsByUserAgent[]): number;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the index of the heartbeat with the earliest date.
|
|
87
|
+
* If the heartbeats array is empty, -1 is returned.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getEarliestHeartbeatIdx(heartbeats: SingleDateHeartbeat[]): number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 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
|
+
import { FirebaseApp } from './public-types';
|
|
18
|
+
import { HeartbeatsInIndexedDB } from './types';
|
|
19
|
+
export declare function readHeartbeatsFromIndexedDB(app: FirebaseApp): Promise<HeartbeatsInIndexedDB | undefined>;
|
|
20
|
+
export declare function writeHeartbeatsToIndexedDB(app: FirebaseApp, heartbeatObject: HeartbeatsInIndexedDB): Promise<void>;
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
import { FirebaseApp, FirebaseAppSettings, FirebaseServerAppSettings, FirebaseOptions, FirebaseServerApp } from './public-types';
|
|
18
|
+
import { Component, Provider, Name } from '@firebase/component';
|
|
19
|
+
import { DEFAULT_ENTRY_NAME } from './constants';
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare const _apps: Map<string, FirebaseApp>;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare const _serverApps: Map<string, FirebaseServerApp>;
|
|
28
|
+
/**
|
|
29
|
+
* Registered components.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare const _components: Map<string, Component<any>>;
|
|
34
|
+
/**
|
|
35
|
+
* @param component - the component being added to this app's container
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare function _addComponent<T extends Name>(app: FirebaseApp, component: Component<T>): void;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare function _addOrOverwriteComponent(app: FirebaseApp, component: Component): void;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param component - the component to register
|
|
48
|
+
* @returns whether or not the component is registered successfully
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export declare function _registerComponent<T extends Name>(component: Component<T>): boolean;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param app - FirebaseApp instance
|
|
56
|
+
* @param name - service name
|
|
57
|
+
*
|
|
58
|
+
* @returns the provider for the service with the matching name
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare function _getProvider<T extends Name>(app: FirebaseApp, name: T): Provider<T>;
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @param app - FirebaseApp instance
|
|
66
|
+
* @param name - service name
|
|
67
|
+
* @param instanceIdentifier - service instance identifier in case the service supports multiple instances
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare function _removeServiceInstance<T extends Name>(app: FirebaseApp, name: T, instanceIdentifier?: string): void;
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
|
|
75
|
+
*
|
|
76
|
+
* @returns true if the provide object is of type FirebaseApp.
|
|
77
|
+
*
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
export declare function _isFirebaseApp(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseApp;
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.
|
|
84
|
+
*
|
|
85
|
+
* @returns true if the provided object is of type FirebaseServerAppImpl.
|
|
86
|
+
*
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
export declare function _isFirebaseServerAppSettings(obj: FirebaseApp | FirebaseOptions | FirebaseAppSettings): obj is FirebaseServerAppSettings;
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @param obj - an object of type FirebaseApp.
|
|
93
|
+
*
|
|
94
|
+
* @returns true if the provided object is of type FirebaseServerAppImpl.
|
|
95
|
+
*
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
export declare function _isFirebaseServerApp(obj: FirebaseApp | FirebaseServerApp | null | undefined): obj is FirebaseServerApp;
|
|
99
|
+
/**
|
|
100
|
+
* Test only
|
|
101
|
+
*
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
export declare function _clearComponents(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Exported in order to be used in app-compat package
|
|
107
|
+
*/
|
|
108
|
+
export { DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME };
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import { Logger } from '@firebase/logger';
|
|
18
|
+
export declare const logger: Logger;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
import { ComponentContainer } from '@firebase/component';
|
|
18
|
+
import { PlatformLoggerService } from './types';
|
|
19
|
+
export declare class PlatformLoggerServiceImpl implements PlatformLoggerService {
|
|
20
|
+
private readonly container;
|
|
21
|
+
constructor(container: ComponentContainer);
|
|
22
|
+
getPlatformInfoString(): string;
|
|
23
|
+
}
|