Skip to content

Commit 0371a54

Browse files
committed
Add next as a devDependency for types
1 parent 09fcd0e commit 0371a54

File tree

5 files changed

+312
-44
lines changed

5 files changed

+312
-44
lines changed

common/api-review/telemetry.api.md

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,16 @@ export function flush(telemetry: Telemetry): Promise<void>;
1818
export function getTelemetry(app?: FirebaseApp): Telemetry;
1919

2020
// @public (undocumented)
21-
export type InstrumentationOnRequestError = (error: unknown, errorRequest: Readonly<{
22-
path: string;
23-
method: string;
24-
headers: NodeJS.Dict<string | string[]>;
25-
}>, errorContext: Readonly<RequestErrorContext>) => void | Promise<void>;
26-
27-
// @public
28-
export const nextOnRequestError: InstrumentationOnRequestError;
29-
30-
// @public
31-
export interface RequestErrorContext {
32-
// (undocumented)
33-
renderSource?: 'react-server-components' | 'react-server-components-payload' | 'server-rendering';
21+
export namespace Instrumentation {
22+
// Warning: (ae-forgotten-export) The symbol "InstrumentationOnRequestError" needs to be exported by the entry point index.d.ts
23+
//
3424
// (undocumented)
35-
revalidateReason: 'on-demand' | 'stale' | undefined;
36-
// (undocumented)
37-
routePath: string;
38-
// (undocumented)
39-
routerKind: 'Pages Router' | 'App Router';
40-
// (undocumented)
41-
routeType: 'render' | 'route' | 'action' | 'middleware';
25+
export type onRequestError = InstrumentationOnRequestError;
4226
}
4327

28+
// @public
29+
export const nextOnRequestError: Instrumentation.onRequestError;
30+
4431
// @public
4532
export interface Telemetry {
4633
app: FirebaseApp;

packages/telemetry/api-extractor.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"enabled": true,
77
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
88
"betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts"
9-
}
9+
},
10+
"bundledPackages": ["next"]
1011
}

packages/telemetry/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"@firebase/app": "0.14.2",
5959
"@opentelemetry/sdk-trace-web": "2.1.0",
6060
"@rollup/plugin-json": "6.1.0",
61+
"next": "15.5.2",
6162
"rollup": "2.79.2",
6263
"rollup-plugin-replace": "2.2.0",
6364
"rollup-plugin-typescript2": "0.36.0",

packages/telemetry/src/next.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,10 @@
1717

1818
import { getApp } from '@firebase/app';
1919
import { captureError, getTelemetry } from './api';
20+
// eslint-disable-next-line import/no-extraneous-dependencies
21+
import { Instrumentation } from 'next';
2022

21-
// The following types mirror those from Next at v15.5
22-
export interface RequestErrorContext {
23-
routerKind: 'Pages Router' | 'App Router';
24-
routePath: string;
25-
routeType: 'render' | 'route' | 'action' | 'middleware';
26-
renderSource?:
27-
| 'react-server-components'
28-
| 'react-server-components-payload'
29-
| 'server-rendering';
30-
revalidateReason: 'on-demand' | 'stale' | undefined;
31-
}
32-
export type InstrumentationOnRequestError = (
33-
error: unknown,
34-
errorRequest: Readonly<{
35-
path: string;
36-
method: string;
37-
headers: NodeJS.Dict<string | string[]>;
38-
}>,
39-
errorContext: Readonly<RequestErrorContext>
40-
) => void | Promise<void>;
23+
export { Instrumentation };
4124

4225
/**
4326
* Automatically report uncaught errors from server routes to Firebase Telemetry.
@@ -50,7 +33,7 @@ export type InstrumentationOnRequestError = (
5033
*
5134
* @public
5235
*/
53-
export const nextOnRequestError: InstrumentationOnRequestError = async (
36+
export const nextOnRequestError: Instrumentation.onRequestError = async (
5437
error,
5538
errorRequest,
5639
errorContext

0 commit comments

Comments
 (0)