1 | import type { Event, ExtractedNodeRequestData, PolymorphicRequest, Transaction, TransactionSource } from '@sentry/types';
|
2 | declare const DEFAULT_REQUEST_INCLUDES: string[];
|
3 | export declare const DEFAULT_USER_INCLUDES: string[];
|
4 | /**
|
5 | * Options deciding what parts of the request to use when enhancing an event
|
6 | */
|
7 | export declare type AddRequestDataToEventOptions = {
|
8 | /** Flags controlling whether each type of data should be added to the event */
|
9 | include?: {
|
10 | ip?: boolean;
|
11 | request?: boolean | Array<typeof DEFAULT_REQUEST_INCLUDES[number]>;
|
12 | transaction?: boolean | TransactionNamingScheme;
|
13 | user?: boolean | Array<typeof DEFAULT_USER_INCLUDES[number]>;
|
14 | };
|
15 | };
|
16 | export declare type TransactionNamingScheme = 'path' | 'methodPath' | 'handler';
|
17 | /**
|
18 | * Sets parameterized route as transaction name e.g.: `GET /users/:id`
|
19 | * Also adds more context data on the transaction from the request
|
20 | */
|
21 | export declare function addRequestDataToTransaction(transaction: Transaction | undefined, req: PolymorphicRequest): void;
|
22 | /**
|
23 | * Extracts a complete and parameterized path from the request object and uses it to construct transaction name.
|
24 | * If the parameterized transaction name cannot be extracted, we fall back to the raw URL.
|
25 | *
|
26 | * Additionally, this function determines and returns the transaction name source
|
27 | *
|
28 | * eg. GET /mountpoint/user/:id
|
29 | *
|
30 | * @param req A request object
|
31 | * @param options What to include in the transaction name (method, path, or a custom route name to be
|
32 | * used instead of the request's route)
|
33 | *
|
34 | * @returns A tuple of the fully constructed transaction name [0] and its source [1] (can be either 'route' or 'url')
|
35 | */
|
36 | export declare function extractPathForTransaction(req: PolymorphicRequest, options?: {
|
37 | path?: boolean;
|
38 | method?: boolean;
|
39 | customRoute?: string;
|
40 | }): [string, TransactionSource];
|
41 | /**
|
42 | * Normalize data from the request object
|
43 | *
|
44 | * @param req The request object from which to extract data
|
45 | * @param options.include An optional array of keys to include in the normalized data. Defaults to
|
46 | * DEFAULT_REQUEST_INCLUDES if not provided.
|
47 | * @param options.deps Injected, platform-specific dependencies
|
48 | *
|
49 | * @returns An object containing normalized request data
|
50 | */
|
51 | export declare function extractRequestData(req: PolymorphicRequest, options?: {
|
52 | include?: string[];
|
53 | }): ExtractedNodeRequestData;
|
54 | /**
|
55 | * Add data from the given request to the given event
|
56 | *
|
57 | * @param event The event to which the request data will be added
|
58 | * @param req Request object
|
59 | * @param options.include Flags to control what data is included
|
60 | *
|
61 | * @returns The mutated `Event` object
|
62 | */
|
63 | export declare function addRequestDataToEvent(event: Event, req: PolymorphicRequest, options?: AddRequestDataToEventOptions): Event;
|
64 | export {};
|
65 | //# sourceMappingURL=requestdata.d.ts.map |
\ | No newline at end of file |