Skip to content

Commit 9bf5d36

Browse files
Merge branch 'main' into auth-typescript
2 parents 1ba05c9 + d488470 commit 9bf5d36

41 files changed

Lines changed: 1539 additions & 1328 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Known differences between the firebase-js-sdk @firebase/installations public
3+
* API and the @react-native-firebase/installations modular API.
4+
*
5+
* Each entry must have a `name` (the export name) and a `reason` explaining
6+
* why the difference exists. Any difference NOT listed here will cause CI to
7+
* fail so that new drift is caught and deliberately acknowledged.
8+
*/
9+
10+
import type { PackageConfig } from '../src/types';
11+
12+
const config: PackageConfig = {
13+
nameMapping: {},
14+
missingInRN: [],
15+
extraInRN: [],
16+
differentShape: [],
17+
};
18+
19+
export default config;
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* Known differences between the firebase-js-sdk @firebase/performance modular
3+
* API and the @react-native-firebase/perf modular API.
4+
*/
5+
6+
import type { PackageConfig } from '../../src/types';
7+
8+
const config: PackageConfig = {
9+
missingInRN: [],
10+
extraInRN: [
11+
{
12+
name: 'HttpMethod',
13+
reason:
14+
'String union of HTTP verbs used by React Native HTTP metrics. The web Performance ' +
15+
'modular API does not expose HTTP metrics in the public tree-shakeable surface.',
16+
},
17+
{
18+
name: 'ScreenTrace',
19+
reason:
20+
'React Native screen trace type for slow/frozen frame reporting. No equivalent exists ' +
21+
'in the firebase-js-sdk modular Performance API.',
22+
},
23+
{
24+
name: 'HttpMetric',
25+
reason:
26+
'React Native HTTP request metric type backed by native instrumentation. The web SDK ' +
27+
'does not expose this type on the modular public surface.',
28+
},
29+
{
30+
name: 'httpMetric',
31+
reason:
32+
'React Native modular helper that constructs an `HttpMetric`. No equivalent exists in ' +
33+
'the firebase-js-sdk modular Performance API.',
34+
},
35+
{
36+
name: 'newScreenTrace',
37+
reason:
38+
'React Native modular helper that constructs a `ScreenTrace`. No equivalent exists in ' +
39+
'the firebase-js-sdk modular Performance API.',
40+
},
41+
{
42+
name: 'startScreenTrace',
43+
reason:
44+
'React Native modular helper that creates and starts a `ScreenTrace`. No equivalent ' +
45+
'exists in the firebase-js-sdk modular Performance API.',
46+
},
47+
],
48+
differentShape: [
49+
{
50+
name: 'FirebasePerformance',
51+
reason:
52+
'React Native extends the service interface with native collection state (`isPerformanceCollectionEnabled`), ' +
53+
'a deprecated `setPerformanceCollectionEnabled` bridge helper, and factory methods for traces, ' +
54+
'screen traces, and HTTP metrics. The firebase-js-sdk web type only exposes `app`, ' +
55+
'`instrumentationEnabled`, and `dataCollectionEnabled`.',
56+
},
57+
{
58+
name: 'PerformanceTrace',
59+
reason:
60+
'React Native uses async `start`/`stop` (`Promise<null>`) because work crosses the native bridge. ' +
61+
'The web SDK uses synchronous `start`/`stop` and exposes `record()`. RN Firebase exposes ' +
62+
'`getMetrics` and `removeMetric` for native-backed custom metrics instead of the web shape.',
63+
},
64+
],
65+
};
66+
67+
export default config;
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
/**
2+
* Public types snapshot from the Firebase JS SDK (@firebase/performance).
3+
*
4+
* Source: firebase-js-sdk `node_modules/@firebase/performance/dist/src/index.d.ts`
5+
* and `node_modules/@firebase/performance/dist/src/public_types.d.ts`
6+
* Modality: modular (tree-shakeable) API only
7+
*
8+
* This file is the reference snapshot used to detect API drift between the
9+
* firebase-js-sdk and the @react-native-firebase/perf modular API.
10+
*
11+
* When a new version of the firebase-js-sdk ships with type changes, update
12+
* this file with the new public modular types from @firebase/performance.
13+
*/
14+
15+
import { FirebaseApp } from '@firebase/app';
16+
17+
/**
18+
* Defines configuration options for the Performance Monitoring SDK.
19+
*
20+
* @public
21+
*/
22+
export interface PerformanceSettings {
23+
/** Whether to collect custom events. */
24+
dataCollectionEnabled?: boolean;
25+
/** Whether to collect out of the box events. */
26+
instrumentationEnabled?: boolean;
27+
}
28+
29+
/**
30+
* The Firebase Performance Monitoring service interface.
31+
*
32+
* @public
33+
*/
34+
export interface FirebasePerformance {
35+
/**
36+
* The {@link @firebase/app#FirebaseApp} this `FirebasePerformance` instance is associated with.
37+
*/
38+
app: FirebaseApp;
39+
/**
40+
* Controls the logging of automatic traces and HTTP/S network monitoring.
41+
*/
42+
instrumentationEnabled: boolean;
43+
/**
44+
* Controls the logging of custom traces.
45+
*/
46+
dataCollectionEnabled: boolean;
47+
}
48+
49+
/**
50+
* The interface representing a `Trace`.
51+
*
52+
* @public
53+
*/
54+
export interface PerformanceTrace {
55+
/**
56+
* Starts the timing for the trace instance.
57+
*/
58+
start(): void;
59+
/**
60+
* Stops the timing of the trace instance and logs the data of the instance.
61+
*/
62+
stop(): void;
63+
/**
64+
* Records a trace from given parameters. This provides a direct way to use trace without a need to
65+
* start/stop. This is useful for use cases in which the trace cannot directly be used
66+
* (e.g. if the duration was captured before the Performance SDK was loaded).
67+
*
68+
* @param startTime - trace start time since epoch in millisec.
69+
* @param duration - The duration of the trace in millisec.
70+
* @param options - An object which can optionally hold maps of custom metrics and
71+
* custom attributes.
72+
*/
73+
record(
74+
startTime: number,
75+
duration: number,
76+
options?: {
77+
metrics?: {
78+
[key: string]: number;
79+
};
80+
attributes?: {
81+
[key: string]: string;
82+
};
83+
},
84+
): void;
85+
/**
86+
* Adds to the value of a custom metric. If a custom metric with the provided name does not
87+
* exist, it creates one with that name and the value equal to the given number. The value will be floored down to an
88+
* integer.
89+
*
90+
* @param metricName - The name of the custom metric.
91+
* @param num - The number to be added to the value of the custom metric. If not provided, it
92+
* uses a default value of one.
93+
*/
94+
incrementMetric(metricName: string, num?: number): void;
95+
/**
96+
* Sets the value of the specified custom metric to the given number regardless of whether
97+
* a metric with that name already exists on the trace instance or not. The value will be floored down to an
98+
* integer.
99+
*
100+
* @param metricName - Name of the custom metric.
101+
* @param num - Value to of the custom metric.
102+
*/
103+
putMetric(metricName: string, num: number): void;
104+
/**
105+
* Returns the value of the custom metric by that name. If a custom metric with that name does
106+
* not exist will return zero.
107+
*
108+
* @param metricName - Name of the custom metric.
109+
*/
110+
getMetric(metricName: string): number;
111+
/**
112+
* Set a custom attribute of a trace to a certain value.
113+
*
114+
* @param attr - Name of the custom attribute.
115+
* @param value - Value of the custom attribute.
116+
*/
117+
putAttribute(attr: string, value: string): void;
118+
/**
119+
* Retrieves the value which a custom attribute is set to.
120+
*
121+
* @param attr - Name of the custom attribute.
122+
*/
123+
getAttribute(attr: string): string | undefined;
124+
/**
125+
* Removes the specified custom attribute from a trace instance.
126+
*
127+
* @param attr - Name of the custom attribute.
128+
*/
129+
removeAttribute(attr: string): void;
130+
/**
131+
* Returns a map of all custom attributes of a trace instance.
132+
*/
133+
getAttributes(): {
134+
[key: string]: string;
135+
};
136+
}
137+
138+
/**
139+
* Returns a {@link FirebasePerformance} instance for the given app.
140+
* @param app - The {@link @firebase/app#FirebaseApp} to use.
141+
* @public
142+
*/
143+
export declare function getPerformance(app?: FirebaseApp): FirebasePerformance;
144+
145+
/**
146+
* Returns a {@link FirebasePerformance} instance for the given app. Can only be called once.
147+
* @param app - The {@link @firebase/app#FirebaseApp} to use.
148+
* @param settings - Optional settings for the {@link FirebasePerformance} instance.
149+
* @public
150+
*/
151+
export declare function initializePerformance(
152+
app: FirebaseApp,
153+
settings?: PerformanceSettings,
154+
): FirebasePerformance;
155+
156+
/**
157+
* Returns a new `PerformanceTrace` instance.
158+
* @param performance - The {@link FirebasePerformance} instance to use.
159+
* @param name - The name of the trace.
160+
* @public
161+
*/
162+
export declare function trace(performance: FirebasePerformance, name: string): PerformanceTrace;

