@slicemachine/manager 0.26.3-beta.1 → 0.26.3-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.cjs +6 -6
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js +4 -4
- package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.cjs +4 -4
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.cjs.map +1 -1
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js +4 -4
- package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js.map +1 -1
- package/dist/errors.cjs +7 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +5 -1
- package/dist/errors.js +7 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/managers/customTypes/CustomTypesManager.cjs +17 -7
- package/dist/managers/customTypes/CustomTypesManager.cjs.map +1 -1
- package/dist/managers/customTypes/CustomTypesManager.js +19 -9
- package/dist/managers/customTypes/CustomTypesManager.js.map +1 -1
- package/package.json +2 -2
- package/src/errors.ts +12 -1
- package/src/index.ts +1 -0
- package/src/managers/customTypes/CustomTypesManager.ts +29 -18
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.cjs +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.js +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/constants.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.cjs +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.js +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/debug-build.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.cjs +0 -29
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.js +0 -29
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/eventProcessors.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.cjs +0 -17
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.js +0 -17
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/exports.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.cjs +0 -535
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.js +0 -535
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/hub.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.cjs +0 -545
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.js +0 -545
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/scope.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.cjs +0 -109
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.js +0 -109
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/session.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.cjs +0 -50
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js +0 -50
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.cjs +0 -85
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js +0 -85
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.cjs +0 -7
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.js +0 -7
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/getRootSpan.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.cjs +0 -35
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.js +0 -35
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/prepareEvent.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.cjs +0 -39
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.js +0 -39
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/utils/spanUtils.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.cjs +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.js +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/core/esm/version.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.cjs +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.js +0 -5
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/debug-build.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.cjs +0 -15
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.js +0 -15
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/is.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.cjs +0 -69
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.js +0 -69
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/logger.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.cjs +0 -34
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.js +0 -34
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/misc.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.cjs +0 -49
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.js +0 -49
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/object.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.cjs +0 -142
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.js +0 -142
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/syncpromise.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.cjs +0 -45
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.js +0 -45
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/time.js.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.cjs +0 -18
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.cjs.map +0 -1
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.js +0 -18
- package/dist/_node_modules/@sentry/node/_node_modules/@sentry/utils/esm/worldwide.js.map +0 -1
- package/dist/lib/checkIsSentryEnabled.d.ts +0 -9
- package/dist/lib/sentryErrorHandlers.cjs +0 -10
- package/dist/lib/sentryErrorHandlers.cjs.map +0 -1
- package/dist/lib/sentryErrorHandlers.d.ts +0 -1
- package/dist/lib/sentryErrorHandlers.js +0 -10
- package/dist/lib/sentryErrorHandlers.js.map +0 -1
- package/src/lib/checkIsSentryEnabled.ts +0 -12
- package/src/lib/sentryErrorHandlers.ts +0 -13
|
@@ -1,545 +0,0 @@
|
|
|
1
|
-
import { getGlobalEventProcessors, notifyEventProcessors } from "./eventProcessors.js";
|
|
2
|
-
import { updateSession } from "./session.js";
|
|
3
|
-
import { applyScopeDataToEvent } from "./utils/applyScopeDataToEvent.js";
|
|
4
|
-
import { isPlainObject } from "../../utils/esm/is.js";
|
|
5
|
-
import { dateTimestampInSeconds } from "../../utils/esm/time.js";
|
|
6
|
-
import { uuid4 } from "../../utils/esm/misc.js";
|
|
7
|
-
import { logger } from "../../utils/esm/logger.js";
|
|
8
|
-
const DEFAULT_MAX_BREADCRUMBS = 100;
|
|
9
|
-
class Scope {
|
|
10
|
-
/** Flag if notifying is happening. */
|
|
11
|
-
/** Callback for client to receive scope changes. */
|
|
12
|
-
/** Callback list that will be called after {@link applyToEvent}. */
|
|
13
|
-
/** Array of breadcrumbs. */
|
|
14
|
-
/** User */
|
|
15
|
-
/** Tags */
|
|
16
|
-
/** Extra */
|
|
17
|
-
/** Contexts */
|
|
18
|
-
/** Attachments */
|
|
19
|
-
/** Propagation Context for distributed tracing */
|
|
20
|
-
/**
|
|
21
|
-
* A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
|
|
22
|
-
* sent to Sentry
|
|
23
|
-
*/
|
|
24
|
-
/** Fingerprint */
|
|
25
|
-
/** Severity */
|
|
26
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
27
|
-
/**
|
|
28
|
-
* Transaction Name
|
|
29
|
-
*/
|
|
30
|
-
/** Span */
|
|
31
|
-
/** Session */
|
|
32
|
-
/** Request Mode Session Status */
|
|
33
|
-
/** The client on this scope */
|
|
34
|
-
// NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.
|
|
35
|
-
constructor() {
|
|
36
|
-
this._notifyingListeners = false;
|
|
37
|
-
this._scopeListeners = [];
|
|
38
|
-
this._eventProcessors = [];
|
|
39
|
-
this._breadcrumbs = [];
|
|
40
|
-
this._attachments = [];
|
|
41
|
-
this._user = {};
|
|
42
|
-
this._tags = {};
|
|
43
|
-
this._extra = {};
|
|
44
|
-
this._contexts = {};
|
|
45
|
-
this._sdkProcessingMetadata = {};
|
|
46
|
-
this._propagationContext = generatePropagationContext();
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Inherit values from the parent scope.
|
|
50
|
-
* @deprecated Use `scope.clone()` and `new Scope()` instead.
|
|
51
|
-
*/
|
|
52
|
-
static clone(scope) {
|
|
53
|
-
return scope ? scope.clone() : new Scope();
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Clone this scope instance.
|
|
57
|
-
*/
|
|
58
|
-
clone() {
|
|
59
|
-
const newScope = new Scope();
|
|
60
|
-
newScope._breadcrumbs = [...this._breadcrumbs];
|
|
61
|
-
newScope._tags = { ...this._tags };
|
|
62
|
-
newScope._extra = { ...this._extra };
|
|
63
|
-
newScope._contexts = { ...this._contexts };
|
|
64
|
-
newScope._user = this._user;
|
|
65
|
-
newScope._level = this._level;
|
|
66
|
-
newScope._span = this._span;
|
|
67
|
-
newScope._session = this._session;
|
|
68
|
-
newScope._transactionName = this._transactionName;
|
|
69
|
-
newScope._fingerprint = this._fingerprint;
|
|
70
|
-
newScope._eventProcessors = [...this._eventProcessors];
|
|
71
|
-
newScope._requestSession = this._requestSession;
|
|
72
|
-
newScope._attachments = [...this._attachments];
|
|
73
|
-
newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };
|
|
74
|
-
newScope._propagationContext = { ...this._propagationContext };
|
|
75
|
-
newScope._client = this._client;
|
|
76
|
-
return newScope;
|
|
77
|
-
}
|
|
78
|
-
/** Update the client on the scope. */
|
|
79
|
-
setClient(client) {
|
|
80
|
-
this._client = client;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get the client assigned to this scope.
|
|
84
|
-
*
|
|
85
|
-
* It is generally recommended to use the global function `Sentry.getClient()` instead, unless you know what you are doing.
|
|
86
|
-
*/
|
|
87
|
-
getClient() {
|
|
88
|
-
return this._client;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Add internal on change listener. Used for sub SDKs that need to store the scope.
|
|
92
|
-
* @hidden
|
|
93
|
-
*/
|
|
94
|
-
addScopeListener(callback) {
|
|
95
|
-
this._scopeListeners.push(callback);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* @inheritDoc
|
|
99
|
-
*/
|
|
100
|
-
addEventProcessor(callback) {
|
|
101
|
-
this._eventProcessors.push(callback);
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* @inheritDoc
|
|
106
|
-
*/
|
|
107
|
-
setUser(user) {
|
|
108
|
-
this._user = user || {
|
|
109
|
-
email: void 0,
|
|
110
|
-
id: void 0,
|
|
111
|
-
ip_address: void 0,
|
|
112
|
-
segment: void 0,
|
|
113
|
-
username: void 0
|
|
114
|
-
};
|
|
115
|
-
if (this._session) {
|
|
116
|
-
updateSession(this._session, { user });
|
|
117
|
-
}
|
|
118
|
-
this._notifyScopeListeners();
|
|
119
|
-
return this;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* @inheritDoc
|
|
123
|
-
*/
|
|
124
|
-
getUser() {
|
|
125
|
-
return this._user;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @inheritDoc
|
|
129
|
-
*/
|
|
130
|
-
getRequestSession() {
|
|
131
|
-
return this._requestSession;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* @inheritDoc
|
|
135
|
-
*/
|
|
136
|
-
setRequestSession(requestSession) {
|
|
137
|
-
this._requestSession = requestSession;
|
|
138
|
-
return this;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* @inheritDoc
|
|
142
|
-
*/
|
|
143
|
-
setTags(tags) {
|
|
144
|
-
this._tags = {
|
|
145
|
-
...this._tags,
|
|
146
|
-
...tags
|
|
147
|
-
};
|
|
148
|
-
this._notifyScopeListeners();
|
|
149
|
-
return this;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* @inheritDoc
|
|
153
|
-
*/
|
|
154
|
-
setTag(key, value) {
|
|
155
|
-
this._tags = { ...this._tags, [key]: value };
|
|
156
|
-
this._notifyScopeListeners();
|
|
157
|
-
return this;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* @inheritDoc
|
|
161
|
-
*/
|
|
162
|
-
setExtras(extras) {
|
|
163
|
-
this._extra = {
|
|
164
|
-
...this._extra,
|
|
165
|
-
...extras
|
|
166
|
-
};
|
|
167
|
-
this._notifyScopeListeners();
|
|
168
|
-
return this;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* @inheritDoc
|
|
172
|
-
*/
|
|
173
|
-
setExtra(key, extra) {
|
|
174
|
-
this._extra = { ...this._extra, [key]: extra };
|
|
175
|
-
this._notifyScopeListeners();
|
|
176
|
-
return this;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* @inheritDoc
|
|
180
|
-
*/
|
|
181
|
-
setFingerprint(fingerprint) {
|
|
182
|
-
this._fingerprint = fingerprint;
|
|
183
|
-
this._notifyScopeListeners();
|
|
184
|
-
return this;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* @inheritDoc
|
|
188
|
-
*/
|
|
189
|
-
setLevel(level) {
|
|
190
|
-
this._level = level;
|
|
191
|
-
this._notifyScopeListeners();
|
|
192
|
-
return this;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Sets the transaction name on the scope for future events.
|
|
196
|
-
*/
|
|
197
|
-
setTransactionName(name) {
|
|
198
|
-
this._transactionName = name;
|
|
199
|
-
this._notifyScopeListeners();
|
|
200
|
-
return this;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* @inheritDoc
|
|
204
|
-
*/
|
|
205
|
-
setContext(key, context) {
|
|
206
|
-
if (context === null) {
|
|
207
|
-
delete this._contexts[key];
|
|
208
|
-
} else {
|
|
209
|
-
this._contexts[key] = context;
|
|
210
|
-
}
|
|
211
|
-
this._notifyScopeListeners();
|
|
212
|
-
return this;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Sets the Span on the scope.
|
|
216
|
-
* @param span Span
|
|
217
|
-
* @deprecated Instead of setting a span on a scope, use `startSpan()`/`startSpanManual()` instead.
|
|
218
|
-
*/
|
|
219
|
-
setSpan(span) {
|
|
220
|
-
this._span = span;
|
|
221
|
-
this._notifyScopeListeners();
|
|
222
|
-
return this;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Returns the `Span` if there is one.
|
|
226
|
-
* @deprecated Use `getActiveSpan()` instead.
|
|
227
|
-
*/
|
|
228
|
-
getSpan() {
|
|
229
|
-
return this._span;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Returns the `Transaction` attached to the scope (if there is one).
|
|
233
|
-
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
|
|
234
|
-
*/
|
|
235
|
-
getTransaction() {
|
|
236
|
-
const span = this._span;
|
|
237
|
-
return span && span.transaction;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* @inheritDoc
|
|
241
|
-
*/
|
|
242
|
-
setSession(session) {
|
|
243
|
-
if (!session) {
|
|
244
|
-
delete this._session;
|
|
245
|
-
} else {
|
|
246
|
-
this._session = session;
|
|
247
|
-
}
|
|
248
|
-
this._notifyScopeListeners();
|
|
249
|
-
return this;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* @inheritDoc
|
|
253
|
-
*/
|
|
254
|
-
getSession() {
|
|
255
|
-
return this._session;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* @inheritDoc
|
|
259
|
-
*/
|
|
260
|
-
update(captureContext) {
|
|
261
|
-
if (!captureContext) {
|
|
262
|
-
return this;
|
|
263
|
-
}
|
|
264
|
-
const scopeToMerge = typeof captureContext === "function" ? captureContext(this) : captureContext;
|
|
265
|
-
if (scopeToMerge instanceof Scope) {
|
|
266
|
-
const scopeData = scopeToMerge.getScopeData();
|
|
267
|
-
this._tags = { ...this._tags, ...scopeData.tags };
|
|
268
|
-
this._extra = { ...this._extra, ...scopeData.extra };
|
|
269
|
-
this._contexts = { ...this._contexts, ...scopeData.contexts };
|
|
270
|
-
if (scopeData.user && Object.keys(scopeData.user).length) {
|
|
271
|
-
this._user = scopeData.user;
|
|
272
|
-
}
|
|
273
|
-
if (scopeData.level) {
|
|
274
|
-
this._level = scopeData.level;
|
|
275
|
-
}
|
|
276
|
-
if (scopeData.fingerprint.length) {
|
|
277
|
-
this._fingerprint = scopeData.fingerprint;
|
|
278
|
-
}
|
|
279
|
-
if (scopeToMerge.getRequestSession()) {
|
|
280
|
-
this._requestSession = scopeToMerge.getRequestSession();
|
|
281
|
-
}
|
|
282
|
-
if (scopeData.propagationContext) {
|
|
283
|
-
this._propagationContext = scopeData.propagationContext;
|
|
284
|
-
}
|
|
285
|
-
} else if (isPlainObject(scopeToMerge)) {
|
|
286
|
-
const scopeContext = captureContext;
|
|
287
|
-
this._tags = { ...this._tags, ...scopeContext.tags };
|
|
288
|
-
this._extra = { ...this._extra, ...scopeContext.extra };
|
|
289
|
-
this._contexts = { ...this._contexts, ...scopeContext.contexts };
|
|
290
|
-
if (scopeContext.user) {
|
|
291
|
-
this._user = scopeContext.user;
|
|
292
|
-
}
|
|
293
|
-
if (scopeContext.level) {
|
|
294
|
-
this._level = scopeContext.level;
|
|
295
|
-
}
|
|
296
|
-
if (scopeContext.fingerprint) {
|
|
297
|
-
this._fingerprint = scopeContext.fingerprint;
|
|
298
|
-
}
|
|
299
|
-
if (scopeContext.requestSession) {
|
|
300
|
-
this._requestSession = scopeContext.requestSession;
|
|
301
|
-
}
|
|
302
|
-
if (scopeContext.propagationContext) {
|
|
303
|
-
this._propagationContext = scopeContext.propagationContext;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
return this;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* @inheritDoc
|
|
310
|
-
*/
|
|
311
|
-
clear() {
|
|
312
|
-
this._breadcrumbs = [];
|
|
313
|
-
this._tags = {};
|
|
314
|
-
this._extra = {};
|
|
315
|
-
this._user = {};
|
|
316
|
-
this._contexts = {};
|
|
317
|
-
this._level = void 0;
|
|
318
|
-
this._transactionName = void 0;
|
|
319
|
-
this._fingerprint = void 0;
|
|
320
|
-
this._requestSession = void 0;
|
|
321
|
-
this._span = void 0;
|
|
322
|
-
this._session = void 0;
|
|
323
|
-
this._notifyScopeListeners();
|
|
324
|
-
this._attachments = [];
|
|
325
|
-
this._propagationContext = generatePropagationContext();
|
|
326
|
-
return this;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* @inheritDoc
|
|
330
|
-
*/
|
|
331
|
-
addBreadcrumb(breadcrumb, maxBreadcrumbs) {
|
|
332
|
-
const maxCrumbs = typeof maxBreadcrumbs === "number" ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;
|
|
333
|
-
if (maxCrumbs <= 0) {
|
|
334
|
-
return this;
|
|
335
|
-
}
|
|
336
|
-
const mergedBreadcrumb = {
|
|
337
|
-
timestamp: dateTimestampInSeconds(),
|
|
338
|
-
...breadcrumb
|
|
339
|
-
};
|
|
340
|
-
const breadcrumbs = this._breadcrumbs;
|
|
341
|
-
breadcrumbs.push(mergedBreadcrumb);
|
|
342
|
-
this._breadcrumbs = breadcrumbs.length > maxCrumbs ? breadcrumbs.slice(-maxCrumbs) : breadcrumbs;
|
|
343
|
-
this._notifyScopeListeners();
|
|
344
|
-
return this;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* @inheritDoc
|
|
348
|
-
*/
|
|
349
|
-
getLastBreadcrumb() {
|
|
350
|
-
return this._breadcrumbs[this._breadcrumbs.length - 1];
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* @inheritDoc
|
|
354
|
-
*/
|
|
355
|
-
clearBreadcrumbs() {
|
|
356
|
-
this._breadcrumbs = [];
|
|
357
|
-
this._notifyScopeListeners();
|
|
358
|
-
return this;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* @inheritDoc
|
|
362
|
-
*/
|
|
363
|
-
addAttachment(attachment) {
|
|
364
|
-
this._attachments.push(attachment);
|
|
365
|
-
return this;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* @inheritDoc
|
|
369
|
-
* @deprecated Use `getScopeData()` instead.
|
|
370
|
-
*/
|
|
371
|
-
getAttachments() {
|
|
372
|
-
const data = this.getScopeData();
|
|
373
|
-
return data.attachments;
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* @inheritDoc
|
|
377
|
-
*/
|
|
378
|
-
clearAttachments() {
|
|
379
|
-
this._attachments = [];
|
|
380
|
-
return this;
|
|
381
|
-
}
|
|
382
|
-
/** @inheritDoc */
|
|
383
|
-
getScopeData() {
|
|
384
|
-
const {
|
|
385
|
-
_breadcrumbs,
|
|
386
|
-
_attachments,
|
|
387
|
-
_contexts,
|
|
388
|
-
_tags,
|
|
389
|
-
_extra,
|
|
390
|
-
_user,
|
|
391
|
-
_level,
|
|
392
|
-
_fingerprint,
|
|
393
|
-
_eventProcessors,
|
|
394
|
-
_propagationContext,
|
|
395
|
-
_sdkProcessingMetadata,
|
|
396
|
-
_transactionName,
|
|
397
|
-
_span
|
|
398
|
-
} = this;
|
|
399
|
-
return {
|
|
400
|
-
breadcrumbs: _breadcrumbs,
|
|
401
|
-
attachments: _attachments,
|
|
402
|
-
contexts: _contexts,
|
|
403
|
-
tags: _tags,
|
|
404
|
-
extra: _extra,
|
|
405
|
-
user: _user,
|
|
406
|
-
level: _level,
|
|
407
|
-
fingerprint: _fingerprint || [],
|
|
408
|
-
eventProcessors: _eventProcessors,
|
|
409
|
-
propagationContext: _propagationContext,
|
|
410
|
-
sdkProcessingMetadata: _sdkProcessingMetadata,
|
|
411
|
-
transactionName: _transactionName,
|
|
412
|
-
span: _span
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* Applies data from the scope to the event and runs all event processors on it.
|
|
417
|
-
*
|
|
418
|
-
* @param event Event
|
|
419
|
-
* @param hint Object containing additional information about the original exception, for use by the event processors.
|
|
420
|
-
* @hidden
|
|
421
|
-
* @deprecated Use `applyScopeDataToEvent()` directly
|
|
422
|
-
*/
|
|
423
|
-
applyToEvent(event, hint = {}, additionalEventProcessors = []) {
|
|
424
|
-
applyScopeDataToEvent(event, this.getScopeData());
|
|
425
|
-
const eventProcessors = [
|
|
426
|
-
...additionalEventProcessors,
|
|
427
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
428
|
-
...getGlobalEventProcessors(),
|
|
429
|
-
...this._eventProcessors
|
|
430
|
-
];
|
|
431
|
-
return notifyEventProcessors(eventProcessors, event, hint);
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Add data which will be accessible during event processing but won't get sent to Sentry
|
|
435
|
-
*/
|
|
436
|
-
setSDKProcessingMetadata(newData) {
|
|
437
|
-
this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...newData };
|
|
438
|
-
return this;
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* @inheritDoc
|
|
442
|
-
*/
|
|
443
|
-
setPropagationContext(context) {
|
|
444
|
-
this._propagationContext = context;
|
|
445
|
-
return this;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* @inheritDoc
|
|
449
|
-
*/
|
|
450
|
-
getPropagationContext() {
|
|
451
|
-
return this._propagationContext;
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Capture an exception for this scope.
|
|
455
|
-
*
|
|
456
|
-
* @param exception The exception to capture.
|
|
457
|
-
* @param hint Optinal additional data to attach to the Sentry event.
|
|
458
|
-
* @returns the id of the captured Sentry event.
|
|
459
|
-
*/
|
|
460
|
-
captureException(exception, hint) {
|
|
461
|
-
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
|
|
462
|
-
if (!this._client) {
|
|
463
|
-
logger.warn("No client configured on scope - will not capture exception!");
|
|
464
|
-
return eventId;
|
|
465
|
-
}
|
|
466
|
-
const syntheticException = new Error("Sentry syntheticException");
|
|
467
|
-
this._client.captureException(
|
|
468
|
-
exception,
|
|
469
|
-
{
|
|
470
|
-
originalException: exception,
|
|
471
|
-
syntheticException,
|
|
472
|
-
...hint,
|
|
473
|
-
event_id: eventId
|
|
474
|
-
},
|
|
475
|
-
this
|
|
476
|
-
);
|
|
477
|
-
return eventId;
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Capture a message for this scope.
|
|
481
|
-
*
|
|
482
|
-
* @param message The message to capture.
|
|
483
|
-
* @param level An optional severity level to report the message with.
|
|
484
|
-
* @param hint Optional additional data to attach to the Sentry event.
|
|
485
|
-
* @returns the id of the captured message.
|
|
486
|
-
*/
|
|
487
|
-
captureMessage(message, level, hint) {
|
|
488
|
-
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
|
|
489
|
-
if (!this._client) {
|
|
490
|
-
logger.warn("No client configured on scope - will not capture message!");
|
|
491
|
-
return eventId;
|
|
492
|
-
}
|
|
493
|
-
const syntheticException = new Error(message);
|
|
494
|
-
this._client.captureMessage(
|
|
495
|
-
message,
|
|
496
|
-
level,
|
|
497
|
-
{
|
|
498
|
-
originalException: message,
|
|
499
|
-
syntheticException,
|
|
500
|
-
...hint,
|
|
501
|
-
event_id: eventId
|
|
502
|
-
},
|
|
503
|
-
this
|
|
504
|
-
);
|
|
505
|
-
return eventId;
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Captures a manually created event for this scope and sends it to Sentry.
|
|
509
|
-
*
|
|
510
|
-
* @param exception The event to capture.
|
|
511
|
-
* @param hint Optional additional data to attach to the Sentry event.
|
|
512
|
-
* @returns the id of the captured event.
|
|
513
|
-
*/
|
|
514
|
-
captureEvent(event, hint) {
|
|
515
|
-
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
|
|
516
|
-
if (!this._client) {
|
|
517
|
-
logger.warn("No client configured on scope - will not capture event!");
|
|
518
|
-
return eventId;
|
|
519
|
-
}
|
|
520
|
-
this._client.captureEvent(event, { ...hint, event_id: eventId }, this);
|
|
521
|
-
return eventId;
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* This will be called on every set call.
|
|
525
|
-
*/
|
|
526
|
-
_notifyScopeListeners() {
|
|
527
|
-
if (!this._notifyingListeners) {
|
|
528
|
-
this._notifyingListeners = true;
|
|
529
|
-
this._scopeListeners.forEach((callback) => {
|
|
530
|
-
callback(this);
|
|
531
|
-
});
|
|
532
|
-
this._notifyingListeners = false;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
function generatePropagationContext() {
|
|
537
|
-
return {
|
|
538
|
-
traceId: uuid4(),
|
|
539
|
-
spanId: uuid4().substring(16)
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
export {
|
|
543
|
-
Scope
|
|
544
|
-
};
|
|
545
|
-
//# sourceMappingURL=scope.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sources":["../../../../../../../../../../node_modules/@sentry/node/node_modules/@sentry/core/esm/scope.js"],"sourcesContent":["import { isPlainObject, dateTimestampInSeconds, uuid4, logger } from '@sentry/utils';\nimport { getGlobalEventProcessors, notifyEventProcessors } from './eventProcessors.js';\nimport { updateSession } from './session.js';\nimport { applyScopeDataToEvent } from './utils/applyScopeDataToEvent.js';\n\n/**\n * Default value for maximum number of breadcrumbs added to an event.\n */\nconst DEFAULT_MAX_BREADCRUMBS = 100;\n\n/**\n * The global scope is kept in this module.\n * When accessing this via `getGlobalScope()` we'll make sure to set one if none is currently present.\n */\nlet globalScope;\n\n/**\n * Holds additional event information. {@link Scope.applyToEvent} will be\n * called by the client before an event will be sent.\n */\nclass Scope {\n /** Flag if notifying is happening. */\n\n /** Callback for client to receive scope changes. */\n\n /** Callback list that will be called after {@link applyToEvent}. */\n\n /** Array of breadcrumbs. */\n\n /** User */\n\n /** Tags */\n\n /** Extra */\n\n /** Contexts */\n\n /** Attachments */\n\n /** Propagation Context for distributed tracing */\n\n /**\n * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get\n * sent to Sentry\n */\n\n /** Fingerprint */\n\n /** Severity */\n // eslint-disable-next-line deprecation/deprecation\n\n /**\n * Transaction Name\n */\n\n /** Span */\n\n /** Session */\n\n /** Request Mode Session Status */\n\n /** The client on this scope */\n\n // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.\n\n constructor() {\n this._notifyingListeners = false;\n this._scopeListeners = [];\n this._eventProcessors = [];\n this._breadcrumbs = [];\n this._attachments = [];\n this._user = {};\n this._tags = {};\n this._extra = {};\n this._contexts = {};\n this._sdkProcessingMetadata = {};\n this._propagationContext = generatePropagationContext();\n }\n\n /**\n * Inherit values from the parent scope.\n * @deprecated Use `scope.clone()` and `new Scope()` instead.\n */\n static clone(scope) {\n return scope ? scope.clone() : new Scope();\n }\n\n /**\n * Clone this scope instance.\n */\n clone() {\n const newScope = new Scope();\n newScope._breadcrumbs = [...this._breadcrumbs];\n newScope._tags = { ...this._tags };\n newScope._extra = { ...this._extra };\n newScope._contexts = { ...this._contexts };\n newScope._user = this._user;\n newScope._level = this._level;\n newScope._span = this._span;\n newScope._session = this._session;\n newScope._transactionName = this._transactionName;\n newScope._fingerprint = this._fingerprint;\n newScope._eventProcessors = [...this._eventProcessors];\n newScope._requestSession = this._requestSession;\n newScope._attachments = [...this._attachments];\n newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };\n newScope._propagationContext = { ...this._propagationContext };\n newScope._client = this._client;\n\n return newScope;\n }\n\n /** Update the client on the scope. */\n setClient(client) {\n this._client = client;\n }\n\n /**\n * Get the client assigned to this scope.\n *\n * It is generally recommended to use the global function `Sentry.getClient()` instead, unless you know what you are doing.\n */\n getClient() {\n return this._client;\n }\n\n /**\n * Add internal on change listener. Used for sub SDKs that need to store the scope.\n * @hidden\n */\n addScopeListener(callback) {\n this._scopeListeners.push(callback);\n }\n\n /**\n * @inheritDoc\n */\n addEventProcessor(callback) {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setUser(user) {\n // If null is passed we want to unset everything, but still define keys,\n // so that later down in the pipeline any existing values are cleared.\n this._user = user || {\n email: undefined,\n id: undefined,\n ip_address: undefined,\n segment: undefined,\n username: undefined,\n };\n\n if (this._session) {\n updateSession(this._session, { user });\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n getUser() {\n return this._user;\n }\n\n /**\n * @inheritDoc\n */\n getRequestSession() {\n return this._requestSession;\n }\n\n /**\n * @inheritDoc\n */\n setRequestSession(requestSession) {\n this._requestSession = requestSession;\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setTags(tags) {\n this._tags = {\n ...this._tags,\n ...tags,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setTag(key, value) {\n this._tags = { ...this._tags, [key]: value };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setExtras(extras) {\n this._extra = {\n ...this._extra,\n ...extras,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setExtra(key, extra) {\n this._extra = { ...this._extra, [key]: extra };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setFingerprint(fingerprint) {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setLevel(\n // eslint-disable-next-line deprecation/deprecation\n level,\n ) {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the transaction name on the scope for future events.\n */\n setTransactionName(name) {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setContext(key, context) {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts[key] = context;\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the Span on the scope.\n * @param span Span\n * @deprecated Instead of setting a span on a scope, use `startSpan()`/`startSpanManual()` instead.\n */\n setSpan(span) {\n this._span = span;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Returns the `Span` if there is one.\n * @deprecated Use `getActiveSpan()` instead.\n */\n getSpan() {\n return this._span;\n }\n\n /**\n * Returns the `Transaction` attached to the scope (if there is one).\n * @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.\n */\n getTransaction() {\n // Often, this span (if it exists at all) will be a transaction, but it's not guaranteed to be. Regardless, it will\n // have a pointer to the currently-active transaction.\n const span = this._span;\n // Cannot replace with getRootSpan because getRootSpan returns a span, not a transaction\n // Also, this method will be removed anyway.\n // eslint-disable-next-line deprecation/deprecation\n return span && span.transaction;\n }\n\n /**\n * @inheritDoc\n */\n setSession(session) {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n getSession() {\n return this._session;\n }\n\n /**\n * @inheritDoc\n */\n update(captureContext) {\n if (!captureContext) {\n return this;\n }\n\n const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;\n\n if (scopeToMerge instanceof Scope) {\n const scopeData = scopeToMerge.getScopeData();\n\n this._tags = { ...this._tags, ...scopeData.tags };\n this._extra = { ...this._extra, ...scopeData.extra };\n this._contexts = { ...this._contexts, ...scopeData.contexts };\n if (scopeData.user && Object.keys(scopeData.user).length) {\n this._user = scopeData.user;\n }\n if (scopeData.level) {\n this._level = scopeData.level;\n }\n if (scopeData.fingerprint.length) {\n this._fingerprint = scopeData.fingerprint;\n }\n if (scopeToMerge.getRequestSession()) {\n this._requestSession = scopeToMerge.getRequestSession();\n }\n if (scopeData.propagationContext) {\n this._propagationContext = scopeData.propagationContext;\n }\n } else if (isPlainObject(scopeToMerge)) {\n const scopeContext = captureContext ;\n this._tags = { ...this._tags, ...scopeContext.tags };\n this._extra = { ...this._extra, ...scopeContext.extra };\n this._contexts = { ...this._contexts, ...scopeContext.contexts };\n if (scopeContext.user) {\n this._user = scopeContext.user;\n }\n if (scopeContext.level) {\n this._level = scopeContext.level;\n }\n if (scopeContext.fingerprint) {\n this._fingerprint = scopeContext.fingerprint;\n }\n if (scopeContext.requestSession) {\n this._requestSession = scopeContext.requestSession;\n }\n if (scopeContext.propagationContext) {\n this._propagationContext = scopeContext.propagationContext;\n }\n }\n\n return this;\n }\n\n /**\n * @inheritDoc\n */\n clear() {\n this._breadcrumbs = [];\n this._tags = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._requestSession = undefined;\n this._span = undefined;\n this._session = undefined;\n this._notifyScopeListeners();\n this._attachments = [];\n this._propagationContext = generatePropagationContext();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n addBreadcrumb(breadcrumb, maxBreadcrumbs) {\n const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;\n\n // No data has been changed, so don't notify scope listeners\n if (maxCrumbs <= 0) {\n return this;\n }\n\n const mergedBreadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb,\n };\n\n const breadcrumbs = this._breadcrumbs;\n breadcrumbs.push(mergedBreadcrumb);\n this._breadcrumbs = breadcrumbs.length > maxCrumbs ? breadcrumbs.slice(-maxCrumbs) : breadcrumbs;\n\n this._notifyScopeListeners();\n\n return this;\n }\n\n /**\n * @inheritDoc\n */\n getLastBreadcrumb() {\n return this._breadcrumbs[this._breadcrumbs.length - 1];\n }\n\n /**\n * @inheritDoc\n */\n clearBreadcrumbs() {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n addAttachment(attachment) {\n this._attachments.push(attachment);\n return this;\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `getScopeData()` instead.\n */\n getAttachments() {\n const data = this.getScopeData();\n\n return data.attachments;\n }\n\n /**\n * @inheritDoc\n */\n clearAttachments() {\n this._attachments = [];\n return this;\n }\n\n /** @inheritDoc */\n getScopeData() {\n const {\n _breadcrumbs,\n _attachments,\n _contexts,\n _tags,\n _extra,\n _user,\n _level,\n _fingerprint,\n _eventProcessors,\n _propagationContext,\n _sdkProcessingMetadata,\n _transactionName,\n _span,\n } = this;\n\n return {\n breadcrumbs: _breadcrumbs,\n attachments: _attachments,\n contexts: _contexts,\n tags: _tags,\n extra: _extra,\n user: _user,\n level: _level,\n fingerprint: _fingerprint || [],\n eventProcessors: _eventProcessors,\n propagationContext: _propagationContext,\n sdkProcessingMetadata: _sdkProcessingMetadata,\n transactionName: _transactionName,\n span: _span,\n };\n }\n\n /**\n * Applies data from the scope to the event and runs all event processors on it.\n *\n * @param event Event\n * @param hint Object containing additional information about the original exception, for use by the event processors.\n * @hidden\n * @deprecated Use `applyScopeDataToEvent()` directly\n */\n applyToEvent(\n event,\n hint = {},\n additionalEventProcessors = [],\n ) {\n applyScopeDataToEvent(event, this.getScopeData());\n\n // TODO (v8): Update this order to be: Global > Client > Scope\n const eventProcessors = [\n ...additionalEventProcessors,\n // eslint-disable-next-line deprecation/deprecation\n ...getGlobalEventProcessors(),\n ...this._eventProcessors,\n ];\n\n return notifyEventProcessors(eventProcessors, event, hint);\n }\n\n /**\n * Add data which will be accessible during event processing but won't get sent to Sentry\n */\n setSDKProcessingMetadata(newData) {\n this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...newData };\n\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setPropagationContext(context) {\n this._propagationContext = context;\n return this;\n }\n\n /**\n * @inheritDoc\n */\n getPropagationContext() {\n return this._propagationContext;\n }\n\n /**\n * Capture an exception for this scope.\n *\n * @param exception The exception to capture.\n * @param hint Optinal additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\n captureException(exception, hint) {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture exception!');\n return eventId;\n }\n\n const syntheticException = new Error('Sentry syntheticException');\n\n this._client.captureException(\n exception,\n {\n originalException: exception,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Capture a message for this scope.\n *\n * @param message The message to capture.\n * @param level An optional severity level to report the message with.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured message.\n */\n captureMessage(message, level, hint) {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture message!');\n return eventId;\n }\n\n const syntheticException = new Error(message);\n\n this._client.captureMessage(\n message,\n level,\n {\n originalException: message,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * Captures a manually created event for this scope and sends it to Sentry.\n *\n * @param exception The event to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\n captureEvent(event, hint) {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture event!');\n return eventId;\n }\n\n this._client.captureEvent(event, { ...hint, event_id: eventId }, this);\n\n return eventId;\n }\n\n /**\n * This will be called on every set call.\n */\n _notifyScopeListeners() {\n // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n }\n }\n}\n\n/**\n * Get the global scope.\n * This scope is applied to _all_ events.\n */\nfunction getGlobalScope() {\n if (!globalScope) {\n globalScope = new Scope();\n }\n\n return globalScope;\n}\n\n/**\n * This is mainly needed for tests.\n * DO NOT USE this, as this is an internal API and subject to change.\n * @hidden\n */\nfunction setGlobalScope(scope) {\n globalScope = scope;\n}\n\nfunction generatePropagationContext() {\n return {\n traceId: uuid4(),\n spanId: uuid4().substring(16),\n };\n}\n\nexport { Scope, getGlobalScope, setGlobalScope };\n//# sourceMappingURL=scope.js.map\n"],"names":[],"mappings":";;;;;;;AAQA,MAAM,0BAA0B;AAYhC,MAAM,MAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6CV,cAAc;AACb,SAAK,sBAAsB;AAC3B,SAAK,kBAAkB,CAAA;AACvB,SAAK,mBAAmB,CAAA;AACxB,SAAK,eAAe,CAAA;AACpB,SAAK,eAAe,CAAA;AACpB,SAAK,QAAQ,CAAA;AACb,SAAK,QAAQ,CAAA;AACb,SAAK,SAAS,CAAA;AACd,SAAK,YAAY,CAAA;AACjB,SAAK,yBAAyB,CAAA;AAC9B,SAAK,sBAAsB,2BAA0B;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMC,OAAO,MAAM,OAAO;AACnB,WAAO,QAAQ,MAAM,MAAK,IAAK,IAAI,MAAK;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA,EAKC,QAAQ;AACP,UAAM,WAAW,IAAI,MAAK;AAC1B,aAAS,eAAe,CAAC,GAAG,KAAK,YAAY;AAC7C,aAAS,QAAQ,EAAE,GAAG,KAAK,MAAK;AAChC,aAAS,SAAS,EAAE,GAAG,KAAK,OAAM;AAClC,aAAS,YAAY,EAAE,GAAG,KAAK,UAAS;AACxC,aAAS,QAAQ,KAAK;AACtB,aAAS,SAAS,KAAK;AACvB,aAAS,QAAQ,KAAK;AACtB,aAAS,WAAW,KAAK;AACzB,aAAS,mBAAmB,KAAK;AACjC,aAAS,e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