@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,24 +1,24 @@
1
- /**
2
- * @license
3
- * Copyright 2017 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 { VersionService } from './types';
19
- declare module '@firebase/component' {
20
- interface NameServiceMapping {
21
- 'vs1': VersionService;
22
- 'vs2': VersionService;
23
- }
24
- }
1
+ /**
2
+ * @license
3
+ * Copyright 2017 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 { VersionService } from './types';
19
+ declare module '@firebase/component' {
20
+ interface NameServiceMapping {
21
+ 'vs1': VersionService;
22
+ 'vs2': VersionService;
23
+ }
24
+ }
@@ -1,231 +1,231 @@
1
- /**
2
- * @license
3
- * Copyright 2020 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, VersionService, HeartbeatService } from './types';
19
- /**
20
- * A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of
21
- * services.
22
- *
23
- * Do not call this constructor directly. Instead, use
24
- * {@link (initializeApp:1) | initializeApp()} to create an app.
25
- *
26
- * @public
27
- */
28
- export interface FirebaseApp {
29
- /**
30
- * The (read-only) name for this app.
31
- *
32
- * The default app's name is `"[DEFAULT]"`.
33
- *
34
- * @example
35
- * ```javascript
36
- * // The default app's name is "[DEFAULT]"
37
- * const app = initializeApp(defaultAppConfig);
38
- * console.log(app.name); // "[DEFAULT]"
39
- * ```
40
- *
41
- * @example
42
- * ```javascript
43
- * // A named app's name is what you provide to initializeApp()
44
- * const otherApp = initializeApp(otherAppConfig, "other");
45
- * console.log(otherApp.name); // "other"
46
- * ```
47
- */
48
- readonly name: string;
49
- /**
50
- * The (read-only) configuration options for this app. These are the original
51
- * parameters given in {@link (initializeApp:1) | initializeApp()}.
52
- *
53
- * @example
54
- * ```javascript
55
- * const app = initializeApp(config);
56
- * console.log(app.options.databaseURL === config.databaseURL); // true
57
- * ```
58
- */
59
- readonly options: FirebaseOptions;
60
- /**
61
- * The settable config flag for GDPR opt-in/opt-out
62
- */
63
- automaticDataCollectionEnabled: boolean;
64
- }
65
- /**
66
- * A {@link @firebase/app#FirebaseServerApp} holds the initialization information
67
- * for a collection of services running in server environments.
68
- *
69
- * Do not call this constructor directly. Instead, use
70
- * {@link (initializeServerApp:1) | initializeServerApp()} to create
71
- * an app.
72
- *
73
- * @public
74
- */
75
- export interface FirebaseServerApp extends FirebaseApp {
76
- /**
77
- * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
78
- * applications. However, it may be used internally, and is declared here so that
79
- * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
80
- */
81
- name: string;
82
- /**
83
- * The (read-only) configuration settings for this server app. These are the original
84
- * parameters given in {@link (initializeServerApp:1) | initializeServerApp()}.
85
- *
86
- * @example
87
- * ```javascript
88
- * const app = initializeServerApp(settings);
89
- * console.log(app.settings.authIdToken === options.authIdToken); // true
90
- * ```
91
- */
92
- readonly settings: FirebaseServerAppSettings;
93
- }
94
- /**
95
- * @public
96
- *
97
- * Firebase configuration object. Contains a set of parameters required by
98
- * services in order to successfully communicate with Firebase server APIs
99
- * and to associate client data with your Firebase project and
100
- * Firebase application. Typically this object is populated by the Firebase
101
- * console at project setup. See also:
102
- * {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
103
- */
104
- export interface FirebaseOptions {
105
- /**
106
- * An encrypted string used when calling certain APIs that don't need to
107
- * access private user data
108
- * (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
109
- */
110
- apiKey?: string;
111
- /**
112
- * Auth domain for the project ID.
113
- */
114
- authDomain?: string;
115
- /**
116
- * Default Realtime Database URL.
117
- */
118
- databaseURL?: string;
119
- /**
120
- * The unique identifier for the project across all of Firebase and
121
- * Google Cloud.
122
- */
123
- projectId?: string;
124
- /**
125
- * The default Cloud Storage bucket name.
126
- */
127
- storageBucket?: string;
128
- /**
129
- * Unique numerical value used to identify each sender that can send
130
- * Firebase Cloud Messaging messages to client apps.
131
- */
132
- messagingSenderId?: string;
133
- /**
134
- * Unique identifier for the app.
135
- */
136
- appId?: string;
137
- /**
138
- * An ID automatically created when you enable Analytics in your
139
- * Firebase project and register a web app. In versions 7.20.0
140
- * and higher, this parameter is optional.
141
- */
142
- measurementId?: string;
143
- }
144
- /**
145
- * @public
146
- *
147
- * Configuration options given to {@link (initializeApp:1) | initializeApp()}
148
- */
149
- export interface FirebaseAppSettings {
150
- /**
151
- * custom name for the Firebase App.
152
- * The default value is `"[DEFAULT]"`.
153
- */
154
- name?: string;
155
- /**
156
- * The settable config flag for GDPR opt-in/opt-out
157
- */
158
- automaticDataCollectionEnabled?: boolean;
159
- }
160
- /**
161
- * @public
162
- *
163
- * Configuration options given to {@link (initializeServerApp:1) | initializeServerApp()}
164
- */
165
- export interface FirebaseServerAppSettings extends Omit<FirebaseAppSettings, 'name'> {
166
- /**
167
- * An optional Auth ID token used to resume a signed in user session from a client
168
- * runtime environment.
169
- *
170
- * Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken`
171
- * causes an automatic attempt to sign in the user that the `authIdToken` represents. The token
172
- * needs to have been recently minted for this operation to succeed.
173
- *
174
- * If the token fails local verification, or if the Auth service has failed to validate it when
175
- * the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not
176
- * sign in a user on initialization.
177
- *
178
- * If a user is successfully signed in, then the Auth instance's `onAuthStateChanged` callback
179
- * is invoked with the `User` object as per standard Auth flows. However, `User` objects
180
- * created via an `authIdToken` do not have a refresh token. Attempted `refreshToken`
181
- * operations fail.
182
- */
183
- authIdToken?: string;
184
- /**
185
- * An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry`
186
- * object to monitor the garbage collection status of the provided object. The
187
- * Firebase SDK releases its reference on the `FirebaseServerApp` instance when the
188
- * provided `releaseOnDeref` object is garbage collected.
189
- *
190
- * You can use this field to reduce memory management overhead for your application.
191
- * If provided, an app running in a SSR pass does not need to perform
192
- * `FirebaseServerApp` cleanup, so long as the reference object is deleted (by falling out of
193
- * SSR scope, for instance.)
194
- *
195
- * If an object is not provided then the application must clean up the `FirebaseServerApp`
196
- * instance by invoking `deleteApp`.
197
- *
198
- * If the application provides an object in this parameter, but the application is
199
- * executed in a JavaScript engine that predates the support of `FinalizationRegistry`
200
- * (introduced in node v14.6.0, for instance), then an error is thrown at `FirebaseServerApp`
201
- * initialization.
202
- */
203
- releaseOnDeref?: object;
204
- }
205
- /**
206
- * @internal
207
- */
208
- export interface _FirebaseService {
209
- app: FirebaseApp;
210
- /**
211
- * Delete the service and free it's resources - called from
212
- * {@link @firebase/app#deleteApp | deleteApp()}
213
- */
214
- _delete(): Promise<void>;
215
- }
216
- /**
217
- * @internal
218
- */
219
- export interface _FirebaseAppInternal extends FirebaseApp {
220
- container: ComponentContainer;
221
- isDeleted: boolean;
222
- checkDestroyed(): void;
223
- }
224
- declare module '@firebase/component' {
225
- interface NameServiceMapping {
226
- 'app': FirebaseApp;
227
- 'app-version': VersionService;
228
- 'heartbeat': HeartbeatService;
229
- 'platform-logger': PlatformLoggerService;
230
- }
231
- }
1
+ /**
2
+ * @license
3
+ * Copyright 2020 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, VersionService, HeartbeatService } from './types';
19
+ /**
20
+ * A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of
21
+ * services.
22
+ *
23
+ * Do not call this constructor directly. Instead, use
24
+ * {@link (initializeApp:1) | initializeApp()} to create an app.
25
+ *
26
+ * @public
27
+ */
28
+ export interface FirebaseApp {
29
+ /**
30
+ * The (read-only) name for this app.
31
+ *
32
+ * The default app's name is `"[DEFAULT]"`.
33
+ *
34
+ * @example
35
+ * ```javascript
36
+ * // The default app's name is "[DEFAULT]"
37
+ * const app = initializeApp(defaultAppConfig);
38
+ * console.log(app.name); // "[DEFAULT]"
39
+ * ```
40
+ *
41
+ * @example
42
+ * ```javascript
43
+ * // A named app's name is what you provide to initializeApp()
44
+ * const otherApp = initializeApp(otherAppConfig, "other");
45
+ * console.log(otherApp.name); // "other"
46
+ * ```
47
+ */
48
+ readonly name: string;
49
+ /**
50
+ * The (read-only) configuration options for this app. These are the original
51
+ * parameters given in {@link (initializeApp:1) | initializeApp()}.
52
+ *
53
+ * @example
54
+ * ```javascript
55
+ * const app = initializeApp(config);
56
+ * console.log(app.options.databaseURL === config.databaseURL); // true
57
+ * ```
58
+ */
59
+ readonly options: FirebaseOptions;
60
+ /**
61
+ * The settable config flag for GDPR opt-in/opt-out
62
+ */
63
+ automaticDataCollectionEnabled: boolean;
64
+ }
65
+ /**
66
+ * A {@link @firebase/app#FirebaseServerApp} holds the initialization information
67
+ * for a collection of services running in server environments.
68
+ *
69
+ * Do not call this constructor directly. Instead, use
70
+ * {@link (initializeServerApp:1) | initializeServerApp()} to create
71
+ * an app.
72
+ *
73
+ * @public
74
+ */
75
+ export interface FirebaseServerApp extends FirebaseApp {
76
+ /**
77
+ * There is no `getApp()` operation for `FirebaseServerApp`, so the name is not relevant for
78
+ * applications. However, it may be used internally, and is declared here so that
79
+ * `FirebaseServerApp` conforms to the `FirebaseApp` interface.
80
+ */
81
+ name: string;
82
+ /**
83
+ * The (read-only) configuration settings for this server app. These are the original
84
+ * parameters given in {@link (initializeServerApp:1) | initializeServerApp()}.
85
+ *
86
+ * @example
87
+ * ```javascript
88
+ * const app = initializeServerApp(settings);
89
+ * console.log(app.settings.authIdToken === options.authIdToken); // true
90
+ * ```
91
+ */
92
+ readonly settings: FirebaseServerAppSettings;
93
+ }
94
+ /**
95
+ * @public
96
+ *
97
+ * Firebase configuration object. Contains a set of parameters required by
98
+ * services in order to successfully communicate with Firebase server APIs
99
+ * and to associate client data with your Firebase project and
100
+ * Firebase application. Typically this object is populated by the Firebase
101
+ * console at project setup. See also:
102
+ * {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
103
+ */
104
+ export interface FirebaseOptions {
105
+ /**
106
+ * An encrypted string used when calling certain APIs that don't need to
107
+ * access private user data
108
+ * (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
109
+ */
110
+ apiKey?: string;
111
+ /**
112
+ * Auth domain for the project ID.
113
+ */
114
+ authDomain?: string;
115
+ /**
116
+ * Default Realtime Database URL.
117
+ */
118
+ databaseURL?: string;
119
+ /**
120
+ * The unique identifier for the project across all of Firebase and
121
+ * Google Cloud.
122
+ */
123
+ projectId?: string;
124
+ /**
125
+ * The default Cloud Storage bucket name.
126
+ */
127
+ storageBucket?: string;
128
+ /**
129
+ * Unique numerical value used to identify each sender that can send
130
+ * Firebase Cloud Messaging messages to client apps.
131
+ */
132
+ messagingSenderId?: string;
133
+ /**
134
+ * Unique identifier for the app.
135
+ */
136
+ appId?: string;
137
+ /**
138
+ * An ID automatically created when you enable Analytics in your
139
+ * Firebase project and register a web app. In versions 7.20.0
140
+ * and higher, this parameter is optional.
141
+ */
142
+ measurementId?: string;
143
+ }
144
+ /**
145
+ * @public
146
+ *
147
+ * Configuration options given to {@link (initializeApp:1) | initializeApp()}
148
+ */
149
+ export interface FirebaseAppSettings {
150
+ /**
151
+ * custom name for the Firebase App.
152
+ * The default value is `"[DEFAULT]"`.
153
+ */
154
+ name?: string;
155
+ /**
156
+ * The settable config flag for GDPR opt-in/opt-out
157
+ */
158
+ automaticDataCollectionEnabled?: boolean;
159
+ }
160
+ /**
161
+ * @public
162
+ *
163
+ * Configuration options given to {@link (initializeServerApp:1) | initializeServerApp()}
164
+ */
165
+ export interface FirebaseServerAppSettings extends Omit<FirebaseAppSettings, 'name'> {
166
+ /**
167
+ * An optional Auth ID token used to resume a signed in user session from a client
168
+ * runtime environment.
169
+ *
170
+ * Invoking `getAuth` with a `FirebaseServerApp` configured with a validated `authIdToken`
171
+ * causes an automatic attempt to sign in the user that the `authIdToken` represents. The token
172
+ * needs to have been recently minted for this operation to succeed.
173
+ *
174
+ * If the token fails local verification, or if the Auth service has failed to validate it when
175
+ * the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not
176
+ * sign in a user on initialization.
177
+ *
178
+ * If a user is successfully signed in, then the Auth instance's `onAuthStateChanged` callback
179
+ * is invoked with the `User` object as per standard Auth flows. However, `User` objects
180
+ * created via an `authIdToken` do not have a refresh token. Attempted `refreshToken`
181
+ * operations fail.
182
+ */
183
+ authIdToken?: string;
184
+ /**
185
+ * An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry`
186
+ * object to monitor the garbage collection status of the provided object. The
187
+ * Firebase SDK releases its reference on the `FirebaseServerApp` instance when the
188
+ * provided `releaseOnDeref` object is garbage collected.
189
+ *
190
+ * You can use this field to reduce memory management overhead for your application.
191
+ * If provided, an app running in a SSR pass does not need to perform
192
+ * `FirebaseServerApp` cleanup, so long as the reference object is deleted (by falling out of
193
+ * SSR scope, for instance.)
194
+ *
195
+ * If an object is not provided then the application must clean up the `FirebaseServerApp`
196
+ * instance by invoking `deleteApp`.
197
+ *
198
+ * If the application provides an object in this parameter, but the application is
199
+ * executed in a JavaScript engine that predates the support of `FinalizationRegistry`
200
+ * (introduced in node v14.6.0, for instance), then an error is thrown at `FirebaseServerApp`
201
+ * initialization.
202
+ */
203
+ releaseOnDeref?: object;
204
+ }
205
+ /**
206
+ * @internal
207
+ */
208
+ export interface _FirebaseService {
209
+ app: FirebaseApp;
210
+ /**
211
+ * Delete the service and free it's resources - called from
212
+ * {@link @firebase/app#deleteApp | deleteApp()}
213
+ */
214
+ _delete(): Promise<void>;
215
+ }
216
+ /**
217
+ * @internal
218
+ */
219
+ export interface _FirebaseAppInternal extends FirebaseApp {
220
+ container: ComponentContainer;
221
+ isDeleted: boolean;
222
+ checkDestroyed(): void;
223
+ }
224
+ declare module '@firebase/component' {
225
+ interface NameServiceMapping {
226
+ 'app': FirebaseApp;
227
+ 'app-version': VersionService;
228
+ 'heartbeat': HeartbeatService;
229
+ 'platform-logger': PlatformLoggerService;
230
+ }
231
+ }
@@ -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
- export declare function registerCoreComponents(variant?: string): void;
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
+ export declare function registerCoreComponents(variant?: string): void;
@@ -1,55 +1,55 @@
1
- /**
2
- * @license
3
- * Copyright 2020 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
- export interface VersionService {
18
- library: string;
19
- version: string;
20
- }
21
- export interface PlatformLoggerService {
22
- getPlatformInfoString(): string;
23
- }
24
- export interface HeartbeatService {
25
- /**
26
- * Called to report a heartbeat. The function will generate
27
- * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
28
- * to IndexedDB.
29
- * Note that we only store one heartbeat per day. So if a heartbeat for today is
30
- * already logged, subsequent calls to this function in the same day will be ignored.
31
- */
32
- triggerHeartbeat(): Promise<void>;
33
- /**
34
- * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
35
- * It also clears all heartbeats from memory as well as in IndexedDB.
36
- */
37
- getHeartbeatsHeader(): Promise<string>;
38
- }
39
- export interface HeartbeatsByUserAgent {
40
- agent: string;
41
- dates: string[];
42
- }
43
- export interface SingleDateHeartbeat {
44
- agent: string;
45
- date: string;
46
- }
47
- export interface HeartbeatStorage {
48
- overwrite(heartbeats: HeartbeatsInIndexedDB): Promise<void>;
49
- add(heartbeats: HeartbeatsInIndexedDB): Promise<void>;
50
- read(): Promise<HeartbeatsInIndexedDB>;
51
- }
52
- export interface HeartbeatsInIndexedDB {
53
- lastSentHeartbeatDate?: string;
54
- heartbeats: SingleDateHeartbeat[];
55
- }
1
+ /**
2
+ * @license
3
+ * Copyright 2020 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
+ export interface VersionService {
18
+ library: string;
19
+ version: string;
20
+ }
21
+ export interface PlatformLoggerService {
22
+ getPlatformInfoString(): string;
23
+ }
24
+ export interface HeartbeatService {
25
+ /**
26
+ * Called to report a heartbeat. The function will generate
27
+ * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
28
+ * to IndexedDB.
29
+ * Note that we only store one heartbeat per day. So if a heartbeat for today is
30
+ * already logged, subsequent calls to this function in the same day will be ignored.
31
+ */
32
+ triggerHeartbeat(): Promise<void>;
33
+ /**
34
+ * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
35
+ * It also clears all heartbeats from memory as well as in IndexedDB.
36
+ */
37
+ getHeartbeatsHeader(): Promise<string>;
38
+ }
39
+ export interface HeartbeatsByUserAgent {
40
+ agent: string;
41
+ dates: string[];
42
+ }
43
+ export interface SingleDateHeartbeat {
44
+ agent: string;
45
+ date: string;
46
+ }
47
+ export interface HeartbeatStorage {
48
+ overwrite(heartbeats: HeartbeatsInIndexedDB): Promise<void>;
49
+ add(heartbeats: HeartbeatsInIndexedDB): Promise<void>;
50
+ read(): Promise<HeartbeatsInIndexedDB>;
51
+ }
52
+ export interface HeartbeatsInIndexedDB {
53
+ lastSentHeartbeatDate?: string;
54
+ heartbeats: SingleDateHeartbeat[];
55
+ }