decord/source/7835__isNativeReflectConstruct.js

295 lines
10 KiB
JavaScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 7835
// Function ID: 7836
2026-08-11 06:20:06 +00:00
// Name: _isNativeReflectConstruct
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 41, 42, 93, 95, 96, 98, 7775, 7790, 7772, 7836, 7800, 7803, 7804, 7776, 7829, 7787, 7837, 7798, 7781, 7812, 7831]
2026-08-11 06:20:06 +00:00
2026-08-24 06:08:38 +00:00
// Module 7835 (_isNativeReflectConstruct)
import isErrorEvent from "isErrorEvent" /* 7831 */;
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "_classCallCheck" /* 41 */;
import _createClass from "_createClass" /* 42 */;
import closure_4 from "_possibleConstructorReturn" /* 93 */;
import closure_5 from "_getPrototypeOf" /* 95 */;
import closure_6 from "_get" /* 96 */;
import _inherits from "_inherits" /* 98 */;
import __SENTRY_DEBUG__ from "__SENTRY_DEBUG__" /* 7775 */;
import dateTimestampInSeconds from "dateTimestampInSeconds" /* 7790 */;
2026-08-11 06:20:06 +00:00
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);
}
2026-08-24 06:08:38 +00:00
closure_0 = !callResult;
_isNativeReflectConstruct = function _isNativeReflectConstruct() {
2026-08-11 06:20:06 +00:00
return closure_0;
2026-08-24 06:08:38 +00:00
};
2026-08-11 06:20:06 +00:00
return _isNativeReflectConstruct();
} catch (err) {
}
}
class ServerRuntimeClient {
constructor(arg0) {
self = this;
2026-08-24 06:08:38 +00:00
tmp = closure_3(this, ServerRuntimeClient);
2026-08-11 06:20:06 +00:00
obj = require("errorCallback");
result = obj.registerSpanErrorInstrumentation();
items = [];
items[0] = global;
2026-08-24 06:08:38 +00:00
tmp3 = closure_5;
obj2 = closure_5(ServerRuntimeClient);
tmp4 = closure_4;
2026-08-11 06:20:06 +00:00
if (_isNativeReflectConstruct()) {
tmp6 = globalThis;
_Reflect = Reflect;
constructResult = Reflect.construct(obj2, items, tmp3(self).constructor);
} else {
constructResult = obj2.apply(self, items);
}
return tmp4(self, constructResult);
}
}
2026-08-24 06:08:38 +00:00
_inherits(ServerRuntimeClient, isErrorEvent.BaseClient);
2026-08-11 06:20:06 +00:00
let items = [
{
key: "eventFromException",
value: function eventFromException(arg0, arg1) {
2026-08-24 06:08:38 +00:00
const result = ServerRuntimeClient(7836).eventFromUnknownInput(this, this._options.stackParser, arg0, arg1);
2026-08-11 06:20:06 +00:00
result.level = "error";
2026-08-24 06:08:38 +00:00
const obj = ServerRuntimeClient(7836);
return ServerRuntimeClient(7800).resolvedSyncPromise(result);
2026-08-11 06:20:06 +00:00
}
},
{
key: "eventFromMessage",
value: function eventFromMessage(arg0) {
let str = arg1;
if (arg1 === undefined) {
str = "info";
}
2026-08-24 06:08:38 +00:00
const obj = ServerRuntimeClient(7800);
return obj.resolvedSyncPromise(ServerRuntimeClient(7836).eventFromMessage(this._options.stackParser, arg0, str, arg2, this._options.attachStacktrace));
2026-08-11 06:20:06 +00:00
}
},
{
key: "captureException",
value: function captureException(arg0, arg1, arg2) {
const self = this;
if (this._options.autoSessionTracking) {
if (self._sessionFlusher) {
2026-08-24 06:08:38 +00:00
const isolationScope = ServerRuntimeClient(7803).getIsolationScope();
2026-08-11 06:20:06 +00:00
const requestSession = isolationScope.getRequestSession();
let tmp4 = requestSession;
if (requestSession) {
tmp4 = "ok" === requestSession.status;
}
if (tmp4) {
requestSession.status = "errored";
}
2026-08-24 06:08:38 +00:00
const obj = ServerRuntimeClient(7803);
2026-08-11 06:20:06 +00:00
}
}
2026-08-24 06:08:38 +00:00
let fn = callback4(callback3(self.prototype), "captureException", self);
2026-08-11 06:20:06 +00:00
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) {
2026-08-24 06:08:38 +00:00
const isolationScope = ServerRuntimeClient(7803).getIsolationScope();
2026-08-11 06:20:06 +00:00
const requestSession = isolationScope.getRequestSession();
let tmp5 = requestSession;
if (requestSession) {
tmp5 = "ok" === requestSession.status;
}
if (tmp5) {
requestSession.status = "errored";
}
2026-08-24 06:08:38 +00:00
const obj = ServerRuntimeClient(7803);
2026-08-11 06:20:06 +00:00
}
}
}
}
tmp = type.type || "exception";
}
}
2026-08-24 06:08:38 +00:00
let fn = callback4(callback3(self.prototype), "captureEvent", self);
2026-08-11 06:20:06 +00:00
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();
}
2026-08-24 06:08:38 +00:00
let fn = callback4(callback3(self.prototype), "close", self);
2026-08-11 06:20:06 +00:00
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;
2026-08-24 06:08:38 +00:00
const sessionFlusher = new tmp2(7829).SessionFlusher(self, obj);
2026-08-11 06:20:06 +00:00
self._sessionFlusher = sessionFlusher;
2026-08-24 06:08:38 +00:00
} else if (tmp2(7804).DEBUG_BUILD) {
const logger = tmp2(7776).logger;
2026-08-11 06:20:06 +00:00
logger.warn("Cannot initialize an instance of SessionFlusher if no release is provided!");
}
}
},
{
key: "captureCheckIn",
value: function captureCheckIn(checkInId) {
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;
}
2026-08-24 06:08:38 +00:00
[tmp9, tmp10] = callback(self._getTraceInfoFromScope(arg2), 2);
2026-08-11 06:20:06 +00:00
if (tmp10) {
2026-08-24 06:08:38 +00:00
obj1 = { trace: null };
2026-08-11 06:20:06 +00:00
obj1[0] = tmp10;
obj.contexts = obj1;
}
2026-08-24 06:08:38 +00:00
const obj5 = ServerRuntimeClient(7837);
2026-08-11 06:20:06 +00:00
const sdkMetadata = self.getSdkMetadata();
const checkInEnvelope = obj5.createCheckInEnvelope(obj, tmp9, sdkMetadata, tunnel, self.getDsn());
2026-08-24 06:08:38 +00:00
if (ServerRuntimeClient(7804).DEBUG_BUILD) {
const logger2 = ServerRuntimeClient(7776).logger;
2026-08-11 06:20:06 +00:00
logger2.info("Sending checkin:", checkInId.monitorSlug, checkInId.status);
}
self.sendEnvelope(checkInEnvelope);
return checkInId;
} else {
2026-08-24 06:08:38 +00:00
if (ServerRuntimeClient(7804).DEBUG_BUILD) {
const logger = ServerRuntimeClient(7776).logger;
2026-08-11 06:20:06 +00:00
logger.warn("SDK not enabled, will not capture checkin.");
}
return checkInId;
}
}
2026-08-24 06:08:38 +00:00
obj = ServerRuntimeClient(7787);
2026-08-11 06:20:06 +00:00
checkInId = obj.uuid4();
}
},
{
key: "_captureRequestSession",
value: function _captureRequestSession() {
if (this._sessionFlusher) {
const _sessionFlusher = this._sessionFlusher;
const result = _sessionFlusher.incrementSessionStatusCount();
} else {
2026-08-24 06:08:38 +00:00
if (ServerRuntimeClient(7804).DEBUG_BUILD) {
const logger = tmp(7776).logger;
2026-08-11 06:20:06 +00:00
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;
}
2026-08-24 06:08:38 +00:00
let fn = callback4(callback3(self.prototype), "_prepareEvent", self);
2026-08-11 06:20:06 +00:00
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) {
2026-08-24 06:08:38 +00:00
const _getSpanForScopeResult = ServerRuntimeClient(7798)._getSpanForScope(arg0);
2026-08-11 06:20:06 +00:00
if (_getSpanForScopeResult) {
2026-08-24 06:08:38 +00:00
let tmpResult = tmp(7781);
2026-08-11 06:20:06 +00:00
let spanToTraceContextResult = tmpResult.spanToTraceContext(_getSpanForScopeResult);
} else {
2026-08-24 06:08:38 +00:00
tmpResult = tmp(7803);
2026-08-11 06:20:06 +00:00
spanToTraceContextResult = tmpResult.getTraceContextFromScope(arg0);
}
2026-08-24 06:08:38 +00:00
const tmpResult1 = ServerRuntimeClient(7812);
2026-08-11 06:20:06 +00:00
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);