1 | import type { Attachment, Breadcrumb, CaptureContext, Client, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, PropagationContext, RequestSession, Scope as ScopeInterface, ScopeData, Session, Severity, SeverityLevel, Span, Transaction, User } from '@sentry/types';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | export declare class Scope implements ScopeInterface {
|
7 |
|
8 | protected _notifyingListeners: boolean;
|
9 |
|
10 | protected _scopeListeners: Array<(scope: Scope) => void>;
|
11 |
|
12 | protected _eventProcessors: EventProcessor[];
|
13 |
|
14 | protected _breadcrumbs: Breadcrumb[];
|
15 |
|
16 | protected _user: User;
|
17 |
|
18 | protected _tags: {
|
19 | [key: string]: Primitive;
|
20 | };
|
21 |
|
22 | protected _extra: Extras;
|
23 |
|
24 | protected _contexts: Contexts;
|
25 |
|
26 | protected _attachments: Attachment[];
|
27 |
|
28 | protected _propagationContext: PropagationContext;
|
29 | |
30 |
|
31 |
|
32 |
|
33 | protected _sdkProcessingMetadata: {
|
34 | [key: string]: unknown;
|
35 | };
|
36 |
|
37 | protected _fingerprint?: string[];
|
38 |
|
39 | protected _level?: Severity | SeverityLevel;
|
40 | |
41 |
|
42 |
|
43 | protected _transactionName?: string;
|
44 |
|
45 | protected _span?: Span;
|
46 |
|
47 | protected _session?: Session;
|
48 |
|
49 | protected _requestSession?: RequestSession;
|
50 |
|
51 | protected _client?: Client;
|
52 | constructor();
|
53 | /**
|
54 | * Inherit values from the parent scope.
|
55 | * @deprecated Use `scope.clone()` and `new Scope()` instead.
|
56 | */
|
57 | static clone(scope?: Scope): Scope;
|
58 | /**
|
59 | * Clone this scope instance.
|
60 | */
|
61 | clone(): Scope;
|
62 | /** Update the client on the scope. */
|
63 | setClient(client: Client | undefined): void;
|
64 | /**
|
65 | * Get the client assigned to this scope.
|
66 | *
|
67 | * It is generally recommended to use the global function `Sentry.getClient()` instead, unless you know what you are doing.
|
68 | */
|
69 | getClient(): Client | undefined;
|
70 | /**
|
71 | * Add internal on change listener. Used for sub SDKs that need to store the scope.
|
72 | * @hidden
|
73 | */
|
74 | addScopeListener(callback: (scope: Scope) => void): void;
|
75 | /**
|
76 | * @inheritDoc
|
77 | */
|
78 | addEventProcessor(callback: EventProcessor): this;
|
79 | /**
|
80 | * @inheritDoc
|
81 | */
|
82 | setUser(user: User | null): this;
|
83 | /**
|
84 | * @inheritDoc
|
85 | */
|
86 | getUser(): User | undefined;
|
87 | /**
|
88 | * @inheritDoc
|
89 | */
|
90 | getRequestSession(): RequestSession | undefined;
|
91 | /**
|
92 | * @inheritDoc
|
93 | */
|
94 | setRequestSession(requestSession?: RequestSession): this;
|
95 | /**
|
96 | * @inheritDoc
|
97 | */
|
98 | setTags(tags: {
|
99 | [key: string]: Primitive;
|
100 | }): this;
|
101 | /**
|
102 | * @inheritDoc
|
103 | */
|
104 | setTag(key: string, value: Primitive): this;
|
105 | /**
|
106 | * @inheritDoc
|
107 | */
|
108 | setExtras(extras: Extras): this;
|
109 | /**
|
110 | * @inheritDoc
|
111 | */
|
112 | setExtra(key: string, extra: Extra): this;
|
113 | /**
|
114 | * @inheritDoc
|
115 | */
|
116 | setFingerprint(fingerprint: string[]): this;
|
117 | /**
|
118 | * @inheritDoc
|
119 | */
|
120 | setLevel(level: Severity | SeverityLevel): this;
|
121 | /**
|
122 | * Sets the transaction name on the scope for future events.
|
123 | */
|
124 | setTransactionName(name?: string): this;
|
125 | /**
|
126 | * @inheritDoc
|
127 | */
|
128 | setContext(key: string, context: Context | null): this;
|
129 | /**
|
130 | * Sets the Span on the scope.
|
131 | * @param span Span
|
132 | * @deprecated Instead of setting a span on a scope, use `startSpan()`/`startSpanManual()` instead.
|
133 | */
|
134 | setSpan(span?: Span): this;
|
135 | /**
|
136 | * Returns the `Span` if there is one.
|
137 | * @deprecated Use `getActiveSpan()` instead.
|
138 | */
|
139 | getSpan(): Span | undefined;
|
140 | /**
|
141 | * Returns the `Transaction` attached to the scope (if there is one).
|
142 | * @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
143 | */
|
144 | getTransaction(): Transaction | undefined;
|
145 | /**
|
146 | * @inheritDoc
|
147 | */
|
148 | setSession(session?: Session): this;
|
149 | /**
|
150 | * @inheritDoc
|
151 | */
|
152 | getSession(): Session | undefined;
|
153 | /**
|
154 | * @inheritDoc
|
155 | */
|
156 | update(captureContext?: CaptureContext): this;
|
157 | /**
|
158 | * @inheritDoc
|
159 | */
|
160 | clear(): this;
|
161 | /**
|
162 | * @inheritDoc
|
163 | */
|
164 | addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
|
165 | /**
|
166 | * @inheritDoc
|
167 | */
|
168 | getLastBreadcrumb(): Breadcrumb | undefined;
|
169 | /**
|
170 | * @inheritDoc
|
171 | */
|
172 | clearBreadcrumbs(): this;
|
173 | /**
|
174 | * @inheritDoc
|
175 | */
|
176 | addAttachment(attachment: Attachment): this;
|
177 | /**
|
178 | * @inheritDoc
|
179 | * @deprecated Use `getScopeData()` instead.
|
180 | */
|
181 | getAttachments(): Attachment[];
|
182 | /**
|
183 | * @inheritDoc
|
184 | */
|
185 | clearAttachments(): this;
|
186 | /** @inheritDoc */
|
187 | getScopeData(): ScopeData;
|
188 | /**
|
189 | * Applies data from the scope to the event and runs all event processors on it.
|
190 | *
|
191 | * @param event Event
|
192 | * @param hint Object containing additional information about the original exception, for use by the event processors.
|
193 | * @hidden
|
194 | * @deprecated Use `applyScopeDataToEvent()` directly
|
195 | */
|
196 | applyToEvent(event: Event, hint?: EventHint, additionalEventProcessors?: EventProcessor[]): PromiseLike<Event | null>;
|
197 | /**
|
198 | * Add data which will be accessible during event processing but won't get sent to Sentry
|
199 | */
|
200 | setSDKProcessingMetadata(newData: {
|
201 | [key: string]: unknown;
|
202 | }): this;
|
203 | /**
|
204 | * @inheritDoc
|
205 | */
|
206 | setPropagationContext(context: PropagationContext): this;
|
207 | /**
|
208 | * @inheritDoc
|
209 | */
|
210 | getPropagationContext(): PropagationContext;
|
211 | /**
|
212 | * Capture an exception for this scope.
|
213 | *
|
214 | * @param exception The exception to capture.
|
215 | * @param hint Optinal additional data to attach to the Sentry event.
|
216 | * @returns the id of the captured Sentry event.
|
217 | */
|
218 | captureException(exception: unknown, hint?: EventHint): string;
|
219 | /**
|
220 | * Capture a message for this scope.
|
221 | *
|
222 | * @param message The message to capture.
|
223 | * @param level An optional severity level to report the message with.
|
224 | * @param hint Optional additional data to attach to the Sentry event.
|
225 | * @returns the id of the captured message.
|
226 | */
|
227 | captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string;
|
228 | /**
|
229 | * Captures a manually created event for this scope and sends it to Sentry.
|
230 | *
|
231 | * @param exception The event to capture.
|
232 | * @param hint Optional additional data to attach to the Sentry event.
|
233 | * @returns the id of the captured event.
|
234 | */
|
235 | captureEvent(event: Event, hint?: EventHint): string;
|
236 | /**
|
237 | * This will be called on every set call.
|
238 | */
|
239 | protected _notifyScopeListeners(): void;
|
240 | }
|
241 | /**
|
242 | * Get the global scope.
|
243 | * This scope is applied to _all_ events.
|
244 | */
|
245 | export declare function getGlobalScope(): ScopeInterface;
|
246 | /**
|
247 | * This is mainly needed for tests.
|
248 | * DO NOT USE this, as this is an internal API and subject to change.
|
249 | * @hidden
|
250 | */
|
251 | export declare function setGlobalScope(scope: ScopeInterface | undefined): void;
|
252 | //# sourceMappingURL=scope.d.ts.map |
\ | No newline at end of file |