@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.
Files changed (52) hide show
  1. package/dist/app/src/api.d.ts +207 -207
  2. package/dist/app/src/api.test.d.ts +22 -22
  3. package/dist/app/src/constants.d.ts +26 -26
  4. package/dist/app/src/errors.d.ts +67 -67
  5. package/dist/app/src/firebaseApp.d.ts +46 -46
  6. package/dist/app/src/firebaseApp.test.d.ts +17 -17
  7. package/dist/app/src/firebaseServerApp.d.ts +36 -36
  8. package/dist/app/src/firebaseServerApp.test.d.ts +17 -17
  9. package/dist/app/src/global_index.d.ts +868 -868
  10. package/dist/app/src/heartbeatService.d.ts +83 -83
  11. package/dist/app/src/heartbeatService.test.d.ts +23 -23
  12. package/dist/app/src/index.d.ts +9 -9
  13. package/dist/app/src/indexeddb.d.ts +20 -20
  14. package/dist/app/src/indexeddb.test.d.ts +17 -17
  15. package/dist/app/src/internal.d.ts +99 -99
  16. package/dist/app/src/internal.test.d.ts +23 -23
  17. package/dist/app/src/logger.d.ts +18 -18
  18. package/dist/app/src/platformLoggerService.d.ts +23 -23
  19. package/dist/app/src/platformLoggerService.test.d.ts +24 -24
  20. package/dist/app/src/public-types.d.ts +231 -231
  21. package/dist/app/src/registerCoreComponents.d.ts +17 -17
  22. package/dist/app/src/types.d.ts +55 -55
  23. package/dist/app/test/setup.d.ts +17 -17
  24. package/dist/app/test/util.d.ts +26 -26
  25. package/dist/esm/app/src/api.d.ts +207 -207
  26. package/dist/esm/app/src/api.test.d.ts +22 -22
  27. package/dist/esm/app/src/constants.d.ts +26 -26
  28. package/dist/esm/app/src/errors.d.ts +67 -67
  29. package/dist/esm/app/src/firebaseApp.d.ts +46 -46
  30. package/dist/esm/app/src/firebaseApp.test.d.ts +17 -17
  31. package/dist/esm/app/src/firebaseServerApp.d.ts +36 -36
  32. package/dist/esm/app/src/firebaseServerApp.test.d.ts +17 -17
  33. package/dist/esm/app/src/heartbeatService.d.ts +83 -83
  34. package/dist/esm/app/src/heartbeatService.test.d.ts +23 -23
  35. package/dist/esm/app/src/index.d.ts +9 -9
  36. package/dist/esm/app/src/indexeddb.d.ts +20 -20
  37. package/dist/esm/app/src/indexeddb.test.d.ts +17 -17
  38. package/dist/esm/app/src/internal.d.ts +99 -99
  39. package/dist/esm/app/src/internal.test.d.ts +23 -23
  40. package/dist/esm/app/src/logger.d.ts +18 -18
  41. package/dist/esm/app/src/platformLoggerService.d.ts +23 -23
  42. package/dist/esm/app/src/platformLoggerService.test.d.ts +24 -24
  43. package/dist/esm/app/src/public-types.d.ts +231 -231
  44. package/dist/esm/app/src/registerCoreComponents.d.ts +17 -17
  45. package/dist/esm/app/src/types.d.ts +55 -55
  46. package/dist/esm/app/test/setup.d.ts +17 -17
  47. package/dist/esm/app/test/util.d.ts +26 -26
  48. package/dist/esm/index.esm2017.js +1069 -1069
  49. package/dist/esm/index.esm2017.js.map +1 -1
  50. package/dist/index.cjs.js +1069 -1069
  51. package/dist/index.cjs.js.map +1 -1
  52. package/package.json +5 -5
