UNPKG

5.43 kBTypeScriptView Raw
1import type { Attachment, Breadcrumb, CaptureContext, Client, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, PropagationContext, RequestSession, Scope as ScopeInterface, ScopeData, Session, SeverityLevel, User } from '@sentry/types';
2/**
3 * Holds additional event information.
4 */
5declare class ScopeClass implements ScopeInterface {
6 /** Flag if notifying is happening. */
7 protected _notifyingListeners: boolean;
8 /** Callback for client to receive scope changes. */
9 protected _scopeListeners: Array<(scope: Scope) => void>;
10 /** Callback list that will be called during event processing. */
11 protected _eventProcessors: EventProcessor[];
12 /** Array of breadcrumbs. */
13 protected _breadcrumbs: Breadcrumb[];
14 /** User */
15 protected _user: User;
16 /** Tags */
17 protected _tags: {
18 [key: string]: Primitive;
19 };
20 /** Extra */
21 protected _extra: Extras;
22 /** Contexts */
23 protected _contexts: Contexts;
24 /** Attachments */
25 protected _attachments: Attachment[];
26 /** Propagation Context for distributed tracing */
27 protected _propagationContext: PropagationContext;
28 /**
29 * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
30 * sent to Sentry
31 */
32 protected _sdkProcessingMetadata: {
33 [key: string]: unknown;
34 };
35 /** Fingerprint */
36 protected _fingerprint?: string[];
37 /** Severity */
38 protected _level?: SeverityLevel;
39 /**
40 * Transaction Name
41 *
42 * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.
43 * It's purpose is to assign a transaction to the scope that's added to non-transaction events.
44 */
45 protected _transactionName?: string;
46 /** Session */
47 protected _session?: Session;
48 /** Request Mode Session Status */
49 protected _requestSession?: RequestSession;
50 /** The client on this scope */
51 protected _client?: Client;
52 /** Contains the last event id of a captured event. */
53 protected _lastEventId?: string;
54 constructor();
55 /**
56 * @inheritDoc
57 */
58 clone(): ScopeClass;
59 /**
60 * @inheritDoc
61 */
62 setClient(client: Client | undefined): void;
63 /**
64 * @inheritDoc
65 */
66 setLastEventId(lastEventId: string | undefined): void;
67 /**
68 * @inheritDoc
69 */
70 getClient<C extends Client>(): C | undefined;
71 /**
72 * @inheritDoc
73 */
74 lastEventId(): string | undefined;
75 /**
76 * @inheritDoc
77 */
78 addScopeListener(callback: (scope: Scope) => void): void;
79 /**
80 * @inheritDoc
81 */
82 addEventProcessor(callback: EventProcessor): this;
83 /**
84 * @inheritDoc
85 */
86 setUser(user: User | null): this;
87 /**
88 * @inheritDoc
89 */
90 getUser(): User | undefined;
91 /**
92 * @inheritDoc
93 */
94 getRequestSession(): RequestSession | undefined;
95 /**
96 * @inheritDoc
97 */
98 setRequestSession(requestSession?: RequestSession): this;
99 /**
100 * @inheritDoc
101 */
102 setTags(tags: {
103 [key: string]: Primitive;
104 }): this;
105 /**
106 * @inheritDoc
107 */
108 setTag(key: string, value: Primitive): this;
109 /**
110 * @inheritDoc
111 */
112 setExtras(extras: Extras): this;
113 /**
114 * @inheritDoc
115 */
116 setExtra(key: string, extra: Extra): this;
117 /**
118 * @inheritDoc
119 */
120 setFingerprint(fingerprint: string[]): this;
121 /**
122 * @inheritDoc
123 */
124 setLevel(level: SeverityLevel): this;
125 /**
126 * @inheritDoc
127 */
128 setTransactionName(name?: string): this;
129 /**
130 * @inheritDoc
131 */
132 setContext(key: string, context: Context | null): this;
133 /**
134 * @inheritDoc
135 */
136 setSession(session?: Session): this;
137 /**
138 * @inheritDoc
139 */
140 getSession(): Session | undefined;
141 /**
142 * @inheritDoc
143 */
144 update(captureContext?: CaptureContext): this;
145 /**
146 * @inheritDoc
147 */
148 clear(): this;
149 /**
150 * @inheritDoc
151 */
152 addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
153 /**
154 * @inheritDoc
155 */
156 getLastBreadcrumb(): Breadcrumb | undefined;
157 /**
158 * @inheritDoc
159 */
160 clearBreadcrumbs(): this;
161 /**
162 * @inheritDoc
163 */
164 addAttachment(attachment: Attachment): this;
165 /**
166 * @inheritDoc
167 */
168 clearAttachments(): this;
169 /** @inheritDoc */
170 getScopeData(): ScopeData;
171 /**
172 * @inheritDoc
173 */
174 setSDKProcessingMetadata(newData: {
175 [key: string]: unknown;
176 }): this;
177 /**
178 * @inheritDoc
179 */
180 setPropagationContext(context: PropagationContext): this;
181 /**
182 * @inheritDoc
183 */
184 getPropagationContext(): PropagationContext;
185 /**
186 * @inheritDoc
187 */
188 captureException(exception: unknown, hint?: EventHint): string;
189 /**
190 * @inheritDoc
191 */
192 captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string;
193 /**
194 * @inheritDoc
195 */
196 captureEvent(event: Event, hint?: EventHint): string;
197 /**
198 * This will be called on every set call.
199 */
200 protected _notifyScopeListeners(): void;
201}
202/**
203 * Holds additional event information.
204 */
205export declare const Scope: typeof ScopeClass;
206/**
207 * Holds additional event information.
208 */
209export type Scope = ScopeInterface;
210export {};
211//# sourceMappingURL=scope.d.ts.map
\No newline at end of file