mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-04-26 23:25:11 +00:00
init
This commit is contained in:
65
node_modules/@sentry/core/esm/integrations/functiontostring.js
generated
vendored
Normal file
65
node_modules/@sentry/core/esm/integrations/functiontostring.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { getOriginalFunction } from '@sentry/utils';
|
||||
import { getClient } from '../exports.js';
|
||||
import { convertIntegrationFnToClass, defineIntegration } from '../integration.js';
|
||||
|
||||
let originalFunctionToString;
|
||||
|
||||
const INTEGRATION_NAME = 'FunctionToString';
|
||||
|
||||
const SETUP_CLIENTS = new WeakMap();
|
||||
|
||||
const _functionToStringIntegration = (() => {
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
setupOnce() {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
originalFunctionToString = Function.prototype.toString;
|
||||
|
||||
// intrinsics (like Function.prototype) might be immutable in some environments
|
||||
// e.g. Node with --frozen-intrinsics, XS (an embedded JavaScript engine) or SES (a JavaScript proposal)
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
Function.prototype.toString = function ( ...args) {
|
||||
const originalFunction = getOriginalFunction(this);
|
||||
const context =
|
||||
SETUP_CLIENTS.has(getClient() ) && originalFunction !== undefined ? originalFunction : this;
|
||||
return originalFunctionToString.apply(context, args);
|
||||
};
|
||||
} catch (e) {
|
||||
// ignore errors here, just don't patch this
|
||||
}
|
||||
},
|
||||
setup(client) {
|
||||
SETUP_CLIENTS.set(client, true);
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
/**
|
||||
* Patch toString calls to return proper name for wrapped functions.
|
||||
*
|
||||
* ```js
|
||||
* Sentry.init({
|
||||
* integrations: [
|
||||
* functionToStringIntegration(),
|
||||
* ],
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
const functionToStringIntegration = defineIntegration(_functionToStringIntegration);
|
||||
|
||||
/**
|
||||
* Patch toString calls to return proper name for wrapped functions.
|
||||
*
|
||||
* @deprecated Use `functionToStringIntegration()` instead.
|
||||
*/
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
const FunctionToString = convertIntegrationFnToClass(
|
||||
INTEGRATION_NAME,
|
||||
functionToStringIntegration,
|
||||
) ;
|
||||
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
|
||||
export { FunctionToString, functionToStringIntegration };
|
||||
//# sourceMappingURL=functiontostring.js.map
|
||||
1
node_modules/@sentry/core/esm/integrations/functiontostring.js.map
generated
vendored
Normal file
1
node_modules/@sentry/core/esm/integrations/functiontostring.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"functiontostring.js","sources":["../../../src/integrations/functiontostring.ts"],"sourcesContent":["import type { Client, Integration, IntegrationClass, IntegrationFn, WrappedFunction } from '@sentry/types';\nimport { getOriginalFunction } from '@sentry/utils';\nimport { getClient } from '../exports';\nimport { convertIntegrationFnToClass, defineIntegration } from '../integration';\n\nlet originalFunctionToString: () => void;\n\nconst INTEGRATION_NAME = 'FunctionToString';\n\nconst SETUP_CLIENTS = new WeakMap<Client, boolean>();\n\nconst _functionToStringIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n originalFunctionToString = Function.prototype.toString;\n\n // intrinsics (like Function.prototype) might be immutable in some environments\n // e.g. Node with --frozen-intrinsics, XS (an embedded JavaScript engine) or SES (a JavaScript proposal)\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Function.prototype.toString = function (this: WrappedFunction, ...args: any[]): string {\n const originalFunction = getOriginalFunction(this);\n const context =\n SETUP_CLIENTS.has(getClient() as Client) && originalFunction !== undefined ? originalFunction : this;\n return originalFunctionToString.apply(context, args);\n };\n } catch {\n // ignore errors here, just don't patch this\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Patch toString calls to return proper name for wrapped functions.\n *\n * ```js\n * Sentry.init({\n * integrations: [\n * functionToStringIntegration(),\n * ],\n * });\n * ```\n */\nexport const functionToStringIntegration = defineIntegration(_functionToStringIntegration);\n\n/**\n * Patch toString calls to return proper name for wrapped functions.\n *\n * @deprecated Use `functionToStringIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const FunctionToString = convertIntegrationFnToClass(\n INTEGRATION_NAME,\n functionToStringIntegration,\n) as IntegrationClass<Integration & { setupOnce: () => void }>;\n\n// eslint-disable-next-line deprecation/deprecation\nexport type FunctionToString = typeof FunctionToString;\n"],"names":[],"mappings":";;;;AAKA,IAAI,wBAAwB,CAAA;AAC5B;AACA,MAAM,gBAAA,GAAmB,kBAAkB,CAAA;AAC3C;AACA,MAAM,aAAc,GAAE,IAAI,OAAO,EAAmB,CAAA;AACpD;AACA,MAAM,4BAA6B,IAAG,MAAM;AAC5C,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB;AACA,MAAM,2BAA2B,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAA;AAC5D;AACA;AACA;AACA,MAAM,IAAI;AACV;AACA,QAAQ,QAAQ,CAAC,SAAS,CAAC,QAAS,GAAE,WAAiC,GAAG,IAAI,EAAiB;AAC/F,UAAU,MAAM,gBAAiB,GAAE,mBAAmB,CAAC,IAAI,CAAC,CAAA;AAC5D,UAAU,MAAM,OAAQ;AACxB,YAAY,aAAa,CAAC,GAAG,CAAC,SAAS,EAAC,EAAa,IAAG,qBAAqB,SAAA,GAAY,gBAAA,GAAmB,IAAI,CAAA;AAChH,UAAU,OAAO,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAC9D,SAAS,CAAA;AACT,QAAQ,OAAM,CAAA,EAAA;AACd;AACA,OAAM;AACN,KAAK;AACL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AACrC,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,2BAA4B,GAAE,iBAAiB,CAAC,4BAA4B,EAAC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,gBAAiB,GAAE,2BAA2B;AAC3D,EAAE,gBAAgB;AAClB,EAAE,2BAA2B;AAC7B,CAAE,EAAA;AACF;AACA;;;;"}
|
||||
224
node_modules/@sentry/core/esm/integrations/inboundfilters.js
generated
vendored
Normal file
224
node_modules/@sentry/core/esm/integrations/inboundfilters.js
generated
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
import { logger, getEventDescription, stringMatchesSomePattern } from '@sentry/utils';
|
||||
import { DEBUG_BUILD } from '../debug-build.js';
|
||||
import { convertIntegrationFnToClass, defineIntegration } from '../integration.js';
|
||||
|
||||
// "Script error." is hard coded into browsers for errors that it can't read.
|
||||
// this is the result of a script being pulled in from an external domain and CORS.
|
||||
const DEFAULT_IGNORE_ERRORS = [
|
||||
/^Script error\.?$/,
|
||||
/^Javascript error: Script error\.? on line 0$/,
|
||||
/^ResizeObserver loop completed with undelivered notifications.$/,
|
||||
/^Cannot redefine property: googletag$/,
|
||||
];
|
||||
|
||||
const DEFAULT_IGNORE_TRANSACTIONS = [
|
||||
/^.*\/healthcheck$/,
|
||||
/^.*\/healthy$/,
|
||||
/^.*\/live$/,
|
||||
/^.*\/ready$/,
|
||||
/^.*\/heartbeat$/,
|
||||
/^.*\/health$/,
|
||||
/^.*\/healthz$/,
|
||||
];
|
||||
|
||||
/** Options for the InboundFilters integration */
|
||||
|
||||
const INTEGRATION_NAME = 'InboundFilters';
|
||||
const _inboundFiltersIntegration = ((options = {}) => {
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
// TODO v8: Remove this
|
||||
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
|
||||
processEvent(event, _hint, client) {
|
||||
const clientOptions = client.getOptions();
|
||||
const mergedOptions = _mergeOptions(options, clientOptions);
|
||||
return _shouldDropEvent(event, mergedOptions) ? null : event;
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
const inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration);
|
||||
|
||||
/**
|
||||
* Inbound filters configurable by the user.
|
||||
* @deprecated Use `inboundFiltersIntegration()` instead.
|
||||
*/
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
const InboundFilters = convertIntegrationFnToClass(
|
||||
INTEGRATION_NAME,
|
||||
inboundFiltersIntegration,
|
||||
)
|
||||
|
||||
;
|
||||
|
||||
function _mergeOptions(
|
||||
internalOptions = {},
|
||||
clientOptions = {},
|
||||
) {
|
||||
return {
|
||||
allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])],
|
||||
denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])],
|
||||
ignoreErrors: [
|
||||
...(internalOptions.ignoreErrors || []),
|
||||
...(clientOptions.ignoreErrors || []),
|
||||
...(internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS),
|
||||
],
|
||||
ignoreTransactions: [
|
||||
...(internalOptions.ignoreTransactions || []),
|
||||
...(clientOptions.ignoreTransactions || []),
|
||||
...(internalOptions.disableTransactionDefaults ? [] : DEFAULT_IGNORE_TRANSACTIONS),
|
||||
],
|
||||
ignoreInternal: internalOptions.ignoreInternal !== undefined ? internalOptions.ignoreInternal : true,
|
||||
};
|
||||
}
|
||||
|
||||
function _shouldDropEvent(event, options) {
|
||||
if (options.ignoreInternal && _isSentryError(event)) {
|
||||
DEBUG_BUILD &&
|
||||
logger.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${getEventDescription(event)}`);
|
||||
return true;
|
||||
}
|
||||
if (_isIgnoredError(event, options.ignoreErrors)) {
|
||||
DEBUG_BUILD &&
|
||||
logger.warn(
|
||||
`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${getEventDescription(event)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (_isIgnoredTransaction(event, options.ignoreTransactions)) {
|
||||
DEBUG_BUILD &&
|
||||
logger.warn(
|
||||
`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${getEventDescription(event)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (_isDeniedUrl(event, options.denyUrls)) {
|
||||
DEBUG_BUILD &&
|
||||
logger.warn(
|
||||
`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${getEventDescription(
|
||||
event,
|
||||
)}.\nUrl: ${_getEventFilterUrl(event)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (!_isAllowedUrl(event, options.allowUrls)) {
|
||||
DEBUG_BUILD &&
|
||||
logger.warn(
|
||||
`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${getEventDescription(
|
||||
event,
|
||||
)}.\nUrl: ${_getEventFilterUrl(event)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function _isIgnoredError(event, ignoreErrors) {
|
||||
// If event.type, this is not an error
|
||||
if (event.type || !ignoreErrors || !ignoreErrors.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return _getPossibleEventMessages(event).some(message => stringMatchesSomePattern(message, ignoreErrors));
|
||||
}
|
||||
|
||||
function _isIgnoredTransaction(event, ignoreTransactions) {
|
||||
if (event.type !== 'transaction' || !ignoreTransactions || !ignoreTransactions.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const name = event.transaction;
|
||||
return name ? stringMatchesSomePattern(name, ignoreTransactions) : false;
|
||||
}
|
||||
|
||||
function _isDeniedUrl(event, denyUrls) {
|
||||
// TODO: Use Glob instead?
|
||||
if (!denyUrls || !denyUrls.length) {
|
||||
return false;
|
||||
}
|
||||
const url = _getEventFilterUrl(event);
|
||||
return !url ? false : stringMatchesSomePattern(url, denyUrls);
|
||||
}
|
||||
|
||||
function _isAllowedUrl(event, allowUrls) {
|
||||
// TODO: Use Glob instead?
|
||||
if (!allowUrls || !allowUrls.length) {
|
||||
return true;
|
||||
}
|
||||
const url = _getEventFilterUrl(event);
|
||||
return !url ? true : stringMatchesSomePattern(url, allowUrls);
|
||||
}
|
||||
|
||||
function _getPossibleEventMessages(event) {
|
||||
const possibleMessages = [];
|
||||
|
||||
if (event.message) {
|
||||
possibleMessages.push(event.message);
|
||||
}
|
||||
|
||||
let lastException;
|
||||
try {
|
||||
// @ts-expect-error Try catching to save bundle size
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
lastException = event.exception.values[event.exception.values.length - 1];
|
||||
} catch (e) {
|
||||
// try catching to save bundle size checking existence of variables
|
||||
}
|
||||
|
||||
if (lastException) {
|
||||
if (lastException.value) {
|
||||
possibleMessages.push(lastException.value);
|
||||
if (lastException.type) {
|
||||
possibleMessages.push(`${lastException.type}: ${lastException.value}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (DEBUG_BUILD && possibleMessages.length === 0) {
|
||||
logger.error(`Could not extract message for event ${getEventDescription(event)}`);
|
||||
}
|
||||
|
||||
return possibleMessages;
|
||||
}
|
||||
|
||||
function _isSentryError(event) {
|
||||
try {
|
||||
// @ts-expect-error can't be a sentry error if undefined
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return event.exception.values[0].type === 'SentryError';
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function _getLastValidUrl(frames = []) {
|
||||
for (let i = frames.length - 1; i >= 0; i--) {
|
||||
const frame = frames[i];
|
||||
|
||||
if (frame && frame.filename !== '<anonymous>' && frame.filename !== '[native code]') {
|
||||
return frame.filename || null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function _getEventFilterUrl(event) {
|
||||
try {
|
||||
let frames;
|
||||
try {
|
||||
// @ts-expect-error we only care about frames if the whole thing here is defined
|
||||
frames = event.exception.values[0].stacktrace.frames;
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
return frames ? _getLastValidUrl(frames) : null;
|
||||
} catch (oO) {
|
||||
DEBUG_BUILD && logger.error(`Cannot extract url for event ${getEventDescription(event)}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export { InboundFilters, inboundFiltersIntegration };
|
||||
//# sourceMappingURL=inboundfilters.js.map
|
||||
1
node_modules/@sentry/core/esm/integrations/inboundfilters.js.map
generated
vendored
Normal file
1
node_modules/@sentry/core/esm/integrations/inboundfilters.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@sentry/core/esm/integrations/index.js
generated
vendored
Normal file
6
node_modules/@sentry/core/esm/integrations/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { FunctionToString } from './functiontostring.js';
|
||||
export { InboundFilters } from './inboundfilters.js';
|
||||
export { LinkedErrors } from './linkederrors.js';
|
||||
|
||||
/* eslint-disable deprecation/deprecation */
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@sentry/core/esm/integrations/index.js.map
generated
vendored
Normal file
1
node_modules/@sentry/core/esm/integrations/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../src/integrations/index.ts"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nexport { FunctionToString } from './functiontostring';\nexport { InboundFilters } from './inboundfilters';\nexport { LinkedErrors } from './linkederrors';\n"],"names":[],"mappings":";;;;AAAA"}
|
||||
45
node_modules/@sentry/core/esm/integrations/linkederrors.js
generated
vendored
Normal file
45
node_modules/@sentry/core/esm/integrations/linkederrors.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import { applyAggregateErrorsToEvent, exceptionFromError } from '@sentry/utils';
|
||||
import { convertIntegrationFnToClass, defineIntegration } from '../integration.js';
|
||||
|
||||
const DEFAULT_KEY = 'cause';
|
||||
const DEFAULT_LIMIT = 5;
|
||||
|
||||
const INTEGRATION_NAME = 'LinkedErrors';
|
||||
|
||||
const _linkedErrorsIntegration = ((options = {}) => {
|
||||
const limit = options.limit || DEFAULT_LIMIT;
|
||||
const key = options.key || DEFAULT_KEY;
|
||||
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
// TODO v8: Remove this
|
||||
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
|
||||
preprocessEvent(event, hint, client) {
|
||||
const options = client.getOptions();
|
||||
|
||||
applyAggregateErrorsToEvent(
|
||||
exceptionFromError,
|
||||
options.stackParser,
|
||||
options.maxValueLength,
|
||||
key,
|
||||
limit,
|
||||
event,
|
||||
hint,
|
||||
);
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);
|
||||
|
||||
/**
|
||||
* Adds SDK info to an event.
|
||||
* @deprecated Use `linkedErrorsIntegration()` instead.
|
||||
*/
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
const LinkedErrors = convertIntegrationFnToClass(INTEGRATION_NAME, linkedErrorsIntegration)
|
||||
|
||||
;
|
||||
|
||||
export { LinkedErrors, linkedErrorsIntegration };
|
||||
//# sourceMappingURL=linkederrors.js.map
|
||||
1
node_modules/@sentry/core/esm/integrations/linkederrors.js.map
generated
vendored
Normal file
1
node_modules/@sentry/core/esm/integrations/linkederrors.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"linkederrors.js","sources":["../../../src/integrations/linkederrors.ts"],"sourcesContent":["import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';\nimport { applyAggregateErrorsToEvent, exceptionFromError } from '@sentry/utils';\nimport { convertIntegrationFnToClass, defineIntegration } from '../integration';\n\ninterface LinkedErrorsOptions {\n key?: string;\n limit?: number;\n}\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\nconst INTEGRATION_NAME = 'LinkedErrors';\n\nconst _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n\n return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n\n applyAggregateErrorsToEvent(\n exceptionFromError,\n options.stackParser,\n options.maxValueLength,\n key,\n limit,\n event,\n hint,\n );\n },\n };\n}) satisfies IntegrationFn;\n\nexport const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);\n\n/**\n * Adds SDK info to an event.\n * @deprecated Use `linkedErrorsIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const LinkedErrors = convertIntegrationFnToClass(INTEGRATION_NAME, linkedErrorsIntegration) as IntegrationClass<\n Integration & { preprocessEvent: (event: Event, hint: EventHint, client: Client) => void }\n> & { new (options?: { key?: string; limit?: number }): Integration };\n"],"names":[],"mappings":";;;AASA,MAAM,WAAA,GAAc,OAAO,CAAA;AAC3B,MAAM,aAAA,GAAgB,CAAC,CAAA;AACvB;AACA,MAAM,gBAAA,GAAmB,cAAc,CAAA;AACvC;AACA,MAAM,wBAAA,IAA4B,CAAC,OAAO,GAAwB,EAAE,KAAK;AACzE,EAAE,MAAM,KAAM,GAAE,OAAO,CAAC,KAAA,IAAS,aAAa,CAAA;AAC9C,EAAE,MAAM,GAAI,GAAE,OAAO,CAAC,GAAA,IAAO,WAAW,CAAA;AACxC;AACA,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B;AACA,IAAI,SAAS,GAAG,EAAE;AAClB,IAAI,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;AACzC,MAAM,MAAM,OAAQ,GAAE,MAAM,CAAC,UAAU,EAAE,CAAA;AACzC;AACA,MAAM,2BAA2B;AACjC,QAAQ,kBAAkB;AAC1B,QAAQ,OAAO,CAAC,WAAW;AAC3B,QAAQ,OAAO,CAAC,cAAc;AAC9B,QAAQ,GAAG;AACX,QAAQ,KAAK;AACb,QAAQ,KAAK;AACb,QAAQ,IAAI;AACZ,OAAO,CAAA;AACP,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;MACa,uBAAwB,GAAE,iBAAiB,CAAC,wBAAwB,EAAC;AAClF;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,eAAe,2BAA2B,CAAC,gBAAgB,EAAE,uBAAuB,CAAE;;;;;;"}
|
||||
62
node_modules/@sentry/core/esm/integrations/metadata.js
generated
vendored
Normal file
62
node_modules/@sentry/core/esm/integrations/metadata.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { forEachEnvelopeItem } from '@sentry/utils';
|
||||
import { convertIntegrationFnToClass, defineIntegration } from '../integration.js';
|
||||
import { stripMetadataFromStackFrames, addMetadataToStackFrames } from '../metadata.js';
|
||||
|
||||
const INTEGRATION_NAME = 'ModuleMetadata';
|
||||
|
||||
const _moduleMetadataIntegration = (() => {
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
// TODO v8: Remove this
|
||||
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
|
||||
setup(client) {
|
||||
if (typeof client.on !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to strip metadata from stack frames before sending them to Sentry since these are client side only.
|
||||
client.on('beforeEnvelope', envelope => {
|
||||
forEachEnvelopeItem(envelope, (item, type) => {
|
||||
if (type === 'event') {
|
||||
const event = Array.isArray(item) ? (item )[1] : undefined;
|
||||
|
||||
if (event) {
|
||||
stripMetadataFromStackFrames(event);
|
||||
item[1] = event;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
processEvent(event, _hint, client) {
|
||||
const stackParser = client.getOptions().stackParser;
|
||||
addMetadataToStackFrames(stackParser, event);
|
||||
return event;
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
const moduleMetadataIntegration = defineIntegration(_moduleMetadataIntegration);
|
||||
|
||||
/**
|
||||
* Adds module metadata to stack frames.
|
||||
*
|
||||
* Metadata can be injected by the Sentry bundler plugins using the `_experiments.moduleMetadata` config option.
|
||||
*
|
||||
* When this integration is added, the metadata passed to the bundler plugin is added to the stack frames of all events
|
||||
* under the `module_metadata` property. This can be used to help in tagging or routing of events from different teams
|
||||
* our sources
|
||||
*
|
||||
* @deprecated Use `moduleMetadataIntegration()` instead.
|
||||
*/
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
const ModuleMetadata = convertIntegrationFnToClass(
|
||||
INTEGRATION_NAME,
|
||||
moduleMetadataIntegration,
|
||||
)
|
||||
|
||||
;
|
||||
|
||||
export { ModuleMetadata, moduleMetadataIntegration };
|
||||
//# sourceMappingURL=metadata.js.map
|
||||
1
node_modules/@sentry/core/esm/integrations/metadata.js.map
generated
vendored
Normal file
1
node_modules/@sentry/core/esm/integrations/metadata.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"metadata.js","sources":["../../../src/integrations/metadata.ts"],"sourcesContent":["import type { Client, Event, EventHint, EventItem, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';\nimport { forEachEnvelopeItem } from '@sentry/utils';\nimport { convertIntegrationFnToClass, defineIntegration } from '../integration';\n\nimport { addMetadataToStackFrames, stripMetadataFromStackFrames } from '../metadata';\n\nconst INTEGRATION_NAME = 'ModuleMetadata';\n\nconst _moduleMetadataIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function\n setup(client) {\n if (typeof client.on !== 'function') {\n return;\n }\n\n // We need to strip metadata from stack frames before sending them to Sentry since these are client side only.\n client.on('beforeEnvelope', envelope => {\n forEachEnvelopeItem(envelope, (item, type) => {\n if (type === 'event') {\n const event = Array.isArray(item) ? (item as EventItem)[1] : undefined;\n\n if (event) {\n stripMetadataFromStackFrames(event);\n item[1] = event;\n }\n }\n });\n });\n },\n\n processEvent(event, _hint, client) {\n const stackParser = client.getOptions().stackParser;\n addMetadataToStackFrames(stackParser, event);\n return event;\n },\n };\n}) satisfies IntegrationFn;\n\nexport const moduleMetadataIntegration = defineIntegration(_moduleMetadataIntegration);\n\n/**\n * Adds module metadata to stack frames.\n *\n * Metadata can be injected by the Sentry bundler plugins using the `_experiments.moduleMetadata` config option.\n *\n * When this integration is added, the metadata passed to the bundler plugin is added to the stack frames of all events\n * under the `module_metadata` property. This can be used to help in tagging or routing of events from different teams\n * our sources\n *\n * @deprecated Use `moduleMetadataIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const ModuleMetadata = convertIntegrationFnToClass(\n INTEGRATION_NAME,\n moduleMetadataIntegration,\n) as IntegrationClass<\n Integration & {\n setup: (client: Client) => void;\n processEvent: (event: Event, hint: EventHint, client: Client) => Event;\n }\n>;\n"],"names":[],"mappings":";;;;AAMA,MAAM,gBAAA,GAAmB,gBAAgB,CAAA;AACzC;AACA,MAAM,0BAA2B,IAAG,MAAM;AAC1C,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B;AACA,IAAI,SAAS,GAAG,EAAE;AAClB,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,IAAI,OAAO,MAAM,CAAC,EAAG,KAAI,UAAU,EAAE;AAC3C,QAAQ,OAAM;AACd,OAAM;AACN;AACA;AACA,MAAM,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,YAAY;AAC9C,QAAQ,mBAAmB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK;AACtD,UAAU,IAAI,IAAK,KAAI,OAAO,EAAE;AAChC,YAAY,MAAM,KAAM,GAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAE,GAAE,CAAC,IAAK,GAAc,CAAC,CAAA,GAAI,SAAS,CAAA;AAClF;AACA,YAAY,IAAI,KAAK,EAAE;AACvB,cAAc,4BAA4B,CAAC,KAAK,CAAC,CAAA;AACjD,cAAc,IAAI,CAAC,CAAC,CAAA,GAAI,KAAK,CAAA;AAC7B,aAAY;AACZ,WAAU;AACV,SAAS,CAAC,CAAA;AACV,OAAO,CAAC,CAAA;AACR,KAAK;AACL;AACA,IAAI,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE;AACvC,MAAM,MAAM,cAAc,MAAM,CAAC,UAAU,EAAE,CAAC,WAAW,CAAA;AACzD,MAAM,wBAAwB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;AAClD,MAAM,OAAO,KAAK,CAAA;AAClB,KAAK;AACL,GAAG,CAAA;AACH,CAAC,CAAE,EAAA;AACH;MACa,yBAA0B,GAAE,iBAAiB,CAAC,0BAA0B,EAAC;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,cAAe,GAAE,2BAA2B;AACzD,EAAE,gBAAgB;AAClB,EAAE,yBAAyB;AAC3B,CAAE;;;;;;"}
|
||||
175
node_modules/@sentry/core/esm/integrations/requestdata.js
generated
vendored
Normal file
175
node_modules/@sentry/core/esm/integrations/requestdata.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
import { extractPathForTransaction, addRequestDataToEvent } from '@sentry/utils';
|
||||
import { convertIntegrationFnToClass, defineIntegration } from '../integration.js';
|
||||
import { spanToJSON } from '../utils/spanUtils.js';
|
||||
|
||||
const DEFAULT_OPTIONS = {
|
||||
include: {
|
||||
cookies: true,
|
||||
data: true,
|
||||
headers: true,
|
||||
ip: false,
|
||||
query_string: true,
|
||||
url: true,
|
||||
user: {
|
||||
id: true,
|
||||
username: true,
|
||||
email: true,
|
||||
},
|
||||
},
|
||||
transactionNamingScheme: 'methodPath',
|
||||
};
|
||||
|
||||
const INTEGRATION_NAME = 'RequestData';
|
||||
|
||||
const _requestDataIntegration = ((options = {}) => {
|
||||
const _addRequestData = addRequestDataToEvent;
|
||||
const _options = {
|
||||
...DEFAULT_OPTIONS,
|
||||
...options,
|
||||
include: {
|
||||
// @ts-expect-error It's mad because `method` isn't a known `include` key. (It's only here and not set by default in
|
||||
// `addRequestDataToEvent` for legacy reasons. TODO (v8): Change that.)
|
||||
method: true,
|
||||
...DEFAULT_OPTIONS.include,
|
||||
...options.include,
|
||||
user:
|
||||
options.include && typeof options.include.user === 'boolean'
|
||||
? options.include.user
|
||||
: {
|
||||
...DEFAULT_OPTIONS.include.user,
|
||||
// Unclear why TS still thinks `options.include.user` could be a boolean at this point
|
||||
...((options.include || {}).user ),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
// TODO v8: Remove this
|
||||
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
|
||||
processEvent(event, _hint, client) {
|
||||
// Note: In the long run, most of the logic here should probably move into the request data utility functions. For
|
||||
// the moment it lives here, though, until https://github.com/getsentry/sentry-javascript/issues/5718 is addressed.
|
||||
// (TL;DR: Those functions touch many parts of the repo in many different ways, and need to be clened up. Once
|
||||
// that's happened, it will be easier to add this logic in without worrying about unexpected side effects.)
|
||||
const { transactionNamingScheme } = _options;
|
||||
|
||||
const { sdkProcessingMetadata = {} } = event;
|
||||
const req = sdkProcessingMetadata.request;
|
||||
|
||||
if (!req) {
|
||||
return event;
|
||||
}
|
||||
|
||||
// The Express request handler takes a similar `include` option to that which can be passed to this integration.
|
||||
// If passed there, we store it in `sdkProcessingMetadata`. TODO(v8): Force express and GCP people to use this
|
||||
// integration, so that all of this passing and conversion isn't necessary
|
||||
const addRequestDataOptions =
|
||||
sdkProcessingMetadata.requestDataOptionsFromExpressHandler ||
|
||||
sdkProcessingMetadata.requestDataOptionsFromGCPWrapper ||
|
||||
convertReqDataIntegrationOptsToAddReqDataOpts(_options);
|
||||
|
||||
const processedEvent = _addRequestData(event, req, addRequestDataOptions);
|
||||
|
||||
// Transaction events already have the right `transaction` value
|
||||
if (event.type === 'transaction' || transactionNamingScheme === 'handler') {
|
||||
return processedEvent;
|
||||
}
|
||||
|
||||
// In all other cases, use the request's associated transaction (if any) to overwrite the event's `transaction`
|
||||
// value with a high-quality one
|
||||
const reqWithTransaction = req ;
|
||||
const transaction = reqWithTransaction._sentryTransaction;
|
||||
if (transaction) {
|
||||
const name = spanToJSON(transaction).description || '';
|
||||
|
||||
// TODO (v8): Remove the nextjs check and just base it on `transactionNamingScheme` for all SDKs. (We have to
|
||||
// keep it the way it is for the moment, because changing the names of transactions in Sentry has the potential
|
||||
// to break things like alert rules.)
|
||||
const shouldIncludeMethodInTransactionName =
|
||||
getSDKName(client) === 'sentry.javascript.nextjs'
|
||||
? name.startsWith('/api')
|
||||
: transactionNamingScheme !== 'path';
|
||||
|
||||
const [transactionValue] = extractPathForTransaction(req, {
|
||||
path: true,
|
||||
method: shouldIncludeMethodInTransactionName,
|
||||
customRoute: name,
|
||||
});
|
||||
|
||||
processedEvent.transaction = transactionValue;
|
||||
}
|
||||
|
||||
return processedEvent;
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
const requestDataIntegration = defineIntegration(_requestDataIntegration);
|
||||
|
||||
/**
|
||||
* Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/integrations`
|
||||
* so it can be used in cross-platform SDKs like `@sentry/nextjs`.
|
||||
* @deprecated Use `requestDataIntegration()` instead.
|
||||
*/
|
||||
// eslint-disable-next-line deprecation/deprecation
|
||||
const RequestData = convertIntegrationFnToClass(INTEGRATION_NAME, requestDataIntegration)
|
||||
|
||||
;
|
||||
|
||||
/** Convert this integration's options to match what `addRequestDataToEvent` expects */
|
||||
/** TODO: Can possibly be deleted once https://github.com/getsentry/sentry-javascript/issues/5718 is fixed */
|
||||
function convertReqDataIntegrationOptsToAddReqDataOpts(
|
||||
integrationOptions,
|
||||
) {
|
||||
const {
|
||||
transactionNamingScheme,
|
||||
include: { ip, user, ...requestOptions },
|
||||
} = integrationOptions;
|
||||
|
||||
const requestIncludeKeys = [];
|
||||
for (const [key, value] of Object.entries(requestOptions)) {
|
||||
if (value) {
|
||||
requestIncludeKeys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
let addReqDataUserOpt;
|
||||
if (user === undefined) {
|
||||
addReqDataUserOpt = true;
|
||||
} else if (typeof user === 'boolean') {
|
||||
addReqDataUserOpt = user;
|
||||
} else {
|
||||
const userIncludeKeys = [];
|
||||
for (const [key, value] of Object.entries(user)) {
|
||||
if (value) {
|
||||
userIncludeKeys.push(key);
|
||||
}
|
||||
}
|
||||
addReqDataUserOpt = userIncludeKeys;
|
||||
}
|
||||
|
||||
return {
|
||||
include: {
|
||||
ip,
|
||||
user: addReqDataUserOpt,
|
||||
request: requestIncludeKeys.length !== 0 ? requestIncludeKeys : undefined,
|
||||
transaction: transactionNamingScheme,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function getSDKName(client) {
|
||||
try {
|
||||
// For a long chain like this, it's fewer bytes to combine a try-catch with assuming everything is there than to
|
||||
// write out a long chain of `a && a.b && a.b.c && ...`
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
return client.getOptions()._metadata.sdk.name;
|
||||
} catch (err) {
|
||||
// In theory we should never get here
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export { RequestData, requestDataIntegration };
|
||||
//# sourceMappingURL=requestdata.js.map
|
||||
1
node_modules/@sentry/core/esm/integrations/requestdata.js.map
generated
vendored
Normal file
1
node_modules/@sentry/core/esm/integrations/requestdata.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user