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 | * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
|
40 | * sent to Sentry
|
41 | */
|
42 | protected _sdkProcessingMetadata?: {
|
43 | [key: string]: unknown;
|
44 | };
|
45 | /**
|
46 | * Inherit values from the parent scope.
|
47 | * @param scope to clone.
|
48 | */
|
49 | static clone(scope?: Scope): Scope;
|
50 | /**
|
51 | * Add internal on change listener. Used for sub SDKs that need to store the scope.
|
52 | * @hidden
|
53 | */
|
54 | addScopeListener(callback: (scope: Scope) => void): void;
|
55 | /**
|
56 | * @inheritDoc
|
57 | */
|
58 | addEventProcessor(callback: EventProcessor): this;
|
59 | /**
|
60 | * @inheritDoc
|
61 | */
|
62 | setUser(user: User | null): this;
|
63 | /**
|
64 | * @inheritDoc
|
65 | */
|
66 | getUser(): User | undefined;
|
67 | /**
|
68 | * @inheritDoc
|
69 | */
|
70 | getRequestSession(): RequestSession | undefined;
|
71 | /**
|
72 | * @inheritDoc
|
73 | */
|
74 | setRequestSession(requestSession?: RequestSession): this;
|
75 | /**
|
76 | * @inheritDoc
|
77 | */
|
78 | setTags(tags: {
|
79 | [key: string]: Primitive;
|
80 | }): this;
|
81 | /**
|
82 | * @inheritDoc
|
83 | */
|
84 | setTag(key: string, value: Primitive): this;
|
85 | /**
|
86 | * @inheritDoc
|
87 | */
|
88 | setExtras(extras: Extras): this;
|
89 | /**
|
90 | * @inheritDoc
|
91 | */
|
92 | setExtra(key: string, extra: Extra): this;
|
93 | /**
|
94 | * @inheritDoc
|
95 | */
|
96 | setFingerprint(fingerprint: string[]): this;
|
97 | /**
|
98 | * @inheritDoc
|
99 | */
|
100 | setLevel(level: Severity): this;
|
101 | /**
|
102 | * @inheritDoc
|
103 | */
|
104 | setTransactionName(name?: string): this;
|
105 | /**
|
106 | * Can be removed in major version.
|
107 | * @deprecated in favor of {@link this.setTransactionName}
|
108 | */
|
109 | setTransaction(name?: string): this;
|
110 | /**
|
111 | * @inheritDoc
|
112 | */
|
113 | setContext(key: string, context: Context | null): this;
|
114 | /**
|
115 | * @inheritDoc
|
116 | */
|
117 | setSpan(span?: Span): this;
|
118 | /**
|
119 | * @inheritDoc
|
120 | */
|
121 | getSpan(): Span | undefined;
|
122 | /**
|
123 | * @inheritDoc
|
124 | */
|
125 | getTransaction(): Transaction | undefined;
|
126 | /**
|
127 | * @inheritDoc
|
128 | */
|
129 | setSession(session?: Session): this;
|
130 | /**
|
131 | * @inheritDoc
|
132 | */
|
133 | getSession(): Session | undefined;
|
134 | /**
|
135 | * @inheritDoc
|
136 | */
|
137 | update(captureContext?: CaptureContext): this;
|
138 | /**
|
139 | * @inheritDoc
|
140 | */
|
141 | clear(): this;
|
142 | /**
|
143 | * @inheritDoc
|
144 | */
|
145 | addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
|
146 | /**
|
147 | * @inheritDoc
|
148 | */
|
149 | clearBreadcrumbs(): this;
|
150 | /**
|
151 | * Applies the current context and fingerprint to the event.
|
152 | * Note that breadcrumbs will be added by the client.
|
153 | * Also if the event has already breadcrumbs on it, we do not merge them.
|
154 | * @param event Event
|
155 | * @param hint May contain additional information about the original exception.
|
156 | * @hidden
|
157 | */
|
158 | applyToEvent(event: Event, hint?: EventHint): PromiseLike<Event | null>;
|
159 | /**
|
160 | * Add data which will be accessible during event processing but won't get sent to Sentry
|
161 | */
|
162 | setSDKProcessingMetadata(newData: {
|
163 | [key: string]: unknown;
|
164 | }): this;
|
165 | /**
|
166 | * This will be called after {@link applyToEvent} is finished.
|
167 | */
|
168 | protected _notifyEventProcessors(processors: EventProcessor[], event: Event | null, hint?: EventHint, index?: number): PromiseLike<Event | null>;
|
169 | /**
|
170 | * This will be called on every set call.
|
171 | */
|
172 | protected _notifyScopeListeners(): void;
|
173 | /**
|
174 | * Applies fingerprint from the scope to the event if there's one,
|
175 | * uses message if there's one instead or get rid of empty fingerprint
|
176 | */
|
177 | private _applyFingerprint;
|
178 | }
|
179 | /**
|
180 | * Add a EventProcessor to be kept globally.
|
181 | * @param callback EventProcessor to add
|
182 | */
|
183 | export declare function addGlobalEventProcessor(callback: EventProcessor): void;
|
184 | //# sourceMappingURL=scope.d.ts.map |
\ | No newline at end of file |