1 | import { Breadcrumb, CaptureContext, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, RequestSession, Scope as ScopeInterface, Severity, Span, Transaction, User } from '@sentry/types';
|
2 | import { Session } from './session';
|
3 | /**
|
4 | * Holds additional event information. {@link Scope.applyToEvent} will be
|
5 | * called by the client before an event will be sent.
|
6 | */
|
7 | export declare class Scope implements ScopeInterface {
|
8 | /** Flag if notifying is happening. */
|
9 | protected _notifyingListeners: boolean;
|
10 | /** Callback for client to receive scope changes. */
|
11 | protected _scopeListeners: Array<(scope: Scope) => void>;
|
12 | /** Callback list that will be called after {@link applyToEvent}. */
|
13 | protected _eventProcessors: EventProcessor[];
|
14 | /** Array of breadcrumbs. */
|
15 | protected _breadcrumbs: Breadcrumb[];
|
16 | /** User */
|
17 | protected _user: User;
|
18 | /** Tags */
|
19 | protected _tags: {
|
20 | [key: string]: Primitive;
|
21 | };
|
22 | /** Extra */
|
23 | protected _extra: Extras;
|
24 | /** Contexts */
|
25 | protected _contexts: Contexts;
|
26 | /** Fingerprint */
|
27 | protected _fingerprint?: string[];
|
28 | /** Severity */
|
29 | protected _level?: Severity;
|
30 | /** Transaction Name */
|
31 | protected _transactionName?: string;
|
32 | /** Span */
|
33 | protected _span?: Span;
|
34 | /** Session */
|
35 | protected _session?: Session;
|
36 | /** Request Mode Session Status */
|
37 | protected _requestSession?: RequestSession;
|
38 | /**
|
39 | * Inherit values from the parent scope.
|
40 | * @param scope to clone.
|
41 | */
|
42 | static clone(scope?: Scope): Scope;
|
43 | /**
|
44 | * Add internal on change listener. Used for sub SDKs that need to store the scope.
|
45 | * @hidden
|
46 | */
|
47 | addScopeListener(callback: (scope: Scope) => void): void;
|
48 | /**
|
49 | * @inheritDoc
|
50 | */
|
51 | addEventProcessor(callback: EventProcessor): this;
|
52 | /**
|
53 | * @inheritDoc
|
54 | */
|
55 | setUser(user: User | null): this;
|
56 | /**
|
57 | * @inheritDoc
|
58 | */
|
59 | getUser(): User | undefined;
|
60 | /**
|
61 | * @inheritDoc
|
62 | */
|
63 | getRequestSession(): RequestSession | undefined;
|
64 | /**
|
65 | * @inheritDoc
|
66 | */
|
67 | setRequestSession(requestSession?: RequestSession): this;
|
68 | /**
|
69 | * @inheritDoc
|
70 | */
|
71 | setTags(tags: {
|
72 | [key: string]: Primitive;
|
73 | }): this;
|
74 | /**
|
75 | * @inheritDoc
|
76 | */
|
77 | setTag(key: string, value: Primitive): this;
|
78 | /**
|
79 | * @inheritDoc
|
80 | */
|
81 | setExtras(extras: Extras): this;
|
82 | /**
|
83 | * @inheritDoc
|
84 | */
|
85 | setExtra(key: string, extra: Extra): this;
|
86 | /**
|
87 | * @inheritDoc
|
88 | */
|
89 | setFingerprint(fingerprint: string[]): this;
|
90 | /**
|
91 | * @inheritDoc
|
92 | */
|
93 | setLevel(level: Severity): this;
|
94 | /**
|
95 | * @inheritDoc
|
96 | */
|
97 | setTransactionName(name?: string): this;
|
98 | /**
|
99 | * Can be removed in major version.
|
100 | * @deprecated in favor of {@link this.setTransactionName}
|
101 | */
|
102 | setTransaction(name?: string): this;
|
103 | /**
|
104 | * @inheritDoc
|
105 | */
|
106 | setContext(key: string, context: Context | null): this;
|
107 | /**
|
108 | * @inheritDoc
|
109 | */
|
110 | setSpan(span?: Span): this;
|
111 | /**
|
112 | * @inheritDoc
|
113 | */
|
114 | getSpan(): Span | undefined;
|
115 | /**
|
116 | * @inheritDoc
|
117 | */
|
118 | getTransaction(): Transaction | undefined;
|
119 | /**
|
120 | * @inheritDoc
|
121 | */
|
122 | setSession(session?: Session): this;
|
123 | /**
|
124 | * @inheritDoc
|
125 | */
|
126 | getSession(): Session | undefined;
|
127 | /**
|
128 | * @inheritDoc
|
129 | */
|
130 | update(captureContext?: CaptureContext): this;
|
131 | /**
|
132 | * @inheritDoc
|
133 | */
|
134 | clear(): this;
|
135 | /**
|
136 | * @inheritDoc
|
137 | */
|
138 | addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
|
139 | /**
|
140 | * @inheritDoc
|
141 | */
|
142 | clearBreadcrumbs(): this;
|
143 | /**
|
144 | * Applies the current context and fingerprint to the event.
|
145 | * Note that breadcrumbs will be added by the client.
|
146 | * Also if the event has already breadcrumbs on it, we do not merge them.
|
147 | * @param event Event
|
148 | * @param hint May contain additional information about the original exception.
|
149 | * @hidden
|
150 | */
|
151 | applyToEvent(event: Event, hint?: EventHint): PromiseLike<Event | null>;
|
152 | /**
|
153 | * This will be called after {@link applyToEvent} is finished.
|
154 | */
|
155 | protected _notifyEventProcessors(processors: EventProcessor[], event: Event | null, hint?: EventHint, index?: number): PromiseLike<Event | null>;
|
156 | /**
|
157 | * This will be called on every set call.
|
158 | */
|
159 | protected _notifyScopeListeners(): void;
|
160 | /**
|
161 | * Applies fingerprint from the scope to the event if there's one,
|
162 | * uses message if there's one instead or get rid of empty fingerprint
|
163 | */
|
164 | private _applyFingerprint;
|
165 | }
|
166 | /**
|
167 | * Add a EventProcessor to be kept globally.
|
168 | * @param callback EventProcessor to add
|
169 | */
|
170 | export declare function addGlobalEventProcessor(callback: EventProcessor): void;
|
171 | //# sourceMappingURL=scope.d.ts.map |
\ | No newline at end of file |