UNPKG

5.53 kBTypeScriptView Raw
1import type { Attachment, Breadcrumb, CaptureContext, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, PropagationContext, RequestSession, Scope as ScopeInterface, Session, Severity, SeverityLevel, Span, Transaction, User } from '@sentry/types';
2/**
3 * Holds additional event information. {@link Scope.applyToEvent} will be
4 * called by the client before an event will be sent.
5 */
6export declare class Scope implements ScopeInterface {
7 /** Flag if notifying is happening. */
8 protected _notifyingListeners: boolean;
9 /** Callback for client to receive scope changes. */
10 protected _scopeListeners: Array<(scope: Scope) => void>;
11 /** Callback list that will be called after {@link applyToEvent}. */
12 protected _eventProcessors: EventProcessor[];
13 /** Array of breadcrumbs. */
14 protected _breadcrumbs: Breadcrumb[];
15 /** User */
16 protected _user: User;
17 /** Tags */
18 protected _tags: {
19 [key: string]: Primitive;
20 };
21 /** Extra */
22 protected _extra: Extras;
23 /** Contexts */
24 protected _contexts: Contexts;
25 /** Attachments */
26 protected _attachments: Attachment[];
27 /** Propagation Context for distributed tracing */
28 protected _propagationContext: PropagationContext;
29 /**
30 * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
31 * sent to Sentry
32 */
33 protected _sdkProcessingMetadata: {
34 [key: string]: unknown;
35 };
36 /** Fingerprint */
37 protected _fingerprint?: string[];
38 /** Severity */
39 protected _level?: Severity | SeverityLevel;
40 /** Transaction Name */
41 protected _transactionName?: string;
42 /** Span */
43 protected _span?: Span;
44 /** Session */
45 protected _session?: Session;
46 /** Request Mode Session Status */
47 protected _requestSession?: RequestSession;
48 constructor();
49 /**
50 * Inherit values from the parent scope.
51 * @param scope to clone.
52 */
53 static clone(scope?: Scope): Scope;
54 /**
55 * Add internal on change listener. Used for sub SDKs that need to store the scope.
56 * @hidden
57 */
58 addScopeListener(callback: (scope: Scope) => void): void;
59 /**
60 * @inheritDoc
61 */
62 addEventProcessor(callback: EventProcessor): this;
63 /**
64 * @inheritDoc
65 */
66 setUser(user: User | null): this;
67 /**
68 * @inheritDoc
69 */
70 getUser(): User | undefined;
71 /**
72 * @inheritDoc
73 */
74 getRequestSession(): RequestSession | undefined;
75 /**
76 * @inheritDoc
77 */
78 setRequestSession(requestSession?: RequestSession): this;
79 /**
80 * @inheritDoc
81 */
82 setTags(tags: {
83 [key: string]: Primitive;
84 }): this;
85 /**
86 * @inheritDoc
87 */
88 setTag(key: string, value: Primitive): this;
89 /**
90 * @inheritDoc
91 */
92 setExtras(extras: Extras): this;
93 /**
94 * @inheritDoc
95 */
96 setExtra(key: string, extra: Extra): this;
97 /**
98 * @inheritDoc
99 */
100 setFingerprint(fingerprint: string[]): this;
101 /**
102 * @inheritDoc
103 */
104 setLevel(level: Severity | SeverityLevel): this;
105 /**
106 * @inheritDoc
107 */
108 setTransactionName(name?: string): this;
109 /**
110 * @inheritDoc
111 */
112 setContext(key: string, context: Context | null): this;
113 /**
114 * @inheritDoc
115 */
116 setSpan(span?: Span): this;
117 /**
118 * @inheritDoc
119 */
120 getSpan(): Span | undefined;
121 /**
122 * @inheritDoc
123 */
124 getTransaction(): Transaction | undefined;
125 /**
126 * @inheritDoc
127 */
128 setSession(session?: Session): this;
129 /**
130 * @inheritDoc
131 */
132 getSession(): Session | undefined;
133 /**
134 * @inheritDoc
135 */
136 update(captureContext?: CaptureContext): this;
137 /**
138 * @inheritDoc
139 */
140 clear(): this;
141 /**
142 * @inheritDoc
143 */
144 addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
145 /**
146 * @inheritDoc
147 */
148 getLastBreadcrumb(): Breadcrumb | undefined;
149 /**
150 * @inheritDoc
151 */
152 clearBreadcrumbs(): this;
153 /**
154 * @inheritDoc
155 */
156 addAttachment(attachment: Attachment): this;
157 /**
158 * @inheritDoc
159 */
160 getAttachments(): Attachment[];
161 /**
162 * @inheritDoc
163 */
164 clearAttachments(): this;
165 /**
166 * Applies data from the scope to the event and runs all event processors on it.
167 *
168 * @param event Event
169 * @param hint Object containing additional information about the original exception, for use by the event processors.
170 * @hidden
171 */
172 applyToEvent(event: Event, hint?: EventHint, additionalEventProcessors?: EventProcessor[]): PromiseLike<Event | null>;
173 /**
174 * Add data which will be accessible during event processing but won't get sent to Sentry
175 */
176 setSDKProcessingMetadata(newData: {
177 [key: string]: unknown;
178 }): this;
179 /**
180 * @inheritDoc
181 */
182 setPropagationContext(context: PropagationContext): this;
183 /**
184 * @inheritDoc
185 */
186 getPropagationContext(): PropagationContext;
187 /**
188 * Get the breadcrumbs for this scope.
189 */
190 protected _getBreadcrumbs(): Breadcrumb[];
191 /**
192 * This will be called on every set call.
193 */
194 protected _notifyScopeListeners(): void;
195 /**
196 * Applies fingerprint from the scope to the event if there's one,
197 * uses message if there's one instead or get rid of empty fingerprint
198 */
199 private _applyFingerprint;
200}
201//# sourceMappingURL=scope.d.ts.map
\No newline at end of file