@@ -1,67 +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 {};
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 {};
@@ -1,46 +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
- }
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
+ }
@@ -1,17 +1,17 @@
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 '../test/setup';
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 '../test/setup';
@@ -1,36 +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
- }
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
+ }
@@ -1,17 +1,17 @@
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 '../test/setup';
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 '../test/setup';
@@ -1,83 +1,83 @@
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 class HeartbeatServiceImpl implements HeartbeatService {
21
- private readonly container;
22
- /**
23
- * The persistence layer for heartbeats
24
- * Leave public for easier testing.
25
- */
26
- _storage: HeartbeatStorageImpl;
27
- /**
28
- * In-memory cache for heartbeats, used by getHeartbeatsHeader() to generate
29
- * the header string.
30
- * Stores one record per date. This will be consolidated into the standard
31
- * format of one record per user agent string before being sent as a header.
32
- * Populated from indexedDB when the controller is instantiated and should
33
- * be kept in sync with indexedDB.
34
- * Leave public for easier testing.
35
- */
36
- _heartbeatsCache: HeartbeatsInIndexedDB | null;
37
- /**
38
- * the initialization promise for populating heartbeatCache.
39
- * If getHeartbeatsHeader() is called before the promise resolves
40
- * (heartbeatsCache == null), it should wait for this promise
41
- * Leave public for easier testing.
42
- */
43
- _heartbeatsCachePromise: Promise<HeartbeatsInIndexedDB>;
44
- constructor(container: ComponentContainer);
45
- /**
46
- * Called to report a heartbeat. The function will generate
47
- * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
48
- * to IndexedDB.
49
- * Note that we only store one heartbeat per day. So if a heartbeat for today is
50
- * already logged, subsequent calls to this function in the same day will be ignored.
51
- */
52
- triggerHeartbeat(): Promise<void>;
53
- /**
54
- * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
55
- * It also clears all heartbeats from memory as well as in IndexedDB.
56
- *
57
- * NOTE: Consuming product SDKs should not send the header if this method
58
- * returns an empty string.
59
- */
60
- getHeartbeatsHeader(): Promise<string>;
61
- }
62
- export declare function extractHeartbeatsForHeader(heartbeatsCache: SingleDateHeartbeat[], maxSize?: number): {
63
- heartbeatsToSend: HeartbeatsByUserAgent[];
64
- unsentEntries: SingleDateHeartbeat[];
65
- };
66
- export declare class HeartbeatStorageImpl implements HeartbeatStorage {
67
- app: FirebaseApp;
68
- private _canUseIndexedDBPromise;
69
- constructor(app: FirebaseApp);
70
- runIndexedDBEnvironmentCheck(): Promise<boolean>;
71
- /**
72
- * Read all heartbeats.
73
- */
74
- read(): Promise<HeartbeatsInIndexedDB>;
75
- overwrite(heartbeatsObject: HeartbeatsInIndexedDB): Promise<void>;
76
- add(heartbeatsObject: HeartbeatsInIndexedDB): Promise<void>;
77
- }
78
- /**
79
- * Calculate bytes of a HeartbeatsByUserAgent array after being wrapped
80
- * in a platform logging header JSON object, stringified, and converted
81
- * to base 64.
82
- */
83
- export declare function countBytes(heartbeatsCache: HeartbeatsByUserAgent[]): number;
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 class HeartbeatServiceImpl implements HeartbeatService {
21
+ private readonly container;
22
+ /**
23
+ * The persistence layer for heartbeats
24
+ * Leave public for easier testing.
25
+ */
26
+ _storage: HeartbeatStorageImpl;
27
+ /**
28
+ * In-memory cache for heartbeats, used by getHeartbeatsHeader() to generate
29
+ * the header string.
30
+ * Stores one record per date. This will be consolidated into the standard
31
+ * format of one record per user agent string before being sent as a header.
32
+ * Populated from indexedDB when the controller is instantiated and should
33
+ * be kept in sync with indexedDB.
34
+ * Leave public for easier testing.
35
+ */
36
+ _heartbeatsCache: HeartbeatsInIndexedDB | null;
37
+ /**
38
+ * the initialization promise for populating heartbeatCache.
39
+ * If getHeartbeatsHeader() is called before the promise resolves
40
+ * (heartbeatsCache == null), it should wait for this promise
41
+ * Leave public for easier testing.
42
+ */
43
+ _heartbeatsCachePromise: Promise<HeartbeatsInIndexedDB>;
44
+ constructor(container: ComponentContainer);
45
+ /**
46
+ * Called to report a heartbeat. The function will generate
47
+ * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
48
+ * to IndexedDB.
49
+ * Note that we only store one heartbeat per day. So if a heartbeat for today is
50
+ * already logged, subsequent calls to this function in the same day will be ignored.
51
+ */
52
+ triggerHeartbeat(): Promise<void>;
53
+ /**
54
+ * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
55
+ * It also clears all heartbeats from memory as well as in IndexedDB.
56
+ *
57
+ * NOTE: Consuming product SDKs should not send the header if this method
58
+ * returns an empty string.
59
+ */
60
+ getHeartbeatsHeader(): Promise<string>;
61
+ }
62
+ export declare function extractHeartbeatsForHeader(heartbeatsCache: SingleDateHeartbeat[], maxSize?: number): {
63
+ heartbeatsToSend: HeartbeatsByUserAgent[];
64
+ unsentEntries: SingleDateHeartbeat[];
65
+ };
66
+ export declare class HeartbeatStorageImpl implements HeartbeatStorage {
67
+ app: FirebaseApp;
68
+ private _canUseIndexedDBPromise;
69
+ constructor(app: FirebaseApp);
70
+ runIndexedDBEnvironmentCheck(): Promise<boolean>;
71
+ /**
72
+ * Read all heartbeats.
73
+ */
74
+ read(): Promise<HeartbeatsInIndexedDB>;
75
+ overwrite(heartbeatsObject: HeartbeatsInIndexedDB): Promise<void>;
76
+ add(heartbeatsObject: HeartbeatsInIndexedDB): Promise<void>;
77
+ }
78
+ /**
79
+ * Calculate bytes of a HeartbeatsByUserAgent array after being wrapped
80
+ * in a platform logging header JSON object, stringified, and converted
81
+ * to base 64.
82
+ */
83
+ export declare function countBytes(heartbeatsCache: HeartbeatsByUserAgent[]): number;
@@ -1,23 +1,23 @@
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 '../test/setup';
18
- import { PlatformLoggerService } from './types';
19
- declare module '@firebase/component' {
20
- interface NameServiceMapping {
21
- 'platform-logger': PlatformLoggerService;
22
- }
23
- }
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 '../test/setup';
18
+ import { PlatformLoggerService } from './types';
19
+ declare module '@firebase/component' {
20
+ interface NameServiceMapping {
21
+ 'platform-logger': PlatformLoggerService;
22
+ }
23
+ }
@@ -1,9 +1,9 @@
1
- /**
2
- * Firebase App
3
- *
4
- * @remarks This package coordinates the communication between the different Firebase components
5
- * @packageDocumentation
6
- */
7
- export * from './api';
8
- export * from './internal';
9
- export * from './public-types';
1
+ /**
2
+ * Firebase App
3
+ *
4
+ * @remarks This package coordinates the communication between the different Firebase components
5
+ * @packageDocumentation
6
+ */
7
+ export * from './api';
8
+ export * from './internal';
9
+ export * from './public-types';
@@ -1,20 +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>;
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>;