@react-native-firebase/perf 24.1.1 → 25.0.1
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/CHANGELOG.md +29 -0
- package/dist/module/HttpMetric.js +91 -0
- package/dist/module/HttpMetric.js.map +1 -0
- package/dist/module/MetricWithAttributes.js +51 -0
- package/dist/module/MetricWithAttributes.js.map +1 -0
- package/{lib → dist/module}/ScreenTrace.js +3 -6
- package/dist/module/ScreenTrace.js.map +1 -0
- package/{lib → dist/module}/Trace.js +8 -23
- package/dist/module/Trace.js.map +1 -0
- package/dist/module/index.js +23 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/modular.js +93 -0
- package/dist/module/modular.js.map +1 -0
- package/{lib/index.js → dist/module/namespaced.js} +28 -72
- package/dist/module/namespaced.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/types/internal.js +4 -0
- package/dist/module/types/internal.js.map +1 -0
- package/dist/module/types/namespaced.js +65 -0
- package/dist/module/types/namespaced.js.map +1 -0
- package/dist/module/types/perf.js +4 -0
- package/dist/module/types/perf.js.map +1 -0
- package/dist/module/version.js +5 -0
- package/dist/module/version.js.map +1 -0
- package/dist/typescript/lib/HttpMetric.d.ts +21 -0
- package/dist/typescript/lib/HttpMetric.d.ts.map +1 -0
- package/dist/typescript/lib/MetricWithAttributes.d.ts +11 -0
- package/dist/typescript/lib/MetricWithAttributes.d.ts.map +1 -0
- package/dist/typescript/lib/ScreenTrace.d.ts +12 -0
- package/dist/typescript/lib/ScreenTrace.d.ts.map +1 -0
- package/dist/typescript/lib/Trace.d.ts +17 -0
- package/dist/typescript/lib/Trace.d.ts.map +1 -0
- package/dist/typescript/lib/index.d.ts +6 -0
- package/dist/typescript/lib/index.d.ts.map +1 -0
- package/dist/typescript/lib/modular.d.ts +43 -0
- package/dist/typescript/lib/modular.d.ts.map +1 -0
- package/dist/typescript/lib/namespaced.d.ts +11 -0
- package/dist/typescript/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/types/internal.d.ts +45 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/lib/types/namespaced.d.ts +128 -0
- package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/types/perf.d.ts +72 -0
- package/dist/typescript/lib/types/perf.d.ts.map +1 -0
- package/dist/typescript/lib/version.d.ts +2 -0
- package/dist/typescript/lib/version.d.ts.map +1 -0
- package/dist/typescript/package.json +1 -0
- package/lib/{HttpMetric.js → HttpMetric.ts} +21 -8
- package/lib/{MetricWithAttributes.js → MetricWithAttributes.ts} +14 -4
- package/lib/ScreenTrace.ts +59 -0
- package/lib/Trace.ts +112 -0
- package/lib/index.ts +25 -0
- package/lib/modular.ts +116 -0
- package/lib/namespaced.ts +200 -0
- package/lib/types/internal.ts +80 -0
- package/lib/types/namespaced.ts +162 -0
- package/lib/types/perf.ts +99 -0
- package/lib/version.ts +2 -0
- package/package.json +40 -8
- package/plugin/tsconfig.json +2 -1
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/tsconfig.json +20 -0
- package/typedoc.json +2 -2
- package/lib/index.d.ts +0 -583
- package/lib/modular/index.d.ts +0 -89
- package/lib/modular/index.js +0 -103
- package/lib/version.js +0 -2
package/lib/index.d.ts
DELETED
|
@@ -1,583 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Firebase Performance Monitoring package for React Native.
|
|
22
|
-
*
|
|
23
|
-
* #### Example 1
|
|
24
|
-
*
|
|
25
|
-
* Access the firebase export from the `perf` package:
|
|
26
|
-
*
|
|
27
|
-
* ```js
|
|
28
|
-
* import { firebase } from '@react-native-firebase/perf';
|
|
29
|
-
*
|
|
30
|
-
* // firebase.perf().X
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* #### Example 2
|
|
34
|
-
*
|
|
35
|
-
* Using the default export from the `perf` package:
|
|
36
|
-
*
|
|
37
|
-
* ```js
|
|
38
|
-
* import perf from '@react-native-firebase/perf';
|
|
39
|
-
*
|
|
40
|
-
* // perf().X
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* #### Example 3
|
|
44
|
-
*
|
|
45
|
-
* Using the default export from the `app` package:
|
|
46
|
-
*
|
|
47
|
-
* ```js
|
|
48
|
-
* import firebase from '@react-native-firebase/app';
|
|
49
|
-
* import '@react-native-firebase/perf';
|
|
50
|
-
*
|
|
51
|
-
* // firebase.perf().X
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @firebase perf
|
|
55
|
-
*/
|
|
56
|
-
export namespace FirebasePerformanceTypes {
|
|
57
|
-
/**
|
|
58
|
-
* Type alias describing the valid HTTP methods accepted when creating a new {@link perf.HttpMetric} instance.
|
|
59
|
-
*
|
|
60
|
-
* #### Example
|
|
61
|
-
*
|
|
62
|
-
* ```js
|
|
63
|
-
* const metric = perf().newHttpMetric('https://api.com/user', 'PATCH');
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Valid HTTP methods.
|
|
70
|
-
*/
|
|
71
|
-
export type HttpMethod =
|
|
72
|
-
| 'GET'
|
|
73
|
-
| 'HEAD'
|
|
74
|
-
| 'PUT'
|
|
75
|
-
| 'POST'
|
|
76
|
-
| 'PATCH'
|
|
77
|
-
| 'TRACE'
|
|
78
|
-
| 'DELETE'
|
|
79
|
-
| 'CONNECT'
|
|
80
|
-
| 'OPTIONS';
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Trace allows you to time the beginning to end of a certain action in your app with additional metric values and attributes.
|
|
84
|
-
*/
|
|
85
|
-
export class Trace {
|
|
86
|
-
/**
|
|
87
|
-
* Returns the value of an attribute. Returns null if it does not exist.
|
|
88
|
-
*
|
|
89
|
-
* #### Example
|
|
90
|
-
*
|
|
91
|
-
* ```js
|
|
92
|
-
* const attribute = trace.getAttribute('userId');
|
|
93
|
-
* ```
|
|
94
|
-
*
|
|
95
|
-
* @param attribute Name of the attribute to fetch the value of.
|
|
96
|
-
*/
|
|
97
|
-
getAttribute(attribute: string): string | null;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Sets a String value for the specified attribute. Updates the value of the attribute if it already exists.
|
|
101
|
-
* The maximum number of attributes that can be added is 5.
|
|
102
|
-
*
|
|
103
|
-
* #### Example
|
|
104
|
-
*
|
|
105
|
-
* ```js
|
|
106
|
-
* trace.putAttribute('userId', '123456789');
|
|
107
|
-
* ```
|
|
108
|
-
*
|
|
109
|
-
* @param attribute Name of the attribute. Max length is 40 chars.
|
|
110
|
-
* @param value Value of the attribute. Max length is 100 chars.
|
|
111
|
-
*/
|
|
112
|
-
putAttribute(attribute: string, value: string): void;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Gets the value of the metric with the given name in the current trace. If the metric
|
|
116
|
-
* doesn't exist, it will not be created and a 0 is returned.
|
|
117
|
-
*
|
|
118
|
-
* #### Example
|
|
119
|
-
*
|
|
120
|
-
* ```js
|
|
121
|
-
* const metric = trace.getMetric('hits');
|
|
122
|
-
* ```
|
|
123
|
-
*
|
|
124
|
-
* @param metricName Name of the metric to get.
|
|
125
|
-
*/
|
|
126
|
-
getMetric(metricName: string): number;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Returns an object of all the currently added metrics and their number values.
|
|
130
|
-
*
|
|
131
|
-
* #### Example
|
|
132
|
-
*
|
|
133
|
-
* ```js
|
|
134
|
-
* const metrics = trace.getMetrics();
|
|
135
|
-
*
|
|
136
|
-
* metrics.forEach(($) => {
|
|
137
|
-
* console.log($);
|
|
138
|
-
* });
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
getMetrics(): { [key: string]: number };
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Sets the value of the named metric with the provided number.
|
|
145
|
-
*
|
|
146
|
-
* If a metric with the given name exists it will be overwritten.
|
|
147
|
-
* If a metric with the given name doesn't exist, a new one will be created.
|
|
148
|
-
*
|
|
149
|
-
* #### Example
|
|
150
|
-
*
|
|
151
|
-
* ```js
|
|
152
|
-
* trace.putMetric('hits', 1);
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* @param metricName Name of the metric to set. Must not have a leading or trailing whitespace, no leading underscore '_' character and have a max length of 32 characters.
|
|
156
|
-
* @param value The value the metric should be set to.
|
|
157
|
-
*/
|
|
158
|
-
putMetric(metricName: string, value: number): void;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Increments the named metric by the `incrementBy` value.
|
|
162
|
-
*
|
|
163
|
-
* If a metric with the given name doesn't exist, a new one will be created starting with the value of `incrementBy`.
|
|
164
|
-
*
|
|
165
|
-
* ```js
|
|
166
|
-
* trace.incrementMetric('hits', 1);
|
|
167
|
-
* ```
|
|
168
|
-
*
|
|
169
|
-
* @param metricName Name of the metric to increment. Must not have a leading or trailing whitespace, no leading underscore '_' character and have a max length of 32 characters.
|
|
170
|
-
* @param incrementBy The value the metric should be incremented by.
|
|
171
|
-
*/
|
|
172
|
-
incrementMetric(metricName: string, incrementBy: number): void;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Removes a metric by name if it exists.
|
|
176
|
-
*
|
|
177
|
-
* #### Example
|
|
178
|
-
*
|
|
179
|
-
* ```js
|
|
180
|
-
* trace.removeMetric('hits');
|
|
181
|
-
* ```
|
|
182
|
-
*
|
|
183
|
-
* @param metricName Name of the metric to remove.
|
|
184
|
-
*/
|
|
185
|
-
removeMetric(metricName: string): void;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Marks the start time of the trace. Does nothing if already started.
|
|
189
|
-
*
|
|
190
|
-
* #### Example
|
|
191
|
-
*
|
|
192
|
-
* ```js
|
|
193
|
-
* const trace = firebase.perf().newTrace('example');
|
|
194
|
-
* await trace.start();
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
|
-
start(): Promise<null>;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Marks the end time of the trace and queues the metric on the device for transmission. Does nothing if already stopped.
|
|
201
|
-
*
|
|
202
|
-
* * #### Example
|
|
203
|
-
*
|
|
204
|
-
* ```js
|
|
205
|
-
* const trace = firebase.perf().newTrace('example');
|
|
206
|
-
* await trace.start();
|
|
207
|
-
* trace.putMetric('hits', 1);
|
|
208
|
-
* await trace.stop();
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
stop(): Promise<null>;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* ScreenTrace allows you to record a custom screen rendering trace of slow and frozen frames.
|
|
216
|
-
* Throws on constructor if hardware acceleration is off or if Android is 9.0 or 9.1.
|
|
217
|
-
*
|
|
218
|
-
* @platform android Android !== 9.0.0 && Adnroid !== 9.1.0
|
|
219
|
-
*/
|
|
220
|
-
export class ScreenTrace {
|
|
221
|
-
/**
|
|
222
|
-
* Starts a new screen trace. Does nothing if already started.
|
|
223
|
-
*
|
|
224
|
-
* #### Example
|
|
225
|
-
*
|
|
226
|
-
* ```js
|
|
227
|
-
* try {
|
|
228
|
-
* const trace = firebase.perf().newScreenTrace('FooScreen');
|
|
229
|
-
* await trace.start();
|
|
230
|
-
* } catch (e) {
|
|
231
|
-
*
|
|
232
|
-
* }
|
|
233
|
-
* ```
|
|
234
|
-
* @platform android Android >= 9.0.0
|
|
235
|
-
*/
|
|
236
|
-
start(): Promise<null>;
|
|
237
|
-
/**
|
|
238
|
-
* Stops and sends the screen trace.
|
|
239
|
-
*
|
|
240
|
-
* #### Example
|
|
241
|
-
*
|
|
242
|
-
* ```js
|
|
243
|
-
* try {
|
|
244
|
-
* const trace = firebase.perf().newScreenTrace('FooScreen');
|
|
245
|
-
* await trace.start();
|
|
246
|
-
* await trace.stop();
|
|
247
|
-
* } catch (e) {
|
|
248
|
-
*
|
|
249
|
-
* }
|
|
250
|
-
* ```
|
|
251
|
-
* @platform android Android >= 9.0.0
|
|
252
|
-
*/
|
|
253
|
-
stop(): Promise<null>;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Metric used to collect data for network requests/responses. A new instance must be used for every request/response.
|
|
258
|
-
*/
|
|
259
|
-
export class HttpMetric {
|
|
260
|
-
/**
|
|
261
|
-
* Returns the value of an attribute. Returns null if it does not exist.
|
|
262
|
-
*
|
|
263
|
-
* #### Example
|
|
264
|
-
*
|
|
265
|
-
* ```js
|
|
266
|
-
* const attribute = metric.getAttribute('user_role');
|
|
267
|
-
* ```
|
|
268
|
-
*
|
|
269
|
-
* @param attribute Name of the attribute to fetch the value of
|
|
270
|
-
*/
|
|
271
|
-
getAttribute(attribute: string): string | null;
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Returns an object of all the currently added attributes.
|
|
275
|
-
*
|
|
276
|
-
* #### Example
|
|
277
|
-
*
|
|
278
|
-
* ```js
|
|
279
|
-
* const attributes = metric.getAttributes();
|
|
280
|
-
*
|
|
281
|
-
* attributes.forEach(($) => {
|
|
282
|
-
* console.log($);
|
|
283
|
-
* });
|
|
284
|
-
* ```
|
|
285
|
-
*/
|
|
286
|
-
getAttributes(): { [key: string]: string };
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Sets a String value for the specified attribute. Updates the value of the attribute if it already exists.
|
|
290
|
-
* The maximum number of attributes that can be added is 5.
|
|
291
|
-
*
|
|
292
|
-
* #### Example
|
|
293
|
-
*
|
|
294
|
-
* ```js
|
|
295
|
-
* metric.putAttribute('user_role', 'admin');
|
|
296
|
-
* ```
|
|
297
|
-
*
|
|
298
|
-
* @param attribute Name of the attribute. Max length is 40 chars.
|
|
299
|
-
* @param value Value of the attribute. Max length is 100 chars.
|
|
300
|
-
*/
|
|
301
|
-
putAttribute(attribute: string, value: string): void;
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Removes an already added attribute. Does nothing if attribute does not exist.
|
|
305
|
-
*
|
|
306
|
-
* #### Example
|
|
307
|
-
*
|
|
308
|
-
* ```js
|
|
309
|
-
* metric.removeAttribute('user_role');
|
|
310
|
-
* ```
|
|
311
|
-
*
|
|
312
|
-
* @param attribute Name of the attribute to be removed.
|
|
313
|
-
*/
|
|
314
|
-
removeAttribute(attribute: string): void;
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Sets the httpResponse code of the request.
|
|
318
|
-
*
|
|
319
|
-
* #### Example
|
|
320
|
-
*
|
|
321
|
-
* ```js
|
|
322
|
-
* const response = await fetch(url);
|
|
323
|
-
* metric.setHttpResponseCode(response.status);
|
|
324
|
-
* ```
|
|
325
|
-
* > This is required for every request, if you do not provide this your metric will not be captured.
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* @param code Value must be greater than 0. Set to null to remove. Invalid usage will be logged natively.
|
|
329
|
-
*/
|
|
330
|
-
setHttpResponseCode(code: number | null): void;
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Sets the size of the request payload.
|
|
334
|
-
*
|
|
335
|
-
* #### Example
|
|
336
|
-
*
|
|
337
|
-
* ```js
|
|
338
|
-
* const response = await fetch(url);
|
|
339
|
-
* metric.setRequestPayloadSize(response.headers.get('Content-Type'));
|
|
340
|
-
* ```
|
|
341
|
-
*
|
|
342
|
-
* @param bytes Value must be greater than 0. Set to null to remove. Invalid usage will be logged natively.
|
|
343
|
-
*/
|
|
344
|
-
setRequestPayloadSize(bytes: number | null): void;
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Sets the size of the response payload.
|
|
348
|
-
*
|
|
349
|
-
* #### Example
|
|
350
|
-
*
|
|
351
|
-
* ```js
|
|
352
|
-
* const response = await fetch(url);
|
|
353
|
-
* metric.setResponsePayloadSize(response.headers.get('Content-Length'));
|
|
354
|
-
* ```
|
|
355
|
-
*
|
|
356
|
-
* @param bytes Value must be greater than 0. Set to null to remove. Invalid usage will be logged natively.
|
|
357
|
-
*/
|
|
358
|
-
setResponsePayloadSize(bytes: number | null): void;
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Content type of the response e.g. `text/html` or `application/json`.
|
|
362
|
-
*
|
|
363
|
-
* #### Example
|
|
364
|
-
*
|
|
365
|
-
* ```js
|
|
366
|
-
* const response = await fetch(url);
|
|
367
|
-
* metric.setResponsePayloadSize(response.headers.get('Content-Type'));
|
|
368
|
-
* ```
|
|
369
|
-
*
|
|
370
|
-
* @param contentType Valid string of MIME type. Set to null to remove. Invalid usage will be logged natively.
|
|
371
|
-
*/
|
|
372
|
-
setResponseContentType(contentType: string | null): void;
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Marks the start time of the request. Does nothing if already started.
|
|
376
|
-
*
|
|
377
|
-
* #### Example
|
|
378
|
-
*
|
|
379
|
-
* ```js
|
|
380
|
-
* const metric = firebase.perf().newHttpMetric('https://api.com/login', 'POST');
|
|
381
|
-
* await metric.start();
|
|
382
|
-
* ```
|
|
383
|
-
*/
|
|
384
|
-
start(): Promise<null>;
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Marks the end time of the response and queues the network request metric on the device for transmission. Does nothing if already stopped.
|
|
388
|
-
*
|
|
389
|
-
* #### Example
|
|
390
|
-
*
|
|
391
|
-
* ```js
|
|
392
|
-
* const metric = firebase.perf().newHttpMetric('https://api.com/login', 'POST');
|
|
393
|
-
* await metric.start();
|
|
394
|
-
* metric.putAttribute('user_role', 'admin');
|
|
395
|
-
* await metric.stop();
|
|
396
|
-
* ```
|
|
397
|
-
*/
|
|
398
|
-
stop(): Promise<null>;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
export interface Statics {
|
|
402
|
-
SDK_VERSION: string;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* The Firebase Performance Monitoring service interface.
|
|
407
|
-
*
|
|
408
|
-
* > This module is available for the default app only.
|
|
409
|
-
*
|
|
410
|
-
* #### Example
|
|
411
|
-
*
|
|
412
|
-
* Get the Performance Monitoring service for the default app:
|
|
413
|
-
*
|
|
414
|
-
* ```js
|
|
415
|
-
* const defaultAppPerf = firebase.perf();
|
|
416
|
-
* ```
|
|
417
|
-
*/
|
|
418
|
-
export class Module extends FirebaseModule {
|
|
419
|
-
/**
|
|
420
|
-
* The current `FirebaseApp` instance for this Firebase service.
|
|
421
|
-
*/
|
|
422
|
-
app: ReactNativeFirebase.FirebaseApp;
|
|
423
|
-
/**
|
|
424
|
-
* Determines whether performance monitoring is enabled or disabled.
|
|
425
|
-
*
|
|
426
|
-
* #### Example
|
|
427
|
-
*
|
|
428
|
-
* ```js
|
|
429
|
-
* const isEnabled = firebase.perf().isPerformanceCollectionEnabled;
|
|
430
|
-
* console.log('Performance collection enabled: ', isEnabled);
|
|
431
|
-
* ```
|
|
432
|
-
*/
|
|
433
|
-
isPerformanceCollectionEnabled: boolean;
|
|
434
|
-
/**
|
|
435
|
-
* Determines whether to collect 'out of the box' (i.e already setup for Firebase Performance) events.
|
|
436
|
-
* This can be set for iOS. Android will always return "true" as it has to be set at gradle level.
|
|
437
|
-
*/
|
|
438
|
-
instrumentationEnabled: boolean;
|
|
439
|
-
/**
|
|
440
|
-
* Determines whether performance monitoring is enabled or disabled.
|
|
441
|
-
*
|
|
442
|
-
* #### Example
|
|
443
|
-
*
|
|
444
|
-
* ```js
|
|
445
|
-
* const isEnabled = firebase.perf().dataCollectionEnabled;
|
|
446
|
-
* console.log('Performance collection enabled: ', isEnabled);
|
|
447
|
-
* ```
|
|
448
|
-
*/
|
|
449
|
-
dataCollectionEnabled: boolean;
|
|
450
|
-
/**
|
|
451
|
-
* Enables or disables performance monitoring.
|
|
452
|
-
*
|
|
453
|
-
* #### Example
|
|
454
|
-
*
|
|
455
|
-
* ```js
|
|
456
|
-
* // Disable performance monitoring collection
|
|
457
|
-
* await firebase.perf().setPerformanceCollectionEnabled(false);
|
|
458
|
-
* ```
|
|
459
|
-
* @deprecated prefer setting `dataCollectionEnabled = boolean`.
|
|
460
|
-
* @param enabled Should performance monitoring be enabled. For iOS only, this also toggles whether instrumentation
|
|
461
|
-
* is enabled. See: https://firebase.google.com/docs/reference/ios/firebaseperformance/api/reference/Classes/FIRPerformance#instrumentationenabled
|
|
462
|
-
*/
|
|
463
|
-
setPerformanceCollectionEnabled(enabled: boolean): Promise<null>;
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Creates a Trace instance with the given identifier.
|
|
467
|
-
*
|
|
468
|
-
* #### Example
|
|
469
|
-
*
|
|
470
|
-
* ```js
|
|
471
|
-
* const trace = firebase.perf().newTrace('user_profile');
|
|
472
|
-
* await trace.start();
|
|
473
|
-
* ```
|
|
474
|
-
*
|
|
475
|
-
* @param identifier Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
|
|
476
|
-
*/
|
|
477
|
-
newTrace(identifier: string): Trace;
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Creates a Trace instance with the given identifier and immediately starts it.
|
|
481
|
-
*
|
|
482
|
-
* #### Example
|
|
483
|
-
*
|
|
484
|
-
* ```js
|
|
485
|
-
* const trace = await firebase.perf().startTrace('user_profile');
|
|
486
|
-
* ```
|
|
487
|
-
*
|
|
488
|
-
* @param identifier Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
|
|
489
|
-
*/
|
|
490
|
-
startTrace(identifier: string): Promise<Trace>;
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* Creates a ScreenTrace instance with the given identifier.
|
|
494
|
-
* Throws if hardware acceleration is disabled or if Android is 9.0 or 9.1.
|
|
495
|
-
*
|
|
496
|
-
* #### Example
|
|
497
|
-
*
|
|
498
|
-
* ```js
|
|
499
|
-
* try {
|
|
500
|
-
* const trace = firebase.perf().newScreenTrace('FooScreen');
|
|
501
|
-
* await trace.start();
|
|
502
|
-
* } catch (e) {
|
|
503
|
-
*
|
|
504
|
-
* }
|
|
505
|
-
* ```
|
|
506
|
-
*
|
|
507
|
-
* @param identifier Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
|
|
508
|
-
*/
|
|
509
|
-
newScreenTrace(identifier: string): ScreenTrace;
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Creates a ScreenTrace instance with the given identifier and immediately starts it.
|
|
513
|
-
* Throws if hardware acceleration is disabled or if Android is 9.0 or 9.1.
|
|
514
|
-
*
|
|
515
|
-
* #### Example
|
|
516
|
-
*
|
|
517
|
-
* ```js
|
|
518
|
-
* try {
|
|
519
|
-
* const trace = await firebase.perf().startScreenTrace('FooScreen');
|
|
520
|
-
* await trace.stop();
|
|
521
|
-
* } catch (e) {
|
|
522
|
-
*
|
|
523
|
-
* }
|
|
524
|
-
* ```
|
|
525
|
-
* @platform android Android !== 9.0.0 && Android !== 9.1.0
|
|
526
|
-
*
|
|
527
|
-
* @param identifier Name of the screen
|
|
528
|
-
*/
|
|
529
|
-
startScreenTrace(identifier: string): Promise<ScreenTrace>;
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* Creates a HttpMetric instance for collecting network performance data for a single request/response
|
|
533
|
-
*
|
|
534
|
-
* #### Example
|
|
535
|
-
*
|
|
536
|
-
* ```js
|
|
537
|
-
* const metric = firebase.perf().newHttpMetric('https://api.com/user/1', 'GET');
|
|
538
|
-
* await metric.start();
|
|
539
|
-
* ```
|
|
540
|
-
*
|
|
541
|
-
* @param url A valid url String, cannot be empty
|
|
542
|
-
* @param httpMethod One of the values GET, PUT, POST, DELETE, HEAD, PATCH, OPTIONS, TRACE, or CONNECT
|
|
543
|
-
*/
|
|
544
|
-
newHttpMetric(url: string, httpMethod: HttpMethod): HttpMetric;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
type PerfNamespace = ReactNativeFirebase.FirebaseModuleWithStatics<
|
|
549
|
-
FirebasePerformanceTypes.Module,
|
|
550
|
-
FirebasePerformanceTypes.Statics
|
|
551
|
-
> & {
|
|
552
|
-
firebase: ReactNativeFirebase.Module;
|
|
553
|
-
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
declare const defaultExport: PerfNamespace;
|
|
557
|
-
|
|
558
|
-
export const firebase: ReactNativeFirebase.Module & {
|
|
559
|
-
perf: typeof defaultExport;
|
|
560
|
-
app(name?: string): ReactNativeFirebase.FirebaseApp & { perf(): FirebasePerformanceTypes.Module };
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
export default defaultExport;
|
|
564
|
-
|
|
565
|
-
export * from './modular';
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
|
569
|
-
*/
|
|
570
|
-
declare module '@react-native-firebase/app' {
|
|
571
|
-
namespace ReactNativeFirebase {
|
|
572
|
-
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
|
573
|
-
interface Module {
|
|
574
|
-
perf: FirebaseModuleWithStatics<
|
|
575
|
-
FirebasePerformanceTypes.Module,
|
|
576
|
-
FirebasePerformanceTypes.Statics
|
|
577
|
-
>;
|
|
578
|
-
}
|
|
579
|
-
interface FirebaseApp {
|
|
580
|
-
perf(): FirebasePerformanceTypes.Module;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
}
|
package/lib/modular/index.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this library except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
import { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
18
|
-
import { FirebasePerformanceTypes } from '..';
|
|
19
|
-
|
|
20
|
-
import Performance = FirebasePerformanceTypes.Module;
|
|
21
|
-
|
|
22
|
-
import Trace = FirebasePerformanceTypes.Module.Trace;
|
|
23
|
-
import HttpMethod = FirebasePerformanceTypes.HttpMethod;
|
|
24
|
-
import HttpMetric = FirebasePerformanceTypes.HttpMetric;
|
|
25
|
-
import ScreenTrace = FirebasePerformanceTypes.ScreenTrace;
|
|
26
|
-
import FirebaseApp = ReactNativeFirebase.FirebaseApp;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Returns a Performance instance for the given app.
|
|
30
|
-
* @param app - FirebaseApp. Optional.
|
|
31
|
-
* @returns {Performance}
|
|
32
|
-
*/
|
|
33
|
-
export function getPerformance(app?: FirebaseApp): Performance;
|
|
34
|
-
|
|
35
|
-
type PerformanceSettings = {
|
|
36
|
-
dataCollectionEnabled: boolean;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Returns a Performance instance for the given app.
|
|
41
|
-
* @param app - FirebaseApp. Required.
|
|
42
|
-
* @param settings - Optional PerformanceSettings. Set "dataCollectionEnabled" which will enable/disable Performance collection.
|
|
43
|
-
* @returns {Promise<Performance>}
|
|
44
|
-
*/
|
|
45
|
-
export function initializePerformance(
|
|
46
|
-
app: FirebaseApp,
|
|
47
|
-
settings?: PerformanceSettings,
|
|
48
|
-
): Promise<Performance>;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Returns a Trace instance.
|
|
52
|
-
* @param perf - Performance instance.
|
|
53
|
-
* @param identifier - A String to identify the Trace instance.
|
|
54
|
-
* @returns {Trace}
|
|
55
|
-
*/
|
|
56
|
-
export function trace(perf: Performance, identifier: string): Trace;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Returns a HttpMetric instance.
|
|
60
|
-
* @param perf - Performance instance.
|
|
61
|
-
* @param identifier - A String to identify the HttpMetric instance.
|
|
62
|
-
* @param httpMethod - The HTTP method for the HttpMetric instance.
|
|
63
|
-
* @returns {HttpMetric}
|
|
64
|
-
*/
|
|
65
|
-
export function httpMetric(
|
|
66
|
-
perf: Performance,
|
|
67
|
-
identifier: string,
|
|
68
|
-
httpMethod: HttpMethod,
|
|
69
|
-
): HttpMetric;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Creates a ScreenTrace instance with the given identifier.
|
|
73
|
-
* Throws if hardware acceleration is disabled or if Android is 9.0 or 9.1.
|
|
74
|
-
* @platform android Android !== 9.0.0 && Android !== 9.1.0
|
|
75
|
-
* @param perf - Performance instance.
|
|
76
|
-
* @param identifier - Name of the trace, no leading or trailing whitespace allowed, no leading underscore '_' character allowed, max length is 100.
|
|
77
|
-
* @returns {ScreenTrace}
|
|
78
|
-
*/
|
|
79
|
-
export function newScreenTrace(perf: Performance, identifier: string): ScreenTrace;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Creates a ScreenTrace instance with the given identifier and immediately starts it.
|
|
83
|
-
* Throws if hardware acceleration is disabled or if Android is 9.0 or 9.1.
|
|
84
|
-
* @platform android Android !== 9.0.0 && Android !== 9.1.0
|
|
85
|
-
* @param perf - Performance instance.
|
|
86
|
-
* @param identifier - Name of the screen.
|
|
87
|
-
* @returns {Promise<ScreenTrace>}
|
|
88
|
-
*/
|
|
89
|
-
export function startScreenTrace(perf: Performance, identifier: string): Promise<ScreenTrace>;
|