-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathindex.types.ts
More file actions
155 lines (133 loc) · 6.96 KB
/
index.types.ts
File metadata and controls
155 lines (133 loc) · 6.96 KB
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
146
147
148
149
150
151
152
153
154
155
/* eslint-disable @typescript-eslint/no-explicit-any */
// import/export got a false positive, and affects most of our index barrel files
// can be removed once following issue is fixed: https://github.com/import-js/eslint-plugin-import/issues/703
/* eslint-disable import/export */
// 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 redefine the colliding exports in this file - which we do below.
import type { Client, Integration, Options, StackParser } from '@sentry/core';
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';
export * from './config';
export * from './client';
export * from './server';
export * from './edge';
/** Initializes Sentry Next.js SDK */
export declare function init(
options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions | edgeSdk.EdgeOptions,
): Client | undefined;
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
export declare const spanStreamingIntegration: typeof clientSdk.spanStreamingIntegration;
export declare const withStreamedSpan: typeof clientSdk.withStreamedSpan;
// Different implementation in server and worker
export declare const vercelAIIntegration: typeof serverSdk.vercelAIIntegration;
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 logger: typeof clientSdk.logger | typeof serverSdk.logger;
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;
export { captureRequestError } from './common/captureRequestError';
export declare const growthbookIntegration: typeof clientSdk.growthbookIntegration;
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;