Files
discord-decomp/sources/by-id/module-00899-ServerRuntimeClient.js
2026-07-28 01:06:53 +03:00

262 lines
14 KiB
JavaScript

/* Metro module 899; source: unknown; dependencies: [57, 6, 7, 15, 17, 102, 18, 827, 900, 901, 881, 839, 832, 833, 889, 902, 884, 857] */
import * as ClassCallCheckModule from './module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import * as CreateClassModule from './module-00007-CreateClass.js'; /* Metro dependency 7 */
import * as PossibleConstructorReturnModule from './module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import * as Module00017Module from './module-00017.js'; /* Metro dependency 17 */
import * as InheritsModule from './module-00018-Inherits.js'; /* Metro dependency 18 */
import * as Module00057Module from './module-00057.js'; /* Metro dependency 57 */
import * as Module00102Module from './module-00102.js'; /* Metro dependency 102 */
import * as RegisterSpanErrorInstrumentationModule from './module-00827-registerSpanErrorInstrumentation.js'; /* Metro dependency 827 */
import * as DEBUG_BUILDModule from './module-00832-DEBUG_BUILD.js'; /* Metro dependency 832 */
import * as Module00833Module from './module-00833.js'; /* Metro dependency 833 */
import * as Module00857Module from './module-00857.js'; /* Metro dependency 857 */
import * as Module00881Module from './module-00881.js'; /* Metro dependency 881 */
import * as ClientModule from './module-00884-Client.js'; /* Metro dependency 884 */
import * as AddUserAgentToTransportHeadersModule from './module-00900-addUserAgentToTransportHeaders.js'; /* Metro dependency 900 */
function _fun9693(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#9693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:6, offset: 0x00d6f362, size: 239 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
const defineProperty = Object.defineProperty;
const Symbol = global.Symbol;
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
const Client = (ClientModule).Client;
exports.ServerRuntimeClient = _fun9700(Client);
function _isNativeReflectConstruct_9694() { // fn#9694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:113, offset: 0x00d6f451, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_9694_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _superPropGet_9697(a0, a1, a2, a3) { // fn#9697, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:332, offset: 0x00d6f4af, size: 99 bytes, params: 5, frame: 18
let value = a0;
const env0_0 = a2;
value = Module00017Module(1 & 3 ? value.prototype : value);
value = Module00102Module(value, a1, a2);
return 2 & 3 ? typeof value !== 'function' ? value : _fun9698 : value;
function _fun9698(a0) { // fn#9698, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:431, offset: 0x00c62408, size: 27 bytes, params: 2, frame: 13
return env0_1.apply(importDefault, a0);
}
}
function setCurrentRequestSessionErroredOrCrashed(a0) { // fn#9699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:3532, offset: 0x00d6f512, size: 148 bytes, params: 2, frame: 14
var handled;
var r1;
const value = undefined;
const isolationScope = (Module00857Module).getIsolationScope();
const getScopeData = isolationScope.getScopeData;
const requestSession = Reflect.apply(getScopeData, isolationScope, []).sdkProcessingMetadata.requestSession;
if (requestSession) {
handled = a0 == null || a0.mechanism == null ? value : a0.mechanism.handled;
r1 = handled == null || handled;
if (r1) {
if (requestSession.status !== 'crashed') {
requestSession.status = 'errored';
} else if (!r1) {
requestSession.status = 'crashed';
}
} else if (!r1) {
requestSession.status = 'crashed';
}
}
return value;
}
function _fun9700(a0) { // fn#9700, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:534, offset: 0x00d6f5a6, size: 208 bytes, params: 2, frame: 16
const ServerRuntimeClient2 = ServerRuntimeClient;
InheritsModule(ServerRuntimeClient2, a0);
return CreateClassModule(ServerRuntimeClient2, [{key: 'eventFromException', value: value_9702}, {key: 'eventFromMessage',
value: value_9703}, {key: 'captureException', value: value_9704}, {key: 'captureEvent', value: value_9705},
{key: 'captureCheckIn', value: value_9706}, {key: '_prepareEvent', value: value_9707},
{key: '_setUpMetricsProcessing', value: function() {
var env0_0 = this;
this.on('processMetric', _fun9709);
}}]);
function ServerRuntimeClient(a0) { // fn#9701, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:559, offset: 0x00d6f676, size: 180 bytes, params: 2, frame: 19
let value = environment.__proto__;
env1_3(this, ServerRuntimeClient);
(RegisterSpanErrorInstrumentationModule).registerSpanErrorInstrumentation();
(AddUserAgentToTransportHeadersModule).addUserAgentToTransportHeaders(a0);
const items2 = [a0];
const value3 = env1_6(ServerRuntimeClient);
value = env1_5(this, _isNativeReflectConstruct_9694() ? global.Reflect.construct(value3, items2,
env1_6(this).constructor) : value3.apply(this, items2));
value._setUpMetricsProcessing();
return value;
}
function value_9702(a0, a1) { // fn#9702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:1000, offset: 0x00d6f72a, size: 97 bytes, params: 3, frame: 20
let value = environment.__proto__;
value = Reflect.apply((require(901) /* metro dependency 901 */).eventFromUnknownInput, value, [this,
this._options.stackParser, a0, a1]);
value.level = 'error';
return (Module00881Module).resolvedSyncPromise(value);
}
function value_9703(a0) { // fn#9703, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:1194, offset: 0x00d6f78b, size: 155 bytes, params: 2, frame: 21
let value = undefined;
const value2 = 'info';
const r8 = arguments.length > 1 ? value === arguments[1] ? value2 : arguments[1] : value2;
const r7 = arguments.length > 2 ? arguments[2] : value;
const resolvedSyncPromise = Module00881Module.resolvedSyncPromise;
value = require(901) /* metro dependency 901 */;
return Reflect.apply(resolvedSyncPromise, Module00881Module, [value.eventFromMessage(this._options.stackParser, a0, r8,
r7, this._options.attachStacktrace)]);
}
function value_9704(a0, a1, a2) { // fn#9704, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:1492, offset: 0x00d6f826, size: 73 bytes, params: 4, frame: 18
const value = environment.__proto__;
setCurrentRequestSessionErroredOrCrashed(a1);
return _superPropGet_9697(ServerRuntimeClient, 'captureException', this, 3)([a0, a1, a2]);
}
function value_9705(a0, a1, a2) { // fn#9705, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:1674, offset: 0x00d6f86f, size: 142 bytes, params: 4, frame: 19
if (!a0.type && a0.exception?.values && a0.exception.values.length > 0) {
value = environment.__proto__;
setCurrentRequestSessionErroredOrCrashed(a1);
}
value = environment.__proto__;
return _superPropGet_9697(ServerRuntimeClient, 'captureEvent', this, 3)([a0, a1, a2]);
}
function value_9706(a0, a1, a2) { // fn#9706, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:1934, offset: 0x00d6f8fd, size: 561 bytes, params: 4, frame: 26
var r0;
var value;
const DEBUG_BUILD = (DEBUG_BUILDModule).DEBUG_BUILD;
const debug = (Module00833Module).debug;
var release;
var environment;
var tunnel;
var object;
var value3;
var property;
var property2;
var moduleValue2;
var checkInEnvelope;
if ('checkInId' in a0) {
if (a0.checkInId) {
r0 = a0.checkInId;
} else {
value = environment.__proto__;
value = require(839) /* metro dependency 839 */;
value = value.uuid4();
r0 = value;
}
} else {
value = environment.__proto__;
value = require(839) /* metro dependency 839 */;
value = value.uuid4();
r0 = value;
}
if (this._isEnabled()) {
value = this.getOptions();
release = value.release;
environment = value.environment;
tunnel = value.tunnel;
object = {check_in_id: r0};
object.monitor_slug = a0.monitorSlug;
object.status = a0.status;
object.release = release;
object.environment = environment;
if ('duration' in a0) {
object.duration = a0.duration;
}
if (a1) {
object.monitor_config = {schedule: a1.schedule, checkin_margin: a1.checkinMargin,
max_runtime: a1.maxRuntime,
timezone: a1.timezone, failure_issue_threshold: a1.failureIssueThreshold,
recovery_threshold: a1.recoveryThreshold};
}
value = environment.__proto__;
value3 = env1_2((require(889) /* metro dependency 889 */)._getTraceInfoFromScope(this, a2), 2);
property = value3[0];
property2 = value3[1];
if (property2) {
object.contexts = {trace: property2};
}
moduleValue2 = require(902) /* metro dependency 902 */;
checkInEnvelope = moduleValue2.createCheckInEnvelope(object, property, this.getSdkMetadata(), tunnel,
this.getDsn());
if (DEBUG_BUILD) {
debug.log('Sending checkin:', a0.monitorSlug, a0.status);
}
this.sendEnvelope(checkInEnvelope);
} else {
value = environment.__proto__;
if (DEBUG_BUILD) {
debug.warn('SDK not enabled, will not capture check-in.');
}
}
return r0;
}
function value_9707(a0, a1, a2, a3) { // fn#9707, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:2869, offset: 0x00d6fb2e, size: 252 bytes, params: 5, frame: 20
var Object;
var assign;
var contexts;
let platform = this._options.platform;
if (platform) {
platform = a0.platform;
platform = !platform ? this._options.platform : platform;
a0.platform = platform;
}
let runtime = this._options.runtime;
if (runtime) {
Object = global.Object;
assign = Object.assign;
contexts = a0.contexts;
runtime = a0.contexts?.runtime;
runtime = !runtime ? this._options.runtime : runtime;
a0.contexts = Reflect.apply(assign, Object, [{}, contexts, {runtime: runtime}]);
}
if (this._options.serverName) {
a0.server_name = a0.server_name || this._options.serverName;
}
const value = environment.__proto__;
return _superPropGet_9697(ServerRuntimeClient, '_prepareEvent', this, 3)([a0, a1, a2, a3]);
}
function value_9708() { // fn#9708, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:3316, offset: 0x00d6fc2a, size: 36 bytes, params: 1, frame: 13
this.on('processMetric', _fun9709);
function _fun9709(a0) { // fn#9709, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1026:3387, offset: 0x00d6fc4e, size: 83 bytes, params: 2, frame: 14
var Object;
if (env0_0._options.serverName) {
Object = global.Object;
a0.attributes = Object.assign({['server.address']: env0_0._options.serverName}, a0.attributes);
}
}
}
}
}
global.__d(_fun9693, 899, [57, 6, 7, 15, 17, 102, 18, 827, 900, 901, 881, 839, 832, 833, 889, 902, 884,
857]) /* metro module 899, dependencies: [57, 6, 7, 15, 17, 102, 18, 827, 900, 901, 881, 839, 832, 833, 889, 902, 884, 857] */;