Files
2026-07-28 01:06:53 +03:00

283 lines
16 KiB
JavaScript

/* Metro module 1095; source: unknown; dependencies: [826, 1041] */
import * as Module00826Module from './module-00826.js'; /* Metro dependency 826 */
function _fun11396(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#11396, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:6, offset: 0x00dab671, size: 195 bytes, params: 8, frame: 23
let env0_0 = require;
const _getGraphQLOperation2 = _getGraphQLOperation;
const getRequestPayloadXhrOrFetch2 = getRequestPayloadXhrOrFetch;
const closure3 = function(a0) {
var value = a0.match(RegExp('^(?:\\s*)(query|mutation|subscription)(?:\\s*)(\\w+)(?:\\s*)[{(]', ''));
var object = {};
if (value) {
object.operationType = value[1];
object.operationName = value[2];
} else {
value = a0.match(RegExp('^(?:\\s*)(query|mutation|subscription)(?:\\s*)[{(]', ''));
if (value) {
object.operationType = value[1];
object.operationName = undefined;
} else {
object.operationType = undefined;
object.operationName = undefined;
}
}
return object;
};
const isObject_11400 = function(a0) {
return typeof a0 === 'object' && a0 !== null;
};
const getGraphQLRequestPayload2 = getGraphQLRequestPayload;
const Object = global.Object;
const defineProperty = Object.defineProperty;
const Symbol = global.Symbol;
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
let value = Module00826Module;
value = value.defineIntegration(function(a0) {
var env0_0 = a0;
return {name: 'GraphQLClient', setup: _fun11405};
});
exports._getGraphQLOperation = _getGraphQLOperation2;
exports.getGraphQLRequestPayload = getGraphQLRequestPayload2;
exports.getRequestPayloadXhrOrFetch = getRequestPayloadXhrOrFetch2;
exports.graphqlClientIntegration = value;
exports.parseGraphQLQuery = closure3;
function _getGraphQLOperation(a0) { // fn#11397, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:91, offset: 0x00dab734, size: 152 bytes, params: 2, frame: 17
var r6;
var query;
var operationName;
var operationName2;
var operationType;
var graphQLQuery;
if (isPersistedRequest(a0)) {
return 'persisted ' + a0.operationName;
}
if (isStandardRequest(a0)) {
query = a0.query;
operationName = a0.operationName;
graphQLQuery = parseGraphQLQuery(query);
operationName2 = graphQLQuery.operationName;
r6 = operationName2 !== undefined ? operationName2 : operationName;
operationType = graphQLQuery.operationType;
return r6 ? '' + operationType + ' ' + r6 : '' + operationType;
}
return 'unknown';
}
function getRequestPayloadXhrOrFetch(a0) { // fn#11398, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:363, offset: 0x00dab7cc, size: 172 bytes, params: 2, frame: 17
var r1;
var r0;
var property;
var value;
if ('xhr' in a0) {
property = a0.xhr[(require(1041) /* metro dependency 1041 */).SENTRY_XHR_DATA_KEY];
if (property) {
value = require(1041) /* metro dependency 1041 */;
value = value.getBodyString(property.body);
property = value[0];
r1 = property;
} else {
r1 = property;
}
r0 = r1;
} else {
value = require(1041) /* metro dependency 1041 */;
value = value.getFetchRequestArgBody(a0.input);
value = (require(1041) /* metro dependency 1041 */).getBodyString(value);
r0 = value[0];
}
return r0;
}
function isStandardRequest(a0) { // fn#11401, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:968, offset: 0x00dab8f6, size: 39 bytes, params: 2, frame: 11
return isObject_11400(a0) && typeof a0.query === 'string';
}
function isPersistedRequest(a0) { // fn#11402, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:1043, offset: 0x00dab91d, size: 145 bytes, params: 2, frame: 14
let r0 = isObject_11400(a0) && typeof a0.operationName === 'string' && isObject_11400(a0.extensions);
r0 = r0 && isObject_11400(a0.extensions.persistedQuery) && typeof a0.extensions.persistedQuery.sha256Hash === 'string' && typeof a0.extensions.persistedQuery.version === 'number';
return r0;
}
function getGraphQLRequestPayload(a0) { // fn#11403, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:1301, offset: 0x00dab9ae, size: 70 bytes, params: 2, frame: 13
var r1;
var JSON;
var value2;
var value3;
var isStandardRequest2;
var isPersistedRequest2;
var error;
const value = undefined;
try {
JSON = global.JSON;
value2 = JSON.parse(a0);
value3 = environment;
isStandardRequest2 = isStandardRequest(value2);
if (isStandardRequest2) {
r1 = value2;
} else {
isPersistedRequest2 = isPersistedRequest(value2);
r1 = isPersistedRequest2 ? value2 : value;
}
} catch (error) {
return value;
}
return r1;
}
function _graphqlClientIntegration(a0) { // fn#11404, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:1472, offset: 0x00dab9f4, size: 33 bytes, params: 2, frame: 3
const env0_0 = a0;
return {name: 'GraphQLClient', setup: setup_11405};
function _graphqlClientIntegrationSetup(a0) { // fn#11405, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:1544, owner: _graphqlClientIntegration.setup, offset: 0x00daba15, size: 38 bytes, params: 2, frame: 14
const binding = env0_0;
((a0, a1) => {
var env0_0 = a1;
a0.on('beforeOutgoingRequestSpan', _fun11407);
})(a0, binding);
((a0, a1) => {
var env0_0 = a1;
a0.on('beforeOutgoingRequestBreadcrumb', _fun11409);
})(a0, binding);
function _updateSpanWithGraphQLData(a0, a1) { // fn#11406, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:1563, owner: _graphqlClientIntegration.setup._updateSpanWithGraphQLData, offset: 0x00daba3b, size: 39 bytes, params: 3, frame: 13
const env0_0 = a1;
a0.on('beforeOutgoingRequestSpan', _fun11407);
function _fun11407(a0, a1) { // fn#11407, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:1638, offset: 0x00daba62, size: 496 bytes, params: 3, frame: 26
var r12;
var r11;
var property;
var moduleValue2;
var moduleValue3;
var value3;
var requestPayloadXhrOrFetch;
var graphQLRequestPayload;
var setAttribute;
var extensions;
var persistedQuery;
const moduleValue = require(826) /* metro dependency 826 */;
const r1 = moduleValue.spanToJSON(a0).data || ({});
const SEMANTIC_ATTRIBUTE_SENTRY_OP = moduleValue.SEMANTIC_ATTRIBUTE_SENTRY_OP;
if (r1[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'http.client') {
property = r1[moduleValue.SEMANTIC_ATTRIBUTE_URL_FULL];
r12 = property || r1['http.url'];
property = r1[(require(826) /* metro dependency 826 */).SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD];
r11 = property || r1['http.method'];
moduleValue2 = require(826) /* metro dependency 826 */;
if (moduleValue2.isString(r12)) {
moduleValue3 = require(826) /* metro dependency 826 */;
if (moduleValue3.isString(r11)) {
value3 = (require(826) /* metro dependency 826 */).stringMatchesSomePattern(r12, require.endpoints);
requestPayloadXhrOrFetch = getRequestPayloadXhrOrFetch(a1);
if (value3) {
if (requestPayloadXhrOrFetch) {
graphQLRequestPayload = getGraphQLRequestPayload(requestPayloadXhrOrFetch);
if (graphQLRequestPayload) {
a0.updateName('' + r11 + ' ' + r12 + ' (' + _getGraphQLOperation(graphQLRequestPayload) + ')');
if (isStandardRequest(graphQLRequestPayload)) {
a0.setAttribute('graphql.document', graphQLRequestPayload.query);
}
if (isPersistedRequest(graphQLRequestPayload)) {
setAttribute = a0.setAttribute;
extensions = graphQLRequestPayload.extensions;
persistedQuery = extensions.persistedQuery;
Reflect.apply(setAttribute, a0, ['graphql.persisted_query.hash.sha256',
persistedQuery.sha256Hash]);
setAttribute = a0.setAttribute;
extensions = graphQLRequestPayload.extensions;
persistedQuery = extensions.persistedQuery;
Reflect.apply(setAttribute, a0, ['graphql.persisted_query.version',
persistedQuery.version]);
}
}
}
}
}
}
}
}
}
function _updateBreadcrumbWithGraphQLData(a0, a1) { // fn#11408, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:2409, owner: _graphqlClientIntegration.setup._updateBreadcrumbWithGraphQLData, offset: 0x00dabc52, size: 39 bytes, params: 3, frame: 13
const env0_0 = a1;
a0.on('beforeOutgoingRequestBreadcrumb', _fun11409);
function _fun11409({category, type, data}, a1) { // fn#11409, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1222:2496, offset: 0x00dabc79, size: 277 bytes, params: 3, frame: 17
var url;
var endpoints;
var value3;
var value4;
var requestPayloadXhrOrFetch;
var graphQLRequestPayload;
var extensions;
var persistedQuery;
if (type === 'http') {
if (category === 'fetch') {
url = data?.url;
endpoints = require.endpoints;
value3 = environment.__proto__.__proto__.__proto__;
value4 = (require(826) /* metro dependency 826 */).stringMatchesSomePattern(url, endpoints);
requestPayloadXhrOrFetch = getRequestPayloadXhrOrFetch(a1);
if (value4) {
if (data) {
if (requestPayloadXhrOrFetch) {
graphQLRequestPayload = getGraphQLRequestPayload(requestPayloadXhrOrFetch);
if (!data.graphql) {
if (graphQLRequestPayload) {
data['graphql.operation'] = _getGraphQLOperation(graphQLRequestPayload);
if (isStandardRequest(graphQLRequestPayload)) {
data['graphql.document'] = graphQLRequestPayload.query;
}
if (isPersistedRequest(graphQLRequestPayload)) {
extensions = graphQLRequestPayload.extensions;
persistedQuery = extensions.persistedQuery;
data['graphql.persisted_query.hash.sha256'] = persistedQuery.sha256Hash;
extensions = graphQLRequestPayload.extensions;
persistedQuery = extensions.persistedQuery;
data['graphql.persisted_query.version'] = persistedQuery.version;
}
}
}
}
}
}
} else if (category === 'xhr') {
url = data?.url;
endpoints = require.endpoints;
value3 = environment.__proto__.__proto__.__proto__;
value4 = (require(826) /* metro dependency 826 */).stringMatchesSomePattern(url, endpoints);
requestPayloadXhrOrFetch = getRequestPayloadXhrOrFetch(a1);
if (value4) {
if (data) {
if (requestPayloadXhrOrFetch) {
graphQLRequestPayload = getGraphQLRequestPayload(requestPayloadXhrOrFetch);
if (!data.graphql) {
if (graphQLRequestPayload) {
data['graphql.operation'] = _getGraphQLOperation(graphQLRequestPayload);
if (isStandardRequest(graphQLRequestPayload)) {
data['graphql.document'] = graphQLRequestPayload.query;
}
if (isPersistedRequest(graphQLRequestPayload)) {
extensions = graphQLRequestPayload.extensions;
persistedQuery = extensions.persistedQuery;
data['graphql.persisted_query.hash.sha256'] = persistedQuery.sha256Hash;
extensions = graphQLRequestPayload.extensions;
persistedQuery = extensions.persistedQuery;
data['graphql.persisted_query.version'] = persistedQuery.version;
}
}
}
}
}
}
}
}
}
}
}
}
}
global.__d(_fun11396, 1095, [826, 1041]) /* metro module 1095, dependencies: [826, 1041] */;