-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathindex.types.ts
145 lines (123 loc) · 6.13 KB
/
index.types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* eslint-disable @typescript-eslint/no-explicit-any */
// We export everything from both the client part of the SDK and from the server part. Some of the exports collide,
// which is not allowed, unless we redifine the colliding exports in this file - which we do below.
export * from './config';
export * from './client';
export * from './server';
export * from './edge';
import type { Client, Integration, Options, StackParser } from '@sentry/types';
import type * as clientSdk from './client';
import type { ServerComponentContext, VercelCronsConfig } from './common/types';
import type * as edgeSdk from './edge';
import type * as serverSdk from './server';
/** Initializes Sentry Next.js SDK */
export declare function init(
options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions | edgeSdk.EdgeOptions,
): Client | undefined;
export declare const getClient: typeof clientSdk.getClient;
export declare const getRootSpan: typeof serverSdk.getRootSpan;
export declare const continueTrace: typeof clientSdk.continueTrace;
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
export declare const getDefaultIntegrations: (options: Options) => Integration[];
export declare const defaultStackParser: StackParser;
export declare function getSentryRelease(fallback?: string): string | undefined;
export declare const ErrorBoundary: typeof clientSdk.ErrorBoundary;
export declare const createReduxEnhancer: typeof clientSdk.createReduxEnhancer;
export declare const showReportDialog: typeof clientSdk.showReportDialog;
export declare const withErrorBoundary: typeof clientSdk.withErrorBoundary;
export declare const metrics: typeof clientSdk.metrics & typeof serverSdk.metrics;
export { withSentryConfig } from './config';
/**
* Wraps a Next.js Pages Router API route with Sentry error and performance instrumentation.
*
* NOTICE: This wrapper is for Pages Router API routes. If you are looking to wrap App Router API routes use `wrapRouteHandlerWithSentry` instead.
*
* @param handler The handler exported from the API route file.
* @param parameterizedRoute The page's parameterized route.
* @returns The wrapped handler.
*/
export declare function wrapApiHandlerWithSentry<APIHandler extends (...args: any[]) => any>(
handler: APIHandler,
parameterizedRoute: string,
): (
...args: Parameters<APIHandler>
) => ReturnType<APIHandler> extends Promise<unknown> ? ReturnType<APIHandler> : Promise<ReturnType<APIHandler>>;
/**
* Wraps a `getInitialProps` function with Sentry error and performance instrumentation.
*
* @param getInitialProps The `getInitialProps` function
* @returns A wrapped version of the function
*/
export declare function wrapGetInitialPropsWithSentry<F extends (...args: any[]) => any>(
getInitialProps: F,
): (...args: Parameters<F>) => ReturnType<F> extends Promise<unknown> ? ReturnType<F> : Promise<ReturnType<F>>;
/**
* Wraps a `getInitialProps` function of a custom `_app` page with Sentry error and performance instrumentation.
*
* @param getInitialProps The `getInitialProps` function
* @returns A wrapped version of the function
*/
export declare function wrapAppGetInitialPropsWithSentry<F extends (...args: any[]) => any>(
getInitialProps: F,
): (...args: Parameters<F>) => ReturnType<F> extends Promise<unknown> ? ReturnType<F> : Promise<ReturnType<F>>;
/**
* Wraps a `getInitialProps` function of a custom `_document` page with Sentry error and performance instrumentation.
*
* @param getInitialProps The `getInitialProps` function
* @returns A wrapped version of the function
*/
export declare function wrapDocumentGetInitialPropsWithSentry<F extends (...args: any[]) => any>(
getInitialProps: F,
): (...args: Parameters<F>) => ReturnType<F> extends Promise<unknown> ? ReturnType<F> : Promise<ReturnType<F>>;
/**
* Wraps a `getInitialProps` function of a custom `_error` page with Sentry error and performance instrumentation.
*
* @param getInitialProps The `getInitialProps` function
* @returns A wrapped version of the function
*/
export declare function wrapErrorGetInitialPropsWithSentry<F extends (...args: any[]) => any>(
getInitialProps: F,
): (...args: Parameters<F>) => ReturnType<F> extends Promise<unknown> ? ReturnType<F> : Promise<ReturnType<F>>;
/**
* Wraps a `getServerSideProps` function with Sentry error and performance instrumentation.
*
* @param origGetServerSideProps The `getServerSideProps` function
* @param parameterizedRoute The page's parameterized route
* @returns A wrapped version of the function
*/
export declare function wrapGetServerSidePropsWithSentry<F extends (...args: any[]) => any>(
origGetServerSideProps: F,
parameterizedRoute: string,
): (...args: Parameters<F>) => ReturnType<F> extends Promise<unknown> ? ReturnType<F> : Promise<ReturnType<F>>;
/**
* Wraps a `getStaticProps` function with Sentry error and performance instrumentation.
*
* @param origGetStaticProps The `getStaticProps` function
* @param parameterizedRoute The page's parameterized route
* @returns A wrapped version of the function
*/
export declare function wrapGetStaticPropsWithSentry<F extends (...args: any[]) => any>(
origGetStaticPropsa: F,
parameterizedRoute: string,
): (...args: Parameters<F>) => ReturnType<F> extends Promise<unknown> ? ReturnType<F> : Promise<ReturnType<F>>;
/**
* Wraps an `app` directory server component with Sentry error and performance instrumentation.
*/
export declare function wrapServerComponentWithSentry<F extends (...args: any[]) => any>(
WrappingTarget: F,
context: ServerComponentContext,
): F;
/**
* Wraps an `app` directory server component with Sentry error and performance instrumentation.
*/
export declare function wrapApiHandlerWithSentryVercelCrons<F extends (...args: any[]) => any>(
WrappingTarget: F,
vercelCronsConfig: VercelCronsConfig,
): F;
/**
* Wraps a page component with Sentry error instrumentation.
*/
export declare function wrapPageComponentWithSentry<C>(WrappingTarget: C): C;
// eslint-disable-next-line deprecation/deprecation
export { experimental_captureRequestError, captureRequestError } from './common/captureRequestError';