1 | import { Breadcrumb } from './breadcrumb';
|
2 | import { Context, Contexts } from './context';
|
3 | import { EventProcessor } from './eventprocessor';
|
4 | import { Extra, Extras } from './extra';
|
5 | import { Primitive } from './misc';
|
6 | import { RequestSession, Session } from './session';
|
7 | import { Severity } from './severity';
|
8 | import { Span } from './span';
|
9 | import { Transaction } from './transaction';
|
10 | import { User } from './user';
|
11 |
|
12 | export declare type CaptureContext = Scope | Partial<ScopeContext> | ((scope: Scope) => Scope);
|
13 | /** JSDocs */
|
14 | export interface ScopeContext {
|
15 | user: User;
|
16 | level: Severity;
|
17 | extra: Extras;
|
18 | contexts: Contexts;
|
19 | tags: {
|
20 | [key: string]: Primitive;
|
21 | };
|
22 | fingerprint: string[];
|
23 | requestSession: RequestSession;
|
24 | }
|
25 | /**
|
26 | * Holds additional event information. {@link Scope.applyToEvent} will be called by the client before an event is sent.
|
27 | */
|
28 | export interface Scope {
|
29 | /** Add new event processor that will be called after {@link applyToEvent}. */
|
30 | addEventProcessor(callback: EventProcessor): this;
|
31 | /**
|
32 | * Updates user context information for future events.
|
33 | *
|
34 | * @param user User context object to be set in the current context. Pass `null` to unset the user.
|
35 | */
|
36 | setUser(user: User | null): this;
|
37 | /**
|
38 | * Returns the `User` if there is one
|
39 | */
|
40 | getUser(): User | undefined;
|
41 | /**
|
42 | * Set an object that will be merged sent as tags data with the event.
|
43 | * @param tags Tags context object to merge into current context.
|
44 | */
|
45 | setTags(tags: {
|
46 | [key: string]: Primitive;
|
47 | }): this;
|
48 | /**
|
49 | * Set key:value that will be sent as tags data with the event.
|
50 | *
|
51 | * Can also be used to unset a tag by passing `undefined`.
|
52 | *
|
53 | * @param key String key of tag
|
54 | * @param value Value of tag
|
55 | */
|
56 | setTag(key: string, value: Primitive): this;
|
57 | /**
|
58 | * Set an object that will be merged sent as extra data with the event.
|
59 | * @param extras Extras object to merge into current context.
|
60 | */
|
61 | setExtras(extras: Extras): this;
|
62 | /**
|
63 | * Set key:value that will be sent as extra data with the event.
|
64 | * @param key String of extra
|
65 | * @param extra Any kind of data. This data will be normalized.
|
66 | */
|
67 | setExtra(key: string, extra: Extra): this;
|
68 | /**
|
69 | * Sets the fingerprint on the scope to send with the events.
|
70 | * @param fingerprint string[] to group events in Sentry.
|
71 | */
|
72 | setFingerprint(fingerprint: string[]): this;
|
73 | /**
|
74 | * Sets the level on the scope for future events.
|
75 | * @param level string {@link Severity}
|
76 | */
|
77 | setLevel(level: Severity): this;
|
78 | /**
|
79 | * Sets the transaction name on the scope for future events.
|
80 | */
|
81 | setTransactionName(name?: string): this;
|
82 | /**
|
83 | * Sets context data with the given name.
|
84 | * @param name of the context
|
85 | * @param context an object containing context data. This data will be normalized. Pass `null` to unset the context.
|
86 | */
|
87 | setContext(name: string, context: Context | null): this;
|
88 | /**
|
89 | * Sets the Span on the scope.
|
90 | * @param span Span
|
91 | */
|
92 | setSpan(span?: Span): this;
|
93 | /**
|
94 | * Returns the `Span` if there is one
|
95 | */
|
96 | getSpan(): Span | undefined;
|
97 | /**
|
98 | * Returns the `Transaction` attached to the scope (if there is one)
|
99 | */
|
100 | getTransaction(): Transaction | undefined;
|
101 | /**
|
102 | * Returns the `Session` if there is one
|
103 | */
|
104 | getSession(): Session | undefined;
|
105 | /**
|
106 | * Sets the `Session` on the scope
|
107 | */
|
108 | setSession(session?: Session): this;
|
109 | /**
|
110 | * Returns the `RequestSession` if there is one
|
111 | */
|
112 | getRequestSession(): RequestSession | undefined;
|
113 | /**
|
114 | * Sets the `RequestSession` on the scope
|
115 | */
|
116 | setRequestSession(requestSession?: RequestSession): this;
|
117 | /**
|
118 | * Updates the scope with provided data. Can work in three variations:
|
119 | * - plain object containing updatable attributes
|
120 | * - Scope instance that'll extract the attributes from
|
121 | * - callback function that'll receive the current scope as an argument and allow for modifications
|
122 | * @param captureContext scope modifier to be used
|
123 | */
|
124 | update(captureContext?: CaptureContext): this;
|
125 | /** Clears the current scope and resets its properties. */
|
126 | clear(): this;
|
127 | /**
|
128 | * Sets the breadcrumbs in the scope
|
129 | * @param breadcrumbs Breadcrumb
|
130 | * @param maxBreadcrumbs number of max breadcrumbs to merged into event.
|
131 | */
|
132 | addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
|
133 | /**
|
134 | * Clears all currently set Breadcrumbs.
|
135 | */
|
136 | clearBreadcrumbs(): this;
|
137 | }
|
138 | //# sourceMappingURL=scope.d.ts.map |
\ | No newline at end of file |