decord/source/7513__isNativeReflectConstruct.js
2026-08-08 06:10:11 +00:00

295 lines
10 KiB
JavaScript

// Module ID: 7513
// Function ID: 7514
// Name: _isNativeReflectConstruct
// Dependencies: [32, 41, 42, 93, 95, 96, 98, 7453, 7468, 7450, 7514, 7478, 7481, 7482, 7454, 7507, 7465, 7515, 7476, 7459, 7490, 7509]
// Module 7513 (_isNativeReflectConstruct)
import _slicedToArray from "_slicedToArray";
import _classCallCheck from "_classCallCheck";
import _createClass from "_createClass";
import c4 from "_possibleConstructorReturn";
import _getPrototypeOf from "_getPrototypeOf";
import _get from "_get";
import _inherits from "_inherits";
import __SENTRY_DEBUG__ from "__SENTRY_DEBUG__";
import dateTimestampInSeconds from "dateTimestampInSeconds";
const ServerRuntimeClient = require;
function _isNativeReflectConstruct() {
try {
const _Boolean = Boolean;
const call = valueOf.call;
const _Reflect = Reflect;
const _Boolean2 = Boolean;
if (typeof call === "unknown") {
let callResult = valueOf();
} else {
callResult = call(constructResult);
}
let closure_0 = !callResult;
function _isNativeReflectConstruct() {
return closure_0;
}
return _isNativeReflectConstruct();
} catch (err) {
}
}
class ServerRuntimeClient {
constructor(arg0) {
self = this;
tmp = _isNativeReflectConstruct(this, ServerRuntimeClient);
obj = require("errorCallback");
result = obj.registerSpanErrorInstrumentation();
items = [];
items[0] = global;
tmp3 = outer1_5;
obj2 = outer1_5(ServerRuntimeClient);
tmp4 = outer1_4;
if (_isNativeReflectConstruct()) {
tmp6 = globalThis;
_Reflect = Reflect;
constructResult = Reflect.construct(obj2, items, tmp3(self).constructor);
} else {
constructResult = obj2.apply(self, items);
}
return tmp4(self, constructResult);
}
}
_inherits(ServerRuntimeClient, require("isErrorEvent").BaseClient);
let items = [
{
key: "eventFromException",
value: function eventFromException(arg0, arg1) {
const result = ServerRuntimeClient(7514).eventFromUnknownInput(this, this._options.stackParser, arg0, arg1);
result.level = "error";
const obj = ServerRuntimeClient(7514);
return ServerRuntimeClient(7478).resolvedSyncPromise(result);
}
},
{
key: "eventFromMessage",
value: function eventFromMessage(arg0) {
let str = arg1;
if (arg1 === undefined) {
str = "info";
}
const obj = ServerRuntimeClient(7478);
return obj.resolvedSyncPromise(ServerRuntimeClient(7514).eventFromMessage(this._options.stackParser, arg0, str, arg2, this._options.attachStacktrace));
}
},
{
key: "captureException",
value: function captureException(arg0, arg1, arg2) {
const self = this;
if (this._options.autoSessionTracking) {
if (self._sessionFlusher) {
const isolationScope = ServerRuntimeClient(7481).getIsolationScope();
const requestSession = isolationScope.getRequestSession();
let tmp4 = requestSession;
if (requestSession) {
tmp4 = "ok" === requestSession.status;
}
if (tmp4) {
requestSession.status = "errored";
}
const obj = ServerRuntimeClient(7481);
}
}
let fn = _get(_getPrototypeOf(self.prototype), "captureException", self);
if (typeof fn === "function") {
fn = (items) => fn.apply(self, items);
}
const items = [arg0, arg1, arg2];
return fn(items);
}
},
{
key: "captureEvent",
value: function captureEvent(type) {
const self = this;
if (this._options.autoSessionTracking) {
if (self._sessionFlusher) {
if ("exception" === tmp) {
if (type.exception) {
if (type.exception.values) {
if (type.exception.values.length > 0) {
const isolationScope = ServerRuntimeClient(7481).getIsolationScope();
const requestSession = isolationScope.getRequestSession();
let tmp5 = requestSession;
if (requestSession) {
tmp5 = "ok" === requestSession.status;
}
if (tmp5) {
requestSession.status = "errored";
}
const obj = ServerRuntimeClient(7481);
}
}
}
}
tmp = type.type || "exception";
}
}
let fn = _get(_getPrototypeOf(self.prototype), "captureEvent", self);
if (typeof fn === "function") {
fn = (items) => fn.apply(self, items);
}
const items = [type, arg1, arg2];
return fn(items);
}
},
{
key: "close",
value: function close(arg0) {
const self = this;
if (this._sessionFlusher) {
const _sessionFlusher = self._sessionFlusher;
_sessionFlusher.close();
}
let fn = _get(_getPrototypeOf(self.prototype), "close", self);
if (typeof fn === "function") {
fn = (items) => fn.apply(self, items);
}
const items = [arg0];
return fn(items);
}
},
{
key: "initSessionFlusher",
value: function initSessionFlusher() {
const self = this;
const release = this._options.release;
if (release) {
const obj = { release: null, environment: null };
obj[0] = release;
obj[1] = tmp;
const sessionFlusher = new tmp2(7507).SessionFlusher(self, obj);
self._sessionFlusher = sessionFlusher;
} else if (tmp2(7482).DEBUG_BUILD) {
const logger = tmp2(7454).logger;
logger.warn("Cannot initialize an instance of SessionFlusher if no release is provided!");
}
}
},
{
key: "captureCheckIn",
value: function captureCheckIn(checkInId) {
let tmp10;
let tmp9;
if ("checkInId" in checkInId) {
if (checkInId.checkInId) {
checkInId = checkInId.checkInId;
}
const self = this;
if (this._isEnabled()) {
const options = self.getOptions();
const tunnel = options.tunnel;
let obj = { check_in_id: null, monitor_slug: null, status: null, release: null, environment: null };
obj[0] = checkInId;
({ monitorSlug: obj2[1], status: obj2[2] } = checkInId);
({ release: obj2[3], environment: obj2[4] } = options);
if ("duration" in checkInId) {
obj.duration = checkInId.duration;
}
if (arg1) {
obj = { schedule: null, checkin_margin: null, max_runtime: null, timezone: null, failure_issue_threshold: null, recovery_threshold: null };
({ schedule: obj3[0], checkinMargin: obj3[1], maxRuntime: obj3[2], timezone: obj3[3], failureIssueThreshold: obj3[4], recoveryThreshold: obj3[5] } = arg1);
obj.monitor_config = obj;
}
[tmp9, tmp10] = _slicedToArray(self._getTraceInfoFromScope(arg2), 2);
if (tmp10) {
const obj1 = { trace: null };
obj1[0] = tmp10;
obj.contexts = obj1;
}
const obj5 = ServerRuntimeClient(7515);
const sdkMetadata = self.getSdkMetadata();
const checkInEnvelope = obj5.createCheckInEnvelope(obj, tmp9, sdkMetadata, tunnel, self.getDsn());
if (ServerRuntimeClient(7482).DEBUG_BUILD) {
const logger2 = ServerRuntimeClient(7454).logger;
logger2.info("Sending checkin:", checkInId.monitorSlug, checkInId.status);
}
self.sendEnvelope(checkInEnvelope);
return checkInId;
} else {
if (ServerRuntimeClient(7482).DEBUG_BUILD) {
const logger = ServerRuntimeClient(7454).logger;
logger.warn("SDK not enabled, will not capture checkin.");
}
return checkInId;
}
}
obj = ServerRuntimeClient(7465);
checkInId = obj.uuid4();
}
},
{
key: "_captureRequestSession",
value: function _captureRequestSession() {
if (this._sessionFlusher) {
const _sessionFlusher = this._sessionFlusher;
const result = _sessionFlusher.incrementSessionStatusCount();
} else {
if (ServerRuntimeClient(7482).DEBUG_BUILD) {
const logger = tmp(7454).logger;
logger.warn("Discarded request mode session because autoSessionTracking option was disabled");
}
tmp = ServerRuntimeClient;
}
}
},
{
key: "_prepareEvent",
value: function _prepareEvent(platform) {
const self = this;
if (this._options.platform) {
platform.platform = platform.platform || self._options.platform;
}
if (self._options.runtime) {
const obj = {};
const merged = Object.assign(platform.contexts);
obj.runtime = platform.contexts || {}.runtime || self._options.runtime;
platform.contexts = obj;
const tmp3 = platform.contexts || {};
}
if (self._options.serverName) {
platform.server_name = platform.server_name || self._options.serverName;
}
let fn = _get(_getPrototypeOf(self.prototype), "_prepareEvent", self);
if (typeof fn === "function") {
fn = (items) => fn.apply(self, items);
}
const items = [platform, arg1, arg2, arg3];
return fn(items);
}
},
{
key: "_getTraceInfoFromScope",
value: function _getTraceInfoFromScope(arg0) {
if (arg0) {
const _getSpanForScopeResult = ServerRuntimeClient(7476)._getSpanForScope(arg0);
if (_getSpanForScopeResult) {
let tmpResult = tmp(7459);
let spanToTraceContextResult = tmpResult.spanToTraceContext(_getSpanForScopeResult);
} else {
tmpResult = tmp(7481);
spanToTraceContextResult = tmpResult.getTraceContextFromScope(arg0);
}
const tmpResult1 = ServerRuntimeClient(7490);
if (_getSpanForScopeResult) {
let dynamicSamplingContextFromSpan = tmpResult1.getDynamicSamplingContextFromSpan(_getSpanForScopeResult);
} else {
const self = this;
dynamicSamplingContextFromSpan = tmpResult1.getDynamicSamplingContextFromScope(this, arg0);
}
const items = [dynamicSamplingContextFromSpan, spanToTraceContextResult];
return items;
} else {
const items1 = [undefined, undefined];
return items1;
}
}
}
];
export const ServerRuntimeClient = _createClass(ServerRuntimeClient, items);