|
12 | 12 | /* eslint-disable max-lines */
|
13 | 13 | /* eslint-disable @typescript-eslint/no-explicit-any */
|
14 | 14 |
|
15 |
| -import { CrossPlatformRequest, Event, ExtractedNodeRequestData, Transaction, TransactionSource } from '@sentry/types'; |
| 15 | +import { Event, ExtractedNodeRequestData, PolymorphicRequest, Transaction, TransactionSource } from '@sentry/types'; |
16 | 16 |
|
17 | 17 | import { isPlainObject, isString } from './is';
|
18 | 18 | import { normalize } from './normalize';
|
@@ -44,7 +44,7 @@ type InjectedNodeDeps = {
|
44 | 44 | */
|
45 | 45 | export function addRequestDataToTransaction(
|
46 | 46 | transaction: Transaction | undefined,
|
47 |
| - req: CrossPlatformRequest, |
| 47 | + req: PolymorphicRequest, |
48 | 48 | deps?: InjectedNodeDeps,
|
49 | 49 | ): void {
|
50 | 50 | if (!transaction) return;
|
@@ -74,7 +74,7 @@ export function addRequestDataToTransaction(
|
74 | 74 | * @returns A tuple of the fully constructed transaction name [0] and its source [1] (can be either 'route' or 'url')
|
75 | 75 | */
|
76 | 76 | export function extractPathForTransaction(
|
77 |
| - req: CrossPlatformRequest, |
| 77 | + req: PolymorphicRequest, |
78 | 78 | options: { path?: boolean; method?: boolean; customRoute?: string } = {},
|
79 | 79 | ): [string, TransactionSource] {
|
80 | 80 | const method = req.method && req.method.toUpperCase();
|
@@ -110,7 +110,7 @@ export function extractPathForTransaction(
|
110 | 110 | type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';
|
111 | 111 |
|
112 | 112 | /** JSDoc */
|
113 |
| -function extractTransaction(req: CrossPlatformRequest, type: boolean | TransactionNamingScheme): string { |
| 113 | +function extractTransaction(req: PolymorphicRequest, type: boolean | TransactionNamingScheme): string { |
114 | 114 | switch (type) {
|
115 | 115 | case 'path': {
|
116 | 116 | return extractPathForTransaction(req, { path: true })[0];
|
@@ -154,7 +154,7 @@ function extractUserData(
|
154 | 154 | * @returns An object containing normalized request data
|
155 | 155 | */
|
156 | 156 | export function extractRequestData(
|
157 |
| - req: CrossPlatformRequest, |
| 157 | + req: PolymorphicRequest, |
158 | 158 | options?: {
|
159 | 159 | include?: string[];
|
160 | 160 | deps?: InjectedNodeDeps;
|
@@ -282,7 +282,7 @@ export interface AddRequestDataToEventOptions {
|
282 | 282 | */
|
283 | 283 | export function addRequestDataToEvent(
|
284 | 284 | event: Event,
|
285 |
| - req: CrossPlatformRequest, |
| 285 | + req: PolymorphicRequest, |
286 | 286 | options?: AddRequestDataToEventOptions,
|
287 | 287 | ): Event {
|
288 | 288 | const include = {
|
@@ -335,7 +335,7 @@ export function addRequestDataToEvent(
|
335 | 335 | }
|
336 | 336 |
|
337 | 337 | function extractQueryParams(
|
338 |
| - req: CrossPlatformRequest, |
| 338 | + req: PolymorphicRequest, |
339 | 339 | deps?: InjectedNodeDeps,
|
340 | 340 | ): string | Record<string, unknown> | undefined {
|
341 | 341 | // url (including path and query string):
|
|
0 commit comments