1 | import { Event, Mechanism, StackFrame } from '@sentry/types';
|
2 | /**
|
3 | * UUID4 generator
|
4 | *
|
5 | * @returns string Generated UUID4.
|
6 | */
|
7 | export declare function uuid4(): string;
|
8 | /**
|
9 | * Parses string form of URL into an object
|
10 | * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B
|
11 | * // intentionally using regex and not <a/> href parsing trick because React Native and other
|
12 | * // environments where DOM might not be available
|
13 | * @returns parsed URL object
|
14 | */
|
15 | export declare function parseUrl(url: string): {
|
16 | host?: string;
|
17 | path?: string;
|
18 | protocol?: string;
|
19 | relative?: string;
|
20 | };
|
21 | /**
|
22 | * Extracts either message or type+value from an event that can be used for user-facing logs
|
23 | * @returns event's description
|
24 | */
|
25 | export declare function getEventDescription(event: Event): string;
|
26 | /**
|
27 | * Adds exception values, type and value to an synthetic Exception.
|
28 | * @param event The event to modify.
|
29 | * @param value Value of the exception.
|
30 | * @param type Type of the exception.
|
31 | * @hidden
|
32 | */
|
33 | export declare function addExceptionTypeValue(event: Event, value?: string, type?: string): void;
|
34 | /**
|
35 | * Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed.
|
36 | *
|
37 | * @param event The event to modify.
|
38 | * @param newMechanism Mechanism data to add to the event.
|
39 | * @hidden
|
40 | */
|
41 | export declare function addExceptionMechanism(event: Event, newMechanism?: Partial<Mechanism>): void;
|
42 | /**
|
43 | * Represents Semantic Versioning object
|
44 | */
|
45 | interface SemVer {
|
46 | major?: number;
|
47 | minor?: number;
|
48 | patch?: number;
|
49 | prerelease?: string;
|
50 | buildmetadata?: string;
|
51 | }
|
52 | /**
|
53 | * Parses input into a SemVer interface
|
54 | * @param input string representation of a semver version
|
55 | */
|
56 | export declare function parseSemver(input: string): SemVer;
|
57 | /**
|
58 | * This function adds context (pre/post/line) lines to the provided frame
|
59 | *
|
60 | * @param lines string[] containing all lines
|
61 | * @param frame StackFrame that will be mutated
|
62 | * @param linesOfContext number of context lines we want to add pre/post
|
63 | */
|
64 | export declare function addContextToFrame(lines: string[], frame: StackFrame, linesOfContext?: number): void;
|
65 | /**
|
66 | * Strip the query string and fragment off of a given URL or path (if present)
|
67 | *
|
68 | * @param urlPath Full URL or path, including possible query string and/or fragment
|
69 | * @returns URL or path without query string or fragment
|
70 | */
|
71 | export declare function stripUrlQueryAndFragment(urlPath: string): string;
|
72 | /**
|
73 | * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
|
74 | * in question), and marks it captured if not.
|
75 | *
|
76 | * This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and
|
77 | * record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so
|
78 | * that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because
|
79 | * the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not
|
80 | * caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This
|
81 | * function helps us ensure that even if we encounter the same error more than once, we only record it the first time we
|
82 | * see it.
|
83 | *
|
84 | * Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on
|
85 | * them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent
|
86 | * object wrapper forms so that this check will always work. However, because we need to flag the exact object which
|
87 | * will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification
|
88 | * must be done before the exception captured.
|
89 | *
|
90 | * @param A thrown exception to check or flag as having been seen
|
91 | * @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)
|
92 | */
|
93 | export declare function checkOrSetAlreadyCaught(exception: unknown): boolean;
|
94 | export {};
|
95 | //# sourceMappingURL=misc.d.ts.map |
\ | No newline at end of file |