1212/* eslint-disable max-lines */
1313/* eslint-disable @typescript-eslint/no-explicit-any */
1414
15- import { Event , ExtractedNodeRequestData , Transaction , TransactionSource } from '@sentry/types' ;
15+ import { CrossPlatformRequest , Event , ExtractedNodeRequestData , Transaction , TransactionSource } from '@sentry/types' ;
1616
1717import { isPlainObject , isString } from './is' ;
1818import { normalize } from './normalize' ;
@@ -27,71 +27,6 @@ const DEFAULT_INCLUDES = {
2727const DEFAULT_REQUEST_INCLUDES = [ 'cookies' , 'data' , 'headers' , 'method' , 'query_string' , 'url' ] ;
2828const DEFAULT_USER_INCLUDES = [ 'id' , 'username' , 'email' ] ;
2929
30- type BaseRequest = {
31- method ?: string ;
32- url ?: string ;
33- } ;
34-
35- type BrowserRequest = BaseRequest ;
36-
37- type NodeRequest = BaseRequest & {
38- headers ?: {
39- [ key : string ] : string | string [ ] | undefined ;
40- } ;
41- protocol ?: string ;
42- socket ?: {
43- encrypted ?: boolean ;
44- remoteAddress ?: string ;
45- } ;
46- } ;
47-
48- type KoaRequest = NodeRequest & {
49- host ?: string ;
50- hostname ?: string ;
51- ip ?: string ;
52- originalUrl ?: string ;
53- } ;
54-
55- type NextjsRequest = NodeRequest & {
56- cookies ?: {
57- [ key : string ] : string ;
58- } ;
59- query ?: {
60- [ key : string ] : any ;
61- } ;
62- } ;
63-
64- type ExpressRequest = NodeRequest & {
65- baseUrl ?: string ;
66- body ?: string | { [ key : string ] : any } ;
67- host ?: string ;
68- hostname ?: string ;
69- ip ?: string ;
70- originalUrl ?: string ;
71- route ?: {
72- path : string ;
73- stack : [
74- {
75- name : string ;
76- } ,
77- ] ;
78- } ;
79- query ?: {
80- [ key : string ] : any ;
81- } ;
82- user ?: {
83- [ key : string ] : any ;
84- } ;
85- } ;
86-
87- /** A `Request` type compatible with Node, Express, browser, etc., because everything is optional */
88- export type CrossPlatformRequest = BaseRequest &
89- BrowserRequest &
90- NodeRequest &
91- ExpressRequest &
92- KoaRequest &
93- NextjsRequest ;
94-
9530type InjectedNodeDeps = {
9631 cookie : {
9732 parse : ( cookieStr : string ) => Record < string , string > ;
0 commit comments