112 lines
3.3 KiB
JavaScript
112 lines
3.3 KiB
JavaScript
// Metro module 6418 (f6419).
|
|
import { merge } from "./merge_6393";
|
|
import { dropUndefinedKeys } from "./addNonEnumerableProperty_6374";
|
|
import { spanToTraceContext, spanToJSON, getRootSpan } from "./spanTimeInputToSeconds";
|
|
import { getDynamicSamplingContextFromSpan } from "./getDynamicSamplingContextFromSpan_6404";
|
|
export function applyScopeDataToEvent(a0, { fingerprint, span, breadcrumbs, sdkProcessingMetadata, extra, tags, user, contexts, level, transactionName }) {
|
|
let fingerprint3;
|
|
const r24 = dropUndefinedKeys(extra);
|
|
if (r24 && Object.keys(r24).length) {
|
|
a0.extra = {
|
|
...r24,
|
|
...a0.extra
|
|
};
|
|
}
|
|
const r38 = dropUndefinedKeys(tags);
|
|
if (r38 && Object.keys(r38).length) {
|
|
a0.tags = {
|
|
...r38,
|
|
...a0.tags
|
|
};
|
|
}
|
|
const r54 = dropUndefinedKeys(user);
|
|
if (r54 && Object.keys(r54).length) {
|
|
a0.user = {
|
|
...r54,
|
|
...a0.user
|
|
};
|
|
}
|
|
const r70 = dropUndefinedKeys(contexts);
|
|
if (r70 && Object.keys(r70).length) {
|
|
a0.contexts = {
|
|
...r70,
|
|
...a0.contexts
|
|
};
|
|
}
|
|
if (level) {
|
|
a0.level = level;
|
|
}
|
|
if (transactionName && a0.type !== "transaction") {
|
|
a0.transaction = transactionName;
|
|
}
|
|
if (span) {
|
|
a0.contexts = {
|
|
trace: spanToTraceContext(span),
|
|
...a0.contexts
|
|
};
|
|
a0.sdkProcessingMetadata = {
|
|
dynamicSamplingContext: getDynamicSamplingContextFromSpan(span),
|
|
...a0.sdkProcessingMetadata
|
|
};
|
|
const description = spanToJSON(getRootSpan(span)).description;
|
|
if (description && !a0.transaction && a0.type === "transaction") {
|
|
a0.transaction = description;
|
|
}
|
|
}
|
|
if (a0.fingerprint) {
|
|
const isArray = Array.isArray(a0.fingerprint);
|
|
const fingerprint2 = a0.fingerprint;
|
|
fingerprint3 = isArray ? fingerprint2 : [fingerprint2];
|
|
} else {
|
|
fingerprint3 = [];
|
|
}
|
|
a0.fingerprint = fingerprint3;
|
|
if (fingerprint) {
|
|
a0.fingerprint = a0.fingerprint.concat(fingerprint);
|
|
}
|
|
if (a0.fingerprint && !a0.fingerprint.length) {
|
|
delete a0["fingerprint"];
|
|
}
|
|
const r132 = [...a0.breadcrumbs || [], ...breadcrumbs];
|
|
a0.breadcrumbs = r132.length ? r132 : void 0;
|
|
a0.sdkProcessingMetadata = {
|
|
...a0.sdkProcessingMetadata,
|
|
...sdkProcessingMetadata
|
|
};
|
|
}
|
|
export function mergeAndOverwriteScopeData(a0, a1, a2) {
|
|
a0[a1] = merge(a0[a1], a2, 1);
|
|
}
|
|
export function mergeScopeData(a0, { extra, tags, user, contexts, level, sdkProcessingMetadata, breadcrumbs, fingerprint, eventProcessors, attachments, propagationContext, transactionName, span }) {
|
|
a0.extra = merge(a0.extra, extra, 1);
|
|
a0.tags = merge(a0.tags, tags, 1);
|
|
a0.user = merge(a0.user, user, 1);
|
|
a0.contexts = merge(a0.contexts, contexts, 1);
|
|
a0.sdkProcessingMetadata = merge(a0.sdkProcessingMetadata, sdkProcessingMetadata, 2);
|
|
if (level) {
|
|
a0.level = level;
|
|
}
|
|
if (transactionName) {
|
|
a0.transactionName = transactionName;
|
|
}
|
|
if (span) {
|
|
a0.span = span;
|
|
}
|
|
if (breadcrumbs.length) {
|
|
a0.breadcrumbs = [...a0.breadcrumbs, ...breadcrumbs];
|
|
}
|
|
if (fingerprint.length) {
|
|
a0.fingerprint = [...a0.fingerprint, ...fingerprint];
|
|
}
|
|
if (eventProcessors.length) {
|
|
a0.eventProcessors = [...a0.eventProcessors, ...eventProcessors];
|
|
}
|
|
if (attachments.length) {
|
|
a0.attachments = [...a0.attachments, ...attachments];
|
|
}
|
|
a0.propagationContext = {
|
|
...a0.propagationContext,
|
|
...propagationContext
|
|
};
|
|
}
|