decord/source/__polyfill/12xxx/module_12944.js
github-actions f0f877e8ce chore: update source for alpha 347.1
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4824.js (118.4 MB)
2026-09-15 14:23:42 +00:00

83 lines
2.5 KiB
JavaScript

// Module ID: 12944
// Function ID: 12945
// Dependencies: [12945, 12942]
// Exports: extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders
// Module 12944
import generatePropagationContext from "generatePropagationContext" /* 12942 */;
import BAGGAGE_HEADER_NAME from "BAGGAGE_HEADER_NAME" /* 12945 */;
require = arg1;
const dependencyMap = arg6;
const regExp = new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");
export const TRACEPARENT_REGEXP = regExp;
export const extractTraceparentData = function extractTraceparentData(str) {
if (str) {
const match = str.match(regExp);
if (match) {
let flag = true;
if ("1" !== match[3]) {
if ("0" === match[3]) {
flag = false;
}
}
const obj = { traceId: match[1], parentSampled: flag, parentSpanId: match[2] };
return obj;
}
}
};
export const generateSentryTraceHeader = function generateSentryTraceHeader() {
let traceId = arg0;
if (arg0 === undefined) {
traceId = generatePropagationContext.generateTraceId();
}
let spanId = arg1;
if (arg1 === undefined) {
spanId = generatePropagationContext.generateSpanId();
}
let str = "";
if (undefined !== arg2) {
let str2 = "-0";
if (arg2) {
str2 = "-1";
}
str = str2;
}
return "" + traceId + "-" + spanId + str;
};
export const propagationContextFromHeaders = function propagationContextFromHeaders(str, arg1) {
let tmp;
if (str) {
const match = str.match(regExp);
if (match) {
let flag = true;
if ("1" !== match[3]) {
if ("0" === match[3]) {
flag = false;
}
}
const obj = { traceId: match[1], parentSampled: flag, parentSpanId: match[2] };
tmp = obj;
}
}
let result = BAGGAGE_HEADER_NAME.baggageHeaderToDynamicSamplingContext(arg1);
if (tmp) {
if (tmp.traceId) {
const obj3 = { traceId: null, parentSpanId: null, spanId: null, sampled: null, dsc: null };
({ traceId: obj7.traceId, parentSpanId: obj7.parentSpanId, parentSampled } = tmp);
obj3.spanId = tmp4(12942).generateSpanId();
obj3.sampled = parentSampled;
if (!result) {
result = {};
}
obj3.dsc = result;
return obj3;
}
}
const obj4 = { traceId: null, spanId: null };
obj4.traceId = generatePropagationContext.generateTraceId();
const tmp4Result3 = generatePropagationContext;
obj4.spanId = generatePropagationContext.generateSpanId();
return obj4;
};