1 |
|
2 | import { Event, ExtractedNodeRequestData } from '@sentry/types';
|
3 | import * as http from 'http';
|
4 | export interface ExpressRequest {
|
5 | baseUrl?: string;
|
6 | connection?: {
|
7 | remoteAddress?: string;
|
8 | };
|
9 | ip?: string;
|
10 | method?: string;
|
11 | originalUrl?: string;
|
12 | route?: {
|
13 | path: string;
|
14 | stack: [{
|
15 | name: string;
|
16 | }];
|
17 | };
|
18 | query?: {
|
19 | [key: string]: unknown;
|
20 | };
|
21 | url?: string;
|
22 | user?: {
|
23 | [key: string]: any;
|
24 | };
|
25 | }
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export declare function tracingHandler(): (req: http.IncomingMessage, res: http.ServerResponse, next: (error?: any) => void) => void;
|
31 | declare type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | export declare function extractRequestData(req: {
|
41 | [key: string]: any;
|
42 | }, keys?: string[]): ExtractedNodeRequestData;
|
43 |
|
44 |
|
45 |
|
46 | export interface ParseRequestOptions {
|
47 | ip?: boolean;
|
48 | request?: boolean | string[];
|
49 | serverName?: boolean;
|
50 | transaction?: boolean | TransactionNamingScheme;
|
51 | user?: boolean | string[];
|
52 | version?: boolean;
|
53 | }
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | export declare function parseRequest(event: Event, req: ExpressRequest, options?: ParseRequestOptions): Event;
|
63 | export declare type RequestHandlerOptions = ParseRequestOptions & {
|
64 | flushTimeout?: number;
|
65 | };
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | export declare function requestHandler(options?: RequestHandlerOptions): (req: http.IncomingMessage, res: http.ServerResponse, next: (error?: any) => void) => void;
|
71 |
|
72 | interface MiddlewareError extends Error {
|
73 | status?: number | string;
|
74 | statusCode?: number | string;
|
75 | status_code?: number | string;
|
76 | output?: {
|
77 | statusCode?: number | string;
|
78 | };
|
79 | }
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | export declare function errorHandler(options?: {
|
85 | |
86 |
|
87 |
|
88 |
|
89 | shouldHandleError?(error: MiddlewareError): boolean;
|
90 | }): (error: MiddlewareError, req: http.IncomingMessage, res: http.ServerResponse, next: (error: MiddlewareError) => void) => void;
|
91 | export {};
|
92 |
|
\ | No newline at end of file |