174 lines
4.8 KiB
JavaScript
174 lines
4.8 KiB
JavaScript
// Metro module 6412 (f6413).
|
|
import * as _slicedToArray from "./_slicedToArray";
|
|
import { GLOBAL_OBJ } from "./Module6369";
|
|
import { normalize } from "./normalize_6413";
|
|
import { dropUndefinedKeys } from "./addNonEnumerableProperty_6374";
|
|
import { dsnToString } from "./dsnFromString_6415";
|
|
let c4110_4;
|
|
const forEachEnvelopeItem = function forEachEnvelopeItem(envelope, a1) {
|
|
for (const item of envelope[1]) {
|
|
if (!a1(item, item[0].type)) {
|
|
continue;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
c4110_4 = {
|
|
session: "session",
|
|
sessions: "session",
|
|
attachment: "attachment",
|
|
transaction: "transaction",
|
|
event: "error",
|
|
client_report: "internal",
|
|
user_report: "default",
|
|
profile: "profile",
|
|
profile_chunk: "profile",
|
|
replay_event: "replay",
|
|
replay_recording: "replay",
|
|
check_in: "monitor",
|
|
feedback: "feedback",
|
|
span: "span",
|
|
statsd: "metric_bucket",
|
|
raw_security: "security"
|
|
};
|
|
export function addItemToEnvelope(a0, a1) {
|
|
const r9 = _slicedToArray(a0, 2);
|
|
return [r9[0], [...r9[1], a1]];
|
|
}
|
|
export function createAttachmentEnvelopeItem(a0) {
|
|
let r11;
|
|
if (typeof a0.data === "string") {
|
|
const data = a0.data;
|
|
r11 = GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.encodePolyfill ? GLOBAL_OBJ.__SENTRY__.encodePolyfill(data) : new TextEncoder().encode(data);
|
|
} else {
|
|
r11 = a0.data;
|
|
}
|
|
return [dropUndefinedKeys({
|
|
type: "attachment",
|
|
length: r11.length,
|
|
filename: a0.filename,
|
|
content_type: a0.contentType,
|
|
attachment_type: a0.attachmentType
|
|
}), r11];
|
|
}
|
|
export function createEnvelope(a0, r2 = []) {
|
|
return [a0, r2];
|
|
}
|
|
export function createEventEnvelopeHeaders(a0, a1, a2, a3) {
|
|
const r7 = a0.sdkProcessingMetadata && a0.sdkProcessingMetadata.dynamicSamplingContext;
|
|
return {
|
|
event_id: a0.event_id,
|
|
sent_at: new Date().toISOString(),
|
|
...a1 ? {
|
|
sdk: a1
|
|
} : a1,
|
|
...!!a2 && a3 && {
|
|
dsn: dsnToString(a3)
|
|
},
|
|
...r7 && {
|
|
trace: dropUndefinedKeys({
|
|
...r7
|
|
})
|
|
}
|
|
};
|
|
}
|
|
export function createSpanEnvelopeItem(a0) {
|
|
return [{
|
|
type: "span"
|
|
}, a0];
|
|
}
|
|
export function envelopeContainsItemType(a0, c15712_0) {
|
|
return forEachEnvelopeItem(a0, (a0, a1) => c15712_0.includes(a1));
|
|
}
|
|
export function envelopeItemTypeToDataCategory(a0) {
|
|
return c4110_4[a0];
|
|
}
|
|
export { forEachEnvelopeItem };
|
|
export function getSdkMetadataForEnvelopeHeader(a0) {
|
|
if (a0 && a0.sdk) {
|
|
const sdk = a0.sdk;
|
|
return {
|
|
name: sdk.name,
|
|
version: sdk.version
|
|
};
|
|
}
|
|
}
|
|
export function parseEnvelope(a0) {
|
|
let r47;
|
|
const r3 = typeof a0 === "string" ? GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.encodePolyfill ? GLOBAL_OBJ.__SENTRY__.encodePolyfill(a0) : new TextEncoder().encode(a0) : a0;
|
|
let c15713_0;
|
|
const readJson = function readJson() {
|
|
let r5 = c15713_0.indexOf(10);
|
|
if (r5 < 0) {
|
|
r5 = c15713_0.length;
|
|
}
|
|
const r4 = JSON;
|
|
const r17 = c15713_0.subarray(0, r5);
|
|
c15713_0 = c15713_0.subarray(r5 + 1);
|
|
return r4.parse(GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.decodePolyfill ? GLOBAL_OBJ.__SENTRY__.decodePolyfill(r17) : new TextDecoder().decode(r17));
|
|
};
|
|
c15713_0 = r3;
|
|
const r40 = readJson();
|
|
const r41 = [];
|
|
while (c15713_0.length) {
|
|
const r9 = readJson();
|
|
const r11 = typeof r9.length === "number" ? r9.length : void 0;
|
|
const r46 = [r9, ,];
|
|
if (r11) {
|
|
r47 = c15713_0.subarray(0, r11);
|
|
c15713_0 = c15713_0.subarray(r11 + 1);
|
|
} else {
|
|
r47 = readJson();
|
|
}
|
|
r46[1] = r47;
|
|
r41.push(r46);
|
|
}
|
|
return [r40, r41];
|
|
}
|
|
export function serializeEnvelope(a0) {
|
|
let r55;
|
|
let c15714_0;
|
|
const append = function append(a0) {
|
|
const r3 = c15714_0;
|
|
if (typeof r3 === "string") {
|
|
c15714_0 = typeof a0 === "string" ? r3 + a0 : [GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.encodePolyfill ? GLOBAL_OBJ.__SENTRY__.encodePolyfill(r3) : new TextEncoder().encode(r3), a0];
|
|
} else {
|
|
r3.push(typeof a0 === "string" ? GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.encodePolyfill ? GLOBAL_OBJ.__SENTRY__.encodePolyfill(a0) : new TextEncoder().encode(a0) : a0);
|
|
}
|
|
};
|
|
const [r11, r29] = a0;
|
|
c15714_0 = JSON.stringify(r11);
|
|
for (const item of r29) {
|
|
const [r14, r40] = item;
|
|
append(`
|
|
${JSON.stringify(r14)}
|
|
`);
|
|
if (typeof r40 !== "string" && !(r40 instanceof Uint8Array)) {
|
|
try {
|
|
r55 = JSON.stringify(r40);
|
|
} catch ($e) {
|
|
r55 = JSON.stringify(normalize(r40));
|
|
}
|
|
append(r55);
|
|
continue;
|
|
}
|
|
append(r40);
|
|
}
|
|
const r70 = c15714_0;
|
|
let r71 = r70;
|
|
if (typeof r71 !== "string") {
|
|
r71 = (function concatBuffers(a0) {
|
|
const uint8Array = new Uint8Array(a0.reduce((acc, item) => acc + item.length, 0));
|
|
let r25 = 0;
|
|
for (const item of a0) {
|
|
const r31 = r25;
|
|
uint8Array.set(item, r31);
|
|
r25 = r31 + item.length;
|
|
}
|
|
return uint8Array;
|
|
})(r70);
|
|
}
|
|
return r71;
|
|
}
|