.github/scripts/compare-types/src/registry.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import firestoreConfig from '../configs/firestore';
1919
import firestorePipelinesConfig from '../configs/firestore-pipelines';
2020
import remoteConfigConfig from '../configs/remote-config';
2121
import authConfig from '../configs/auth';
22+
import installationsConfig from '../configs/installations';
23+
import perfConfig from '../configs/perf-config';
2224

2325
const REPO_ROOT = path.resolve(__dirname, '..', '..', '..', '..');
2426

@@ -231,6 +233,18 @@ export const packages: PackageEntry[] = [
231233
],
232234
config: appCheckConfig,
233235
},
236+
{
237+
name: 'installations',
238+
firebaseSdkTypesPaths: [
239+
requiredFirebaseTypes('installations'),
240+
],
241+
rnFirebaseModularFiles: [
242+
path.join(rnDist('installations'), 'types', 'installations.d.ts'),
243+
path.join(rnDist('installations'), 'modular.d.ts'),
244+
],
245+
rnFirebaseSupportFiles: [path.join(rnDist('installations'), 'types', 'internal.d.ts')],
246+
config: installationsConfig,
247+
},
234248
{
235249
name: 'firestore',
236250
firebaseSdkTypesPaths: [requiredFirebaseTypes('firestore')],
@@ -282,4 +296,14 @@ export const packages: PackageEntry[] = [
282296
],
283297
config: firestorePipelinesConfig,
284298
})),
299+
{
300+
name: 'perf',
301+
firebaseSdkTypesPaths: [requiredFirebaseTypes('performance')],
302+
rnFirebaseModularFiles: [
303+
path.join(rnDist('perf'), 'types', 'perf.d.ts'),
304+
path.join(rnDist('perf'), 'modular.d.ts'),
305+
],
306+
rnFirebaseSupportFiles: [],
307+
config: perfConfig,
308+
},
285309
];

