@react-native-firebase/perf 24.1.1 → 25.0.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/CHANGELOG.md +25 -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
|
@@ -0,0 +1,162 @@
|
|
|
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 type { 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
|
+
/**
|
|
57
|
+
* @deprecated Use the modular type exports from `@react-native-firebase/perf` instead.
|
|
58
|
+
* `FirebasePerformanceTypes` is kept for backwards compatibility with the namespaced API.
|
|
59
|
+
*/
|
|
60
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
61
|
+
export namespace FirebasePerformanceTypes {
|
|
62
|
+
type FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use the `HttpMethod` type from the modular package exports instead.
|
|
66
|
+
*/
|
|
67
|
+
export type HttpMethod =
|
|
68
|
+
| 'GET'
|
|
69
|
+
| 'HEAD'
|
|
70
|
+
| 'PUT'
|
|
71
|
+
| 'POST'
|
|
72
|
+
| 'PATCH'
|
|
73
|
+
| 'TRACE'
|
|
74
|
+
| 'DELETE'
|
|
75
|
+
| 'CONNECT'
|
|
76
|
+
| 'OPTIONS';
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated Use the `PerformanceTrace` type from the modular package exports instead.
|
|
80
|
+
*/
|
|
81
|
+
export interface Trace {
|
|
82
|
+
getAttribute(attribute: string): string | undefined;
|
|
83
|
+
putAttribute(attribute: string, value: string): void;
|
|
84
|
+
getMetric(metricName: string): number;
|
|
85
|
+
getMetrics(): { [key: string]: number };
|
|
86
|
+
putMetric(metricName: string, value: number): void;
|
|
87
|
+
incrementMetric(metricName: string, incrementBy?: number): void;
|
|
88
|
+
removeMetric(metricName: string): void;
|
|
89
|
+
start(): Promise<null>;
|
|
90
|
+
stop(): Promise<null>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Use the `ScreenTrace` type from the modular package exports instead.
|
|
95
|
+
*/
|
|
96
|
+
export interface ScreenTrace {
|
|
97
|
+
start(): Promise<null>;
|
|
98
|
+
stop(): Promise<null>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated Use the `HttpMetric` type from the modular package exports instead.
|
|
103
|
+
*/
|
|
104
|
+
export interface HttpMetric {
|
|
105
|
+
getAttribute(attribute: string): string | undefined;
|
|
106
|
+
getAttributes(): { [key: string]: string };
|
|
107
|
+
putAttribute(attribute: string, value: string): void;
|
|
108
|
+
removeAttribute(attribute: string): void;
|
|
109
|
+
setHttpResponseCode(code: number | null): void;
|
|
110
|
+
setRequestPayloadSize(bytes: number | null): void;
|
|
111
|
+
setResponsePayloadSize(bytes: number | null): void;
|
|
112
|
+
setResponseContentType(contentType: string | null): void;
|
|
113
|
+
start(): Promise<null>;
|
|
114
|
+
stop(): Promise<null>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated Use static exports from the package root instead.
|
|
119
|
+
*/
|
|
120
|
+
export interface Statics {
|
|
121
|
+
SDK_VERSION: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Use the `FirebasePerformance` type from the modular package exports instead.
|
|
126
|
+
*/
|
|
127
|
+
export interface Module extends FirebaseModule {
|
|
128
|
+
app: ReactNativeFirebase.FirebaseApp;
|
|
129
|
+
isPerformanceCollectionEnabled: boolean;
|
|
130
|
+
instrumentationEnabled: boolean;
|
|
131
|
+
dataCollectionEnabled: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated prefer setting `dataCollectionEnabled = boolean`.
|
|
134
|
+
*/
|
|
135
|
+
setPerformanceCollectionEnabled(enabled: boolean): Promise<null>;
|
|
136
|
+
newTrace(identifier: string): Trace;
|
|
137
|
+
startTrace(identifier: string): Promise<Trace>;
|
|
138
|
+
newScreenTrace(identifier: string): ScreenTrace;
|
|
139
|
+
startScreenTrace(identifier: string): Promise<ScreenTrace>;
|
|
140
|
+
newHttpMetric(url: string, httpMethod: HttpMethod): HttpMetric;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/* eslint-enable @typescript-eslint/no-namespace */
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
|
147
|
+
*/
|
|
148
|
+
declare module '@react-native-firebase/app' {
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
150
|
+
namespace ReactNativeFirebase {
|
|
151
|
+
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
|
152
|
+
interface Module {
|
|
153
|
+
perf: FirebaseModuleWithStatics<
|
|
154
|
+
FirebasePerformanceTypes.Module,
|
|
155
|
+
FirebasePerformanceTypes.Statics
|
|
156
|
+
>;
|
|
157
|
+
}
|
|
158
|
+
interface FirebaseApp {
|
|
159
|
+
perf(): FirebasePerformanceTypes.Module;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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 type { FirebaseApp } from '@react-native-firebase/app';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Configuration options for Performance Monitoring (aligned with {@link https://firebase.google.com/docs/reference/js/performance.performancesettings | PerformanceSettings} in the Firebase JS SDK).
|
|
22
|
+
*/
|
|
23
|
+
export interface PerformanceSettings {
|
|
24
|
+
/** Whether to collect custom events. */
|
|
25
|
+
dataCollectionEnabled?: boolean;
|
|
26
|
+
/** Whether to collect out-of-the-box events. */
|
|
27
|
+
instrumentationEnabled?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Valid HTTP methods for HTTP metrics.
|
|
32
|
+
*/
|
|
33
|
+
export type HttpMethod =
|
|
34
|
+
| 'GET'
|
|
35
|
+
| 'HEAD'
|
|
36
|
+
| 'PUT'
|
|
37
|
+
| 'POST'
|
|
38
|
+
| 'PATCH'
|
|
39
|
+
| 'TRACE'
|
|
40
|
+
| 'DELETE'
|
|
41
|
+
| 'CONNECT'
|
|
42
|
+
| 'OPTIONS';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A performance trace (aligned with {@link https://firebase.google.com/docs/reference/js/performance.performancetrace | PerformanceTrace} in the Firebase JS SDK).
|
|
46
|
+
*
|
|
47
|
+
* @remarks React Native uses async `start`/`stop` (native bridge). The web SDK uses synchronous `start`/`stop`. React Native also exposes `getMetrics` and `removeMetric`, which are not on the web `PerformanceTrace` type.
|
|
48
|
+
*/
|
|
49
|
+
export interface PerformanceTrace {
|
|
50
|
+
getAttribute(attr: string): string | undefined;
|
|
51
|
+
putAttribute(attr: string, value: string): void;
|
|
52
|
+
getMetric(metricName: string): number;
|
|
53
|
+
getMetrics(): { [key: string]: number };
|
|
54
|
+
putMetric(metricName: string, num: number): void;
|
|
55
|
+
incrementMetric(metricName: string, num?: number): void;
|
|
56
|
+
removeMetric(metricName: string): void;
|
|
57
|
+
start(): Promise<null>;
|
|
58
|
+
stop(): Promise<null>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Screen trace for slow/frozen frames (React Native).
|
|
63
|
+
*/
|
|
64
|
+
export interface ScreenTrace {
|
|
65
|
+
start(): Promise<null>;
|
|
66
|
+
stop(): Promise<null>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Network request metric (React Native; not part of the web Performance modular surface).
|
|
71
|
+
*/
|
|
72
|
+
export interface HttpMetric {
|
|
73
|
+
getAttribute(attr: string): string | undefined;
|
|
74
|
+
getAttributes(): { [key: string]: string };
|
|
75
|
+
putAttribute(attr: string, value: string): void;
|
|
76
|
+
removeAttribute(attr: string): void;
|
|
77
|
+
setHttpResponseCode(code: number | null): void;
|
|
78
|
+
setRequestPayloadSize(bytes: number | null): void;
|
|
79
|
+
setResponsePayloadSize(bytes: number | null): void;
|
|
80
|
+
setResponseContentType(contentType: string | null): void;
|
|
81
|
+
start(): Promise<null>;
|
|
82
|
+
stop(): Promise<null>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Firebase Performance Monitoring service (aligned with {@link https://firebase.google.com/docs/reference/js/performance.firebaseperformance | FirebasePerformance} in the Firebase JS SDK).
|
|
87
|
+
*
|
|
88
|
+
* @remarks React Native adds collection/read APIs backed by native (`isPerformanceCollectionEnabled`, custom traces, HTTP metrics, screen traces).
|
|
89
|
+
*/
|
|
90
|
+
export interface FirebasePerformance {
|
|
91
|
+
/** The FirebaseApp this Performance instance is associated with. */
|
|
92
|
+
app: FirebaseApp;
|
|
93
|
+
/** Controls logging of automatic traces and HTTP/S network monitoring. */
|
|
94
|
+
instrumentationEnabled: boolean;
|
|
95
|
+
/** Controls logging of custom traces. */
|
|
96
|
+
dataCollectionEnabled: boolean;
|
|
97
|
+
/** Whether performance data collection is enabled for this app instance (native). */
|
|
98
|
+
isPerformanceCollectionEnabled: boolean;
|
|
99
|
+
}
|
package/lib/version.ts
ADDED
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/perf",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Firebase - React Native Firebase provides native integration with Performance Monitoring to gain insight into key performance characteristics within your React Native application.",
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
6
|
+
"main": "./dist/module/index.js",
|
|
7
|
+
"types": "./dist/typescript/lib/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "genversion --semi lib/version.
|
|
9
|
+
"build": "genversion --esm --semi lib/version.ts",
|
|
10
10
|
"build:clean": "rimraf android/build && rimraf ios/build",
|
|
11
11
|
"build:plugin": "rimraf plugin/build && tsc --build plugin",
|
|
12
|
+
"compile": "bob build",
|
|
12
13
|
"lint:plugin": "eslint plugin/src/*",
|
|
13
|
-
"prepare": "yarn run build && yarn run build:plugin"
|
|
14
|
+
"prepare": "yarn run build && yarn compile && yarn run build:plugin"
|
|
14
15
|
},
|
|
15
16
|
"repository": {
|
|
16
17
|
"type": "git",
|
|
@@ -29,11 +30,12 @@
|
|
|
29
30
|
"performance monitoring"
|
|
30
31
|
],
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"@react-native-firebase/app": "
|
|
33
|
+
"@react-native-firebase/app": "25.0.0",
|
|
33
34
|
"expo": ">=47.0.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"expo": "^55.0.
|
|
37
|
+
"expo": "^55.0.18",
|
|
38
|
+
"react-native-builder-bob": "^0.40.13"
|
|
37
39
|
},
|
|
38
40
|
"peerDependenciesMeta": {
|
|
39
41
|
"expo": {
|
|
@@ -44,5 +46,35 @@
|
|
|
44
46
|
"access": "public",
|
|
45
47
|
"provenance": true
|
|
46
48
|
},
|
|
47
|
-
"
|
|
49
|
+
"exports": {
|
|
50
|
+
".": {
|
|
51
|
+
"source": "./lib/index.ts",
|
|
52
|
+
"types": "./dist/typescript/lib/index.d.ts",
|
|
53
|
+
"default": "./dist/module/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./package.json": "./package.json"
|
|
56
|
+
},
|
|
57
|
+
"react-native-builder-bob": {
|
|
58
|
+
"source": "lib",
|
|
59
|
+
"output": "dist",
|
|
60
|
+
"targets": [
|
|
61
|
+
[
|
|
62
|
+
"module",
|
|
63
|
+
{
|
|
64
|
+
"esm": true
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
"typescript",
|
|
69
|
+
{
|
|
70
|
+
"tsc": "../../node_modules/.bin/tsc"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"eslintIgnore": [
|
|
76
|
+
"node_modules/",
|
|
77
|
+
"dist/"
|
|
78
|
+
],
|
|
79
|
+
"gitHead": "eac5bf5f3c80b158bf85b33789e4b64bfd16bbe1"
|
|
48
80
|
}
|
package/plugin/tsconfig.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/index.ts","./src/android/applyPlugin.ts","./src/android/buildscriptDependency.ts","./src/android/constants.ts","./src/android/index.ts"],"version":"
|
|
1
|
+
{"root":["./src/index.ts","./src/android/applyPlugin.ts","./src/android/buildscriptDependency.ts","./src/android/constants.ts","./src/android/index.ts"],"version":"6.0.3"}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.packages.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": ".",
|
|
5
|
+
"paths": {
|
|
6
|
+
"@react-native-firebase/app/dist/module/common/*": ["../app/dist/typescript/lib/common/*"],
|
|
7
|
+
"@react-native-firebase/app/dist/module/common": ["../app/dist/typescript/lib/common"],
|
|
8
|
+
"@react-native-firebase/app/dist/module/internal/*": [
|
|
9
|
+
"../app/dist/typescript/lib/internal/*"
|
|
10
|
+
],
|
|
11
|
+
"@react-native-firebase/app/dist/module/internal": ["../app/dist/typescript/lib/internal"],
|
|
12
|
+
"@react-native-firebase/app": ["../app/dist/typescript/lib"],
|
|
13
|
+
"@react-native-firebase/app/dist/module/types/internal": [
|
|
14
|
+
"../app/dist/typescript/lib/types/internal"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"include": ["lib/**/*"],
|
|
19
|
+
"exclude": ["node_modules", "dist", "__tests__", "**/*.test.ts"]
|
|
20
|
+
}
|
package/typedoc.json
CHANGED