docs/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ project.ext {
335335
// Overriding Library SDK Versions if desired
336336
firebase: [
337337
// Override Firebase SDK Version
338-
bom : "34.12.0"
338+
bom : "34.13.0"
339339
],
340340
],
341341
])
@@ -350,12 +350,12 @@ Open your projects `/ios/Podfile` and add any of the globals shown below to the
350350

351351
```ruby
352352
# Override Firebase SDK Version if desired
353-
$FirebaseSDKVersion = '12.12.0'
353+
$FirebaseSDKVersion = '12.13.0'
354354
```
355355

356356
Once changed, reinstall your projects pods via pod install and rebuild your project with `npx react-native run-ios`.
357357

358-
Alternatively, if you cannot edit the Podfile easily (as when using Expo), you may add the environment variable `FIREBASE_SDK_VERSION=12.12.0` (or whatever version you need) to the command line that installs pods. For example `FIREBASE_SDK_VERSION=12.12.0 yarn expo prebuild --clean`
358+
Alternatively, if you cannot edit the Podfile easily (as when using Expo), you may add the environment variable `FIREBASE_SDK_VERSION=12.13.0` (or whatever version you need) to the command line that installs pods. For example `FIREBASE_SDK_VERSION=12.13.0 yarn expo prebuild --clean`
359359

360360
### Android Performance
361361

packages/app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
},
106106
"sdkVersions": {
107107
"ios": {
108-
"firebase": "12.12.0",
108+
"firebase": "12.13.0",
109109
"iosTarget": "15.0",
110110
"macosTarget": "10.15",
111111
"tvosTarget": "15.0"
@@ -114,7 +114,7 @@
114114
"minSdk": 23,
115115
"targetSdk": 34,
116116
"compileSdk": 34,
117-
"firebase": "34.12.0",
117+
"firebase": "34.13.0",
118118
"firebaseCrashlyticsGradle": "3.0.7",
119119
"firebasePerfGradle": "2.0.2",
120120
"gmsGoogleServicesGradle": "4.4.4",

packages/installations/__tests__/installations.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ describe('installations()', function () {
109109
const installations = getInstallations();
110110
installationsV9Deprecation(
111111
() => deleteInstallations(installations),
112+
// @ts-expect-error Combines modular and namespace API
112113
() => installations.delete(),
113114
'delete',
114115
);
@@ -118,6 +119,7 @@ describe('installations()', function () {
118119
const installations = getInstallations();
119120
installationsV9Deprecation(
120121
() => getId(installations),
122+
// @ts-expect-error Combines modular and namespace API
121123
() => installations.getId(),
122124
'getId',
123125
);
@@ -127,6 +129,7 @@ describe('installations()', function () {
127129
const installations = getInstallations();
128130
installationsV9Deprecation(
129131
() => getToken(installations),
132+
// @ts-expect-error Combines modular and namespace API
130133
() => installations.getToken(),
131134
'getToken',
132135
);

0 commit comments

Comments
 (0)